]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG/CaloTrackCorrBase/AliCaloTrackAODReader.cxx
used run 170162 as reference
[u/mrichter/AliRoot.git] / PWG / CaloTrackCorrBase / AliCaloTrackAODReader.cxx
CommitLineData
1c5acb87 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 **************************************************************************/
1c5acb87 16
17//_________________________________________________________________________
18// Class for reading data (AODs) in order to do prompt gamma
591cc579 19// or other particle identification and correlations.
1e68a3f4 20// This part is commented: Mixing analysis can be done, input AOD with events
591cc579 21// is opened in the AliCaloTrackReader::Init()
1c5acb87 22//
23//
24//*-- Author: Gustavo Conesa (LNF-INFN)
25//////////////////////////////////////////////////////////////////////////////
26
1c5acb87 27//---- ANALYSIS system ----
28#include "AliCaloTrackAODReader.h"
8a587055 29#include "AliAODInputHandler.h"
c8fe2783 30#include "AliMultiEventInputHandler.h"
8a587055 31#include "AliAnalysisManager.h"
c8fe2783 32#include "AliMixedEvent.h"
f3138ecf 33#include "AliAODEvent.h"
1c5acb87 34
35ClassImp(AliCaloTrackAODReader)
36
37//____________________________________________________________________________
38AliCaloTrackAODReader::AliCaloTrackAODReader() :
6060ed91 39 AliCaloTrackReader(), fOrgInputEvent(0x0)
1c5acb87 40{
41 //Default Ctor
42
43 //Initialize parameters
44 fDataType=kAOD;
591cc579 45 fReadStack = kTRUE;
46 fReadAODMCParticles = kFALSE;
0ae57829 47
1c5acb87 48}
1c5acb87 49
43074325 50//_________________________________________________________
51AliCentrality* AliCaloTrackAODReader::GetCentrality() const
52{
6060ed91 53 // recover centrality object.
54 AliAODEvent* event = dynamic_cast<AliAODEvent*> (fInputEvent);
55 AliAODEvent* orgevent = dynamic_cast<AliAODEvent*> (fOrgInputEvent);
43074325 56
0de1814a 57 if(event && !fSelectEmbeddedClusters)
58 {
6060ed91 59 //Normal AOD event
60 return event->GetHeader()->GetCentralityP() ;
61 }
0de1814a 62 else if(fSelectEmbeddedClusters && orgevent)
63 {
6060ed91 64 // centrality in AOD from input, not in embedded event
65 // temporary fix until this object is copied to the output event in embedding analysis
66 return orgevent->GetHeader()->GetCentralityP();
67 }
0de1814a 68 else
69 {
6060ed91 70 return 0x0 ;
71 }
72}
73
43074325 74//_________________________________________________________________
75void AliCaloTrackAODReader::SetInputOutputMCEvent(AliVEvent* input,
76 AliAODEvent* aod,
77 AliMCEvent* mc)
78{
1c5acb87 79 // Connect the data pointers
477d6cee 80 // If input is AOD, do analysis with input, if not, do analysis with the output aod.
43074325 81
898c9d44 82 //printf("AODInputHandler %p, MergeEvents %d \n",aodIH, aodIH->GetMergeEvents());
43074325 83
c8fe2783 84 Bool_t tesd = kFALSE ;
85 Bool_t taod = kTRUE ;
0de1814a 86 if ( strcmp(input->GetName(), "AliMixedEvent") == 0 )
87 {
c8fe2783 88 AliMultiEventInputHandler* multiEH = dynamic_cast<AliMultiEventInputHandler*>((AliAnalysisManager::GetAnalysisManager())->GetInputEventHandler());
898c9d44 89 if(multiEH){
0de1814a 90 if (multiEH->GetFormat() == 0 )
91 {
898c9d44 92 tesd = kTRUE ;
0de1814a 93 } else if (multiEH->GetFormat() == 1)
94 {
898c9d44 95 taod = kTRUE ;
96 }
97 }
0de1814a 98 else
99 {
898c9d44 100 printf("AliCaloTrackAODReader::SetInputOutputMCEvent() - MultiEventHandler is NULL");
101 abort();
c8fe2783 102 }
103 }
0de1814a 104 if (strcmp(input->GetName(),"AliESDEvent") == 0)
105 {
c8fe2783 106 tesd = kTRUE ;
0de1814a 107 } else if (strcmp(input->GetName(),"AliAODEvent") == 0)
108 {
c8fe2783 109 taod = kTRUE ;
110 }
111
43074325 112
0de1814a 113 if(tesd)
114 {
477d6cee 115 SetInputEvent(aod);
116 SetOutputEvent(aod);
6060ed91 117 fOrgInputEvent = input;
477d6cee 118 }
0de1814a 119 else if(taod)
120 {
c8fe2783 121 AliAODInputHandler* aodIH = dynamic_cast<AliAODInputHandler*>((AliAnalysisManager::GetAnalysisManager())->GetInputEventHandler());
0de1814a 122
123 if (aodIH && aodIH->GetMergeEvents())
124 {
8a587055 125 //Merged events, use output AOD.
126 SetInputEvent(aod);
127 SetOutputEvent(aod);
6060ed91 128 fOrgInputEvent = input;
8a587055 129 }
0de1814a 130 else
131 {
8a587055 132 SetInputEvent(input);
133 SetOutputEvent(aod);
134 }
477d6cee 135 }
0de1814a 136 else
137 {
c8fe2783 138 AliFatal(Form("AliCaloTrackAODReader::SetInputOutputMCEvent() - STOP : Wrong data format: %s\n",input->GetName()));
477d6cee 139 }
140
141 SetMC(mc);
1c5acb87 142
1c5acb87 143}
08a064bc 144