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

Public Member Functions

 RawDigitAna (fhicl::ParameterSet const &pset)
 Standard constructor and destructor for an FMWK module. More...
 
virtual ~RawDigitAna ()
 
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 fReadoutModuleLabel
 module label for the Geant More...
 
TTree * fChannelTree
 Tree to keep track of sanity check info. More...
 
EventInfo fEvt
 Struct containing event identification. More...
 
EnergyDep fEDep
 Struct containing energy deposition info. More...
 
ChannelInfo fChannelInfo
 Struct containing channel 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 76 of file RawDigitAna_module.cc.

Constructor & Destructor Documentation

gar::rosim::RawDigitAna::RawDigitAna ( fhicl::ParameterSet const &  pset)
explicit

Standard constructor and destructor for an FMWK module.

Definition at line 102 of file RawDigitAna_module.cc.

103  : EDAnalyzer(pset)
104  {
105  this->reconfigure(pset);
106  }
void reconfigure(fhicl::ParameterSet const &pset)
EDAnalyzer(fhicl::ParameterSet const &pset)
Definition: EDAnalyzer.h:25
gar::rosim::RawDigitAna::~RawDigitAna ( )
virtual

Definition at line 110 of file RawDigitAna_module.cc.

111  {
112  }

Member Function Documentation

void gar::rosim::RawDigitAna::analyze ( const ::art::Event evt)

Definition at line 144 of file RawDigitAna_module.cc.

145  {
146  // set the event id info
147  fEvt.run = evt.run();
148  fEvt.subrun = evt.subRun();
149  fEvt.event = evt.id().event();
150 
151  // get the list of particles from this event
152  auto bt = gar::providerFrom<cheat::BackTracker>();
153 
154  // get the raw digits for this event
155  auto digCol = evt.getValidHandle<std::vector<gar::raw::RawDigit> >(fReadoutModuleLabel);
156 
157  if( digCol.failedToGet() ){
158  MF_LOG_VERBATIM("RawDigitAna")
159  << "failed to get raw digits, bail";
160  return;
161  }
162 
163  // get the find many for the energy depositions
164  ::art::FindMany<gar::sdp::EnergyDeposit> fmEnergyDep(digCol, evt, fReadoutModuleLabel);
165 
166  if( !fmEnergyDep.isValid() ){
167  MF_LOG_WARNING("RawDigitAna")
168  << "Unable to find valid association between RawDigits and "
169  << "energy deposits, no analysis in this module is possible";
170 
171  return;
172  }
173 
174  auto geo = gar::providerFrom<geo::GeometryGAr>();
175 
176  float xyz[3] = {0.};
177  float xyzChan[3] = {0.};
178  unsigned int chan = 0;
179 
180  for(size_t d = 0; d < digCol->size(); ++d){
181  std::vector<const gar::sdp::EnergyDeposit*> edepsCol;
182  fmEnergyDep.get(d, edepsCol);
183  if(edepsCol.size() < 1) continue;
184 
185  MF_LOG_DEBUG("RawDigitAna")
186  << "There are "
187  << edepsCol.size()
188  << " energy depositions for channel "
189  << (*digCol)[d].Channel();
190 
191  geo->ChannelToPosition((*digCol)[d].Channel(), xyz);
192 
193  // fill the channel information
194  fChannelInfo.channel = (int)(*digCol)[d].Channel();
195  fChannelInfo.x = xyz[0];
196  fChannelInfo.y = xyz[1];
197  fChannelInfo.z = xyz[2];
198 
199  // loop over the energy deposition collections to fill the tree
200  for(auto edep : edepsCol){
201 
202  // get the MCParticle for this track ID
203  auto part = bt->TrackIDToParticle(edep->TrackID());
204 
205  fEDep.trackID = edep->TrackID();
206  fEDep.pdg = part->PdgCode();
207  fEDep.x = edep->X();
208  fEDep.y = edep->Y();
209  fEDep.z = edep->Z();
210  fEDep.dX = edep->dX();
211  fEDep.t = edep->Time();
212  fEDep.e = edep->Energy();
213 
214  MF_LOG_DEBUG("RawDigitAna")
215  << "pos: ("
216  << fEDep.x
217  << ", "
218  << fEDep.y
219  << ", "
220  << fEDep.z
221  << ") e: "
222  << fEDep.e
223  << " t: "
224  << fEDep.t
225  << " dX: "
226  << fEDep.dX;
227 
228  // closure test for the channel map
229  xyz[0] = fEDep.x;
230  xyz[1] = fEDep.y;
231  xyz[2] = fEDep.z;
232 
233  chan = geo->NearestChannel(xyz);
234  if (chan != geo->GapChannelNumber())
235  {
236  geo->ChannelToPosition(chan, xyzChan);
237 
238 // if(std::abs(xyz[1] - fChannelInfo.y) > 0.33)
239 // MF_LOG_VERBATIM("RawDigitAna")
240 // << "Channel "
241 // << fChannelInfo.channel
242 // << " / "
243 // << chan
244 // << " is off from the energy deposit in y: ("
245 // << fChannelInfo.y
246 // << ", "
247 // << fChannelInfo.z
248 // << ") vs ("
249 // << xyz[1]
250 // << ", "
251 // << xyz[2]
252 // << ") "
253 // << std::abs(xyz[1] - fChannelInfo.y);
254 //
255 // if(std::abs(xyz[2] - fChannelInfo.z) > 10.33)
256 // MF_LOG_VERBATIM("RawDigitAna")
257 // << "Channel "
258 // << fChannelInfo.channel
259 // << " / "
260 // << chan
261 // << " is off from the energy deposit in z: ("
262 // << fChannelInfo.y
263 // << ", "
264 // << fChannelInfo.z
265 // << ") vs ("
266 // << xyz[1]
267 // << ", "
268 // << xyz[2]
269 // << ") "
270 // << std::abs(xyz[2] - fChannelInfo.z);
271 
272  }
273 
274  // make the tree flat in terms of the energy depositions
275  fChannelTree->Fill();
276 
277  } // end loop over collection of EnergyDeposits
278  } // end loop over RawDigit collection
279 
280  return;
281  } // analyze
std::string fReadoutModuleLabel
module label for the Geant
EventInfo fEvt
Struct containing event identification.
ChannelInfo fChannelInfo
Struct containing channel info.
EnergyDep fEDep
Struct containing energy deposition 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
#define MF_LOG_VERBATIM(category)
#define MF_LOG_DEBUG(id)
EventNumber_t event() const
Definition: EventID.h:116
#define MF_LOG_WARNING(category)
LArSoft geometry interface.
Definition: ChannelGeo.h:16
EventID id() const
Definition: Event.cc:34
TTree * fChannelTree
Tree to keep track of sanity check info.
void gar::rosim::RawDigitAna::beginJob ( )
virtual

Reimplemented from art::EDAnalyzer.

Definition at line 115 of file RawDigitAna_module.cc.

116  {
118 
119  fChannelTree = tfs->make<TTree>("ChannelTree", "ChannelTree");
120 
121  std::string description("run/I:subrun/I:event/I");
122 
123  fChannelTree->Branch("info", &fEvt, description.c_str());
124 
125  description = "trackID/I:pdg/I:x/F:y/F:z/F:e/F:dX/F:t/F";
126 
127  fChannelTree->Branch("edep", &fEDep, description.c_str());
128 
129  description = "channel/I:x/F:y/F:z/F";
130 
131  fChannelTree->Branch("chan", &fChannelInfo, description.c_str());
132 
133  }
std::string string
Definition: nybbler.cc:12
EventInfo fEvt
Struct containing event identification.
ChannelInfo fChannelInfo
Struct containing channel info.
EnergyDep fEDep
Struct containing energy deposition info.
TTree * fChannelTree
Tree to keep track of sanity check info.
void gar::rosim::RawDigitAna::reconfigure ( fhicl::ParameterSet const &  pset)

Definition at line 136 of file RawDigitAna_module.cc.

137  {
138  fReadoutModuleLabel = p.get< std::string >("ReadoutModuleLabel");
139 
140  return;
141  }
std::string string
Definition: nybbler.cc:12
std::string fReadoutModuleLabel
module label for the Geant
p
Definition: test.py:223

Member Data Documentation

ChannelInfo gar::rosim::RawDigitAna::fChannelInfo
private

Struct containing channel info.

Definition at line 93 of file RawDigitAna_module.cc.

TTree* gar::rosim::RawDigitAna::fChannelTree
private

Tree to keep track of sanity check info.

Definition at line 90 of file RawDigitAna_module.cc.

EnergyDep gar::rosim::RawDigitAna::fEDep
private

Struct containing energy deposition info.

Definition at line 92 of file RawDigitAna_module.cc.

EventInfo gar::rosim::RawDigitAna::fEvt
private

Struct containing event identification.

Definition at line 91 of file RawDigitAna_module.cc.

std::string gar::rosim::RawDigitAna::fReadoutModuleLabel
private

module label for the Geant

Definition at line 89 of file RawDigitAna_module.cc.


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