]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ANALYSIS/AliAnalysisTaskPIDResponse.cxx
make work the jet events rejection method for AODs
[u/mrichter/AliRoot.git] / ANALYSIS / AliAnalysisTaskPIDResponse.cxx
CommitLineData
66ab8ab2 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
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 **************************************************************************/
15
16/* $Id: AliAnalysisTaskPIDResponse.cxx 43811 2010-09-23 14:13:31Z wiechula $ */
66ab8ab2 17#include <TFile.h>
66ab8ab2 18#include <TChain.h>
19
20#include <AliAnalysisManager.h>
21#include <AliInputEventHandler.h>
22#include <AliVEventHandler.h>
23#include <AliVEvent.h>
24#include <AliVParticle.h>
25#include <AliVTrack.h>
26#include <AliLog.h>
66ab8ab2 27#include <AliPIDResponse.h>
66ab8ab2 28
29#include "AliAnalysisTaskPIDResponse.h"
30
66ab8ab2 31ClassImp(AliAnalysisTaskPIDResponse)
32
33//______________________________________________________________________________
34AliAnalysisTaskPIDResponse::AliAnalysisTaskPIDResponse():
35AliAnalysisTaskSE(),
36fIsMC(kFALSE),
67ad8680 37fOADBPath(),
66ab8ab2 38fPIDResponse(0x0),
66ab8ab2 39fRun(0),
40fOldRun(0),
539a5a59 41fRecoPass(0),
42fIsTunedOnData(kFALSE),
43fRecoPassTuned(0)
66ab8ab2 44{
45 //
46 // Dummy constructor
47 //
48}
49
50//______________________________________________________________________________
51AliAnalysisTaskPIDResponse::AliAnalysisTaskPIDResponse(const char* name):
52AliAnalysisTaskSE(name),
53fIsMC(kFALSE),
67ad8680 54fOADBPath(),
66ab8ab2 55fPIDResponse(0x0),
66ab8ab2 56fRun(0),
57fOldRun(0),
539a5a59 58fRecoPass(0),
59fIsTunedOnData(kFALSE),
60fRecoPassTuned(0)
66ab8ab2 61{
62 //
63 // Default constructor
64 //
65 DefineInput(0,TChain::Class());
66ab8ab2 66}
67
68//______________________________________________________________________________
69AliAnalysisTaskPIDResponse::~AliAnalysisTaskPIDResponse()
70{
71 //
72 // Destructor
73 //
66ab8ab2 74}
75
76//______________________________________________________________________________
77void AliAnalysisTaskPIDResponse::UserCreateOutputObjects()
78{
79 //
80 // Create the output QA objects
81 //
6a45d03f 82
66ab8ab2 83 AliLog::SetClassDebugLevel("AliAnalysisTaskPIDResponse",10);
6a45d03f 84
66ab8ab2 85 //input hander
86 AliAnalysisManager *man=AliAnalysisManager::GetAnalysisManager();
87 AliInputEventHandler *inputHandler=dynamic_cast<AliInputEventHandler*>(man->GetInputEventHandler());
88 if (!inputHandler) AliFatal("Input handler needed");
6a45d03f 89
66ab8ab2 90 //pid response object
91 inputHandler->CreatePIDResponse(fIsMC);
92 fPIDResponse=inputHandler->GetPIDResponse();
87977cf5 93 if (!fPIDResponse) AliFatal("PIDResponse object was not created");
66ab8ab2 94
6a45d03f 95 fPIDResponse->SetOADBPath(AliAnalysisManager::GetOADBPath());
67ad8680 96 if (!fOADBPath.IsNull()) fPIDResponse->SetOADBPath(fOADBPath.Data());
539a5a59 97
98 if(fIsTunedOnData) fPIDResponse->SetTunedOnData(kTRUE,fRecoPassTuned);
66ab8ab2 99}
100
66ab8ab2 101//______________________________________________________________________________
102void AliAnalysisTaskPIDResponse::UserExec(Option_t */*option*/)
103{
66ab8ab2 104 // Setup the PID response functions and fill the QA histograms
105 //
66ab8ab2 106 AliVEvent *event=InputEvent();
107 if (!event) return;
108 fRun=event->GetRunNumber();
6a45d03f 109
66ab8ab2 110 if (fRun!=fOldRun){
6a45d03f 111 SetRecoInfo();
66ab8ab2 112 fOldRun=fRun;
113 }
114
6a45d03f 115 fPIDResponse->InitialiseEvent(event,fRecoPass);
66ab8ab2 116}
117
66ab8ab2 118//______________________________________________________________________________
119void AliAnalysisTaskPIDResponse::SetRecoInfo()
120{
121 //
122 // Set reconstruction information
123 //
124
125 //reset information
126 fRecoPass=0;
66ab8ab2 127
128 //Get the current file to check the reconstruction pass (UGLY, but not stored in ESD... )
129 AliAnalysisManager *mgr=AliAnalysisManager::GetAnalysisManager();
130 AliVEventHandler *inputHandler=mgr->GetInputEventHandler();
131 if (!inputHandler) return;
132
133 TTree *tree= (TTree*)inputHandler->GetTree();
134 TFile *file= (TFile*)tree->GetCurrentFile();
135
136 if (!file) {
137 AliError("Current file not found, cannot set reconstruction information");
138 return;
139 }
66ab8ab2 140
141 //find pass from file name (UGLY, but not stored in ESD... )
142 TString fileName(file->GetName());
5a0aa7cb 143 if (fileName.Contains("pass1") ) {
66ab8ab2 144 fRecoPass=1;
5a0aa7cb 145 } else if (fileName.Contains("pass2") ) {
66ab8ab2 146 fRecoPass=2;
5a0aa7cb 147 } else if (fileName.Contains("pass3") ) {
66ab8ab2 148 fRecoPass=3;
6ca0da23 149 } else if (fileName.Contains("pass4") ) {
150 fRecoPass=4;
151 } else if (fileName.Contains("pass5") ) {
152 fRecoPass=5;
66ab8ab2 153 }
67ad8680 154
ab4db4eb 155 fPIDResponse->SetCurrentFile(fileName.Data());
66ab8ab2 156}