CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
ClusterSummary.cc
Go to the documentation of this file.
3 
5 
6  int placeInModsVector = -1;
7 
8  int cnt = 0;
9  int pixelcnt = 0;
10  for(std::vector<int>::const_iterator it = modules_.begin(); it != modules_.end(); ++it) {
11  /*
12  if ( mod == (*it) ) {
13  placeInModsVector = cnt;
14  break;
15  }
16  else ++cnt;
17  */
18 
19  int mod_tmp = *it;
20  while (mod_tmp > 9 ){
21  mod_tmp /= 10;
22  }
23 
24  if ( mod_tmp < 5 ){
25 
26  if ( mod == (*it) ) {
27  placeInModsVector = cnt;
28  break;
29  }
30  else ++cnt;
31  }
32  else{
33  if ( mod == (*it) ) {
34  placeInModsVector = pixelcnt;
35  break;
36  }
37  else ++pixelcnt;
38  }
39  }
40 
41  if (placeInModsVector == -1){
42 
43  edm::LogWarning("NoModule") << "No information for requested module "<<mod<<". Please check in the Provinence Infomation for proper modules.";
44 
45  return -1;
46 
47  }
48 
49  return placeInModsVector;
50 
51 }
52 
53 
54 
56 
57  int placeInUserVector = -1;
58 
59 
60  int cnt = 0;
61  for(std::vector<std::string>::const_iterator it = userContent.begin(); it != userContent.end(); ++it) {
62 
63  if ( var == (*it) ) {
64  placeInUserVector = cnt;
65  break;
66  }
67  else ++cnt;
68 
69  }
70 
71 
72  /*
73  if ( var == "cHits" )
74  placeInUserVector = NMODULES;
75  else if (var == "cSize" )
76  placeInUserVector = CLUSTERSIZE;
77  else if (var == "cCharge" )
78  placeInUserVector = CLUSTERCHARGE;
79  else if (var == "pHits" )
80  placeInUserVector = NMODULESPIXELS;
81  else if (var == "pSize" )
82  placeInUserVector = CLUSTERSIZEPIXELS;
83  else if (var == "pCharge" )
84  placeInUserVector = CLUSTERCHARGEPIXELS;
85  else
86  placeInUserVector = -1;
87  */
88  if (placeInUserVector == -1){
89  std::ostringstream err;
90  err<<"No information for requested var "<<var<<". Please check if you have chosen a proper variable.";
91 
92  throw cms::Exception( "Missing Variable", err.str());
93  }
94 
95  return placeInUserVector;
96 
97 }
98 
99 
100 
101 std::vector<std::string> ClusterSummary::DecodeProvInfo(std::string ProvInfo) const {
102 
103  std::vector<std::string> v_moduleTypes;
104 
105  std::string mod = ProvInfo;
107  std::string::size_type j = mod.find(',');
108 
109  if ( j == std::string::npos ){
110  v_moduleTypes.push_back(mod);
111  }
112  else{
113 
114  while (j != std::string::npos) {
115  v_moduleTypes.push_back(mod.substr(i, j-i));
116  i = ++j;
117  j = mod.find(',', j);
118  if (j == std::string::npos)
119  v_moduleTypes.push_back(mod.substr(i, mod.length( )));
120  }
121 
122  }
123 
124  return v_moduleTypes;
125 
126 }
127 
128 
129 
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 }
416 
417 
418 
419 
420 
421 
422 
423 
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 
436  std::string::size_type result = geosearch.find("_");
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 }
575 
577  geosearch = gs;
578 }
579 
std::vector< std::string > DecodeProvInfo(std::string ProvInfo) const
int i
Definition: DBlmapReader.cc:9
unsigned int layer() const
layer id
Definition: TOBDetId.h:39
virtual std::pair< int, int > IsPixelSelected(int DetId)
std::vector< std::string > userContent
std::vector< int > modules_
unsigned int ringNumber() const
Definition: TIDDetId.h:97
uint16_t size_type
unsigned int layer() const
layer id
Definition: PXBDetId.h:35
SeedingLayerSetsHits::SeedingLayer Layer
Definition: LayerTriplets.h:14
double Mod(double phi)
autoexplaining
bool isZMinusSide() const
Definition: TECDetId.h:86
tuple result
Definition: query.py:137
virtual std::pair< int, int > IsStripSelected(int DetId)
int j
Definition: DBlmapReader.cc:9
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:37
unsigned int disk() const
disk id
Definition: PXFDetId.h:43
int GetVariableLocation(std::string var) const
Detector identifier class for the strip tracker.
Definition: SiStripDetId.h:17
SubDetector subDetector() const
Definition: SiStripDetId.h:114
Definition: DetId.h:18
bool isZMinusSide() const
Definition: TIDDetId.h:81
unsigned int wheel() const
wheel id
Definition: TECDetId.h:52
unsigned int layer() const
layer id
Definition: TIBDetId.h:41
unsigned int ringNumber() const
Definition: TECDetId.h:98
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:35
int GetModuleLocation(int mod) const
T mod(const T &a, const T &b)
Definition: ecalDccMap.h:4
unsigned int wheel() const
wheel id
Definition: TIDDetId.h:50