CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
ClusterSummary::ModuleSelection Class Reference

#include <ClusterSummary.h>

Public Member Functions

virtual std::pair< int, int > IsPixelSelected (int DetId)
 
virtual std::pair< int, int > IsStripSelected (int DetId)
 
 ModuleSelection (std::string gs)
 
virtual ~ModuleSelection ()
 

Private Attributes

std::string geosearch
 

Detailed Description

Definition at line 281 of file ClusterSummary.h.

Constructor & Destructor Documentation

ClusterSummary::ModuleSelection::ModuleSelection ( std::string  gs)

Definition at line 576 of file ClusterSummary.cc.

576  {
577  geosearch = gs;
578 }
ClusterSummary::ModuleSelection::~ModuleSelection ( )
virtual

Definition at line 580 of file ClusterSummary.cc.

580 {}

Member Function Documentation

std::pair< int, int > ClusterSummary::ModuleSelection::IsPixelSelected ( int  DetId)
virtual

Definition at line 424 of file ClusterSummary.cc.

References ClusterSummary::BPIX, ClusterSummary::BPIX_1, ClusterSummary::BPIX_2, ClusterSummary::BPIX_3, DetId::det(), PXFDetId::disk(), ClusterSummary::FPIX, ClusterSummary::FPIX_1, ClusterSummary::FPIX_2, ClusterSummary::FPIX_3, ClusterSummary::FPIXM, ClusterSummary::FPIXM_1, ClusterSummary::FPIXM_2, ClusterSummary::FPIXM_3, ClusterSummary::FPIXP, ClusterSummary::FPIXP_1, ClusterSummary::FPIXP_2, ClusterSummary::FPIXP_3, PXBDetId::layer(), Mod(), ClusterSummary::PIXEL, pos, query::result, PXFDetId::side(), and DetId::subdetId().

424  {
425 
426  // true if the module mod is among the selected modules.
427  int isselected = 0;
428  int enumVal = 99999;
429 
430  DetId detId = DetId(detid); // Get the Detid object
431  unsigned int detType=detId.det(); // det type, pixel=1
432  unsigned int subdetid=detId.subdetId(); //subdetector type, barrel=1, foward=2
433 
434  if(detType!=1) return std::make_pair(0,99999); // look only at pixels
435 
437 
438  if(result != std::string::npos) {
439 
440  std::string modStr = geosearch; //Convert to string to use needed methods
441  size_t pos = modStr.find("_", 0); //find the '_'
442  std::string Mod = modStr.substr(0, pos); //find the module
443  std::string Layer = modStr.substr(pos+1, modStr.length()); //find the Layer
444 
445  std::stringstream ss(Layer);
446  int layer_id = 0;
447 
448  ss >> layer_id;
449 
450  /****
451  Check the Layers of the Barrel
452  ****/
453 
454  if (subdetid == 1 && Mod == "BPIX"){
455 
456  PXBDetId pdetId = PXBDetId(detid);
457  // Barell layer = 1,2,3
458  int layer=pdetId.layer();
459 
460  if (layer_id == layer){
461 
462  if (layer_id == 1) enumVal = ClusterSummary::BPIX_1;
463  else if (layer_id == 2) enumVal = ClusterSummary::BPIX_2;
464  else if (layer_id == 3) enumVal = ClusterSummary::BPIX_3;
465 
466  isselected = 1;
467  }
468  }
469 
470  /****
471  Check the Disk of the endcaps
472  ****/
473  else if (subdetid == 2 && Mod == "FPIX"){
474 
475  PXFDetId pdetId = PXFDetId(detid);
476  int disk=pdetId.disk(); //1,2,3
477 
478  if (layer_id == disk){
479 
480  if (disk == 1) enumVal = ClusterSummary::FPIX_1;
481  else if (disk == 2) enumVal = ClusterSummary::FPIX_2;
482  else if (disk == 3) enumVal = ClusterSummary::FPIX_3;
483 
484  isselected = 1;
485 
486  }
487  }
488 
489  /****
490  Check the sides of each Disk of the endcaps
491  ****/
492 
493  else if (subdetid == 2 && Mod == "FPIXM"){
494 
495  PXFDetId pdetId = PXFDetId(detid);
496  int side=pdetId.side(); //size=1 for -z, 2 for +z
497  int disk=pdetId.disk(); //1,2,3
498 
499  if (layer_id == disk && side == 1 ){
500 
501  if (disk == 1) enumVal = ClusterSummary::FPIXM_1;
502  else if (disk == 2) enumVal = ClusterSummary::FPIXM_2;
503  else if (disk == 3) enumVal = ClusterSummary::FPIXM_3;
504 
505  isselected = 1;
506 
507  }
508  }
509 
510  else if (subdetid == 2 && Mod == "FPIXP"){
511 
512  PXFDetId pdetId = PXFDetId(detid);
513  int side=pdetId.side(); //size=1 for -z, 2 for +z
514  int disk=pdetId.disk(); //1,2,3
515 
516  if (layer_id == disk && side == 2){
517 
518  if (disk == 1) enumVal = ClusterSummary::FPIXP_1;
519  else if (disk == 2) enumVal = ClusterSummary::FPIXP_2;
520  else if (disk == 3) enumVal = ClusterSummary::FPIXP_3;
521 
522  isselected = 1;
523 
524  }
525  }
526  }
527 
528  /****
529  Check the top and bottom of the endcaps
530  ****/
531 
532  else if( subdetid == 2 && geosearch.compare("FPIXM")==0 ) {
533 
534  PXFDetId pdetId = PXFDetId(detid);
535  int side=pdetId.side(); //size=1 for -z, 2 for +z
536 
537  if (side == 1){
538  isselected = 1;
539  enumVal = ClusterSummary::FPIXM;
540  }
541  }
542 
543  else if( subdetid == 2 && geosearch.compare("FPIXP")==0 ) {
544 
545  PXFDetId pdetId = PXFDetId(detid);
546  int side=pdetId.side(); //size=1 for -z, 2 for +z
547 
548  if (side == 2){
549  isselected = 1;
550  enumVal = ClusterSummary::FPIXP;
551  }
552  }
553 
554 
555  /****
556  Check the full Barrel and Endcaps
557  ****/
558 
559  else if(subdetid == 1 && geosearch.compare("BPIX")==0 ) {
560  isselected = 1;
561  enumVal = ClusterSummary::BPIX;
562  }
563  else if(subdetid == 2 && geosearch.compare("FPIX")==0 ) {
564  isselected = 1;
565  enumVal = ClusterSummary::FPIX;
566  }
567  else if( geosearch.compare("PIXEL")==0) {
568  isselected = 1;
569  enumVal = ClusterSummary::PIXEL;
570  }
571 
572 
573  return std::make_pair(isselected, enumVal);
574 }
uint16_t size_type
unsigned int layer() const
layer id
Definition: PXBDetId.h:35
double Mod(double phi)
autoexplaining
tuple result
Definition: query.py:137
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:39
unsigned int disk() const
disk id
Definition: PXFDetId.h:43
Definition: DetId.h:20
unsigned int side() const
positive or negative id
Definition: PXFDetId.h:38
Detector det() const
get the detector field from this detid
Definition: DetId.h:37
std::pair< int, int > ClusterSummary::ModuleSelection::IsStripSelected ( int  DetId)
virtual

Definition at line 130 of file ClusterSummary.cc.

References geosearch, TIDDetId::isZMinusSide(), TECDetId::isZMinusSide(), TOBDetId::layer(), TIBDetId::layer(), Mod(), pos, query::result, relativeConstraints::ring, TIDDetId::ringNumber(), TECDetId::ringNumber(), SiStripDetId::subDetector(), SiStripDetId::TEC, ClusterSummary::TEC, ClusterSummary::TECM, ClusterSummary::TECM_1, ClusterSummary::TECM_2, ClusterSummary::TECM_3, ClusterSummary::TECM_4, ClusterSummary::TECM_5, ClusterSummary::TECM_6, ClusterSummary::TECM_7, ClusterSummary::TECM_8, ClusterSummary::TECM_9, ClusterSummary::TECMR_1, ClusterSummary::TECMR_2, ClusterSummary::TECMR_3, ClusterSummary::TECMR_4, ClusterSummary::TECMR_5, ClusterSummary::TECMR_6, ClusterSummary::TECMR_7, ClusterSummary::TECP, ClusterSummary::TECP_1, ClusterSummary::TECP_2, ClusterSummary::TECP_3, ClusterSummary::TECP_4, ClusterSummary::TECP_5, ClusterSummary::TECP_6, ClusterSummary::TECP_7, ClusterSummary::TECP_8, ClusterSummary::TECP_9, ClusterSummary::TECPR_1, ClusterSummary::TECPR_2, ClusterSummary::TECPR_3, ClusterSummary::TECPR_4, ClusterSummary::TECPR_5, ClusterSummary::TECPR_6, ClusterSummary::TECPR_7, SiStripDetId::TIB, ClusterSummary::TIB, ClusterSummary::TIB_1, ClusterSummary::TIB_2, ClusterSummary::TIB_3, ClusterSummary::TIB_4, SiStripDetId::TID, ClusterSummary::TID, ClusterSummary::TIDM, ClusterSummary::TIDM_1, ClusterSummary::TIDM_2, ClusterSummary::TIDM_3, ClusterSummary::TIDMR_1, ClusterSummary::TIDMR_2, ClusterSummary::TIDMR_3, ClusterSummary::TIDP, ClusterSummary::TIDP_1, ClusterSummary::TIDP_2, ClusterSummary::TIDP_3, ClusterSummary::TIDPR_1, ClusterSummary::TIDPR_2, ClusterSummary::TIDPR_3, SiStripDetId::TOB, ClusterSummary::TOB, ClusterSummary::TOB_1, ClusterSummary::TOB_2, ClusterSummary::TOB_3, ClusterSummary::TOB_4, ClusterSummary::TOB_5, ClusterSummary::TOB_6, ClusterSummary::TRACKER, TIDDetId::wheel(), and TECDetId::wheel().

130  {
131 
132  // true if the module mod is among the selected modules.
133  int isselected = 0;
134  int enumVal = 99999;
135 
136  SiStripDetId subdet(DetId);
137  int subdetid = subdet.subDetector();
138 
140 
141  if(result != std::string::npos) {
142 
143  /****
144  Check to the layers in the modules
145  ****/
146 
147  std::string modStr = geosearch; //Convert to string to use needed methods
148  size_t pos = modStr.find("_", 0); //find the '_'
149  std::string Mod = modStr.substr(0, pos); //find the module
150  std::string Layer = modStr.substr(pos+1, modStr.length()); //find the Layer
151 
152  std::stringstream ss(Layer);
153  int layer_id = 0;
154 
155  ss >> layer_id;
156 
157  if (SiStripDetId::TIB == subdetid && Mod == "TIB"){
158 
159  TIBDetId tib(DetId);
160  int layer = tib.layer();
161  if (layer_id == layer){
162 
163  if (layer_id == 1) enumVal = ClusterSummary::TIB_1;
164  else if (layer_id == 2) enumVal = ClusterSummary::TIB_2;
165  else if (layer_id == 3) enumVal = ClusterSummary::TIB_3;
166  else if (layer_id == 4) enumVal = ClusterSummary::TIB_4;
167 
168  isselected = 1;
169  }
170  }
171 
172  else if (SiStripDetId::TOB == subdetid && Mod == "TOB"){
173 
174  TOBDetId tob(DetId);
175  int layer = tob.layer();
176  if (layer_id == layer){
177 
178  if (layer_id == 1) enumVal = ClusterSummary::TOB_1;
179  else if (layer_id == 2) enumVal = ClusterSummary::TOB_2;
180  else if (layer_id == 3) enumVal = ClusterSummary::TOB_3;
181  else if (layer_id == 4) enumVal = ClusterSummary::TOB_4;
182  else if (layer_id == 5) enumVal = ClusterSummary::TOB_5;
183  else if (layer_id == 6) enumVal = ClusterSummary::TOB_6;
184 
185  isselected = 1;
186  }
187  }
188 
189  else if (SiStripDetId::TEC == subdetid && Mod == "TECM"){
190 
191  TECDetId tec(DetId);
192  int side = (tec.isZMinusSide())?-1:1;
193  int layerwheel = tec.wheel();
194 
195  if (layer_id == layerwheel && side == -1){
196 
197  if (layer_id == 1) enumVal = ClusterSummary::TECM_1;
198  else if (layer_id == 2) enumVal = ClusterSummary::TECM_2;
199  else if (layer_id == 3) enumVal = ClusterSummary::TECM_3;
200  else if (layer_id == 4) enumVal = ClusterSummary::TECM_4;
201  else if (layer_id == 5) enumVal = ClusterSummary::TECM_5;
202  else if (layer_id == 6) enumVal = ClusterSummary::TECM_6;
203  else if (layer_id == 7) enumVal = ClusterSummary::TECM_7;
204  else if (layer_id == 8) enumVal = ClusterSummary::TECM_8;
205  else if (layer_id == 9) enumVal = ClusterSummary::TECM_9;
206 
207  isselected = 1;
208  }
209  }
210 
211  else if (SiStripDetId::TEC == subdetid && Mod == "TECP"){
212 
213  TECDetId tec(DetId);
214  int side = (tec.isZMinusSide())?-1:1;
215  int layerwheel = tec.wheel();
216 
217  if (layer_id == layerwheel && side == 1){
218 
219  if (layer_id == 1) enumVal = ClusterSummary::TECP_1;
220  else if (layer_id == 2) enumVal = ClusterSummary::TECP_2;
221  else if (layer_id == 3) enumVal = ClusterSummary::TECP_3;
222  else if (layer_id == 4) enumVal = ClusterSummary::TECP_4;
223  else if (layer_id == 5) enumVal = ClusterSummary::TECP_5;
224  else if (layer_id == 6) enumVal = ClusterSummary::TECP_6;
225  else if (layer_id == 7) enumVal = ClusterSummary::TECP_7;
226  else if (layer_id == 8) enumVal = ClusterSummary::TECP_8;
227  else if (layer_id == 9) enumVal = ClusterSummary::TECP_9;
228 
229  isselected = 1;
230  }
231  }
232 
233  // TEC minus ring
234  else if (SiStripDetId::TEC == subdetid && Mod == "TECMR"){
235 
236  TECDetId tec(DetId);
237  int side = (tec.isZMinusSide())?-1:1;
238  int ring = tec.ringNumber();
239 
240  if (layer_id == ring && side == -1){
241 
242  if (layer_id == 1) enumVal = ClusterSummary::TECMR_1;
243  else if (layer_id == 2) enumVal = ClusterSummary::TECMR_2;
244  else if (layer_id == 3) enumVal = ClusterSummary::TECMR_3;
245  else if (layer_id == 4) enumVal = ClusterSummary::TECMR_4;
246  else if (layer_id == 5) enumVal = ClusterSummary::TECMR_5;
247  else if (layer_id == 6) enumVal = ClusterSummary::TECMR_6;
248  else if (layer_id == 7) enumVal = ClusterSummary::TECMR_7;
249 
250  isselected = 1;
251  }
252  }
253 
254  // TEC plus ring
255  else if (SiStripDetId::TEC == subdetid && Mod == "TECPR"){
256 
257  TECDetId tec(DetId);
258  int side = (tec.isZMinusSide())?-1:1;
259  int ring = tec.ringNumber();
260  if (layer_id == ring && side == 1){
261 
262  if (layer_id == 1) enumVal = ClusterSummary::TECPR_1;
263  else if (layer_id == 2) enumVal = ClusterSummary::TECPR_2;
264  else if (layer_id == 3) enumVal = ClusterSummary::TECPR_3;
265  else if (layer_id == 4) enumVal = ClusterSummary::TECPR_4;
266  else if (layer_id == 5) enumVal = ClusterSummary::TECPR_5;
267  else if (layer_id == 6) enumVal = ClusterSummary::TECPR_6;
268  else if (layer_id == 7) enumVal = ClusterSummary::TECPR_7;
269 
270  isselected = 1;
271  }
272  }
273 
274  else if (SiStripDetId::TID == subdetid && Mod == "TIDM"){
275 
276  TIDDetId tid(DetId);
277  int side = (tid.isZMinusSide())?-1:1;
278  int layerwheel = tid.wheel();
279 
280  if (layer_id == layerwheel && side == -1){
281 
282  if (layer_id == 1) enumVal = ClusterSummary::TIDM_1;
283  else if (layer_id == 2) enumVal = ClusterSummary::TIDM_2;
284  else if (layer_id == 3) enumVal = ClusterSummary::TIDM_3;
285 
286  isselected = 1;
287  }
288  }
289 
290  else if (SiStripDetId::TID == subdetid && Mod == "TIDP"){
291 
292  TIDDetId tid(DetId);
293  int side = (tid.isZMinusSide())?-1:1;
294  int layerwheel = tid.wheel();
295 
296  if (layer_id == layerwheel && side == 1){
297 
298  if (layer_id == 1) enumVal = ClusterSummary::TIDP_1;
299  else if (layer_id == 2) enumVal = ClusterSummary::TIDP_2;
300  else if (layer_id == 3) enumVal = ClusterSummary::TIDP_3;
301 
302  isselected = 1;
303  }
304  }
305 
306  // TID minus ring
307  else if (SiStripDetId::TID == subdetid && Mod == "TIDMR"){
308  TIDDetId tid(DetId);
309  int side = (tid.isZMinusSide())?-1:1;
310  int ring = tid.ringNumber();
311  if (layer_id == ring && side == -1){
312 
313  if (layer_id == 1) enumVal = ClusterSummary::TIDMR_1;
314  else if (layer_id == 2) enumVal = ClusterSummary::TIDMR_2;
315  else if (layer_id == 3) enumVal = ClusterSummary::TIDMR_3;
316 
317  isselected = 1;
318  }
319  }
320 
321  // TID plus ring
322  else if (SiStripDetId::TID == subdetid && Mod == "TIDPR"){
323  TIDDetId tid(DetId);
324  int side = (tid.isZMinusSide())?-1:1;
325  int ring = tid.ringNumber();
326 
327  if (layer_id == ring && side == 1){
328 
329  if (layer_id == 1) enumVal = ClusterSummary::TIDPR_1;
330  else if (layer_id == 2) enumVal = ClusterSummary::TIDPR_2;
331  else if (layer_id == 3) enumVal = ClusterSummary::TIDPR_3;
332 
333  isselected = 1;
334  }
335  }
336  }
337 
338  /****
339  Check the top and bottom for the TEC and TID
340  ****/
341 
342  else if( SiStripDetId::TEC == subdetid && geosearch.compare("TECM")==0 ) {
343 
344  TECDetId tec(DetId);
345  int side = (tec.isZMinusSide())?-1:1;
346 
347  if (side == -1){
348  isselected = 1;
349  enumVal = ClusterSummary::TECM;
350  }
351  }
352 
353  else if( SiStripDetId::TEC == subdetid && geosearch.compare("TECP")==0 ) {
354 
355  TECDetId tec(DetId);
356  int side = (tec.isZMinusSide())?-1:1;
357 
358  if (side == 1){
359  isselected = 1;
360  enumVal = ClusterSummary::TECP;
361  }
362  }
363 
364 
365  else if( SiStripDetId::TID == subdetid && geosearch.compare("TIDM")==0 ) {
366 
367  TIDDetId tid(DetId);
368  int side = (tid.isZMinusSide())?-1:1;
369 
370  if (side == -1){
371  isselected = 1;
372  enumVal = ClusterSummary::TIDM;
373  }
374  }
375 
376 
377  else if( SiStripDetId::TID == subdetid && geosearch.compare("TIDP")==0 ) {
378 
379  TIDDetId tid(DetId);
380  int side = (tid.isZMinusSide())?-1:1;
381 
382  if (side == 1){
383  isselected = 1;
384  enumVal = ClusterSummary::TIDP;
385  }
386  }
387 
388  /****
389  Check the full TOB, TIB, TID, TEC modules
390  ****/
391 
392  else if( SiStripDetId::TIB == subdetid && geosearch.compare("TIB")==0 ) {
393  isselected = 1;
394  enumVal = ClusterSummary::TIB;
395  }
396  else if( SiStripDetId::TID == subdetid && geosearch.compare("TID")==0 ) {
397  isselected = 1;
398  enumVal = ClusterSummary::TID;
399  }
400  else if( SiStripDetId::TOB == subdetid && geosearch.compare("TOB")==0) {
401  isselected = 1;
402  enumVal = ClusterSummary::TOB;
403  }
404  else if( SiStripDetId::TEC == subdetid && geosearch.compare("TEC")==0) {
405  isselected = 1;
406  enumVal = ClusterSummary::TEC;
407  }
408  else if( geosearch.compare("TRACKER")==0) {
409  isselected = 1;
410  enumVal = ClusterSummary::TRACKER;
411  }
412 
413 
414  return std::make_pair(isselected, enumVal);
415 }
uint16_t size_type
double Mod(double phi)
autoexplaining
tuple result
Definition: query.py:137
Detector identifier class for the strip tracker.
Definition: SiStripDetId.h:17
Definition: DetId.h:20

Member Data Documentation

std::string ClusterSummary::ModuleSelection::geosearch
private

Definition at line 288 of file ClusterSummary.h.

Referenced by IsStripSelected().