CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_2_SLHC4_patch1/src/RecoLocalCalo/HcalRecAlgos/src/HcalTDCReco.cc

Go to the documentation of this file.
00001 #include "RecoLocalCalo/HcalRecAlgos/src/HcalTDCReco.h"
00002 #include "DataFormats/HcalDigi/interface/HcalUpgradeDataFrame.h"
00003 #include "DataFormats/HcalRecHit/interface/HBHERecHit.h"
00004 
00005 HcalTDCReco::HcalTDCReco() 
00006 {}
00007 
00008 void HcalTDCReco::reconstruct(const HcalUpgradeDataFrame & digi, 
00009                               HBHERecHit & recHit) const
00010 {
00011   int n = digi.size();
00012   double risingTime = -999.;
00013   double fallingTime = -999.;
00014   int signalBX = 4;              // NB: HARDWIRED !!!
00015   // start at bunch crossing 3
00016   for(int i=3; i < n; ++i)
00017   {
00018     unsigned tdc = digi.tdc(i);
00019     unsigned rising = tdc & 0x7F;
00020     // altered packing to tdcBins*2=7
00021     unsigned falling = (tdc >> 7) & 0x7F;
00022     // only set the first time
00023     if(risingTime < -998. && rising != 64 && rising != 65) {
00024       risingTime = rising*25./64. + (i-signalBX)*25.;
00025     }
00026     if(fallingTime < -998. && falling != 64 && falling != 65) {
00027       fallingTime = falling*25./64. + (i-signalBX)*25.;
00028     }    
00029   }
00030   recHit = HBHERecHit(recHit.id(), recHit.energy(), risingTime, fallingTime);
00031 }