1 |
pam-fi |
1.1 |
|
2 |
|
|
|
3 |
|
|
/** |
4 |
|
|
* \file PamLevel2.h |
5 |
|
|
* \author Elena Vannuccini |
6 |
|
|
*/ |
7 |
|
|
#ifndef pamlevel2_h |
8 |
|
|
#define pamlevel2_h |
9 |
|
|
|
10 |
pam-fi |
1.2 |
#include <TRefArray.h> |
11 |
pam-fi |
1.1 |
|
12 |
pam-fi |
1.13 |
#include <TrkStruct.h> |
13 |
|
|
#include <TrkParams.h> |
14 |
|
|
#include <TrkLevel0.h> |
15 |
pam-fi |
1.4 |
#include <TrkLevel1.h> |
16 |
pam-fi |
1.1 |
#include <TrkLevel2.h> |
17 |
pam-fi |
1.6 |
#include <TrkHough.h> |
18 |
|
|
#include <CaloLevel1.h> |
19 |
pam-fi |
1.1 |
#include <CaloLevel2.h> |
20 |
|
|
#include <ToFLevel2.h> |
21 |
|
|
#include <TrigLevel2.h> |
22 |
|
|
#include <S4Level2.h> |
23 |
|
|
#include <NDLevel2.h> |
24 |
|
|
#include <AcLevel2.h> |
25 |
pam-fi |
1.2 |
#include <OrbitalInfo.h> |
26 |
pam-fi |
1.4 |
#include <RunInfo.h> |
27 |
|
|
#include <GLTables.h> |
28 |
|
|
|
29 |
pam-fi |
1.1 |
|
30 |
|
|
#include <TTree.h> |
31 |
pam-fi |
1.7 |
#include <TFriendElement.h> |
32 |
pam-fi |
1.2 |
#include <TChain.h> |
33 |
pam-fi |
1.1 |
#include <TFile.h> |
34 |
pam-fi |
1.2 |
#include <TList.h> |
35 |
|
|
#include <TKey.h> |
36 |
|
|
#include <TSystemFile.h> |
37 |
|
|
#include <TSystemDirectory.h> |
38 |
pam-fi |
1.13 |
#include <TSQLServer.h> |
39 |
pam-fi |
1.1 |
|
40 |
|
|
#include <iostream> |
41 |
pam-fi |
1.13 |
|
42 |
|
|
#define NCLONES 10 |
43 |
|
|
|
44 |
pam-fi |
1.1 |
using namespace std; |
45 |
|
|
|
46 |
|
|
/** |
47 |
|
|
* \brief Class to describe particle tracks in the apparatus, including tracker and track-related variables from other detectors (calorimeter and TOF). |
48 |
|
|
* |
49 |
|
|
* This class inherites from TrkTrack, CaloTrkVar ecc... |
50 |
|
|
* |
51 |
|
|
*/ |
52 |
pam-fi |
1.10 |
//class PamTrack : public TrkTrack, public CaloTrkVar, public ToFTrkVar { |
53 |
|
|
class PamTrack : public TObject { |
54 |
pam-fi |
1.1 |
|
55 |
|
|
private: |
56 |
|
|
|
57 |
|
|
TrkTrack* trk_track; |
58 |
|
|
CaloTrkVar* calo_track; |
59 |
|
|
ToFTrkVar* tof_track; |
60 |
|
|
|
61 |
pam-fi |
1.10 |
bool candeleteobj; |
62 |
|
|
|
63 |
|
|
// TClonesArray *Cluster; ///< clusters (if stored) |
64 |
|
|
|
65 |
pam-fi |
1.1 |
public: |
66 |
|
|
|
67 |
|
|
PamTrack(); |
68 |
pam-fi |
1.10 |
PamTrack(TrkTrack* , CaloTrkVar* , ToFTrkVar* ); |
69 |
|
|
PamTrack(const PamTrack&); |
70 |
|
|
~PamTrack(){ Delete(); }; |
71 |
pam-fi |
1.1 |
|
72 |
pam-fi |
1.10 |
void Clear(); |
73 |
|
|
void Clear(Option_t *option){Clear();}; |
74 |
|
|
void Delete(); |
75 |
pam-fi |
1.1 |
|
76 |
pam-fi |
1.10 |
TrkTrack* GetTrkTrack(){return trk_track;}; |
77 |
pam-fi |
1.8 |
CaloTrkVar* GetCaloTrack(){return calo_track;}; |
78 |
pam-fi |
1.10 |
ToFTrkVar* GetToFTrack(){return tof_track;}; |
79 |
pam-fi |
1.8 |
|
80 |
pam-fi |
1.1 |
ClassDef(PamTrack,1); |
81 |
|
|
}; |
82 |
|
|
|
83 |
|
|
/** |
84 |
|
|
* \brief Class to describe PAMELA LEVEL2 data. |
85 |
|
|
* |
86 |
|
|
* This class inherites from TrkLevel2, CaloLevel2 ecc... and it overrides the TrkLevel2:GetTrack(int it) and TrkLevel2:GetTrackImage(int it) methods. |
87 |
|
|
* This allows to solve the tracker ambiguity (that is, to choose between track images) by using also information from other detectors. |
88 |
|
|
*/ |
89 |
|
|
|
90 |
pam-fi |
1.10 |
//class PamLevel2 : public CaloLevel2, public CaloLevel1, public ToFLevel2, public TrkLevel2, public TrkLevel1, public TrkHough, public TrigLevel2, public S4Level2, public NDLevel2, public AcLevel2, public OrbitalInfo { |
91 |
|
|
class PamLevel2 : public TObject { |
92 |
pam-fi |
1.1 |
|
93 |
|
|
private: |
94 |
|
|
|
95 |
pam-fi |
1.13 |
// ------------------------------ |
96 |
|
|
// variables to retrieve run info |
97 |
|
|
// ------------------------------ |
98 |
|
|
Int_t irun; //current run entry, relative to the TChain |
99 |
|
|
ULong64_t runfirstentry; //first entry of run, relative to the TChain |
100 |
|
|
ULong64_t runlastentry; //last entry of run, relative to the TChain |
101 |
|
|
Int_t irunentry; //position of current entry, relative to the run |
102 |
|
|
TChain* run_tree; |
103 |
|
|
TTree* run_tree_clone; |
104 |
|
|
TChain* sel_tree; |
105 |
|
|
TTree* sel_tree_clone; |
106 |
|
|
|
107 |
|
|
// --------------------------------- |
108 |
|
|
// variables to retrieve level0 info |
109 |
|
|
// --------------------------------- |
110 |
|
|
TFile* l0_file; |
111 |
|
|
TTree* l0_tree; |
112 |
|
|
Int_t iroot; |
113 |
|
|
// -------------------------------------------- |
114 |
|
|
// variables to store Level0 info (if required) |
115 |
|
|
// -------------------------------------------- |
116 |
|
|
EventHeader* h0_obj; |
117 |
|
|
TrkLevel0* trk0_obj; |
118 |
|
|
|
119 |
|
|
// --------------------------- |
120 |
|
|
// variables to connect the DB |
121 |
|
|
// --------------------------- |
122 |
|
|
TSQLServer* dbc; |
123 |
|
|
TString host; |
124 |
|
|
TString user; |
125 |
|
|
TString psw; |
126 |
|
|
|
127 |
|
|
// --------------------------------------------- |
128 |
|
|
// variables to retrieve and clone level1-2 info |
129 |
|
|
// --------------------------------------------- |
130 |
|
|
TChain* pam_tree; |
131 |
|
|
TTree* pam_tree_clone[NCLONES]; |
132 |
|
|
// -------------------------------------------- |
133 |
|
|
// variables to store Level0 info (if required) |
134 |
|
|
// -------------------------------------------- |
135 |
pam-fi |
1.6 |
TrkLevel1* trk1_obj; |
136 |
|
|
TrkLevel2* trk2_obj; |
137 |
|
|
TrkHough* trkh_obj; |
138 |
|
|
CaloLevel1* calo1_obj; |
139 |
|
|
CaloLevel2* calo2_obj; |
140 |
pam-fi |
1.2 |
ToFLevel2* tof_obj; |
141 |
|
|
TrigLevel2* trig_obj; |
142 |
|
|
S4Level2* s4_obj; |
143 |
|
|
NDLevel2* nd_obj; |
144 |
|
|
AcLevel2* ac_obj; |
145 |
pam-fi |
1.6 |
OrbitalInfo* orb_obj; |
146 |
|
|
GL_RUN* run_obj; |
147 |
mocchiut |
1.11 |
SoftInfo* soft_obj; // Emiliano |
148 |
pam-fi |
1.10 |
|
149 |
pam-fi |
1.13 |
// ----------------------------------- |
150 |
|
|
// variables to sort the track |
151 |
|
|
// ----------------------------------- |
152 |
pam-fi |
1.10 |
TClonesArray *tsorted; |
153 |
|
|
TClonesArray *timage; |
154 |
|
|
PamTrack *track; //store the last required |
155 |
pam-fi |
1.7 |
|
156 |
|
|
|
157 |
pam-fi |
1.13 |
// ----- |
158 |
|
|
// flags |
159 |
|
|
// ----- |
160 |
pam-fi |
1.6 |
Bool_t CAL2; //level2 branch |
161 |
|
|
Bool_t CAL1; //level1 branch |
162 |
pam-fi |
1.13 |
Bool_t CAL0; //yoda |
163 |
pam-fi |
1.6 |
|
164 |
|
|
Bool_t TRK2; //level2 branch |
165 |
|
|
Bool_t TRK1; //level1 branch |
166 |
|
|
Bool_t TRKh; //hough branch |
167 |
pam-fi |
1.13 |
Bool_t TRK0; //yoda |
168 |
|
|
|
169 |
|
|
Bool_t TOF; |
170 |
|
|
Bool_t TOF0; |
171 |
pam-fi |
1.6 |
|
172 |
|
|
Bool_t TRG; |
173 |
|
|
Bool_t S4; |
174 |
|
|
Bool_t ND; |
175 |
|
|
Bool_t AC; |
176 |
|
|
Bool_t ORB; |
177 |
pam-fi |
1.9 |
|
178 |
|
|
Bool_t RUN; |
179 |
pam-fi |
1.13 |
|
180 |
|
|
Int_t SELLI; //trees of selected events (there is a selection list) |
181 |
|
|
|
182 |
|
|
|
183 |
|
|
public: |
184 |
pam-fi |
1.6 |
|
185 |
pam-fi |
1.1 |
PamLevel2(); |
186 |
pam-fi |
1.10 |
~PamLevel2(){Delete();}; |
187 |
pam-fi |
1.2 |
|
188 |
pam-fi |
1.6 |
void Clear(); |
189 |
pam-fi |
1.10 |
void Delete(); |
190 |
pam-fi |
1.2 |
|
191 |
mocchiut |
1.12 |
|
192 |
pam-fi |
1.13 |
// ============================================= |
193 |
|
|
// methods needed to read/write Level0-1-2 trees |
194 |
|
|
// ============================================= |
195 |
pam-fi |
1.6 |
void SetWhichTrees(TString); |
196 |
pam-fi |
1.8 |
void GetWhichTrees(TFile*); |
197 |
|
|
|
198 |
|
|
TTree* GetPamTree(TFile*,TString); |
199 |
|
|
TTree* GetPamTree(TFile* f){return GetPamTree(f,"");}; |
200 |
|
|
|
201 |
pam-fi |
1.6 |
TList* GetListOfLevel2Files(TString, TString); |
202 |
|
|
Bool_t CheckLevel2File(TString); |
203 |
|
|
TChain* GetPamTree(TList*,TString); |
204 |
pam-fi |
1.8 |
TChain* GetPamTree(TString ddir,TString list,TString detlist){ return GetPamTree(GetListOfLevel2Files(ddir,list),detlist); }; |
205 |
|
|
TChain* GetPamTree(TString ddir,TString list){ return GetPamTree(GetListOfLevel2Files(ddir,list),""); }; |
206 |
|
|
|
207 |
pam-fi |
1.6 |
TTree* GetRunTree(TFile*); |
208 |
|
|
TChain* GetRunTree(TList*); |
209 |
mocchiut |
1.12 |
TChain* GetRunTree(TString ddir,TString list){ return GetRunTree(GetListOfLevel2Files(ddir,list)); }; |
210 |
|
|
Bool_t UpdateRunInfo(TTree *,ULong64_t); |
211 |
|
|
Bool_t UpdateRunInfo(TChain *,ULong64_t); |
212 |
pam-fi |
1.7 |
|
213 |
pam-fi |
1.8 |
void CreateCloneTrees0(TChain *fChain, TFile* file); |
214 |
|
|
void CreateCloneTrees(TFile* file); |
215 |
pam-fi |
1.7 |
void FillCloneTrees(); |
216 |
|
|
TTree *GetCloneTree(TString); |
217 |
|
|
void WriteCloneTrees(); |
218 |
|
|
|
219 |
pam-fi |
1.6 |
void SetBranchAddress(TTree *); |
220 |
|
|
void SetBranchAddress(TChain *); |
221 |
|
|
|
222 |
pam-fi |
1.13 |
Int_t GetEntry(Int_t); |
223 |
|
|
Int_t GetYodaEntry(); |
224 |
|
|
|
225 |
|
|
TChain* GetPamTree(){return pam_tree;}; |
226 |
|
|
TChain* GetRunTree(){return run_tree;}; |
227 |
|
|
TTree* GetYodaTree(); |
228 |
|
|
|
229 |
|
|
// ============= |
230 |
|
|
// DB connection |
231 |
|
|
// ============= |
232 |
|
|
void SetDBHost(TString str){host=str;}; |
233 |
|
|
void SetDBUser(TString str){user=str;}; |
234 |
|
|
void SetDBPsw(TString str){psw=str;}; |
235 |
|
|
|
236 |
|
|
|
237 |
pam-fi |
1.10 |
// ======================================================== |
238 |
|
|
// methods needed to retrieve subdetector general variables |
239 |
|
|
// ======================================================== |
240 |
pam-fi |
1.6 |
void* GetPointerTo(const char*); |
241 |
pam-fi |
1.13 |
TrkLevel0 *GetTrkLevel0() { return trk0_obj; }; |
242 |
|
|
|
243 |
|
|
TrkLevel1 *GetTrkLevel1() { return trk1_obj; }; |
244 |
|
|
TrkLevel2 *GetTrkLevel2() { return trk2_obj; }; |
245 |
|
|
TrkHough *GetTrkHough() { return trkh_obj; }; |
246 |
pam-fi |
1.10 |
CaloLevel1 *GetCaloLevel1() { return calo1_obj;}; |
247 |
|
|
CaloLevel2 *GetCaloLevel2() { return calo2_obj;}; |
248 |
pam-fi |
1.13 |
ToFLevel2 *GetToFLevel2() { return tof_obj; }; |
249 |
|
|
TrigLevel2 *GetTrigLevel2() { return trig_obj; }; |
250 |
|
|
S4Level2 *GetS4Level2() { return s4_obj; }; |
251 |
|
|
NDLevel2 *GetNDLevel2() { return nd_obj; }; |
252 |
|
|
AcLevel2 *GetAcLevel2() { return ac_obj; }; |
253 |
|
|
OrbitalInfo *GetOrbitalInfo(){ return orb_obj; }; |
254 |
|
|
GL_RUN *GetRunInfo() { return run_obj; }; |
255 |
mocchiut |
1.11 |
SoftInfo *GetSoftInfo() { return soft_obj; }; // Emiliano |
256 |
pam-fi |
1.3 |
|
257 |
|
|
// ============================================== |
258 |
|
|
// methods to retrieve subdetectors stored tracks |
259 |
|
|
// ============================================== |
260 |
pam-fi |
1.10 |
TrkTrack* GetTrkStoredTrack(int seqno){return trk2_obj->TrkLevel2::GetStoredTrack(seqno); }; |
261 |
pam-fi |
1.6 |
CaloTrkVar* GetCaloStoredTrack(int); |
262 |
|
|
ToFTrkVar* GetToFStoredTrack(int); |
263 |
|
|
// |
264 |
|
|
PamTrack* GetPamTrackAlong(TrkTrack*); |
265 |
pam-fi |
1.3 |
// PamTrack* GetPamTrackAlong(CaloTrkVar*); //se serve |
266 |
|
|
// PamTrack* GetPamTrackAlong(ToFTrkVar*); //se serve |
267 |
|
|
|
268 |
pam-fi |
1.1 |
// ================================= |
269 |
|
|
// methods to retrieve pamela tracks |
270 |
|
|
// ================================= |
271 |
pam-fi |
1.3 |
PamTrack* GetStoredTrack(Int_t); |
272 |
pam-fi |
1.6 |
// |
273 |
|
|
void SortTracks(TString); //assign value to variable sorted_tracks |
274 |
pam-fi |
1.10 |
// TRefArray* GetTracks(); //return sorted_tracks |
275 |
|
|
TClonesArray* GetTracks(); //return sorted_tracks |
276 |
pam-fi |
1.6 |
PamTrack* GetTrack(int); |
277 |
pam-fi |
1.1 |
PamTrack* GetTrackImage(int); |
278 |
pam-fi |
1.2 |
|
279 |
pam-fi |
1.6 |
// ================================= |
280 |
|
|
// other methods |
281 |
|
|
// ================================= |
282 |
pam-fi |
1.10 |
// Int_t ntrk(){ return trk2_obj->TrkLevel2::ntrk(); }; |
283 |
pam-fi |
1.6 |
|
284 |
|
|
|
285 |
pam-fi |
1.1 |
ClassDef(PamLevel2,1); |
286 |
|
|
}; |
287 |
|
|
|
288 |
|
|
//=============================================================================================== |
289 |
|
|
// |
290 |
|
|
// |
291 |
|
|
// |
292 |
|
|
// |
293 |
|
|
//=============================================================================================== |
294 |
|
|
|
295 |
|
|
|
296 |
|
|
#endif |
297 |
|
|
|