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