LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
ems::MultiEMShowers Class Reference
Inheritance diagram for ems::MultiEMShowers:
art::EDAnalyzer art::EventObserverBase art::Consumer art::EngineCreator

Public Types

using WorkerType = WorkerT< EDAnalyzer >
 
using ModuleType = EDAnalyzer
 

Public Member Functions

 MultiEMShowers (fhicl::ParameterSet const &p)
 
 MultiEMShowers (MultiEMShowers const &)=delete
 
 MultiEMShowers (MultiEMShowers &&)=delete
 
MultiEMShowersoperator= (MultiEMShowers const &)=delete
 
MultiEMShowersoperator= (MultiEMShowers &&)=delete
 
void beginJob () override
 
void endJob () override
 
void analyze (art::Event const &e) override
 
void reconfigure (fhicl::ParameterSet const &p)
 
std::string workerType () const
 
bool modifiesEvent () const
 
void registerProducts (MasterProductRegistry &, ProductDescriptions &, ModuleDescription const &)
 
std::string const & processName () const
 
bool wantAllEvents () const
 
bool wantEvent (Event const &e)
 
fhicl::ParameterSetID selectorConfig () const
 
art::Handle< art::TriggerResultsgetTriggerResults (Event const &e) const
 
template<typename T , BranchType = InEvent>
ProductToken< T > consumes (InputTag const &)
 
template<typename T , art::BranchType BT>
art::ProductToken< T > consumes (InputTag const &it)
 
template<typename T , BranchType = InEvent>
void consumesMany ()
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > consumesView (InputTag const &)
 
template<typename T , art::BranchType BT>
art::ViewToken< T > consumesView (InputTag const &it)
 
template<typename T , BranchType = InEvent>
ProductToken< T > mayConsume (InputTag const &)
 
template<typename T , art::BranchType BT>
art::ProductToken< T > mayConsume (InputTag const &it)
 
template<typename T , BranchType = InEvent>
void mayConsumeMany ()
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > mayConsumeView (InputTag const &)
 
template<typename T , art::BranchType BT>
art::ViewToken< T > mayConsumeView (InputTag const &it)
 
base_engine_tcreateEngine (seed_t seed)
 
base_engine_tcreateEngine (seed_t seed, std::string const &kind_of_engine_to_make)
 
base_engine_tcreateEngine (seed_t seed, std::string const &kind_of_engine_to_make, label_t const &engine_label)
 
seed_t get_seed_value (fhicl::ParameterSet const &pset, char const key[]="seed", seed_t const implicit_seed=-1)
 

Static Public Member Functions

static cet::exempt_ptr< Consumernon_module_context ()
 

Protected Member Functions

CurrentProcessingContext const * currentContext () const
 
detail::CachedProducts & cachedProducts ()
 
void validateConsumedProduct (BranchType const bt, ProductInfo const &pi)
 
void prepareForJob (fhicl::ParameterSet const &pset)
 
void showMissingConsumes () const
 

Private Member Functions

bool convCluster (art::Event const &evt)
 
double getMinDist (std::vector< art::Ptr< recob::Hit > > const &v, TVector3 const &convmc, size_t view, size_t tpc, size_t cryo)
 

Private Attributes

int fConvGood
 
int fConvWrong
 
int fConvBothGood
 
int fGammasInside
 
TTree * fEvTree
 
int fEvNumber
 
int fNGroups
 
double fPi0mom
 
double fGmom1
 
double fGmom2
 
double fMcth
 
int fNgammas
 
int fEvFidVol
 
int fEvComp
 
int fEvGMomCut
 
int fEvInput
 
TVector3 fGdir1
 
TVector3 fGdir2
 
TVector3 fPrimary
 
int fEvReco
 
int fEv2Groups
 
int fEv2Good
 
int fCountph
 
int fCountreco
 
TTree * fShTree
 
TTree * fRecoTree
 
double fStartX
 
double fStartY
 
double fStartZ
 
double fDedxZ
 
double fDedxV
 
double fDedxU
 
double fMCrecovtx
 
double fMCrecoTh
 
double fMCrecovtxgood
 
double fMCrecoThgood
 
double fRecth
 
double fRecthgood
 
double fDistConvrecomc1
 
double fDistConvrecomc2
 
double fGdirmcreco1
 
double fGdirmcreco2
 
double fGdirmcreco1good
 
double fGdirmcreco2good
 
art::InputTag fHitsModuleLabel
 
art::InputTag fCluModuleLabel
 
art::InputTag fTrk3DModuleLabel
 
art::InputTag fVtxModuleLabel
 
art::InputTag fShsModuleLabel
 

Detailed Description

Definition at line 238 of file MultiEMShowers_module.cc.

Member Typedef Documentation

Definition at line 39 of file EDAnalyzer.h.

Definition at line 38 of file EDAnalyzer.h.

Constructor & Destructor Documentation

ems::MultiEMShowers::MultiEMShowers ( fhicl::ParameterSet const &  p)
explicit

Definition at line 309 of file MultiEMShowers_module.cc.

References fConvBothGood, fConvGood, fConvWrong, fEv2Good, fEv2Groups, fEvComp, fEvFidVol, fEvGMomCut, fEvInput, fEvReco, and reconfigure().

310  :
311  EDAnalyzer(p)
312 {
313  fConvGood = 0;
314  fConvWrong = 0;
315  fConvBothGood = 0;
316  fEvFidVol = 0;
317  fEvComp = 0;
318  fEvGMomCut = 0;
319  fEvReco = 0;
320  fEvInput = 0;
321  fEv2Groups = 0;
322  fEv2Good = 0;
323  reconfigure(p);
324 }
EDAnalyzer(Table< Config > const &config)
Definition: EDAnalyzer.h:100
void reconfigure(fhicl::ParameterSet const &p)
ems::MultiEMShowers::MultiEMShowers ( MultiEMShowers const &  )
delete
ems::MultiEMShowers::MultiEMShowers ( MultiEMShowers &&  )
delete

Member Function Documentation

void ems::MultiEMShowers::analyze ( art::Event const &  e)
overridevirtual

Implements art::EDAnalyzer.

Definition at line 395 of file MultiEMShowers_module.cc.

References convCluster(), recob::Shower::dEdx(), recob::Shower::Direction(), pma::Dist2(), art::EventID::event(), fCluModuleLabel, fConvBothGood, fConvGood, fConvWrong, fCountph, fCountreco, fDedxU, fDedxV, fDedxZ, fDistConvrecomc1, fDistConvrecomc2, fEv2Good, fEv2Groups, fEvComp, fEvFidVol, fEvGMomCut, fEvInput, fEvNumber, fEvReco, fEvTree, fGammasInside, fGdir1, fGdir2, fGdirmcreco1, fGdirmcreco1good, fGdirmcreco2, fGdirmcreco2good, fGmom1, fGmom2, fHitsModuleLabel, fMCrecoTh, fMCrecoThgood, fMCrecovtx, fMCrecovtxgood, fMcth, fNgammas, fNGroups, fPi0mom, fPrimary, fRecoTree, fRecth, fRecthgood, fShsModuleLabel, fShTree, fStartX, fStartY, fStartZ, fTrk3DModuleLabel, fVtxModuleLabel, art::DataViewImpl::getByLabel(), ems::MCinfo::GetCosine(), ems::MCinfo::GetDirgamma1(), ems::MCinfo::GetDirgamma2(), ems::MCinfo::GetMomGamma1(), ems::MCinfo::GetMomGamma2(), ems::MCinfo::GetMompi0(), ems::MCinfo::GetNgammas(), ems::MCinfo::GetPosgamma1(), ems::MCinfo::GetPosgamma2(), ems::MCinfo::GetPospi0(), ems::MCinfo::GetPrimary(), art::Event::id(), ems::MCinfo::IsCompton(), ems::MCinfo::IsInside1(), ems::MCinfo::IsInside2(), s, recob::Shower::ShowerStart(), and pma::SolveLeastSquares3D().

396 {
397  fEvNumber = e.id().event();
398  fNGroups = 0;
399  fStartX = 0.0; fStartY = 0.0; fStartZ = 0.0;
400  fPi0mom = 0.0; fNgammas = 0;
401  fDistConvrecomc1 = 0.0; fDistConvrecomc2 = 0.0;
402  fMCrecovtx = -400.0;
403  fMCrecovtxgood = -400.0;
404  fRecth = -400.0;
405  fRecthgood = -400.0;
406  fMCrecoTh = -400.0;
407  fMCrecoThgood = -400.0;
408  fGammasInside = 0;
409  fCountph = 0;
410  fCountreco = 0;
411  fGdirmcreco1 = 0.0;
412  fGdirmcreco2 = 0.0;
413  fGdirmcreco1good = 0.0;
414  fGdirmcreco2good = 0.0;
415  fDedxZ = 0.0; fDedxV = 0.0; fDedxU = 0.0;
416 
417  ems::MCinfo mc(e);
418  fPrimary = mc.GetPrimary();
419  fPi0mom = mc.GetMompi0();
420  fGmom1 = mc.GetMomGamma1();
421  fGmom2 = mc.GetMomGamma2();
422  fGdir1 = mc.GetDirgamma1();
423  fGdir2 = mc.GetDirgamma2();
424  fNgammas = mc.GetNgammas();
425  TVector3 pospi0 = mc.GetPospi0();
426 
427  double cosinemc = mc.GetCosine();
428  fMcth = 180.0F * (std::acos(cosinemc)) / TMath::Pi();
429  TVector3 convp[2];
430  convp[0] = mc.GetPosgamma1();
431  convp[1] = mc.GetPosgamma2();
432  const double maxdist = 2.0; //cm
433 
434  // check whether two photons are inside fid vol
435  if (mc.IsInside1() && mc.IsInside2())
436  {
437  fGammasInside = 1;
438  fEvFidVol++;
439  }
440 
441  if ((fGmom1 > 0.1) && (fGmom2 > 0.1)) fEvGMomCut++;
442 
443  if (mc.IsCompton()) fEvComp++;
444 
449  art::Handle< std::vector<recob::Hit> > hitListHandle;
450  if (e.getByLabel(fShsModuleLabel, shsListHandle) &&
451  e.getByLabel(fTrk3DModuleLabel, trkListHandle) &&
452  e.getByLabel(fVtxModuleLabel, vtxListHandle) &&
453  e.getByLabel(fCluModuleLabel, cluListHandle) &&
454  e.getByLabel(fHitsModuleLabel, hitListHandle))
455  {
456  art::FindManyP< recob::Cluster > cluFromShs(shsListHandle, e, fShsModuleLabel);
457  art::FindManyP< recob::Cluster > cluFromTrk(trkListHandle, e, fTrk3DModuleLabel);
458  art::FindManyP< recob::Vertex > vtxFromTrk(trkListHandle, e, fVtxModuleLabel);
459  art::FindManyP< recob::Hit > hitFromClu(cluListHandle, e, fCluModuleLabel);
460 
461  fNGroups = shsListHandle->size();
462 
463  fCountph = 0;
464  if (fNgammas == 2) // pi0
465  {
466  int idph = -1;
467  for (size_t s = 0; s < shsListHandle->size(); ++s)
468  {
469  const recob::Shower& sh = (*shsListHandle)[s];
470  double mindist = maxdist; bool found = false;
471 
472  for (int i = 0; i < fNgammas; ++i)
473  {
474  double dist = sqrt(pma::Dist2(sh.ShowerStart(), convp[i]));
475  if ((dist < mindist) && (idph != i))
476  { mindist = dist; idph = i; found = true; }
477  }
478  if (found) { fConvGood++; fCountph++; }
479  else { fConvWrong++; }
480  }
481  if (fCountph == 2) fConvBothGood++;
482 
483  // plot a few variables if there are 2 showers
484  if (fCountph == 2)
485  for (size_t s = 0; s < shsListHandle->size(); ++s)
486  {
487  const recob::Shower& sh = (*shsListHandle)[s];
488  TVector3 pos = sh.ShowerStart();
489  fStartX = pos.X(); fStartY = pos.Y(); fStartZ = pos.Z();
490  std::vector<double> const& vecdedx = sh.dEdx();
491 
492  if (vecdedx.size() == 3)
493  {
494  fDedxZ = vecdedx[0]; fDedxV = vecdedx[1]; fDedxU = vecdedx[2];
495  }
496 
497  fShTree->Fill();
498  }
499  }
500  else // other than pi0
501  {
502  for (size_t s = 0; s < shsListHandle->size(); ++s)
503  {
504  const recob::Shower& sh = (*shsListHandle)[s];
505  double mindist = maxdist;
506 
507  double dist = sqrt(pma::Dist2(sh.ShowerStart(), fPrimary));
508  if (dist < mindist)
509  {
510  TVector3 pos = sh.ShowerStart();
511  fStartX = pos.X(); fStartY = pos.Y(); fStartZ = pos.Z();
512  std::vector<double> vecdedx = sh.dEdx();
513  if (vecdedx.size() == 3)
514  {
515  fDedxZ = vecdedx[0]; fDedxV = vecdedx[1]; fDedxU = vecdedx[2];
516  }
517  }
518 
519  fShTree->Fill();
520  }
521  }
522  // compute the crossing point
523 
524  //cut from mc and clusters
525 
526  if (mc.IsInside1() && mc.IsInside2() && (fGmom1 > 0.1) && (fGmom2 > 0.1) && (!mc.IsCompton()) && convCluster(e))
527  {
528  fCountreco = 1;
529  if (fNGroups == 2) fEv2Groups++;
530  if ((fNGroups == 2) && (fCountph == 2)) fEv2Good++;
531  // cut from reco
532  //if (countph == 2)
533  if (fNGroups == 2)
534  {
535  std::vector< std::pair<TVector3, TVector3> > lines;
536  const recob::Shower& sh1 = (*shsListHandle)[0];
537  const recob::Shower& sh2 = (*shsListHandle)[1];
538 
539  std::pair<TVector3, TVector3> frontback1(sh1.ShowerStart(), sh1.ShowerStart() + sh1.Direction());
540  std::pair<TVector3, TVector3> frontback2(sh2.ShowerStart(), sh2.ShowerStart() + sh2.Direction());
541  lines.push_back(frontback1); lines.push_back(frontback2);
542 
543  TVector3 result;
544  pma::SolveLeastSquares3D(lines, result); // mse.
545 
546  double dist1_0 = pma::Dist2(result, sh1.ShowerStart());
547  double dist2_0 = pma::Dist2(result, sh1.ShowerStart() + sh1.Direction());
548  double dist1_1 = pma::Dist2(result, sh2.ShowerStart());
549  double dist2_1 = pma::Dist2(result, sh2.ShowerStart() + sh2.Direction());
550  if ((dist1_0 > dist2_0) || (dist1_1 > dist2_1)) {}
551  else
552  {
553  fMCrecovtx = std::sqrt(pma::Dist2(pospi0, result));
554 
555  if (fCountph == 2) fMCrecovtxgood = fMCrecovtx;
556 
557  double cosine_reco = sh1.Direction() * sh2.Direction();
558  fRecth = 180.0F * (std::acos(cosine_reco)) / TMath::Pi();
559 
560  fGdirmcreco1 = fGdir1 * sh1.Direction();
561  fGdirmcreco2 = fGdir2 * sh2.Direction();
562  if (fCountph == 2)
563  {
566  }
567 
568  if (fCountph == 2) fRecthgood = fRecth;
569 
570  fMCrecoTh = fRecth - fMcth;
571 
572  if (fCountph == 2) fMCrecoThgood = fMCrecoTh;
573 
574  fEvReco++;
575  fRecoTree->Fill();
576  }
577  }
578  fEvInput++;
579  //fRecoTree->Fill();
580  }
581  }
582 
583  fEvTree->Fill();
584 }
Float_t s
Definition: plot.C:23
const TVector3 & ShowerStart() const
Definition: Shower.h:192
double Dist2(const TVector2 &v1, const TVector2 &v2)
Definition: Utilities.cxx:19
bool convCluster(art::Event const &evt)
const std::vector< double > & dEdx() const
Definition: Shower.h:203
const TVector3 & Direction() const
Definition: Shower.h:189
double SolveLeastSquares3D(const std::vector< std::pair< TVector3, TVector3 > > &lines, TVector3 &result)
Definition: Utilities.cxx:176
Float_t e
Definition: plot.C:34
void ems::MultiEMShowers::beginJob ( )
overridevirtual

Reimplemented from art::EDAnalyzer.

Definition at line 337 of file MultiEMShowers_module.cc.

References fConvBothGood, fConvGood, fConvWrong, fCountph, fCountreco, fDedxU, fDedxV, fDedxZ, fEvNumber, fEvTree, fGammasInside, fGdirmcreco1, fGdirmcreco1good, fGdirmcreco2, fGdirmcreco2good, fGmom1, fGmom2, fMCrecoTh, fMCrecoThgood, fMCrecovtx, fMCrecovtxgood, fMcth, fNgammas, fNGroups, fPi0mom, fRecoTree, fRecth, fRecthgood, fShTree, fStartX, fStartY, fStartZ, and art::TFileDirectory::make().

338 {
340 
341  fEvTree = tfs->make<TTree>("MultiShowers", "showers3d");
342  fEvTree->Branch("fEvNumber", &fEvNumber, "fEvNumber/I");
343  fEvTree->Branch("fNGroups", &fNGroups, "fNGroups/I");
344  fEvTree->Branch("fPi0mom", &fPi0mom, "fPi0mom/D");
345  fEvTree->Branch("fNgammas", &fNgammas, "fNgammas/I");
346  fEvTree->Branch("fGmom1", &fGmom1, "fGmom1/D");
347  fEvTree->Branch("fGmom2", &fGmom2, "fGmom2/D");
348  fEvTree->Branch("fMcth", &fMcth, "fMcth/D");
349  fEvTree->Branch("fRecth", &fRecth, "fRecth/D");
350  fEvTree->Branch("fMCrecovtx", &fMCrecovtx, "fMCrecovtx/D");
351  fEvTree->Branch("fMCrecoTh", &fMCrecoTh, "fMCrecoTh/D");
352  fEvTree->Branch("fConvGood", &fConvGood, "fConvGood/I");
353  fEvTree->Branch("fConvWrong", &fConvWrong, "fConvWrong/I");
354  fEvTree->Branch("fConvBothGood", &fConvBothGood, "fConvBothGood/I");
355  fEvTree->Branch("fGammasInside", &fGammasInside, "fGammasInside/I");
356  fEvTree->Branch("fCountph", &fCountph, "fCountph/I");
357  fEvTree->Branch("fCountreco", &fCountreco, "fCountreco/I");
358 
359  fRecoTree = tfs->make<TTree>("Cascades", "conv points");
360  fRecoTree->Branch("fRecth", &fRecth, "fRecth/D");
361  fRecoTree->Branch("fMCrecovtx", &fMCrecovtx, "fMCrecovtx/D");
362  fRecoTree->Branch("fMCrecoTh", &fMCrecoTh, "fMCrecoTh/D");
363  fRecoTree->Branch("fRecthgood", &fRecthgood, "fRecthgood/D");
364  fRecoTree->Branch("fMCrecovtxgood", &fMCrecovtxgood, "fMCrecovtxgood/D");
365  fRecoTree->Branch("fMCrecoThgood", &fMCrecoThgood, "fMCrecoThgood/D");
366  fRecoTree->Branch("fGdirmcreco1", &fGdirmcreco1, "fGdirmcreco1/D");
367  fRecoTree->Branch("fGdirmcreco2", &fGdirmcreco2, "fGdirmcreco2/D");
368  fRecoTree->Branch("fGdirmcreco1good", &fGdirmcreco1good, "fGdirmcreco1good/D");
369  fRecoTree->Branch("fGdirmcreco2good", &fGdirmcreco2good, "fGdirmcreco2good/D");
370 
371  fShTree = tfs->make<TTree>("Shower", "conv point");
372 
373  fShTree->Branch("fStartX", &fStartX, "fStartX/D");
374  fShTree->Branch("fStartY", &fStartY, "fStartY/D");
375  fShTree->Branch("fStartZ", &fStartZ, "fStartZ/D");
376  fShTree->Branch("fDedxZ", &fDedxZ, "fDedxZ/D");
377  fShTree->Branch("fDedxV", &fDedxV, "fDedxV/D");
378  fShTree->Branch("fDedxU", &fDedxU, "fDedxU/D");
379 }
T * make(ARGS...args) const
detail::CachedProducts& art::EventObserverBase::cachedProducts ( )
inlineprotectedinherited

Definition at line 79 of file EventObserverBase.h.

References art::EventObserverBase::selectors_.

Referenced by art::EDAnalyzer::doEvent(), and art::OutputModule::doWriteEvent().

80  {
81  return selectors_;
82  }
detail::CachedProducts selectors_
template<typename T , BranchType = InEvent>
ProductToken<T> art::Consumer::consumes ( InputTag const &  )
inherited
template<typename T , art::BranchType BT>
art::ProductToken<T> art::Consumer::consumes ( InputTag const &  it)
inherited

Definition at line 147 of file Consumer.h.

References art::InputTag::instance(), art::InputTag::label(), and art::InputTag::process().

148 {
149  if (!moduleContext_)
150  return ProductToken<T>::invalid();
151 
152  consumables_[BT].emplace_back(ConsumableType::Product,
153  TypeID{typeid(T)},
154  it.label(),
155  it.instance(),
156  it.process());
157  return ProductToken<T>{it};
158 }
static ProductToken< T > invalid()
Definition: ProductToken.h:47
ConsumableProducts consumables_
Definition: Consumer.h:138
bool moduleContext_
Definition: Consumer.h:136
template<typename T , art::BranchType BT>
void art::Consumer::consumesMany ( )
inherited

Definition at line 162 of file Consumer.h.

163 {
164  if (!moduleContext_)
165  return;
166 
167  consumables_[BT].emplace_back(ConsumableType::Many, TypeID{typeid(T)});
168 }
ConsumableProducts consumables_
Definition: Consumer.h:138
bool moduleContext_
Definition: Consumer.h:136
template<typename Element , BranchType = InEvent>
ViewToken<Element> art::Consumer::consumesView ( InputTag const &  )
inherited
template<typename T , art::BranchType BT>
art::ViewToken<T> art::Consumer::consumesView ( InputTag const &  it)
inherited

Definition at line 172 of file Consumer.h.

References art::InputTag::instance(), art::InputTag::label(), and art::InputTag::process().

173 {
174  if (!moduleContext_)
175  return ViewToken<T>::invalid();
176 
177  consumables_[BT].emplace_back(ConsumableType::ViewElement,
178  TypeID{typeid(T)},
179  it.label(),
180  it.instance(),
181  it.process());
182  return ViewToken<T>{it};
183 }
static ViewToken< Element > invalid()
Definition: ProductToken.h:75
ConsumableProducts consumables_
Definition: Consumer.h:138
bool moduleContext_
Definition: Consumer.h:136
bool ems::MultiEMShowers::convCluster ( art::Event const &  evt)
private

Definition at line 587 of file MultiEMShowers_module.cc.

References geo::GeometryCore::Cryostat(), fCluModuleLabel, fHitsModuleLabel, geo::GeometryCore::FindCryostatAtPosition(), geo::GeometryCore::FindTPCAtPosition(), art::DataViewImpl::getByLabel(), getMinDist(), ems::MCinfo::GetPosgamma1(), ems::MCinfo::GetPosgamma2(), geo::GeometryCore::HasTPC(), hits(), geo::CryostatGeo::MaxPlanes(), and geo::TPCID::TPC.

Referenced by analyze().

588 {
589  ems::MCinfo mc(evt);
590  TVector3 convp[2];
591  convp[0] = mc.GetPosgamma1();
592  convp[1] = mc.GetPosgamma2();
593 
594  double vtx[3] = {convp[0].X(), convp[0].Y(), convp[0].Z()};
595 
597  geo::TPCID idtpc = geom->FindTPCAtPosition(vtx);
598  size_t cryoid = geom->FindCryostatAtPosition(vtx);
599 
600  art::Handle< std::vector<recob::Hit> > hitListHandle;
602 
603  //map: conversion point, vec of id clusters in each view
604  std::map < size_t, std::vector< size_t > > used;
605 
606 
607  art::FindManyP< recob::Hit > fbc(cluListHandle, evt, fCluModuleLabel);
608 
609  double maxdist = 1.0; // 1 cm
610  if (geom->HasTPC(idtpc))
611  {
612  const geo::CryostatGeo& cryostat = geom->Cryostat(cryoid);
613  if (evt.getByLabel(fHitsModuleLabel, hitListHandle) &&
614  evt.getByLabel(fCluModuleLabel, cluListHandle))
615  {
616  size_t conv = 0;
617  while (conv < 2)
618  {
619  for (size_t view = 0; view < cryostat.MaxPlanes(); view++)
620  {
621 
622  double mindist = maxdist; int clid = 0;
623  for (size_t c = 0; c < cluListHandle->size(); ++c)
624  {
625 
626  bool exist = false;
627  for (auto const & ids : used)
628  for (auto i : ids.second)
629  if (i == c) exist = true;
630  if (exist) continue;
631 
632  std::vector< art::Ptr<recob::Hit> > hits = fbc.at(c);
633  if (hits.size() < 20) continue;
634  if (hits[0]->WireID().Plane != view) continue;
635 
636  double dist = getMinDist(hits, convp[conv], view, idtpc.TPC, cryoid);
637  if (dist < mindist)
638  {
639  mindist = dist;
640  clid = c;
641  }
642  }
643  if (mindist < maxdist) used[conv].push_back(clid);
644  }
645  conv++;
646  }
647  }
648  }
649  bool result = false;
650 
651  if (used.size() > 1)
652  for (auto const & ids : used)
653  {
654  if (ids.second.size() > 1) result = true;
655  else {result = false; break;}
656  }
657 
658  return result;
659 }
unsigned int MaxPlanes() const
Returns the largest number of planes among the TPCs in this cryostat.
Geometry information for a single cryostat.
Definition: CryostatGeo.h:36
geo::TPCID FindTPCAtPosition(double const worldLoc[3]) const
Returns the ID of the TPC at specified location.
void hits()
Definition: readHits.C:15
CryostatGeo const & Cryostat(geo::CryostatID const &cryoid) const
Returns the specified cryostat.
The data type to uniquely identify a TPC.
Definition: geo_types.h:195
bool HasTPC(geo::TPCID const &tpcid) const
Returns whether we have the specified TPC.
double getMinDist(std::vector< art::Ptr< recob::Hit > > const &v, TVector3 const &convmc, size_t view, size_t tpc, size_t cryo)
TCEvent evt
Definition: DataStructs.cxx:5
TPCID_t TPC
Index of the TPC within its cryostat.
Definition: geo_types.h:203
geo::CryostatID::CryostatID_t FindCryostatAtPosition(geo::Point_t const &worldLoc) const
Returns the index of the cryostat at specified location.
EngineCreator::base_engine_t & EngineCreator::createEngine ( seed_t  seed,
std::string const &  kind_of_engine_to_make 
)
inherited

Definition at line 32 of file EngineCreator.cc.

References art::EngineCreator::rng().

34 {
35  return rng()->createEngine(
36  placeholder_schedule_id(), seed, kind_of_engine_to_make);
37 }
long seed
Definition: chem4.cc:68
static art::ServiceHandle< art::RandomNumberGenerator > & rng()
EngineCreator::base_engine_t & EngineCreator::createEngine ( seed_t  seed,
std::string const &  kind_of_engine_to_make,
label_t const &  engine_label 
)
inherited

Definition at line 40 of file EngineCreator.cc.

References art::EngineCreator::rng().

43 {
44  return rng()->createEngine(
45  placeholder_schedule_id(), seed, kind_of_engine_to_make, engine_label);
46 }
long seed
Definition: chem4.cc:68
static art::ServiceHandle< art::RandomNumberGenerator > & rng()
CurrentProcessingContext const * art::EDAnalyzer::currentContext ( ) const
protectedinherited

Definition at line 114 of file EDAnalyzer.cc.

References art::EDAnalyzer::current_context_.

Referenced by art::EDAnalyzer::workerType().

115  {
116  return current_context_.get();
117  }
CPC_exempt_ptr current_context_
Definition: EDAnalyzer.h:179
void ems::MultiEMShowers::endJob ( )
overridevirtual

Reimplemented from art::EDAnalyzer.

Definition at line 381 of file MultiEMShowers_module.cc.

References fEv2Good, fEv2Groups, fEvComp, fEvFidVol, fEvGMomCut, fEvInput, and fEvReco.

382 {
383  mf::LogInfo log("MultiEMShower");
384  log << "******************** fEvFidVol = " << fEvFidVol << "\n";
385  log << "******************** fEvGMomCut = " << fEvGMomCut << "\n";
386  log << "******************** fEvComp = " << fEvComp << "\n";
387  log << "******************** fEvReco = " << fEvReco << "\n";
388  log << "******************** fEvInput = " << fEvInput << "\n";
389  log << "******************** fEv2Groups = " << fEv2Groups << "\n";
390  log << "******************** fEv2Good = " << fEv2Good << "\n";
391  if (fEvInput)
392  log << "******************** reco % = " << double(fEvReco)/double(fEvInput) << "\n";
393 }
EngineCreator::seed_t EngineCreator::get_seed_value ( fhicl::ParameterSet const &  pset,
char const  key[] = "seed",
seed_t const  implicit_seed = -1 
)
inherited

Definition at line 49 of file EngineCreator.cc.

References fhicl::ParameterSet::get().

Referenced by art::MixFilter< T >::initEngine_().

52 {
53  auto const& explicit_seeds = pset.get<std::vector<int>>(key, {});
54  return explicit_seeds.empty() ? implicit_seed : explicit_seeds.front();
55 }
double ems::MultiEMShowers::getMinDist ( std::vector< art::Ptr< recob::Hit > > const &  v,
TVector3 const &  convmc,
size_t  view,
size_t  tpc,
size_t  cryo 
)
private

Definition at line 661 of file MultiEMShowers_module.cc.

References DEFINE_ART_MODULE, pma::Dist2(), pma::GetProjectionToPlane(), proj, and pma::WireDriftToCm().

Referenced by convCluster().

664 {
665  double mindist = 9999;
666  // MC vertex projected to view
667  TVector2 proj = pma::GetProjectionToPlane(convmc, view, tpc, cryo);
668 
669  // loop over hits to find the closest to MC 2d vtx
670  for (size_t h = 0; h < v.size(); ++h)
671  {
672  if ((v[h]->WireID().Plane == view) &&
673  (v[h]->WireID().TPC == tpc))
674  {
675  TVector2 hpoint = pma::WireDriftToCm(v[h]->WireID().Wire, v[h]->PeakTime(), view, tpc, cryo);
676 
677  double dist = pma::Dist2(proj, hpoint);
678  if (dist < mindist)
679  {
680  mindist = dist;
681  }
682  }
683  }
684 
685  return mindist;
686 }
double Dist2(const TVector2 &v1, const TVector2 &v2)
Definition: Utilities.cxx:19
TVector2 WireDriftToCm(unsigned int wire, float drift, unsigned int plane, unsigned int tpc, unsigned int cryo)
Definition: Utilities.cxx:296
TVector2 GetProjectionToPlane(const TVector3 &p, unsigned int plane, unsigned int tpc, unsigned int cryo)
Definition: Utilities.cxx:280
Float_t proj
Definition: plot.C:34
recob::tracking::Plane Plane
Definition: TrackState.h:17
art::Handle<art::TriggerResults> art::EventObserverBase::getTriggerResults ( Event const &  e) const
inlineinherited

Definition at line 61 of file EventObserverBase.h.

References art::detail::CachedProducts::getOneTriggerResults(), and art::EventObserverBase::selectors_.

Referenced by art::OutputModule::doWriteEvent().

62  {
64  }
detail::CachedProducts selectors_
art::Handle< art::TriggerResults > getOneTriggerResults(Event const &) const
Float_t e
Definition: plot.C:34
template<typename T , BranchType = InEvent>
ProductToken<T> art::Consumer::mayConsume ( InputTag const &  )
inherited
template<typename T , art::BranchType BT>
art::ProductToken<T> art::Consumer::mayConsume ( InputTag const &  it)
inherited

Definition at line 190 of file Consumer.h.

References art::InputTag::instance(), art::InputTag::label(), and art::InputTag::process().

191 {
192  if (!moduleContext_)
193  return ProductToken<T>::invalid();
194 
195  consumables_[BT].emplace_back(ConsumableType::Product,
196  TypeID{typeid(T)},
197  it.label(),
198  it.instance(),
199  it.process());
200  return ProductToken<T>{it};
201 }
static ProductToken< T > invalid()
Definition: ProductToken.h:47
ConsumableProducts consumables_
Definition: Consumer.h:138
bool moduleContext_
Definition: Consumer.h:136
template<typename T , art::BranchType BT>
void art::Consumer::mayConsumeMany ( )
inherited

Definition at line 205 of file Consumer.h.

206 {
207  if (!moduleContext_)
208  return;
209 
210  consumables_[BT].emplace_back(ConsumableType::Many, TypeID{typeid(T)});
211 }
ConsumableProducts consumables_
Definition: Consumer.h:138
bool moduleContext_
Definition: Consumer.h:136
template<typename Element , BranchType = InEvent>
ViewToken<Element> art::Consumer::mayConsumeView ( InputTag const &  )
inherited
template<typename T , art::BranchType BT>
art::ViewToken<T> art::Consumer::mayConsumeView ( InputTag const &  it)
inherited

Definition at line 215 of file Consumer.h.

References art::InputTag::instance(), art::InputTag::label(), and art::InputTag::process().

216 {
217  if (!moduleContext_)
218  return ViewToken<T>::invalid();
219 
220  consumables_[BT].emplace_back(ConsumableType::ViewElement,
221  TypeID{typeid(T)},
222  it.label(),
223  it.instance(),
224  it.process());
225  return ViewToken<T>{it};
226 }
static ViewToken< Element > invalid()
Definition: ProductToken.h:75
ConsumableProducts consumables_
Definition: Consumer.h:138
bool moduleContext_
Definition: Consumer.h:136
bool art::EventObserverBase::modifiesEvent ( ) const
inlineinherited

Definition at line 25 of file EventObserverBase.h.

26  {
27  return false;
28  }
MultiEMShowers& ems::MultiEMShowers::operator= ( MultiEMShowers const &  )
delete
MultiEMShowers& ems::MultiEMShowers::operator= ( MultiEMShowers &&  )
delete
void art::Consumer::prepareForJob ( fhicl::ParameterSet const &  pset)
protectedinherited

Definition at line 89 of file Consumer.cc.

References fhicl::ParameterSet::get_if_present().

Referenced by art::EDProducer::doBeginJob(), art::EDFilter::doBeginJob(), and art::EDAnalyzer::doBeginJob().

90 {
91  if (!moduleContext_)
92  return;
93 
94  pset.get_if_present("errorOnMissingConsumes", requireConsumes_);
95  for (auto& consumablesPerBranch : consumables_) {
96  cet::sort_all(consumablesPerBranch);
97  }
98 }
bool requireConsumes_
Definition: Consumer.h:137
ConsumableProducts consumables_
Definition: Consumer.h:138
bool moduleContext_
Definition: Consumer.h:136
std::string const& art::EventObserverBase::processName ( ) const
inlineinherited
void ems::MultiEMShowers::reconfigure ( fhicl::ParameterSet const &  p)

Definition at line 326 of file MultiEMShowers_module.cc.

References fCluModuleLabel, fHitsModuleLabel, fShsModuleLabel, fTrk3DModuleLabel, fVtxModuleLabel, and fhicl::ParameterSet::get().

Referenced by MultiEMShowers().

327 {
328  fHitsModuleLabel = p.get< art::InputTag >("HitsModuleLabel");
329  fCluModuleLabel = p.get< art::InputTag >("ClustersModuleLabel");
330  fTrk3DModuleLabel = p.get< art::InputTag >("Trk3DModuleLabel");
331  fVtxModuleLabel = p.get< art::InputTag >("VtxModuleLabel");
332  fShsModuleLabel = p.get< art::InputTag >("ShsModuleLabel");
333 
334  return;
335 }
void art::EventObserverBase::registerProducts ( MasterProductRegistry ,
ProductDescriptions ,
ModuleDescription const &   
)
inlineinherited

Definition at line 33 of file EventObserverBase.h.

36  {}
fhicl::ParameterSetID art::EventObserverBase::selectorConfig ( ) const
inlineinherited

Definition at line 56 of file EventObserverBase.h.

References art::EventObserverBase::selector_config_id_.

Referenced by art::RootOutputFile::writeOne().

57  {
58  return selector_config_id_;
59  }
fhicl::ParameterSetID selector_config_id_
void art::Consumer::showMissingConsumes ( ) const
protectedinherited

Definition at line 125 of file Consumer.cc.

Referenced by art::EDProducer::doEndJob(), art::EDFilter::doEndJob(), art::EDAnalyzer::doEndJob(), and art::RootOutput::endJob().

126 {
127  if (!moduleContext_)
128  return;
129 
130  // If none of the branches have missing consumes statements, exit early.
131  if (std::all_of(cbegin(missingConsumes_),
132  cend(missingConsumes_),
133  [](auto const& perBranch) { return perBranch.empty(); }))
134  return;
135 
136  constexpr cet::HorizontalRule rule{60};
137  mf::LogPrint log{"MTdiagnostics"};
138  log << '\n'
139  << rule('=') << '\n'
140  << "The following consumes (or mayConsume) statements are missing from\n"
141  << module_context(moduleDescription_) << '\n'
142  << rule('-') << '\n';
143 
144  cet::for_all_with_index(
145  missingConsumes_, [&log](std::size_t const i, auto const& perBranch) {
146  for (auto const& pi : perBranch) {
147  log << " "
148  << assemble_consumes_statement(static_cast<BranchType>(i), pi)
149  << '\n';
150  }
151  });
152  log << rule('=');
153 }
cet::exempt_ptr< ModuleDescription const > moduleDescription_
Definition: Consumer.h:140
constexpr T pi()
Returns the constant pi (up to 35 decimal digits of precision)
bool moduleContext_
Definition: Consumer.h:136
ConsumableProductSets missingConsumes_
Definition: Consumer.h:139
void art::Consumer::validateConsumedProduct ( BranchType const  bt,
ProductInfo const &  pi 
)
protectedinherited

Definition at line 101 of file Consumer.cc.

References art::errors::ProductRegistrationFailure.

103 {
104  // Early exits if consumes tracking has been disabled or if the
105  // consumed product is an allowed consumable.
106  if (!moduleContext_)
107  return;
108 
109  if (cet::binary_search_all(consumables_[bt], pi))
110  return;
111 
112  if (requireConsumes_) {
114  "Consumer: an error occurred during validation of a "
115  "retrieved product\n\n")
116  << "The following consumes (or mayConsume) statement is missing from\n"
117  << module_context(moduleDescription_) << ":\n\n"
118  << " " << assemble_consumes_statement(bt, pi) << "\n\n";
119  }
120 
121  missingConsumes_[bt].insert(pi);
122 }
cet::exempt_ptr< ModuleDescription const > moduleDescription_
Definition: Consumer.h:140
bool requireConsumes_
Definition: Consumer.h:137
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
constexpr T pi()
Returns the constant pi (up to 35 decimal digits of precision)
ConsumableProducts consumables_
Definition: Consumer.h:138
bool moduleContext_
Definition: Consumer.h:136
ConsumableProductSets missingConsumes_
Definition: Consumer.h:139
bool art::EventObserverBase::wantAllEvents ( ) const
inlineinherited
bool art::EventObserverBase::wantEvent ( Event const &  e)
inlineinherited
std::string art::EDAnalyzer::workerType ( ) const
inlineinherited

Definition at line 109 of file EDAnalyzer.h.

References art::EDAnalyzer::currentContext().

110  {
111  return "WorkerT<EDAnalyzer>";
112  }

Member Data Documentation

art::InputTag ems::MultiEMShowers::fCluModuleLabel
private

Definition at line 302 of file MultiEMShowers_module.cc.

Referenced by analyze(), convCluster(), and reconfigure().

int ems::MultiEMShowers::fConvBothGood
private

Definition at line 261 of file MultiEMShowers_module.cc.

Referenced by analyze(), beginJob(), and MultiEMShowers().

int ems::MultiEMShowers::fConvGood
private

Definition at line 259 of file MultiEMShowers_module.cc.

Referenced by analyze(), beginJob(), and MultiEMShowers().

int ems::MultiEMShowers::fConvWrong
private

Definition at line 260 of file MultiEMShowers_module.cc.

Referenced by analyze(), beginJob(), and MultiEMShowers().

int ems::MultiEMShowers::fCountph
private

Definition at line 287 of file MultiEMShowers_module.cc.

Referenced by analyze(), and beginJob().

int ems::MultiEMShowers::fCountreco
private

Definition at line 288 of file MultiEMShowers_module.cc.

Referenced by analyze(), and beginJob().

double ems::MultiEMShowers::fDedxU
private

Definition at line 293 of file MultiEMShowers_module.cc.

Referenced by analyze(), and beginJob().

double ems::MultiEMShowers::fDedxV
private

Definition at line 293 of file MultiEMShowers_module.cc.

Referenced by analyze(), and beginJob().

double ems::MultiEMShowers::fDedxZ
private

Definition at line 293 of file MultiEMShowers_module.cc.

Referenced by analyze(), and beginJob().

double ems::MultiEMShowers::fDistConvrecomc1
private

Definition at line 297 of file MultiEMShowers_module.cc.

Referenced by analyze().

double ems::MultiEMShowers::fDistConvrecomc2
private

Definition at line 297 of file MultiEMShowers_module.cc.

Referenced by analyze().

int ems::MultiEMShowers::fEv2Good
private

Definition at line 286 of file MultiEMShowers_module.cc.

Referenced by analyze(), endJob(), and MultiEMShowers().

int ems::MultiEMShowers::fEv2Groups
private

Definition at line 285 of file MultiEMShowers_module.cc.

Referenced by analyze(), endJob(), and MultiEMShowers().

int ems::MultiEMShowers::fEvComp
private

Definition at line 276 of file MultiEMShowers_module.cc.

Referenced by analyze(), endJob(), and MultiEMShowers().

int ems::MultiEMShowers::fEvFidVol
private

Definition at line 275 of file MultiEMShowers_module.cc.

Referenced by analyze(), endJob(), and MultiEMShowers().

int ems::MultiEMShowers::fEvGMomCut
private

Definition at line 277 of file MultiEMShowers_module.cc.

Referenced by analyze(), endJob(), and MultiEMShowers().

int ems::MultiEMShowers::fEvInput
private

Definition at line 278 of file MultiEMShowers_module.cc.

Referenced by analyze(), endJob(), and MultiEMShowers().

int ems::MultiEMShowers::fEvNumber
private

Definition at line 266 of file MultiEMShowers_module.cc.

Referenced by analyze(), and beginJob().

int ems::MultiEMShowers::fEvReco
private

Definition at line 284 of file MultiEMShowers_module.cc.

Referenced by analyze(), endJob(), and MultiEMShowers().

TTree* ems::MultiEMShowers::fEvTree
private

Definition at line 265 of file MultiEMShowers_module.cc.

Referenced by analyze(), and beginJob().

int ems::MultiEMShowers::fGammasInside
private

Definition at line 262 of file MultiEMShowers_module.cc.

Referenced by analyze(), and beginJob().

TVector3 ems::MultiEMShowers::fGdir1
private

Definition at line 279 of file MultiEMShowers_module.cc.

Referenced by analyze().

TVector3 ems::MultiEMShowers::fGdir2
private

Definition at line 280 of file MultiEMShowers_module.cc.

Referenced by analyze().

double ems::MultiEMShowers::fGdirmcreco1
private

Definition at line 298 of file MultiEMShowers_module.cc.

Referenced by analyze(), and beginJob().

double ems::MultiEMShowers::fGdirmcreco1good
private

Definition at line 299 of file MultiEMShowers_module.cc.

Referenced by analyze(), and beginJob().

double ems::MultiEMShowers::fGdirmcreco2
private

Definition at line 298 of file MultiEMShowers_module.cc.

Referenced by analyze(), and beginJob().

double ems::MultiEMShowers::fGdirmcreco2good
private

Definition at line 299 of file MultiEMShowers_module.cc.

Referenced by analyze(), and beginJob().

double ems::MultiEMShowers::fGmom1
private

Definition at line 271 of file MultiEMShowers_module.cc.

Referenced by analyze(), and beginJob().

double ems::MultiEMShowers::fGmom2
private

Definition at line 272 of file MultiEMShowers_module.cc.

Referenced by analyze(), and beginJob().

art::InputTag ems::MultiEMShowers::fHitsModuleLabel
private

Definition at line 301 of file MultiEMShowers_module.cc.

Referenced by analyze(), convCluster(), and reconfigure().

double ems::MultiEMShowers::fMCrecoTh
private

Definition at line 294 of file MultiEMShowers_module.cc.

Referenced by analyze(), and beginJob().

double ems::MultiEMShowers::fMCrecoThgood
private

Definition at line 295 of file MultiEMShowers_module.cc.

Referenced by analyze(), and beginJob().

double ems::MultiEMShowers::fMCrecovtx
private

Definition at line 294 of file MultiEMShowers_module.cc.

Referenced by analyze(), and beginJob().

double ems::MultiEMShowers::fMCrecovtxgood
private

Definition at line 295 of file MultiEMShowers_module.cc.

Referenced by analyze(), and beginJob().

double ems::MultiEMShowers::fMcth
private

Definition at line 273 of file MultiEMShowers_module.cc.

Referenced by analyze(), and beginJob().

int ems::MultiEMShowers::fNgammas
private

Definition at line 274 of file MultiEMShowers_module.cc.

Referenced by analyze(), and beginJob().

int ems::MultiEMShowers::fNGroups
private

Definition at line 267 of file MultiEMShowers_module.cc.

Referenced by analyze(), and beginJob().

double ems::MultiEMShowers::fPi0mom
private

Definition at line 270 of file MultiEMShowers_module.cc.

Referenced by analyze(), and beginJob().

TVector3 ems::MultiEMShowers::fPrimary
private

Definition at line 281 of file MultiEMShowers_module.cc.

Referenced by analyze().

TTree* ems::MultiEMShowers::fRecoTree
private

Definition at line 291 of file MultiEMShowers_module.cc.

Referenced by analyze(), and beginJob().

double ems::MultiEMShowers::fRecth
private

Definition at line 296 of file MultiEMShowers_module.cc.

Referenced by analyze(), and beginJob().

double ems::MultiEMShowers::fRecthgood
private

Definition at line 296 of file MultiEMShowers_module.cc.

Referenced by analyze(), and beginJob().

art::InputTag ems::MultiEMShowers::fShsModuleLabel
private

Definition at line 305 of file MultiEMShowers_module.cc.

Referenced by analyze(), and reconfigure().

TTree* ems::MultiEMShowers::fShTree
private

Definition at line 290 of file MultiEMShowers_module.cc.

Referenced by analyze(), and beginJob().

double ems::MultiEMShowers::fStartX
private

Definition at line 292 of file MultiEMShowers_module.cc.

Referenced by analyze(), and beginJob().

double ems::MultiEMShowers::fStartY
private

Definition at line 292 of file MultiEMShowers_module.cc.

Referenced by analyze(), and beginJob().

double ems::MultiEMShowers::fStartZ
private

Definition at line 292 of file MultiEMShowers_module.cc.

Referenced by analyze(), and beginJob().

art::InputTag ems::MultiEMShowers::fTrk3DModuleLabel
private

Definition at line 303 of file MultiEMShowers_module.cc.

Referenced by analyze(), and reconfigure().

art::InputTag ems::MultiEMShowers::fVtxModuleLabel
private

Definition at line 304 of file MultiEMShowers_module.cc.

Referenced by analyze(), and reconfigure().


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