Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

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

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

std::string fInputFileName = ""


Constructor & Destructor Documentation

NuInputEvents::NuInputEvents  ) 
 

Definition at line 34 of file NuInputEvents.cxx.

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

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

NuInputEvents::~NuInputEvents  ) 
 

Definition at line 64 of file NuInputEvents.cxx.

References fChainNuEvent, fChainNuMCEvent, and MSG.

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


Member Function Documentation

void NuInputEvents::AddNuEventToCache const NuEvent nu  ) 
 

Definition at line 551 of file NuInputEvents.cxx.

References fpvNuEvents.

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

void NuInputEvents::AddNuMCEventToCache const NuMCEvent nu  ) 
 

Definition at line 568 of file NuInputEvents.cxx.

References fpvNuMCEvents.

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

Int_t NuInputEvents::GetCacheEntriesNuEvent  )  const [private]
 

Definition at line 376 of file NuInputEvents.cxx.

References fpvNuEvents, and MSG.

Referenced by GetEntriesNuEvent().

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

Int_t NuInputEvents::GetCacheEntriesNuMCEvent  )  const [private]
 

Definition at line 392 of file NuInputEvents.cxx.

References fpvNuMCEvents, and MSG.

Referenced by GetEntriesNuMCEvent().

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

Int_t NuInputEvents::GetEntriesNuEvent  )  const
 

Definition at line 315 of file NuInputEvents.cxx.

References GetCacheEntriesNuEvent(), and GetTreeEntriesNuEvent().

Referenced by NuDSTAna::BRevAna(), NuDSTAna::CoilHoleAna(), NuDSTAna::ConcatenateDSTs(), NuDSTAna::Contamination(), NuDSTAna::CSSAna(), NuDSTAna::CSSAnaRashid(), NuDSTAna::DPSystematic(), NuDSTAna::FDTestAna(), NuFCExperimentFactory::FillFromDST(), NuDSTAna::FluxComponents(), NuDSTAna::JeffsTestAna(), NuDSTAna::MakeDstPQ(), NuDSTAna::MakeFCTree(), NuDSTAna::MakeMicroDST(), NuDSTAna::MakeMicroDst2010(), NuDSTAna::MakeMicroDstFakeData(), NuDSTAna::MakeMicroDstForCSSSystematics(), NuDSTAna::MakeMicroDstHe(), NuDSTAna::MakeMicroDstJJEPresel(), NuDSTAna::MakeMicroDstWithStdCCRecoAndCuts(), NuDSTAna::MakeSelMicroDST(), NuDSTAna::MMRereco(), NuDSTAna::MMTransition(), 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::VsTime().

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

Int_t NuInputEvents::GetEntriesNuMCEvent  )  const
 

Definition at line 327 of file NuInputEvents.cxx.

References GetCacheEntriesNuMCEvent(), and GetTreeEntriesNuMCEvent().

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

00328 {
00329   if (fUseCachedNuMCEvents) {
00330     return this->GetCacheEntriesNuMCEvent();
00331   }
00332   else {
00333     return this->GetTreeEntriesNuMCEvent();
00334   }
00335 }

Int_t NuInputEvents::GetFirstRunNumberNuEvent  )  [inline]
 

Definition at line 36 of file NuInputEvents.h.

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

00036 {return fFirstRunNumberNuEvent;};

Int_t NuInputEvents::GetFirstRunNumberNuMCEvent  )  [inline]
 

Definition at line 37 of file NuInputEvents.h.

00037 {return fFirstRunNumberNuMCEvent;};

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

Definition at line 828 of file NuInputEvents.cxx.

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

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

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

There are no safety checks here at present!

Definition at line 585 of file NuInputEvents.cxx.

Referenced by GetNextNuEvent().

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

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

There are no safety checks here at present!

Definition at line 599 of file NuInputEvents.cxx.

Referenced by GetNextNuMCEvent().

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

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

Definition at line 695 of file NuInputEvents.cxx.

References GetNextCachedNuEvent(), and GetNextTreeNuEvent().

Referenced by NuDSTAna::BRevAna(), NuDSTAna::CoilHoleAna(), NuDSTAna::ConcatenateDSTs(), NuDSTAna::Contamination(), NuDSTAna::CSSAna(), NuDSTAna::CSSAnaRashid(), NuDSTAna::DoIO(), NuDSTAna::DPSystematic(), NuDSTAna::FDTestAna(), NuFCExperimentFactory::FillFromDST(), NuDSTAna::FluxComponents(), NuDSTAna::JeffsTestAna(), NuDSTAna::MakeDstPQ(), NuDSTAna::MakeFCTree(), NuDSTAna::MakeMicroDST(), NuDSTAna::MakeMicroDst2010(), NuDSTAna::MakeMicroDstFakeData(), NuDSTAna::MakeMicroDstForCSSSystematics(), NuDSTAna::MakeMicroDstHe(), NuDSTAna::MakeMicroDstJJEPresel(), NuDSTAna::MakeMicroDstWithStdCCRecoAndCuts(), NuDSTAna::MakeSelMicroDST(), NuDSTAna::MMRereco(), NuDSTAna::MMTransition(), 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::VsTime().

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

const NuMCEvent & NuInputEvents::GetNextNuMCEvent Msg::LogLevel_t  logLevel  ) 
 

Definition at line 711 of file NuInputEvents.cxx.

References GetNextCachedNuMCEvent(), and GetNextTreeNuMCEvent().

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

00712 {
00713   const NuMCEvent* pnu=0;
00714   
00715   if (fUseCachedNuMCEvents) {
00716     pnu=&this->GetNextCachedNuMCEvent(logLevel);
00717   }
00718   else {
00719     pnu=&this->GetNextTreeNuMCEvent(logLevel);
00720   }
00721 
00722   return *pnu;
00723 }

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

Definition at line 613 of file NuInputEvents.cxx.

References fChainNuEvent, fEntriesNuEvent, fEntryNuEvent, and MSG.

Referenced by GetNextNuEvent().

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

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

Definition at line 654 of file NuInputEvents.cxx.

References fChainNuMCEvent, fEntriesNuMCEvent, fEntryNuMCEvent, and MSG.

Referenced by GetNextNuMCEvent().

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

Int_t NuInputEvents::GetTreeEntriesNuEvent  )  const [private]
 

Definition at line 339 of file NuInputEvents.cxx.

References MSG.

Referenced by GetEntriesNuEvent().

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

Int_t NuInputEvents::GetTreeEntriesNuMCEvent  )  const [private]
 

Definition at line 355 of file NuInputEvents.cxx.

References MSG.

Referenced by GetEntriesNuMCEvent().

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

void NuInputEvents::InitialiseChains  ) 
 

Definition at line 87 of file NuInputEvents.cxx.

References fChainNuMCEvent, MakeChain(), and MSG.

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

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

void NuInputEvents::InitialiseNuEventBranch  ) 
 

Definition at line 956 of file NuInputEvents.cxx.

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

Referenced by NuDSTAna::Contamination(), NuDSTAna::DoIO(), NuDSTAna::DoIOSimple(), NuDSTAna::DPSystematic(), NuDSTAna::FDTestAna(), NuFCExperimentFactory::FillFromDST(), NuDSTAna::MMTransition(), NuDSTAna::NewFieldAna(), NuDSTAna::NMBAna(), and NuAnalysis::NMBSummaryTreeAna().

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

void NuInputEvents::InitialiseNuEventCache  ) 
 

Definition at line 507 of file NuInputEvents.cxx.

References fNuEventsIter, fpvNuEvents, and MSG.

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

void NuInputEvents::InitialiseNuMCEventBranch  ) 
 

Definition at line 985 of file NuInputEvents.cxx.

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

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

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

void NuInputEvents::InitialiseNuMCEventCache  ) 
 

Definition at line 529 of file NuInputEvents.cxx.

References fNuMCEventsIter, fpvNuMCEvents, and MSG.

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

void NuInputEvents::InputFileName std::string  f  )  [static]
 

Definition at line 727 of file NuInputEvents.cxx.

References fInputFileName, and MSG.

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

00728 {
00729   if (f!=""){
00730     MSG("NuInputEvents",Msg::kInfo)
00731       <<"Running with input file name="<<f<<endl;
00732     fInputFileName=f;
00733   }
00734 }

void NuInputEvents::MakeChain  )  [private]
 

Definition at line 848 of file NuInputEvents.cxx.

References fChainNuEvent, fChainNuMCEvent, MakeFileList(), MSG, and ObjectExistsInFile().

Referenced by InitialiseChains().

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

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

Check the fInputFileName first then check the env variable

Definition at line 738 of file NuInputEvents.cxx.

References fInputFileName, GetListOfFilesInDir(), and MSG.

Referenced by MakeChain().

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

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

Definition at line 1014 of file NuInputEvents.cxx.

References MSG.

Referenced by MakeChain().

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

TDirectory * NuInputEvents::OpenInputFile  ) 
 

Definition at line 181 of file NuInputEvents.cxx.

References fInputFileDir, fInputFileName, GetListOfFilesInDir(), and MSG.

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

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

TDirectory * NuInputEvents::OpenNextInputFile  ) 
 

Definition at line 98 of file NuInputEvents.cxx.

References fInputFileDir, fInputFileName, GetListOfFilesInDir(), and MSG.

Referenced by NuDSTAna::DoIO().

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

void NuInputEvents::PrintNewFileName  )  const
 

Definition at line 409 of file NuInputEvents.cxx.

References fChainNuEvent, and MSG.

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

void NuInputEvents::PrintNewMCFileName  )  const
 

Definition at line 424 of file NuInputEvents.cxx.

References fChainNuMCEvent, and MSG.

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

void NuInputEvents::ResetNuEventCachePositionToStart  )  [private]
 

Definition at line 279 of file NuInputEvents.cxx.

References fNuEventsIter, fpvNuEvents, and MSG.

Referenced by ResetNuEventLoopPositionToStart().

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

void NuInputEvents::ResetNuEventLoopPositionToStart  ) 
 

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

Definition at line 235 of file NuInputEvents.cxx.

References ResetNuEventCachePositionToStart(), and ResetNuEventTreePositionToStart().

Referenced by NuDSTAna::BRevAna(), NuDSTAna::CoilHoleAna(), NuDSTAna::ConcatenateDSTs(), NuDSTAna::Contamination(), NuDSTAna::CSSAna(), NuDSTAna::CSSAnaRashid(), NuDSTAna::DPSystematic(), NuDSTAna::FDTestAna(), NuFCExperimentFactory::FillFromDST(), NuDSTAna::FluxComponents(), NuDSTAna::JeffsTestAna(), NuDSTAna::MakeDstPQ(), NuDSTAna::MakeFCTree(), NuDSTAna::MakeMicroDST(), NuDSTAna::MakeMicroDst2010(), NuDSTAna::MakeMicroDstFakeData(), NuDSTAna::MakeMicroDstForCSSSystematics(), NuDSTAna::MakeMicroDstHe(), NuDSTAna::MakeMicroDstJJEPresel(), NuDSTAna::MakeMicroDstWithStdCCRecoAndCuts(), NuDSTAna::MakeSelMicroDST(), NuDSTAna::MMRereco(), NuDSTAna::MMTransition(), NuDSTAna::NDOsc(), NuDSTAna::NDQPRB(), NuDSTAna::NDTestAna(), NuDSTAna::NewFieldAna(), NuDSTAna::NMBAna(), NuAnalysis::NMBSummaryTreeAna(), NuDSTAna::QPStudy(), NuDSTAna::RHCTest(), NuDSTAna::SelectorTable(), NuDSTAna::StdCCAna(), NuDSTAna::StdNMBAna(), and NuDSTAna::TestNuSyst().

00236 {
00239   if (fUseCachedNuEvents) {
00240     this->ResetNuEventCachePositionToStart();
00241   }
00242   else {
00243     this->ResetNuEventTreePositionToStart();
00244   }
00245 }

void NuInputEvents::ResetNuEventTreePositionToStart  )  [private]
 

Definition at line 263 of file NuInputEvents.cxx.

References fEntryNuEvent.

Referenced by NuInputEvents(), and ResetNuEventLoopPositionToStart().

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

void NuInputEvents::ResetNuMCEventCachePositionToStart  )  [private]
 

Definition at line 297 of file NuInputEvents.cxx.

References fNuMCEventsIter, fpvNuMCEvents, and MSG.

Referenced by ResetNuMCEventLoopPositionToStart().

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

void NuInputEvents::ResetNuMCEventLoopPositionToStart  ) 
 

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

Definition at line 249 of file NuInputEvents.cxx.

References ResetNuMCEventCachePositionToStart(), and ResetNuMCEventTreePositionToStart().

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

00250 {
00253   if (fUseCachedNuMCEvents) {
00254     this->ResetNuMCEventCachePositionToStart();
00255   }
00256   else {
00257     this->ResetNuMCEventTreePositionToStart();
00258   }
00259 }

void NuInputEvents::ResetNuMCEventTreePositionToStart  )  [private]
 

Definition at line 271 of file NuInputEvents.cxx.

References fEntryNuMCEvent.

Referenced by NuInputEvents(), and ResetNuMCEventLoopPositionToStart().

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

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

Definition at line 439 of file NuInputEvents.cxx.

References fChainNuEvent, fEntriesNuEvent, and MSG.

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

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

Definition at line 457 of file NuInputEvents.cxx.

References fChainNuMCEvent, fEntriesNuMCEvent, and MSG.

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

void NuInputEvents::UseNuEventCache Bool_t  useCache = true  ) 
 

Definition at line 475 of file NuInputEvents.cxx.

References fUseCachedNuEvents, and MSG.

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

void NuInputEvents::UseNuMCEventCache Bool_t  useCache = true  ) 
 

Definition at line 491 of file NuInputEvents.cxx.

References fUseCachedNuMCEvents, and MSG.

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


Member Data Documentation

TChain* NuInputEvents::fChainNuEvent [private]
 

Definition at line 92 of file NuInputEvents.h.

Referenced by GetNextTreeNuEvent(), InitialiseNuEventBranch(), MakeChain(), NuInputEvents(), PrintNewFileName(), SetLoopVariablesNuEvent(), and ~NuInputEvents().

TChain* NuInputEvents::fChainNuMCEvent [private]
 

Definition at line 93 of file NuInputEvents.h.

Referenced by GetNextTreeNuMCEvent(), InitialiseChains(), InitialiseNuMCEventBranch(), MakeChain(), NuInputEvents(), PrintNewMCFileName(), SetLoopVariablesNuMCEvent(), and ~NuInputEvents().

Int_t NuInputEvents::fEntriesNuEvent [private]
 

Definition at line 86 of file NuInputEvents.h.

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

Int_t NuInputEvents::fEntriesNuMCEvent [private]
 

Definition at line 89 of file NuInputEvents.h.

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

Int_t NuInputEvents::fEntryNuEvent [private]
 

Definition at line 87 of file NuInputEvents.h.

Referenced by GetNextTreeNuEvent(), and ResetNuEventTreePositionToStart().

Int_t NuInputEvents::fEntryNuMCEvent [private]
 

Definition at line 90 of file NuInputEvents.h.

Referenced by GetNextTreeNuMCEvent(), and ResetNuMCEventTreePositionToStart().

Int_t NuInputEvents::fFirstRunNumberNuEvent [private]
 

Definition at line 88 of file NuInputEvents.h.

Referenced by InitialiseNuEventBranch(), and NuInputEvents().

Int_t NuInputEvents::fFirstRunNumberNuMCEvent [private]
 

Definition at line 91 of file NuInputEvents.h.

Referenced by InitialiseNuMCEventBranch(), and NuInputEvents().

TDirectory* NuInputEvents::fInputFileDir [private]
 

Definition at line 85 of file NuInputEvents.h.

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

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

Definition at line 28 of file NuInputEvents.cxx.

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

NuEvent* NuInputEvents::fNuEvent [private]
 

Definition at line 94 of file NuInputEvents.h.

Referenced by InitialiseNuEventBranch(), and NuInputEvents().

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

Definition at line 82 of file NuInputEvents.h.

Referenced by InitialiseNuEventCache(), and ResetNuEventCachePositionToStart().

NuMCEvent* NuInputEvents::fNuMCEvent [private]
 

Definition at line 95 of file NuInputEvents.h.

Referenced by InitialiseNuMCEventBranch(), and NuInputEvents().

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

Definition at line 83 of file NuInputEvents.h.

Referenced by InitialiseNuMCEventCache(), and ResetNuMCEventCachePositionToStart().

std::vector<NuEvent*>* NuInputEvents::fpvNuEvents [private]
 

Definition at line 80 of file NuInputEvents.h.

Referenced by AddNuEventToCache(), GetCacheEntriesNuEvent(), InitialiseNuEventCache(), NuInputEvents(), and ResetNuEventCachePositionToStart().

std::vector<NuMCEvent*>* NuInputEvents::fpvNuMCEvents [private]
 

Definition at line 81 of file NuInputEvents.h.

Referenced by AddNuMCEventToCache(), GetCacheEntriesNuMCEvent(), InitialiseNuMCEventCache(), NuInputEvents(), and ResetNuMCEventCachePositionToStart().

Bool_t NuInputEvents::fUseCachedNuEvents [private]
 

Definition at line 78 of file NuInputEvents.h.

Referenced by NuInputEvents(), and UseNuEventCache().

Bool_t NuInputEvents::fUseCachedNuMCEvents [private]
 

Definition at line 79 of file NuInputEvents.h.

Referenced by NuInputEvents(), and UseNuMCEventCache().


The documentation for this class was generated from the following files:
Generated on Mon Feb 15 11:09:53 2010 for loon by  doxygen 1.3.9.1