CMS 3D CMS Logo

/data/git/CMSSW_5_3_11_patch5/src/FastSimulation/Tracking/src/TrackerRecHit.cc

Go to the documentation of this file.
00001 #include "FastSimulation/Tracking/interface/TrackerRecHit.h"
00002 #include "FastSimulation/TrackerSetup/interface/TrackerInteractionGeometry.h"
00003 
00004 TrackerRecHit::TrackerRecHit(const SiTrackerGSMatchedRecHit2D* theHit, 
00005                              const TrackerGeometry* theGeometry) :
00006   theSplitHit(0),
00007   theMatchedHit(theHit),
00008   theSubDetId(0),
00009   theLayerNumber(0),
00010   theRingNumber(0),
00011   theCylinderNumber(0),
00012   theLocalError(0.),
00013   theLargerError(0.)
00014      
00015 { 
00016   init(theGeometry);
00017 }
00018 
00019 TrackerRecHit::TrackerRecHit(const SiTrackerGSRecHit2D* theHit, 
00020                              const TrackerGeometry* theGeometry) :
00021   theSplitHit(theHit),
00022   theMatchedHit(0),
00023   theSubDetId(0),
00024   theLayerNumber(0),
00025   theRingNumber(0),
00026   theCylinderNumber(0),
00027   theLocalError(0.),
00028   theLargerError(0.)
00029      
00030 { 
00031   init(theGeometry);
00032 }
00033 
00034 void
00035 TrackerRecHit::init(const TrackerGeometry* theGeometry) { 
00036 
00037   const DetId& theDetId = hit()->geographicalId();
00038   theGeomDet = theGeometry->idToDet(theDetId);
00039   theSubDetId = theDetId.subdetId(); 
00040   if ( theSubDetId == StripSubdetector::TIB) { 
00041     TIBDetId tibid(theDetId.rawId()); 
00042     theLayerNumber = tibid.layer();
00043     theCylinderNumber = TrackerInteractionGeometry::TIB+theLayerNumber;
00044     forward = false;
00045   } else if ( theSubDetId ==  StripSubdetector::TOB ) { 
00046     TOBDetId tobid(theDetId.rawId()); 
00047     theLayerNumber = tobid.layer();
00048     theCylinderNumber = TrackerInteractionGeometry::TOB+theLayerNumber;
00049     forward = false;
00050   } else if ( theSubDetId ==  StripSubdetector::TID) { 
00051     TIDDetId tidid(theDetId.rawId());
00052     theLayerNumber = tidid.wheel();
00053     theCylinderNumber = TrackerInteractionGeometry::TID+theLayerNumber;
00054     theRingNumber = tidid.ring();
00055     forward = true;
00056   } else if ( theSubDetId ==  StripSubdetector::TEC ) { 
00057     TECDetId tecid(theDetId.rawId()); 
00058     theLayerNumber = tecid.wheel(); 
00059     theCylinderNumber = TrackerInteractionGeometry::TEC+theLayerNumber;
00060     theRingNumber = tecid.ring();
00061     forward = true;
00062   } else if ( theSubDetId ==  PixelSubdetector::PixelBarrel ) { 
00063     PXBDetId pxbid(theDetId.rawId()); 
00064     theLayerNumber = pxbid.layer(); 
00065     theCylinderNumber = TrackerInteractionGeometry::PXB+theLayerNumber;
00066     forward = false;
00067   } else if ( theSubDetId ==  PixelSubdetector::PixelEndcap ) { 
00068     PXFDetId pxfid(theDetId.rawId()); 
00069     theLayerNumber = pxfid.disk();  
00070     theCylinderNumber = TrackerInteractionGeometry::PXD+theLayerNumber;
00071     forward = true;
00072   }
00073   
00074 }
00075 
00076 bool
00077 //TrackerRecHit::isOnRequestedDet(const std::vector<unsigned int>& whichDet) const { 
00078 TrackerRecHit::isOnRequestedDet(const std::vector<unsigned int>& whichDet, const std::string& seedingAlgo) const { 
00079   
00080   bool isOnDet = false;
00081   
00082   for ( unsigned idet=0; idet<whichDet.size(); ++idet ) {
00083     
00084     switch ( whichDet[idet] ) { 
00085       
00086     case 1: 
00087       //Pixel Barrel
00088       isOnDet =  theSubDetId==1;
00089       break;
00090       
00091     case 2: 
00092       //Pixel Disks
00093       isOnDet = theSubDetId==2;
00094       break;
00095       
00096     case 3:
00097       //Inner Barrel
00098       isOnDet = theSubDetId==3 && theLayerNumber < 4;
00099       break;
00100       
00101     case 4:
00102       //Inner Disks
00103       isOnDet = theSubDetId==4 && theRingNumber < 3;
00104       break;
00105       
00106     case 5:
00107       //Outer Barrel
00108       if(seedingAlgo == "TobTecLayerPairs"){
00109         isOnDet = theSubDetId==5 && theLayerNumber <3;
00110       }else {
00111         isOnDet = false;
00112       }
00113       break;
00114       
00115     case 6:
00116       //Tracker EndCap
00117       if(seedingAlgo == "PixelLessPairs"){
00118         isOnDet = theSubDetId==6 && theLayerNumber < 6 && theRingNumber < 3;
00119       }else if (seedingAlgo == "TobTecLayerPairs"){
00120         //      isOnDet = theSubDetId==6 && theLayerNumber < 8 && theRingNumber < 5;
00121         isOnDet = theSubDetId==6 && theLayerNumber < 8 && theRingNumber == 5;
00122       } else if (seedingAlgo == "MixedTriplets"){ 
00123         //      isOnDet = theSubDetId==6 && theLayerNumber == 2 && theRingNumber == 1;
00124         isOnDet = theSubDetId==6 && theLayerNumber < 4 && theRingNumber == 1;
00125       } else {
00126         isOnDet = theSubDetId==6;
00127         std::cout << "DEBUG - this should never happen" << std::endl;
00128       }
00129 
00130       break;
00131       
00132     default:
00133       // Should not happen
00134       isOnDet = false;
00135       break;
00136       
00137     }
00138     
00139     if ( isOnDet ) break;
00140     
00141   }
00142   
00143   return isOnDet;
00144 }
00145 
00146 bool
00147 TrackerRecHit::makesAPairWith(const TrackerRecHit& anotherHit) const { 
00148 
00149   bool isAProperPair = false;
00150 
00151   unsigned int anotherSubDetId = anotherHit.subDetId();
00152   unsigned int anotherLayerNumber = anotherHit.layerNumber();
00153   isAProperPair = 
00154     // First hit on PXB1
00155     ( ( theSubDetId == 1 && theLayerNumber == 1 ) && (
00156       ( anotherSubDetId == 1 && anotherLayerNumber == 2) || 
00157       ( anotherSubDetId == 1 && anotherLayerNumber == 3) || 
00158       ( anotherSubDetId == 2 && anotherLayerNumber == 1) || 
00159       ( anotherSubDetId == 2 && anotherLayerNumber == 2) ) ) || 
00160     // First hit on PXB2
00161     ( ( theSubDetId == 1 && theLayerNumber == 2 ) && (
00162       ( anotherSubDetId == 1 && anotherLayerNumber == 3) || 
00163       ( anotherSubDetId == 2 && anotherLayerNumber == 1) || 
00164       ( anotherSubDetId == 2 && anotherLayerNumber == 2) ) ) ||
00165     // First Hit on PXD1
00166     ( ( theSubDetId == 2 && theLayerNumber == 1 ) && 
00167       ( anotherSubDetId == 2 && anotherLayerNumber == 2 ) ) ||
00168     // First Hit on PXD2
00169     ( ( theSubDetId == 2 && theLayerNumber == 2 ) && ( 
00170       ( anotherSubDetId == 6 && anotherLayerNumber == 1 ) ||
00171       ( anotherSubDetId == 6 && anotherLayerNumber == 2 ) ) ) ||
00172     // First Hit on TEC1
00173     ( ( theSubDetId == 6 && theLayerNumber == 1 ) && 
00174       ( anotherSubDetId == 6 && anotherLayerNumber == 2 ) ) ||
00175     // First Hit on TEC2
00176     ( ( theSubDetId == 6 && theLayerNumber == 2 ) && 
00177       ( anotherSubDetId == 6 && anotherLayerNumber == 3 ) ) ||
00178 
00179   //Pixelless Pairs  
00180    // First Hit on TIB1
00181     ( ( theSubDetId == 3 && theLayerNumber == 1 ) && 
00182       (( anotherSubDetId == 3 && anotherLayerNumber == 2 ) ||
00183        ( anotherSubDetId == 4 && anotherLayerNumber == 1 )) ) ||
00184     // First Hit on TID1
00185     ( ( theSubDetId == 4 && theLayerNumber == 1 ) && 
00186       ( anotherSubDetId == 4 && anotherLayerNumber == 2 ) ) ||
00187     // First Hit on TID2
00188     ( ( theSubDetId == 4 && theLayerNumber == 2 ) && 
00189       ( anotherSubDetId == 4 && anotherLayerNumber == 3 ) ) ||
00190     // First Hit on TID3
00191     ( ( theSubDetId == 4 && theLayerNumber == 3 ) && 
00192       ( anotherSubDetId == 6 && anotherLayerNumber == 1 ) ) ||
00193     // First Hit on TEC3
00194     ( ( theSubDetId == 6 && theLayerNumber == 3 ) && 
00195       (      ( anotherSubDetId == 6 && anotherLayerNumber == 4 ) || 
00196              ( anotherSubDetId == 6 && anotherLayerNumber == 5 ))  ) ||
00197     // First Hit on TEC4
00198     ( ( theSubDetId == 6 && theLayerNumber == 4 ) && 
00199       ( anotherSubDetId == 6 && anotherLayerNumber == 5 ) ) ||
00200 
00201   //Tob-Tec pairs
00202   //first hit on TOB1 
00203     ( ( theSubDetId == 5 && theLayerNumber == 1 ) && 
00204       (( anotherSubDetId == 5 && anotherLayerNumber == 2 ) ||
00205        ( anotherSubDetId == 6 && anotherLayerNumber == 1 )) ) ||
00206     // First Hit on TEC1
00207     ( ( theSubDetId == 6 && theLayerNumber == 1 ) && 
00208       ( anotherSubDetId == 6 && anotherLayerNumber == 2 ) ) ||
00209     // First Hit on TEC2
00210     ( ( theSubDetId == 6 && theLayerNumber == 2 ) && 
00211       ( anotherSubDetId == 6 && anotherLayerNumber == 3 ) ) ||
00212     // First Hit on TEC3
00213     ( ( theSubDetId == 6 && theLayerNumber == 3 ) && 
00214       ( anotherSubDetId == 6 && anotherLayerNumber == 4 ) ) || 
00215       // ???     ( anotherSubDetId == 6 && anotherLayerNumber == 5 ) ) ||
00216     // First Hit on TEC4
00217     ( ( theSubDetId == 6 && theLayerNumber == 4 ) && 
00218       ( anotherSubDetId == 6 && anotherLayerNumber == 5 ) ) ||
00219     // First Hit on TEC5
00220     ( ( theSubDetId == 6 && theLayerNumber == 5 ) && 
00221       ( anotherSubDetId == 6 && anotherLayerNumber == 6 ) ) ||
00222     // First Hit on TEC6
00223     ( ( theSubDetId == 6 && theLayerNumber == 6 ) && 
00224       ( anotherSubDetId == 6 && anotherLayerNumber == 7 ) ) ;
00225 
00226   return isAProperPair;
00227 
00228 } 
00229 
00230 bool
00231 TrackerRecHit::makesAPairWith3rd(const TrackerRecHit& anotherHit) const { 
00232 
00233   bool isAProperPair = false;
00234 
00235   unsigned int anotherSubDetId = anotherHit.subDetId();
00236   unsigned int anotherLayerNumber = anotherHit.layerNumber();
00237   isAProperPair = 
00238     // First hit on PXB1
00239     ( ( theSubDetId == 1 && theLayerNumber == 1 ) && (
00240       ( anotherSubDetId == 1 && anotherLayerNumber == 2) || 
00241       ( anotherSubDetId == 2 && anotherLayerNumber == 1) ) ) || 
00242       // First hit on PXB2
00243     ( ( theSubDetId == 1 && theLayerNumber == 2 ) && 
00244       ( anotherSubDetId == 1 && anotherLayerNumber == 3) ) || 
00245     // First Hit on PXD1
00246     ( ( theSubDetId == 2 && theLayerNumber == 1 ) && 
00247       ( anotherSubDetId == 2 && anotherLayerNumber == 2) ) ||
00248     // First Hit on PXD2
00249     ( ( theSubDetId == 2 && theLayerNumber == 2 ) &&  
00250       ( anotherSubDetId == 6 && anotherLayerNumber == 2 ) );
00251 
00252  return isAProperPair;
00253 
00254 }
00255       
00256 bool
00257 TrackerRecHit::makesATripletWith(const TrackerRecHit& anotherHit,
00258                                  const TrackerRecHit& yetAnotherHit ) const { 
00259 
00260   bool isAProperTriplet = false;
00261 
00262   unsigned int anotherSubDetId = anotherHit.subDetId();
00263   unsigned int anotherLayerNumber = anotherHit.layerNumber();
00264   unsigned int yetAnotherSubDetId = yetAnotherHit.subDetId();
00265   unsigned int yetAnotherLayerNumber = yetAnotherHit.layerNumber();
00266   isAProperTriplet = 
00267     // First hit on PXB1, second on PXB2
00268     ( ( theSubDetId == 1 && theLayerNumber == 1 ) && 
00269       ( anotherSubDetId == 1 && anotherLayerNumber == 2) && ( 
00270       ( yetAnotherSubDetId == 1 && yetAnotherLayerNumber == 3) || 
00271       ( yetAnotherSubDetId == 2 && yetAnotherLayerNumber == 1) || 
00272       ( yetAnotherSubDetId == 3 && yetAnotherLayerNumber == 1) ) ) || 
00273     // First hit on PXB1, second on PXB3 
00274     ( ( theSubDetId == 1 && theLayerNumber == 1 ) &&
00275       ( anotherSubDetId == 1 && anotherLayerNumber == 3) && 
00276       ( yetAnotherSubDetId == 3 && yetAnotherLayerNumber == 1) ) || 
00277     // First hit on PXB2, second on PXB3 
00278     ( ( theSubDetId == 1 && theLayerNumber == 2 ) &&
00279       ( anotherSubDetId == 1 && anotherLayerNumber == 3) && 
00280       ( yetAnotherSubDetId == 3 && yetAnotherLayerNumber == 1) ) || 
00281     // First Hit on PXB1, second on PXD1
00282     ( ( theSubDetId == 1 && theLayerNumber == 1 ) &&
00283       ( anotherSubDetId == 2 && anotherLayerNumber == 1) && ( 
00284       ( yetAnotherSubDetId == 2 && yetAnotherLayerNumber == 2) || 
00285       ( yetAnotherSubDetId == 4 && yetAnotherLayerNumber == 1) || 
00286       ( yetAnotherSubDetId == 4 && yetAnotherLayerNumber == 2) ) ) || 
00287     // First Hit on PXD1, second on PXD2
00288     ( ( theSubDetId == 2 && theLayerNumber == 1 ) && 
00289       ( anotherSubDetId == 2 && anotherLayerNumber == 2 ) && (
00290       ( yetAnotherSubDetId == 6 && yetAnotherLayerNumber == 1 ) ||
00291       ( yetAnotherSubDetId == 6 && yetAnotherLayerNumber == 2 ) ) ) ||
00292     // First hit on TIB1 (pixel less)
00293     ( ( theSubDetId == 3 && theLayerNumber == 1 ) && 
00294       ( anotherSubDetId == 3 && anotherLayerNumber == 2 ) && 
00295       ( yetAnotherSubDetId == 3 && yetAnotherLayerNumber == 3 ) );
00296   
00297   return isAProperTriplet;
00298   
00299 }
00300 
00301 
00302 
00303