Heavy ion Analysis Libriares
Loading...
Searching...
No Matches
TrackTpcToFCut.cxx
1/*
2 * TrackTPCToFCut.cxx
3 *
4 * Created on: 28 maj 2018
5 * Author: Daniel Wielanek
6 * E-mail: daniel.wielanek@gmail.com
7 * Warsaw University of Technology, Faculty of Physics
8 */
9
10#include "TrackTpcToFCut.h"
11
12#include <TMath.h>
13#include <TString.h>
14
15#include "Cout.h"
16#include "Cut.h"
17#include "Std.h"
18#include "Package.h"
19#include "Parameter.h"
20#include "Track.h"
21
22namespace Hal {
23 TrackTpcToFCut::TrackTpcToFCut(TrackTpcCut* tpc, TrackToFMass2Cut* tof) : TrackExpCut(8) {
24 if (tof)
25 fToF = new TrackToFMass2Cut(*tof);
26 else
27 fToF = new TrackToFMass2Cut();
28 if (tpc)
29 fTpc = new TrackTpcCut(*tpc);
30 else
31 fTpc = new TrackTpcCut();
32 fThreshold = 0.5;
33 fTofOpt = kFALSE;
34 for (int i = 0; i < fTpc->GetCutSize(); i++) {
35 SetUnitName(fTpc->GetUnit(i), i);
36 }
37 SetUnitName(fToF->GetUnit(0), fTpc->GetCutSize());
38 for (int i = 0; i < 7; i++) {
39 SetMinMax(fTpc->GetMin(i), fTpc->GetMax(i), i);
40 }
41 SetMinMax(fToF->GetMin(0), fToF->GetMax(0), 7);
42 }
43
44 Bool_t TrackTpcToFCut::Init(Int_t format_id) {
45 if (fTpc->Init(format_id) == kFALSE) {
46 Cout::PrintInfo(Form("Cannot init %s becase TPC cut", ClassName()), EInfo::kWarning);
47 return kFALSE;
48 }
49 if (fToF->Init(format_id) == kFALSE) {
50 Cout::PrintInfo(Form("Cannot init %s because ToF cut", ClassName()), EInfo::kWarning);
51 return kFALSE;
52 }
53 for (int i = 0; i < 7; i++) {
54 SetMinMax(fTpc->GetMin(i), fTpc->GetMax(i), i);
55 }
56 SetMinMax(fToF->GetMin(0), fToF->GetMax(0), 7);
57 return kTRUE;
58 }
59
60 Bool_t TrackTpcToFCut::Pass(Track* tr) {
61 Double_t px = tr->GetPx();
62 Double_t py = tr->GetPy();
63 Double_t pz = tr->GetPz();
64 Double_t p = TMath::Sqrt(px * px + py * py + pz * pz);
65 Bool_t good = fTpc->Pass(tr);
66 Bool_t tof_ok = fToF->Pass(tr);
67 for (int i = 0; i < fTpc->GetCutSize(); i++) {
68 SetValue(fTpc->GetValue(i), i);
69 }
70 SetValue(fToF->GetValue(), 7);
71 if (p > fThreshold) {
72 if (tof_ok == kFALSE) good = kFALSE;
73 } else if (fTofOpt) {
74 Double_t m2 = fToF->GetValue(0);
75 if (m2 != 0.0 && m2 > -1) { // ToF data avaiable
76 if (tof_ok == kFALSE) good = kFALSE;
77 }
78 }
79 return ForcedUpdate(good);
80 }
81
82 Package* TrackTpcToFCut::Report() const {
83 Package* pack = TrackExpCut::Report();
84 Package* reportTpc = fTpc->Report();
85 TString active_sigma = ((ParameterString*) reportTpc->GetObjectByName("ActiveSigma"))->GetValue();
86 TString mode = ((ParameterString*) reportTpc->GetObjectByName("Mode"))->GetValue();
87 delete reportTpc;
88 pack->AddObject(new ParameterString("ActiveSigma", active_sigma));
89 pack->AddObject(new ParameterString("Mode", mode));
90 Double_t LowLine[3];
91 Double_t HighLine[3];
92 fToF->GetPolyDown(LowLine[0], LowLine[1], LowLine[2]);
93 fToF->GetPolyUp(HighLine[0], HighLine[1], HighLine[2]);
94 pack->AddObject(new ParameterDouble("ToF m^{2} a_{min} ", LowLine[0]));
95 pack->AddObject(new ParameterDouble("ToF m^{2} a_{max} ", HighLine[0]));
96 pack->AddObject(new ParameterDouble("ToF m^{2} b_{min} ", LowLine[1]));
97 pack->AddObject(new ParameterDouble("ToF m^{2} b_{max} ", HighLine[1]));
98 pack->AddObject(new ParameterDouble("ToF m^{2} c_{min}", LowLine[2]));
99 pack->AddObject(new ParameterDouble("ToF m^{2} c_{max} ", HighLine[2]));
100 pack->AddObject(new ParameterBool("ToF optional", fTofOpt));
101 pack->AddObject(new ParameterDouble("ToF threshold [GeV/c]", fThreshold));
102 return pack;
103 }
104
105 TrackTpcToFCut::TrackTpcToFCut(const TrackTpcToFCut& other) :
106 TrackExpCut(other), fThreshold(other.fThreshold), fTofOpt(other.fTofOpt) {
107 TString tof_class = other.fToF->ClassName();
108 if (tof_class == "Hal::TrackToFMass2Cut") {
109 fToF = new TrackToFMass2Cut(*other.fToF);
110 } else if (tof_class == "Hal::TrackTofMass2CutNoZeros") {
111 fToF = new TrackTofMass2CutNoZeros(*other.fToF);
112 }
113 fTpc = new TrackTpcCut(*other.fTpc);
114 }
115
116 TrackTpcToFCut::~TrackTpcToFCut() {
117 delete fTpc;
118 delete fToF;
119 }
120} // namespace Hal
TObject * GetObjectByName(TString name, Int_t index=0, Bool_t quited=kFALSE) const
Definition Package.cxx:67
Package * Report() const
Definition Package.cxx:129
void AddObject(TObject *object)
Definition Package.cxx:209
Double_t GetPz() const
Definition Track.h:109
Double_t GetPx() const
Definition Track.h:99
Double_t GetPy() const
Definition Track.h:104