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