CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
ESRecHitFitAlgo Class Reference

#include <ESRecHitFitAlgo.h>

Public Member Functions

 ESRecHitFitAlgo ()
 
double * EvalAmplitude (const ESDataFrame &digi, double ped) const
 
EcalRecHit reconstruct (const ESDataFrame &digi) const
 
void setAngleCorrectionFactors (const ESAngleCorrectionFactors *ang)
 
void setChannelStatus (const ESChannelStatus *status)
 
void setESGain (const double &value)
 
void setIntercalibConstants (const ESIntercalibConstants *mips)
 
void setMIPGeV (const double &value)
 
void setPedestals (const ESPedestals *peds)
 
void setRatioCuts (const ESRecHitRatioCuts *ratioCuts)
 
 ~ESRecHitFitAlgo ()
 

Private Attributes

const ESAngleCorrectionFactorsang_
 
const ESChannelStatuschannelStatus_
 
TF1 * fit_
 
double gain_
 
double MIPGeV_
 
const ESIntercalibConstantsmips_
 
const ESPedestalspeds_
 
const ESRecHitRatioCutsratioCuts_
 

Detailed Description

Definition at line 14 of file ESRecHitFitAlgo.h.

Constructor & Destructor Documentation

◆ ESRecHitFitAlgo()

ESRecHitFitAlgo::ESRecHitFitAlgo ( )

Definition at line 24 of file ESRecHitFitAlgo.cc.

References fit_, and fitf().

24  {
25  fit_ = new TF1("fit", fitf, -200, 200, 2);
26  fit_->SetParameters(50, 10);
27 }
Double_t fitf(Double_t *x, Double_t *par)

◆ ~ESRecHitFitAlgo()

ESRecHitFitAlgo::~ESRecHitFitAlgo ( )

Definition at line 29 of file ESRecHitFitAlgo.cc.

References fit_.

29 { delete fit_; }

Member Function Documentation

◆ EvalAmplitude()

double * ESRecHitFitAlgo::EvalAmplitude ( const ESDataFrame digi,
double  ped 
) const

Definition at line 31 of file ESRecHitFitAlgo.cc.

References ESSample::adc(), gpuClustering::adc, fit_, ESRecHitRatioCuts::getR12High(), ESRecHitRatioCuts::getR23High(), mps_fire::i, ratioCuts_, ESDataFrame::sample(), ESDataFrame::size(), and mps_update::status.

Referenced by reconstruct().

31  {
32  double* fitresults = new double[3]{};
33  double adc[3]{};
34  double tx[3]{};
35  tx[0] = -5.;
36  tx[1] = 20.;
37  tx[2] = 45.;
38 
39  for (int i = 0; i < digi.size(); i++)
40  adc[i] = digi.sample(i).adc() - ped;
41 
42  double status = 0;
43  if (adc[0] > 20)
44  status = 14;
45  if (adc[1] < 0 || adc[2] < 0)
46  status = 10;
47  if (adc[0] > adc[1] && adc[0] > adc[2])
48  status = 8;
49  if (adc[2] > adc[1] && adc[2] > adc[0])
50  status = 9;
51  double r12 = (adc[1] != 0) ? adc[0] / adc[1] : 99999;
52  double r23 = (adc[2] != 0) ? adc[1] / adc[2] : 99999;
53  if (r12 > ratioCuts_->getR12High())
54  status = 5;
55  if (r23 > ratioCuts_->getR23High())
56  status = 6;
57  if (r23 < ratioCuts_->getR23Low())
58  status = 7;
59 
60  if (int(status) == 0) {
61  double para[10]{};
62  TGraph* gr = new TGraph(3, tx, adc);
63  fit_->SetParameters(50, 10);
64  gr->Fit(fit_, "MQ");
65  fit_->GetParameters(para);
66  fitresults[0] = para[0];
67  fitresults[1] = para[1];
68  delete gr;
69 
70  if (adc[1] > 2800 && adc[2] > 2800)
71  status = 11;
72  else if (adc[1] > 2800)
73  status = 12;
74  else if (adc[2] > 2800)
75  status = 13;
76 
77  } else {
78  fitresults[0] = 0;
79  fitresults[1] = -999;
80  }
81 
82  fitresults[2] = status;
83 
84  return fitresults;
85 }
float getR12High() const
int size() const
Definition: ESDataFrame.h:21
const ESRecHitRatioCuts * ratioCuts_
float getR23High() const
int adc() const
get the ADC sample (singed 16 bits)
Definition: ESSample.h:16
const ESSample & sample(int i) const
Definition: ESDataFrame.h:24
uint16_t *__restrict__ uint16_t const *__restrict__ adc

◆ reconstruct()

EcalRecHit ESRecHitFitAlgo::reconstruct ( const ESDataFrame digi) const

Definition at line 87 of file ESRecHitFitAlgo.cc.

References ang_, channelStatus_, funct::cos(), HCALHighEnergyHPDFilter_cfi::energy, EvalAmplitude(), ESCondObjectContainer< T >::find(), ESCondObjectContainer< T >::getMap(), ESDataFrame::id(), createfilelist::int, EcalRecHit::kESBadRatioFor12, EcalRecHit::kESBadRatioFor23Lower, EcalRecHit::kESBadRatioFor23Upper, EcalRecHit::kESDead, EcalRecHit::kESGood, EcalRecHit::kESSaturated, EcalRecHit::kESTS13Sigmas, EcalRecHit::kESTS1Largest, EcalRecHit::kESTS2Saturated, EcalRecHit::kESTS3Largest, EcalRecHit::kESTS3Negative, EcalRecHit::kESTS3Saturated, LogDebug, MIPGeV_, mips_, peds_, mysort::results, EcalRecHit::setFlag(), mps_update::status, and FrontierCondition_GT_autoExpress_cfi::t0.

Referenced by ESRecHitWorker::run().

87  {
88  ESPedestals::const_iterator it_ped = peds_->find(digi.id());
89 
92 
94 
95  double* results;
96 
97  results = EvalAmplitude(digi, it_ped->getMean());
98 
99  double energy = results[0];
100  double t0 = results[1];
101  int status = (int)results[2];
102  delete[] results;
103 
104  double mipCalib = (std::fabs(cos(*it_ang)) != 0.) ? (*it_mip) / fabs(cos(*it_ang)) : 0.;
105  energy *= (mipCalib != 0.) ? MIPGeV_ / mipCalib : 0.;
106 
107  LogDebug("ESRecHitFitAlgo") << "ESRecHitFitAlgo : reconstructed energy " << energy << " T0 " << t0;
108 
109  EcalRecHit rechit(digi.id(), energy, t0);
110 
111  if (it_status->getStatusCode() == 1) {
113  } else {
114  if (status == 0)
115  rechit.setFlag(EcalRecHit::kESGood);
116  else if (status == 5)
117  rechit.setFlag(EcalRecHit::kESBadRatioFor12);
118  else if (status == 6)
119  rechit.setFlag(EcalRecHit::kESBadRatioFor23Upper);
120  else if (status == 7)
121  rechit.setFlag(EcalRecHit::kESBadRatioFor23Lower);
122  else if (status == 8)
123  rechit.setFlag(EcalRecHit::kESTS1Largest);
124  else if (status == 9)
125  rechit.setFlag(EcalRecHit::kESTS3Largest);
126  else if (status == 10)
127  rechit.setFlag(EcalRecHit::kESTS3Negative);
128  else if (status == 11)
129  rechit.setFlag(EcalRecHit::kESSaturated);
130  else if (status == 12)
131  rechit.setFlag(EcalRecHit::kESTS2Saturated);
132  else if (status == 13)
133  rechit.setFlag(EcalRecHit::kESTS3Saturated);
134  else if (status == 14)
135  rechit.setFlag(EcalRecHit::kESTS13Sigmas);
136  }
137 
138  return rechit;
139 }
const ESDetId & id() const
Definition: ESDataFrame.h:19
const ESChannelStatus * channelStatus_
double * EvalAmplitude(const ESDataFrame &digi, double ped) const
void setFlag(int flag)
set the flags (from Flags or ESFlags)
Definition: EcalRecHit.h:183
const_iterator find(uint32_t rawId) const
const ESAngleCorrectionFactors * ang_
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
std::vector< Item >::const_iterator const_iterator
results
Definition: mysort.py:8
const self & getMap() const
const ESIntercalibConstants * mips_
#define LogDebug(id)
const ESPedestals * peds_

◆ setAngleCorrectionFactors()

void ESRecHitFitAlgo::setAngleCorrectionFactors ( const ESAngleCorrectionFactors ang)
inline

Definition at line 25 of file ESRecHitFitAlgo.h.

References ang_.

Referenced by ESRecHitWorker::set().

25 { ang_ = ang; }
const ESAngleCorrectionFactors * ang_

◆ setChannelStatus()

void ESRecHitFitAlgo::setChannelStatus ( const ESChannelStatus status)
inline

Definition at line 23 of file ESRecHitFitAlgo.h.

References channelStatus_, and mps_update::status.

Referenced by ESRecHitWorker::set().

const ESChannelStatus * channelStatus_

◆ setESGain()

void ESRecHitFitAlgo::setESGain ( const double &  value)
inline

Definition at line 19 of file ESRecHitFitAlgo.h.

References gain_, and relativeConstraints::value.

Referenced by ESRecHitWorker::set().

◆ setIntercalibConstants()

void ESRecHitFitAlgo::setIntercalibConstants ( const ESIntercalibConstants mips)
inline

Definition at line 22 of file ESRecHitFitAlgo.h.

References mips_.

Referenced by ESRecHitWorker::set().

22 { mips_ = mips; }
const ESIntercalibConstants * mips_

◆ setMIPGeV()

void ESRecHitFitAlgo::setMIPGeV ( const double &  value)
inline

Definition at line 20 of file ESRecHitFitAlgo.h.

References MIPGeV_, and relativeConstraints::value.

Referenced by ESRecHitWorker::set().

◆ setPedestals()

void ESRecHitFitAlgo::setPedestals ( const ESPedestals peds)
inline

Definition at line 21 of file ESRecHitFitAlgo.h.

References peds_.

Referenced by ESRecHitWorker::set().

21 { peds_ = peds; }
const ESPedestals * peds_

◆ setRatioCuts()

void ESRecHitFitAlgo::setRatioCuts ( const ESRecHitRatioCuts ratioCuts)
inline

Definition at line 24 of file ESRecHitFitAlgo.h.

References ratioCuts_.

Referenced by ESRecHitWorker::set().

24 { ratioCuts_ = ratioCuts; }
const ESRecHitRatioCuts * ratioCuts_

Member Data Documentation

◆ ang_

const ESAngleCorrectionFactors* ESRecHitFitAlgo::ang_
private

Definition at line 36 of file ESRecHitFitAlgo.h.

Referenced by reconstruct(), and setAngleCorrectionFactors().

◆ channelStatus_

const ESChannelStatus* ESRecHitFitAlgo::channelStatus_
private

Definition at line 34 of file ESRecHitFitAlgo.h.

Referenced by reconstruct(), and setChannelStatus().

◆ fit_

TF1* ESRecHitFitAlgo::fit_
private

Definition at line 30 of file ESRecHitFitAlgo.h.

Referenced by ESRecHitFitAlgo(), EvalAmplitude(), and ~ESRecHitFitAlgo().

◆ gain_

double ESRecHitFitAlgo::gain_
private

Definition at line 31 of file ESRecHitFitAlgo.h.

Referenced by setESGain().

◆ MIPGeV_

double ESRecHitFitAlgo::MIPGeV_
private

Definition at line 37 of file ESRecHitFitAlgo.h.

Referenced by reconstruct(), and setMIPGeV().

◆ mips_

const ESIntercalibConstants* ESRecHitFitAlgo::mips_
private

Definition at line 33 of file ESRecHitFitAlgo.h.

Referenced by reconstruct(), and setIntercalibConstants().

◆ peds_

const ESPedestals* ESRecHitFitAlgo::peds_
private

Definition at line 32 of file ESRecHitFitAlgo.h.

Referenced by reconstruct(), and setPedestals().

◆ ratioCuts_

const ESRecHitRatioCuts* ESRecHitFitAlgo::ratioCuts_
private

Definition at line 35 of file ESRecHitFitAlgo.h.

Referenced by EvalAmplitude(), and setRatioCuts().