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
00079 bool isOnDet = false;
00080
00081 for ( unsigned idet=0; idet<whichDet.size(); ++idet ) {
00082
00083 switch ( whichDet[idet] ) {
00084
00085 case 1:
00086
00087 isOnDet = theSubDetId==1;
00088 break;
00089
00090 case 2:
00091
00092 isOnDet = theSubDetId==2;
00093 break;
00094
00095 case 3:
00096
00097 isOnDet = theSubDetId==3 && theLayerNumber < 4;
00098 break;
00099
00100 case 4:
00101
00102 isOnDet = theSubDetId==4 && theRingNumber < 3;
00103 break;
00104
00105 case 5:
00106
00107 isOnDet = false;
00108 break;
00109
00110 case 6:
00111
00112 isOnDet = theSubDetId==6 && theLayerNumber < 4 && theRingNumber < 3;
00113 break;
00114
00115 default:
00116
00117 isOnDet = false;
00118 break;
00119
00120 }
00121
00122 if ( isOnDet ) break;
00123
00124 }
00125
00126 return isOnDet;
00127 }
00128
00129 bool
00130 TrackerRecHit::makesAPairWith(const TrackerRecHit& anotherHit) const {
00131
00132 bool isAProperPair = false;
00133
00134 unsigned int anotherSubDetId = anotherHit.subDetId();
00135 unsigned int anotherLayerNumber = anotherHit.layerNumber();
00136 isAProperPair =
00137
00138 ( ( theSubDetId == 1 && theLayerNumber == 1 ) && (
00139 ( anotherSubDetId == 1 && anotherLayerNumber == 2) ||
00140 ( anotherSubDetId == 1 && anotherLayerNumber == 3) ||
00141 ( anotherSubDetId == 2 && anotherLayerNumber == 1) ||
00142 ( anotherSubDetId == 2 && anotherLayerNumber == 2) ) ) ||
00143
00144 ( ( theSubDetId == 1 && theLayerNumber == 2 ) && (
00145 ( anotherSubDetId == 1 && anotherLayerNumber == 3) ||
00146 ( anotherSubDetId == 2 && anotherLayerNumber == 1) ||
00147 ( anotherSubDetId == 2 && anotherLayerNumber == 2) ) ) ||
00148
00149 ( ( theSubDetId == 2 && theLayerNumber == 1 ) &&
00150 ( anotherSubDetId == 2 && anotherLayerNumber == 2 ) ) ||
00151
00152 ( ( theSubDetId == 2 && theLayerNumber == 2 ) && (
00153 ( anotherSubDetId == 6 && anotherLayerNumber == 1 ) ||
00154 ( anotherSubDetId == 6 && anotherLayerNumber == 2 ) ) ) ||
00155
00156 ( ( theSubDetId == 6 && theLayerNumber == 1 ) &&
00157 ( anotherSubDetId == 6 && anotherLayerNumber == 2 ) ) ||
00158
00159 ( ( theSubDetId == 6 && theLayerNumber == 2 ) &&
00160 ( anotherSubDetId == 6 && anotherLayerNumber == 3 ) );
00161
00162 return isAProperPair;
00163
00164 }
00165
00166 bool
00167 TrackerRecHit::makesATripletWith(const TrackerRecHit& anotherHit,
00168 const TrackerRecHit& yetAnotherHit ) const {
00169
00170 bool isAProperTriplet = false;
00171
00172 unsigned int anotherSubDetId = anotherHit.subDetId();
00173 unsigned int anotherLayerNumber = anotherHit.layerNumber();
00174 unsigned int yetAnotherSubDetId = yetAnotherHit.subDetId();
00175 unsigned int yetAnotherLayerNumber = yetAnotherHit.layerNumber();
00176 isAProperTriplet =
00177
00178 ( ( theSubDetId == 1 && theLayerNumber == 1 ) &&
00179 ( anotherSubDetId == 1 && anotherLayerNumber == 2) && (
00180 ( yetAnotherSubDetId == 1 && yetAnotherLayerNumber == 3) ||
00181 ( yetAnotherSubDetId == 2 && yetAnotherLayerNumber == 1) ||
00182 ( yetAnotherSubDetId == 3 && yetAnotherLayerNumber == 1) ) ) ||
00183
00184 ( ( theSubDetId == 1 && theLayerNumber == 1 ) &&
00185 ( anotherSubDetId == 1 && anotherLayerNumber == 3) &&
00186 ( yetAnotherSubDetId == 3 && yetAnotherLayerNumber == 1) ) ||
00187
00188 ( ( theSubDetId == 1 && theLayerNumber == 2 ) &&
00189 ( anotherSubDetId == 1 && anotherLayerNumber == 3) &&
00190 ( yetAnotherSubDetId == 3 && yetAnotherLayerNumber == 1) ) ||
00191
00192 ( ( theSubDetId == 1 && theLayerNumber == 1 ) &&
00193 ( anotherSubDetId == 2 && anotherLayerNumber == 1) && (
00194 ( yetAnotherSubDetId == 2 && yetAnotherLayerNumber == 2) ||
00195 ( yetAnotherSubDetId == 4 && yetAnotherLayerNumber == 1) ||
00196 ( yetAnotherSubDetId == 4 && yetAnotherLayerNumber == 2) ) ) ||
00197
00198 ( ( theSubDetId == 2 && theLayerNumber == 1 ) &&
00199 ( anotherSubDetId == 2 && anotherLayerNumber == 2 ) && (
00200 ( yetAnotherSubDetId == 6 && yetAnotherLayerNumber == 1 ) ||
00201 ( yetAnotherSubDetId == 6 && yetAnotherLayerNumber == 2 ) ) ) ||
00202
00203 ( ( theSubDetId == 3 && theLayerNumber == 1 ) &&
00204 ( anotherSubDetId == 3 && anotherLayerNumber == 2 ) &&
00205 ( yetAnotherSubDetId == 3 && yetAnotherLayerNumber == 3 ) );
00206
00207 return isAProperTriplet;
00208
00209 }
00210
00211