CMS 3D CMS Logo

Classes | Public Member Functions | Private Attributes

EcalTBTDCRecInfoAlgo Class Reference

#include <EcalTBTDCRecInfoAlgo.h>

List of all members.

Classes

struct  EcalTBTDCRanges

Public Member Functions

 EcalTBTDCRecInfoAlgo ()
 EcalTBTDCRecInfoAlgo (const std::vector< EcalTBTDCRanges > &tdcRanges)
EcalTBTDCRecInfo reconstruct (const EcalTBTDCRawInfo &TDCRawInfo, const EcalTBEventHeader &eventHeader, bool use2004OffsetConvention) const
 ~EcalTBTDCRecInfoAlgo ()

Private Attributes

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

Detailed Description

Definition at line 11 of file EcalTBTDCRecInfoAlgo.h.


Constructor & Destructor Documentation

EcalTBTDCRecInfoAlgo::EcalTBTDCRecInfoAlgo ( ) [inline]

Definition at line 17 of file EcalTBTDCRecInfoAlgo.h.

EcalTBTDCRecInfoAlgo::EcalTBTDCRecInfoAlgo ( const std::vector< EcalTBTDCRanges > &  tdcRanges) [explicit]
EcalTBTDCRecInfoAlgo::~EcalTBTDCRecInfoAlgo ( ) [inline]

Definition at line 28 of file EcalTBTDCRecInfoAlgo.h.

    {
    };

Member Function Documentation

EcalTBTDCRecInfo EcalTBTDCRecInfoAlgo::reconstruct ( const EcalTBTDCRawInfo TDCRawInfo,
const EcalTBEventHeader eventHeader,
bool  use2004OffsetConvention 
) const

Definition at line 13 of file EcalTBTDCRecInfoAlgo.cc.

References actualRange_, actualRun_, gather_cfg::cout, EcalTBEventHeader::dbEventType(), i, evf::evtn::offset(), EcalTBEventHeader::runNumber(), Ecal2004TBTDCRanges_cff::tdcMax, Ecal2004TBTDCRanges_cff::tdcMin, tdcRangeErrorMessageAlreadyDisplayed_, and tdcRanges_.

Referenced by EcalTBTDCRecInfoProducer::produce().

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

  int tdcd = TDCRawInfo[0].tdcValue();

  if( !tdcRangeErrorMessageAlreadyDisplayed_ 
      && (tdcd < tdcRanges_[actualRange_].tdcMin[eventType] || tdcd > tdcRanges_[actualRange_].tdcMax[eventType]) ){
    std::cout << " ============================" <<std::endl;
    std::cout << " Event type: " << eventType << std::endl;
    std::cout << " TDC values not correctly set Raw TDC = "<< tdcd 
              << " (Min/Max = "<< tdcRanges_[actualRange_].tdcMin[eventType] << "/" << tdcRanges_[actualRange_].tdcMax[eventType]
              << std::endl;
    std::cout << " ============================" <<std::endl;
    tdcRangeErrorMessageAlreadyDisplayed_ = true;
  }

  double offset = ( (double)tdcd - (double)tdcRanges_[actualRange_].tdcMin[eventType] )
    / ((double)tdcRanges_[actualRange_].tdcMax[eventType]-(double)tdcRanges_[actualRange_].tdcMin[eventType]);
  if (use2004OffsetConvention)
    offset = (1. - offset) ;
  return EcalTBTDCRecInfo(offset); 
}

Member Data Documentation

int EcalTBTDCRecInfoAlgo::actualRange_ [mutable, private]

Definition at line 39 of file EcalTBTDCRecInfoAlgo.h.

Referenced by reconstruct().

int EcalTBTDCRecInfoAlgo::actualRun_ [mutable, private]

Definition at line 38 of file EcalTBTDCRecInfoAlgo.h.

Referenced by reconstruct().

Definition at line 37 of file EcalTBTDCRecInfoAlgo.h.

Referenced by reconstruct().

Definition at line 36 of file EcalTBTDCRecInfoAlgo.h.

Referenced by reconstruct().