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 photon data in simulated data
20 //////////////////////////////////////////////////////////////////////////////
27 #include "AliTriggerPHOS.h"
31 //______________________________________________________________________________
32 AliTriggerPHOS::AliTriggerPHOS(const char *name) :
33 AliAnalysisTask(name,""),
42 // Input slot #0 works with an Ntuple
43 DefineInput(0, TChain::Class());
44 // Output slot #0 writes into a TH1 container
45 DefineOutput(0, TObjArray::Class()) ;
48 //______________________________________________________________________________
49 AliTriggerPHOS::~AliTriggerPHOS()
52 fOutputContainer->Clear() ;
53 delete fOutputContainer ;
59 //______________________________________________________________________________
60 void AliTriggerPHOS::ConnectInputData(const Option_t*)
62 // Initialisation of branch container and histograms
64 AliInfo(Form("*** Initialization of %s", GetName())) ;
67 fChain = dynamic_cast<TChain *>(GetInputData(0)) ;
69 AliError(Form("Input 0 for %s not found\n", GetName()));
73 // One should first check if the branch address was taken by some other task
74 char ** address = (char **)GetBranchAddress(0, "ESD");
76 fESD = (AliESD*)(*address);
79 SetBranchAddress(0, "ESD", &fESD);
83 //________________________________________________________________________
85 void AliTriggerPHOS::CreateOutputObjects()
89 fNtTrigger22 = new TNtuple("PHOStrigger22", "Trigger data 2x2 patch", "a22:a220:enMax:phEnMax:eta22:phi22:etaMax:phiMax:phEtaMax:phPhiMax");
90 fNtTriggerNN = new TNtuple("PHOStriggerNN", "Trigger data NxN patch", "aNN:aNN0:enMax:phEnMax:etaNN:phiNN:etaMax:phiMax:phEtaMax:phPhiMax");
92 // create output container
94 fOutputContainer = new TObjArray(2) ;
95 fOutputContainer->SetName(GetName()) ;
97 fOutputContainer->AddAt(fNtTrigger22, 0) ;
98 fOutputContainer->AddAt(fNtTriggerNN, 1) ;
102 //______________________________________________________________________________
103 void AliTriggerPHOS::Exec(Option_t *)
105 // Processing of one event
107 Long64_t entry = fChain->GetReadEntry() ;
110 AliError("fESD is not connected to the input!") ;
114 if ( !((entry-1)%100) )
115 AliInfo(Form("%s ----> Processing event # %lld", (dynamic_cast<TChain *>(fChain))->GetFile()->GetName(), entry)) ;
117 // ************************ PHOS *************************************
118 // Get trigger information
120 // trigger amplitudes
121 const TArrayF * triggerAmplitudes = fESD->GetPHOSTriggerAmplitudes();
122 const Float_t a22 = static_cast<Float_t>(triggerAmplitudes->At(0)) ;
123 const Float_t a22O = static_cast<Float_t>(triggerAmplitudes->At(1)) ;
124 const Float_t aNN = static_cast<Float_t>(triggerAmplitudes->At(2)) ;
125 const Float_t aNNO = static_cast<Float_t>(triggerAmplitudes->At(3)) ;
128 const TArrayF * triggerPosition = fESD->GetPHOSTriggerPosition();
129 const Float_t x22 = static_cast<Float_t>(triggerPosition->At(0)) ;
130 const Float_t y22 = static_cast<Float_t>(triggerPosition->At(1)) ;
131 const Float_t z22 = static_cast<Float_t>(triggerPosition->At(2)) ;
132 const Float_t xNN = static_cast<Float_t>(triggerPosition->At(3)) ;
133 const Float_t yNN = static_cast<Float_t>(triggerPosition->At(4)) ;
134 const Float_t zNN = static_cast<Float_t>(triggerPosition->At(5)) ;
136 Int_t firstPhosCluster = fESD->GetFirstPHOSCluster() ;
137 const Int_t numberOfPhosClusters = fESD->GetNumberOfPHOSClusters() ;
140 Float_t phEnMax = 0. ;
141 Float_t etaMax = 0.5 ;
142 Float_t phiMax = 0. ;
143 Float_t phEtaMax = 0.5 ;
144 Float_t phPhiMax = 0. ;
146 TVector3 vpos22(x22, y22, z22) ;
147 TVector3 vposNN(xNN, yNN, zNN) ;
148 Float_t eta22 = vpos22.Eta() ;
149 Float_t phi22 = vpos22.Phi() * TMath::RadToDeg() + 360. ;
150 Float_t etaNN = vposNN.Eta() ;
151 Float_t phiNN = vposNN.Phi() * TMath::RadToDeg() + 360. ;
155 // loop over the PHOS Cluster
157 for(phosCluster = firstPhosCluster ; phosCluster < firstPhosCluster + numberOfPhosClusters ; phosCluster++) {
158 AliESDCaloCluster * caloCluster = fESD->GetCaloCluster(phosCluster) ;
161 Float_t cluEnergy = caloCluster->GetClusterEnergy() ;
165 caloCluster->GetGlobalPosition( pos ) ;
167 if ( cluEnergy > enMax) {
169 vpos.SetXYZ(pos[0], pos[1], pos[2]) ;
170 etaMax = vpos.Eta() ;
171 phiMax = vpos.Phi() ;
174 Float_t * pid = caloCluster->GetPid() ;
176 if(pid[AliPID::kPhoton] > 0.9) {
177 if ( cluEnergy > phEnMax) {
178 phEnMax = cluEnergy ;
179 vpos.SetXYZ(pos[0], pos[1], pos[2]) ;
180 phEtaMax = vpos.Eta() ;
181 phPhiMax = vpos.Phi() ;
186 fNtTrigger22->Fill(a22, a22O, enMax, phEnMax, eta22, phi22, etaMax, phiMax * TMath::RadToDeg() + 360., phEtaMax, phPhiMax * TMath::RadToDeg() + 360.);
187 fNtTriggerNN->Fill(aNN, aNNO, enMax, phEnMax, etaNN, phiNN, etaMax, phiMax * TMath::RadToDeg() + 360., phEtaMax, phPhiMax * TMath::RadToDeg() + 360.);
191 PostData(0, fOutputContainer);
195 //______________________________________________________________________________
196 void AliTriggerPHOS::Terminate(Option_t *)
198 // Processing when the event loop is ended