Heavy ion Analysis Libriares
Loading...
Searching...
No Matches
SmearedEvent.cxx
1/*
2 * EventSmeared.cxx
3 *
4 * Created on: 20 lis 2016
5 * Author: Daniel Wielanek
6 * E-mail: daniel.wielanek@gmail.com
7 * Warsaw University of Technology, Faculty of Physics
8 */
9
10#include "SmearedEvent.h"
11#include "ComplexTrack.h"
12
13
14#include <TClonesArray.h>
15#include <TObjArray.h>
16#include <TString.h>
17
18#include "ComplexEventInterface.h"
19#include "Event.h"
20#include "McTrack.h"
21#include "VirtualEvent.h"
22
23namespace Hal {
24 SmearedEvent::SmearedEvent() : ComplexEvent("SmearedTrack", NULL, NULL), fSmearing(kFALSE), fRealMC(kFALSE) {}
25
26 void SmearedEvent::Clear(Option_t* opt) { ComplexEvent::Clear(opt); }
27
28 TString SmearedEvent::GetFormatName() const { return fRealEvent->GetFormatName() + "_smeared"; }
29
31 ComplexEvent("SmearedTrack", event->GetNewEvent(), new VirtualEvent()), fSmearing(kFALSE) {
32 if (event->InheritsFrom("Hal::McEvent")) {
33 fRealMC = kTRUE;
34 } else {
35 fRealMC = kFALSE;
36 }
37 }
38
40 ComplexEvent(other), fSmearing(other.fSmearing), fRealMC(other.fRealMC) {}
41
43 if (fSmearing) { // we need to update real event and copy data to imaginary
44 // event
45 ComplexEventInterface* inter = (ComplexEventInterface*) interface;
46 fRealEvent->Update(inter->GetReal());
47 CopyData(fRealEvent);
48 fImgEvent->Clear();
49 fImgEvent->ShallowCopyEvent(fRealEvent);
50 fTracks->Clear();
51 if (fRealEvent->GetTotalTrackNo()) {
52 fTotalTracksNo = fRealEvent->GetTotalTrackNo();
53 for (int i = 0; i < fTotalTracksNo; i++) {
54 Track* tr = (Track*) fRealEvent->fTracks->UncheckedAt(i);
55 ComplexTrack* to = (ComplexTrack*) fTracks->ConstructedAt(i);
56 if (fRealMC) {
57 ((McTrack*) to)->McTrack::CopyData(tr);
58 } else {
59 to->Track::CopyData(tr);
60 }
61 to->SetImgTrack((Track*) ((VirtualEvent*) fImgEvent)->GetTrackSafely(i));
62 to->SetRealTrack(tr);
63 }
64 }
65 } else { // each event is separately updated
66 ComplexEvent::Update(interface);
67 }
68 }
69
70 SmearedEvent::~SmearedEvent() {}
71} // namespace Hal
virtual void Update(EventInterface *interface)
virtual void Clear(Option_t *opt=" ")
virtual void ShallowCopyEvent(Event *event)
Definition Event.cxx:100
virtual void Update(EventInterface *interface)
Definition Event.cxx:157
Int_t GetTotalTrackNo() const
Definition Event.h:236
virtual void Clear(Option_t *opt=" ")
Definition Event.cxx:82
void CopyData(Event *event)
Definition Event.cxx:136
virtual TString GetFormatName() const
Definition Event.cxx:155
TString GetFormatName() const
virtual void Update(EventInterface *interface)
void Clear(Option_t *opt=" ")