NuInputEvents Class Reference

#include <NuInputEvents.h>

List of all members.

Public Member Functions

 NuInputEvents ()
 ~NuInputEvents ()
Int_t GetEntriesNuEvent () const
Int_t GetEntriesNuMCEvent () const
Bool_t ObjectExistsInFile (TFile *file, std::string objectName) const
void PrintNewFileName () const
void PrintNewMCFileName () const
void AddNuEventToCache (const NuEvent &nu)
void AddNuMCEventToCache (const NuMCEvent &nu)
Int_t GetFirstRunNumberNuEvent ()
Int_t GetFirstRunNumberNuMCEvent ()
const NuEventGetNextNuEvent (Msg::LogLevel_t logLevel)
const NuMCEventGetNextNuMCEvent (Msg::LogLevel_t logLevel)
void InitialiseChains ()
void InitialiseNuEventBranch ()
void InitialiseNuMCEventBranch ()
void InitialiseNuEventCache ()
void InitialiseNuMCEventCache ()
TDirectory * OpenInputFile ()
TDirectory * OpenNextInputFile ()
void ResetNuEventLoopPositionToStart ()
void ResetNuMCEventLoopPositionToStart ()
void UseNuEventCache (Bool_t useCache=true)
void UseNuMCEventCache (Bool_t useCache=true)

Static Public Member Functions

static void InputFileName (std::string f)

Private Member Functions

Int_t GetTreeEntriesNuEvent () const
Int_t GetTreeEntriesNuMCEvent () const
Int_t GetCacheEntriesNuEvent () const
Int_t GetCacheEntriesNuMCEvent () const
std::vector< std::string > GetListOfFilesInDir (std::string wildcardString) const
std::vector< std::string > MakeFileList ()
const NuEventGetNextCachedNuEvent (Msg::LogLevel_t logLevel)
const NuMCEventGetNextCachedNuMCEvent (Msg::LogLevel_t logLevel)
const NuEventGetNextTreeNuEvent (Msg::LogLevel_t logLevel)
const NuMCEventGetNextTreeNuMCEvent (Msg::LogLevel_t logLevel)
void MakeChain ()
void ResetNuEventCachePositionToStart ()
void ResetNuMCEventCachePositionToStart ()
void ResetNuEventTreePositionToStart ()
void ResetNuMCEventTreePositionToStart ()
void SetLoopVariablesNuEvent (Int_t entry, Int_t printMode=1)
void SetLoopVariablesNuMCEvent (Int_t entry, Int_t printMode=1)

Private Attributes

Bool_t fUseCachedNuEvents
Bool_t fUseCachedNuMCEvents
std::vector< NuEvent * > * fpvNuEvents
std::vector< NuMCEvent * > * fpvNuMCEvents
std::vector< NuEvent * >::iterator fNuEventsIter
std::vector< NuMCEvent * >
::iterator 
fNuMCEventsIter
TDirectory * fInputFileDir
Int_t fEntriesNuEvent
Int_t fEntryNuEvent
Int_t fFirstRunNumberNuEvent
Int_t fEntriesNuMCEvent
Int_t fEntryNuMCEvent
Int_t fFirstRunNumberNuMCEvent
TChain * fChainNuEvent
TChain * fChainNuMCEvent
NuEventfNuEvent
NuMCEventfNuMCEvent

Static Private Attributes

static std::string fInputFileName = ""

Detailed Description

Definition at line 19 of file NuInputEvents.h.


Constructor & Destructor Documentation

NuInputEvents::NuInputEvents (  ) 

Definition at line 36 of file NuInputEvents.cxx.

References fChainNuEvent, fChainNuMCEvent, fEntriesNuEvent, fEntriesNuMCEvent, fFirstRunNumberNuEvent, fFirstRunNumberNuMCEvent, fInputFileDir, fNuEvent, fNuMCEvent, fpvNuEvents, fpvNuMCEvents, fUseCachedNuEvents, fUseCachedNuMCEvents, Msg::kDebug, MSG, ResetNuEventTreePositionToStart(), and ResetNuMCEventTreePositionToStart().

00037 {
00038   MSG("NuInputEvents",Msg::kDebug)
00039     <<"Running NuInputEvents Constructor..."<<endl;
00040   
00041   //initialise data members
00042   fUseCachedNuEvents=false;//use tree as std
00043   fUseCachedNuMCEvents=false;//use tree as std
00044   fpvNuEvents=0;
00045   fpvNuMCEvents=0;
00046   //fNuEventsIter;//what to do with this?
00047   //fNuMCEventsIter;//what to do with this?
00048   fInputFileDir=0;
00049   fEntriesNuEvent=0;
00050   fFirstRunNumberNuEvent=999;
00051   this->ResetNuEventTreePositionToStart();//sets fEntry=-1;
00052   fEntriesNuMCEvent=0;
00053   fFirstRunNumberNuMCEvent=999;
00054   this->ResetNuMCEventTreePositionToStart();//sets fEntry=-1;
00055   fNuEvent=0;
00056   fNuMCEvent=0;
00057   fChainNuEvent=0;
00058   fChainNuMCEvent=0;
00059 
00060   MSG("NuInputEvents",Msg::kDebug)
00061     <<"Finished NuInputEvents Constructor"<<endl;
00062 }

NuInputEvents::~NuInputEvents (  ) 

Definition at line 66 of file NuInputEvents.cxx.

References fChainNuEvent, fChainNuMCEvent, Msg::kDebug, and MSG.

00067 {
00068   MSG("NuInputEvents",Msg::kDebug)
00069     <<"Running NuInputEvents Destructor..."<<endl;
00070   
00071   //clean up memory
00072   if (fChainNuEvent) {
00073     delete fChainNuEvent;
00074     fChainNuEvent=0;
00075   }
00076   //clean up memory
00077   if (fChainNuMCEvent) {
00078     delete fChainNuMCEvent;
00079     fChainNuMCEvent=0;
00080   }
00081   //fNuEvent is only ever used as a pointer and doesn't own any memory
00082 
00083   MSG("NuInputEvents",Msg::kDebug)
00084     <<"Finished NuInputEvents Destructor"<<endl;
00085 }


Member Function Documentation

void NuInputEvents::AddNuEventToCache ( const NuEvent nu  ) 

Definition at line 553 of file NuInputEvents.cxx.

References fpvNuEvents.

00554 {
00555   //create a new NuEvent on the heap
00556   NuEvent* nuClone=new NuEvent();
00557 
00558   //clone the NuEvent
00559   *nuClone=nu;
00560 
00561   //add the nuClone to the cache
00562   if (fpvNuEvents) {
00563     fpvNuEvents->push_back(nuClone);
00564   }
00565   else cout<<"Ahhhh, fpvNuEvents==0, can't AddNuEventToCache"<<endl;
00566 }

void NuInputEvents::AddNuMCEventToCache ( const NuMCEvent nu  ) 

Definition at line 570 of file NuInputEvents.cxx.

References fpvNuMCEvents.

00571 {
00572   //create a new NuMCEvent on the heap
00573   NuMCEvent* nuClone=new NuMCEvent();
00574 
00575   //clone the NuMCEvent
00576   *nuClone=nu;
00577 
00578   //add the nuClone to the cache
00579   if (fpvNuMCEvents) {
00580     fpvNuMCEvents->push_back(nuClone);
00581   }
00582   else cout<<"Ahhhh, fpvNuMCEvents==0, can't AddNuMCEventToCache"<<endl;
00583 }

Int_t NuInputEvents::GetCacheEntriesNuEvent (  )  const [private]

Definition at line 378 of file NuInputEvents.cxx.

References fpvNuEvents, Msg::kError, and MSG.

Referenced by GetEntriesNuEvent().

00379 {
00380   if (fpvNuEvents) {
00381     return fpvNuEvents->size();
00382   }
00383   else {
00384     MSG("NuInputEvents",Msg::kError) 
00385       <<"Can't get NuEvent cache entries before cache is created"<<endl
00386       <<"Will exit here..."<<endl;
00387     assert(false);
00388     return -1;//keep the compiler quiet
00389   }
00390 }

Int_t NuInputEvents::GetCacheEntriesNuMCEvent (  )  const [private]

Definition at line 394 of file NuInputEvents.cxx.

References fpvNuMCEvents, Msg::kError, and MSG.

Referenced by GetEntriesNuMCEvent().

00395 {
00396   if (fpvNuMCEvents) {
00397     return fpvNuMCEvents->size();
00398   }
00399   else {
00400     MSG("NuInputEvents",Msg::kError) 
00401       <<"Can't get NuMCEvent cache entries before cache is created"
00402       <<endl
00403       <<"Will exit here..."<<endl;
00404     assert(false);
00405     return -1;//keep the compiler quiet
00406   }
00407 }

Int_t NuInputEvents::GetEntriesNuEvent (  )  const

Definition at line 317 of file NuInputEvents.cxx.

References fUseCachedNuEvents, GetCacheEntriesNuEvent(), and GetTreeEntriesNuEvent().

Referenced by NuDSTAna::BRevAna(), NuDSTAna::CoilHoleAna(), NuDSTAna::ConcatenateDSTs(), NuDSTAna::Contamination(), NuDSTAna::ContaminationNQ(), NuDSTAna::CSSAna(), NuDSTAna::CSSAnaRashid(), NuDSTAna::DPSystematic(), NuDSTAna::FDTestAna(), NuFCExperimentFactoryNSI::FillFromDST(), NuFCExperimentFactory::FillFromDST(), NuDSTAna::FluxComponents(), NuDSTAna::JeffsTestAna(), NuDSTAna::MakeCuts(), DataMCPlots::MakeDataPlots(), FoverNHistos::MakeDataPlots(), ToFPlotter::MakeDataPlots(), NuDSTAna::MakeDstPQ(), NuDSTAna::MakeFCTree(), NuDSTAna::MakekNNTrainTestSet(), NuDSTAna::MakeMicroDST(), NuDSTAna::MakeMicroDst2010(), NuDSTAna::MakeMicroDst2014(), NuDSTAna::MakeMicroDstFakeData(), NuDSTAna::MakeMicroDstForCSSSystematics(), NuDSTAna::MakeMicroDstHe(), NuDSTAna::MakeMicroDstJJEPresel(), NuDSTAna::MakeMicroDstNC2012(), NuDSTAna::MakeMicroDstWithStdCCRecoAndCuts(), DataStabilityAnalysisClass::MakePlots(), TemplateAnalysisClass::MakePlots(), NuDSTAna::MakePurityEfficiencyPlotsCCNC(), NuDSTAna::MakeResolutionBins(), NuDSTAna::MakeRoIDTrainingSet(), NuDSTAna::MakeSelMicroDST(), NuDSTAna::MakeShwEnkNNTestingSet(), NuDSTAna::MakeShwEnkNNTrainingSet(), FitTree::MakeVectors(), NuDSTAna::MMRereco(), NuDSTAna::MMTransition(), NuDSTAna::MMTransSME(), NuDSTAna::NDOsc(), NuDSTAna::NDQPRB(), NuDSTAna::NDTestAna(), NuDSTAna::NewFieldAna(), NuDSTAna::NMBAna(), NuAnalysis::NMBSummaryTreeAna(), NuDSTAna::QPStudy(), NuDSTAna::RHCTest(), NuDSTAna::SelectorTable(), NuDSTAna::StdCCAna(), NuDSTAna::StdNMBAna(), NuDSTAna::TestNuSyst(), NuDSTAna::VsTime(), and NuDSTAna::YStudy().

00318 {
00319   if (fUseCachedNuEvents) {
00320     return this->GetCacheEntriesNuEvent();
00321   }
00322   else {
00323     return this->GetTreeEntriesNuEvent();
00324   }
00325 }

Int_t NuInputEvents::GetEntriesNuMCEvent (  )  const
Int_t NuInputEvents::GetFirstRunNumberNuEvent (  )  [inline]
Int_t NuInputEvents::GetFirstRunNumberNuMCEvent (  )  [inline]

Definition at line 38 of file NuInputEvents.h.

References fFirstRunNumberNuMCEvent.

00038 {return fFirstRunNumberNuMCEvent;};

std::vector< std::string > NuInputEvents::GetListOfFilesInDir ( std::string  wildcardString  )  const [private]

Definition at line 831 of file NuInputEvents.cxx.

References Munits::g.

Referenced by MakeFileList(), OpenInputFile(), and OpenNextInputFile().

00832 {
00833   std::vector<std::string> fileList;
00834   
00835   glob_t g;
00836   glob(wildcardString.c_str(),
00837        // GLOB_NOCHECK | // If no match return pattern
00838        GLOB_TILDE, // Expand ~'s
00839        0, &g);
00840   for(unsigned int i = 0; i < g.gl_pathc; ++i)
00841     fileList.push_back(g.gl_pathv[i]);
00842   globfree(&g);
00843 
00844   // glob output is sorted by default
00845 
00846   return fileList;
00847 }

const NuEvent & NuInputEvents::GetNextCachedNuEvent ( Msg::LogLevel_t  logLevel  )  [private]

There are no safety checks here at present!

Definition at line 587 of file NuInputEvents.cxx.

References fNuEventsIter.

Referenced by GetNextNuEvent().

00589 {
00591 
00592   //increment the iterator to the next nuEvent
00593   ++fNuEventsIter;
00594 
00595   //return the NuEvent
00596   return *(*fNuEventsIter);
00597 }

const NuMCEvent & NuInputEvents::GetNextCachedNuMCEvent ( Msg::LogLevel_t  logLevel  )  [private]

There are no safety checks here at present!

Definition at line 601 of file NuInputEvents.cxx.

References fNuMCEventsIter.

Referenced by GetNextNuMCEvent().

00603 {
00605 
00606   //increment the iterator to the next nuEvent
00607   ++fNuMCEventsIter;
00608 
00609   //return the NuMCEvent
00610   return *(*fNuMCEventsIter);
00611 }

const NuEvent & NuInputEvents::GetNextNuEvent ( Msg::LogLevel_t  logLevel  ) 

Definition at line 697 of file NuInputEvents.cxx.

References fUseCachedNuEvents, GetNextCachedNuEvent(), and GetNextTreeNuEvent().

Referenced by NuDSTAna::BRevAna(), NuDSTAna::CoilHoleAna(), NuDSTAna::ConcatenateDSTs(), NuDSTAna::Contamination(), NuDSTAna::ContaminationNQ(), NuDSTAna::CSSAna(), NuDSTAna::CSSAnaRashid(), NuDSTAna::DoIO(), NuDSTAna::DPSystematic(), NuDSTAna::FDTestAna(), NuFCExperimentFactoryNSI::FillFromDST(), NuFCExperimentFactory::FillFromDST(), NuDSTAna::FluxComponents(), NuDSTAna::JeffsTestAna(), NuDSTAna::MakeCuts(), DataMCPlots::MakeDataPlots(), FoverNHistos::MakeDataPlots(), ToFPlotter::MakeDataPlots(), NuDSTAna::MakeDstPQ(), NuDSTAna::MakeFCTree(), NuDSTAna::MakekNNTrainTestSet(), NuDSTAna::MakeMicroDST(), NuDSTAna::MakeMicroDst2010(), NuDSTAna::MakeMicroDst2014(), NuDSTAna::MakeMicroDstFakeData(), NuDSTAna::MakeMicroDstForCSSSystematics(), NuDSTAna::MakeMicroDstHe(), NuDSTAna::MakeMicroDstJJEPresel(), NuDSTAna::MakeMicroDstNC2012(), NuDSTAna::MakeMicroDstWithStdCCRecoAndCuts(), DataStabilityAnalysisClass::MakePlots(), TemplateAnalysisClass::MakePlots(), NuDSTAna::MakePurityEfficiencyPlotsCCNC(), NuDSTAna::MakeResolutionBins(), NuDSTAna::MakeRoIDTrainingSet(), NuDSTAna::MakeSelMicroDST(), NuDSTAna::MakeShwEnkNNTestingSet(), NuDSTAna::MakeShwEnkNNTrainingSet(), FitTree::MakeVectors(), NuDSTAna::MMRereco(), NuDSTAna::MMTransition(), NuDSTAna::MMTransSME(), NuDSTAna::NDOsc(), NuDSTAna::NDQPRB(), NuDSTAna::NDTestAna(), NuDSTAna::NewFieldAna(), NuDSTAna::NMBAna(), NuAnalysis::NMBSummaryTreeAna(), NuDSTAna::QPStudy(), NuDSTAna::RHCTest(), NuDSTAna::SelectorTable(), NuDSTAna::StdCCAna(), NuDSTAna::StdNMBAna(), NuDSTAna::TestNuSyst(), NuDSTAna::VsTime(), and NuDSTAna::YStudy().

00698 {
00699   const NuEvent* pnu=0;
00700   
00701   if (fUseCachedNuEvents) {
00702     pnu=&this->GetNextCachedNuEvent(logLevel);
00703   }
00704   else {
00705     pnu=&this->GetNextTreeNuEvent(logLevel);
00706   }
00707 
00708   return *pnu;
00709 }

const NuMCEvent & NuInputEvents::GetNextNuMCEvent ( Msg::LogLevel_t  logLevel  ) 
const NuEvent & NuInputEvents::GetNextTreeNuEvent ( Msg::LogLevel_t  logLevel  )  [private]

Definition at line 615 of file NuInputEvents.cxx.

References fChainNuEvent, fEntriesNuEvent, fEntryNuEvent, fNuEvent, Msg::kError, Msg::kInfo, and MSG.

Referenced by GetNextNuEvent().

00617 {
00618 
00619   if (fEntryNuEvent==-1) {
00620     MSG("NuInputEvents",Msg::kInfo) 
00621       <<"Running NuInputEvents::GetNextNuEvent for first entry..."
00622       <<endl;
00623   }
00624   else if (fEntryNuEvent>=fEntriesNuEvent) {
00625     MSG("NuInputEvents",Msg::kError) 
00626       <<"Asked for entry="<<fEntryNuEvent
00627       <<" beyond end of tree. Total tree entries="
00628       <<fEntriesNuEvent<<endl
00629       <<"Will exit here..."<<endl;
00630     assert(false);
00631   }
00632   
00633   //increment the entry to get
00634   ++fEntryNuEvent;
00635   
00636   if (logLevel>=Msg::kInfo){
00637     Float_t fract=ceil(fEntriesNuEvent/20.);  
00638     if (ceil(((Float_t)fEntryNuEvent)/fract)==
00639         ((Float_t)fEntryNuEvent)/fract){
00640       MSG("NuInputEvents",Msg::kInfo) 
00641         <<"Fraction of loop complete: "<<fEntryNuEvent 
00642         <<"/"<<fEntriesNuEvent<<"  ("
00643         <<(Int_t)(100.*fEntryNuEvent/fEntriesNuEvent)<<"%)"<<endl;
00644     }
00645   }
00646 
00647   //get the snarl/entry
00648   fChainNuEvent->GetEntry(fEntryNuEvent); 
00649 
00650   //return the next NuEvent
00651   return *fNuEvent;
00652 }

const NuMCEvent & NuInputEvents::GetNextTreeNuMCEvent ( Msg::LogLevel_t  logLevel  )  [private]

Definition at line 656 of file NuInputEvents.cxx.

References fChainNuMCEvent, fEntriesNuMCEvent, fEntryNuMCEvent, fNuMCEvent, Msg::kError, Msg::kInfo, and MSG.

Referenced by GetNextNuMCEvent().

00658 {
00659 
00660   if (fEntryNuMCEvent==-1) {
00661     MSG("NuInputEvents",Msg::kInfo) 
00662       <<"Running NuInputEvents::GetNextNuMCEvent for first entry..."
00663       <<endl;
00664   }
00665   else if (fEntryNuMCEvent>=fEntriesNuMCEvent) {
00666     MSG("NuInputEvents",Msg::kError) 
00667       <<"Asked for entry="<<fEntryNuMCEvent
00668       <<" beyond end of tree. Total tree entries="
00669       <<fEntriesNuMCEvent<<endl
00670       <<"Will exit here..."<<endl;
00671     assert(false);
00672   }
00673   
00674   //increment the entry to get
00675   ++fEntryNuMCEvent;
00676   
00677   if (logLevel>=Msg::kInfo){
00678     Float_t fract=ceil(fEntriesNuMCEvent/20.);  
00679     if (ceil(((Float_t)fEntryNuMCEvent)/fract)==
00680         ((Float_t)fEntryNuMCEvent)/fract){
00681       MSG("NuInputEvents",Msg::kInfo) 
00682         <<"Fraction of loop complete: "<<fEntryNuMCEvent 
00683         <<"/"<<fEntriesNuMCEvent<<"  ("
00684         <<(Int_t)(100.*fEntryNuMCEvent/fEntriesNuMCEvent)<<"%)"<<endl;
00685     }
00686   }
00687 
00688   //get the snarl/entry
00689   fChainNuMCEvent->GetEntry(fEntryNuMCEvent); 
00690 
00691   //return the next NuMCEvent
00692   return *fNuMCEvent;
00693 }

Int_t NuInputEvents::GetTreeEntriesNuEvent (  )  const [private]

Definition at line 341 of file NuInputEvents.cxx.

References fChainNuEvent, fEntriesNuEvent, Msg::kError, and MSG.

Referenced by GetEntriesNuEvent().

00342 {
00343   if (fChainNuEvent) {
00344     return fEntriesNuEvent;
00345   }
00346   else {
00347     MSG("NuInputEvents",Msg::kError) 
00348       <<"Can't get NuEvent tree entries before chain is created"<<endl
00349       <<"Will exit here..."<<endl;
00350     assert(false);
00351     return -1;//keep the compiler quiet
00352   }
00353 }

Int_t NuInputEvents::GetTreeEntriesNuMCEvent (  )  const [private]

Definition at line 357 of file NuInputEvents.cxx.

References fChainNuMCEvent, fEntriesNuMCEvent, Msg::kWarning, and MSG.

Referenced by GetEntriesNuMCEvent().

00358 {
00359   if (fChainNuMCEvent) {
00360     return fEntriesNuMCEvent;
00361   }
00362   else {
00363     //MSG("NuInputEvents",Msg::kError) 
00364     //<<"Can't get NuMCEvent tree entries before chain is created"<<endl
00365     //<<"Will exit here..."<<endl;
00366     //assert(false);
00367     //return -1;//keep the compiler quiet
00368     
00369     MSG("NuInputEvents",Msg::kWarning) 
00370       <<"Can't get NuMCEvent tree entries when chain doesn't exist."
00371       <<" Returning ZERO entries"<<endl;
00372     return 0;
00373   }
00374 }

void NuInputEvents::InitialiseChains (  ) 

Definition at line 89 of file NuInputEvents.cxx.

References fChainNuEvent, fChainNuMCEvent, Msg::kInfo, MakeChain(), and MSG.

Referenced by NuDSTAna::DoIO(), NuDSTAna::DoIOSimple(), NuDSTAna::FDTestAna(), NuFCExperimentFactoryNSI::FillFromDST(), NuFCExperimentFactory::FillFromDST(), NuDSTAna::NMBAna(), and NuAnalysis::NMBSummaryTreeAna().

00090 {
00091   if (fChainNuMCEvent || fChainNuEvent) {
00092     MSG("NuInputEvents",Msg::kInfo)
00093       <<"Chains already initialised... nothing to do"<<endl;
00094   }
00095   else this->MakeChain();
00096 }

void NuInputEvents::InitialiseNuEventBranch (  ) 

Definition at line 950 of file NuInputEvents.cxx.

References fChainNuEvent, fEntriesNuEvent, fFirstRunNumberNuEvent, fNuEvent, Msg::kDebug, Msg::kInfo, MSG, and NuEvent::run.

Referenced by NuDSTAna::Contamination(), NuDSTAna::ContaminationNQ(), NuDSTAna::DoIO(), NuDSTAna::DoIOSimple(), NuDSTAna::DPSystematic(), NuDSTAna::FDTestAna(), NuFCExperimentFactoryNSI::FillFromDST(), NuFCExperimentFactory::FillFromDST(), NuDSTAna::MakekNNTrainTestSet(), NuDSTAna::MakePurityEfficiencyPlotsCCNC(), NuDSTAna::MakeRoIDTrainingSet(), NuDSTAna::MakeShwEnkNNTestingSet(), NuDSTAna::MakeShwEnkNNTrainingSet(), NuDSTAna::MMTransition(), NuDSTAna::NewFieldAna(), NuDSTAna::NMBAna(), and NuAnalysis::NMBSummaryTreeAna().

00951 {
00952   MSG("NuInputEvents",Msg::kDebug)
00953     <<"Running the SetupNuEventTree method..."<<endl;
00954 
00955   //set up tree
00956   if (fChainNuEvent) {
00957     fChainNuEvent->SetBranchAddress("s",&fNuEvent);
00958     
00959     //set the number of entries in the tree
00960     fEntriesNuEvent=static_cast<Int_t>(fChainNuEvent->GetEntries());
00961     MSG("NuInputEvents",Msg::kInfo)
00962       <<"NuEvent tree has "<<fEntriesNuEvent<<" entries"<<endl;
00963     if (fEntriesNuEvent>0){
00964       //get the snarl/entry
00965       fChainNuEvent->GetEntry(0); 
00966       MSG("NuInputEvents",Msg::kInfo)
00967         <<"NuInputEvents::First run number="<<fNuEvent->run<<endl;
00968       fFirstRunNumberNuEvent=fNuEvent->run;
00969     }
00970   }
00971   else cout<<"No fChainNuEvent to setup, initialise first"<<endl;
00972   
00973   MSG("NuInputEvents",Msg::kDebug)
00974     <<"Finished the SetupNuEventTree method"<<endl;
00975 }

void NuInputEvents::InitialiseNuEventCache (  ) 

Definition at line 509 of file NuInputEvents.cxx.

References fNuEventsIter, fpvNuEvents, Msg::kInfo, and MSG.

00510 {
00511   MSG("NuInputEvents",Msg::kInfo) 
00512     <<"Running NuInputEvents::InitialiseNuEventCache"<<endl;
00513 
00514   //create the vector of NuEvents and initialise
00515   fpvNuEvents=new vector<NuEvent*>;
00516 
00517   //make space in memory for objects
00518   fpvNuEvents->reserve(50000);
00519 
00520   //initialise the iterator
00521   fNuEventsIter=fpvNuEvents->begin();
00522   //this is one before the first so that GetNext works properly
00523   --fNuEventsIter;
00524 
00525   MSG("NuInputEvents",Msg::kInfo) 
00526     <<"   Cache size="<<fpvNuEvents->size()<<endl;
00527 }

void NuInputEvents::InitialiseNuMCEventBranch (  ) 

Definition at line 979 of file NuInputEvents.cxx.

References fChainNuMCEvent, fEntriesNuMCEvent, fFirstRunNumberNuMCEvent, fNuMCEvent, Msg::kDebug, Msg::kInfo, MSG, and NuMCEvent::run.

Referenced by NuDSTAna::ConcatenateDSTs(), NuDSTAna::JeffsTestAna(), NuDSTAna::MakeMicroDST(), NuDSTAna::MakeMicroDst2010(), NuDSTAna::MakeMicroDst2014(), NuDSTAna::MakeMicroDstFakeData(), NuDSTAna::MakeMicroDstForCSSSystematics(), NuDSTAna::MakeMicroDstHe(), NuDSTAna::MakeMicroDstJJEPresel(), NuDSTAna::MakeMicroDstNC2012(), NuDSTAna::MakeMicroDstWithStdCCRecoAndCuts(), NuDSTAna::MakeSelMicroDST(), NuDSTAna::MMRereco(), NuDSTAna::MMTransition(), NuDSTAna::MMTransSME(), NuDSTAna::StdCCAna(), and NuDSTAna::StdNMBAna().

00980 {
00981   MSG("NuInputEvents",Msg::kDebug)
00982     <<"Running the SetupNuMCEventTree method..."<<endl;
00983 
00984   //set up tree
00985   if (fChainNuMCEvent) {
00986     fChainNuMCEvent->SetBranchAddress("mc",&fNuMCEvent);
00987   
00988     //set the number of entries in the tree
00989     fEntriesNuMCEvent=static_cast<Int_t>(fChainNuMCEvent->GetEntries());
00990     MSG("NuInputEvents",Msg::kInfo)
00991       <<"NuMCEvent tree has "<<fEntriesNuMCEvent<<" entries"<<endl;
00992     if (fEntriesNuMCEvent>0){
00993       //get the snarl/entry
00994       fChainNuMCEvent->GetEntry(0); 
00995       MSG("NuInputEvents",Msg::kInfo)
00996         <<"NuInputEvents::First run number="<<fNuMCEvent->run<<endl;
00997       fFirstRunNumberNuMCEvent=fNuMCEvent->run;
00998     }
00999   }
01000   else cout<<"No fChainNuMCEvent to setup, initialise first"<<endl;
01001 
01002   MSG("NuInputEvents",Msg::kDebug)
01003     <<"Finished the SetupNuMCEventTree method"<<endl;
01004 }

void NuInputEvents::InitialiseNuMCEventCache (  ) 

Definition at line 531 of file NuInputEvents.cxx.

References fNuMCEventsIter, fpvNuMCEvents, Msg::kInfo, and MSG.

00532 {
00533   MSG("NuInputEvents",Msg::kInfo) 
00534     <<"Running NuInputEvents::InitialiseNuMCEventCache"<<endl;
00535 
00536   //create the vector of NuMCEvents and initialise
00537   fpvNuMCEvents=new vector<NuMCEvent*>;
00538 
00539   //make space in memory for objects
00540   fpvNuMCEvents->reserve(50000);
00541 
00542   //initialise the iterator
00543   fNuMCEventsIter=fpvNuMCEvents->begin();
00544   //this is one before the first so that GetNext works properly
00545   --fNuMCEventsIter;
00546 
00547   MSG("NuInputEvents",Msg::kInfo) 
00548     <<"   Cache size="<<fpvNuMCEvents->size()<<endl;
00549 }

static void NuInputEvents::InputFileName ( std::string  f  )  [static]
void NuInputEvents::MakeChain (  )  [private]

Definition at line 851 of file NuInputEvents.cxx.

References exit(), fChainNuEvent, fChainNuMCEvent, Msg::kError, Msg::kInfo, Msg::kWarning, MakeFileList(), MSG, and ObjectExistsInFile().

Referenced by InitialiseChains().

00852 {
00853   //get the files to open
00854   vector<string> fileList=this->MakeFileList();
00855   
00856   //sanity check
00857   if (fileList.size()<=0) cout<<"Ahhh no files in fileList"<<endl;
00858   
00859   //open the file
00860   TFile* file=TFile::Open((*fileList.begin()).c_str(),"READ");
00861   
00862   //create a chain with NuEvent tree
00863   fChainNuEvent=new TChain("s");
00864   
00865   //check if NuMCEvent exists
00866   if (this->ObjectExistsInFile(file,"mc")) {
00867     //create a chain with NuEvent tree
00868     fChainNuMCEvent=new TChain("mc");
00869     //fChainNuMCEvent->Print();
00870   }
00871       
00872   //add the files to the chain  
00873   Int_t nfNuEvent=0;
00874   Int_t nfNuMCEvent=0;
00875   for (vector<string>::iterator file=fileList.begin();
00876        file!=fileList.end();++file){
00877     
00878     //test if file already exists
00879     ifstream openOk((*file).c_str()); 
00880 
00881     //check if a wildcard was used because ifstream can't open wildcards
00882     Int_t stars=(*file).find("*");
00883     Int_t quest=(*file).find("?");
00884 
00885     //check if file existed
00886     if (!openOk && !(quest>=0 || stars>=0)){
00887       MSG("NuInputEvents",Msg::kInfo)
00888         <<endl<<endl
00889         <<"***********************************************************"
00890         <<endl<<"Can't find file="<<*file<<endl
00891         <<"Note: you can't use '~/'. It has to be the full path"<<endl
00892         <<"***********************************************************"
00893         <<endl<<endl
00894         <<"Exiting here!"<<endl;
00895       exit(0);
00896     }
00897     
00898     if (fChainNuEvent) {
00899       MSG("NuInputEvents",Msg::kInfo)<<"Adding file="<<*file<<endl;
00900       nfNuEvent+=fChainNuEvent->Add((*file).c_str());
00901       if (fChainNuMCEvent) {
00902         nfNuMCEvent+=fChainNuMCEvent->Add((*file).c_str());
00903       }
00904     }
00905     else {
00906       MSG("NuInputEvents",Msg::kWarning)
00907         <<"fChainNuEvent is a null pointer"<<endl;
00908     }
00909   }
00910 
00911   if(nfNuEvent==0){
00912     MSG("NuInputEvents",Msg::kError)
00913       <<endl<<endl
00914       <<"*************************************************************"
00915       <<endl<<"No NuEvent*.root files found"<<endl
00916       <<"Please set NUEVENT to the directory containing the"
00917       <<" NuEvent*.root files"<<endl
00918       <<"Or give the txt file containing the files to be input"<<endl
00919       <<"Note: If more than one file is found they will be"
00920       <<" concatenated in a TChain and treated as one"<<endl
00921       <<"*************************************************************"
00922       <<endl<<endl<<"Program will exit here"<<endl;
00923     exit(0);
00924   }
00925 
00926   if (nfNuMCEvent) {
00927     MSG("NuInputEvents",Msg::kInfo) 
00928       <<"NuMCEvent information:"<<endl;
00929     //fChainNuMCEvent->Show(0);
00930     MSG("NuInputEvents",Msg::kInfo)
00931       <<endl<<"Added "<<nfNuMCEvent<<" file(s) to NuMCEvent TChain"
00932       <<endl;
00933   }
00934   else {
00935     MSG("NuInputEvents",Msg::kInfo)
00936       <<endl<<"Zero files added to NuMCEvent TChain"<<endl;
00937   }
00938     
00939   MSG("NuInputEvents",Msg::kInfo) 
00940     <<"NuEvent information:"<<endl;
00941   //fChainNuEvent->Show(0);
00942   
00943   MSG("NuInputEvents",Msg::kInfo)
00944     <<endl<<"Analysing "<<nfNuEvent<<" file(s). Reading from disk..."
00945     <<endl;
00946 }

std::vector< std::string > NuInputEvents::MakeFileList (  )  [private]

Check the fInputFileName first then check the env variable

Definition at line 740 of file NuInputEvents.cxx.

References exit(), fInputFileName, GetListOfFilesInDir(), Msg::kError, Msg::kInfo, and MSG.

Referenced by MakeChain().

00741 {
00743 
00744   vector<string> fileList;
00745   
00746   if (fInputFileName!=""){
00747     MSG("NuInputEvents",Msg::kInfo)
00748       <<"Running NuInputEvents::MakeFileList with fInputFileName="
00749       <<fInputFileName<<endl;
00750     
00751     Int_t findGives=fInputFileName.find(".root");
00752     //cout<<"find gives="<<fInputFileName.find(".root")<<endl;
00753 
00754     //check if there is a wildcard
00755     if (findGives>0 && 
00756         TString(fInputFileName.c_str()).MaybeWildcard()) {
00757       MSG("NuInputEvents",Msg::kInfo)
00758         <<"Found wildcard so getting list of files in directory"<<endl;
00759       fileList=this->GetListOfFilesInDir(fInputFileName);
00760       if(fileList.empty()) {
00761         MSG("NuInputEvents", Msg::kError)
00762           << "No files matched wildcard, will fall back to NUEVENT" << endl;
00763       }
00764     }
00765     else if (findGives>0){
00766       MSG("NuInputEvents",Msg::kInfo)
00767         <<"Adding file direct to list"<<endl;
00768       //add the file direct to the list
00769       fileList.push_back(fInputFileName);
00770     }
00771     else{//treat the file as a list of root files 
00772       ifstream inputFile(fInputFileName.c_str());
00773       
00774       //check if file exists
00775       if (inputFile){
00776         //variables to hold input from file
00777         string file="";
00778         
00779         //read in from the text file and fill objects
00780         while(inputFile>>file) {
00781           MSG("NuInputEvents",Msg::kInfo)
00782             <<"Found input file name="<<file<<endl;
00783           fileList.push_back(file);
00784         }
00785         MSG("NuInputEvents",Msg::kInfo)
00786           <<"Files names found in txt file="<<fileList.size()<<endl;
00787       }
00788       else{
00789         MSG("NuInputEvents",Msg::kError)
00790           <<endl<<endl
00791           <<"**********************************************************"
00792           <<endl<<"Input txt file of file names does not exist!"<<endl
00793           <<"InputFileName="<<fInputFileName<<endl
00794           <<"**********************************************************"
00795           <<endl<<endl<<"Program will exit here"<<endl;
00796         exit(0);
00797       }
00798     }
00799   }
00800   //return the fileList if files were found
00801   if (fileList.size()>0) return fileList;
00802   
00803   //Check the env variable to find files
00804   char* envVariable=getenv("NUEVENT");
00805   if (envVariable==NULL){
00806     MSG("NuInputEvents",Msg::kError)
00807       <<endl<<endl
00808       <<"*************************************************************"
00809       <<endl<<"Environmental variable NUEVENT not set!"<<endl
00810       <<"Please set NUEVENT to the directory containing the"
00811       <<" NuEvent*.root files"<<endl
00812       <<"Note: If more than one file is found they will be"
00813       <<" concatenated and treated as one"<<endl
00814       <<"*************************************************************"
00815       <<endl<<endl<<"Program will exit here"<<endl;
00816     exit(0);
00817   }
00818   string sEnv=envVariable;
00819   MSG("NuInputEvents",Msg::kInfo)
00820     <<"Looking for NuEvent*.root files using the env variable"<<endl
00821     <<"NUEVENT="<<sEnv<<endl;
00822   sEnv+="/NuEvent*.root";
00823   fileList.push_back(sEnv);
00824 
00825   return fileList;
00826 }

Bool_t NuInputEvents::ObjectExistsInFile ( TFile *  file,
std::string  objectName 
) const

Definition at line 1008 of file NuInputEvents.cxx.

References Msg::kInfo, Msg::kWarning, and MSG.

Referenced by MakeChain().

01010 {
01011   if (!file) {
01012     MSG("NuInputEvents",Msg::kWarning)
01013       <<"File does not exist so can't test if object exists!"<<endl;
01014     return false;
01015   }
01016 
01017   TList* listOfKeys=file->GetListOfKeys();
01018 
01019   static TFile* lastFile=0;
01020   if (lastFile!=file){
01021     //MSG("NuInputEvents",Msg::kInfo)
01022     //<<"File contains these keys:"<<endl;
01023     //listOfKeys->Print();//too verbose when lots of histos
01024   }
01025   lastFile=file;
01026 
01027   TObject* ob=listOfKeys->FindObject(objectName.c_str());
01028   if (ob) {
01029     MSG("NuInputEvents",Msg::kInfo)
01030       <<"Requested object with name="<<objectName
01031       <<" exists in file:"<<endl;
01032     ob->Print();
01033     return true;
01034   }
01035   else {
01036     MSG("NuInputEvents",Msg::kInfo)
01037       <<"Requested object with name="<<objectName
01038       <<" does NOT exist in file"<<endl;
01039     return false;
01040   }
01041 }

TDirectory * NuInputEvents::OpenInputFile (  ) 

Definition at line 183 of file NuInputEvents.cxx.

References fInputFileDir, fInputFileName, GetListOfFilesInDir(), it, Msg::kInfo, Msg::kWarning, and MSG.

Referenced by NuDSTAna::DoIOSimple(), NuDSTAna::FDTestAna(), NuDSTAna::NMBAna(), and NuAnalysis::NMBSummaryTreeAna().

00184 {
00185   if (!fInputFileDir) {
00186     //to avoid changing the global configuration
00187     //get the original directory
00188     TDirectory* directoryOrig=gDirectory;
00189     //cout<<"Original directory is:"<<endl;
00190     //directoryOrig->Print();
00191     
00192     if (fInputFileName=="") return NULL;
00193     
00194     vector<string> fileList;
00195     fileList=this->GetListOfFilesInDir(fInputFileName);
00196     
00197     //print out files found    
00198     MSG("NuInputEvents",Msg::kInfo)
00199       <<"Found "<<fileList.size()<<" files:"<<endl;
00200     for (vector<string>::iterator it=fileList.begin();
00201          it!=fileList.end();++it) {
00202       MSG("NuInputEvents",Msg::kInfo)
00203         <<"  File name="<<*it<<endl;
00204     }
00205 
00206     if (fileList.size()>0) {
00207       cout<<"Opening (1st) file="<<fileList[0]<<endl;
00208       TFile::Open(fileList[0].c_str());
00209     }
00210     else {
00211       MSG("NuInputEvents",Msg::kWarning)
00212         <<"No file found so returning NULL, fInputFileName="
00213         <<fInputFileName<<endl;
00214       return NULL;
00215     }
00216     
00217     //store the directory of the file
00218     fInputFileDir=gDirectory;
00219     
00220     //reset the global directory to the original directory
00221     gDirectory=directoryOrig;
00222   }
00223   else {
00224     MSG("NuInputEvents",Msg::kWarning)
00225       <<"A file has already been opened, fInputFileName="
00226       <<fInputFileName
00227       <<", fInputFileDir="
00228       <<endl;
00229     fInputFileDir->Print();
00230   }
00231 
00232   return fInputFileDir;
00233 }

TDirectory * NuInputEvents::OpenNextInputFile (  ) 

Definition at line 100 of file NuInputEvents.cxx.

References fInputFileDir, fInputFileName, GetListOfFilesInDir(), it, Msg::kInfo, Msg::kWarning, and MSG.

Referenced by NuDSTAna::DoIO().

00101 {
00102   //check if input file name exists
00103   if (fInputFileName=="") {
00104     MSG("NuInputEvents",Msg::kWarning)
00105       <<"No input file given so returning NULL, fInputFileName="
00106       <<fInputFileName<<endl;
00107     return NULL;
00108   }
00109 
00110   //create a vector to store the list of files
00111   static vector<string> fileList;
00112   if (fileList.size()==0) {
00113     MSG("NuInputEvents",Msg::kInfo)
00114       <<"Searching for files..."<<endl;
00115     fileList=this->GetListOfFilesInDir(fInputFileName);
00116     
00117     //check if file found
00118     if (fileList.size()==0) {
00119       MSG("NuInputEvents",Msg::kWarning)
00120         <<"No file found so returning NULL, fInputFileName="
00121         <<fInputFileName<<endl;
00122       return NULL;
00123     }
00124 
00125     //print out files found    
00126     MSG("NuInputEvents",Msg::kInfo)
00127       <<"Found "<<fileList.size()<<" files:"<<endl;
00128     for (vector<string>::iterator it=fileList.begin();
00129          it!=fileList.end();++it) {
00130       MSG("NuInputEvents",Msg::kInfo)
00131         <<"  File name="<<*it<<endl;
00132     }
00133   }
00134   
00135   //get an iterator
00136   static vector<string>::iterator it=fileList.begin();
00137   
00138   //check if iterator points to anything
00139   if (it==fileList.end()) return NULL;
00140   
00141   //to avoid changing the global configuration
00142   //get the original directory
00143   TDirectory* directoryOrig=gDirectory;
00144   //cout<<"Original directory is:"<<endl;
00145   //directoryOrig->Print();
00146   
00147   //keep a pointer to the file
00148   static TFile* file=0;
00149   static TFile* firstFile=0;
00150   //close the file if it exists
00151   //don't close the first file... the clones of histos in the first
00152   //file seem to disappear if the file is closed
00153   //not closing the first file is a nasty work around 
00154   if (file) {
00155     if (file!=firstFile) {
00156       cout<<"Closing file="<<file->GetName()<<endl;
00157       file->Close();
00158       file=0;//reset the pointer
00159     }
00160     else cout<<"Not closing the first file to be opened (avoids a segv)"
00161              <<endl;
00162   }
00163 
00164   //open the new file
00165   cout<<"Opening file... name="<<(*it).c_str()<<endl;
00166   file=TFile::Open((*it).c_str());
00167   if (!firstFile) firstFile=file;
00168 
00169   //increment the iterator
00170   ++it;
00171 
00172   //store the directory of the file
00173   fInputFileDir=gDirectory;
00174   
00175   //reset the global directory to the original directory
00176   gDirectory=directoryOrig;
00177   
00178   return fInputFileDir;
00179 }

void NuInputEvents::PrintNewFileName (  )  const

Definition at line 411 of file NuInputEvents.cxx.

References fChainNuEvent, fUseCachedNuEvents, Msg::kInfo, and MSG.

00412 {
00413   static int lastFileno = -1;
00414   if (fUseCachedNuEvents) return;
00415   int current = fChainNuEvent->GetTreeNumber();
00416   
00417   if (current > lastFileno) {
00418     lastFileno = current;
00419     MSG("NuInputEvents",Msg::kInfo) << "*** New File: " << fChainNuEvent->GetFile()->GetName() << endl;
00420   }
00421   
00422 }

void NuInputEvents::PrintNewMCFileName (  )  const

Definition at line 426 of file NuInputEvents.cxx.

References fChainNuMCEvent, fUseCachedNuMCEvents, Msg::kInfo, and MSG.

00427 {
00428   static int lastFileno = -1;
00429   if (fUseCachedNuMCEvents) return;
00430   int current = fChainNuMCEvent->GetTreeNumber();
00431   
00432   if (current > lastFileno) {
00433     lastFileno = current;
00434     MSG("NuInputEvents",Msg::kInfo) << "*** New File: " << fChainNuMCEvent->GetFile()->GetName() << endl;
00435   }
00436   
00437 }

void NuInputEvents::ResetNuEventCachePositionToStart (  )  [private]

Definition at line 281 of file NuInputEvents.cxx.

References fNuEventsIter, fpvNuEvents, Msg::kError, and MSG.

Referenced by ResetNuEventLoopPositionToStart().

00282 {
00283   if (fpvNuEvents) {
00284     fNuEventsIter=fpvNuEvents->begin();
00285     //this is one before the first so that GetNext works properly
00286     --fNuEventsIter;
00287   }
00288   else {
00289     MSG("NuInputEvents",Msg::kError) 
00290       <<"Can't reset cache position to start before cache is created"
00291       <<endl
00292       <<"Will exit here..."<<endl;
00293     assert(false);
00294   }
00295 }

void NuInputEvents::ResetNuEventLoopPositionToStart (  ) 

Reset either the tree or the cache to the start depending on the method in use

Definition at line 237 of file NuInputEvents.cxx.

References fUseCachedNuEvents, ResetNuEventCachePositionToStart(), and ResetNuEventTreePositionToStart().

Referenced by NuDSTAna::BRevAna(), NuDSTAna::CoilHoleAna(), NuDSTAna::ConcatenateDSTs(), NuDSTAna::Contamination(), NuDSTAna::ContaminationNQ(), NuDSTAna::CSSAna(), NuDSTAna::CSSAnaRashid(), NuDSTAna::DPSystematic(), NuDSTAna::FDTestAna(), NuFCExperimentFactoryNSI::FillFromDST(), NuFCExperimentFactory::FillFromDST(), NuDSTAna::FluxComponents(), FoverNHistos::GetEventListForLooping(), FitTree::GetEventListForLooping(), DataStabilityAnalysisClass::GetEventListForLooping(), TemplateAnalysisClass::GetEventListForLooping(), ToFPlotter::GetEventListForLooping(), DataMCPlots::GetEventListForLooping(), NuDSTAna::JeffsTestAna(), NuDSTAna::MakeCuts(), NuDSTAna::MakeDstPQ(), NuDSTAna::MakeFCTree(), NuDSTAna::MakekNNTrainTestSet(), NuDSTAna::MakeMicroDST(), NuDSTAna::MakeMicroDst2010(), NuDSTAna::MakeMicroDst2014(), NuDSTAna::MakeMicroDstFakeData(), NuDSTAna::MakeMicroDstForCSSSystematics(), NuDSTAna::MakeMicroDstHe(), NuDSTAna::MakeMicroDstJJEPresel(), NuDSTAna::MakeMicroDstNC2012(), NuDSTAna::MakeMicroDstWithStdCCRecoAndCuts(), NuDSTAna::MakePurityEfficiencyPlotsCCNC(), NuDSTAna::MakeResolutionBins(), NuDSTAna::MakeRoIDTrainingSet(), NuDSTAna::MakeSelMicroDST(), NuDSTAna::MakeShwEnkNNTestingSet(), NuDSTAna::MakeShwEnkNNTrainingSet(), NuDSTAna::MMRereco(), NuDSTAna::MMTransition(), NuDSTAna::MMTransSME(), NuDSTAna::NDOsc(), NuDSTAna::NDQPRB(), NuDSTAna::NDTestAna(), NuDSTAna::NewFieldAna(), NuDSTAna::NMBAna(), NuAnalysis::NMBSummaryTreeAna(), NuDSTAna::QPStudy(), NuDSTAna::RHCTest(), NuDSTAna::SelectorTable(), NuDSTAna::StdCCAna(), NuDSTAna::StdNMBAna(), NuDSTAna::TestNuSyst(), and NuDSTAna::YStudy().

00238 {
00241   if (fUseCachedNuEvents) {
00242     this->ResetNuEventCachePositionToStart();
00243   }
00244   else {
00245     this->ResetNuEventTreePositionToStart();
00246   }
00247 }

void NuInputEvents::ResetNuEventTreePositionToStart (  )  [private]

Definition at line 265 of file NuInputEvents.cxx.

References fEntryNuEvent.

Referenced by NuInputEvents(), and ResetNuEventLoopPositionToStart().

00266 {
00267   //this is one before the first so that GetNext works properly
00268   fEntryNuEvent=-1;
00269 }

void NuInputEvents::ResetNuMCEventCachePositionToStart (  )  [private]

Definition at line 299 of file NuInputEvents.cxx.

References fNuMCEventsIter, fpvNuMCEvents, Msg::kError, and MSG.

Referenced by ResetNuMCEventLoopPositionToStart().

00300 {
00301   if (fpvNuMCEvents) {
00302     fNuMCEventsIter=fpvNuMCEvents->begin();
00303     //this is one before the first so that GetNext works properly
00304     --fNuMCEventsIter;
00305   }
00306   else {
00307     MSG("NuInputEvents",Msg::kError) 
00308       <<"Can't reset cache position to start before cache is created"
00309       <<endl
00310       <<"Will exit here..."<<endl;
00311     assert(false);
00312   }
00313 }

void NuInputEvents::ResetNuMCEventLoopPositionToStart (  ) 
void NuInputEvents::ResetNuMCEventTreePositionToStart (  )  [private]

Definition at line 273 of file NuInputEvents.cxx.

References fEntryNuMCEvent.

Referenced by NuInputEvents(), and ResetNuMCEventLoopPositionToStart().

00274 {
00275   //this is one before the first so that GetNext works properly
00276   fEntryNuMCEvent=-1;
00277 }

void NuInputEvents::SetLoopVariablesNuEvent ( Int_t  entry,
Int_t  printMode = 1 
) [private]

Definition at line 441 of file NuInputEvents.cxx.

References fChainNuEvent, fEntriesNuEvent, Msg::kDebug, and MSG.

00442 {
00443   if (printMode==1){
00444     Float_t fract=ceil(fEntriesNuEvent/20.);  
00445     if (ceil(((Float_t)entry)/fract)==((Float_t)entry)/fract){
00446       MSG("NuInputEvents",Msg::kDebug) 
00447         <<"Fraction of loop complete: "<<entry 
00448         <<"/"<<fEntriesNuEvent<<"  ("
00449         <<(Int_t)(100.*entry/fEntriesNuEvent)<<"%)"<<endl;
00450     }
00451   }
00452 
00453   //get the snarl/entry
00454   fChainNuEvent->GetEntry(entry); 
00455 }

void NuInputEvents::SetLoopVariablesNuMCEvent ( Int_t  entry,
Int_t  printMode = 1 
) [private]

Definition at line 459 of file NuInputEvents.cxx.

References fChainNuMCEvent, fEntriesNuMCEvent, Msg::kDebug, and MSG.

00460 {
00461   if (printMode==1){
00462     Float_t fract=ceil(fEntriesNuMCEvent/20.);  
00463     if (ceil(((Float_t)entry)/fract)==((Float_t)entry)/fract){
00464       MSG("NuInputEvents",Msg::kDebug) 
00465         <<"Fraction of loop complete: "<<entry 
00466         <<"/"<<fEntriesNuMCEvent<<"  ("
00467         <<(Int_t)(100.*entry/fEntriesNuMCEvent)<<"%)"<<endl;
00468     }
00469   }
00470 
00471   //get the snarl/entry
00472   fChainNuMCEvent->GetEntry(entry); 
00473 }

void NuInputEvents::UseNuEventCache ( Bool_t  useCache = true  ) 

Definition at line 477 of file NuInputEvents.cxx.

References fUseCachedNuEvents, Msg::kInfo, and MSG.

00478 {
00479   if (useCache==true) {
00480     MSG("NuInputEvents",Msg::kInfo) 
00481       <<"Setting NuInputEvents object to use the cache"<<endl;
00482     fUseCachedNuEvents=true;
00483   }
00484   else {
00485     MSG("NuInputEvents",Msg::kInfo) 
00486       <<"Setting NuInputEvents object to use the tree"<<endl;
00487     fUseCachedNuEvents=false;
00488   }
00489 }

void NuInputEvents::UseNuMCEventCache ( Bool_t  useCache = true  ) 

Definition at line 493 of file NuInputEvents.cxx.

References fUseCachedNuMCEvents, Msg::kInfo, and MSG.

00494 {
00495   if (useCache==true) {
00496     MSG("NuInputEvents",Msg::kInfo) 
00497       <<"Setting NuInputEvents object to use the cache"<<endl;
00498     fUseCachedNuMCEvents=true;
00499   }
00500   else {
00501     MSG("NuInputEvents",Msg::kInfo) 
00502       <<"Setting NuInputEvents object to use the tree"<<endl;
00503     fUseCachedNuMCEvents=false;
00504   }
00505 }


Member Data Documentation

TChain* NuInputEvents::fChainNuEvent [private]
TChain* NuInputEvents::fChainNuMCEvent [private]

Definition at line 88 of file NuInputEvents.h.

Referenced by GetNextTreeNuEvent(), and ResetNuEventTreePositionToStart().

Definition at line 91 of file NuInputEvents.h.

Referenced by GetNextTreeNuMCEvent(), and ResetNuMCEventTreePositionToStart().

TDirectory* NuInputEvents::fInputFileDir [private]

Definition at line 86 of file NuInputEvents.h.

Referenced by NuInputEvents(), OpenInputFile(), and OpenNextInputFile().

string NuInputEvents::fInputFileName = "" [static, private]

Definition at line 85 of file NuInputEvents.h.

Referenced by MakeFileList(), OpenInputFile(), and OpenNextInputFile().

Definition at line 95 of file NuInputEvents.h.

Referenced by GetNextTreeNuEvent(), InitialiseNuEventBranch(), and NuInputEvents().

std::vector<NuEvent*>::iterator NuInputEvents::fNuEventsIter [private]

Definition at line 96 of file NuInputEvents.h.

Referenced by GetNextTreeNuMCEvent(), InitialiseNuMCEventBranch(), and NuInputEvents().

std::vector<NuMCEvent*>::iterator NuInputEvents::fNuMCEventsIter [private]
std::vector<NuEvent*>* NuInputEvents::fpvNuEvents [private]
std::vector<NuMCEvent*>* NuInputEvents::fpvNuMCEvents [private]

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

Generated on 22 Nov 2017 for loon by  doxygen 1.6.1