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::ConnectInputData(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()));
94 // One should first check if the branch address was taken by some other task
95 char ** address = (char **)GetBranchAddress(0, "ESD");
97 fESD = (AliESD*)(*address);
100 SetBranchAddress(0, "ESD", &fESD);
104 //________________________________________________________________________
105 void AliMUONQATask::CreateOutputObjects()
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())) ;
205 fOutputContainer = (TObjArray*)GetOutputData(0);
206 fhMUONVertex = (TH1F*)fOutputContainer->At(0);
207 fhMUONMult = (TH1F*)fOutputContainer->At(1);
209 Int_t eff_match = -1 ;
211 eff_match = 100 * fnTrackTrig / ftracktot ;
213 printf("===================================================\n") ;
214 printf("================ %s ESD SUMMARY ==============\n", GetName()) ;
216 printf(" Total number of processed events %d \n", fnevents) ;
219 printf("Table 4: \n") ;
220 printf(" Global Trigger output Low pt High pt All\n") ;
221 printf(" number of Single Plus :\t");
222 printf("%i\t%i\t%i\t", fSPLowpt, fSPHighpt, fSPAllpt) ;
224 printf(" number of Single Minus :\t");
225 printf("%i\t%i\t%i\t", fSMLowpt, fSMHighpt, fSMAllpt) ;
227 printf(" number of Single Undefined :\t");
228 printf("%i\t%i\t%i\t", fSULowpt, fSUHighpt, fSUAllpt) ;
230 printf(" number of UnlikeSign pair :\t");
231 printf("%i\t%i\t%i\t", fUSLowpt, fUSHighpt, fUSAllpt) ;
233 printf(" number of LikeSign pair :\t");
234 printf("%i\t%i\t%i\t", fLSLowpt, fLSHighpt, fLSAllpt) ;
236 printf("===================================================\n") ;
238 printf("matching efficiency with the trigger for single tracks = %2d %% \n", eff_match);
240 TCanvas * cMUON = new TCanvas("cMUON", "MUON ESD Test", 400, 10, 600, 700) ;
243 fhMUONVertex->Draw() ;
246 cMUON->Print("MUON.eps") ;
249 sprintf(line, ".!tar -zcvf %s.tar.gz *.eps", GetName()) ;
250 gROOT->ProcessLine(line);
251 sprintf(line, ".!rm -fR *.eps");
252 gROOT->ProcessLine(line);
254 AliInfo(Form("!!! All the eps files are in %s.tar.gz !!! \n", GetName())) ;