00001
00002
00003
00004
00005
00006
00008
00009 #include "AnalysisNtuples/Module/ANtpMCManipulator.h"
00010 #include "MessageService/MsgService.h"
00011
00012 #include <cassert>
00013 #include <algorithm>
00014
00015 ClassImp(ANtpMCManipulator)
00016
00017 CVSID("$Id: ANtpMCManipulator.cxx,v 1.3 2005/11/17 22:15:19 brebel Exp $");
00018
00019
00020 ANtpMCManipulator::ANtpMCManipulator() :
00021 fMCArray(0),
00022 fStdArray(0),
00023 fTHEventArray(0),
00024 fTHTrackArray(0),
00025 fTHShowerArray(0),
00026 fTHStripArray(0)
00027 {
00028
00029 MSG("ANtpMCManipulator", Msg::kDebug) << "ANtpMCManipulator::Constructor" << endl;
00030
00031 }
00032
00033
00034 void ANtpMCManipulator::Initialize(TClonesArray *mcArray, TClonesArray *stdArray,
00035 TClonesArray *thEventArray, TClonesArray *thTrackArray,
00036 TClonesArray *thShowerArray, TClonesArray *thStripArray)
00037 {
00038 fMCArray = mcArray;
00039 fStdArray = stdArray;
00040 fTHEventArray = thEventArray;
00041 fTHTrackArray = thTrackArray;
00042 fTHShowerArray = thShowerArray;
00043 fTHStripArray = thStripArray;
00044
00045 MSG("ANtpMCManipulator", Msg::kDebug) << "ANtpMCManipulator::Constructor" << endl;
00046 }
00047
00048
00049
00050 ANtpMCManipulator::~ANtpMCManipulator()
00051 {
00052 MSG("ANtpMCManipulator", Msg::kDebug) << "ANtpMCManipulator::Destructor" << endl;
00053 }
00054
00055
00056 NtpMCTruth *ANtpMCManipulator::GetNtpMCTruth(Int_t index)
00057 {
00058 NtpMCTruth *ntpMCTruth = 0;
00059
00060 if(!fMCArray) return ntpMCTruth;
00061
00062 if(index < 0 && fMCArray->GetEntries()>0) index = 0;
00063 if(index < fMCArray->GetEntries()+1)
00064 ntpMCTruth = dynamic_cast<NtpMCTruth *>(fMCArray->At(index));
00065
00066 return ntpMCTruth;
00067 }
00068
00069
00070 NtpMCStdHep *ANtpMCManipulator::GetNtpMCStdHep(Int_t index)
00071 {
00072 NtpMCStdHep *ntpMCStdHep = 0;
00073
00074 if(!fStdArray) return ntpMCStdHep;
00075
00076 if(index < 0 && fStdArray->GetEntries()>0) index = 0;
00077 if(index < fStdArray->GetEntries()+1)
00078 ntpMCStdHep = dynamic_cast<NtpMCStdHep *>(fStdArray->At(index));
00079
00080 return ntpMCStdHep;
00081 }
00082
00083
00084 NtpTHEvent *ANtpMCManipulator::GetNtpTHEvent(Int_t index)
00085 {
00086 NtpTHEvent *ntpTHEvent = 0;
00087
00088 if(!fTHEventArray) return ntpTHEvent;
00089
00090 if(index < 0 && fTHEventArray->GetEntries()>0) index = 0;
00091 if(index < fTHEventArray->GetLast()+1)
00092 ntpTHEvent = dynamic_cast<NtpTHEvent *>(fTHEventArray->At(index));
00093
00094 return ntpTHEvent;
00095 }
00096
00097
00098 NtpTHTrack *ANtpMCManipulator::GetNtpTHTrack(Int_t index)
00099 {
00100 NtpTHTrack *ntpTHTrack = 0;
00101
00102 if(!fTHTrackArray) return ntpTHTrack;
00103
00104 if(index < 0 && fTHTrackArray->GetEntries()>0) index = 0;
00105 if(index < fTHTrackArray->GetLast()+1)
00106 ntpTHTrack = dynamic_cast<NtpTHTrack *>(fTHTrackArray->At(index));
00107
00108 return ntpTHTrack;
00109 }
00110
00111
00112 NtpTHShower *ANtpMCManipulator::GetNtpTHShower(Int_t index)
00113 {
00114 NtpTHShower *ntpTHShower = 0;
00115
00116 if(!fTHShowerArray) return ntpTHShower;
00117
00118 if(index < 0 && fTHShowerArray->GetEntries()>0) index = 0;
00119 if(index < fTHShowerArray->GetLast()+1)
00120 ntpTHShower = dynamic_cast<NtpTHShower *>(fTHShowerArray->At(index));
00121
00122 return ntpTHShower;
00123 }
00124
00125
00126 NtpTHStrip *ANtpMCManipulator::GetNtpTHStrip(Int_t index)
00127 {
00128 NtpTHStrip *ntpTHStrip = 0;
00129
00130 if(!fTHStripArray) return ntpTHStrip;
00131
00132 if(index < 0 && fTHStripArray->GetEntries()>0) index = 0;
00133 if(index < fTHStripArray->GetLast()+1)
00134 ntpTHStrip = dynamic_cast<NtpTHStrip *>(fTHStripArray->At(index));
00135
00136 return ntpTHStrip;
00137 }