CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Classes | Public Member Functions | Private Attributes
EcalTBTDCRecInfoAlgo Class Reference

#include <EcalTBTDCRecInfoAlgo.h>

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.

29  {
30  };

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(), stage2BMTFBufferRaw_cfi::eventType, i, hltrates_dqm_sourceclient-live_cfg::offset, EcalTBEventHeader::runNumber(), Ecal2004TBTDCRanges_cff::tdcMax, Ecal2004TBTDCRanges_cff::tdcMin, tdcRangeErrorMessageAlreadyDisplayed_, and tdcRanges_.

Referenced by EcalTBTDCRecInfoProducer::produce().

14 {
15  if (actualRun_ != eventHeader.runNumber() )
16  {
17  actualRun_ = eventHeader.runNumber();
18  actualRange_ = -1;
19  for (unsigned int i=0; i<tdcRanges_.size();i++)
20  if ( eventHeader.runNumber() <= tdcRanges_[i].runRanges.second && eventHeader.runNumber() >= tdcRanges_[i].runRanges.first )
21  actualRange_ = i;
22 
23  if (actualRange_ == -1)
24  {
25  edm::LogError("TDCRange not found") << "TDC range not found";
26  return EcalTBTDCRecInfo(-1);
27  }
28  }
29 
30  int eventType;
31  eventType=( (eventHeader.dbEventType() == 0) ? 0 : (eventHeader.dbEventType()-1));
32 
33  int tdcd = TDCRawInfo[0].tdcValue();
34 
36  && (tdcd < tdcRanges_[actualRange_].tdcMin[eventType] || tdcd > tdcRanges_[actualRange_].tdcMax[eventType]) ){
37  std::cout << " ============================" <<std::endl;
38  std::cout << " Event type: " << eventType << std::endl;
39  std::cout << " TDC values not correctly set Raw TDC = "<< tdcd
40  << " (Min/Max = "<< tdcRanges_[actualRange_].tdcMin[eventType] << "/" << tdcRanges_[actualRange_].tdcMax[eventType]
41  << std::endl;
42  std::cout << " ============================" <<std::endl;
44  }
45 
46  double offset = ( (double)tdcd - (double)tdcRanges_[actualRange_].tdcMin[eventType] )
47  / ((double)tdcRanges_[actualRange_].tdcMax[eventType]-(double)tdcRanges_[actualRange_].tdcMin[eventType]);
48  if (use2004OffsetConvention)
49  offset = (1. - offset) ;
50  return EcalTBTDCRecInfo(offset);
51 }
int i
Definition: DBlmapReader.cc:9
std::vector< EcalTBTDCRanges > tdcRanges_
int runNumber() const
int dbEventType() const
Returns the event type as in the H4ROOTDB.
tuple cout
Definition: gather_cfg.py:145

Member Data Documentation

int EcalTBTDCRecInfoAlgo::actualRange_
mutableprivate

Definition at line 39 of file EcalTBTDCRecInfoAlgo.h.

Referenced by reconstruct().

int EcalTBTDCRecInfoAlgo::actualRun_
mutableprivate

Definition at line 38 of file EcalTBTDCRecInfoAlgo.h.

Referenced by reconstruct().

bool EcalTBTDCRecInfoAlgo::tdcRangeErrorMessageAlreadyDisplayed_
mutableprivate

Definition at line 37 of file EcalTBTDCRecInfoAlgo.h.

Referenced by reconstruct().

std::vector<EcalTBTDCRanges> EcalTBTDCRecInfoAlgo::tdcRanges_
private

Definition at line 36 of file EcalTBTDCRecInfoAlgo.h.

Referenced by reconstruct().