/[PAMELA software]/DarthVader/CalorimeterLevel2/doc/sostracker.cpp
ViewVC logotype

Contents of /DarthVader/CalorimeterLevel2/doc/sostracker.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1.1.1 - (show annotations) (download) (vendor branch)
Fri May 19 13:15:48 2006 UTC (18 years, 6 months ago) by mocchiut
Branch: DarthVader, MAIN
CVS Tags: v0r01, v0r02, v5r00, v4r00, v2r01, v10RED, v1r01beta, start, v9r00, v9r01, v1r00, v1r01, v10REDr01, v3r04, v3r05, v3r06, v3r00, v3r03, v6r01, v6r00, v2r00BETA, HEAD
Changes since 1.1: +0 -0 lines
Error occurred while calculating annotation data.
Imported sources

1 //
2 // C/C++ headers
3 //
4 #include <fstream>
5 #include <string.h>
6 //
7 // ROOT headers
8 //
9 #include <TTree.h>
10 #include <TClassEdit.h>
11 #include <TObject.h>
12 #include <TList.h>
13 #include <TArrayL.h>
14 #include <TSystem.h>
15 #include <TSystemDirectory.h>
16 #include <TString.h>
17 #include <TFile.h>
18 #include <TClass.h>
19 #include <TCanvas.h>
20 #include <TH1.h>
21 #include <TH1F.h>
22 #include <TH2D.h>
23 #include <TLatex.h>
24 #include <TPad.h>
25 #include <TSQLServer.h>
26 #include <TSQLRow.h>
27 #include <TSQLResult.h>
28 #include <TClonesArray.h>
29 //
30 // YODA headers
31 //
32 #include <PamelaRun.h>
33 #include <RegistryEvent.h>
34 #include <physics/trigger/TriggerEvent.h>
35
36 // #######################################################################################################################
37 //
38 // Calorimeter class CaloProcessing. Do not include CaloLevel2 (it doesn't compile I don't understand why...)
39 //
40 #include <CaloProcessing.h>
41 // #######################################################################################################################
42
43
44
45 int main(){
46 //
47 // definizione di variabili
48 //
49 TFile *l0File = 0;
50 TTree *l0tr = 0;
51 TBranch *l0registry = 0;
52 TBranch *l0calo = 0;
53 ULong64_t atime = 0ULL;
54 UInt_t ei = 0;
55 UInt_t re = 0;
56 Int_t sgnl = 0;
57 pamela::RegistryEvent *l0reg=0;
58 TSQLServer *dbc = 0;
59 dbc = TSQLServer::Connect("mysql://localhost/pamelaprod","anonymous","");
60
61 //
62 // e` importante che CaloProcessing chiami QUI prima di loopare sui run il suo costruttore!
63 //
64 // #######################################################################################################################
65 CaloProcessing *event = new CaloProcessing();
66 CaloLevel2 *ca = 0;
67 // #######################################################################################################################
68 //
69
70 //
71 // LOOP ON THE RUNS at some time...
72 //
73
74 //
75 // now we assume to process run 24 (my run 24 not the one on gundam if any) with
76 //
77 ULong64_t runheadtime = 132796435910ULL;
78 UInt_t evfrom = 179;
79 UInt_t evto = 200;
80 // UInt_t evto = 1354;
81
82 //
83 // Open Level0 file and branches
84 //
85 l0File = new TFile("/wizard3/pamela/samara/filesfromyoda//dw_050318_00100.root");
86 if ( !l0File ) {
87 printf(" CALORIMETER - ERROR: problems opening Level0 file\n");
88 return(0);
89 };
90 l0tr = (TTree*)l0File->Get("Physics");
91 if ( !l0tr ) {
92 printf(" CALORIMETER - ERROR: no Physics tree in Level0 file\n");
93 l0File->Close();
94 return(0);
95 };
96 l0registry = l0tr->GetBranch("Registry");
97 if ( !l0registry ) {
98 printf(" CALORIMETER - ERROR: no Registry branch in Level0 tree\n");
99 l0File->Close();
100 return(0);
101 };
102 //
103 l0calo = l0tr->GetBranch("Calorimeter");
104 if ( !l0calo ) {
105 printf(" CALORIMETER - ERROR: no Calorimeter branch in Level0 tree\n");
106 l0File->Close();
107 return(0);
108 };
109 //
110 l0tr->SetBranchAddress("Registry", &l0reg);
111
112
113
114
115 // #######################################################################################################################
116 //
117 // Initialize the calorimeter event object, look for the calibration which include the first header
118 //
119 printf(" Check for calorimeter calibrations and initialize event object \n");
120 event->ProcessingInit(dbc,runheadtime,sgnl,l0tr);
121 printf("\n");
122 //
123 // Check if we have to load parameter files (one time for every run)
124 //
125 event->ChkParam(dbc,runheadtime); // calorimeter parameter files
126 //
127 // #######################################################################################################################
128
129
130
131
132 //
133 // run over all the events of the run
134 //
135 printf("\n Ready to start! \n\n");
136 //
137 for ( re = evfrom; re <= evto; re++){
138 //
139 l0registry->GetEntry(re);
140 //
141 // absolute time of this event
142 //
143 atime = l0reg->absTime;
144 //
145 // physics events is at entry number ei where
146 //
147 ei = l0reg->event;
148 //
149
150
151
152 // #######################################################################################################################
153 //
154 // create (or clear if existing) a calorimeter level2 object
155 //
156 ca = new CaloLevel2();
157 //
158 // check if the calibration we are using is still good, if not load another calibration
159 //
160 event->ChkCalib(dbc,atime);
161 //
162 // set this variable to one to be sure to process the event (usually I do not process the event if I don't have a track or a selftrigger event)
163 //. =====> Notice: the event will NOT be processed if any CRC error in the calorimeter data has occured!! <=====
164 //
165 event->clevel1->good2 = 1;
166 //
167 // Calibrate calorimeter event with registry number "ei" and store output in the two structures that will be passed to fortran routine
168 //
169 event->Calibrate(ei);
170 //
171 // Calculate variables common to all tracks (qtot, nstrip, calorimeter fit parameters etc.)
172 //
173 event->GetCommonVar();
174 //
175 // Fill common variables
176 //
177 event->FillCommonVar(ca);
178 //
179 // Clear structures used to communicate with fortran
180 //
181 event->ClearStructs();
182 //
183 // #######################################################################################################################
184 //
185
186
187 //
188 // use the output to do something
189 //
190 printf(" ### Calorimeter tracking output: ### \n");
191 printf(" => event %i reg entry %i <= \n",re,ei);
192 printf(" ax = %f \n",ca->impx);
193 printf(" tanx = %f \n",ca->tanx);
194 printf(" ay = %f \n",ca->impy);
195 printf(" tany = %f \n",ca->tany);
196 printf(" N. point fit x = %i \n",ca->npcfit[0]);
197 printf(" N. point fit y = %i \n",ca->npcfit[1]);
198 printf(" Variance fit x = %f \n",ca->varcfit[0]);
199 printf(" Variance fit y = %f \n",ca->varcfit[1]);
200 printf(" Energy assuming interacting electron [GeV]= %f \n",ca->elen);
201 printf(" Error on energy [GeV]= %f \n",ca->selen);
202 printf(" #################################### \n");
203 //
204 };
205
206
207
208 // #######################################################################################################################
209 //
210 // this is needed before processing another run!
211 //
212 event->RunClose();
213 //
214 // #######################################################################################################################
215
216
217
218 //
219 // end of the loop over the runs
220 //
221
222 }

  ViewVC Help
Powered by ViewVC 1.1.23