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