]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG4/PartCorrBase/AliCaloTrackESDReader.cxx
1 object for all runs
[u/mrichter/AliRoot.git] / PWG4 / PartCorrBase / AliCaloTrackESDReader.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 (ESDs) in order to do prompt gamma 
20 // or other particle identification and correlations
21 //
22 //
23 //
24 //
25 //*-- Author: Gustavo Conesa (LNF-INFN) 
26 //////////////////////////////////////////////////////////////////////////////
27
28
29 // --- ROOT system ---
30 //#include "Riostream.h"
31
32 //---- ANALYSIS system ----
33 #include "AliCaloTrackESDReader.h" 
34 #include "AliAODEvent.h"
35 #include "AliMultiEventInputHandler.h"
36 #include "AliAnalysisManager.h"
37 #include "AliMixedEvent.h"
38 #include "AliESDVZERO.h"
39
40
41 ClassImp(AliCaloTrackESDReader)
42
43 //____________________________________________________________________________
44 AliCaloTrackESDReader::AliCaloTrackESDReader() : 
45 AliCaloTrackReader()
46 {
47   //Default Ctor
48   
49   //Initialize parameters
50   fDataType=kESD;
51   fReadStack          = kTRUE;
52   fReadAODMCParticles = kFALSE;
53
54 }
55
56 //____________________________________________________________________________
57 Double_t AliCaloTrackESDReader::GetBField() const {
58   //Return magnetic field
59
60   Double_t bfield = fInputEvent->GetMagneticField();
61
62   return bfield;
63 }
64
65
66 //____________________________________________________________________________
67 void AliCaloTrackESDReader::SetInputOutputMCEvent(AliVEvent* esd, AliAODEvent* aod, AliMCEvent* mc) {
68   // Connect the data pointers
69   
70   Bool_t tesd = kFALSE ; 
71
72   if ( strcmp(esd->GetName(), "AliMixedEvent") == 0 ) {
73     AliMultiEventInputHandler* multiEH = dynamic_cast<AliMultiEventInputHandler*>((AliAnalysisManager::GetAnalysisManager())->GetInputEventHandler());
74     if(multiEH){
75       if (multiEH->GetFormat() == 0 ) {
76         tesd = kTRUE ; 
77       }
78     }
79     else{
80       printf("AliCaloTrackESDReader::SetInputOutputMCEvent() - MultiEventHandler is NULL");
81       abort();
82     }
83   }
84   if (strcmp(esd->GetName(),"AliESDEvent") == 0) {
85     tesd = kTRUE ; 
86   }
87   
88   if(!tesd){
89     AliFatal(Form("AliCaloTrackESDReader::SetInputOutputMCEvent() - STOP ::Wrong reader, here only ESDs. Input name: %s != AliESDEvent \n",esd->GetName()));
90   }
91   
92   SetInputEvent(esd);
93   SetOutputEvent(aod);
94   SetMC(mc);
95   
96 }
97
98 //____________________________________________________________________________
99 void AliCaloTrackESDReader::FillInputVZERO(){
100   //Fill VZERO information in data member, add all the channels information.
101   AliESDVZERO* esdV0 = ((AliESDEvent*)fInputEvent)->GetVZEROData();
102   //printf("Init V0: ADC (%d,%d), Multiplicity (%d,%d) \n",fV0ADC[0],fV0ADC[1],fV0Mul[0],fV0Mul[1]);
103
104   if (esdV0) 
105   {
106     for (Int_t i = 0; i < 32; i++)
107     {
108       fV0ADC[0] += (Int_t)esdV0->GetAdcV0C(i);
109       fV0ADC[1] += (Int_t)esdV0->GetAdcV0A(i);
110       fV0Mul[0] += (Int_t)esdV0->GetMultiplicityV0C(i);
111       fV0Mul[1] += (Int_t)esdV0->GetMultiplicityV0A(i);
112     }
113     if(fDebug > 0)
114       printf("V0: ADC (%d,%d), Multiplicity (%d,%d) \n",fV0ADC[0],fV0ADC[1],fV0Mul[0],fV0Mul[1]);
115   }
116   else
117   {
118     printf("Cannot retrieve V0 ESD! Run w/ null V0 charges");
119   }
120 }