File indexing completed on 2024-11-16 09:02:05
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #ifndef INCLUDE_EICSMEAR_ERHIC_EVENTMC_H_
0011 #define INCLUDE_EICSMEAR_ERHIC_EVENTMC_H_
0012
0013 #include <string>
0014 #include <vector>
0015
0016 #include <TClonesArray.h>
0017 #include <TLorentzVector.h>
0018
0019 #include "eicsmear/erhic/EventDis.h"
0020 #include "eicsmear/erhic/ParticleMC.h"
0021
0022 class TTree;
0023
0024 namespace erhic {
0025
0026
0027
0028
0029
0030 class EventMC : public EventDis {
0031 public:
0032
0033
0034
0035 EventMC();
0036
0037
0038
0039
0040 virtual ~EventMC();
0041
0042 virtual bool RequiresEaParticleFields() { return false; };
0043
0044
0045
0046
0047 virtual ULong64_t GetN() const;
0048
0049
0050
0051
0052 virtual Int_t GetProcess() const;
0053
0054
0055
0056
0057 virtual UInt_t GetNTracks() const;
0058
0059
0060
0061
0062
0063
0064 virtual const ParticleMC* GetTrack(UInt_t) const;
0065
0066
0067
0068
0069 virtual ParticleMC* GetTrack(UInt_t);
0070
0071
0072
0073
0074
0075
0076
0077
0078
0079
0080
0081
0082 virtual const ParticleMC* BeamLepton() const;
0083
0084
0085
0086
0087
0088
0089
0090
0091 virtual const ParticleMC* BeamHadron() const;
0092
0093
0094
0095
0096
0097
0098
0099
0100 virtual const ParticleMC* ExchangeBoson() const;
0101
0102
0103
0104
0105
0106
0107
0108
0109
0110
0111
0112
0113
0114 virtual const ParticleMC* ScatteredLepton() const;
0115
0116
0117
0118
0119
0120
0121 virtual bool Parse(const std::string&) = 0;
0122
0123
0124
0125
0126
0127 virtual void AddLast(ParticleMC* track);
0128
0129
0130
0131
0132
0133 virtual void Reset();
0134
0135
0136
0137
0138 void Print( const Option_t *option="" ) const;
0139
0140
0141
0142
0143
0144
0145 virtual void Clear(Option_t* = "");
0146
0147
0148
0149
0150
0151 virtual void SetProcess(int code);
0152
0153
0154
0155
0156
0157 virtual void SetN(int n);
0158
0159
0160
0161
0162
0163 virtual void SetNTracks(int n);
0164
0165
0166
0167
0168 virtual void SetELeptonInNuclearFrame(double energy);
0169
0170
0171
0172
0173 virtual void SetEScatteredInNuclearFrame(double energy);
0174
0175
0176
0177
0178
0179
0180
0181 void FinalState(ParticlePtrList& particles) const;
0182
0183
0184
0185
0186
0187
0188 void HadronicFinalState(ParticlePtrList&) const;
0189
0190
0191
0192
0193 TLorentzVector FinalStateMomentum() const;
0194
0195
0196
0197
0198 TLorentzVector HadronicFinalStateMomentum() const;
0199
0200
0201
0202
0203 Double_t FinalStateCharge() const;
0204
0205
0206
0207
0208
0209 std::vector<const VirtualParticle*> GetTracks() const;
0210
0211 protected:
0212 Int_t number;
0213 Int_t process;
0214 Int_t nTracks;
0215 Double32_t ELeptonInNucl;
0216
0217 Double32_t ELeptonOutNucl;
0218
0219 TClonesArray particles;
0220
0221 ClassDef(erhic::EventMC, 2)
0222 };
0223
0224 inline ULong64_t EventMC::GetN() const {
0225 return number;
0226 }
0227
0228 inline Int_t EventMC::GetProcess() const {
0229 return process;
0230 }
0231
0232 inline UInt_t EventMC::GetNTracks() const {
0233 return particles.GetEntries();
0234 }
0235
0236 inline const ParticleMC* EventMC::GetTrack(UInt_t u) const {
0237 if (u < (UInt_t)particles.GetEntries()) {
0238 return static_cast<ParticleMC*>(particles.At(u));
0239 } else {
0240 return NULL;
0241 }
0242 }
0243
0244 inline ParticleMC* EventMC::GetTrack(UInt_t u) {
0245 if (u < (UInt_t)particles.GetEntries()) {
0246 return static_cast<ParticleMC*>(particles.At(u));
0247 } else {
0248 return NULL;
0249 }
0250 }
0251
0252 inline void EventMC::SetProcess(int code) {
0253 process = code;
0254 }
0255
0256 inline void EventMC::SetN(int n) {
0257 number = n;
0258 }
0259
0260 inline void EventMC::SetNTracks(int n) {
0261 nTracks = n;
0262 }
0263
0264 inline void EventMC::SetELeptonInNuclearFrame(double e) {
0265 ELeptonInNucl = e;
0266 }
0267
0268 inline void EventMC::SetEScatteredInNuclearFrame(double e) {
0269 ELeptonOutNucl = e;
0270 }
0271
0272
0273
0274
0275 class Reader {
0276 public:
0277
0278
0279
0280 explicit Reader(const std::string& treeName = "EICTree");
0281
0282
0283
0284
0285 virtual ~Reader() { }
0286
0287
0288
0289
0290
0291
0292 EventMC* Read(Long64_t number);
0293
0294
0295
0296
0297
0298
0299 EventMC* operator()(Long64_t number);
0300
0301
0302
0303
0304 TTree* GetTree();
0305
0306 EventMC* mEvent;
0307 TTree* mTree;
0308
0309 ClassDef(erhic::Reader, 1)
0310 };
0311
0312 inline EventMC* Reader::operator()(Long64_t i) {
0313 return Read(i);
0314 }
0315
0316 inline TTree* Reader::GetTree() {
0317 return mTree;
0318 }
0319
0320 }
0321
0322 #endif