Heavy ion Analysis Libriares
Loading...
Searching...
No Matches
SplittingToStatusTask.cxx
1/*
2 * SplittingToStatusTask.cxx
3 *
4 * Created on: 28 kwi 2021
5 * Author: Daniel Wielanek
6 * E-mail: daniel.wielanek@gmail.com
7 * Warsaw University of Technology, Faculty of Physics
8 */
9
10#include "SplittingToStatusTask.h"
11
12#include "ComplexEvent.h"
13#include "ComplexTrack.h"
14#include "DataFormatManager.h"
15#include "DataManager.h"
16#include "Event.h"
17#include "MemoryMapManager.h"
18#include "Std.h"
19#include "Track.h"
20
21#include <RtypesCore.h>
22
23namespace Hal {
24 SplittingToStatusTask::SplittingToStatusTask() { AddTags("splitting task"); }
25
26 SplittingToStatusTask::~SplittingToStatusTask() {}
27
30 const Event* ev = formatManager->GetFormat(GetTaskID(), EFormatDepth::kNonBuffered);
31 if (ev == nullptr) return Task::EInitFlag::kFATAL;
32 if (dynamic_cast<const ComplexEvent*>(ev) == nullptr) { return Task::EInitFlag::kFATAL; }
33 return EventAna::CheckFormat();
34 }
35
36 Task::EInitFlag SplittingToStatusTask::Init() {
37 Task::EInitFlag init = EventAna::Init();
38 DataManager* ioManager = DataManager::Instance();
39 ioManager->Register(Form("%s.", fCurrentEvent->ClassName()), "HalEvents", fCurrentEvent, kFALSE);
40 return init;
41 }
42
43 void SplittingToStatusTask::Exec(Option_t* /*opt*/) {
46 ComplexEvent* ev = static_cast<ComplexEvent*>(fCurrentEvent);
47 Event* im = ev->GetImgEvent();
48 // Event* rec = ev->GetRealEvent();
49 int size = fSplitFlag.size();
50 if (size < im->GetTotalTrackNo()) fSplitFlag.resize(im->GetTotalTrackNo());
51
52 for (int i = 0; i < im->GetTotalTrackNo(); i++)
53 fSplitFlag[i] = 0;
54 for (int i = 0; i < ev->GetTotalTrackNo(); i++) {
55 ComplexTrack* tr = (ComplexTrack*) ev->GetTrack(i);
56 if (tr->GetMatchID() > -1) { ++fSplitFlag[tr->GetMatchID()]; }
57 }
58 for (int i = 0; i < ev->GetTotalTrackNo(); i++) {
59 ComplexTrack* z = (ComplexTrack*) ev->GetTrack(i);
60 Int_t match = z->GetMatchID();
61 if (match > -1) {
62 if (fSplitFlag[match] > 1)
63 z->SetStatus(1);
64 else
65 z->SetStatus(0);
66 }
67 }
68 }
69
70 SplittingToStatusTask::SplittingToStatusTask(const SplittingToStatusTask& other) :
71 EventAna(other), fSplitFlag(other.fSplitFlag) {}
72
73 SplittingToStatusTask& SplittingToStatusTask::operator=(const SplittingToStatusTask& other) {
74 if (this == &other) return *this;
76 fSplitFlag = other.fSplitFlag;
77 return *this;
78 }
79} // namespace Hal
const Event * GetFormat(Int_t task_id, EFormatDepth format_depth=EFormatDepth::kAll) const
static DataFormatManager * Instance()
void Register(const char *name, const char *folderName, TNamed *obj, Bool_t toFile)
virtual Task::EInitFlag CheckFormat()
Definition EventAna.cxx:371
Int_t GetTaskID() const
Definition EventAna.h:155
Event * fCurrentEvent
Definition EventAna.h:86
UInt_t fProcessedEvents
Definition EventAna.h:53
MemoryMapManager * fMemoryMap
Definition EventAna.h:82
EventAna & operator=(const EventAna &other)
Definition EventAna.cxx:449
virtual Task::EInitFlag Init()
Definition EventAna.cxx:66
virtual void AddTags(TString tag)
Definition EventAna.cxx:304
Int_t GetTotalTrackNo() const
Definition Event.h:236
Track * GetTrack(Int_t i) const
Definition Event.h:208
virtual Task::EInitFlag CheckFormat()
virtual void Exec(Option_t *opt="")
virtual Task::EInitFlag Init()
void SetStatus(Int_t status)
Definition Track.h:144