NC::FakeDataAdder Class Reference

Every MC event is added to both the MC and "data" spectra. More...

#include <NCEventAdder.h>

Inheritance diagram for NC::FakeDataAdder:
NC::EventAdderBase NC::IEventAdder

List of all members.

Public Member Functions

 FakeDataAdder ()
virtual ~FakeDataAdder ()
virtual void Config (const Registry &r)
 Override this function to handle additional registry options.
virtual void AddEvents (NCExtrapolationModule *mod, NCEventInfo *eventInfo, TChain *nearData, TChain *nearMC, TChain *farData, TChain *farMC, TChain *farMCTau, TChain *farMCElectron) const
 You should implement this function to call back to NCExtrapolationModule::AddEventToExtrapolations.

Protected Member Functions

void AddEventsToExtrapolations (NCExtrapolationModule *mod, NCEventInfo *eventInfo, TChain *chain) const

Protected Attributes

bool fSkipMC
 Don't add MC because LoadExtrapolationsFile!="".
bool fSkipData
 Don't add data because IncludeDataFromLoadedExtrapolations.

Detailed Description

Every MC event is added to both the MC and "data" spectra.

Definition at line 83 of file NCEventAdder.h.


Constructor & Destructor Documentation

NC::FakeDataAdder::FakeDataAdder (  ) 

Definition at line 240 of file NCEventAdder.cxx.

00240                                : fSkipMC(false), fSkipData(false)
00241 {
00242 }

NC::FakeDataAdder::~FakeDataAdder (  )  [virtual]

Definition at line 246 of file NCEventAdder.cxx.

00247 {
00248 }


Member Function Documentation

void NC::FakeDataAdder::AddEvents ( NCExtrapolationModule mod,
NCEventInfo eventInfo,
TChain *  nearData,
TChain *  nearMC,
TChain *  farData,
TChain *  farMC,
TChain *  farMCTau,
TChain *  farMCElectron 
) const [virtual]

You should implement this function to call back to NCExtrapolationModule::AddEventToExtrapolations.

Implements NC::IEventAdder.

Definition at line 271 of file NCEventAdder.cxx.

References AddEventsToExtrapolations(), fSkipData, and fSkipMC.

00279 {
00280   if(fSkipMC && fSkipData) return;
00281 
00282   // Add near MC as both MC and fake data
00283   AddEventsToExtrapolations(mod, eventInfo, nearMC);
00284 
00285   // Add all the far MC and as data as well
00286   AddEventsToExtrapolations(mod, eventInfo, farMCTau);
00287   AddEventsToExtrapolations(mod, eventInfo, farMCElectron);
00288   AddEventsToExtrapolations(mod, eventInfo, farMC);
00289 }

void NC::FakeDataAdder::AddEventsToExtrapolations ( NCExtrapolationModule mod,
NCEventInfo eventInfo,
TChain *  chain 
) const [protected]

Definition at line 293 of file NCEventAdder.cxx.

References NCExtrapolationModule::AddEventToExtrapolations(), LoopRunLimitHelper::AreDone(), det, ANtpHeaderInfo::detector, NCEventInfo::FillFromChain(), NC::EventAdderBase::fRunLimitFarMC, NC::EventAdderBase::fRunLimitNearMC, fSkipData, fSkipMC, NCEventInfo::header, Msg::kError, Detector::kNear, MSG, and NC::EventAdderBase::ReportOnEventInfo().

Referenced by AddEvents().

00296 {
00297   if(chain->GetEntries() < 1){
00298     MSG("NC::FakeDataAdder", Msg::kError) << "No entries in chain!" << endl;
00299     return;
00300   }
00301 
00302   eventInfo->FillFromChain(chain, 0);
00303 
00304   ReportOnEventInfo(eventInfo);
00305 
00306   // The file limit
00307   Detector::Detector_t det = Detector::Detector_t(eventInfo->header->detector);
00308   const int limit = (det == Detector::kNear) ? fRunLimitNearMC : fRunLimitFarMC;
00309 
00310   const int eventTot = chain->GetEntries();
00311 
00312   LoopRunLimitHelper runLimitHelper(limit, eventTot, eventInfo);
00313 
00314   //loop over the entries in the tree
00315   for(int i = 0; i < eventTot; ++i){
00316     eventInfo->FillFromChain(chain, i);
00317 
00318     if(runLimitHelper.AreDone(i, eventInfo)) break;
00319 
00320     if(!fSkipMC) mod->AddEventToExtrapolations(false);
00321     //    chain->GetEntry(i);
00322     if(!fSkipData) mod->AddEventToExtrapolations(true);
00323   }//end loop over data chain
00324 }

void NC::FakeDataAdder::Config ( const Registry r  )  [virtual]

Override this function to handle additional registry options.

This default implementation fills the run limit member variables

Reimplemented from NC::EventAdderBase.

Definition at line 252 of file NCEventAdder.cxx.

References fSkipData, fSkipMC, and Registry::Get().

00253 {
00254   NC::EventAdderBase::Config(r);
00255 
00256   bool ok = true;
00257 
00258   const char* tmps;
00259   ok = ok && r.Get("LoadExtrapolationsFile", tmps);
00260   fSkipMC = TString(tmps) != "";
00261   int tmpi;
00262   ok = ok && r.Get("IncludeDataFromLoadedExtrapolations", tmpi);
00263   // This key only takes effect when we're loading anyway
00264   fSkipData = fSkipMC && tmpi;
00265 
00266   assert(ok);
00267 }


Member Data Documentation

bool NC::FakeDataAdder::fSkipData [protected]

Don't add data because IncludeDataFromLoadedExtrapolations.

Definition at line 106 of file NCEventAdder.h.

Referenced by AddEvents(), AddEventsToExtrapolations(), and Config().

bool NC::FakeDataAdder::fSkipMC [protected]

Don't add MC because LoadExtrapolationsFile!="".

Definition at line 105 of file NCEventAdder.h.

Referenced by AddEvents(), AddEventsToExtrapolations(), and Config().


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

Generated on 19 Jan 2018 for loon by  doxygen 1.6.1