ParticleRatio Class: Deepika
[u/mrichter/AliRoot.git] / PWGCF / EBYE / PIDFluctuation / task / AliEbyEPidRatioBase.cxx
CommitLineData
0a28d543 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: ALICE Offline. *
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//=========================================================================//
17// AliEbyE Analysis for Particle Ratio Fluctuation //
18// Deepika Rathee | Satyajit Jena //
19// drathee@cern.ch | sjena@cern.ch //
20// Date: Wed Jul 9 18:38:30 CEST 2014 //
21// New approch to find particle ratio to reduce memory //
22// (Test Only) //
23//=========================================================================//
24
25#include "TMath.h"
26#include "TAxis.h"
27
28#include "AliESDEvent.h"
29#include "AliESDInputHandler.h"
30#include "AliStack.h"
31#include "AliMCEvent.h"
32#include "AliESDtrackCuts.h"
33
34#include "AliAODEvent.h"
35#include "AliAODInputHandler.h"
36#include "AliAODMCParticle.h"
37#include "AliEbyEPidRatioBase.h"
38
39using namespace std;
40ClassImp(AliEbyEPidRatioBase)
41//________________________________________________________________________
42AliEbyEPidRatioBase::AliEbyEPidRatioBase() :
43 TNamed(),
44 fHelper(NULL),
45
46 fESD(NULL),
47 fESDTrackCuts(NULL),
48 fAOD(NULL),
49 fArrayMC(NULL),
50 fAODtrackCutBit(1024),
51 fIsMC(kFALSE),
52 fMCEvent(NULL),
53 fStack(NULL),
54
55 fCentralityBin(-1.),
56 fNTracks(0) {
57 // Constructor
58
59 AliLog::SetClassDebugLevel("AliEbyEPidRatioBase",10);
60}
61
62//________________________________________________________________________
63AliEbyEPidRatioBase::AliEbyEPidRatioBase(const Char_t* name, const Char_t* title) :
64 TNamed(name, title),
65 fHelper(NULL),
66
67 fESD(NULL),
68 fESDTrackCuts(NULL),
69 fAOD(NULL),
70 fArrayMC(NULL),
71 fAODtrackCutBit(1024),
72 fIsMC(kFALSE),
73 fMCEvent(NULL),
74 fStack(NULL),
75
76 fCentralityBin(-1.),
77 fNTracks(0) {
78 // Constructor
79
80 AliLog::SetClassDebugLevel("AliEbyEPidRatioBase",10);
81}
82
83//________________________________________________________________________
84AliEbyEPidRatioBase::~AliEbyEPidRatioBase() {
85 // Destructor
86}
87
88//________________________________________________________________________
89void AliEbyEPidRatioBase::Initialize(AliEbyEPidRatioHelper* helper, AliESDtrackCuts* cuts) {
90 fHelper = helper;
91 fESDTrackCuts = (cuts) ? cuts : helper->GetESDTrackCuts();
92 fIsMC = helper->GetIsMC();
93 fAODtrackCutBit = helper->GetAODtrackCutBit();
94 Init();
95 CreateHistograms();
96
97 return;
98}
99
100//________________________________________________________________________
101Int_t AliEbyEPidRatioBase::SetupEvent() {
102 // -- Setup event
103
104 ResetEvent();
105
106 // -- Get ESD objects
107 if (dynamic_cast<AliESDInputHandler*>(fHelper->GetInputEventHandler())) {
108 fESD = dynamic_cast<AliESDEvent*>(fHelper->GetInputEventHandler()->GetEvent());
109 fNTracks = fESD->GetNumberOfTracks();
110 }
111
112 // -- Get AOD objects
113 else if (dynamic_cast<AliAODInputHandler*>(fHelper->GetInputEventHandler())) {
114 fAOD = dynamic_cast<AliAODEvent*>(fHelper->GetInputEventHandler()->GetEvent());
115 fNTracks = fAOD->GetNumberOfTracks();
116
117 if (fIsMC) {
118 fArrayMC = dynamic_cast<TClonesArray*>(fAOD->FindListObject(AliAODMCParticle::StdBranchName()));
119 if (!fArrayMC)
120 AliFatal("No array of MC particles found !!!"); // MW no AliFatal use return values
121 }
122 }
123
124 if (fIsMC) {
125 fMCEvent = fHelper->GetMCEvent();
126 if (fMCEvent)
127 fStack = fMCEvent->Stack();
128 }
129
130 fCentralityBin = fHelper->GetCentralityBin();
131
132 return Setup();
133}
134
135//________________________________________________________________________
136void AliEbyEPidRatioBase::ResetEvent() {
137 // -- Reset ESD Event
138 fESD = NULL;
139 // -- Reset AOD Event
140 fAOD = NULL;
141 // -- Reset MC Event
142 if (fIsMC)
143 fMCEvent = NULL;
144 // -- Reset in class
145 Reset();
146 return;
147}
148
149