Heavy ion Analysis Libriares
Loading...
Searching...
No Matches
V0BasicFinder.cxx
1/*
2 * V0BasicFinder.cxx
3 *
4 * Created on: 27 lut 2018
5 * Author: Daniel Wielanek
6 * E-mail: daniel.wielanek@gmail.com
7 * Warsaw University of Technology, Faculty of Physics
8 */
9
10#include "V0BasicFinder.h"
11
12#include <RtypesCore.h>
13#include <TClonesArray.h>
14#include <TDatabasePDG.h>
15#include <TObjArray.h>
16#include <TParticlePDG.h>
17#include <TString.h>
18
19#include "Cout.h"
20#include "CutContainer.h"
21#include "CutMonitor.h"
22#include "DataManager.h"
23#include "MemoryMapManager.h"
24#include "Package.h"
25#include "Parameter.h"
26#include "TrackCut.h"
27#include "TwoTrack.h"
28#include "TwoTrackCut.h"
29#include "V0Candidate.h"
30#include "V0Track.h"
31
32#include <iostream>
33
34namespace Hal {
35 V0BasicFinder::V0BasicFinder() :
36 TrackAna(ECutUpdate::kTwoTrack),
37 fPosPdg(2212),
38 fNegPdg(-211),
39 fV0Pdg(3312),
40 fPosMass(0),
41 fNegMass(0),
42 fV0Mass(0),
43 fFirstV0Finder(kTRUE),
44 fWrite(kFALSE),
45 fV0Candiate(nullptr),
46 fV0Tracks(nullptr) {}
47
48 Task::EInitFlag V0BasicFinder::Init() {
49 DataManager* mngr = DataManager::Instance();
50 if (mngr->CheckBranch("V0Tracks") != 0) {
51 fFirstV0Finder = kFALSE;
52 fV0Tracks = (TClonesArray*) mngr->GetObject("V0Tracks");
53 } else {
54 fV0Tracks = new TClonesArray("Hal::V0Track");
55 mngr->Register("V0Tracks", "V0", fV0Tracks, fWrite);
56 }
57
58 Task::EInitFlag stat = TrackAna::Init();
59 if (fV0Candiate == nullptr) {
60 Cout::PrintInfo("No VO candidate class!", EInfo::kError);
61 return Task::EInitFlag::kFATAL;
62 }
63 TDatabasePDG* db = TDatabasePDG::Instance();
64 TParticlePDG* particle = db->GetParticle(fV0Pdg);
65 if (particle == nullptr) return Task::EInitFlag::kFATAL;
66 fV0Mass = particle->Mass();
67 particle = db->GetParticle(fPosPdg);
68 if (particle == nullptr) return Task::EInitFlag::kFATAL;
69 fPosMass = particle->Mass();
70 particle = db->GetParticle(fNegPdg);
71 if (particle == nullptr) return Task::EInitFlag::kFATAL;
72 fNegMass = particle->Mass();
73 return stat;
74 }
75
76 Package* V0BasicFinder::Report() const {
77 Package* pack = TrackAna::Report();
78 pack->AddObject(new ParameterInt("Pos_dau PDG", fPosPdg));
79 pack->AddObject(new ParameterInt("Neg dau PDG", fNegPdg));
80 pack->AddObject(new ParameterInt("V_{0} PDG", fV0Pdg));
81 return pack;
82 }
83
84 void V0BasicFinder::ProcessEvent() {
85 TrackAna::ProcessEvent();
86 for (int i = 0; i < fMemoryMap->GetTracksNo(fCurrentEventCollectionID, 0); i++) {
87 fV0Candiate->AddFirstTrack(fMemoryMap->GetTemporaryTrack(fCurrentEventCollectionID, 0, i));
88 for (int j = 0; j < fMemoryMap->GetTracksNo(fCurrentEventCollectionID, 1); j++) {
89 fV0Candiate->AddSecondTrack(fMemoryMap->GetTemporaryTrack(fCurrentEventCollectionID, 1, j));
90 fV0Candiate->MakeV0(fPosMass, fNegMass, fV0Pdg, fPosPdg, fNegPdg);
91 // if(TMath::Abs(fV0Candiate->GetV0Track().GetMom().M()-1.115)<0.05)
92 if (fCutContainer->PassSignalPair(fV0Candiate, 0)) {
93 V0Track* v0 = (V0Track*) fV0Tracks->ConstructedAt(fV0Tracks->GetEntriesFast());
94 *v0 = fV0Candiate->GetV0Track();
95 }
96 }
97 }
98 }
99
100 void V0BasicFinder::Exec(Option_t* option) {
101 if (fFirstV0Finder) fV0Tracks->Clear();
102 TrackAna::Exec(option);
103 }
104
105 V0BasicFinder::~V0BasicFinder() {}
106
107 void V0BasicFinder::AddNegDauCut(const TrackCut& dau_neg, Option_t* opt) {
108 TString option = opt;
109 TString optz = "";
110 if (Hal::Std::FindParam(option, "fast")) { optz = "fast"; }
111 if (Hal::Std::FindParam(option, "re")) { optz = optz + "+re"; }
112 if (Hal::Std::FindParam(option, "im")) { optz = optz + "+im"; }
113 TrackAna::AddCut(dau_neg, optz + "{1}");
114 }
115
116 void V0BasicFinder::AddPosDauCut(const TrackCut& pos_cut, Option_t* opt) {
117 TString option = opt;
118 TString optz = "";
119 if (Hal::Std::FindParam(option, "fast")) { optz = "fast"; }
120 if (Hal::Std::FindParam(option, "re")) { optz = optz + "+re"; }
121 if (Hal::Std::FindParam(option, "im")) { optz = optz + "+im"; }
122 TrackAna::AddCut(pos_cut, optz + "{0}");
123 }
124
125 void V0BasicFinder::AddCandicateCut(const TwoTrackCut& obj, Option_t* opt) { TrackAna::AddCut(obj, opt); }
126
127 void V0BasicFinder::AddCandicateCutMon(const CutMonitor& mon, Option_t* opt) { TrackAna::AddCutMonitor(mon, opt); }
128
129 void V0BasicFinder::SetPDG(Int_t dau1, Int_t dau2, Int_t v0) {
130 fPosPdg = dau1;
131 fNegPdg = dau2;
132 fV0Pdg = v0;
133 }
134
135 void V0BasicFinder::SetV0Container(const V0Candidate& vo) { fV0Candiate = (V0Candidate*) vo.Clone("v0 candidate"); }
136
137 void V0BasicFinder::AddNegDauCutMon(const CutMonitor& mon, Option_t* /*opt*/) { TrackAna::AddCutMonitor(mon, "{1}"); }
138
139 void V0BasicFinder::AddPosDauCutMon(const CutMonitor& mon, Option_t* /*opt*/) { TrackAna::AddCutMonitor(mon, "{0}"); }
140
141 void V0BasicFinder::LinkCollections() {
142 Int_t eventTrig = fCutContainer->GetEventCollectionsNo();
143 for (int iEv = 0; iEv < eventTrig; iEv++) {
144 fCutContainer->LinkCollections(ECutUpdate::kEvent, iEv, ECutUpdate::kTrack, 0);
145 fCutContainer->LinkCollections(ECutUpdate::kEvent, iEv, ECutUpdate::kTrack, 1);
146 fCutContainer->LinkCollections(ECutUpdate::kTrack, 0, ECutUpdate::kTwoTrack, 0);
147 fCutContainer->LinkCollections(ECutUpdate::kTrack, 1, ECutUpdate::kTwoTrack, 0);
148 }
149 }
150} // namespace Hal
void Register(const char *name, const char *folderName, TNamed *obj, Bool_t toFile)
Bool_t CheckBranch(const char *BrName)
void AddObject(TObject *object)
Definition Package.cxx:209