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 **************************************************************************/
15 // An analysis task to check the MUON data in simulated data
17 //*-- Ivana Hrivnacova
18 //////////////////////////////////////////////////////////////////////////////
19 //////////////////////////////////////////////////////////////////////////////
26 #include "AliMUONQATask.h"
29 #include "AliESDVertex.h"
30 #include "AliESDMuonTrack.h"
32 //______________________________________________________________________________
33 AliMUONQATask::AliMUONQATask(const char *name) :
34 AliAnalysisTask(name,""),
59 // Input slot #0 works with an Ntuple
60 DefineInput(0, TChain::Class());
61 // Output slot #0 writes into a TH1 container
62 DefineOutput(0, TObjArray::Class()) ;
65 //______________________________________________________________________________
66 AliMUONQATask::~AliMUONQATask()
69 fOutputContainer->Clear() ;
70 delete fOutputContainer ;
76 //______________________________________________________________________________
77 void AliMUONQATask::Init(const Option_t*)
79 // Initialisation of branch container and histograms
81 AliInfo(Form("*** Initialization of %s", GetName())) ;
84 fChain = dynamic_cast<TChain *>(GetInputData(0)) ;
86 AliError(Form("Input 0 for %s not found\n", GetName()));
91 // One should first check if the branch address was taken by some other task
92 char ** address = (char **)GetBranchAddress(0, "ESD") ;
94 fESD = (AliESD *)(*address) ;
96 fChain->SetBranchAddress("ESD", &fESD) ;
98 // The output objects will be written to
99 TDirectory * cdir = gDirectory ;
100 // Open a file for output #0
101 char outputName[1024] ;
102 sprintf(outputName, "%s.root", GetName() ) ;
103 OpenFile(0, outputName , "RECREATE") ;
108 fhMUONVertex = new TH1F("hMUONVertex","ITS Vertex" ,100, -25., 25.);
109 fhMUONMult = new TH1F("hMUONMult" ,"Multiplicity of ESD tracks",10, -0.5, 9.5);
112 // create output container
114 fOutputContainer = new TObjArray(2) ;
115 fOutputContainer->SetName(GetName()) ;
117 fOutputContainer->AddAt(fhMUONVertex, 0) ;
118 fOutputContainer->AddAt(fhMUONMult, 1) ;
121 //______________________________________________________________________________
122 void AliMUONQATask::Exec(Option_t *)
124 // Processing of one event
128 Long64_t entry = fChain->GetReadEntry() ;
131 AliError("fESD is not connected to the input!") ;
135 if ( !((entry-1)%100) )
136 AliInfo(Form("%s ----> Processing event # %lld", (dynamic_cast<TChain *>(fChain))->GetFile()->GetName(), entry)) ;
138 // ************************ MUON *************************************
140 const AliESDVertex* vertex = dynamic_cast<const AliESDVertex*>(fESD->GetVertex()) ;
142 Double_t zVertex = 0. ;
144 zVertex = vertex->GetZv() ;
146 Int_t nTracks = fESD->GetNumberOfMuonTracks() ;
148 ULong64_t trigWord = fESD->GetTriggerMask() ;
158 if (trigWord & 0x010)
160 if (trigWord & 0x020)
162 if (trigWord & 0x040)
164 if (trigWord & 0x080)
166 if (trigWord & 0x100)
168 if (trigWord & 0x200)
170 if (trigWord & 0x400)
172 if (trigWord & 0x800)
174 if (trigWord & 0x1000)
176 if (trigWord & 0x2000)
178 if (trigWord & 0x4000)
181 Int_t tracktrig = 0 ;
184 for (iTrack1 = 0 ; iTrack1 < nTracks ; iTrack1++) { //1st loop
185 AliESDMuonTrack* muonTrack = fESD->GetMuonTrack(iTrack1) ;
187 if(muonTrack->GetMatchTrigger()) {
193 fhMUONVertex->Fill(zVertex) ;
194 fhMUONMult->Fill(Float_t(nTracks)) ;
196 PostData(0, fOutputContainer);
199 //______________________________________________________________________________
200 void AliMUONQATask::Terminate(Option_t *)
202 // Processing when the event loop is ended
204 AliInfo(Form("Terminate %s:", GetName())) ;
206 Int_t eff_match = 100 * fnTrackTrig / ftracktot ;
208 printf("===================================================\n") ;
209 printf("================ %s ESD SUMMARY ==============\n", GetName()) ;
211 printf(" Total number of processed events %d \n", fnevents) ;
214 printf("Table 4: \n") ;
215 printf(" Global Trigger output Low pt High pt All\n") ;
216 printf(" number of Single Plus :\t");
217 printf("%i\t%i\t%i\t", fSPLowpt, fSPHighpt, fSPAllpt) ;
219 printf(" number of Single Minus :\t");
220 printf("%i\t%i\t%i\t", fSMLowpt, fSMHighpt, fSMAllpt) ;
222 printf(" number of Single Undefined :\t");
223 printf("%i\t%i\t%i\t", fSULowpt, fSUHighpt, fSUAllpt) ;
225 printf(" number of UnlikeSign pair :\t");
226 printf("%i\t%i\t%i\t", fUSLowpt, fUSHighpt, fUSAllpt) ;
228 printf(" number of LikeSign pair :\t");
229 printf("%i\t%i\t%i\t", fLSLowpt, fLSHighpt, fLSAllpt) ;
231 printf("===================================================\n") ;
233 printf("matching efficiency with the trigger for single tracks = %2d %% \n", eff_match);
235 TCanvas * cMUON = new TCanvas("cMUON", "MUON ESD Test", 400, 10, 600, 700) ;
238 fhMUONVertex->Draw() ;
241 cMUON->Print("MUON.eps") ;
244 sprintf(line, ".!tar -zcvf %s.tar.gz *.eps", GetName()) ;
245 gROOT->ProcessLine(line);
246 sprintf(line, ".!rm -fR *.eps");
247 gROOT->ProcessLine(line);
249 AliInfo(Form("!!! All the eps files are in %s.tar.gz !!! \n", GetName())) ;