]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG4/PartCorrBase/AliCaloTrackAODReader.cxx
coverity and coding violations
[u/mrichter/AliRoot.git] / PWG4 / PartCorrBase / 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
28
29// --- ROOT system ---
30//#include "Riostream.h"
31
32//---- ANALYSIS system ----
33#include "AliCaloTrackAODReader.h"
8a587055 34#include "AliAODInputHandler.h"
c8fe2783 35#include "AliMultiEventInputHandler.h"
8a587055 36#include "AliAnalysisManager.h"
c8fe2783 37#include "AliMixedEvent.h"
1c5acb87 38
39ClassImp(AliCaloTrackAODReader)
40
41//____________________________________________________________________________
42AliCaloTrackAODReader::AliCaloTrackAODReader() :
6060ed91 43 AliCaloTrackReader(), fOrgInputEvent(0x0)
1c5acb87 44{
45 //Default Ctor
46
47 //Initialize parameters
48 fDataType=kAOD;
591cc579 49 fReadStack = kTRUE;
50 fReadAODMCParticles = kFALSE;
0ae57829 51
1c5acb87 52}
1c5acb87 53
233e0df8 54
43074325 55//_________________________________________________________
56AliCentrality* AliCaloTrackAODReader::GetCentrality() const
57{
6060ed91 58 // recover centrality object.
59 AliAODEvent* event = dynamic_cast<AliAODEvent*> (fInputEvent);
60 AliAODEvent* orgevent = dynamic_cast<AliAODEvent*> (fOrgInputEvent);
43074325 61
6060ed91 62 if(event && !fSelectEmbeddedClusters) {
63 //Normal AOD event
64 return event->GetHeader()->GetCentralityP() ;
65 }
44b0a8f7 66 else if(fSelectEmbeddedClusters && orgevent) {
6060ed91 67 // centrality in AOD from input, not in embedded event
68 // temporary fix until this object is copied to the output event in embedding analysis
69 return orgevent->GetHeader()->GetCentralityP();
70 }
71 else {
72 return 0x0 ;
73 }
74}
75
43074325 76//_________________________________________________________________
77void AliCaloTrackAODReader::SetInputOutputMCEvent(AliVEvent* input,
78 AliAODEvent* aod,
79 AliMCEvent* mc)
80{
1c5acb87 81 // Connect the data pointers
477d6cee 82 // If input is AOD, do analysis with input, if not, do analysis with the output aod.
43074325 83
898c9d44 84 //printf("AODInputHandler %p, MergeEvents %d \n",aodIH, aodIH->GetMergeEvents());
43074325 85
c8fe2783 86 Bool_t tesd = kFALSE ;
87 Bool_t taod = kTRUE ;
88 if ( strcmp(input->GetName(), "AliMixedEvent") == 0 ) {
89 AliMultiEventInputHandler* multiEH = dynamic_cast<AliMultiEventInputHandler*>((AliAnalysisManager::GetAnalysisManager())->GetInputEventHandler());
898c9d44 90 if(multiEH){
91 if (multiEH->GetFormat() == 0 ) {
92 tesd = kTRUE ;
93 } else if (multiEH->GetFormat() == 1) {
94 taod = kTRUE ;
95 }
96 }
97 else{
98 printf("AliCaloTrackAODReader::SetInputOutputMCEvent() - MultiEventHandler is NULL");
99 abort();
c8fe2783 100 }
101 }
102 if (strcmp(input->GetName(),"AliESDEvent") == 0) {
103 tesd = kTRUE ;
104 } else if (strcmp(input->GetName(),"AliAODEvent") == 0) {
105 taod = kTRUE ;
106 }
107
43074325 108
c8fe2783 109 if(tesd) {
477d6cee 110 SetInputEvent(aod);
111 SetOutputEvent(aod);
6060ed91 112 fOrgInputEvent = input;
477d6cee 113 }
c8fe2783 114 else if(taod){
115 AliAODInputHandler* aodIH = dynamic_cast<AliAODInputHandler*>((AliAnalysisManager::GetAnalysisManager())->GetInputEventHandler());
8a587055 116 if (aodIH && aodIH->GetMergeEvents()) {
117 //Merged events, use output AOD.
118 SetInputEvent(aod);
119 SetOutputEvent(aod);
6060ed91 120 fOrgInputEvent = input;
8a587055 121 }
122 else{
123 SetInputEvent(input);
124 SetOutputEvent(aod);
125 }
477d6cee 126 }
127 else{
c8fe2783 128 AliFatal(Form("AliCaloTrackAODReader::SetInputOutputMCEvent() - STOP : Wrong data format: %s\n",input->GetName()));
477d6cee 129 }
130
131 SetMC(mc);
1c5acb87 132
1c5acb87 133}
08a064bc 134