10#include "TwoTrackAnaChain.h"
13#include "CutContainer.h"
14#include "DataFormatManager.h"
16#include "EventVirtualCut.h"
17#include "MemoryMapManager.h"
21#include "TrackVirtualCut.h"
23#include "TwoTrackVirtualCut.h"
30 TwoTrackAnaChain::TwoTrackAnaChain(Bool_t use_background) :
TwoTrackAna(use_background), fTaskNo(0), fTask(NULL) {
34 TwoTrackAnaChain::TwoTrackAnaChain() : fTaskNo(0), fTask(NULL) {}
36 void TwoTrackAnaChain::RemoveTask(Int_t no) {
40 for (
int i = 0; i < fTaskNo; i++) {
41 if (i == no)
continue;
51 for (
int i = 0; i < fTaskNo; i++) {
59 for (
int i = 0; i < fTaskNo; i++) {
66 for (
int i = 0; i < fTaskNo; i++) {
73 if (!ana->InheritsFrom(
"Hal::TwoTrackAna")) {
74 Cout::PrintInfo(
"Tasks that doesn't inherit from TwoTrackAna cannot be processed "
79 Cout::PrintInfo(Form(
"Task that is added must have the same trier %s will not be added", ana->ClassName()),
89 for (
int i = 0; i < fTaskNo; i++) {
90 if (ana == fTask[i]) {
97 for (
int i = 0; i < fTaskNo; i++) {
101 fTask[fTaskNo] = ana;
110 metadata_new->
SetName(
"RunInfo");
117 TDirectory* dir = (TDirectory*) gFile;
118 TDirectory* metadatata = (TDirectory*) dir->Get(
"HalInfo");
119 if (metadatata->Get(
"RunInfo")) {
122 metadata_new->Write(
"RunInfo");
125 pack->Write(Form(
"AnaPackage_%i",
GetTaskID()));
126 if (pack) {
delete pack; }
127 for (
int i = 0; i < fTaskNo; i++) {
130 subtask_pack->Write(Form(
"AnaPackage_%i", fTask[i]->
GetTaskID()));
134 Cout::PrintInfo(Form(
"%s done, writing results", this->ClassName()), EInfo::kInfo);
139 if (stat == Task::EInitFlag::kSUCCESS) {
141 for (
int i = 0; i < fTaskNo; i++) {
144 if (Task::EInitFlag::kFATAL == fTask[i]->
Init()) {
151 return Task::EInitFlag::kSUCCESS;
153 return Task::EInitFlag::kFATAL;
157 for (
int i = 0; i < fTaskNo; i++) {
164 for (
int i = 0; i < fTaskNo; i++) {
171 for (
int i = 0; i < fTaskNo; i++) {
178 for (
int i = 0; i < fTaskNo; i++) {
185 for (
int i = 0; i < fTaskNo; i++) {
192 for (
int i = 0; i < fTaskNo; i++) {
199 for (
int i = 0; i < fTaskNo; i++) {
206 for (
int i = 0; i < fTaskNo; i++) {
213 for (
int i = 0; i < fTaskNo; i++) {
220 for (
int i = 0; i < fTaskNo; i++) {
227 for (
int i = 0; i < fTaskNo; i++) {
234 for (
int i = 0; i < fTaskNo; i++) {
241 for (
int i = 0; i < fTaskNo; i++) {
248 for (
int i = 0; i < fTaskNo; i++) {
255 for (
int i = 0; i < fTaskNo; i++) {
262 for (
int i = 0; i < fTaskNo; i++) {
273 if (tr1 == 0 || tr2 == 0) {
277 for (
int i = 0; i < fTaskNo; i++) {
278 fTask[i]->fCurrentTrack1CollectionNo = fCurrentTrack1CollectionNo;
279 fTask[i]->fCurrentTrack2CollectionNo = fCurrentTrack2CollectionNo;
285 MakePairs2_Perfect();
293 MakePairs2_Rotated();
297 MakePairs2_Hemisphere();
305 MakePairs2_Charged2();
311 for (
int i = 0; i < fTaskNo; i++) {
312 fTask[i]->fCurrentTrack1CollectionNo = fCurrentTrack1CollectionNo;
313 fTask[i]->fCurrentTrack2CollectionNo = fCurrentTrack2CollectionNo;
317 MakePairs2_Charged3();
319 default:
Cout::PrintInfo(
"Unknown Background mode", EInfo::kCriticalError);
break;
328 for (
int i = 0; i < fTaskNo; i++) {
329 fTask[i]->fCurrentTrack1CollectionNo = fCurrentTrack1CollectionNo;
330 fTask[i]->fCurrentTrack2CollectionNo = fCurrentTrack2CollectionNo;
348 MakePairs_Hemisphere();
358 for (
int i = 0; i < fTaskNo; i++) {
359 fTask[i]->fCurrentTrack1CollectionNo = fCurrentTrack1CollectionNo;
360 fTask[i]->fCurrentTrack2CollectionNo = fCurrentTrack2CollectionNo;
365 MakePairs_Charged2();
372 for (
int i = 0; i < fTaskNo; i++) {
373 fTask[i]->fCurrentTrack1CollectionNo = fCurrentTrack1CollectionNo;
374 fTask[i]->fCurrentTrack2CollectionNo = fCurrentTrack2CollectionNo;
379 MakePairs_Charged3();
381 default:
Cout::PrintInfo(
"Unknown Background mode", EInfo::kCriticalError);
break;
390 ana->fCurrentTrack1 = fCurrentTrack1;
391 ana->fCurrentTrack2 = fCurrentTrack2;
405 ana->fCurrentTrack1 =
nullptr;
406 ana->fCurrentTrack2 =
nullptr;
425 TwoTrackAnaChain::~TwoTrackAnaChain() {
426 for (
int i = 0; i < fTaskNo; i++) {
static void PrintInfo(TString text, Hal::EInfo status)
void MakeDummyCopies(ECutUpdate update, CutContainer *other, Bool_t copy_link)
CutContainer * fCutContainer
Int_t fEventCollectionsNo
TString GetInputFileName() const
MemoryMapManager * fMemoryMap
virtual void AddCut(const Cut &cut, Option_t *opt="")
virtual Package * Report() const
Int_t fCurrentEventCollectionID
virtual void SetFormat(Event *format, EFormatDepth depth=EFormatDepth::kAll)
Int_t GetTracksNo(Int_t event_collection, Int_t track_collection) const
void RejectLastEvent(Int_t event_collection)
Bool_t IsReadyToMixing(Int_t collection) const
virtual void ProcessTrack()
void SetName(TString name)
void AddObject(TObject *object)
void GoToDir(TString name)
Int_t fCurrentTrackCollectionID
Int_t fTrackCollectionsNo
virtual void SynchronizeCutContainers(TwoTrackAna *ana, Bool_t end) const
virtual void UnlinkTask(TwoTrackAna *ana) const
void ProcessPair2_Charged2()
void ProcessPair_Hemisphere()
void ProcessPair2_Perfect()
void ProcessPair2_Charged3()
void ProcessPair_Charged2()
void ProcessPair2_Hemisphere()
void ProcessPair_ChargedId()
void ProcessPair2_Rotated()
virtual void FinishEventNonIdentical()
virtual void FinishTask()
virtual void FinishEventIdentical()
void ProcessPair_Rotated()
void ProcessPair_Charged3()
virtual void LinkTask(TwoTrackAna *ana) const
virtual void AddAnalysis(TwoTrackAna *ana)
virtual Package * Report() const
virtual Task::EInitFlag Init()
void ProcessPair_Perfect()
void ProcessPair_ChargedNId()
void ProcessPair2_Mixed()
TwoTrack * fCurrentSignalPair
virtual void ProcessPair2_Charged2()
virtual void ProcessPair2_Charged3()
TwoTrack * fCurrentBackgroundPair
Int_t fTwoTrackCollectionsNo
virtual void ProcessPair_ChargedNId()
virtual Package * Report() const
virtual void ProcessEvent()
virtual void ProcessPair_Charged2()
virtual void ProcessPair2_Perfect()
virtual void ProcessPair_Perfect()
virtual void ProcessPair2()
virtual void ProcessPair2_Hemisphere()
Int_t fCurrentPairCollectionID
@ kHemispherePairsID
kHemispherePairsID
@ kRotatedPairsID
kRotatedPairsID
@ kNoBackgroundNID
kNoBackgroundNID
@ kHemispherePairsNID
kHemispherePairsNID
@ kNoBackgroundID
kNoBackgroundID
@ kRotatedPairsNID
kRotatedPairsNID
@ kChargedNID2
kChargedNID2
@ kMixedPairsNID
kMixedPairsNID
@ kPerfectPairsID
kPerfectPairsID
@ kNoBackground
kNoBackground
@ kPerfectPairsNID
kPerfectPairsNID
@ kMixedPairsID
kMixedPairsID
@ kChargedNID3
kChargedNID3
virtual void ProcessPair_Mixed()
TwoTrackAna(Bool_t use_background=kFALSE)
virtual void ProcessPair_ChargedId()
virtual void ProcessPair2_Mixed()
virtual void ProcessPair2_Rotated()
virtual void ProcessPair_Hemisphere()
virtual void ProcessPair_Charged3()
virtual void ProcessPair_Rotated()
virtual void ProcessPair()
void SetMixSize(Int_t mixsize)
virtual Task::EInitFlag Init()