Heavy ion Analysis Libriares
Loading...
Searching...
No Matches
MultiTrackAna.cxx
1/*
2 * MultiTrackAna.cxx
3 *
4 * Created on: 07-08-2013
5 * Author: Daniel Wielanek
6 * E-mail: daniel.wielanek@gmail.com
7 * Warsaw University of Technology, Faculty of Physics
8 */
9
10#include "MultiTrackAna.h"
11
12#include "Cout.h"
13#include "DataFormatManager.h"
14#include "Event.h"
15#include "EventAna.h"
16#include "MemoryMapManager.h"
17#include "Parameter.h"
18#include "Std.h"
19
20#include <RtypesCore.h>
21#include <TString.h>
22
23
24namespace Hal {
25 Task::EInitFlag MultiTrackAna::Init() {
26 if (Task::EInitFlag::kSUCCESS == TrackAna::Init()) {
27 if (fMixSize < 1) {
28#ifdef HAL_DEBUG
29 Cout::PrintInfo("To small mix size, increasing to 1", EInfo::kDebugInfo);
30#endif
31 fMixSize = 1;
32 }
33#ifdef HAL_DEBUG
34 Cout::PrintInfo(Form("Mix size is %i", fMixSize), EInfo::kDebugInfo);
35#endif
36 return Task::EInitFlag::kSUCCESS;
37 } else {
38 Cout::PrintInfo("Failed to init TrackAna in MultiTrackAna", EInfo::kError);
39 return Task::EInitFlag::kFATAL;
40 }
41 }
42
43 void MultiTrackAna::SetMixSize(Int_t to_mix) {
44 if (to_mix < 1) {
45 Cout::PrintInfo("Wrong mix size in SetMixSize", EInfo::kWarning);
46 } else {
47 fMixSize = to_mix;
48 }
49 }
50
51 void MultiTrackAna::SetOption(Option_t* option) { TrackAna::SetOption(option); }
52
54
55 MultiTrackAna::~MultiTrackAna() {}
56
57 MultiTrackAna::MultiTrackAna(ECutUpdate tiers) : TrackAna(tiers) {}
58
59 MultiTrackAna::MultiTrackAna() : MultiTrackAna(ECutUpdate::kTwoTrack) {}
60
61 MultiTrackAna::MultiTrackAna(const MultiTrackAna& ana) : TrackAna(ana) {}
62
64 Package* pack = TrackAna::Report();
65 AddToAnaMetadata(pack, new ParameterInt("MixSize", fMixSize));
66 return pack;
67 }
68
73
75
77
78 MultiTrackAna& MultiTrackAna::operator=(const MultiTrackAna& other) {
79 if (this != &other) { TrackAna::operator=(other); }
80 return *this;
81 }
82
83 Task::EInitFlag MultiTrackAna::CheckFormat() {
84 Task::EInitFlag stat = TrackAna::CheckFormat();
85 if (stat == Task::EInitFlag::kFATAL) return stat;
86 if (DataFormatManager::Instance()->GetFormat(GetTaskID(), EFormatDepth::kBuffered) == nullptr) {
87 Cout::PrintInfo(Form("%s %s", this->ClassName(), ": Buffered format not set, fixing"), EInfo::kWarning);
88 if (DataFormatManager::Instance()->GetFormat(GetTaskID(), EFormatDepth::kNonBuffered) == nullptr) {
89 Cout::PrintInfo("Cannot fix, non-buffered format not present", EInfo::kError);
90 return Task::EInitFlag::kFATAL;
91 }
92 SetFormatBuffered(DataFormatManager::Instance()->GetFormat(GetTaskID(), EFormatDepth::kNonBuffered)->GetNewEvent());
93 }
94 const Event* nonBuf = DataFormatManager::Instance()->GetFormat(GetTaskID(), EFormatDepth::kNonBuffered);
95 const Event* Buf = DataFormatManager::Instance()->GetFormat(GetTaskID(), EFormatDepth::kBuffered);
96 if (Buf->IsCompatible(nonBuf)) {
97#ifdef HAL_DEBUG
98 Cout::PrintInfo("Formats are compatible", EInfo::kDebugInfo);
99#endif
100 return Task::EInitFlag::kSUCCESS;
101 } else {
102 Cout::PrintInfo(Form("Format %s is not compatible with %s", nonBuf->GetFormatName().Data(), Buf->GetFormatName().Data()),
103 EInfo::kError);
104 }
105 return Task::EInitFlag::kSUCCESS;
106 }
107} // namespace Hal
static void PrintInfo(TString text, Hal::EInfo status)
Definition Cout.cxx:370
const Event * GetFormat(Int_t task_id, EFormatDepth format_depth=EFormatDepth::kAll) const
static DataFormatManager * Instance()
virtual Task::EInitFlag CheckFormat()
Definition EventAna.cxx:371
Int_t GetTaskID() const
Definition EventAna.h:155
Int_t fMixSize
Definition EventAna.h:57
virtual void InitNewCutContainer()
Definition EventAna.cxx:192
void AddToAnaMetadata(Package *main_pack, TObject *obj) const
Definition EventAna.cxx:239
MemoryMapManager * fMemoryMap
Definition EventAna.h:82
Int_t fCurrentEventCollectionID
Definition EventAna.h:65
virtual Bool_t IsCompatible(const Event *non_buffered) const
Definition Event.cxx:245
virtual TString GetFormatName() const
Definition Event.cxx:155
void BufferEvent(Int_t collection)
virtual Task::EInitFlag CheckFormat()
virtual Task::EInitFlag Init()
virtual void InitNewCutContainer()
virtual Package * Report() const
virtual void FinishTask()
void SetMixSize(Int_t to_mix)
virtual void ProcessTrack()
virtual void SetOption(Option_t *option)
void SetFormatBuffered(Event *format)
virtual void ProcessEvent()
virtual Task::EInitFlag Init()
Definition TrackAna.cxx:48
virtual Package * Report() const
Definition TrackAna.cxx:94
virtual void FinishTask()
Definition TrackAna.cxx:99
virtual void ProcessEvent()
Definition TrackAna.cxx:30
virtual void SetOption(Option_t *option)
Definition TrackAna.cxx:56