Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Attributes | List of all members
beamlinereco::ToFPositionRecoAnalysis Class Reference
Inheritance diagram for beamlinereco::ToFPositionRecoAnalysis:
art::EDAnalyzer art::EventObserverBase art::Consumer art::EngineCreator

Public Types

using WorkerType = WorkerT< EDAnalyzer >
 
using ModuleType = EDAnalyzer
 

Public Member Functions

 ToFPositionRecoAnalysis (const fhicl::ParameterSet &pset)
 
void reconfigure (const fhicl::ParameterSet &pset)
 
void beginJob () override
 
void analyze (const art::Event &evt)
 
void endJob () override
 
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< Tconsumes (InputTag const &)
 
template<typename T , art::BranchType BT>
art::ProductToken< Tconsumes (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< TconsumesView (InputTag const &it)
 
template<typename T , BranchType = InEvent>
ProductToken< TmayConsume (InputTag const &)
 
template<typename T , art::BranchType BT>
art::ProductToken< TmayConsume (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< TmayConsumeView (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

art::ServiceHandle< art::TFileServicetfs
 
std::unordered_map< unsigned int, std::stringchannelMap
 
art::InputTag fRecoToFLabel
 
art::InputTag fToFDigitLabel
 
std::vector< std::pair< unsigned int, std::string > > fChannels
 
double fSamplingInterval
 
TH1D * hToF
 
std::map< int, std::map< int, TH1D * > > hdtByChannel
 
std::map< ToFCounter, TH1D * > hFirstHits
 
std::map< ToFCounter, std::vector< TH2D * > > hPosnRecoDump
 
std::map< ToFCounter, std::vector< TH2D * > > hPosn
 
std::map< ToFCounter, std::vector< TH1D * > > hPosnSpread
 
std::map< ToFCounter, std::vector< int > > nPhysicalPosns
 
std::map< ToFCounter, std::vector< int > > nNonphysicalPosns
 
std::map< ToFCounter, intnFourHitEvents
 
std::map< ToFCounter, intnEvents
 
std::map< ToFCounter, intnHighSpreadPosns
 
ToFPositionFinderposnfinder
 
art::ServiceHandle< beamlineutil::BeamlineChannelMapfChannelMap
 

Detailed Description

Definition at line 109 of file ToFPositionRecoAnalysis_module.cc.

Member Typedef Documentation

Definition at line 39 of file EDAnalyzer.h.

Definition at line 38 of file EDAnalyzer.h.

Constructor & Destructor Documentation

beamlinereco::ToFPositionRecoAnalysis::ToFPositionRecoAnalysis ( const fhicl::ParameterSet pset)

Definition at line 156 of file ToFPositionRecoAnalysis_module.cc.

References reconfigure().

156  : EDAnalyzer(pset) {
157  this->reconfigure(pset);
158 }
EDAnalyzer(Table< Config > const &config)
Definition: EDAnalyzer.h:100
void reconfigure(const fhicl::ParameterSet &pset)

Member Function Documentation

void beamlinereco::ToFPositionRecoAnalysis::analyze ( const art::Event evt)

Definition at line 251 of file ToFPositionRecoAnalysis_module.cc.

References activeToFCounters, channels, om::cout, d, dumpPosns, art::EventID::event(), fChannelMap, art::fill_ptr_vector(), fRecoToFLabel, fToFDigitLabel, beamlinereco::ToFPositionFinder::Get4CornerPosition(), beamlinereco::ToFPositionFinder::Get4CornerSpread(), art::DataViewImpl::getByLabel(), beamlinereco::ToFPositionFinder::GetSummaryHist(), hdtByChannel, hFirstHits, hPosn, hPosnRecoDump, hPosnSpread, hToF, MECModelEnuComparisons::i, art::Event::id(), beamlinereco::ToFPositionFinder::IsPhysical(), calib::j, PandAna.Demos.demo0::loc, MAX_SCINT_SIDE, MIN_SCINT_SIDE, nEvents, nFourHitEvents, nHighSpreadPosns, nNonphysicalPosns, nPhysicalPosns, beamlineutil::BeamlineChannelMap::OnlineDigitChannel(), posnfinder, requiredChannels, art::Event::run(), SCINT_SIDE_LENGTH, SCINT_SIDE_STEP, SPREAD_CUTOFF, art::Event::subRun(), getGoodRuns4SAM::t1, t2, VARY_SIDE, beamlinereco::posn_t::x, and beamlinereco::posn_t::y.

251  {
252 
253  // Get ToFs for each reco version
255  std::vector<art::Ptr<brb::ToF>> tofs;
256  if (e.getByLabel(fRecoToFLabel, tofHandle)) {
257  art::fill_ptr_vector(tofs, tofHandle);
258  }
259  unsigned int nToFs = tofs.size();
260 
261  // Get time of flight for each ToF
262  std::vector<double> flightTimes;
263  for(unsigned int i = 0; i < nToFs; i++) {
264  flightTimes.push_back(tofs[i]->Time());
265  }
266 
267  //fill tof histogram
268  for(unsigned int i = 0; i < nToFs; i++) {
269  hToF->Fill(flightTimes[i]);
270  }
271 
272 
273  // Get associated digits for each reco version
275  std::vector<art::Ptr<brb::BeamlineDigit>> tofDigits;
276  if (e.getByLabel(fToFDigitLabel, tofDigitHandle)) {
277  art::fill_ptr_vector(tofDigits, tofDigitHandle);
278  }
279 
280  // Retrieve start times by channel
281  std::unordered_map<int,double> startTimeByChannel;
282  //first, initialize all required channels to -1. This flag will allow us to skip the event
283  // if the channel doesn't get a good start time value
284  for(auto tofc : activeToFCounters) {
285  for(int ch : channels[tofc]) {
286  startTimeByChannel[ch] = -1;
287  }//for ch
288  }//for tofc
289 
290  for(auto d : tofDigits){
291  //get start time by channel
292  startTimeByChannel[fChannelMap->OnlineDigitChannel(d->ChannelID())] = d->StartTimeInNanoSec();
293  }//for
294 
295  //skip the event if it doesn't have all required channels
296  for(int ch : requiredChannels) {
297  if(startTimeByChannel[ch] <= 0) {
298  return;
299  }//if
300  }//for
301 
302  //debugging
303  //std::cout << "Got start times for run " << e.run() << " subrun " << e.subRun() << " event " << e.id().event() << "\n";
304 
305  //everything else needs to be wrapped in a big for loop and executed once for each tof counter
306  for(auto tofc : activeToFCounters) {
307  //*****************THE DT DISTRIBUTIONS*******************
308  for (int i=0; i<4; i++) {
309  for (int j=i+1; j<4; j++) {
310  if(startTimeByChannel[channels[tofc][i]] > 0 && startTimeByChannel[channels[tofc][j]] > 0) {
311  double dt = startTimeByChannel[channels[tofc][i]] - startTimeByChannel[channels[tofc][j]];
312  hdtByChannel[channels[tofc][i]][channels[tofc][j]]->Fill(dt);
313  }//if
314  }//for i
315  }//for j
316 
317  //debugging
318  //std::cout << "Made dt distributions for run " << e.run() << " subrun " << e.subRun() << " event " << e.id().event() << "\n";
319 
320  //************THE FIRST CHANNEL HIT DISTRIBUTIONS*************
321  bool fourHits = true;
322  for(int i=0; i<4; i++) {
323  fourHits = fourHits && (startTimeByChannel[channels[tofc][i]] > 0);
324  }
325  int firstBin = 0;
326  for(int i=0; i<4; i++) {
327  firstBin = startTimeByChannel[channels[tofc][i]] < startTimeByChannel[channels[tofc][firstBin]] ? i : firstBin;
328  } //for i
329  if(fourHits) {
330  hFirstHits[tofc]->Fill(firstBin);
331  }
332 
333  //debugging
334  //std::cout << "Made first channel distributions for run " << e.run() << " subrun " << e.subRun() << " event " << e.id().event() << "\n";
335 
336  //******************POSITION RECONSTRUCTION DUMP**************
337  //only if hits recorded on all four corners
338  if(fourHits) {
339  if(dumpPosns) {
340  //make histograms
341  TH2D* eventPosnDump
342  = new TH2D(posnfinder->GetSummaryHist(Form("run%d_subrun%d_event%d_posndump", e.run(), e.subRun(), e.id().event()),
343  Form("run%d_subrun%d_event%d_posndump", e.run(), e.subRun(), e.id().event()),
344  startTimeByChannel[channels[tofc][0]],
345  startTimeByChannel[channels[tofc][1]],
346  startTimeByChannel[channels[tofc][2]],
347  startTimeByChannel[channels[tofc][3]],
349  hPosnRecoDump[tofc].push_back(eventPosnDump);
350  }
351 
352  if(VARY_SIDE) {
353  int i = 0; //got to keep track in two places...
354  for(double s = MIN_SCINT_SIDE; s < MAX_SCINT_SIDE; s += SCINT_SIDE_STEP) {
355  double spread = posnfinder->Get4CornerSpread(startTimeByChannel[channels[tofc][0]],
356  startTimeByChannel[channels[tofc][1]],
357  startTimeByChannel[channels[tofc][2]],
358  startTimeByChannel[channels[tofc][3]],
359  s);
360  hPosnSpread[tofc][i]->Fill(spread);
361 
362  posn_t loc = posnfinder->Get4CornerPosition(startTimeByChannel[channels[tofc][0]],
363  startTimeByChannel[channels[tofc][1]],
364  startTimeByChannel[channels[tofc][2]],
365  startTimeByChannel[channels[tofc][3]],
366  s);
367  if(spread < SPREAD_CUTOFF) {
368  hPosn[tofc][i]->Fill(loc.x,loc.y);
369  bool phys = posnfinder->IsPhysical(loc,s);
370  nPhysicalPosns[tofc][i] += phys ? 1 : 0;
371  nNonphysicalPosns[tofc][i] += phys ? 0 : 1;
372  }//if
373  i++;
374  }//for
375  }//if
376 
377  else { //(!VARY_SIDE)
378  double t1 = startTimeByChannel[channels[tofc][0]];
379  double t2 = startTimeByChannel[channels[tofc][1]];
380  double t3 = startTimeByChannel[channels[tofc][2]];
381  double t4 = startTimeByChannel[channels[tofc][3]];
382  double spread = posnfinder->Get4CornerSpread(t1,t2,t3,t4,SCINT_SIDE_LENGTH);
383  hPosnSpread[tofc][0]->Fill(spread);
384 
385  posn_t loc = posnfinder->Get4CornerPosition(t1,t2,t3,t4,SCINT_SIDE_LENGTH);
386  if(spread < SPREAD_CUTOFF) {
387  hPosn[tofc][0]->Fill(loc.x,loc.y);
388 
389  bool phys = posnfinder->IsPhysical(loc,SCINT_SIDE_LENGTH);
390  nPhysicalPosns[tofc][0] += phys ? 1 : 0;
391  nNonphysicalPosns[tofc][0] += phys ? 0 : 1;
392 
393  }//if
394  else {
395  std::cout << Form("High spread for run %d subrun %d event %d with hits at %.2f,%.2f,%.2f,%.2f and reco posn %.2f,%.2f: %.2f\n", e.run(), e.subRun(), e.id().event(), t1, t2, t3, t4, loc.x, loc.y, spread);
396  nHighSpreadPosns[tofc]++;
397  }//else
398  }//else
399 
400  nFourHitEvents[tofc]++;
401  }//if fourhits
402 
403 
404  //keep count
405  nEvents[tofc]++;
406 
407 
408  //debugging
409  //std::cout << "Made position histograms for run " << e.run() << " subrun " << e.subRun() << " event " << e.id().event() << "\n";
410  }//for tofc
411 }//analyze(event)
TH2D GetSummaryHist(TString name, TString title, double tA, double tB, double tC, double tD, double s)
std::map< ToFCounter, std::vector< TH2D * > > hPosn
double SCINT_SIDE_LENGTH
art::ServiceHandle< beamlineutil::BeamlineChannelMap > fChannelMap
std::map< ToFCounter, std::vector< TH2D * > > hPosnRecoDump
std::map< ToFCounter, std::vector< int > > nPhysicalPosns
unsigned int OnlineDigitChannel(ChannelID channel) const
Online digiziter channel number for this offline ChannelID.
std::vector< unsigned int > requiredChannels
const XML_Char * s
Definition: expat.h:262
Definition: Cand.cxx:23
std::map< ToFCounter, std::vector< unsigned int > > channels
double Get4CornerSpread(double tA, double tB, double tC, double tD, double s)
bool IsPhysical(posn_t p, double s)
Float_t d
Definition: plot.C:236
const double j
Definition: BetheBloch.cxx:29
double t2
OStream cout
Definition: OStream.cxx:6
std::map< int, std::map< int, TH1D * > > hdtByChannel
posn_t Get4CornerPosition(double tA, double tB, double tC, double tD, double s)
std::map< ToFCounter, std::vector< int > > nNonphysicalPosns
void fill_ptr_vector(std::vector< Ptr< T >> &ptrs, H const &h)
Definition: Ptr.h:464
double SCINT_SIDE_STEP
Float_t e
Definition: plot.C:35
std::vector< ToFCounter > activeToFCounters
std::map< ToFCounter, std::vector< TH1D * > > hPosnSpread
void beamlinereco::ToFPositionRecoAnalysis::beginJob ( )
overridevirtual

Reimplemented from art::EDAnalyzer.

Definition at line 174 of file ToFPositionRecoAnalysis_module.cc.

References activeToFCounters, channels, d, hdtByChannel, hFirstHits, hPosn, hPosnSpread, hToF, MECModelEnuComparisons::i, calib::j, art::TFileDirectory::make(), MAX_DT, MAX_SCINT_SIDE, MAX_SPREAD, MAX_TOF, MIN_DT, MIN_SCINT_SIDE, MIN_TOF, art::TFileDirectory::mkdir(), N_BINS, nChannels, nEvents, nFourHitEvents, nHighSpreadPosns, nNonphysicalPosns, nPhysicalPosns, POSN_ZOOM_IN, posnfinder, SCINT_SIDE_LENGTH, SCINT_SIDE_STEP, tfs, tofCounterStrings, and VARY_SIDE.

174  {
175 
176  //set up directories, main ToF distributions
177  this->hToF = tfs->make<TH1D>("hToF", "Time of Flight", N_BINS, MIN_TOF, MAX_TOF);
178 
179  //Do everything three times, once for each ToF
180  for(auto tofc : activeToFCounters) {
181  art::TFileDirectory tofDir = tfs->mkdir(tofCounterStrings[tofc].Data());
182 
183  //set up dt distributions
184  art::TFileDirectory dtDir = tofDir.mkdir("dt_distributions");
185 
186  for(int i = 0; i < nChannels; i++) {
187  for(int j = i+1; j < nChannels; j++) {
188  hdtByChannel[channels[tofc][i]][channels[tofc][j]] =
189  dtDir.make<TH1D>(Form("h_dt_ch%d_%d", channels[tofc][i], channels[tofc][j]),
190  Form("dt for channels %d and %d", channels[tofc][i], channels[tofc][j]),
191  N_BINS, MIN_DT, MAX_DT);
192  }//for j
193  }//for i
194 
195  //set up plot for the first channel in each hit group
196  hFirstHits[tofc] = tofDir.make<TH1D>("first_hits", "Number of times each channel is first in a cluster",4,0,4);
197 
198  //set up position distribution
199  if(VARY_SIDE) {
200  //better put things in a folder
201  art::TFileDirectory posnstuff = tofDir.mkdir("hPosn");
202  //vector needs to contain one double per side length
203  for(double d = MIN_SCINT_SIDE; d < MAX_SCINT_SIDE; d += SCINT_SIDE_STEP) {
204  this->hPosn[tofc].push_back(posnstuff.make<TH2D>(Form("hPosnS%.3f",d),
205  Form("Hit position with side length constant %.3f", d),
206  N_BINS,
207  (POSN_ZOOM_IN ? 0 : -d),
208  (POSN_ZOOM_IN ? d : 2*d),
209  N_BINS,
210  (POSN_ZOOM_IN ? 0 : -d),
211  (POSN_ZOOM_IN ? d : 2*d)));
212  this->hPosnSpread[tofc].push_back(posnstuff.make<TH1D>(Form("hPosnSpreadS%.3f", d),
213  Form("Position spread with side length constant %.3f", d),
214  N_BINS, 0, MAX_SPREAD));
215  nPhysicalPosns[tofc].push_back(0);
216  nNonphysicalPosns[tofc].push_back(0);
217  } //for d
218  } //if
219 
220  else {//(!VARY_SIDE)
221  //vector only needs one thing
222  this->hPosn[tofc].push_back(tofDir.make<TH2D>("hPosn", "Position",
223  N_BINS,
226  N_BINS,
227  (POSN_ZOOM_IN ? 0 : -SCINT_SIDE_LENGTH),
228  (POSN_ZOOM_IN ? SCINT_SIDE_LENGTH : 2*SCINT_SIDE_LENGTH)));
229  this->hPosnSpread[tofc].push_back(tofDir.make<TH1D>("hPosnSpread", "Position spread",
230  N_BINS, 0, MAX_SPREAD));
231  nPhysicalPosns[tofc].push_back(0);
232  nNonphysicalPosns[tofc].push_back(0);
233  } //else
234 
235  //set draw options for 2d histograms
236  for(TH2D* posnHist : hPosn[tofc]) {
237  posnHist->SetOption("colz");
238  }
239 
240  //set the useful counter
241  nEvents[tofc] = 0;
242  nHighSpreadPosns[tofc] = 0;
243  nFourHitEvents[tofc] = 0;
244 
245  }//for tofc
246 
247  posnfinder = new ToFPositionFinder();
248 }
std::map< ToFCounter, std::vector< TH2D * > > hPosn
double SCINT_SIDE_LENGTH
std::map< ToFCounter, TString > tofCounterStrings
TFileDirectory mkdir(std::string const &dir, std::string const &descr="")
std::map< ToFCounter, std::vector< int > > nPhysicalPosns
const int nChannels
std::map< ToFCounter, std::vector< unsigned int > > channels
Float_t d
Definition: plot.C:236
const double j
Definition: BetheBloch.cxx:29
std::map< int, std::map< int, TH1D * > > hdtByChannel
T * make(ARGS...args) const
art::ServiceHandle< art::TFileService > tfs
std::map< ToFCounter, std::vector< int > > nNonphysicalPosns
double SCINT_SIDE_STEP
std::vector< ToFCounter > activeToFCounters
std::map< ToFCounter, std::vector< TH1D * > > hPosnSpread
detail::CachedProducts& art::EventObserverBase::cachedProducts ( )
inlineprotectedinherited

Definition at line 79 of file EventObserverBase.h.

References art::EventObserverBase::selectors_.

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 146 of file Consumer.h.

References art::InputTag::instance(), PandAna.reco_validation.prod5_pid_validation::invalid, art::InputTag::label(), art::InputTag::process(), and T.

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

Definition at line 161 of file Consumer.h.

References T.

162 {
163  if (!moduleContext_)
164  return;
165 
166  consumables_[BT].emplace_back(ConsumableType::Many, TypeID{typeid(T)});
167 }
ConsumableProducts consumables_
Definition: Consumer.h:137
double T
Definition: Xdiff_gwt.C:5
bool moduleContext_
Definition: Consumer.h:135
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 171 of file Consumer.h.

References art::InputTag::instance(), PandAna.reco_validation.prod5_pid_validation::invalid, art::InputTag::label(), art::InputTag::process(), and T.

172 {
173  if (!moduleContext_)
174  return ViewToken<T>::invalid();
175 
176  consumables_[BT].emplace_back(ConsumableType::ViewElement,
177  TypeID{typeid(T)},
178  it.label(),
179  it.instance(),
180  it.process());
181  return ViewToken<T>{it};
182 }
set< int >::iterator it
static ViewToken< Element > invalid()
Definition: ProductToken.h:75
ConsumableProducts consumables_
Definition: Consumer.h:137
double T
Definition: Xdiff_gwt.C:5
bool moduleContext_
Definition: Consumer.h:135
base_engine_t& art::EngineCreator::createEngine ( seed_t  seed)
inherited
base_engine_t& art::EngineCreator::createEngine ( seed_t  seed,
std::string const &  kind_of_engine_to_make 
)
inherited
base_engine_t& art::EngineCreator::createEngine ( seed_t  seed,
std::string const &  kind_of_engine_to_make,
label_t const &  engine_label 
)
inherited
CurrentProcessingContext const* art::EDAnalyzer::currentContext ( ) const
protectedinherited
void beamlinereco::ToFPositionRecoAnalysis::endJob ( )
overridevirtual

VARY_SIDE

Reimplemented from art::EDAnalyzer.

Definition at line 413 of file ToFPositionRecoAnalysis_module.cc.

References activeToFCounters, channels, om::cout, dumpPosns, hdtByChannel, hFirstHits, hPosnRecoDump, MECModelEnuComparisons::i, calib::j, art::TFileDirectory::make(), MAX_SCINT_SIDE, extractScale::mean, MIN_SCINT_SIDE, art::TFileDirectory::mkdir(), nEvents, nFourHitEvents, nHighSpreadPosns, nNonphysicalPosns, nPhysicalPosns, extractScale::rms, SCINT_SIDE_STEP, SPREAD_CUTOFF, string, tfs, tofCounterStrings, and VARY_SIDE.

413  {
414  if(dumpPosns) {
415  art::TFileDirectory posnDumpDir = tfs->mkdir("Position_reco_dump");
416  for(auto tofc : activeToFCounters) {
417  //send the posn reco dump to a folder
418  TString name = "Posns_" + tofCounterStrings[tofc];
419  art::TFileDirectory posnRecoDumpDir = posnDumpDir.mkdir(name.Data());
420  for(auto eventHist : hPosnRecoDump[tofc]) {
421  posnRecoDumpDir.make<TH2D>(*eventHist);
422  }//for eventHist
423  }//for tofc
424  }//if dumpPosns
425 
426  //prep file
427  std::ofstream dtInfo;
428  dtInfo.open("dtInfo.txt");
429  for(auto tofc : activeToFCounters) {
430  // Write all ToF dt information to a text file for easy reading and viewing
431  for (int i=0; i<4; i++) {
432  for (int j=i+1; j<4; j++) {
433  //calculate values
434  double mean = hdtByChannel[channels[tofc][i]][channels[tofc][j]]->GetMean(1); //mean of the histogram along the x=1 axis
435  double rms = hdtByChannel[channels[tofc][i]][channels[tofc][j]]->GetRMS(1); //standard deviation
436 
437  //write to file
438  dtInfo << std::string(40,'-') << "\n";
439  dtInfo << Form("| %2d | %2d | %7.4f | %6.4f |\n", channels[tofc][i], channels[tofc][j], mean, rms);
440  } //for i
441  } //for j
442  } //for tofc
443  dtInfo.close();
444 
445  for(auto tofc : activeToFCounters) {
446  //print the number of physical and all posns
447  if(VARY_SIDE) {
448  int i = 0;
449  for(double s = MIN_SCINT_SIDE; s < MAX_SCINT_SIDE; s += SCINT_SIDE_STEP) {
450  std::cout << Form("In " + tofCounterStrings[tofc] + " There were %d physical posns ", nPhysicalPosns[tofc][i])
451  << Form("for side = %.3f\n", s);
452  std::cout << Form("In " + tofCounterStrings[tofc] + " There were %d nonphysical posns ", nNonphysicalPosns[tofc][i])
453  << Form("for side = %.3f\n", s);
454  i++;
455  }//for
456  }//if
457  else { //!VARY_SIDE
458  std::cout << Form("In " + tofCounterStrings[tofc] + " There were %d physical posns.\n", nPhysicalPosns[tofc][0]);
459  std::cout << Form("In " + tofCounterStrings[tofc] + " There were %d nonphysical posns.\n", nNonphysicalPosns[tofc][0]);
460  }//else
461 
462  std::cout << Form("In total, for " + tofCounterStrings[tofc] + " there were %d events with spread above %.3f.\n", nHighSpreadPosns[tofc], SPREAD_CUTOFF);
463  std::cout << Form("In total, for " + tofCounterStrings[tofc] + " there were %d events with four hits.\n", nFourHitEvents[tofc]);
464  std::cout << Form("In total, for " + tofCounterStrings[tofc] + " there were %d events.\n", nEvents[tofc]);
465 
466  //redo the labels for the first hits histograms
467  //and set a nice range
468  for(int i = 0; i < 4; i++) {
469  hFirstHits[tofc]->GetXaxis()->SetBinLabel(i+1, Form("ch%d",channels[tofc][i]));
470  hFirstHits[tofc]->GetYaxis()->SetRangeUser(0, 1.2*hFirstHits[tofc]->GetBinContent(hFirstHits[tofc]->GetMaximumBin()));
471  hFirstHits[tofc]->SetOption("bar1");
472  }//for i
473 
474  }//for tofc
475 }//endJob
const XML_Char * name
Definition: expat.h:151
std::map< ToFCounter, std::vector< TH2D * > > hPosnRecoDump
std::map< ToFCounter, TString > tofCounterStrings
TFileDirectory mkdir(std::string const &dir, std::string const &descr="")
std::map< ToFCounter, std::vector< int > > nPhysicalPosns
const XML_Char * s
Definition: expat.h:262
std::map< ToFCounter, std::vector< unsigned int > > channels
const double j
Definition: BetheBloch.cxx:29
OStream cout
Definition: OStream.cxx:6
std::map< int, std::map< int, TH1D * > > hdtByChannel
T * make(ARGS...args) const
art::ServiceHandle< art::TFileService > tfs
std::map< ToFCounter, std::vector< int > > nNonphysicalPosns
double SCINT_SIDE_STEP
std::vector< ToFCounter > activeToFCounters
enum BeamMode string
seed_t art::EngineCreator::get_seed_value ( fhicl::ParameterSet const &  pset,
char const  key[] = "seed",
seed_t const  implicit_seed = -1 
)
inherited
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_.

62  {
64  }
detail::CachedProducts selectors_
art::Handle< art::TriggerResults > getOneTriggerResults(Event const &) const
Float_t e
Definition: plot.C:35
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 189 of file Consumer.h.

References art::InputTag::instance(), PandAna.reco_validation.prod5_pid_validation::invalid, art::InputTag::label(), art::InputTag::process(), and T.

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

Definition at line 204 of file Consumer.h.

References T.

205 {
206  if (!moduleContext_)
207  return;
208 
209  consumables_[BT].emplace_back(ConsumableType::Many, TypeID{typeid(T)});
210 }
ConsumableProducts consumables_
Definition: Consumer.h:137
double T
Definition: Xdiff_gwt.C:5
bool moduleContext_
Definition: Consumer.h:135
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 214 of file Consumer.h.

References art::InputTag::instance(), PandAna.reco_validation.prod5_pid_validation::invalid, art::InputTag::label(), art::InputTag::process(), and T.

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

Definition at line 25 of file EventObserverBase.h.

26  {
27  return false;
28  }
static cet::exempt_ptr<Consumer> art::Consumer::non_module_context ( )
staticinherited
void art::Consumer::prepareForJob ( fhicl::ParameterSet const &  pset)
protectedinherited
std::string const& art::EventObserverBase::processName ( ) const
inlineinherited
void beamlinereco::ToFPositionRecoAnalysis::reconfigure ( const fhicl::ParameterSet pset)

Definition at line 161 of file ToFPositionRecoAnalysis_module.cc.

References channelMap, fChannels, fRecoToFLabel, fSamplingInterval, fToFDigitLabel, and fhicl::ParameterSet::get().

Referenced by ToFPositionRecoAnalysis().

161  {
162  fRecoToFLabel = pset.get<art::InputTag>("RecoToFLabel");
163  fToFDigitLabel = pset.get<art::InputTag>("ToFDigitLabel");
164 
165 
166  fChannels = pset.get<std::vector<std::pair<unsigned int, std::string>>>("Channels");
167  fSamplingInterval = pset.get<double>("TimeSamplingInterval");
168 
169  channelMap.clear();
170  for (auto ch : fChannels) { channelMap[ch.first] = ch.second; }
171 }
std::vector< std::pair< unsigned int, std::string > > fChannels
T get(std::string const &key) const
Definition: ParameterSet.h:231
std::unordered_map< unsigned int, std::string > channelMap
void art::EventObserverBase::registerProducts ( MasterProductRegistry ,
ProductDescriptions ,
ModuleDescription const &   
)
inlineinherited

Definition at line 33 of file EventObserverBase.h.

References string.

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

Definition at line 56 of file EventObserverBase.h.

References art::EventObserverBase::selector_config_id_.

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

Referenced by art::RootOutput::endJob().

void art::Consumer::validateConsumedProduct ( BranchType const  bt,
ProductInfo const &  pi 
)
protectedinherited
bool art::EventObserverBase::wantAllEvents ( ) const
inlineinherited

Definition at line 46 of file EventObserverBase.h.

References art::EventObserverBase::wantAllEvents_.

Referenced by art::RootOutput::RootOutput().

47  {
48  return wantAllEvents_;
49  }
bool art::EventObserverBase::wantEvent ( Event const &  e)
inlineinherited

Definition at line 51 of file EventObserverBase.h.

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

52  {
53  return selectors_.wantEvent(e);
54  }
detail::CachedProducts selectors_
Float_t e
Definition: plot.C:35
bool wantEvent(Event const &)
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

std::unordered_map<unsigned int, std::string> beamlinereco::ToFPositionRecoAnalysis::channelMap
private

Definition at line 124 of file ToFPositionRecoAnalysis_module.cc.

Referenced by reconfigure().

art::ServiceHandle<beamlineutil::BeamlineChannelMap> beamlinereco::ToFPositionRecoAnalysis::fChannelMap
private

Definition at line 148 of file ToFPositionRecoAnalysis_module.cc.

Referenced by analyze().

std::vector<std::pair<unsigned int, std::string> > beamlinereco::ToFPositionRecoAnalysis::fChannels
private

Definition at line 129 of file ToFPositionRecoAnalysis_module.cc.

Referenced by reconfigure().

art::InputTag beamlinereco::ToFPositionRecoAnalysis::fRecoToFLabel
private

Definition at line 126 of file ToFPositionRecoAnalysis_module.cc.

Referenced by analyze(), and reconfigure().

double beamlinereco::ToFPositionRecoAnalysis::fSamplingInterval
private

Definition at line 130 of file ToFPositionRecoAnalysis_module.cc.

Referenced by reconfigure().

art::InputTag beamlinereco::ToFPositionRecoAnalysis::fToFDigitLabel
private

Definition at line 127 of file ToFPositionRecoAnalysis_module.cc.

Referenced by analyze(), and reconfigure().

std::map<int, std::map<int, TH1D*> > beamlinereco::ToFPositionRecoAnalysis::hdtByChannel
private

Definition at line 133 of file ToFPositionRecoAnalysis_module.cc.

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

std::map<ToFCounter,TH1D*> beamlinereco::ToFPositionRecoAnalysis::hFirstHits
private

Definition at line 134 of file ToFPositionRecoAnalysis_module.cc.

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

std::map<ToFCounter,std::vector<TH2D*> > beamlinereco::ToFPositionRecoAnalysis::hPosn
private

Definition at line 136 of file ToFPositionRecoAnalysis_module.cc.

Referenced by analyze(), and beginJob().

std::map<ToFCounter,std::vector<TH2D*> > beamlinereco::ToFPositionRecoAnalysis::hPosnRecoDump
private

Definition at line 135 of file ToFPositionRecoAnalysis_module.cc.

Referenced by analyze(), and endJob().

std::map<ToFCounter,std::vector<TH1D*> > beamlinereco::ToFPositionRecoAnalysis::hPosnSpread
private

Definition at line 137 of file ToFPositionRecoAnalysis_module.cc.

Referenced by analyze(), and beginJob().

TH1D* beamlinereco::ToFPositionRecoAnalysis::hToF
private

Definition at line 132 of file ToFPositionRecoAnalysis_module.cc.

Referenced by analyze(), and beginJob().

std::map<ToFCounter,int> beamlinereco::ToFPositionRecoAnalysis::nEvents
private

Definition at line 142 of file ToFPositionRecoAnalysis_module.cc.

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

std::map<ToFCounter,int> beamlinereco::ToFPositionRecoAnalysis::nFourHitEvents
private

Definition at line 141 of file ToFPositionRecoAnalysis_module.cc.

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

std::map<ToFCounter,int> beamlinereco::ToFPositionRecoAnalysis::nHighSpreadPosns
private

Definition at line 143 of file ToFPositionRecoAnalysis_module.cc.

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

std::map<ToFCounter,std::vector<int> > beamlinereco::ToFPositionRecoAnalysis::nNonphysicalPosns
private

Definition at line 140 of file ToFPositionRecoAnalysis_module.cc.

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

std::map<ToFCounter,std::vector<int> > beamlinereco::ToFPositionRecoAnalysis::nPhysicalPosns
private

Definition at line 139 of file ToFPositionRecoAnalysis_module.cc.

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

ToFPositionFinder* beamlinereco::ToFPositionRecoAnalysis::posnfinder
private

Definition at line 145 of file ToFPositionRecoAnalysis_module.cc.

Referenced by analyze(), and beginJob().

art::ServiceHandle<art::TFileService> beamlinereco::ToFPositionRecoAnalysis::tfs
private

Definition at line 122 of file ToFPositionRecoAnalysis_module.cc.

Referenced by beginJob(), and endJob().


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