Public Member Functions | Private Attributes | List of all members
gar::garg4::GArG4Ana Class Reference
Inheritance diagram for gar::garg4::GArG4Ana:
art::EDAnalyzer art::detail::Analyzer art::detail::LegacyModule art::Observer art::ModuleBase

Public Member Functions

 GArG4Ana (fhicl::ParameterSet const &pset)
 Standard constructor and destructor for an FMWK module. More...
 
virtual ~GArG4Ana ()
 
void analyze (const ::art::Event &evt)
 
void beginJob ()
 
void reconfigure (fhicl::ParameterSet const &pset)
 
- Public Member Functions inherited from art::EDAnalyzer
 EDAnalyzer (fhicl::ParameterSet const &pset)
 
template<typename Config >
 EDAnalyzer (Table< Config > const &config)
 
std::string workerType () const
 
- Public Member Functions inherited from art::detail::Analyzer
virtual ~Analyzer () noexcept
 
 Analyzer (fhicl::ParameterSet const &pset)
 
template<typename Config >
 Analyzer (Table< Config > const &config)
 
void doBeginJob (SharedResources const &resources)
 
void doEndJob ()
 
void doRespondToOpenInputFile (FileBlock const &fb)
 
void doRespondToCloseInputFile (FileBlock const &fb)
 
void doRespondToOpenOutputFiles (FileBlock const &fb)
 
void doRespondToCloseOutputFiles (FileBlock const &fb)
 
bool doBeginRun (RunPrincipal &rp, ModuleContext const &mc)
 
bool doEndRun (RunPrincipal &rp, ModuleContext const &mc)
 
bool doBeginSubRun (SubRunPrincipal &srp, ModuleContext const &mc)
 
bool doEndSubRun (SubRunPrincipal &srp, ModuleContext const &mc)
 
bool doEvent (EventPrincipal &ep, ModuleContext const &mc, std::atomic< std::size_t > &counts_run, std::atomic< std::size_t > &counts_passed, std::atomic< std::size_t > &counts_failed)
 
- Public Member Functions inherited from art::Observer
 ~Observer () noexcept
 
 Observer (Observer const &)=delete
 
 Observer (Observer &&)=delete
 
Observeroperator= (Observer const &)=delete
 
Observeroperator= (Observer &&)=delete
 
void registerProducts (ProductDescriptions &, ModuleDescription const &)
 
void fillDescriptions (ModuleDescription const &)
 
fhicl::ParameterSetID selectorConfig () const
 
- Public Member Functions inherited from art::ModuleBase
virtual ~ModuleBase () noexcept
 
 ModuleBase ()
 
ModuleDescription const & moduleDescription () const
 
void setModuleDescription (ModuleDescription const &)
 
std::array< std::vector< ProductInfo >, NumBranchTypes > const & getConsumables () const
 
void sortConsumables (std::string const &current_process_name)
 
template<typename T , BranchType BT>
ViewToken< T > consumesView (InputTag const &tag)
 
template<typename T , BranchType BT>
ViewToken< T > mayConsumeView (InputTag const &tag)
 

Private Attributes

std::string fG4ModuleLabel
 module label for the Geant More...
 
std::string fTruthModuleLabel
 module label for the Geant More...
 
TTree * fEDepTree
 Tree to keep track of sanity check info. More...
 
TTree * fParticleTree
 Tree to keep track of sanity check info. More...
 
EventInfo fEvt
 Struct containing event identification. More...
 
EnergyDep fEDep
 Struct containing energy deposition info. More...
 
ParticleInfo fPartInfo
 Struct containing particle info. More...
 

Additional Inherited Members

- Public Types inherited from art::EDAnalyzer
using WorkerType = WorkerT< EDAnalyzer >
 
using ModuleType = EDAnalyzer
 
- Protected Member Functions inherited from art::Observer
std::string const & processName () const
 
bool wantAllEvents () const noexcept
 
bool wantEvent (ScheduleID id, Event const &e) const
 
Handle< TriggerResultsgetTriggerResults (Event const &e) const
 
 Observer (fhicl::ParameterSet const &config)
 
 Observer (std::vector< std::string > const &select_paths, std::vector< std::string > const &reject_paths, fhicl::ParameterSet const &config)
 
- Protected Member Functions inherited from art::ModuleBase
ConsumesCollectorconsumesCollector ()
 
template<typename T , BranchType = InEvent>
ProductToken< T > consumes (InputTag const &)
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > consumesView (InputTag const &)
 
template<typename T , BranchType = InEvent>
void consumesMany ()
 
template<typename T , BranchType = InEvent>
ProductToken< T > mayConsume (InputTag const &)
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > mayConsumeView (InputTag const &)
 
template<typename T , BranchType = InEvent>
void mayConsumeMany ()
 

Detailed Description

Definition at line 77 of file GArG4Ana_module.cc.

Constructor & Destructor Documentation

gar::garg4::GArG4Ana::GArG4Ana ( fhicl::ParameterSet const &  pset)
explicit

Standard constructor and destructor for an FMWK module.

Definition at line 106 of file GArG4Ana_module.cc.

107  : EDAnalyzer(pset)
108  {
109  this->reconfigure(pset);
110  }
EDAnalyzer(fhicl::ParameterSet const &pset)
Definition: EDAnalyzer.h:25
void reconfigure(fhicl::ParameterSet const &pset)
gar::garg4::GArG4Ana::~GArG4Ana ( )
virtual

Definition at line 114 of file GArG4Ana_module.cc.

115  {
116  }

Member Function Documentation

void gar::garg4::GArG4Ana::analyze ( const ::art::Event evt)

Definition at line 151 of file GArG4Ana_module.cc.

152  {
153  // set the event id info
154  fEvt.run = evt.run();
155  fEvt.subrun = evt.subRun();
156  fEvt.event = evt.id().event();
157 
158  // get the list of particles from this event
160 
161  // get the energy depositions for this event
162  auto edepsCol = evt.getValidHandle<std::vector<gar::sdp::EnergyDeposit> >(fG4ModuleLabel);
163 
164  if( edepsCol.failedToGet() ){
165  MF_LOG_VERBATIM("GArG4Ana")
166  << "failed to get energy depositions, bail";
167  return;
168  }
169 
170  sim::ParticleList* pList = bt->GetParticleList();
171 
172  sim::ParticleList::iterator itr = pList->begin();
173  for (; itr!=pList->end(); ++itr) {
174  auto part = itr->second;
175  if( !part ) continue;
176 
177  fPartInfo.trackID = part->TrackId();
178  fPartInfo.pdg = part->PdgCode();
179  fPartInfo.energy = part->E();
180  fPartInfo.length = part->Trajectory().TotalLength();
181 
182  MF_LOG_VERBATIM("GArG4Ana")
183  << part->TrackId()
184  << " "
185  << part->PdgCode()
186  << " "
187  << part->E()
188  << " "
189  << part->NumberTrajectoryPoints()
190  << " "
191  << part->Trajectory().TotalLength();
192 
193  fParticleTree->Fill();
194  }
195 
196  // loop over the energy deposition collections to fill the tree
197  for(auto edep : *edepsCol){
198 
199  // get the MCParticle for this track ID
200  auto part = bt->TrackIDToParticle(edep.TrackID());
201 
202  fEDep.trackID = edep.TrackID();
203  fEDep.pdg = part->PdgCode();
204  fEDep.x = edep.X();
205  fEDep.y = edep.Y();
206  fEDep.z = edep.Z();
207  fEDep.dX = edep.dX();
208  fEDep.t = edep.Time();
209  fEDep.e = edep.Energy();
210 
211  MF_LOG_DEBUG("GArG4Ana")
212  << "pos: ("
213  << fEDep.x
214  << ", "
215  << fEDep.y
216  << ", "
217  << fEDep.z
218  << ") e: "
219  << fEDep.e
220  << " t: "
221  << fEDep.t
222  << " dX: "
223  << fEDep.dX;
224 
225  // make the tree flat in terms of the energy depositions
226  fEDepTree->Fill();
227 
228  } // end loop over collection of EnergyDeposits
229 
230  return;
231  } // analyze
intermediate_table::iterator iterator
TTree * fEDepTree
Tree to keep track of sanity check info.
EnergyDep fEDep
Struct containing energy deposition info.
ParticleInfo fPartInfo
Struct containing particle info.
bt
Definition: tracks.py:83
ValidHandle< PROD > getValidHandle(InputTag const &tag) const
Definition: DataViewImpl.h:441
SubRunNumber_t subRun() const
Definition: DataViewImpl.cc:78
RunNumber_t run() const
Definition: DataViewImpl.cc:71
std::string fG4ModuleLabel
module label for the Geant
#define MF_LOG_VERBATIM(category)
#define MF_LOG_DEBUG(id)
EventNumber_t event() const
Definition: EventID.h:116
EventID id() const
Definition: Event.cc:34
TTree * fParticleTree
Tree to keep track of sanity check info.
EventInfo fEvt
Struct containing event identification.
void gar::garg4::GArG4Ana::beginJob ( )
virtual

Reimplemented from art::EDAnalyzer.

Definition at line 119 of file GArG4Ana_module.cc.

120  {
122 
123  fEDepTree = tfs->make<TTree>("EDepTree", "EDepTree" );
124  fParticleTree = tfs->make<TTree>("ParticleTree", "ParicleTree");
125 
126  std::string description("run/I:subrun/I:event/I");
127 
128  fEDepTree ->Branch("info", &fEvt, description.c_str());
129  fParticleTree->Branch("info", &fEvt, description.c_str());
130 
131  description = "trackID/I:pdg/I:x/F:y/F:z/F:e/F:dX/F:t/F";
132 
133  fEDepTree->Branch("edep", &fEDep, description.c_str());
134 
135  description = "trackID/I:pdg/I:length/F:energy/F";
136 
137  fParticleTree->Branch("part", &fPartInfo, description.c_str());
138 
139  }
std::string string
Definition: nybbler.cc:12
TTree * fEDepTree
Tree to keep track of sanity check info.
EnergyDep fEDep
Struct containing energy deposition info.
ParticleInfo fPartInfo
Struct containing particle info.
TTree * fParticleTree
Tree to keep track of sanity check info.
EventInfo fEvt
Struct containing event identification.
void gar::garg4::GArG4Ana::reconfigure ( fhicl::ParameterSet const &  pset)

Definition at line 142 of file GArG4Ana_module.cc.

143  {
144  fG4ModuleLabel = p.get< std::string >("GeantModuleLabel");
145  fTruthModuleLabel = p.get< std::string >("TruthModuleLabel");
146 
147  return;
148  }
std::string string
Definition: nybbler.cc:12
std::string fTruthModuleLabel
module label for the Geant
p
Definition: test.py:223
std::string fG4ModuleLabel
module label for the Geant

Member Data Documentation

EnergyDep gar::garg4::GArG4Ana::fEDep
private

Struct containing energy deposition info.

Definition at line 96 of file GArG4Ana_module.cc.

TTree* gar::garg4::GArG4Ana::fEDepTree
private

Tree to keep track of sanity check info.

Definition at line 93 of file GArG4Ana_module.cc.

EventInfo gar::garg4::GArG4Ana::fEvt
private

Struct containing event identification.

Definition at line 95 of file GArG4Ana_module.cc.

std::string gar::garg4::GArG4Ana::fG4ModuleLabel
private

module label for the Geant

Definition at line 90 of file GArG4Ana_module.cc.

TTree* gar::garg4::GArG4Ana::fParticleTree
private

Tree to keep track of sanity check info.

Definition at line 94 of file GArG4Ana_module.cc.

ParticleInfo gar::garg4::GArG4Ana::fPartInfo
private

Struct containing particle info.

Definition at line 97 of file GArG4Ana_module.cc.

std::string gar::garg4::GArG4Ana::fTruthModuleLabel
private

module label for the Geant

Definition at line 91 of file GArG4Ana_module.cc.


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