test
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 Attributes
cond::service::DTHVCheckWithHysteresis Class Reference

#include <DTHVCheckWithHysteresis.h>

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

Public Member Functions

virtual 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)
 check HV status More...
 
 DTHVCheckWithHysteresis ()
 
 DTHVCheckWithHysteresis (const edm::ParameterSet &iConfig, edm::ActivityRegistry &iAR)
 
virtual 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)
 
virtual ~DTHVCheckWithHysteresis ()
 
- 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 = 0
 

Detailed Description

Definition at line 39 of file DTHVCheckWithHysteresis.h.

Constructor & Destructor Documentation

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

Constructor

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

Definition at line 37 of file DTHVCheckWithHysteresis.cc.

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

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

Destructor

Definition at line 68 of file DTHVCheckWithHysteresis.cc.

68  {
69 }

Member Function Documentation

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 
)
virtual

check HV status

Operations

Implements DTHVAbstractCheck.

Definition at line 75 of file DTHVCheckWithHysteresis.cc.

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

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

Reimplemented from DTHVAbstractCheck.

Definition at line 207 of file DTHVCheckWithHysteresis.cc.

References oldStatusA, oldStatusC, and oldStatusS.

212  {
213 // std::cout << "set status " << rawId << " "
214 // << flagA << " " << flagC << " " << flagS << std::endl;
215  std::map<int,int>::iterator chanIter;
216  if ( ( chanIter = oldStatusA->find( rawId ) ) == oldStatusA->end() )
217  oldStatusA->insert( std::pair<int,int>( rawId, flagA ) );
218  else chanIter->second = flagA;
219  if ( ( chanIter = oldStatusC->find( rawId ) ) == oldStatusA->end() )
220  oldStatusC->insert( std::pair<int,int>( rawId, flagC ) );
221  else chanIter->second = flagC;
222  if ( ( chanIter = oldStatusS->find( rawId ) ) == oldStatusA->end() )
223  oldStatusS->insert( std::pair<int,int>( rawId, flagS ) );
224  else chanIter->second = flagS;
225  return;
226 }

Member Data Documentation

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

Definition at line 75 of file DTHVCheckWithHysteresis.h.

Referenced by checkCurrentStatus(), and DTHVCheckWithHysteresis().

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

Definition at line 74 of file DTHVCheckWithHysteresis.h.

Referenced by checkCurrentStatus(), and DTHVCheckWithHysteresis().

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

Definition at line 73 of file DTHVCheckWithHysteresis.h.

Referenced by checkCurrentStatus(), and DTHVCheckWithHysteresis().

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

Definition at line 72 of file DTHVCheckWithHysteresis.h.

Referenced by checkCurrentStatus(), and DTHVCheckWithHysteresis().

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