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 // An analysis task to check the MUON data in simulated data
20 //*-- Ivana Hrivnacova
21 //////////////////////////////////////////////////////////////////////////////
22 //////////////////////////////////////////////////////////////////////////////
30 #include "AliMUONQATask.h"
33 #include "AliESDVertex.h"
34 #include "AliESDMuonTrack.h"
36 //______________________________________________________________________________
37 AliMUONQATask::AliMUONQATask(const char *name) :
38 AliAnalysisTask(name,""),
63 // Input slot #0 works with an Ntuple
64 DefineInput(0, TChain::Class());
65 // Output slot #0 writes into a TH1 container
66 DefineOutput(0, TObjArray::Class()) ;
69 //______________________________________________________________________________
70 AliMUONQATask::~AliMUONQATask()
73 fOutputContainer->Clear() ;
74 delete fOutputContainer ;
80 //______________________________________________________________________________
81 void AliMUONQATask::Init(const Option_t*)
83 // Initialisation of branch container and histograms
85 AliInfo(Form("*** Initialization of %s", GetName())) ;
88 fChain = dynamic_cast<TChain *>(GetInputData(0)) ;
90 AliError(Form("Input 0 for %s not found\n", GetName()));
95 // One should first check if the branch address was taken by some other task
96 char ** address = (char **)GetBranchAddress(0, "ESD") ;
98 fESD = (AliESD *)(*address) ;
100 fChain->SetBranchAddress("ESD", &fESD) ;
102 // The output objects will be written to
103 TDirectory * cdir = gDirectory ;
104 // Open a file for output #0
105 char outputName[1024] ;
106 sprintf(outputName, "%s.root", GetName() ) ;
107 OpenFile(0, outputName , "RECREATE") ;
112 fhMUONVertex = new TH1F("hMUONVertex","ITS Vertex" ,100, -25., 25.);
113 fhMUONMult = new TH1F("hMUONMult" ,"Multiplicity of ESD tracks",10, -0.5, 9.5);
116 // create output container
118 fOutputContainer = new TObjArray(2) ;
119 fOutputContainer->SetName(GetName()) ;
121 fOutputContainer->AddAt(fhMUONVertex, 0) ;
122 fOutputContainer->AddAt(fhMUONMult, 1) ;
125 //______________________________________________________________________________
126 void AliMUONQATask::Exec(Option_t *)
128 // Processing of one event
132 Long64_t entry = fChain->GetReadEntry() ;
135 AliError("fESD is not connected to the input!") ;
139 if ( !((entry-1)%100) )
140 AliInfo(Form("%s ----> Processing event # %lld", (dynamic_cast<TChain *>(fChain))->GetFile()->GetName(), entry)) ;
142 // ************************ MUON *************************************
144 const AliESDVertex* vertex = dynamic_cast<const AliESDVertex*>(fESD->GetVertex()) ;
146 Double_t zVertex = 0. ;
148 zVertex = vertex->GetZv() ;
150 Int_t nTracks = fESD->GetNumberOfMuonTracks() ;
152 ULong64_t trigWord = fESD->GetTriggerMask() ;
162 if (trigWord & 0x010)
164 if (trigWord & 0x020)
166 if (trigWord & 0x040)
168 if (trigWord & 0x080)
170 if (trigWord & 0x100)
172 if (trigWord & 0x200)
174 if (trigWord & 0x400)
176 if (trigWord & 0x800)
178 if (trigWord & 0x1000)
180 if (trigWord & 0x2000)
182 if (trigWord & 0x4000)
185 Int_t tracktrig = 0 ;
188 for (iTrack1 = 0 ; iTrack1 < nTracks ; iTrack1++) { //1st loop
189 AliESDMuonTrack* muonTrack = fESD->GetMuonTrack(iTrack1) ;
191 if(muonTrack->GetMatchTrigger()) {
197 fhMUONVertex->Fill(zVertex) ;
198 fhMUONMult->Fill(Float_t(nTracks)) ;
200 PostData(0, fOutputContainer);
203 //______________________________________________________________________________
204 void AliMUONQATask::Terminate(Option_t *)
206 // Processing when the event loop is ended
208 AliInfo(Form("Terminate %s:", GetName())) ;
210 Int_t eff_match = -1 ;
212 eff_match = 100 * fnTrackTrig / ftracktot ;
214 printf("===================================================\n") ;
215 printf("================ %s ESD SUMMARY ==============\n", GetName()) ;
217 printf(" Total number of processed events %d \n", fnevents) ;
220 printf("Table 4: \n") ;
221 printf(" Global Trigger output Low pt High pt All\n") ;
222 printf(" number of Single Plus :\t");
223 printf("%i\t%i\t%i\t", fSPLowpt, fSPHighpt, fSPAllpt) ;
225 printf(" number of Single Minus :\t");
226 printf("%i\t%i\t%i\t", fSMLowpt, fSMHighpt, fSMAllpt) ;
228 printf(" number of Single Undefined :\t");
229 printf("%i\t%i\t%i\t", fSULowpt, fSUHighpt, fSUAllpt) ;
231 printf(" number of UnlikeSign pair :\t");
232 printf("%i\t%i\t%i\t", fUSLowpt, fUSHighpt, fUSAllpt) ;
234 printf(" number of LikeSign pair :\t");
235 printf("%i\t%i\t%i\t", fLSLowpt, fLSHighpt, fLSAllpt) ;
237 printf("===================================================\n") ;
239 printf("matching efficiency with the trigger for single tracks = %2d %% \n", eff_match);
241 TCanvas * cMUON = new TCanvas("cMUON", "MUON ESD Test", 400, 10, 600, 700) ;
244 fhMUONVertex->Draw() ;
247 cMUON->Print("MUON.eps") ;
250 sprintf(line, ".!tar -zcvf %s.tar.gz *.eps", GetName()) ;
251 gROOT->ProcessLine(line);
252 sprintf(line, ".!rm -fR *.eps");
253 gROOT->ProcessLine(line);
255 AliInfo(Form("!!! All the eps files are in %s.tar.gz !!! \n", GetName())) ;