]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG4/PartCorrBase/AliCaloTrackAODReader.cxx
Changes for report #69974: Virtual class for calorimeter analysis objects
[u/mrichter/AliRoot.git] / PWG4 / PartCorrBase / AliCaloTrackAODReader.cxx
1
2 /**************************************************************************
3  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4  *                                                                        *
5  * Author: The ALICE Off-line Project.                                    *
6  * Contributors are mentioned in the code where appropriate.              *
7  *                                                                        *
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  **************************************************************************/
16 /* $Id: $ */
17
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()
23 // 
24 //
25 //*-- Author: Gustavo Conesa (LNF-INFN) 
26 //////////////////////////////////////////////////////////////////////////////
27
28
29 // --- ROOT system ---
30 //#include "Riostream.h"
31
32 //---- ANALYSIS system ----
33 #include "AliCaloTrackAODReader.h" 
34 #include "AliAODCaloCluster.h"
35 #include "AliAODTrack.h"
36 #include "AliESDtrack.h"
37 #include "AliFiducialCut.h"
38 #include "AliAODInputHandler.h"
39 #include "AliMultiEventInputHandler.h"
40 #include "AliAnalysisManager.h"
41 #include "AliMixedEvent.h"
42
43 ClassImp(AliCaloTrackAODReader)
44
45 //____________________________________________________________________________
46 AliCaloTrackAODReader::AliCaloTrackAODReader() : 
47   AliCaloTrackReader()
48 {
49   //Default Ctor
50   
51   //Initialize parameters
52   fDataType=kAOD;
53   fReadStack          = kTRUE;
54   fReadAODMCParticles = kFALSE;
55   //We want tracks fitted in the detectors:
56   fTrackStatus=AliESDtrack::kTPCrefit;
57   fTrackStatus|=AliESDtrack::kITSrefit;
58
59 }
60 /*
61 //____________________________________________________________________________
62 AliCaloTrackAODReader::AliCaloTrackAODReader(const AliCaloTrackAODReader & aodr) :   
63   AliCaloTrackReader(aodr), fWriteOutputStdAOD(aodr.fWriteOutputStdAOD)
64 {
65   // cpy ctor
66 }
67 */
68 //_________________________________________________________________________
69 //AliCaloTrackAODReader & AliCaloTrackAODReader::operator = (const AliCaloTrackAODReader & source)
70 //{
71 //  // assignment operator
72 //
73 //  if(&source == this) return *this;
74 //
75 //  return *this;
76 //
77 //}
78
79
80 //____________________________________________________________________________
81 void AliCaloTrackAODReader::GetSecondInputAODVertex(Double_t  v[3]) const {
82         //Return vertex position of second AOD input
83         
84         fSecondInputAODEvent->GetPrimaryVertex()->GetXYZ(v);
85
86 }
87
88 //____________________________________________________________________________
89 Double_t AliCaloTrackAODReader::GetBField() const {
90   //Return magnetic field
91
92   Double_t bfield = fInputEvent->GetMagneticField();
93
94   return bfield;
95
96 }
97
98 //____________________________________________________________________________
99 void AliCaloTrackAODReader::SetInputOutputMCEvent(AliVEvent* input, AliAODEvent* aod, AliMCEvent* mc) {
100   // Connect the data pointers
101   // If input is AOD, do analysis with input, if not, do analysis with the output aod.
102
103           //printf("AODInputHandler %p, MergeEvents %d \n",aodIH, aodIH->GetMergeEvents());
104
105   Bool_t tesd = kFALSE ; 
106   Bool_t taod = kTRUE ; 
107   if ( strcmp(input->GetName(), "AliMixedEvent") == 0 ) {
108     AliMultiEventInputHandler* multiEH = dynamic_cast<AliMultiEventInputHandler*>((AliAnalysisManager::GetAnalysisManager())->GetInputEventHandler());
109     if (multiEH->GetFormat() == 0 ) {
110       tesd = kTRUE ; 
111     } else if (multiEH->GetFormat() == 1) {
112       taod = kTRUE ; 
113     }
114   }
115   if (strcmp(input->GetName(),"AliESDEvent") == 0) {
116     tesd = kTRUE ; 
117   } else if (strcmp(input->GetName(),"AliAODEvent") == 0) {
118     taod = kTRUE ; 
119   }
120   
121
122   if(tesd)   {
123     SetInputEvent(aod);
124     SetOutputEvent(aod);
125   }
126   else if(taod){
127     AliAODInputHandler* aodIH = dynamic_cast<AliAODInputHandler*>((AliAnalysisManager::GetAnalysisManager())->GetInputEventHandler());
128           if (aodIH && aodIH->GetMergeEvents()) {
129                   //Merged events, use output AOD.
130                   SetInputEvent(aod);
131                   SetOutputEvent(aod);
132           }
133           else{
134                   SetInputEvent(input);
135                   SetOutputEvent(aod);
136           }
137   }
138   else{ 
139     AliFatal(Form("AliCaloTrackAODReader::SetInputOutputMCEvent() - STOP : Wrong data format: %s\n",input->GetName()));
140   }
141   
142   SetMC(mc);
143   
144 }
145
146 //________________________________________________________________
147 void AliCaloTrackAODReader::Print(const Option_t * opt) const
148 {
149         
150         //Print some relevant parameters set for the analysis
151         AliCaloTrackReader::Print(opt);
152         
153         printf("Write std AOD       =     %d\n", fWriteOutputStdAOD) ;
154         
155         printf("    \n") ;
156
157