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
00077 bool
00078 TrackerRecHit::isOnRequestedDet(const std::vector<std::string>& layerList) const {
00079
00080 std::cout << "layerList.size() = " << layerList.size() << std::endl;
00081 bool isOnDet = false;
00082
00083 int subdet = 0;
00084 int idLayer = 0;
00085 int side = 0;
00086
00087 for (unsigned i=0; i<layerList.size();i++) {
00088 std::string name = layerList[i];
00089 std::cout << "------- Name = " << name << std::endl;
00090
00091
00092
00093
00094 if (name.substr(0,4) == "BPix") {
00095 subdet = 1;
00096 idLayer = atoi(name.substr(4,1).c_str());
00097 side=0;
00098 }
00099
00100
00101
00102 else if (name.substr(0,4) == "FPix") {
00103 subdet = 2;
00104 idLayer = atoi(name.substr(4,1).c_str());
00105 if ( name.find("pos") != std::string::npos ) {
00106 side = +1;
00107 } else {
00108 side = -1;
00109 }
00110 }
00111
00112
00113
00114 else if (name.substr(0,3) == "TIB") {
00115 subdet = 3;
00116 idLayer = atoi(name.substr(3,1).c_str());
00117 side=0;
00118 }
00119
00120
00121
00122 else if (name.substr(0,3) == "TID") {
00123 subdet = 4;
00124 idLayer = atoi(name.substr(3,1).c_str());
00125 if ( name.find("pos") !=std::string::npos ) {
00126 side = +1;
00127 } else {
00128 side = -1;
00129 }
00130 }
00131
00132
00133
00134 else if (name.substr(0,3) == "TOB") {
00135 subdet = 5;
00136 idLayer = atoi(name.substr(3,1).c_str());
00137 side = 0;
00138 }
00139
00140
00141
00142 else if (name.substr(0,3) == "TEC") {
00143 subdet = 6;
00144 idLayer = atoi(name.substr(3,1).c_str());
00145 if ( name.find("pos") != std::string::npos ) {
00146 side = +1;
00147 } else {
00148 side = -1;
00149 }
00150 }
00151
00152 std::cout << "subdet = " << subdet << std::endl;
00153 std::cout << "idLayer = " << idLayer << std::endl;
00154 std::cout << "side = " << side << std::endl;
00155
00156 }
00157
00159
00160
00161
00162 return isOnDet;
00163 }
00164
00165 bool
00166
00167 TrackerRecHit::isOnRequestedDet(const std::vector<unsigned int>& whichDet, const std::string& seedingAlgo) const {
00168
00169 bool isOnDet = false;
00170
00171 for ( unsigned idet=0; idet<whichDet.size(); ++idet ) {
00172
00173 switch ( whichDet[idet] ) {
00174
00175 case 1:
00176
00177 isOnDet = theSubDetId==1;
00178 break;
00179
00180 case 2:
00181
00182 isOnDet = theSubDetId==2;
00183 break;
00184
00185 case 3:
00186
00187 isOnDet = theSubDetId==3 && theLayerNumber < 4;
00188 break;
00189
00190 case 4:
00191
00192 isOnDet = theSubDetId==4 && theRingNumber < 3;
00193 break;
00194
00195 case 5:
00196
00197 if(seedingAlgo == "TobTecLayerPairs"){
00198 isOnDet = theSubDetId==5 && theLayerNumber <3;
00199 }else {
00200 isOnDet = false;
00201 }
00202 break;
00203
00204 case 6:
00205
00206 if(seedingAlgo == "PixelLessPairs"){
00207 isOnDet = theSubDetId==6 && theLayerNumber < 6 && theRingNumber < 3;
00208 }else if (seedingAlgo == "TobTecLayerPairs"){
00209
00210 isOnDet = theSubDetId==6 && theLayerNumber < 8 && theRingNumber == 5;
00211 } else if (seedingAlgo == "MixedTriplets"){
00212
00213 isOnDet = theSubDetId==6 && theLayerNumber < 4 && theRingNumber == 1;
00214 } else {
00215 isOnDet = theSubDetId==6;
00216 std::cout << "DEBUG - this should never happen" << std::endl;
00217 }
00218
00219 break;
00220
00221 default:
00222
00223 isOnDet = false;
00224 break;
00225
00226 }
00227
00228 if ( isOnDet ) break;
00229
00230 }
00231
00232 return isOnDet;
00233 }
00234
00235 bool
00236 TrackerRecHit::makesAPairWith(const TrackerRecHit& anotherHit) const {
00237
00238 bool isAProperPair = false;
00239
00240 unsigned int anotherSubDetId = anotherHit.subDetId();
00241 unsigned int anotherLayerNumber = anotherHit.layerNumber();
00242 isAProperPair =
00243
00244 ( ( theSubDetId == 1 && theLayerNumber == 1 ) && (
00245 ( anotherSubDetId == 1 && anotherLayerNumber == 2) ||
00246 ( anotherSubDetId == 1 && anotherLayerNumber == 3) ||
00247 ( anotherSubDetId == 2 && anotherLayerNumber == 1) ||
00248 ( anotherSubDetId == 2 && anotherLayerNumber == 2) ) ) ||
00249
00250 ( ( theSubDetId == 1 && theLayerNumber == 2 ) && (
00251 ( anotherSubDetId == 1 && anotherLayerNumber == 3) ||
00252 ( anotherSubDetId == 2 && anotherLayerNumber == 1) ||
00253 ( anotherSubDetId == 2 && anotherLayerNumber == 2) ) ) ||
00254
00255 ( ( theSubDetId == 2 && theLayerNumber == 1 ) &&
00256 ( anotherSubDetId == 2 && anotherLayerNumber == 2 ) ) ||
00257
00258 ( ( theSubDetId == 2 && theLayerNumber == 2 ) && (
00259 ( anotherSubDetId == 6 && anotherLayerNumber == 1 ) ||
00260 ( anotherSubDetId == 6 && anotherLayerNumber == 2 ) ) ) ||
00261
00262 ( ( theSubDetId == 6 && theLayerNumber == 1 ) &&
00263 ( anotherSubDetId == 6 && anotherLayerNumber == 2 ) ) ||
00264
00265 ( ( theSubDetId == 6 && theLayerNumber == 2 ) &&
00266 ( anotherSubDetId == 6 && anotherLayerNumber == 3 ) ) ||
00267
00268
00269
00270 ( ( theSubDetId == 3 && theLayerNumber == 1 ) &&
00271 (( anotherSubDetId == 3 && anotherLayerNumber == 2 ) ||
00272 ( anotherSubDetId == 4 && anotherLayerNumber == 1 )) ) ||
00273
00274 ( ( theSubDetId == 4 && theLayerNumber == 1 ) &&
00275 ( anotherSubDetId == 4 && anotherLayerNumber == 2 ) ) ||
00276
00277 ( ( theSubDetId == 4 && theLayerNumber == 2 ) &&
00278 ( anotherSubDetId == 4 && anotherLayerNumber == 3 ) ) ||
00279
00280 ( ( theSubDetId == 4 && theLayerNumber == 3 ) &&
00281 ( anotherSubDetId == 6 && anotherLayerNumber == 1 ) ) ||
00282
00283 ( ( theSubDetId == 6 && theLayerNumber == 3 ) &&
00284 ( ( anotherSubDetId == 6 && anotherLayerNumber == 4 ) ||
00285 ( anotherSubDetId == 6 && anotherLayerNumber == 5 )) ) ||
00286
00287 ( ( theSubDetId == 6 && theLayerNumber == 4 ) &&
00288 ( anotherSubDetId == 6 && anotherLayerNumber == 5 ) ) ||
00289
00290
00291
00292 ( ( theSubDetId == 5 && theLayerNumber == 1 ) &&
00293 (( anotherSubDetId == 5 && anotherLayerNumber == 2 ) ||
00294 ( anotherSubDetId == 6 && anotherLayerNumber == 1 )) ) ||
00295
00296 ( ( theSubDetId == 6 && theLayerNumber == 1 ) &&
00297 ( anotherSubDetId == 6 && anotherLayerNumber == 2 ) ) ||
00298
00299 ( ( theSubDetId == 6 && theLayerNumber == 2 ) &&
00300 ( anotherSubDetId == 6 && anotherLayerNumber == 3 ) ) ||
00301
00302 ( ( theSubDetId == 6 && theLayerNumber == 3 ) &&
00303 ( anotherSubDetId == 6 && anotherLayerNumber == 4 ) ) ||
00304
00305
00306 ( ( theSubDetId == 6 && theLayerNumber == 4 ) &&
00307 ( anotherSubDetId == 6 && anotherLayerNumber == 5 ) ) ||
00308
00309 ( ( theSubDetId == 6 && theLayerNumber == 5 ) &&
00310 ( anotherSubDetId == 6 && anotherLayerNumber == 6 ) ) ||
00311
00312 ( ( theSubDetId == 6 && theLayerNumber == 6 ) &&
00313 ( anotherSubDetId == 6 && anotherLayerNumber == 7 ) ) ;
00314
00315 return isAProperPair;
00316
00317 }
00318
00319 bool
00320 TrackerRecHit::makesAPairWith3rd(const TrackerRecHit& anotherHit) const {
00321
00322 bool isAProperPair = false;
00323
00324 unsigned int anotherSubDetId = anotherHit.subDetId();
00325 unsigned int anotherLayerNumber = anotherHit.layerNumber();
00326 isAProperPair =
00327
00328 ( ( theSubDetId == 1 && theLayerNumber == 1 ) && (
00329 ( anotherSubDetId == 1 && anotherLayerNumber == 2) ||
00330 ( anotherSubDetId == 2 && anotherLayerNumber == 1) ) ) ||
00331
00332 ( ( theSubDetId == 1 && theLayerNumber == 2 ) &&
00333 ( anotherSubDetId == 1 && anotherLayerNumber == 3) ) ||
00334
00335 ( ( theSubDetId == 2 && theLayerNumber == 1 ) &&
00336 ( anotherSubDetId == 2 && anotherLayerNumber == 2) ) ||
00337
00338 ( ( theSubDetId == 2 && theLayerNumber == 2 ) &&
00339 ( anotherSubDetId == 6 && anotherLayerNumber == 2 ) );
00340
00341 return isAProperPair;
00342
00343 }
00344
00345 bool
00346 TrackerRecHit::makesATripletWith(const TrackerRecHit& anotherHit,
00347 const TrackerRecHit& yetAnotherHit ) const {
00348
00349 bool isAProperTriplet = false;
00350
00351 unsigned int anotherSubDetId = anotherHit.subDetId();
00352 unsigned int anotherLayerNumber = anotherHit.layerNumber();
00353 unsigned int yetAnotherSubDetId = yetAnotherHit.subDetId();
00354 unsigned int yetAnotherLayerNumber = yetAnotherHit.layerNumber();
00355 isAProperTriplet =
00356
00357 ( ( theSubDetId == 1 && theLayerNumber == 1 ) &&
00358 ( anotherSubDetId == 1 && anotherLayerNumber == 2) && (
00359 ( yetAnotherSubDetId == 1 && yetAnotherLayerNumber == 3) ||
00360 ( yetAnotherSubDetId == 2 && yetAnotherLayerNumber == 1) ||
00361 ( yetAnotherSubDetId == 3 && yetAnotherLayerNumber == 1) ) ) ||
00362
00363 ( ( theSubDetId == 1 && theLayerNumber == 1 ) &&
00364 ( anotherSubDetId == 1 && anotherLayerNumber == 3) &&
00365 ( yetAnotherSubDetId == 3 && yetAnotherLayerNumber == 1) ) ||
00366
00367 ( ( theSubDetId == 1 && theLayerNumber == 2 ) &&
00368 ( anotherSubDetId == 1 && anotherLayerNumber == 3) &&
00369 ( yetAnotherSubDetId == 3 && yetAnotherLayerNumber == 1) ) ||
00370
00371 ( ( theSubDetId == 1 && theLayerNumber == 1 ) &&
00372 ( anotherSubDetId == 2 && anotherLayerNumber == 1) && (
00373 ( yetAnotherSubDetId == 2 && yetAnotherLayerNumber == 2) ||
00374 ( yetAnotherSubDetId == 4 && yetAnotherLayerNumber == 1) ||
00375 ( yetAnotherSubDetId == 4 && yetAnotherLayerNumber == 2) ) ) ||
00376
00377 ( ( theSubDetId == 2 && theLayerNumber == 1 ) &&
00378 ( anotherSubDetId == 2 && anotherLayerNumber == 2 ) && (
00379 ( yetAnotherSubDetId == 6 && yetAnotherLayerNumber == 1 ) ||
00380 ( yetAnotherSubDetId == 6 && yetAnotherLayerNumber == 2 ) ) ) ||
00381
00382 ( ( theSubDetId == 3 && theLayerNumber == 1 ) &&
00383 ( anotherSubDetId == 3 && anotherLayerNumber == 2 ) &&
00384 ( yetAnotherSubDetId == 3 && yetAnotherLayerNumber == 3 ) );
00385
00386 return isAProperTriplet;
00387
00388 }
00389
00390
00391
00392