HighLAND
Public Member Functions | Protected Attributes | List of all members
SelectionManager Class Reference

#include <SelectionManager.hxx>

Inheritance diagram for SelectionManager:
HLClonesArray

Public Member Functions

SelectionBaseGetSelection (const std::string &name, bool print_error=true)
 Return the selection that was registered with the given name. NULL if it does not exist.
 
SelectionBaseGetSelection (Int_t, bool print_error=true)
 Return the selection that was registered with the given index. NULL if it does not exist.
 
void AddSelection (const std::string &name, const std::string &title, SelectionBase *sel, Int_t presel=-1)
 Add a user selection to the selection manager.
 
bool ApplySelection (const std::string &name, AnaEventC &event, bool &redo)
 Apply the selection that was registered with the given name.
 
std::vector< SelectionBase * > & GetSelections ()
 Return the map of selections.
 
void DisableSelection (const std::string &sel)
 Disable a selection.
 
void EnableSelection (const std::string &sel)
 Enable a selection.
 
void ReadSelections (const std::string &file)
 
void DumpSelections ()
 Print out the index, name and title of each selection for a given branch (no argument for all branches)
 
void PrintStatistics ()
 Print #events passing cuts. More...
 
UInt_t GetNEnabledSelections ()
 Returns the number of enabled selections.
 
UInt_t GetNMaxBranches ()
 Returns the maximum number of branches in all selections.
 
UInt_t GetNMaxCuts ()
 Returns the maximum number of cuts in all selections.
 
void SetForceFillEventSummary (bool force)
 
void SetValidRunPeriods (const std::string &ssel1, const std::string validRunPeriods)
 Method to set the valid run periods for this selection (e.g. Anti-neutrino selections should only be valid when looking at anti-neutrino data or MC)
 
bool PreSelectionPassed (const AnaEventC &event)
 Chek if preselection cuts have been passed;.
 
void InitializeEvent (AnaEventC &event)
 Initialize the EventBox for all enabled selections.
 
void CreateToyBoxArray (Int_t nevents)
 Create the array of PreviousToyBox for all enabled selections.
 
void FinalizeEvent (const AnaEventC &event)
 Delete the PreviousToyBox pointer for the last toy of the event for all enabled selections.
 
- Public Member Functions inherited from HLClonesArray
 HLClonesArray (const std::string &tree_name, const std::string &tcarray_name, const std::string &class_name, const UInt_t size)
 
void ReadClonesArray (const std::string &file)
 
void WriteClonesArray (TTree &tree)
 
Int_t & GetNObjects ()
 Return the number of steps that have been added.
 
TClonesArray * GetClonesArray ()
 
const std::string & GetClonesArrayName () const
 Return the name of the TClonesArray.
 
const std::string & GetTreeName () const
 Return the name of the tree.
 

Protected Attributes

std::vector< SelectionBase * > _eventSelections
 Internal storage fo the selections that were added.
 
UInt_t _nMaxBranches
 maximum number of branches
 
UInt_t _nMaxCuts
 maximum number of cuts
 
UInt_t _nEnabledSelections
 number of enabled selections
 
- Protected Attributes inherited from HLClonesArray
TChain * _chain
 TChain used to read the "config" tree from the output file.
 
Int_t _NObjects
 The number of steps that were added.
 
TClonesArray * _objects
 
std::string _tcArrayName
 Name of the TClonesArray in the tree.
 
std::string _treeName
 Name of the Tree.
 
std::string _fileName
 Name of the last file read.
 

Detailed Description

This class holds a collection of SelectionBase. It allows us to have multiple selections

Definition at line 10 of file SelectionManager.hxx.

Member Function Documentation

§ PrintStatistics()

void SelectionManager::PrintStatistics ( )

Print #events passing cuts.

Loop over selections

Definition at line 200 of file SelectionManager.cxx.

200  {
201 //********************************************************************
202 
203  /// Loop over selections
204  for (std::vector<SelectionBase*>::iterator it = _eventSelections.begin(); it!=_eventSelections.end(); it++){
205  if ((*it)->IsEnabled())
206  (*it)->PrintStatistics();
207  }
208 }
std::vector< SelectionBase * > _eventSelections
Internal storage fo the selections that were added.

§ ReadSelections()

void SelectionManager::ReadSelections ( const std::string &  file)

Read the "config" tree from the given file, to read the selections that were used when running the analysis. This is used so we can access the selections in the DrawingTools.

Definition at line 139 of file SelectionManager.cxx.

139  {
140 //********************************************************************
141 
142  // Reset the vectors
143  _eventSelections.clear();
144 
145  _nMaxCuts=0;
146  _nMaxBranches=0;
148 
149  // Read the selections from the clones array in the input file
150  ReadClonesArray(file);
151 
152  for (int i=0;i<_NObjects;i++){
153  SelectionBase* sel = (SelectionBase*)(*_objects)[i];
154  _eventSelections.push_back(sel);
155  if (sel->IsEnabled()){
156 
157  // computes the maximum number of cuts and branches for all added selections
159  if (sel->GetNMaxCuts() >_nMaxCuts) _nMaxCuts = sel->GetNMaxCuts();
160 
161  // recompute the number of enabled selections
163  }
164  }
165 
166  // int nselections[NMAXBRANCHES]={0};
167 
168 }
UInt_t _nEnabledSelections
number of enabled selections
UInt_t GetNMaxCuts() const
Return the number of steps in a given branch.
UInt_t _nMaxBranches
maximum number of branches
UInt_t _nMaxCuts
maximum number of cuts
std::vector< SelectionBase * > _eventSelections
Internal storage fo the selections that were added.
Int_t _NObjects
The number of steps that were added.
TClonesArray * _objects
UInt_t GetNBranches() const
Return the number of branches.

§ SetForceFillEventSummary()

void SelectionManager::SetForceFillEventSummary ( bool  force)

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. This function enables/disables this option for all selections in the manager

Definition at line 247 of file SelectionManager.cxx.

247  {
248 //********************************************************************
249 
250  for (std::vector<SelectionBase*>::iterator it=_eventSelections.begin();it!=_eventSelections.end();it++){
251  (*it)->SetForceFillEventSummary(force);
252  }
253 }
std::vector< SelectionBase * > _eventSelections
Internal storage fo the selections that were added.

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