CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
DTHVCheckByAbsoluteValues.cc
Go to the documentation of this file.
1 /*
2  * See header file for a description of this class.
3  *
4  * $Date: 2010/09/14 13:54:22 $
5  * $Revision: 1.5 $
6  * \author Paolo Ronchese INFN Padova
7  *
8  */
9 
10 //-----------------------
11 // This Class' Header --
12 //-----------------------
14 
15 //-------------------------------
16 // Collaborating Class Headers --
17 //-------------------------------
21 
22 //---------------
23 // C++ Headers --
24 //---------------
25 #include <iostream>
26 
27 namespace cond { namespace service {
28 
29 //-------------------
30 // Initializations --
31 //-------------------
32 
33 
34 //----------------
35 // Constructors --
36 //----------------
38  const edm::ParameterSet & iConfig,
39  edm::ActivityRegistry & iAR ) {
40  if ( instance == 0 ) {
41  std::cout << "create DTHVCheckByAbsoluteValues" << std::endl;
42  minHV = new float[4];
43  maxHV = new float[4];
44 // minHV[0] = 3500.0;
45 // minHV[1] = 3500.0;
46 // minHV[2] = 1400.0;
47 // minHV[3] = 800.0;
48  minHV[0] = 3500.0;
49  minHV[1] = 3500.0;
50  minHV[2] = 1700.0;
51  minHV[3] = 1100.0;
52  maxHV[0] = 4000.0;
53  maxHV[1] = 4000.0;
54  maxHV[2] = 2200.0;
55  maxHV[3] = 1600.0;
56  maxCurrent = 30.0;
57  instance = this;
58  }
59 }
60 
61 //--------------
62 // Destructor --
63 //--------------
65 }
66 
67 //--------------
68 // Operations --
69 //--------------
71  int rawId, int type,
72  float valueA, float valueC, float valueS,
73  const std::map<int,timedMeasurement>& snapshotValues,
74  const std::map<int,int>& aliasMap,
75  const std::map<int,int>& layerMap ) {
76 
77 // find all values for this channel
78 // ind dpid = 0;
79 // std::map<int,int>::const_iterator lpartIter;
80 // std::map<int,int>::const_iterator lpartIend = layerMap.end();
81 // if ( ( layerIter = layerMap.find( chp0 ) ) != layerIend )
82 // dpid = layerIter.second;
83 // std::map<int,timedMeasurement>::const_iterator snapIter;
84 // std::map<int,timedMeasurement>::const_iterator snapIend =
85 // snapshotValues.end();
86 // float val1 = -999999.0;
87 // float val2 = -999999.0;
88 // int chan = dpId * 10;
89 // if ( ( snapIter = snapshotValues.find( chan + 1 ) ) != snapIend )
90 // val1 = snapIter->second.second;
91 // if ( ( snapIter = snapshotValues.find( chan + 2 ) ) != snapIend )
92 // val2 = snapIter->second.second;
93 
94 // find dp identifier for all channels in this layer
95 // DTLayerId lay = chlId.layerId();
96 // int chp0 = DTWireId( lay, 10 ).rawId();
97 // int chp1 = DTWireId( lay, 11 ).rawId();
98 // int chp2 = DTWireId( lay, 12 ).rawId();
99 // int chp3 = DTWireId( lay, 13 ).rawId();
100 // ind dpi0 = 0;
101 // ind dpi1 = 0;
102 // ind dpi2 = 0;
103 // ind dpi3 = 0;
104 // std::map<int,int>::const_iterator layerIter;
105 // std::map<int,int>::const_iterator layerIend = layerMap.end();
106 // if ( ( layerIter = layerMap.find( chp0 ) ) != layerIend )
107 // dpi0 = layerIter.second;
108 // if ( ( layerIter = layerMap.find( chp1 ) ) != layerIend )
109 // dpi1 = layerIter.second;
110 // if ( ( layerIter = layerMap.find( chp2 ) ) != layerIend )
111 // dpi2 = layerIter.second;
112 // if ( ( layerIter = layerMap.find( chp3 ) ) != layerIend )
113 // dpi3 = layerIter.second;
114 
115  DTWireId chlId( rawId );
116  int part = chlId.wire() - 10;
118  flag.a = flag.c = flag.s = 0;
119  if ( type == 1 ) {
120  if ( valueA < minHV[part] ) flag.a = 1;
121  if ( valueA > maxHV[part] ) flag.a = 2;
122  if ( valueS < minHV[ 2] ) flag.s = 1;
123  if ( valueS > maxHV[ 2] ) flag.s = 2;
124  if ( valueC < minHV[ 3] ) flag.c = 1;
125  if ( valueC > maxHV[ 3] ) flag.c = 2;
126  }
127  if ( type == 2 ) {
128  float voltA = 0.0;
129  float voltS = 0.0;
130  float voltC = 0.0;
131  DTLayerId lay = chlId.layerId();
132  int l_p = chlId.wire();
133  DTWireId chA( lay, l_p );
134  DTWireId chS( lay, 12 );
135  DTWireId chC( lay, 13 );
136  std::map<int,int>::const_iterator layerIter;
137  std::map<int,int>::const_iterator layerIend = layerMap.end();
138  std::map<int,timedMeasurement>::const_iterator snapIter;
139  std::map<int,timedMeasurement>::const_iterator snapIend =
140  snapshotValues.end();
141  int chan;
142  if ( ( layerIter = layerMap.find( chA.rawId() ) ) != layerIend ) {
143  chan = ( layerIter->second * 10 ) + l_p;
144  if ( ( snapIter = snapshotValues.find( chan ) ) != snapIend ) {
145  voltA = snapIter->second.second;
146  }
147  }
148  if ( ( layerIter = layerMap.find( chS.rawId() ) ) != layerIend ) {
149  chan = ( layerIter->second * 10 ) + 2;
150  if ( ( snapIter = snapshotValues.find( chan ) ) != snapIend ) {
151  voltS = snapIter->second.second;
152  }
153  }
154  if ( ( layerIter = layerMap.find( chC.rawId() ) ) != layerIend ) {
155  chan = ( layerIter->second * 10 ) + 3;
156  if ( ( snapIter = snapshotValues.find( chan ) ) != snapIend ) {
157  voltC = snapIter->second.second;
158  }
159  }
160  if ( ( valueA > maxCurrent ) &&
161  ( voltA >= minHV[part] ) ) flag.a = 4;
162  if ( ( valueS > maxCurrent ) &&
163  ( voltS >= minHV[ 2] ) ) flag.s = 4;
164  if ( ( valueC > maxCurrent ) &&
165  ( voltC >= minHV[ 3] ) ) flag.c = 4;
166  }
167  return flag;
168 
169 }
170 
171 
173 } }
174 
175 
type
Definition: HCALResponse.h:22
long int flag
Definition: mlp_lapack.h:47
DEFINE_FWK_SERVICE(DTHVCheckByAbsoluteValues)
uint32_t rawId() const
get the raw id
Definition: DetId.h:45
int wire() const
Return the wire number.
Definition: DTWireId.h:58
static DTHVAbstractCheck * instance
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
part
Definition: HCALResponse.h:21
DTLayerId layerId() const
Return the corresponding LayerId.
Definition: DTWireId.h:64
tuple cout
Definition: gather_cfg.py:121