1 /**************************************************************************
\r
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
\r
4 * Author: The ALICE Off-line Project. *
\r
5 * Contributors are mentioned in the code where appropriate. *
\r
7 * Permission to use, copy, modify and distribute this software and its *
\r
8 * documentation strictly for non-commercial purposes is hereby granted *
\r
9 * without fee, provided that the above copyright notice appears in all *
\r
10 * copies and that both the copyright notice and this permission notice *
\r
11 * appear in the supporting documentation. The authors make no claims *
\r
12 * about the suitability of this software for any purpose. It is *
\r
13 * provided "as is" without express or implied warranty. *
\r
14 **************************************************************************/
\r
16 //------------------------------------------------------------------------------
\r
17 // Implementation of the AliPerformanceTask class. It checks reconstruction performance
\r
18 // for the reconstructed vs MC particle tracks under several conditions. For real data
\r
19 // the control QA histograms are filled.
\r
21 // The comparison output objects deriving from AliPerformanceObject
\r
22 // (e.g. AliPerformanceRes, AliPerformanceEff, AliPerformanceDEdx, AliPerformanceDCA ...)
\r
23 // are stored in the output file (details in description of these classes).
\r
25 // Author: J.Otwinowski 01/04/2009
\r
26 //------------------------------------------------------------------------------
\r
33 #include "TCanvas.h"
\r
37 #include "AliAnalysisTask.h"
\r
38 #include "AliAnalysisManager.h"
\r
39 #include "AliESDEvent.h"
\r
40 #include "AliESDfriend.h"
\r
41 #include "AliMCEvent.h"
\r
42 #include "AliESDInputHandler.h"
\r
43 #include "AliMCEventHandler.h"
\r
44 #include "AliESDVertex.h"
\r
45 #include "AliMagF.h"
\r
46 #include "AliTracker.h"
\r
47 #include "AliGeomManager.h"
\r
49 #include "AliMCInfo.h"
\r
50 #include "AliESDRecInfo.h"
\r
51 #include "AliMCInfoCuts.h"
\r
52 #include "AliRecInfoCuts.h"
\r
53 #include "AliComparisonObject.h"
\r
54 #include "AliPerformanceObject.h"
\r
55 #include "AliPerformanceTask.h"
\r
57 using namespace std;
\r
59 ClassImp(AliPerformanceTask)
\r
61 //_____________________________________________________________________________
\r
62 AliPerformanceTask::AliPerformanceTask()
\r
63 : AliAnalysisTask("Performance","Detector Performance")
\r
70 , fUseMCInfo(kFALSE)
\r
71 , fUseESDfriend(kFALSE)
\r
73 // Dummy Constructor
\r
74 // should not be used
\r
77 //_____________________________________________________________________________
\r
78 AliPerformanceTask::AliPerformanceTask(const char *name, const char *title)
\r
79 : AliAnalysisTask(name, title)
\r
86 , fUseMCInfo(kFALSE)
\r
87 , fUseESDfriend(kFALSE)
\r
91 // Define input and output slots here
\r
92 DefineInput(0, TChain::Class());
\r
93 DefineOutput(0, TList::Class());
\r
95 // create the list for comparison objects
\r
96 fCompList = new TList;
\r
99 //_____________________________________________________________________________
\r
100 AliPerformanceTask::~AliPerformanceTask()
\r
102 if(fOutput) delete fOutput; fOutput =0;
\r
103 if(fCompList) delete fCompList; fCompList =0;
\r
106 //_____________________________________________________________________________
\r
107 void AliPerformanceTask::ConnectInputData(Option_t *)
\r
109 // Connect input data
\r
112 TTree *tree = dynamic_cast<TTree*> (GetInputData(0));
\r
114 Printf("ERROR: Could not read chain from input slot 0");
\r
118 AliESDInputHandler *esdH = dynamic_cast<AliESDInputHandler*> (AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler());
\r
120 Printf("ERROR: Could not get ESDInputHandler");
\r
122 fESD = esdH->GetEvent();
\r
126 fESDfriend = static_cast<AliESDfriend*>(fESD->FindListObject("AliESDfriend"));
\r
128 Printf("ERROR: ESD friends not available");
\r
133 // use MC information
\r
135 AliMCEventHandler* eventHandler = dynamic_cast<AliMCEventHandler*> (AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler());
\r
136 if (!eventHandler) {
\r
137 Printf("ERROR: Could not retrieve MC event handler");
\r
139 fMC = eventHandler->MCEvent();
\r
144 //_____________________________________________________________________________
\r
145 Bool_t AliPerformanceTask::AddPerformanceObject(AliPerformanceObject *pObj)
\r
147 // add comparison object to the list
\r
149 Printf("ERROR: Could not add comparison object");
\r
153 // add object to the list
\r
154 fCompList->AddLast(pObj);
\r
159 //_____________________________________________________________________________
\r
160 void AliPerformanceTask::CreateOutputObjects()
\r
162 // Create histograms
\r
165 // create output list
\r
166 fOutput = new TList;
\r
167 fOutput->SetOwner();
\r
168 fPitList = fOutput->MakeIterator();
\r
170 // add comparison objects to the output
\r
171 AliPerformanceObject *pObj=0;
\r
173 TIterator *pitCompList = fCompList->MakeIterator();
\r
174 pitCompList->Reset();
\r
175 while(( pObj = (AliPerformanceObject *)pitCompList->Next()) != NULL) {
\r
176 fOutput->Add(pObj);
\r
179 Printf("CreateOutputObjects(): Number of output comparison objects: %d \n", count);
\r
182 //_____________________________________________________________________________
\r
183 void AliPerformanceTask::Exec(Option_t *)
\r
186 // Called for each event
\r
188 AliPerformanceObject *pObj=0;
\r
191 Printf("ERROR: ESD event not available");
\r
195 if (fUseMCInfo && !fMC) {
\r
196 Printf("ERROR: MC event not available");
\r
203 Printf("ERROR: ESD friends not available");
\r
207 // Process comparison
\r
209 while(( pObj = (AliPerformanceObject *)fPitList->Next()) != NULL) {
\r
210 pObj->Exec(fMC,fESD,fESDfriend,fUseMCInfo,fUseESDfriend);
\r
213 // Post output data.
\r
214 PostData(0, fOutput);
\r
217 //_____________________________________________________________________________
\r
218 void AliPerformanceTask::Terminate(Option_t *)
\r
220 // Called one at the end
\r
222 // check output data
\r
223 fOutput = dynamic_cast<TList*> (GetOutputData(0));
\r
225 Printf("ERROR: AliPerformanceTask::Terminate(): Output data not avaiable GetOutputData(0)==0x0 ..." );
\r
230 //_____________________________________________________________________________
\r
231 Bool_t AliPerformanceTask::Notify()
\r
233 static Int_t count = 0;
\r
235 Printf("Processing %d. file", count);
\r