CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch13/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 == "FourthPixelLessPairs"){
00118         //for the pixelless now we use TEC layers 1-5 
00119         isOnDet = theSubDetId==6 && theLayerNumber < 6 && theRingNumber < 3;
00120       }else if (seedingAlgo == "TobTecLayerPairs"){
00121         //for the tob-tec now we use TEC layers 1-7 and rings= 5 
00122         //      isOnDet = theSubDetId==6 && theLayerNumber < 8 && theRingNumber < 5;
00123         isOnDet = theSubDetId==6 && theLayerNumber < 8 && theRingNumber == 5;
00124       } else if (seedingAlgo == "ThirdMixedPairs"){
00125         //up to the third step we use only 2 and ring1&2 
00126         isOnDet = theSubDetId==6 && theLayerNumber == 2 && theRingNumber < 3;
00127     } else {
00128         //on second step we use layer  up to 3 but only ring 1
00129         isOnDet = theSubDetId==6 && theLayerNumber < 4 && theRingNumber == 1 ;
00130     }
00131 
00132       break;
00133       
00134     default:
00135       // Should not happen
00136       isOnDet = false;
00137       break;
00138       
00139     }
00140     
00141     if ( isOnDet ) break;
00142     
00143   }
00144   
00145   return isOnDet;
00146 }
00147 
00148 bool
00149 TrackerRecHit::makesAPairWith(const TrackerRecHit& anotherHit) const { 
00150 
00151   bool isAProperPair = false;
00152 
00153   unsigned int anotherSubDetId = anotherHit.subDetId();
00154   unsigned int anotherLayerNumber = anotherHit.layerNumber();
00155   isAProperPair = 
00156     // First hit on PXB1
00157     ( ( theSubDetId == 1 && theLayerNumber == 1 ) && (
00158       ( anotherSubDetId == 1 && anotherLayerNumber == 2) || 
00159       ( anotherSubDetId == 1 && anotherLayerNumber == 3) || 
00160       ( anotherSubDetId == 2 && anotherLayerNumber == 1) || 
00161       ( anotherSubDetId == 2 && anotherLayerNumber == 2) ) ) || 
00162     // First hit on PXB2
00163     ( ( theSubDetId == 1 && theLayerNumber == 2 ) && (
00164       ( anotherSubDetId == 1 && anotherLayerNumber == 3) || 
00165       ( anotherSubDetId == 2 && anotherLayerNumber == 1) || 
00166       ( anotherSubDetId == 2 && anotherLayerNumber == 2) ) ) ||
00167     // First Hit on PXD1
00168     ( ( theSubDetId == 2 && theLayerNumber == 1 ) && 
00169       ( anotherSubDetId == 2 && anotherLayerNumber == 2 ) ) ||
00170     // First Hit on PXD2
00171     ( ( theSubDetId == 2 && theLayerNumber == 2 ) && ( 
00172       ( anotherSubDetId == 6 && anotherLayerNumber == 1 ) ||
00173       ( anotherSubDetId == 6 && anotherLayerNumber == 2 ) ) ) ||
00174     // First Hit on TEC1
00175     ( ( theSubDetId == 6 && theLayerNumber == 1 ) && 
00176       ( anotherSubDetId == 6 && anotherLayerNumber == 2 ) ) ||
00177     // First Hit on TEC2
00178     ( ( theSubDetId == 6 && theLayerNumber == 2 ) && 
00179       ( anotherSubDetId == 6 && anotherLayerNumber == 3 ) ) ||
00180 
00181   //Pixelless Pairs  
00182    // First Hit on TIB1
00183     ( ( theSubDetId == 3 && theLayerNumber == 1 ) && 
00184       (( anotherSubDetId == 3 && anotherLayerNumber == 2 ) ||
00185        ( anotherSubDetId == 4 && anotherLayerNumber == 1 )) ) ||
00186     // First Hit on TID1
00187     ( ( theSubDetId == 4 && theLayerNumber == 1 ) && 
00188       ( anotherSubDetId == 4 && anotherLayerNumber == 2 ) ) ||
00189     // First Hit on TID2
00190     ( ( theSubDetId == 4 && theLayerNumber == 2 ) && 
00191       ( anotherSubDetId == 4 && anotherLayerNumber == 3 ) ) ||
00192     // First Hit on TID3
00193     ( ( theSubDetId == 4 && theLayerNumber == 3 ) && 
00194       ( anotherSubDetId == 6 && anotherLayerNumber == 1 ) ) ||
00195     // First Hit on TEC3
00196     ( ( theSubDetId == 6 && theLayerNumber == 3 ) && 
00197       (      ( anotherSubDetId == 6 && anotherLayerNumber == 4 ) || 
00198              ( anotherSubDetId == 6 && anotherLayerNumber == 5 ))  ) ||
00199     // First Hit on TEC4
00200     ( ( theSubDetId == 6 && theLayerNumber == 4 ) && 
00201       ( anotherSubDetId == 6 && anotherLayerNumber == 5 ) ) ||
00202 
00203   //Tob-Tec pairs
00204   //first hit on TOB1 
00205     ( ( theSubDetId == 5 && theLayerNumber == 1 ) && 
00206       (( anotherSubDetId == 5 && anotherLayerNumber == 2 ) ||
00207        ( anotherSubDetId == 6 && anotherLayerNumber == 1 )) ) ||
00208     // First Hit on TEC1
00209     ( ( theSubDetId == 6 && theLayerNumber == 1 ) && 
00210       ( anotherSubDetId == 6 && anotherLayerNumber == 2 ) ) ||
00211     // First Hit on TEC2
00212     ( ( theSubDetId == 6 && theLayerNumber == 2 ) && 
00213       ( anotherSubDetId == 6 && anotherLayerNumber == 3 ) ) ||
00214     // First Hit on TEC3
00215     ( ( theSubDetId == 6 && theLayerNumber == 3 ) && 
00216       ( anotherSubDetId == 6 && anotherLayerNumber == 4 ) ) || 
00217       // ???     ( anotherSubDetId == 6 && anotherLayerNumber == 5 ) ) ||
00218     // First Hit on TEC4
00219     ( ( theSubDetId == 6 && theLayerNumber == 4 ) && 
00220       ( anotherSubDetId == 6 && anotherLayerNumber == 5 ) ) ||
00221     // First Hit on TEC5
00222     ( ( theSubDetId == 6 && theLayerNumber == 5 ) && 
00223       ( anotherSubDetId == 6 && anotherLayerNumber == 6 ) ) ||
00224     // First Hit on TEC6
00225     ( ( theSubDetId == 6 && theLayerNumber == 6 ) && 
00226       ( anotherSubDetId == 6 && anotherLayerNumber == 7 ) ) ;
00227 
00228   return isAProperPair;
00229 
00230 } 
00231 
00232 bool
00233 TrackerRecHit::makesAPairWith3rd(const TrackerRecHit& anotherHit) const { 
00234 
00235   bool isAProperPair = false;
00236 
00237   unsigned int anotherSubDetId = anotherHit.subDetId();
00238   unsigned int anotherLayerNumber = anotherHit.layerNumber();
00239   isAProperPair = 
00240     // First hit on PXB1
00241     ( ( theSubDetId == 1 && theLayerNumber == 1 ) && (
00242       ( anotherSubDetId == 1 && anotherLayerNumber == 2) || 
00243       ( anotherSubDetId == 2 && anotherLayerNumber == 1) ) ) || 
00244       // First hit on PXB2
00245     ( ( theSubDetId == 1 && theLayerNumber == 2 ) && 
00246       ( anotherSubDetId == 1 && anotherLayerNumber == 3) ) || 
00247     // First Hit on PXD1
00248     ( ( theSubDetId == 2 && theLayerNumber == 1 ) && 
00249       ( anotherSubDetId == 2 && anotherLayerNumber == 2) ) ||
00250     // First Hit on PXD2
00251     ( ( theSubDetId == 2 && theLayerNumber == 2 ) &&  
00252       ( anotherSubDetId == 6 && anotherLayerNumber == 2 ) );
00253 
00254  return isAProperPair;
00255 
00256 }
00257       
00258 bool
00259 TrackerRecHit::makesATripletWith(const TrackerRecHit& anotherHit,
00260                                  const TrackerRecHit& yetAnotherHit ) const { 
00261 
00262   bool isAProperTriplet = false;
00263 
00264   unsigned int anotherSubDetId = anotherHit.subDetId();
00265   unsigned int anotherLayerNumber = anotherHit.layerNumber();
00266   unsigned int yetAnotherSubDetId = yetAnotherHit.subDetId();
00267   unsigned int yetAnotherLayerNumber = yetAnotherHit.layerNumber();
00268   isAProperTriplet = 
00269     // First hit on PXB1, second on PXB2
00270     ( ( theSubDetId == 1 && theLayerNumber == 1 ) && 
00271       ( anotherSubDetId == 1 && anotherLayerNumber == 2) && ( 
00272       ( yetAnotherSubDetId == 1 && yetAnotherLayerNumber == 3) || 
00273       ( yetAnotherSubDetId == 2 && yetAnotherLayerNumber == 1) || 
00274       ( yetAnotherSubDetId == 3 && yetAnotherLayerNumber == 1) ) ) || 
00275     // First hit on PXB1, second on PXB3 
00276     ( ( theSubDetId == 1 && theLayerNumber == 1 ) &&
00277       ( anotherSubDetId == 1 && anotherLayerNumber == 3) && 
00278       ( yetAnotherSubDetId == 3 && yetAnotherLayerNumber == 1) ) || 
00279     // First hit on PXB2, second on PXB3 
00280     ( ( theSubDetId == 1 && theLayerNumber == 2 ) &&
00281       ( anotherSubDetId == 1 && anotherLayerNumber == 3) && 
00282       ( yetAnotherSubDetId == 3 && yetAnotherLayerNumber == 1) ) || 
00283     // First Hit on PXB1, second on PXD1
00284     ( ( theSubDetId == 1 && theLayerNumber == 1 ) &&
00285       ( anotherSubDetId == 2 && anotherLayerNumber == 1) && ( 
00286       ( yetAnotherSubDetId == 2 && yetAnotherLayerNumber == 2) || 
00287       ( yetAnotherSubDetId == 4 && yetAnotherLayerNumber == 1) || 
00288       ( yetAnotherSubDetId == 4 && yetAnotherLayerNumber == 2) ) ) || 
00289     // First Hit on PXD1, second on PXD2
00290     ( ( theSubDetId == 2 && theLayerNumber == 1 ) && 
00291       ( anotherSubDetId == 2 && anotherLayerNumber == 2 ) && (
00292       ( yetAnotherSubDetId == 6 && yetAnotherLayerNumber == 1 ) ||
00293       ( yetAnotherSubDetId == 6 && yetAnotherLayerNumber == 2 ) ) ) ||
00294     // First hit on TIB1 (pixel less)
00295     ( ( theSubDetId == 3 && theLayerNumber == 1 ) && 
00296       ( anotherSubDetId == 3 && anotherLayerNumber == 2 ) && 
00297       ( yetAnotherSubDetId == 3 && yetAnotherLayerNumber == 3 ) );
00298   
00299   return isAProperTriplet;
00300   
00301 }
00302 
00303 
00304 
00305