10#include "TrackTpcCut.h"
17#include "DataFormat.h"
26 const Int_t TrackTpcCut::fgTpcHitsId = 0;
27 const Int_t TrackTpcCut::fgChargeId = 1;
28 const Int_t TrackTpcCut::fgSigmaPionId = 2;
29 const Int_t TrackTpcCut::fgSigmaKaonId = 3;
30 const Int_t TrackTpcCut::fgSigmaProtonId = 4;
31 const Int_t TrackTpcCut::fgSigmaElectronId = 5;
32 const Int_t TrackTpcCut::fgDeDxId = 6;
34 TrackTpcCut::TrackTpcCut() : TrackExpCut(7) {
35 SetUnitName(
"TpcHits [N]", TpcHits());
36 SetUnitName(
"TpcCharge [q]", Charge());
37 SetUnitName(
"#sigma#pi", PionSigma());
38 SetUnitName(
"#sigmaK", KaonSigma());
39 SetUnitName(
"#sigmaP", ProtonSigma());
40 SetUnitName(
"#sigmae", ElectronSigma());
41 SetUnitName(
"dEdX [kV/cm]", DeDx());
42 fParticleType = PionSigma();
43 SetMinMax(-1E+29, 1E+29, PionSigma());
44 SetMinMax(-1E+29, 1E+29, KaonSigma());
45 SetMinMax(-1E+29, 1E+29, ProtonSigma());
46 SetMinMax(-1E+29, 1E+29, ElectronSigma());
47 SetMinMax(0, 1E+29, DeDx());
48 SetMinMax(-1, 1, Charge());
49 SetMinMax(0, 90, TpcHits());
53 Bool_t TrackTpcCut::Init(Int_t task_id) {
54 Bool_t stat = TrackExpCut::Init(task_id);
55 if (stat == kFALSE)
return kFALSE;
56 if (TpcAvaiable(task_id))
return kTRUE;
60 void TrackTpcCut::SetSigma(Double_t min, Double_t max, TString opt) {
61 if (Hal::Std::FindParam(opt,
"pi")) {
62 SetMinMax(min, max, PionSigma());
63 }
else if (Hal::Std::FindParam(opt,
"K")) {
64 SetMinMax(min, max, KaonSigma());
65 }
else if (Hal::Std::FindParam(opt,
"p")) {
66 SetMinMax(min, max, ProtonSigma());
67 }
else if (Hal::Std::FindParam(opt,
"e")) {
68 SetMinMax(min, max, ElectronSigma());
70 Cout::Text(
"Wrong SetSigma flag please use pi/K/p/e",
"L", kOrange);
74 void TrackTpcCut::SetCharge(Int_t i) { SetMinAndMax(i, Charge()); }
76 void TrackTpcCut::SetNHits(Int_t min, Int_t max) { SetMinMax(min, max, TpcHits()); }
79 Package* pack = TrackCut::Report();
81 switch (fParticleType) {
82 case fgSigmaPionId: sigma_name =
"PionSigma";
break;
83 case fgSigmaKaonId: sigma_name =
"KaonSigma";
break;
84 case fgSigmaProtonId: sigma_name =
"ProtonSigma";
break;
85 case fgSigmaElectronId: sigma_name =
"ElectronSigma";
break;
86 default: sigma_name =
"UnknownSigma";
break;
103 void TrackTpcCut::SetDeDx(Double_t min, Double_t max) { SetMinMax(min, max, DeDx()); }
105 TrackTpcCut::~TrackTpcCut() {}
107 Bool_t TrackTpcCut::Pass(
Track* track) {
109 if (tpc == NULL)
return ForcedUpdate(kFALSE);
110 SetValue(track->
GetCharge(), fgChargeId);
111 SetValue(tpc->
GetDeDx(), fgDeDxId);
112 SetValue(tpc->
GetNHits(), fgTpcHitsId);
117 return ForcedUpdate(Verify());
120 Bool_t TrackTpcCut::Verify() {
123 for (
int i = fgSigmaPionId; i < fgSigmaPionId + 4; i++) {
124 if (i == fParticleType) {
125 if (GetValue(i) < GetMin(i))
return kFALSE;
126 if (GetValue(i) > GetMax(i))
return kFALSE;
129 if (GetValue(i) > GetMin(i) && GetValue(i) < GetMax(i))
return kFALSE;
135 if (GetValue(fParticleType) < GetMin(fParticleType))
return kFALSE;
136 if (GetValue(fParticleType) > GetMax(fParticleType))
return kFALSE;
140 if (GetValue(fgDeDxId) < GetMin(fgDeDxId))
return kFALSE;
141 if (GetValue(fgDeDxId) > GetMax(fgDeDxId))
return kFALSE;
143 if (GetValue(fgTpcHitsId) < GetMin(fgTpcHitsId))
return kFALSE;
144 if (GetValue(fgTpcHitsId) > GetMax(fgTpcHitsId))
return kFALSE;
146 if (GetValue(fgChargeId) < GetMin(fgChargeId))
return kFALSE;
147 if (GetValue(fgChargeId) > GetMax(fgChargeId))
return kFALSE;
151 TrackTpcCut::TrackTpcCut(
const TrackTpcCut& other) :
152 TrackExpCut(other), fParticleType(other.fParticleType), fMode(other.fMode) {}
155 if (Hal::Std::FindParam(flag,
"pi")) {
157 }
else if (Hal::Std::FindParam(flag,
"K")) {
159 }
else if (Hal::Std::FindParam(flag,
"p")) {
161 }
else if (Hal::Std::FindParam(flag,
"e")) {
164 Cout::Text(
"Wrong SetActiveSigma flag please use pi/K/p/e",
"L", kOrange);
static void Text(TString text, TString option="L", Color_t color=-1)
void AddObject(TObject *object)
Float_t GetSigmaPion() const
Float_t GetSigmaProton() const
Float_t GetSigmaKaon() const
Float_t GetSigmaElectron() const
void SetActiveSigma(TString flag)
static Int_t ProtonSigma()
static Int_t ElectronSigma()
Double_t GetCharge() const