All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Public Member Functions | Private Member Functions | Private Attributes | List of all members
ShowerQuality Class Reference
Inheritance diagram for ShowerQuality:

Classes

struct  TreeParams_t
 For convenience: struct to define a set of parameters per shower to be stored in TTree. More...
 

Public Member Functions

 ShowerQuality (fhicl::ParameterSet const &p)
 
 ShowerQuality (ShowerQuality const &)=delete
 
 ShowerQuality (ShowerQuality &&)=delete
 
ShowerQualityoperator= (ShowerQuality const &)=delete
 
ShowerQualityoperator= (ShowerQuality &&)=delete
 

Private Member Functions

void analyze (art::Event const &e) override
 
void beginJob () override
 
void SetShowerProducer (const std::string name)
 
void SetMCShowerProducer (const std::string name)
 
void SetSimChannelProducer (const std::string name)
 
void SetMaxEnergyCut (const double energy)
 Set maximum energy for MCShowers to be considered. More...
 
void SetMinEnergyCut (const double energy)
 Set minimum energy for MCShowers to be considered. More...
 
template<class T >
art::Handle< T > GetDataOrDie (art::Event const &e, std::string producer)
 
void InitializeAnaTree ()
 Function to prepare TTree. More...
 

Private Attributes

::btutil::MCMatchAlg fBTAlg
 Shower back tracking algorithm. More...
 
double _mc_energy_min
 Minimum MC shower energy cut. More...
 
double _mc_energy_max
 Maximum MC shower energy cut. More...
 
std::string fShowerProducer
 Shower Producer's Name. More...
 
std::string fMCShowerProducer
 MCShower Producer's Name. More...
 
std::string fSimChannelProducer
 SimChannel Producer's Name. More...
 
TH1D * hMatchCorrectness
 Matching correctness. More...
 
TH1D * hVtxDX
 X difference (reco-MC) in cm. More...
 
TH1D * hVtxDY
 Y difference (reco-MC) in cm. More...
 
TH1D * hVtxDZ
 Z difference (reco-MC) in cm. More...
 
TH1D * hVtxDR
 3D vtx distance between reco to MC in cm More...
 
TH1D * hDCosX
 Direction unit vector X component difference. More...
 
TH1D * hDCosY
 Direction unit vector Y component difference. More...
 
TH1D * hDCosZ
 Direction unit vector Z component difference. More...
 
TH1D * h3DAngleDiff
 Opening angle between reco & MC 3D direction. More...
 
TH2D * hEnergyCorr
 Energy correlation reco (x) vs. MC (y) More...
 
TH1D * hEnergyAssym
 Energy assym. parameter: (reco E - MC E) / (reco E + MC E) * 2. More...
 
TH1D * hEnergyDiff
 Energy difference: reco E - MC E. More...
 
TH1D * hMatchedClusterEff
 Matched 3D shower's cluster efficiency (combined across planes) More...
 
TH1D * hMatchedClusterPur
 Matched 3D shower's cluster purity (combined across planes) More...
 
std::map< int, TH1D * > mDEDX
 dEdx per particle per PDG code More...
 
TH1D * hBestPlane
 Best plane id. More...
 
struct ShowerQuality::TreeParams_t fTreeParams
 
TTree * fTree
 Analysis TTree. More...
 

Detailed Description

Definition at line 34 of file ShowerQuality_module.cc.

Constructor & Destructor Documentation

ShowerQuality::ShowerQuality ( fhicl::ParameterSet const &  p)
explicit

Definition at line 181 of file ShowerQuality_module.cc.

181  : EDAnalyzer(p) // ,
182 // More initializers here.
183 {
184 
185  //fShowerProducer = "";
186  //fMCShowerProducer = "";
187  //fSimChannelProducer = "";
188  SetShowerProducer(p.get<std::string>("ShowerProducer"));
189  SetMCShowerProducer(p.get<std::string>("MCShowerProducer"));
190  SetSimChannelProducer(p.get<std::string>("SimChannelProducer"));
191  SetMinEnergyCut(p.get<double>("MCShowerEnergyMin"));
192  SetMaxEnergyCut(p.get<double>("MCShowerEnergyMax"));
193 
194  hMatchCorrectness = nullptr;
195 
196  hVtxDX = nullptr;
197  hVtxDY = nullptr;
198  hVtxDZ = nullptr;
199  hVtxDR = nullptr;
200 
201  hDCosX = nullptr;
202  hDCosY = nullptr;
203  hDCosZ = nullptr;
204  h3DAngleDiff = nullptr;
205 
206  hEnergyCorr = nullptr;
207  hEnergyAssym = nullptr;
208  hEnergyDiff = nullptr;
209 
210  hMatchedClusterPur = nullptr;
211  hMatchedClusterEff = nullptr;
212 
213  mDEDX.clear();
214  hBestPlane = nullptr;
215 
216  fTree = nullptr;
217 }
TH1D * hMatchedClusterPur
Matched 3D shower&#39;s cluster purity (combined across planes)
TH1D * hVtxDR
3D vtx distance between reco to MC in cm
void SetSimChannelProducer(const std::string name)
void SetMinEnergyCut(const double energy)
Set minimum energy for MCShowers to be considered.
TH1D * h3DAngleDiff
Opening angle between reco &amp; MC 3D direction.
std::map< int, TH1D * > mDEDX
dEdx per particle per PDG code
pdgs p
Definition: selectors.fcl:22
TH1D * hVtxDZ
Z difference (reco-MC) in cm.
TH1D * hVtxDX
X difference (reco-MC) in cm.
TH1D * hDCosX
Direction unit vector X component difference.
TH1D * hVtxDY
Y difference (reco-MC) in cm.
void SetShowerProducer(const std::string name)
TH1D * hEnergyAssym
Energy assym. parameter: (reco E - MC E) / (reco E + MC E) * 2.
TH1D * hEnergyDiff
Energy difference: reco E - MC E.
void SetMaxEnergyCut(const double energy)
Set maximum energy for MCShowers to be considered.
TH2D * hEnergyCorr
Energy correlation reco (x) vs. MC (y)
void SetMCShowerProducer(const std::string name)
TTree * fTree
Analysis TTree.
TH1D * hMatchCorrectness
Matching correctness.
TH1D * hDCosZ
Direction unit vector Z component difference.
TH1D * hMatchedClusterEff
Matched 3D shower&#39;s cluster efficiency (combined across planes)
TH1D * hDCosY
Direction unit vector Y component difference.
TH1D * hBestPlane
Best plane id.
ShowerQuality::ShowerQuality ( ShowerQuality const &  )
delete
ShowerQuality::ShowerQuality ( ShowerQuality &&  )
delete

Member Function Documentation

void ShowerQuality::analyze ( art::Event const &  e)
overrideprivate

Definition at line 351 of file ShowerQuality_module.cc.

352 {
353  // Retrieve mcshower data product
354  auto mcsHandle = GetDataOrDie<std::vector<sim::MCShower>>(e, fMCShowerProducer);
355  auto resHandle = GetDataOrDie<std::vector<recob::Shower>>(e, fShowerProducer);
356  auto schHandle = GetDataOrDie<std::vector<sim::SimChannel>>(e, fSimChannelProducer);
357  const std::vector<sim::MCShower>& ev_mcs(*mcsHandle);
358  const std::vector<recob::Shower>& ev_shower(*resHandle);
359  const std::vector<sim::SimChannel>& ev_simch(*schHandle);
360 
361  if (!(ev_shower.size())) return;
362 
363  // Get the whole clusters + associated clusters
364  art::Handle<std::vector<recob::Cluster>> clsHandle;
365  art::FindManyP<recob::Cluster> cluster_m(resHandle, e, fShowerProducer);
366  e.get(cluster_m.at(0).front().id(), clsHandle);
367  if (!clsHandle.isValid())
368  throw ::showerreco::ShowerRecoException("Failed to retrieve cluster handle!");
369  const std::vector<recob::Cluster>& ev_cluster(*clsHandle);
370 
371  // Make clusters in terms of hit vector to feed into BT algorithm
372  art::FindManyP<recob::Hit> hit_m(clsHandle, e, clsHandle.provenance()->moduleLabel());
373  std::vector<std::vector<art::Ptr<recob::Hit>>> ev_cluster_hit;
374  ev_cluster_hit.reserve(clsHandle->size());
375  std::map<art::Ptr<recob::Cluster>, size_t> cluster_ptr_map;
376  for (size_t i = 0; i < ev_cluster.size(); ++i) {
377  const art::Ptr<recob::Cluster> cluster_ptr(clsHandle, i);
378  cluster_ptr_map[cluster_ptr] = ev_cluster_hit.size();
379  ev_cluster_hit.push_back(hit_m.at(i));
380  }
381 
382  // Create ass_cluster_v index vector
383  std::vector<std::vector<unsigned int>> ass_cluster_v;
384  ass_cluster_v.reserve(ev_shower.size());
385  for (size_t shower_index = 0; shower_index < ev_shower.size(); ++shower_index) {
386  ass_cluster_v.push_back(std::vector<unsigned int>());
387  for (auto const& p : cluster_m.at(shower_index))
388  ass_cluster_v.back().push_back(cluster_ptr_map[p]);
389  }
390 
391  // Create G4 track ID vector for which we are interested in
392  std::vector<std::vector<unsigned int>> g4_trackid_v;
393  std::vector<unsigned int> mc_index_v;
394  g4_trackid_v.reserve(ev_mcs.size());
395  for (size_t mc_index = 0; mc_index < ev_mcs.size(); ++mc_index) {
396  auto const& mcs = ev_mcs[mc_index];
397  double energy = mcs.DetProfile().E();
398  std::vector<unsigned int> id_v;
399  id_v.reserve(mcs.DaughterTrackID().size());
400  if (_mc_energy_min < energy && energy < _mc_energy_max) {
401  for (auto const& id : mcs.DaughterTrackID()) {
402  if (id == mcs.TrackID()) continue;
403  id_v.push_back(id);
404  }
405  id_v.push_back(mcs.TrackID());
406  g4_trackid_v.push_back(id_v);
407  mc_index_v.push_back(mc_index);
408  }
409  }
410 
411  auto const clockData = art::ServiceHandle<detinfo::DetectorClocksService const>()->DataFor(e);
412  if (!fBTAlg.BuildMap(clockData, g4_trackid_v, ev_simch, ev_cluster_hit)) {
413  std::cerr << "\033[93m[ERROR]\033[00m <<ShowerQuality::analyze>> Failed to "
414  "build back-tracking map for MC..."
415  << std::endl;
416  return;
417  }
418 
419  // Find the best-representative reco-ed Shower given an MCShower
420  std::vector<std::vector<double>> shower_mcq_vv(ev_shower.size(),
421  std::vector<double>(mc_index_v.size(), 0));
422 
423  for (size_t shower_index = 0; shower_index < ass_cluster_v.size(); ++shower_index) {
424 
425  auto const& ass_cluster = ass_cluster_v[shower_index];
426 
427  std::vector<::btutil::WireRange_t> w_v;
428 
429  for (auto const& cluster_index : ass_cluster) {
430 
431  auto const& ass_hit = ev_cluster_hit[cluster_index];
432 
433  w_v.reserve(ass_hit.size() + w_v.size());
434 
435  for (auto const& hit_ptr : ass_hit) {
436  w_v.emplace_back(hit_ptr->Channel(), hit_ptr->StartTick(), hit_ptr->EndTick());
437  }
438  }
439 
440  auto mcq_v = fBTAlg.BTAlg().MCQ(clockData, w_v);
441 
442  auto& shower_mcq_v = shower_mcq_vv[shower_index];
443 
444  for (size_t mcs_index = 0; mcs_index < (mcq_v.size() - 1); ++mcs_index) {
445 
446  shower_mcq_v[mcs_index] = mcq_v[mcs_index];
447  }
448  }
449 
450  // Loop over MCShower and inspect corresponding shower quality
451  for (size_t mcs_index = 0; mcs_index < mc_index_v.size(); ++mcs_index) {
452 
453  auto const& mc_shower = ev_mcs[mc_index_v[mcs_index]];
454 
455  // Search for the best representative shower
456  size_t best_shower_index = shower_mcq_vv.size();
457  double max_mcq = 0;
458  for (size_t shower_index = 0; shower_index < shower_mcq_vv.size(); ++shower_index) {
459 
460  if (shower_mcq_vv[shower_index][mcs_index] > max_mcq) best_shower_index = shower_index;
461  }
462 
463  if (best_shower_index == shower_mcq_vv.size()) {
464  std::string msg;
465  std::cerr << "\033[93m[ERROR]\033[00m <<ShowerQuality::analyze>> "
466  << "Failed to find a corresponding shower for MCShower " << mc_index_v[mcs_index]
467  << std::endl;
468  continue;
469  }
470 
471  auto const& reco_shower = ev_shower[best_shower_index];
472 
473  auto res = fBTAlg.ShowerCorrectness(ass_cluster_v[best_shower_index]);
474 
475  fTreeParams.match_correctness = res.second;
476 
477  if (fTreeParams.match_correctness < 0) {
478  std::cerr << "\033[93m[ERROR]\033[00m <<ShowerQuality::analyze>> "
479  << "Failed to find a corresponding MCShower for shower " << best_shower_index
480  << std::endl;
481  continue;
482  }
483 
484  // MC Info
485  fTreeParams.mc_x = mc_shower.DetProfile().X();
486  fTreeParams.mc_y = mc_shower.DetProfile().Y();
487  fTreeParams.mc_z = mc_shower.DetProfile().Z();
488 
489  fTreeParams.mc_energy = mc_shower.DetProfile().E();
490  fTreeParams.mc_pdgid = mc_shower.PdgCode();
491  fTreeParams.mc_containment = mc_shower.DetProfile().E() / mc_shower.Start().E();
492 
493  //fTreeParams.mc_dcosx = mc_shower.DetProfile().Px() / fTreeParams.mc_energy;
494  //fTreeParams.mc_dcosy = mc_shower.DetProfile().Py() / fTreeParams.mc_energy;
495  //fTreeParams.mc_dcosz = mc_shower.DetProfile().Pz() / fTreeParams.mc_energy;
496  fTreeParams.mc_dcosx = mc_shower.Start().Px() / mc_shower.Start().E();
497  fTreeParams.mc_dcosy = mc_shower.Start().Py() / mc_shower.Start().E();
498  fTreeParams.mc_dcosz = mc_shower.Start().Pz() / mc_shower.Start().E();
499 
500  // Reco vtx
501  fTreeParams.reco_x = reco_shower.ShowerStart()[0];
502  fTreeParams.reco_y = reco_shower.ShowerStart()[1];
503  fTreeParams.reco_z = reco_shower.ShowerStart()[2];
504 
505  // Reco angle
506  fTreeParams.reco_dcosx = reco_shower.Direction()[0];
507  fTreeParams.reco_dcosy = reco_shower.Direction()[1];
508  fTreeParams.reco_dcosz = reco_shower.Direction()[2];
509 
510  // Reco - MC angle diff
514  3.14159265359 * 180.;
515  // Reco - MC vtx distance
517  pow(fTreeParams.reco_y - fTreeParams.mc_y, 2) +
518  pow(fTreeParams.reco_z - fTreeParams.mc_z, 2));
519 
520  // Reco cluster efficiency & purity
523  for (auto const& cluster_index : ass_cluster_v[best_shower_index]) {
524  auto ep = fBTAlg.ClusterEP(cluster_index, mcs_index);
525  if (ep.first == 0 && ep.second == 0) continue;
526  fTreeParams.cluster_eff *= ep.first;
527  fTreeParams.cluster_pur *= ep.second;
528  }
529 
530  // Reco energy & dedx info
531  fTreeParams.best_plane_id = reco_shower.best_plane();
532 
533  /*
534  int best_plane_index = -1;
535 
536  for(size_t i=0; i < ass_cluster_v[best_shower_index].size(); ++i) {
537 
538  size_t cluster_index = ass_cluster_v[best_shower_index][i];
539  //std::cout<<best_plane_index<<" : "<<ev_cluster->at(cluster_index).View()<<std::endl;
540  if( ev_cluster->at(cluster_index).View() == reco_shower.best_plane() ) {
541  best_plane_index = i;
542  break;
543  }
544  }
545 
546  if(best_plane_index < 0) {
547  throw ::showerreco::ShowerRecoException(Form("Failed to identify the best plane for shower %zu",
548  best_shower_index)
549  );
550  }
551  */
552 
553  fTreeParams.reco_energy = reco_shower.Energy().at(reco_shower.best_plane());
554  //fTreeParams.reco_dedx_U = reco_shower.dEdx().at(0);
555  //fTreeParams.reco_dedx_V = reco_shower.dEdx().at(1);
556  //fTreeParams.reco_dedx_Y = reco_shower.dEdx().at(2);
557  fTreeParams.reco_dedx = reco_shower.dEdx().at(reco_shower.best_plane());
558 
559  //
560  // Fill histograms
561  //
563 
568 
569  // Angular info
574 
576 
579 
581 
582  if (mDEDX.find(fTreeParams.mc_pdgid) == mDEDX.end())
583 
584  mDEDX.insert(std::make_pair(
586  new TH1D(Form("hdEdx_PDG_%d", fTreeParams.mc_pdgid),
587  Form("Reco dE/dx for PDG = %d; dE/dx [MeV/cm]; Showers", fTreeParams.mc_pdgid),
588  100,
589  0,
590  50)));
591 
594 
596 
598 
599  // Fill Tree
600  fTree->Fill();
601  }
602 }
TH1D * hMatchedClusterPur
Matched 3D shower&#39;s cluster purity (combined across planes)
TH1D * hVtxDR
3D vtx distance between reco to MC in cm
BEGIN_PROLOG could also be cerr
TH1D * h3DAngleDiff
Opening angle between reco &amp; MC 3D direction.
std::map< int, TH1D * > mDEDX
dEdx per particle per PDG code
pdgs p
Definition: selectors.fcl:22
const MCBTAlg & BTAlg() const
BTAlgo getter.
Definition: MCMatchAlg.h:93
TH1D * hVtxDZ
Z difference (reco-MC) in cm.
std::string fMCShowerProducer
MCShower Producer&#39;s Name.
TH1D * hVtxDX
X difference (reco-MC) in cm.
bool BuildMap(detinfo::DetectorClocksData const &clockData, const std::vector< unsigned int > &g4_trackid_v, const std::vector< sim::SimChannel > &simch_v, const std::vector< std::vector< art::Ptr< recob::Hit >>> &cluster_v)
Constructs needed information for Reco=&gt;MC matching.
Definition: MCMatchAlg.cxx:19
TH1D * hDCosX
Direction unit vector X component difference.
TH1D * hVtxDY
Y difference (reco-MC) in cm.
TH1D * hEnergyAssym
Energy assym. parameter: (reco E - MC E) / (reco E + MC E) * 2.
std::pair< double, double > ClusterEP(const size_t cluster_index, const size_t mcshower_index) const
For a specified cluster, compute cluster efficiency and purity in terms of specified MC object...
Definition: MCMatchAlg.cxx:191
TH1D * hEnergyDiff
Energy difference: reco E - MC E.
std::string fShowerProducer
Shower Producer&#39;s Name.
std::vector< double > MCQ(detinfo::DetectorClocksData const &clockData, const WireRange_t &hit) const
Definition: MCBTAlg.cxx:106
::btutil::MCMatchAlg fBTAlg
Shower back tracking algorithm.
double _mc_energy_min
Minimum MC shower energy cut.
TH2D * hEnergyCorr
Energy correlation reco (x) vs. MC (y)
struct ShowerQuality::TreeParams_t fTreeParams
do i e
TTree * fTree
Analysis TTree.
TH1D * hMatchCorrectness
Matching correctness.
TH1D * hDCosZ
Direction unit vector Z component difference.
double _mc_energy_max
Maximum MC shower energy cut.
TH1D * hMatchedClusterEff
Matched 3D shower&#39;s cluster efficiency (combined across planes)
std::pair< size_t, double > ShowerCorrectness(const std::vector< unsigned int > cluster_indices) const
Definition: MCMatchAlg.cxx:150
TH1D * hDCosY
Direction unit vector Y component difference.
std::string fSimChannelProducer
SimChannel Producer&#39;s Name.
TH1D * hBestPlane
Best plane id.
void ShowerQuality::beginJob ( )
overrideprivate

Definition at line 220 of file ShowerQuality_module.cc.

221 {
222 
223  if (fShowerProducer.empty() || fMCShowerProducer.empty() || fSimChannelProducer.empty()) {
224  std::string msg;
225  msg += "\033[93m[ERROR]\033[00m <<";
226  msg += __FUNCTION__;
227  msg += ">> Producer's name not set!";
228  std::cout << msg.c_str() << std::endl;
229  throw ::showerreco::ShowerRecoException(msg.c_str());
230  }
231 
232  art::ServiceHandle<geo::Geometry const> geo;
233  art::ServiceHandle<art::TFileService const> tfs;
234 
235  if (fTree) delete fTree;
236  fTree = tfs->make<TTree>("fShowerQualityTree", "");
237 
238  //
239  // Matching correctness histogram initialization
240  //
243  tfs->make<TH1D>("hMatchCorrectness",
244  "Shower 2D Cluster Matching Correctness; Correctness; Showers",
245  101,
246  -0.005,
247  1.005);
248 
249  //
250  // 3D Vtx (start point) MC/Reco comparison histogram initialization
251  //
252  if (hVtxDX) delete hVtxDX;
253  if (hVtxDY) delete hVtxDY;
254  if (hVtxDZ) delete hVtxDZ;
255  if (hVtxDR) delete hVtxDR;
256 
257  hVtxDX = tfs->make<TH1D>(
258  "hVtxDX", "Reco - MC Start X [cm] Displacement; #DeltaX [cm]; Showers", 200, -100, 100);
259 
260  hVtxDY = tfs->make<TH1D>(
261  "hVtxDY", "Reco - MC Start Y [cm] Displacement; #DeltaY [cm]; Showers", 200, -100, 100);
262 
263  hVtxDZ = tfs->make<TH1D>(
264  "hVtxDZ", "Reco - MC Start Z [cm] Displacement; #DeltaZ [cm]; Showers", 200, -100, 100);
265 
266  hVtxDR = tfs->make<TH1D>(
267  "hVtxDR", "Reco - MC Start 3D Vtx Displacement; #DeltaR [cm]; Showers", 200, -100, 100);
268 
269  //
270  // 3D Angular MC/Reco comparison histogram initialization
271  //
272  if (hDCosX) delete hDCosX;
273  if (hDCosY) delete hDCosY;
274  if (hDCosZ) delete hDCosZ;
275  if (h3DAngleDiff) delete h3DAngleDiff;
276 
277  hDCosX = tfs->make<TH1D>(
278  "hDCosX", "Direction Unit Vector Reco - MC #DeltaX; #DeltaCosX; Showers", 100, -2, 2);
279 
280  hDCosY = tfs->make<TH1D>(
281  "hDCosY", "Direction Unit Vector Reco - MC #DeltaY; #DeltaCosY; Showers", 100, -2, 2);
282 
283  hDCosZ = tfs->make<TH1D>(
284  "hDCosZ", "Direction Unit Vector Reco - MC #DeltaZ; #DeltaCosZ; Showers", 100, -2, 2);
285 
286  h3DAngleDiff =
287  tfs->make<TH1D>("h3DAngleDiff",
288  "3D Opening Angle Between Reco & MC; Opening Angle [degrees]; Showers",
289  181,
290  -0.5,
291  180.5);
292 
293  //
294  // Energy MC/Reco comparison histogram initialization
295  //
296  if (hEnergyCorr) delete hEnergyCorr;
297  if (hEnergyAssym) delete hEnergyAssym;
298  if (hEnergyDiff) delete hEnergyDiff;
299 
300  hEnergyCorr =
301  tfs->make<TH2D>("hEnergyCorr",
302  "Reco (x) vs. MC (y) Energy Comparison; Reco Energy [MeV]; MC Energy [MeV]",
303  200,
304  0,
305  1000,
306  200,
307  0,
308  1000);
309 
310  hEnergyAssym = tfs->make<TH1D>("hEnergyAssym",
311  "MC - Reco Energy Fractional Difference; Assymetry; Showers",
312  201,
313  -1.005,
314  1.005);
315 
316  hEnergyDiff = tfs->make<TH1D>(
317  "hEnergyDiff", "MC - Reco Energy Difference; Energy Difference [MeV]; Showers", 200, 0, 1000);
318 
319  //
320  // Shower cluster purity & efficiency histograms initialization
321  //
324 
326  tfs->make<TH1D>("hMatchedClusterEff_PlaneCombo",
327  "Matched Shower Cluster's Charge Efficiency; Efficiency; Clusters",
328  101,
329  -0.005,
330  1.005);
331 
332  hMatchedClusterPur = tfs->make<TH1D>("hMatchedClusterPur_PlaneCombo",
333  "Matched Shower Cluster's Charge Purity; Purity; Clusters",
334  101,
335  -0.005,
336  1.005);
337 
338  //
339  // Best plane ID histogram initialization
340  //
341  hBestPlane = tfs->make<TH1D>("hBestPlane",
342  "Best Plane (for energy & dE/dx estimate); Plane ID; Showers",
343  geo->Nplanes(),
344  -0.5,
345  geo->Nplanes() - 0.5);
346 
348 }
TH1D * hMatchedClusterPur
Matched 3D shower&#39;s cluster purity (combined across planes)
TH1D * hVtxDR
3D vtx distance between reco to MC in cm
TH1D * h3DAngleDiff
Opening angle between reco &amp; MC 3D direction.
TH1D * hVtxDZ
Z difference (reco-MC) in cm.
std::string fMCShowerProducer
MCShower Producer&#39;s Name.
TH1D * hVtxDX
X difference (reco-MC) in cm.
TH1D * hDCosX
Direction unit vector X component difference.
TH1D * hVtxDY
Y difference (reco-MC) in cm.
TH1D * hEnergyAssym
Energy assym. parameter: (reco E - MC E) / (reco E + MC E) * 2.
TH1D * hEnergyDiff
Energy difference: reco E - MC E.
std::string fShowerProducer
Shower Producer&#39;s Name.
TH2D * hEnergyCorr
Energy correlation reco (x) vs. MC (y)
void InitializeAnaTree()
Function to prepare TTree.
TTree * fTree
Analysis TTree.
TH1D * hMatchCorrectness
Matching correctness.
TH1D * hDCosZ
Direction unit vector Z component difference.
TH1D * hMatchedClusterEff
Matched 3D shower&#39;s cluster efficiency (combined across planes)
art::ServiceHandle< art::TFileService > tfs
TH1D * hDCosY
Direction unit vector Y component difference.
std::string fSimChannelProducer
SimChannel Producer&#39;s Name.
TH1D * hBestPlane
Best plane id.
BEGIN_PROLOG could also be cout
template<class T >
art::Handle<T> ShowerQuality::GetDataOrDie ( art::Event const &  e,
std::string  producer 
)
inlineprivate

Definition at line 87 of file ShowerQuality_module.cc.

88  {
89  art::Handle<T> h;
90  e.getByLabel(producer, h);
91  if (!h.isValid()) {
92  std::string msg;
93  msg += "Could not find a data product by: " + producer;
94  std::cout << msg.c_str() << std::endl;
96  }
97  return h;
98  }
while getopts h
do i e
BEGIN_PROLOG could also be cout
void ShowerQuality::InitializeAnaTree ( )
private

Function to prepare TTree.

Definition at line 605 of file ShowerQuality_module.cc.

606 {
607 
608  fTree->Branch("reco_x", &fTreeParams.reco_x, "reco_x/D");
609  fTree->Branch("reco_y", &fTreeParams.reco_y, "reco_y/D");
610  fTree->Branch("reco_z", &fTreeParams.reco_z, "reco_z/D");
611  fTree->Branch("reco_dcosx", &fTreeParams.reco_dcosx, "reco_dcosx/D");
612  fTree->Branch("reco_dcosy", &fTreeParams.reco_dcosy, "reco_dcosy/D");
613  fTree->Branch("reco_dcosz", &fTreeParams.reco_dcosz, "reco_dcosz/D");
614  fTree->Branch("reco_energy", &fTreeParams.reco_energy, "reco_energy/D");
615 
616  fTree->Branch("best_plane_id", &fTreeParams.best_plane_id, "best_plane_id/i");
617 
618  fTree->Branch("mc_x", &fTreeParams.mc_x, "mc_x/D");
619  fTree->Branch("mc_y", &fTreeParams.mc_y, "mc_y/D");
620  fTree->Branch("mc_z", &fTreeParams.mc_z, "mc_z/D");
621  fTree->Branch("mc_dcosx", &fTreeParams.mc_dcosx, "mc_dcosx/D");
622  fTree->Branch("mc_dcosy", &fTreeParams.mc_dcosy, "mc_dcosy/D");
623  fTree->Branch("mc_dcosz", &fTreeParams.mc_dcosz, "mc_dcosz/D");
624  fTree->Branch("mc_energy", &fTreeParams.mc_energy, "mc_energy/D");
625 
626  fTree->Branch("reco_dedx", &fTreeParams.reco_dedx, "reco_dedx_/D");
627  fTree->Branch("reco_dedx_U", &fTreeParams.reco_dedx_U, "reco_dedx_U/D");
628  fTree->Branch("reco_dedx_V", &fTreeParams.reco_dedx_V, "reco_dedx_V/D");
629  fTree->Branch("reco_dedx_Y", &fTreeParams.reco_dedx_Y, "reco_dedx_Y/D");
630  fTree->Branch("mc_pdgid", &fTreeParams.mc_pdgid, "mc_pdgid/i");
631 
632  fTree->Branch("mc_reco_anglediff", &fTreeParams.mc_reco_anglediff, "mc_reco_anglediff/D");
633  fTree->Branch("mc_reco_dist", &fTreeParams.mc_reco_dist, "mc_reco_dist/D");
634 
635  fTree->Branch("mc_containment", &fTreeParams.mc_containment, "mc_containment/D");
636 
637  fTree->Branch("match_correctness", &fTreeParams.match_correctness, "match_correctness/D");
638  fTree->Branch("cluster_eff", &fTreeParams.cluster_eff, "cluster_eff/D");
639  fTree->Branch("cluster_pur", &fTreeParams.cluster_pur, "cluster_pur/D");
640 }
struct ShowerQuality::TreeParams_t fTreeParams
TTree * fTree
Analysis TTree.
ShowerQuality& ShowerQuality::operator= ( ShowerQuality const &  )
delete
ShowerQuality& ShowerQuality::operator= ( ShowerQuality &&  )
delete
void ShowerQuality::SetMaxEnergyCut ( const double  energy)
inlineprivate

Set maximum energy for MCShowers to be considered.

Definition at line 73 of file ShowerQuality_module.cc.

74  {
75  _mc_energy_max = energy;
76  }
double _mc_energy_max
Maximum MC shower energy cut.
void ShowerQuality::SetMCShowerProducer ( const std::string  name)
inlineprivate

Definition at line 61 of file ShowerQuality_module.cc.

62  {
64  }
std::string fMCShowerProducer
MCShower Producer&#39;s Name.
then echo fcl name
void ShowerQuality::SetMinEnergyCut ( const double  energy)
inlineprivate

Set minimum energy for MCShowers to be considered.

Definition at line 80 of file ShowerQuality_module.cc.

81  {
82  _mc_energy_min = energy;
83  }
double _mc_energy_min
Minimum MC shower energy cut.
void ShowerQuality::SetShowerProducer ( const std::string  name)
inlineprivate

Setter function for a shower producer name.

Definition at line 56 of file ShowerQuality_module.cc.

57  {
59  }
std::string fShowerProducer
Shower Producer&#39;s Name.
then echo fcl name
void ShowerQuality::SetSimChannelProducer ( const std::string  name)
inlineprivate

Definition at line 66 of file ShowerQuality_module.cc.

67  {
69  }
then echo fcl name
std::string fSimChannelProducer
SimChannel Producer&#39;s Name.

Member Data Documentation

double ShowerQuality::_mc_energy_max
private

Maximum MC shower energy cut.

Definition at line 107 of file ShowerQuality_module.cc.

double ShowerQuality::_mc_energy_min
private

Minimum MC shower energy cut.

Definition at line 104 of file ShowerQuality_module.cc.

::btutil::MCMatchAlg ShowerQuality::fBTAlg
private

Shower back tracking algorithm.

Definition at line 101 of file ShowerQuality_module.cc.

std::string ShowerQuality::fMCShowerProducer
private

MCShower Producer's Name.

Definition at line 113 of file ShowerQuality_module.cc.

std::string ShowerQuality::fShowerProducer
private

Shower Producer's Name.

Definition at line 110 of file ShowerQuality_module.cc.

std::string ShowerQuality::fSimChannelProducer
private

SimChannel Producer's Name.

Definition at line 116 of file ShowerQuality_module.cc.

TTree* ShowerQuality::fTree
private

Analysis TTree.

Definition at line 173 of file ShowerQuality_module.cc.

struct ShowerQuality::TreeParams_t ShowerQuality::fTreeParams
private
TH1D* ShowerQuality::h3DAngleDiff
private

Opening angle between reco & MC 3D direction.

Definition at line 129 of file ShowerQuality_module.cc.

TH1D* ShowerQuality::hBestPlane
private

Best plane id.

Definition at line 143 of file ShowerQuality_module.cc.

TH1D* ShowerQuality::hDCosX
private

Direction unit vector X component difference.

Definition at line 126 of file ShowerQuality_module.cc.

TH1D* ShowerQuality::hDCosY
private

Direction unit vector Y component difference.

Definition at line 127 of file ShowerQuality_module.cc.

TH1D* ShowerQuality::hDCosZ
private

Direction unit vector Z component difference.

Definition at line 128 of file ShowerQuality_module.cc.

TH1D* ShowerQuality::hEnergyAssym
private

Energy assym. parameter: (reco E - MC E) / (reco E + MC E) * 2.

Definition at line 133 of file ShowerQuality_module.cc.

TH2D* ShowerQuality::hEnergyCorr
private

Energy correlation reco (x) vs. MC (y)

Definition at line 131 of file ShowerQuality_module.cc.

TH1D* ShowerQuality::hEnergyDiff
private

Energy difference: reco E - MC E.

Definition at line 134 of file ShowerQuality_module.cc.

TH1D* ShowerQuality::hMatchCorrectness
private

Matching correctness.

Definition at line 119 of file ShowerQuality_module.cc.

TH1D* ShowerQuality::hMatchedClusterEff
private

Matched 3D shower's cluster efficiency (combined across planes)

Definition at line 136 of file ShowerQuality_module.cc.

TH1D* ShowerQuality::hMatchedClusterPur
private

Matched 3D shower's cluster purity (combined across planes)

Definition at line 137 of file ShowerQuality_module.cc.

TH1D* ShowerQuality::hVtxDR
private

3D vtx distance between reco to MC in cm

Definition at line 124 of file ShowerQuality_module.cc.

TH1D* ShowerQuality::hVtxDX
private

X difference (reco-MC) in cm.

Definition at line 121 of file ShowerQuality_module.cc.

TH1D* ShowerQuality::hVtxDY
private

Y difference (reco-MC) in cm.

Definition at line 122 of file ShowerQuality_module.cc.

TH1D* ShowerQuality::hVtxDZ
private

Z difference (reco-MC) in cm.

Definition at line 123 of file ShowerQuality_module.cc.

std::map<int, TH1D*> ShowerQuality::mDEDX
private

dEdx per particle per PDG code

Definition at line 140 of file ShowerQuality_module.cc.


The documentation for this class was generated from the following file: