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 "AliMUONSimData.h"
33 #include "AliMUONRecData.h"
34 #include "AliMUONDigit.h"
35 #include "AliMUONConstants.h"
36 #include "AliMUONTrack.h"
37 #include "AliMUONTrackParam.h"
38 #include "AliMUONTrackExtrap.h"
40 #include "AliMpSegmentation.h"
41 #include "AliMpVSegmentation.h"
42 #include "AliMpDEManager.h"
44 #include "AliRunLoader.h"
45 #include "AliLoader.h"
47 #include "AliTrackReference.h"
48 #include "AliTracker.h"
50 #include "AliESDMuonTrack.h"
51 #include "AliMagFMaps.h"
56 #include <TLorentzVector.h>
59 #include <TParticle.h>
62 ClassImp(AliMUONCheck)
65 AliMUONCheck::AliMUONCheck(const char* galiceFile, const char* esdFile,Int_t firstEvent, Int_t lastEvent,const char* outDir)
67 fFileName(galiceFile),
68 fFileNameSim(galiceFile),
69 fesdFileName(esdFile),
71 fFirstEvent(firstEvent),
72 fLastEvent(lastEvent),
81 fRunLoader = AliRunLoader::Open(fFileName.Data(),"MUONFolder","READ");
84 AliError(Form("Error opening %s file \n",fFileName.Data()));
88 fLoader = fRunLoader->GetLoader("MUONLoader");
91 fRecData = new AliMUONRecData(fLoader,"MUON","MUON");
95 AliError(Form("Could get MUONLoader"));
99 fRunLoaderSim = AliRunLoader::Open(fFileNameSim.Data(),"MUONFolderSim","READ");
102 AliError(Form("Error opening %s file \n",fFileNameSim.Data()));
106 fLoaderSim = fRunLoaderSim->GetLoader("MUONLoader");
109 fSimData = new AliMUONSimData(fLoaderSim,"MUON","MUON");
113 AliError(Form("Could get MUONLoader"));
118 sprintf(command,"rm -rf %s", foutDir);
119 gSystem->Exec(command);
120 gSystem->mkdir(foutDir);
123 //_____________________________________________________________________________
124 AliMUONCheck::AliMUONCheck(const char* galiceFile, const char* galiceFileSim, const char* esdFile,Int_t firstEvent, Int_t lastEvent,const char* outDir)
126 fFileName(galiceFile),
127 fFileNameSim(galiceFileSim),
128 fesdFileName(esdFile),
130 fFirstEvent(firstEvent),
131 fLastEvent(lastEvent),
140 fRunLoader = AliRunLoader::Open(fFileName.Data(),"MUONFolder","READ");
143 AliError(Form("Error opening %s file \n",fFileName.Data()));
147 fLoader = fRunLoader->GetLoader("MUONLoader");
150 fRecData = new AliMUONRecData(fLoader,"MUON","MUON");
154 AliError(Form("Could get MUONLoader"));
158 fRunLoaderSim = AliRunLoader::Open(fFileNameSim.Data(),"MUONFolderSim","READ");
161 AliError(Form("Error opening %s file \n",fFileNameSim.Data()));
165 fLoaderSim = fRunLoaderSim->GetLoader("MUONLoader");
168 fSimData = new AliMUONSimData(fLoaderSim,"MUON","MUON");
172 AliError(Form("Could get MUONLoader"));
177 sprintf(command,"rm -rf %s", foutDir);
178 gSystem->Exec(command);
179 gSystem->mkdir(foutDir);
183 //_____________________________________________________________________________
184 AliMUONCheck::~AliMUONCheck()
187 fRunLoader->UnloadAll();
188 fRunLoaderSim->UnloadAll();
191 delete fRunLoaderSim;
195 //_____________________________________________________________________________
197 AliMUONCheck::CheckESD(Bool_t pdc06TriggerResponse)
201 if ( !IsValid() ) return;
204 TH1F * fhMUONVertex ; //!
205 TH1F * fhMUONMult ; //!
208 fhMUONVertex = new TH1F("hMUONVertex","ITS Vertex" ,100, -25., 25.);
209 fhMUONMult = new TH1F("hMUONMult" ,"Multiplicity of ESD tracks",10, -0.5, 9.5);
211 TH1F *hY = new TH1F("hY","Rapidity",100,-5.,-1.);
212 TH1F *hPt = new TH1F("hPt","Pt",100, 0.,20.);
214 // ------------->open the ESD file
215 TFile* esdFile = TFile::Open(fesdFileName.Data());
217 if (!esdFile || !esdFile->IsOpen()) {
218 AliError(Form("Error opening %s file \n",fesdFileName.Data()));
221 Int_t fSPLowpt=0 ; //!
222 Int_t fSPHighpt=0 ; //!
223 Int_t fSPAllpt=0 ; //!
224 Int_t fSMLowpt=0 ; //!
225 Int_t fSMHighpt =0 ; //!
226 Int_t fSMAllpt=0 ; //!
227 Int_t fSULowpt=0 ; //!
228 Int_t fSUHighpt=0 ; //!
229 Int_t fSUAllpt=0 ; //!
230 Int_t fUSLowpt=0 ; //!
231 Int_t fUSHighpt=0 ; //!
232 Int_t fUSAllpt=0 ; //!
233 Int_t fLSLowpt=0 ; //!
234 Int_t fLSHighpt=0 ; //!
235 Int_t fLSAllpt=0 ; //!
237 Int_t fSLowpt=0 ; //!
238 Int_t fSHighpt=0 ; //!
240 Int_t fnTrackTrig=0 ; //!
241 Int_t ftracktot=0 ; //!
242 Int_t effMatch=0 ; //!
245 Float_t muonMass = 0.105658389;
246 Double_t thetaX, thetaY, pYZ;
247 Double_t fPxRec1, fPyRec1, fPzRec1, fE1;
250 AliESD* fESD = new AliESD();
251 TTree* fTree = (TTree*) esdFile->Get("esdTree");
253 Error("CheckESD", "no ESD tree found");
254 AliError(Form("CheckESD", "no ESD tree found"));
257 fTree->SetBranchAddress("ESD", &fESD);
259 Int_t fnevents = fRunLoader->GetNumberOfEvents();
260 Int_t endOfLoop = fLastEvent+1;
262 if ( fLastEvent == -1 ) endOfLoop = fnevents;
266 for (ievent = fFirstEvent; ievent < endOfLoop; ++ievent )
268 fRunLoader->GetEvent(ievent);
271 fTree->GetEvent(ievent);
273 Error("CheckESD", "no ESD object found for event %d", ievent);
276 AliESDVertex* vertex = (AliESDVertex*) fESD->AliESD::GetVertex();
278 Double_t zVertex = 0. ;
279 if (vertex) zVertex = vertex->GetZv();
281 Int_t nTracks = (Int_t)fESD->GetNumberOfMuonTracks() ;
282 ULong64_t trigword=fESD->GetTriggerMask();
284 if(pdc06TriggerResponse){
285 if (trigword & 0x01) {
289 if (trigword & 0x02){
292 if (trigword & 0x04){
295 if (trigword & 0x08){
298 if (trigword & 0x010){
301 if (trigword & 0x020){
304 if (trigword & 0x040){
307 if (trigword & 0x080){
310 if (trigword & 0x100){
313 if (trigword & 0x200){
317 if (trigword & 0x400){
320 if (trigword & 0x800){
323 if (trigword & 0x1000){
327 if (trigword & 0x2000){
331 if (trigword & 0x4000){
334 }// if pdc06TriggerResponse
336 if (trigword & 0x01) {
340 if (trigword & 0x02){
343 if (trigword & 0x04){
346 if (trigword & 0x08){
349 if (trigword & 0x010){
352 if (trigword & 0x020){
359 for (iTrack1 = 0; iTrack1<nTracks; iTrack1++) { //1st loop
360 AliESDMuonTrack* muonTrack = fESD->GetMuonTrack(iTrack1);
363 thetaX = muonTrack->GetThetaX();
364 thetaY = muonTrack->GetThetaY();
365 pYZ = 1./TMath::Abs(muonTrack->GetInverseBendingMomentum());
367 fPzRec1 = - pYZ / TMath::Sqrt(1.0 + TMath::Tan(thetaY)*TMath::Tan(thetaY));
368 fPxRec1 = fPzRec1 * TMath::Tan(thetaX);
369 fPyRec1 = fPzRec1 * TMath::Tan(thetaY);
370 fZ1 = Int_t(TMath::Sign(1.,muonTrack->GetInverseBendingMomentum()));
371 fE1 = TMath::Sqrt(muonMass * muonMass + fPxRec1 * fPxRec1 + fPyRec1 * fPyRec1 + fPzRec1 * fPzRec1);
372 fV1.SetPxPyPzE(fPxRec1, fPyRec1, fPzRec1, fE1);
373 // -----------> transverse momentum
374 Float_t pt1 = fV1.Pt();
375 // ----------->Rapidity
376 Float_t y1 = fV1.Rapidity();
378 if(muonTrack->GetMatchTrigger()) {
387 fhMUONVertex->Fill(zVertex) ;
388 fhMUONMult->Fill(Float_t(nTracks)) ;
390 } // loop over events
392 AliInfo(Form("Terminate %s:", GetName())) ;
394 effMatch=100*fnTrackTrig/ftracktot;
396 if(pdc06TriggerResponse){
397 printf("=================================================================\n") ;
398 printf("================ %s ESD SUMMARY ==============\n", GetName()) ;
400 printf(" Total number of processed events %d \n", nev) ;
403 printf("Table 1: \n") ;
404 printf(" Global Trigger output Low pt High pt All\n") ;
405 printf(" number of Single Plus :\t");
406 printf("%i\t%i\t%i\t", fSPLowpt, fSPHighpt, fSPAllpt) ;
408 printf(" number of Single Minus :\t");
409 printf("%i\t%i\t%i\t", fSMLowpt, fSMHighpt, fSMAllpt) ;
411 printf(" number of Single Undefined :\t");
412 printf("%i\t%i\t%i\t", fSULowpt, fSUHighpt, fSUAllpt) ;
414 printf(" number of UnlikeSign pair :\t");
415 printf("%i\t%i\t%i\t", fUSLowpt, fUSHighpt, fUSAllpt) ;
417 printf(" number of LikeSign pair :\t");
418 printf("%i\t%i\t%i\t", fLSLowpt, fLSHighpt, fLSAllpt) ;
420 printf("===================================================\n") ;
422 printf("matching efficiency with the trigger for single tracks = %2d %% \n", effMatch);
423 printf("================================================================\n") ; printf("\n") ;
425 }//if(pdc06TriggerResponse)
427 gSystem->cd(foutDir);
429 FILE *outtxt=fopen("output.txt","a");
430 freopen("output.txt","a",outtxt);
432 if(pdc06TriggerResponse){
433 fprintf(outtxt," \n");
434 fprintf(outtxt,"===================================================\n");
435 fprintf(outtxt,"================ ESD SUMMARY ==============\n");
436 fprintf(outtxt," \n");
437 fprintf(outtxt," Total number of processed events %d \n", nev);
438 fprintf(outtxt,"\n");
439 fprintf(outtxt,"\n");
440 fprintf(outtxt,"Table 1: \n");
441 fprintf(outtxt," Global Trigger output Low pt High pt All\n");
442 fprintf(outtxt," number of Single Plus :\t");
443 fprintf(outtxt,"%i\t%i\t%i\t",fSPLowpt,fSPHighpt,fSPAllpt);
444 fprintf(outtxt,"\n");
445 fprintf(outtxt," number of Single Minus :\t");
446 fprintf(outtxt,"%i\t%i\t%i\t",fSMLowpt,fSMHighpt,fSMAllpt);
447 fprintf(outtxt,"\n");
448 fprintf(outtxt," number of Single Undefined :\t");
449 fprintf(outtxt,"%i\t%i\t%i\t",fSULowpt,fSUHighpt,fSUAllpt);
450 fprintf(outtxt,"\n");
451 fprintf(outtxt," number of UnlikeSign pair :\t");
452 fprintf(outtxt,"%i\t%i\t%i\t",fUSLowpt,fUSHighpt,fUSAllpt);
453 fprintf(outtxt,"\n");
454 fprintf(outtxt," number of LikeSign pair :\t");
455 fprintf(outtxt,"%i\t%i\t%i\t",fLSLowpt,fLSHighpt, fLSAllpt);
456 fprintf(outtxt,"\n");
457 fprintf(outtxt,"===================================================\n");
458 fprintf(outtxt,"\n");
459 fprintf(outtxt,"matching efficiency with the trigger for single tracks = %2d %% \n", effMatch);
460 }//if(pdc06TriggerResponse)
464 fprintf(outtxt," \n");
465 fprintf(outtxt,"===================================================\n");
466 fprintf(outtxt,"================ ESD SUMMARY ==============\n");
467 fprintf(outtxt," \n");
468 fprintf(outtxt," Total number of processed events %d \n", nev);
469 fprintf(outtxt,"\n");
470 fprintf(outtxt,"\n");
471 fprintf(outtxt,"Table 1: \n");
472 fprintf(outtxt," Global Trigger output Low pt High pt \n");
473 fprintf(outtxt," number of Single :\t");
474 fprintf(outtxt,"%i\t%i\t",fSLowpt,fSHighpt);
475 fprintf(outtxt,"\n");
476 fprintf(outtxt," number of UnlikeSign pair :\t");
477 fprintf(outtxt,"%i\t%i\t",fUSLowpt,fUSHighpt);
478 fprintf(outtxt,"\n");
479 fprintf(outtxt," number of LikeSign pair :\t");
480 fprintf(outtxt,"%i\t%i\t",fLSLowpt,fLSHighpt);
481 fprintf(outtxt,"\n");
482 fprintf(outtxt,"===================================================\n");
483 fprintf(outtxt,"\n");
484 fprintf(outtxt,"matching efficiency with the trigger for single tracks = %2d %% \n", effMatch);
488 TCanvas * c1 = new TCanvas("c1", "ESD", 400, 10, 600, 700) ;
491 fhMUONVertex->Draw() ;
494 c1->Print("VertexAndMul.eps") ;
495 TCanvas *c2 = new TCanvas("c2","ESD",400,10,600,700);
501 c2->Print("YandPt.eps") ;
504 //_____________________________________________________________________________
506 AliMUONCheck::CheckKine()
509 if ( !IsValid() ) return;
511 // Stack of particle for each event
514 Int_t fnevents = fRunLoaderSim->GetNumberOfEvents();
515 fRunLoaderSim->LoadKinematics("READ");
517 Int_t endOfLoop = fLastEvent+1;
519 if ( fLastEvent == -1 ) endOfLoop = fnevents;
529 for (ievent = fFirstEvent; ievent < endOfLoop; ++ievent ) {
534 fRunLoaderSim->GetEvent(ievent);
535 stack = fRunLoaderSim->Stack();
536 npa = stack->GetNprimary();
537 npb = stack->GetNtrack();
538 printf("Primary particles %i \n",npa);
539 printf("Sec particles %i \n",npb);
540 printf("=================================================================\n") ;
541 printf("Primary particles listing: \n");
542 printf("=================================================================\n") ;
543 for(Int_t i=0; i<npa; i++) {
545 TParticle *p = stack->Particle(i);
547 Int_t pdg=p->GetPdgCode();
550 if (abs(pdg) == 13) {
554 printf("=================================================================\n") ;
555 printf("=================================================================\n") ;
557 printf("Secondaries particles listing: \n");
558 printf("=================================================================\n") ;
559 for(Int_t i=npa; i<npb; i++) {
561 stack->Particle(i)->Print("");
564 printf("=================================================================\n") ;
565 printf(">>> Event %d, Number of primary particles is %d \n",ievent, npa);
566 printf(">>> Event %d, Number of secondary articles is %d \n",ievent, npb-npa);
567 printf("=================================================================\n");
569 printf(">>> Okay!!! Event %d with at least one muon on primary stack! \n",ievent);
574 printf(">>> Warning!!! Event %d without muon on primary stack! \n",ievent);
579 printf(">>> Okay!!! Event %d with at least two muons on primary stack! \n",ievent);
582 printf("=================================================================\n");
587 fRunLoaderSim->UnloadKinematics();
589 printf("=================================================================\n") ;
590 printf(" Total number of processed events %d \n", nev) ;
594 printf("---> WARNING!!! <---\n");
595 printf(" %i events without muon on primary stack \n",nmu);
599 printf("---> OKAY!!! <---\n");
600 printf(" %i events generated with at least one muon on primary stack \n",nonemu);
603 printf("---> OKAY!!! <---\n");
604 printf(" %i events generated with at least two muons on primary stack \n",ndimu);
608 printf("*** Leaving MuonKine() *** \n");
609 printf("**************************************************************** \n");
611 gSystem->cd(foutDir);
612 FILE *outtxt=fopen("output.txt","a");
613 freopen("output.txt","a",outtxt);
614 fprintf(outtxt," \n");
615 fprintf(outtxt,"=================================================================\n");
616 fprintf(outtxt,"================ MUONkine SUMMARY ================\n");
617 fprintf(outtxt,"\n");
618 fprintf(outtxt,"=================================================================\n");
619 fprintf(outtxt," Total number of processed events %d \n", nev) ;
620 fprintf(outtxt," \n");
623 fprintf(outtxt," ---> WARNING!!! <--- \n");
624 fprintf(outtxt," %i events without muon on primary stack \n",nmu);
628 fprintf(outtxt," ---> OKAY!!! <--- \n");
629 fprintf(outtxt," %i events generated with at least one muon on primary stack \n",nonemu);
633 fprintf(outtxt," ---> OKAY!!! <--- \n");
634 fprintf(outtxt," %i events generated with at least two muons on primary stack \n",ndimu);
637 fprintf(outtxt," \n") ;
638 fprintf(outtxt,"*** Leaving MuonKine() *** \n");
639 fprintf(outtxt,"**************************************************************** \n");
642 fRunLoaderSim->UnloadKinematics();
645 //_____________________________________________________________________________
647 AliMUONCheck::CheckTrackRef()
649 /// Check TrackRef files
651 if ( !IsValid() ) return;
652 Int_t flag11=0,flag12=0,flag13=0,flag14=0;
654 TH1F *tof01= new TH1F("tof01","TOF for first tracking plane",100,0.,100);
655 tof01->SetXTitle("tof (ns)");
656 TH1F *tof14= new TH1F("tof14","TOF for MT22",100,0.,100);
657 tof14->SetXTitle("tof (ns)");
660 hitDensity[0] = new TH1F("TR_dhits01","",30,0,300);
661 hitDensity[0]->SetFillColor(3);
662 hitDensity[0]->SetXTitle("R (cm)");
663 hitDensity[1] = new TH1F("TR_dhits10","",30,0,300);
664 hitDensity[1]->SetFillColor(3);
665 hitDensity[1]->SetXTitle("R (cm)");
666 hitDensity[2] = new TH1F("TR_dhits11","",30,0,300);
667 hitDensity[2]->SetFillColor(3);
668 hitDensity[2]->SetXTitle("R (cm)");
669 hitDensity[3] = new TH1F("TR_dhits14","",30,0,300);
670 hitDensity[3]->SetFillColor(3);
671 hitDensity[3]->SetXTitle("R (cm)");
672 Int_t fnevents = fRunLoader->GetNumberOfEvents();
674 fRunLoaderSim->LoadTrackRefs();
675 Int_t endOfLoop = fLastEvent+1;
677 if ( fLastEvent == -1 ) endOfLoop = fnevents;
681 Int_t ntot=fLastEvent+1-fFirstEvent;
682 for (ievent = fFirstEvent; ievent < endOfLoop; ++ievent ) {
683 fRunLoaderSim->GetEvent(ievent);
686 TTree *tTR = fRunLoaderSim->TreeTR();
687 Int_t nentries = (Int_t)tTR->GetEntries();
688 TClonesArray *fRefArray = new TClonesArray("AliTrackReference");
689 TBranch *branch = tTR->GetBranch("MUON");
690 branch->SetAddress(&fRefArray);
692 for(Int_t l=0; l<nentries; l++)
694 if(!branch->GetEvent(l)) continue;
695 Int_t nnn = fRefArray->GetEntriesFast();
697 for(Int_t k=0; k<nnn; k++)
699 AliTrackReference *tref = (AliTrackReference*)fRefArray->UncheckedAt(k);
700 Int_t label = tref->GetTrack();
701 Float_t x = tref->X(); // x-pos of hit
702 Float_t y = tref->Y(); // y-pos
703 Float_t z = tref->Z();
705 Float_t r=TMath::Sqrt(x*x+y*y);
706 Float_t time = tref->GetTime();
708 Float_t wgt=1/(2*10*TMath::Pi()*r)/(ntot);
721 if (z<=-521&& z>=-531&&flag11==0){
723 hitDensity[0]->Fill(r,wgt);
724 tof01->Fill(1000000000*time,1);
728 if (z<=-1432&&z>=-1442&&flag12==0){
730 hitDensity[1]->Fill(r,wgt);
734 if (z<=-1598&& z>=-1608&&flag13==0){
736 hitDensity[2]->Fill(r,wgt);
740 if(z<=-1715&&z>=-1725&&flag14==0){
742 hitDensity[3]->Fill(r,wgt);
743 tof14->Fill(1000000000*time,1);
756 fRunLoaderSim->UnloadTrackRefs();
757 gSystem->cd(foutDir);
758 TCanvas *c6 = new TCanvas("c6","TOF",400,10,600,700);
765 c6->Print("tof_on_trigger.ps");
767 TCanvas *c5 = new TCanvas("c5","TRef:Hits Density",400,10,600,700);
770 hitDensity[0]->Draw();
772 hitDensity[1]->Draw();
774 hitDensity[2]->Draw();
776 hitDensity[3]->Draw();
777 c5->Print("TR_Hit_densities.ps");
778 printf("=================================================================\n") ;
779 printf("================ %s Tref SUMMARY ==============\n", GetName()) ;
781 printf(" Total number of processed events %d \n", nev) ;
782 printf("*** Leaving TRef() *** \n");
783 printf("*************************************************** \n");
785 fRunLoaderSim->UnloadTrackRefs();
788 //_____________________________________________________________________________
790 AliMUONCheck::CheckOccupancy(Bool_t perDetEle) const
792 /// Check occupancy for the first event selected
794 // Loading MUON subsystem
795 fLoaderSim->LoadDigits("READ");
796 AliMUONData muondata(fLoaderSim,"MUON","MUON");
798 AliMUONDigit * mDigit =0x0;
799 const AliMpVSegmentation * segbend = 0x0;
800 const AliMpVSegmentation * segnonbend = 0x0;
801 AliMpIntPair pad(0,0);
803 Int_t dEoccupancyBending[14][26];
804 Int_t dEoccupancyNonBending[14][26];
805 Int_t cHoccupancyBending[14];
806 Int_t cHoccupancyNonBending[14];
807 Int_t totaloccupancyBending =0;
808 Int_t totaloccupancyNonBending =0;
810 Int_t dEchannelsBending[14][26];
811 Int_t dEchannelsNonBending[14][26];
812 Int_t cHchannelsBending[14];
813 Int_t cHchannelsNonBending[14];
814 Int_t totalchannelsBending =0;
815 Int_t totalchannelsNonBending =0;
817 Int_t nchambers = AliMUONConstants::NCh(); ;
818 for (Int_t ichamber=0; ichamber<nchambers; ichamber++) {
819 cHchannelsBending[ichamber]=0;
820 cHchannelsNonBending[ichamber]=0;
822 for (Int_t idetele=0; idetele<26; idetele++) {
823 Int_t detele = 100*(ichamber +1)+idetele;
824 dEchannelsBending[ichamber][idetele]=0;
825 dEchannelsNonBending[ichamber][idetele]=0;
826 dEoccupancyBending[ichamber][idetele]=0;
827 dEoccupancyNonBending[ichamber][idetele]=0;
828 if ( AliMpDEManager::IsValidDetElemId(detele) ) {
829 segbend = AliMpSegmentation::Instance()
830 ->GetMpSegmentation(detele, AliMp::kCath0);
831 segnonbend = AliMpSegmentation::Instance()
832 ->GetMpSegmentation(detele, AliMp::kCath1);
833 if (AliMpDEManager::GetPlaneType(detele, AliMp::kCath0) != AliMp::kBendingPlane ) {
834 const AliMpVSegmentation* tmp = segbend;
835 segbend = segnonbend;
839 for (Int_t ix=0; ix<=segbend->MaxPadIndexX(); ix++) {
840 for (Int_t iy=0; iy<=segbend->MaxPadIndexY(); iy++) {
843 if( segbend->HasPad(pad) ) {
844 dEchannelsBending[ichamber][idetele]++;
845 cHchannelsBending[ichamber]++;
846 totalchannelsBending++;
850 for (Int_t ix=0; ix<=segnonbend->MaxPadIndexX(); ix++) {
851 for (Int_t iy=0; iy<=segnonbend->MaxPadIndexY(); iy++) {
854 if(segnonbend->HasPad(pad)) {
855 dEchannelsNonBending[ichamber][idetele]++;
856 cHchannelsNonBending[ichamber]++;
857 totalchannelsNonBending++;
861 if (perDetEle) printf(">>> Detection element %4d has %5d channels in bending and %5d channels in nonbending \n",
862 detele, dEchannelsBending[ichamber][idetele], dEchannelsNonBending[ichamber][idetele] );
865 printf(">>> Chamber %2d has %6d channels in bending and %6d channels in nonbending \n",
866 ichamber+1, cHchannelsBending[ichamber], cHchannelsNonBending[ichamber]);
868 printf(">>Spectrometer has %7d channels in bending and %7d channels in nonbending \n",
869 totalchannelsBending, totalchannelsNonBending);
872 printf(">>> Event %d \n", fFirstEvent);
873 fRunLoaderSim->GetEvent(fFirstEvent);
874 muondata.SetTreeAddress("D");
875 muondata.GetDigits();
878 for (Int_t ichamber=0; ichamber<nchambers; ichamber++) {
879 cHoccupancyBending[ichamber] = 0;
880 cHoccupancyNonBending[ichamber]= 0;
883 Int_t ndigits = (Int_t) muondata.Digits(ichamber)->GetEntriesFast();
884 for (Int_t idigit=0; idigit<ndigits; idigit++) {
885 mDigit = static_cast<AliMUONDigit*>(muondata.Digits(ichamber)->At(idigit));
886 Int_t detele = mDigit->DetElemId();
887 Int_t idetele = detele-(ichamber+1)*100;
888 if ( mDigit->Cathode() == 0 ) {
889 cHoccupancyBending[ichamber]++;
890 dEoccupancyBending[ichamber][idetele]++;
891 totaloccupancyBending++;
894 cHoccupancyNonBending[ichamber]++;
895 dEoccupancyNonBending[ichamber][idetele]++;
896 totaloccupancyNonBending++;
900 printf(">>> Chamber %2d nChannels Bending %5d nChannels NonBending %5d \n",
902 cHoccupancyBending[ichamber],
903 cHoccupancyNonBending[ichamber]);
904 printf(">>> Chamber %2d Occupancy Bending %5.2f %% Occupancy NonBending %5.2f %% \n",
906 100.*((Float_t) cHoccupancyBending[ichamber])/((Float_t) cHchannelsBending[ichamber]),
907 100.*((Float_t) cHoccupancyNonBending[ichamber])/((Float_t) cHchannelsBending[ichamber]) );
910 for(Int_t idetele=0; idetele<26; idetele++) {
911 Int_t detele = idetele + 100*(ichamber+1);
912 if ( AliMpDEManager::IsValidDetElemId(detele) ) {
914 printf(">>> DetEle %4d nChannels Bending %5d nChannels NonBending %5d \n",
915 idetele+100*(ichamber+1),
916 dEoccupancyBending[ichamber][idetele],
917 dEoccupancyNonBending[ichamber][idetele]);
918 printf(">>> DetEle %4d Occupancy Bending %5.2f %% Occupancy NonBending %5.2f %% \n",
919 idetele+100*(ichamber+1),
920 100.*((Float_t) dEoccupancyBending[ichamber][idetele])/((Float_t) dEchannelsBending[ichamber][idetele]),
921 100.*((Float_t) dEoccupancyNonBending[ichamber][idetele])/((Float_t) dEchannelsBending[ichamber][idetele]));
925 } // end chamber loop
926 printf(">>> Muon Spectrometer Occupancy Bending %5.2f %% Occupancy NonBending %5.2f %% \n",
927 100.*((Float_t) totaloccupancyBending)/((Float_t) totalchannelsBending),
928 100.*((Float_t) totaloccupancyNonBending)/((Float_t) totalchannelsNonBending) );
929 muondata.ResetDigits();
930 // } // end cathode loop
931 fLoaderSim->UnloadDigits();
934 //_____________________________________________________________________________
936 AliMUONCheck::CheckRecTracks () const
938 /// Reads and dumps rec tracks objects
940 // waiting for mag field in CDB
941 AliInfoStream() << "Loading field map...\n";
942 if (!AliTracker::GetFieldMap()) {
943 AliMagFMaps* field = new AliMagFMaps("Maps","Maps", 1, 1., 10., AliMagFMaps::k5kG);
944 AliTracker::SetFieldMap(field, kFALSE);
948 fLoader->LoadTracks("READ");
950 Int_t endOfLoop = fLastEvent+1;
951 if ( fLastEvent == -1 ) endOfLoop = fRunLoader->GetNumberOfEvents();
953 for (Int_t ievent=fFirstEvent; ievent<endOfLoop; ievent++) {
954 fRunLoader->GetEvent(ievent);
956 fRecData->SetTreeAddress("RT");
957 fRecData->GetRecTracks();
958 TClonesArray* recTracks = fRecData->RecTracks();
960 Int_t nrectracks = (Int_t) recTracks->GetEntriesFast(); //
961 printf(">>> Event %d, Number of Recconstructed tracks %d \n",ievent, nrectracks);
963 // Set the magnetic field for track extrapolations
964 AliMUONTrackExtrap::SetField(AliTracker::GetFieldMap());
967 for (Int_t iRecTracks = 0; iRecTracks < nrectracks; iRecTracks++) {
968 AliMUONTrack* recTrack = (AliMUONTrack*) recTracks->At(iRecTracks);
969 AliMUONTrackParam* trackParam = (AliMUONTrackParam*) (recTrack->GetTrackParamAtHit())->First();
970 AliMUONTrackExtrap::ExtrapToZ(trackParam,0.);
971 recTrack->Print("full");
973 fRecData->ResetRecTracks();
975 fLoader->UnloadTracks();
978 //_____________________________________________________________________________
979 void AliMUONCheck::SetEventsToCheck(Int_t firstEvent, Int_t lastEvent)
981 /// Set first and last event number to check
983 fFirstEvent = firstEvent;
984 fLastEvent = lastEvent;