CMS 3D CMS Logo

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