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

Public Types

using WorkerType = WorkerT< EDAnalyzer >
 
using ModuleType = EDAnalyzer
 

Public Member Functions

 EventListMaker (fhicl::ParameterSet const &pset)
 
virtual ~EventListMaker ()
 
 EventListMaker (EventListMaker const &)=delete
 
 EventListMaker (EventListMaker &&)=delete
 
EventListMakeroperator= (EventListMaker const &)=delete
 
EventListMakeroperator= (EventListMaker &&)=delete
 
void analyze (art::Event const &e) override
 
void beginJob () override
 
void beginRun (art::Run const &r) override
 
void endSubRun (art::SubRun const &sr) override
 
void reconfigure (fhicl::ParameterSet const &p)
 
void endJob () override
 
void respondToOpenInputFile (art::FileBlock const &fb) 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 Member Functions

void clear ()
 
std::string EpochName ()
 
void Serialize ()
 Store the Events in a ROOT file. More...
 
void InitializeEventListMaps ()
 
std::string RunToEpoch (int run)
 
fnex::BeamType_t BeamType (sumdata::SpillData const &spillInfo) const
 
void CheckNueFDPID (fnex::MetaData &md, fnex::DataVarVals const &dataVal) const
 

Private Attributes

std::vector< art::InputTagfSkimmerTags
 tags of the module that did the skimming More...
 
std::string fPOTLabel
 names of the module that did the skimming More...
 
std::string fSRDLabel
 names of the module that made the subrun data summary object More...
 
std::map< std::string, sumdata::POTSumfPOTSum
 total summary of the POT information More...
 
fnex::EventListMap fMDToEventsFull
 each entry in the vector is for a single slice More...
 
std::vector< std::unique_ptr< fnex::AnalysisSetupBase > > fAnalyses
 the analysis object More...
 
fnex::FileType_t fFileType
 get from the configuration for now More...
 
std::vector< fnex::SelectionType_tfSelectionTypes
 get from the analysis configuration More...
 
art::ServiceHandle< art::TFileServicefTFS
 TFileService. More...
 
art::ServiceHandle< ds::DetectorServicefDetService
 which detector? More...
 
art::ServiceHandle< nova::dbi::RunHistoryServicefRH
 RunHistory service. More...
 
sumdata::POTSum fNDStandardMCPOT
 standard number of POT/file (subrun) in ND MC More...
 
std::set< novadaq::cnv::DetIdfDetectorsSeen
 set of detector ids seen in this job More...
 
std::map< std::string, intfFilesPerEpoch
 number of files seen per epoch More...
 
std::set< std::stringfEpochsInListMap
 epochs placed in the event list maps More...
 
std::map< int, sumdata::POTSumfRunSubRunToPOT
 POT present for a given run/subrun. More...
 
std::map< int, std::set< int > > fRunSubRunCycles
 number of cycles for a MC run/subrun More...
 
float fNDSpillsPerFile
 spills in each ND file More...
 
int fCycle
 MC cycle number. More...
 
TRandom3 fRand
 RNG for the capping decisions. More...
 
std::string fHornLabel
 label of module storing spill info More...
 

Detailed Description

Definition at line 49 of file EventListMaker_module.cc.

Member Typedef Documentation

Definition at line 39 of file EDAnalyzer.h.

Definition at line 38 of file EDAnalyzer.h.

Constructor & Destructor Documentation

fnex::EventListMaker::EventListMaker ( fhicl::ParameterSet const &  pset)
explicit

Definition at line 104 of file EventListMaker_module.cc.

References clear(), fNDSpillsPerFile, fNDStandardMCPOT, sumdata::POTSum::goodspills, reconfigure(), sumdata::POTSum::totgoodpot, sumdata::POTSum::totpot, and sumdata::POTSum::totspills.

105  : EDAnalyzer(pset)
106  , fCycle(0)
107  , fRand(TRandom3(0))
108  {
109  // make sure everything is zeroed out.
110  this->clear();
111 
112  this->reconfigure(pset);
113 
118 
119  return;
120  }
void reconfigure(fhicl::ParameterSet const &p)
float fNDSpillsPerFile
spills in each ND file
int fCycle
MC cycle number.
EDAnalyzer(Table< Config > const &config)
Definition: EDAnalyzer.h:100
sumdata::POTSum fNDStandardMCPOT
standard number of POT/file (subrun) in ND MC
int goodspills
Definition: POTSum.h:31
int totspills
Definition: POTSum.h:30
double totgoodpot
normalized by 10^12 POT
Definition: POTSum.h:28
TRandom3 fRand
RNG for the capping decisions.
double totpot
normalized by 10^12 POT
Definition: POTSum.h:27
fnex::EventListMaker::~EventListMaker ( )
virtual

Definition at line 123 of file EventListMaker_module.cc.

References clear().

124  {
125  this->clear();
126  }
fnex::EventListMaker::EventListMaker ( EventListMaker const &  )
delete
fnex::EventListMaker::EventListMaker ( EventListMaker &&  )
delete

Member Function Documentation

void fnex::EventListMaker::analyze ( art::Event const &  e)
overridevirtual

Implements art::EDAnalyzer.

Definition at line 479 of file EventListMaker_module.cc.

References a, BeamType(), CheckNueFDPID(), fnex::MetaData::detector, ds::DetectorService::DetId(), EpochName(), fAnalyses, fCycle, fDetService, fFileType, fHornLabel, fMDToEventsFull, fRunSubRunCycles, fSelectionTypes, fSkimmerTags, fSRDLabel, art::DataViewImpl::getValidHandle(), plot_timing_data::horn, MECModelEnuComparisons::i, fnex::MetaData::isMC, art::Event::isRealData(), art::ValidHandle< T >::isValid(), it, simb::kNC, fnex::kNC, novadaq::cnv::kNEARDET, fnex::kNuEBarCC, fnex::kNuECC, fnex::kNuESelectionHighPID, fnex::kNuESelectionPeripheral, fnex::kNuMuBarCC, fnex::kNuMuCC, fnex::kNuTauBarCC, fnex::kNuTauCC, fnex::kTrueCCNC, fnex::kTruePDG, fnex::kUnknownInteraction, LOG_DEBUG, LOG_WARNING, fetch_tb_beamline_files::md, make_root_from_grid_output::pdg, art::Event::run(), fnex::MetaData::selectionType, art::Event::subRun(), and fnex::MetaData::ToString().

480  {
481 
482  //get the handle to the SpillData
484  if( !horn.isValid() ){
485  throw cet::exception("EventListMaker")
486  << "SpillData not found";
487  }
488 
489  //Get the Horn Orientation - FHC or RHC
490  auto beamType = this->BeamType(*horn);
491 
492  // get the handle to the stored SubRunData
493  // we store the SubRunData object at the event level to avoid the
494  // same issues we are getting with the POTSummary objects when
495  // there are multiple cycles. It is pretty stupid, but there we are
496  // The POTLabel reflects the cell skimmer.
497  auto srdHandle = e.getValidHandle<sumdata::SubRunData>(fSRDLabel);
498 
499  if( srdHandle.isValid() )
500  fCycle = srdHandle->Cycle();
501  else
502  LOG_WARNING("EventListMaker")
503  << "cannot find cycle info for "
504  << e.run()
505  << " "
506  << e.subRun();
507 
508  // Because this maps to a set, if we try to insert the same cycle number
509  // multiple times we still only get it once in the set
510  fRunSubRunCycles[e.run() * 1000 + e.subRun()].insert(fCycle);
511 
512  for(size_t a = 0; a < fAnalyses.size(); ++a){
513  LOG_DEBUG("EventListMaker")
514  << fSkimmerTags[a];
515 
516  auto slHandle = e.getValidHandle< std::vector<rb::Cluster> >(fSkimmerTags[a]);
517 
518  if( slHandle.isValid() ){
519 
520 // if(fSkimmerTags[a].instance().compare("nue") == 0 && slHandle->size() > 0)
521 // LOG_DEBUG("EventListMaker")
522 // << " there are "
523 // << slHandle->size()
524 // << " slices ";
525 
526  if(slHandle->size() < 1) continue;
527 
530  float pdg = 0;
531 
532  std::vector<fnex::DataVarVals> dataVals;
533  std::vector<fnex::MCVarVals > mcVals;
534  std::vector<fnex::EventId > evIds;
535 
536  fAnalyses[a]->FillVars(e, slHandle, fSkimmerTags[a], dataVals, mcVals, evIds, beamType);
537 
538  // check that the filled variable vectors are the same size
539  if(dataVals.size() != mcVals.size())
540  throw cet::exception("EventListMaker")
541  << "Data and MC variable vectors have different sizes: "
542  << dataVals.size()
543  << " : "
544  << mcVals.size()
545  << " cannot do anything with this slice, bail";
546 
547  // the analysis object returns a vector with a VarVals for each slice
548  // VarVals is an unordered map of strings to values
549 
550  for(size_t i = 0; i < dataVals.size(); ++i){
551 
552  fnex::EventPtr ev = std::make_shared<fnex::Event>();
553 
555 
556  // figure out the interaction type and then get the correct metadata
557  // for it
558  if(!e.isRealData()){
559  if( mcVals[i].val_at(fnex::kTrueCCNC) == 1.*simb::kNC )
560  it = fnex::kNC;
561  else{
562  pdg = mcVals[i].val_at(fnex::kTruePDG);
563  if (pdg == 12) it = fnex::kNuECC;
564  else if(pdg == -12) it = fnex::kNuEBarCC;
565  else if(pdg == 14) it = fnex::kNuMuCC;
566  else if(pdg == -14) it = fnex::kNuMuBarCC;
567  else if(pdg == 16) it = fnex::kNuTauCC;
568  else if(pdg == -16) it = fnex::kNuTauBarCC;
569  }
570  }
571 
572  md = fnex::MetaData(!e.isRealData(),
573  fDetService->DetId(),
574  fFileType,
576  it,
577  this->EpochName());
578 
579  // double check the MetaData for the correct NuE selection:
580  this->CheckNueFDPID(md, dataVals[i]);
581 
582  ev->eventId.reset(new fnex::EventId(evIds[i]));
583  //set the cycle number
584  ev->eventId->cycle = fCycle;
585 
586  ev->dataVals.reset(new fnex::DataVarVals(dataVals[i]));
587 
588  if(md.isMC)
589  ev->mcVals.reset(new fnex::MCVarVals(mcVals[i]));
590  else
591  ev->mcVals.reset(nullptr);
592 
593  fMDToEventsFull.find(md)->second.AddEvent(ev);
594 
595  // Handle the nue ND peripheral sample. In the ND as of the 2017 analysis
596  // the peripheral sample is just the high CVN set so we just copy that
597  // and write it into a tree
600 
601  // set the selection type to be the peripheral
603 
604  LOG_DEBUG("EventListMaker")
605  << "metadata is "
606  << md.ToString()
607  << " "
608  << fMDToEventsFull.count(md);
609 
610  // add the event to the peripheral sample.
611  fMDToEventsFull.find(md)->second.AddEvent(ev);
612  }
613 
614  }
615 
616  } // end if handle is valid
617  }// end loop over analyses
618 
619  return;
620  }
#define LOG_DEBUG(stream)
Definition: Messenger.h:149
novadaq::cnv::DetId DetId() const
What detector are we in?
art::ServiceHandle< ds::DetectorService > fDetService
which detector?
std::map< int, std::set< int > > fRunSubRunCycles
number of cycles for a MC run/subrun
set< int >::iterator it
Base container for the MC related Vars that constitute an event.
Definition: VarVals.h:930
fnex::BeamType_t BeamType(sumdata::SpillData const &spillInfo) const
enum fnex::interaction_type InteractionType_t
::xsd::cxx::tree::exception< char > exception
Definition: Database.h:225
std::string fHornLabel
label of module storing spill info
std::vector< std::unique_ptr< fnex::AnalysisSetupBase > > fAnalyses
the analysis object
static const unsigned char kTrueCCNC
Definition: VarVals.h:44
std::string const ToString() const
Definition: Structs.cxx:114
void CheckNueFDPID(fnex::MetaData &md, fnex::DataVarVals const &dataVal) const
int fCycle
MC cycle number.
const double a
Near Detector in the NuMI cavern.
novadaq::cnv::DetId detector
Definition: Structs.h:50
fnex::EventListMap fMDToEventsFull
each entry in the vector is for a single slice
#define LOG_WARNING(category)
std::vector< art::InputTag > fSkimmerTags
tags of the module that did the skimming
fnex::FileType_t fFileType
get from the configuration for now
fnex::SelectionType_t selectionType
Definition: Structs.h:52
std::string fSRDLabel
names of the module that made the subrun data summary object
std::vector< fnex::SelectionType_t > fSelectionTypes
get from the analysis configuration
std::shared_ptr< Event > EventPtr
Definition: Event.h:50
Float_t e
Definition: plot.C:35
Base container for the MC related Vars that constitute an event.
Definition: VarVals.h:874
bool isValid() const
Definition: Handle.h:326
static const unsigned char kTruePDG
Definition: VarVals.h:43
fnex::BeamType_t fnex::EventListMaker::BeamType ( sumdata::SpillData const &  spillInfo) const
private

Definition at line 441 of file EventListMaker_module.cc.

References sumdata::SpillData::is0HC, sumdata::SpillData::isRHC, fnex::k0HC, fnex::kFHC, and fnex::kRHC.

Referenced by analyze().

442  {
443  if(spillInfo.isRHC) return fnex::kRHC;
444  if(spillInfo.is0HC) return fnex::k0HC;
445 
446  return fnex::kFHC;
447  }
void fnex::EventListMaker::beginJob ( )
overridevirtual

Reimplemented from art::EDAnalyzer.

Definition at line 129 of file EventListMaker_module.cc.

130  {
131  return;
132  }
void fnex::EventListMaker::beginRun ( art::Run const &  r)
overridevirtual

Reimplemented from art::EDAnalyzer.

Definition at line 234 of file EventListMaker_module.cc.

References ds::DetectorService::DetId(), fDetectorsSeen, fDetService, and InitializeEventListMaps().

235  {
236  fDetectorsSeen.insert(fDetService->DetId());
237 
238  this->InitializeEventListMaps();
239 
240  return;
241  }
novadaq::cnv::DetId DetId() const
What detector are we in?
art::ServiceHandle< ds::DetectorService > fDetService
which detector?
std::set< novadaq::cnv::DetId > fDetectorsSeen
set of detector ids seen in this job
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_
void fnex::EventListMaker::CheckNueFDPID ( fnex::MetaData md,
fnex::DataVarVals const &  dataVal 
) const
private

Definition at line 451 of file EventListMaker_module.cc.

References fnex::MetaData::detector, energy, fnex::MetaData::IsNuMuSelected(), novadaq::cnv::kFARDET, fnex::kNu_RecoE, fnex::kNuESelectionHighPID, fnex::kNuESelectionPeripheral, fnex::MetaData::selectionType, and fnex::DataVarVals::val_at().

Referenced by analyze().

453  {
454  // The analysis skimmer can't determine the energy at skimming time
455  // as that is done in FNEX. That is not a problem except for the FD
456  // peripheral and High CVN samples where the high CVN sample has
457  // an energy range of 1 <= E <= 4 GeV and the peripheral doesn't
458  // If we find an event in the high sample outside that energy range
459  // we need to change the MetaData to put it in the peripheral sample
460 
461  // do nothing for numu selected events or not the FD
462  if(md.IsNuMuSelected() ||
463  md.detector != novadaq::cnv::kFARDET) return;
464 
465  auto energy = dataVal.val_at(fnex::kNu_RecoE, md);
466 
467  // do nothing if the energy is in the range 1 - 4 GeV
468  if(energy > 1. && energy < 4.) return;
469 
470  // should only have HighCVN events with energies < 1 or > 4 GeV
471  // at this point, but double check the selection
474 
475  return;
476  }
static const unsigned char kNu_RecoE
Definition: VarVals.h:36
bool IsNuMuSelected() const
Definition: Structs.cxx:256
Far Detector at Ash River, MN.
double energy
Definition: plottest35.C:25
novadaq::cnv::DetId detector
Definition: Structs.h:50
fnex::SelectionType_t selectionType
Definition: Structs.h:52
void fnex::EventListMaker::clear ( )
private

Definition at line 213 of file EventListMaker_module.cc.

References fDetectorsSeen, fMDToEventsFull, and fPOTSum.

Referenced by EventListMaker(), and ~EventListMaker().

214  {
215  fMDToEventsFull.clear();
216  //fMDToEventsCap .clear();
217  fPOTSum .clear();
218  fDetectorsSeen .clear();
219 
220  return;
221  }
fnex::EventListMap fMDToEventsFull
each entry in the vector is for a single slice
std::set< novadaq::cnv::DetId > fDetectorsSeen
set of detector ids seen in this job
std::map< std::string, sumdata::POTSum > fPOTSum
total summary of the POT information
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 fnex::EventListMaker::endJob ( )
overridevirtual

Reimplemented from art::EDAnalyzer.

Definition at line 623 of file EventListMaker_module.cc.

References fnex::MetaData::detector, fnex::MetaData::epoch, fDetectorsSeen, fFileType, fnex::MetaData::fileType, stan::math::floor(), fMDToEventsFull, fPOTSum, fRunSubRunCycles, fRunSubRunToPOT, fSelectionTypes, sumdata::POTSum::goodspills, MECModelEnuComparisons::i, fnex::MetaData::interactionType, fnex::MetaData::isMC, fnex::kDataFile, fnex::kNC, fnex::kNuEBarCC, fnex::kNuECC, fnex::kNuMuBarCC, fnex::kNuMuCC, fnex::kNuTauBarCC, fnex::kNuTauCC, fnex::kUnknownInteraction, LOG_VERBATIM, LOG_WARNING, fetch_tb_beamline_files::md, pot, RunToEpoch(), fnex::MetaData::selectionType, Serialize(), ss, string, sumdata::POTSum::totgoodpot, sumdata::POTSum::totpot, and sumdata::POTSum::totspills.

624  {
625  // check if more than one type of detector was represented by the files
626  // seen by this job, if so, we have problems.
627  if(fDetectorsSeen.size() > 1)
628  throw cet::exception("EventListMaker")
629  << "Multiple detectors represented in this job. "
630  << "Rerun with only a single detector.";
631 
632  // Sum the POT for the epochs
633  // loop over the RunSubRun POT objects and figure out how many cycles are in
634  // each combination
636  for(auto itr : fRunSubRunToPOT){
637 
638  int run = std::floor(itr.first * 1.e-3);
639 
640  if(fRunSubRunCycles.count(itr.first) < 1)
641  LOG_WARNING("EventListMaker")
642  << "No cycle information for run "
643  << std::floor(itr.first * 1.e-3)
644  << " subrun "
645  << itr.first - std::floor(itr.first * 1.e-3) * 1.e3;
646 
647  pot.totpot = itr.second.totpot;
648  pot.totgoodpot = itr.second.totgoodpot;
649  pot.totspills = itr.second.totspills;
650  pot.goodspills = itr.second.goodspills;
651 
652  fPOTSum[this->RunToEpoch(run)] += pot;
653 
654  LOG_VERBATIM("EventListMaker")
655  << "run "
656  << run
657  << " subRun "
658  << itr.first - run * 1.e3
659  << " has "
660  << itr.second.totpot
661  << " POT and a total of "
662  << fPOTSum[this->RunToEpoch(run)].totpot
663  << " POT for the epoch";
664 
665  }
666 
667 
668  // check that we have lists to serialize
669  // if we don't then we need to make the metadata tree, but will not
670  // have any events to serialize. Just create entries for each possible
671  // metadata in this file with empty event lists
672  if(fMDToEventsFull.size() < 1){
675  std::string epoch;
676 
677  md.fileType = fFileType;
678  md.detector = *(fDetectorsSeen.begin());
679 
680  std::set<fnex::InteractionType_t> intTypes({fnex::kNuMuCC,
682  fnex::kNuECC,
686  fnex::kNC});
687 
688  for(auto itr : fPOTSum){
689  size_t first = itr.first.find_first_of("abcdefghijklmnopqrstuvwxyz");
690  std::string alpha = itr.first.substr(first, first + 1);
691 
692  md.epoch = std::atoi(itr.first.substr(0, first).c_str()) * 1000 + static_cast<int>(*(alpha.c_str()));
693 
694  // loop over selection types
695  for(auto sel : fSelectionTypes){
696  md.selectionType = sel;
697 
698  if(fFileType == fnex::kDataFile){
699  md.isMC = false;
701 
702  fMDToEventsFull.emplace(md, fnex::EventList(md, ss));
703  //fMDToEventsCap .emplace(md, fnex::EventList(md, ss));
704 
705  } // end if this is a data file
706  else{
707  md.isMC = true;
708 
709  // loop over the interaction types too
710  for(auto i : intTypes){
711  md.interactionType = i;
712 
713  fMDToEventsFull.emplace(md, fnex::EventList(md, ss));
714 
715  } // end loop over interaction types
716  } // end if MC
717  } // end loop over selection types
718  } // end loop over epochs from the POT summaries
719  } // end if there are no event lists at this point
720 
721  /*// The far detector data pot information will be handled in the
722  // EventListManipulator, set the values to 0 for now.
723  auto md = fMDToEventsFull.begin()->first;
724  if(!md.isMC &&
725  md.detector == novadaq::cnv::kFARDET &&
726  fFileType != kCosmicBackgroundFile ){
727  fPOTSum["1a"] = sumdata::POTSum(0., 0., 1, 1);
728  fPOTSum["2a"] = sumdata::POTSum(0., 0., 1, 1);
729  fPOTSum["2b"] = sumdata::POTSum(0., 0., 1, 1);
730  fPOTSum["2c"] = sumdata::POTSum(0., 0., 1, 1);
731  fPOTSum["3b"] = sumdata::POTSum(0., 0., 1, 1);
732  fPOTSum["3c"] = sumdata::POTSum(0., 0., 1, 1);
733  fPOTSum["3d"] = sumdata::POTSum(0., 0., 1, 1);
734  fPOTSum["3e"] = sumdata::POTSum(0., 0., 1, 1);
735  fPOTSum["4a"] = sumdata::POTSum(0., 0., 1, 1);
736  fPOTSum["4c"] = sumdata::POTSum(0., 0., 1, 1);
737  fPOTSum["5a"] = sumdata::POTSum(0., 0., 1, 1);
738  fPOTSum["5b"] = sumdata::POTSum(0., 0., 1, 1);
739  fPOTSum["6a"] = sumdata::POTSum(0., 0., 1, 1);
740  fPOTSum["6b"] = sumdata::POTSum(0., 0., 1, 1);
741  fPOTSum["7a"] = sumdata::POTSum(0., 0., 1, 1);
742  fPOTSum["7b"] = sumdata::POTSum(0., 0., 1, 1);
743  } // end if FD data */
744 
745  // The ND MC has a single value of POT/spill and
746  // a known number of spills per subrun (file). Check that we are using
747  // ND MC and set the POT accordingly if that is the case
748 // if(md.isMC &&
749 // md.detector == novadaq::cnv::kNEARDET ){
750 // for(auto itr : fFilesPerEpoch){
751 //
752 // auto mcPOT = fNDStandardMCPOT;
753 // mcPOT.totpot *= itr.second;
754 // mcPOT.totgoodpot *= itr.second;
755 // mcPOT.totspills *= itr.second;
756 // mcPOT.goodspills *= itr.second;
757 //
758 // fPOTSum[itr.first] = mcPOT;
759 // LOG_DEBUG("EventListMaker")
760 // << "POT of "
761 // << mcPOT.totgoodpot
762 // << " for epoch "
763 // << itr.first
764 // << " "
765 // << fPOTSum.find(itr.first)->second.totgoodpot;
766 // }
767 // }
768 
769  //===== Remove once writing fnex::EventLists to art files works========
770  // for now, we don't have a good way of writing multiple input streams into
771  // an art file, and we don't have a good way of storing fnex::EventLists in
772  // an art file...so make TTrees instead.
773  this->Serialize();
774 
775  return;
776  }
std::map< int, std::set< int > > fRunSubRunCycles
number of cycles for a MC run/subrun
Float_t ss
Definition: plot.C:24
::xsd::cxx::tree::exception< char > exception
Definition: Database.h:225
std::map< int, sumdata::POTSum > fRunSubRunToPOT
POT present for a given run/subrun.
#define pot
novadaq::cnv::DetId detector
Definition: Structs.h:50
void Serialize()
Store the Events in a ROOT file.
fnex::EventListMap fMDToEventsFull
each entry in the vector is for a single slice
fnex::FileType_t fileType
Definition: Structs.h:51
Definition: run.py:1
#define LOG_WARNING(category)
fnex::FileType_t fFileType
get from the configuration for now
fnex::SelectionType_t selectionType
Definition: Structs.h:52
std::vector< fnex::SelectionType_t > fSelectionTypes
get from the analysis configuration
fnex::InteractionType_t interactionType
Definition: Structs.h:53
std::set< novadaq::cnv::DetId > fDetectorsSeen
set of detector ids seen in this job
int goodspills
Definition: POTSum.h:31
std::map< std::string, sumdata::POTSum > fPOTSum
total summary of the POT information
fvar< T > floor(const fvar< T > &x)
Definition: floor.hpp:11
std::string RunToEpoch(int run)
int totspills
Definition: POTSum.h:30
#define LOG_VERBATIM(category)
double totgoodpot
normalized by 10^12 POT
Definition: POTSum.h:28
double totpot
normalized by 10^12 POT
Definition: POTSum.h:27
enum BeamMode string
void fnex::EventListMaker::endSubRun ( art::SubRun const &  sr)
overridevirtual

Reimplemented from art::EDAnalyzer.

Definition at line 244 of file EventListMaker_module.cc.

References EpochName(), fFileType, fPOTLabel, fPOTSum, fRunSubRunToPOT, art::DataViewImpl::getValidHandle(), fnex::kCosmicBackgroundFile, livetime, LOG_DEBUG, LOG_VERBATIM, LOG_WARNING, art::SubRun::run(), and art::SubRun::subRun().

245  {
246 
248 
249  // get the handle to the stored POTSum
250  auto potHandle = sr.getValidHandle<sumdata::POTSum>(fPOTLabel);
251 
252  if( potHandle.isValid() )
253  fRunSubRunToPOT [sr.run() * 1000 + sr.subRun()] += *potHandle;
254  else
255  LOG_WARNING("EventListMaker")
256  << "cannot find POT info for "
257  << sr.run()
258  << " "
259  << sr.subRun();
260 
261  }
262  else {
263  //Fake up POT for cosmic background
264  LOG_DEBUG("EventListMaker") << "It's a cosmic background file";
265 
266  // get the handle to the stored cosmic exposure time
267  auto cosexpHandle = sr.getValidHandle<sumdata::CosmicExposure>("exposure");//fCosmicExposureLabel);//right label??
268  //cosexpHandle->Print();
269  double livetime = cosexpHandle->totlivetime;
270  LOG_DEBUG("EventListMaker") << "totlivetime for this subrun = " << livetime;
271 
272  float TimePOTRatio = 0.;// POT/livetime
273  //float epochPOT;
274  LOG_DEBUG("EventListMaker") << "EpochName() = " << this->EpochName();
275 
276 
277  if (this->EpochName().find("1") != std::string::npos) TimePOTRatio = 1.23e8/128.1;
278  else if(this->EpochName().find("2") != std::string::npos) TimePOTRatio = 2.64e8/119.1;
279  else if(this->EpochName().find("3") != std::string::npos) TimePOTRatio = 2.81e8/106.5;//Combined 3b-c and 3d
280  else LOG_VERBATIM("EventListMaker") << "What epoch are you looking at?? Allegedly " << this->EpochName();
281 
282  LOG_DEBUG("EventListMaker") << "POT / livetime = " << TimePOTRatio;
283 
284  double fakePOT = 0.;
285  fakePOT = TimePOTRatio * livetime;
286  LOG_DEBUG("EventListMaker") << "fakePOT = " << fakePOT;
287 
288  sumdata::POTSum fakePOTSum(fakePOT, fakePOT, 0, 0);
289 
290  fPOTSum[this->EpochName()] += fakePOTSum;
291 
292  }
293 
294  return;
295  }
#define LOG_DEBUG(stream)
Definition: Messenger.h:149
std::map< int, sumdata::POTSum > fRunSubRunToPOT
POT present for a given run/subrun.
std::string fPOTLabel
names of the module that did the skimming
caf::StandardRecord * sr
#define LOG_WARNING(category)
fnex::FileType_t fFileType
get from the configuration for now
double livetime
Definition: saveFDMCHists.C:21
std::map< std::string, sumdata::POTSum > fPOTSum
total summary of the POT information
#define LOG_VERBATIM(category)
std::string fnex::EventListMaker::EpochName ( )
private

Definition at line 298 of file EventListMaker_module.cc.

References fRH, nova::dbi::RunHistory::RunNumber(), and RunToEpoch().

Referenced by analyze(), endSubRun(), InitializeEventListMaps(), and respondToOpenInputFile().

299  {
300  return this->RunToEpoch(fRH->RunNumber());
301  }
art::ServiceHandle< nova::dbi::RunHistoryService > fRH
RunHistory service.
std::string RunToEpoch(int run)
int RunNumber() const
Definition: RunHistory.h:374
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
void fnex::EventListMaker::InitializeEventListMaps ( )
private

Definition at line 343 of file EventListMaker_module.cc.

References fnex::MetaData::detector, ds::DetectorService::DetId(), fnex::MetaData::epoch, EpochName(), fnex::EpochStringToInt(), fDetService, fEpochsInListMap, fFileType, fnex::MetaData::fileType, fMDToEventsFull, fSelectionTypes, MECModelEnuComparisons::i, fnex::MetaData::interactionType, fnex::MetaData::isMC, fnex::kDataFile, fnex::kNC, novadaq::cnv::kNEARDET, fnex::kNuEBarCC, fnex::kNuECC, fnex::kNuESelectionHighPID, fnex::kNuESelectionPeripheral, fnex::kNuMuBarCC, fnex::kNuMuCC, fnex::kNuTauBarCC, fnex::kNuTauCC, fnex::kTauSwap, fnex::kUnknownInteraction, LOG_VERBATIM, fetch_tb_beamline_files::md, fnex::MetaData::selectionType, ss, and fnex::MetaData::ToString().

Referenced by beginRun().

344  {
345  // here we will create an event list for each possible meta data
346  // for the current epoch and data/MC type.
347 
348  // We only run this module on one detector type at a time, so no need
349  // to check that
350 
351  // fEpochsInListMap is a set, so if we try to insert the same thing twice
352  // it won't do it a second time
353  fEpochsInListMap.insert(this->EpochName());
354 
357 
358  // set the bits of the metadata that won't change
359  md.isMC = (fFileType != fnex::kDataFile);
360  md.detector = fDetService->DetId();
361  md.fileType = fFileType;
362  md.epoch = fnex::EpochStringToInt(this->EpochName());
363 
364  std::set<fnex::InteractionType_t> intTypes({fnex::kNuMuCC,
366  fnex::kNuECC,
368  fnex::kNC});
369 
370  // only worry about nu tau interactions in the tau swap files
371  if(fFileType == fnex::kTauSwap){
372  intTypes.insert(fnex::kNuTauCC);
373  intTypes.insert(fnex::kNuTauBarCC);
374  }
375 
376  // loop over the selection and interaction types to flesh out the lists
377  for(auto s : fSelectionTypes){
378 
379  md.selectionType = s;
380 
381  if(md.isMC){
382 
383  // loop over possible interaction types for the metadata
384  // don't use cosmic muons, those are special and are handled
385  // in another way - we don't want to inflate the POT for those lists
386  for(auto i : intTypes){
387 
388  md.interactionType = i;
389 
390  // make a new EventList if one does not already exist for this
391  // MetaData. The SpillSummary will have 0's in it so that we can
392  // add the final tally at the end.
393  if(fMDToEventsFull.count(md) < 1){
394  fMDToEventsFull.emplace(md, fnex::EventList(md, ss));
395 
396  LOG_VERBATIM("EventListMaker")
397  << "added md "
398  << md.ToString();
399 
403  fMDToEventsFull.emplace(md, fnex::EventList(md, ss));
404  LOG_VERBATIM("EventListMaker")
405  << "added md "
406  << md.ToString();
408  }
409  }
410  } // end loop over interaction types
411  } // end if mc
412  else{
413  // data has an unknown interaction type
414 
416 
417  if(fMDToEventsFull.count(md) < 1){
418  fMDToEventsFull.emplace(md, fnex::EventList(md, ss));
419  //fMDToEventsCap .emplace(md, fnex::EventList(md, ss));
420  LOG_VERBATIM("EventListMaker")
421  << "added md "
422  << md.ToString();
423 
427  fMDToEventsFull.emplace(md, fnex::EventList(md, ss));
428  LOG_VERBATIM("EventListMaker")
429  << "added md "
430  << md.ToString();
432  }
433  } // end if we need to add it to the list
434  } // end if data
435  } // end loop over selection types
436 
437  return;
438  }
novadaq::cnv::DetId DetId() const
What detector are we in?
art::ServiceHandle< ds::DetectorService > fDetService
which detector?
Float_t ss
Definition: plot.C:24
const XML_Char * s
Definition: expat.h:262
std::string const ToString() const
Definition: Structs.cxx:114
int EpochStringToInt(std::string const &epochStr)
Definition: Structs.h:82
Near Detector in the NuMI cavern.
novadaq::cnv::DetId detector
Definition: Structs.h:50
fnex::EventListMap fMDToEventsFull
each entry in the vector is for a single slice
fnex::FileType_t fileType
Definition: Structs.h:51
fnex::FileType_t fFileType
get from the configuration for now
fnex::SelectionType_t selectionType
Definition: Structs.h:52
std::vector< fnex::SelectionType_t > fSelectionTypes
get from the analysis configuration
std::set< std::string > fEpochsInListMap
epochs placed in the event list maps
fnex::InteractionType_t interactionType
Definition: Structs.h:53
#define LOG_VERBATIM(category)
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
EventListMaker& fnex::EventListMaker::operator= ( EventListMaker const &  )
delete
EventListMaker& fnex::EventListMaker::operator= ( EventListMaker &&  )
delete
void art::Consumer::prepareForJob ( fhicl::ParameterSet const &  pset)
protectedinherited
std::string const& art::EventObserverBase::processName ( ) const
inlineinherited
void fnex::EventListMaker::reconfigure ( fhicl::ParameterSet const &  p)

Definition at line 135 of file EventListMaker_module.cc.

References fAnalyses, fFileType, fHornLabel, fNDSpillsPerFile, fPOTLabel, fSelectionTypes, fSkimmerTags, fSRDLabel, fhicl::ParameterSet::get(), fnex::kBeam, fnex::kCosmicBackgroundFile, fnex::kDataFile, fnex::kNuESelection, fnex::kNuESelectionHighPID, fnex::kNuESelectionLowPID, fnex::kNuESelectionMidPID, fnex::kNuESelectionPeripheral, fnex::kNuMuSelection, fnex::kNuMuSelectionQ1, fnex::kNuMuSelectionQ2, fnex::kNuMuSelectionQ3, fnex::kNuMuSelectionQ4, fnex::kSwap, fnex::kTauSwap, and string.

Referenced by EventListMaker().

136  {
137  fNDSpillsPerFile = pset.get<float>("NDSpillsPerFile", 400.);
138 
139  fPOTLabel = pset.get<std::string>("POTLabel");
140  fHornLabel = pset.get<std::string>("HornLabel");
141  auto ftString = pset.get<std::string>("FileType");
142 
143  if (ftString.compare("FluxSwap") == 0)
144  fFileType = kSwap;
145  else if(ftString.compare("NonSwap") == 0)
146  fFileType = kBeam;
147  else if(ftString.compare("TauSwap") == 0)
149  else if(ftString.compare("CosmicBackground") == 0)
151  else
153 
154  // create the analysis object we need, use the stored parameter set
155  // to determine exactly what we are after
156  for(auto const& apset : pset.get<std::vector<fhicl::ParameterSet> >("AnalysisPSets")){
157  auto const& type = apset.get<std::string>("AnalysisType");
158 
159  fSRDLabel = apset.get<std::string>("SkimmerLabel");
160  fSkimmerTags.push_back(art::InputTag(apset.get<std::string>("SkimmerLabel" ),
161  apset.get<std::string>("SkimmerInstance")));
162 
163  if(type.compare("NuMu_Standard") == 0){
164  fAnalyses .push_back(std::make_unique<fnex::NuMuAnalysisSetup>(apset));
166  }
167  else if(type.compare("NuMu_Q1") == 0){
168  fAnalyses .push_back(std::make_unique<fnex::NuMuAnalysisSetup>(apset));
170  }
171  else if(type.compare("NuMu_Q2") == 0){
172  fAnalyses .push_back(std::make_unique<fnex::NuMuAnalysisSetup>(apset));
174  }
175  else if(type.compare("NuMu_Q3") == 0){
176  fAnalyses .push_back(std::make_unique<fnex::NuMuAnalysisSetup>(apset));
178  }
179  else if(type.compare("NuMu_Q4") == 0){
180  fAnalyses .push_back(std::make_unique<fnex::NuMuAnalysisSetup>(apset));
182  }
183  else if(type.compare("NuE_AllPID") == 0){
184  fAnalyses .push_back(std::make_unique<fnex::NuEAnalysisSetup >(apset));
186  }
187  else if(type.compare("NuE_LowPID") == 0){
188  fAnalyses .push_back(std::make_unique<fnex::NuEAnalysisSetup >(apset));
190  }
191  else if(type.compare("NuE_MidPID") == 0){
192  fAnalyses .push_back(std::make_unique<fnex::NuEAnalysisSetup >(apset));
194  }
195  else if(type.compare("NuE_HighPID") == 0){
196  fAnalyses .push_back(std::make_unique<fnex::NuEAnalysisSetup >(apset));
198  }
199  else if(type.compare("NuE_Peripheral") == 0){
200  fAnalyses .push_back(std::make_unique<fnex::NuEAnalysisSetup >(apset));
202  }
203  else
204  throw cet::exception("EventListMaker") << "unknown AnalysisType: " << type;
205  }
206 
207  return;
208  }
::xsd::cxx::tree::exception< char > exception
Definition: Database.h:225
std::string fHornLabel
label of module storing spill info
std::vector< std::unique_ptr< fnex::AnalysisSetupBase > > fAnalyses
the analysis object
std::string fPOTLabel
names of the module that did the skimming
float fNDSpillsPerFile
spills in each ND file
std::vector< art::InputTag > fSkimmerTags
tags of the module that did the skimming
fnex::FileType_t fFileType
get from the configuration for now
std::string fSRDLabel
names of the module that made the subrun data summary object
std::vector< fnex::SelectionType_t > fSelectionTypes
get from the analysis configuration
enum BeamMode string
void art::EventObserverBase::registerProducts ( MasterProductRegistry ,
ProductDescriptions ,
ModuleDescription const &   
)
inlineinherited

Definition at line 33 of file EventObserverBase.h.

References string.

36  {}
void fnex::EventListMaker::respondToOpenInputFile ( art::FileBlock const &  fb)
overridevirtual

Reimplemented from art::EDAnalyzer.

Definition at line 224 of file EventListMaker_module.cc.

References EpochName(), and fFilesPerEpoch.

225  {
226  // keep track of the number of files per epoch. We'll use this information
227  // in the end job if the detector type for these files is ND and its MC
228  fFilesPerEpoch[this->EpochName()] += 1;
229 
230  return;
231  }
std::map< std::string, int > fFilesPerEpoch
number of files seen per epoch
std::string fnex::EventListMaker::RunToEpoch ( int  run)
private

Definition at line 305 of file EventListMaker_module.cc.

References ds::DetectorService::DetId(), fDetService, novadaq::cnv::kFARDET, novadaq::cnv::kNEARDET, and string.

Referenced by endJob(), and EpochName().

306  {
307  std::string epochStr("Unknown");
308 
309 
311  if (run < 10408) epochStr = "1";
312  else if(run < 10974) epochStr = "2";
313  else if(run < 11629) epochStr = "3";
314  else if(run < 11926) epochStr = "4";
315  else if(run < 12087) epochStr = "5";
316  //else if(run < 12290) epochStr = "6a";
317  //else if(run < 12517) epochStr = "6b";
318  //else if(run < 12580) epochStr = "7a";
319  //else epochStr = "7b";
320  // In the 2018 analysis there is no MC for runs after epoch 6a
321  // so make that the last epoch string we worry about too
322  else epochStr = "6";
323  }
324  else if(fDetService->DetId() == novadaq::cnv::kFARDET){
325  if (run < 17140) epochStr = "1";
326  else if(run < 19747) epochStr = "2";
327  else if(run < 23420) epochStr = "3";
328  else if(run < 24614) epochStr = "4";
329  else if(run < 25413) epochStr = "5";
330  //else if(run < 26686) epochStr = "6a";
331  //else if(run < 28037) epochStr = "6b";
332  //else if(run < 28550) epochStr = "7a";
333  //else epochStr = "7b";
334  // In the 2018 analysis there is no MC for runs after epoch 6a
335  // so make that the last epoch string we worry about too
336  else epochStr = "6";
337  }
338 
339  return epochStr;
340  }
novadaq::cnv::DetId DetId() const
What detector are we in?
art::ServiceHandle< ds::DetectorService > fDetService
which detector?
Far Detector at Ash River, MN.
Near Detector in the NuMI cavern.
Definition: run.py:1
enum BeamMode string
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 fnex::EventListMaker::Serialize ( )
private

Store the Events in a ROOT file.

Serialize the list of Events to a ROOT file. Unfortunately, the serialization tool that generates the necessary dictionaries, genreflex, doesn't understand C++11 syntax or library types, so we're forced to make do with somewhat less elegant storage. We make a tree storing the fnex::EventList::MetaData for each configuration and one tree of event information corresponding to each MetaData instance. Inside the tree are two branches: one with a std::vector containing an Event's IndepVars, and a second with a std::vector<IndepVar*> which will be used to build the DepVars upon de-serialization.

Definition at line 790 of file EventListMaker_module.cc.

References fnex::SpillSummary::clear(), fnex::DEFINE_ART_MODULE(), fnex::MetaData::EpochString(), fMDToEventsFull, fPOTSum, fnex::SpillSummary::goodPOT, sumdata::POTSum::goodspills, it, LOG_VERBATIM, fetch_tb_beamline_files::md, fnex::SpillSummary::numGoodSpills, pot, fnex::SerializeEventListMap(), ss, string, fnex::MetaData::ToString(), fnex::SpillSummary::totalNumSpills, fnex::SpillSummary::totalPOT, sumdata::POTSum::totgoodpot, sumdata::POTSum::totpot, and sumdata::POTSum::totspills.

Referenced by endJob().

791  {
792 
796  std::string epoch;
797 
798  // loop over the event lists and add the appropriate POT to each
799  // spill summary
800  for(auto it : fMDToEventsFull){
801 
802  md = it.first;
803  epoch = md.EpochString();
804  ss.clear();
805 
806  if( fPOTSum.count(epoch) > 0){
807 
808  pot = fPOTSum.find(epoch)->second;
809 
810  // fill the pot information
811  ss.totalPOT = pot.totpot;
812  ss.goodPOT = pot.totgoodpot;
813  ss.totalNumSpills = pot.totspills;
814  ss.numGoodSpills = pot.goodspills;
815 
816  } // end we found POT
817 
818  // set the POT information for the current list
819  fMDToEventsFull.find(md)->second.AddSpillSummary(ss);
820 
821  LOG_VERBATIM("EventListMaker")
822  << md.ToString()
823  << " totalPOT "
824  << pot.totpot
825  << " : "
826  << ss.totalPOT;
827 
828  } // end loop to set the POT and make capped lists
829 
830  // now write the full and capped lists
832  fMDToEventsFull);
833 
834  return;
835 
836  } // Serialize
set< int >::iterator it
void SerializeEventListMap(std::string const &dirName, fnex::EventListMap const &listMap)
Definition: Event.cxx:176
Float_t ss
Definition: plot.C:24
std::string const EpochString() const
Definition: Structs.cxx:101
unsigned long int numGoodSpills
Definition: Structs.h:108
std::string const ToString() const
Definition: Structs.cxx:114
#define pot
fnex::EventListMap fMDToEventsFull
each entry in the vector is for a single slice
unsigned long int totalNumSpills
Definition: Structs.h:107
int goodspills
Definition: POTSum.h:31
std::map< std::string, sumdata::POTSum > fPOTSum
total summary of the POT information
int totspills
Definition: POTSum.h:30
#define LOG_VERBATIM(category)
double totgoodpot
normalized by 10^12 POT
Definition: POTSum.h:28
double totpot
normalized by 10^12 POT
Definition: POTSum.h:27
enum BeamMode string
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::vector<std::unique_ptr<fnex::AnalysisSetupBase> > fnex::EventListMaker::fAnalyses
private

the analysis object

Definition at line 85 of file EventListMaker_module.cc.

Referenced by analyze(), and reconfigure().

int fnex::EventListMaker::fCycle
private

MC cycle number.

Definition at line 98 of file EventListMaker_module.cc.

Referenced by analyze().

std::set<novadaq::cnv::DetId> fnex::EventListMaker::fDetectorsSeen
private

set of detector ids seen in this job

Definition at line 92 of file EventListMaker_module.cc.

Referenced by beginRun(), clear(), and endJob().

art::ServiceHandle<ds::DetectorService> fnex::EventListMaker::fDetService
private

which detector?

Definition at line 89 of file EventListMaker_module.cc.

Referenced by analyze(), beginRun(), InitializeEventListMaps(), and RunToEpoch().

std::set<std::string> fnex::EventListMaker::fEpochsInListMap
private

epochs placed in the event list maps

Definition at line 94 of file EventListMaker_module.cc.

Referenced by InitializeEventListMaps().

std::map<std::string, int> fnex::EventListMaker::fFilesPerEpoch
private

number of files seen per epoch

Definition at line 93 of file EventListMaker_module.cc.

Referenced by respondToOpenInputFile().

fnex::FileType_t fnex::EventListMaker::fFileType
private

get from the configuration for now

Definition at line 86 of file EventListMaker_module.cc.

Referenced by analyze(), endJob(), endSubRun(), InitializeEventListMaps(), and reconfigure().

std::string fnex::EventListMaker::fHornLabel
private

label of module storing spill info

Definition at line 100 of file EventListMaker_module.cc.

Referenced by analyze(), and reconfigure().

fnex::EventListMap fnex::EventListMaker::fMDToEventsFull
private

each entry in the vector is for a single slice

Definition at line 83 of file EventListMaker_module.cc.

Referenced by analyze(), clear(), endJob(), InitializeEventListMaps(), and Serialize().

float fnex::EventListMaker::fNDSpillsPerFile
private

spills in each ND file

Definition at line 97 of file EventListMaker_module.cc.

Referenced by EventListMaker(), and reconfigure().

sumdata::POTSum fnex::EventListMaker::fNDStandardMCPOT
private

standard number of POT/file (subrun) in ND MC

Definition at line 91 of file EventListMaker_module.cc.

Referenced by EventListMaker().

std::string fnex::EventListMaker::fPOTLabel
private

names of the module that did the skimming

Definition at line 80 of file EventListMaker_module.cc.

Referenced by endSubRun(), and reconfigure().

std::map<std::string, sumdata::POTSum> fnex::EventListMaker::fPOTSum
private

total summary of the POT information

Definition at line 82 of file EventListMaker_module.cc.

Referenced by clear(), endJob(), endSubRun(), and Serialize().

TRandom3 fnex::EventListMaker::fRand
private

RNG for the capping decisions.

Definition at line 99 of file EventListMaker_module.cc.

art::ServiceHandle<nova::dbi::RunHistoryService> fnex::EventListMaker::fRH
private

RunHistory service.

Definition at line 90 of file EventListMaker_module.cc.

Referenced by EpochName().

std::map<int, std::set<int> > fnex::EventListMaker::fRunSubRunCycles
private

number of cycles for a MC run/subrun

Definition at line 96 of file EventListMaker_module.cc.

Referenced by analyze(), and endJob().

std::map<int, sumdata::POTSum> fnex::EventListMaker::fRunSubRunToPOT
private

POT present for a given run/subrun.

Definition at line 95 of file EventListMaker_module.cc.

Referenced by endJob(), and endSubRun().

std::vector<fnex::SelectionType_t> fnex::EventListMaker::fSelectionTypes
private

get from the analysis configuration

Definition at line 87 of file EventListMaker_module.cc.

Referenced by analyze(), endJob(), InitializeEventListMaps(), and reconfigure().

std::vector<art::InputTag> fnex::EventListMaker::fSkimmerTags
private

tags of the module that did the skimming

Definition at line 79 of file EventListMaker_module.cc.

Referenced by analyze(), and reconfigure().

std::string fnex::EventListMaker::fSRDLabel
private

names of the module that made the subrun data summary object

Definition at line 81 of file EventListMaker_module.cc.

Referenced by analyze(), and reconfigure().

art::ServiceHandle<art::TFileService> fnex::EventListMaker::fTFS
private

TFileService.

Definition at line 88 of file EventListMaker_module.cc.


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