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, AliPerformanceDEdxA, 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 "AliComparisonRes.h"
\r
54 #include "AliComparisonEff.h"
\r
55 #include "AliComparisonDEdx.h"
\r
56 #include "AliComparisonDCA.h"
\r
57 #include "AliComparisonObject.h"
\r
58 #include "AliPerformanceObject.h"
\r
59 #include "AliPerformanceTask.h"
\r
61 using namespace std;
\r
63 ClassImp(AliPerformanceTask)
\r
65 //_____________________________________________________________________________
\r
66 AliPerformanceTask::AliPerformanceTask()
\r
67 : AliAnalysisTask("Performance","Detector Performance")
\r
74 , fUseMCInfo(kFALSE)
\r
75 , fUseESDfriend(kFALSE)
\r
77 // Dummy Constructor
\r
78 // should not be used
\r
81 //_____________________________________________________________________________
\r
82 AliPerformanceTask::AliPerformanceTask(const char *name, const char *title)
\r
83 : AliAnalysisTask(name, title)
\r
90 , fUseMCInfo(kFALSE)
\r
91 , fUseESDfriend(kFALSE)
\r
95 // Define input and output slots here
\r
96 DefineInput(0, TChain::Class());
\r
97 DefineOutput(0, TList::Class());
\r
99 // create the list for comparison objects
\r
100 fCompList = new TList;
\r
103 //_____________________________________________________________________________
\r
104 AliPerformanceTask::~AliPerformanceTask()
\r
106 if(fOutput) delete fOutput; fOutput =0;
\r
107 if(fCompList) delete fCompList; fCompList =0;
\r
110 //_____________________________________________________________________________
\r
111 void AliPerformanceTask::ConnectInputData(Option_t *)
\r
113 // Connect input data
\r
116 TTree *tree = dynamic_cast<TTree*> (GetInputData(0));
\r
118 Printf("ERROR: Could not read chain from input slot 0");
\r
122 AliESDInputHandler *esdH = dynamic_cast<AliESDInputHandler*> (AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler());
\r
124 Printf("ERROR: Could not get ESDInputHandler");
\r
126 fESD = esdH->GetEvent();
\r
129 // use MC information
\r
131 AliMCEventHandler* eventHandler = dynamic_cast<AliMCEventHandler*> (AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler());
\r
132 if (!eventHandler) {
\r
133 Printf("ERROR: Could not retrieve MC event handler");
\r
135 fMC = eventHandler->MCEvent();
\r
140 //_____________________________________________________________________________
\r
141 Bool_t AliPerformanceTask::AddPerformanceObject(AliPerformanceObject *pObj)
\r
143 // add comparison object to the list
\r
145 Printf("ERROR: Could not add comparison object");
\r
149 // add object to the list
\r
150 fCompList->AddLast(pObj);
\r
155 //_____________________________________________________________________________
\r
156 void AliPerformanceTask::CreateOutputObjects()
\r
158 // Create histograms
\r
161 // create output list
\r
162 fOutput = new TList;
\r
163 fOutput->SetOwner();
\r
164 fPitList = fOutput->MakeIterator();
\r
166 // add comparison objects to the output
\r
167 AliPerformanceObject *pObj=0;
\r
169 TIterator *pitCompList = fCompList->MakeIterator();
\r
170 pitCompList->Reset();
\r
171 while(( pObj = (AliPerformanceObject *)pitCompList->Next()) != NULL) {
\r
172 fOutput->Add(pObj);
\r
175 Printf("CreateOutputObjects(): Number of output comparison objects: %d \n", count);
\r
178 //_____________________________________________________________________________
\r
179 void AliPerformanceTask::Exec(Option_t *)
\r
182 // Called for each event
\r
184 AliPerformanceObject *pObj=0;
\r
187 Printf("ERROR: ESD event not available");
\r
191 if (fUseMCInfo && !fMC) {
\r
192 Printf("ERROR: MC event not available");
\r
198 fESDfriend = static_cast<AliESDfriend*>(fESD->FindListObject("AliESDfriend"));
\r
200 Printf("ERROR: ESD friends not available");
\r
205 // Process comparison
\r
207 while(( pObj = (AliPerformanceObject *)fPitList->Next()) != NULL) {
\r
208 pObj->Exec(fMC,fESD,fESDfriend,fUseMCInfo,fUseESDfriend);
\r
211 // Post output data.
\r
212 PostData(0, fOutput);
\r
215 //_____________________________________________________________________________
\r
216 void AliPerformanceTask::Terminate(Option_t *)
\r
218 // Called one at the end
\r
220 // check output data
\r
221 fOutput = dynamic_cast<TList*> (GetOutputData(0));
\r
223 Printf("ERROR: AliPerformanceTask::Terminate(): Output data not avaiable GetOutputData(0)==0x0 ..." );
\r
228 //_____________________________________________________________________________
\r
229 Bool_t AliPerformanceTask::Notify()
\r
231 static Int_t count = 0;
\r
233 Printf("Processing %d. file", count);
\r