CMS 3D CMS Logo

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

Functions

template<class Digi , class RecHit >
RecHit reco (const Digi &digi, const CastorCoder &coder, const CastorCalibrations &calibs, int ifirst, int n, bool slewCorrect, const CastorPulseContainmentCorrection *corr, CastorTimeSlew::BiasSetting slewFlavor)
 

Function Documentation

template<class Digi , class RecHit >
RecHit CastorSimpleRecAlgoImpl::reco ( const Digi &  digi,
const CastorCoder coder,
const CastorCalibrations calibs,
int  ifirst,
int  n,
bool  slewCorrect,
const CastorPulseContainmentCorrection corr,
CastorTimeSlew::BiasSetting  slewFlavor 
)
inline

Definition at line 36 of file CastorSimpleRecAlgo.cc.

References CastorCoder::adc2fC(), CastorTimeSlew::delay(), CastorCalibrations::gain(), CastorPulseContainmentCorrection::getCorrection(), i, max(), findQualityFiles::maxI, CastorCalibrations::pedestal(), CaloSamples::size(), cond::rpcobgas::time, and timeshift_ns_hf().

37  {
38  CaloSamples tool;
39  coder.adc2fC(digi,tool);
40 
41  double ampl=0; int maxI = -1; double maxA = -1e10; float ta=0;
42  double fc_ampl=0;
43  for (int i=ifirst; i<tool.size() && i<n+ifirst; i++) {
44  int capid=digi[i].capid();
45  ta = (tool[i]-calibs.pedestal(capid)); // pedestal subtraction
46  fc_ampl+=ta;
47  ta*=calibs.gain(capid); // fC --> GeV
48  ampl+=ta;
49  if(ta>maxA){
50  maxA=ta;
51  maxI=i;
52  }
53  }
54 
55  float time=-9999;
57  if(maxI==0 || maxI==(tool.size()-1)) {
58  // supress warning and use dummy time value for 2009 data
59  /*
60  edm::LogWarning("HCAL/CASTOR Pulse") << "CastorSimpleRecAlgo::reconstruct :"
61  << " Invalid max amplitude position, "
62  << " max Amplitude: "<< maxI
63  << " first: "<<ifirst
64  << " last: "<<(tool.size()-1)
65  << std::endl;
66  */
67  } else {
68  maxA=fabs(maxA);
69  int capid=digi[maxI-1].capid();
70  float t0 = fabs((tool[maxI-1]-calibs.pedestal(capid))*calibs.gain(capid));
71  capid=digi[maxI+1].capid();
72  float t2 = fabs((tool[maxI+1]-calibs.pedestal(capid))*calibs.gain(capid));
73  float wpksamp = (t0 + maxA + t2);
74  if (wpksamp!=0) wpksamp=(maxA + 2.0*t2) / wpksamp;
75  time = (maxI - digi.presamples())*25.0 + timeshift_ns_hf(wpksamp);
76 
77  if (corr!=0) {
78  // Apply phase-based amplitude correction:
79  ampl *= corr->getCorrection(fc_ampl);
80  // std::cout << fc_ampl << " --> " << corr->getCorrection(fc_ampl) << std::endl;
81  }
82 
83 
84  if (slewCorrect) time-=CastorTimeSlew::delay(std::max(1.0,fc_ampl),slewFlavor);
85  }
86  return RecHit(digi.id(),ampl,time);
87  }
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...
int i
Definition: DBlmapReader.cc:9
virtual void adc2fC(const CastorDataFrame &df, CaloSamples &lf) const =0
const T & max(const T &a, const T &b)
double pedestal(int fCapId) const
get pedestal for capid=0..3
double gain(int fCapId) const
get gain for capid=0..3
int size() const
get the size
Definition: CaloSamples.h:24
static float timeshift_ns_hf(float wpksamp)
Same as above, but for the HF PMTs.