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 PHOS/EMCAL simulated trigger
19 //*-- Yves Schutz & Gustavo Conesa Balbastre
20 //////////////////////////////////////////////////////////////////////////////
27 #include "AliAnaCaloTrigger.h"
31 //______________________________________________________________________________
32 AliAnaCaloTrigger::AliAnaCaloTrigger(const char *name) :
33 AliAnalysisTask(name,""),
43 // Input slot #0 works with an Ntuple
44 DefineInput(0, TChain::Class());
45 // Output slot #0 writes into a TH1 container
46 DefineOutput(0, TObjArray::Class()) ;
49 //______________________________________________________________________________
50 AliAnaCaloTrigger::~AliAnaCaloTrigger()
53 fOutputContainer->Clear() ;
54 delete fOutputContainer ;
60 //______________________________________________________________________________
61 void AliAnaCaloTrigger::ConnectInputData(const Option_t*)
63 // Initialisation of branch container and histograms
65 AliInfo(Form("*** Initialization of %s", GetName())) ;
68 fChain = dynamic_cast<TChain *>(GetInputData(0)) ;
70 AliError(Form("Input 0 for %s not found\n", GetName()));
74 // One should first check if the branch address was taken by some other task
75 char ** address = (char **)GetBranchAddress(0, "ESD");
77 fESD = (AliESD*)(*address);
80 SetBranchAddress(0, "ESD", &fESD);
84 //________________________________________________________________________
86 void AliAnaCaloTrigger::CreateOutputObjects()
90 fNtTrigger22 = new TNtuple(fCalorimeter+"trigger22", "Trigger data 2x2 patch", "a22:a220:enMax:phEnMax:eta22:phi22:etaMax:phiMax:phEtaMax:phPhiMax");
91 fNtTriggerNN = new TNtuple(fCalorimeter+"triggerNN", "Trigger data NxN patch", "aNN:aNN0:enMax:phEnMax:etaNN:phiNN:etaMax:phiMax:phEtaMax:phPhiMax");
93 // create output container
95 fOutputContainer = new TObjArray(2) ;
96 fOutputContainer->SetName(GetName()) ;
98 fOutputContainer->AddAt(fNtTrigger22, 0) ;
99 fOutputContainer->AddAt(fNtTriggerNN, 1) ;
103 //______________________________________________________________________________
104 void AliAnaCaloTrigger::Exec(Option_t *)
106 // Processing of one event
108 Long64_t entry = fChain->GetReadEntry() ;
111 AliError("fESD is not connected to the input!") ;
115 if ( !((entry-1)%100) )
116 AliInfo(Form("%s ----> Processing event # %lld", (dynamic_cast<TChain *>(fChain))->GetFile()->GetName(), entry)) ;
118 // Get trigger information of fCalorimeter
119 TArrayF * triggerAmplitudes = 0x0 ;
120 TArrayF * triggerPosition = 0x0 ;
121 Int_t firstCaloCluster = 0 ;
122 Int_t numberOfCaloClusters = 0 ;
124 if(fCalorimeter == "PHOS"){
125 triggerAmplitudes = fESD->GetPHOSTriggerAmplitudes();
126 triggerPosition = fESD->GetPHOSTriggerPosition();
127 firstCaloCluster = fESD->GetFirstPHOSCluster() ;
128 numberOfCaloClusters = fESD->GetNumberOfPHOSClusters() ;
130 else if(fCalorimeter == "EMCAL"){
131 triggerAmplitudes = fESD->GetEMCALTriggerAmplitudes();
132 triggerPosition = fESD->GetEMCALTriggerPosition();
133 firstCaloCluster = fESD->GetFirstEMCALCluster() ;
134 numberOfCaloClusters = fESD->GetNumberOfEMCALClusters() ;
137 // trigger amplitudes
138 const Float_t a22 = static_cast<Float_t>(triggerAmplitudes->At(0)) ;
139 const Float_t a22O = static_cast<Float_t>(triggerAmplitudes->At(1)) ;
140 const Float_t aNN = static_cast<Float_t>(triggerAmplitudes->At(2)) ;
141 const Float_t aNNO = static_cast<Float_t>(triggerAmplitudes->At(3)) ;
144 const Float_t x22 = static_cast<Float_t>(triggerPosition->At(0)) ;
145 const Float_t y22 = static_cast<Float_t>(triggerPosition->At(1)) ;
146 const Float_t z22 = static_cast<Float_t>(triggerPosition->At(2)) ;
147 const Float_t xNN = static_cast<Float_t>(triggerPosition->At(3)) ;
148 const Float_t yNN = static_cast<Float_t>(triggerPosition->At(4)) ;
149 const Float_t zNN = static_cast<Float_t>(triggerPosition->At(5)) ;
154 Float_t phEnMax = 0. ;
155 Float_t etaMax = 0.5 ;
156 Float_t phiMax = 0. ;
157 Float_t phEtaMax = 0.5 ;
158 Float_t phPhiMax = 0. ;
160 TVector3 vpos22(x22, y22, z22) ;
161 TVector3 vposNN(xNN, yNN, zNN) ;
162 Float_t eta22 = vpos22.Eta() ;
163 Float_t phi22 = vpos22.Phi() * TMath::RadToDeg() + 360. ;
164 Float_t etaNN = vposNN.Eta() ;
165 Float_t phiNN = vposNN.Phi() * TMath::RadToDeg() + 360. ;
169 // loop over the Calorimeters Clusters
171 for(icaloCluster = firstCaloCluster ; icaloCluster < firstCaloCluster + numberOfCaloClusters ; icaloCluster++) {
172 AliESDCaloCluster * cluster = fESD->GetCaloCluster(icaloCluster) ;
175 Float_t cluEnergy = cluster->GetClusterEnergy() ;
179 cluster->GetGlobalPosition( pos ) ;
181 if ( cluEnergy > enMax) {
183 vpos.SetXYZ(pos[0], pos[1], pos[2]) ;
184 etaMax = vpos.Eta() ;
185 phiMax = vpos.Phi() ;
188 Float_t * pid = cluster->GetPid() ;
190 if(pid[AliPID::kPhoton] > 0.9) {
191 if ( cluEnergy > phEnMax) {
192 phEnMax = cluEnergy ;
193 vpos.SetXYZ(pos[0], pos[1], pos[2]) ;
194 phEtaMax = vpos.Eta() ;
195 phPhiMax = vpos.Phi() ;
200 fNtTrigger22->Fill(a22, a22O, enMax, phEnMax, eta22, phi22, etaMax, phiMax * TMath::RadToDeg() + 360., phEtaMax, phPhiMax * TMath::RadToDeg() + 360.);
201 fNtTriggerNN->Fill(aNN, aNNO, enMax, phEnMax, etaNN, phiNN, etaMax, phiMax * TMath::RadToDeg() + 360., phEtaMax, phPhiMax * TMath::RadToDeg() + 360.);
205 PostData(0, fOutputContainer);
209 //______________________________________________________________________________
210 void AliAnaCaloTrigger::Terminate(Option_t *)
212 // Processing when the event loop is ended