CMS 3D CMS Logo

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

Public Member Functions

void add_statistics (double *data, int nTS)
 
void change_status (int val)
 
bool get_average_led (double *ave, double *rms)
 
bool get_average_time (double *ave, double *rms)
 
int get_overflow ()
 
bool get_reference (double *val, double *rms)
 
int get_statistics ()
 
int get_status ()
 
int get_undeflow ()
 
 HcalDetDiagLEDData ()
 
void reset ()
 
void set_reference (float val, float rms)
 

Private Member Functions

double GetEnergy (double *data, int n)
 
double GetTime (double *data, int n=10)
 

Private Attributes

bool IsRefetence
 
double n
 
int overflow
 
float ref_led
 
float ref_rms
 
int status
 
int undeflow
 
double Xe
 
double Xt
 
double XXe
 
double XXt
 

Detailed Description

Definition at line 28 of file HcalDetDiagLEDMonitor.cc.

Constructor & Destructor Documentation

HcalDetDiagLEDData::HcalDetDiagLEDData ( )
inline

Definition at line 30 of file HcalDetDiagLEDMonitor.cc.

References IsRefetence, reset(), and status.

Member Function Documentation

void HcalDetDiagLEDData::add_statistics ( double *  data,
int  nTS 
)
inline

Definition at line 40 of file HcalDetDiagLEDMonitor.cc.

References alignCSCRings::e, GetEnergy(), GetTime(), n, overflow, tree::t, undeflow, Xe, Xt, XXe, and XXt.

Referenced by HcalDetDiagLEDMonitor::analyze().

40  {
41  double e=GetEnergy(data,nTS);
42  double t=GetTime(data,nTS);
43  if(e<20) undeflow++; else if(e>10000) overflow++; else{
44  n++; Xe+=e; XXe+=e*e; Xt+=t; XXt+=t*t;
45  }
46  }
tuple t
Definition: tree.py:139
double GetEnergy(double *data, int n)
double GetTime(double *data, int n=10)
void HcalDetDiagLEDData::change_status ( int  val)
inline

Definition at line 51 of file HcalDetDiagLEDMonitor.cc.

References status.

Referenced by HcalDetDiagLEDMonitor::CheckStatus().

51  {
52  status|=val;
53  }
bool HcalDetDiagLEDData::get_average_led ( double *  ave,
double *  rms 
)
inline

Definition at line 61 of file HcalDetDiagLEDMonitor.cc.

References n, mathSSE::sqrt(), Xe, and XXe.

Referenced by HcalDetDiagLEDMonitor::fillHistos(), and HcalDetDiagLEDMonitor::SaveReference().

61  {
62  if(n>0){ *ave=Xe/n; *rms=sqrt(XXe/n-(Xe*Xe)/(n*n));} else return false;
63  return true;
64  }
T sqrt(T t)
Definition: SSEVec.h:48
bool HcalDetDiagLEDData::get_average_time ( double *  ave,
double *  rms 
)
inline

Definition at line 65 of file HcalDetDiagLEDMonitor.cc.

References n, mathSSE::sqrt(), Xt, and XXt.

Referenced by HcalDetDiagLEDMonitor::CheckStatus(), HcalDetDiagLEDMonitor::fillHistos(), and HcalDetDiagLEDMonitor::SaveReference().

65  {
66  if(n>0){ *ave=Xt/n; *rms=sqrt(XXt/n-(Xt*Xt)/(n*n));} else return false;
67  return true;
68  }
T sqrt(T t)
Definition: SSEVec.h:48
int HcalDetDiagLEDData::get_overflow ( )
inline

Definition at line 72 of file HcalDetDiagLEDMonitor.cc.

References overflow.

Referenced by HcalDetDiagLEDMonitor::CheckStatus().

72  {
73  return overflow;
74  }
bool HcalDetDiagLEDData::get_reference ( double *  val,
double *  rms 
)
inline

Definition at line 57 of file HcalDetDiagLEDMonitor.cc.

References IsRefetence, ref_led, and ref_rms.

int HcalDetDiagLEDData::get_statistics ( )
inline

Definition at line 69 of file HcalDetDiagLEDMonitor.cc.

References n.

Referenced by HcalDetDiagLEDMonitor::CheckStatus(), and HcalDetDiagLEDMonitor::SaveReference().

69  {
70  return (int)n;
71  }
int HcalDetDiagLEDData::get_status ( )
inline

Definition at line 54 of file HcalDetDiagLEDMonitor.cc.

References status.

Referenced by HcalDetDiagLEDMonitor::SaveReference().

54  {
55  return status;
56  }
int HcalDetDiagLEDData::get_undeflow ( )
inline

Definition at line 75 of file HcalDetDiagLEDMonitor.cc.

References undeflow.

Referenced by HcalDetDiagLEDMonitor::CheckStatus().

75  {
76  return undeflow;
77  }
double HcalDetDiagLEDData::GetEnergy ( double *  data,
int  n 
)
inlineprivate

Definition at line 79 of file HcalDetDiagLEDMonitor.cc.

References j, and n.

Referenced by add_statistics().

79  {
80  int MaxI=0; double Energy,MaxE=0;
81  for(int j=0;j<n;++j) if(MaxE<data[j]){ MaxE=data[j]; MaxI=j; }
82  Energy=data[MaxI];
83  if(MaxI>0) Energy+=data[MaxI-1];
84  if(MaxI>1) Energy+=data[MaxI-2];
85  if(MaxI<(n-1)) Energy+=data[MaxI+1];
86  if(MaxI<(n-2)) Energy+=data[MaxI+2];
87  return Energy;
88  }
int j
Definition: DBlmapReader.cc:9
double HcalDetDiagLEDData::GetTime ( double *  data,
int  n = 10 
)
inlineprivate

Definition at line 89 of file HcalDetDiagLEDMonitor.cc.

References j, and n.

Referenced by add_statistics().

89  {
90  int MaxI=0; double Time=-9999,SumT=0,MaxT=-10;
91  for(int j=0;j<n;++j) if(MaxT<data[j]){ MaxT=data[j]; MaxI=j; }
92  Time=MaxI*data[MaxI];
93  SumT=data[MaxI];
94  if(MaxI>0){ Time+=(MaxI-1)*data[MaxI-1]; SumT+=data[MaxI-1]; }
95  if(MaxI<(n-1)){ Time+=(MaxI+1)*data[MaxI+1]; SumT+=data[MaxI+1]; }
96  Time=Time/SumT;
97  return Time;
98  }
int j
Definition: DBlmapReader.cc:9
void HcalDetDiagLEDData::reset ( void  )
inline
void HcalDetDiagLEDData::set_reference ( float  val,
float  rms 
)
inline

Member Data Documentation

bool HcalDetDiagLEDData::IsRefetence
private

Definition at line 102 of file HcalDetDiagLEDMonitor.cc.

Referenced by get_reference(), HcalDetDiagLEDData(), and set_reference().

double HcalDetDiagLEDData::n
private
int HcalDetDiagLEDData::overflow
private
float HcalDetDiagLEDData::ref_led
private

Definition at line 103 of file HcalDetDiagLEDMonitor.cc.

Referenced by get_reference(), and set_reference().

float HcalDetDiagLEDData::ref_rms
private

Definition at line 104 of file HcalDetDiagLEDMonitor.cc.

Referenced by get_reference(), and set_reference().

int HcalDetDiagLEDData::status
private
int HcalDetDiagLEDData::undeflow
private

Definition at line 100 of file HcalDetDiagLEDMonitor.cc.

Referenced by add_statistics(), get_undeflow(), and reset().

double HcalDetDiagLEDData::Xe
private

Definition at line 101 of file HcalDetDiagLEDMonitor.cc.

Referenced by add_statistics(), get_average_led(), and reset().

double HcalDetDiagLEDData::Xt
private

Definition at line 101 of file HcalDetDiagLEDMonitor.cc.

Referenced by add_statistics(), get_average_time(), and reset().

double HcalDetDiagLEDData::XXe
private

Definition at line 101 of file HcalDetDiagLEDMonitor.cc.

Referenced by add_statistics(), get_average_led(), and reset().

double HcalDetDiagLEDData::XXt
private

Definition at line 101 of file HcalDetDiagLEDMonitor.cc.

Referenced by add_statistics(), get_average_time(), and reset().