#include <NCEventAdder.h>
Inheritance diagram for NC::SplitFakeDataAdder:

Public Member Functions | |
| SplitFakeDataAdder () | |
| virtual | ~SplitFakeDataAdder () |
| 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 | |
| int | fSplitMCSeed |
| If >0, split MC randomly, using this seed. | |
If SplitMCSeed is not set then this is done alternately by run otherwise it is done randomly, event by event
Definition at line 115 of file NCEventAdder.h.
|
|
Definition at line 331 of file NCEventAdder.cxx. 00331 : fSplitMCSeed(-1) 00332 { 00333 }
|
|
|
Definition at line 337 of file NCEventAdder.cxx. 00338 {
00339 }
|
|
||||||||||||||||||||||||||||||||||||
|
You should implement this function to call back to NCExtrapolationModule::AddEventToExtrapolations.
Implements NC::IEventAdder. Definition at line 353 of file NCEventAdder.cxx. References AddEventsToExtrapolations(). 00361 {
00362 // Add near MC as both MC and fake data
00363 AddEventsToExtrapolations(mod, eventInfo, nearMC);
00364
00365 // Add all the far MC and as data as well
00366 AddEventsToExtrapolations(mod, eventInfo, farMCTau);
00367 AddEventsToExtrapolations(mod, eventInfo, farMCElectron);
00368 AddEventsToExtrapolations(mod, eventInfo, farMC);
00369 }
|
|
||||||||||||||||
|
Definition at line 374 of file NCEventAdder.cxx. References NCExtrapolationModule::AddEventToExtrapolations(), LoopRunLimitHelper::AreDone(), det, ANtpHeaderInfo::detector, Detector::Detector_t, NCEventInfo::FillFromChain(), fSplitMCSeed, LoopRunLimitHelper::GetRunCounter(), NCEventInfo::header, MSG, and NC::EventAdderBase::ReportOnEventInfo(). Referenced by AddEvents(). 00377 {
00378 if(chain->GetEntries() < 1){
00379 MSG("NC::SplitFakeDataAdder", Msg::kError) << "No entries in chain!" << endl;
00380 return;
00381 }
00382
00383 eventInfo->FillFromChain(chain, 0);
00384
00385 Detector::Detector_t det = Detector::Detector_t(eventInfo->header->detector);
00386
00387 ReportOnEventInfo(eventInfo);
00388
00389 // The file limit
00390 int limit = (det == Detector::kNear) ? fRunLimitNearMC : fRunLimitFarMC;
00391 // Need an even number of runs so we can split them equally
00392 if(TMath::Odd(limit)) --limit;
00393
00394 const int eventTot = chain->GetEntries();
00395
00396 LoopRunLimitHelper runLimitHelper(limit, eventTot, eventInfo);
00397
00398 TRandom3 randomGen(fSplitMCSeed);
00399
00400 //loop over the entries in the tree
00401 for(int i = 0; i < eventTot; ++i){
00402 eventInfo->FillFromChain(chain, i);
00403
00404 if(runLimitHelper.AreDone(i, eventInfo)) break;
00405
00406 bool asFakeData;
00407 if(fSplitMCSeed >= 0){
00408 // Put each event randomly into one spectrum or another
00409 asFakeData = randomGen.Uniform() > .5;
00410 }
00411 else{
00412 // Put alternate runs into data or MC
00413 asFakeData = (runLimitHelper.GetRunCounter()%2 == 0);
00414 }
00415
00416 mod->AddEventToExtrapolations(asFakeData);
00417
00418 }//end loop over data chain
00419 }
|
|
|
Override this function to handle additional registry options. This default implementation fills the run limit member variables Reimplemented from NC::EventAdderBase. Definition at line 343 of file NCEventAdder.cxx. References NC::EventAdderBase::Config(), fSplitMCSeed, and Registry::Get(). 00344 {
00345 NC::EventAdderBase::Config(r);
00346
00347 const bool ok = r.Get("SplitMCSeed", fSplitMCSeed);
00348 assert(ok);
00349 }
|
|
|
If >0, split MC randomly, using this seed.
Definition at line 137 of file NCEventAdder.h. Referenced by AddEventsToExtrapolations(), and Config(). |
1.3.9.1