]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG4/PartCorrDep/AliAnaCaloTrigger.cxx
Updated D0 systematic errors for PbPb 40-80
[u/mrichter/AliRoot.git] / PWG4 / PartCorrDep / AliAnaCaloTrigger.cxx
CommitLineData
1c5acb87 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//_________________________________________________________________________
17// An analysis task to check the trigger data in ESD
18// Creates an ntuple for 2x2 and NxN triggers
19// Each ntuple connects the maximum trigger amplitudes
20// and its positions with reconstructed clusters
6639984f 21// and if MC stack available, with pt of parent.
1c5acb87 22//
23//*-- Yves Schutz (CERN) & Gustavo Conesa Balbastre (INFN-LNF)
24//////////////////////////////////////////////////////////////////////////////
6639984f 25//Root
1c5acb87 26#include <TNtuple.h>
27#include <TVector3.h>
28
6639984f 29//Aliroot
1c5acb87 30#include "AliAnaCaloTrigger.h"
6639984f 31#include "AliStack.h"
1c5acb87 32#include "AliESDCaloCluster.h"
6639984f 33#include "AliMCEvent.h"
34#include "AliESDEvent.h"
1c5acb87 35
36//______________________________________________________________________________
37AliAnaCaloTrigger::AliAnaCaloTrigger() :
1c5acb87 38 fOutputContainer(0),
39 fCalorimeter("PHOS"),
40 fNtTrigger22(0),
41 fNtTriggerNN(0)
1c5acb87 42{
43 // Default Constructor.
44
45}
46
47//______________________________________________________________________________
48AliAnaCaloTrigger::AliAnaCaloTrigger(const char *name) :
6639984f 49 AliAnalysisTaskSE(name),
1c5acb87 50 fOutputContainer(0),
51 fCalorimeter("PHOS"),
52 fNtTrigger22(0),
53 fNtTriggerNN(0)
1c5acb87 54{
55 // Constructor.
6639984f 56 // Output slot
57 DefineOutput(1, TList::Class()) ;
1c5acb87 58}
6639984f 59
1c5acb87 60//____________________________________________________________________________
61AliAnaCaloTrigger::AliAnaCaloTrigger(const AliAnaCaloTrigger & ct) :
6639984f 62 AliAnalysisTaskSE(ct.GetName()),
1c5acb87 63 fOutputContainer(ct.fOutputContainer), fCalorimeter(ct. fCalorimeter),
64 fNtTrigger22(ct.fNtTrigger22), fNtTriggerNN(ct.fNtTriggerNN)
65{
66
67 // cpy ctor
6639984f 68
1c5acb87 69}
70
71//_________________________________________________________________________
72AliAnaCaloTrigger & AliAnaCaloTrigger::operator = (const AliAnaCaloTrigger & source)
73{
74 // assignment operator
75
6639984f 76 //if(&source == this) return *this;
77 this->~AliAnaCaloTrigger();
78 new(this) AliAnaCaloTrigger(source);
1c5acb87 79
1c5acb87 80 fOutputContainer = source.fOutputContainer ;
81 fCalorimeter = source. fCalorimeter ;
82 fNtTrigger22 = source.fNtTrigger22 ;
83 fNtTriggerNN = source.fNtTriggerNN ;
84
85 return *this;
86
87}
88
89//______________________________________________________________________________
90AliAnaCaloTrigger::~AliAnaCaloTrigger()
91{
92 // dtor
477d6cee 93 if(fOutputContainer){
94 fOutputContainer->Clear() ;
95 delete fOutputContainer ;
96 }
1c5acb87 97}
98
99
1c5acb87 100//________________________________________________________________________
101
6639984f 102void AliAnaCaloTrigger::UserCreateOutputObjects()
1c5acb87 103{
104
105 // Create the outputs containers
6639984f 106 OpenFile(1) ;
1c5acb87 107
108 // create histograms
6639984f 109 fNtTrigger22 = new TNtuple(fCalorimeter+"trigger22", "Trigger data 2x2 patch", "a22:a220:ptGen:enMax:phEnMax:eta22:phi22:etaMax:phiMax:phEtaMax:phPhiMax");
110 fNtTriggerNN = new TNtuple(fCalorimeter+"triggerNN", "Trigger data NxN patch", "aNN:aNN0:ptGen:enMax:phEnMax:etaNN:phiNN:etaMax:phiMax:phEtaMax:phPhiMax");
1c5acb87 111
112 // create output container
113
6639984f 114 fOutputContainer = new TList() ;
1c5acb87 115 fOutputContainer->SetName(GetName()) ;
116
117 fOutputContainer->AddAt(fNtTrigger22, 0) ;
118 fOutputContainer->AddAt(fNtTriggerNN, 1) ;
119
120}
121
122//______________________________________________________________________________
6639984f 123void AliAnaCaloTrigger::UserExec(Option_t *)
1c5acb87 124{
477d6cee 125 // Processing of one event
126
127 if ( !((Entry()-1)%100) )
128 printf(" Processing event # %lld\n", Entry()) ;
e615d952 129// AliESDEvent* esd = 0x0;
130// esd = (AliESDEvent*)InputEvent();
131//
132// //Get MC data, if available
133// AliStack* stack = 0x0;
134// if(MCEvent())
135// stack = MCEvent()->Stack();
477d6cee 136
042d5330 137 // // Get trigger information of fCalorimeter
138 // TArrayF * triggerAmplitudes = 0x0 ;
139 // TArrayF * triggerPosition = 0x0 ;
140 // Int_t numberOfCaloClusters = esd->GetNumberOfCaloClusters() ;
477d6cee 141
042d5330 142 // if(fCalorimeter == "PHOS"){
143 // triggerAmplitudes = esd->GetPHOSTriggerAmplitudes();
144 // triggerPosition = esd->GetPHOSTriggerPosition();
145 // }
146 // else if(fCalorimeter == "EMCAL"){
147 // triggerAmplitudes = esd->GetEMCALTriggerAmplitudes();
148 // triggerPosition = esd->GetEMCALTriggerPosition();
149 // }
477d6cee 150
042d5330 151 // if( triggerAmplitudes && triggerPosition ){
152 // // trigger amplitudes
153 // const Float_t ka22 = static_cast<Float_t>(triggerAmplitudes->At(0)) ;
154 // const Float_t ka22O = static_cast<Float_t>(triggerAmplitudes->At(1)) ;
155 // const Float_t kaNN = static_cast<Float_t>(triggerAmplitudes->At(2)) ;
156 // const Float_t kaNNO = static_cast<Float_t>(triggerAmplitudes->At(3)) ;
477d6cee 157
042d5330 158 // // trigger position
159 // const Float_t kx22 = static_cast<Float_t>(triggerPosition->At(0)) ;
160 // const Float_t ky22 = static_cast<Float_t>(triggerPosition->At(1)) ;
161 // const Float_t kz22 = static_cast<Float_t>(triggerPosition->At(2)) ;
162 // const Float_t kxNN = static_cast<Float_t>(triggerPosition->At(3)) ;
163 // const Float_t kyNN = static_cast<Float_t>(triggerPosition->At(4)) ;
164 // const Float_t kzNN = static_cast<Float_t>(triggerPosition->At(5)) ;
477d6cee 165
042d5330 166 // //printf("ka22 %f, ka220 %f, kaNN %f, kaNN0 %f\n",ka22,ka22O,kaNN,kaNNO);
167 // //printf("kx22 %f, ky22 %f, kz22 %f, kxNN %f, kyNN %f, kzNN %f \n",kx22,ky22,kz22,kxNN,kyNN,kzNN);
477d6cee 168
042d5330 169 // Float_t enMax = 0. ;
170 // Float_t phEnMax = 0. ;
171 // Float_t etaMax = 0.5 ;
172 // Float_t phiMax = 0. ;
173 // Float_t phEtaMax = 0.5 ;
174 // Float_t phPhiMax = 0. ;
477d6cee 175
042d5330 176 // TVector3 vpos22(kx22, ky22, kz22) ;
177 // TVector3 vposNN(kxNN, kyNN, kzNN) ;
178 // Float_t eta22 = vpos22.Eta() ;
179 // Float_t phi22 = vpos22.Phi() * TMath::RadToDeg() + 360. ;
180 // Float_t etaNN = vposNN.Eta() ;
181 // Float_t phiNN = vposNN.Phi() * TMath::RadToDeg() + 360. ;
477d6cee 182
183
042d5330 184 // Int_t icaloCluster = 0 ;
185 // Int_t labelmax = -1 ;
186 // // loop over the Calorimeters Clusters
477d6cee 187
042d5330 188 // for(icaloCluster = 0 ; icaloCluster < numberOfCaloClusters ; icaloCluster++) {
477d6cee 189
042d5330 190 // AliESDCaloCluster * cluster = esd->GetCaloCluster(icaloCluster) ;
477d6cee 191
042d5330 192 // if (cluster && ( (fCalorimeter == "PHOS" && cluster->IsPHOS()) ||
193 // (fCalorimeter == "EMCAL" && cluster->IsEMCAL()))) {
6639984f 194
042d5330 195 // Float_t cluEnergy = cluster->E() ;
196 // Float_t pos[3] ;
197 // TVector3 vpos ;
6639984f 198
042d5330 199 // cluster->GetPosition( pos ) ;
6639984f 200
042d5330 201 // if ( cluEnergy > enMax) {
202 // enMax = cluEnergy ;
203 // vpos.SetXYZ(pos[0], pos[1], pos[2]) ;
204 // etaMax = vpos.Eta() ;
205 // phiMax = vpos.Phi() ;
206 // labelmax = cluster->GetLabel();
207 // }
6639984f 208
042d5330 209 // const Double_t * pid = cluster->GetPID() ;
6639984f 210
042d5330 211 // if(pid[AliPID::kPhoton] > 0.9) {
212 // if ( cluEnergy > phEnMax) {
213 // phEnMax = cluEnergy ;
214 // vpos.SetXYZ(pos[0], pos[1], pos[2]) ;
215 // phEtaMax = vpos.Eta() ;
216 // phPhiMax = vpos.Phi() ;
217 // }
218 // }
219 // }//if cluster
477d6cee 220
042d5330 221 // Float_t ptGen = -1;
222 // if(stack && labelmax < stack->GetNtrack() && labelmax >= 0 ){
223 // TParticle * particle = stack->Particle(labelmax);
224 // ptGen = particle->Energy();
225 // }
477d6cee 226
042d5330 227 // fNtTrigger22->Fill(ka22, ka22O, ptGen, enMax, phEnMax, eta22, phi22, etaMax, phiMax * TMath::RadToDeg() + 360., phEtaMax, phPhiMax * TMath::RadToDeg() + 360.);
228 // fNtTriggerNN->Fill(kaNN, kaNNO, ptGen, enMax, phEnMax, etaNN, phiNN, etaMax, phiMax * TMath::RadToDeg() + 360., phEtaMax, phPhiMax * TMath::RadToDeg() + 360.);
477d6cee 229
042d5330 230 // }//CaloCluster loop
477d6cee 231
042d5330 232 // }//If trigger arrays filled
477d6cee 233
234 PostData(1, fOutputContainer);
235
1c5acb87 236}
237
238//______________________________________________________________________________
239//void AliAnaCaloTrigger::Terminate(Option_t *) const
240//{
241// // Processing when the event loop is ended
242//
243//}