CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Functions
HcalSimpleRecAlgoImpl Namespace Reference

Functions

template<class Digi , class RecHit >
RecHit reco (const Digi &digi, const HcalCoder &coder, const HcalCalibrations &calibs, int ifirst, int n, bool slewCorrect, const HcalPulseContainmentCorrection *corr, HcalTimeSlew::BiasSetting slewFlavor, bool forData)
 

Function Documentation

template<class Digi , class RecHit >
RecHit HcalSimpleRecAlgoImpl::reco ( const Digi &  digi,
const HcalCoder coder,
const HcalCalibrations calibs,
int  ifirst,
int  n,
bool  slewCorrect,
const HcalPulseContainmentCorrection corr,
HcalTimeSlew::BiasSetting  slewFlavor,
bool  forData 
)
inline

Definition at line 47 of file HcalSimpleRecAlgo.cc.

References HcalCoder::adc2fC(), HcalTimeSlew::delay(), eCorr(), HcalPulseContainmentCorrection::getCorrection(), i, HcalDetId::ieta(), LogDebug, max(), findQualityFiles::maxI, HcalCalibrations::pedestal(), HcalCalibrations::respcorrgain(), CaloSamples::size(), cond::rpcobgas::time, HcalCalibrations::timecorr(), and timeshift_ns_hbheho().

49  {
50  CaloSamples tool;
51  coder.adc2fC(digi,tool);
52 
53  double ampl=0; int maxI = -1; double maxA = -1e10; float ta=0;
54  double fc_ampl=0;
55  for (int i=ifirst; i<tool.size() && i<n+ifirst; i++) {
56  int capid=digi[i].capid();
57  ta = (tool[i]-calibs.pedestal(capid)); // pedestal subtraction
58  fc_ampl+=ta;
59  ta*= calibs.respcorrgain(capid) ; // fC --> GeV
60  ampl+=ta;
61  if(ta>maxA){
62  maxA=ta;
63  maxI=i;
64  }
65  }
66 
67  float time = -9999;
69  if(maxI==0 || maxI==(tool.size()-1)) {
70  LogDebug("HCAL Pulse") << "HcalSimpleRecAlgo::reconstruct :"
71  << " Invalid max amplitude position, "
72  << " max Amplitude: "<< maxI
73  << " first: "<<ifirst
74  << " last: "<<(tool.size()-1)
75  << std::endl;
76  } else {
77  int capid=digi[maxI-1].capid();
78  float t0 = ((tool[maxI-1]-calibs.pedestal(capid))*calibs.respcorrgain(capid) );
79  capid=digi[maxI+1].capid();
80  float t2 = ((tool[maxI+1]-calibs.pedestal(capid))*calibs.respcorrgain(capid) );
81 
82  // Handle negative excursions by moving "zero":
83  float minA=t0;
84  if (maxA<minA) minA=maxA;
85  if (t2<minA) minA=t2;
86  if (minA<0) { maxA-=minA; t0-=minA; t2-=minA; } // positivizes all samples
87 
88  float wpksamp = (t0 + maxA + t2);
89  if (wpksamp!=0) wpksamp=(maxA + 2.0*t2) / wpksamp;
90  time = (maxI - digi.presamples())*25.0 + timeshift_ns_hbheho(wpksamp);
91  if (corr!=0) {
92  // Apply phase-based amplitude correction:
93  ampl *= corr->getCorrection(fc_ampl);
94  // std::cout << fc_ampl << " --> " << corr->getCorrection(fc_ampl) << std::endl;
95  }
96  if (slewCorrect) time-=HcalTimeSlew::delay(std::max(1.0,fc_ampl),slewFlavor);
97 
98  time=time-calibs.timecorr(); // time calibration
99  }
100 
101  // Temoprary Ugly Hack to apply energy-dependent corrections on some
102  // HB- cells
103  if(forData) {
104  HcalDetId cell(digi.id());
105  int ieta = cell.ieta();
106  int iphi = cell.iphi();
107  ampl *= eCorr(ieta,iphi,ampl);
108  }
109 
110  return RecHit(digi.id(),ampl,time);
111  }
#define LogDebug(id)
int i
Definition: DBlmapReader.cc:9
double respcorrgain(int fCapId) const
get response corrected gain for capid=0..3
double getCorrection(double fc_ampl) const
double pedestal(int fCapId) const
get pedestal for capid=0..3
const T & max(const T &a, const T &b)
int ieta() const
get the cell ieta
Definition: HcalDetId.h:38
static float timeshift_ns_hbheho(float wpksamp)
static float eCorr(int ieta, int iphi, double ampl)
Ugly hack to apply energy corrections to some HB- cells.
int size() const
get the size
Definition: CaloSamples.h:24
double timecorr() const
get time correction factor
virtual void adc2fC(const HBHEDataFrame &df, CaloSamples &lf) const =0
static double delay(double fC, BiasSetting bias=Medium)
Returns the amount (ns) by which a pulse of the given number of fC will be delayed by the timeslew ef...
Definition: HcalTimeSlew.cc:8