CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Functions
hcaldqm::utilities Namespace Reference

Functions

template<typename DIGI >
double aveADC (DIGI digi, double ped, int i=0, int j=3)
 
template<typename DIGI >
double aveQ (DIGI digi, double ped, int i=0, int j=3)
 
template<typename DIGI >
double aveTS (DIGI digi, double ped=0, int i=0, int j=3)
 
template<typename STDTYPE >
void dqmdebug (STDTYPE x, int debug=0)
 
int getFEDById (int)
 
int getIdByFED (int)
 
int getTPSubDet (HcalTrigTowerDetId const &)
 
int getTPSubDetPM (HcalTrigTowerDetId const &)
 
template<typename DIGI >
bool isError (DIGI digi)
 
template<typename DIGI >
int maxTS (DIGI digi, double ped=0)
 
template<typename DIGI >
double sumADC (DIGI digi, double ped, int i=0, int j=3)
 
template<typename DIGI >
double sumQ (DIGI digi, double ped, int i=0, int j=3)
 
bool validDetId (HcalSubdetector, int, int, int)
 
bool validDetId (HcalDetId const &)
 

Function Documentation

template<typename DIGI >
double hcaldqm::utilities::aveADC ( DIGI  digi,
double  ped,
int  i = 0,
int  j = 3 
)

Definition at line 76 of file Utilities.h.

References i, and j.

77  {
78  return sumADC<DIGI>(digi, ped, i, j)/(j-i+1);
79  }
int i
Definition: DBlmapReader.cc:9
int j
Definition: DBlmapReader.cc:9
template<typename DIGI >
double hcaldqm::utilities::aveQ ( DIGI  digi,
double  ped,
int  i = 0,
int  j = 3 
)

Definition at line 61 of file Utilities.h.

References i, and j.

62  {
63  return sumQ<DIGI>(digi, ped, i, j)/(j-i+1);
64  }
int i
Definition: DBlmapReader.cc:9
int j
Definition: DBlmapReader.cc:9
template<typename DIGI >
double hcaldqm::utilities::aveTS ( DIGI  digi,
double  ped = 0,
int  i = 0,
int  j = 3 
)

Definition at line 38 of file Utilities.h.

References hcaldqm::constants::GARBAGE_VALUE, i, cuy::ii, j, and sumQ().

Referenced by LaserTask::_process(), and LEDTask::_process().

39  {
40  double sumQ = 0;
41  double sumQT = 0;
42  for (int ii=i; ii<=j; ii++)
43  {
44  sumQ+=digi.sample(ii).nominal_fC()-ped;
45  sumQT +=(ii+1)*(digi.sample(ii).nominal_fC()-ped);
46  }
47 
48  return sumQ>0 ? sumQT/sumQ-1 : GARBAGE_VALUE;
49  }
int i
Definition: DBlmapReader.cc:9
double sumQ(DIGI digi, double ped, int i=0, int j=3)
Definition: Utilities.h:52
int ii
Definition: cuy.py:588
int const GARBAGE_VALUE
Definition: Constants.h:168
int j
Definition: DBlmapReader.cc:9
template<typename STDTYPE >
void hcaldqm::utilities::dqmdebug ( STDTYPE  x,
int  debug = 0 
)

Definition at line 111 of file Utilities.h.

References gather_cfg::cout, and debug.

112  {
113  if (debug==0)
114  return;
115  std::cout << "%MSG" << std::endl;
116  std::cout << "%MSG-d HCALDQM::" << x;
117  std::cout << std::endl;
118  }
T x() const
Cartesian x coordinate.
#define debug
Definition: HDRShower.cc:19
tuple cout
Definition: gather_cfg.py:145
int hcaldqm::utilities::getFEDById ( int  id)

Definition at line 77 of file Utilities.cc.

References hcaldqm::constants::FED_uTCA_DELTA, hcaldqm::constants::FED_uTCA_MIN, hcaldqm::constants::FED_VME_MIN, and hcaldqm::constants::FED_VME_NUM.

Referenced by RawTask::endLuminosityBlock().

78  {
79  int fed = 700;
80  if (id>=FED_VME_NUM)
82  else
83  fed = FED_VME_MIN + id;
84  return fed;
85  }
int const FED_uTCA_MIN
Definition: Constants.h:31
int const FED_VME_MIN
Definition: Constants.h:26
int const FED_uTCA_DELTA
Definition: Constants.h:34
int const FED_VME_NUM
Definition: Constants.h:29
int hcaldqm::utilities::getIdByFED ( int  fed)

Definition at line 87 of file Utilities.cc.

References hcaldqm::constants::FED_uTCA_DELTA, hcaldqm::constants::FED_uTCA_MAX, hcaldqm::constants::FED_uTCA_MIN, hcaldqm::constants::FED_VME_MAX, hcaldqm::constants::FED_VME_MIN, and hcaldqm::constants::FED_VME_NUM.

Referenced by RawTask::_process().

88  {
89  int id = 0;
90  if (fed>=FED_VME_MIN && fed<=FED_VME_MAX)
91  id = fed-FED_VME_MIN;
92  else if (fed>=FED_uTCA_MIN && fed<=FED_uTCA_MAX)
94  return id;
95  }
int const FED_uTCA_MIN
Definition: Constants.h:31
int const FED_uTCA_MAX
Definition: Constants.h:32
int const FED_VME_MIN
Definition: Constants.h:26
int const FED_uTCA_DELTA
Definition: Constants.h:34
int const FED_VME_NUM
Definition: Constants.h:29
int const FED_VME_MAX
Definition: Constants.h:27
int hcaldqm::utilities::getTPSubDet ( HcalTrigTowerDetId const &  tid)

Definition at line 58 of file Utilities.cc.

References HcalTrigTowerDetId::ietaAbs().

Referenced by TPTask::_process().

59  {
60  return tid.ietaAbs()<29 ? 0 : 1;
61  }
int hcaldqm::utilities::getTPSubDetPM ( HcalTrigTowerDetId const &  tid)

Definition at line 63 of file Utilities.cc.

References HcalTrigTowerDetId::ieta().

64  {
65  int ieta = tid.ieta();
66  if (ieta<0 && ieta>-29)
67  return 0;
68  else if (ieta>0 && ieta<29)
69  return 1;
70  else if (ieta<=-29)
71  return 2;
72  else
73  return 3;
74  return 0;
75  }
template<typename DIGI >
bool hcaldqm::utilities::isError ( DIGI  digi)

Definition at line 82 of file Utilities.h.

83  {
84  int capId = 0;
85  int lastcapId = 0;
86  bool anycapId = true;
87  bool anyerror = false;
88  bool anydv = true;
89  bool er, dv;
90  for (int its=0; its<digi.size(); its++)
91  {
92  capId = digi.sample(its).capid();
93  er= digi.sample(its).er();
94  dv = digi.sample(its).dv();
95  if (its!=0 && (lastcapId+1)%4!=capId)
96  anycapId = false;
97  lastcapId = capId;
98  if (er)
99  anyerror = true;
100  if (!dv)
101  anydv = false;
102  }
103 
104  return !anycapId || anyerror || !anydv;
105  }
template<typename DIGI >
int hcaldqm::utilities::maxTS ( DIGI  digi,
double  ped = 0 
)

Definition at line 24 of file Utilities.h.

References i.

25  {
26  int maxTS = -1;
27  double maxQ = -100;
28  for (int i=0; i<digi.size(); i++)
29  if((digi.sample(i).nominal_fC()-ped)>maxQ)
30  {
31  maxQ = digi.sample(i).nominal_fC()-ped;
32  maxTS = i;
33  }
34  return maxTS;
35  }
int i
Definition: DBlmapReader.cc:9
int maxTS(DIGI digi, double ped=0)
Definition: Utilities.h:24
template<typename DIGI >
double hcaldqm::utilities::sumADC ( DIGI  digi,
double  ped,
int  i = 0,
int  j = 3 
)

Definition at line 67 of file Utilities.h.

References i, cuy::ii, and j.

68  {
69  double sum = 0;
70  for (int ii=i; ii<=j; ii++)
71  sum+=digi.sample(ii).adc()-ped;
72  return sum;
73  }
int i
Definition: DBlmapReader.cc:9
int ii
Definition: cuy.py:588
int j
Definition: DBlmapReader.cc:9
template<typename DIGI >
double hcaldqm::utilities::sumQ ( DIGI  digi,
double  ped,
int  i = 0,
int  j = 3 
)

Definition at line 52 of file Utilities.h.

References i, cuy::ii, and j.

Referenced by LaserTask::_process(), LEDTask::_process(), DigiTask::_process(), aveTS(), StripCPEgeometric::WrappedCluster::centroid(), and StripCPEgeometric::WrappedCluster::eta().

53  {
54  double sum=0;
55  for (int ii=i; ii<=j; ii++)
56  sum+=(digi.sample(ii).nominal_fC()-ped);
57  return sum;
58  }
int i
Definition: DBlmapReader.cc:9
int ii
Definition: cuy.py:588
int j
Definition: DBlmapReader.cc:9
bool hcaldqm::utilities::validDetId ( HcalSubdetector  sub,
int  ieta,
int  iphi,
int  depth 
)

Definition at line 12 of file Utilities.cc.

References funct::abs(), HcalBarrel, HcalEndcap, HcalForward, and HcalOuter.

13  {
14  int ie(abs(ieta));
15  return ((iphi>=1) &&
16  (iphi<=72) &&
17  (depth>=1) &&
18  (ie>=1) &&
19  (((sub==HcalBarrel) &&
20  (((ie<=14) &&
21  (depth==1)) ||
22  (((ie==15) || (ie==16)) &&
23  (depth<=2)))) ||
24  ((sub==HcalEndcap) &&
25  (((ie==16) &&
26  (depth==3)) ||
27  ((ie==17) &&
28  (depth==1)) ||
29  ((ie>=18) &&
30  (ie<=20) &&
31  (depth<=2)) ||
32  ((ie>=21) &&
33  (ie<=26) &&
34  (depth<=2) &&
35  (iphi%2==1)) ||
36  ((ie==29) &&
37  (depth<=2) &&
38  (iphi%2==1)))) ||
39  ((sub==HcalOuter) &&
40  (ie<=15) &&
41  (depth==4)) ||
42  ((sub==HcalForward) &&
43  (depth<=2) &&
44  (((ie>=29) &&
45  (ie<=39) &&
46  (iphi%2==1)) ||
47  ((ie>=40) &&
48  (ie<=41) &&
49  (iphi%4==3))))));
50  }
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
bool hcaldqm::utilities::validDetId ( HcalDetId const &  did)

Definition at line 52 of file Utilities.cc.

References HcalDetId::depth(), HcalDetId::ieta(), HcalDetId::iphi(), HcalDetId::subdet(), and HcalObjRepresent::validDetId().

53  {
54  return validDetId(did.subdet(),
55  did.ieta(), did.iphi(), did.depth());
56  }
bool validDetId(HcalSubdetector sd, int ies, int ip, int dp)