HighLAND
HighlandInputManager.hxx
1 #ifndef HighlandInputManager_h
2 #define HighlandInputManager_h
3 
4 #include "InputManager.hxx"
5 //#include "BaseDataClasses.hxx"
6 
7 /// class to handle correctly any input file and convert it into the
8 /// analysis structure. It contains a collection of InputConverters, and
9 /// automatically selects the correct converter based on the file type.
10 ///
11 /// The manager
12 /// keeps track of the current active spill, and provides three copies:
13 /// - RawSpill: the spill as read in from the input file.
14 /// - CorrectedSpill: for applying corrections to.
15 /// - Spill: for applying corrections and systematics to.
16 
18  public :
19 
20  /// Constructor
22 
23  /// Destructor, which cleans up the spills.
25 
26  /// Reset the converters and the UniqueID
27  void Reset();
28 
29  /// clean up the remaining pointers to the spills.
30  void DeleteSpill();
31 
32  /// Read one or several entries in the input tree(s) to fill a raw AnaSpill, and
33  /// sets the CorrectedSpill and Spill as copies of it (to be manipulated
34  /// later).
35  /// The argument entry (the entry number in the input tree)
36  /// will be modified inside the method by the specific converter (hence the non-cont reference).
37  /// The way entry is modified will depend on whether the input file is SPILL based
38  /// (every call to this method will increment by one the argument entry) or
39  /// EVENT based (entry number will be incremented in several units to account for
40  /// several events -- bunches -- in the same spill). At the moment oaAnalysis and MiniTree are SPILL based
41  /// while FlatTree is EVENT based.
42  ///
43  /// Examples on how to use this method are available in highland2/highlandTools/vXrY/src/AnalysisLoop.cxx,
44  /// and highland2/highlandTools/vXrY/src/SimpleLoopBase.cxx. Just search for LoadSpill in those files.
45  ///
46  /// This method Returns whether the event was successfully filled.
47  bool LoadSpill(Long64_t& entry);
48 
49  /// Whether an OriginalTree converter has been selected.
50  bool InputIsOriginalTree() { return (_selected->Name() == "OriginalTree" || _selected->Name() == "oaAnalysisTree"); }
51 
52  //-------------------------------
53 
54  /// Get the current spill (constant, as read in from the input file).
55  const AnaSpillC& GetRawSpill(){return *_RawSpill;}
56 
57  /// Set the current spill (constant, as read in from the input file).
58  void SetRawSpill(AnaSpillC* RawSpill){_RawSpill = RawSpill;}
59 
60  /// Get the current bunch (constant, as read in from the input file).
61  const AnaBunchC& GetRawBunch(){return *_RawSpill->Bunches[_currentBunch];}
62 
63  /// Get the current bunch (to have corrections applied to it).
64  AnaBunchC& GetCorrectedBunch(){return *_CorrectedSpill->Bunches[_currentBunch];}
65 
66  /// Get the current bunch (to have corrections and systematics applied to it).
67  AnaBunchC& GetBunch(){return *_Spill->Bunches[_currentBunch];}
68 
69  /// Set the current bunch index.
70  void SetCurrentBunch(int ibunch){_currentBunch = ibunch;}
71 
72  /// Create the event
73  // AnaEventC* MakeEvent();
74 
75  /// Reset the main spill to the raw spill. This removes all the variations
76  /// applied by the systematics.
77  void ResetSpillToRaw();
78 
79  private:
80 
81  /// The current raw spill.
82  AnaSpillC* _RawSpill;
83 
84  /// The current active bunch in the current spill.
85  int _currentBunch;
86 
87 };
88 
89 #endif
90 
91 
void Reset()
Reset the converters and the UniqueID.
AnaBunchC & GetCorrectedBunch()
Get the current bunch (to have corrections applied to it).
AnaSpillC * _Spill
The current spill with corrections and systematics.
std::vector< AnaBunchC * > Bunches
The reconstructed objects, split into timing bunches.
virtual ~HighlandInputManager()
Destructor, which cleans up the spills.
void SetCurrentBunch(int ibunch)
Set the current bunch index.
void DeleteSpill()
clean up the remaining pointers to the spills.
const std::string & Name() const
Return the name of this converter.
HighlandInputManager()
Constructor.
AnaBunchC & GetBunch()
Get the current bunch (to have corrections and systematics applied to it).
void ResetSpillToRaw()
Create the event.
const AnaBunchC & GetRawBunch()
Get the current bunch (constant, as read in from the input file).
const AnaSpillC & GetRawSpill()
Get the current spill (constant, as read in from the input file).
InputConverter * _selected
Selected converter.
AnaSpillC * _CorrectedSpill
The current corrected spill.
bool LoadSpill(Long64_t &entry)
bool InputIsOriginalTree()
Whether an OriginalTree converter has been selected.
void SetRawSpill(AnaSpillC *RawSpill)
Set the current spill (constant, as read in from the input file).