71 if (width > 0.005 || width < 0.002)
78 if (S <
fSignal || B < 0. || B > 10000.)
110 isNeededTarget =
kTRUE;
119 if (!tmp.Contains(
Form(
"%d", iFile)))
132 cout <<
"nFiles# " << selectedFiles.size() << endl;
149 TString hName =
TString::Format(
"dca0 %G dca1 %G dca2 %G dca12 %G path %G nPos %d nNeg %d", dca0, dca1, dca2,
150 dca12, path, nPos, nNeg);
155 for (
auto it = selectedFiles.begin(); it != selectedFiles.end(); it++) {
166 pair<Double_t, Double_t> T = make_pair(-1., -1.);
167 pair<Double_t, Double_t> B = make_pair(-1., -1.);
169 if (
hSpectra[iCut]->GetEntries() < 250.)
172 if (iCut % 1000 == 0)
173 cout <<
"Fitting cut# " << iCut << endl;
185 const Int_t nCuts = 1;
188 map<Double_t, Int_t> Smap;
202 vector<Int_t> cutsToBeImproved;
204 for (
auto it = Smap.rbegin(); it != Smap.rend(); it++) {
206 if (distance(Smap.rbegin(), it) == nCuts)
214 cutsToBeImproved.push_back(it->second);
216 hSpectra[it->second]->SetTitle(
Form(
"S = %G, B = %G, S/B = %G", S, B, S / B));
221 for (
auto it : cutsToBeImproved) {
226 cout <<
"Improved dca12 = " << dca12Imp << endl;
231 cout <<
"Improved dca0 = " << dca0Imp << endl;
236 cout <<
"Improved dca1 = " << dca1Imp << endl;
241 cout <<
"Improved dca2 = " << dca2Imp << endl;
246 cout <<
"Improved path = " << path << endl;
261 }
else if (cutName.
Contains(
"path")) {
267 vector<TH1F*> spectraImproved;
281 for (
auto sign : signs)
282 for (
Int_t iStep = 1; iStep < nSteps + 1; iStep++) {
287 if (cutName ==
"dca0")
288 cutImp->
SetDca0(cutImp->
dca0() + sign * iStep * step);
289 else if (cutName ==
"dca1")
290 cutImp->
SetDca1(cutImp->
dca1() + sign * iStep * step);
291 else if (cutName ==
"dca2")
292 cutImp->
SetDca2(cutImp->
dca2() + sign * iStep * step);
293 else if (cutName ==
"dca12")
295 else if (cutName ==
"path")
296 cutImp->
SetPath(cutImp->
path() + sign * iStep * step);
298 Fatal(
"BmnMassSpectrumAnal::ImproveCutValue",
"No correct cut name given!");
313 dca2, dca12, path, nPos, nNeg);
317 for (
auto it1 = selectedFiles.begin(); it1 != selectedFiles.end(); it1++) {
326 pair<Double_t, Double_t> T = make_pair(-1., -1.);
327 pair<Double_t, Double_t> B = make_pair(-1., -1.);
340 Form(
"S = %G, B = %G, S/B = %G", T.first - B.first, B.first, (T.first - B.first) / B.first));
353 if (cutName ==
"dca0")
355 else if (cutName ==
"dca1")
357 else if (cutName ==
"dca2")
359 else if (cutName ==
"dca12")
361 else if (cutName ==
"path")
368 vector<BmnParticlePairCut> improved;
374 improved.push_back(*cut0);
385 for (
auto it1 = improved.begin(); it1 != improved.end(); it1++) {
393 if (dB_B0 > 0. || dB_B0 > dS_S0)
394 improved.erase(it1--);
398 if (!improved.size()) {
399 if (cutName ==
"dca0")
401 else if (cutName ==
"dca1")
403 else if (cutName ==
"dca2")
405 else if (cutName ==
"dca12")
407 else if (cutName ==
"path")
414 map<Double_t, Double_t> signalCut;
418 if (cutName ==
"dca0")
420 else if (cutName ==
"dca1")
422 else if (cutName ==
"dca2")
424 else if (cutName ==
"dca12")
426 else if (cutName ==
"path")
429 signalCut[it1.S()] = cVal;
432 auto it1 = signalCut.rbegin();
436 for (
TH1F* h : spectraImproved) {
437 if (!((
TString)h->GetName()).Contains(hNamePart.
Data()))
440 cout << h->GetName() << endl;
470 if (!particlePair || !header)
502 if (nVpTracks >= minMult && nVpTracks < maxMult) {
517 if (v0z < 0. || v0z > 50.)
547 if (DCA0 > dca0 || DCA12 > dca12)
550 if (DCA1 < dca1 || DCA2 < dca2 || PATH < path)
553 if (protonNGemHits <= nPos || pionNGemHits <= nNeg)
569 if (DCA0 > dca0 || DCA12 > dca12)
572 if (DCA1 < dca1 || DCA2 < dca2)
579 if (PATH < pathMin || PATH > pathMax)
583 if (protonNGemHits <= nPos || pionNGemHits <= nNeg)
600 vector<Double_t> kinVec1{protonMom, protonTx, protonTy};
604 vector<Double_t> kinVec2{pionMom, pionTx, pionTy};
609 GetPtY(kinVec1, kinVec2, pt, y);
625 cout <<
"File " << f <<
" processed# " << endl;
633 vector<Double_t> binErrorsAll;
634 vector<Double_t> binErrorsSignal;
670 pair<Double_t, Double_t>& T,
671 pair<Double_t, Double_t>& B)
675 vector<Double_t> binErrorsAll;
676 vector<Double_t> binErrorsSignal;
747 mean = res->Parameter(8);
774 Double_t x = (2.0 * xx[0] - fA - fB) / (fB - fA);
775 int order = fT.size();
779 return p[0] + x * p[1];
784 fT[
i + 1] = 2 * x * fT[
i] - fT[
i - 1];
787 for (
int i = 1;
i <= order; ++
i) {
797 Double_t arg = (xx[0] - p[1]) / p[2];
char * Form(const char *fmt,...)
TString GetTrigger(Int_t)
Int_t FinBin(map< Int_t, pair< Double_t, Double_t > > binMap, Double_t value)
vector< TString > createFilelist()
TClonesArray * fParticlePairCuts
static Double_t fitFunction(Double_t *, Double_t *)
Bool_t isVectorOk(vector< Double_t > vector)
Double_t ImproveCutValue(vector< TString >, BmnParticlePairCut *, TString)
map< Int_t, pair< Double_t, Double_t > > fPathBins
vector< TString > fInFiles
void ReadFile(TString, BmnParticlePairCut *cut0=nullptr, TClonesArray *triggEffInfo=nullptr, Double_t pathMin=0., Double_t pathMax=0.)
Bool_t checkFit(BmnParticlePairCut *)
TFitResultPtr fitSpectrum(TH1F *)
static Double_t signal(Double_t *, Double_t *)
vector< TString > fTarget
map< Int_t, pair< Double_t, Double_t > > fYBinMap
map< Int_t, pair< Double_t, Double_t > > fPtBinMap
static Double_t background(Double_t *, Double_t *)
void GetPtY(vector< Double_t >, vector< Double_t >, Double_t &, Double_t &)
void SetOrigin(TString orig)
void SetSignalAndBackground(Double_t sb)
void SetBackground(Double_t b)
void SetDca12(Double_t v)
void SetWidth(Double_t w)
Int_t GetNHitsPart1(TString det="")
Int_t GetNHitsPart2(TString det="")
double Parameter(unsigned int i) const
virtual void SetLineStyle(Style_t lstyle)
virtual void SetLineColor(Color_t lcolor)
Int_t SetBranchAddress(const char *bname, T **add, TBranch **ptr=nullptr)
virtual Int_t Add(const char *name, Long64_t nentries=TTree::kMaxEntries)
Long64_t GetEntries() const override
Int_t GetEntry(Long64_t entry=0, Int_t getall=0) override
virtual Double_t Integral(Double_t a, Double_t b, Double_t epsrel=1.e-12)
virtual void SetNpx(Int_t npx=100)
virtual Double_t Eval(Double_t x, Double_t y=0, Double_t z=0, Double_t t=0) const
virtual void SetParameter(const TString &name, Double_t value)
virtual Double_t GetBinCenter(Int_t bin) const
virtual Double_t GetBinError(Int_t bin) const
virtual TFitResultPtr Fit(const char *formula, Option_t *option="", Option_t *goption="", Double_t xmin=0, Double_t xmax=0)
virtual Int_t GetNbinsX() const
virtual void SetBinError(Int_t bin, Double_t error)
virtual Double_t GetBinContent(Int_t bin) const
virtual Double_t GetBinWidth(Int_t bin) const
const char * GetName() const override
Int_t GetEntriesFast() const
TObject * UncheckedAt(Int_t i) const
friend friend class TClonesArray
virtual void Fatal(const char *method, const char *msgfmt,...) const
Bool_t EndsWith(const char *pat, ECaseCompare cmp=kExact) const
const char * Data() const
static TString Format(const char *fmt,...)
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
virtual TList * GetListOfFiles() const
virtual Bool_t IsDirectory(const char *dir=nullptr) const
pair< Int_t, Int_t > multilplicity()
UniRun.h Class for the table: run_.
static UniRun * GetRun(int period_number, int run_number)
get run from the database
TString GetBeamParticle()
get beam particle of the current run
TString GetTargetParticle()
get target particle of the current run
*brief user defined string literal for JSON values *sa std::size_t n
Double_t Sqrt(Double_t x)