4#include "BmnTrigDigit.h"
5#include "BmnTrigWaveDigit.h"
61 LOGF(error,
"Cannot open file %s", dstFileName.
Data());
67 LOGF(error,
"Cannot find tree bmndata in the file");
73 if ((ret < 0) || (ret > 2)) {
74 LOGF(error,
"Cannot match branch BmnTrigInfo.");
79 if ((ret < 0) || (ret > 2)) {
80 LOGF(error,
"Cannot match branch MpdVertex.");
85 if ((ret < 0) || (ret > 2)) {
86 LOGF(error,
"Cannot match branch BmnTof400Hit");
91 if ((ret < 0) || (ret > 2)) {
92 LOGF(error,
"Cannot match branch BmnTof700Hit");
100 LOGF(error,
"Dst file name must contain \"mpd_run_Top_<RunId>\"");
106 LOGF(info,
"runId = %d",
fRunId);
112 LOGF(info,
"File %s successfully opened", dstFileName.
Data());
142 LOGF(info,
"runId = %d",
fRunId);
151 LOGF(debug,
"BmnTriggerEfficiencyRun8::GetBDEfficiency(): Start");
157 LOGF(debug,
"BmnTriggerEfficiencyRun8::GetFDEfficiency(): Start");
163 LOGF(debug,
"BmnTriggerEfficiencyRun8::GetTriggerEfficiency(): Start");
179 statErr = systErr = errSystErr = -1.;
184 else if (eff == 0.) {
185 statErr = systErr = errSystErr = 0.;
193 statErr = eff *
sqrt(relStatErrBD * relStatErrBD + relStatErrFD * relStatErrFD);
208 LOGF(debug,
"Primary Vertex branch should be defined");
221 LOGF(error,
"This BmnTriggerEfficiencyRun8 object is not valid");
226 LOGF(debug,
"BmnTriggerEfficiencyRun8::GetFluxRejectionFactorWithError(): bin = %d", bin);
227 Int_t binx, biny, binz;
228 fHFrf->GetBinXYZ(bin, binx, biny, binz);
229 LOGF(debug,
"BmnTriggerEfficiencyRun8::GetFluxRejectionFactorWithError(): binx = %d, biny = %d, binz = %d", binx,
232 if ((binx < 1) || (binx >
fHFrf->GetNbinsX())) {
233 LOGF(error,
"Run id is out of analysis range");
237 factor =
fHFrf->GetBinContent(bin);
241 err =
fHFrf->GetBinError(bin);
260 LOGF(debug,
"(pvx,pvy,pvz,pvntr) = (%f,%f,%f,%d)", pvx, pvy, pvz, pvntr);
263 vtxPos.
SetXYZ(0.3179, 0., -0.0169);
264 if ((
abs(pvz - vtxPos.
Z()) > 1.) || (
pow(pvx - vtxPos.
X(), 2) +
pow(pvy - vtxPos.
Y(), 2) >
pow(1.5, 2))
267 LOGF(debug,
"Event primary vertex does not pass analysis conditions");
272 if ((pv_chi2tondf < 0.1) || (pv_chi2tondf > 10)) {
273 LOGF(debug,
"Event primary vertex does not pass analysis conditions");
280 LOGF(debug,
"This event does not pass BC2 analysis conditions for pile up");
285 Int_t threshold = 10;
289 if (isPileupTof400 || isPileupTof700) {
290 LOGF(debug,
"This event does not pass ToF analysis conditions for pile up");
294 auto TrigPattern =
fBTrigInfo->GetInputSignalsAR();
295 auto bitCCT2 = (TrigPattern >> 7) & 1;
297 LOGF(debug,
"This event does not pass trigger conditions");
306 if ((evId >=
fDstTree->GetEntries()) || (evId < 0)) {
307 LOGF(debug,
"Event id is out of range for this file");
319 LOGF(error,
"Number of tracks in PV is out of analysis range");
323 LOGF(error,
"This BmnTriggerEfficiencyRun8 object is not valid");
328 LOGF(debug,
"BmnTriggerEfficiencyRun8::GetEfficiencyOrError(): bin = %d", bin);
329 Int_t binx, biny, binz;
331 LOGF(debug,
"BmnTriggerEfficiencyRun8::GetEfficiencyOrError(): binx = %d, biny = %d, binz = %d", binx, biny, binz);
333 if ((binx < 1) || (binx > hist->
GetNbinsX())) {
334 LOGF(error,
"Run id is out of analysis range");
359 TString fileName1 =
TString(getenv(
"VMCWORKDIR")) +
TString(
"/parameters/triggerefficiency/EffBdFd_Run8_v3.root");
362 LOGF(error,
"Cannot open file %s", fileName1.
Data());
369 LOGF(error,
"Cannot find histogram hbd in the file");
375 LOGF(error,
"Cannot find histogram hfd in the file");
380 LOGF(info,
"File %s successfully opened", fileName1.
Data());
382 TString fileName2 =
TString(getenv(
"VMCWORKDIR")) +
TString(
"/parameters/triggerefficiency/EffCctSyst_Run8.root");
385 LOGF(error,
"Cannot open file %s", fileName2.
Data());
392 LOGF(error,
"Cannot find histogram herr in the file");
397 LOGF(info,
"File %s successfully opened", fileName2.
Data());
402 TString(getenv(
"VMCWORKDIR")) +
TString(
"/parameters/triggerefficiency/FluxRejectionFactor_Run8_v2.root");
405 LOGF(error,
"Cannot open file %s", fileName3.
Data());
412 LOGF(error,
"Cannot find histogram hfrc_bt in the file");
417 LOGF(info,
"File %s successfully opened", fileName3.
Data());
426 else if (runId < 7984)
428 else if (runId < 8005)
430 else if (runId < 8011)
432 else if (runId < 8030)
434 else if (runId < 8060)
447 else if (runId < 7114)
449 else if (runId < 7237)
451 else if (runId < 7560)
453 else if (runId < 7594)
464 else if (runId < 7114)
466 else if (runId < 7148)
468 else if (runId < 7237)
470 else if (runId < 7258)
472 else if (runId < 7429)
474 else if (runId < 7486)
476 else if (runId < 7560)
478 else if (runId < 7594)
491 LOGF(error,
"Unexpected behaviour. bc2Digits->GetEntriesFast() = %d", bc2Digits->
GetEntriesFast());
495 for (
Int_t i = leftEl;
i <= rightEl; ++
i) {
513 if ((bdDigit->
GetMod() < 0) || (bdDigit->
GetMod() > 39)) {
514 LOGF(error,
"Unexpected BD module number %d", bdDigit->
GetMod());
541 Int_t peak = -100000;
544 for (
Int_t i = start;
i <= stop; ++
i)
558 Int_t bins[34] = {0};
567 if (t >= -1766.0 && t <= -66.0) {
569 if (bin >= 0 && bin < 34) {
571 if (bins[bin] > maxBin)
class for TQDC data including waveform can be initialized both from an std::vector and raw pointer to...
vector< int16_t > & GetValue()
void SetFDTrigWindowLeftEdgeByRun(Int_t runId)
Int_t GetBC2Int(Int_t leftEl, Int_t rightEl)
void SetBC2IntCutByRun(Int_t runId)
TClonesArray * fBTof400Hit
BmnTriggerEfficiencyRun8()
void SetFDPeakLimitByRun(Int_t runId)
Double_t GetFDEfficiency(Int_t runId, Int_t ntrPV)
Double_t GetEfficiencyOrError(TH2D *hist, Int_t runId, Int_t ntrPV, Bool_t isEff)
void InitEfficiencyInput()
Int_t fFDTrigWindowLeftEdge
Int_t GetMaxTofHitsInBin(TClonesArray *hits)
Double_t GetTriggerEfficiency(Int_t runId, Int_t ntrPV)
Bool_t GetFluxRejectionFactorWithError(Int_t runId, Double_t &factor, Double_t &err)
Bool_t GetTriggerEfficiencyWithErrors(Int_t runId, Int_t ntrPV, Double_t &eff, Double_t &statErr, Double_t &systErr, Double_t &errSystErr)
CbmVertex * fBPrimaryVertex
TClonesArray * fBTof700Hit
Double_t GetBDEfficiency(Int_t runId, Int_t ntrPV)
Bool_t IsEventAnalysable()
BmnTrigInfoDst * fBTrigInfo
Bool_t HasDistantPileup(TClonesArray *hits, Int_t threshold)
static TFile * Open(const char *name, Option_t *option="", const char *ftitle="", Int_t compress=ROOT::RCompressionSetting::EDefaults::kUseCompiledDefault, Int_t netopt=0)
virtual Int_t GetNbinsY() const
virtual Double_t GetBinError(Int_t bin) const
virtual void GetBinXYZ(Int_t binglobal, Int_t &binx, Int_t &biny, Int_t &binz) const
virtual Int_t GetNbinsX() const
virtual Int_t FindBin(Double_t x, Double_t y=0, Double_t z=0)
virtual Double_t GetBinContent(Int_t bin) const
Int_t GetEntriesFast() const
TObject * At(Int_t idx) const override
TObject * UncheckedAt(Int_t i) const
friend friend class TClonesArray
const char * Data() const
virtual Int_t Sizeof() const
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
void SetXYZ(Double_t x, Double_t y, Double_t z)
RVec< PromoteType< T > > abs(const RVec< T > &v)
RVec< PromoteTypes< T0, T1 > > pow(const RVec< T0 > &v, const T1 &y)
RVec< PromoteType< T > > sqrt(const RVec< T > &v)