]>
Commit | Line | Data |
---|---|---|
70b4a8d6 | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
7 | * Permission to use, copy, modify and distribute this software and its * | |
8 | * documentation strictly for non-commercial purposes is hereby granted * | |
9 | * without fee, provided that the above copyright notice appears in all * | |
10 | * copies and that both the copyright notice and this permission notice * | |
11 | * appear in the supporting documentation. The authors make no claims * | |
12 | * about the suitability of this software for any purpose. It is * | |
13 | * provided "as is" without express or implied warranty. * | |
14 | **************************************************************************/ | |
15 | ||
16 | // $Id$ | |
17 | ||
9780bd43 | 18 | /// \class AliMUONCheck |
19 | /// | |
20 | /// This class check the ESD tree, providing the matching with the trigger | |
21 | /// response and designing useful plots (Pt, Y, ITS vertex, multiplicity). | |
22 | /// Note that there is a special flag to turn on for pdc06 production. | |
23 | /// It also checks the TR tree giving hit densities on the two first and | |
24 | /// last planes of the spectrometer as well as the time of flight on these planes. | |
25 | /// MUONkine() provides event stack and check if the event are generated with | |
26 | /// at least one muon and two muons (for PDC06). | |
27 | /// DumpDigit() as a replacement of the function from MUONCheck.C macro. | |
28 | /// | |
29 | /// \author Frederic Yermia, INFN Torino | |
30 | ||
70b4a8d6 | 31 | #include "AliMUONCheck.h" |
9780bd43 | 32 | #include "AliMUONConstants.h" |
33 | #include "AliMUONTrack.h" | |
34 | #include "AliMUONTrackParam.h" | |
35 | #include "AliMUONTrackExtrap.h" | |
2e6ca202 | 36 | #include "AliMUONMCDataInterface.h" |
37 | #include "AliMUONDataInterface.h" | |
9780bd43 | 38 | #include "AliMpSegmentation.h" |
39 | #include "AliMpVSegmentation.h" | |
40 | #include "AliMpDEManager.h" | |
2e6ca202 | 41 | #include "AliMUONVDigitStore.h" |
70b4a8d6 | 42 | |
9780bd43 | 43 | #include "AliRunLoader.h" |
70b4a8d6 | 44 | #include "AliLoader.h" |
9780bd43 | 45 | #include "AliStack.h" |
46 | #include "AliTrackReference.h" | |
47 | #include "AliTracker.h" | |
48 | #include "AliESD.h" | |
49 | #include "AliESDMuonTrack.h" | |
50 | #include "AliMagFMaps.h" | |
70b4a8d6 | 51 | #include "AliLog.h" |
70b4a8d6 | 52 | |
9780bd43 | 53 | #include <TSystem.h> |
54 | #include <TCanvas.h> | |
55 | #include <TLorentzVector.h> | |
56 | #include <TFile.h> | |
57 | #include <TH1.h> | |
58 | #include <TParticle.h> | |
70b4a8d6 | 59 | |
5398f946 | 60 | /// \cond CLASSIMP |
70b4a8d6 | 61 | ClassImp(AliMUONCheck) |
5398f946 | 62 | /// \endcond |
6b092dfc | 63 | |
5a560b6a | 64 | AliMUONCheck::AliMUONCheck(const char* galiceFile, const char* esdFile,Int_t firstEvent, Int_t lastEvent,const char* outDir) |
65 | : TObject(), | |
2e6ca202 | 66 | fFileName(galiceFile), |
67 | fFileNameSim(), | |
68 | fesdFileName(esdFile), | |
69 | foutDir(outDir), | |
70 | fFirstEvent(firstEvent), | |
71 | fLastEvent(lastEvent) | |
5a560b6a | 72 | { |
73 | /// ctor | |
5a560b6a | 74 | } |
2e6ca202 | 75 | |
70b4a8d6 | 76 | //_____________________________________________________________________________ |
2e6ca202 | 77 | AliMUONCheck::AliMUONCheck(const char* galiceFile, const char* galiceFileSim, |
78 | const char* esdFile,Int_t firstEvent, Int_t lastEvent, | |
79 | const char* outDir) | |
70b4a8d6 | 80 | : TObject(), |
2e6ca202 | 81 | fFileName(galiceFile), |
82 | fFileNameSim(galiceFileSim), | |
83 | fesdFileName(esdFile), | |
84 | foutDir(outDir), | |
85 | fFirstEvent(firstEvent), | |
86 | fLastEvent(lastEvent) | |
70b4a8d6 | 87 | { |
71a2d3aa | 88 | /// ctor |
9780bd43 | 89 | } |
90 | ||
70b4a8d6 | 91 | //_____________________________________________________________________________ |
92 | AliMUONCheck::~AliMUONCheck() | |
93 | { | |
2e6ca202 | 94 | /// Destructor |
70b4a8d6 | 95 | } |
96 | ||
97 | //_____________________________________________________________________________ | |
98 | void | |
9780bd43 | 99 | AliMUONCheck::CheckESD(Bool_t pdc06TriggerResponse) |
70b4a8d6 | 100 | { |
71a2d3aa | 101 | /// Check ESD files |
70b4a8d6 | 102 | |
9780bd43 | 103 | // Histograms |
104 | TH1F * fhMUONVertex ; //! | |
105 | TH1F * fhMUONMult ; //! | |
106 | ||
107 | // create histograms | |
108 | fhMUONVertex = new TH1F("hMUONVertex","ITS Vertex" ,100, -25., 25.); | |
109 | fhMUONMult = new TH1F("hMUONMult" ,"Multiplicity of ESD tracks",10, -0.5, 9.5); | |
70b4a8d6 | 110 | |
9780bd43 | 111 | TH1F *hY = new TH1F("hY","Rapidity",100,-5.,-1.); |
112 | TH1F *hPt = new TH1F("hPt","Pt",100, 0.,20.); | |
70b4a8d6 | 113 | |
9780bd43 | 114 | // ------------->open the ESD file |
115 | TFile* esdFile = TFile::Open(fesdFileName.Data()); | |
116 | ||
2e6ca202 | 117 | if (!esdFile || !esdFile->IsOpen()) |
118 | { | |
9780bd43 | 119 | AliError(Form("Error opening %s file \n",fesdFileName.Data())); |
2e6ca202 | 120 | return; |
121 | } | |
122 | ||
9780bd43 | 123 | Int_t fSPLowpt=0 ; //! |
124 | Int_t fSPHighpt=0 ; //! | |
125 | Int_t fSPAllpt=0 ; //! | |
126 | Int_t fSMLowpt=0 ; //! | |
127 | Int_t fSMHighpt =0 ; //! | |
128 | Int_t fSMAllpt=0 ; //! | |
129 | Int_t fSULowpt=0 ; //! | |
130 | Int_t fSUHighpt=0 ; //! | |
131 | Int_t fSUAllpt=0 ; //! | |
132 | Int_t fUSLowpt=0 ; //! | |
133 | Int_t fUSHighpt=0 ; //! | |
134 | Int_t fUSAllpt=0 ; //! | |
135 | Int_t fLSLowpt=0 ; //! | |
136 | Int_t fLSHighpt=0 ; //! | |
137 | Int_t fLSAllpt=0 ; //! | |
2e6ca202 | 138 | |
9780bd43 | 139 | Int_t fSLowpt=0 ; //! |
140 | Int_t fSHighpt=0 ; //! | |
2e6ca202 | 141 | |
9780bd43 | 142 | Int_t fnTrackTrig=0 ; //! |
143 | Int_t ftracktot=0 ; //! | |
144 | Int_t effMatch=0 ; //! | |
145 | ||
146 | TLorentzVector fV1; | |
147 | Float_t muonMass = 0.105658389; | |
148 | Double_t thetaX, thetaY, pYZ; | |
149 | Double_t fPxRec1, fPyRec1, fPzRec1, fE1; | |
150 | Int_t fZ1; | |
151 | ||
152 | AliESD* fESD = new AliESD(); | |
2e6ca202 | 153 | TTree* tree = (TTree*) esdFile->Get("esdTree"); |
154 | if (!tree) | |
155 | { | |
9780bd43 | 156 | Error("CheckESD", "no ESD tree found"); |
157 | AliError(Form("CheckESD", "no ESD tree found")); | |
158 | return ; | |
159 | } | |
2e6ca202 | 160 | fESD->ReadFromTree(tree); |
9780bd43 | 161 | |
2e6ca202 | 162 | Int_t fnevents = tree->GetEntries(); |
9780bd43 | 163 | Int_t endOfLoop = fLastEvent+1; |
2e6ca202 | 164 | |
9780bd43 | 165 | if ( fLastEvent == -1 ) endOfLoop = fnevents; |
166 | Int_t ievent=0; | |
167 | Int_t nev=0; | |
2e6ca202 | 168 | |
9780bd43 | 169 | for (ievent = fFirstEvent; ievent < endOfLoop; ++ievent ) |
70b4a8d6 | 170 | { |
2e6ca202 | 171 | nev++; |
172 | tree->GetEvent(ievent); | |
173 | if (!fESD) | |
174 | { | |
9780bd43 | 175 | Error("CheckESD", "no ESD object found for event %d", ievent); |
176 | return ; | |
177 | } | |
2e6ca202 | 178 | AliESDVertex* vertex = (AliESDVertex*) fESD->GetVertex(); |
9780bd43 | 179 | |
180 | Double_t zVertex = 0. ; | |
181 | if (vertex) zVertex = vertex->GetZv(); | |
2e6ca202 | 182 | |
9780bd43 | 183 | Int_t nTracks = (Int_t)fESD->GetNumberOfMuonTracks() ; |
184 | ULong64_t trigword=fESD->GetTriggerMask(); | |
2e6ca202 | 185 | |
186 | if(pdc06TriggerResponse) | |
187 | { | |
9780bd43 | 188 | if (trigword & 0x01) { |
189 | fSPLowpt++; | |
190 | } | |
2e6ca202 | 191 | |
9780bd43 | 192 | if (trigword & 0x02){ |
193 | fSPHighpt++; | |
194 | } | |
195 | if (trigword & 0x04){ | |
196 | fSPAllpt++; | |
197 | } | |
198 | if (trigword & 0x08){ | |
199 | fSMLowpt++; | |
200 | } | |
201 | if (trigword & 0x010){ | |
202 | fSMHighpt++; | |
203 | } | |
204 | if (trigword & 0x020){ | |
205 | fSMAllpt++; | |
206 | } | |
207 | if (trigword & 0x040){ | |
208 | fSULowpt++; | |
209 | } | |
210 | if (trigword & 0x080){ | |
211 | fSUHighpt++; | |
212 | } | |
213 | if (trigword & 0x100){ | |
214 | fSUAllpt++; | |
215 | } | |
216 | if (trigword & 0x200){ | |
217 | fUSLowpt++; | |
218 | } | |
2e6ca202 | 219 | |
9780bd43 | 220 | if (trigword & 0x400){ |
221 | fUSHighpt++; | |
222 | } | |
223 | if (trigword & 0x800){ | |
224 | fUSAllpt++; | |
225 | } | |
226 | if (trigword & 0x1000){ | |
227 | fLSLowpt++; | |
228 | } | |
2e6ca202 | 229 | |
9780bd43 | 230 | if (trigword & 0x2000){ |
231 | fLSHighpt++; | |
232 | } | |
2e6ca202 | 233 | |
9780bd43 | 234 | if (trigword & 0x4000){ |
235 | fLSAllpt++; | |
236 | } | |
237 | }// if pdc06TriggerResponse | |
238 | else { | |
239 | if (trigword & 0x01) { | |
240 | fSLowpt++; | |
241 | } | |
2e6ca202 | 242 | |
9780bd43 | 243 | if (trigword & 0x02){ |
244 | fSHighpt++; | |
245 | } | |
246 | if (trigword & 0x04){ | |
247 | fLSLowpt++; | |
248 | } | |
249 | if (trigword & 0x08){ | |
250 | fLSHighpt++; | |
251 | } | |
252 | if (trigword & 0x010){ | |
253 | fUSLowpt++; | |
254 | } | |
255 | if (trigword & 0x020){ | |
256 | fUSHighpt++; | |
257 | } | |
258 | } | |
259 | ||
260 | Int_t tracktrig=0; | |
2e6ca202 | 261 | |
262 | for ( Int_t iTrack1 = 0; iTrack1<nTracks; ++iTrack1 ) | |
263 | { //1st loop | |
9780bd43 | 264 | AliESDMuonTrack* muonTrack = fESD->GetMuonTrack(iTrack1); |
265 | ftracktot++; | |
266 | ||
267 | thetaX = muonTrack->GetThetaX(); | |
268 | thetaY = muonTrack->GetThetaY(); | |
269 | pYZ = 1./TMath::Abs(muonTrack->GetInverseBendingMomentum()); | |
2e6ca202 | 270 | |
9780bd43 | 271 | fPzRec1 = - pYZ / TMath::Sqrt(1.0 + TMath::Tan(thetaY)*TMath::Tan(thetaY)); |
272 | fPxRec1 = fPzRec1 * TMath::Tan(thetaX); | |
273 | fPyRec1 = fPzRec1 * TMath::Tan(thetaY); | |
274 | fZ1 = Int_t(TMath::Sign(1.,muonTrack->GetInverseBendingMomentum())); | |
275 | fE1 = TMath::Sqrt(muonMass * muonMass + fPxRec1 * fPxRec1 + fPyRec1 * fPyRec1 + fPzRec1 * fPzRec1); | |
276 | fV1.SetPxPyPzE(fPxRec1, fPyRec1, fPzRec1, fE1); | |
277 | // -----------> transverse momentum | |
278 | Float_t pt1 = fV1.Pt(); | |
279 | // ----------->Rapidity | |
280 | Float_t y1 = fV1.Rapidity(); | |
2e6ca202 | 281 | |
282 | if(muonTrack->GetMatchTrigger()) | |
283 | { | |
9780bd43 | 284 | fnTrackTrig++; |
285 | tracktrig++; | |
286 | } | |
287 | hY->Fill(y1); | |
288 | hPt->Fill(pt1); | |
2e6ca202 | 289 | } // loop on track |
290 | ||
9780bd43 | 291 | fhMUONVertex->Fill(zVertex) ; |
292 | fhMUONMult->Fill(Float_t(nTracks)) ; | |
2e6ca202 | 293 | |
9780bd43 | 294 | } // loop over events |
295 | ||
296 | AliInfo(Form("Terminate %s:", GetName())) ; | |
297 | ||
298 | effMatch=100*fnTrackTrig/ftracktot; | |
2e6ca202 | 299 | |
300 | if(pdc06TriggerResponse) | |
301 | { | |
9780bd43 | 302 | printf("=================================================================\n") ; |
303 | printf("================ %s ESD SUMMARY ==============\n", GetName()) ; | |
304 | printf(" \n") ; | |
305 | printf(" Total number of processed events %d \n", nev) ; | |
306 | printf("\n") ; | |
307 | printf("\n") ; | |
308 | printf("Table 1: \n") ; | |
309 | printf(" Global Trigger output Low pt High pt All\n") ; | |
310 | printf(" number of Single Plus :\t"); | |
311 | printf("%i\t%i\t%i\t", fSPLowpt, fSPHighpt, fSPAllpt) ; | |
312 | printf("\n"); | |
313 | printf(" number of Single Minus :\t"); | |
314 | printf("%i\t%i\t%i\t", fSMLowpt, fSMHighpt, fSMAllpt) ; | |
315 | printf("\n"); | |
316 | printf(" number of Single Undefined :\t"); | |
317 | printf("%i\t%i\t%i\t", fSULowpt, fSUHighpt, fSUAllpt) ; | |
318 | printf("\n"); | |
319 | printf(" number of UnlikeSign pair :\t"); | |
320 | printf("%i\t%i\t%i\t", fUSLowpt, fUSHighpt, fUSAllpt) ; | |
321 | printf("\n"); | |
322 | printf(" number of LikeSign pair :\t"); | |
323 | printf("%i\t%i\t%i\t", fLSLowpt, fLSHighpt, fLSAllpt) ; | |
324 | printf("\n"); | |
325 | printf("===================================================\n") ; | |
326 | printf("\n") ; | |
327 | printf("matching efficiency with the trigger for single tracks = %2d %% \n", effMatch); | |
328 | printf("================================================================\n") ; printf("\n") ; | |
2e6ca202 | 329 | |
9780bd43 | 330 | }//if(pdc06TriggerResponse) |
331 | ||
332 | gSystem->cd(foutDir); | |
333 | ||
334 | FILE *outtxt=fopen("output.txt","a"); | |
335 | freopen("output.txt","a",outtxt); | |
2e6ca202 | 336 | |
9780bd43 | 337 | if(pdc06TriggerResponse){ |
338 | fprintf(outtxt," \n"); | |
339 | fprintf(outtxt,"===================================================\n"); | |
340 | fprintf(outtxt,"================ ESD SUMMARY ==============\n"); | |
341 | fprintf(outtxt," \n"); | |
342 | fprintf(outtxt," Total number of processed events %d \n", nev); | |
343 | fprintf(outtxt,"\n"); | |
344 | fprintf(outtxt,"\n"); | |
345 | fprintf(outtxt,"Table 1: \n"); | |
346 | fprintf(outtxt," Global Trigger output Low pt High pt All\n"); | |
347 | fprintf(outtxt," number of Single Plus :\t"); | |
348 | fprintf(outtxt,"%i\t%i\t%i\t",fSPLowpt,fSPHighpt,fSPAllpt); | |
349 | fprintf(outtxt,"\n"); | |
350 | fprintf(outtxt," number of Single Minus :\t"); | |
351 | fprintf(outtxt,"%i\t%i\t%i\t",fSMLowpt,fSMHighpt,fSMAllpt); | |
352 | fprintf(outtxt,"\n"); | |
353 | fprintf(outtxt," number of Single Undefined :\t"); | |
354 | fprintf(outtxt,"%i\t%i\t%i\t",fSULowpt,fSUHighpt,fSUAllpt); | |
355 | fprintf(outtxt,"\n"); | |
356 | fprintf(outtxt," number of UnlikeSign pair :\t"); | |
357 | fprintf(outtxt,"%i\t%i\t%i\t",fUSLowpt,fUSHighpt,fUSAllpt); | |
358 | fprintf(outtxt,"\n"); | |
359 | fprintf(outtxt," number of LikeSign pair :\t"); | |
360 | fprintf(outtxt,"%i\t%i\t%i\t",fLSLowpt,fLSHighpt, fLSAllpt); | |
361 | fprintf(outtxt,"\n"); | |
362 | fprintf(outtxt,"===================================================\n"); | |
363 | fprintf(outtxt,"\n"); | |
364 | fprintf(outtxt,"matching efficiency with the trigger for single tracks = %2d %% \n", effMatch); | |
365 | }//if(pdc06TriggerResponse) | |
9780bd43 | 366 | |
2e6ca202 | 367 | else { |
368 | ||
9780bd43 | 369 | fprintf(outtxt," \n"); |
370 | fprintf(outtxt,"===================================================\n"); | |
371 | fprintf(outtxt,"================ ESD SUMMARY ==============\n"); | |
372 | fprintf(outtxt," \n"); | |
373 | fprintf(outtxt," Total number of processed events %d \n", nev); | |
374 | fprintf(outtxt,"\n"); | |
375 | fprintf(outtxt,"\n"); | |
376 | fprintf(outtxt,"Table 1: \n"); | |
377 | fprintf(outtxt," Global Trigger output Low pt High pt \n"); | |
378 | fprintf(outtxt," number of Single :\t"); | |
379 | fprintf(outtxt,"%i\t%i\t",fSLowpt,fSHighpt); | |
380 | fprintf(outtxt,"\n"); | |
381 | fprintf(outtxt," number of UnlikeSign pair :\t"); | |
382 | fprintf(outtxt,"%i\t%i\t",fUSLowpt,fUSHighpt); | |
383 | fprintf(outtxt,"\n"); | |
384 | fprintf(outtxt," number of LikeSign pair :\t"); | |
385 | fprintf(outtxt,"%i\t%i\t",fLSLowpt,fLSHighpt); | |
386 | fprintf(outtxt,"\n"); | |
387 | fprintf(outtxt,"===================================================\n"); | |
388 | fprintf(outtxt,"\n"); | |
389 | fprintf(outtxt,"matching efficiency with the trigger for single tracks = %2d %% \n", effMatch); | |
390 | }//else | |
391 | fclose(outtxt); | |
392 | ||
393 | TCanvas * c1 = new TCanvas("c1", "ESD", 400, 10, 600, 700) ; | |
394 | c1->Divide(1,2) ; | |
395 | c1->cd(1) ; | |
396 | fhMUONVertex->Draw() ; | |
397 | c1->cd(2) ; | |
398 | fhMUONMult->Draw() ; | |
399 | c1->Print("VertexAndMul.eps") ; | |
400 | TCanvas *c2 = new TCanvas("c2","ESD",400,10,600,700); | |
401 | c2->Divide(1,2); | |
402 | c2->cd(1); | |
403 | hY->Draw(); | |
404 | c2->cd(2); | |
405 | hPt->Draw(); | |
406 | c2->Print("YandPt.eps") ; | |
70b4a8d6 | 407 | } |
9780bd43 | 408 | |
409 | //_____________________________________________________________________________ | |
410 | void | |
411 | AliMUONCheck::CheckKine() | |
412 | { | |
71a2d3aa | 413 | /// Check Stack |
9780bd43 | 414 | |
2e6ca202 | 415 | AliMUONMCDataInterface diSim(fFileNameSim.Data()); |
416 | if (!diSim.IsValid()) return; | |
417 | ||
418 | Int_t fnevents = diSim.NumberOfEvents(); | |
9780bd43 | 419 | |
9780bd43 | 420 | Int_t endOfLoop = fLastEvent+1; |
421 | ||
422 | if ( fLastEvent == -1 ) endOfLoop = fnevents; | |
423 | ||
9780bd43 | 424 | Int_t nev=0; |
425 | Int_t nmu=0; | |
426 | Int_t nonemu=0; | |
427 | Int_t ndimu=0; | |
9780bd43 | 428 | |
2e6ca202 | 429 | for ( Int_t ievent = fFirstEvent; ievent < endOfLoop; ++ievent ) |
430 | { | |
9780bd43 | 431 | Int_t nmu2=0; |
2e6ca202 | 432 | ++nev; |
9780bd43 | 433 | |
2e6ca202 | 434 | AliStack* stack = diSim.Stack(ievent); |
435 | Int_t npa = stack->GetNprimary(); | |
436 | Int_t npb = stack->GetNtrack(); | |
9780bd43 | 437 | printf("Primary particles %i \n",npa); |
438 | printf("Sec particles %i \n",npb); | |
439 | printf("=================================================================\n") ; | |
440 | printf("Primary particles listing: \n"); | |
441 | printf("=================================================================\n") ; | |
2e6ca202 | 442 | for (Int_t i=0; i<npa; ++i) |
443 | { | |
9780bd43 | 444 | TParticle *p = stack->Particle(i); |
445 | p->Print(""); | |
446 | Int_t pdg=p->GetPdgCode(); | |
447 | ||
2e6ca202 | 448 | if (abs(pdg) == 13) |
449 | { | |
450 | ++nmu2; | |
9780bd43 | 451 | } |
452 | } | |
453 | printf("=================================================================\n") ; | |
454 | printf("=================================================================\n") ; | |
455 | ||
456 | printf("Secondaries particles listing: \n"); | |
457 | printf("=================================================================\n") ; | |
2e6ca202 | 458 | for (Int_t i=npa; i<npb; ++i) |
459 | { | |
9780bd43 | 460 | stack->Particle(i)->Print(""); |
461 | } | |
2e6ca202 | 462 | |
9780bd43 | 463 | printf("=================================================================\n") ; |
464 | printf(">>> Event %d, Number of primary particles is %d \n",ievent, npa); | |
465 | printf(">>> Event %d, Number of secondary articles is %d \n",ievent, npb-npa); | |
466 | printf("=================================================================\n"); | |
2e6ca202 | 467 | if(nmu2>0) |
468 | { | |
9780bd43 | 469 | printf(">>> Okay!!! Event %d with at least one muon on primary stack! \n",ievent); |
2e6ca202 | 470 | ++nonemu; |
9780bd43 | 471 | } |
472 | ||
2e6ca202 | 473 | if(nmu2==0) |
474 | { | |
9780bd43 | 475 | printf(">>> Warning!!! Event %d without muon on primary stack! \n",ievent); |
2e6ca202 | 476 | ++nmu; |
9780bd43 | 477 | } |
2e6ca202 | 478 | |
479 | if(nmu2>1) | |
480 | { | |
9780bd43 | 481 | printf(">>> Okay!!! Event %d with at least two muons on primary stack! \n",ievent); |
2e6ca202 | 482 | ++ndimu; |
9780bd43 | 483 | } |
484 | printf("=================================================================\n"); | |
485 | printf(" \n"); | |
486 | printf(" \n") ; | |
487 | }//ievent | |
488 | ||
9780bd43 | 489 | printf("=================================================================\n") ; |
490 | printf(" Total number of processed events %d \n", nev) ; | |
491 | printf(" \n") ; | |
492 | ||
2e6ca202 | 493 | if(nmu>0) |
494 | { | |
9780bd43 | 495 | printf("---> WARNING!!! <---\n"); |
496 | printf(" %i events without muon on primary stack \n",nmu); | |
497 | } | |
498 | ||
2e6ca202 | 499 | if(nmu==0) |
500 | { | |
9780bd43 | 501 | printf("---> OKAY!!! <---\n"); |
502 | printf(" %i events generated with at least one muon on primary stack \n",nonemu); | |
503 | } | |
2e6ca202 | 504 | |
505 | if(ndimu>0) | |
506 | { | |
9780bd43 | 507 | printf("---> OKAY!!! <---\n"); |
508 | printf(" %i events generated with at least two muons on primary stack \n",ndimu); | |
509 | } | |
2e6ca202 | 510 | |
9780bd43 | 511 | printf(" \n") ; |
512 | printf("*** Leaving MuonKine() *** \n"); | |
513 | printf("**************************************************************** \n"); | |
514 | ||
515 | gSystem->cd(foutDir); | |
516 | FILE *outtxt=fopen("output.txt","a"); | |
517 | freopen("output.txt","a",outtxt); | |
518 | fprintf(outtxt," \n"); | |
519 | fprintf(outtxt,"=================================================================\n"); | |
520 | fprintf(outtxt,"================ MUONkine SUMMARY ================\n"); | |
521 | fprintf(outtxt,"\n"); | |
522 | fprintf(outtxt,"=================================================================\n"); | |
523 | fprintf(outtxt," Total number of processed events %d \n", nev) ; | |
524 | fprintf(outtxt," \n"); | |
525 | ||
2e6ca202 | 526 | if(nmu>0) |
527 | { | |
9780bd43 | 528 | fprintf(outtxt," ---> WARNING!!! <--- \n"); |
529 | fprintf(outtxt," %i events without muon on primary stack \n",nmu); | |
530 | } | |
2e6ca202 | 531 | |
532 | if(nmu==0) | |
533 | { | |
9780bd43 | 534 | fprintf(outtxt," ---> OKAY!!! <--- \n"); |
535 | fprintf(outtxt," %i events generated with at least one muon on primary stack \n",nonemu); | |
536 | } | |
2e6ca202 | 537 | |
538 | if(ndimu>0) | |
539 | { | |
9780bd43 | 540 | fprintf(outtxt," ---> OKAY!!! <--- \n"); |
541 | fprintf(outtxt," %i events generated with at least two muons on primary stack \n",ndimu); | |
542 | } | |
2e6ca202 | 543 | |
9780bd43 | 544 | fprintf(outtxt," \n") ; |
545 | fprintf(outtxt,"*** Leaving MuonKine() *** \n"); | |
546 | fprintf(outtxt,"**************************************************************** \n"); | |
547 | fclose(outtxt); | |
9780bd43 | 548 | } |
549 | ||
550 | //_____________________________________________________________________________ | |
551 | void | |
552 | AliMUONCheck::CheckTrackRef() | |
553 | { | |
2e6ca202 | 554 | /// Check TrackRef files |
555 | ||
556 | AliMUONMCDataInterface diSim(fFileNameSim.Data()); | |
557 | if ( !diSim.IsValid() ) return; | |
9780bd43 | 558 | |
9780bd43 | 559 | Int_t flag11=0,flag12=0,flag13=0,flag14=0; |
2e6ca202 | 560 | |
9780bd43 | 561 | TH1F *tof01= new TH1F("tof01","TOF for first tracking plane",100,0.,100); |
562 | tof01->SetXTitle("tof (ns)"); | |
563 | TH1F *tof14= new TH1F("tof14","TOF for MT22",100,0.,100); | |
564 | tof14->SetXTitle("tof (ns)"); | |
565 | ||
566 | TH1F *hitDensity[4]; | |
567 | hitDensity[0] = new TH1F("TR_dhits01","",30,0,300); | |
568 | hitDensity[0]->SetFillColor(3); | |
569 | hitDensity[0]->SetXTitle("R (cm)"); | |
570 | hitDensity[1] = new TH1F("TR_dhits10","",30,0,300); | |
571 | hitDensity[1]->SetFillColor(3); | |
572 | hitDensity[1]->SetXTitle("R (cm)"); | |
573 | hitDensity[2] = new TH1F("TR_dhits11","",30,0,300); | |
574 | hitDensity[2]->SetFillColor(3); | |
575 | hitDensity[2]->SetXTitle("R (cm)"); | |
576 | hitDensity[3] = new TH1F("TR_dhits14","",30,0,300); | |
577 | hitDensity[3]->SetFillColor(3); | |
578 | hitDensity[3]->SetXTitle("R (cm)"); | |
9780bd43 | 579 | |
2e6ca202 | 580 | Int_t fnevents = diSim.NumberOfEvents(); |
581 | ||
9780bd43 | 582 | Int_t endOfLoop = fLastEvent+1; |
583 | ||
584 | if ( fLastEvent == -1 ) endOfLoop = fnevents; | |
585 | ||
9780bd43 | 586 | Int_t nev=0; |
587 | Int_t ntot=fLastEvent+1-fFirstEvent; | |
2e6ca202 | 588 | |
589 | for ( Int_t ievent = fFirstEvent; ievent < endOfLoop; ++ievent ) | |
590 | { | |
9780bd43 | 591 | Int_t save=-99; |
2e6ca202 | 592 | ++nev; |
593 | ||
594 | Int_t nentries = diSim.NumberOfTrackRefs(ievent); | |
9780bd43 | 595 | |
2e6ca202 | 596 | for ( Int_t l=0; l<nentries; ++l ) |
9780bd43 | 597 | { |
2e6ca202 | 598 | TClonesArray* trackRefs = diSim.TrackRefs(ievent,l); |
599 | if (!trackRefs) continue; | |
600 | ||
601 | Int_t nnn = trackRefs->GetEntriesFast(); | |
602 | ||
603 | for ( Int_t k=0; k<nnn; ++k ) | |
9780bd43 | 604 | { |
2e6ca202 | 605 | AliTrackReference *tref = static_cast<AliTrackReference*>(trackRefs->UncheckedAt(k)); |
9780bd43 | 606 | Int_t label = tref->GetTrack(); |
607 | Float_t x = tref->X(); // x-pos of hit | |
608 | Float_t y = tref->Y(); // y-pos | |
609 | Float_t z = tref->Z(); | |
610 | ||
611 | Float_t r=TMath::Sqrt(x*x+y*y); | |
612 | Float_t time = tref->GetTime(); | |
613 | ||
614 | Float_t wgt=1/(2*10*TMath::Pi()*r)/(ntot); | |
615 | ||
616 | if (save!=label){ | |
617 | save=label; | |
618 | flag11=0; | |
619 | flag12=0; | |
620 | flag13=0; | |
621 | flag14=0; | |
622 | } | |
2e6ca202 | 623 | |
9780bd43 | 624 | if (save==label){ |
625 | ||
626 | //Ch 1, z=-526.16 | |
627 | if (z<=-521&& z>=-531&&flag11==0){ | |
628 | flag11=1; | |
629 | hitDensity[0]->Fill(r,wgt); | |
630 | tof01->Fill(1000000000*time,1); | |
631 | }; | |
632 | ||
633 | //Ch 10, z=-1437.6 | |
634 | if (z<=-1432&&z>=-1442&&flag12==0){ | |
635 | flag12=1; | |
636 | hitDensity[1]->Fill(r,wgt); | |
637 | } | |
2e6ca202 | 638 | |
9780bd43 | 639 | //Ch 11, z=-1603.5 |
640 | if (z<=-1598&& z>=-1608&&flag13==0){ | |
641 | flag13=1; | |
642 | hitDensity[2]->Fill(r,wgt); | |
643 | }; | |
644 | ||
645 | //ch 14 z=-1720.5 | |
646 | if(z<=-1715&&z>=-1725&&flag14==0){ | |
647 | flag14=1; | |
648 | hitDensity[3]->Fill(r,wgt); | |
649 | tof14->Fill(1000000000*time,1); | |
650 | }; | |
651 | ||
652 | }//if save==label | |
2e6ca202 | 653 | |
9780bd43 | 654 | }//hits de tTR |
2e6ca202 | 655 | |
656 | delete trackRefs; | |
657 | ||
9780bd43 | 658 | }//entree de tTR |
2e6ca202 | 659 | |
9780bd43 | 660 | }//evt loop |
2e6ca202 | 661 | |
9780bd43 | 662 | gSystem->cd(foutDir); |
663 | TCanvas *c6 = new TCanvas("c6","TOF",400,10,600,700); | |
664 | c6->Divide(1,2); | |
665 | c6->cd(1); | |
666 | ||
667 | tof01->Draw(); | |
668 | c6->cd(2); | |
669 | tof14->Draw(); | |
670 | c6->Print("tof_on_trigger.ps"); | |
2e6ca202 | 671 | |
9780bd43 | 672 | TCanvas *c5 = new TCanvas("c5","TRef:Hits Density",400,10,600,700); |
673 | c5->Divide(2,2); | |
674 | c5->cd(1); | |
675 | hitDensity[0]->Draw(); | |
676 | c5->cd(2); | |
677 | hitDensity[1]->Draw(); | |
678 | c5->cd(3); | |
679 | hitDensity[2]->Draw(); | |
680 | c5->cd(4); | |
681 | hitDensity[3]->Draw(); | |
682 | c5->Print("TR_Hit_densities.ps"); | |
683 | printf("=================================================================\n") ; | |
684 | printf("================ %s Tref SUMMARY ==============\n", GetName()) ; | |
685 | printf(" \n") ; | |
686 | printf(" Total number of processed events %d \n", nev) ; | |
687 | printf("*** Leaving TRef() *** \n"); | |
688 | printf("*************************************************** \n"); | |
9780bd43 | 689 | } |
690 | ||
691 | //_____________________________________________________________________________ | |
692 | void | |
693 | AliMUONCheck::CheckOccupancy(Bool_t perDetEle) const | |
694 | { | |
2e6ca202 | 695 | /// Check occupancy for the first event selected |
696 | ||
9780bd43 | 697 | Int_t dEoccupancyBending[14][26]; |
698 | Int_t dEoccupancyNonBending[14][26]; | |
699 | Int_t cHoccupancyBending[14]; | |
700 | Int_t cHoccupancyNonBending[14]; | |
701 | Int_t totaloccupancyBending =0; | |
702 | Int_t totaloccupancyNonBending =0; | |
2e6ca202 | 703 | |
9780bd43 | 704 | Int_t dEchannelsBending[14][26]; |
705 | Int_t dEchannelsNonBending[14][26]; | |
706 | Int_t cHchannelsBending[14]; | |
707 | Int_t cHchannelsNonBending[14]; | |
708 | Int_t totalchannelsBending =0; | |
709 | Int_t totalchannelsNonBending =0; | |
2e6ca202 | 710 | |
711 | Int_t nchambers = AliMUONConstants::NCh(); | |
712 | ||
713 | AliMUONDataInterface di(fFileNameSim); | |
714 | ||
715 | AliMUONVDigitStore* digitStore = di.DigitStore(fFirstEvent); | |
716 | ||
717 | // Compute values | |
718 | for (Int_t ichamber=0; ichamber<nchambers; ++ichamber) | |
719 | { | |
9780bd43 | 720 | cHchannelsBending[ichamber]=0; |
721 | cHchannelsNonBending[ichamber]=0; | |
2e6ca202 | 722 | cHoccupancyBending[ichamber]=0; |
723 | cHoccupancyNonBending[ichamber]=0; | |
724 | ||
725 | for (Int_t idetele=0; idetele<26; idetele++) | |
726 | { | |
9780bd43 | 727 | Int_t detele = 100*(ichamber +1)+idetele; |
2e6ca202 | 728 | |
729 | if ( AliMpDEManager::IsValidDetElemId(detele) ) | |
730 | { | |
731 | Int_t cathode(0); | |
732 | ||
733 | const AliMpVSegmentation* segbend = AliMpSegmentation::Instance() | |
734 | ->GetMpSegmentation(detele, AliMp::kCath0); | |
735 | const AliMpVSegmentation* segnonbend = AliMpSegmentation::Instance() | |
736 | ->GetMpSegmentation(detele, AliMp::kCath1); | |
737 | ||
738 | if (AliMpDEManager::GetPlaneType(detele, AliMp::kCath0) != AliMp::kBendingPlane ) | |
739 | { | |
740 | const AliMpVSegmentation* tmp = segbend; | |
741 | segbend = segnonbend; | |
742 | segnonbend = tmp; | |
743 | cathode = 1; | |
744 | } | |
745 | ||
746 | Int_t nchannels = segbend->NofPads(); | |
747 | Int_t ndigits = digitStore->GetSize(detele,cathode); | |
748 | dEchannelsBending[ichamber][idetele] = nchannels; | |
749 | dEoccupancyBending[ichamber][idetele] = ndigits; | |
750 | cHchannelsBending[ichamber] += nchannels; | |
751 | cHoccupancyBending[ichamber] += ndigits; | |
752 | totalchannelsBending += nchannels; | |
753 | totaloccupancyBending += ndigits; | |
754 | ||
755 | nchannels = segnonbend->NofPads(); | |
756 | ndigits = digitStore->GetSize(detele,1-cathode); | |
757 | ||
758 | dEchannelsNonBending[ichamber][idetele] = nchannels; | |
759 | dEoccupancyBending[ichamber][idetele] = ndigits; | |
760 | cHchannelsNonBending[ichamber] += nchannels; | |
761 | cHoccupancyNonBending[ichamber] += ndigits; | |
762 | totalchannelsNonBending += nchannels; | |
763 | totaloccupancyNonBending += ndigits; | |
9780bd43 | 764 | } |
2e6ca202 | 765 | if (perDetEle) |
766 | { | |
767 | printf(">>> Detection element %4d has %5d channels in bending and %5d channels in nonbending \n", | |
768 | detele, dEchannelsBending[ichamber][idetele], dEchannelsNonBending[ichamber][idetele] ); | |
9780bd43 | 769 | } |
770 | } | |
771 | printf(">>> Chamber %2d has %6d channels in bending and %6d channels in nonbending \n", | |
2e6ca202 | 772 | ichamber+1, cHchannelsBending[ichamber], cHchannelsNonBending[ichamber]); |
9780bd43 | 773 | } |
774 | printf(">>Spectrometer has %7d channels in bending and %7d channels in nonbending \n", | |
2e6ca202 | 775 | totalchannelsBending, totalchannelsNonBending); |
776 | ||
777 | // Output values | |
778 | ||
779 | for ( Int_t ichamber = 0; ichamber < 14; ++ichamber ) | |
780 | { | |
9780bd43 | 781 | printf(">>> Chamber %2d nChannels Bending %5d nChannels NonBending %5d \n", |
2e6ca202 | 782 | ichamber+1, |
783 | cHoccupancyBending[ichamber], | |
784 | cHoccupancyNonBending[ichamber]); | |
9780bd43 | 785 | printf(">>> Chamber %2d Occupancy Bending %5.2f %% Occupancy NonBending %5.2f %% \n", |
2e6ca202 | 786 | ichamber+1, |
787 | 100.*((Float_t) cHoccupancyBending[ichamber])/((Float_t) cHchannelsBending[ichamber]), | |
788 | 100.*((Float_t) cHoccupancyNonBending[ichamber])/((Float_t) cHchannelsBending[ichamber]) ); | |
789 | ||
790 | if ( perDetEle ) | |
791 | { | |
792 | for(Int_t idetele=0; idetele<26; idetele++) | |
793 | { | |
794 | Int_t detele = idetele + 100*(ichamber+1); | |
795 | if ( AliMpDEManager::IsValidDetElemId(detele) ) | |
796 | { | |
797 | printf(">>> DetEle %4d nChannels Bending %5d nChannels NonBending %5d \n", | |
798 | idetele+100*(ichamber+1), | |
799 | dEoccupancyBending[ichamber][idetele], | |
800 | dEoccupancyNonBending[ichamber][idetele]); | |
801 | printf(">>> DetEle %4d Occupancy Bending %5.2f %% Occupancy NonBending %5.2f %% \n", | |
802 | idetele+100*(ichamber+1), | |
803 | 100.*((Float_t) dEoccupancyBending[ichamber][idetele])/((Float_t) dEchannelsBending[ichamber][idetele]), | |
804 | 100.*((Float_t) dEoccupancyNonBending[ichamber][idetele])/((Float_t) dEchannelsBending[ichamber][idetele])); | |
805 | } | |
9780bd43 | 806 | } |
807 | } | |
2e6ca202 | 808 | } |
809 | ||
9780bd43 | 810 | printf(">>> Muon Spectrometer Occupancy Bending %5.2f %% Occupancy NonBending %5.2f %% \n", |
2e6ca202 | 811 | 100.*((Float_t) totaloccupancyBending)/((Float_t) totalchannelsBending), |
812 | 100.*((Float_t) totaloccupancyNonBending)/((Float_t) totalchannelsNonBending) ); | |
813 | ||
814 | delete digitStore; | |
9780bd43 | 815 | } |
816 | ||
817 | //_____________________________________________________________________________ | |
818 | void | |
819 | AliMUONCheck::CheckRecTracks () const | |
820 | { | |
2e6ca202 | 821 | /// Reads and dumps rec tracks objects |
822 | ||
823 | AliWarning("Reimplement me ? or use AliMUONDumper simply ?"); | |
824 | ||
825 | // // waiting for mag field in CDB | |
826 | // AliInfoStream() << "Loading field map...\n"; | |
827 | // if (!AliTracker::GetFieldMap()) { | |
828 | // AliMagFMaps* field = new AliMagFMaps("Maps","Maps", 1, 1., 10., AliMagFMaps::k5kG); | |
829 | // AliTracker::SetFieldMap(field, kFALSE); | |
830 | // } | |
831 | // | |
832 | // // Loading data | |
833 | // fLoader->LoadTracks("READ"); | |
834 | // | |
835 | // Int_t endOfLoop = fLastEvent+1; | |
836 | // if ( fLastEvent == -1 ) endOfLoop = fRunLoader->GetNumberOfEvents(); | |
837 | // | |
838 | // for (Int_t ievent=fFirstEvent; ievent<endOfLoop; ievent++) { | |
839 | // fRunLoader->GetEvent(ievent); | |
840 | // | |
841 | // fRecData->SetTreeAddress("RT"); | |
842 | // fRecData->GetRecTracks(); | |
843 | // TClonesArray* recTracks = fRecData->RecTracks(); | |
844 | // | |
845 | // Int_t nrectracks = (Int_t) recTracks->GetEntriesFast(); // | |
846 | // printf(">>> Event %d, Number of Recconstructed tracks %d \n",ievent, nrectracks); | |
847 | // | |
848 | // // Set the magnetic field for track extrapolations | |
849 | // AliMUONTrackExtrap::SetField(AliTracker::GetFieldMap()); | |
850 | // | |
851 | // // Loop over tracks | |
852 | // for (Int_t iRecTracks = 0; iRecTracks < nrectracks; iRecTracks++) { | |
853 | // AliMUONTrack* recTrack = (AliMUONTrack*) recTracks->At(iRecTracks); | |
854 | // AliMUONTrackParam* trackParam = (AliMUONTrackParam*) (recTrack->GetTrackParamAtHit())->First(); | |
855 | // AliMUONTrackExtrap::ExtrapToZ(trackParam,0.); | |
856 | // recTrack->Print("full"); | |
857 | // } | |
858 | // fRecData->ResetRecTracks(); | |
859 | // } | |
860 | // fLoader->UnloadTracks(); | |
9780bd43 | 861 | } |
862 | ||
863 | //_____________________________________________________________________________ | |
864 | void AliMUONCheck::SetEventsToCheck(Int_t firstEvent, Int_t lastEvent) | |
865 | { | |
2e6ca202 | 866 | /// Set first and last event number to check |
867 | ||
9780bd43 | 868 | fFirstEvent = firstEvent; |
869 | fLastEvent = lastEvent; | |
870 | } |