CMS 3D CMS Logo

Classes | Public Member Functions | Private Attributes

EcalTBH2TDCRecInfoAlgo Class Reference

#include <EcalTBH2TDCRecInfoAlgo.h>

List of all members.

Classes

struct  EcalTBH2TDCRanges

Public Member Functions

 EcalTBH2TDCRecInfoAlgo ()
 EcalTBH2TDCRecInfoAlgo (const std::vector< EcalTBH2TDCRanges > &tdcZero)
EcalTBTDCRecInfo reconstruct (const int &runNumber, const HcalTBTiming &TDCRawInfo) const
 ~EcalTBH2TDCRecInfoAlgo ()

Private Attributes

int actualRange_
int actualRun_
bool tdcRangeErrorMessageAlreadyDisplayed_
std::vector< EcalTBH2TDCRangestdcZeros_

Detailed Description

Definition at line 10 of file EcalTBH2TDCRecInfoAlgo.h.


Constructor & Destructor Documentation

EcalTBH2TDCRecInfoAlgo::EcalTBH2TDCRecInfoAlgo ( ) [inline]

Definition at line 13 of file EcalTBH2TDCRecInfoAlgo.h.

EcalTBH2TDCRecInfoAlgo::EcalTBH2TDCRecInfoAlgo ( const std::vector< EcalTBH2TDCRanges > &  tdcZero) [explicit]

Definition at line 8 of file EcalTBH2TDCRecInfoAlgo.cc.

EcalTBH2TDCRecInfoAlgo::~EcalTBH2TDCRecInfoAlgo ( ) [inline]

Definition at line 23 of file EcalTBH2TDCRecInfoAlgo.h.

    {
    };

Member Function Documentation

EcalTBTDCRecInfo EcalTBH2TDCRecInfoAlgo::reconstruct ( const int &  runNumber,
const HcalTBTiming TDCRawInfo 
) const

tdcRangeErrorMessageAlreadyDisplayed_ &&

Definition at line 14 of file EcalTBH2TDCRecInfoAlgo.cc.

References actualRange_, actualRun_, HcalTBTiming::BeamCoincidenceCount(), HcalTBTiming::BeamCoincidenceHits(), i, evf::evtn::offset(), inputsource_file_cfi::runNumber, tdcRangeErrorMessageAlreadyDisplayed_, Ecal2006TBH2TDCRanges_v0_cff::tdcZero, tdcZeros_, and HcalTBTiming::ttcL1Atime().

Referenced by EcalTBH2TDCRecInfoProducer::produce().

{
  if (actualRun_ != runNumber )
    {
      actualRun_ = runNumber;
      actualRange_ = -1;
      for (unsigned int i=0; i<tdcZeros_.size();i++)
        if ( runNumber <= tdcZeros_[i].runRanges.second && runNumber >= tdcZeros_[i].runRanges.first )
          actualRange_ = i;
      
      if (actualRange_ == -1)
        {
          edm::LogError("TDCRange not found") << "TDC range not found";
          return EcalTBTDCRecInfo(-1);
        }
    }

  int ntdc = TDCRawInfo.BeamCoincidenceCount();
  edm::LogInfo("") << "EcalTBH2TDCRecInfoAlgo::reconstruct # tdc hits: " << ntdc << std::endl;;
  if(ntdc>1) {
    for(int i=0; i<ntdc; ++i) {
      edm::LogInfo("") << "hit i: " << i << " tdc: " << TDCRawInfo.BeamCoincidenceHits(i) << std::endl;
    }
  }


  if(ntdc==0) {
     edm::LogError("NoTDCHits") << "no TDC hits. TDC info not reliable" << std::endl;
     return EcalTBTDCRecInfo(-999.);
  }


  //double tdcd = TDCRawInfo.ttcL1Atime() - TDCRawInfo.beamCoincidence();
  double tdcd = TDCRawInfo.ttcL1Atime() - TDCRawInfo.BeamCoincidenceHits(0);

  if( 
     (tdcd < tdcZeros_[actualRange_].tdcZero -1 || tdcd > tdcZeros_[actualRange_].tdcZero + 26) )
    {
      edm::LogError("TDCOutOfRange") << " ============================\n" 
                                     << " tdc value out of range = "<< tdcd 
                                     << " tdcZero = " << tdcZeros_[actualRange_].tdcZero
                                     << "\n" 
                                     << " ============================\n" <<std::endl;
      tdcRangeErrorMessageAlreadyDisplayed_ = true;
      return EcalTBTDCRecInfo(-999.);
    }
  
  double offset = ( (double)tdcd - (double)tdcZeros_[actualRange_].tdcZero )
    / 25.; //
  //   if (use2004OffsetConvention)
  //  offset = (1. - offset) ;
  return EcalTBTDCRecInfo(offset); 
}

Member Data Documentation

int EcalTBH2TDCRecInfoAlgo::actualRange_ [mutable, private]

Definition at line 34 of file EcalTBH2TDCRecInfoAlgo.h.

Referenced by reconstruct().

int EcalTBH2TDCRecInfoAlgo::actualRun_ [mutable, private]

Definition at line 33 of file EcalTBH2TDCRecInfoAlgo.h.

Referenced by reconstruct().

Definition at line 32 of file EcalTBH2TDCRecInfoAlgo.h.

Referenced by reconstruct().

Definition at line 31 of file EcalTBH2TDCRecInfoAlgo.h.

Referenced by reconstruct().