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

Classes

struct  MCHists
 
struct  RecoHists
 

Public Types

using WorkerType = WorkerT< EDAnalyzer >
 
using ModuleType = EDAnalyzer
 

Public Member Functions

 SeedAna (fhicl::ParameterSet const &pset)
 
virtual ~SeedAna ()
 
void analyze (const art::Event &evt)
 
void endJob ()
 
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 Attributes

std::string fSeedModuleLabel
 
std::string fMCTrackModuleLabel
 
int fDump
 
double fMinMCKE
 
double fMinMCLen
 
double fMatchColinearity
 
double fMatchDisp
 
bool fIgnoreSign
 
std::map< int, MCHistsfMCHistMap
 
std::map< int, RecoHistsfRecoHistMap
 
int fNumEvent
 

Detailed Description

Definition at line 233 of file SeedAna_module.cc.

Member Typedef Documentation

Definition at line 39 of file EDAnalyzer.h.

Definition at line 38 of file EDAnalyzer.h.

Constructor & Destructor Documentation

trkf::SeedAna::SeedAna ( fhicl::ParameterSet const &  pset)
explicit

Definition at line 641 of file SeedAna_module.cc.

References fDump, fMCTrackModuleLabel, fMinMCKE, fMinMCLen, and fSeedModuleLabel.

647  : EDAnalyzer(pset)
648  , fSeedModuleLabel(pset.get<std::string>("SeedModuleLabel"))
649  , fMCTrackModuleLabel(pset.get<std::string>("MCTrackModuleLabel"))
650  , fDump(pset.get<int>("Dump"))
651  , fMinMCKE(pset.get<double>("MinMCKE"))
652  , fMinMCLen(pset.get<double>("MinMCLen"))
653  , fMatchColinearity(pset.get<double>("MatchColinearity"))
654  , fMatchDisp(pset.get<double>("MatchDisp"))
655  , fIgnoreSign(pset.get<bool>("IgnoreSign"))
656  , fNumEvent(0)
657  {
658 
659  // Report.
660 
661  mf::LogInfo("SeedAna")
662  << "SeedAna configured with the following parameters:\n"
663  << " SeedModuleLabel = " << fSeedModuleLabel << "\n"
664  << " MCTrackModuleLabel = " << fMCTrackModuleLabel << "\n"
665  << " Dump = " << fDump << "\n"
666  << " MinMCKE = " << fMinMCKE << "\n"
667  << " MinMCLen = " << fMinMCLen;
668  }
std::string fMCTrackModuleLabel
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
std::string fSeedModuleLabel
double fMatchColinearity
EDAnalyzer(Table< Config > const &config)
Definition: EDAnalyzer.h:100
trkf::SeedAna::~SeedAna ( )
virtual

Definition at line 670 of file SeedAna_module.cc.

674  {}

Member Function Documentation

void trkf::SeedAna::analyze ( const art::Event evt)

Definition at line 676 of file SeedAna_module.cc.

References dir, detinfo::DetectorProperties::DriftVelocity(), sim::MCStep::E(), fDump, trkf::SeedAna::RecoHists::fHdist, trkf::SeedAna::RecoHists::fHphi, trkf::SeedAna::RecoHists::fHtheta, trkf::SeedAna::RecoHists::fHtheta_xz, trkf::SeedAna::RecoHists::fHtheta_yz, trkf::SeedAna::RecoHists::fHx, trkf::SeedAna::RecoHists::fHy, trkf::SeedAna::RecoHists::fHz, fIgnoreSign, fMatchColinearity, fMatchDisp, fMCHistMap, fMCTrackModuleLabel, fMinMCKE, fMinMCLen, fNumEvent, fRecoHistMap, fSeedModuleLabel, art::DataViewImpl::getByLabel(), recob::Seed::GetDirection(), recob::Seed::GetPoint(), art::Event::isRealData(), art::Handle< T >::isValid(), sim::MCStep::Momentum(), sim::MCTrack::PdgCode(), seed, sim::MCTrack::Start(), sim::MCStep::T(), sim::MCTrack::TrackID(), and w.

682  {
683  ++fNumEvent;
684 
685  // Optional dump stream.
686 
687  std::unique_ptr<mf::LogInfo> pdump;
688  if(fDump > 0) {
689  --fDump;
690  pdump = std::unique_ptr<mf::LogInfo>(new mf::LogInfo("TrackAna"));
691  }
692 
693  // Make sure histograms are booked.
694 
695  bool mc = !evt.isRealData();
696 
697  // Get seed handle.
698 
700  evt.getByLabel(fSeedModuleLabel, seedh);
701 
702  const detinfo::DetectorProperties* detprop = lar::providerFrom<detinfo::DetectorPropertiesService>();
703 
704  // Seed->mc track matching map.
705 
706  std::map<const recob::Seed*, int> seedmap;
707 
708  if(mc) {
709 
710  // Get MCTracks.
711 
713  evt.getByLabel(fMCTrackModuleLabel, mctrackh);
714 
715  // Dump MCTracks.
716 
717  if(pdump) {
718  *pdump << "MC Tracks\n"
719  << " Id pdg x y z dx dy dz p\n"
720  << "-------------------------------------------------------------------------------------------\n";
721  }
722 
723  // Loop over mc tracks, and fill histograms that depend only
724  // on mc particles.
725 
726  for(std::vector<sim::MCTrack>::const_iterator imctrk = mctrackh->begin();
727  imctrk != mctrackh->end(); ++imctrk) {
728  const sim::MCTrack& mctrk = *imctrk;
729  int pdg = mctrk.PdgCode();
730  if(fIgnoreSign)
731  pdg = std::abs(pdg);
732 
733  // Ignore everything except stable charged nonshowering particles.
734 
735  int apdg = std::abs(pdg);
736  if(apdg == 13 || // Muon
737  apdg == 211 || // Charged pion
738  apdg == 321 || // Charged kaon
739  apdg == 2212) { // (Anti)proton
740 
741  // Apply minimum energy cut.
742 
743  if(mctrk.Start().E() >= mctrk.Start().Momentum().Mag() + 1000.*fMinMCKE) {
744 
745  // Calculate the x offset due to nonzero mc particle time.
746 
747  double mctime = mctrk.Start().T(); // nsec
748  double mcdx = mctime * 1.e-3 * detprop->DriftVelocity(); // cm
749 
750  // Calculate the length of this mc particle inside the fiducial volume.
751 
752  TVector3 mcstart;
753  TVector3 mcend;
754  TVector3 mcstartmom;
755  TVector3 mcendmom;
756  double plen = length(mctrk, mcdx, mcstart, mcend, mcstartmom, mcendmom);
757 
758  // Apply minimum fiducial length cut. Always reject particles that have
759  // zero length in the tpc regardless of the configured cut.
760 
761  if(plen > 0. && plen > fMinMCLen) {
762 
763  // Dump MC particle information here.
764 
765  if(pdump) {
766  double pstart = mcstartmom.Mag();
767  double pend = mcendmom.Mag();
768  *pdump << "\nOffset"
769  << std::setw(3) << mctrk.TrackID()
770  << std::setw(6) << mctrk.PdgCode()
771  << " "
772  << std::fixed << std::setprecision(2)
773  << std::setw(10) << mcdx
774  << "\nStart "
775  << std::setw(3) << mctrk.TrackID()
776  << std::setw(6) << mctrk.PdgCode()
777  << " "
778  << std::fixed << std::setprecision(2)
779  << std::setw(10) << mcstart[0]
780  << std::setw(10) << mcstart[1]
781  << std::setw(10) << mcstart[2];
782  if(pstart > 0.) {
783  *pdump << " "
784  << std::fixed << std::setprecision(3)
785  << std::setw(10) << mcstartmom[0]/pstart
786  << std::setw(10) << mcstartmom[1]/pstart
787  << std::setw(10) << mcstartmom[2]/pstart;
788  }
789  else
790  *pdump << std::setw(32) << " ";
791  *pdump << std::setw(12) << std::fixed << std::setprecision(3) << pstart;
792  *pdump << "\nEnd "
793  << std::setw(3) << mctrk.TrackID()
794  << std::setw(6) << mctrk.PdgCode()
795  << " "
796  << std::fixed << std::setprecision(2)
797  << std::setw(10) << mcend[0]
798  << std::setw(10) << mcend[1]
799  << std::setw(10) << mcend[2];
800  if(pend > 0.01) {
801  *pdump << " "
802  << std::fixed << std::setprecision(3)
803  << std::setw(10) << mcendmom[0]/pend
804  << std::setw(10) << mcendmom[1]/pend
805  << std::setw(10) << mcendmom[2]/pend;
806  }
807  else
808  *pdump << std::setw(32)<< " ";
809  *pdump << std::setw(12) << std::fixed << std::setprecision(3) << pend << "\n";
810  }
811 
812  // Fill histograms.
813 
814  if(fMCHistMap.count(pdg) == 0) {
815  std::ostringstream ostr;
816  ostr << "MC" << (fIgnoreSign ? "All" : (pdg > 0 ? "Pos" : "Neg")) << std::abs(pdg);
817  fMCHistMap[pdg] = MCHists(ostr.str());
818  }
819  const MCHists& mchists = fMCHistMap[pdg];
820 
821  double mctheta_xz = std::atan2(mcstartmom.X(), mcstartmom.Z());
822  double mctheta_yz = std::atan2(mcstartmom.Y(), mcstartmom.Z());
823 
824  mchists.fHmcstartx->Fill(mcstart.X());
825  mchists.fHmcstarty->Fill(mcstart.Y());
826  mchists.fHmcstartz->Fill(mcstart.Z());
827  mchists.fHmcendx->Fill(mcend.X());
828  mchists.fHmcendy->Fill(mcend.Y());
829  mchists.fHmcendz->Fill(mcend.Z());
830  mchists.fHmctheta->Fill(mcstartmom.Theta());
831  mchists.fHmcphi->Fill(mcstartmom.Phi());
832  mchists.fHmctheta_xz->Fill(mctheta_xz);
833  mchists.fHmctheta_yz->Fill(mctheta_yz);
834  mchists.fHmcmom->Fill(mcstartmom.Mag());
835  mchists.fHmclen->Fill(plen);
836 
837  // Loop over seeds and do matching.
838 
839  int nmatch = 0;
840  if(seedh.isValid()) {
841 
842  // Loop over seeds.
843 
844  int nseed = seedh->size();
845  for(int i = 0; i < nseed; ++i) {
846  art::Ptr<recob::Seed> pseed(seedh, i);
847  const recob::Seed& seed = *pseed;
848  if(seedmap.count(&seed) == 0)
849  seedmap[&seed] = -1;
850 
851  // Get parameters of this seed.
852 
853  TVector3 pos;
854  TVector3 dir;
855  double err[3];
856  seed.GetPoint(&pos[0], err);
857  seed.GetDirection(&dir[0], err);
858 
859  // Calculate the global-to-local rotation matrix.
860  // Copied from Track.cxx.
861 
862  TMatrixD rot(3,3);
863  double dirmag = dir.Mag();
864  double diryz = std::sqrt(dir.Y()*dir.Y() + dir.Z()*dir.Z());
865 
866  double sinth = dir.X() / dirmag;
867  double costh = diryz / dirmag;
868  double sinphi = 0.;
869  double cosphi = 1.;
870  if(diryz != 0) {
871  sinphi = -dir.Y() / diryz;
872  cosphi = dir.Z() / diryz;
873  }
874  rot(0,0) = costh;
875  rot(1,0) = 0.;
876  rot(2,0) = sinth;
877  rot(0,1) = sinth * sinphi;
878  rot(1,1) = cosphi;
879  rot(2,1) = -costh * sinphi;
880  rot(0,2) = -sinth * cosphi;
881  rot(1,2) = sinphi;
882  rot(2,2) = costh * cosphi;
883 
884  // Get best matching mc trajectory point.
885 
886  int itraj = mcmatch(mctrk, seed);
887  if(itraj >= 0) {
888 
889  // Get mc relative position and direction at matching trajectory point.
890 
891  TVector3 mcpos = mctrk[itraj].Position().Vect() - pos;
892  TVector3 mcmom = mctrk[itraj].Momentum().Vect();
893  mcpos[0] += mcdx;
894 
895  // Rotate the momentum and position to the
896  // seed-local coordinate system.
897 
898  TVector3 mcmoml = rot * mcmom;
899  TVector3 mcposl = rot * mcpos;
900 
901  if(mcmoml.Z() < 0.)
902  mcmoml = -mcmoml;
903  double costh = mcmoml.Z() / mcmoml.Mag();
904 
905  double u = mcposl.X();
906  double v = mcposl.Y();
907  double w = mcposl.Z();
908 
909  double pu = mcmoml.X();
910  double pv = mcmoml.Y();
911  double pw = mcmoml.Z();
912 
913  double dudw = pu / pw;
914  double dvdw = pv / pw;
915 
916  double u0 = u - w * dudw;
917  double v0 = v - w * dvdw;
918  double uv0 = std::sqrt(u0*u0 + v0*v0);
919 
920  // Fill matching histograms.
921 
922  mchists.fHduvcosth->Fill(costh, uv0);
923  if(std::abs(uv0) < fMatchDisp) {
924 
925  // Fill slope matching histograms.
926 
927  mchists.fHmcdudw->Fill(dudw);
928  mchists.fHmcdvdw->Fill(dvdw);
929  }
930  mchists.fHcosth->Fill(costh);
931  if(costh > fMatchColinearity) {
932 
933  // Fill displacement matching histograms.
934 
935  mchists.fHmcu->Fill(u0);
936  mchists.fHmcv->Fill(v0);
937  mchists.fHmcw->Fill(w);
938 
939  if(std::abs(uv0) < fMatchDisp) {
940 
941  // Now we have passed all matching cuts and we have a matching
942  // mc particle + seed pair.
943 
944  ++nmatch;
945  seedmap[&seed] = mctrk.TrackID();
946 
947  // Fill matched seed histograms (seed multiplicity).
948 
949  mchists.fHmstartx->Fill(mcstart.X());
950  mchists.fHmstarty->Fill(mcstart.Y());
951  mchists.fHmstartz->Fill(mcstart.Z());
952  mchists.fHmendx->Fill(mcend.X());
953  mchists.fHmendy->Fill(mcend.Y());
954  mchists.fHmendz->Fill(mcend.Z());
955  mchists.fHmtheta->Fill(mcstartmom.Theta());
956  mchists.fHmphi->Fill(mcstartmom.Phi());
957  mchists.fHmtheta_xz->Fill(mctheta_xz);
958  mchists.fHmtheta_yz->Fill(mctheta_yz);
959  mchists.fHmmom->Fill(mcstartmom.Mag());
960  mchists.fHmlen->Fill(plen);
961  }
962  }
963  }
964  }
965 
966  // If we found at least one matched seed, fill good
967  // particle histograms.
968 
969  if(nmatch > 0) {
970  mchists.fHgstartx->Fill(mcstart.X());
971  mchists.fHgstarty->Fill(mcstart.Y());
972  mchists.fHgstartz->Fill(mcstart.Z());
973  mchists.fHgendx->Fill(mcend.X());
974  mchists.fHgendy->Fill(mcend.Y());
975  mchists.fHgendz->Fill(mcend.Z());
976  mchists.fHgtheta->Fill(mcstartmom.Theta());
977  mchists.fHgphi->Fill(mcstartmom.Phi());
978  mchists.fHgtheta_xz->Fill(mctheta_xz);
979  mchists.fHgtheta_yz->Fill(mctheta_yz);
980  mchists.fHgmom->Fill(mcstartmom.Mag());
981  mchists.fHglen->Fill(plen);
982  }
983  }
984  }
985  }
986  }
987  }
988  }
989 
990  // Loop over seeds and fill reco-only seed histograms.
991 
992  if(seedh.isValid()) {
993 
994  // Loop over seeds.
995 
996  int nseed = seedh->size();
997 
998  if(nseed > 0 && pdump != 0) {
999  *pdump << "\nReconstructed Seeds\n"
1000  << " MCid x y z dx dy dz p\n"
1001  << "-------------------------------------------------------------------------------------------\n";
1002  }
1003 
1004  for(int i = 0; i < nseed; ++i) {
1005  art::Ptr<recob::Seed> pseed(seedh, i);
1006  const recob::Seed& seed = *pseed;
1007 
1008  // Fill histograms involving reco seeds only.
1009 
1010  TVector3 pos;
1011  TVector3 dir;
1012  double err[3];
1013  seed.GetPoint(&pos[0], err);
1014  seed.GetDirection(&dir[0], err);
1015  double mdir = dir.Mag();
1016  if(mdir != 0.) {
1017  dir *= (1./mdir);
1018  }
1019 
1020  double dpos = bdist(pos);
1021  double theta_xz = std::atan2(dir.X(), dir.Z());
1022  double theta_yz = std::atan2(dir.Y(), dir.Z());
1023 
1024  // Dump seed information here.
1025 
1026  if(pdump) {
1027  int mcid = seedmap[&seed];
1028  *pdump << std::setw(15) << mcid
1029  << " "
1030  << std::fixed << std::setprecision(2)
1031  << std::setw(10) << pos[0]
1032  << std::setw(10) << pos[1]
1033  << std::setw(10) << pos[2]
1034  << " "
1035  << std::fixed << std::setprecision(3)
1036  << std::setw(10) << dir[0]
1037  << std::setw(10) << dir[1]
1038  << std::setw(10) << dir[2]
1039  << "\n";
1040  }
1041 
1042  // Fill histograms.
1043 
1044  if(fRecoHistMap.count(0) == 0)
1045  fRecoHistMap[0] = RecoHists("Reco");
1046  const RecoHists& rhists = fRecoHistMap[0];
1047 
1048  rhists.fHx->Fill(pos.X());
1049  rhists.fHy->Fill(pos.Y());
1050  rhists.fHz->Fill(pos.Z());
1051  rhists.fHdist->Fill(dpos);
1052  rhists.fHtheta->Fill(dir.Theta());
1053  rhists.fHphi->Fill(dir.Phi());
1054  rhists.fHtheta_xz->Fill(theta_xz);
1055  rhists.fHtheta_yz->Fill(theta_yz);
1056  }
1057  }
1058  }
std::string fMCTrackModuleLabel
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
void GetPoint(double *Pt, double *Err) const
Definition: Seed.cxx:112
std::string fSeedModuleLabel
double T() const
Definition: MCStep.h:45
bool isRealData() const
Definition: Event.h:83
double fMatchColinearity
bool isValid() const
Definition: Handle.h:190
intermediate_table::const_iterator const_iterator
long seed
Definition: chem4.cc:68
std::map< int, RecoHists > fRecoHistMap
int PdgCode() const
Definition: MCTrack.h:41
const TLorentzVector & Momentum() const
Definition: MCStep.h:38
std::map< int, MCHists > fMCHistMap
TDirectory * dir
Definition: macro.C:5
bool getByLabel(std::string const &label, std::string const &productInstanceName, Handle< PROD > &result) const
Definition: DataViewImpl.h:344
virtual double DriftVelocity(double efield=0., double temperature=0.) const =0
double E() const
Definition: MCStep.h:49
const MCStep & Start() const
Definition: MCTrack.h:44
unsigned int TrackID() const
Definition: MCTrack.h:42
Float_t w
Definition: plot.C:23
void GetDirection(double *Dir, double *Err) const
Definition: Seed.cxx:102
Definition: fwd.h:25
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
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 trkf::SeedAna::endJob ( )
virtual

Reimplemented from art::EDAnalyzer.

Definition at line 1060 of file SeedAna_module.cc.

References trkf::SeedAna::MCHists::fHeendx, trkf::SeedAna::MCHists::fHeendy, trkf::SeedAna::MCHists::fHeendz, trkf::SeedAna::MCHists::fHelen, trkf::SeedAna::MCHists::fHemom, trkf::SeedAna::MCHists::fHephi, trkf::SeedAna::MCHists::fHestartx, trkf::SeedAna::MCHists::fHestarty, trkf::SeedAna::MCHists::fHestartz, trkf::SeedAna::MCHists::fHetheta, trkf::SeedAna::MCHists::fHetheta_xz, trkf::SeedAna::MCHists::fHetheta_yz, trkf::SeedAna::MCHists::fHgendx, trkf::SeedAna::MCHists::fHgendy, trkf::SeedAna::MCHists::fHgendz, trkf::SeedAna::MCHists::fHglen, trkf::SeedAna::MCHists::fHgmom, trkf::SeedAna::MCHists::fHgphi, trkf::SeedAna::MCHists::fHgstartx, trkf::SeedAna::MCHists::fHgstarty, trkf::SeedAna::MCHists::fHgstartz, trkf::SeedAna::MCHists::fHgtheta, trkf::SeedAna::MCHists::fHgtheta_xz, trkf::SeedAna::MCHists::fHgtheta_yz, trkf::SeedAna::MCHists::fHmcendx, trkf::SeedAna::MCHists::fHmcendy, trkf::SeedAna::MCHists::fHmcendz, trkf::SeedAna::MCHists::fHmclen, trkf::SeedAna::MCHists::fHmcmom, trkf::SeedAna::MCHists::fHmcphi, trkf::SeedAna::MCHists::fHmcstartx, trkf::SeedAna::MCHists::fHmcstarty, trkf::SeedAna::MCHists::fHmcstartz, trkf::SeedAna::MCHists::fHmctheta, trkf::SeedAna::MCHists::fHmctheta_xz, trkf::SeedAna::MCHists::fHmctheta_yz, trkf::SeedAna::MCHists::fHmendx, trkf::SeedAna::MCHists::fHmendy, trkf::SeedAna::MCHists::fHmendz, trkf::SeedAna::MCHists::fHmlen, trkf::SeedAna::MCHists::fHmmom, trkf::SeedAna::MCHists::fHmphi, trkf::SeedAna::MCHists::fHmstartx, trkf::SeedAna::MCHists::fHmstarty, trkf::SeedAna::MCHists::fHmstartz, trkf::SeedAna::MCHists::fHmtheta, trkf::SeedAna::MCHists::fHmtheta_xz, trkf::SeedAna::MCHists::fHmtheta_yz, trkf::SeedAna::MCHists::fHmulendx, trkf::SeedAna::MCHists::fHmulendy, trkf::SeedAna::MCHists::fHmulendz, trkf::SeedAna::MCHists::fHmullen, trkf::SeedAna::MCHists::fHmulmom, trkf::SeedAna::MCHists::fHmulphi, trkf::SeedAna::MCHists::fHmulstartx, trkf::SeedAna::MCHists::fHmulstarty, trkf::SeedAna::MCHists::fHmulstartz, trkf::SeedAna::MCHists::fHmultheta, trkf::SeedAna::MCHists::fHmultheta_xz, trkf::SeedAna::MCHists::fHmultheta_yz, fMCHistMap, and fNumEvent.

1064  {
1065  // Print summary.
1066 
1067  mf::LogInfo("SeedAna")
1068  << "SeedAna statistics:\n"
1069  << " Number of events = " << fNumEvent;
1070 
1071  // Fill multiplicity histograms.
1072 
1074  i != fMCHistMap.end(); ++i) {
1075  const MCHists& mchists = i->second;
1076  mulcalc(mchists.fHmstartx, mchists.fHmcstartx, mchists.fHmulstartx);
1077  mulcalc(mchists.fHmstarty, mchists.fHmcstarty, mchists.fHmulstarty);
1078  mulcalc(mchists.fHmstartz, mchists.fHmcstartz, mchists.fHmulstartz);
1079  mulcalc(mchists.fHmendx, mchists.fHmcendx, mchists.fHmulendx);
1080  mulcalc(mchists.fHmendy, mchists.fHmcendy, mchists.fHmulendy);
1081  mulcalc(mchists.fHmendz, mchists.fHmcendz, mchists.fHmulendz);
1082  mulcalc(mchists.fHmtheta, mchists.fHmctheta, mchists.fHmultheta);
1083  mulcalc(mchists.fHmphi, mchists.fHmcphi, mchists.fHmulphi);
1084  mulcalc(mchists.fHmtheta_xz, mchists.fHmctheta_xz, mchists.fHmultheta_xz);
1085  mulcalc(mchists.fHmtheta_yz, mchists.fHmctheta_yz, mchists.fHmultheta_yz);
1086  mulcalc(mchists.fHmmom, mchists.fHmcmom, mchists.fHmulmom);
1087  mulcalc(mchists.fHmlen, mchists.fHmclen, mchists.fHmullen);
1088  }
1089  // Fill efficiency histograms.
1090 
1092  i != fMCHistMap.end(); ++i) {
1093  const MCHists& mchists = i->second;
1094  effcalc(mchists.fHgstartx, mchists.fHmcstartx, mchists.fHestartx);
1095  effcalc(mchists.fHgstarty, mchists.fHmcstarty, mchists.fHestarty);
1096  effcalc(mchists.fHgstartz, mchists.fHmcstartz, mchists.fHestartz);
1097  effcalc(mchists.fHgendx, mchists.fHmcendx, mchists.fHeendx);
1098  effcalc(mchists.fHgendy, mchists.fHmcendy, mchists.fHeendy);
1099  effcalc(mchists.fHgendz, mchists.fHmcendz, mchists.fHeendz);
1100  effcalc(mchists.fHgtheta, mchists.fHmctheta, mchists.fHetheta);
1101  effcalc(mchists.fHgphi, mchists.fHmcphi, mchists.fHephi);
1102  effcalc(mchists.fHgtheta_xz, mchists.fHmctheta_xz, mchists.fHetheta_xz);
1103  effcalc(mchists.fHgtheta_yz, mchists.fHmctheta_yz, mchists.fHetheta_yz);
1104  effcalc(mchists.fHgmom, mchists.fHmcmom, mchists.fHemom);
1105  effcalc(mchists.fHglen, mchists.fHmclen, mchists.fHelen);
1106  }
1107  }
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
intermediate_table::const_iterator const_iterator
std::map< int, MCHists > fMCHistMap
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 }
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  }
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 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

int trkf::SeedAna::fDump
private

Definition at line 371 of file SeedAna_module.cc.

Referenced by analyze(), and SeedAna().

bool trkf::SeedAna::fIgnoreSign
private

Definition at line 376 of file SeedAna_module.cc.

Referenced by analyze().

double trkf::SeedAna::fMatchColinearity
private

Definition at line 374 of file SeedAna_module.cc.

Referenced by analyze().

double trkf::SeedAna::fMatchDisp
private

Definition at line 375 of file SeedAna_module.cc.

Referenced by analyze().

std::map<int, MCHists> trkf::SeedAna::fMCHistMap
private

Definition at line 380 of file SeedAna_module.cc.

Referenced by analyze(), and endJob().

std::string trkf::SeedAna::fMCTrackModuleLabel
private

Definition at line 370 of file SeedAna_module.cc.

Referenced by analyze(), and SeedAna().

double trkf::SeedAna::fMinMCKE
private

Definition at line 372 of file SeedAna_module.cc.

Referenced by analyze(), and SeedAna().

double trkf::SeedAna::fMinMCLen
private

Definition at line 373 of file SeedAna_module.cc.

Referenced by analyze(), and SeedAna().

int trkf::SeedAna::fNumEvent
private

Definition at line 385 of file SeedAna_module.cc.

Referenced by analyze(), and endJob().

std::map<int, RecoHists> trkf::SeedAna::fRecoHistMap
private

Definition at line 381 of file SeedAna_module.cc.

Referenced by analyze().

std::string trkf::SeedAna::fSeedModuleLabel
private

Definition at line 369 of file SeedAna_module.cc.

Referenced by analyze(), and SeedAna().


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