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

Public Types

using WorkerType = WorkerT< EDAnalyzer >
 
using ModuleType = EDAnalyzer
 

Public Member Functions

 CAFToEventList (fhicl::ParameterSet const &pset)
 
virtual ~CAFToEventList ()
 
 CAFToEventList (CAFToEventList const &)=delete
 
 CAFToEventList (CAFToEventList &&)=delete
 
CAFToEventListoperator= (CAFToEventList const &)=delete
 
CAFToEventListoperator= (CAFToEventList &&)=delete
 
void analyze (art::Event const &e) override
 
void reconfigure (fhicl::ParameterSet const &p)
 
void endJob () override
 
std::string workerType () const
 
bool modifiesEvent () const
 
void registerProducts (MasterProductRegistry &, ProductDescriptions &, ModuleDescription const &)
 
std::string const & processName () const
 
bool wantAllEvents () const
 
bool wantEvent (Event const &e)
 
fhicl::ParameterSetID selectorConfig () const
 
art::Handle< art::TriggerResultsgetTriggerResults (Event const &e) const
 
template<typename T , BranchType = InEvent>
ProductToken< Tconsumes (InputTag const &)
 
template<typename T , art::BranchType BT>
art::ProductToken< Tconsumes (InputTag const &it)
 
template<typename T , BranchType = InEvent>
void consumesMany ()
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > consumesView (InputTag const &)
 
template<typename T , art::BranchType BT>
art::ViewToken< TconsumesView (InputTag const &it)
 
template<typename T , BranchType = InEvent>
ProductToken< TmayConsume (InputTag const &)
 
template<typename T , art::BranchType BT>
art::ProductToken< TmayConsume (InputTag const &it)
 
template<typename T , BranchType = InEvent>
void mayConsumeMany ()
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > mayConsumeView (InputTag const &)
 
template<typename T , art::BranchType BT>
art::ViewToken< TmayConsumeView (InputTag const &it)
 
base_engine_tcreateEngine (seed_t seed)
 
base_engine_tcreateEngine (seed_t seed, std::string const &kind_of_engine_to_make)
 
base_engine_tcreateEngine (seed_t seed, std::string const &kind_of_engine_to_make, label_t const &engine_label)
 
seed_t get_seed_value (fhicl::ParameterSet const &pset, char const key[]="seed", seed_t const implicit_seed=-1)
 

Static Public Member Functions

static cet::exempt_ptr< Consumernon_module_context ()
 

Protected Member Functions

CurrentProcessingContext const * currentContext () const
 
detail::CachedProducts & cachedProducts ()
 
void validateConsumedProduct (BranchType const bt, ProductInfo const &pi)
 
void prepareForJob (fhicl::ParameterSet const &pset)
 
void showMissingConsumes () const
 

Private Member Functions

void clear ()
 
void DefineNumuQuantiles ()
 
void InitializeEventListColls ()
 
int RunToPeriod (int run)
 
bool PassesSelections (caf::SRProxy const &proxy) const
 
bool PassesNueSelections (caf::SRProxy const &proxy) const
 
bool PassesNumuSelections (caf::SRProxy const &proxy) const
 
bool PassesNCSelections (caf::SRProxy const &proxy) const
 
bool PassesSpillAndBeamCuts (caf::SRProxy const &proxy) const
 
void FillVariables (std::vector< cmf::DataVarVals > &dataVals, std::vector< cmf::MCVarVals > &mcVals, std::vector< cmf::EventId > &evIds, std::vector< cmf::SelectionType_t > &sels)
 
void FillMCVals (cmf::TruthVars &truthVars, cmf::WeightVars &weightVars, cmf::SystVarColl &systVars, caf::SRProxy &srProxy) const
 
void FillDataVarVals (cmf::DataVarVals &dataVals, caf::SRProxy const &srProxy) const
 
void FillEventId (cmf::EventId &evId, caf::SRProxy const &srProxy) const
 
void FindPOTPerPeriod (TFile &tf)
 
cmf::SelectionType_t FindSelectionType (caf::SRProxy const &srProxy) const
 

Private Attributes

std::vector< std::stringfCAFFileNames
 name of the CAF file we are using More...
 
std::string fFHCQuantFileName
 name of file in numudata ups product with FHC quantiles More...
 
std::string fRHCQuantFileName
 name of file in numudata ups product with FHC quantiles More...
 
std::string fSpillTreeName
 names of the Spill tree in the file More...
 
std::string fPOTHistName
 names of the CAF histogram with the total POT More...
 
std::string fCAFRecTreeName
 names of the CAF tree with the reco info More...
 
cmf::DetType_t fDetector
 which detector are we using More...
 
cmf::EventListColl fMDToEvents
 each entry in the vector is for a single slice More...
 
cmf::FileType_t fFileType
 get from the configuration for now More...
 
std::string fSystType
 systematic type More...
 
bool fIsRealData
 are we looking at real data? More...
 
bool fIsFHC
 are we looking at FHC files? More...
 
std::vector< ana::CutfNumuFHCQuantCuts
 quantile boundaries for the numu FHC data More...
 
std::vector< ana::CutfNumuRHCQuantCuts
 quantile boundaries for the numu RHC data More...
 
unsigned int fNumQuantiles
 number of quantiles More...
 
std::map< int, POTLiveTimefPeriodToPOTLiveTime
 keep track of the POT in each period More...
 
std::set< cmf::SelectionType_tfSelections
 Selections to use. More...
 
bool fMakeSelectedList
 configure to true to make a list More...
 
std::vector< cmf::PeriodRunfPeriodRuns
 vector of periods to runs More...
 

Detailed Description

Definition at line 140 of file CMFCAFToEventList_module.cc.

Member Typedef Documentation

Definition at line 39 of file EDAnalyzer.h.

Definition at line 38 of file EDAnalyzer.h.

Constructor & Destructor Documentation

cmf::CAFToEventList::CAFToEventList ( fhicl::ParameterSet const &  pset)
explicit

Definition at line 204 of file CMFCAFToEventList_module.cc.

References clear(), fPeriodToPOTLiveTime, MECModelEnuComparisons::i, and reconfigure().

205  : EDAnalyzer (pset)
208  , fIsRealData (false)
209  , fIsFHC (true)
210  , fNumQuantiles (1)
211  , fMakeSelectedList(false)
212  {
213  // make sure everything is zeroed out.
214  this->clear();
215 
216  this->reconfigure(pset);
217 
218  // initialize the period to POT map
219  // just allow for many periods, unlikely we will
220  // have more than 50, but it doesn't matter if we
221  // plan ahead
222  for(int i = 1; i < 51; ++i) fPeriodToPOTLiveTime[i] = POTLiveTime(0., 0.);
223 
224  // fMissingEvents.insert(cmf::EventId(19195, 10, 73, 0, 37));
225  // fMissingEvents.insert(cmf::EventId(19546, 12, 222, 0, 30));
226  // fMissingEvents.insert(cmf::EventId(19580, 19, 584, 0, 36));
227  // fMissingEvents.insert(cmf::EventId(19662, 58, 54, 0, 27));
228  // fMissingEvents.insert(cmf::EventId(21650, 54, 267, 0, 28));
229  // fMissingEvents.insert(cmf::EventId(22797, 43, 678, 0, 22));
230  // fMissingEvents.insert(cmf::EventId(23330, 24, 252, 0, 33));
231 
232  }
bool fIsRealData
are we looking at real data?
bool fMakeSelectedList
configure to true to make a list
std::map< int, POTLiveTime > fPeriodToPOTLiveTime
keep track of the POT in each period
cmf::DetType_t fDetector
which detector are we using
cmf::FileType_t fFileType
get from the configuration for now
void reconfigure(fhicl::ParameterSet const &p)
EDAnalyzer(Table< Config > const &config)
Definition: EDAnalyzer.h:100
bool fIsFHC
are we looking at FHC files?
unsigned int fNumQuantiles
number of quantiles
cmf::CAFToEventList::~CAFToEventList ( )
virtual

Definition at line 235 of file CMFCAFToEventList_module.cc.

References clear().

236  {
237  this->clear();
238  }
cmf::CAFToEventList::CAFToEventList ( CAFToEventList const &  )
delete
cmf::CAFToEventList::CAFToEventList ( CAFToEventList &&  )
delete

Member Function Documentation

void cmf::CAFToEventList::analyze ( art::Event const &  e)
overridevirtual

Implements art::EDAnalyzer.

Definition at line 322 of file CMFCAFToEventList_module.cc.

323  {
324  }
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 cmf::CAFToEventList::clear ( )
private

Definition at line 243 of file CMFCAFToEventList_module.cc.

References fMDToEvents, fNumuFHCQuantCuts, fNumuRHCQuantCuts, and fSelections.

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

244  {
245  fMDToEvents .clear();
246  fNumuFHCQuantCuts.clear();
247  fNumuRHCQuantCuts.clear();
248  fSelections .clear();
249  }
std::vector< ana::Cut > fNumuFHCQuantCuts
quantile boundaries for the numu FHC data
cmf::EventListColl fMDToEvents
each entry in the vector is for a single slice
std::set< cmf::SelectionType_t > fSelections
Selections to use.
std::vector< ana::Cut > fNumuRHCQuantCuts
quantile boundaries for the numu RHC data
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 cmf::CAFToEventList::DefineNumuQuantiles ( )
private

Definition at line 328 of file CMFCAFToEventList_module.cc.

References fFHCQuantFileName, cet::search_path::find_file(), fNumQuantiles, fNumuFHCQuantCuts, fNumuRHCQuantCuts, fRHCQuantFileName, ana::kHadEFracAxis2020, ana::kNumuCCOptimisedAxis2020, ana::QuantileCutsFromTH2(), and string.

Referenced by reconfigure().

329  {
330  // set up the numu quantile cuts
331 
332  std::string filePath;
333 
334  cet::search_path sp("FW_SEARCH_PATH");
335  if( !sp.find_file(fFHCQuantFileName, filePath) )
336  throw cet::exception("CAFToEventList")
337  << "Cannot find FHC numu quantile file "
339 
340  TFile fhcTF(filePath.c_str(), "READ");
341  TH2D *FDSpec2D = dynamic_cast<TH2D*>(fhcTF.Get("FDSpec2D"));
342  if(FDSpec2D == nullptr)
343  throw cet::exception("CAFToEventList")
344  << "Cannot find histogram FDSpec2D in "
345  << filePath;
346 
348 
349  if( !sp.find_file(fRHCQuantFileName, filePath) )
350  throw cet::exception("EventListMaker")
351  << "Cannot find RHC numu quantile file "
353 
354  TFile rhcTF(filePath.c_str(), "READ");
355  FDSpec2D = dynamic_cast<TH2D*>(rhcTF.Get("FDSpec2D"));
356  if(FDSpec2D == nullptr)
357  throw cet::exception("CAFToEventList")
358  << "Cannot find histogram FDSpec2D in "
359  << filePath;
360 
362 
363  }
std::string fFHCQuantFileName
name of file in numudata ups product with FHC quantiles
std::vector< ana::Cut > fNumuFHCQuantCuts
quantile boundaries for the numu FHC data
::xsd::cxx::tree::exception< char > exception
Definition: Database.h:225
const HistAxis kNumuCCOptimisedAxis2020("Reconstructed Neutrino Energy (GeV)", kNumuCCEOptimisedBinning, kNumuE2020)
Definition: HistAxes.h:25
const HistAxis kHadEFracAxis2020("E_{had.} / E_{#nu}", Binning::Simple(200, 0, 1), kNumuHadEFrac2020)
Definition: HistAxes.h:31
std::vector< ana::Cut > fNumuRHCQuantCuts
quantile boundaries for the numu RHC data
std::vector< Cut > QuantileCutsFromTH2(TH2 *quantileHist, const HistAxis &independentAxis, const HistAxis &quantileAxis, const unsigned int &numQuantiles, const bool verbose)
: Do the same as the QuantileCuts function but taking in the TH2 instead of making it...
std::string fRHCQuantFileName
name of file in numudata ups product with FHC quantiles
unsigned int fNumQuantiles
number of quantiles
enum BeamMode string
void cmf::CAFToEventList::endJob ( )
overridevirtual

Reimplemented from art::EDAnalyzer.

Definition at line 1086 of file CMFCAFToEventList_module.cc.

References cmf::cSelectionType_Strings, DEFINE_ART_MODULE(), fDetector, fFileType, FillVariables(), cmf::FindEventList(), fIsRealData, fMakeSelectedList, fMDToEvents, fPeriodToPOTLiveTime, cmf::WeightVars::fRPACCQE_Weight, cmf::TruthVars::fTrueCCNC, cmf::TruthVars::fTrueE, cmf::TruthVars::fTrueIntType, cmf::TruthVars::fTruePDG, cmf::TruthVars::fTruePDGOrig, cmf::WeightVars::fXSecCVPPFX_Weight, MECModelEnuComparisons::i, InitializeEventListColls(), cmf::MetaData::isMC, it, cmf::kCosmicBackgroundFile, cmf::kCosmicMuon, simb::kNC, cmf::kNC, cmf::kNu_RecoE, cmf::kNuE_CVN, cmf::kNuEBarCC, cmf::kNuECC, cmf::kNuMuBarCC, cmf::kNuMuCC, cmf::kNuTauBarCC, cmf::kNuTauCC, cmf::kTrueCCNC, cmf::kTruePDG, cmf::kUncategorised, cmf::kUnknownInteraction, cmf::kXSecCVPPFX_Weight, cmf::SpillSummary::liveTime, LOG_DEBUG, LOG_VERBATIM, LOG_WARNING, fetch_tb_beamline_files::md, make_root_from_grid_output::pdg, cmf::MetaData::Period(), RunToPeriod(), cmf::MetaData::selectionType, ana::sels, cmf::SerializeEventListColl(), ss, and cmf::MetaData::ToString().

1087  {
1088  this->InitializeEventListColls();
1089 
1090  cmf::MetaData md;
1092  float pdg = 0;
1093 
1094  std::vector<cmf::DataVarVals > dataVals;
1095  std::vector<cmf::MCVarVals > mcVals;
1096  std::vector<cmf::EventId > evIds;
1097  std::vector<cmf::SelectionType_t> sels;
1098 
1099  this->FillVariables(dataVals, mcVals, evIds, sels);
1100 
1101  LOG_VERBATIM("CAFToEventList")
1102  << "there are "
1103  << dataVals.size()
1104  << " data vals "
1105  << mcVals.size()
1106  << " mc vals "
1107  << evIds.size()
1108  << " event ids "
1109  << sels.size()
1110  << " selections ";
1111 
1112  auto periodToPOTItr = fPeriodToPOTLiveTime.begin();
1113 
1114  // need these *Vars for the cosmic muon files
1115  cmf::TruthVars tv;
1116  cmf::WeightVars wv;
1117 
1118  // loop over the event lists and add SpillSummary info
1119  for(auto & itr : fMDToEvents){
1120 
1121  auto const& md = itr.ListMetaData();
1123 
1124  periodToPOTItr = fPeriodToPOTLiveTime.find(md.Period());
1125 
1126  // multiply the weight for this period by the total POT
1127  // indicated in the list of CAF files used. We only
1128  // look at either FHC or RHC SAM datalists separately,
1129  // so we don't have to worry about separate accounting
1130  // for those
1131  if(periodToPOTItr != fPeriodToPOTLiveTime.end()){
1132  ss += cmf::SpillSummary(periodToPOTItr->second.pot,
1133  periodToPOTItr->second.pot,
1134  periodToPOTItr->second.liveTime,
1135  1,
1136  1);
1137 
1138  LOG_DEBUG("CAFTToEventList")
1139  << " checking spill summary to add "
1140  << ss
1141  << " "
1142  << periodToPOTItr->second.pot
1143  << " "
1144  << periodToPOTItr->second.liveTime;
1145  }
1146  else{
1147  LOG_WARNING("CAFToEventList")
1148  << md.ToString()
1149  << " could not find period "
1150  << md.Period()
1151  << " in POT weight map, just add zeros";
1152  }
1153 
1154  itr.AddSpillSummary(ss);
1155 
1156  LOG_VERBATIM("CAFToEventList")
1157  << "adding "
1158  << ss
1159  << " to "
1160  << md.ToString()
1161  << " "
1162  << itr.ListSpillSummary();
1163 
1164  } // end loop over the metadata to event lists map
1165 
1166  // now make event lists
1167  for(size_t i = 0; i < dataVals.size(); ++i){
1168 
1170 
1171  // figure out the interaction type and then get the correct metadata
1172  // for it
1174  it = cmf::kCosmicMuon;
1175  }
1176  else if(!fIsRealData){
1177  if( mcVals[i].val_at(cmf::kTrueCCNC) == 1. * simb::kNC )
1178  it = cmf::kNC;
1179  else{
1180  pdg = mcVals[i].val_at(cmf::kTruePDG);
1181  if (pdg == 12) it = cmf::kNuECC;
1182  else if(pdg == -12) it = cmf::kNuEBarCC;
1183  else if(pdg == 14) it = cmf::kNuMuCC;
1184  else if(pdg == -14) it = cmf::kNuMuBarCC;
1185  else if(pdg == 16) it = cmf::kNuTauCC;
1186  else if(pdg == -16) it = cmf::kNuTauBarCC;
1187  else it = cmf::kUncategorised;
1188  }
1189  } // end if neutrino MC
1190 
1191  md = cmf::MetaData(!fIsRealData,
1192  fDetector,
1193  fFileType,
1194  sels[i],
1195  it,
1196  this->RunToPeriod(evIds[i].run));
1197 
1198  // get an iterator to the event list for this md
1199  auto listItr = cmf::FindEventList(md, fMDToEvents);
1200  if(listItr == fMDToEvents.end())
1201  throw cet::exception("CMFCAFToEventList")
1202  << "cannot find metadata "
1203  << md.ToString()
1204  << " in event list";
1205 
1207  tv = cmf::TruthVars(mcVals[i].TruthVars());
1208  tv.fTrueE = 0. ;
1209  tv.fTruePDG = 13 ;
1210  tv.fTruePDGOrig = 13 ;
1211  tv.fTrueCCNC = 0. ;
1213 
1214  wv = cmf::WeightVars(mcVals[i].WeightVars());
1215  wv.fXSecCVPPFX_Weight = 1. ;
1216  wv.fRPACCQE_Weight = 1. ;
1217 
1218  mcVals[i] = cmf::MCVarVals(tv, wv, mcVals[i].SystematicShifts());
1219  listItr->AddEvent(evIds[i],
1220  dataVals[i],
1221  mcVals[i]);
1222  } // end if cosmic backgrounds
1223  else if(md.isMC){
1224  listItr->AddEvent(evIds[i],
1225  dataVals[i],
1226  mcVals[i]);
1227  }
1228  else
1229  listItr->AddEvent(evIds[i],
1230  dataVals[i]);
1231 
1232  LOG_DEBUG("CAFToEventList")
1233  << "add the event to "
1234  << md.ToString()
1235  << " "
1236  << i;
1237 
1238  } // end loop to insert events
1239 
1240 
1241  for(auto const& itr : fMDToEvents){
1242 
1243  auto const& md = itr.ListMetaData();
1244 
1245  LOG_VERBATIM("CAFToEventList")
1246  << "metadata "
1247  << md.ToString()
1248  << " has "
1249  << itr.ListSpillSummary()
1250  << " and "
1251  << itr.size()
1252  << " events";
1253 
1254  if(fMakeSelectedList){
1255  for(auto const& ev : itr){
1256  std::stringstream selectionOutput;
1257  selectionOutput << cmf::cSelectionType_Strings[md.selectionType]
1258  << "\t\t" << ev->EventID().run
1259  << "\t" << ev->EventID().subrun
1260  << "\t" << ev->EventID().event
1261  << "\t" << ev->EventID().slice
1262  << "\t" << ev->EventID().cycle
1263  << "\t" << ev->DataVals().val_at(cmf::kNu_RecoE, md)
1264  << "\t" << ev->DataVals().val_at(cmf::kNuE_CVN, md)
1265  << "\t";
1266  if(md.isMC)
1267  selectionOutput << ev->MCVals().val_at(cmf::kXSecCVPPFX_Weight);
1268 
1269  LOG_VERBATIM("SelectedEvents")
1270  << selectionOutput.str();
1271 
1272  } // end loop over events
1273  } // end if we are making a list of selected events
1274  }
1275 
1276  LOG_DEBUG("CAFToEventList")
1277  << "Serialize the events";
1278 
1280  fMDToEvents);
1281 
1282  LOG_DEBUG("CAFToEventList")
1283  << "endJob() done";
1284 
1285  }
float fTruePDGOrig
true PDG of original neutrino
Definition: VarVals.h:50
#define LOG_DEBUG(stream)
Definition: Messenger.h:149
enum cmf::interaction_type InteractionType_t
bool fIsRealData
are we looking at real data?
set< int >::iterator it
bool fMakeSelectedList
configure to true to make a list
const std::string cSelectionType_Strings[12]
Definition: Constants.h:79
long Period() const
Definition: Structs.h:128
float fTrueCCNC
true cc vs nc
Definition: VarVals.h:48
float fTruePDG
true PDG
Definition: VarVals.h:47
double liveTime
Definition: Structs.h:187
std::map< int, POTLiveTime > fPeriodToPOTLiveTime
keep track of the POT in each period
Float_t ss
Definition: plot.C:24
cmf::EventListColl::iterator FindEventList(cmf::MetaData const &md, cmf::EventListColl &eventListColl)
Definition: Event.cxx:44
::xsd::cxx::tree::exception< char > exception
Definition: Database.h:225
float fTrueE
True nu energy.
Definition: VarVals.h:46
cmf::DetType_t fDetector
which detector are we using
cmf::FileType_t fFileType
get from the configuration for now
Base container for the MC related Vars that constitute an event.
Definition: VarVals.h:342
cmf::EventListColl fMDToEvents
each entry in the vector is for a single slice
float fRPACCQE_Weight
To be used for systematic evaluation ONLY.
Definition: VarVals.h:151
cmf::SelectionType_t selectionType
Definition: Structs.h:116
const Cut sels[kNumSels]
Definition: vars.h:44
float fXSecCVPPFX_Weight
Was Tufts weight for SA.
Definition: VarVals.h:150
Definition: run.py:1
#define LOG_WARNING(category)
void SerializeEventListColl(std::string const &dirName, cmf::EventListColl const &listColl)
Definition: Event.cxx:117
std::string ToString() const
Definition: Structs.cxx:133
void FillVariables(std::vector< cmf::DataVarVals > &dataVals, std::vector< cmf::MCVarVals > &mcVals, std::vector< cmf::EventId > &evIds, std::vector< cmf::SelectionType_t > &sels)
#define LOG_VERBATIM(category)
float fTrueIntType
true interaction type
Definition: VarVals.h:49
void cmf::CAFToEventList::FillDataVarVals ( cmf::DataVarVals dataVals,
caf::SRProxy const &  srProxy 
) const
private

Definition at line 940 of file CMFCAFToEventList_module.cc.

References ana::kCVNe_looseptp, ana::kEME_2020, cmf::kHad_RecoE, ana::kHADE_2020, cmf::kLep_RecoE, ana::kNMichels, cmf::kNuE_CVN, cmf::kNuE_NumMichel, ana::kNumuHadE2020, ana::kNumuMuE2020, cmf::kRecoQ2, ana::kRecoQ2, PassesNCSelections(), PassesNueSelections(), PassesNumuSelections(), and cmf::DataVarVals::set_val_at().

Referenced by FillVariables().

942  {
943 
944  if(this->PassesNueSelections(srProxy)){
945  dataVals.set_val_at(cmf::kLep_RecoE , (float)ana::kEME_2020(&srProxy));
946  dataVals.set_val_at(cmf::kHad_RecoE , (float)ana::kHADE_2020(&srProxy));
947  dataVals.set_val_at(cmf::kNuE_CVN , (float)ana::kCVNe_looseptp(&srProxy));
948  dataVals.set_val_at(cmf::kNuE_NumMichel , (float)ana::kNMichels(&srProxy));
949  }
950  else if(this->PassesNumuSelections(srProxy)){
951  // new implementation
952  dataVals.set_val_at(cmf::kLep_RecoE, (float)ana::kNumuMuE2020(&srProxy));
953  dataVals.set_val_at(cmf::kHad_RecoE, (float)ana::kNumuHadE2020(&srProxy));
954  dataVals.set_val_at(cmf::kRecoQ2 , (float)ana::kRecoQ2(&srProxy));
955  //dataVals.set_val_at(cmf::kLep_RecoE_MCFrac, (float)ana::kNumuHadEFrac2020(&srProxy));
956  }
957  else if(this->PassesNCSelections(srProxy)){
958  // NOTE: the energies here are NOT the leptonic and hadronic energies
959  // for the NC energy estimator we need the "EM-like" and "Hadronic-like" energies
960  // and so we store them in the leptonic and hadronic energies repsectively
961 
962  dataVals.set_val_at(cmf::kLep_RecoE, ana::kEME_2020 (&srProxy));
963  dataVals.set_val_at(cmf::kHad_RecoE, ana::kHADE_2020(&srProxy));
964 
965  }
966 
967  }
const ana::Var kRecoQ2([](const caf::SRProxy *sr){const double M_mu_sqrd=util::sqr(0.1056);double E_mu=kMuE(sr);double p_mu=sqrt(util::sqr(E_mu)-M_mu_sqrd);return 2 *kCCE(sr)*(E_mu-p_mu *kCosNumi(sr))-M_mu_sqrd;})
Reconstructed four-momentum transfer invariant (Q^2)
Definition: NumuVars.h:146
bool PassesNumuSelections(caf::SRProxy const &proxy) const
void set_val_at(uint8_t const &varkey, float const &val)
Definition: VarVals.cxx:189
bool PassesNueSelections(caf::SRProxy const &proxy) const
const Var kNMichels([](const caf::SRProxy *sr){int n_me=0;for(int i=0;i< (int) sr->me.nslc;i++) if(sr->me.slc[i].mid > 1. &&sr->me.slc[i].deltat > 1200.) n_me++;for(int i=0;i< (int) sr->me.nkalman;i++) if(sr->me.trkkalman[i].mid > 0. &&sr->me.trkkalman[i].deltat > 800.) n_me++;if(n_me > 2) n_me=2;return n_me;})
Number of SlcME&#39;s assoc with slice.
Definition: Vars.h:85
const Var kHADE_2020([](const caf::SRProxy *sr){if(!sr->vtx.elastic.IsValid) return-1.0;if(sr->vtx.elastic.fuzzyk.npng< 1) return-1.0;const double CVNha_CalE=sr->slc.calE;return std::max(CVNha_CalE-kEME_2020(sr), 0.);})
Definition: NueEnergy2020.h:15
bool PassesNCSelections(caf::SRProxy const &proxy) const
const Var kCVNe_looseptp
Definition: Vars.cxx:36
const Var kEME_2020([](const caf::SRProxy *sr){if(!sr->vtx.elastic.IsValid) return-1.0;if(sr->vtx.elastic.fuzzyk.npng< 1) return-1.0;double CVNem_CalE=0.0;const caf::SRFuzzyKProngProxy &prim_png=sr->vtx.elastic.fuzzyk.png[0];for(const caf::SRFuzzyKProngProxy &png:sr->vtx.elastic.fuzzyk.png){double png_CalE=png.shwlid.calE;double emPID=((double) png.cvnpart.photonid+ (double) png.cvnpart.pizeroid+ (double) png.cvnpart.electronid);double haPID=((double) png.cvnpart.protonid+ (double) png.cvnpart.pionid+ (double) png.cvnpart.neutronid+ (double) png.cvnpart.otherid+ (double) png.cvnpart.muonid);if(emPID< 0) continue;if(emPID >=haPID ) CVNem_CalE+=png_CalE;else continue;}if(kLongestProng(sr) >=500) CVNem_CalE=prim_png.shwlid.calE;return CVNem_CalE;})
Definition: NueEnergy2020.h:14
const Var kNumuMuE2020
Definition: NumuEFxs.h:198
const Var kNumuHadE2020
Definition: NumuEFxs.h:199
void cmf::CAFToEventList::FillEventId ( cmf::EventId evId,
caf::SRProxy const &  srProxy 
) const
private

Definition at line 970 of file CMFCAFToEventList_module.cc.

References cmf::EventId::cycle, caf::Proxy< caf::SRHeader >::cycle, cmf::EventId::event, caf::Proxy< caf::SRHeader >::evt, caf::Proxy< caf::StandardRecord >::hdr, cmf::EventId::run, caf::Proxy< caf::SRHeader >::run, cmf::EventId::slice, caf::Proxy< caf::SRHeader >::subevt, cmf::EventId::subrun, and caf::Proxy< caf::SRHeader >::subrun.

Referenced by FillVariables().

972  {
973  evId.run = srProxy.hdr.run;
974  evId.subrun = srProxy.hdr.subrun;
975  evId.event = srProxy.hdr.evt;
976  evId.slice = srProxy.hdr.subevt;
977  evId.cycle = srProxy.hdr.cycle;
978  }
int subrun
Definition: VarVals.h:84
int cycle
Definition: VarVals.h:86
int slice
Definition: VarVals.h:87
int event
Definition: VarVals.h:85
void cmf::CAFToEventList::FillMCVals ( cmf::TruthVars truthVars,
cmf::WeightVars weightVars,
cmf::SystVarColl systVars,
caf::SRProxy srProxy 
) const
private

Definition at line 757 of file CMFCAFToEventList_module.cc.

References check_time_usage::float, cmf::WeightVars::fPPFXFluxCV_Weight, fSystType, cmf::TruthVars::fTrueCCNC, cmf::TruthVars::fTrueE, cmf::TruthVars::fTrueHitNuc, cmf::TruthVars::fTrueIntMode, cmf::TruthVars::fTrueIntType, cmf::TruthVars::fTrueParentDecay, cmf::TruthVars::fTrueParentPDG, cmf::TruthVars::fTrueParentPT, cmf::TruthVars::fTrueParentPZ, cmf::TruthVars::fTrueParentTargetPDG, cmf::TruthVars::fTruePDG, cmf::TruthVars::fTruePDGOrig, cmf::WeightVars::fXSecCV2020_Weight, cmf::WeightVars::fXSecCVPPFX_Weight, ana::GetGenieKnobSyst(), ana::GetGeniePrincipals2020Small(), ana::k2ndClassCurrs, ana::kAna2020NormFHC, ana::kAna2020NormRHC, cmf::kBaselineNux, simb::kCC, ana::kCOHCCScaleSyst2018, ana::kCOHNCScaleSyst2018, ana::kCorrMuEScaleSyst2020, ana::kDISvbarnCC0pi_2020, ana::kDISvbarnCC1pi_2020, ana::kDISvbarnCC2pi_2020, ana::kDISvbarnCC3pi_2020, ana::kDISvbarnNC0pi_2020, ana::kDISvbarnNC1pi_2020, ana::kDISvbarnNC2pi_2020, ana::kDISvbarnNC3pi_2020, ana::kDISvbarpCC0pi_2020, ana::kDISvbarpCC1pi_2020, ana::kDISvbarpCC2pi_2020, ana::kDISvbarpCC3pi_2020, ana::kDISvbarpNC0pi_2020, ana::kDISvbarpNC1pi_2020, ana::kDISvbarpNC2pi_2020, ana::kDISvbarpNC3pi_2020, ana::kDISvnCC0pi_2020, ana::kDISvnCC1pi_2020, ana::kDISvnCC2pi_2020, ana::kDISvnCC3pi_2020, ana::kDISvnNC0pi_2020, ana::kDISvnNC1pi_2020, ana::kDISvnNC2pi_2020, ana::kDISvnNC3pi_2020, ana::kDISvpCC0pi_2020, ana::kDISvpCC1pi_2020, ana::kDISvpCC2pi_2020, ana::kDISvpCC3pi_2020, ana::kDISvpNC0pi_2020, ana::kDISvpNC1pi_2020, ana::kDISvpNC2pi_2020, ana::kDISvpNC3pi_2020, ana::kFormZone_2020, ana::kGauss2DCorr_1Nux, ana::kGauss2DCorr_2Nux, ana::kGauss2DMeanQ0_1Nux, ana::kGauss2DMeanQ0_2Nux, ana::kGauss2DMeanQ3_1Nux, ana::kGauss2DMeanQ3_2Nux, ana::kGauss2DNorm_1Nux, ana::kGauss2DNorm_2Nux, ana::kGauss2DSigmaQ0_1Nux, ana::kGauss2DSigmaQ0_2Nux, ana::kGauss2DSigmaQ3_1Nux, ana::kGauss2DSigmaQ3_2Nux, ana::kHitNuc, ana::khNFSISyst2020_EV1, ana::khNFSISyst2020_EV2, ana::khNFSISyst2020_EV3, ana::khNFSISyst2020_MFP, ana::kMECEnuShapeSyst2020AntiNu, ana::kMECEnuShapeSyst2020Nu, ana::kMECInitStateNPFracSyst2020AntiNu, ana::kMECInitStateNPFracSyst2020Nu, ana::kMECShapeSyst2020AntiNu, ana::kMECShapeSyst2020Nu, ana::kMichelTaggingSyst2020, ana::kMode, simb::kNC, ana::kNeutronVisEScalePrimariesSyst2018, ana::kPileupMuESyst2020, ana::kPPFXFluxCVWgt, ana::kRadCorrNue, ana::kRadCorrNuebar, ana::kRESLowQ2SuppressionSyst2020, ana::kRPACCQEEnhSyst2020, ana::kRPACCQESuppSyst2020, ana::kTauScaleSyst, ana::kTrueE, ana::kTruePDG, ana::kTruetpT, ana::kTruetpz, ana::kUnCorrMuCatMuESyst2020, ana::kUnCorrNDMuEScaleSyst2020, ana::kXSecCVWgt2020, ana::kZExpEV1Syst2020, ana::kZExpEV2Syst2020, ana::kZExpEV3Syst2020, ana::kZExpEV4Syst2020, caf::Proxy< caf::StandardRecord >::mc, caf::Proxy< caf::SRTruthBranch >::nu, string, art::to_string(), cmf::VarNameToKey(), and wgt.

Referenced by FillVariables().

761  {
762 
763  truthVars.fTrueE = (float)ana::kTrueE(&srProxy) ;
764  truthVars.fTruePDG = (float)ana::kTruePDG(&srProxy) ;
765  truthVars.fTrueCCNC = (srProxy.mc.nu[0].iscc) ? simb::kCC : simb::kNC;
766  truthVars.fTrueIntType = srProxy.mc.nu[0].inttype ;
767  truthVars.fTrueIntMode = (float)ana::kMode(&srProxy) ;
768  truthVars.fTrueHitNuc = (float)ana::kHitNuc(&srProxy) ;
769  truthVars.fTruePDGOrig = srProxy.mc.nu[0].pdgorig ;
770  truthVars.fTrueParentPDG = srProxy.mc.nu[0].beam.ptype ;
771  truthVars.fTrueParentDecay = srProxy.mc.nu[0].beam.ndecay ;
772  truthVars.fTrueParentTargetPDG = srProxy.mc.nu[0].beam.tptype ;
773  truthVars.fTrueParentPZ = (float)ana::kTruetpz(&srProxy) ;
774  truthVars.fTrueParentPT = (float)ana::kTruetpT(&srProxy) ;
775 
776  // we only care about the following systematics if we're not running a
777  // systematically shifted dataset
778  if (fSystType != "NOSYST") return;
779 
780  // these are weights applied to the event
781  weightVars.fXSecCVPPFX_Weight = (float)(ana::kXSecCVWgt2020(&srProxy) * ana::kPPFXFluxCVWgt(&srProxy));
782  weightVars.fXSecCV2020_Weight = (float)(ana::kXSecCVWgt2020(&srProxy));
783  weightVars.fPPFXFluxCV_Weight = (float)(ana::kPPFXFluxCVWgt(&srProxy));
784 
785  // Now for the full set of systematic knobs
786  // These systematics for the 2020 analysis are taken from Analysis/3FlavorAna2020Systs.cxx
787  //
788  // Note that we don't take:
789  // -- file systematics -> just produce systematically shifted event lists
790  // -- beam systematics -> we have our own handling of that. See core/ShifterAndWeighter.cxx
791 
792  static std::map<const ana::ISyst*, std::string> labelMap =
793  {
794  // xsec systematics
795  {ana::GetGenieKnobSyst(rwgt::fReweightMaCCRES) , "MaCCRES" },
796  {ana::GetGenieKnobSyst(rwgt::fReweightMvCCRES) , "MvCCRES" },
797  {ana::GetGenieKnobSyst(rwgt::fReweightMaNCRES) , "MaNCRES" },
798  {ana::GetGenieKnobSyst(rwgt::fReweightMvNCRES) , "MvNCRES" },
799  {ana::GetGenieKnobSyst(rwgt::fReweightZNormCCQE), "ZNormCCQE" },
800  {&ana::kZExpEV1Syst2020 , "ZExpAxialFFSyst2020_eV1" },
801  {&ana::kZExpEV2Syst2020 , "ZExpAxialFFSyst2020_eV2" },
802  {&ana::kZExpEV3Syst2020 , "ZExpAxialFFSyst2020_eV3" },
803  {&ana::kZExpEV4Syst2020 , "ZExpAxialFFSyst2020_eV4" },
804  {&ana::kRPACCQEEnhSyst2020 , "RPACCQEshapeEnh" }, // ?
805  {&ana::kRPACCQESuppSyst2020 , "RPACCQEshapeSupp" }, // ?
806  {&ana::kRESLowQ2SuppressionSyst2020 , "RESLowQ2SuppSyst2020" },
807  {&ana::kDISvnCC1pi_2020 , "DISvnCC1piWgt_2020" }, // ?
808  {&ana::khNFSISyst2020_MFP , "hNFSISyst2020_MFP" },
809  {&ana::khNFSISyst2020_EV1 , "hNFSISyst2020_EV1" },
810  {&ana::kMECEnuShapeSyst2020Nu , "MECEnuShapeSyst2020Nu" },
811  {&ana::kMECEnuShapeSyst2020AntiNu , "MECEnuShapeSyst2020AntiNu" },
812  {&ana::kMECShapeSyst2020Nu , "MECShapeSyst2020Nu" },
813  {&ana::kMECShapeSyst2020AntiNu , "MECShapeSyst2020AntiNu" },
814  {&ana::kMECInitStateNPFracSyst2020Nu , "MECInitStateNPFracSyst2020Nu" },
815  {&ana::kMECInitStateNPFracSyst2020AntiNu , "MECInitStateNPFracSyst2020AntiNu" },
816  {&ana::kRadCorrNue , "RadCorrNue" },
817  {&ana::kRadCorrNuebar , "RadCorrNuebar" },
818  {&ana::k2ndClassCurrs , "2ndClassCurrs" },
819  // muon energy scale systematics
820  {&ana::kUnCorrNDMuEScaleSyst2020 , "UnCorrNDMuEScaleSyst2020" },
821  {&ana::kUnCorrMuCatMuESyst2020 , "UnCorrMuCatMuESyst2020" },
822  {&ana::kPileupMuESyst2020 , "PileupMuESyst2020" },
823  {&ana::kCorrMuEScaleSyst2020 , "CorrMuEScaleSyst2020" },
824  // neutron systematics
825  {&ana::kNeutronVisEScalePrimariesSyst2018 , "NeutronVisEScalePrimariesSyst2018"},
826  // michel systematics
827  {&ana::kMichelTaggingSyst2020 , "MichelTaggingSyst2020" },
828  // norm systemaitics
829  {&ana::kAna2020NormFHC , "Ana2020NormFHC" },
830  {&ana::kAna2020NormRHC , "Ana2020NormRHC" },
831  // other systematics
832  {&ana::kTauScaleSyst , "TauScaleSyst" },
833  // loads of DIS systs, likely in pca systs, but worth having just in case
834  {&ana::kDISvpCC0pi_2020 , "DISvpCC0pi_2020" },
835  {&ana::kDISvpCC1pi_2020 , "DISvpCC1pi_2020" },
836  {&ana::kDISvpCC2pi_2020 , "DISvpCC2pi_2020" },
837  {&ana::kDISvpCC3pi_2020 , "DISvpCC3pi_2020" },
838  {&ana::kDISvpNC0pi_2020 , "DISvpNC0pi_2020" },
839  {&ana::kDISvpNC1pi_2020 , "DISvpNC1pi_2020" },
840  {&ana::kDISvpNC2pi_2020 , "DISvpNC2pi_2020" },
841  {&ana::kDISvpNC3pi_2020 , "DISvpNC3pi_2020" },
842  {&ana::kDISvnCC0pi_2020 , "DISvnCC0pi_2020" },
843  {&ana::kDISvnCC1pi_2020 , "DISvnCC1pi_2020" },
844  {&ana::kDISvnCC2pi_2020 , "DISvnCC2pi_2020" },
845  {&ana::kDISvnCC3pi_2020 , "DISvnCC3pi_2020" },
846  {&ana::kDISvnNC0pi_2020 , "DISvnNC0pi_2020" },
847  {&ana::kDISvnNC1pi_2020 , "DISvnNC1pi_2020" },
848  {&ana::kDISvnNC2pi_2020 , "DISvnNC2pi_2020" },
849  {&ana::kDISvnNC3pi_2020 , "DISvnNC3pi_2020" },
850  {&ana::kDISvbarpCC0pi_2020 , "DISvbarpCC0pi_2020" },
851  {&ana::kDISvbarpCC1pi_2020 , "DISvbarpCC1pi_2020" },
852  {&ana::kDISvbarpCC2pi_2020 , "DISvbarpCC2pi_2020" },
853  {&ana::kDISvbarpCC3pi_2020 , "DISvbarpCC3pi_2020" },
854  {&ana::kDISvbarpNC0pi_2020 , "DISvbarpNC0pi_2020" },
855  {&ana::kDISvbarpNC1pi_2020 , "DISvbarpNC1pi_2020" },
856  {&ana::kDISvbarpNC2pi_2020 , "DISvbarpNC2pi_2020" },
857  {&ana::kDISvbarpNC3pi_2020 , "DISvbarpNC3pi_2020" },
858  {&ana::kDISvbarnCC0pi_2020 , "DISvbarnCC0pi_2020" },
859  {&ana::kDISvbarnCC1pi_2020 , "DISvbarnCC1pi_2020" },
860  {&ana::kDISvbarnCC2pi_2020 , "DISvbarnCC2pi_2020" },
861  {&ana::kDISvbarnCC3pi_2020 , "DISvbarnCC3pi_2020" },
862  {&ana::kDISvbarnNC0pi_2020 , "DISvbarnNC0pi_2020" },
863  {&ana::kDISvbarnNC1pi_2020 , "DISvbarnNC1pi_2020" },
864  {&ana::kDISvbarnNC2pi_2020 , "DISvbarnNC2pi_2020" },
865  {&ana::kDISvbarnNC3pi_2020 , "DISvbarnNC3pi_2020" },
866  // and some additional likely-pca systs
867  {&ana::kFormZone_2020 , "FormZone_2020" } ,
868  {&ana::khNFSISyst2020_EV2 , "hNFSISyst2020_EV2" } ,
869  {&ana::khNFSISyst2020_EV3 , "hNFSISyst2020_EV3" } ,
870  {ana::GetGenieKnobSyst(rwgt::fReweightMaNCEL) , "MaNCEL" } ,
871  {ana::GetGenieKnobSyst(rwgt::fReweightEtaNCEL) , "EtaNCEL" } ,
872  {&ana::kCOHCCScaleSyst2018 , "COHCCScale2018" } ,
873  {&ana::kCOHNCScaleSyst2018 , "COHNCScale2018" } ,
874  {ana::GetGenieKnobSyst(rwgt::fReweightAhtBY) , "AhtBY" } ,
875  {ana::GetGenieKnobSyst(rwgt::fReweightBhtBY) , "BhtBY" } ,
876  {ana::GetGenieKnobSyst(rwgt::fReweightCV1uBY) , "CV1uBY" } ,
877  {ana::GetGenieKnobSyst(rwgt::fReweightCV2uBY) , "CV2uBY" } ,
878  {ana::GetGenieKnobSyst(rwgt::fReweightAGKY_xF1pi) , "AGKY_xF1pi" } ,
879  {ana::GetGenieKnobSyst(rwgt::fReweightAGKY_pT1pi) , "AGKY_pT1pi" } ,
880  {ana::GetGenieKnobSyst(rwgt::fReweightBR1gamma) , "BR1gamma" } ,
881  {ana::GetGenieKnobSyst(rwgt::fReweightBR1eta) , "BR1eta" } ,
882  {ana::GetGenieKnobSyst(rwgt::fReweightTheta_Delta2Npi) , "Theta_Delta2Npi" } ,
883  // mec for NuX
896  {new ana::MECDoubleGaussEnhSystNux( ana::MECDoubleGaussEnhParamNux::kBaselineNux , "BaselineNux" ), "BaselineNux" }
897  };
898 
899  // add small GENIE PCA scale systs
900  for (int ipca = 0; ipca < 12; ++ipca){
901  std::string gpcaname = "GENIEPCA" + std::to_string(ipca);
902  labelMap[ana::GetGeniePrincipals2020Small(ipca)] = gpcaname;
903  }
904 
905  // now that we have the ISysts for all of the systematics we want to use, get
906  // the -2, -1, +1, +2 shifts and store them in the files.
907  std::string rwgtLabel;
908  std::vector<double> wgt(4, 1.);
909  systShifts.clear();
910  for (auto const& rwgtPair : labelMap){
911 
912  auto wgtFunc = rwgtPair.first;
913  rwgtLabel = rwgtPair.second;
914 
915  wgt[0] = 1.;
916  wgtFunc->Shift(-2., &srProxy, wgt[0]);
917 
918  wgt[1] = 1.;
919  wgtFunc->Shift(-1., &srProxy, wgt[1]);
920 
921  wgt[2] = 1.;
922  wgtFunc->Shift( 1., &srProxy, wgt[2]);
923 
924  wgt[3] = 1.;
925  wgtFunc->Shift( 2., &srProxy, wgt[3]);
926 
927  systShifts.emplace_back(cmf::VarNameToKey(rwgtLabel),
928  (float)wgt[0],
929  (float)wgt[1],
930  (float)wgt[2],
931  (float)wgt[3]);
932 
933  } // end loop over genie reweight variables
934 
935  }
const Var kTruePDG
Definition: TruthVars.h:48
float fTruePDGOrig
true PDG of original neutrino
Definition: VarVals.h:50
const Var kMode([](const caf::SRProxy *sr){return(sr->mc.nnu==0)?-1:int(sr->mc.nu[0].mode);})
Neutrino interaction mode.
Definition: Vars.h:99
const NOvARwgtSyst kZExpEV2Syst2020("ZExpAxialFFSyst2020_EV2","CCQE z-exp EV shift #2", novarwgt::kZExpEV2Syst2020)
Definition: XSecSysts.h:57
const NOvARwgtSyst kDISvpNC2pi_2020("DISvpNC2pi_2020","DIS vpNC2pi", novarwgt::kDIS_NC_2pi_nu_p_SystKnob_2020)
Definition: DISSysts.h:21
const DummyAnaSyst kAna2020NormFHC("NormFHC2020","FHC. Norm.")
const NOvARwgtSyst k2ndClassCurrs("2ndclasscurr","Second class currents", novarwgt::kSimpleSecondClassCurrentsSystKnob)
Second-class current syst. See documentation in NOvARwgt.
Definition: XSecSysts.h:71
const NOvARwgtSyst khNFSISyst2020_MFP("hNFSI_MFP_2020","hN FSI mean free path", novarwgt::khNFSISyst2020_MFP)
Definition: FSISysts.h:13
const NOvARwgtSyst kDISvnNC3pi_2020("DISvnNC3pi_2020","DIS vnNC3pi", novarwgt::kDIS_NC_3pluspi_nu_n_SystKnob_2020)
Definition: DISSysts.h:30
const NOvARwgtSyst kDISvbarpCC2pi_2020("DISvbarpCC2pi_2020","DIS vbarpCC2pi", novarwgt::kDIS_CC_2pi_nubar_p_SystKnob_2020)
Definition: DISSysts.h:33
const Var kPPFXFluxCVWgt
Definition: PPFXWeights.h:16
const NOvARwgtSyst kDISvbarpNC3pi_2020("DISvbarpNC3pi_2020","DIS vbarpNC3pi", novarwgt::kDIS_NC_3pluspi_nubar_p_SystKnob_2020)
Definition: DISSysts.h:38
const NOvARwgtSyst kDISvbarnNC3pi_2020("DISvbarnNC3pi_2020","DIS vbarnNC3pi", novarwgt::kDIS_NC_3pluspi_nubar_n_SystKnob_2020)
Definition: DISSysts.h:46
float fPPFXFluxCV_Weight
For 2020 Ana, store weights seperately.
Definition: VarVals.h:159
float fTrueHitNuc
true hit nucleus
Definition: VarVals.h:56
const NOvARwgtSyst kDISvbarpCC0pi_2020("DISvbarpCC0pi_2020","DIS vbarpCC0pi", novarwgt::kDIS_CC_0pi_nubar_p_SystKnob_2020)
Definition: DISSysts.h:31
float fTrueCCNC
true cc vs nc
Definition: VarVals.h:48
const NOvARwgtSyst kDISvbarnCC2pi_2020("DISvbarnCC2pi_2020","DIS vbarnCC2pi", novarwgt::kDIS_CC_2pi_nubar_n_SystKnob_2020)
Definition: DISSysts.h:41
const NOvARwgtSyst kDISvnNC2pi_2020("DISvnNC2pi_2020","DIS vnNC2pi", novarwgt::kDIS_NC_2pi_nu_n_SystKnob_2020)
Definition: DISSysts.h:29
float fTrueParentDecay
true parent decay mode
Definition: VarVals.h:54
float fTruePDG
true PDG
Definition: VarVals.h:47
const NOvARwgtSyst kMECShapeSyst2020Nu("MECShape2020Nu","MEC 2020 (q_{0}, |#vec{q}|) response, neutrinos", novarwgt::kMECQ0Q3RespSyst2020_NuOnly)
Definition: MECSysts.h:11
const NOvARwgtSyst kDISvpCC0pi_2020("DISvpCC0pi_2020","DIS vpCC0pi", novarwgt::kDIS_CC_0pi_nu_p_SystKnob_2020)
Definition: DISSysts.h:15
const NOvARwgtSyst kDISvnCC1pi_2020("DISvnCC1pi_2020","DIS vnCC1pi", novarwgt::kDIS_CC_1pi_nu_n_SystKnob_2020)
Definition: DISSysts.h:24
const NOvARwgtSyst kDISvbarnNC2pi_2020("DISvbarnNC2pi_2020","DIS vbarnNC2pi", novarwgt::kDIS_NC_2pi_nubar_n_SystKnob_2020)
Definition: DISSysts.h:45
const NOvARwgtSyst kDISvpCC2pi_2020("DISvpCC2pi_2020","DIS vpCC2pi", novarwgt::kDIS_CC_2pi_nu_p_SystKnob_2020)
Definition: DISSysts.h:17
const NOvARwgtSyst kDISvpCC3pi_2020("DISvpCC3pi_2020","DIS vpCC3pi", novarwgt::kDIS_CC_3pluspi_nu_p_SystKnob_2020)
Definition: DISSysts.h:18
const NOvARwgtSyst kDISvbarpNC1pi_2020("DISvbarpNC1pi_2020","DIS vbarpNC1pi", novarwgt::kDIS_NC_1pi_nubar_p_SystKnob_2020)
Definition: DISSysts.h:36
caf::Proxy< std::vector< caf::SRNeutrino > > nu
Definition: SRProxy.h:618
const NuTruthSystComponentScale kTauScaleSyst("NuTauScale","#nu_{#tau} Scale", kIsTau_NT &&!kIsNC_NT, 0.6, NuTruthSystComponentScale::kLinear)
100% uncertainty scale on taus
Definition: Systs.h:176
float fTrueParentPT
true p_T of neutrino parent
Definition: VarVals.h:52
const NOvARwgtSyst kDISvbarnCC0pi_2020("DISvbarnCC0pi_2020","DIS vbarnCC0pi", novarwgt::kDIS_CC_0pi_nubar_n_SystKnob_2020)
Definition: DISSysts.h:39
const NeutronVisEScaleSyst2018 kNeutronVisEScalePrimariesSyst2018(false)
const DummyAnaSyst kAna2020NormRHC("NormRHC2020","RHC. Norm.")
const NOvARwgtSyst khNFSISyst2020_EV3("hNFSI_FateFracEV3_2020","hN FSI fate fraction eigenvector #3", novarwgt::khNFSISyst2020_EV3)
Definition: FSISysts.h:12
const NOvARwgtSyst kDISvbarpNC2pi_2020("DISvbarpNC2pi_2020","DIS vbarpNC2pi", novarwgt::kDIS_NC_2pi_nubar_p_SystKnob_2020)
Definition: DISSysts.h:37
const NOvARwgtSyst kDISvbarpNC0pi_2020("DISvbarpNC0pi_2020","DIS vbarpNC0pi", novarwgt::kDIS_NC_0pi_nubar_p_SystKnob_2020)
Definition: DISSysts.h:35
const NOvARwgtSyst kDISvbarnNC0pi_2020("DISvbarnNC0pi_2020","DIS vbarnNC0pi", novarwgt::kDIS_NC_0pi_nubar_n_SystKnob_2020)
Definition: DISSysts.h:43
float fTrueE
True nu energy.
Definition: VarVals.h:46
const Var kTruetpT([](const caf::SRProxy *sr){return(sr->mc.nnu==0)?0.:util::pythag(sr->mc.nu[0].beam.tp.X(), sr->mc.nu[0].beam.tp.Y());})
True neutrino ancestor (off-target) pT.
Definition: Vars.h:102
const Var kHitNuc
Definition: TruthVars.h:19
const NOvARwgtSyst kRadCorrNuebar("radcorrnuebar","Radiative corrections for #bar{#nu}_{e}", novarwgt::kSimpleRadiativeCorrNuebarXsecSystKnob)
Radiative corrections syst (nuebars). See documentation in NOvARwgt.
Definition: XSecSysts.h:67
const NOvARwgtSyst kDISvnCC2pi_2020("DISvnCC2pi_2020","DIS vnCC2pi", novarwgt::kDIS_CC_2pi_nu_n_SystKnob_2020)
Definition: DISSysts.h:25
const NOvARwgtSyst kFormZone_2020("FormZone2020","DIS Formation Zone", novarwgt::kFormZoneSyst2020)
Definition: DISSysts.h:7
static uint8_t VarNameToKey(std::string const &name)
Definition: StaticFuncs.h:385
const Var kTrueE([](const caf::SRProxy *sr){assert(sr->mc.nnu==1);return sr->mc.nu[0].E;})
Definition: Vars.cxx:85
float fTrueParentPDG
true PDG of neutrino parent
Definition: VarVals.h:51
std::string fSystType
systematic type
const NOvARwgtSyst kDISvbarpCC3pi_2020("DISvbarpCC3pi_2020","DIS vbarpCC3pi", novarwgt::kDIS_CC_3pluspi_nubar_p_SystKnob_2020)
Definition: DISSysts.h:34
const NOvARwgtSyst kZExpEV1Syst2020("ZExpAxialFFSyst2020_EV1","CCQE z-exp EV shift #1", novarwgt::kZExpEV1Syst2020)
Definition: XSecSysts.h:56
const Var kTruetpz([](const caf::SRProxy *sr){return(sr->mc.nnu==0)?0.:float(sr->mc.nu[0].beam.tp.z);})
True neutrino ancestor (off-target) pz.
Definition: Vars.h:105
const NOvARwgtSyst khNFSISyst2020_EV1("hNFSI_FateFracEV1_2020","hN FSI fate fraction eigenvector #1", novarwgt::khNFSISyst2020_EV1)
Definition: FSISysts.h:10
const NOvARwgtSyst kMECInitStateNPFracSyst2020AntiNu("MECInitStateNPFrac2020AntiNu","MEC initial state np fraction, antineutrinos", novarwgt::kMECInitStateNPFracSyst2020_NubarOnly)
Definition: MECSysts.h:18
const NOvARwgtSyst kDISvbarpCC1pi_2020("DISvbarpCC1pi_2020","DIS vbarpCC1pi", novarwgt::kDIS_CC_1pi_nubar_p_SystKnob_2020)
Definition: DISSysts.h:32
const NOvARwgtSyst kDISvnCC0pi_2020("DISvnCC0pi_2020","DIS vnCC0pi", novarwgt::kDIS_CC_0pi_nu_n_SystKnob_2020)
Definition: DISSysts.h:23
const NOvARwgtSyst kDISvbarnNC1pi_2020("DISvbarnNC1pi_2020","DIS vbarnNC1pi", novarwgt::kDIS_NC_1pi_nubar_n_SystKnob_2020)
Definition: DISSysts.h:44
float fXSecCV2020_Weight
For 2020 Ana, store weights seperately.
Definition: VarVals.h:158
const NOvARwgtSyst kZExpEV4Syst2020("ZExpAxialFFSyst2020_EV4","CCQE z-exp EV shift #4", novarwgt::kZExpEV4Syst2020)
Definition: XSecSysts.h:59
const ana::Var wgt
const NOvARwgtSyst kRPACCQEEnhSyst2020("RPAShapeenh2020","RPA shape: higher-Q^{2} enhancement (2020)", novarwgt::kRPACCQEEnhSyst2020)
Definition: RPASysts.h:17
const NOvARwgtSyst kCOHCCScaleSyst2018("COHCCScale2018","Coherent CC Scale", novarwgt::kCOHNormCCSystKnob)
20% uncertainty scale on coherent CC events. See documentation in NOvARwgt
Definition: XSecSysts.h:40
const NOvARwgtSyst kDISvbarnCC3pi_2020("DISvbarnCC3pi_2020","DIS vbarnCC3pi", novarwgt::kDIS_CC_3pluspi_nubar_n_SystKnob_2020)
Definition: DISSysts.h:42
float fXSecCVPPFX_Weight
Was Tufts weight for SA.
Definition: VarVals.h:150
float fTrueParentPZ
true p_Z of neutrino parent
Definition: VarVals.h:53
const NOvARwgtSyst kRESLowQ2SuppressionSyst2020("LowQ2RESSupp2020","RES low-Q^2 suppression", novarwgt::kRESLowQ2SuppressionSyst2020)
Definition: RESSysts.h:10
const MichelTaggingSyst2020 kMichelTaggingSyst2020
const NOvARwgtSyst kZExpEV3Syst2020("ZExpAxialFFSyst2020_EV3","CCQE z-exp EV shift #3", novarwgt::kZExpEV3Syst2020)
Definition: XSecSysts.h:58
const NOvARwgtSyst khNFSISyst2020_EV2("hNFSI_FateFracEV2_2020","hN FSI fate fraction eigenvector #2", novarwgt::khNFSISyst2020_EV2)
Definition: FSISysts.h:11
caf::Proxy< caf::SRTruthBranch > mc
Definition: SRProxy.h:2138
const NOvARwgtSyst kCOHNCScaleSyst2018("COHNCScale2018","Coherent NC Scale", novarwgt::kCOHNormNCSystKnob)
20% uncertainty scale on coherent NC events. See documentation in NOvARwgt
Definition: XSecSysts.h:43
const NOvARwgtSyst kMECInitStateNPFracSyst2020Nu("MECInitStateNPFrac2020Nu","MEC initial state np fraction, neutrinos", novarwgt::kMECInitStateNPFracSyst2020_NuOnly)
Definition: MECSysts.h:17
const NOvARwgtSyst kMECShapeSyst2020AntiNu("MECShape2020AntiNu","MEC 2020 (q_{0}, |#vec{q}|) response, antineutrinos", novarwgt::kMECQ0Q3RespSyst2020_NubarOnly)
Definition: MECSysts.h:12
const PileupMuESyst2020 kPileupMuESyst2020(0.46, 1.3)
const NOvARwgtSyst kRPACCQESuppSyst2020("RPAShapesupp2020","RPA shape: low-Q^{2} suppression (2020)", novarwgt::kRPACCQESuppSyst2020)
Definition: RPASysts.h:18
const NOvARwgtSyst kMECEnuShapeSyst2020AntiNu("MECEnuShape2020AntiNu","MEC E_{#nu} shape, antineutrinos", novarwgt::kMECEnuShapeSyst2020_NubarOnly)
Definition: MECSysts.h:15
const NOvARwgtSyst kDISvpCC1pi_2020("DISvpCC1pi_2020","DIS vpCC1pi", novarwgt::kDIS_CC_1pi_nu_p_SystKnob_2020)
Definition: DISSysts.h:16
const CorrMuEScaleSyst2020 kCorrMuEScaleSyst2020(0.0074, 0.0074, 0.0013)
const UnCorrNDMuEScaleSyst2020 kUnCorrNDMuEScaleSyst2020(0.0013)
const NOvARwgtSyst kDISvnCC3pi_2020("DISvnCC3pi_2020","DIS vnCC3pi", novarwgt::kDIS_CC_3pluspi_nu_n_SystKnob_2020)
Definition: DISSysts.h:26
std::string to_string(ModuleType mt)
Definition: ModuleType.h:32
const NOvARwgtSyst kDISvnNC0pi_2020("DISvnNC0pi_2020","DIS vnNC0pi", novarwgt::kDIS_NC_0pi_nu_n_SystKnob_2020)
Definition: DISSysts.h:27
const UnCorrMuCatMuESyst2020 kUnCorrMuCatMuESyst2020(0.0048)
const NOvARwgtSyst kDISvnNC1pi_2020("DISvnNC1pi_2020","DIS vnNC1pi", novarwgt::kDIS_NC_1pi_nu_n_SystKnob_2020)
Definition: DISSysts.h:28
float fTrueIntType
true interaction type
Definition: VarVals.h:49
const NOvARwgtSyst * GetGenieKnobSyst(rwgt::ReweightLabel_t knobIdx, std::string altName, std::string altLabel)
Convenience function to get a GENIE knob syst. (Allows using the GENIE knob name & description as the...
Definition: XSecSysts.cxx:119
const NOvARwgtSyst kDISvpNC3pi_2020("DISvpNC3pi_2020","DIS vpNC3pi", novarwgt::kDIS_NC_3pluspi_nu_p_SystKnob_2020)
Definition: DISSysts.h:22
const NOvARwgtSyst kDISvpNC0pi_2020("DISvpNC0pi_2020","DIS vpNC0pi", novarwgt::kDIS_NC_0pi_nu_p_SystKnob_2020)
Definition: DISSysts.h:19
const NOvARwgtSyst kRadCorrNue("radcorrnue","Radiative corrections for #nu_{e}", novarwgt::kSimpleRadiativeCorrNueXsecSystKnob)
Radiative corrections syst (nues). See documentation in NOvARwgt.
Definition: XSecSysts.h:64
float fTrueIntMode
true interaction mode
Definition: VarVals.h:57
const NOvARwgtSyst kDISvpNC1pi_2020("DISvpNC1pi_2020","DIS vpNC1pi", novarwgt::kDIS_NC_1pi_nu_p_SystKnob_2020)
Definition: DISSysts.h:20
const NOvARwgtSyst kDISvbarnCC1pi_2020("DISvbarnCC1pi_2020","DIS vbarnCC1pi", novarwgt::kDIS_CC_1pi_nubar_n_SystKnob_2020)
Definition: DISSysts.h:40
float fTrueParentTargetPDG
true parent pdg code off the target
Definition: VarVals.h:55
const Var kXSecCVWgt2020
Definition: XsecTunes.h:106
const NOvARwgtSyst kMECEnuShapeSyst2020Nu("MECEnuShape2020Nu","MEC E_{#nu} shape, neutrinos", novarwgt::kMECEnuShapeSyst2020_NuOnly)
Definition: MECSysts.h:14
GeniePCASyst * GetGeniePrincipals2020Small(int PCIdx)
enum BeamMode string
void cmf::CAFToEventList::FillVariables ( std::vector< cmf::DataVarVals > &  dataVals,
std::vector< cmf::MCVarVals > &  mcVals,
std::vector< cmf::EventId > &  evIds,
std::vector< cmf::SelectionType_t > &  sels 
)
private

Definition at line 981 of file CMFCAFToEventList_module.cc.

References fCAFFileNames, fCAFRecTreeName, plotROC::fileName, FillDataVarVals(), FillEventId(), FillMCVals(), FindPOTPerPeriod(), FindSelectionType(), caf::Proxy< caf::StandardRecord >::hdr, MECModelEnuComparisons::i, caf::Proxy< caf::SRHeader >::ismc, LOG_DEBUG, caf::Proxy< caf::StandardRecord >::mc, caf::Proxy< caf::SRTruthBranch >::nu, PassesSelections(), and sr.

Referenced by endJob().

985  {
986  dataVals.clear();
987  mcVals .clear();
988  evIds .clear();
989 
990  for(auto const& fileName : fCAFFileNames){
991 
992  // open the CAF file and get the TTrees and histograms for reading
993  TFile *tf = TFile::Open(fileName.c_str());
994 
995  this->FindPOTPerPeriod(*tf);
996 
997  auto *cafTree = dynamic_cast<TTree*>(tf->Get(fCAFRecTreeName.c_str()));
998 
999  // hook the TTree up to a standard record and get the first entry to initialize things
1000  caf::StandardRecord *sr = nullptr;
1001 
1002  cafTree->SetBranchAddress("rec", &sr);
1003  cafTree->GetEntry(0);
1004 
1005  static caf::SRProxy srProxy(nullptr, nullptr, "", 0, 0);
1006 
1007  LOG_DEBUG("CAFToEventList")
1008  << "There are "
1009  << cafTree->GetEntriesFast()
1010  << " caf entries";
1011 
1012  // now loop over the CAF entries and fill the event list variables
1013  //for(int i = 0; i < 10; ++i){
1014  for(int i = 0; i < cafTree->GetEntriesFast(); ++i){
1015  cafTree->GetEntry(i);
1016 
1017  // get a proxy for each entry
1018  srProxy = *sr;
1019 
1020  // Uncomment the following block to debug cases where events
1021  // show up in the official CAF selection but not this one, or
1022  // vice versa
1023  /*
1024  cmf::EventId curEvent(srProxy.hdr.run,
1025  srProxy.hdr.subrun,
1026  srProxy.hdr.evt,
1027  srProxy.hdr.cycle,
1028  srProxy.hdr.subevt);
1029 
1030  if( fMissingEvents.find(curEvent) != fMissingEvents.end())
1031  LOG_VERBATIM("MissingEventsCheck")
1032  << curEvent
1033  << " beam "
1034  << ana::kInBeamSpill(&srProxy)
1035  << " spill "
1036  << ana::kStandardSpillCuts(&(srProxy.spill))
1037  << " FD all "
1038  << ana::kNue2020FDAllSamples(&srProxy);
1039  */
1040 
1041  if ( !this->PassesSelections(srProxy) ) continue;
1042  sels .emplace_back(this->FindSelectionType(srProxy));
1043 
1044 
1045  cmf::TruthVars truthVars;
1046  cmf::WeightVars weightVars;
1047  cmf::SystVarColl systVars;
1048  cmf::DataVarVals dataVarVals;
1049  cmf::EventId evId;
1050 
1051  // TODO: right now we must emplace back the information
1052  // immediately after we fill it, else ISyst::Shift, called in
1053  // FillMCVals will modify them. This shouldn't happen and really
1054  // bothers me, figure that out.
1055 
1056  // fill the event id information
1057  this->FillEventId(evId, srProxy);
1058  evIds .emplace_back(evId);
1059 
1060  // fill the data values
1061  this->FillDataVarVals(dataVarVals, srProxy);
1062  dataVals.emplace_back(dataVarVals);
1063 
1064  // fill MC information if this is mc
1065  if(srProxy.hdr.ismc){
1066  if(srProxy.mc.nu.size() == 1){
1067  this->FillMCVals(truthVars,
1068  weightVars,
1069  systVars,
1070  srProxy);
1071  }
1072  } // end if the event is MC
1073 
1074 
1075  // add everything to the vectors
1076  mcVals .emplace_back(truthVars, weightVars, systVars);
1077 
1078  } // end loop over the CAF StandardRecords
1079 
1080  tf->Close();
1081 
1082  } // end loop over CAF file names
1083  }
#define LOG_DEBUG(stream)
Definition: Messenger.h:149
fileName
Definition: plotROC.py:78
void FillMCVals(cmf::TruthVars &truthVars, cmf::WeightVars &weightVars, cmf::SystVarColl &systVars, caf::SRProxy &srProxy) const
bool PassesSelections(caf::SRProxy const &proxy) const
Proxy for caf::StandardRecord.
Definition: SRProxy.h:2126
cmf::SelectionType_t FindSelectionType(caf::SRProxy const &srProxy) const
std::string fCAFRecTreeName
names of the CAF tree with the reco info
void FillEventId(cmf::EventId &evId, caf::SRProxy const &srProxy) const
Timing fit.
const Cut sels[kNumSels]
Definition: vars.h:44
std::vector< std::string > fCAFFileNames
name of the CAF file we are using
caf::StandardRecord * sr
Base container for the MC related Vars that constitute an event.
Definition: VarVals.h:383
std::vector< cmf::SystVar > SystVarColl
Definition: VarVals.h:223
The StandardRecord is the primary top-level object in the Common Analysis File trees.
void FillDataVarVals(cmf::DataVarVals &dataVals, caf::SRProxy const &srProxy) const
void cmf::CAFToEventList::FindPOTPerPeriod ( TFile &  tf)
private

Definition at line 594 of file CMFCAFToEventList_module.cc.

References std::abs(), caf::SRSpill::evt, fPeriodToPOTLiveTime, fPOTHistName, fSpillTreeName, MECModelEnuComparisons::i, std::isnan(), ana::kStandardSpillCuts, caf::SRSpill::livetime, LOG_VERBATIM, DCS_db_parser::period, caf::SRSpill::run, RunToPeriod(), caf::SRSpill::spillpot, caf::Proxy< caf::SRSpill >::spillpot, and caf::SRSpill::subrun.

Referenced by FillVariables().

595  {
596  int period;
597  float totalPOT = 0.;
598 
599  // TODO this is just using the standard spill cuts to figure out the POT
600  // which is a potential problem. I think ideally we want to check
601  // PassesSpillAndbeamCuts, which should set the right spill cuts based
602  // on detector/sample but that only takes an srProxy, not a spProxy.
603  // the below was my attempt at getting it working but i couldn't quite get
604  // there, I'll get back to it later.
605 /*
606  auto *cafTree = dynamic_cast<TTree*>(tf.Get(fCAFRecTreeName.c_str()));
607 
608  // hook the TTree up to a standard record and get the first entry to initialize things
609  caf::StandardRecord *sr = nullptr;
610 
611  cafTree->SetBranchAddress("rec", &sr);
612  cafTree->GetEntry(0);
613 
614  static caf::SRProxy srProxy(nullptr, nullptr, "", 0, 0);
615  static caf::SRSpillProxy spProxy(nullptr, nullptr, "", 0, 0);
616 
617  LOG_DEBUG("CAFToEventList")
618  << "There are "
619  << cafTree->GetEntriesFast()
620  << " caf entries";
621 
622  for(int i = 0; i < cafTree->GetEntriesFast(); ++i){
623  cafTree->GetEntry(i);
624 
625  // get a proxy for each entry
626  srProxy = *sr;
627  spProxy = &(srProxy.spill);
628 
629  if !(this->PassesSpillAndBeamCuts(srProxy)) continue;
630 
631  period = this->RunToPeriod(spProxy.run);
632 
633  if (std::isnan(sp.spillpot) || std::isnan(sp.livetime))
634  continue;
635  }
636 */
637 
638  auto *spillTree = dynamic_cast<TTree*>(tf.Get(fSpillTreeName.c_str()));
639 
640  caf::SRSpill *sp = nullptr;
641 
642  spillTree->SetBranchAddress("spill", &sp);
643  spillTree->GetEntry(0);
644 
645  static caf::SRSpillProxy spProxy(nullptr, nullptr, "", 0, 0);
646 
647  LOG_VERBATIM("CAFToEventList")
648  << "There are "
649  << spillTree->GetEntriesFast()
650  << " spills";
651 
652  // loop over the spill tree to add up the POT for each period
653  //for(int i = 0; i < 10; ++i){
654  for(int i = 0; i < spillTree->GetEntries(); ++i){
655 
656  spillTree->GetEntry(i);
657 
658  // get a proxy for each entry
659  spProxy = *sp;
660 
661  // ignore spills that don't pass the standard cuts
662  if(!ana::kStandardSpillCuts(&spProxy)) continue;
663 
664  // now figure out which period this spill belongs to
665  period = this->RunToPeriod(sp->run);
666 
667  if(std::isnan(sp->spillpot) ||
668  std::isnan(sp->livetime) ){
669  LOG_VERBATIM("CAFToEventList")
670  << tf.GetName()
671  << " "
672  << sp->run
673  << " "
674  << sp->subrun
675  << " "
676  << sp->evt
677  << " spill has nan for pot or livetime "
678  << sp->spillpot
679  << " "
680  << sp->livetime
681  << " period "
682  << period;
683 
684  continue;
685  }
686  // spillpot is in units of 10^20 POT
688  fPeriodToPOTLiveTime[period].liveTime += sp->livetime;
689 
690  totalPOT += spProxy.spillpot;
691 
692  } // end loop over the entries in the spill tree
693 
694  // if the spill tree and histogram totals are off by more than 1%, say something
695  // n.b. the histogram stores only spills that pass spill cuts, so we actually expect these
696  // to be a little different
697  if(std::abs(1. - totalPOT / dynamic_cast<TH1F* >(tf.Get(fPOTHistName.c_str()))->Integral()) > 0.01)
698  LOG_VERBATIM("CAFToEventList")
699  << "pot hist has "
700  << dynamic_cast<TH1F* >(tf.Get(fPOTHistName.c_str()))->Integral()
701  << " POT compared to "
702  << totalPOT
703  << " from the tree";
704 
705  // print out the number of pot for all files so far
706  for(auto const& itr : fPeriodToPOTLiveTime){
707  if(itr.second.pot > 0. ||
708  itr.second.liveTime > 0.)
709  LOG_VERBATIM("CAFToEventList")
710  << "period "
711  << itr.first
712  << " has "
713  << itr.second.pot * 1.e-20
714  << " x 10^20 POT and "
715  << itr.second.liveTime
716  << " s live time";
717  }
718  }
std::string fSpillTreeName
names of the Spill tree in the file
std::string fPOTHistName
names of the CAF histogram with the total POT
std::map< int, POTLiveTime > fPeriodToPOTLiveTime
keep track of the POT in each period
unsigned int run
run number
Definition: SRSpill.h:25
Timing fit.
float abs(float number)
Definition: d0nt_math.hpp:39
int isnan(const stan::math::var &a)
Definition: std_isnan.hpp:18
unsigned int subrun
subrun number
Definition: SRSpill.h:26
unsigned int evt
ART event number, indexes trigger windows.
Definition: SRSpill.h:27
Proxy for caf::SRSpill.
Definition: SRProxy.h:1346
float livetime
Length of readout [s].
Definition: SRSpill.h:40
const SpillCut kStandardSpillCuts
Apply this unless you&#39;re doing something special.
Definition: SpillCuts.h:49
float spillpot
Definition: SRSpill.h:38
#define LOG_VERBATIM(category)
cmf::SelectionType_t cmf::CAFToEventList::FindSelectionType ( caf::SRProxy const &  srProxy) const
private

Definition at line 721 of file CMFCAFToEventList_module.cc.

References fNumuFHCQuantCuts, fNumuRHCQuantCuts, caf::Proxy< caf::SRSpill >::isFHC, ana::kCVNe_looseptp, cmf::kNCSelection, ana::kNue2020CVNFHCHighEdge, ana::kNue2020CVNRHCHighEdge, ana::kNue2020FDPeripheral(), cmf::kNuESelectionHighPID, cmf::kNuESelectionLowPID, cmf::kNuESelectionPeripheral, cmf::kNuMuSelectionQ1, cmf::kNuMuSelectionQ2, cmf::kNuMuSelectionQ3, cmf::kNuMuSelectionQ4, cmf::kUnknownSelection, PassesNCSelections(), PassesNueSelections(), PassesNumuSelections(), and caf::Proxy< caf::StandardRecord >::spill.

Referenced by FillVariables().

722  {
723  if(this->PassesNumuSelections(srProxy)){
724  if(srProxy.spill.isFHC){
725  if (fNumuFHCQuantCuts[0](&srProxy)) return cmf::kNuMuSelectionQ1;
726  else if(fNumuFHCQuantCuts[1](&srProxy)) return cmf::kNuMuSelectionQ2;
727  else if(fNumuFHCQuantCuts[2](&srProxy)) return cmf::kNuMuSelectionQ3;
728  else if(fNumuFHCQuantCuts[3](&srProxy)) return cmf::kNuMuSelectionQ4;
729  } // end if fhc
730  else{
731  if (fNumuRHCQuantCuts[0](&srProxy)) return cmf::kNuMuSelectionQ1;
732  else if(fNumuRHCQuantCuts[1](&srProxy)) return cmf::kNuMuSelectionQ2;
733  else if(fNumuRHCQuantCuts[2](&srProxy)) return cmf::kNuMuSelectionQ3;
734  else if(fNumuRHCQuantCuts[3](&srProxy)) return cmf::kNuMuSelectionQ4;
735  }
736  } // end if numu
737  else if(this->PassesNueSelections(srProxy)){
738  auto cvnHighEdge = (srProxy.spill.isFHC) ? ana::kNue2020CVNFHCHighEdge : ana::kNue2020CVNRHCHighEdge;
739  if(ana::kNue2020FDPeripheral(&srProxy))
741  if(ana::kCVNe_looseptp(&srProxy) > cvnHighEdge)
743 
744  // event is NuE and passes the CVN cut, but isn't high or peripheral,
745  // it must be low
747  }
748  else if(this->PassesNCSelections(srProxy)) return cmf::kNCSelection;
749 
750 
751  return cmf::kUnknownSelection;
752  }
bool PassesNumuSelections(caf::SRProxy const &proxy) const
const double kNue2020CVNRHCHighEdge
Definition: NueCuts2020.h:53
std::vector< ana::Cut > fNumuFHCQuantCuts
quantile boundaries for the numu FHC data
const double kNue2020CVNFHCHighEdge
Definition: NueCuts2020.h:48
std::vector< ana::Cut > fNumuRHCQuantCuts
quantile boundaries for the numu RHC data
bool PassesNueSelections(caf::SRProxy const &proxy) const
bool PassesNCSelections(caf::SRProxy const &proxy) const
const Cut kNue2020FDPeripheral(kNue2020FDPeripheralFunc)
const Var kCVNe_looseptp
Definition: Vars.cxx:36
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 cmf::CAFToEventList::InitializeEventListColls ( )
private

Definition at line 382 of file CMFCAFToEventList_module.cc.

References fDetector, fFileType, cmf::FindEventList(), fMDToEvents, fPeriodRuns, fSelections, MECModelEnuComparisons::i, cmf::kCosmicBackgroundFile, cmf::kCosmicMuon, cmf::kDataFile, cmf::kNC, cmf::kNEARDET, cmf::kNuEBarCC, cmf::kNuECC, cmf::kNuESelectionPeripheral, cmf::kNuMuBarCC, cmf::kNuMuCC, cmf::kNuTauBarCC, cmf::kNuTauCC, cmf::kRockFluxSwap, cmf::kRockNonSwap, cmf::kUncategorised, cmf::kUnknownInteraction, fetch_tb_beamline_files::md, and ss.

Referenced by endJob().

383  {
384  // here we will create an event list for each possible meta data
385  // for the current epoch and data/MC type.
386 
387  // if we are looking at the ND, there are no cosmic or rock events
388  // there, so don't bother
389  if(fDetector == cmf::kNEARDET &&
392  fFileType == cmf::kRockNonSwap) ) return;
393 
395 
396  std::set<cmf::InteractionType_t> intTypes({cmf::kNuMuCC,
398  cmf::kNuECC,
402  cmf::kNC,
404 
405  // set the bits of the metadata that won't change
406  bool isMC = (fFileType != cmf::kDataFile);
407 
408  for(auto const& itr : fPeriodRuns){
409  // loop over the selection and interaction types to flesh out the lists
410  for(auto const& s : fSelections){
411 
412  // there are no nue peripheral events in the ND
413  if(fDetector == cmf::kNEARDET &&
414  s == cmf::kNuESelectionPeripheral) continue;
415 
416  if(fFileType == cmf::kDataFile){
417 
418  // data have an unknown interaction type
419  cmf::MetaData md(isMC,
420  fDetector,
421  fFileType,
422  s,
424  itr.fPeriod);
425 
426  // make a new EventList for the data
428  fMDToEvents.emplace_back(cmf::EventList(md, ss));
429  } // end if data
431 
432  cmf::MetaData md(true,
433  fDetector,
434  fFileType,
435  s,
437  itr.fPeriod);
438 
439  // make a new EventList for the cosmic background
441  fMDToEvents.emplace_back(cmf::EventList(md, ss));
442  } // end if cosmic background
443  else{
444  // loop over possible interaction types for the metadata
445  // don't use cosmic muons, those are special and are handled
446  // in another way - we don't want to inflate the POT for those lists
447  for(auto const& i : intTypes){
448 
449  cmf::MetaData md(isMC,
450  fDetector,
451  fFileType,
452  s,
453  i,
454  itr.fPeriod);
455 
456  // make a new EventList for the MC
458  fMDToEvents.emplace_back(cmf::EventList(md, ss));
459  } // end loop over interaction types
460  } // end if not data or MC, ie cosmic background
461 
462  } // end loop over selection types
463  } // end loop over epochs
464  }
Float_t ss
Definition: plot.C:24
cmf::EventListColl::iterator FindEventList(cmf::MetaData const &md, cmf::EventListColl &eventListColl)
Definition: Event.cxx:44
cmf::DetType_t fDetector
which detector are we using
std::vector< cmf::PeriodRun > fPeriodRuns
vector of periods to runs
cmf::FileType_t fFileType
get from the configuration for now
cmf::EventListColl fMDToEvents
each entry in the vector is for a single slice
const XML_Char * s
Definition: expat.h:262
std::set< cmf::SelectionType_t > fSelections
Selections to use.
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
CAFToEventList& cmf::CAFToEventList::operator= ( CAFToEventList const &  )
delete
CAFToEventList& cmf::CAFToEventList::operator= ( CAFToEventList &&  )
delete
bool cmf::CAFToEventList::PassesNCSelections ( caf::SRProxy const &  proxy) const
private

Definition at line 566 of file CMFCAFToEventList_module.cc.

References fDetector, cmf::kFARDET, cmf::kNEARDET, ana::kNus20FDCosRejCuts, ana::kNus20FDCuts_ML, ana::kNus20FDMinSliceDistCut, ana::kNus20FDSelectionCuts, ana::kNus20NDCuts, ana::kNus20NDFiducialCuts, ana::kNus20NDSelectionCuts, ana::kNus20QualityCuts, and LOG_DEBUG.

Referenced by FillDataVarVals(), FindSelectionType(), and PassesSelections().

567  {
568  if(fDetector == cmf::kFARDET){
569  if(!ana::kNus20FDCuts_ML(&proxy)){
570  LOG_DEBUG("CAFToEventList")
571  << "Fails nc FD selection, reasons:"
572  << "\n -- kNus20QualityCuts: " << ana::kNus20QualityCuts(&proxy)
573  << "\n -- kNus20FDMinSliceDistCut: " << ana::kNus20FDMinSliceDistCut(&proxy)
574  << "\n -- kNus20FDSelectionCuts: " << ana::kNus20FDSelectionCuts(&proxy)
575  << "\n -- kNus20FDCosRejCuts: " << ana::kNus20FDCosRejCuts(&proxy);
576  return false;
577  }
578  }
579  else if(fDetector == cmf::kNEARDET){
580  if(!ana::kNus20NDCuts(&proxy)){
581  LOG_DEBUG("CAFToEventList")
582  << "Fails nc ND selection, reasons:"
583  << "\n -- kNus20QualityCuts: " << ana::kNus20QualityCuts(&proxy)
584  << "\n -- kNus20NDFiducialCuts: " << ana::kNus20NDFiducialCuts(&proxy)
585  << "\n -- kNus20NDSelectionCuts: " << ana::kNus20NDSelectionCuts(&proxy);
586  return false;
587  }
588  }
589 
590  return true;
591  }
#define LOG_DEBUG(stream)
Definition: Messenger.h:149
const Cut kNus20FDSelectionCuts
Definition: NusCuts20.h:168
cmf::DetType_t fDetector
which detector are we using
const Cut kNus20QualityCuts
Definition: NusCuts20.h:41
const Cut kNus20NDCuts
Definition: NusCuts20.h:102
const Cut kNus20NDFiducialCuts
Definition: NusCuts20.h:88
const Cut kNus20FDCosRejCuts
Definition: NusCuts20.h:171
const Cut kNus20NDSelectionCuts
Definition: NusCuts20.h:99
const Cut kNus20FDCuts_ML
const Cut kNus20FDMinSliceDistCut
Definition: NusCuts20.h:153
bool cmf::CAFToEventList::PassesNueSelections ( caf::SRProxy const &  proxy) const
private

Definition at line 510 of file CMFCAFToEventList_module.cc.

References fDetector, cmf::kFARDET, cmf::kNEARDET, ana::kNue2020FDAllSamples_ML, ana::kNue2020ND, ana::kNue2020NDContain, ana::kNue2020NDPresel, ana::kNue2020PID, ana::kNue2020RecoQuality, and LOG_DEBUG.

Referenced by FillDataVarVals(), FindSelectionType(), and PassesSelections().

511  {
512  if(fDetector == cmf::kFARDET){
513  if(!ana::kNue2020FDAllSamples_ML(&proxy)){
514  LOG_DEBUG("CAFToEventList")
515  << "Fails nue FD main and peripheral cuts";
516  return false;
517  }
518  }
519  else if(fDetector == cmf::kNEARDET){
520  if(!ana::kNue2020ND(&proxy)){
521  LOG_DEBUG("CAFToEventList")
522  << "Fails nue ND cuts, reasons:"
523  << "\n -- kNue2020NDPresel: " << ana::kNue2020NDPresel(&proxy)
524  << "\n ---- kNue2020RecoQuality: " << ana::kNue2020RecoQuality(&proxy)
525  << "\n ---- kNue2020NDContain: " << ana::kNue2020NDContain(&proxy)
526  << "\n -- kNue2020PID: " << ana::kNue2020PID(&proxy);
527  return false;
528  }
529  }
530 
531  return true;
532  }
#define LOG_DEBUG(stream)
Definition: Messenger.h:149
const Cut kNue2020PID([](const caf::SRProxy *sr){if(kIsRHC(sr)) return kNue2020PIDRHC(sr);else return kNue2020PIDFHC(sr);})
Definition: NueCuts2020.h:61
const Cut kNue2020ND
Definition: NueCuts2020.h:178
cmf::DetType_t fDetector
which detector are we using
const Cut kNue2020NDContain([](const caf::SRProxy *sr){for(unsigned int ix=0;ix< sr->vtx.elastic.fuzzyk.nshwlid;++ix){const caf::SRVector3DProxy &start=sr->vtx.elastic.fuzzyk.png[ix].shwlid.start;const caf::SRVector3DProxy &stop=sr->vtx.elastic.fuzzyk.png[ix].shwlid.stop;if(std::min(start.X(), stop.X())< -150.0) return false;if(std::max(start.X(), stop.X()) > 170.0) return false;if(std::min(start.Y(), stop.Y())< -170.0) return false;if(std::max(start.Y(), stop.Y()) > 150.0) return false;if(std::min(start.Z(), stop.Z())< 100.0) return false;if(std::max(start.Z(), stop.Z()) > 1225.0) return false;}if(sr->sel.contain.nplanestofront< 10) return false;return true;})
Definition: NueCuts2020.h:167
const Cut kNue2020NDPresel
Definition: NueCuts2020.h:169
const Cut kNue2020RecoQuality([](const caf::SRProxy *sr){if(sr->sel.nuecosrej.hitsperplane >=8) return false;if(!sr->vtx.elastic.IsValid) return false;if(sr->vtx.elastic.fuzzyk.npng==0) return false;return true;})
Definition: NueCuts2020.h:16
const Cut kNue2020FDAllSamples_ML
bool cmf::CAFToEventList::PassesNumuSelections ( caf::SRProxy const &  proxy) const
private

Definition at line 535 of file CMFCAFToEventList_module.cc.

References fDetector, ana::kCCE, cmf::kFARDET, cmf::kNEARDET, ana::kNumu2020CosRej, ana::kNumu2020FD_ML, ana::kNumu2020ND, ana::kNumu2020PID, ana::kNumuContainFD2020, ana::kNumuContainND2020, ana::kNumuQuality, and LOG_DEBUG.

Referenced by FillDataVarVals(), FindSelectionType(), and PassesSelections().

536  {
537  // check that this event passes the quality cuts and PID selections
538  // for numu
539  if ((float)ana::kCCE(&proxy) >= 5) return false;
540  if(fDetector == cmf::kFARDET){
541  if(!(ana::kNumu2020FD_ML(&proxy))){
542  LOG_DEBUG("CAFToEventList")
543  << "failed numu FD cuts, reasons:"
544  << "\n -- kNumuQuality: " << ana::kNumuQuality(&proxy)
545  << "\n -- kNumuContainFD2020: " << ana::kNumuContainFD2020(&proxy)
546  << "\n -- kNumu2020PID: " << ana::kNumu2020PID(&proxy)
547  << "\n -- kNumu2020CosRej: " << ana::kNumu2020CosRej(&proxy);
548  return false;
549  }
550  }
551  else if(fDetector == cmf::kNEARDET){
552  if(!(ana::kNumu2020ND(&proxy))){
553  LOG_DEBUG("CAFToEventList")
554  << "failed numu ND cuts, reasons:"
555  << "\n -- kNumuQuality: " << ana::kNumuQuality(&proxy)
556  << "\n -- kNumuContainND2020: " << ana::kNumuContainND2020(&proxy)
557  << "\n -- kNumu2020PID: " << ana::kNumu2020PID(&proxy);
558  return false;
559  }
560  }
561 
562  return true;
563  }
#define LOG_DEBUG(stream)
Definition: Messenger.h:149
const Cut kNumu2020ND
Definition: NumuCuts2020.h:57
cmf::DetType_t fDetector
which detector are we using
const Cut kNumu2020PID([](const caf::SRProxy *sr){return(sr->sel.remid.pid > 0.30 && sr->sel.cvnloosepreselptp.numuid > 0.80);})
Definition: NumuCuts2020.h:21
const Cut kNumuContainFD2020
Definition: NumuCuts2020.h:42
const Var kCCE
Definition: NumuVars.h:21
const Cut kNumu2020CosRej([](const caf::SRProxy *sr){return(sr->sel.cosrej.numucontpid2020 > 0.45);})
Definition: NumuCuts2020.h:22
const Cut kNumuQuality
Definition: NumuCuts.h:18
const Cut kNumuContainND2020([](const caf::SRProxy *sr){if(!sr->vtx.elastic.IsValid) return false;for(unsigned int i=0;i< sr->vtx.elastic.fuzzyk.nshwlid;++i){const caf::SRVector3DProxy &start=sr->vtx.elastic.fuzzyk.png[i].shwlid.start;const caf::SRVector3DProxy &stop=sr->vtx.elastic.fuzzyk.png[i].shwlid.stop;if(std::min(start.X(), stop.X())< -180.0) return false;if(std::max(start.X(), stop.X()) > 180.0) return false;if(std::min(start.Y(), stop.Y())< -180.0) return false;if(std::max(start.Y(), stop.Y()) > 180.0) return false;if(std::min(start.Z(), stop.Z())< 40.0) return false;if(std::max(start.Z(), stop.Z()) > 1525.0) return false;}if(sr->trk.kalman.ntracks< 1) return false;for(unsigned int i=0;i< sr->trk.kalman.ntracks;++i){if(i==sr->trk.kalman.idxremid) continue;else if(sr->trk.kalman.tracks[i].start.Z() > 1275||sr->trk.kalman.tracks[i].stop.Z() > 1275) return false;}return(sr->trk.kalman.ntracks > sr->trk.kalman.idxremid &&sr->slc.firstplane > 1 &&sr->slc.lastplane< 212 &&sr->trk.kalman.tracks[0].start.Z()< 1100 &&(sr->trk.kalman.tracks[0].stop.Z()< 1275 ||sr->sel.contain.kalyposattrans< 55) &&sr->sel.contain.kalfwdcellnd > 5 &&sr->sel.contain.kalbakcellnd > 10);})
Definition: NumuCuts2020.h:31
const Cut kNumu2020FD_ML
bool cmf::CAFToEventList::PassesSelections ( caf::SRProxy const &  proxy) const
private

Definition at line 486 of file CMFCAFToEventList_module.cc.

References fSelections, cmf::kNCSelection, cmf::kNuESelectionLowPID, cmf::kNuMuSelectionQ1, PassesNCSelections(), PassesNueSelections(), PassesNumuSelections(), and PassesSpillAndBeamCuts().

Referenced by FillVariables().

487  {
488  if(!this->PassesSpillAndBeamCuts(proxy)) return false;
489 
490  // use a series of if statements rather than if/else if because
491  // we want to check each selection option for each event, not
492  // give up if we are looking for numu and nue and an event
493  // happens to not be which ever comes first
494  if(fSelections.find(cmf::kNuMuSelectionQ1) != fSelections.end()){
495  if(this->PassesNumuSelections(proxy)) return true;
496  }
497 
499  if(this->PassesNueSelections(proxy)) return true;
500  }
501 
502  if(fSelections.find(cmf::kNCSelection) != fSelections.end()){
503  if(this->PassesNCSelections(proxy)) return true;
504  }
505 
506  return false;
507  }
bool PassesNumuSelections(caf::SRProxy const &proxy) const
std::set< cmf::SelectionType_t > fSelections
Selections to use.
bool PassesNueSelections(caf::SRProxy const &proxy) const
bool PassesNCSelections(caf::SRProxy const &proxy) const
bool PassesSpillAndBeamCuts(caf::SRProxy const &proxy) const
bool cmf::CAFToEventList::PassesSpillAndBeamCuts ( caf::SRProxy const &  proxy) const
private

Definition at line 468 of file CMFCAFToEventList_module.cc.

References fFileType, cmf::kCosmicBackgroundFile, ana::kInBeamSpill, ana::kInCosmicTimingWindow, ana::kIsFarDet, ana::kStandardSpillCuts, ana::kStandardSpillCuts_FD_Prod4MotivatedDQ, and caf::Proxy< caf::StandardRecord >::spill.

Referenced by PassesSelections().

469  {
470  // only apply kInBeamSpill to far detector since spill.cosmicvn doesn't
471  // exist for ND cafs
472  if (ana::kIsFarDet(&proxy)){
474  return ana::kInCosmicTimingWindow(&proxy) &&
476  else
477  return ana::kInBeamSpill(&proxy) &&
479  }
480  else {
481  return ana::kStandardSpillCuts(&proxy.spill);
482  }
483  }
const SpillCut kStandardSpillCuts_FD_Prod4MotivatedDQ
Definition: SpillCuts.h:69
const Cut kIsFarDet([](const caf::SRProxy *sr){return sr->hdr.det==caf::kFARDET;})
Definition: Cuts.h:94
cmf::FileType_t fFileType
get from the configuration for now
const Cut kInCosmicTimingWindow
Is the event far from the start and ends of the spill ? For FD cosmic selection.
Definition: TimingCuts.cxx:165
const Cut kInBeamSpill([](const caf::SRProxy *sr){if(sr->spill.run > util::kLastBadTimingRun) return kInBeamSpill_main(sr);else return kInBeamSpill_main(sr)||kInBeamSpill_shifted(sr);}, [](const caf::SRSpillProxy *spill){if(spill->run > util::kLastBadTimingRun) return kInBeamSpill_main.Livetime(spill);else return kInBeamSpill_main.Livetime(spill)+kInBeamSpill_shifted.Livetime(spill);}, [](const caf::SRSpillProxy *spill) -> double{return spill->spillpot;})
Does the event fall inside the window we call the beam spill?
Definition: TimingCuts.h:8
const SpillCut kStandardSpillCuts
Apply this unless you&#39;re doing something special.
Definition: SpillCuts.h:49
void art::Consumer::prepareForJob ( fhicl::ParameterSet const &  pset)
protectedinherited
std::string const& art::EventObserverBase::processName ( ) const
inlineinherited
void cmf::CAFToEventList::reconfigure ( fhicl::ParameterSet const &  p)

Definition at line 252 of file CMFCAFToEventList_module.cc.

References DefineNumuQuantiles(), mkDefs::detName, fCAFFileNames, fCAFRecTreeName, fDetector, fFHCQuantFileName, fFileType, fIsFHC, fIsRealData, fMakeSelectedList, fNumQuantiles, fPeriodRuns, fPOTHistName, fRHCQuantFileName, fSelections, fSpillTreeName, fSystType, fhicl::ParameterSet::get(), cmf::ParameterUtility::Initialize(), cmf::ParameterUtility::Instance(), cmf::kBeam, cmf::kCosmicBackgroundFile, cmf::kDataFile, cmf::kFARDET, cmf::kNCSelection, cmf::kNEARDET, cmf::kNuESelectionHighPID, cmf::kNuESelectionLowPID, cmf::kNuESelectionPeripheral, cmf::kNuMuSelectionQ1, cmf::kNuMuSelectionQ2, cmf::kNuMuSelectionQ3, cmf::kNuMuSelectionQ4, cmf::kRockFluxSwap, cmf::kRockNonSwap, cmf::kSwap, cmf::kTauSwap, string, and cmf::StringToDetectorType().

Referenced by CAFToEventList().

253  {
254  fCAFFileNames = p.get<std::vector<std::string> >("CAFFileNames" );
255 
256  // assume we don't mix FHC and RHC files in the same job, and the
257  // fIsFHC should only be used for cosmics
258  if(fCAFFileNames.begin()->find("rhc") != std::string::npos)
259  fIsFHC = false;
260 
261  fCAFRecTreeName = p.get<std::string >("CAFRecTreeName" , "recTree" );
262  fSpillTreeName = p.get<std::string >("SpillTreeName" , "spillTree" );
263  fPOTHistName = p.get<std::string >("CAFPOTHistName" , "TotalPOT" );
264  fNumQuantiles = p.get<unsigned int>("NumQuantiles" , 4 );
265  fMakeSelectedList = p.get<bool >("MakeSelectedList" , false );
266  fFHCQuantFileName = p.get<std::string >("FHCQuantFileName" );
267  fRHCQuantFileName = p.get<std::string >("RHCQuantFileName" );
268  fSystType = p.get<std::string >("SystematicType" , "NOSYST" );
269 
270  auto detName = p.get<std::string>("DetectorName", "Near");
271  fDetector = (detName == "Near") ? cmf::kNEARDET : cmf::kFARDET;
272 
273  auto selType = p.get<std::string>("Selections");
274 
275  if(selType == "NuESel"){
279  }
280  else if(selType == "NuMuSel"){
285 
286  this->DefineNumuQuantiles();
287  }
288  else if(selType == "NCSel"){
290  }
291 
292  auto ftString = p.get<std::string>("FileType");
293 
294  if (ftString == "FluxSwap") fFileType = kSwap;
295  else if(ftString == "NonSwap" ) fFileType = kBeam;
296  else if(ftString == "TauSwap" ) fFileType = kTauSwap;
297  else if(ftString == "CosmicBackground") fFileType = kCosmicBackgroundFile;
298  else if(ftString == "RockFluxSwap" ) fFileType = kRockFluxSwap;
299  else if(ftString == "RockNonSwap" ) fFileType = kRockNonSwap;
300  else{
302  fIsRealData = true;
303  } // end tests on ftString
304 
305  // load up the epochs to use
306  auto periodPOTPars = p.get< std::vector<fhicl::ParameterSet> >("PeriodsToUse");
307 
308  for(auto const& itr : periodPOTPars){
309  if(cmf::StringToDetectorType(itr.get<std::string>("Detector")) != fDetector) continue;
310  fPeriodRuns.emplace_back(itr.get<int>("Period"),
311  itr.get<int>("StartRun"),
312  itr.get<int>("EndRun"));
313  }
314 
315  cmf::ParameterUtility::Instance()->Initialize(p.get< fhicl::ParameterSet >("ParametersToUse"));
316 
317  }
std::string fSpillTreeName
names of the Spill tree in the file
std::string fFHCQuantFileName
name of file in numudata ups product with FHC quantiles
std::string fPOTHistName
names of the CAF histogram with the total POT
bool fIsRealData
are we looking at real data?
bool fMakeSelectedList
configure to true to make a list
void Initialize(fhicl::ParameterSet const &pset)
const char * p
Definition: xmltok.h:285
std::string fCAFRecTreeName
names of the CAF tree with the reco info
cmf::DetType_t fDetector
which detector are we using
std::vector< cmf::PeriodRun > fPeriodRuns
vector of periods to runs
cmf::FileType_t fFileType
get from the configuration for now
static ParameterUtility * Instance()
std::string fSystType
systematic type
std::set< cmf::SelectionType_t > fSelections
Selections to use.
std::vector< std::string > fCAFFileNames
name of the CAF file we are using
static cmf::DetType_t StringToDetectorType(std::string const &str)
Definition: StaticFuncs.h:275
bool fIsFHC
are we looking at FHC files?
std::string fRHCQuantFileName
name of file in numudata ups product with FHC quantiles
unsigned int fNumQuantiles
number of quantiles
detName
Definition: mkDefs.py:106
enum BeamMode string
void art::EventObserverBase::registerProducts ( MasterProductRegistry ,
ProductDescriptions ,
ModuleDescription const &   
)
inlineinherited

Definition at line 33 of file EventObserverBase.h.

References string.

36  {}
int cmf::CAFToEventList::RunToPeriod ( int  run)
private

Definition at line 367 of file CMFCAFToEventList_module.cc.

References fPeriodRuns, and updateRunHistoryTables::run.

Referenced by endJob(), and FindPOTPerPeriod().

368  {
369  for(auto const& itr : fPeriodRuns){
370  if(itr.RunInPeriod(run)) return itr.fPeriod;
371  }
372 
373  // no period found for this run and detector, got a problem
374  throw cet::exception("RunToPeriod")
375  << "no period found for run "
376  << run;
377 
378  return 0;
379  }
::xsd::cxx::tree::exception< char > exception
Definition: Database.h:225
std::vector< cmf::PeriodRun > fPeriodRuns
vector of periods to runs
Definition: run.py:1
fhicl::ParameterSetID art::EventObserverBase::selectorConfig ( ) const
inlineinherited

Definition at line 56 of file EventObserverBase.h.

References art::EventObserverBase::selector_config_id_.

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

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

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

Definition at line 46 of file EventObserverBase.h.

References art::EventObserverBase::wantAllEvents_.

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

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

Definition at line 51 of file EventObserverBase.h.

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

52  {
53  return selectors_.wantEvent(e);
54  }
detail::CachedProducts selectors_
Float_t e
Definition: plot.C:35
bool wantEvent(Event const &)
std::string art::EDAnalyzer::workerType ( ) const
inlineinherited

Definition at line 109 of file EDAnalyzer.h.

References art::EDAnalyzer::currentContext().

110  {
111  return "WorkerT<EDAnalyzer>";
112  }

Member Data Documentation

std::vector<std::string> cmf::CAFToEventList::fCAFFileNames
private

name of the CAF file we are using

Definition at line 181 of file CMFCAFToEventList_module.cc.

Referenced by FillVariables(), and reconfigure().

std::string cmf::CAFToEventList::fCAFRecTreeName
private

names of the CAF tree with the reco info

Definition at line 186 of file CMFCAFToEventList_module.cc.

Referenced by FillVariables(), and reconfigure().

cmf::DetType_t cmf::CAFToEventList::fDetector
private
std::string cmf::CAFToEventList::fFHCQuantFileName
private

name of file in numudata ups product with FHC quantiles

Definition at line 182 of file CMFCAFToEventList_module.cc.

Referenced by DefineNumuQuantiles(), and reconfigure().

cmf::FileType_t cmf::CAFToEventList::fFileType
private

get from the configuration for now

Definition at line 189 of file CMFCAFToEventList_module.cc.

Referenced by endJob(), InitializeEventListColls(), PassesSpillAndBeamCuts(), and reconfigure().

bool cmf::CAFToEventList::fIsFHC
private

are we looking at FHC files?

Definition at line 192 of file CMFCAFToEventList_module.cc.

Referenced by reconfigure().

bool cmf::CAFToEventList::fIsRealData
private

are we looking at real data?

Definition at line 191 of file CMFCAFToEventList_module.cc.

Referenced by endJob(), and reconfigure().

bool cmf::CAFToEventList::fMakeSelectedList
private

configure to true to make a list

Definition at line 199 of file CMFCAFToEventList_module.cc.

Referenced by endJob(), and reconfigure().

cmf::EventListColl cmf::CAFToEventList::fMDToEvents
private

each entry in the vector is for a single slice

Definition at line 188 of file CMFCAFToEventList_module.cc.

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

unsigned int cmf::CAFToEventList::fNumQuantiles
private

number of quantiles

Definition at line 195 of file CMFCAFToEventList_module.cc.

Referenced by DefineNumuQuantiles(), and reconfigure().

std::vector<ana::Cut> cmf::CAFToEventList::fNumuFHCQuantCuts
private

quantile boundaries for the numu FHC data

Definition at line 193 of file CMFCAFToEventList_module.cc.

Referenced by clear(), DefineNumuQuantiles(), and FindSelectionType().

std::vector<ana::Cut> cmf::CAFToEventList::fNumuRHCQuantCuts
private

quantile boundaries for the numu RHC data

Definition at line 194 of file CMFCAFToEventList_module.cc.

Referenced by clear(), DefineNumuQuantiles(), and FindSelectionType().

std::vector<cmf::PeriodRun> cmf::CAFToEventList::fPeriodRuns
private

vector of periods to runs

Definition at line 200 of file CMFCAFToEventList_module.cc.

Referenced by InitializeEventListColls(), reconfigure(), and RunToPeriod().

std::map<int, POTLiveTime> cmf::CAFToEventList::fPeriodToPOTLiveTime
private

keep track of the POT in each period

Definition at line 197 of file CMFCAFToEventList_module.cc.

Referenced by CAFToEventList(), endJob(), and FindPOTPerPeriod().

std::string cmf::CAFToEventList::fPOTHistName
private

names of the CAF histogram with the total POT

Definition at line 185 of file CMFCAFToEventList_module.cc.

Referenced by FindPOTPerPeriod(), and reconfigure().

std::string cmf::CAFToEventList::fRHCQuantFileName
private

name of file in numudata ups product with FHC quantiles

Definition at line 183 of file CMFCAFToEventList_module.cc.

Referenced by DefineNumuQuantiles(), and reconfigure().

std::set<cmf::SelectionType_t> cmf::CAFToEventList::fSelections
private

Selections to use.

Definition at line 198 of file CMFCAFToEventList_module.cc.

Referenced by clear(), InitializeEventListColls(), PassesSelections(), and reconfigure().

std::string cmf::CAFToEventList::fSpillTreeName
private

names of the Spill tree in the file

Definition at line 184 of file CMFCAFToEventList_module.cc.

Referenced by FindPOTPerPeriod(), and reconfigure().

std::string cmf::CAFToEventList::fSystType
private

systematic type

Definition at line 190 of file CMFCAFToEventList_module.cc.

Referenced by FillMCVals(), and reconfigure().


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