Heavy ion Analysis Libriares
Loading...
Searching...
No Matches
BoostTask.cxx
1/*
2 * BoostTask.cxx
3 *
4 * Created on: 23 lip 2015
5 * Author: Daniel Wielanek
6 * E-mail: daniel.wielanek@gmail.com
7 * Warsaw University of Technology, Faculty of Physics
8 */
9
10#include "BoostTask.h"
11
12#include "Cout.h"
13#include "DataFormatManager.h"
14#include "Event.h"
15#include "EventInterface.h"
16#include "EventInterfaceAdvanced.h"
17#include "MemoryMapManager.h"
18#include "Package.h"
19#include "Parameter.h"
20#include "TrackInterface.h"
21
22
23namespace Hal {
25
26 BoostTask::BoostTask(Double_t vx, Double_t vy, Double_t vz) :
27 EventAna(), fBoostVx(vx), fBoostVy(vy), fBoostVz(vz), fEventInterface(nullptr), fTrackInterface(nullptr) {}
28
29 BoostTask::BoostTask(Double_t vz) : BoostTask(0, 0, vz) {}
30
31 Task::EInitFlag BoostTask::Init() {
32 Task::EInitFlag stat = EventAna::Init();
34 fEventInterface = event->CreateInterface();
35 if (fEventInterface) {
36 EventInterfaceAdvanced* source = dynamic_cast<EventInterfaceAdvanced*>(fEventInterface);
37 if (source) fTrackInterface = source->GetTrackInterface();
38 } else {
39 return Task::EInitFlag::kFATAL;
40 }
42 return stat;
43 }
44
45 void BoostTask::Exec(Option_t* /*opt*/) {
46 EventInterfaceAdvanced* source = dynamic_cast<EventInterfaceAdvanced*>(fEventInterface);
47 if (source) source->Boost(fBoostVx, fBoostVy, fBoostVz);
48 }
49
50 void BoostTask::SetBoost(Double_t vx, Double_t vy, Double_t vz, Option_t* /*opt*/) {
51 fBoostVx = vx;
52 fBoostVy = vy;
53 fBoostVz = vz;
54 }
55
56 void BoostTask::SetBoost(Double_t vz, Option_t* /*opt*/) { fBoostVz = vz; }
57
59 Package* pack = EventAna::Report();
60 pack->RemoveObjectByName("CutContainer");
61 AddToAnaMetadata(pack, new ParameterString("Boost option", "velocity"));
62 AddToAnaMetadata(pack, new ParameterDouble("Vx", fBoostVx));
63 AddToAnaMetadata(pack, new ParameterDouble("Vy", fBoostVy));
64 AddToAnaMetadata(pack, new ParameterDouble("Vz", fBoostVz));
65 return pack;
66 }
67
68 BoostTask::~BoostTask() {
69 if (fTrackInterface) delete fTrackInterface;
70 if (fEventInterface) delete fEventInterface;
71 }
72} // namespace Hal
void Exec(Option_t *opt)
Definition BoostTask.cxx:45
Task::EInitFlag Init()
Definition BoostTask.cxx:31
virtual Package * Report() const
Definition BoostTask.cxx:58
void SetBoost(Double_t vx, Double_t vy, Double_t vz, Option_t *opt="")
Definition BoostTask.cxx:50
const Event * GetFormat(Int_t task_id, EFormatDepth format_depth=EFormatDepth::kAll) const
static DataFormatManager * Instance()
Int_t GetTaskID() const
Definition EventAna.h:155
Event * fCurrentEvent
Definition EventAna.h:86
void AddToAnaMetadata(Package *main_pack, TObject *obj) const
Definition EventAna.cxx:239
MemoryMapManager * fMemoryMap
Definition EventAna.h:82
virtual Package * Report() const
Definition EventAna.cxx:259
virtual Task::EInitFlag Init()
Definition EventAna.cxx:66
TrackInterface * GetTrackInterface() const
virtual void Boost(Double_t vx, Double_t vy, Double_t vz)
void RemoveObjectByName(TString name, Int_t index=0, Bool_t delete_obj=kTRUE)
Definition Package.cxx:331