2 /**************************************************************************
3 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
5 * Author: The ALICE Off-line Project. *
6 * Contributors are mentioned in the code where appropriate. *
8 * Permission to use, copy, modify and distribute this software and its *
9 * documentation strictly for non-commercial purposes is hereby granted *
10 * without fee, provided that the above copyright notice appears in all *
11 * copies and that both the copyright notice and this permission notice *
12 * appear in the supporting documentation. The authors make no claims *
13 * about the suitability of this software for any purpose. It is *
14 * provided "as is" without express or implied warranty. *
15 **************************************************************************/
18 //_________________________________________________________________________
19 // Class for reading data (AODs) in order to do prompt gamma
20 // or other particle identification and correlations.
21 // Mixing analysis can be done, input AOD with events
22 // is opened in the AliCaloTrackReader::Init()
25 //*-- Author: Gustavo Conesa (LNF-INFN)
26 //////////////////////////////////////////////////////////////////////////////
29 // --- ROOT system ---
30 //#include "Riostream.h"
32 //---- ANALYSIS system ----
33 #include "AliCaloTrackAODReader.h"
34 #include "AliAODEvent.h"
35 #include "AliAODCaloCluster.h"
36 #include "AliAODTrack.h"
37 #include "AliESDtrack.h"
38 #include "AliFidutialCut.h"
40 ClassImp(AliCaloTrackAODReader)
42 //____________________________________________________________________________
43 AliCaloTrackAODReader::AliCaloTrackAODReader() :
48 //Initialize parameters
51 fReadAODMCParticles = kFALSE;
52 //We want tracks fitted in the detectors:
53 fTrackStatus=AliESDtrack::kTPCrefit;
54 fTrackStatus|=AliESDtrack::kITSrefit;
58 //____________________________________________________________________________
59 AliCaloTrackAODReader::AliCaloTrackAODReader(const AliCaloTrackAODReader & g) :
65 //_________________________________________________________________________
66 //AliCaloTrackAODReader & AliCaloTrackAODReader::operator = (const AliCaloTrackAODReader & source)
68 // // assignment operator
70 // if(&source == this) return *this;
76 //____________________________________________________________________________
77 void AliCaloTrackAODReader::FillInputCTS() {
78 //Return array with Central Tracking System (CTS) tracks
80 Int_t nTracks = fInputEvent->GetNumberOfTracks() ;
82 for (Int_t itrack = 0; itrack < nTracks; itrack++) {////////////// track loop
83 AliAODTrack * track = ((AliAODEvent*)fInputEvent)->GetTrack(itrack) ; // retrieve track from esd
85 //Select tracks under certain conditions, TPCrefit, ITSrefit ... check the set bits
86 if (fTrackStatus && !((track->GetStatus() & fTrackStatus) == fTrackStatus)) continue ;
89 TLorentzVector momentum(p[0],p[1],p[2],0);
91 if(fCTSPtMin < momentum.Pt() && fFidutialCut->IsInFidutialCut(momentum,"CTS")){
93 if(fDebug > 2 && momentum.Pt() > 0.1) printf("AliCaloTrackAODReader::FillInputCTS() - Selected tracks E %3.2f, pt %3.2f, phi %3.2f, eta %3.2f\n",
94 momentum.E(),momentum.Pt(),momentum.Phi()*TMath::RadToDeg(),momentum.Eta());
97 }//Pt and Fidutial cut passed.
100 fAODCTSNormalInputEntries = fAODCTS->GetEntriesFast();
101 if(fDebug > 1) printf("AliCaloTrackAODReader::FillInputCTS() - aod entries %d\n", fAODCTSNormalInputEntries);
103 //If second input event available, add the clusters.
104 if(fSecondInputAODTree && fSecondInputAODEvent){
105 nTracks = fSecondInputAODEvent->GetNumberOfTracks() ;
106 if(fDebug > 1) printf("AliCaloTrackAODReader::FillInputCTS() - Add second input tracks, entries %d\n", nTracks) ;
107 for (Int_t itrack = 0; itrack < nTracks; itrack++) {////////////// track loop
108 AliAODTrack * track = ((AliAODEvent*)fSecondInputAODEvent)->GetTrack(itrack) ; // retrieve track from esd
110 //Select tracks under certain conditions, TPCrefit, ITSrefit ... check the set bits
111 if (fTrackStatus && !((track->GetStatus() & fTrackStatus) == fTrackStatus)) continue ;
113 track->GetPxPyPz(p) ;
114 TLorentzVector momentum(p[0],p[1],p[2],0);
116 if(fCTSPtMin < momentum.Pt() && fFidutialCut->IsInFidutialCut(momentum,"CTS")){
118 if(fDebug > 2 && momentum.Pt() > 0.1) printf("AliCaloTrackAODReader::FillInputCTS() - Selected tracks E %3.2f, pt %3.2f, phi %3.2f, eta %3.2f\n",
119 momentum.E(),momentum.Pt(),momentum.Phi()*TMath::RadToDeg(),momentum.Eta());
123 }//Pt and Fidutial cut passed.
126 if(fDebug > 1) printf("AliCaloTrackAODReader::FillInputCTS() - aod normal entries %d, after second input %d\n", fAODCTSNormalInputEntries, fAODCTS->GetEntriesFast());
127 } //second input loop
131 //____________________________________________________________________________
132 void AliCaloTrackAODReader::FillInputEMCAL() {
133 //Return array with EMCAL clusters in aod format
135 //Get vertex for momentum calculation
136 Double_t v[3] ; //vertex ;
139 //Loop to select clusters in fidutial cut and fill container with aodClusters
140 Int_t nclusters = ((AliAODEvent*)fInputEvent)->GetNCaloClusters();
141 for (Int_t iclus = 0; iclus < nclusters; iclus++) {
142 AliAODCaloCluster * clus = 0;
143 if ( (clus = ((AliAODEvent*)fInputEvent)->GetCaloCluster(iclus)) ) {
144 if (clus->IsEMCALCluster()){
145 TLorentzVector momentum ;
146 clus->GetMomentum(momentum, v);
148 if(fEMCALPtMin < momentum.Pt() && fFidutialCut->IsInFidutialCut(momentum,"EMCAL")){
150 if(fDebug > 2 && momentum.E() > 0.1) printf("AliCaloTrackAODReader::FillInputEMCAL() - Selected clusters E %3.2f, pt %3.2f, phi %3.2f, eta %3.2f\n",
151 momentum.E(),momentum.Pt(),momentum.Phi()*TMath::RadToDeg(),momentum.Eta());
153 fAODEMCAL->Add(clus);
154 }//Pt and Fidutial cut passed.
159 fAODEMCALNormalInputEntries = fAODEMCAL->GetEntriesFast();
160 if(fDebug > 1) printf("AliCaloTrackAODReader::FillInputEMCAL() - aod entries %d\n", fAODEMCALNormalInputEntries);
162 //If second input event available, add the clusters.
163 if(fSecondInputAODTree && fSecondInputAODEvent){
164 nclusters = ((AliAODEvent*)fSecondInputAODEvent)->GetNCaloClusters();
165 if(fDebug > 1) printf("AliCaloTrackAODReader::FillInputEMCAL() - Add second input clusters, entries %d\n", nclusters) ;
166 for (Int_t iclus = 0; iclus < nclusters; iclus++) {
167 AliAODCaloCluster * clus = 0;
168 if ( (clus = ((AliAODEvent*)fSecondInputAODEvent)->GetCaloCluster(iclus)) ) {
169 if (clus->IsEMCALCluster()){
170 TLorentzVector momentum ;
171 clus->GetMomentum(momentum, v);
173 if(fEMCALPtMin < momentum.Pt() && fFidutialCut->IsInFidutialCut(momentum,"EMCAL")){
175 if(fDebug > 2 && momentum.E() > 0.1) printf("AliCaloTrackAODReader::FillInputEMCAL() - Selected clusters E %3.2f, pt %3.2f, phi %3.2f, eta %3.2f\n",
176 momentum.E(),momentum.Pt(),momentum.Phi()*TMath::RadToDeg(),momentum.Eta());
177 fAODEMCAL->Add(clus);
178 }//Pt and Fidutial cut passed.
183 if(fDebug > 1) printf("AliCaloTrackAODReader::FillInputEMCAL() - aod normal entries %d, after second input %d\n", fAODEMCALNormalInputEntries, fAODEMCAL->GetEntriesFast());
185 } //second input loop
188 //____________________________________________________________________________
189 void AliCaloTrackAODReader::FillInputPHOS() {
190 //Return array with PHOS clusters in aod format
192 //Get vertex for momentum calculation
193 Double_t v[3] ; //vertex ;
196 //Loop to select clusters in fidutial cut and fill container with aodClusters
197 Int_t nclusters = ((AliAODEvent*)fInputEvent)->GetNCaloClusters();
198 for (Int_t iclus = 0; iclus < nclusters; iclus++) {
199 AliAODCaloCluster * clus = 0;
200 if ( (clus = ((AliAODEvent*)fInputEvent)->GetCaloCluster(iclus)) ) {
201 if (clus->IsPHOSCluster()){
202 TLorentzVector momentum ;
203 clus->GetMomentum(momentum, v);
205 if(fPHOSPtMin < momentum.Pt() && fFidutialCut->IsInFidutialCut(momentum,"PHOS")){
207 if(fDebug > 2 && momentum.E() > 0.1) printf("AliCaloTrackAODReader::FillInputPHOS() - Selected clusters E %3.2f, pt %3.2f, phi %3.2f, eta %3.2f\n",
208 momentum.E(),momentum.Pt(),momentum.Phi()*TMath::RadToDeg(),momentum.Eta());
211 }//Pt and Fidutial cut passed.
216 fAODPHOSNormalInputEntries = fAODPHOS->GetEntriesFast() ;
217 if(fDebug > 1) printf("AliCaloTrackAODReader::FillInputPHOS() - aod entries %d\n", fAODPHOSNormalInputEntries);
219 //If second input event available, add the clusters.
220 if(fSecondInputAODTree && fSecondInputAODEvent){
221 nclusters = ((AliAODEvent*)fSecondInputAODEvent)->GetNCaloClusters();
222 if(fDebug > 1) printf("AliCaloTrackAODReader::FillInputPHOS() - Add second input clusters, entries %d\n", nclusters);
223 for (Int_t iclus = 0; iclus < nclusters; iclus++) {
224 AliAODCaloCluster * clus = 0;
225 if ( (clus = ((AliAODEvent*)fSecondInputAODEvent)->GetCaloCluster(iclus)) ) {
226 if (clus->IsPHOSCluster()){
227 TLorentzVector momentum ;
228 clus->GetMomentum(momentum, v);
230 if(fPHOSPtMin < momentum.Pt() && fFidutialCut->IsInFidutialCut(momentum,"PHOS")){
232 if(fDebug > 2 && momentum.E() > 0.1) printf("AliCaloTrackAODReader::FillInputPHOS() - Selected clusters E %3.2f, pt %3.2f, phi %3.2f, eta %3.2f\n",
233 momentum.E(),momentum.Pt(),momentum.Phi()*TMath::RadToDeg(),momentum.Eta());
235 }//Pt and Fidutial cut passed.
239 if(fDebug > 1) printf("AliCaloTrackAODReader::FillInputPHOS() - aod normal entries %d, after second input %d\n", fAODPHOSNormalInputEntries, fAODPHOS->GetEntriesFast());
240 } //second input loop
244 //____________________________________________________________________________
245 void AliCaloTrackAODReader::FillInputEMCALCells() {
246 //Return array with EMCAL cells in aod format
248 fEMCALCells = (TNamed*) ((AliAODEvent*)fInputEvent)->GetEMCALCells();
252 //____________________________________________________________________________
253 void AliCaloTrackAODReader::FillInputPHOSCells() {
254 //Return array with PHOS cells in aod format
256 fPHOSCells = (TNamed*) ((AliAODEvent*)fInputEvent)->GetPHOSCells();
260 //____________________________________________________________________________
261 void AliCaloTrackAODReader::GetVertex(Double_t v[3]) const {
262 //Return vertex position
264 v[0] = ((AliAODEvent*)fInputEvent)->GetVertex(0)->GetX() ;//CHECK!!!
265 v[1] = ((AliAODEvent*)fInputEvent)->GetVertex(0)->GetY() ;//CHECK!!!
266 v[2] = ((AliAODEvent*)fInputEvent)->GetVertex(0)->GetZ() ;//CHECK!!!
270 //____________________________________________________________________________
271 void AliCaloTrackAODReader::SetInputOutputMCEvent(AliVEvent* input, AliAODEvent* aod, AliMCEvent* mc) {
272 // Connect the data pointers
273 // If input is AOD, do analysis with input, if not, do analysis with the output aod.
274 if(!strcmp(input->GetName(),"AliESDEvent")) {
278 else if(!strcmp(input->GetName(),"AliAODEvent")){
279 SetInputEvent(input);
283 printf("AliCaloTrackAODReader::SetInputOutputMCEvent() - STOP : Wrong data format: %s\n",input->GetName());