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

Public Types

using WorkerType = WorkerT< EDAnalyzer >
 
using ModuleType = EDAnalyzer
 

Public Member Functions

 LightLevels (fhicl::ParameterSet const &p)
 
virtual ~LightLevels ()
 
void analyze (art::Event const &e) override
 
void beginJob () override
 
void beginRun (const art::Run &run) override
 
void beginSubRun (const art::SubRun &sr) override
 
void endSubRun (const art::SubRun &sr) override
 
void endRun (const art::Run &run) override
 
void CreateHistos ()
 
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

TH1D * fNSpills
 
TH1D * fNActiveCells
 
TH1D * fExposure
 
TH1D * fCellScaledExposure_us
 
TH2D * fPEperCM
 
TH2D * fPEperCM_X
 
TH2D * fPEperCM_Y
 
TH2D * fPEperCM_all
 
TH2D * fPEperCM_all_X
 
TH2D * fPEperCM_all_Y
 
TH1D * fPEperCM1D
 
TH1D * fPEperCM1D_X
 
TH1D * fPEperCM1D_Y
 
TH1D * fPEperCM1D_all
 
TH1D * fPEperCM1D_all_X
 
TH1D * fPEperCM1D_all_Y
 
TH1D * fPE
 
TH1D * fPE_X
 
TH1D * fPE_Y
 
TH1D * fPE_all
 
TH1D * fPE_all_X
 
TH1D * fPE_all_Y
 
TH1D * fPathLength
 
TH1D * fPathLength_X
 
TH1D * fPathLength_Y
 
TH1D * fPathLength_all
 
TH1D * fPathLength_all_X
 
TH1D * fPathLength_all_Y
 
TH1D * fCosDirX
 
TH1D * fCosDirY
 
TH1D * fCosDirZ
 
TH1D * fPhysicsHits
 
TH1D * fNoiseHits
 
TH2D * fNoiseHitsPerCell
 
TH3D * fNoiseHits3D
 
TTree * fLightLevelTree
 
Float_t _pathLength
 
Float_t _w
 
Float_t _pe
 
Int_t _plane
 
Int_t _cell
 
Float_t _distFromEnd
 
Bool_t _isStopper
 
Float_t _cosX
 
Float_t _cosY
 
Float_t _cosZ
 
Bool_t _isX
 
double fTotExposure_us
 
double fMaxW
 
bool fFirstTime
 
bool fMakeTree
 
bool fUseBeam
 
std::vector< std::stringfQualLabels
 

Detailed Description

Definition at line 70 of file LightLevels_module.cc.

Member Typedef Documentation

Definition at line 39 of file EDAnalyzer.h.

Definition at line 38 of file EDAnalyzer.h.

Constructor & Destructor Documentation

LightLevels::LightLevels ( fhicl::ParameterSet const &  p)
explicit

Definition at line 159 of file LightLevels_module.cc.

159  :
160  EDAnalyzer(p), fMakeTree( p.get<bool>("MakeTree") ), fUseBeam( p.get<bool>("UseBeam") )
161 {}
const char * p
Definition: xmltok.h:285
EDAnalyzer(Table< Config > const &config)
Definition: EDAnalyzer.h:100
LightLevels::~LightLevels ( )
virtual

Definition at line 163 of file LightLevels_module.cc.

164 {}

Member Function Documentation

void LightLevels::analyze ( art::Event const &  e)
overridevirtual

Implements art::EDAnalyzer.

Definition at line 307 of file LightLevels_module.cc.

References _cell, _cosX, _cosY, _cosZ, _distFromEnd, _isStopper, _isX, _pathLength, _pe, _plane, _w, rawdata::RawDigit::ADC(), getBrightness::cell, geo::PlaneGeo::Cell(), om::cerr, visualisationForPaperMasterPlot::cmap, om::cout, DEFINE_ART_MODULE(), geo::GeometryBase::DetId(), geo::LiveGeometry::DistToEdgeX(), geo::LiveGeometry::DistToEdgeXY(), geo::LiveGeometry::DistToEdgeZ(), geo::LiveGeometry::DistToFront(), geo::LiveGeometry::DistToTop(), dx, dy, dz, e, allTimeWatchdog::endl, stan::math::fabs(), art::Handle< T >::failedToGet(), fCosDirX, fCosDirY, fCosDirZ, fExposure, geo::GeometryBase::FirstPlaneInMuonCatcher(), fLightLevelTree, fMakeTree, fNoiseHits, fNoiseHits3D, fNoiseHitsPerCell, fNSpills, fPathLength, fPathLength_all, fPathLength_all_X, fPathLength_all_Y, fPathLength_X, fPathLength_Y, fPE, fPE_all, fPE_all_X, fPE_all_Y, fPE_X, fPE_Y, fPEperCM, fPEperCM1D, fPEperCM1D_all, fPEperCM1D_all_X, fPEperCM1D_all_Y, fPEperCM1D_X, fPEperCM1D_Y, fPEperCM_all, fPEperCM_all_X, fPEperCM_all_Y, fPEperCM_X, fPEperCM_Y, fPhysicsHits, fQualLabels, fTotExposure_us, art::DataViewImpl::getByLabel(), cmap::dataprov::CMap::GetCell(), cmap::dataprov::CMap::GetPlane(), make_syst_table_plots::h, geo::CellGeo::HalfL(), hits(), MECModelEnuComparisons::i, makeTrainCVSamples::int, calib::j, novadaq::cnv::kFARDET, novadaq::cnv::kNEARDET, geo::kX, geo::kXorY, std::min(), rawdata::RawDigit::NADC(), geo::GeometryBase::Plane(), NDAPDHVSetting::plane, string, rb::CellHit::TNS(), track, w, and submit_syst::x.

308 {
309  /*
310  art::Handle<std::vector<rawdata::RawTrigger> > trigs;
311  evt.getByLabel("daq", trigs);
312  bool isDDT(true);
313  for(unsigned int n = 0; n < trigs->size(); ++n) {
314  const rawdata::RawTrigger& trig = (*trigs)[n];
315  std::cout << "Trigger length = " << trig.fTriggerRange_TriggerLength << std::endl;
316  //fTotExposure_us += trig.fTriggerRange_TriggerLength*500*1e-3;
317  if (trig.fTriggerRange_TriggerLength >= 1000)
318  {
319  isDDT = false;
320  fTotExposure_us += 500;
321  }
322  else
323  {
324  isDDT = true;
325  fTotExposure_us += 50;
326  }
327  }
328  */
329  //use beam or cosmic triggers and only take from 25 us to 175 us
330  fTotExposure_us += 150;
331 
332  std::string trackLabel = "cosmictrack";
333  std::string pclistLabel = "pclist";
334 
336 
337  //if there are no hits, this event was probably filtered
338 
340  evt.getByLabel("calhit", hits);
341  if (hits.failedToGet())
342  {
343  //std::cerr << "Failed to get calhits" << std::endl;
344  return;
345  }
346 
347  fNSpills->Fill(1);
348 
349  // get the slices
351  evt.getByLabel("slicer", slices);
352  if (slices.failedToGet()) {
353  std::cerr << "Failed to get slices" << std::endl;
354  return;
355  }
356 
357  double minTime(999999.0);
358  double maxTime(-999999.0);
359  for(unsigned int i = 0; i < hits->size(); ++i)
360  {
361  double tns = (*hits)[i].TNS();
362  //double tns = (*hits)[i].TDC();
363  if (i == 0) {
364  maxTime = tns;
365  minTime = tns;
366  }
367  else {
368  if (tns > maxTime) maxTime = tns;
369  if (tns < minTime) minTime = tns;
370  }
371  }
372  //std::cout << "minTime = " << minTime*1e-3 << " maxTime = " << maxTime*1e-3 << std::endl;
373  //std::cout << "minTime = " << minTime*1e-3 << " maxTime = " << maxTime*1e-3 << std::endl;
374 
375  double deltaTUS = fExposure->GetBinContent(1);
376  //deltaTMS += (maxTime - minTime)/1.0e6;
377  deltaTUS += 150.;
378  fExposure->SetBinContent(1, deltaTUS);
379 
381 
382  for(unsigned int i = 0; i < slices->size(); ++i) {
383  if ((*slices)[i].IsNoise()) {
384  std::cout << "N Hits in noise slice: " << (*slices)[i].NCell() << std::endl;
385  for(unsigned int j = 0; j < (*slices)[i].NCell(); ++j) {
386  const rb::CellHit* h = (*slices)[i].Cell(j).get();
387  double tus = h->TNS()*1e-3;
388  //if ( (isDDT && (tus >= 0 && tus <= 50)) || (!isDDT && (tus >= 0 && tus <= 500)) )
389  if (tus >= 25 && tus <= 175)
390  {
391  fNoiseHits->Fill( h->ADC() );
392  if (h->NADC() > 1) fNoiseHits3D->Fill( h->ADC(1) - h->ADC(0), h->ADC(2) - h->ADC(0), h->ADC(3) - h->ADC(0) );
393  const int plane = cmap->GetPlane(h);
394  const int cell = cmap->GetCell(h);
395  double nhits = fNoiseHitsPerCell->GetBinContent(plane, cell);
396  nhits += 1.0;
397  fNoiseHitsPerCell->SetBinContent(plane, cell, nhits);
398  }
399  }
400  }
401  else {
402  int nhits = (*slices)[i].NCell();
403  art::FindManyP<rb::Track> fmptrks(slices, evt, art::InputTag(trackLabel));
404  if (!fmptrks.isValid()) {
405  std::cerr << "No associated cosmic tracks for slice!" << std::endl;
406  return;
407  }
408  int nTrackHits(0);
409  std::vector<art::Ptr<rb::Track> > sliceTracks = fmptrks.at(i);
410  for( auto const& slcTrk: sliceTracks ) {
411  nTrackHits += slcTrk->NCell();
412  }
413  fPhysicsHits->Fill(nhits - nTrackHits);
414  }
415  }
416 
418  evt.getByLabel(trackLabel, tracks);
419  if (tracks.failedToGet()) {
420  std::cerr << "Failed to get cosmic tracks" << std::endl;
421  return;
422  }
423  if (tracks->empty()) {
424  //std::cerr << "Empty cosmic tracks container" << std::endl;
425  return;
426  }
427 
428  for (size_t trkIdx = 0; trkIdx < tracks->size(); ++trkIdx) {
429  const rb::Track* track(&tracks->at(trkIdx));
430 
431  //3D tracks
432  if(track->View() != geo::kXorY) continue;
433 
434  //sufficient length for track window
435  if ( track->TotalLength() < 200. ) continue;
436 
437  double dx = std::fabs( track->Dir().X() );
438  double dy = std::fabs( track->Dir().Y() );
439  double dz = std::fabs( track->Dir().Z() );
440 
441  fCosDirX->Fill( dx );
442  fCosDirY->Fill( dy );
443  fCosDirZ->Fill( dz );
444 
445  _cosX = dx;
446  _cosY = dy;
447  _cosZ = dz;
448 
449  //Determine if tracks come from outside and stop
451 
452  double distStartToFront = livegeo->DistToFront(track->Start());
453  double distStartToTop = livegeo->DistToTop(track->Start());
454  double distStartToSide = livegeo->DistToEdgeX(track->Start());
455 
456  //physical starts
457 
458  if (distStartToFront < 0) continue;
459  if (distStartToTop < 0) continue;
460  if (distStartToSide < 10) continue;
461 
462  //if (fUseBeam && distStartToFront > 10) continue;
463  //if (!fUseBeam && distStartToTop > 10) continue;
464 
465  //make sure it start near front for neardet (must be rock muon)
466  if (geo->DetId() == novadaq::cnv::kNEARDET && distStartToFront > 10) continue;
467  //make sure it start near top for fardet (must be cosmic muon)
468  if (geo->DetId() == novadaq::cnv::kFARDET && distStartToTop > 10) continue;
469  //moving to the activity trigger
470  //if (distStartToTop > 10) continue;
471 
472  // endpoint isn't contained
473  double distEndToEdge = std::min(livegeo->DistToEdgeXY(track->Stop()), livegeo->DistToEdgeZ(track->Stop()));
474  bool isStopper = true;
475  if (distEndToEdge < 50) isStopper = false;
476 
477  // fetch pc hits
478  for (size_t iQual = 0; iQual < fQualLabels.size(); ++iQual) {
479  art::FindManyP<caldp::PCHit> fmpcxy(tracks, evt, art::InputTag(pclistLabel, fQualLabels[iQual].c_str()) );
480  if (!fmpcxy.isValid()) {
481  std::cerr << "No associated pchits for cosmic tracks!" << std::endl;
482  return;
483  }
484 
485  std::vector<art::Ptr<caldp::PCHit> > pcxy = fmpcxy.at(trkIdx);
486  //std::cout << pcxy.size() << " pchits" << std::endl;
487  for( auto const& iPc: pcxy ) {
488  double pathLength = iPc->Path();
489  double w = iPc->W();
490  double pe = iPc->PE();
491  int plane = iPc->Plane();
492  int cell = iPc->Cell();
493 
494  //remove the first module in each plane (potential light contamination)
495  //if (cell < 32) continue;
496 
497  //don't keep hits in the muon catcher
498  if(geo->DetId() == novadaq::cnv::kNEARDET && plane >= int(geo->FirstPlaneInMuonCatcher())) continue;
499 
500  //maxW - |w| < 0.75*maxW -> away from the edges that might be affected by the roll-offs
501  const double maxW = geo->Plane(plane)->Cell(cell)->HalfL();
502  bool isCentral = (maxW - std::fabs(w) < 0.75*maxW);
503 
504  double x = track->TotalLength() - iPc->FlightLen();
505 
506  _pathLength = pathLength;
507  _w = w;
508  _pe = pe;
509  _plane = plane;
510  _cell = cell;
511  _distFromEnd = x;
512  _isStopper = isStopper;
513  if (iPc->View() == geo::kX) _isX = true;
514  else _isX = false;
515 
516  if (fMakeTree) fLightLevelTree->Fill();
517 
518  //remove potentially low efficiency cells and low oil cells
519  //int modcell = cell%32;
520  //if ( modcell == 7 || modcell == 15 || modcell == 23 || modcell == 31) continue;
521  //if ( iPc->View() == geo::kY && modcell == 30) continue;
522 
523  fPEperCM_all->Fill( maxW - w, pe/pathLength );
524  fPathLength_all->Fill( pathLength );
525  if (isCentral) {
526  fPE_all->Fill(pe);
527  fPEperCM1D_all->Fill( pe/pathLength );
528  }
529  if (iPc->View() == geo::kX) {
530  fPEperCM_all_X->Fill( maxW - w, pe/pathLength );
531  fPathLength_all_X->Fill( pathLength );
532  if (isCentral) {
533  fPE_all_X->Fill(pe);
534  fPEperCM1D_all_X->Fill( pe/pathLength );
535  }
536  }
537  else {
538  fPEperCM_all_Y->Fill( maxW - w, pe/pathLength );
539  fPathLength_all_Y->Fill( pathLength );
540  if (isCentral) {
541  fPE_all_Y->Fill(pe);
542  fPEperCM1D_all_Y->Fill( pe/pathLength );
543  }
544  }
545 
546  if (!isStopper) continue;
547  if (x < 100 || x > 200) continue;
548 
549  fPEperCM->Fill( maxW - w, pe/pathLength );
550  fPathLength->Fill( pathLength );
551  if (isCentral) {
552  fPE->Fill(pe);
553  fPEperCM1D->Fill( pe/pathLength );
554  }
555  if (iPc->View() == geo::kX) {
556  fPEperCM_X->Fill( maxW - w, pe/pathLength );
557  fPathLength_X->Fill( pathLength );
558  if (isCentral) {
559  fPE_X->Fill(pe);
560  fPEperCM1D_X->Fill( pe/pathLength );
561  }
562  }
563  else {
564  fPEperCM_Y->Fill( maxW - w, pe/pathLength );
565  fPathLength_Y->Fill( pathLength );
566  if (isCentral) {
567  fPE_Y->Fill(pe);
568  fPEperCM1D_Y->Fill( pe/pathLength );
569  }
570  }
571  }
572  }
573  }
574 }
float TNS() const
Definition: CellHit.h:46
double HalfL() const
Definition: CellGeo.cxx:198
fvar< T > fabs(const fvar< T > &x)
Definition: fabs.hpp:15
X or Y views.
Definition: PlaneGeo.h:30
double DistToEdgeXY(TVector3 vertex)
const CellGeo * Cell(int icell) const
Definition: PlaneGeo.h:48
Vertical planes which measure X.
Definition: PlaneGeo.h:28
Definition: event.h:19
OStream cerr
Definition: OStream.cxx:7
std::vector< std::string > fQualLabels
A rb::Prong with full reconstructed trajectory.
Definition: Track.h:20
double DistToEdgeX(TVector3 vertex)
double DistToFront(TVector3 vertex)
const PlaneGeo * Plane(unsigned int i) const
double DistToTop(TVector3 vertex)
Far Detector at Ash River, MN.
void hits()
Definition: readHits.C:15
double dy[NP][NC]
double dx[NP][NC]
double DistToEdgeZ(TVector3 vertex)
double dz[NP][NC]
novadaq::cnv::DetId DetId() const
Prefer ds::DetectorService::DetId() instead.
Definition: GeometryBase.h:243
int evt
Near Detector in the NuMI cavern.
unsigned short GetPlane(const rawdata::RawDigit *dig)
Definition: CMap.cxx:285
const double j
Definition: BetheBloch.cxx:29
OStream cout
Definition: OStream.cxx:6
A rawdata::RawDigit with channel information decoded.
Definition: CellHit.h:27
int16_t ADC(uint32_t i) const
Definition: RawDigit.cxx:58
uint32_t NADC() const
Definition: RawDigit.h:81
unsigned short GetCell(const rawdata::RawDigit *dig)
Definition: CMap.cxx:327
T min(const caf::Proxy< T > &a, T b)
Float_t e
Definition: plot.C:35
Helper for AttenCurve.
Definition: Path.h:10
Float_t track
Definition: plot.C:35
Float_t w
Definition: plot.C:20
bool failedToGet() const
Definition: Handle.h:196
const unsigned int FirstPlaneInMuonCatcher() const
Returns the index of the first plane contained in the muon catcher.
enum BeamMode string
void LightLevels::beginJob ( )
overridevirtual

Reimplemented from art::EDAnalyzer.

Definition at line 166 of file LightLevels_module.cc.

References fFirstTime.

167 {
168  fFirstTime = true;
169 }
void LightLevels::beginRun ( const art::Run run)
override

Definition at line 301 of file LightLevels_module.cc.

References CreateHistos().

302 {
303  CreateHistos();
304  return;
305 }
void LightLevels::beginSubRun ( const art::SubRun sr)
override

Definition at line 171 of file LightLevels_module.cc.

References fTotExposure_us.

172 {
173  fTotExposure_us = 0.0;
174 }
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
void LightLevels::CreateHistos ( )

Definition at line 213 of file LightLevels_module.cc.

References _cell, _cosX, _cosY, _cosZ, _distFromEnd, _isStopper, _isX, _pathLength, _pe, _plane, _w, getBrightness::cell, geo::PlaneGeo::Cell(), fCellScaledExposure_us, fCosDirX, fCosDirY, fCosDirZ, fExposure, fFirstTime, fLightLevelTree, fMaxW, fNActiveCells, fNoiseHits, fNoiseHits3D, fNoiseHitsPerCell, fNSpills, fPathLength, fPathLength_all, fPathLength_all_X, fPathLength_all_Y, fPathLength_X, fPathLength_Y, fPE, fPE_all, fPE_all_X, fPE_all_Y, fPE_X, fPE_Y, fPEperCM, fPEperCM1D, fPEperCM1D_all, fPEperCM1D_all_X, fPEperCM1D_all_Y, fPEperCM1D_X, fPEperCM1D_Y, fPEperCM_all, fPEperCM_all_X, fPEperCM_all_Y, fPEperCM_X, fPEperCM_Y, fPhysicsHits, fQualLabels, geo::CellGeo::HalfL(), art::TFileDirectory::make(), geo::PlaneGeo::Ncells(), geo::GeometryBase::NPlanes(), geo::GeometryBase::Plane(), and NDAPDHVSetting::plane.

Referenced by beginRun().

214 {
215  if (!fFirstTime) return;
216 
219 
220  fMaxW = 0;
221  unsigned int maxCells(0);
222  unsigned int nPlanes = geo->NPlanes();
223  for (unsigned int plane = 0; plane < nPlanes; plane++) {
224  if (geo->Plane(plane)->Ncells() > maxCells) maxCells = geo->Plane(plane)->Ncells();
225  for (unsigned int cell = 0; cell < geo->Plane(plane)->Ncells(); cell++) {
226  if (geo->Plane(plane)->Cell(cell)->HalfL() > fMaxW) fMaxW = geo->Plane(plane)->Cell(cell)->HalfL();
227  }
228  }
229 
230  double cmPerBin = 5.0;
231  int nBinsW = 2.*fMaxW/cmPerBin;
232 
233  fNSpills = tfs->make<TH1D>("fNSpills", ";Number of Spills", 1, 0, 2);
234  fNActiveCells = tfs->make<TH1D>("fNActiveCells", ";Number of Active Cells", 1, 0, 2);
235  fExposure = tfs->make<TH1D>("fExposure", ";Total Exposure Time (us)", 1, 0, 2);
236  fCellScaledExposure_us = tfs->make<TH1D>("fCellScaledExposure_us", ";Exposure*Active Cells (us)", 1, 0, 2);
237 
238  fPEperCM = tfs->make<TH2D>("pPEperCM", ";Distance to Readout End of Cell; PE/Pathlength", nBinsW, 0, 2*fMaxW, 2000, 0, 500);
239  fPEperCM_X = tfs->make<TH2D>("pPEperCM_X",";Distance to Readout End of Cell (X View); PE/Pathlength", nBinsW, 0, 2*fMaxW, 2000, 0, 500);
240  fPEperCM_Y = tfs->make<TH2D>("pPEperCM_Y",";Distance to Readout End of Cell (Y View); PE/Pathlength", nBinsW, 0, 2*fMaxW, 2000, 0, 500);
241 
242  fPEperCM_all = tfs->make<TH2D>("pPEperCM_all", ";Distance to Readout End of Cell; PE/Pathlength", nBinsW, 0, 2*fMaxW, 2000, 0, 500);
243  fPEperCM_all_X = tfs->make<TH2D>("pPEperCM_all_X",";Distance to Readout End of Cell (X View); PE/Pathlength", nBinsW, 0, 2*fMaxW, 2000, 0, 500);
244  fPEperCM_all_Y = tfs->make<TH2D>("pPEperCM_all_Y",";Distance to Readout End of Cell (Y View); PE/Pathlength", nBinsW, 0, 2*fMaxW, 2000, 0, 500);
245 
246  fPEperCM1D = tfs->make<TH1D>("fPEperCM1D", ";Mean PE/Pathlength", 2000, 0, 500);
247  fPEperCM1D_X = tfs->make<TH1D>("fPEperCM1D_X",";Mean PE/Pathlength", 2000, 0, 500);
248  fPEperCM1D_Y = tfs->make<TH1D>("fPEperCM1D_Y",";Mean PE/Pathlength", 2000, 0, 500);
249 
250  fPEperCM1D_all = tfs->make<TH1D>("fPEperCM1D_all", ";Mean PE/Pathlength", 2000, 0, 500);
251  fPEperCM1D_all_X = tfs->make<TH1D>("fPEperCM1D_all_X",";Mean PE/Pathlength", 2000, 0, 500);
252  fPEperCM1D_all_Y = tfs->make<TH1D>("fPEperCM1D_all_Y",";Mean PE/Pathlength", 2000, 0, 500);
253 
254  fPE = tfs->make<TH1D>("fPE", ";Hit PE", 512, 0, 2048);
255  fPE_X = tfs->make<TH1D>("fPE_X", ";Hit PE: X View", 512, 0, 2048);
256  fPE_Y = tfs->make<TH1D>("fPE_Y", ";Hit PE: Y View", 512, 0, 2048);
257 
258  fPE_all = tfs->make<TH1D>("fPE_all", ";Hit PE", 512, 0, 2048);
259  fPE_all_X = tfs->make<TH1D>("fPE_all_X", ";Hit PE: X View", 512, 0, 2048);
260  fPE_all_Y = tfs->make<TH1D>("fPE_all_Y", ";Hit PE: Y View", 512, 0, 2048);
261 
262  fPathLength = tfs->make<TH1D>("fPathLength", ";Path Length", 100 ,0, 10);
263  fPathLength_X = tfs->make<TH1D>("fPathLength_X", ";Path Length: X View", 100 ,0, 10);
264  fPathLength_Y = tfs->make<TH1D>("fPathLength_Y", ";Path Length: Y View", 100 ,0, 10);
265 
266  fPathLength_all = tfs->make<TH1D>("fPathLength_all", ";Path Length", 100 ,0, 10);
267  fPathLength_all_X = tfs->make<TH1D>("fPathLength_all_X", ";Path Length: X View", 100 ,0, 10);
268  fPathLength_all_Y = tfs->make<TH1D>("fPathLength_all_Y", ";Path Length: Y View", 100 ,0, 10);
269 
270  fCosDirX = tfs->make<TH1D>("fCosDirX", ";X Direction Cosine", 100, 0, 1);
271  fCosDirY = tfs->make<TH1D>("fCosDirY", ";Y Direction Cosine", 100, 0, 1);
272  fCosDirZ = tfs->make<TH1D>("fCosDirZ", ";Z Direction Cosine", 100, 0, 1);
273 
274  fPhysicsHits = tfs->make<TH1D>("fPhysicsHits", ";N Physics Hits",1000, 0, 1000);
275 
276  fNoiseHits = tfs->make<TH1D>("fNoiseHits", ";Noise Slice ADC", 512, 0, 4095);
277  fNoiseHitsPerCell = tfs->make<TH2D>("fNoiseHitsPerCell", ";Plane;Cell;Noise Hits", nPlanes, 0, nPlanes-1, maxCells, 0, maxCells-1);
278  fNoiseHits3D = tfs->make<TH3D>("fNoiseHits3D", ";ADC1-ADC0;ADC2-ADC0;ADC3-ADC0", 150, 0, 300, 150, 0, 300, 150, 0, 300);
279 
280  fLightLevelTree = tfs->make<TTree>("lightLevelTree","Information for setting light levels");
281 
282  fLightLevelTree->Branch("pathLength", &_pathLength, "pathLength/F");
283  fLightLevelTree->Branch("w", &_w, "w/F");
284  fLightLevelTree->Branch("pe", &_pe, "pe/F");
285  fLightLevelTree->Branch("plane", &_plane, "plane/I");
286  fLightLevelTree->Branch("cell", &_cell, "cell/I");
287  fLightLevelTree->Branch("distFromEnd", &_distFromEnd, "distFromENd/F");
288  fLightLevelTree->Branch("isStopper", &_isStopper, "isStopper/B");
289  fLightLevelTree->Branch("isX", &_isX, "isX/B");
290  fLightLevelTree->Branch("cosX", &_cosX, "coxX/F");
291  fLightLevelTree->Branch("cosY", &_cosY, "coxY/F");
292  fLightLevelTree->Branch("cosZ", &_cosZ, "cosZ/F");
293 
294  //fQualLabels.push_back("pathQualXY");
295  //fQualLabels.push_back("pathQualZ");
296  fQualLabels.push_back("pathQualTraj");
297  fFirstTime = false;
298  return;
299 }
double HalfL() const
Definition: CellGeo.cxx:198
TH1D * fCellScaledExposure_us
const CellGeo * Cell(int icell) const
Definition: PlaneGeo.h:48
unsigned int Ncells() const
Number of cells in this plane.
Definition: PlaneGeo.h:43
std::vector< std::string > fQualLabels
const PlaneGeo * Plane(unsigned int i) const
T * make(ARGS...args) const
unsigned int NPlanes() const
Helper for AttenCurve.
Definition: Path.h:10
CurrentProcessingContext const* art::EDAnalyzer::currentContext ( ) const
protectedinherited
void LightLevels::endRun ( const art::Run run)
override

Definition at line 199 of file LightLevels_module.cc.

200 {
201  //Fill fNActiveCells with the number of non-zero cells in fNoiseHitsPerCell
202  /*
203  double nActiveCells(0.0);
204  for (int iX = 1; iX <= fNoiseHitsPerCell->GetXaxis()->GetNbins(); ++iX) {
205  for (int iY = 1; iY <= fNoiseHitsPerCell->GetYaxis()->GetNbins(); ++iY) {
206  if (fNoiseHitsPerCell->GetBinContent(iX, iY) > 0) nActiveCells += 1.0;
207  }
208  }
209  fNActiveCells->SetBinContent(1, nActiveCells);
210  */
211 }
void LightLevels::endSubRun ( const art::SubRun sr)
override

Definition at line 176 of file LightLevels_module.cc.

References getBrightness::cell, fCellScaledExposure_us, fNActiveCells, fNSpills, fTotExposure_us, geom(), geo::GeometryBase::GetPlanesByView(), chaninfo::BadChanList::IsBad(), it, geo::kXorY, makeBrightnessMap::maxCell, geo::PlaneGeo::Ncells(), geo::GeometryBase::Plane(), and NDAPDHVSetting::plane.

177 {
180 
181  unsigned int nLiveChans = 0;
182  const std::set<unsigned int>& planes = geom->GetPlanesByView(geo::kXorY);
183  for(std::set<unsigned int>::const_iterator it = planes.begin(); it != planes.end(); ++it){
184  const unsigned int plane = *it;
185  const unsigned int maxCell = geom->Plane(plane)->Ncells();
186  for(unsigned int cell = 0; cell < maxCell; ++cell){
187  if(!badChans->IsBad(plane, cell)) ++nLiveChans;
188  } // end for cell
189  } // end for it
190  mf::LogInfo("LightLevels") << "There are " << nLiveChans << " live channels " << fTotExposure_us << "us total exposure " << fTotExposure_us/fNSpills->Integral() << "us exposure/spill";
191  fCellScaledExposure_us->SetBinContent(1, nLiveChans*fTotExposure_us);
192 
193  double totActiveCells = fNActiveCells->GetBinContent(1);
194  totActiveCells += nLiveChans;
195  fNActiveCells->SetBinContent(1, totActiveCells);
196 }
set< int >::iterator it
TH1D * fCellScaledExposure_us
X or Y views.
Definition: PlaneGeo.h:30
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
unsigned int Ncells() const
Number of cells in this plane.
Definition: PlaneGeo.h:43
const PlaneGeo * Plane(unsigned int i) const
const std::set< unsigned int > & GetPlanesByView(View_t v=kXorY) const
void geom(int which=0)
Definition: geom.C:163
bool IsBad(int plane, int cell)
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 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

Int_t LightLevels::_cell
private

Definition at line 140 of file LightLevels_module.cc.

Referenced by analyze(), and CreateHistos().

Float_t LightLevels::_cosX
private

Definition at line 143 of file LightLevels_module.cc.

Referenced by analyze(), and CreateHistos().

Float_t LightLevels::_cosY
private

Definition at line 144 of file LightLevels_module.cc.

Referenced by analyze(), and CreateHistos().

Float_t LightLevels::_cosZ
private

Definition at line 145 of file LightLevels_module.cc.

Referenced by analyze(), and CreateHistos().

Float_t LightLevels::_distFromEnd
private

Definition at line 141 of file LightLevels_module.cc.

Referenced by analyze(), and CreateHistos().

Bool_t LightLevels::_isStopper
private

Definition at line 142 of file LightLevels_module.cc.

Referenced by analyze(), and CreateHistos().

Bool_t LightLevels::_isX
private

Definition at line 146 of file LightLevels_module.cc.

Referenced by analyze(), and CreateHistos().

Float_t LightLevels::_pathLength
private

Definition at line 136 of file LightLevels_module.cc.

Referenced by analyze(), and CreateHistos().

Float_t LightLevels::_pe
private

Definition at line 138 of file LightLevels_module.cc.

Referenced by analyze(), and CreateHistos().

Int_t LightLevels::_plane
private

Definition at line 139 of file LightLevels_module.cc.

Referenced by analyze(), and CreateHistos().

Float_t LightLevels::_w
private

Definition at line 137 of file LightLevels_module.cc.

Referenced by analyze(), and CreateHistos().

TH1D* LightLevels::fCellScaledExposure_us
private

Definition at line 90 of file LightLevels_module.cc.

Referenced by CreateHistos(), and endSubRun().

TH1D* LightLevels::fCosDirX
private

Definition at line 124 of file LightLevels_module.cc.

Referenced by analyze(), and CreateHistos().

TH1D* LightLevels::fCosDirY
private

Definition at line 125 of file LightLevels_module.cc.

Referenced by analyze(), and CreateHistos().

TH1D* LightLevels::fCosDirZ
private

Definition at line 126 of file LightLevels_module.cc.

Referenced by analyze(), and CreateHistos().

TH1D* LightLevels::fExposure
private

Definition at line 89 of file LightLevels_module.cc.

Referenced by analyze(), and CreateHistos().

bool LightLevels::fFirstTime
private

Definition at line 152 of file LightLevels_module.cc.

Referenced by beginJob(), and CreateHistos().

TTree* LightLevels::fLightLevelTree
private

Definition at line 134 of file LightLevels_module.cc.

Referenced by analyze(), and CreateHistos().

bool LightLevels::fMakeTree
private

Definition at line 153 of file LightLevels_module.cc.

Referenced by analyze().

double LightLevels::fMaxW
private

Definition at line 150 of file LightLevels_module.cc.

Referenced by CreateHistos().

TH1D* LightLevels::fNActiveCells
private

Definition at line 88 of file LightLevels_module.cc.

Referenced by CreateHistos(), and endSubRun().

TH1D* LightLevels::fNoiseHits
private

Definition at line 130 of file LightLevels_module.cc.

Referenced by analyze(), and CreateHistos().

TH3D* LightLevels::fNoiseHits3D
private

Definition at line 132 of file LightLevels_module.cc.

Referenced by analyze(), and CreateHistos().

TH2D* LightLevels::fNoiseHitsPerCell
private

Definition at line 131 of file LightLevels_module.cc.

Referenced by analyze(), and CreateHistos().

TH1D* LightLevels::fNSpills
private

Definition at line 87 of file LightLevels_module.cc.

Referenced by analyze(), CreateHistos(), and endSubRun().

TH1D* LightLevels::fPathLength
private

Definition at line 116 of file LightLevels_module.cc.

Referenced by analyze(), and CreateHistos().

TH1D* LightLevels::fPathLength_all
private

Definition at line 120 of file LightLevels_module.cc.

Referenced by analyze(), and CreateHistos().

TH1D* LightLevels::fPathLength_all_X
private

Definition at line 121 of file LightLevels_module.cc.

Referenced by analyze(), and CreateHistos().

TH1D* LightLevels::fPathLength_all_Y
private

Definition at line 122 of file LightLevels_module.cc.

Referenced by analyze(), and CreateHistos().

TH1D* LightLevels::fPathLength_X
private

Definition at line 117 of file LightLevels_module.cc.

Referenced by analyze(), and CreateHistos().

TH1D* LightLevels::fPathLength_Y
private

Definition at line 118 of file LightLevels_module.cc.

Referenced by analyze(), and CreateHistos().

TH1D* LightLevels::fPE
private

Definition at line 108 of file LightLevels_module.cc.

Referenced by analyze(), and CreateHistos().

TH1D* LightLevels::fPE_all
private

Definition at line 112 of file LightLevels_module.cc.

Referenced by analyze(), and CreateHistos().

TH1D* LightLevels::fPE_all_X
private

Definition at line 113 of file LightLevels_module.cc.

Referenced by analyze(), and CreateHistos().

TH1D* LightLevels::fPE_all_Y
private

Definition at line 114 of file LightLevels_module.cc.

Referenced by analyze(), and CreateHistos().

TH1D* LightLevels::fPE_X
private

Definition at line 109 of file LightLevels_module.cc.

Referenced by analyze(), and CreateHistos().

TH1D* LightLevels::fPE_Y
private

Definition at line 110 of file LightLevels_module.cc.

Referenced by analyze(), and CreateHistos().

TH2D* LightLevels::fPEperCM
private

Definition at line 92 of file LightLevels_module.cc.

Referenced by analyze(), and CreateHistos().

TH1D* LightLevels::fPEperCM1D
private

Definition at line 100 of file LightLevels_module.cc.

Referenced by analyze(), and CreateHistos().

TH1D* LightLevels::fPEperCM1D_all
private

Definition at line 104 of file LightLevels_module.cc.

Referenced by analyze(), and CreateHistos().

TH1D* LightLevels::fPEperCM1D_all_X
private

Definition at line 105 of file LightLevels_module.cc.

Referenced by analyze(), and CreateHistos().

TH1D* LightLevels::fPEperCM1D_all_Y
private

Definition at line 106 of file LightLevels_module.cc.

Referenced by analyze(), and CreateHistos().

TH1D* LightLevels::fPEperCM1D_X
private

Definition at line 101 of file LightLevels_module.cc.

Referenced by analyze(), and CreateHistos().

TH1D* LightLevels::fPEperCM1D_Y
private

Definition at line 102 of file LightLevels_module.cc.

Referenced by analyze(), and CreateHistos().

TH2D* LightLevels::fPEperCM_all
private

Definition at line 96 of file LightLevels_module.cc.

Referenced by analyze(), and CreateHistos().

TH2D* LightLevels::fPEperCM_all_X
private

Definition at line 97 of file LightLevels_module.cc.

Referenced by analyze(), and CreateHistos().

TH2D* LightLevels::fPEperCM_all_Y
private

Definition at line 98 of file LightLevels_module.cc.

Referenced by analyze(), and CreateHistos().

TH2D* LightLevels::fPEperCM_X
private

Definition at line 93 of file LightLevels_module.cc.

Referenced by analyze(), and CreateHistos().

TH2D* LightLevels::fPEperCM_Y
private

Definition at line 94 of file LightLevels_module.cc.

Referenced by analyze(), and CreateHistos().

TH1D* LightLevels::fPhysicsHits
private

Definition at line 128 of file LightLevels_module.cc.

Referenced by analyze(), and CreateHistos().

std::vector<std::string> LightLevels::fQualLabels
private

Definition at line 156 of file LightLevels_module.cc.

Referenced by analyze(), and CreateHistos().

double LightLevels::fTotExposure_us
private

Definition at line 148 of file LightLevels_module.cc.

Referenced by analyze(), beginSubRun(), and endSubRun().

bool LightLevels::fUseBeam
private

Definition at line 154 of file LightLevels_module.cc.


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