CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
cond::service::DTHVCheckWithHysteresis Class Reference

#include <DTHVCheckWithHysteresis.h>

Inheritance diagram for cond::service::DTHVCheckWithHysteresis:
DTHVAbstractCheck

Public Member Functions

DTHVAbstractCheck::flag checkCurrentStatus (int rawId, int type, float valueA, float valueC, float valueS, const std::map< int, timedMeasurement > &snapshotValues, const std::map< int, int > &aliasMap, const std::map< int, int > &layerMap) override
 check HV status More...
 
 DTHVCheckWithHysteresis ()
 
 DTHVCheckWithHysteresis (const edm::ParameterSet &iConfig, edm::ActivityRegistry &iAR)
 
void setStatus (int rawId, int flagA, int flagC, int flagS, const std::map< int, timedMeasurement > &snapshotValues, const std::map< int, int > &aliasMap, const std::map< int, int > &layerMap) override
 
 ~DTHVCheckWithHysteresis () override
 
- Public Member Functions inherited from DTHVAbstractCheck
 DTHVAbstractCheck ()
 
virtual void setValue (int rawId, int type, float valueA, float valueC, float valueS, const std::map< int, timedMeasurement > &snapshotValues, const std::map< int, int > &aliasMap, const std::map< int, int > &layerMap)
 
virtual ~DTHVAbstractCheck ()
 

Private Attributes

float maxCurrent
 
float * maxHV
 
float * minHVh
 
float * minHVl
 
std::map< int, int > * oldStatusA
 
std::map< int, int > * oldStatusC
 
std::map< int, int > * oldStatusS
 

Additional Inherited Members

- Public Types inherited from DTHVAbstractCheck
typedef std::pair< long long int, float > timedMeasurement
 check HV status More...
 
- Static Public Member Functions inherited from DTHVAbstractCheck
static bool chkFlag (const DTHVAbstractCheck::flag &f)
 
static bool compare (const DTHVAbstractCheck::flag &fl, const DTHVAbstractCheck::flag &fr)
 
static DTHVAbstractCheckgetInstance ()
 check HV status More...
 
- Static Protected Attributes inherited from DTHVAbstractCheck
static DTHVAbstractCheckinstance = nullptr
 

Detailed Description

Definition at line 40 of file DTHVCheckWithHysteresis.h.

Constructor & Destructor Documentation

◆ DTHVCheckWithHysteresis() [1/2]

cond::service::DTHVCheckWithHysteresis::DTHVCheckWithHysteresis ( )

Constructor

◆ DTHVCheckWithHysteresis() [2/2]

DTHVCheckWithHysteresis::DTHVCheckWithHysteresis ( const edm::ParameterSet iConfig,
edm::ActivityRegistry iAR 
)

Definition at line 37 of file DTHVCheckWithHysteresis.cc.

37  {
38  if (instance == nullptr) {
39  std::cout << "create DTHVCheckWithHysteresis" << std::endl;
40  minHVl = new float[4];
41  minHVh = new float[4];
42  maxHV = new float[4];
43  minHVl[0] = 3000.0;
44  minHVl[1] = 3000.0;
45  minHVl[2] = 1200.0;
46  minHVl[3] = 600.0;
47  minHVh[0] = 3500.0;
48  minHVh[1] = 3500.0;
49  minHVh[2] = 1700.0;
50  minHVh[3] = 1100.0;
51  maxHV[0] = 4000.0;
52  maxHV[1] = 4000.0;
53  maxHV[2] = 2200.0;
54  maxHV[3] = 1600.0;
55  maxCurrent = 30.0;
56  oldStatusA = new std::map<int, int>;
57  oldStatusC = new std::map<int, int>;
58  oldStatusS = new std::map<int, int>;
59  instance = this;
60  }
61  }

References gather_cfg::cout, DTHVAbstractCheck::instance, maxCurrent, maxHV, minHVh, minHVl, oldStatusA, oldStatusC, and oldStatusS.

◆ ~DTHVCheckWithHysteresis()

DTHVCheckWithHysteresis::~DTHVCheckWithHysteresis ( )
override

Destructor

Definition at line 66 of file DTHVCheckWithHysteresis.cc.

66 {}

Member Function Documentation

◆ checkCurrentStatus()

DTHVAbstractCheck::flag DTHVCheckWithHysteresis::checkCurrentStatus ( int  rawId,
int  type,
float  valueA,
float  valueC,
float  valueS,
const std::map< int, timedMeasurement > &  snapshotValues,
const std::map< int, int > &  aliasMap,
const std::map< int, int > &  layerMap 
)
overridevirtual

check HV status

Operations

Implements DTHVAbstractCheck.

Definition at line 72 of file DTHVCheckWithHysteresis.cc.

80  {
81  // find all values for this channel
82  // ind dpid = 0;
83  // std::map<int,int>::const_iterator lpartIter;
84  // std::map<int,int>::const_iterator lpartIend = layerMap.end();
85  // if ( ( layerIter = layerMap.find( chp0 ) ) != layerIend )
86  // dpid = layerIter.second;
87  // std::map<int,timedMeasurement>::const_iterator snapIter;
88  // std::map<int,timedMeasurement>::const_iterator snapIend =
89  // snapshotValues.end();
90  // float val1 = -999999.0;
91  // float val2 = -999999.0;
92  // int chan = dpId * 10;
93  // if ( ( snapIter = snapshotValues.find( chan + 1 ) ) != snapIend )
94  // val1 = snapIter->second.second;
95  // if ( ( snapIter = snapshotValues.find( chan + 2 ) ) != snapIend )
96  // val2 = snapIter->second.second;
97 
98  // find dp identifier for all channels in this layer
99  // DTLayerId lay = chlId.layerId();
100  // int chp0 = DTWireId( lay, 10 ).rawId();
101  // int chp1 = DTWireId( lay, 11 ).rawId();
102  // int chp2 = DTWireId( lay, 12 ).rawId();
103  // int chp3 = DTWireId( lay, 13 ).rawId();
104  // ind dpi0 = 0;
105  // ind dpi1 = 0;
106  // ind dpi2 = 0;
107  // ind dpi3 = 0;
108  // std::map<int,int>::const_iterator layerIter;
109  // std::map<int,int>::const_iterator layerIend = layerMap.end();
110  // if ( ( layerIter = layerMap.find( chp0 ) ) != layerIend )
111  // dpi0 = layerIter.second;
112  // if ( ( layerIter = layerMap.find( chp1 ) ) != layerIend )
113  // dpi1 = layerIter.second;
114  // if ( ( layerIter = layerMap.find( chp2 ) ) != layerIend )
115  // dpi2 = layerIter.second;
116  // if ( ( layerIter = layerMap.find( chp3 ) ) != layerIend )
117  // dpi3 = layerIter.second;
118 
119  float minHV[4];
120  // DTLayerId lay = chlId.layerId();
121  // int chp0 = DTWireId( lay, 10 ).rawId();
122  // int chp1 = DTWireId( lay, 11 ).rawId();
123  // int chp2 = DTWireId( lay, 12 ).rawId();
124  // int chp3 = DTWireId( lay, 13 ).rawId();
125 
126  DTWireId chlId(rawId);
127  int part = chlId.wire() - 10;
129  flag.a = flag.c = flag.s = 0;
130 
131  std::map<int, int>::iterator chanIter;
132  if (((chanIter = oldStatusA->find(rawId)) != oldStatusA->end()) && (chanIter->second % 2))
133  minHV[part] = minHVh[part];
134  else
135  minHV[part] = minHVl[part];
136  if (((chanIter = oldStatusS->find(rawId)) != oldStatusS->end()) && (chanIter->second % 2))
137  minHV[2] = minHVh[2];
138  else
139  minHV[2] = minHVl[2];
140  if (((chanIter = oldStatusC->find(rawId)) != oldStatusC->end()) && (chanIter->second % 2))
141  minHV[3] = minHVh[3];
142  else
143  minHV[3] = minHVl[3];
144 
145  if (type == 1) {
146  if (valueA < minHV[part])
147  flag.a = 1;
148  if (valueA > maxHV[part])
149  flag.a = 2;
150  if (valueS < minHV[2])
151  flag.s = 1;
152  if (valueS > maxHV[2])
153  flag.s = 2;
154  if (valueC < minHV[3])
155  flag.c = 1;
156  if (valueC > maxHV[3])
157  flag.c = 2;
158  if ((chanIter = oldStatusA->find(rawId)) == oldStatusA->end())
159  oldStatusA->insert(std::pair<int, int>(rawId, flag.a));
160  else
161  chanIter->second = flag.a;
162  if ((chanIter = oldStatusC->find(rawId)) == oldStatusC->end())
163  oldStatusC->insert(std::pair<int, int>(rawId, flag.c));
164  else
165  chanIter->second = flag.c;
166  if ((chanIter = oldStatusS->find(rawId)) == oldStatusS->end())
167  oldStatusS->insert(std::pair<int, int>(rawId, flag.s));
168  else
169  chanIter->second = flag.s;
170  }
171  if (type == 2) {
172  float voltA = 0.0;
173  float voltS = 0.0;
174  float voltC = 0.0;
175  DTLayerId lay = chlId.layerId();
176  int l_p = chlId.wire();
177  DTWireId chA(lay, l_p);
178  DTWireId chS(lay, 12);
179  DTWireId chC(lay, 13);
180 
181  std::map<int, int>::const_iterator layerIter;
182  std::map<int, int>::const_iterator layerIend = layerMap.end();
183  std::map<int, timedMeasurement>::const_iterator snapIter;
184  std::map<int, timedMeasurement>::const_iterator snapIend = snapshotValues.end();
185  int chan;
186  if ((layerIter = layerMap.find(chA.rawId())) != layerIend) {
187  chan = (layerIter->second * 10) + l_p;
188  if ((snapIter = snapshotValues.find(chan)) != snapIend) {
189  voltA = snapIter->second.second;
190  }
191  }
192  if ((layerIter = layerMap.find(chS.rawId())) != layerIend) {
193  chan = (layerIter->second * 10) + 2;
194  if ((snapIter = snapshotValues.find(chan)) != snapIend) {
195  voltS = snapIter->second.second;
196  }
197  }
198  if ((layerIter = layerMap.find(chC.rawId())) != layerIend) {
199  chan = (layerIter->second * 10) + 3;
200  if ((snapIter = snapshotValues.find(chan)) != snapIend) {
201  voltC = snapIter->second.second;
202  }
203  }
204  if ((valueA > maxCurrent) && (voltA >= minHV[part]))
205  flag.a = 4;
206  if ((valueS > maxCurrent) && (voltS >= minHV[2]))
207  flag.s = 4;
208  if ((valueC > maxCurrent) && (voltC >= minHV[3]))
209  flag.c = 4;
210  }
211 
212  return flag;
213  }

References DTHVAbstractCheck::flag::a, DTHVAbstractCheck::flag::c, officialStyle::chan, RemoveAddSevLevel::flag, DTWireId::layerId(), maxCurrent, maxHV, minHVh, minHVl, oldStatusA, oldStatusC, oldStatusS, DetId::rawId(), DTHVAbstractCheck::flag::s, and DTWireId::wire().

◆ setStatus()

void DTHVCheckWithHysteresis::setStatus ( int  rawId,
int  flagA,
int  flagC,
int  flagS,
const std::map< int, timedMeasurement > &  snapshotValues,
const std::map< int, int > &  aliasMap,
const std::map< int, int > &  layerMap 
)
overridevirtual

Reimplemented from DTHVAbstractCheck.

Definition at line 215 of file DTHVCheckWithHysteresis.cc.

221  {
222  // std::cout << "set status " << rawId << " "
223  // << flagA << " " << flagC << " " << flagS << std::endl;
224  std::map<int, int>::iterator chanIter;
225  if ((chanIter = oldStatusA->find(rawId)) == oldStatusA->end())
226  oldStatusA->insert(std::pair<int, int>(rawId, flagA));
227  else
228  chanIter->second = flagA;
229  if ((chanIter = oldStatusC->find(rawId)) == oldStatusA->end())
230  oldStatusC->insert(std::pair<int, int>(rawId, flagC));
231  else
232  chanIter->second = flagC;
233  if ((chanIter = oldStatusS->find(rawId)) == oldStatusA->end())
234  oldStatusS->insert(std::pair<int, int>(rawId, flagS));
235  else
236  chanIter->second = flagS;
237  return;
238  }

References oldStatusA, oldStatusC, and oldStatusS.

Member Data Documentation

◆ maxCurrent

float cond::service::DTHVCheckWithHysteresis::maxCurrent
private

Definition at line 75 of file DTHVCheckWithHysteresis.h.

Referenced by checkCurrentStatus(), and DTHVCheckWithHysteresis().

◆ maxHV

float* cond::service::DTHVCheckWithHysteresis::maxHV
private

Definition at line 74 of file DTHVCheckWithHysteresis.h.

Referenced by checkCurrentStatus(), and DTHVCheckWithHysteresis().

◆ minHVh

float* cond::service::DTHVCheckWithHysteresis::minHVh
private

Definition at line 73 of file DTHVCheckWithHysteresis.h.

Referenced by checkCurrentStatus(), and DTHVCheckWithHysteresis().

◆ minHVl

float* cond::service::DTHVCheckWithHysteresis::minHVl
private

Definition at line 72 of file DTHVCheckWithHysteresis.h.

Referenced by checkCurrentStatus(), and DTHVCheckWithHysteresis().

◆ oldStatusA

std::map<int, int>* cond::service::DTHVCheckWithHysteresis::oldStatusA
private

◆ oldStatusC

std::map<int, int>* cond::service::DTHVCheckWithHysteresis::oldStatusC
private

◆ oldStatusS

std::map<int, int>* cond::service::DTHVCheckWithHysteresis::oldStatusS
private
cond::service::DTHVCheckWithHysteresis::minHVl
float * minHVl
Definition: DTHVCheckWithHysteresis.h:72
cond::service::DTHVCheckWithHysteresis::oldStatusS
std::map< int, int > * oldStatusS
Definition: DTHVCheckWithHysteresis.h:78
gather_cfg.cout
cout
Definition: gather_cfg.py:144
cond::service::DTHVCheckWithHysteresis::oldStatusA
std::map< int, int > * oldStatusA
Definition: DTHVCheckWithHysteresis.h:76
part
part
Definition: HCALResponse.h:20
DTHVAbstractCheck::flag
Definition: DTHVAbstractCheck.h:48
DTWireId
Definition: DTWireId.h:12
cond::service::DTHVCheckWithHysteresis::minHVh
float * minHVh
Definition: DTHVCheckWithHysteresis.h:73
DTLayerId
Definition: DTLayerId.h:12
cond::service::DTHVCheckWithHysteresis::oldStatusC
std::map< int, int > * oldStatusC
Definition: DTHVCheckWithHysteresis.h:77
DTHVAbstractCheck::instance
static DTHVAbstractCheck * instance
Definition: DTHVAbstractCheck.h:80
cond::service::DTHVCheckWithHysteresis::maxCurrent
float maxCurrent
Definition: DTHVCheckWithHysteresis.h:75
type
type
Definition: HCALResponse.h:21
officialStyle.chan
chan
lumi = TPaveText(lowX+0.38, lowY+0.061, lowX+0.45, lowY+0.161, "NDC") lumi.SetBorderSize( 0 ) lumi....
Definition: officialStyle.py:106
RemoveAddSevLevel.flag
flag
Definition: RemoveAddSevLevel.py:116
cond::service::DTHVCheckWithHysteresis::maxHV
float * maxHV
Definition: DTHVCheckWithHysteresis.h:74