HighLAND
Public Types | Public Member Functions | Protected Attributes | List of all members
AnalysisAlgorithm Class Referenceabstract

#include <AnalysisAlgorithm.hxx>

Inheritance diagram for AnalysisAlgorithm:
baseAnalysis baseP0DAnalysis baseTrackerAnalysis p0dExampleAnalysis antiNumuCCAnalysis gammaAnalysis nueCCAnalysis numuBkgInAntiNuModeAnalysis numuCC4piAnalysis numuCCAnalysis numuCCMultiPiAnalysis numuCCMultiTargetAnalysis p0dNumuCCAnalysis p0dNumuCCQEAnalysis tutorialAnalysis useTutorialAnalysis

Public Types

enum  enumAnalysisPoint {
  kInitialize =0, kDefineProductions, kDefineInputConverters, kDefineSelections,
  kDefineCorrections, kDefineSystematics, kDefineConfigurations, kDefineMicroTrees,
  kDefineTruthTree, kFillConfigTree, kInitializeSpill, kInitializeBunch,
  kInitializeConfiguration, kInitializeToy, kInitializeSelection, kFinalizeSelection,
  kFinalizeToy, kFillToyVarsInMicroTrees, kFinalizeConfiguration, kFillCategories,
  kFillMicroTrees, kFinalizeBunch, kFillTruthTree, kFinalizeSpill,
  kFinalize
}
 
enum  enumStandardMicroTrees_AnalysisAlgorithm {
  firstCategory = OutputManager::enumStandardMicroTreesLast_OutputManager+1, firstCategoryCounter = firstCategory+NMAXCATEG, entry = firstCategoryCounter + NMAXCATEGCOUNTERS, toy_ref,
  toy_index, toy_par_weight, toy_par_var, NWEIGHTSYST,
  weight_syst, weight_syst_total, weight_corr, weight_corr_total,
  redo, accum_level, first_cut, last_cut =first_cut+NMAXSTEPS,
  enumStandardMicroTreesLast_AnalysisAlgorithm
}
 
enum  enumConfigTree_AnalysisAlgorithm {
  SoftwareVersion =0, HOSTNAME, CMTPATH, INPUTFILE,
  OriginalFile, MinAccumLevelToSave, enumConfigTreeLast_AnalysisAlgorithm
}
 

Public Member Functions

 AnalysisAlgorithm (AnalysisAlgorithm *ana=NULL)
 
virtual void Finalize ()
 [AnalysisAlgorithm_optional]
 
virtual bool InitializeSpill ()
 
virtual void FinalizeSpill ()
 
virtual void InitializeBunch ()
 
virtual void FinalizeBunch ()
 
virtual void InitializeConfiguration ()
 
virtual bool FinalizeConfiguration ()
 
virtual void InitializeToy ()
 
virtual void FinalizeToy ()
 
virtual void InitializeSelection (const SelectionBase &)
 
virtual void FinalizeSelection (const SelectionBase &)
 
virtual void FillCategories ()
 
virtual void FillConfigTree ()
 
virtual AnaEventCMakeEvent ()=0
 [AnalysisAlgorithm_optional] More...
 
virtual bool Initialize ()=0
 [AnalysisAlgorithm_mandatory]
 
virtual void DefineProductions ()=0
 
virtual void DefineInputConverters ()=0
 
virtual void DefineSelections ()=0
 
virtual void DefineCorrections ()=0
 
virtual void DefineSystematics ()=0
 
virtual void DefineConfigurations ()=0
 
virtual void DefineMicroTrees (bool addBase=true)=0
 
virtual void DefineTruthTree ()=0
 
virtual void FillMicroTrees (bool addBase=true)=0
 
virtual void FillToyVarsInMicroTrees (bool addBase=true)=0
 
virtual void FillTruthTree ()=0
 
void FinalizeToyBase ()
 [AnalysisAlgorithm_mandatory] More...
 
void SetFillSuccessOnly (bool fill)
 Fill trees and process weight systematics only when any of the branches is successful.
 
bool GetFillSuccessOnly ()
 
void SetInitializeTrees (bool ini)
 Initialize trees at the beginning of each configuration.
 
bool GetInitializeTrees ()
 
void SetMinAccumCutLevelToSave (Int_t level)
 Set the minimum accumulated cut level to save an event into the micro-tree.
 
Int_t GetMinAccumCutLevelToSave ()
 Get the minimum accumulated cut level to save an event into the micro-tree.
 
bool CheckAccumLevelToSave ()
 Check if the condition is fulfilled for at least one branch.
 
void SetEvent (AnaEventC *event)
 Set the current event into the algorithm and all used algorithms.
 
void SetToyBox (const ToyBoxB *box, Int_t isel=0)
 Set the current box into the algorithm and all used algorithms. This is useful when one Analysis uses another.
 
void UseAnalysis (AnalysisAlgorithm *ana)
 Used a given analysis.
 
void SetSelectedSelection (Int_t sel)
 Select one of the selections.
 
void SetVersionCheck (bool check)
 Set version checking.
 
void SetAnalysisPoint (enumAnalysisPoint point)
 Set the point of the analysis at which AnalysisLoop is.
 
HighlandInputManagerinput ()
 
SelectionManagersel ()
 
CorrectionManagercorr ()
 
SystematicManagersyst ()
 
EventWeightManagereweight ()
 
EventVariationManagerevar ()
 
OutputManageroutput ()
 
ConfigurationManagerconf ()
 
CategoryManagercat ()
 
DocStringManagerdoc ()
 
virtual const ToyBoxBboxB (Int_t isel=-1) const
 

Protected Attributes

HighlandInputManager_inputManager
 Input Manager: access to the current Event.
 
CorrectionManager_corrManager
 Correction Manager.
 
SystematicManager_systManager
 Systematics Manager.
 
EventWeightManager_weightManager
 EventWeight Manager.
 
EventVariationManager_variationManager
 EventVariation Manager.
 
OutputManager_outputManager
 Output Manager.
 
ConfigurationManager_confManager
 Configuration Manager.
 
SelectionManager_selManager
 
CategoryManager_categManager
 
DocStringManager_docManager
 
const ToyBoxB_box [NMAXSELECTIONS]
 The analysis box.
 
Int_t _min_accum_cut_level
 the minimum accumulated cut level to save an event into the micro-tree
 
bool _fillSuccessOnly
 Fill trees and process weight systematics only when any of the branches is succesful.
 
bool _initializeTrees
 Initialize trees at the beginning of each configuration.
 
AnaEventC_event
 The current event.
 
std::vector< AnalysisAlgorithm * > _usedAnalyses
 The Vector of used analysis.
 
Int_t _selectedSelection
 The selected selection.
 
bool _setMethodCalled
 Boolean parameter to know whether nny of the methods that sets things into used analysis has been called.
 
bool _versionCheck
 
enumAnalysisPoint _analysisPoint
 

Detailed Description

This class provides a base for user analyses. It handles many common functions, and provides a structure so that users don't have to write too much "boiler-plate" code.

User analyses should inherit from this class.

Definition at line 22 of file AnalysisAlgorithm.hxx.

Constructor & Destructor Documentation

§ AnalysisAlgorithm()

AnalysisAlgorithm::AnalysisAlgorithm ( AnalysisAlgorithm ana = NULL)

Constructor, which instantiates the necessary converters for converting input files to the AnaSpill format.

Boolean parameter to know whether nny of the methods that sets things into used analysis has been called

Version check enabled by default

Definition at line 7 of file AnalysisAlgorithm.cxx.

7  {
8 //********************************************************************
9 
10  if (ana){
11  _inputManager = &(ana->input());
12  _selManager = &(ana->sel());
13  _corrManager = &(ana->corr());
14  _systManager = &(ana->syst());
15  _weightManager = &(ana->eweight());
16  _variationManager = &(ana->evar());
17  _outputManager = &(ana->output());
18  _confManager = &(ana->conf());
19  _categManager = &(ana->cat());
20  _docManager = &(ana->doc());
21  }
22  else{
24  _selManager = new SelectionManager();
31  _categManager = new CategoryManager();
32  _docManager = new DocStringManager();
33  }
34 
35  _outputManager->SetDocStringManager(_docManager);
36 
37  anaUtils::_categ = &cat();
38 
39  for (UInt_t i=0;i<NMAXSELECTIONS;i++)
40  _box[i] = NULL;
41 
43 
44  // Minimum cut level to save the event. By default save everything
46 
47  // By default save events that don't pass the selection
48  _fillSuccessOnly=false;
49 
50  // By default initialize micro-trees at the beginning of each configuration
51  _initializeTrees=true;
52 
53  /// Boolean parameter to know whether nny of the methods that sets things into used analysis has been called
54  _setMethodCalled=false;
55 
56 
57  /// Version check enabled by default
58  _versionCheck = true;
59 }
EventVariationManager * _variationManager
EventVariation Manager.
ConfigurationManager * _confManager
Configuration Manager.
bool _setMethodCalled
Boolean parameter to know whether nny of the methods that sets things into used analysis has been cal...
Int_t _selectedSelection
The selected selection.
const ToyBoxB * _box[NMAXSELECTIONS]
The analysis box.
OutputManager * _outputManager
Output Manager.
HighlandInputManager * _inputManager
Input Manager: access to the current Event.
The maximum number of systematics that is supported.
bool _fillSuccessOnly
Fill trees and process weight systematics only when any of the branches is succesful.
CorrectionManager * _corrManager
Correction Manager.
SystematicManager * _systManager
Systematics Manager.
Int_t _min_accum_cut_level
the minimum accumulated cut level to save an event into the micro-tree
EventWeightManager * _weightManager
EventWeight Manager.
bool _initializeTrees
Initialize trees at the beginning of each configuration.

Member Function Documentation

§ FinalizeToyBase()

void AnalysisAlgorithm::FinalizeToyBase ( )

[AnalysisAlgorithm_mandatory]

Finalize toy

Definition at line 184 of file AnalysisAlgorithm.cxx.

184  {
185 //********************************************************************
186 
187  // This method Sets the appropriate ToyBox to be used when filling the Micro-trees.
188  // If any of the selections is succesfull chose the first found
189  // If not chose the one with higher accum_level
190 
191  static bool first = true;
192 
193  Int_t maxAccumLevel=-1;
194  bool found=false;
195 
196  for (std::vector<SelectionBase*>::iterator it=sel().GetSelections().begin();it!=sel().GetSelections().end();it++){
197  SelectionBase* selec = *it;
198  if (!selec->IsEnabled()) continue;
199 
200  Int_t isel = selec->GetEnabledIndex();
201 
202  // Get the ToyBox of the previous Toy
203  const ToyBoxB& box = selec->GetPreviousToyBox();
204 
205  if (first){
206  // Set the box into this and all used algorithms. Only the first time since the Box is always the same for a given selection
207  SetToyBox(&box,isel);
208  }
209 
210  if (!found){
211  if (box.SuccessfulBranch>-1){
212  SetSelectedSelection(isel);
213  found=true;
214  }
215  else if (selec->GetMaxAccumCutLevel()> maxAccumLevel){
216  SetSelectedSelection(isel);
217  maxAccumLevel = selec->GetMaxAccumCutLevel();
218  }
219  }
220  else if (box.SuccessfulBranch>-1){
221  std::cout << "AnalysisAlgorithm::FinalizeToyBase(). Selections are not mutually exclusive !!! Run/Subrun/Event/Bunch "
223  << " passing selection '" << selec->Name() << ", was also successfull in selection '" << sel().GetSelection(_selectedSelection)->Name() << "'."
224  << " Results for first selection being passed will be saved in micro-trees for this event. " << std::endl;
225  if (!_allowNonExclusiveSelections){
226  std::cout << "Non exclusive selections are in general problematic. THE PROGRAM WILL STOP NOW !!!!" << std::endl;
227  std::cout << "Set '_allowNonExclusiveSelections=true' at the begining of highlandTools/vXrY/src/AnalysisAlgorithm.cxx to allow non-exclusive selections" << std::endl;
228  exit(1);
229  }
230  }
231 
232  }
233  first = false;
234 }
void SetSelectedSelection(Int_t sel)
Select one of the selections.
const std::string & Name() const
Return the name of this selection.
void SetToyBox(const ToyBoxB *box, Int_t isel=0)
Set the current box into the algorithm and all used algorithms. This is useful when one Analysis uses...
Int_t _selectedSelection
The selected selection.
const ToyBoxB & GetPreviousToyBox(const AnaEventC &event) const
Get the ToyBox of the last processed toy for a particular event.
std::vector< SelectionBase * > & GetSelections()
Return the map of selections.
AnaEventC * _event
The current event.
Int_t SuccessfulBranch
The branch that is successful for this toy in the selection this ToyBox belongs to.
Definition: ToyBoxB.hxx:46
SelectionBase * GetSelection(const std::string &name, bool print_error=true)
Return the selection that was registered with the given name. NULL if it does not exist...
virtual std::string GetEventInfoString() const
User-frienly method to get event info (run,subrun,etc)
Int_t GetMaxAccumCutLevel() const
Get the maximum cut level for this event and the last processed toy.
Int_t GetEnabledIndex() const
Get the Selection index.

§ MakeEvent()

virtual AnaEventC* AnalysisAlgorithm::MakeEvent ( )
pure virtual

[AnalysisAlgorithm_optional]

Create the appropriate event time from an Spill and a Bunch in that spill

Implemented in baseAnalysis, and p0dExampleAnalysis.


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