CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Static Public Attributes | Protected Member Functions | Private Attributes
EcalShapeBase Class Referenceabstract

#include <EcalShapeBase.h>

Inheritance diagram for EcalShapeBase:
CaloVShape APDShape EBShape EEShape

Public Types

enum  {
  kReadoutTimeInterval = 25, kNBinsPerNSec = 10, k1NSecBins = kReadoutTimeInterval*kNBinsPerNSec, k1NSecBinsTotal = 2*k1NSecBins,
  kNBinsStored = k1NSecBinsTotal*kNBinsPerNSec
}
 
typedef std::vector< double > DVec
 

Public Member Functions

double derivative (double time) const
 
 EcalShapeBase (bool aSaveDerivative)
 
double operator() (double aTime) const
 
virtual double threshold () const =0
 
double timeOfMax () const
 
double timeOfThr () const
 
virtual double timeToRise () const
 
virtual ~EcalShapeBase ()
 
- Public Member Functions inherited from CaloVShape
 CaloVShape ()
 
virtual ~CaloVShape ()
 

Static Public Attributes

static const double qNSecPerBin = 1./(1.*kNBinsPerNSec)
 

Protected Member Functions

void buildMe ()
 
virtual void fillShape (DVec &aVec) const =0
 
unsigned int timeIndex (double aTime) const
 

Private Attributes

DVecm_derivPtr
 
unsigned int m_firstIndexOverThreshold
 
double m_firstTimeOverThreshold
 
unsigned int m_indexOfMax
 
DVec m_shape
 
double m_timeOfMax
 

Detailed Description

Definition at line 12 of file EcalShapeBase.h.

Member Typedef Documentation

typedef std::vector<double> EcalShapeBase::DVec

Definition at line 16 of file EcalShapeBase.h.

Member Enumeration Documentation

anonymous enum
Enumerator
kReadoutTimeInterval 
kNBinsPerNSec 
k1NSecBins 
k1NSecBinsTotal 
kNBinsStored 

Definition at line 32 of file EcalShapeBase.h.

Constructor & Destructor Documentation

EcalShapeBase::EcalShapeBase ( bool  aSaveDerivative)

Definition at line 16 of file EcalShapeBase.cc.

16  :
18  m_firstTimeOverThreshold ( 0.0 ) ,
19  m_indexOfMax ( 0 ) ,
20  m_timeOfMax ( 0.0 ) ,
21  m_shape ( DVec( kNBinsStored, 0.0 ) ) ,
22  m_derivPtr ( aSaveDerivative ? new DVec( kNBinsStored, 0.0 ) : 0 )
23 {
24 }
DVec * m_derivPtr
Definition: EcalShapeBase.h:56
std::vector< double > DVec
Definition: EcalShapeBase.h:16
double m_firstTimeOverThreshold
Definition: EcalShapeBase.h:52
unsigned int m_indexOfMax
Definition: EcalShapeBase.h:53
double m_timeOfMax
Definition: EcalShapeBase.h:54
unsigned int m_firstIndexOverThreshold
Definition: EcalShapeBase.h:51
EcalShapeBase::~EcalShapeBase ( )
virtual

Definition at line 11 of file EcalShapeBase.cc.

References m_derivPtr.

12 {
13  delete m_derivPtr ;
14 }
DVec * m_derivPtr
Definition: EcalShapeBase.h:56

Member Function Documentation

void EcalShapeBase::buildMe ( )
protected

Definition at line 46 of file EcalShapeBase.cc.

References a, b, EnergyCorrector::c, delta, alignCSCRings::e, python.connectstrParser::f1, python.connectstrParser::f2, python.connectstrParser::f3, fillShape(), i, j, k1NSecBinsTotal, kNBinsPerNSec, kNBinsStored, m_derivPtr, m_firstIndexOverThreshold, m_firstTimeOverThreshold, m_indexOfMax, m_shape, m_timeOfMax, qNSecPerBin, GOODCOLL_filter_cfg::thresh, threshold(), relativeConstraints::value, and x.

Referenced by APDShape::APDShape(), EBShape::EBShape(), and EEShape::EEShape().

47 {
48  DVec shapeArray( k1NSecBinsTotal , 0.0 ) ;
49 
50  fillShape( shapeArray ) ;
51 
52  const double maxel ( *max_element( shapeArray.begin(), shapeArray.end() ) ) ;
53 
54  const double maxelt ( 1.e-5 < maxel ? maxel : 1 ) ;
55 
56  for( unsigned int i ( 0 ) ; i != shapeArray.size(); ++i )
57  {
58  shapeArray[i] = shapeArray[i]/maxelt ;
59  }
60 
61  const double thresh ( threshold()/maxelt ) ;
62 
63 /*
64  for( unsigned int i ( 0 ) ; i != k1NSecBinsTotal ; ++i )
65  {
66  LogDebug("EcalShapeBase") << " time (ns) = " << (double)i << " tabulated ECAL pulse shape = " << shapeArray[i];
67  }
68 */
69 
70  const double delta ( qNSecPerBin/2. ) ;
71 
72  for( unsigned int j ( 0 ) ; j != kNBinsStored ; ++j )
73  {
74  const double xb ( ( j + 0.5 )*qNSecPerBin ) ;
75 
76  const unsigned int ibin ( j/kNBinsPerNSec ) ;
77 
78  double value = 0.0 ;
79  double deriv = 0.0 ;
80 
81  if( 0 == ibin ||
82  shapeArray.size() == 1 + ibin ) // cannot do quadratic interpolation at ends
83  {
84  value = shapeArray[ibin];
85  deriv = 0.0 ;
86  }
87  else
88  {
89  const double x ( xb - ( ibin + 0.5 ) ) ;
90  const double f1 ( shapeArray[ ibin - 1 ] ) ;
91  const double f2 ( shapeArray[ ibin ] ) ;
92  const double f3 ( shapeArray[ ibin + 1 ] ) ;
93  const double a ( f2 ) ;
94  const double b ( ( f3 - f1 )/2. ) ;
95  const double c ( ( f1 + f3 )/2. - f2 ) ;
96  value = a + b*x + c*x*x;
97  deriv = ( b + 2*c*x )/delta ;
98  }
99 
100  m_shape[ j ] = value;
101  if( 0 != m_derivPtr ) (*m_derivPtr)[ j ] = deriv;
102 
103  if( 0 < j &&
104  thresh < value &&
106  {
109  }
110 
111  if( m_shape[ m_indexOfMax ] < value )
112  {
113  m_indexOfMax = j ;
114  }
115 
116 // LogDebug("EcalShapeBase") << " time (ns) = " << ( j + 1.0 )*qNSecPerBin - delta
117 // << " interpolated ECAL pulse shape = " << m_shape[ j ]
118 // << " derivative = " << ( 0 != m_derivPtr ? (*m_derivPtr)[ j ] : 0 ) ;
119  }
121 }
dbl * delta
Definition: mlp_gen.cc:36
DVec * m_derivPtr
Definition: EcalShapeBase.h:56
int i
Definition: DBlmapReader.cc:9
static const double qNSecPerBin
Definition: EcalShapeBase.h:39
virtual double threshold() const =0
std::vector< double > DVec
Definition: EcalShapeBase.h:16
int j
Definition: DBlmapReader.cc:9
double m_firstTimeOverThreshold
Definition: EcalShapeBase.h:52
virtual void fillShape(DVec &aVec) const =0
double b
Definition: hdecay.h:120
unsigned int m_indexOfMax
Definition: EcalShapeBase.h:53
double m_timeOfMax
Definition: EcalShapeBase.h:54
double a
Definition: hdecay.h:121
unsigned int m_firstIndexOverThreshold
Definition: EcalShapeBase.h:51
double EcalShapeBase::derivative ( double  time) const

Definition at line 149 of file EcalShapeBase.cc.

References cmsHarvester::index, kNBinsStored, m_derivPtr, and timeIndex().

150 {
151  const unsigned int index ( timeIndex( aTime ) ) ;
152  return ( 0 == m_derivPtr ||
153  kNBinsStored == index ? 0 : (*m_derivPtr)[ index ] ) ;
154 }
DVec * m_derivPtr
Definition: EcalShapeBase.h:56
unsigned int timeIndex(double aTime) const
virtual void EcalShapeBase::fillShape ( DVec aVec) const
protectedpure virtual

Implemented in APDShape, EBShape, and EEShape.

Referenced by buildMe().

double EcalShapeBase::operator() ( double  aTime) const
virtual

Implements CaloVShape.

Definition at line 140 of file EcalShapeBase.cc.

References cmsHarvester::index, kNBinsStored, m_shape, and timeIndex().

141 {
142  // return pulse amplitude for request time in ns
143 
144  const unsigned int index ( timeIndex( aTime ) ) ;
145  return ( kNBinsStored == index ? 0 : m_shape[ index ] ) ;
146 }
unsigned int timeIndex(double aTime) const
virtual double EcalShapeBase::threshold ( ) const
pure virtual

Implemented in APDShape, EBShape, and EEShape.

Referenced by buildMe().

unsigned int EcalShapeBase::timeIndex ( double  aTime) const
protected

Definition at line 124 of file EcalShapeBase.cc.

References cond::ecalcond::bad(), cmsHarvester::index, kNBinsPerNSec, kNBinsStored, LogDebug, and m_firstIndexOverThreshold.

Referenced by derivative(), and operator()().

125 {
126  const int index ( m_firstIndexOverThreshold +
127  (unsigned int) ( aTime*kNBinsPerNSec + 0.5 ) ) ;
128 
129  const bool bad ( (int) m_firstIndexOverThreshold > index ||
130  (int) kNBinsStored <= index ) ;
131 
132  if( (int) kNBinsStored <= index )
133  {
134  LogDebug("EcalShapeBase") << " ECAL MGPA shape requested for out of range time " << aTime ;
135  }
136  return ( bad ? kNBinsStored : (unsigned int) index ) ;
137 }
#define LogDebug(id)
int bad(Items const &cont)
unsigned int m_firstIndexOverThreshold
Definition: EcalShapeBase.h:51
double EcalShapeBase::timeOfMax ( ) const

Definition at line 33 of file EcalShapeBase.cc.

References m_timeOfMax.

Referenced by EcalTPGParamBuilder::computeWeights(), and timeToRise().

34 {
35  return m_timeOfMax ;
36 }
double m_timeOfMax
Definition: EcalShapeBase.h:54
double EcalShapeBase::timeOfThr ( ) const

Definition at line 27 of file EcalShapeBase.cc.

References m_firstTimeOverThreshold.

Referenced by EcalTPGParamBuilder::computeWeights(), and timeToRise().

28 {
30  }
double m_firstTimeOverThreshold
Definition: EcalShapeBase.h:52
double EcalShapeBase::timeToRise ( ) const
virtual

Implements CaloVShape.

Definition at line 39 of file EcalShapeBase.cc.

References timeOfMax(), and timeOfThr().

Referenced by EcalDccWeightBuilder::computeWeights(), and EcalUncalibRecHitRecChi2Algo< C >::EcalUncalibRecHitRecChi2Algo().

40 {
41  return timeOfMax() - timeOfThr() ;
42 }
double timeOfThr() const
double timeOfMax() const

Member Data Documentation

DVec* EcalShapeBase::m_derivPtr
private

Definition at line 56 of file EcalShapeBase.h.

Referenced by buildMe(), derivative(), and ~EcalShapeBase().

unsigned int EcalShapeBase::m_firstIndexOverThreshold
private

Definition at line 51 of file EcalShapeBase.h.

Referenced by buildMe(), and timeIndex().

double EcalShapeBase::m_firstTimeOverThreshold
private

Definition at line 52 of file EcalShapeBase.h.

Referenced by buildMe(), and timeOfThr().

unsigned int EcalShapeBase::m_indexOfMax
private

Definition at line 53 of file EcalShapeBase.h.

Referenced by buildMe().

DVec EcalShapeBase::m_shape
private

Definition at line 55 of file EcalShapeBase.h.

Referenced by buildMe(), and operator()().

double EcalShapeBase::m_timeOfMax
private

Definition at line 54 of file EcalShapeBase.h.

Referenced by buildMe(), and timeOfMax().

const double EcalShapeBase::qNSecPerBin = 1./(1.*kNBinsPerNSec)
static

Definition at line 39 of file EcalShapeBase.h.

Referenced by buildMe().