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