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