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 "AliMCEvent.h"
\r
41 #include "AliESDInputHandler.h"
\r
42 #include "AliMCEventHandler.h"
\r
43 #include "AliESDVertex.h"
\r
44 #include "AliMagF.h"
\r
45 #include "AliTracker.h"
\r
46 #include "AliGeomManager.h"
\r
48 #include "AliMCInfo.h"
\r
49 #include "AliESDRecInfo.h"
\r
50 #include "AliMCInfoCuts.h"
\r
51 #include "AliRecInfoCuts.h"
\r
52 #include "AliComparisonRes.h"
\r
53 #include "AliComparisonEff.h"
\r
54 #include "AliComparisonDEdx.h"
\r
55 #include "AliComparisonDCA.h"
\r
56 #include "AliComparisonObject.h"
\r
57 #include "AliPerformanceObject.h"
\r
58 #include "AliPerformanceTask.h"
\r
60 using namespace std;
\r
62 ClassImp(AliPerformanceTask)
\r
64 //_____________________________________________________________________________
\r
65 AliPerformanceTask::AliPerformanceTask()
\r
66 : AliAnalysisTask("Performance","Detector Performance")
\r
72 , fUseMCInfo(kFALSE)
\r
74 // Dummy Constructor
\r
75 // should not be used
\r
78 //_____________________________________________________________________________
\r
79 AliPerformanceTask::AliPerformanceTask(const char *name, const char *title)
\r
80 : AliAnalysisTask(name, title)
\r
86 , fUseMCInfo(kFALSE)
\r
90 // Define input and output slots here
\r
91 DefineInput(0, TChain::Class());
\r
92 DefineOutput(0, TList::Class());
\r
94 // create the list for comparison objects
\r
95 fCompList = new TList;
\r
98 //_____________________________________________________________________________
\r
99 AliPerformanceTask::~AliPerformanceTask()
\r
101 if(fOutput) delete fOutput; fOutput =0;
\r
102 if(fCompList) delete fCompList; fCompList =0;
\r
105 //_____________________________________________________________________________
\r
106 void AliPerformanceTask::ConnectInputData(Option_t *)
\r
108 // Connect input data
\r
111 TTree *tree = dynamic_cast<TTree*> (GetInputData(0));
\r
113 Printf("ERROR: Could not read chain from input slot 0");
\r
117 AliESDInputHandler *esdH = dynamic_cast<AliESDInputHandler*> (AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler());
\r
119 Printf("ERROR: Could not get ESDInputHandler");
\r
121 fESD = esdH->GetEvent();
\r
123 // Enable only the needed branches
\r
124 //esdH->SetActiveBranches("AliESDHeader Vertex Tracks");
\r
127 // use MC information
\r
129 AliMCEventHandler* eventHandler = dynamic_cast<AliMCEventHandler*> (AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler());
\r
130 if (!eventHandler) {
\r
131 Printf("ERROR: Could not retrieve MC event handler");
\r
133 fMC = eventHandler->MCEvent();
\r
138 //_____________________________________________________________________________
\r
139 Bool_t AliPerformanceTask::AddPerformanceObject(AliPerformanceObject *pObj)
\r
141 // add comparison object to the list
\r
143 Printf("ERROR: Could not add comparison object");
\r
147 // add object to the list
\r
148 fCompList->AddLast(pObj);
\r
153 //_____________________________________________________________________________
\r
154 void AliPerformanceTask::CreateOutputObjects()
\r
156 // Create histograms
\r
159 // create output list
\r
160 fOutput = new TList;
\r
161 fOutput->SetOwner();
\r
162 fPitList = fOutput->MakeIterator();
\r
164 // add comparison objects to the output
\r
165 AliPerformanceObject *pObj=0;
\r
167 TIterator *pitCompList = fCompList->MakeIterator();
\r
168 pitCompList->Reset();
\r
169 while(( pObj = (AliPerformanceObject *)pitCompList->Next()) != NULL) {
\r
170 fOutput->Add(pObj);
\r
173 Printf("CreateOutputObjects(): Number of output comparison objects: %d \n", count);
\r
176 //_____________________________________________________________________________
\r
177 void AliPerformanceTask::Exec(Option_t *)
\r
180 // Called for each event
\r
182 AliPerformanceObject *pObj=0;
\r
185 Printf("ERROR: ESD event not available");
\r
189 if (fUseMCInfo && !fMC) {
\r
190 Printf("ERROR: MC event not available");
\r
194 // Process comparison
\r
196 while(( pObj = (AliPerformanceObject *)fPitList->Next()) != NULL) {
\r
197 pObj->Exec(fMC,fESD,fUseMCInfo);
\r
200 // Post output data.
\r
201 PostData(0, fOutput);
\r
204 //_____________________________________________________________________________
\r
205 void AliPerformanceTask::Terminate(Option_t *)
\r
207 // Called one at the end
\r
209 // check output data
\r
210 fOutput = dynamic_cast<TList*> (GetOutputData(0));
\r
212 Printf("ERROR: AliPerformanceTask::Terminate(): Output data not avaiable GetOutputData(0)==0x0 ..." );
\r
217 //_____________________________________________________________________________
\r
218 Bool_t AliPerformanceTask::Notify()
\r
220 static Int_t count = 0;
\r
222 Printf("Processing %d. file", count);
\r