Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 29 additions & 1 deletion offline/packages/mbd/MbdCalib.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2497,7 +2497,7 @@ void MbdCalib::Reset_Pileup()
_pileup_p0err.fill(std::numeric_limits<float>::quiet_NaN());
_pileup_p1err.fill(std::numeric_limits<float>::quiet_NaN());
_pileup_p2err.fill(std::numeric_limits<float>::quiet_NaN());
_qfit_chi2ndf.fill(std::numeric_limits<float>::quiet_NaN());
_pileup_chi2ndf.fill(std::numeric_limits<float>::quiet_NaN());
}

void MbdCalib::Reset_Thresholds()
Expand Down Expand Up @@ -2590,3 +2590,31 @@ TGraph *MbdCalib::get_lut_graph(const int pmtch, std::string_view type)
return g;
}


void MbdCalib::set_pileup(const int ifeech, const int ipar, const float pval)
{
int chtype = (ifeech / 8) % 2; // 0=T-ch, 1=Q-ch

if (ipar==0)
{
_pileup_p0[ifeech] = pval;
}
else if (ipar==1)
{
_pileup_p1[ifeech] = pval;
}
else if (ipar==2)
{
_pileup_p2[ifeech] = pval;
}
else if (ipar==3 && chtype==0)
{
_pileup_p1err[ifeech] = pval;
}
else if (ipar==4 && chtype==0)
{
_pileup_p2err[ifeech] = pval;
}
}


49 changes: 31 additions & 18 deletions offline/packages/mbd/MbdCalib.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,36 @@ class MbdCalib
float get_pedrms(const int ifeech) const { return _pedsigma[ifeech]; }
int get_sampmax(const int ifeech) const { return _sampmax[ifeech]; }
int get_status(const int ifeech) const { return _mbdstatus[ifeech]; }

float get_pileup(const int ifeech, const int ipar) const
{
int chtype = (ifeech / 8) % 2; // 0=T-ch, 1=Q-ch

if (ipar==0)
{
return _pileup_p0[ifeech];
}
else if (ipar==1)
{
return _pileup_p1[ifeech];
}
else if (ipar==2)
{
return _pileup_p2[ifeech];
}
else if (ipar==3 && chtype==0)
{
return _pileup_p1err[ifeech];
}
else if (ipar==4 && chtype==0)
{
return _pileup_p2err[ifeech];
}

return std::numeric_limits<float>::quiet_NaN();
}


float get_tcorr(const int ifeech, const int tdc) const {
if (tdc<0)
{
Expand Down Expand Up @@ -86,31 +116,14 @@ class MbdCalib
std::vector<float> get_shape(const int ifeech) const { return _shape_y[ifeech]; }
std::vector<float> get_sherr(const int ifeech) const { return _sherr_yerr[ifeech]; }

float get_pileup(const int ifeech, const int ipar) const {

if (ipar==0)
{
return _pileup_p0[ifeech];
}
else if (ipar==1)
{
return _pileup_p1[ifeech];
}
else if (ipar==2)
{
return _pileup_p2[ifeech];
}

return std::numeric_limits<float>::quiet_NaN();
}

float get_threshold(const int pmtch, const int rel_or_abs = 0);

TGraph *get_lut_graph(const int pmtch, std::string_view type);

void set_sampmax(const int ifeech, const int val) { _sampmax[ifeech] = val; }
void set_status(const int ifeech, const int val) { _mbdstatus[ifeech] = val; }
void set_ped(const int ifeech, const float m, const float merr, const float s, const float serr);
void set_pileup(const int ifeech, const int ipar, const float val);
void set_tt0(const int ipmt, const float t0) { _ttfit_t0mean[ipmt] = t0; }
void set_tq0(const int ipmt, const float t0) { _tqfit_t0mean[ipmt] = t0; }

Expand Down
10 changes: 1 addition & 9 deletions offline/packages/mbd/MbdEvent.cc
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,7 @@ int MbdEvent::End()

for (auto & sig : _mbdsig)
{
sig.WritePedvsEvent();
sig.WriteChi2Hist();
}

Expand Down Expand Up @@ -1127,11 +1128,6 @@ int MbdEvent::Calculate(MbdPmtContainer *bbcpmts, MbdOut *bbcout, PHCompositeNod
gausfit[iarm]->SetRange(hevt_bbct[iarm]->GetMean() - 5, hevt_bbct[iarm]->GetMean() + 5);
*/

if ( hevt_bbct[iarm]->GetEntries()==0 )//chiu
{
std::cout << PHWHERE << " hevt_bbct EMPTY" << std::endl;
}

hevt_bbct[iarm]->Fit(gausfit[iarm], "BNQLR");

// m_bbct[iarm] = m_bbct[iarm] / m_bbcn[iarm];
Expand Down Expand Up @@ -1462,10 +1458,6 @@ int MbdEvent::CalcPedCalib()

pedgaus->SetParameters(ampl,mean,sigma);
pedgaus->SetRange(mean-(4*sigma), mean+(4*sigma));
if ( hped0->GetEntries()==0 ) //chiu
{
std::cout << "HPED0 EMPTY" << std::endl;
}
hped0->Fit(pedgaus,"RNQ");

mean = pedgaus->GetParameter(1);
Expand Down
Loading