CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
ESRecHitAnalyticAlgo Class Reference

#include <ESRecHitAnalyticAlgo.h>

Public Member Functions

 ESRecHitAnalyticAlgo ()
 
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)
 
 ~ESRecHitAnalyticAlgo ()
 

Private Attributes

const ESAngleCorrectionFactorsang_
 
const ESChannelStatuschannelStatus_
 
double gain_
 
double MIPGeV_
 
const ESIntercalibConstantsmips_
 
const ESPedestalspeds_
 
const ESRecHitRatioCutsratioCuts_
 

Detailed Description

Definition at line 12 of file ESRecHitAnalyticAlgo.h.

Constructor & Destructor Documentation

ESRecHitAnalyticAlgo::ESRecHitAnalyticAlgo ( )

Definition at line 7 of file ESRecHitAnalyticAlgo.cc.

7  {
8 }
ESRecHitAnalyticAlgo::~ESRecHitAnalyticAlgo ( )

Definition at line 10 of file ESRecHitAnalyticAlgo.cc.

10  {
11 }

Member Function Documentation

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

Definition at line 13 of file ESRecHitAnalyticAlgo.cc.

References ecalMGPA::adc(), ESSample::adc(), create_public_lumi_plots::exp, ESRecHitRatioCuts::getR12High(), ESRecHitRatioCuts::getR23High(), i, create_public_lumi_plots::log, n, funct::pow(), ratioCuts_, ESDataFrame::sample(), ESDataFrame::size(), ntuplemaker::status, and w().

Referenced by reconstruct().

13  {
14 
15  double *fitresults = new double[3];
16  double adc[3];
17 
18  for (int i=0; i<digi.size(); i++)
19  adc[i] = digi.sample(i).adc() - ped;
20 
21  double status = 0;
22  if (adc[0] > 20) status = 14;
23  if (adc[1] < 0 || adc[2] < 0) status = 10;
24  if (adc[0] > adc[1] && adc[0] > adc[2]) status = 8;
25  if (adc[2] > adc[1] && adc[2] > adc[0]) status = 9;
26  double r12 = (adc[1] != 0) ? adc[0]/adc[1] : 99999;
27  double r23 = (adc[2] != 0) ? adc[1]/adc[2] : 99999;
28  if (r12 > ratioCuts_->getR12High()) status = 5;
29  if (r23 > ratioCuts_->getR23High()) status = 6;
30  if (r23 < ratioCuts_->getR23Low()) status = 7;
31 
32  if (int(status) == 0) {
33 
34  double A1 = adc[1];
35  double A2 = adc[2];
36 
37  // t0 from analytical formula:
38  double n = 1.798;
39  double w = 0.07291;
40  double DeltaT = 25.;
41  double aaa = log(A2/A1)/n;
42  double bbb = w/n*DeltaT;
43  double ccc= exp(aaa+bbb);
44 
45  //double t0 = (2.-ccc)/(ccc-1) * DeltaT + 5;
46  double t0 = (2.-ccc)/(1.-ccc) * DeltaT - 5;
47 
48  // A from analytical formula:
49  double t1 = 20.;
50  //double t2 = 45.;
51  double A_1 = pow(w/n*(t1),n) * exp(n-w*(t1));
52  //double A_2 = pow(w/n*(t2),n) * exp(n-w*(t2));
53  double AA1 = A1 / A_1;
54  //double AA2 = A2 / A_2;
55 
56  fitresults[0] = AA1;
57  fitresults[1] = t0;
58 
59  if (adc[1] > 2800 && adc[2] > 2800) status = 11;
60  else if (adc[1] > 2800) status = 12;
61  else if (adc[2] > 2800) status = 13;
62 
63  } else {
64  fitresults[0] = 0;
65  fitresults[1] = -999;
66  }
67 
68  fitresults[2] = status;
69 
70  return fitresults;
71 }
int adc(sample_type sample)
get the ADC sample (12 bits)
int i
Definition: DBlmapReader.cc:9
int size() const
Definition: ESDataFrame.h:23
const ESRecHitRatioCuts * ratioCuts_
const ESSample & sample(int i) const
Definition: ESDataFrame.h:26
float getR12High() const
float getR23High() const
int adc() const
get the ADC sample (singed 16 bits)
Definition: ESSample.h:18
T w() const
tuple status
Definition: ntuplemaker.py:245
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
EcalRecHit ESRecHitAnalyticAlgo::reconstruct ( const ESDataFrame digi) const

Definition at line 73 of file ESRecHitAnalyticAlgo.cc.

References ang_, channelStatus_, funct::cos(), relval_parameters_module::energy, EvalAmplitude(), ESCondObjectContainer< T >::find(), ESCondObjectContainer< T >::getMap(), ESDataFrame::id(), 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_, python.entryComment::results, EcalRecHit::setFlag(), and ntuplemaker::status.

Referenced by ESRecHitWorker::run().

73  {
74 
75  ESPedestals::const_iterator it_ped = peds_->find(digi.id());
76 
79 
81 
82  double* results;
83 
84  results = EvalAmplitude(digi, it_ped->getMean());
85 
86  double energy = results[0];
87  double t0 = results[1];
88  int status = (int) results[2];
89  delete[] results;
90 
91  double mipCalib = (fabs(cos(*it_ang)) != 0.) ? (*it_mip)/fabs(cos(*it_ang)) : 0.;
92  energy *= (mipCalib != 0.) ? MIPGeV_/mipCalib : 0.;
93 
94  LogDebug("ESRecHitAnalyticAlgo") << "ESRecHitAnalyticAlgo : reconstructed energy "<<energy<<" T0 "<<t0;
95 
96  EcalRecHit rechit(digi.id(), energy, t0);
97 
98  if (it_status->getStatusCode() == 1) {
100  } else {
101  if (status == 0)
102  rechit.setFlag(EcalRecHit::kESGood);
103  else if (status == 5)
104  rechit.setFlag(EcalRecHit::kESBadRatioFor12);
105  else if (status == 6)
106  rechit.setFlag(EcalRecHit::kESBadRatioFor23Upper);
107  else if (status == 7)
108  rechit.setFlag(EcalRecHit::kESBadRatioFor23Lower);
109  else if (status == 8)
110  rechit.setFlag(EcalRecHit::kESTS1Largest);
111  else if (status == 9)
112  rechit.setFlag(EcalRecHit::kESTS3Largest);
113  else if (status == 10)
114  rechit.setFlag(EcalRecHit::kESTS3Negative);
115  else if (status == 11)
116  rechit.setFlag(EcalRecHit::kESSaturated);
117  else if (status == 12)
118  rechit.setFlag(EcalRecHit::kESTS2Saturated);
119  else if (status == 13)
120  rechit.setFlag(EcalRecHit::kESTS3Saturated);
121  else if (status == 14)
122  rechit.setFlag(EcalRecHit::kESTS13Sigmas);
123  }
124 
125  return rechit;
126 }
#define LogDebug(id)
const ESDetId & id() const
Definition: ESDataFrame.h:21
const self & getMap() const
const ESIntercalibConstants * mips_
void setFlag(int flag)
set the flags (from Flags or ESFlags)
Definition: EcalRecHit.h:99
double * EvalAmplitude(const ESDataFrame &digi, double ped) const
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
const_iterator find(uint32_t rawId) const
const ESPedestals * peds_
const ESChannelStatus * channelStatus_
const ESAngleCorrectionFactors * ang_
std::vector< Item >::const_iterator const_iterator
tuple status
Definition: ntuplemaker.py:245
void ESRecHitAnalyticAlgo::setAngleCorrectionFactors ( const ESAngleCorrectionFactors ang)
inline

Definition at line 25 of file ESRecHitAnalyticAlgo.h.

References ang_.

Referenced by ESRecHitWorker::set().

25 { ang_ = ang; }
const ESAngleCorrectionFactors * ang_
void ESRecHitAnalyticAlgo::setChannelStatus ( const ESChannelStatus status)
inline

Definition at line 23 of file ESRecHitAnalyticAlgo.h.

References channelStatus_, and ntuplemaker::status.

Referenced by ESRecHitWorker::set().

const ESChannelStatus * channelStatus_
tuple status
Definition: ntuplemaker.py:245
void ESRecHitAnalyticAlgo::setESGain ( const double &  value)
inline

Definition at line 19 of file ESRecHitAnalyticAlgo.h.

References gain_, and relativeConstraints::value.

Referenced by ESRecHitWorker::set().

void ESRecHitAnalyticAlgo::setIntercalibConstants ( const ESIntercalibConstants mips)
inline

Definition at line 22 of file ESRecHitAnalyticAlgo.h.

References mips_.

Referenced by ESRecHitWorker::set().

22 { mips_ = mips; }
const ESIntercalibConstants * mips_
void ESRecHitAnalyticAlgo::setMIPGeV ( const double &  value)
inline

Definition at line 20 of file ESRecHitAnalyticAlgo.h.

References MIPGeV_, and relativeConstraints::value.

Referenced by ESRecHitWorker::set().

void ESRecHitAnalyticAlgo::setPedestals ( const ESPedestals peds)
inline

Definition at line 21 of file ESRecHitAnalyticAlgo.h.

References peds_.

Referenced by ESRecHitWorker::set().

21 { peds_ = peds; }
const ESPedestals * peds_
void ESRecHitAnalyticAlgo::setRatioCuts ( const ESRecHitRatioCuts ratioCuts)
inline

Definition at line 24 of file ESRecHitAnalyticAlgo.h.

References ratioCuts_.

Referenced by ESRecHitWorker::set().

24 { ratioCuts_ = ratioCuts; }
const ESRecHitRatioCuts * ratioCuts_

Member Data Documentation

const ESAngleCorrectionFactors* ESRecHitAnalyticAlgo::ang_
private

Definition at line 36 of file ESRecHitAnalyticAlgo.h.

Referenced by reconstruct(), and setAngleCorrectionFactors().

const ESChannelStatus* ESRecHitAnalyticAlgo::channelStatus_
private

Definition at line 34 of file ESRecHitAnalyticAlgo.h.

Referenced by reconstruct(), and setChannelStatus().

double ESRecHitAnalyticAlgo::gain_
private

Definition at line 31 of file ESRecHitAnalyticAlgo.h.

Referenced by setESGain().

double ESRecHitAnalyticAlgo::MIPGeV_
private

Definition at line 37 of file ESRecHitAnalyticAlgo.h.

Referenced by reconstruct(), and setMIPGeV().

const ESIntercalibConstants* ESRecHitAnalyticAlgo::mips_
private

Definition at line 33 of file ESRecHitAnalyticAlgo.h.

Referenced by reconstruct(), and setIntercalibConstants().

const ESPedestals* ESRecHitAnalyticAlgo::peds_
private

Definition at line 32 of file ESRecHitAnalyticAlgo.h.

Referenced by reconstruct(), and setPedestals().

const ESRecHitRatioCuts* ESRecHitAnalyticAlgo::ratioCuts_
private

Definition at line 35 of file ESRecHitAnalyticAlgo.h.

Referenced by EvalAmplitude(), and setRatioCuts().