CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
HcalTDCReco.cc
Go to the documentation of this file.
4 
6 {}
7 
9  HBHERecHit & recHit) const
10 {
11  int n = digi.size();
12  double risingTime = -999.;
13  double fallingTime = -999.;
14  int signalBX = 4; // NB: HARDWIRED !!!
15  int nbins = 50; // as in HcalTDCParameters.h (SimCalorimetry/HcalSimAlgos)
16  int direction(-1), stepSize(1); // where to go after signalBX
17  // start at bunch crossing 3 by default
18  int i(signalBX);
19 
20  // for(int i = 3; i < n; ++i)
21  while ((i > 2) && (i < 8) && (i < n) &&
22  ((risingTime < -998.) || (fallingTime < 998.)))
23  {
24  unsigned tdc = digi.tdc(i);
25 
26  /*
27  unsigned rising = tdc & 0x7F;
28  unsigned falling = (tdc >> 7) & 0x7F;
29  */
30  // temporary "unpacking" instead, which directly corresponds to
31  // SimCalorimetry/HcalSimAlgos/src/HcalTDC.cc (nibs = 50...)
32  // packedTDC = TDC_RisingEdge + (tdcBins*2) * TDC_FallingEdge;
33  unsigned rising = tdc%100;
34  unsigned falling = tdc/100;
35 
36  // only set the first time, avoiding "special" codes
37  if(risingTime < -998. && rising != 62 && rising != 63) {
38  risingTime = rising*25./nbins + (i-signalBX)*25.;
39  }
40  if(((fallingTime < -998.) || (fallingTime < risingTime)) &&
41  (falling != 62) && (falling != 63)) {
42  fallingTime = falling*25./nbins + (i-signalBX)*25.;
43  }
44 
45  i += direction*stepSize;
46  ++stepSize;
47  direction *= -1;
48  /*
49  std::cout << " digi.tdc[" << i << "] = " << tdc
50  << " rising = " << rising << " falling = " << falling
51  << " Rt = " << risingTime
52  << " Ft = " << fallingTime
53  << std::endl;
54  */
55  }
56  recHit = HBHERecHit(recHit.id(), recHit.energy(), risingTime, fallingTime);
57 }
int i
Definition: DBlmapReader.cc:9
HcalDetId id() const
get the id
Definition: HBHERecHit.h:23
float energy() const
Definition: CaloRecHit.h:17
uint16_t tdc(int iSample=0) const
void reconstruct(const HcalUpgradeDataFrame &digi, HBHERecHit &recHit) const
Definition: HcalTDCReco.cc:8