Heavy ion Analysis Libriares
Loading...
Searching...
No Matches
SameMotherMcCut.cxx
1/*
2 * SameMotherCut.cxx
3 *
4 * Created on: 2 kwi 2024
5 * Author: daniel
6 */
7
8#include "SameMotherMcCut.h"
9
10#include "DataFormatManager.h"
11#include "Event.h"
12#include "McTrack.h"
13#include "TwoTrack.h"
14
15namespace Hal {
16
17 SameMotherMcCut::SameMotherMcCut() : TwoTrackCut(1) {
18 SetUnitName("SameMother", 0);
19 SetMinAndMax(1, 0);
20 }
21
22 Bool_t SameMotherMcCut::Pass(TwoTrack* pair) {
23 auto tr1 = (Hal::McTrack*) pair->GetTrack1();
24 auto tr2 = (Hal::McTrack*) pair->GetTrack2();
25 if (tr1->GetMotherIndex() < 0) { return ForcedUpdate(0); }
26 if (tr2->GetMotherIndex() < 0) { return ForcedUpdate(0); }
27 if (tr1->GetMotherIndex() == tr2->GetMotherIndex()) return ForcedUpdate(1);
28 return ForcedUpdate(0);
29 }
30
31 Bool_t SameMotherMcCut::Init(Int_t task_id) {
32 if (TwoTrackCut::Init() == kFALSE) return kFALSE;
33 const Event* ev = DataFormatManager::Instance()->GetFormat(task_id, EFormatDepth::kBuffered);
34 if (ev->InheritsFrom("Hal::McEvent")) {
35 return kTRUE;
36 } else {
37 return kFALSE;
38 }
39 }
40
41} /* namespace Hal */
Track * GetTrack1() const
Definition TwoTrack.h:75
Track * GetTrack2() const
Definition TwoTrack.h:80