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