1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 /// \class AliMUONCheck
20 /// This class check the ESD tree, providing the matching with the trigger
21 /// response and designing useful plots (Pt, Y, ITS vertex, multiplicity).
22 /// Note that there is a special flag to turn on for pdc06 production.
23 /// It also checks the TR tree giving hit densities on the two first and
24 /// last planes of the spectrometer as well as the time of flight on these planes.
25 /// MUONkine() provides event stack and check if the event are generated with
26 /// at least one muon and two muons (for PDC06).
27 /// DumpDigit() as a replacement of the function from MUONCheck.C macro.
29 /// \author Frederic Yermia, INFN Torino
31 #include "AliMUONCheck.h"
32 #include "AliMUONData.h"
33 #include "AliMUONDigit.h"
34 #include "AliMUONConstants.h"
35 #include "AliMUONTrack.h"
36 #include "AliMUONTrackParam.h"
37 #include "AliMUONTrackExtrap.h"
39 #include "AliMpSegmentation.h"
40 #include "AliMpVSegmentation.h"
41 #include "AliMpDEManager.h"
43 #include "AliRunLoader.h"
44 #include "AliLoader.h"
46 #include "AliTrackReference.h"
47 #include "AliTracker.h"
49 #include "AliESDMuonTrack.h"
50 #include "AliMagFMaps.h"
55 #include <TLorentzVector.h>
58 #include <TParticle.h>
61 ClassImp(AliMUONCheck)
64 //_____________________________________________________________________________
65 AliMUONCheck::AliMUONCheck(const char* galiceFile,const char* esdFile,Int_t firstEvent, Int_t lastEvent,const char* outDir)
67 fFileName(galiceFile),
68 fesdFileName(esdFile),
70 fFirstEvent(firstEvent),
71 fLastEvent(lastEvent),
78 fRunLoader = AliRunLoader::Open(fFileName.Data(),"MUONFolder","READ");
81 AliError(Form("Error opening %s file \n",fFileName.Data()));
85 fLoader = fRunLoader->GetLoader("MUONLoader");
88 fData = new AliMUONData(fLoader,"MUON","MUON");
92 AliError(Form("Could get MUONLoader"));
97 sprintf(command,"rm -rf %s", foutDir);
98 gSystem->Exec(command);
99 gSystem->mkdir(foutDir);
103 //_____________________________________________________________________________
104 AliMUONCheck::AliMUONCheck(const AliMUONCheck& rhs) : TObject(rhs)
107 AliFatal("Implement me if needed");
110 //_____________________________________________________________________________
112 AliMUONCheck::operator=(const AliMUONCheck&)
114 // assignement operator
115 AliFatal("Implement me if needed")
119 //_____________________________________________________________________________
120 AliMUONCheck::~AliMUONCheck()
124 fRunLoader->UnloadAll();
129 //_____________________________________________________________________________
131 AliMUONCheck::CheckESD(Bool_t pdc06TriggerResponse)
135 if ( !IsValid() ) return;
138 TH1F * fhMUONVertex ; //!
139 TH1F * fhMUONMult ; //!
142 fhMUONVertex = new TH1F("hMUONVertex","ITS Vertex" ,100, -25., 25.);
143 fhMUONMult = new TH1F("hMUONMult" ,"Multiplicity of ESD tracks",10, -0.5, 9.5);
145 TH1F *hY = new TH1F("hY","Rapidity",100,-5.,-1.);
146 TH1F *hPt = new TH1F("hPt","Pt",100, 0.,20.);
148 // ------------->open the ESD file
149 TFile* esdFile = TFile::Open(fesdFileName.Data());
151 if (!esdFile || !esdFile->IsOpen()) {
152 AliError(Form("Error opening %s file \n",fesdFileName.Data()));
155 Int_t fSPLowpt=0 ; //!
156 Int_t fSPHighpt=0 ; //!
157 Int_t fSPAllpt=0 ; //!
158 Int_t fSMLowpt=0 ; //!
159 Int_t fSMHighpt =0 ; //!
160 Int_t fSMAllpt=0 ; //!
161 Int_t fSULowpt=0 ; //!
162 Int_t fSUHighpt=0 ; //!
163 Int_t fSUAllpt=0 ; //!
164 Int_t fUSLowpt=0 ; //!
165 Int_t fUSHighpt=0 ; //!
166 Int_t fUSAllpt=0 ; //!
167 Int_t fLSLowpt=0 ; //!
168 Int_t fLSHighpt=0 ; //!
169 Int_t fLSAllpt=0 ; //!
171 Int_t fSLowpt=0 ; //!
172 Int_t fSHighpt=0 ; //!
174 Int_t fnTrackTrig=0 ; //!
175 Int_t ftracktot=0 ; //!
176 Int_t effMatch=0 ; //!
179 Float_t muonMass = 0.105658389;
180 Double_t thetaX, thetaY, pYZ;
181 Double_t fPxRec1, fPyRec1, fPzRec1, fE1;
184 AliESD* fESD = new AliESD();
185 TTree* fTree = (TTree*) esdFile->Get("esdTree");
187 Error("CheckESD", "no ESD tree found");
188 AliError(Form("CheckESD", "no ESD tree found"));
191 fTree->SetBranchAddress("ESD", &fESD);
193 Int_t fnevents = fRunLoader->GetNumberOfEvents();
194 Int_t endOfLoop = fLastEvent+1;
196 if ( fLastEvent == -1 ) endOfLoop = fnevents;
200 for (ievent = fFirstEvent; ievent < endOfLoop; ++ievent )
202 fRunLoader->GetEvent(ievent);
205 fTree->GetEvent(ievent);
207 Error("CheckESD", "no ESD object found for event %d", ievent);
210 AliESDVertex* vertex = (AliESDVertex*) fESD->AliESD::GetVertex();
212 Double_t zVertex = 0. ;
213 if (vertex) zVertex = vertex->GetZv();
215 Int_t nTracks = (Int_t)fESD->GetNumberOfMuonTracks() ;
216 ULong64_t trigword=fESD->GetTriggerMask();
218 if(pdc06TriggerResponse){
219 if (trigword & 0x01) {
223 if (trigword & 0x02){
226 if (trigword & 0x04){
229 if (trigword & 0x08){
232 if (trigword & 0x010){
235 if (trigword & 0x020){
238 if (trigword & 0x040){
241 if (trigword & 0x080){
244 if (trigword & 0x100){
247 if (trigword & 0x200){
251 if (trigword & 0x400){
254 if (trigword & 0x800){
257 if (trigword & 0x1000){
261 if (trigword & 0x2000){
265 if (trigword & 0x4000){
268 }// if pdc06TriggerResponse
270 if (trigword & 0x01) {
274 if (trigword & 0x02){
277 if (trigword & 0x04){
280 if (trigword & 0x08){
283 if (trigword & 0x010){
286 if (trigword & 0x020){
293 for (iTrack1 = 0; iTrack1<nTracks; iTrack1++) { //1st loop
294 AliESDMuonTrack* muonTrack = fESD->GetMuonTrack(iTrack1);
297 thetaX = muonTrack->GetThetaX();
298 thetaY = muonTrack->GetThetaY();
299 pYZ = 1./TMath::Abs(muonTrack->GetInverseBendingMomentum());
301 fPzRec1 = - pYZ / TMath::Sqrt(1.0 + TMath::Tan(thetaY)*TMath::Tan(thetaY));
302 fPxRec1 = fPzRec1 * TMath::Tan(thetaX);
303 fPyRec1 = fPzRec1 * TMath::Tan(thetaY);
304 fZ1 = Int_t(TMath::Sign(1.,muonTrack->GetInverseBendingMomentum()));
305 fE1 = TMath::Sqrt(muonMass * muonMass + fPxRec1 * fPxRec1 + fPyRec1 * fPyRec1 + fPzRec1 * fPzRec1);
306 fV1.SetPxPyPzE(fPxRec1, fPyRec1, fPzRec1, fE1);
307 // -----------> transverse momentum
308 Float_t pt1 = fV1.Pt();
309 // ----------->Rapidity
310 Float_t y1 = fV1.Rapidity();
312 if(muonTrack->GetMatchTrigger()) {
321 fhMUONVertex->Fill(zVertex) ;
322 fhMUONMult->Fill(Float_t(nTracks)) ;
324 } // loop over events
326 AliInfo(Form("Terminate %s:", GetName())) ;
328 effMatch=100*fnTrackTrig/ftracktot;
330 if(pdc06TriggerResponse){
331 printf("=================================================================\n") ;
332 printf("================ %s ESD SUMMARY ==============\n", GetName()) ;
334 printf(" Total number of processed events %d \n", nev) ;
337 printf("Table 1: \n") ;
338 printf(" Global Trigger output Low pt High pt All\n") ;
339 printf(" number of Single Plus :\t");
340 printf("%i\t%i\t%i\t", fSPLowpt, fSPHighpt, fSPAllpt) ;
342 printf(" number of Single Minus :\t");
343 printf("%i\t%i\t%i\t", fSMLowpt, fSMHighpt, fSMAllpt) ;
345 printf(" number of Single Undefined :\t");
346 printf("%i\t%i\t%i\t", fSULowpt, fSUHighpt, fSUAllpt) ;
348 printf(" number of UnlikeSign pair :\t");
349 printf("%i\t%i\t%i\t", fUSLowpt, fUSHighpt, fUSAllpt) ;
351 printf(" number of LikeSign pair :\t");
352 printf("%i\t%i\t%i\t", fLSLowpt, fLSHighpt, fLSAllpt) ;
354 printf("===================================================\n") ;
356 printf("matching efficiency with the trigger for single tracks = %2d %% \n", effMatch);
357 printf("================================================================\n") ; printf("\n") ;
359 }//if(pdc06TriggerResponse)
361 gSystem->cd(foutDir);
363 FILE *outtxt=fopen("output.txt","a");
364 freopen("output.txt","a",outtxt);
366 if(pdc06TriggerResponse){
367 fprintf(outtxt," \n");
368 fprintf(outtxt,"===================================================\n");
369 fprintf(outtxt,"================ ESD SUMMARY ==============\n");
370 fprintf(outtxt," \n");
371 fprintf(outtxt," Total number of processed events %d \n", nev);
372 fprintf(outtxt,"\n");
373 fprintf(outtxt,"\n");
374 fprintf(outtxt,"Table 1: \n");
375 fprintf(outtxt," Global Trigger output Low pt High pt All\n");
376 fprintf(outtxt," number of Single Plus :\t");
377 fprintf(outtxt,"%i\t%i\t%i\t",fSPLowpt,fSPHighpt,fSPAllpt);
378 fprintf(outtxt,"\n");
379 fprintf(outtxt," number of Single Minus :\t");
380 fprintf(outtxt,"%i\t%i\t%i\t",fSMLowpt,fSMHighpt,fSMAllpt);
381 fprintf(outtxt,"\n");
382 fprintf(outtxt," number of Single Undefined :\t");
383 fprintf(outtxt,"%i\t%i\t%i\t",fSULowpt,fSUHighpt,fSUAllpt);
384 fprintf(outtxt,"\n");
385 fprintf(outtxt," number of UnlikeSign pair :\t");
386 fprintf(outtxt,"%i\t%i\t%i\t",fUSLowpt,fUSHighpt,fUSAllpt);
387 fprintf(outtxt,"\n");
388 fprintf(outtxt," number of LikeSign pair :\t");
389 fprintf(outtxt,"%i\t%i\t%i\t",fLSLowpt,fLSHighpt, fLSAllpt);
390 fprintf(outtxt,"\n");
391 fprintf(outtxt,"===================================================\n");
392 fprintf(outtxt,"\n");
393 fprintf(outtxt,"matching efficiency with the trigger for single tracks = %2d %% \n", effMatch);
394 }//if(pdc06TriggerResponse)
398 fprintf(outtxt," \n");
399 fprintf(outtxt,"===================================================\n");
400 fprintf(outtxt,"================ ESD SUMMARY ==============\n");
401 fprintf(outtxt," \n");
402 fprintf(outtxt," Total number of processed events %d \n", nev);
403 fprintf(outtxt,"\n");
404 fprintf(outtxt,"\n");
405 fprintf(outtxt,"Table 1: \n");
406 fprintf(outtxt," Global Trigger output Low pt High pt \n");
407 fprintf(outtxt," number of Single :\t");
408 fprintf(outtxt,"%i\t%i\t",fSLowpt,fSHighpt);
409 fprintf(outtxt,"\n");
410 fprintf(outtxt," number of UnlikeSign pair :\t");
411 fprintf(outtxt,"%i\t%i\t",fUSLowpt,fUSHighpt);
412 fprintf(outtxt,"\n");
413 fprintf(outtxt," number of LikeSign pair :\t");
414 fprintf(outtxt,"%i\t%i\t",fLSLowpt,fLSHighpt);
415 fprintf(outtxt,"\n");
416 fprintf(outtxt,"===================================================\n");
417 fprintf(outtxt,"\n");
418 fprintf(outtxt,"matching efficiency with the trigger for single tracks = %2d %% \n", effMatch);
422 TCanvas * c1 = new TCanvas("c1", "ESD", 400, 10, 600, 700) ;
425 fhMUONVertex->Draw() ;
428 c1->Print("VertexAndMul.eps") ;
429 TCanvas *c2 = new TCanvas("c2","ESD",400,10,600,700);
435 c2->Print("YandPt.eps") ;
438 //_____________________________________________________________________________
440 AliMUONCheck::CheckKine()
443 if ( !IsValid() ) return;
445 // Stack of particle for each event
448 Int_t fnevents = fRunLoader->GetNumberOfEvents();
449 fRunLoader->LoadKinematics("READ");
451 Int_t endOfLoop = fLastEvent+1;
453 if ( fLastEvent == -1 ) endOfLoop = fnevents;
463 for (ievent = fFirstEvent; ievent < endOfLoop; ++ievent ) {
468 fRunLoader->GetEvent(ievent);
469 stack = fRunLoader->Stack();
470 npa = stack->GetNprimary();
471 npb = stack->GetNtrack();
472 printf("Primary particles %i \n",npa);
473 printf("Sec particles %i \n",npb);
474 printf("=================================================================\n") ;
475 printf("Primary particles listing: \n");
476 printf("=================================================================\n") ;
477 for(Int_t i=0; i<npa; i++) {
479 TParticle *p = stack->Particle(i);
481 Int_t pdg=p->GetPdgCode();
484 if (abs(pdg) == 13) {
488 printf("=================================================================\n") ;
489 printf("=================================================================\n") ;
491 printf("Secondaries particles listing: \n");
492 printf("=================================================================\n") ;
493 for(Int_t i=npa; i<npb; i++) {
495 stack->Particle(i)->Print("");
498 printf("=================================================================\n") ;
499 printf(">>> Event %d, Number of primary particles is %d \n",ievent, npa);
500 printf(">>> Event %d, Number of secondary articles is %d \n",ievent, npb-npa);
501 printf("=================================================================\n");
503 printf(">>> Okay!!! Event %d with at least one muon on primary stack! \n",ievent);
508 printf(">>> Warning!!! Event %d without muon on primary stack! \n",ievent);
513 printf(">>> Okay!!! Event %d with at least two muons on primary stack! \n",ievent);
516 printf("=================================================================\n");
521 fRunLoader->UnloadKinematics();
523 printf("=================================================================\n") ;
524 printf(" Total number of processed events %d \n", nev) ;
528 printf("---> WARNING!!! <---\n");
529 printf(" %i events without muon on primary stack \n",nmu);
533 printf("---> OKAY!!! <---\n");
534 printf(" %i events generated with at least one muon on primary stack \n",nonemu);
537 printf("---> OKAY!!! <---\n");
538 printf(" %i events generated with at least two muons on primary stack \n",ndimu);
542 printf("*** Leaving MuonKine() *** \n");
543 printf("**************************************************************** \n");
545 gSystem->cd(foutDir);
546 FILE *outtxt=fopen("output.txt","a");
547 freopen("output.txt","a",outtxt);
548 fprintf(outtxt," \n");
549 fprintf(outtxt,"=================================================================\n");
550 fprintf(outtxt,"================ MUONkine SUMMARY ================\n");
551 fprintf(outtxt,"\n");
552 fprintf(outtxt,"=================================================================\n");
553 fprintf(outtxt," Total number of processed events %d \n", nev) ;
554 fprintf(outtxt," \n");
557 fprintf(outtxt," ---> WARNING!!! <--- \n");
558 fprintf(outtxt," %i events without muon on primary stack \n",nmu);
562 fprintf(outtxt," ---> OKAY!!! <--- \n");
563 fprintf(outtxt," %i events generated with at least one muon on primary stack \n",nonemu);
567 fprintf(outtxt," ---> OKAY!!! <--- \n");
568 fprintf(outtxt," %i events generated with at least two muons on primary stack \n",ndimu);
571 fprintf(outtxt," \n") ;
572 fprintf(outtxt,"*** Leaving MuonKine() *** \n");
573 fprintf(outtxt,"**************************************************************** \n");
576 fRunLoader->UnloadKinematics();
579 //_____________________________________________________________________________
581 AliMUONCheck::CheckTrackRef()
583 // Check TrackRef files
585 if ( !IsValid() ) return;
586 Int_t flag11=0,flag12=0,flag13=0,flag14=0;
588 TH1F *tof01= new TH1F("tof01","TOF for first tracking plane",100,0.,100);
589 tof01->SetXTitle("tof (ns)");
590 TH1F *tof14= new TH1F("tof14","TOF for MT22",100,0.,100);
591 tof14->SetXTitle("tof (ns)");
594 hitDensity[0] = new TH1F("TR_dhits01","",30,0,300);
595 hitDensity[0]->SetFillColor(3);
596 hitDensity[0]->SetXTitle("R (cm)");
597 hitDensity[1] = new TH1F("TR_dhits10","",30,0,300);
598 hitDensity[1]->SetFillColor(3);
599 hitDensity[1]->SetXTitle("R (cm)");
600 hitDensity[2] = new TH1F("TR_dhits11","",30,0,300);
601 hitDensity[2]->SetFillColor(3);
602 hitDensity[2]->SetXTitle("R (cm)");
603 hitDensity[3] = new TH1F("TR_dhits14","",30,0,300);
604 hitDensity[3]->SetFillColor(3);
605 hitDensity[3]->SetXTitle("R (cm)");
606 Int_t fnevents = fRunLoader->GetNumberOfEvents();
608 fRunLoader->LoadTrackRefs();
609 Int_t endOfLoop = fLastEvent+1;
611 if ( fLastEvent == -1 ) endOfLoop = fnevents;
615 Int_t ntot=fLastEvent+1-fFirstEvent;
616 for (ievent = fFirstEvent; ievent < endOfLoop; ++ievent ) {
617 fRunLoader->GetEvent(ievent);
620 TTree *tTR = fRunLoader->TreeTR();
621 Int_t nentries = (Int_t)tTR->GetEntries();
622 TClonesArray *fRefArray = new TClonesArray("AliTrackReference");
623 TBranch *branch = tTR->GetBranch("MUON");
624 branch->SetAddress(&fRefArray);
626 for(Int_t l=0; l<nentries; l++)
628 if(!branch->GetEvent(l)) continue;
629 Int_t nnn = fRefArray->GetEntriesFast();
631 for(Int_t k=0; k<nnn; k++)
633 AliTrackReference *tref = (AliTrackReference*)fRefArray->UncheckedAt(k);
634 Int_t label = tref->GetTrack();
635 Float_t x = tref->X(); // x-pos of hit
636 Float_t y = tref->Y(); // y-pos
637 Float_t z = tref->Z();
639 Float_t r=TMath::Sqrt(x*x+y*y);
640 Float_t time = tref->GetTime();
642 Float_t wgt=1/(2*10*TMath::Pi()*r)/(ntot);
655 if (z<=-521&& z>=-531&&flag11==0){
657 hitDensity[0]->Fill(r,wgt);
658 tof01->Fill(1000000000*time,1);
662 if (z<=-1432&&z>=-1442&&flag12==0){
664 hitDensity[1]->Fill(r,wgt);
668 if (z<=-1598&& z>=-1608&&flag13==0){
670 hitDensity[2]->Fill(r,wgt);
674 if(z<=-1715&&z>=-1725&&flag14==0){
676 hitDensity[3]->Fill(r,wgt);
677 tof14->Fill(1000000000*time,1);
690 fRunLoader->UnloadTrackRefs();
691 gSystem->cd(foutDir);
692 TCanvas *c6 = new TCanvas("c6","TOF",400,10,600,700);
699 c6->Print("tof_on_trigger.ps");
701 TCanvas *c5 = new TCanvas("c5","TRef:Hits Density",400,10,600,700);
704 hitDensity[0]->Draw();
706 hitDensity[1]->Draw();
708 hitDensity[2]->Draw();
710 hitDensity[3]->Draw();
711 c5->Print("TR_Hit_densities.ps");
712 printf("=================================================================\n") ;
713 printf("================ %s Tref SUMMARY ==============\n", GetName()) ;
715 printf(" Total number of processed events %d \n", nev) ;
716 printf("*** Leaving TRef() *** \n");
717 printf("*************************************************** \n");
719 fRunLoader->UnloadTrackRefs();
722 //_____________________________________________________________________________
724 AliMUONCheck::CheckOccupancy(Bool_t perDetEle) const
726 /// Check occupancy for the first event selected
728 // Loading MUON subsystem
729 fLoader->LoadDigits("READ");
730 AliMUONData muondata(fLoader,"MUON","MUON");
732 AliMUONDigit * mDigit =0x0;
733 const AliMpVSegmentation * segbend = 0x0;
734 const AliMpVSegmentation * segnonbend = 0x0;
735 AliMpIntPair pad(0,0);
737 Int_t dEoccupancyBending[14][26];
738 Int_t dEoccupancyNonBending[14][26];
739 Int_t cHoccupancyBending[14];
740 Int_t cHoccupancyNonBending[14];
741 Int_t totaloccupancyBending =0;
742 Int_t totaloccupancyNonBending =0;
744 Int_t dEchannelsBending[14][26];
745 Int_t dEchannelsNonBending[14][26];
746 Int_t cHchannelsBending[14];
747 Int_t cHchannelsNonBending[14];
748 Int_t totalchannelsBending =0;
749 Int_t totalchannelsNonBending =0;
751 Int_t nchambers = AliMUONConstants::NCh(); ;
752 for (Int_t ichamber=0; ichamber<nchambers; ichamber++) {
753 cHchannelsBending[ichamber]=0;
754 cHchannelsNonBending[ichamber]=0;
756 for (Int_t idetele=0; idetele<26; idetele++) {
757 Int_t detele = 100*(ichamber +1)+idetele;
758 dEchannelsBending[ichamber][idetele]=0;
759 dEchannelsNonBending[ichamber][idetele]=0;
760 dEoccupancyBending[ichamber][idetele]=0;
761 dEoccupancyNonBending[ichamber][idetele]=0;
762 if ( AliMpDEManager::IsValidDetElemId(detele) ) {
763 segbend = AliMpSegmentation::Instance()
764 ->GetMpSegmentation(detele, AliMp::kCath0);
765 segnonbend = AliMpSegmentation::Instance()
766 ->GetMpSegmentation(detele, AliMp::kCath1);
767 if (AliMpDEManager::GetPlaneType(detele, AliMp::kCath0) != AliMp::kBendingPlane ) {
768 const AliMpVSegmentation* tmp = segbend;
769 segbend = segnonbend;
773 for (Int_t ix=0; ix<=segbend->MaxPadIndexX(); ix++) {
774 for (Int_t iy=0; iy<=segbend->MaxPadIndexY(); iy++) {
777 if( segbend->HasPad(pad) ) {
778 dEchannelsBending[ichamber][idetele]++;
779 cHchannelsBending[ichamber]++;
780 totalchannelsBending++;
784 for (Int_t ix=0; ix<=segnonbend->MaxPadIndexX(); ix++) {
785 for (Int_t iy=0; iy<=segnonbend->MaxPadIndexY(); iy++) {
788 if(segnonbend->HasPad(pad)) {
789 dEchannelsNonBending[ichamber][idetele]++;
790 cHchannelsNonBending[ichamber]++;
791 totalchannelsNonBending++;
795 if (perDetEle) printf(">>> Detection element %4d has %5d channels in bending and %5d channels in nonbending \n",
796 detele, dEchannelsBending[ichamber][idetele], dEchannelsNonBending[ichamber][idetele] );
799 printf(">>> Chamber %2d has %6d channels in bending and %6d channels in nonbending \n",
800 ichamber+1, cHchannelsBending[ichamber], cHchannelsNonBending[ichamber]);
802 printf(">>Spectrometer has %7d channels in bending and %7d channels in nonbending \n",
803 totalchannelsBending, totalchannelsNonBending);
806 printf(">>> Event %d \n", fFirstEvent);
807 fRunLoader->GetEvent(fFirstEvent);
808 muondata.SetTreeAddress("D");
809 muondata.GetDigits();
812 for (Int_t ichamber=0; ichamber<nchambers; ichamber++) {
813 cHoccupancyBending[ichamber] = 0;
814 cHoccupancyNonBending[ichamber]= 0;
817 Int_t ndigits = (Int_t) muondata.Digits(ichamber)->GetEntriesFast();
818 for (Int_t idigit=0; idigit<ndigits; idigit++) {
819 mDigit = static_cast<AliMUONDigit*>(muondata.Digits(ichamber)->At(idigit));
820 Int_t detele = mDigit->DetElemId();
821 Int_t idetele = detele-(ichamber+1)*100;
822 if ( mDigit->Cathode() == 0 ) {
823 cHoccupancyBending[ichamber]++;
824 dEoccupancyBending[ichamber][idetele]++;
825 totaloccupancyBending++;
828 cHoccupancyNonBending[ichamber]++;
829 dEoccupancyNonBending[ichamber][idetele]++;
830 totaloccupancyNonBending++;
834 printf(">>> Chamber %2d nChannels Bending %5d nChannels NonBending %5d \n",
836 cHoccupancyBending[ichamber],
837 cHoccupancyNonBending[ichamber]);
838 printf(">>> Chamber %2d Occupancy Bending %5.2f %% Occupancy NonBending %5.2f %% \n",
840 100.*((Float_t) cHoccupancyBending[ichamber])/((Float_t) cHchannelsBending[ichamber]),
841 100.*((Float_t) cHoccupancyNonBending[ichamber])/((Float_t) cHchannelsBending[ichamber]) );
844 for(Int_t idetele=0; idetele<26; idetele++) {
845 Int_t detele = idetele + 100*(ichamber+1);
846 if ( AliMpDEManager::IsValidDetElemId(detele) ) {
848 printf(">>> DetEle %4d nChannels Bending %5d nChannels NonBending %5d \n",
849 idetele+100*(ichamber+1),
850 dEoccupancyBending[ichamber][idetele],
851 dEoccupancyNonBending[ichamber][idetele]);
852 printf(">>> DetEle %4d Occupancy Bending %5.2f %% Occupancy NonBending %5.2f %% \n",
853 idetele+100*(ichamber+1),
854 100.*((Float_t) dEoccupancyBending[ichamber][idetele])/((Float_t) dEchannelsBending[ichamber][idetele]),
855 100.*((Float_t) dEoccupancyNonBending[ichamber][idetele])/((Float_t) dEchannelsBending[ichamber][idetele]));
859 } // end chamber loop
860 printf(">>> Muon Spectrometer Occupancy Bending %5.2f %% Occupancy NonBending %5.2f %% \n",
861 100.*((Float_t) totaloccupancyBending)/((Float_t) totalchannelsBending),
862 100.*((Float_t) totaloccupancyNonBending)/((Float_t) totalchannelsNonBending) );
863 muondata.ResetDigits();
864 // } // end cathode loop
865 fLoader->UnloadDigits();
868 //_____________________________________________________________________________
870 AliMUONCheck::CheckRecTracks () const
872 /// Reads and dumps rec tracks objects
874 // waiting for mag field in CDB
875 AliInfoStream() << "Loading field map...\n";
876 if (!AliTracker::GetFieldMap()) {
877 AliMagFMaps* field = new AliMagFMaps("Maps","Maps", 1, 1., 10., AliMagFMaps::k5kG);
878 AliTracker::SetFieldMap(field, kFALSE);
882 fLoader->LoadTracks("READ");
884 Int_t endOfLoop = fLastEvent+1;
885 if ( fLastEvent == -1 ) endOfLoop = fRunLoader->GetNumberOfEvents();
887 for (Int_t ievent=fFirstEvent; ievent<endOfLoop; ievent++) {
888 fRunLoader->GetEvent(ievent);
890 fData->SetTreeAddress("RT");
891 fData->GetRecTracks();
892 TClonesArray* recTracks = fData->RecTracks();
894 Int_t nrectracks = (Int_t) recTracks->GetEntriesFast(); //
895 printf(">>> Event %d, Number of Recconstructed tracks %d \n",ievent, nrectracks);
897 // Set the magnetic field for track extrapolations
898 AliMUONTrackExtrap::SetField(AliTracker::GetFieldMap());
901 for (Int_t iRecTracks = 0; iRecTracks < nrectracks; iRecTracks++) {
902 AliMUONTrack* recTrack = (AliMUONTrack*) recTracks->At(iRecTracks);
903 AliMUONTrackParam* trackParam = (AliMUONTrackParam*) (recTrack->GetTrackParamAtHit())->First();
904 AliMUONTrackExtrap::ExtrapToZ(trackParam,0.);
905 recTrack->Print("full");
907 fData->ResetRecTracks();
909 fLoader->UnloadTracks();
912 //_____________________________________________________________________________
913 void AliMUONCheck::SetEventsToCheck(Int_t firstEvent, Int_t lastEvent)
915 /// Set first and last event number to check
917 fFirstEvent = firstEvent;
918 fLastEvent = lastEvent;