BmnRoot 26.10.0-18-g4e3414f9
Software framework of the BM@N experiment
Loading...
Searching...
No Matches
BmnLambdaAnalRun7.h
Go to the documentation of this file.
1#ifndef BMNLAMBDAANALRUN7_H
2#define BMNLAMBDAANALRUN7_H 1
3
4#include "TObjString.h"
5
7#include <set>
8
9using namespace std;
10
11// Class to store signal (and its error, if necessary) for different samples of data and path bins
12
14{
15 public:
16 TString dSet; // MC or DATA
17
18 Int_t pathBin = -1; // path bin
19 Int_t ptBin = -1; // pt bin
20 Int_t yBin = -1; // y bin
21
24};
25
27{
28 public:
30
31 TriggerEfficiency(TString tr, pair<Int_t, Int_t> mult, pair<Double_t, Double_t> e)
32 {
33 trigg = tr;
34
35 minMult = mult.first;
36 maxMult = mult.second;
37
38 eff = e.first;
39 errEff = e.second;
40 }
41
42 virtual ~TriggerEfficiency() { ; }
43
44 TString trigger() { return trigg; }
45
46 pair<Int_t, Int_t> multilplicity() { return make_pair(minMult, maxMult); }
47
48 Double_t efficiency() { return eff; }
49
51
52 private:
54
57
60
62};
63
65{
66 public:
68 : fTrigEffs(new TClonesArray("TriggerEfficiency"))
69 {}
70
73 , fTrigEffs(nullptr)
74 {
75
76 fPtBinMap.clear();
77 fYBinMap.clear();
78
79 isMc = kFALSE;
80 }
81
82 // Constructor with two input dirs (data and MC)
83
84 BmnLambdaAnalRun7(TString dirMc, TString dirData, TString target = "")
85 : fTrigEffs(nullptr)
86 {
87
88 fPtBinMap.clear();
89 fYBinMap.clear();
90
91 isMc = kTRUE;
92
94 fMcList = mc->GetFileList();
95 delete mc;
96
97 BmnMassSpectrumAnal* data = new BmnMassSpectrumAnal(dirData);
98 data->SetTarget(target);
99 fDataList = data->createFilelist();
100 delete data;
101
102 hSpectrumImproved = nullptr;
103 }
104
106 {
107 if (fTrigEffs)
108 delete fTrigEffs;
109 }
110
111 void SetIsMc(Bool_t flag) { isMc = flag; }
112
113 // Cuts to be used for analysis ...
114
115 void SetCuts(TString target,
116 Double_t DCA0,
117 Double_t DCA1,
118 Double_t DCA2,
119 Double_t DCA12,
120 Double_t PATH = -1,
121 Int_t nHitsPos = 2,
122 Int_t nHitsNeg = 2)
123 {
124
126 pCut->SetDca0(DCA0);
127 pCut->SetDca1(DCA1);
128 pCut->SetDca2(DCA2);
129 pCut->SetDca12(DCA12);
130 pCut->SetPath(PATH);
131 pCut->SetNHitsGemPos(nHitsPos);
132 pCut->SetNHitsGemNeg(nHitsNeg);
133
134 fTargCutsMap[target] = pCut;
135 }
136
137 BmnParticlePairCut* GetCuts(TString target) const { return fTargCutsMap.find(target)->second; }
138
139 void SetPtBins(vector<pair<Double_t, Double_t>> bins)
140 {
141 fPtBinMap.clear();
142
143 nPtBins = bins.size();
144
145 for (size_t iBin = 0; iBin < bins.size(); iBin++)
146 fPtBinMap[iBin] = bins.at(iBin);
147 }
148
149 void SetYBins(vector<pair<Double_t, Double_t>> bins)
150 {
151 fYBinMap.clear();
152
153 nYBins = bins.size();
154
155 for (size_t iBin = 0; iBin < bins.size(); iBin++)
156 fYBinMap[iBin] = bins.at(iBin);
157 }
158
159 void SetPathBins(vector<pair<Double_t, Double_t>> bins)
160 {
161 fPathBins.clear();
162
163 nPathBins = bins.size();
164
165 for (size_t iBin = 0; iBin < bins.size(); iBin++)
166 fPathBins[iBin] = bins.at(iBin);
167 }
168
169 // Trigger efficiency ...
170
171 void SetTriggerEffData(TString trigger, TString data) { fTrigEffData[trigger] = data; }
172
173 // Getters ...
174
175 map<TString, BmnParticlePairCut*> GetTargetCutsMap() { return fTargCutsMap; }
176
177 // For specific use outside the class if needed ...
179
180 map<Int_t, pair<Double_t, Double_t>> GetSignalPtBinMap() { return fSdeltaS_PtBinMap; }
181
182 map<Int_t, pair<Double_t, Double_t>> GetSignalYBinMap() { return fSdeltaS_YBinMap; }
183
184 void doAllTargetsAnal();
185 void doTargetAnal(TString target);
186 void doTargetAnal(vector<TString> targets);
187
188 private:
190 set<TString>&,
191 set<TString>&); // Checking whether the established cuts are the same for all targets ...
192 void DrawH(TH1F*, Double_t, Double_t, pair<Double_t, Double_t>, pair<Double_t, Double_t>, Int_t si = 1);
193
194 void doTargetAnal(); // For internal use in the class ...
195 void doTargetAnalPath();
196
197 public:
198 void ReadData()
199 {
200 fTrigEffs = new TClonesArray("TriggerEfficiency");
201
202 for (auto trigger : fTrigEffData) {
203 TString trig = trigger.first;
204 TString data = trigger.second;
205
206 TFile* f = new TFile(data.Data());
207 TH1F* h = (TH1F*)f->Get("Eff");
208
209 if (!h)
210 continue;
211
212 for (Int_t iBin = 1; iBin < h->GetNbinsX() + 1; iBin++) {
213 vector<Int_t> mults;
214 vector<Double_t> effs;
215
216 effs.push_back(h->GetBinContent(iBin));
217 effs.push_back(h->GetBinError(iBin));
218
219 TString label = (TString)h->GetXaxis()->GetBinLabel(iBin);
220 label.ReplaceAll(")", "").ReplaceAll("[", "").ReplaceAll(",", "");
221
222 TObjArray* tx = label.Tokenize(" ");
223
224 for (Int_t i = 0; i < tx->GetEntries(); i++)
225 mults.push_back(((TObjString*)(tx->At(i)))->String().Atoi());
226
227 new ((*fTrigEffs)[fTrigEffs->GetEntriesFast()])
228 TriggerEfficiency(trig, make_pair(mults.at(0), mults.at(1)), make_pair(effs.at(0), effs.at(1)));
229 }
230 }
231 }
232
233 private:
235 map<TString, TString> fTrigEffData;
236
237 // Maps with output S and deltaS for all bins over Pt and Y ...
238 map<Int_t, pair<Double_t, Double_t>> fSdeltaS_PtBinMap;
239 map<Int_t, pair<Double_t, Double_t>> fSdeltaS_YBinMap;
240
241 vector<TString> fMcList;
242 vector<TString> fDataList;
243
244 protected:
245 map<TString, BmnParticlePairCut*> fTargCutsMap;
246
248};
249
250#endif
int i
Definition P4_F32vec4.h:22
bool Bool_t
int Int_t
constexpr Bool_t kFALSE
double Double_t
constexpr Bool_t kTRUE
#define ClassDef(name, id)
map< Int_t, pair< Double_t, Double_t > > fSdeltaS_PtBinMap
map< TString, BmnParticlePairCut * > GetTargetCutsMap()
void SetTriggerEffData(TString trigger, TString data)
void SetIsMc(Bool_t flag)
map< TString, BmnParticlePairCut * > fTargCutsMap
void DrawH(TH1F *, Double_t, Double_t, pair< Double_t, Double_t >, pair< Double_t, Double_t >, Int_t si=1)
vector< TString > fMcList
map< Int_t, pair< Double_t, Double_t > > GetSignalYBinMap()
void SetPathBins(vector< pair< Double_t, Double_t > > bins)
BmnLambdaAnalRun7(TString dirMc, TString dirData, TString target="")
map< Int_t, pair< Double_t, Double_t > > fSdeltaS_YBinMap
BmnLambdaAnalRun7(TString dir)
vector< TString > fDataList
map< TString, TString > fTrigEffData
void SetCuts(TString target, Double_t DCA0, Double_t DCA1, Double_t DCA2, Double_t DCA12, Double_t PATH=-1, Int_t nHitsPos=2, Int_t nHitsNeg=2)
map< Int_t, pair< Double_t, Double_t > > GetSignalPtBinMap()
void SetPtBins(vector< pair< Double_t, Double_t > > bins)
TClonesArray * GetFilledArray()
void targetListsByCutsEstablished(set< TString > &, set< TString > &)
TClonesArray * fTrigEffs
BmnParticlePairCut * GetCuts(TString target) const
void SetYBins(vector< pair< Double_t, Double_t > > bins)
vector< TString > createFilelist()
map< Int_t, pair< Double_t, Double_t > > fPathBins
void SetTarget(TString t)
map< Int_t, pair< Double_t, Double_t > > fYBinMap
map< Int_t, pair< Double_t, Double_t > > fPtBinMap
vector< TString > GetFileList()
void SetNHitsGemNeg(Int_t nHits)
void SetNHitsGemPos(Int_t nHits)
void SetDca1(Double_t v)
void SetDca0(Double_t v)
void SetPath(Double_t v)
void SetDca12(Double_t v)
void SetDca2(Double_t v)
const char * GetBinLabel(Int_t bin) const
virtual Double_t GetBinError(Int_t bin) const
TAxis * GetXaxis()
virtual Int_t GetNbinsX() const
virtual Double_t GetBinContent(Int_t bin) const
Int_t GetEntries() const override
TObject * At(Int_t idx) const override
friend friend class TClonesArray
const char * Data() const
TObjArray * Tokenize(const TString &delim) const
TString & ReplaceAll(const char *s1, const char *s2)
TriggerEfficiency(TString tr, pair< Int_t, Int_t > mult, pair< Double_t, Double_t > e)
pair< Int_t, Int_t > multilplicity()
Definition json.hpp:4446