CMS 3D CMS Logo

SiStripDetKey.cc
Go to the documentation of this file.
1 
5 #include <iomanip>
6 
7 // -----------------------------------------------------------------------------
8 //
9 SiStripDetKey::SiStripDetKey(const uint16_t& partition)
10  : SiStripKey(), partition_(partition), apvPairNumber_(sistrip::invalid_), apvWithinPair_(sistrip::invalid_) {
11  // order is important!
12  initFromValue();
13  initFromKey();
14  initFromPath();
16 }
17 
18 // -----------------------------------------------------------------------------
19 //
20 SiStripDetKey::SiStripDetKey(const DetId& det_id, const uint16_t& apv_pair_number, const uint16_t& apv_within_pair)
21  : SiStripKey(), partition_(sistrip::invalid_), apvPairNumber_(apv_pair_number), apvWithinPair_(apv_within_pair) {
22  // order is important!
23  initFromValue();
24  initFromKey();
25  initFromPath();
27 }
28 
29 // -----------------------------------------------------------------------------
30 //
32  : SiStripKey(),
34  apvPairNumber_(sistrip::invalid_),
35  apvWithinPair_(sistrip::invalid_) {
36  // order is important!
37  initFromValue();
38  initFromKey();
39  initFromPath();
41 }
42 
43 // -----------------------------------------------------------------------------
44 //
45 SiStripDetKey::SiStripDetKey(const uint32_t& det_key)
46  : SiStripKey(det_key),
48  apvPairNumber_(sistrip::invalid_),
49  apvWithinPair_(sistrip::invalid_) {
50  // order is important!
51  initFromKey();
52  initFromValue();
53  initFromPath();
55 }
56 
57 // -----------------------------------------------------------------------------
58 //
60  : SiStripKey(path),
62  apvPairNumber_(sistrip::invalid_),
63  apvWithinPair_(sistrip::invalid_) {
64  // order is important!
65  initFromPath();
66  initFromValue();
67  initFromKey();
69 }
70 
71 // -----------------------------------------------------------------------------
72 //
74  : SiStripKey(),
75  partition_(input.partition()),
76  apvPairNumber_(input.apvPairNumber()),
77  apvWithinPair_(input.apvWithinPair()) {
78  key(input.key());
79  path(input.path());
80  granularity(input.granularity());
81 }
82 
83 // -----------------------------------------------------------------------------
84 //
86  : SiStripKey(),
88  apvPairNumber_(sistrip::invalid_),
89  apvWithinPair_(sistrip::invalid_) {
90  const SiStripDetKey& det_key = dynamic_cast<const SiStripDetKey&>(input);
91  key(det_key.key());
92  path(det_key.path());
93  granularity(det_key.granularity());
94  partition_ = det_key.partition();
95  apvPairNumber_ = det_key.apvPairNumber();
96  apvWithinPair_ = det_key.apvWithinPair();
97 }
98 
99 // -----------------------------------------------------------------------------
100 //
102  : SiStripKey(), partition_(0), apvPairNumber_(0), apvWithinPair_(0) {
103  const SiStripDetKey& det_key = dynamic_cast<const SiStripDetKey&>(input);
104  if (gran == sistrip::PARTITION) {
105  partition_ = det_key.partition();
106  }
107 
108  initFromValue();
109  initFromKey();
110  initFromPath();
111  initGranularity();
112 }
113 
114 // -----------------------------------------------------------------------------
115 //
117  : SiStripKey(),
119  apvPairNumber_(sistrip::invalid_),
120  apvWithinPair_(sistrip::invalid_) {
121  ;
122 }
123 
124 // -----------------------------------------------------------------------------
125 //
127  const SiStripDetKey& input = dynamic_cast<const SiStripDetKey&>(key);
128  if (partition_ == input.partition() && apvPairNumber_ == input.apvPairNumber() &&
129  apvWithinPair_ == input.apvWithinPair()) {
130  return true;
131  } else {
132  return false;
133  }
134 }
135 
136 // -----------------------------------------------------------------------------
137 //
139  const SiStripDetKey& input = dynamic_cast<const SiStripDetKey&>(key);
140  if (isEqual(input)) {
141  return false;
142  } else if ((partition_ == 0 || input.partition() == 0) && (apvPairNumber_ == 0 || input.apvPairNumber() == 0) &&
143  (apvWithinPair_ == 0 || input.apvWithinPair() == 0)) {
144  return true;
145  } else {
146  return false;
147  }
148 }
149 
150 // -----------------------------------------------------------------------------
151 //
152 bool SiStripDetKey::isValid() const { return isValid(sistrip::APV); }
153 
154 // -----------------------------------------------------------------------------
155 //
157  if (gran == sistrip::TRACKER) {
158  return true;
159  } else if (gran == sistrip::UNDEFINED_GRAN || gran == sistrip::UNKNOWN_GRAN) {
160  return false;
161  }
162 
163  if (partition_ != sistrip::invalid_) {
164  if (gran == sistrip::PARTITION) {
165  return true;
166  }
167  }
168  return false;
169 }
170 
171 // -----------------------------------------------------------------------------
172 //
174 
175 // -----------------------------------------------------------------------------
176 //
178  if (gran == sistrip::TRACKER) {
179  return false;
180  } else if (gran == sistrip::UNDEFINED_GRAN || gran == sistrip::UNKNOWN_GRAN) {
181  return false;
182  }
183 
184  if (partition_ == sistrip::invalid_) {
185  if (gran == sistrip::PARTITION) {
186  return true;
187  }
188  }
189  return false;
190 }
191 
192 // -----------------------------------------------------------------------------
193 //
195  // partition
196  if (partition_ > 4) {
198  }
199 }
200 
201 // -----------------------------------------------------------------------------
202 //
204  if (key() == sistrip::invalid32_) {
205  // ---------- Set DetKey based on member data ----------
206 
207  // Initialise to null value
208  key(0);
209 
210  // Extract partition
211  if (partition_ >= 1 && //sistrip::PARTITION_MIN &&
212  partition_ <= 4) { //sistrip::PARTITION_MAX ) {
214  } else if (partition_ == 0) {
216  } else {
218  }
219 
220  } else {
221  // ---------- Set member data based on Det key ----------
222 
224 
225  if (partition_ == partitionMask_) {
227  }
228  }
229 }
230 
231 // -----------------------------------------------------------------------------
232 //
234  if (path() == sistrip::null_) {
235  // ---------- Set directory path based on member data ----------
236 
237  std::stringstream dir;
238 
240 
241  // Add partition
242  if (partition_) {
244  }
245 
246  std::string temp(dir.str());
247  path(temp);
248 
249  } else {
250  // ---------- Set member data based on directory path ----------
251 
252  partition_ = 0;
253 
254  // Check if root is found
255  if (path().find(sistrip::root_) == std::string::npos) {
256  std::string temp = path();
258  }
259 
260  size_t curr = 0; // current string position
261  size_t next = 0; // next string position
262  next = path().find(sistrip::detectorView_, curr);
263 
264  // Extract view
265  curr = next;
266  if (curr != std::string::npos) {
267  next = path().find(sistrip::partition_, curr);
268  std::string detector_view(
269  path(), curr + (sizeof(sistrip::detectorView_) - 1), next - (sizeof(sistrip::dir_) - 1) - curr);
270  // Extract partition
271  curr = next;
272  if (curr != std::string::npos) {
273  next = std::string::npos;
275  path(), curr + (sizeof(sistrip::partition_) - 1), next - (sizeof(sistrip::dir_) - 1) - curr);
276  partition_ = std::atoi(partition.c_str());
277  }
278  } else {
279  std::stringstream ss;
281  //ss << sistrip::root_ << sistrip::dir_
282  //<< sistrip::unknownView_ << sistrip::dir_;
283  std::string temp(ss.str());
284  path(temp);
285  }
286  }
287 }
288 
289 // -----------------------------------------------------------------------------
290 //
293  channel(0);
297  } else if (partition_ == sistrip::invalid_) {
300  }
301 }
302 
303 // -----------------------------------------------------------------------------
304 //
305 void SiStripDetKey::terse(std::stringstream& ss) const { ss << "DET:partition= " << partition(); }
306 
307 // -----------------------------------------------------------------------------
308 //
309 void SiStripDetKey::print(std::stringstream& ss) const {
310  ss << " [SiStripDetKey::print]" << std::endl
311  << std::hex << " 32-bit Det key : 0x" << std::setfill('0') << std::setw(8) << key() << std::endl
312  << std::setfill(' ') << std::dec << " Partition : " << partition() << std::endl
313  << " Directory : " << path() << std::endl
314  << " Granularity : " << SiStripEnumsAndStrings::granularity(granularity()) << std::endl
315  << " Channel : " << channel() << std::endl
316  << " isValid : " << isValid();
317 }
318 
319 // -----------------------------------------------------------------------------
320 //
321 std::ostream& operator<<(std::ostream& os, const SiStripDetKey& input) {
322  std::stringstream ss;
323  input.print(ss);
324  os << ss.str();
325  return os;
326 }
sistrip::Granularity
Granularity
Definition: ConstantsForGranularity.h:60
Constants.h
Generic constants.
sistrip::null_
static const char null_[]
Definition: Constants.h:22
SiStripDetKey::print
void print(std::stringstream &ss) const override
Definition: SiStripDetKey.cc:309
input
static const std::string input
Definition: EdmProvDump.cc:48
sistrip::TRACKER
Definition: ConstantsForGranularity.h:64
sistrip::invalid32_
static const uint32_t invalid32_
Definition: Constants.h:15
SiStripDetKey::initFromKey
void initFromKey() override
Definition: SiStripDetKey.cc:203
sistrip::detectorView_
static const char detectorView_[]
Definition: ConstantsForView.h:22
SiStripKey::key
const uint32_t & key() const
Definition: SiStripKey.h:120
sistrip::dir_
static const char dir_[]
Definition: ConstantsForDqm.h:17
sistrip::UNKNOWN_GRAN
Definition: ConstantsForGranularity.h:62
spr::find
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
groupFilesInBlocks.temp
list temp
Definition: groupFilesInBlocks.py:142
SiStripKey::granularity
const sistrip::Granularity & granularity() const
Definition: SiStripKey.h:122
SiStripDetKey::isEqual
bool isEqual(const SiStripKey &) const override
Definition: SiStripDetKey.cc:126
SiStripDetKey::apvPairNumber
const uint16_t & apvPairNumber() const
Definition: SiStripDetKey.h:135
contentValuesCheck.ss
ss
Definition: contentValuesCheck.py:33
DetId
Definition: DetId.h:17
SiStripKey::channel
const uint16_t & channel() const
Definition: SiStripKey.h:123
SiStripDetKey::apvWithinPair_
uint16_t apvWithinPair_
Definition: SiStripDetKey.h:123
SiStripDetKey::partition_
uint16_t partition_
Definition: SiStripDetKey.h:117
sistrip::partition_
static const char partition_[]
Definition: ConstantsForGranularity.h:24
SiStripEnumsAndStrings::granularity
static std::string granularity(const sistrip::Granularity &)
Definition: SiStripEnumsAndStrings.cc:265
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
SiStripDetKey::initFromValue
void initFromValue() override
Definition: SiStripDetKey.cc:194
SiStripKey::path
const std::string & path() const
Definition: SiStripKey.h:121
sistrip::APV
Definition: ConstantsForGranularity.h:79
sistrip::root_
static const char root_[]
Definition: ConstantsForDqm.h:30
sistrip::invalid_
static const uint16_t invalid_
Definition: Constants.h:16
SiStripDetKey.h
SiStripDetKey
Utility class that identifies a position within the strip tracker geometrical structure,...
Definition: SiStripDetKey.h:28
SiStripDetKey::partitionMask_
static const uint16_t partitionMask_
Definition: SiStripDetKey.h:129
SiStripDetKey::partitionOffset_
static const uint16_t partitionOffset_
Definition: SiStripDetKey.h:126
SiStripDetKey::apvPairNumber_
uint16_t apvPairNumber_
Definition: SiStripDetKey.h:120
SiStripEnumsAndStrings.h
SiStripDetKey::isConsistent
bool isConsistent(const SiStripKey &) const override
Definition: SiStripDetKey.cc:138
SiStripDetKey::partition
const uint16_t & partition() const
Definition: SiStripDetKey.h:134
SiStripDetKey::initFromPath
void initFromPath() override
Definition: SiStripDetKey.cc:233
SiStripDetKey::isValid
bool isValid() const override
Definition: SiStripDetKey.cc:152
SiStripDetKey::SiStripDetKey
SiStripDetKey()
Definition: SiStripDetKey.cc:116
sistrip::PARTITION
Definition: ConstantsForGranularity.h:65
castor_dqm_sourceclient_file_cfg.path
path
Definition: castor_dqm_sourceclient_file_cfg.py:37
SiStripDetId
Detector identifier class for the strip tracker.
Definition: SiStripDetId.h:18
sistrip
sistrip classes
Definition: SiStripQualityHelpers.h:14
SiStripDetKey::initGranularity
void initGranularity() override
Definition: SiStripDetKey.cc:291
operator<<
std::ostream & operator<<(std::ostream &os, const SiStripDetKey &input)
Definition: SiStripDetKey.cc:321
SiStripDetKey::isInvalid
bool isInvalid() const override
Definition: SiStripDetKey.cc:173
sistrip::UNDEFINED_GRAN
Definition: ConstantsForGranularity.h:61
crabWrapper.key
key
Definition: crabWrapper.py:19
SiStripKey
Base utility class that identifies a position within a logical structure of the strip tracker.
Definition: SiStripKey.h:23
TauDecayModes.dec
dec
Definition: TauDecayModes.py:143
SiStripDetKey::terse
void terse(std::stringstream &ss) const override
Definition: SiStripDetKey.cc:305
GetRecoTauVFromDQM_MC_cff.next
next
Definition: GetRecoTauVFromDQM_MC_cff.py:31
DeadROC_duringRun.dir
dir
Definition: DeadROC_duringRun.py:23
SiStripDetKey::apvWithinPair
const uint16_t & apvWithinPair() const
Definition: SiStripDetKey.h:136