CMS 3D CMS Logo

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

#include <CaloSamples.h>

Public Member Functions

 CaloSamples ()
 
 CaloSamples (const DetId &id, int size)
 
 CaloSamples (const DetId &id, int size, int preciseSize)
 
DetId id () const
 get the (generic) id More...
 
bool isBlank () const
 
CaloSamplesoffsetTime (double offset)
 shift all the samples by a time, in ns, interpolating More...
 
CaloSamplesoperator*= (double value)
 scale all samples More...
 
CaloSamplesoperator+= (double value)
 add a value to all samples More...
 
CaloSamplesoperator+= (const CaloSamples &other)
 
double & operator[] (int i)
 mutable operator to access samples More...
 
double operator[] (int i) const
 const operator to access samples More...
 
float preciseAt (int i) const
 const function to access precise samples More...
 
float & preciseAtMod (int i)
 mutable function to access precise samples More...
 
float preciseDeltaT () const
 
int precisePresamples () const
 
int preciseSize () const
 get the size More...
 
int presamples () const
 access presample information More...
 
void resetPrecise ()
 
CaloSamplesscale (double value)
 multiply each item by this value More...
 
void setBlank ()
 
void setDetId (DetId detId)
 
void setPrecise (int precisePresamples, float deltaT)
 
void setPresamples (int pre)
 set presample information More...
 
void setSize (unsigned int size)
 
int size () const
 get the size More...
 

Static Public Attributes

static const int MAXSAMPLES =10
 

Private Attributes

double data_ [MAXSAMPLES]
 
float deltaTprecise_
 
DetId id_
 
std::vector< float > preciseData_
 
int precisePresamples_
 
int preciseSize_
 
int presamples_
 
int size_
 

Detailed Description

Class which represents the charge/voltage measurements of an event/channel with the ADC decoding performed.

Definition at line 14 of file CaloSamples.h.

Constructor & Destructor Documentation

CaloSamples::CaloSamples ( )

Definition at line 8 of file CaloSamples.cc.

References setBlank().

int precisePresamples_
Definition: CaloSamples.h:80
void setBlank()
Definition: CaloSamples.cc:100
int presamples_
Definition: CaloSamples.h:77
int preciseSize_
Definition: CaloSamples.h:80
CaloSamples::CaloSamples ( const DetId id,
int  size 
)
explicit

Definition at line 10 of file CaloSamples.cc.

References setBlank().

10  :
11  id_ ( id ) ,
12  size_ ( size ) ,
13  presamples_ ( 0 ) ,
14  deltaTprecise_ (0.0f) ,
15  preciseSize_(0),
16  precisePresamples_(0) { setBlank() ; }
int precisePresamples_
Definition: CaloSamples.h:80
void setBlank()
Definition: CaloSamples.cc:100
double f[11][100]
int size() const
get the size
Definition: CaloSamples.h:24
float deltaTprecise_
Definition: CaloSamples.h:78
int presamples_
Definition: CaloSamples.h:77
int preciseSize_
Definition: CaloSamples.h:80
CaloSamples::CaloSamples ( const DetId id,
int  size,
int  preciseSize 
)
explicit

Definition at line 18 of file CaloSamples.cc.

References setBlank().

18  :
19  id_ ( id ) ,
20  size_ ( size ) ,
21  presamples_ ( 0 ) ,
22  deltaTprecise_ (0.0f) ,
23  preciseSize_(presize),
24  precisePresamples_(0) { setBlank() ; }
int precisePresamples_
Definition: CaloSamples.h:80
void setBlank()
Definition: CaloSamples.cc:100
double f[11][100]
int size() const
get the size
Definition: CaloSamples.h:24
float deltaTprecise_
Definition: CaloSamples.h:78
int presamples_
Definition: CaloSamples.h:77
int preciseSize_
Definition: CaloSamples.h:80

Member Function Documentation

DetId CaloSamples::id ( ) const
inline
bool CaloSamples::isBlank ( ) const

Definition at line 90 of file CaloSamples.cc.

References data_, alignCSCRings::e, edm::false, i, MAXSAMPLES, and funct::true.

Referenced by CaloHitRespoNew::findSignal().

91 {
92  for( int i ( 0 ) ; i != MAXSAMPLES ; ++i )
93  {
94  if( 1.e-6 < fabs( data_[i] ) ) return false ;
95  }
96  return true ;
97 }
int i
Definition: DBlmapReader.cc:9
static const int MAXSAMPLES
Definition: CaloSamples.h:73
volatile std::atomic< bool > shutdown_flag false
double data_[MAXSAMPLES]
Definition: CaloSamples.h:76
CaloSamples & CaloSamples::offsetTime ( double  offset)

shift all the samples by a time, in ns, interpolating

Definition at line 69 of file CaloSamples.cc.

References data, data_, f, i, MAXSAMPLES, hltrates_dqm_sourceclient-live_cfg::offset, and lumiQTWidget::t.

70 {
71  double data[MAXSAMPLES];
72  for( int i ( 0 ) ; i != MAXSAMPLES ; ++i )
73  {
74  double t = i*25. - offset;
75  int firstbin = floor(t/25.);
76  double f = t/25. - firstbin;
77  int nextbin = firstbin + 1;
78  double v1 = (firstbin < 0 || firstbin >= MAXSAMPLES) ? 0. : data_[firstbin];
79  double v2 = (nextbin < 0 || nextbin >= MAXSAMPLES) ? 0. : data_[nextbin];
80  data[i] = (v1*(1.-f)+v2*f);
81  }
82  for( int i ( 0 ) ; i != MAXSAMPLES ; ++i )
83  {
84  data_[i] = data[i];
85  }
86  return (*this);
87 }
int i
Definition: DBlmapReader.cc:9
static const int MAXSAMPLES
Definition: CaloSamples.h:73
double f[11][100]
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
double data_[MAXSAMPLES]
Definition: CaloSamples.h:76
CaloSamples& CaloSamples::operator*= ( double  value)
inline

scale all samples

Definition at line 43 of file CaloSamples.h.

References scale().

43 { return scale(value); }
CaloSamples & scale(double value)
multiply each item by this value
Definition: CaloSamples.cc:35
CaloSamples & CaloSamples::operator+= ( double  value)

add a value to all samples

Definition at line 42 of file CaloSamples.cc.

References data_, deltaTprecise_, i, j, MAXSAMPLES, and preciseData_.

42  {
43  for (int i=0; i<MAXSAMPLES; i++) data_[i]+=value;
44  for (std::vector<float>::iterator j=preciseData_.begin() ; j!=preciseData_.end(); ++j)
45  (*j)+=value*deltaTprecise_/25.0; // note that the scale is conserved!
46  return (*this);
47 }
int i
Definition: DBlmapReader.cc:9
static const int MAXSAMPLES
Definition: CaloSamples.h:73
std::vector< float > preciseData_
Definition: CaloSamples.h:79
int j
Definition: DBlmapReader.cc:9
float deltaTprecise_
Definition: CaloSamples.h:78
double data_[MAXSAMPLES]
Definition: CaloSamples.h:76
CaloSamples & CaloSamples::operator+= ( const CaloSamples other)

Definition at line 49 of file CaloSamples.cc.

References data_, i, preciseData_, preciseSize_, presamples_, resetPrecise(), and size_.

49  {
50  if(size_ != other.size_ ||
51  presamples_ != other.presamples_ ||
52  preciseSize_ != other.preciseSize_) {
53  edm::LogError("CaloHitResponse") << "Mismatched calo signals ";
54  }
55  int i;
56  for(i = 0; i < size_; ++i) {
57  data_[i] += other.data_[i];
58  }
59  if ( preciseData_.size() == 0 && other.preciseData_.size() > 0 ) resetPrecise();
60  if ( other.preciseData_.size() > 0 ) {
61  for(i = 0; i < preciseSize_; ++i) {
62  preciseData_[i] += other.preciseData_[i];
63  }
64  }
65  return *this;
66 }
int i
Definition: DBlmapReader.cc:9
void resetPrecise()
Definition: CaloSamples.cc:27
std::vector< float > preciseData_
Definition: CaloSamples.h:79
int presamples_
Definition: CaloSamples.h:77
double data_[MAXSAMPLES]
Definition: CaloSamples.h:76
int preciseSize_
Definition: CaloSamples.h:80
double& CaloSamples::operator[] ( int  i)
inline

mutable operator to access samples

Definition at line 26 of file CaloSamples.h.

References data_, and i.

26 { return data_[i]; }
int i
Definition: DBlmapReader.cc:9
double data_[MAXSAMPLES]
Definition: CaloSamples.h:76
double CaloSamples::operator[] ( int  i) const
inline

const operator to access samples

Definition at line 28 of file CaloSamples.h.

References data_, and i.

28 { return data_[i]; }
int i
Definition: DBlmapReader.cc:9
double data_[MAXSAMPLES]
Definition: CaloSamples.h:76
float CaloSamples::preciseAt ( int  i) const
inline

const function to access precise samples

Definition at line 33 of file CaloSamples.h.

References i, and preciseData_.

Referenced by HcalTDC::timing().

33 { return preciseData_[i]; }
int i
Definition: DBlmapReader.cc:9
std::vector< float > preciseData_
Definition: CaloSamples.h:79
float& CaloSamples::preciseAtMod ( int  i)
inline

mutable function to access precise samples

Definition at line 31 of file CaloSamples.h.

References i, and preciseData_.

Referenced by HcalSiPMHitResponse::differentiatePreciseSamples(), and HcalSiPMHitResponse::makeSiPMSignal().

31 { return preciseData_[i]; }
int i
Definition: DBlmapReader.cc:9
std::vector< float > preciseData_
Definition: CaloSamples.h:79
float CaloSamples::preciseDeltaT ( ) const
inline

Definition at line 64 of file CaloSamples.h.

References deltaTprecise_.

Referenced by HcalSiPMHitResponse::differentiatePreciseSamples().

64 { return deltaTprecise_; }
float deltaTprecise_
Definition: CaloSamples.h:78
int CaloSamples::precisePresamples ( ) const
inline

Definition at line 63 of file CaloSamples.h.

References precisePresamples_.

Referenced by setPrecise().

63 { return precisePresamples_; }
int precisePresamples_
Definition: CaloSamples.h:80
int CaloSamples::preciseSize ( ) const
inline

get the size

Definition at line 62 of file CaloSamples.h.

References preciseData_, and preciseSize_.

Referenced by HcalSiPMHitResponse::differentiatePreciseSamples(), HcalSiPMHitResponse::makeSiPMSignal(), operator<<(), and HcalTDC::timing().

62 { if ( preciseData_.size() ==0 ) return 0; return preciseSize_; }
std::vector< float > preciseData_
Definition: CaloSamples.h:79
int preciseSize_
Definition: CaloSamples.h:80
int CaloSamples::presamples ( ) const
inline
void CaloSamples::resetPrecise ( )

Definition at line 27 of file CaloSamples.cc.

References preciseData_, and preciseSize_.

Referenced by HcalSiPMHitResponse::makeSiPMSignal(), and operator+=().

27  {
28  preciseData_.resize(preciseSize_,0);
29 }
std::vector< float > preciseData_
Definition: CaloSamples.h:79
int preciseSize_
Definition: CaloSamples.h:80
CaloSamples & CaloSamples::scale ( double  value)
void CaloSamples::setBlank ( )

Definition at line 100 of file CaloSamples.cc.

References data_, lumiContext::fill, MAXSAMPLES, and preciseData_.

Referenced by CaloSamples().

101 {
102  std::fill( data_ , data_ + MAXSAMPLES, (double)0.0 ) ;
103  std::fill( preciseData_.begin() , preciseData_.end(), (double)0.0 ) ;
104 }
string fill
Definition: lumiContext.py:319
static const int MAXSAMPLES
Definition: CaloSamples.h:73
std::vector< float > preciseData_
Definition: CaloSamples.h:79
double data_[MAXSAMPLES]
Definition: CaloSamples.h:76
void CaloSamples::setDetId ( DetId  detId)
inline

Definition at line 53 of file CaloSamples.h.

References id_.

53 { id_ = detId ; }
void CaloSamples::setPrecise ( int  precisePresamples,
float  deltaT 
)
inline

Definition at line 66 of file CaloSamples.h.

References deltaTprecise_, precisePresamples(), and precisePresamples_.

66  {
68  deltaTprecise_=deltaT;
69  }
int precisePresamples_
Definition: CaloSamples.h:80
int precisePresamples() const
Definition: CaloSamples.h:63
float deltaTprecise_
Definition: CaloSamples.h:78
void CaloSamples::setPresamples ( int  pre)
void CaloSamples::setSize ( unsigned int  size)
inline

Definition at line 55 of file CaloSamples.h.

References size(), and size_.

55 { size_ = size ; }
int size() const
get the size
Definition: CaloSamples.h:24
int CaloSamples::size ( void  ) const
inline

Member Data Documentation

double CaloSamples::data_[MAXSAMPLES]
private

Definition at line 76 of file CaloSamples.h.

Referenced by isBlank(), offsetTime(), operator+=(), operator[](), scale(), and setBlank().

float CaloSamples::deltaTprecise_
private

Definition at line 78 of file CaloSamples.h.

Referenced by operator+=(), preciseDeltaT(), and setPrecise().

DetId CaloSamples::id_
private

Definition at line 75 of file CaloSamples.h.

Referenced by id(), and setDetId().

const int CaloSamples::MAXSAMPLES =10
static
std::vector<float> CaloSamples::preciseData_
private
int CaloSamples::precisePresamples_
private

Definition at line 80 of file CaloSamples.h.

Referenced by precisePresamples(), and setPrecise().

int CaloSamples::preciseSize_
private

Definition at line 80 of file CaloSamples.h.

Referenced by operator+=(), preciseSize(), and resetPrecise().

int CaloSamples::presamples_
private

Definition at line 77 of file CaloSamples.h.

Referenced by operator+=(), presamples(), and setPresamples().

int CaloSamples::size_
private

Definition at line 77 of file CaloSamples.h.

Referenced by operator+=(), setSize(), and size().