1 |
mocchiut |
1.1 |
/** |
2 |
|
|
* \file CaloEnergy.h |
3 |
|
|
* \authors Emiliano Mocchiutti & Giovanna Jerse |
4 |
|
|
*/ |
5 |
|
|
#ifndef caloenergy_h |
6 |
|
|
#define caloenergy_h |
7 |
|
|
|
8 |
|
|
#include <PamLevel2.h> |
9 |
|
|
|
10 |
|
|
#include <TTree.h> |
11 |
|
|
#include <TFriendElement.h> |
12 |
|
|
#include <TChain.h> |
13 |
|
|
#include <TFile.h> |
14 |
|
|
#include <TList.h> |
15 |
|
|
#include <TKey.h> |
16 |
|
|
#include <TSystemFile.h> |
17 |
|
|
#include <TSystemDirectory.h> |
18 |
|
|
#include <TSQLServer.h> |
19 |
mocchiut |
1.6 |
|
20 |
mocchiut |
1.4 |
#include <CaloPreSampler.h> |
21 |
mocchiut |
1.6 |
#include <CaloProfile.h> |
22 |
mocchiut |
1.1 |
|
23 |
|
|
#include <iostream> |
24 |
|
|
|
25 |
|
|
using namespace std; |
26 |
|
|
|
27 |
|
|
/** |
28 |
|
|
* |
29 |
|
|
*/ |
30 |
|
|
class CaloEnergy : public TObject { |
31 |
|
|
|
32 |
|
|
private: |
33 |
|
|
// |
34 |
mocchiut |
1.5 |
PamLevel2 *L2; ///< PamLevel2 object |
35 |
mocchiut |
1.4 |
Bool_t debug; ///< debug flag |
36 |
mocchiut |
1.1 |
// |
37 |
|
|
// needed to avoid reprocessing the same event over and over to obtain the variables |
38 |
|
|
// |
39 |
mocchiut |
1.4 |
UInt_t OBT; ///< CPU OBT |
40 |
|
|
UInt_t PKT; ///< CPU packet number |
41 |
|
|
UInt_t atime; ///< event absolute time |
42 |
|
|
TString sntr; ///< string containing the list of section the user want to process |
43 |
|
|
UInt_t AOBT; ///< CPU OBT |
44 |
|
|
UInt_t APKT; ///< CPU packet number |
45 |
|
|
UInt_t aatime;///< event absolute time |
46 |
|
|
TString asntr;///< string containing the list of section the user want to process |
47 |
|
|
// |
48 |
|
|
Float_t fM; ///< margin in the strip direction |
49 |
|
|
Float_t fM1; ///< margin along the strip reading direction |
50 |
|
|
Int_t fPl; ///< number of dE/dx measurements over the maximum that are used to find the energy |
51 |
|
|
Float_t fConv_rxe; ///< MIP - energy conversion factor for section XE |
52 |
|
|
Float_t fConv_rxo; ///< MIP - energy conversion factor for section XO |
53 |
|
|
Float_t fConv_rye; ///< MIP - energy conversion factor for section YE |
54 |
|
|
Float_t fConv_ryo; ///< MIP - energy conversion factor for section YO |
55 |
|
|
Bool_t fLong; ///< if true use the integral of the longitudinal profile to measure the energy (NOT IMPLEMENTED YET), default FALSE |
56 |
|
|
// |
57 |
|
|
Float_t fEnergyxe; ///< Energy as measured by section XE |
58 |
|
|
Float_t fEnergyxo; ///< Energy as measured by section XO |
59 |
|
|
Float_t fEnergyye; ///< Energy as measured by section YE |
60 |
|
|
Float_t fEnergyyo; ///< Energy as measured by section YO |
61 |
|
|
Float_t fEnergy; ///< Energy as measured by the average of the used section in "Independent mode" or energy as measured by the used section in "Coherent mode" |
62 |
|
|
Float_t fCount; ///< Number of sections inside the acceptance (only the section given by the user are checked) |
63 |
|
|
Int_t fMax_planexe; ///< plane of maximum energy release (independent mode) or last plane used for energy measurement (coherent mode) for section XE |
64 |
|
|
Int_t fMax_planexo; ///< plane of maximum energy release (independent mode) or last plane used for energy measurement (coherent mode) for section XO |
65 |
|
|
Int_t fMax_planeyo; ///< plane of maximum energy release (independent mode) or last plane used for energy measurement (coherent mode) for section YO |
66 |
|
|
Int_t fMax_planeye; ///< plane of maximum energy release (independent mode) or last plane used for energy measurement (coherent mode) for section YE |
67 |
|
|
Float_t fMax_plane; ///< average max plane [0,11] (independent mode) or last plane for energy measurement [0,43] (coherent mode) |
68 |
|
|
// |
69 |
|
|
Float_t fXOen_maxplane; ///< total energy [MIP] used for energy determination as given by section XO |
70 |
|
|
Float_t fYOen_maxplane; ///< total energy [MIP] used for energy determination as given by section YO |
71 |
|
|
Float_t fXEen_maxplane; ///< total energy [MIP] used for energy determination as given by section XE |
72 |
|
|
Float_t fYEen_maxplane; ///< total energy [MIP] used for energy determination as given by section YE |
73 |
|
|
// |
74 |
mocchiut |
1.6 |
Float_t xomax_en; ///< energy at plane of maximum of section XO |
75 |
|
|
Float_t xemax_en; ///< energy at plane of maximum of section XE |
76 |
|
|
Float_t yomax_en; ///< energy at plane of maximum of section YO |
77 |
|
|
Float_t yemax_en; ///< energy at plane of maximum of section YE |
78 |
|
|
// |
79 |
|
|
// |
80 |
mocchiut |
1.4 |
Float_t xe1; ///< position of strip 1 section XE |
81 |
|
|
Float_t xe2; ///< position of strip 32 section XE |
82 |
|
|
Float_t xe3; ///< position of strip 33 section XE |
83 |
|
|
Float_t xe4; ///< position of strip 64 section XE |
84 |
|
|
Float_t xe5; ///< position of strip 65 section XE |
85 |
|
|
Float_t xe6; ///< position of strip 96 section XE |
86 |
|
|
// Float_t z1; |
87 |
|
|
Float_t yo1; ///< position of strip 1 section YO |
88 |
|
|
Float_t yo2; ///< position of strip 32 section YO |
89 |
|
|
Float_t yo3; ///< position of strip 33 section YO |
90 |
|
|
Float_t yo4; ///< position of strip 64 section YO |
91 |
|
|
Float_t yo5; ///< position of strip 65 section YO |
92 |
|
|
Float_t yo6; ///< position of strip 96 section YO |
93 |
|
|
// Float_t z2; |
94 |
|
|
Float_t xo1; ///< position of strip 1 section XO |
95 |
|
|
Float_t xo2; ///< position of strip 32 section XO |
96 |
|
|
Float_t xo3; ///< position of strip 33 section XO |
97 |
|
|
Float_t xo4; ///< position of strip 64 section XO |
98 |
|
|
Float_t xo5; ///< position of strip 65 section XO |
99 |
|
|
Float_t xo6; ///< position of strip 96 section XO |
100 |
|
|
// Float_t z3; |
101 |
|
|
Float_t ye1; ///< position of strip 1 section YE |
102 |
|
|
Float_t ye2; ///< position of strip 32 section YE |
103 |
|
|
Float_t ye3; ///< position of strip 33 section YE |
104 |
|
|
Float_t ye4; ///< position of strip 64 section YE |
105 |
|
|
Float_t ye5; ///< position of strip 65 section YE |
106 |
|
|
Float_t ye6; ///< position of strip 96 section YE |
107 |
|
|
// Float_t z4; |
108 |
mocchiut |
1.8 |
Float_t track_coordx[22][2]; |
109 |
|
|
Float_t track_coordy[22][2]; |
110 |
|
|
// |
111 |
mocchiut |
1.4 |
Float_t trk_z[22][2]; ///< Z position of calorimeter planes |
112 |
|
|
Float_t en; ///< energy [mip] for decodeestrip |
113 |
|
|
Int_t view; ///< view for decodeestrip |
114 |
|
|
Int_t plane; ///< plane for decodeestrip |
115 |
|
|
Int_t strip; ///< strip for decodeestrip |
116 |
|
|
Int_t fRad; ///< Radius [strip] of the cylinder used to integrate the energy along the track, if negative radius is inf (the whole plane is used). Default: -1 |
117 |
|
|
Int_t fNumSec; ///< Number of sections given by the user |
118 |
|
|
Float_t energyxe; ///< 11 planes detected energy [MIP] for section XE |
119 |
|
|
Float_t energyyo; ///< 11 planes detected energy [MIP] for section YO |
120 |
|
|
Float_t energyxo; ///< 11 planes detected energy [MIP] for section XO |
121 |
|
|
Float_t energyye; ///< 11 planes detected energy [MIP] for section YE |
122 |
|
|
Float_t en_xep[11]; ///< detected energy [MIP] for each plane of section XE |
123 |
|
|
Float_t en_yop[11]; ///< detected energy [MIP] for each plane of section YO |
124 |
|
|
Float_t en_xop[11]; ///< detected energy [MIP] for each plane of section XO |
125 |
|
|
Float_t en_yep[11]; ///< detected energy [MIP] for each plane of section YE |
126 |
|
|
Float_t enstrip[2][22][96]; ///< detected energy [MIP] for each strip of calorimeter |
127 |
mocchiut |
1.9 |
// |
128 |
|
|
Float_t encol[2][3]; |
129 |
|
|
Int_t fColumn; |
130 |
mocchiut |
1.6 |
// |
131 |
|
|
Float_t x0max; ///< plane of maximum given externally (only test purpose) |
132 |
mocchiut |
1.4 |
// |
133 |
|
|
Bool_t fXosel; ///< true if event is contained in section XO |
134 |
|
|
Bool_t fXesel; ///< true if event is contained in section XE |
135 |
|
|
Bool_t fYosel; ///< true if event is contained in section YO |
136 |
|
|
Bool_t fYesel; ///< true if event is contained in section YE |
137 |
|
|
Bool_t fSel; ///< true if event is contained in at least one of the given section (independet mode) or in all the given section (coherent mode) |
138 |
|
|
Bool_t fPartsel; ///< true if the event is contained only up to the last plane used for energy determination (can be used in conjunction with fXXmin) |
139 |
|
|
Int_t fXeout; ///< last plane [0,11] for which the trajectory is contained in section XE |
140 |
|
|
Int_t fYeout; ///< last plane [0,11] for which the trajectory is contained in section YE |
141 |
|
|
Int_t fXoout; ///< last plane [0,11] for which the trajectory is contained in section XO |
142 |
|
|
Int_t fYoout; ///< last plane [0,11] for which the trajectory is contained in section YO |
143 |
|
|
Int_t fXomin; ///< last plane [0,11] for which the trajectory MUST be contained in section XO. Default 1000 means all the planes, if less than 10 events can be only partially contained in a section (NB: THIS INTRODUCE AN ENERGY DEPENDENT SELECTION CONTAINMENT EFFICIENCY) |
144 |
|
|
Int_t fXemin; ///< last plane [0,11] for which the trajectory MUST be contained in section XE. Default 1000 means all the planes, if less than 10 events can be only partially contained in a section (NB: THIS INTRODUCE AN ENERGY DEPENDENT SELECTION CONTAINMENT EFFICIENCY) |
145 |
|
|
Int_t fYomin; ///< last plane [0,11] for which the trajectory MUST be contained in section YO. Default 1000 means all the planes, if less than 10 events can be only partially contained in a section (NB: THIS INTRODUCE AN ENERGY DEPENDENT SELECTION CONTAINMENT EFFICIENCY) |
146 |
|
|
Int_t fYemin; ///< last plane [0,11] for which the trajectory MUST be contained in section YE. Default 1000 means all the planes, if less than 10 events can be only partially contained in a section (NB: THIS INTRODUCE AN ENERGY DEPENDENT SELECTION CONTAINMENT EFFICIENCY) |
147 |
|
|
// |
148 |
|
|
Bool_t fSimu; ///< true if we are using simulated data, default false |
149 |
|
|
Bool_t indep; ///< flag to switch between INDEPENDENT or COHERENT mode, default false - COHERENT mode selected |
150 |
|
|
// |
151 |
|
|
CaloPreSampler *cp; ///< pointer to calopresampler object (object constructed only when invoking method UseCaloPreSampler() , default: use level2 data). |
152 |
mocchiut |
1.6 |
CaloLong *clong; ///< pointer to calolong object (object constructed only when invoking method UseLongFit(), default use energy up to maximum). |
153 |
mocchiut |
1.4 |
// |
154 |
|
|
void DefineGeometry(); ///< called by constructors to fill geometrical variables (like xe1 etc). |
155 |
|
|
void Set(); ///< called by contructors to define default variables |
156 |
mocchiut |
1.1 |
|
157 |
|
|
public: |
158 |
|
|
// |
159 |
mocchiut |
1.4 |
CaloEnergy(); ///< default constructor (does nothing) |
160 |
|
|
CaloEnergy(PamLevel2 *L2); ///< constructor |
161 |
|
|
CaloEnergy(PamLevel2 *L2, Bool_t simulation); ///< constructor |
162 |
|
|
~CaloEnergy(){ Delete(); }; ///< default destructor |
163 |
|
|
// |
164 |
|
|
void SetDebug(Bool_t d){ debug=d; }; ///< set the debug flag (verbose print-out on STDOUT), default is false |
165 |
|
|
// |
166 |
|
|
void Clear(); ///< clear varibles |
167 |
|
|
void Clear(Option_t *option){Clear();}; ///< compatibility with TObject |
168 |
|
|
void Delete(); ///< delete object |
169 |
|
|
void Delete(Option_t *option){Delete();}; ///< compatibility with TObject |
170 |
|
|
// |
171 |
|
|
void Process(); ///< Process the event |
172 |
|
|
void Process(TString section); ///< Process the event for section "section" |
173 |
|
|
void Print(); ///< Print variables on STDOUT |
174 |
|
|
void Print(Option_t *option){Print();}; ///< compatibility with TObject |
175 |
mocchiut |
1.1 |
// |
176 |
mocchiut |
1.4 |
Bool_t IsInsideAcceptance(TString section); ///< returns true if event is inside acceptance of the given sections (all if coherent mode, at least one in independent mode) |
177 |
|
|
Bool_t IsInsideReducedAcceptance(){return fPartsel;}; ///< returns true if the event is inside acceptance only up to the last used plane (see fXomin etc) |
178 |
mocchiut |
1.1 |
// |
179 |
|
|
Bool_t IsInsideXE(){return(IsInsideAcceptance("XE"));}; |
180 |
|
|
Bool_t InsideXEcheck(){return fXesel;}; |
181 |
|
|
Bool_t IsInsideXO(){return(IsInsideAcceptance("XO"));}; |
182 |
|
|
Bool_t InsideXOcheck(){return fXosel;}; |
183 |
|
|
Bool_t IsInsideYE(){return(IsInsideAcceptance("YE"));}; |
184 |
|
|
Bool_t InsideYEcheck(){return fYesel;}; |
185 |
|
|
Bool_t IsInsideYO(){return(IsInsideAcceptance("YO"));}; |
186 |
|
|
Bool_t InsideYOcheck(){return fYosel;}; |
187 |
|
|
// |
188 |
mocchiut |
1.4 |
Float_t GetEnergy(){ Process(); return fEnergy;}; ///< returns the energy [GV] determined for this event |
189 |
|
|
Float_t GetEnergy(TString section){ Process(section); return fEnergy;}; ///< returns the energy [GV] determined for this event |
190 |
|
|
Float_t GetCount(){ return fCount;}; ///< returns the number of section inside acceptance for this event (equal to the number of given section in coherent mode) |
191 |
|
|
// |
192 |
|
|
Float_t GetMaxplane(){ return fMax_plane;}; ///< returns the average max plane [0,11] (independent mode) or last plane for energy measurement [0,43] (coherent mode) |
193 |
mocchiut |
1.6 |
Float_t GetEnergyAtMaxplane(TString section); ///< returns the energy at the plane of maximum for section "section" |
194 |
mocchiut |
1.4 |
// |
195 |
mocchiut |
1.6 |
Float_t GetMaxEnergy(); ///< returns the total energy [MIP] before conversion |
196 |
mocchiut |
1.4 |
Float_t GetMaxEnergy(TString section); ///< returns the total energy [MIP] before conversion for section "section" |
197 |
|
|
Int_t GetMaxplane(TString section); ///< returns the plane of maximum (independent mode) or the last used plane (coherent mode) for section "section" |
198 |
|
|
// |
199 |
mocchiut |
1.6 |
void UseLongFit();///< use or not the longitudinal fit to determine the energy |
200 |
|
|
CaloLong* GetCaloLong(){return clong;}; ///< Get calolong object. |
201 |
mocchiut |
1.4 |
void UseMeasuredEnergyUpToMax(){ fLong = false;}; ///< use the measured energy to determine the maximum (default) |
202 |
|
|
// |
203 |
mocchiut |
1.8 |
void SetMargin(Float_t margin){fM = margin ; fM1 = margin - 0.122 - 0.096 + 0.096; if ( fM1 < 0. ) fM1 = 0.;}; ///< set the margin from the border of the silicon sensor (not from the first strip), set the same margin for both the directions |
204 |
|
|
void SetMarginStripDirection(Float_t margin){fM = margin ;}; ///< set the margin from the border of the silicon sensor (not from the first strip) in the strip direction |
205 |
|
|
void SetMarginStripReading(Float_t margin){fM1 = margin -0.122 - 0.096 + 0.096;}; ///< set the margin from the border of the silicon sensor (not from the first strip) in the strip reading direction |
206 |
mocchiut |
1.4 |
void SetRadius(Int_t strip){fRad = strip;}; ///< set the radius of the cylinder |
207 |
|
|
void SetMaxPlaneOffset(Int_t noplanes){fPl = noplanes;}; ///< set the number of dE/dx measurements to be used after the maximum |
208 |
mocchiut |
1.6 |
void SetX0max(Float_t xm){ x0max = xm;}; ///< set the plane of maximum from external source X0 (test purpose only) |
209 |
|
|
void SetRigX0max(Float_t rig){ x0max = -0.5+log(rig/0.0076);}; ///< set the plane of maximum from external source rigidity (GeV) (test purpose only) |
210 |
mocchiut |
1.4 |
// |
211 |
|
|
void SetMinimumContainment(Int_t plane); ///< set the last plane [0,11] for which the trajectory MUST be contained in all the sections. Default 1000 means all the planes, if less than 10 events can be only partially contained in a section (NB: THIS INTRODUCE AN ENERGY DEPENDENT SELECTION CONTAINMENT EFFICIENCY) |
212 |
|
|
void SetMinimumContainment(TString section, Int_t plane); ///< set the last plane [0,11] for which the trajectory MUST be contained in section "section". Default 1000 means all the planes, if less than 10 events can be only partially contained in a section (NB: THIS INTRODUCE AN ENERGY DEPENDENT SELECTION CONTAINMENT EFFICIENCY) |
213 |
|
|
Int_t GetMinimumContainment(TString section); ///< get the last plane [0,11] for which the trajectory MUST be contained in section "section". |
214 |
|
|
// |
215 |
|
|
void SetConversionFactor(Float_t conv_r); ///< Set the MIP-GV conversion factor for all the four sections. |
216 |
|
|
void SetConversionFactor(TString section, Float_t conv_r); ///< Set the MIP-GV conversion factor for section "section". |
217 |
|
|
Float_t GetConversionFactor(TString section); ///< Get the MIP-GV conversion factor for section "section". |
218 |
|
|
// |
219 |
|
|
void IndependentMode(){ indep = true; }; ///< Set the independent mode |
220 |
|
|
void CoherentMode(){ indep = false; }; ///< Set the coherent mode |
221 |
|
|
// |
222 |
|
|
void UseCaloPreSampler(); ///< use pre-sampler routine to refit the track (level2 default fitting could be wrong, in this case we force "shower fitting" in the DV library). |
223 |
|
|
CaloPreSampler* GetCaloPreSampler(){return cp;}; ///< Get pre-sampler object. |
224 |
mocchiut |
1.1 |
// |
225 |
mocchiut |
1.9 |
Float_t *Get_track_coordx(){ return *track_coordx;}; ///< X position of the track for all the planes and views |
226 |
|
|
Float_t *Get_track_coordy(){ return *track_coordy;}; ///< Y position of the track for all the planes and views |
227 |
|
|
// |
228 |
|
|
Float_t Get_track_coordx(Int_t i, Int_t j){ return track_coordx[i][j];}; ///< X position of the track for plane i and view j |
229 |
|
|
Float_t Get_track_coordy(Int_t i, Int_t j){ return track_coordy[i][j];}; ///< X position of the track for plane i and view j |
230 |
|
|
// |
231 |
|
|
Float_t *Get_encol(){ return *encol;}; ///< integrated energy over columns [MIP] |
232 |
|
|
Float_t Get_encol(Int_t i, Int_t j){ return encol[i][j];}; ///< integrated energy over view i and column j [MIP] |
233 |
|
|
// |
234 |
|
|
Int_t Get_column(){return fColumn;}; ///< number of column which contains the track |
235 |
mocchiut |
1.8 |
// |
236 |
mocchiut |
1.1 |
ClassDef(CaloEnergy,1); |
237 |
|
|
}; |
238 |
|
|
|
239 |
|
|
#endif |
240 |
|
|
|