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 //_________________________________________________________________________
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
21 // and if MC stack available, with pt of parent.
23 //*-- Yves Schutz (CERN) & Gustavo Conesa Balbastre (INFN-LNF)
24 //////////////////////////////////////////////////////////////////////////////
30 #include "AliAnaCaloTrigger.h"
32 #include "AliESDCaloCluster.h"
33 #include "AliMCEvent.h"
34 #include "AliESDEvent.h"
36 //______________________________________________________________________________
37 AliAnaCaloTrigger::AliAnaCaloTrigger() :
43 // Default Constructor.
47 //______________________________________________________________________________
48 AliAnaCaloTrigger::AliAnaCaloTrigger(const char *name) :
49 AliAnalysisTaskSE(name),
57 DefineOutput(1, TList::Class()) ;
60 //____________________________________________________________________________
61 AliAnaCaloTrigger::AliAnaCaloTrigger(const AliAnaCaloTrigger & ct) :
62 AliAnalysisTaskSE(ct.GetName()),
63 fOutputContainer(ct.fOutputContainer), fCalorimeter(ct. fCalorimeter),
64 fNtTrigger22(ct.fNtTrigger22), fNtTriggerNN(ct.fNtTriggerNN)
71 //_________________________________________________________________________
72 AliAnaCaloTrigger & AliAnaCaloTrigger::operator = (const AliAnaCaloTrigger & source)
74 // assignment operator
76 //if(&source == this) return *this;
77 this->~AliAnaCaloTrigger();
78 new(this) AliAnaCaloTrigger(source);
80 fOutputContainer = source.fOutputContainer ;
81 fCalorimeter = source. fCalorimeter ;
82 fNtTrigger22 = source.fNtTrigger22 ;
83 fNtTriggerNN = source.fNtTriggerNN ;
89 //______________________________________________________________________________
90 AliAnaCaloTrigger::~AliAnaCaloTrigger()
94 fOutputContainer->Clear() ;
95 delete fOutputContainer ;
100 //________________________________________________________________________
102 void AliAnaCaloTrigger::UserCreateOutputObjects()
105 // Create the outputs containers
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");
112 // create output container
114 fOutputContainer = new TList() ;
115 fOutputContainer->SetName(GetName()) ;
117 fOutputContainer->AddAt(fNtTrigger22, 0) ;
118 fOutputContainer->AddAt(fNtTriggerNN, 1) ;
122 //______________________________________________________________________________
123 void AliAnaCaloTrigger::UserExec(Option_t *)
125 // Processing of one event
127 if ( !((Entry()-1)%100) )
128 printf(" Processing event # %lld\n", Entry()) ;
129 AliESDEvent* esd = 0x0;
130 esd = (AliESDEvent*)InputEvent();
132 //Get MC data, if available
133 AliStack* stack = 0x0;
135 stack = MCEvent()->Stack();
137 // // Get trigger information of fCalorimeter
138 // TArrayF * triggerAmplitudes = 0x0 ;
139 // TArrayF * triggerPosition = 0x0 ;
140 // Int_t numberOfCaloClusters = esd->GetNumberOfCaloClusters() ;
142 // if(fCalorimeter == "PHOS"){
143 // triggerAmplitudes = esd->GetPHOSTriggerAmplitudes();
144 // triggerPosition = esd->GetPHOSTriggerPosition();
146 // else if(fCalorimeter == "EMCAL"){
147 // triggerAmplitudes = esd->GetEMCALTriggerAmplitudes();
148 // triggerPosition = esd->GetEMCALTriggerPosition();
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)) ;
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)) ;
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);
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. ;
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. ;
184 // Int_t icaloCluster = 0 ;
185 // Int_t labelmax = -1 ;
186 // // loop over the Calorimeters Clusters
188 // for(icaloCluster = 0 ; icaloCluster < numberOfCaloClusters ; icaloCluster++) {
190 // AliESDCaloCluster * cluster = esd->GetCaloCluster(icaloCluster) ;
192 // if (cluster && ( (fCalorimeter == "PHOS" && cluster->IsPHOS()) ||
193 // (fCalorimeter == "EMCAL" && cluster->IsEMCAL()))) {
195 // Float_t cluEnergy = cluster->E() ;
199 // cluster->GetPosition( pos ) ;
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();
209 // const Double_t * pid = cluster->GetPID() ;
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() ;
221 // Float_t ptGen = -1;
222 // if(stack && labelmax < stack->GetNtrack() && labelmax >= 0 ){
223 // TParticle * particle = stack->Particle(labelmax);
224 // ptGen = particle->Energy();
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.);
230 // }//CaloCluster loop
232 // }//If trigger arrays filled
234 PostData(1, fOutputContainer);
238 //______________________________________________________________________________
239 //void AliAnaCaloTrigger::Terminate(Option_t *) const
241 // // Processing when the event loop is ended