HighLAND
|
#include <SelectionBase.hxx>
Public Member Functions | |
SelectionBase (bool forceBreak=true, Int_t eventBoxId=UNASSIGNEDID) | |
virtual void | DefineSteps () |
Define all steps in the selection. | |
virtual void | DefineDetectorFV () |
Define the detector Fiducial Volume in which this selection is applied. | |
virtual ToyBoxB * | MakeToyBox () |
Create the appropriate type of box. | |
virtual void | InitializeEvent (AnaEventC &) |
Fill the EventBox with the objects needed by this selection. | |
virtual bool | FillEventSummary (AnaEventC &, Int_t *) |
Fill the Event Summary, needed by fitters. | |
virtual SampleId_h | GetSampleId () |
Return the sample type, needed by fitters. | |
virtual bool | IsRelevantRecObjectForSystematic (const AnaEventC &, AnaRecObjectC *, SystId_h syst_index, Int_t branch=0) const |
Is this track relevant for a given systematic (prior to selection, call when initializing the event, valid for all toys in the same event) | |
virtual bool | IsRelevantTrueObjectForSystematic (const AnaEventC &, AnaTrueObjectC *, SystId_h syst_index, Int_t branch=0) const |
Is this true track relevant for a given systematic (prior to selection, call when initializing the event, valid for all toys in the same event) | |
virtual bool | IsRelevantRecObjectForSystematicInToy (const AnaEventC &, const ToyBoxB &, AnaRecObjectC *, SystId_h syst_index, Int_t branch=0) const |
Is this track relevant for a given systematic (after selection, called for each toy) | |
virtual bool | IsRelevantTrueObjectForSystematicInToy (const AnaEventC &, const ToyBoxB &, AnaTrueObjectC *, SystId_h syst_index, Int_t branch=0) const |
Is this true track relevant for a given systematic (after selection, called for each toy) | |
virtual bool | IsRelevantSystematic (const AnaEventC &, const ToyBoxB &, SystId_h syst_index, Int_t branch=0) const |
Is this systematic relevant for this selection. | |
virtual bool | CheckRedoSelection (const AnaEventC &, const ToyBoxB &PreviousToyBox, Int_t &redoFromStep) |
void | Initialize () |
Initialize this selection: defines the steps and the detectorFV. | |
void | Validate () const |
Validates this selection. | |
bool | Apply (AnaEventC &event, bool &redo) |
Apply all steps in the selection. | |
const std::string & | Title () const |
Return the title of this selection. A nice version of the name. | |
virtual const char * | GetName () const |
Return the name of this selection. This overrides the TObject::GetName() interface. | |
const std::string & | Name () const |
Return the name of this selection. | |
void | SetTitle (const std::string &title) |
Set the title of this selection, which is the "nice" version of the selection name,. | |
void | SetName (const std::string &name) |
Set the name of this selection, which is used internally by the SelectionManager. | |
void | Enable () |
enable and disable selection | |
void | Disable () |
bool | IsEnabled () const |
bool | GetForceBreak () const |
void | PrintStatistics () const |
void | PrintStatistics (const std::string &name) const |
void | PrintStatistics (UInt_t ID) const |
void | CreateToyBoxArray (Int_t nevents) |
Create the array of PreviousToyBox. | |
void | FinalizeEvent (const AnaEventC &event) |
Delete the PreviousToyBox pointer for the last toy of the event. | |
void | AddStep (StepBase::TypeEnum type, const std::string &title, StepBase *step, bool cut_break=false) |
void | AddStep (Int_t b0, StepBase::TypeEnum type, const std::string &title, StepBase *step, bool cut_break=false) |
void | AddStep (Int_t b0, Int_t b1, StepBase::TypeEnum type, const std::string &title, StepBase *step, bool cut_break=false) |
void | AddStep (Int_t b0, Int_t b1, Int_t b2, StepBase::TypeEnum type, const std::string &title, StepBase *step, bool cut_break=false) |
void | AddStep (Int_t b0, Int_t b1, Int_t b2, Int_t b3, StepBase::TypeEnum type, const std::string &title, StepBase *step, bool cut_break=false) |
void | AddStep (Int_t b0, Int_t b1, Int_t b2, Int_t b3, Int_t b4, StepBase::TypeEnum type, const std::string &title, StepBase *step, bool cut_break=false) |
void | AddStep (Int_t b0, Int_t b1, Int_t b2, Int_t b3, Int_t b4, Int_t b5, StepBase::TypeEnum type, const std::string &title, StepBase *step, bool cut_break=false) |
void | AddStep (Int_t b0, Int_t b1, Int_t b2, Int_t b3, Int_t b4, Int_t b5, Int_t b6, StepBase::TypeEnum type, const std::string &title, StepBase *step, bool cut_break=false) |
void | AddStep (Int_t b0, Int_t b1, Int_t b2, Int_t b3, Int_t b4, Int_t b5, Int_t b6, Int_t b7, StepBase::TypeEnum type, const std::string &title, StepBase *step, bool cut_break=false) |
void | AddStep (const std::vector< UInt_t > &branch_seq, StepBase::TypeEnum type, const std::string &title, StepBase *step, bool cut_break=false) |
void | AddStep (const std::vector< UInt_t > &branch_seq, StepBase *step) |
void | AddSteps (const std::vector< UInt_t > &branch_seq, const std::vector< StepBase *> &steps) |
void | AddSplit (UInt_t nbranches, Int_t b0=-1, Int_t b1=-1, Int_t b2=-1, Int_t b3=-1, Int_t b4=-1, Int_t b5=-1, Int_t b6=-1, Int_t b7=-1) |
Add a split in the step sequence. The user should specify the number of branches in this split and the branch sequence. | |
void | AddSplit (UInt_t nbranches, const std::vector< UInt_t > &branch_seq) |
void | AddBranch (Int_t ibranch, const std::vector< UInt_t > &branch_seq, const std::string &alias="") |
void | DisableStep (const std::string &title, Int_t ID=-1) |
Replace a step (same structure of AddStep, but for only one step at once) More... | |
void | RemoveStep (const std::string &title, Int_t ID=-1) |
Disable step provided title and branch ID. | |
void | ReplaceStep (const std::string &old_title, Int_t ID, StepBase::TypeEnum type, const std::string &title, StepBase *step, bool cut_break=false) |
Replace step provided title and branch ID of the step to replace. | |
void | InsertStep (const std::string &previous_title, Int_t ID, StepBase::TypeEnum type, const std::string &title, StepBase *step, bool cut_break=false) |
void | CopySteps (SelectionBase &sel1, UInt_t branchID1, UInt_t first, UInt_t last, Int_t b0=-1, Int_t b1=-1, Int_t b2=-1, Int_t b3=-1, Int_t b4=-1, Int_t b5=-1, Int_t b6=-1, Int_t b7=-1) |
Copy a clone of the steps in range first-last from branch sbranch1 in selection ssel1 to sbranch2 in selection ssel2. | |
void | CopySteps (SelectionBase &sel1, const std::string &sbranch1, UInt_t first, UInt_t last, Int_t b0=-1, Int_t b1=-1, Int_t b2=-1, Int_t b3=-1, Int_t b4=-1, Int_t b5=-1, Int_t b6=-1, Int_t b7=-1) |
void | CopySteps (SelectionBase &sel1, UInt_t branchID1, UInt_t first, UInt_t last, const std::vector< UInt_t > &branch_seq2) |
void | CopySteps (SelectionBase &sel1, const std::string &sbranch1="trunk") |
Copy a clone of all the steps from branch sbranch1 in selection ssel1 to first branch in selection 2. | |
void | CopyStep (SelectionBase &sel1, const std::string &sbranch1, UInt_t istep, Int_t b0=-1, Int_t b1=-1, Int_t b2=-1, Int_t b3=-1, Int_t b4=-1, Int_t b5=-1, Int_t b6=-1, Int_t b7=-1) |
Copy a clone of the steps with number istep from branch sbranch1 in selection ssel1 to sbranch2 in selection ssel2. | |
void | CopyStep (SelectionBase &sel1, UInt_t istep, Int_t b0=-1, Int_t b1=-1, Int_t b2=-1, Int_t b3=-1, Int_t b4=-1, Int_t b5=-1, Int_t b6=-1, Int_t b7=-1) |
std::vector< StepBase * > | GetStepsInBranch (const std::vector< UInt_t > &branch_seq, UInt_t first=0, UInt_t last=NMAXSTEPS-1) const |
Get all steps in a given branch provided the branch sequence (vector of integers) | |
std::vector< StepBase * > | GetStepsInBranchWithDummy (const std::vector< UInt_t > &branch_seq, UInt_t first=0, UInt_t last=NMAXSTEPS-1) const |
Get all steps in a given branch provided the branch sequence (vector of integers) | |
std::vector< StepBase * > | GetStepsInBranch (const std::string &branch, UInt_t first=0, UInt_t last=NMAXSTEPS-1) const |
Get all steps in a given branch provided the branch alias. | |
std::vector< StepBase * > | GetStepsInBranch (UInt_t ID, UInt_t first=0, UInt_t last=NMAXSTEPS-1) const |
Get all steps in a given branch provided the branch uniqueID. | |
std::vector< StepBase * > | GetCutsInBranch (const std::string &branch) const |
Get all cuts in a given branch provided the branch alias. | |
std::vector< StepBase * > | GetCutsInBranch (UInt_t ID) const |
Get all cuts in a given branch provided the branch uniqueID. | |
StepBase * | GetLastStepInBranch (Int_t b0=-1, Int_t b1=-1, Int_t b2=-1, Int_t b3=-1, Int_t b4=-1, Int_t b5=-1, Int_t b6=-1, Int_t b7=-1) const |
Get the last step in a given branch provided the branch sequence (individual integers) | |
StepBase * | GetLastStepInBranch (const std::vector< UInt_t > &branch) const |
Get the last step in a given branch provided the branch sequence (vector of integers) | |
StepBase * | GetLastStepInBranch (const std::string &branch) const |
Get the last step in a given branch provided the branch alias. | |
StepBase * | GetStepInBranch (const std::vector< UInt_t > &branch_seq, UInt_t index) const |
Get step in a given branch provided the branch sequence (vector of integers) and the step index. | |
StepBase * | GetStepInBranch (const std::string &branch, UInt_t index) const |
Get step in a given branch provided the branch alias and the step index. | |
StepBase * | GetStepInBranch (UInt_t ID, UInt_t index) const |
Get step in a given branch provided the branch uniqueID and the step index. | |
std::string | ConvertBranchToString (const std::vector< UInt_t > &branch, Int_t upToSplit=-1) const |
Convert the branch sequence into a string. | |
std::vector< UInt_t > | ConvertBranch (Int_t b0=-1, Int_t b1=-1, Int_t b2=-1, Int_t b3=-1, Int_t b4=-1, Int_t b5=-1, Int_t b6=-1, Int_t b7=-1) const |
Convert the branch sequence of individual integers into a vector of integers. | |
void | SetBranchAlias (Int_t ID, const std::string &name, Int_t b0=-1, Int_t b1=-1, Int_t b2=-1, Int_t b3=-1, Int_t b4=-1, Int_t b5=-1, Int_t b6=-1, Int_t b7=-1) |
Set the branch alias and unique ID provided the branch sequence. | |
std::vector< UInt_t > | GetBranchSequence (const std::string &name) const |
Get the branch sequence for a specific branch alias. | |
std::vector< UInt_t > | GetBranchSequence (Int_t ID) const |
Get the branch sequence for a specific branch unique ID. | |
Int_t | GetBranchUniqueID (const std::string &name) const |
Gets the branch unique ID with a given alias. | |
std::string | GetBranchAlias (Int_t ID) const |
Gets the branch alias for a given branch unique ID. | |
bool | ApplySteps (AnaEventC &event, ToyBoxB &box, const std::string &branch, Int_t ifirst=0, Int_t ilast=NMAXSTEPS) |
Apply a range of steps in a branch. | |
bool | ApplySteps (AnaEventC &event, ToyBoxB &box, Int_t firstStepToApply) |
Apply all registered steps in a threadsafe way. | |
bool | GetCutPassed (Int_t icut, Int_t branch=0) const |
Return whether the specified cut was passed or not. | |
Int_t | GetAccumCutLevel (Int_t branch=0) const |
void | InitializeCutLevels () |
Reset all cuts to "not passed", and set the accumulated cut level to 0. | |
Int_t | GetMaxAccumCutLevel () const |
Get the maximum cut level for this event and the last processed toy. | |
Int_t | GetMaxAccumCutLevelForAllToys () const |
Get the maximum cut level for this event and all toys. | |
bool | PreSelectionPassed (const AnaEventC &event) |
Is the preselection passed in any of the branches. | |
void | SetPreSelectionAccumLevel (Int_t presel) |
Set the pre-selection accum level. | |
Int_t | GetPreSelectionAccumLevel () const |
Set the pre-selection accum level. | |
void | SetEnabledIndex (Int_t index) |
Set the Selection index. | |
Int_t | GetEnabledIndex () const |
Get the Selection index. | |
void | SetDetectorFV (SubDetId_h det, Int_t ibranch=-1) |
Set the detector in which the Fiducial Volume is defined. | |
SubDetId_h | GetDetectorFV (Int_t ibranch=0) const |
Get the detector in which the Fiducial Volume is defined. | |
EventBoxId_h | GetEventBoxId () const |
Returns the Id of the EventBox to be used in this selection. | |
bool | HasBranch (Int_t ibranch, const std::string &fromMethod="HasBranch") const |
Check the existence of branch. | |
UInt_t | GetNBranches () const |
Return the number of branches. | |
std::vector< std::string > | GetStepNames (Int_t ibranch=0) const |
Return all the names of the steps, in the order they were added. | |
std::vector< std::string > | GetCutNames (Int_t ibranch=0) const |
Return all the names of the cuts, in the order they were added. | |
StepBase * | GetStep (const std::string &title, Int_t ID=0) const |
Return an step provided the title and the Branch ID. | |
Int_t | GetCutNumber (const std::string &title, Int_t ID=0) const |
Return the cut number (starting at 0) corresponding to an step with a given title. | |
Int_t | GetStepNumber (const std::string &title, Int_t ID=0) const |
Return the step number (starting at 0) corresponding to an step with a given title. | |
UInt_t | GetNMaxCuts () const |
Return the number of steps in a given branch. More... | |
UInt_t | GetNCuts (Int_t branch) const |
Return the number of cuts in a given branch. More... | |
void | SetForceFillEventSummary (bool force) |
bool | GetForceFillEventSummary () const |
Returns the flag to fill the EventSummary even when the selection is not passed. | |
void | DumpBranches () const |
Dumps the list of branches. | |
void | DumpSteps (const std::string &branch="", bool onlycuts=false) const |
Print out the index, name and title of each step for a given branch (no argument for all branches) | |
void | DumpSteps (Int_t ID, bool onlycuts=false) const |
void | DumpCuts (Int_t branch=-1) const |
Print out the index, name and title of each cut for a given branch (no argument for all branches) | |
void | SetValidRunPeriods (std::string runPeriods) |
bool | IsValidRun (int runPeriod) const |
Method to see whether this selection should be applied to the given run period. | |
const ToyBoxB & | GetPreviousToyBox (const AnaEventC &event) const |
Get the ToyBox of the last processed toy for a particular event. | |
const ToyBoxB & | GetPreviousToyBox () const |
Get the ToyBox of the last processed toy (only for no MULTITHREAD) | |
ClassDef (SelectionBase, 1) | |
Protected Member Functions | |
void | AddBranchUniqueID (std::vector< StepBase *> &steps, UInt_t ibranch) |
Add a branch unique ID to all steps in that branch. | |
bool | ApplyStep (AnaEventC &event, ToyBoxB &box, const StepBase &step, Int_t branch=-1) |
bool | ApplyStepRecursive (AnaEventC &event, ToyBoxB &box, const StepBase &step, Int_t firstStepToApply) |
Apply all steps recursively provided the first step in a threadsafe way. | |
bool | CutPassed (bool passed, Int_t branch, ToyBoxB &box) |
bool | CutPassed (bool ok, const StepBase &step, ToyBoxB &box) |
Protected Attributes | |
Int_t | _selEnabledIndex |
The index of the selection in the selection manager (for enabled selections) | |
SubDetId_h | _detectorFV [NMAXBRANCHES] |
std::string | _name |
The name of the selection. | |
std::string | _title |
the nice name of the selection | |
bool | _enabled |
is this selection enabled ? | |
Int_t | _presel_accum_cut_level |
The preselection accum level. | |
bool | _cut_passed [NMAXBRANCHES][NMAXSTEPS] |
The cuts that were passed. | |
Int_t | _current_cut [NMAXBRANCHES] |
The current cut level. | |
std::vector< StepBase * > | _firstSteps |
The top level steps in the trunk. | |
std::vector< std::string > | _branchAlias |
Association between a branch unique ID (entry in vector) and branch alias. | |
std::vector< std::vector< UInt_t > > | _branchSequence |
Association between a branch unique ID (entry in vector) and branch sequence. | |
std::vector< UInt_t > | _nCutsInBranch |
Number of cuts in each branch. | |
std::vector< UInt_t > | _nEventsPassed |
Used for statistics. | |
int | _cut_passed_stats [NMAXBRANCHES][NMAXSTEPS] |
bool | _forceBreak |
bool | _forceFillEventSummary |
bool | _validRunPeriods [10] |
ToyBoxB ** | PreviousToyBox |
Array of pointers to the PreviousToyBox (for each event) | |
Int_t | _maxAccumLevelForAllToys |
This is the maximum accum level of any of the branches in all toys. | |
EventBoxId_h | _eventBoxId |
The ID of the EventBox to be used. | |
bool | _initialized |
Is this selection initialized ? | |
Base class for an event selection It should implement the methods
The main way you will interact with this class is using the AddStep() function
If your analysis only has a single "branch" to it, then adding cuts is very simple. All you have to do is define cuts that inherit from the CutBase base class, and add them using AddStep(Step type, "Pretty name", new YourNewCut());
You should add them in DefineSteps() method of your selection. The steps should be added in the order in which you call them. You can have up to NMAXSTEPS cuts. For example for the CC-Inclusive selection
AddStep(StepBase::kCut, "event quality", new EventQualityCut(), true); AddStep(StepBase::kCut, "> 0 tracks ", new TotalMultiplicityCut(), true); AddStep(StepBase::kAction, "find leading tracks",new FindLeadingTracksAction()); AddStep(StepBase::kAction, "find vertex", new FindVertexAction()); AddStep(StepBase::kCut, "quality+fiducial", new TrackQualityFiducialCut(), true); AddStep(StepBase::kAction, "find veto track", new FindVetoTrackAction()); AddStep(StepBase::kCut, "veto", new ExternalVetoCut()); AddStep(StepBase::kAction, "find oofv track", new FindOOFVTrackAction()); AddStep(StepBase::kCut, "External FGD1", new ExternalFGD1lastlayersCut()); AddStep(StepBase::kCut, "muon PID", new MuonPIDCut());
last "true" means the step sequence is broken if cut is not passed (default is "false") Cut branches
Your analysis can contain several branches that contain common steps. For example, CC0pi, CC1pi and CCNpi branches. You can have up to NMAXBRANCHES branches. There are a few subtleties to be aware of when using branches, which are best explained using the following example code, which would all appear in your yourSelection class. For the CC multi-pion selection Additional actions for the multi-pi selection.
AddStep(StepBase::kAction, "find_pions", new FindPionsAction()); AddStep(StepBase::kAction, "find_tpc1", new FindTPC1TracksAction()); Add a split to the trunk with 3 branches. AddSplit(3); First branch is for CC-0pi AddStep(0, StepBase::kCut, "CC-0pi", new NoPionCut()); Second branch is for CC-1pi AddStep(1, StepBase::kCut, "CC-1pi", new OnePionCut()); Third branch is for CC-Other AddStep(2, StepBase::kCut, "CC-Other", new OthersCut()); Set the branch aliases to the three branches SetBranchAlias(0,"CC-0pi",0); SetBranchAlias(1,"CC-1pi",1); SetBranchAlias(2,"CC-Other",2);
Definition at line 86 of file SelectionBase.hxx.
void SelectionBase::AddStep | ( | StepBase::TypeEnum | type, |
const std::string & | title, | ||
StepBase * | step, | ||
bool | cut_break = false |
||
) |
Add a user step to the selection. One should specify the branching sequence, the step type, the title and the cut_break (whether to break the step sequence quen a cut is not passed)
Definition at line 811 of file SelectionBase.cxx.
|
protected |
Apply the step. This is the important function that calls Apply() in the relevant step.
Definition at line 314 of file SelectionBase.cxx.
|
inlinevirtual |
This method is called after the systematic is applied (Apply). It should decide wheder the selection has to be redone or not.
Reimplemented in numuCC4piMultiPiFGD2Selection, numuCC4piMultiPiSelection, antiNueCCSelection, numuCC4piFGD2Selection, numuCC4piSelection, numuCC4piSelection, numuCCBwdSelection, numuCCSelection, numuCCFGD2Selection, antiNueCCFGD2Selection, gammaFGD2Selection, gammaSelection, nueCCFGD2Selection, numuBkgInAntiNuModeCCMultiPiFGD2Selection, numuBkgInAntiNuModeCCMultiTrackFGD2Selection, nueCCSelection, antiNumuCCMultiPiFGD2Selection, antiNumuCCSelection, numuCCMultiPiFGD2Selection, numuCCMultiPiSelection, antiNumuCCMultiTrackFGD2Selection, numuBkgInAntiNuModeCCFGD2Selection, antiNumuCCFGD2Selection, antiNumuCCMultiPiSelection, antiNumuCCMultiTrackSelection, numuBkgInAntiNuModeCCMultiPiSelection, numuBkgInAntiNuModeCCMultiTrackSelection, and numuBkgInAntiNuModeCCSelection.
Definition at line 134 of file SelectionBase.hxx.
|
protected |
Set whether the current cut was passed, and increment the current cut counter. Return value is the same as the input "passed" value. Calls the other CutPassed interface if "passed" is true.
Definition at line 449 of file SelectionBase.cxx.
Check whetehr a cut is passed and set the relevant all_cuts_passed field if it is not passed THis is the threadsafe version of the selection
Definition at line 428 of file SelectionBase.cxx.
void SelectionBase::DisableStep | ( | const std::string & | title, |
Int_t | ID = -1 |
||
) |
Replace a step (same structure of AddStep, but for only one step at once)
Remove a step Insert a step after the specified cut Disable step Disable step provided title and branch ID
Definition at line 622 of file SelectionBase.cxx.
|
inline |
Get the accumulated cut level - the maximum cut number for which all lower cut numbers were passed.
Definition at line 336 of file SelectionBase.hxx.
|
inline |
When using the framework by a fitter (i.e. BANFF) we want to break the step sequence when a cut is not passed, that is we are interested about events that pass all cuts. In this case _forceBreak should be true. On the other hand it should be false in highland since we might be interested about events that didn't pass a specific cut.
Definition at line 172 of file SelectionBase.hxx.
UInt_t SelectionBase::GetNCuts | ( | Int_t | branch | ) | const |
Return the number of cuts in a given branch.
Return the number of cuts that have been added for a given branch
Definition at line 505 of file SelectionBase.cxx.
UInt_t SelectionBase::GetNMaxCuts | ( | ) | const |
Return the number of steps in a given branch.
Return the number of cuts that have been added.
Return the number of cuts of the branch with more cuts
Definition at line 492 of file SelectionBase.cxx.
|
inline |
By default EventSummary class is created and filled when the selection is passed. But this might be necessary also for events not passing the selection The user can force the EventSummary to be filled always.
Definition at line 405 of file SelectionBase.hxx.
void SelectionBase::SetValidRunPeriods | ( | std::string | runPeriods | ) |
Set the Run periods (defined in AnalysisUtils) for which this selection is valid By default all run periods are valid
Definition at line 1430 of file SelectionBase.cxx.
|
protected |
When using the framework by a fitter (i.e. BANFF) we want to break the step sequence when a cut is not passed, that is we are interested about events that pass all cuts. In this case _forceBreak should be true. On the other hand it should be false in highland since we might be interested about events that didn't pass a specific cut.
Definition at line 504 of file SelectionBase.hxx.
|
protected |
By default EventSummary class is created and filled when the selection is passed. But this might be necessary also for events not passing the selection The user can force the EventSummary to be filled always.
Definition at line 508 of file SelectionBase.hxx.
|
protected |
Boolean array to store valid run periods for this selection Should use enumeration in future to set size of this
Definition at line 512 of file SelectionBase.hxx.