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
23 //*-- Author: Gustavo Conesa (LNF-INFN)
24 //////////////////////////////////////////////////////////////////////////////
27 // --- ROOT system ---
28 //#include "Riostream.h"
30 //---- ANALYSIS system ----
31 #include "AliCaloTrackAODReader.h"
32 #include "AliAODEvent.h"
33 #include "AliAODCaloCluster.h"
34 #include "AliAODTrack.h"
35 #include "AliFidutialCut.h"
37 ClassImp(AliCaloTrackAODReader)
39 //____________________________________________________________________________
40 AliCaloTrackAODReader::AliCaloTrackAODReader() :
45 //Initialize parameters
50 //____________________________________________________________________________
51 AliCaloTrackAODReader::AliCaloTrackAODReader(const AliCaloTrackAODReader & g) :
57 //_________________________________________________________________________
58 //AliCaloTrackAODReader & AliCaloTrackAODReader::operator = (const AliCaloTrackAODReader & source)
60 // // assignment operator
62 // if(&source == this) return *this;
68 //____________________________________________________________________________
69 void AliCaloTrackAODReader::FillInputCTS() {
70 //Return array with CTS tracks
72 Int_t nTracks = fInputEvent->GetNumberOfTracks() ;
76 for (Int_t itrack = 0; itrack < nTracks; itrack++) {////////////// track loop
77 AliAODTrack * track = ((AliAODEvent*)fInputEvent)->GetTrack(itrack) ; // retrieve track from esd
79 // //We want tracks fitted in the detectors:
80 // ULong_t status=AliAODTrack::kTPCrefit;
81 // status|=AliAODTrack::kITSrefit;
83 //We want tracks whose PID bit is set:
84 // ULong_t status =AliAODTrack::kITSpid;
85 // status|=AliAODTrack::kTPCpid;
87 // if ( (track->GetStatus() & status) == status) {//Check if the bits we want are set
90 TLorentzVector momentum(p[0],p[1],p[2],0);
92 if(fCTSPtMin < momentum.Pt() && fFidutialCut->IsInFidutialCut(momentum,"CTS")){
94 if(fDebug > 2 && momentum.Pt() > 0.1)printf("FillInputCTS():: Selected tracks E %3.2f, pt %3.2f, phi %3.2f, eta %3.2f\n",
95 momentum.E(),momentum.Pt(),momentum.Phi()*TMath::RadToDeg(),momentum.Eta());
98 new (fAODCTS) TRefArray(TProcessID::GetProcessWithUID(track));
103 }//Pt and Fidutial cut passed.
106 if(fDebug > 1) printf("FillInputCTS():: aod entries %d\n", fAODCTS->GetEntriesFast());
109 //____________________________________________________________________________
110 void AliCaloTrackAODReader::FillInputEMCAL() {
111 //Return array with EMCAL clusters in aod format
113 Bool_t first = kTRUE;
115 //Get vertex for momentum calculation
116 Double_t v[3] ; //vertex ;
119 //Loop to select clusters in fidutial cut and fill container with aodClusters
121 for (Int_t iclus = 0; iclus < ((AliAODEvent*)fInputEvent)->GetNCaloClusters(); iclus++) {
122 AliAODCaloCluster * clus = 0;
123 if ( (clus = ((AliAODEvent*)fInputEvent)->GetCaloCluster(iclus)) ) {
124 if (clus->IsEMCALCluster()){
125 TLorentzVector momentum ;
126 clus->GetMomentum(momentum, v);
128 if(fEMCALPtMin < momentum.Pt() && fFidutialCut->IsInFidutialCut(momentum,"EMCAL")){
130 if(fDebug > 2 && momentum.E() > 0.1)printf("FillInputEMCAL():: Selected clusters E %3.2f, pt %3.2f, phi %3.2f, eta %3.2f\n",
131 momentum.E(),momentum.Pt(),momentum.Phi()*TMath::RadToDeg(),momentum.Eta());
134 new (fAODEMCAL) TRefArray(TProcessID::GetProcessWithUID(clus));
137 fAODEMCAL->Add(clus);
138 }//Pt and Fidutial cut passed.
143 if(fDebug > 1) printf("FillInputEMCAL():: aod entries %d\n", fAODEMCAL->GetEntriesFast());
147 //____________________________________________________________________________
148 void AliCaloTrackAODReader::FillInputPHOS() {
149 //Return array with PHOS clusters in aod format
151 Bool_t first = kTRUE;
153 //Get vertex for momentum calculation
154 Double_t v[3] ; //vertex ;
157 //Loop to select clusters in fidutial cut and fill container with aodClusters
160 for (Int_t iclus = 0; iclus < ((AliAODEvent*)fInputEvent)->GetNCaloClusters(); iclus++) {
161 AliAODCaloCluster * clus = 0;
162 if ( (clus = ((AliAODEvent*)fInputEvent)->GetCaloCluster(iclus)) ) {
163 if (clus->IsPHOSCluster()){
164 TLorentzVector momentum ;
165 clus->GetMomentum(momentum, v);
167 if(fPHOSPtMin < momentum.Pt() && fFidutialCut->IsInFidutialCut(momentum,"PHOS")){
169 if(fDebug > 2 && momentum.E() > 0.1)printf("FillInputPHOS():: Selected clusters E %3.2f, pt %3.2f, phi %3.2f, eta %3.2f\n",
170 momentum.E(),momentum.Pt(),momentum.Phi()*TMath::RadToDeg(),momentum.Eta());
173 new (fAODPHOS) TRefArray(TProcessID::GetProcessWithUID(clus));
177 }//Pt and Fidutial cut passed.
182 if(fDebug > 1) printf("FillInputPHOS():: aod entries %d\n", fAODPHOS->GetEntriesFast());
187 //____________________________________________________________________________
188 void AliCaloTrackAODReader::FillInputEMCALCells() {
189 //Return array with EMCAL cells in aod format
191 fEMCALCells = (TNamed*) ((AliAODEvent*)fInputEvent)->GetEMCALCells();
195 //____________________________________________________________________________
196 void AliCaloTrackAODReader::FillInputPHOSCells() {
197 //Return array with PHOS cells in aod format
199 fPHOSCells = (TNamed*) ((AliAODEvent*)fInputEvent)->GetPHOSCells();
203 //____________________________________________________________________________
204 void AliCaloTrackAODReader::GetVertex(Double_t v[3]) const {
205 //Return vertex position
207 v[0] = ((AliAODEvent*)fInputEvent)->GetVertex(0)->GetX() ;//CHECK!!!
208 v[1] = ((AliAODEvent*)fInputEvent)->GetVertex(0)->GetY() ;//CHECK!!!
209 v[2] = ((AliAODEvent*)fInputEvent)->GetVertex(0)->GetZ() ;//CHECK!!!
213 //____________________________________________________________________________
214 void AliCaloTrackAODReader::SetInputOutputMCEvent(AliVEvent* input, AliAODEvent* aod, AliMCEvent* mc) {
215 // Connect the data pointers
216 // If input is AOD, do analysis with input, if not, do analysis with the output aod.
217 if(!strcmp(input->GetName(),"AliESDEvent")) {
221 else if(!strcmp(input->GetName(),"AliAODEvent")){
222 SetInputEvent(input);
226 printf("AliCaloTrackAODReader::SetInputOutputMCEvent() - ABORT::Unknown data format: %s",input->GetName());