CMS 3D CMS Logo

DTHVHandler.cc
Go to the documentation of this file.
1 /*
2  * See header file for a description of this class.
3  *
4  * $Date: 2008/11/20 12:00:00 $
5  * $Revision: 1.1 $
6  * \author Paolo Ronchese INFN Padova
7  *
8  */
9 
10 //----------------------
11 // This Class' Header --
12 //----------------------
14 
15 //-------------------------------
16 // Collaborating Class Headers --
17 //-------------------------------
22 //#include "Geometry/DTGeometry/interface/DTGeometry.h"
23 //#include "Geometry/Records/interface/MuonGeometryRecord.h"
24 
25 //---------------
26 // C++ Headers --
27 //---------------
28 
29 //-------------------
30 // Initializations --
31 //-------------------
32 
33 //----------------
34 // Constructors --
35 //----------------
37 
38 /*
39 DTHVHandler::DTHVHandler( const DTHVStatus* dbObject,
40  const DTGeometry* geometry ):
41  objectPtr( dbObject ),
42  dtGeomPtr( geometry ) {
43 }
44 */
45 DTHVHandler::DTHVHandler(const DTHVStatus* dbObject) : objectPtr(dbObject) {}
46 
47 //--------------
48 // Destructor --
49 //--------------
51 
52 //--------------
53 // Operations --
54 //--------------
55 int DTHVHandler::get(const DTWireId& id, int& flagA, int& flagC, int& flagS) const {
56  /*
57  if ( objectPtr == 0 ) {
58  flagA = flagC = flagS = 0;
59  return 999;
60  }
61  return objectPtr->get( id.wheel(),
62  id.station(),
63  id.sector(),
64  id.superLayer(),
65  id.layer(),
66  findLayerPart( id ),
67  flagA, flagC, flagS );
68 */
69  flagA = flagC = flagS = 0;
70  if (objectPtr == nullptr)
71  return 999;
72  int iCell = id.wire();
73  int fCell;
74  int lCell;
75  int fCheck = objectPtr->get(
76  id.wheel(), id.station(), id.sector(), id.superLayer(), id.layer(), 0, fCell, lCell, flagA, flagC, flagS);
77  if ((fCheck == 0) && (fCell <= iCell) && (lCell >= iCell))
78  return 0;
79  fCheck = objectPtr->get(
80  id.wheel(), id.station(), id.sector(), id.superLayer(), id.layer(), 1, fCell, lCell, flagA, flagC, flagS);
81  if ((fCheck == 0) && (fCell <= iCell) && (lCell >= iCell))
82  return 0;
83  flagA = flagC = flagS = 0;
84  return 1;
85 }
86 
88  int offNum = 0;
91  while (iter != iend) {
92  const std::pair<DTHVStatusId, DTHVStatusData>& entry = *iter++;
93  DTHVStatusId hvId = entry.first;
94  DTHVStatusData data = entry.second;
95  if (data.flagA || data.flagC || data.flagS)
96  offNum += (1 + data.lCell - data.fCell);
97  }
98  return offNum;
99 }
100 
102  int offNum = 0;
105  /*
106  while ( iter != iend ) {
107  const std::pair<DTHVStatusId,DTHVStatusData>& entry = *iter++;
108  DTHVStatusId idCh = entry.first;
109  DTHVStatusData data = entry.second;
110  DTLayerId idL( idCh.wheelId, idCh.stationId, idCh.sectorId,
111  idCh.slId, idCh.layerId );
112  int fCell;
113  int lCell;
114  getLayerEdges( idL, idCh.partId, fCell, lCell );
115  if ( data.flagA || data.flagC || data.flagS )
116  offNum += ( 1 + lCell - fCell );
117  }
118 */
119  while (iter != iend) {
120  const std::pair<DTHVStatusId, DTHVStatusData>& entry = *iter++;
121  DTHVStatusId hvId = entry.first;
122  DTHVStatusData data = entry.second;
123  if ((hvId.wheelId == id.wheel()) && (hvId.stationId == id.station()) && (hvId.sectorId == id.sector()) &&
124  (data.flagA || data.flagC || data.flagS))
125  offNum += (1 + data.lCell - data.fCell);
126  }
127  return offNum;
128  // return 0;
129 }
130 
131 /*
132 int DTHVHandler::findLayerPart( const DTWireId& id ) const {
133  int fc;
134  int lc;
135  getLayerEdges( id.layerId(), fc, lc );
136  if ( id.wire() < ( lc / 2 ) ) return 1;
137  return 2;
138 }
139 
140 
141 int DTHVHandler::getLayerEdges( const DTLayerId& id,
142  int& fCell, int& lCell ) const {
143  const DTLayer* layPtr = dtGeomPtr->layer( id );
144  const DTTopology& topo = layPtr->specificTopology();
145  fCell = topo.firstChannel();
146  lCell = topo. lastChannel();
147  return 1;
148 }
149 
150 
151 int DTHVHandler::getLayerEdges( const DTLayerId& id, int part,
152  int& fCell, int& lCell ) const {
153  int flc;
154  int llc;
155  getLayerEdges( id, flc, llc );
156  int hlc = llc / 2;
157  if ( part == 1 ) {
158  fCell = flc;
159  lCell = hlc;
160  }
161  else {
162  fCell = hlc + 1;
163  lCell = llc;
164  }
165  return 1;
166 }
167 */
int get(int wheelId, int stationId, int sectorId, int slId, int layerId, int partId, int &fCell, int &lCell, int &flagA, int &flagC, int &flagS) const
get content
Definition: DTHVStatus.cc:56
#define nullptr
int offChannelsNumber() const
Definition: DTHVHandler.cc:87
int get(const DTWireId &id, int &flagA, int &flagC, int &flagS) const
get content
Definition: DTHVHandler.cc:55
std::vector< std::pair< DTHVStatusId, DTHVStatusData > >::const_iterator const_iterator
Access methods to data.
Definition: DTHVStatus.h:128
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
const_iterator end() const
Definition: DTHVStatus.cc:300
const_iterator begin() const
Definition: DTHVStatus.cc:298
const DTHVStatus * objectPtr
Definition: DTHVHandler.h:60