test
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 const &digi, double ped, int i=0, int j=3)
 
template<typename DIGI >
double aveQ (DIGI const &digi, double ped, int i=0, int j=3)
 
template<typename DIGI >
double aveTS (DIGI const &digi, double ped=0, int i=0, int j=3)
 
template<typename FRAME >
double aveTS_v10 (FRAME const &frame, double ped=0, int i=0, int j=3)
 
uint16_t crate2fed (int crate, int slot)
 
template<typename STDTYPE >
void dqmdebug (STDTYPE const &x, int debug=0)
 
std::pair< uint16_t, uint16_t > fed2crate (int fed)
 
std::vector< int > getFEDList (HcalElectronicsMap const *)
 
std::vector< int > getFEDuTCAList (HcalElectronicsMap const *)
 
std::vector< int > getFEDVMEList (HcalElectronicsMap const *)
 
int getTPSubDet (HcalTrigTowerDetId const &)
 
int getTPSubDetPM (HcalTrigTowerDetId const &)
 
uint32_t hash (HcalDetId const &)
 
uint32_t hash (HcalElectronicsId const &)
 
uint32_t hash (HcalTrigTowerDetId const &)
 
bool isFEDHBHE (HcalElectronicsId const &)
 
bool isFEDHF (HcalElectronicsId const &)
 
bool isFEDHO (HcalElectronicsId const &)
 
template<typename DIGI >
int maxTS (DIGI const &digi, double ped=0)
 
std::string ogtype2string (OrbitGapType type)
 
template<typename DIGI >
double sumADC (DIGI const &digi, double ped, int i=0, int j=3)
 
template<typename DIGI >
double sumQ (DIGI const &digi, double ped, int i=0, int j=3)
 
template<typename FRAME >
double sumQ_v10 (FRAME const &frame, double ped, int i=0, int j=3)
 

Function Documentation

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

Definition at line 103 of file Utilities.h.

References i, and j.

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

Definition at line 88 of file Utilities.h.

References i, and j.

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

Definition at line 65 of file Utilities.h.

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

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

66  {
67  double sumQ = 0;
68  double sumQT = 0;
69  for (int ii=i; ii<=j; ii++)
70  {
71  sumQ+=digi.sample(ii).nominal_fC()-ped;
72  sumQT +=(ii+1)*(digi.sample(ii).nominal_fC()-ped);
73  }
74 
75  return sumQ>0 ? sumQT/sumQ-1 : GARBAGE_VALUE;
76  }
int i
Definition: DBlmapReader.cc:9
int ii
Definition: cuy.py:588
int const GARBAGE_VALUE
Definition: Constants.h:215
int j
Definition: DBlmapReader.cc:9
double sumQ(DIGI const &digi, double ped, int i=0, int j=3)
Definition: Utilities.h:79
template<typename FRAME >
double hcaldqm::utilities::aveTS_v10 ( FRAME const &  frame,
double  ped = 0,
int  i = 0,
int  j = 3 
)

Definition at line 24 of file Utilities.h.

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

25  {
26  double sumQ = 0;
27  double sumQT = 0;
28  for (int ii=i; ii<=j; ii++)
29  {
30  double q = constants::adc2fC[frame[ii].adc()]-ped;
31  sumQ += q;
32  sumQT += (ii+1)*q;
33  }
34 
35  return sumQ>0 ? sumQT/sumQ-1 : GARBAGE_VALUE;
36  }
int i
Definition: DBlmapReader.cc:9
int ii
Definition: cuy.py:588
int const GARBAGE_VALUE
Definition: Constants.h:215
int j
Definition: DBlmapReader.cc:9
float adc2fC[128]
double sumQ(DIGI const &digi, double ped, int i=0, int j=3)
Definition: Utilities.h:79
uint16_t hcaldqm::utilities::crate2fed ( int  crate,
int  slot 
)

Definition at line 27 of file Utilities.cc.

References hcaldqm::constants::CRATE2FED, Exception, and hcaldqm::constants::FED_uTCA_MAX_REAL.

Referenced by getFEDList(), getFEDuTCAList(), getFEDVMEList(), hcaldqm::quantity::getLabels_FED(), hcaldqm::quantity::getLabels_FEDuTCA(), hcaldqm::quantity::getLabels_FEDuTCASlot(), hcaldqm::quantity::FEDQuantity::getValue(), hcaldqm::quantity::getValue_FED(), hcaldqm::quantity::getValue_FEDuTCA(), isFEDHBHE(), isFEDHF(), hcaldqm::hashfunctions::name_FED(), hcaldqm::hashfunctions::name_FEDSlot(), and hcaldqm::hashfunctions::name_FEDSpigot().

28  {
29  // for the details see Constants.h
31  throw cms::Exception("HCALDQM")
32  << "crate2fed::crate index is out of range "
33  << crate;
34  int fed = constants::CRATE2FED[crate];
35  if (slot > 6 && (crate == 22 || crate == 29 || crate == 32)) //needed to handle dual fed readout
36  ++fed;
37 
38  return fed;
39  }
uint16_t const CRATE2FED[50]
Definition: Constants.h:38
int const FED_uTCA_MAX_REAL
Definition: Constants.h:30
template<typename STDTYPE >
void hcaldqm::utilities::dqmdebug ( STDTYPE const &  x,
int  debug = 0 
)

Definition at line 112 of file Utilities.h.

References gather_cfg::cout, and debug.

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

Definition at line 13 of file Utilities.cc.

References Exception, hcaldqm::constants::FED2CRATE, hcaldqm::constants::FED_uTCA_MAX_REAL, and hcaldqm::constants::SLOT_uTCA_MIN.

Referenced by RawTask::_process(), hcaldqm::DQHarvester::beginRun(), hcaldqm::DQClient::beginRun(), PedestalTask::bookHistograms(), TPTask::bookHistograms(), RawTask::bookHistograms(), RecHitTask::bookHistograms(), DigiPhase1Task::bookHistograms(), DigiTask::bookHistograms(), hcaldqm::DQTask::bookHistograms(), hcaldqm::quantity::getEid_FED(), hcaldqm::quantity::getEid_FEDuTCA(), hcaldqm::hashfunctions::hash_FED(), hcaldqm::hashfunctions::hash_FEDSlot(), and hcaldqm::hashfunctions::hash_FEDSpigot().

14  {
15  fed-=1100;
17  throw cms::Exception("HCALDQM")
18  << "fed2crate::fed index is out of range "
19  << fed;
20 
21  // uTCA Crate is split in half
22  uint16_t slot = fed%2==0 ? SLOT_uTCA_MIN : SLOT_uTCA_MIN+6;
23  return std::make_pair<uint16_t const, uint16_t const>((uint16_t const)constants::FED2CRATE[fed],
24  (uint16_t const)slot);
25  }
uint16_t const FED2CRATE[FED_uTCA_MAX_REAL]
Definition: Constants.h:31
int const FED_uTCA_MAX_REAL
Definition: Constants.h:30
int const SLOT_uTCA_MIN
Definition: Constants.h:72
std::vector< int > hcaldqm::utilities::getFEDList ( HcalElectronicsMap const *  emap)

Definition at line 54 of file Utilities.cc.

References HcalElectronicsMap::allElectronicsIdPrecision(), crate2fed(), hcaldqm::constants::FED_VME_MIN, and gen::n.

Referenced by hcaldqm::DQHarvester::beginRun(), hcaldqm::DQClient::beginRun(), DigiComparisonTask::bookHistograms(), TPComparisonTask::bookHistograms(), PedestalTask::bookHistograms(), TPTask::bookHistograms(), RawTask::bookHistograms(), RecHitTask::bookHistograms(), DigiPhase1Task::bookHistograms(), and DigiTask::bookHistograms().

55  {
56  std::vector<int> vfeds;
57  std::vector<HcalElectronicsId> vids =
58  emap->allElectronicsIdPrecision();
59  for (std::vector<HcalElectronicsId>::const_iterator
60  it=vids.begin(); it!=vids.end(); ++it)
61  {
62  int fed = it->isVMEid()?it->dccid()+FED_VME_MIN:
63  crate2fed(it->crateId(),it->slot());
64  uint32_t n=0;
65  for (std::vector<int>::const_iterator jt=vfeds.begin();
66  jt!=vfeds.end(); ++jt)
67  if (fed==*jt)
68  break;
69  else
70  n++;
71  if (n==vfeds.size())
72  vfeds.push_back(fed);
73  }
74 
75  std::sort(vfeds.begin(), vfeds.end());
76  return vfeds;
77  }
uint16_t crate2fed(int crate, int slot)
Definition: Utilities.cc:27
int const FED_VME_MIN
Definition: Constants.h:47
std::vector< int > hcaldqm::utilities::getFEDuTCAList ( HcalElectronicsMap const *  emap)

Definition at line 104 of file Utilities.cc.

References HcalElectronicsMap::allElectronicsIdPrecision(), crate2fed(), hcaldqm::constants::FED_VME_MIN, and gen::n.

Referenced by DigiComparisonTask::bookHistograms(), TPComparisonTask::bookHistograms(), PedestalTask::bookHistograms(), TPTask::bookHistograms(), RawTask::bookHistograms(), RecHitTask::bookHistograms(), DigiTask::bookHistograms(), and DigiPhase1Task::bookHistograms().

105  {
106  std::vector<int> vfeds;
107  std::vector<HcalElectronicsId> vids =
108  emap->allElectronicsIdPrecision();
109  for (std::vector<HcalElectronicsId>::const_iterator
110  it=vids.begin(); it!=vids.end(); ++it)
111  {
112  if (it->isVMEid())
113  continue;
114  int fed = it->isVMEid()?it->dccid()+FED_VME_MIN:
115  crate2fed(it->crateId(),it->slot());
116  uint32_t n=0;
117  for (std::vector<int>::const_iterator jt=vfeds.begin();
118  jt!=vfeds.end(); ++jt)
119  if (fed==*jt)
120  break;
121  else
122  n++;
123  if (n==vfeds.size())
124  vfeds.push_back(fed);
125  }
126 
127  std::sort(vfeds.begin(), vfeds.end());
128  return vfeds;
129  }
uint16_t crate2fed(int crate, int slot)
Definition: Utilities.cc:27
int const FED_VME_MIN
Definition: Constants.h:47
std::vector< int > hcaldqm::utilities::getFEDVMEList ( HcalElectronicsMap const *  emap)

Definition at line 78 of file Utilities.cc.

References HcalElectronicsMap::allElectronicsIdPrecision(), crate2fed(), hcaldqm::constants::FED_VME_MIN, and gen::n.

Referenced by DigiComparisonTask::bookHistograms(), TPComparisonTask::bookHistograms(), PedestalTask::bookHistograms(), TPTask::bookHistograms(), RawTask::bookHistograms(), RecHitTask::bookHistograms(), DigiTask::bookHistograms(), and DigiPhase1Task::bookHistograms().

79  {
80  std::vector<int> vfeds;
81  std::vector<HcalElectronicsId> vids =
82  emap->allElectronicsIdPrecision();
83  for (std::vector<HcalElectronicsId>::const_iterator
84  it=vids.begin(); it!=vids.end(); ++it)
85  {
86  if (!it->isVMEid())
87  continue;
88  int fed = it->isVMEid()?it->dccid()+FED_VME_MIN:
89  crate2fed(it->crateId(),it->slot());
90  uint32_t n=0;
91  for (std::vector<int>::const_iterator jt=vfeds.begin();
92  jt!=vfeds.end(); ++jt)
93  if (fed==*jt)
94  break;
95  else
96  n++;
97  if (n==vfeds.size())
98  vfeds.push_back(fed);
99  }
100 
101  std::sort(vfeds.begin(), vfeds.end());
102  return vfeds;
103  }
uint16_t crate2fed(int crate, int slot)
Definition: Utilities.cc:27
int const FED_VME_MIN
Definition: Constants.h:47
int hcaldqm::utilities::getTPSubDet ( HcalTrigTowerDetId const &  )
int hcaldqm::utilities::getTPSubDetPM ( HcalTrigTowerDetId const &  )
uint32_t hcaldqm::utilities::hash ( HcalDetId const &  did)
uint32_t hcaldqm::utilities::hash ( HcalElectronicsId const &  eid)

Definition at line 45 of file Utilities.cc.

References HcalElectronicsId::rawId().

46  {
47  return eid.rawId();
48  }
uint32_t hcaldqm::utilities::hash ( HcalTrigTowerDetId const &  tid)

Definition at line 49 of file Utilities.cc.

References DetId::rawId().

50  {
51  return tid.rawId();
52  }
bool hcaldqm::utilities::isFEDHBHE ( HcalElectronicsId const &  eid)

Definition at line 131 of file Utilities.cc.

References crate2fed(), HcalElectronicsId::crateId(), HcalElectronicsId::dccid(), hcaldqm::constants::FED_VME_MIN, HcalElectronicsId::isVMEid(), and HcalElectronicsId::slot().

Referenced by PedestalTask::_dump(), hcaldqm::RecoRunSummary::endJob(), hcaldqm::TPRunSummary::endJob(), hcaldqm::DigiRunSummary::endJob(), hcaldqm::DigiRunSummary::endLuminosityBlock(), hcaldqm::RawRunSummary::endLuminosityBlock(), TPTask::endLuminosityBlock(), RawTask::endLuminosityBlock(), and DigiTask::endLuminosityBlock().

132  {
133  if (eid.isVMEid())
134  {
135  int fed = eid.dccid()+FED_VME_MIN;
136  if (fed>=700 && fed<=717)
137  return true;
138  else
139  return false;
140  }
141  else
142  {
143  int fed = crate2fed(eid.crateId(),eid.slot());
144  if (fed>=1100 && fed<1118)
145  return true;
146  else
147  return false;
148  }
149 
150  return false;
151  }
uint16_t crate2fed(int crate, int slot)
Definition: Utilities.cc:27
int const FED_VME_MIN
Definition: Constants.h:47
bool hcaldqm::utilities::isFEDHF ( HcalElectronicsId const &  eid)

Definition at line 153 of file Utilities.cc.

References crate2fed(), HcalElectronicsId::crateId(), HcalElectronicsId::isVMEid(), and HcalElectronicsId::slot().

Referenced by PedestalTask::_dump(), hcaldqm::RecoRunSummary::endJob(), hcaldqm::TPRunSummary::endJob(), hcaldqm::DigiRunSummary::endJob(), hcaldqm::RawRunSummary::endLuminosityBlock(), hcaldqm::DigiRunSummary::endLuminosityBlock(), TPTask::endLuminosityBlock(), RawTask::endLuminosityBlock(), RecHitTask::endLuminosityBlock(), and DigiTask::endLuminosityBlock().

154  {
155  /*
156  if (eid.isVMEid())
157  {
158  int fed = eid.dccid()+FED_VME_MIN;
159  if (fed>=718 && fed<=723)
160  return true;
161  else
162  return false;
163  }*/
164 // else
165 // {
166  if (eid.isVMEid())
167  return false;
168  int fed = crate2fed(eid.crateId(),eid.slot());
169  if (fed>=1118 && fed<=1123)
170  return true;
171  else
172  return false;
173 // }
174 
175  return false;
176  }
uint16_t crate2fed(int crate, int slot)
Definition: Utilities.cc:27
bool hcaldqm::utilities::isFEDHO ( HcalElectronicsId const &  eid)

Definition at line 178 of file Utilities.cc.

References HcalElectronicsId::dccid(), hcaldqm::constants::FED_VME_MIN, and HcalElectronicsId::isVMEid().

Referenced by PedestalTask::_dump(), hcaldqm::DigiRunSummary::endJob(), hcaldqm::DigiRunSummary::endLuminosityBlock(), hcaldqm::RawRunSummary::endLuminosityBlock(), RawTask::endLuminosityBlock(), and DigiTask::endLuminosityBlock().

179  {
180  if (!eid.isVMEid())
181  return false;
182 
183  int fed = eid.dccid()+FED_VME_MIN;
184  if (fed>=724 && fed<=731)
185  return true;
186  else
187  return false;
188 
189  return false;
190  }
int const FED_VME_MIN
Definition: Constants.h:47
template<typename DIGI >
int hcaldqm::utilities::maxTS ( DIGI const &  digi,
double  ped = 0 
)

Definition at line 51 of file Utilities.h.

References i.

52  {
53  int maxTS = -1;
54  double maxQ = -100;
55  for (int i=0; i<digi.size(); i++)
56  if((digi.sample(i).nominal_fC()-ped)>maxQ)
57  {
58  maxQ = digi.sample(i).nominal_fC()-ped;
59  maxTS = i;
60  }
61  return maxTS;
62  }
int i
Definition: DBlmapReader.cc:9
int maxTS(DIGI const &digi, double ped=0)
Definition: Utilities.h:51
std::string hcaldqm::utilities::ogtype2string ( OrbitGapType  type)

Definition at line 195 of file Utilities.cc.

References hcaldqm::constants::tCalib, hcaldqm::constants::tCRF, hcaldqm::constants::tHBHEHPD, hcaldqm::constants::tHBMMega, hcaldqm::constants::tHBPMega, hcaldqm::constants::tHEMMega, hcaldqm::constants::tHEPMega, hcaldqm::constants::tHF, hcaldqm::constants::tHFRaddam, hcaldqm::constants::tHO, hcaldqm::constants::tNull, hcaldqm::constants::tPedestal, hcaldqm::constants::tSafe, and hcaldqm::constants::tZDC.

Referenced by hcaldqm::quantity::EventType::getLabels().

196  {
197  switch (type)
198  {
199  case tNull : return "Nill";
200  case tPedestal : return "Pedestal";
201  case tHFRaddam : return "HFRaddam";
202  case tHBHEHPD : return "HBHEHPD";
203  case tHO : return "HO";
204  case tHF : return "HF";
205  case tZDC : return "ZDC";
206  case tHEPMega : return "HEPMegatile";
207  case tHEMMega : return "HEMMegatile";
208  case tHBPMega : return "HBPMegatile";
209  case tHBMMega : return "HBMMegatile";
210  case tCRF : return "CRF";
211  case tCalib : return "Calib";
212  case tSafe : return "Safe";
213  default : return "Unknonw";
214  }
215  }
type
Definition: HCALResponse.h:21
template<typename DIGI >
double hcaldqm::utilities::sumADC ( DIGI const &  digi,
double  ped,
int  i = 0,
int  j = 3 
)

Definition at line 94 of file Utilities.h.

References i, cuy::ii, and j.

95  {
96  double sum = 0;
97  for (int ii=i; ii<=j; ii++)
98  sum+=digi.sample(ii).adc()-ped;
99  return sum;
100  }
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 const &  digi,
double  ped,
int  i = 0,
int  j = 3 
)

Definition at line 79 of file Utilities.h.

References i, cuy::ii, and j.

Referenced by NoCQTask::_process(), LEDTask::_process(), DigiPhase1Task::_process(), DigiTask::_process(), UMNioTask::_process(), LaserTask::_process(), aveTS(), aveTS_v10(), StripCPEgeometric::WrappedCluster::centroid(), StripCPEgeometric::WrappedCluster::eta(), and sumQ_v10().

80  {
81  double sum=0;
82  for (int ii=i; ii<=j; ii++)
83  sum+=(digi.sample(ii).nominal_fC()-ped);
84  return sum;
85  }
int i
Definition: DBlmapReader.cc:9
int ii
Definition: cuy.py:588
int j
Definition: DBlmapReader.cc:9
template<typename FRAME >
double hcaldqm::utilities::sumQ_v10 ( FRAME const &  frame,
double  ped,
int  i = 0,
int  j = 3 
)

Definition at line 39 of file Utilities.h.

References ecalMGPA::adc(), hcaldqm::constants::adc2fC, i, cuy::ii, j, and sumQ().

40  {
41  double sumQ = 0;
42  for (int ii=i; ii<=j; ii++)
43  sumQ += constants::adc2fC[frame[ii].adc()]-ped;
44  return sumQ;
45  }
int adc(sample_type sample)
get the ADC sample (12 bits)
int i
Definition: DBlmapReader.cc:9
int ii
Definition: cuy.py:588
int j
Definition: DBlmapReader.cc:9
float adc2fC[128]
double sumQ(DIGI const &digi, double ped, int i=0, int j=3)
Definition: Utilities.h:79