]>
Commit | Line | Data |
---|---|---|
6c3efb37 | 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 PHOS photon data in simulated data | |
18 | // | |
19 | //*-- Yves Schutz | |
20 | ////////////////////////////////////////////////////////////////////////////// | |
21 | ||
22 | #include <TChain.h> | |
23 | #include <TFile.h> | |
24 | #include <TNtuple.h> | |
25 | #include <TVector3.h> | |
26 | ||
27 | #include "AliTriggerPHOS.h" | |
28 | #include "AliESD.h" | |
29 | #include "AliLog.h" | |
30 | ||
31 | //______________________________________________________________________________ | |
32 | AliTriggerPHOS::AliTriggerPHOS(const char *name) : | |
33 | AliAnalysisTask(name,""), | |
34 | fChain(0), | |
35 | fESD(0), | |
36 | fOutputContainer(0), | |
37 | fNtTrigger22(0), | |
38 | fNtTriggerNN(0) | |
39 | ||
40 | { | |
41 | // Constructor. | |
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()) ; | |
46 | } | |
47 | ||
48 | //______________________________________________________________________________ | |
49 | AliTriggerPHOS::~AliTriggerPHOS() | |
50 | { | |
51 | // dtor | |
52 | fOutputContainer->Clear() ; | |
53 | delete fOutputContainer ; | |
54 | delete fNtTrigger22 ; | |
55 | delete fNtTriggerNN ; | |
56 | } | |
57 | ||
58 | ||
59 | //______________________________________________________________________________ | |
60 | void AliTriggerPHOS::ConnectInputData(const Option_t*) | |
61 | { | |
62 | // Initialisation of branch container and histograms | |
63 | ||
64 | AliInfo(Form("*** Initialization of %s", GetName())) ; | |
65 | ||
66 | // Get input data | |
67 | fChain = dynamic_cast<TChain *>(GetInputData(0)) ; | |
68 | if (!fChain) { | |
69 | AliError(Form("Input 0 for %s not found\n", GetName())); | |
70 | return ; | |
71 | } | |
72 | ||
73 | // One should first check if the branch address was taken by some other task | |
74 | char ** address = (char **)GetBranchAddress(0, "ESD"); | |
75 | if (address) { | |
76 | fESD = (AliESD*)(*address); | |
77 | } else { | |
78 | fESD = new AliESD(); | |
79 | SetBranchAddress(0, "ESD", &fESD); | |
80 | } | |
81 | } | |
82 | ||
83 | //________________________________________________________________________ | |
84 | ||
85 | void AliTriggerPHOS::CreateOutputObjects() | |
86 | { | |
87 | ||
88 | // create histograms | |
89 | fNtTrigger22 = new TNtuple("PHOStrigger22", "Trigger data 2x2 patch", "a22:a220:enMax:phEnMax:p22:eta22:phi22:etaMax:phiMax:phEtaMax:phPhiMax"); | |
90 | fNtTriggerNN = new TNtuple("PHOStriggerNN", "Trigger data NxN patch", "aNN:aNN0:enMax:phEnMax:pNN:etaNN:phiNN:etaMax:phiMax:phEtaMax:phPhiMax"); | |
91 | ||
92 | // create output container | |
93 | ||
94 | fOutputContainer = new TObjArray(2) ; | |
95 | fOutputContainer->SetName(GetName()) ; | |
96 | ||
97 | fOutputContainer->AddAt(fNtTrigger22, 0) ; | |
98 | fOutputContainer->AddAt(fNtTriggerNN, 1) ; | |
99 | ||
100 | } | |
101 | ||
102 | //______________________________________________________________________________ | |
103 | void AliTriggerPHOS::Exec(Option_t *) | |
104 | { | |
105 | // Processing of one event | |
106 | ||
107 | Long64_t entry = fChain->GetReadEntry() ; | |
108 | ||
109 | if (!fESD) { | |
110 | AliError("fESD is not connected to the input!") ; | |
111 | return ; | |
112 | } | |
113 | ||
114 | if ( !((entry-1)%100) ) | |
115 | AliInfo(Form("%s ----> Processing event # %lld", (dynamic_cast<TChain *>(fChain))->GetFile()->GetName(), entry)) ; | |
116 | ||
117 | // ************************ PHOS ************************************* | |
118 | // Get trigger information | |
119 | ||
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)) ; | |
126 | ||
127 | // trigger position | |
64df000d | 128 | const TArrayF * triggerPosition = fESD->GetPHOSTriggerPosition(); |
129 | const Float_t p22 = static_cast<Float_t>(triggerPosition->At(0)) ; | |
130 | const Float_t phi22 = static_cast<Float_t>(triggerPosition->At(1)) ; | |
131 | const Float_t eta22 = static_cast<Float_t>(triggerPosition->At(2)) ; | |
132 | const Float_t pNN = static_cast<Float_t>(triggerPosition->At(3)) ; | |
133 | const Float_t phiNN = static_cast<Float_t>(triggerPosition->At(4)) ; | |
134 | const Float_t etaNN = static_cast<Float_t>(triggerPosition->At(5)) ; | |
6c3efb37 | 135 | |
136 | Int_t firstPhosCluster = fESD->GetFirstPHOSCluster() ; | |
137 | const Int_t numberOfPhosClusters = fESD->GetNumberOfPHOSClusters() ; | |
138 | ||
139 | Float_t enMax = 0. ; | |
140 | Float_t phEnMax = 0. ; | |
141 | Float_t etaMax = 999. ; | |
142 | Float_t phiMax = 999. ; | |
143 | Float_t phEtaMax = 999. ; | |
144 | Float_t phPhiMax = 999. ; | |
145 | ||
146 | Int_t phosCluster ; | |
147 | ||
148 | // loop over the PHOS Cluster | |
149 | ||
150 | for(phosCluster = firstPhosCluster ; phosCluster < firstPhosCluster + numberOfPhosClusters ; phosCluster++) { | |
151 | AliESDCaloCluster * caloCluster = fESD->GetCaloCluster(phosCluster) ; | |
152 | if (caloCluster) { | |
153 | ||
154 | Float_t cluEnergy = caloCluster->GetClusterEnergy() ; | |
155 | Float_t pos[3] ; | |
156 | TVector3 vpos ; | |
157 | ||
158 | caloCluster->GetGlobalPosition( pos ) ; | |
159 | ||
160 | if ( cluEnergy > enMax) { | |
161 | enMax = cluEnergy ; | |
162 | vpos.SetXYZ(pos[0], pos[1], pos[2]) ; | |
163 | etaMax = vpos.Eta() ; | |
164 | phiMax = vpos.Phi() ; | |
165 | } | |
166 | ||
167 | Float_t * pid = caloCluster->GetPid() ; | |
168 | ||
169 | if(pid[AliPID::kPhoton] > 0.9) { | |
170 | if ( cluEnergy > phEnMax) { | |
171 | phEnMax = cluEnergy ; | |
172 | vpos.SetXYZ(pos[0], pos[1], pos[2]) ; | |
173 | phEtaMax = vpos.Eta() ; | |
174 | phPhiMax = vpos.Phi() ; | |
175 | } | |
176 | } | |
177 | } | |
178 | ||
179 | fNtTrigger22->Fill(a22, a22O, enMax, phEnMax, p22, eta22, phi22, etaMax, phiMax, phEtaMax, phPhiMax ); | |
180 | fNtTriggerNN->Fill(aNN, aNNO, enMax, phEnMax, pNN, etaNN, phiNN, etaMax, phiMax, phEtaMax, phPhiMax ); | |
181 | } | |
182 | ||
183 | ||
184 | PostData(0, fOutputContainer); | |
185 | ||
186 | } | |
187 | ||
188 | //______________________________________________________________________________ | |
189 | void AliTriggerPHOS::Terminate(Option_t *) | |
190 | { | |
191 | // Processing when the event loop is ended | |
192 | ||
193 | } |