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 //-------------------
31 // Initializations --
32 //-------------------
33 
34 
35 //----------------
36 // Constructors --
37 //----------------
39  objectPtr ( nullptr ) {
40 }
41 
42 
43 /*
44 DTHVHandler::DTHVHandler( const DTHVStatus* dbObject,
45  const DTGeometry* geometry ):
46  objectPtr( dbObject ),
47  dtGeomPtr( geometry ) {
48 }
49 */
51  objectPtr( dbObject ) {
52 }
53 
54 
55 //--------------
56 // Destructor --
57 //--------------
59 }
60 
61 
62 //--------------
63 // Operations --
64 //--------------
65 int DTHVHandler::get( const DTWireId& id,
66  int& flagA,
67  int& flagC,
68  int& flagS ) const {
69 /*
70  if ( objectPtr == 0 ) {
71  flagA = flagC = flagS = 0;
72  return 999;
73  }
74  return objectPtr->get( id.wheel(),
75  id.station(),
76  id.sector(),
77  id.superLayer(),
78  id.layer(),
79  findLayerPart( id ),
80  flagA, flagC, flagS );
81 */
82  flagA = flagC = flagS = 0;
83  if ( objectPtr == nullptr ) return 999;
84  int iCell = id.wire();
85  int fCell;
86  int lCell;
87  int
88  fCheck = objectPtr->get( id.wheel(),
89  id.station(),
90  id.sector(),
91  id.superLayer(),
92  id.layer(),
93  0, fCell, lCell,
94  flagA, flagC, flagS );
95  if ( ( fCheck == 0 ) &&
96  ( fCell <= iCell ) &&
97  ( lCell >= iCell ) ) return 0;
98  fCheck = objectPtr->get( id.wheel(),
99  id.station(),
100  id.sector(),
101  id.superLayer(),
102  id.layer(),
103  1, fCell, lCell,
104  flagA, flagC, flagS );
105  if ( ( fCheck == 0 ) &&
106  ( fCell <= iCell ) &&
107  ( lCell >= iCell ) ) return 0;
108  flagA = flagC = flagS = 0;
109  return 1;
110 }
111 
112 
114  int offNum = 0;
117  while ( iter != iend ) {
118  const std::pair<DTHVStatusId,DTHVStatusData>& entry = *iter++;
119  DTHVStatusId hvId = entry.first;
120  DTHVStatusData data = entry.second;
121  if ( data.flagA || data.flagC || data.flagS )
122  offNum += ( 1 + data.lCell - data.fCell );
123  }
124  return offNum;
125 }
126 
127 
129  int offNum = 0;
132 /*
133  while ( iter != iend ) {
134  const std::pair<DTHVStatusId,DTHVStatusData>& entry = *iter++;
135  DTHVStatusId idCh = entry.first;
136  DTHVStatusData data = entry.second;
137  DTLayerId idL( idCh.wheelId, idCh.stationId, idCh.sectorId,
138  idCh.slId, idCh.layerId );
139  int fCell;
140  int lCell;
141  getLayerEdges( idL, idCh.partId, fCell, lCell );
142  if ( data.flagA || data.flagC || data.flagS )
143  offNum += ( 1 + lCell - fCell );
144  }
145 */
146  while ( iter != iend ) {
147  const std::pair<DTHVStatusId,DTHVStatusData>& entry = *iter++;
148  DTHVStatusId hvId = entry.first;
149  DTHVStatusData data = entry.second;
150  if ( ( hvId. wheelId == id. wheel() ) &&
151  ( hvId.stationId == id.station() ) &&
152  ( hvId. sectorId == id. sector() ) &&
153  ( data.flagA || data.flagC || data.flagS ) )
154  offNum += ( 1 + data.lCell - data.fCell );
155  }
156  return offNum;
157 // return 0;
158 }
159 
160 
161 /*
162 int DTHVHandler::findLayerPart( const DTWireId& id ) const {
163  int fc;
164  int lc;
165  getLayerEdges( id.layerId(), fc, lc );
166  if ( id.wire() < ( lc / 2 ) ) return 1;
167  return 2;
168 }
169 
170 
171 int DTHVHandler::getLayerEdges( const DTLayerId& id,
172  int& fCell, int& lCell ) const {
173  const DTLayer* layPtr = dtGeomPtr->layer( id );
174  const DTTopology& topo = layPtr->specificTopology();
175  fCell = topo.firstChannel();
176  lCell = topo. lastChannel();
177  return 1;
178 }
179 
180 
181 int DTHVHandler::getLayerEdges( const DTLayerId& id, int part,
182  int& fCell, int& lCell ) const {
183  int flc;
184  int llc;
185  getLayerEdges( id, flc, llc );
186  int hlc = llc / 2;
187  if ( part == 1 ) {
188  fCell = flc;
189  lCell = hlc;
190  }
191  else {
192  fCell = hlc + 1;
193  lCell = llc;
194  }
195  return 1;
196 }
197 */
198 
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:84
#define nullptr
int offChannelsNumber() const
Definition: DTHVHandler.cc:113
int get(const DTWireId &id, int &flagA, int &flagC, int &flagS) const
get content
Definition: DTHVHandler.cc:65
std::vector< std::pair< DTHVStatusId, DTHVStatusData > >::const_iterator const_iterator
Access methods to data.
Definition: DTHVStatus.h:180
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
const_iterator end() const
Definition: DTHVStatus.cc:497
const_iterator begin() const
Definition: DTHVStatus.cc:492
const DTHVStatus * objectPtr
Definition: DTHVHandler.h:67