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 **************************************************************************/
16 /* $Id: AliAnalysisTaskPIDResponse.cxx 43811 2010-09-23 14:13:31Z wiechula $ */
20 #include <AliAnalysisManager.h>
21 #include <AliInputEventHandler.h>
22 #include <AliVEventHandler.h>
23 #include <AliVEvent.h>
24 #include <AliVParticle.h>
25 #include <AliVTrack.h>
27 #include <AliPIDResponse.h>
29 #include "AliAnalysisTaskPIDResponse.h"
31 ClassImp(AliAnalysisTaskPIDResponse)
33 //______________________________________________________________________________
34 AliAnalysisTaskPIDResponse::AliAnalysisTaskPIDResponse():
48 //______________________________________________________________________________
49 AliAnalysisTaskPIDResponse::AliAnalysisTaskPIDResponse(const char* name):
50 AliAnalysisTaskSE(name),
59 // Default constructor
61 DefineInput(0,TChain::Class());
64 //______________________________________________________________________________
65 AliAnalysisTaskPIDResponse::~AliAnalysisTaskPIDResponse()
72 //______________________________________________________________________________
73 void AliAnalysisTaskPIDResponse::UserCreateOutputObjects()
76 // Create the output QA objects
79 AliLog::SetClassDebugLevel("AliAnalysisTaskPIDResponse",10);
82 AliAnalysisManager *man=AliAnalysisManager::GetAnalysisManager();
83 AliInputEventHandler *inputHandler=dynamic_cast<AliInputEventHandler*>(man->GetInputEventHandler());
84 if (!inputHandler) AliFatal("Input handler needed");
87 inputHandler->CreatePIDResponse(fIsMC);
88 fPIDResponse=inputHandler->GetPIDResponse();
89 if (!fPIDResponse) AliFatal("PIDResponse object was not created");
91 fPIDResponse->SetOADBPath(AliAnalysisManager::GetOADBPath());
92 if (!fOADBPath.IsNull()) fPIDResponse->SetOADBPath(fOADBPath.Data());
95 //______________________________________________________________________________
96 void AliAnalysisTaskPIDResponse::UserExec(Option_t */*option*/)
98 // Setup the PID response functions and fill the QA histograms
100 AliVEvent *event=InputEvent();
102 fRun=event->GetRunNumber();
109 fPIDResponse->InitialiseEvent(event,fRecoPass);
112 //______________________________________________________________________________
113 void AliAnalysisTaskPIDResponse::SetRecoInfo()
116 // Set reconstruction information
122 //Get the current file to check the reconstruction pass (UGLY, but not stored in ESD... )
123 AliAnalysisManager *mgr=AliAnalysisManager::GetAnalysisManager();
124 AliVEventHandler *inputHandler=mgr->GetInputEventHandler();
125 if (!inputHandler) return;
127 TTree *tree= (TTree*)inputHandler->GetTree();
128 TFile *file= (TFile*)tree->GetCurrentFile();
131 AliError("Current file not found, cannot set reconstruction information");
135 //find pass from file name (UGLY, but not stored in ESD... )
136 TString fileName(file->GetName());
137 if (fileName.Contains("/pass1") || fileName.Contains(".pass1") ) {
139 } else if (fileName.Contains("/pass2") || fileName.Contains(".pass2")) {
141 } else if (fileName.Contains("/pass3") || fileName.Contains(".pass3")) {
145 fPIDResponse->SetCurrentFile(fileName.Data());