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 // Changes by M.Knichel and H.Erdal 27/07/2010
\r
27 //------------------------------------------------------------------------------
\r
34 #include "TCanvas.h"
\r
38 #include "AliAnalysisTask.h"
\r
39 #include "AliAnalysisManager.h"
\r
40 #include "AliESDEvent.h"
\r
41 #include "AliESDfriend.h"
\r
42 #include "AliMCEvent.h"
\r
43 #include "AliESDInputHandler.h"
\r
44 #include "AliMCEventHandler.h"
\r
45 #include "AliESDVertex.h"
\r
46 #include "AliMagF.h"
\r
47 #include "AliTracker.h"
\r
48 #include "AliGeomManager.h"
\r
50 #include "AliMCInfo.h"
\r
51 #include "AliESDRecInfo.h"
\r
52 #include "AliMCInfoCuts.h"
\r
53 #include "AliRecInfoCuts.h"
\r
54 #include "AliComparisonObject.h"
\r
55 #include "AliPerformanceObject.h"
\r
56 #include "AliPerformanceTask.h"
\r
58 using namespace std;
\r
60 ClassImp(AliPerformanceTask)
\r
62 //_____________________________________________________________________________
\r
63 AliPerformanceTask::AliPerformanceTask()
\r
64 : AliAnalysisTaskSE("Performance")
\r
71 , fUseMCInfo(kFALSE)
\r
72 , fUseESDfriend(kFALSE)
\r
75 // Dummy Constructor
\r
76 // should not be used
\r
79 //_____________________________________________________________________________
\r
80 AliPerformanceTask::AliPerformanceTask(const char *name, const char */*title*/)
\r
81 : AliAnalysisTaskSE(name)
\r
88 , fUseMCInfo(kFALSE)
\r
89 , fUseESDfriend(kFALSE)
\r
94 // Define input and output slots here
\r
95 DefineOutput(1, TList::Class());
\r
97 // create the list for comparison objects
\r
98 fCompList = new TList;
\r
101 //_____________________________________________________________________________
\r
102 AliPerformanceTask::~AliPerformanceTask()
\r
104 if(fOutput) delete fOutput; fOutput = 0;
\r
105 if(fCompList) delete fCompList; fCompList = 0;
\r
108 //_____________________________________________________________________________
\r
109 Bool_t AliPerformanceTask::AddPerformanceObject(AliPerformanceObject *pObj)
\r
111 // add comparison object to the list
\r
113 Printf("ERROR: Could not add comparison object");
\r
117 // add object to the list
\r
118 fCompList->AddLast(pObj);
\r
123 //_____________________________________________________________________________
\r
124 void AliPerformanceTask::UserCreateOutputObjects()
\r
126 // Create histograms
\r
129 // create output list
\r
130 fOutput = new TList;
\r
131 fOutput->SetOwner();
\r
132 fPitList = fOutput->MakeIterator();
\r
134 // add comparison objects to the output
\r
135 AliPerformanceObject *pObj=0;
\r
137 TIterator *pitCompList = fCompList->MakeIterator();
\r
138 pitCompList->Reset();
\r
139 while(( pObj = (AliPerformanceObject *)pitCompList->Next()) != NULL) {
\r
140 fOutput->Add(pObj);
\r
143 Printf("CreateOutputObjects(): Number of output comparison objects: %d \n", count);
\r
146 //_____________________________________________________________________________
\r
147 void AliPerformanceTask::UserExec(Option_t *)
\r
150 // Called for each event
\r
152 // Decide whether to use HLT or Offline ESD
\r
155 AliESDInputHandler *esdH = dynamic_cast<AliESDInputHandler*>
\r
156 (AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler());
\r
159 printf("ERROR: Could not get ESDInputHandler");
\r
162 fESD = esdH->GetHLTEvent();
\r
165 fESD = (AliESDEvent*) (InputEvent());
\r
169 fESDfriend = static_cast<AliESDfriend*>(fESD->FindListObject("AliESDfriend"));
\r
171 Printf("ERROR: ESD friends not available");
\r
180 AliPerformanceObject *pObj=0;
\r
183 Printf("ERROR: ESD event not available");
\r
187 if (fUseMCInfo && !fMC) {
\r
188 Printf("ERROR: MC event not available");
\r
195 Printf("ERROR: ESD friends not available");
\r
199 // Process comparison
\r
201 while(( pObj = (AliPerformanceObject *)fPitList->Next()) != NULL) {
\r
202 pObj->Exec(fMC,fESD,fESDfriend,fUseMCInfo,fUseESDfriend);
\r
205 // Post output data.
\r
206 PostData(1, fOutput);
\r
209 //_____________________________________________________________________________
\r
210 void AliPerformanceTask::Terminate(Option_t *)
\r
212 // Called once at the end
\r
214 // check output data
\r
215 fOutput = dynamic_cast<TList*> (GetOutputData(1));
\r
217 Printf("ERROR: AliPerformanceTask::Terminate(): fOutput data not avaiable ..." );
\r
221 AliPerformanceObject* pObj=0;
\r
222 TIterator* itOut = fOutput->MakeIterator();
\r
224 while(( pObj = dynamic_cast<AliPerformanceObject*>(itOut->Next())) != NULL) {
\r
230 //_____________________________________________________________________________
\r
231 Bool_t AliPerformanceTask::Notify()
\r
233 static Int_t count = 0;
\r
235 Printf("Processing %d. file", count);
\r