CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_2_SLHC4_patch1/src/RecoTracker/RingMakerESProducer/src/RingMaker.cc

Go to the documentation of this file.
00001 //
00002 // Package:         RecoTracker/RingMakerESProducer
00003 // Class:           RingMaker
00004 // 
00005 // Description:     The RingMaker object creates and povides
00006 //                  all Rings in the detector.
00007 //
00008 // Original Author: Oliver Gutsche, gutsche@fnal.gov
00009 // Created:         Tue Oct  3 23:51:34 UTC 2006
00010 //
00011 // $Author: yana $
00012 // $Date: 2012/08/03 13:48:52 $
00013 // $Revision: 1.7 $
00014 //
00015 
00016 #include <iostream>
00017 #include <algorithm>
00018 #include <map>
00019 #include <utility>
00020 #include <fstream>
00021 #include <sstream>
00022 
00023 #include "RecoTracker/RingMakerESProducer/interface/RingMaker.h"
00024 
00025 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00026 
00027 #include "DataFormats/SiStripDetId/interface/TIBDetId.h"
00028 #include "DataFormats/SiStripDetId/interface/TOBDetId.h"
00029 #include "DataFormats/SiStripDetId/interface/TIDDetId.h"
00030 #include "DataFormats/SiStripDetId/interface/TECDetId.h"
00031 #include "DataFormats/SiPixelDetId/interface/PXBDetId.h"
00032 #include "DataFormats/SiPixelDetId/interface/PXFDetId.h"
00033 
00034 #include "DataFormats/GeometryVector/interface/LocalPoint.h"
00035 #include "DataFormats/GeometryVector/interface/GlobalPoint.h"
00036 
00037 #include "Geometry/CommonDetUnit/interface/GeomDetUnit.h"
00038 #include "Geometry/CommonTopologies/interface/Topology.h"
00039 #include "DataFormats/GeometrySurface/interface/TrapezoidalPlaneBounds.h"
00040 #include "DataFormats/GeometryVector/interface/Pi.h"
00041 
00042 RingMaker::RingMaker(const TrackerGeometry *tracker,
00043                      std::string configuration) 
00044   : tracker_(tracker), configuration_(configuration)
00045 {
00046 
00047   rings_ = new Rings();
00048 
00049   fillTIBGeometryArray();
00050   fillTOBGeometryArray();
00051   fillTIDGeometryArray();
00052   fillTECGeometryArray();
00053   fillPXBGeometryArray();
00054   fillPXFGeometryArray();
00055 
00056   constructRings();
00057   
00058 }
00059 
00060 RingMaker::~RingMaker() { 
00061 
00062 }  
00063 
00064 void RingMaker::constructRings() {
00065 
00066   unsigned int index = 0;
00067 
00068   if ( configuration_ == "TIF") {
00069     index = 52;
00070     constructTIBRings(index);
00071     constructTIDRings(index);
00072     constructTOBRings(index);
00073     constructTECRings(index);
00074   } else if ( configuration_ == "TIFTOB") {
00075     index = 118;
00076     constructTOBRings(index);
00077   } else if ( configuration_ == "TIFTIB") {
00078     index = 52;
00079     constructTIBRings(index);
00080     constructTIDRings(index);
00081   } else if ( configuration_ == "TIFTIBTOB") {
00082     index = 52;
00083     constructTIBRings(index);
00084     constructTIDRings(index);
00085     index = 118;
00086     constructTOBRings(index);
00087  } else if ( configuration_ == "TIFTOBTEC") {
00088     index = 118;
00089     constructTOBRings(index);
00090     index = 190;
00091     constructTECRings(index);
00092   } else {
00093     constructPXBRings(index);
00094     constructPXFRings(index);
00095     constructTIBRings(index);
00096     constructTIDRings(index);
00097     constructTOBRings(index);
00098     constructTECRings(index);
00099   }
00100   
00101   edm::LogInfo("RoadSearch") << "Constructed " << index << " rings."; 
00102 
00103 }
00104 
00105 void RingMaker::constructTIBRings(unsigned int &index) {
00106 
00107   unsigned int counter = 0;
00108 
00109   unsigned int layer_max   = 5;
00110   unsigned int fw_bw_max   = 3;
00111   unsigned int ext_int_max = 3;
00112   unsigned int detector_max  = 4;
00113 
00114   for ( unsigned int layer = 0; layer < layer_max; ++layer ) {
00115     for ( unsigned int fw_bw = 0; fw_bw < fw_bw_max; ++fw_bw ) {
00116       for ( unsigned int ext_int = 0; ext_int < ext_int_max; ++ext_int ) {
00117         for ( unsigned int detector = 0; detector < detector_max; ++detector ) {
00118           Ring ring = constructTIBRing(layer,fw_bw,ext_int,detector);
00119           if ( ring.getNumDetIds() > 0 ) {
00120             ring.setindex(++index);
00121             double center_z = ring.getzmin() + ((ring.getzmax()-ring.getzmin())/2);
00122             rings_->insert(center_z,ring);
00123             ++counter;
00124             LogDebug("RoadSearch") << "constructed TIB ring with index: " << ring.getindex() 
00125                                    << " consisting of " << ring.getNumDetIds() << " DetIds"; 
00126           }
00127         }    
00128       }    
00129     }    
00130   }
00131   LogDebug("RoadSearch") << "constructed " << counter << " TIB rings"; 
00132   
00133 }
00134 
00135 Ring RingMaker::constructTIBRing(unsigned int layer,
00136                                  unsigned int fw_bw,
00137                                  unsigned int ext_int,
00138                                  unsigned int detector) {
00139 
00140   // variables for determinaton of rmin, rmax, zmin, zmax
00141   float rmin = 1200.;
00142   float rmax = 0.;
00143   float zmin = 2800.;
00144   float zmax = -2800.;
00145 
00146   unsigned int string_max = 57;
00147 
00148   Ring ring(Ring::TIBRing);
00149 
00150   for ( unsigned int string = 0; string < string_max; ++string) {
00151     // only fill r/phi sensor id's
00152     // first try r/phi of double sided layer (stereo = 2)
00153     // then try r/phi of single sided layer (stereo = 0)
00154     if ( tib_[layer][fw_bw][ext_int][string][detector][2] > 0 ) {
00155       DetId id = constructTIBDetId(layer,fw_bw,ext_int,string,detector,2);
00156       double phi = determineExtensions(id,rmin,rmax,zmin,zmax,Ring::TIBRing);
00157       ring.addId(phi,id);
00158     } else if ( tib_[layer][fw_bw][ext_int][string][detector][0] > 0 ) {
00159       DetId id = constructTIBDetId(layer,fw_bw,ext_int,string,detector,0);
00160       double phi = determineExtensions(id,rmin,rmax,zmin,zmax,Ring::TIBRing);
00161       ring.addId(phi,id);
00162     }
00163   }
00164 
00165   LogDebug("RoadSearch") << "TIB ring initialized rmin/rmax/zmin/zmax: " << rmin 
00166                          << "/" << rmax 
00167                          << "/" << zmin 
00168                          << "/" << zmax;
00169     
00170   ring.initialize(rmin,rmax,zmin,zmax);
00171 
00172   return ring;
00173 }
00174 
00175 DetId RingMaker::constructTIBDetId(unsigned int layer,
00176                                    unsigned int fw_bw,
00177                                    unsigned int ext_int,
00178                                    unsigned int string,
00179                                    unsigned int detector,
00180                                    unsigned int stereo) {
00181 
00182   TIBDetId id(layer+1,fw_bw,ext_int,string+1,detector+1,stereo);
00183   LogDebug("RoadSearch") << "constructed TIB ring DetId for layer: " << id.layer() 
00184                          << " fw(0)/bw(1): " << id.string()[0]
00185                          << " ext(0)/int(1): " << id.string()[1] 
00186                          << " string: " << id.string()[2] 
00187                          << " module: " << id.module()
00188                          << " stereo: " << id.stereo(); 
00189 
00190   return DetId(id.rawId());
00191 }
00192 
00193 
00194 void RingMaker::constructTOBRings(unsigned int &index) {
00195 
00196   unsigned int counter = 0;
00197  
00198   unsigned int layer_max       = 7;
00199   unsigned int rod_fw_bw_max   = 3;
00200   unsigned int module_max      = 7; 
00201 
00202   for ( unsigned int layer = 0; layer < layer_max; ++layer ) {
00203     for ( unsigned int rod_fw_bw = 0; rod_fw_bw < rod_fw_bw_max; ++rod_fw_bw ) {
00204       for ( unsigned int module = 0; module < module_max; ++module ) {
00205         Ring ring = constructTOBRing(layer,rod_fw_bw,module);
00206         if ( ring.getNumDetIds() > 0 ) {
00207           ring.setindex(++index);
00208           double center_z = ring.getzmin() + ((ring.getzmax()-ring.getzmin())/2);
00209           rings_->insert(center_z,ring);
00210           ++counter;
00211           LogDebug("RoadSearch") << "constructed TOB ring with index: " << ring.getindex() 
00212                                  << " consisting of " << ring.getNumDetIds() << " DetIds"; 
00213         }
00214       }    
00215     }    
00216   }
00217 
00218   LogDebug("RoadSearch") << "constructed " << counter << " TOB rings"; 
00219 
00220 }
00221 
00222 Ring RingMaker::constructTOBRing(unsigned int layer,
00223                                  unsigned int rod_fw_bw,
00224                                  unsigned int module) {
00225   
00226   // variables for determinaton of rmin, rmax, zmin, zmax
00227   float rmin = 1200.;
00228   float rmax = 0.;
00229   float zmin = 2800.;
00230   float zmax = -2800.;
00231 
00232   unsigned int rod_max = 75;
00233   Ring ring(Ring::TOBRing);
00234 
00235   for ( unsigned int rod = 0; rod < rod_max; ++rod ) {
00236     // only fill r/phi sensor id's
00237     // first try r/phi of double sided layer (stereo = 2)
00238     // then try r/phi of single sided layer (stereo = 0)
00239     if ( tob_[layer][rod_fw_bw][rod][module][2] > 0 ) {
00240       DetId id = constructTOBDetId(layer,rod_fw_bw,rod,module,2);
00241       double phi = determineExtensions(id,rmin,rmax,zmin,zmax,Ring::TOBRing);
00242       ring.addId(phi,id);
00243     } else if ( tob_[layer][rod_fw_bw][rod][module][0] > 0 ) {
00244       DetId id = constructTOBDetId(layer,rod_fw_bw,rod,module,0);
00245       double phi = determineExtensions(id,rmin,rmax,zmin,zmax,Ring::TOBRing);
00246       ring.addId(phi,id);
00247     }
00248   }
00249   
00250   
00251   LogDebug("RoadSearch") << "TOB ring initialized rmin/rmax/zmin/zmax: " << rmin 
00252                          << "/" << rmax 
00253                          << "/" << zmin 
00254                          << "/" << zmax;
00255     
00256   ring.initialize(rmin,rmax,zmin,zmax);
00257   
00258   return ring;
00259 }
00260 
00261 DetId RingMaker::constructTOBDetId(unsigned int layer,
00262                                    unsigned int rod_fw_bw,
00263                                    unsigned int rod,
00264                                    unsigned int detector,
00265                                    unsigned int stereo) {
00266 
00267   TOBDetId id(layer+1,rod_fw_bw,rod+1,detector+1,stereo);
00268 
00269   LogDebug("RoadSearch") << "constructed TOB ring DetId for layer: " << id.layer() 
00270                          << " rod fw(0)/bw(1): " << id.rod()[0] 
00271                          << " rod: " << id.rod()[1] 
00272                          << " module: " << id.module() 
00273                          << " stereo: " << id.stereo() << std::endl; 
00274 
00275   return DetId(id.rawId());
00276 }
00277 
00278 void RingMaker::constructTIDRings(unsigned int &index) {
00279 
00280   unsigned int counter = 0;
00281 
00282   unsigned int fw_bw_max       = 3;
00283   unsigned int wheel_max       = 4;
00284   unsigned int ring_max        = 4;
00285 
00286   for ( unsigned int fw_bw = 0; fw_bw < fw_bw_max; ++fw_bw ) {
00287     for ( unsigned int wheel = 0; wheel < wheel_max; ++wheel ) {
00288       for ( unsigned int ring = 0; ring < ring_max; ++ring ) {
00289         Ring tempring = constructTIDRing(fw_bw,wheel,ring);
00290         if ( tempring.getNumDetIds() > 0 ) {
00291           tempring.setindex(++index);
00292           double center_z = tempring.getzmin() + ((tempring.getzmax()-tempring.getzmin())/2);
00293           rings_->insert(center_z,tempring);
00294           ++counter;
00295           LogDebug("RoadSearch") << "constructed TID ring with index: " << tempring.getindex() 
00296                                  << " consisting of " << tempring.getNumDetIds() << " DetIds"; 
00297         }
00298       }   
00299     }  
00300   }
00301   
00302   LogDebug("RoadSearch") << "constructed " << counter << " TID rings"; 
00303 
00304 }
00305 
00306 Ring RingMaker::constructTIDRing(unsigned int fw_bw,
00307                                  unsigned int wheel,
00308                                  unsigned int ring) {
00309 
00310   // variables for determinaton of rmin, rmax, zmin, zmax
00311   float rmin = 1200.;
00312   float rmax = 0.;
00313   float zmin = 2800.;
00314   float zmax = -2800.;
00315 
00316   unsigned int detector_fw_bw_max   = 3;
00317   unsigned int detector_max = 21;
00318   
00319   Ring tempring(Ring::TIDRing);
00320   
00321   for ( unsigned int detector_fw_bw = 0; detector_fw_bw < detector_fw_bw_max; ++detector_fw_bw ) {
00322     for ( unsigned int detector = 0; detector < detector_max; ++detector ) {
00323       if ( tid_[fw_bw][wheel][ring][detector_fw_bw][detector][2] > 0 ) {
00324         DetId id = constructTIDDetId(fw_bw,wheel,ring,detector_fw_bw,detector,2);
00325         double phi = determineExtensions(id,rmin,rmax,zmin,zmax,Ring::TIDRing);
00326         tempring.addId(phi,id);
00327       } else if ( tid_[fw_bw][wheel][ring][detector_fw_bw][detector][0] > 0 ) {
00328         DetId id = constructTIDDetId(fw_bw,wheel,ring,detector_fw_bw,detector,0);
00329         double phi = determineExtensions(id,rmin,rmax,zmin,zmax,Ring::TIDRing);
00330         tempring.addId(phi,id);
00331       }
00332     }
00333   }
00334         
00335   LogDebug("RoadSearch") << "TID ring initialized rmin/rmax/zmin/zmax: " << rmin 
00336                          << "/" << rmax 
00337                          << "/" << zmin 
00338                          << "/" << zmax;
00339     
00340   tempring.initialize(rmin,rmax,zmin,zmax);
00341 
00342   return tempring;
00343 }
00344 
00345 DetId RingMaker::constructTIDDetId(unsigned int fw_bw,
00346                                    unsigned int wheel,
00347                                    unsigned int ring,
00348                                    unsigned int module_fw_bw,
00349                                    unsigned int module,
00350                                    unsigned int stereo) {
00351 
00352   TIDDetId id(fw_bw+1,wheel+1,ring+1,module_fw_bw,module+1,stereo);
00353 
00354   LogDebug("RoadSearch") << "constructed TID ring DetId for side: " << id.side() 
00355                          << " wheel: " << id.wheel() 
00356                          << " ring: " << id.ring() 
00357                          << " module_fw_bw: " << id.module()[0] 
00358                          << " module: " << id.module()[1] 
00359                          << " stereo: " << id.stereo(); 
00360         
00361   return DetId(id.rawId());
00362 }
00363 
00364 void RingMaker::constructTECRings(unsigned int &index) {
00365 
00366   unsigned int counter = 0;
00367 
00368   unsigned int fw_bw_max       = 3;
00369   unsigned int wheel_max       = 10;
00370   unsigned int ring_max        = 8;
00371 
00372   for ( unsigned int fw_bw = 0; fw_bw < fw_bw_max; ++fw_bw ) {
00373     for ( unsigned int wheel = 0; wheel < wheel_max; ++wheel ) {
00374       for ( unsigned int ring = 0; ring < ring_max; ++ring ) {
00375         if ( tec2_[fw_bw][wheel][ring] > 0 ) {
00376           Ring tempring = constructTECRing(fw_bw,wheel,ring);
00377           if ( tempring.getNumDetIds() > 0 ) {
00378             tempring.setindex(++index);
00379             double center_z = tempring.getzmin() + ((tempring.getzmax()-tempring.getzmin())/2);
00380             rings_->insert(center_z,tempring);
00381             ++counter;
00382             LogDebug("RoadSearch") << "constructed TEC ring with index: " << tempring.getindex() 
00383                                    << " consisting of " << tempring.getNumDetIds() << " DetIds"; 
00384           }
00385         }
00386       }   
00387     }  
00388   }
00389 
00390   LogDebug("RoadSearch") << "constructed " << counter << " TEC rings"; 
00391 
00392 }
00393 
00394 Ring RingMaker::constructTECRing(unsigned int fw_bw,
00395                                  unsigned int wheel,
00396                                  unsigned int ring) {
00397 
00398   // variables for determinaton of rmin, rmax, zmin, zmax
00399   float rmin = 1200.;
00400   float rmax = 0.;
00401   float zmin = 2800.;
00402   float zmax = -2800.;
00403 
00404   unsigned int petal_max       = 9;
00405   unsigned int petal_fw_bw_max = 3;
00406   unsigned int module_max      = 21;
00407 
00408   Ring tempring(Ring::TECRing);
00409         
00410   for ( unsigned int petal = 0; petal < petal_max; ++petal ) {
00411     for ( unsigned int petal_fw_bw = 0; petal_fw_bw < petal_fw_bw_max; ++petal_fw_bw ) {
00412       for ( unsigned int module = 0; module < module_max; ++module ) {
00413         // only fill r/phi sensor id's
00414         // first try r/phi of double sided layer (stereo = 2)
00415         // then try r/phi of single sided layer (stereo = 0)
00416         if ( tec_[fw_bw][wheel][petal_fw_bw][petal][ring][module][2] > 0 ) {
00417           DetId id = constructTECDetId(fw_bw,wheel,petal_fw_bw,petal,ring,module,2);
00418           double phi = determineExtensions(id,rmin,rmax,zmin,zmax,Ring::TECRing);
00419           tempring.addId(phi,id);
00420         } else if ( tec_[fw_bw][wheel][petal_fw_bw][petal][ring][module][0] > 0 ) {
00421           DetId id = constructTECDetId(fw_bw,wheel,petal_fw_bw,petal,ring,module,0);
00422           double phi = determineExtensions(id,rmin,rmax,zmin,zmax,Ring::TECRing);
00423           tempring.addId(phi,id);
00424         }
00425       }
00426     }
00427   }
00428 
00429   LogDebug("RoadSearch") << "TEC ring initialized rmin/rmax/zmin/zmax: " << rmin 
00430                          << "/" << rmax 
00431                          << "/" << zmin 
00432                          << "/" << zmax;
00433     
00434   tempring.initialize(rmin,rmax,zmin,zmax);
00435 
00436   return tempring;
00437 }
00438 
00439 DetId RingMaker::constructTECDetId(unsigned int fw_bw,
00440                                    unsigned int wheel,
00441                                    unsigned int petal_fw_bw,
00442                                    unsigned int petal,
00443                                    unsigned int ring,
00444                                    unsigned int module,
00445                                    unsigned int stereo) {
00446 
00447   TECDetId id(fw_bw+1,wheel+1,petal_fw_bw,petal+1,ring+1,module+1,stereo);
00448   
00449   LogDebug("RoadSearch") << "constructed TEC ring DetId for side: " << id.side() 
00450                          << " wheel: " << id.wheel() 
00451                          << " ring: " << id.ring() 
00452                          << " petal fw(0)/bw(0): " << id.petal()[0] 
00453                          << " petal: " << id.petal()[1] 
00454                          << " module: " << id.module() 
00455                          << " stereo: " << id.stereo(); 
00456 
00457   return DetId(id.rawId());
00458 }
00459 
00460 void RingMaker::constructPXBRings(unsigned int &index) {
00461 
00462   unsigned int counter = 0;
00463 
00464   unsigned int layer_max   = 3;
00465   unsigned int module_max  = 8;
00466 
00467   for ( unsigned int layer = 0; layer < layer_max; ++layer ) {
00468     for ( unsigned int module = 0; module < module_max; ++module ) {
00469       Ring ring = constructPXBRing(layer,module);
00470       if ( ring.getNumDetIds() > 0 ) {
00471         ring.setindex(++index);
00472         double center_z = ring.getzmin() + ((ring.getzmax()-ring.getzmin())/2);
00473         rings_->insert(center_z,ring);
00474         ++counter;
00475         LogDebug("RoadSearch") << "constructed PXB ring with index: " << ring.getindex() 
00476                                << " consisting of " << ring.getNumDetIds() << " DetIds"; 
00477       }
00478     }    
00479   }    
00480 
00481   LogDebug("RoadSearch") << "constructed " << counter << " PXB rings"; 
00482   
00483 }
00484 
00485 Ring RingMaker::constructPXBRing(unsigned int layer,
00486                                  unsigned int module) {
00487 
00488   // variables for determinaton of rmin, rmax, zmin, zmax
00489   float rmin = 1200.;
00490   float rmax = 0.;
00491   float zmin = 2800.;
00492   float zmax = -2800.;
00493 
00494   unsigned int ladder_max = 44;
00495 
00496   Ring ring(Ring::PXBRing);
00497 
00498   for ( unsigned int ladder = 0; ladder < ladder_max; ++ladder ) {
00499     if ( pxb_[layer][ladder][module] > 0 ) {
00500       DetId id = constructPXBDetId(layer,ladder,module);
00501       double phi = determineExtensions(id,rmin,rmax,zmin,zmax,Ring::PXBRing);
00502       ring.addId(phi,id);
00503     }
00504   }
00505   
00506   LogDebug("RoadSearch") << "PXB ring initialized rmin/rmax/zmin/zmax: " << rmin 
00507                          << "/" << rmax 
00508                          << "/" << zmin 
00509                          << "/" << zmax;
00510     
00511   ring.initialize(rmin,rmax,zmin,zmax);
00512 
00513   return ring;
00514 }
00515 
00516 DetId RingMaker::constructPXBDetId(unsigned int layer,
00517                                    unsigned int ladder,
00518                                    unsigned int module) {
00519   PXBDetId id(layer+1,ladder+1,module+1);
00520         
00521   LogDebug("RoadSearch") << "constructed PXB ring DetId for layer: " << id.layer() 
00522                          << " ladder: " << id.ladder() 
00523                          << " module: " << id.det(); 
00524 
00525   return DetId(id.rawId());
00526 }
00527 
00528 void RingMaker::constructPXFRings(unsigned int &index) {
00529 
00530   unsigned int counter = 0;
00531 
00532   unsigned int fw_bw_max   = 2;
00533   unsigned int disk_max    = 2; // 2 disks
00534   unsigned int panel_max   = 2; // 2 sided panel on each blade
00535   unsigned int module_max  = 4; // 3-4 sensor arrays on each panel
00536 
00537   for ( unsigned int fw_bw = 0; fw_bw < fw_bw_max; ++fw_bw ) {
00538     for ( unsigned int disk = 0; disk < disk_max; ++disk ) {
00539       for ( unsigned int panel = 0; panel < panel_max; ++panel ) {
00540         for ( unsigned int module = 0; module < module_max; ++module ) {
00541           if ( pxf2_[fw_bw][disk][panel][module] > 0 ) {
00542             Ring ring = constructPXFRing(fw_bw,disk,panel,module);
00543             if ( ring.getNumDetIds() > 0 ) {
00544               ring.setindex(++index);
00545               double center_z = ring.getzmin() + ((ring.getzmax()-ring.getzmin())/2);
00546               rings_->insert(center_z,ring);
00547               ++counter;
00548             }
00549           }
00550         }
00551       }
00552     }    
00553   }    
00554 
00555   LogDebug("RoadSearch") << "constructed " << counter << " PXF rings"; 
00556   
00557 }
00558 
00559 Ring RingMaker::constructPXFRing(unsigned int fw_bw,
00560                                  unsigned int disk,
00561                                  unsigned int panel,
00562                                  unsigned int module) {
00563 
00564   // variables for determinaton of rmin, rmax, zmin, zmax
00565   float rmin = 1200.;
00566   float rmax = 0.;
00567   float zmin = 2800.;
00568   float zmax = -2800.;
00569 
00570   unsigned int blade_max   = 24;
00571 
00572   Ring ring(Ring::PXFRing);
00573 
00574   for ( unsigned int blade = 0; blade < blade_max; ++blade ) {
00575     if ( pxf_[fw_bw][disk][blade][panel][module] > 0 ) {
00576       DetId id = constructPXFDetId(fw_bw,disk,blade,panel,module);
00577       double phi = determineExtensions(id,rmin,rmax,zmin,zmax,Ring::PXFRing);
00578       ring.addId(phi,id);
00579     } 
00580   }
00581 
00582   LogDebug("RoadSearch") << "PXF ring initialized rmin/rmax/zmin/zmax: " << rmin 
00583                          << "/" << rmax 
00584                          << "/" << zmin 
00585                          << "/" << zmax;
00586     
00587   ring.initialize(rmin,rmax,zmin,zmax);
00588 
00589   return ring;
00590 }
00591 
00592 DetId RingMaker::constructPXFDetId(unsigned int fw_bw,
00593                                    unsigned int disk,
00594                                    unsigned int blade,
00595                                    unsigned int panel,
00596                                    unsigned int module) {
00597 
00598   PXFDetId id(fw_bw+1,disk+1,blade+1,panel+1,module+1);
00599 
00600   LogDebug("RoadSearch") << "constructed PXF ring DetId for fw_bw: " << id.side() 
00601                          << " disk: " << id.disk() 
00602                          << " blade: " << id.blade() 
00603                          << " panel: " << id.panel() 
00604                          << " module: " << id.module(); 
00605         
00606   return DetId(id.rawId());
00607 }
00608 
00609 double RingMaker::determineExtensions(DetId id, float &rmin, float &rmax, float &zmin, float& zmax, Ring::type type) {
00610 
00611   //solution for double modules: loop over r-phi and stereo sensors is required
00612   std::vector<unsigned int> UseRingIds;
00613 
00614   if ( type == Ring::TOBRing ) {
00615     TOBDetId tob_axial(id.rawId());
00616     UseRingIds.push_back(tob_axial.rawId());
00617     if ( tob_axial.partnerDetId() != 0 ) {
00618       TOBDetId tob_stereo(tob_axial.partnerDetId());
00619       UseRingIds.push_back(tob_stereo.rawId());
00620     }
00621   }
00622   if ( type == Ring::TIDRing ) {
00623     TIDDetId tid_axial(id.rawId());
00624     UseRingIds.push_back(tid_axial.rawId());
00625     if ( tid_axial.partnerDetId() != 0 ) {
00626       TIDDetId tid_stereo(tid_axial.partnerDetId());
00627       UseRingIds.push_back(tid_stereo.rawId());
00628     }
00629   }
00630   if ( type == Ring::TECRing ) {
00631     TECDetId tec_axial(id.rawId());
00632     UseRingIds.push_back(tec_axial.rawId());
00633     if ( tec_axial.partnerDetId() != 0 ) {
00634       TECDetId tec_stereo(tec_axial.partnerDetId());
00635       UseRingIds.push_back(tec_stereo.rawId());
00636     }
00637   }
00638   if ( type == Ring::PXBRing ) {
00639     PXBDetId pxb_axial(id.rawId());
00640     UseRingIds.push_back(pxb_axial.rawId());
00641   }
00642   if ( type == Ring::PXFRing ) {
00643     PXFDetId pxf_axial(id.rawId());
00644     UseRingIds.push_back(pxf_axial.rawId());
00645   }
00646 
00647 
00648   if ( type == Ring::TIBRing ) {
00649     TIBDetId tib_axial(id.rawId());
00650     UseRingIds.push_back(tib_axial.rawId());
00651     if ( tib_axial.partnerDetId() != 0 ) {
00652       TIBDetId tib_stereo(tib_axial.partnerDetId());
00653       UseRingIds.push_back(tib_stereo.rawId());
00654     }
00655   }
00656   double phi = 0.;
00657   for ( std::vector<unsigned int>::iterator it = UseRingIds.begin(); it != UseRingIds.end(); ++it) {
00658 
00659     const GeomDetUnit *det = tracker_->idToDetUnit(DetId(*it));
00660         
00661     if ( det != 0 ) {
00662       
00663       GlobalPoint p[8];
00664       float r[8],z[8];
00665       float local_rmin = 1200.;
00666       float local_rmax = 0.;
00667       float local_zmin = 2800.;
00668       float local_zmax = -2800.;
00669     
00670       // calculate global position of center
00671       GlobalPoint center = det->surface().toGlobal(LocalPoint(0,0,0)); 
00672       phi = center.phi();
00673 
00674       if ( (type == Ring::TIBRing) || (type == Ring::TOBRing) || (type == Ring::PXBRing) || (type == Ring::PXFRing) ) {
00675 
00676         float length = det->surface().bounds().length();
00677         float width = det->surface().bounds().width();
00678         float thickness = det->surface().bounds().thickness();
00679           
00680         p[0] = det->surface().toGlobal(LocalPoint(width/2,length/2,thickness/2)); 
00681         p[1] = det->surface().toGlobal(LocalPoint(width/2,-length/2,thickness/2)); 
00682         p[2] = det->surface().toGlobal(LocalPoint(-width/2,length/2,thickness/2)); 
00683         p[3] = det->surface().toGlobal(LocalPoint(-width/2,-length/2,thickness/2)); 
00684         p[4] = det->surface().toGlobal(LocalPoint(width/2,length/2,-thickness/2)); 
00685         p[5] = det->surface().toGlobal(LocalPoint(width/2,-length/2,-thickness/2)); 
00686         p[6] = det->surface().toGlobal(LocalPoint(-width/2,length/2,-thickness/2)); 
00687         p[7] = det->surface().toGlobal(LocalPoint(-width/2,-length/2,-thickness/2)); 
00688       
00689       } else if ( (type == Ring::TIDRing) || (type == Ring::TECRing) ) {
00690           
00691         std::array<const float, 4> const & parameters = ((const TrapezoidalPlaneBounds&)(det->surface().bounds())).parameters();
00692       
00693         p[0] = det->surface().toGlobal(LocalPoint(parameters[0],-parameters[3],parameters[2])); 
00694         p[1] = det->surface().toGlobal(LocalPoint(-parameters[0],-parameters[3],parameters[2])); 
00695         p[2] = det->surface().toGlobal(LocalPoint(parameters[1],parameters[3],parameters[2])); 
00696         p[3] = det->surface().toGlobal(LocalPoint(-parameters[1],parameters[3],parameters[2])); 
00697         p[4] = det->surface().toGlobal(LocalPoint(parameters[0],-parameters[3],-parameters[2])); 
00698         p[5] = det->surface().toGlobal(LocalPoint(-parameters[0],-parameters[3],-parameters[2])); 
00699         p[6] = det->surface().toGlobal(LocalPoint(parameters[1],parameters[3],-parameters[2])); 
00700         p[7] = det->surface().toGlobal(LocalPoint(-parameters[1],parameters[3],-parameters[2])); 
00701 
00702       } 
00703     
00704       for ( int i = 0; i < 8; ++i ) {
00705         r[i] = sqrt(p[i].x()*p[i].x() + p[i].y()*p[i].y());
00706         z[i] = p[i].z();
00707         if ( r[i] < local_rmin ) local_rmin = r[i];
00708         if ( r[i] > local_rmax ) local_rmax = r[i];
00709         if ( z[i] < local_zmin ) local_zmin = z[i];
00710         if ( z[i] > local_zmax ) local_zmax = z[i];
00711       }
00712     
00713       if ( local_rmin < rmin ) rmin = local_rmin;
00714       if ( local_rmax > rmax ) rmax = local_rmax;
00715       if ( local_zmin < zmin ) zmin = local_zmin;
00716       if ( local_zmax > zmax ) zmax = local_zmax;
00717   
00718     } else {
00719     
00720       if ( type == Ring::TIBRing ) {
00721         TIBDetId tibid(id.rawId());
00722         edm::LogError("RoadSearch") << "problem resolving DetUnit for TIB ring Detid: " << id.rawId() 
00723                                     << " layer: " << tibid.layer() 
00724                                     << " fw(0)/bw(1): " << tibid.string()[0]
00725                                     << " ext(0)/int(0): " << tibid.string()[1] 
00726                                     << " string: " << tibid.string()[2] 
00727                                     << " module: " << tibid.module()
00728                                     << " not stereo(0)/stereo(1): " << tibid.stereo() 
00729                                     << " not glued(0)/glued(1): " << tibid.glued(); 
00730       } else if ( type == Ring::TOBRing ) {
00731         TOBDetId tobid(id.rawId()); 
00732         edm::LogError("RoadSearch") << "problem resolving DetUnit for TOB ring Detid: " << id.rawId() 
00733                                     << " layer: " << tobid.layer() 
00734                                     << " fw(0)/bw(1): " << tobid.rod()[0]
00735                                     << " rod: " << tobid.rod()[1] 
00736                                     << " detector: " << tobid.det()
00737                                     << " not stereo(0)/stereo(1): " << tobid.stereo() 
00738                                     << " not glued(0)/glued(1): " << tobid.glued(); 
00739       } else if ( type == Ring::TIDRing ) {
00740         TIDDetId tidid(id.rawId()); 
00741         edm::LogError("RoadSearch") << "problem resolving DetUnit for TID ring Detid: " << id.rawId() 
00742                                     << " side neg(1)/pos(2): " << tidid.side() 
00743                                     << " wheel: " << tidid.wheel()
00744                                     << " ring: " << tidid.ring()
00745                                     << " module fw(0)/bw(1): " << tidid.module()[0]
00746                                     << " module: " << tidid.module()[1] 
00747                                     << " not stereo(0)/stereo(1): " << tidid.stereo() 
00748                                     << " not glued(0)/glued(1): " << tidid.glued(); 
00749       } else if ( type == Ring::TECRing ) {
00750         TECDetId tecid(id.rawId()); 
00751         edm::LogError("RoadSearch") << "problem resolving DetUnit for TEC ring DetId: " << id.rawId() 
00752                                     << " side neg(1)/pos(2): " << tecid.side() 
00753                                     << " wheel: " << tecid.wheel()
00754                                     << " petal fw(0)/bw(1): " << tecid.petal()[0]
00755                                     << " petal: " << tecid.petal()[1] 
00756                                     << " ring: " << tecid.ring()
00757                                     << " module: " << tecid.module()
00758                                     << " not stereo(0)/stereo(1): " << tecid.stereo() 
00759                                     << " not glued(0)/glued(1): " << tecid.glued(); 
00760       } else if ( type == Ring::PXBRing ) {
00761         PXBDetId pxbid(id.rawId()); 
00762         edm::LogError("RoadSearch") << "problem resolving DetUnit for PXB ring DetId: " << id.rawId() 
00763                                     << " layer: " << pxbid.layer()
00764                                     << " ladder: " << pxbid.ladder()
00765                                     << " module: " << pxbid.module(); 
00766       } else if ( type == Ring::PXFRing ) {
00767         PXFDetId pxfid(id.rawId()); 
00768         edm::LogError("RoadSearch") << "problem resolving DetUnit for PXF ring DetId: " << id.rawId() 
00769                                     << " side: " << pxfid.side()
00770                                     << " disk: " << pxfid.disk()
00771                                     << " blade: " << pxfid.blade()
00772                                     << " panel: " << pxfid.panel()
00773                                     << " module: " << pxfid.module(); 
00774       }
00775     }
00776   }
00777   LogDebug("RoadSearch") << "id/rmin/rmax/zmin/zmax " << id.rawId() << "/" << rmin <<"/"<<rmax<<"/"<<zmin<<"/"<<zmax;
00778   return phi;
00779 }
00780 
00781 void RingMaker::fillTIBGeometryArray() {
00782   // fill hardcoded TIB geometry array
00783   // tib[layer][str_fw_bw][str_int_ext][str][module][stereo]
00784   for (int i = 0; i < 5; ++i) {
00785     for (int j = 0; j < 3; ++j) {
00786       for (int k = 0; k < 3; ++k) {
00787         for (int l = 0; l < 57; ++l) {
00788           for (int m = 0; m < 4; ++m) {
00789             for (int n =0; n < 3; ++n) {
00790               tib_[i][j][k][l][m][n] = 0;
00791             }
00792           }
00793         }
00794       }
00795     }
00796   }
00797 
00798   std::vector<DetId> detIds = tracker_->detUnitIds();
00799   
00800   for ( std::vector<DetId>::iterator detiterator = detIds.begin(); detiterator != detIds.end(); ++detiterator ) {
00801     DetId id = *detiterator;
00802 
00803     if ( (unsigned int)id.subdetId() == StripSubdetector::TIB ) {
00804       TIBDetId tibid(id.rawId());
00805       
00806       if( (int)tibid.rawId()-(int)tibid.glued() == (int)tibid.rawId()) {
00807         //single sided: r-phi 
00808         //double sided: matched
00809         tib_[tibid.layer()-1][tibid.string()[0]][tibid.string()[1]][tibid.string()[2]-1][tibid.module()-1][0] += 1;
00810       } else if ( (int)tibid.rawId()-(int)tibid.glued() == 1) {
00811         //double sided: stereo
00812         tib_[tibid.layer()-1][tibid.string()[0]][tibid.string()[1]][tibid.string()[2]-1][tibid.module()-1][1] += 1;
00813       } else if ( (int)tibid.rawId()-(int)tibid.glued() == 2) { 
00814         //double sided: r-phi
00815         tib_[tibid.layer()-1][tibid.string()[0]][tibid.string()[1]][tibid.string()[2]-1][tibid.module()-1][2] += 1;
00816       } else {
00817         edm::LogError("RoadSearch") << "stereo of TIBId: " << id.rawId() << " could not be determined." << (int)tibid.glued(); 
00818       }
00819 
00820     }
00821   }
00822 }
00823 
00824 void RingMaker::fillTIDGeometryArray() {
00825   // fills hardcoded TID geometry array
00826   // tid[side][wheel][ring][module_fw_bw][module][stereo]
00827   // where stereo gives the int of the last constructor parameter
00828   // the content inidicates if detector with combination exists (>0) or not (==0)
00829 
00830   for (int i = 0; i < 3; ++i ) {
00831     for (int j = 0; j < 4; ++j ) {
00832       for (int k = 0; k < 4; ++k ) {
00833         for (int l = 0; l < 3; ++l ) {
00834           for (int m = 0; m < 21; ++m ) {
00835             for (int n = 0; n < 3; ++n ) {
00836               tid_[i][j][k][l][m][n] = 0;
00837             }
00838           }
00839         }
00840       }
00841     }
00842   }
00843 
00844   std::vector<DetId> detIds = tracker_->detUnitIds();
00845   
00846   for ( std::vector<DetId>::iterator detiterator = detIds.begin(); detiterator != detIds.end(); ++detiterator ) {
00847     DetId id = *detiterator;
00848 
00849     if ( (unsigned int)id.subdetId() == StripSubdetector::TID ) {
00850       TIDDetId tidid(id.rawId());
00851 
00852       if( (int)tidid.rawId()-(int)tidid.glued() == (int)tidid.rawId()) {
00853         //single sided: r-phi 
00854         //double sided: matched
00855         tid_[tidid.side()-1][tidid.wheel()-1][tidid.ring()-1][tidid.module()[0]][tidid.module()[1]-1][0] += 1;
00856       } else if ( (int)tidid.rawId()-(int)tidid.glued() == 1) {
00857         //double sided: stereo
00858         tid_[tidid.side()-1][tidid.wheel()-1][tidid.ring()-1][tidid.module()[0]][tidid.module()[1]-1][1] += 1;
00859       } else if ( (int)tidid.rawId()-(int)tidid.glued() == 2) { 
00860         //double sided: r-phi
00861         tid_[tidid.side()-1][tidid.wheel()-1][tidid.ring()-1][tidid.module()[0]][tidid.module()[1]-1][2] += 1;
00862       } else {
00863         edm::LogError("RoadSearch") << "stereo of TIDId: " << id.rawId() << " could not be determined."; 
00864       }
00865 
00866     }
00867   }
00868 }
00869 
00870 void RingMaker::fillTOBGeometryArray() {
00871   // fills hardcoded TOB geometry array
00872   // tob[layer][rod_fw_bw][rod][module][stereo]
00873   for (int i = 0; i < 7; ++i) {
00874     for (int j = 0; j < 3; ++j) {
00875       for (int k = 0; k < 75; ++k) {
00876         for (int l = 0; l < 7; ++l) {
00877           for (int m = 0; m < 3; ++m) {
00878             tob_[i][j][k][l][m] = 0;
00879           }
00880         }
00881       }
00882     }
00883   }
00884 
00885   std::vector<DetId> detIds = tracker_->detUnitIds();
00886   
00887   for ( std::vector<DetId>::iterator detiterator = detIds.begin(); detiterator != detIds.end(); ++detiterator ) {
00888     DetId id = *detiterator;
00889 
00890     if ( (unsigned int)id.subdetId() == StripSubdetector::TOB ) {
00891       TOBDetId tobid(id.rawId());
00892 
00893       if( (int)tobid.rawId()-(int)tobid.glued() == (int)tobid.rawId()) {
00894         //single sided: r-phi 
00895         //double sided: matched
00896         tob_[tobid.layer()-1][tobid.rod()[0]][tobid.rod()[1]-1][tobid.module()-1][0] += 1;
00897       } else if ( (int)tobid.rawId()-(int)tobid.glued() == 1) {
00898         //double sided: stereo
00899         tob_[tobid.layer()-1][tobid.rod()[0]][tobid.rod()[1]-1][tobid.module()-1][1] += 1;
00900       } else if ( (int)tobid.rawId()-(int)tobid.glued() == 2) { 
00901         //double sided: r-phi
00902         tob_[tobid.layer()-1][tobid.rod()[0]][tobid.rod()[1]-1][tobid.module()-1][2] += 1;
00903       } else {
00904         edm::LogError("RoadSearch") << "stereo of TOBId: " << id.rawId() << " could not be determined."; 
00905       }
00906 
00907     }
00908   }
00909 }
00910 
00911 void RingMaker::fillTECGeometryArray() {
00912   // fills hardcoded TEC geometry array
00913   // tec[side][wheel][petal_fw_bw][petal][ring][module][stereo]
00914   // where stereo gives the int of the last constructor parameter
00915   // the content inidicates if detector with combination exists (>0) or not (==0)
00916 
00917   // fill two arrays to restrict first loop (number of rings dependent on wheel)
00918 
00919   for (int i = 0; i < 3; ++i ) {
00920     for (int j = 0; j < 10; ++j ) {
00921       for (int k = 0; k < 3; ++k ) {
00922         for (int l = 0; l < 9; ++l ) {
00923           for (int m = 0; m < 8; ++m ) {
00924             for (int n = 0; n < 21; ++n ) {
00925               for (int o = 0; o < 3; ++o ) {
00926                 tec_[i][j][k][l][m][n][o] = 0;
00927               }
00928             }   
00929           }
00930         }
00931       }
00932     }
00933   }
00934 
00935   for (int i = 0; i < 3; ++i ) {
00936     for (int j = 0; j < 10; ++j ) {
00937       for (int k = 0; k < 8; ++k ) {
00938         tec2_[i][j][k] = 0;
00939       }
00940     }   
00941   }
00942 
00943   std::vector<DetId> detIds = tracker_->detUnitIds();
00944   
00945   for ( std::vector<DetId>::iterator detiterator = detIds.begin(); detiterator != detIds.end(); ++detiterator ) {
00946     DetId id = *detiterator;
00947 
00948     if ( (unsigned int)id.subdetId() == StripSubdetector::TEC ) {
00949       TECDetId tecid(id.rawId());
00950 
00951       if( (int)tecid.rawId()-(int)tecid.glued() == (int)tecid.rawId()) {
00952         //single sided: r-phi 
00953         //double sided: matched
00954         tec_[tecid.side()-1][tecid.wheel()-1][tecid.petal()[0]][tecid.petal()[1]-1][tecid.ring()-1][tecid.module()-1][0] += 1;
00955         tec2_[tecid.side()-1][tecid.wheel()-1][tecid.ring()-1] += 1;
00956       } else if ( (int)tecid.rawId()-(int)tecid.glued() == 1) {
00957         //double sided: stereo
00958         tec_[tecid.side()-1][tecid.wheel()-1][tecid.petal()[0]][tecid.petal()[1]-1][tecid.ring()-1][tecid.module()-1][1] += 1;
00959         tec2_[tecid.side()-1][tecid.wheel()-1][tecid.ring()-1] += 1;
00960       } else if ( (int)tecid.rawId()-(int)tecid.glued() == 2) { 
00961         //double sided: r-phi
00962         tec_[tecid.side()-1][tecid.wheel()-1][tecid.petal()[0]][tecid.petal()[1]-1][tecid.ring()-1][tecid.module()-1][2] += 1;
00963         tec2_[tecid.side()-1][tecid.wheel()-1][tecid.ring()-1] += 1;
00964       } else {
00965         edm::LogError("RoadSearch") << "stereo of TECId: " << id.rawId() << " could not be determined."; 
00966       }
00967 
00968     }
00969   }
00970 }
00971 
00972 void RingMaker::fillPXBGeometryArray() {
00973   // fills hardcoded PXB geometry array: pxb[layer][ladder][module]
00974   // module gives the int of the last constructor parameter
00975   // content of [module] indicates if module with combination exists (>0) or not (==0)
00976 
00977   for (int i = 0; i < 3; ++i ) {
00978     for (int j = 0; j < 44; ++j ) {
00979       for (int k = 0; k < 8; ++k ) {
00980         pxb_[i][j][k] = 0;
00981       }
00982     }
00983   }
00984 
00985   std::vector<DetId> detIds = tracker_->detUnitIds();
00986   
00987   for ( std::vector<DetId>::iterator detiterator = detIds.begin(); detiterator != detIds.end(); ++detiterator ) {
00988     DetId id = *detiterator;
00989 
00990     if ( (unsigned int)id.subdetId() == PixelSubdetector::PixelBarrel ) {
00991       PXBDetId pxbid(id.rawId());
00992 
00993       //sanity check with partner ID not possible
00994       pxb_[pxbid.layer()-1][pxbid.ladder()-1][pxbid.module()-1] += 1;
00995       
00996     }
00997   }
00998 }
00999 
01000 void RingMaker::fillPXFGeometryArray() {
01001   // fills hardcoded PXF geometry array: pxf[side][disk][blade][panel][module]
01002   // module gives the int of the last constructor parameter
01003   // content of [module] indicates if module with combination exists (>0) or not (==0)
01004 
01005   for (int i = 0; i < 2; ++i ) {
01006     for (int j = 0; j < 2; ++j ) {
01007       for (int k = 0; k < 24; ++k ) {
01008         for (int l = 0; l < 2; ++l ) {
01009           for (int m = 0; m < 4; ++m ) {
01010             pxf_[i][j][k][l][m] = 0;
01011           }
01012         }
01013       }
01014     }
01015   }
01016 
01017   for (int i = 0; i < 2; ++i ) {
01018     for (int j = 0; j < 2; ++j ) {
01019         for (int k = 0; k < 2; ++k ) {
01020           for (int l = 0; l < 4; ++l ) {
01021             pxf2_[i][j][k][l] = 0;
01022           }
01023         }
01024     }
01025   }
01026 
01027   std::vector<DetId> detIds = tracker_->detUnitIds();
01028   
01029   for ( std::vector<DetId>::iterator detiterator = detIds.begin(); detiterator != detIds.end(); ++detiterator ) {
01030     DetId id = *detiterator;
01031 
01032     if ( (unsigned int)id.subdetId() == PixelSubdetector::PixelEndcap ) {
01033       PXFDetId pxfid(id.rawId());
01034 
01035       //sanity check with partner ID not possible
01036       pxf_[pxfid.side()-1][pxfid.disk()-1][pxfid.blade()-1][pxfid.panel()-1][pxfid.module()-1] += 1;
01037       pxf2_[pxfid.side()-1][pxfid.disk()-1][pxfid.panel()-1][pxfid.module()-1] += 1;
01038       
01039     }
01040   }
01041 }
01042 
01043 bool RingMaker::dumpDetIdsIntoFile(std::string filename) {
01044   //
01045   // dumps all tracker detids in geometry
01046   //
01047 
01048   // return value
01049   bool result = true;
01050 
01051   std::ofstream output(filename.c_str());
01052 
01053   output << dumpDetIds();
01054 
01055   return result;
01056 
01057 }
01058 
01059 std::string RingMaker::dumpDetIds() {
01060   //
01061   // dumps all tracker detids in geometry
01062   //
01063 
01064   std::ostringstream output;
01065 
01066   std::vector<DetId> detIds = tracker_->detUnitIds();
01067 
01068   output << std::endl << "[RoadMaker] Total number of DETECTOR = " << detIds.size() << std::endl;
01069 
01070   for ( std::vector<DetId>::iterator detiterator = detIds.begin(); detiterator != detIds.end(); ++detiterator ) {
01071     DetId id = *detiterator;
01072 
01073     if ( (unsigned int)id.subdetId() == StripSubdetector::TIB ) {
01074       TIBDetId tibid(id.rawId()); 
01075       output << "[RoadMaker] DetUnit for TIB ring Detid: " << id.rawId() 
01076              << " layer: " << tibid.layer() 
01077              << " fw(0)/bw(1): " << tibid.string()[0]
01078              << " ext(0)/int(0): " << tibid.string()[1] 
01079              << " string: " << tibid.string()[2] 
01080              << " detector: " << tibid.module()
01081              << " not stereo(0)/stereo(1): " << tibid.stereo() 
01082              << " not glued(0)/glued(1): " << tibid.glued() 
01083              << std::endl; 
01084     } else if ( (unsigned int)id.subdetId() == StripSubdetector::TOB ) {
01085       TOBDetId tobid(id.rawId()); 
01086       output << "[RoadMaker] DetUnit for TOB ring Detid: " << id.rawId() 
01087              << " layer: " << tobid.layer() 
01088              << " fw(0)/bw(1): " << tobid.rod()[0]
01089              << " rod: " << tobid.rod()[1] 
01090              << " detector: " << tobid.module()
01091              << " not stereo(0)/stereo(1): " << tobid.stereo() 
01092              << " not glued(0)/glued(1): " << tobid.glued() 
01093              << std::endl; 
01094     } else if ( (unsigned int)id.subdetId() == StripSubdetector::TID ) {
01095       TIDDetId tidid(id.rawId()); 
01096       output << "[RoadMaker] DetUnit for TID ring Detid: " << id.rawId() 
01097              << " side neg(1)/pos(2): " << tidid.side() 
01098              << " wheel: " << tidid.wheel()
01099              << " ring: " << tidid.ring()
01100              << " detector fw(0)/bw(1): " << tidid.module()[0]
01101              << " detector: " << tidid.module()[1] 
01102              << " not stereo(0)/stereo(1): " << tidid.stereo() 
01103              << " not glued(0)/glued(1): " << tidid.glued() 
01104              << std::endl; 
01105     } else if ( (unsigned int)id.subdetId() == StripSubdetector::TEC ) {
01106       TECDetId tecid(id.rawId()); 
01107       output << "[RoadMaker] DetUnit for TEC ring DetId: " << id.rawId() 
01108              << " side neg(1)/pos(2): " << tecid.side() 
01109              << " wheel: " << tecid.wheel()
01110              << " petal fw(0)/bw(1): " << tecid.petal()[0]
01111              << " petal: " << tecid.petal()[1] 
01112              << " ring: " << tecid.ring()
01113              << " module: " << tecid.module();
01114       if ( ((int)tecid.partnerDetId()-(int)id.rawId()) == 1 ) {
01115         output << " stereo: 1";
01116       } else if ( ((int)tecid.partnerDetId()-(int)id.rawId()) == -1 ) {
01117         output << " stereo: 2";
01118       } else if ( tecid.partnerDetId() == 0 ) {
01119         output << " stereo: 0";
01120       } else {
01121         output << " stereo: problem";
01122       }
01123       output << std::endl; 
01124     } else if ( (unsigned int)id.subdetId() == PixelSubdetector::PixelBarrel ) {
01125       PXBDetId pxbid(id.rawId()); 
01126       output << "[RoadMaker] DetUnit for PXB ring DetId: " << id.rawId() 
01127              << " layer: " << pxbid.layer()
01128              << " ladder: " << pxbid.ladder()
01129              << " detector: " << pxbid.module()
01130              << std::endl; 
01131     } else if ( (unsigned int)id.subdetId() == PixelSubdetector::PixelEndcap ) {
01132       PXFDetId pxfid(id.rawId()); 
01133       output << "[RoadMaker] DetUnit for PXF ring DetId: " << id.rawId() 
01134              << " side: " << pxfid.side()
01135              << " disk: " << pxfid.disk()
01136              << " blade: " << pxfid.blade()
01137              << " detector: " << pxfid.module()
01138              << std::endl; 
01139     } else {
01140       output << "[RoadMaker] DetUnit for unknown subdetector: " << id.rawId() << std::endl;
01141     }
01142 
01143   }
01144 
01145   return output.str();
01146   
01147 }