CMS 3D CMS Logo

CMSSW_4_4_3_patch1/src/RecoTracker/TkHitPairs/src/CosmicLayerPairs.cc

Go to the documentation of this file.
00001 #include "RecoTracker/TkHitPairs/interface/CosmicLayerPairs.h"
00002 #include "RecoTracker/TkDetLayers/interface/GeometricSearchTracker.h"
00003 #include "RecoTracker/Record/interface/TrackerRecoGeometryRecord.h"
00004 
00005 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00006 
00007 #include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h"
00008 #include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h"
00009 #include "Geometry/Records/interface/TrackerDigiGeometryRecord.h"
00010 #include "FWCore/Framework/interface/ESHandle.h"
00011 
00012 
00013 std::vector<SeedLayerPairs::LayerPair> CosmicLayerPairs::operator()() 
00014 {
00015   std::vector<SeedLayerPairs::LayerPair> result;
00016 
00017   if (_geometry=="STANDARD"){
00018 //      result.push_back( SeedLayerPairs::LayerPair(&TIBLayerWithHits[1], &TIBLayerWithHits[0]));
00019 //      result.push_back( SeedLayerPairs::LayerPair(&TIBLayerWithHits[2], &TIBLayerWithHits[0]));
00020 
00021     result.push_back( SeedLayerPairs::LayerPair(&TOBLayerWithHits[3], &TOBLayerWithHits[5]));
00022     result.push_back( SeedLayerPairs::LayerPair(&TOBLayerWithHits[4], &TOBLayerWithHits[5]));
00023     result.push_back( SeedLayerPairs::LayerPair(&TOBLayerWithHits[3], &TOBLayerWithHits[4]));
00024 
00025     result.push_back( SeedLayerPairs::LayerPair(&TECPlusLayerWithHits[7], &TECPlusLayerWithHits[8]));
00026     result.push_back( SeedLayerPairs::LayerPair(&TECPlusLayerWithHits[6], &TECPlusLayerWithHits[8]));
00027 
00028     result.push_back( SeedLayerPairs::LayerPair(&TECPlusLayerWithHits[6], &TECPlusLayerWithHits[7]));
00029     result.push_back( SeedLayerPairs::LayerPair(&TECPlusLayerWithHits[5], &TECPlusLayerWithHits[7]));
00030 
00031     result.push_back( SeedLayerPairs::LayerPair(&TECPlusLayerWithHits[5], &TECPlusLayerWithHits[6]));
00032     result.push_back( SeedLayerPairs::LayerPair(&TECPlusLayerWithHits[4], &TECPlusLayerWithHits[6]));
00033 
00034     result.push_back( SeedLayerPairs::LayerPair(&TECPlusLayerWithHits[4], &TECPlusLayerWithHits[5]));
00035     result.push_back( SeedLayerPairs::LayerPair(&TECPlusLayerWithHits[3], &TECPlusLayerWithHits[5]));
00036 
00037     result.push_back( SeedLayerPairs::LayerPair(&TECPlusLayerWithHits[3], &TECPlusLayerWithHits[4]));
00038     result.push_back( SeedLayerPairs::LayerPair(&TECPlusLayerWithHits[2], &TECPlusLayerWithHits[4]));
00039 
00040     result.push_back( SeedLayerPairs::LayerPair(&TECPlusLayerWithHits[2], &TECPlusLayerWithHits[3]));
00041     result.push_back( SeedLayerPairs::LayerPair(&TECPlusLayerWithHits[1], &TECPlusLayerWithHits[3]));
00042 
00043     result.push_back( SeedLayerPairs::LayerPair(&TECPlusLayerWithHits[1], &TECPlusLayerWithHits[2]));
00044     result.push_back( SeedLayerPairs::LayerPair(&TECPlusLayerWithHits[0], &TECPlusLayerWithHits[2]));
00045 
00046     result.push_back( SeedLayerPairs::LayerPair(&TECPlusLayerWithHits[0], &TECPlusLayerWithHits[1]));
00047 
00048 
00049     result.push_back( SeedLayerPairs::LayerPair(&TECMinusLayerWithHits[7], &TECMinusLayerWithHits[8]));
00050     result.push_back( SeedLayerPairs::LayerPair(&TECMinusLayerWithHits[6], &TECMinusLayerWithHits[8]));
00051 
00052     result.push_back( SeedLayerPairs::LayerPair(&TECMinusLayerWithHits[6], &TECMinusLayerWithHits[7]));
00053     result.push_back( SeedLayerPairs::LayerPair(&TECMinusLayerWithHits[5], &TECMinusLayerWithHits[7]));
00054 
00055     result.push_back( SeedLayerPairs::LayerPair(&TECMinusLayerWithHits[5], &TECMinusLayerWithHits[6]));
00056     result.push_back( SeedLayerPairs::LayerPair(&TECMinusLayerWithHits[4], &TECMinusLayerWithHits[6]));
00057 
00058     result.push_back( SeedLayerPairs::LayerPair(&TECMinusLayerWithHits[4], &TECMinusLayerWithHits[5]));
00059     result.push_back( SeedLayerPairs::LayerPair(&TECMinusLayerWithHits[3], &TECMinusLayerWithHits[5]));
00060 
00061     result.push_back( SeedLayerPairs::LayerPair(&TECMinusLayerWithHits[3], &TECMinusLayerWithHits[4]));
00062     result.push_back( SeedLayerPairs::LayerPair(&TECMinusLayerWithHits[2], &TECMinusLayerWithHits[4]));
00063 
00064     result.push_back( SeedLayerPairs::LayerPair(&TECMinusLayerWithHits[2], &TECMinusLayerWithHits[3]));
00065     result.push_back( SeedLayerPairs::LayerPair(&TECMinusLayerWithHits[1], &TECMinusLayerWithHits[3]));
00066 
00067     result.push_back( SeedLayerPairs::LayerPair(&TECMinusLayerWithHits[1], &TECMinusLayerWithHits[2]));
00068     result.push_back( SeedLayerPairs::LayerPair(&TECMinusLayerWithHits[0], &TECMinusLayerWithHits[2]));
00069 
00070     result.push_back( SeedLayerPairs::LayerPair(&TECMinusLayerWithHits[0], &TECMinusLayerWithHits[1]));
00071 
00072 
00073   } 
00074   else if(_geometry=="TECPAIRS_TOBTRIPLETS"){
00075     result.push_back( SeedLayerPairs::LayerPair(&TECPlusLayerWithHits[7], &TECPlusLayerWithHits[8]));
00076     result.push_back( SeedLayerPairs::LayerPair(&TECPlusLayerWithHits[6], &TECPlusLayerWithHits[8]));
00077     
00078     result.push_back( SeedLayerPairs::LayerPair(&TECPlusLayerWithHits[6], &TECPlusLayerWithHits[7]));
00079     result.push_back( SeedLayerPairs::LayerPair(&TECPlusLayerWithHits[5], &TECPlusLayerWithHits[7]));
00080     
00081     result.push_back( SeedLayerPairs::LayerPair(&TECPlusLayerWithHits[5], &TECPlusLayerWithHits[6]));
00082     result.push_back( SeedLayerPairs::LayerPair(&TECPlusLayerWithHits[4], &TECPlusLayerWithHits[6]));
00083     
00084     result.push_back( SeedLayerPairs::LayerPair(&TECPlusLayerWithHits[4], &TECPlusLayerWithHits[5]));
00085     result.push_back( SeedLayerPairs::LayerPair(&TECPlusLayerWithHits[3], &TECPlusLayerWithHits[5]));
00086 
00087     result.push_back( SeedLayerPairs::LayerPair(&TECPlusLayerWithHits[3], &TECPlusLayerWithHits[4]));
00088     result.push_back( SeedLayerPairs::LayerPair(&TECPlusLayerWithHits[2], &TECPlusLayerWithHits[4]));
00089 
00090     result.push_back( SeedLayerPairs::LayerPair(&TECPlusLayerWithHits[2], &TECPlusLayerWithHits[3]));
00091     result.push_back( SeedLayerPairs::LayerPair(&TECPlusLayerWithHits[1], &TECPlusLayerWithHits[3]));
00092 
00093     result.push_back( SeedLayerPairs::LayerPair(&TECPlusLayerWithHits[1], &TECPlusLayerWithHits[2]));
00094     result.push_back( SeedLayerPairs::LayerPair(&TECPlusLayerWithHits[0], &TECPlusLayerWithHits[2]));
00095 
00096     result.push_back( SeedLayerPairs::LayerPair(&TECPlusLayerWithHits[0], &TECPlusLayerWithHits[1]));
00097 
00098 
00099     result.push_back( SeedLayerPairs::LayerPair(&TECMinusLayerWithHits[7], &TECMinusLayerWithHits[8]));
00100     result.push_back( SeedLayerPairs::LayerPair(&TECMinusLayerWithHits[6], &TECMinusLayerWithHits[8]));
00101 
00102     result.push_back( SeedLayerPairs::LayerPair(&TECMinusLayerWithHits[6], &TECMinusLayerWithHits[7]));
00103     result.push_back( SeedLayerPairs::LayerPair(&TECMinusLayerWithHits[5], &TECMinusLayerWithHits[7]));
00104 
00105     result.push_back( SeedLayerPairs::LayerPair(&TECMinusLayerWithHits[5], &TECMinusLayerWithHits[6]));
00106     result.push_back( SeedLayerPairs::LayerPair(&TECMinusLayerWithHits[4], &TECMinusLayerWithHits[6]));
00107 
00108     result.push_back( SeedLayerPairs::LayerPair(&TECMinusLayerWithHits[4], &TECMinusLayerWithHits[5]));
00109     result.push_back( SeedLayerPairs::LayerPair(&TECMinusLayerWithHits[3], &TECMinusLayerWithHits[5]));
00110 
00111     result.push_back( SeedLayerPairs::LayerPair(&TECMinusLayerWithHits[3], &TECMinusLayerWithHits[4]));
00112     result.push_back( SeedLayerPairs::LayerPair(&TECMinusLayerWithHits[2], &TECMinusLayerWithHits[4]));
00113 
00114     result.push_back( SeedLayerPairs::LayerPair(&TECMinusLayerWithHits[2], &TECMinusLayerWithHits[3]));
00115     result.push_back( SeedLayerPairs::LayerPair(&TECMinusLayerWithHits[1], &TECMinusLayerWithHits[3]));
00116 
00117     result.push_back( SeedLayerPairs::LayerPair(&TECMinusLayerWithHits[1], &TECMinusLayerWithHits[2]));
00118     result.push_back( SeedLayerPairs::LayerPair(&TECMinusLayerWithHits[0], &TECMinusLayerWithHits[2]));
00119 
00120     result.push_back( SeedLayerPairs::LayerPair(&TECMinusLayerWithHits[0], &TECMinusLayerWithHits[1]));
00121     
00122 
00123   }
00124   else if (_geometry=="MTCC"){
00125     result.push_back( SeedLayerPairs::LayerPair(&MTCCLayerWithHits[1],&MTCCLayerWithHits[0]));
00126     result.push_back( SeedLayerPairs::LayerPair(&MTCCLayerWithHits[2],&MTCCLayerWithHits[3]));
00127     //IMPORTANT
00128     // The seed from overlaps must be at the end
00129     result.push_back( SeedLayerPairs::LayerPair(&MTCCLayerWithHits[0],&MTCCLayerWithHits[0]));
00130     result.push_back( SeedLayerPairs::LayerPair(&MTCCLayerWithHits[1],&MTCCLayerWithHits[1]));  
00131   } 
00132   else if (_geometry=="CRACK"){
00133     //TODO: clean all this. Now this is a random choice of layers
00134     result.push_back( SeedLayerPairs::LayerPair(&CRACKLayerWithHits[1],&CRACKLayerWithHits[0]));
00135     result.push_back( SeedLayerPairs::LayerPair(&CRACKLayerWithHits[2],&CRACKLayerWithHits[0]));
00136     result.push_back( SeedLayerPairs::LayerPair(&CRACKLayerWithHits[2],&CRACKLayerWithHits[1]));
00137     result.push_back( SeedLayerPairs::LayerPair(&CRACKLayerWithHits[3],&CRACKLayerWithHits[2]));
00138     result.push_back( SeedLayerPairs::LayerPair(&CRACKLayerWithHits[5],&CRACKLayerWithHits[4]));
00139     result.push_back( SeedLayerPairs::LayerPair(&CRACKLayerWithHits[6],&CRACKLayerWithHits[4]));
00140     result.push_back( SeedLayerPairs::LayerPair(&CRACKLayerWithHits[6],&CRACKLayerWithHits[5]));
00141     result.push_back( SeedLayerPairs::LayerPair(&CRACKLayerWithHits[7],&CRACKLayerWithHits[6]));
00142     result.push_back( SeedLayerPairs::LayerPair(&CRACKLayerWithHits[8],&CRACKLayerWithHits[5]));
00143     result.push_back( SeedLayerPairs::LayerPair(&CRACKLayerWithHits[9],&CRACKLayerWithHits[5]));
00144     result.push_back( SeedLayerPairs::LayerPair(&CRACKLayerWithHits[10],&CRACKLayerWithHits[5]));
00145     result.push_back( SeedLayerPairs::LayerPair(&CRACKLayerWithHits[11],&CRACKLayerWithHits[5]));
00146     result.push_back( SeedLayerPairs::LayerPair(&CRACKLayerWithHits[12],&CRACKLayerWithHits[5]));
00147     result.push_back( SeedLayerPairs::LayerPair(&CRACKLayerWithHits[13],&CRACKLayerWithHits[5]));
00148   } 
00149   else if (_geometry=="TIBD+"){
00150     result.push_back( SeedLayerPairs::LayerPair(&TIBLayerWithHits[1],&TIBLayerWithHits[0]));
00151     result.push_back( SeedLayerPairs::LayerPair(&TIBLayerWithHits[2],&TIBLayerWithHits[3]));
00152     result.push_back( SeedLayerPairs::LayerPair(&TIBLayerWithHits[0],&TIBLayerWithHits[0]));
00153     result.push_back( SeedLayerPairs::LayerPair(&TIBLayerWithHits[1],&TIBLayerWithHits[1]));
00154   } 
00155   else if (_geometry=="TOB") {
00156     result.push_back( SeedLayerPairs::LayerPair(&TOBLayerWithHits[3], &TOBLayerWithHits[5]));
00157     result.push_back( SeedLayerPairs::LayerPair(&TOBLayerWithHits[4], &TOBLayerWithHits[5]));
00158     result.push_back( SeedLayerPairs::LayerPair(&TOBLayerWithHits[3], &TOBLayerWithHits[4]));
00159     
00160   } 
00161   else if(_geometry=="TIBTOB") {
00162     result.push_back( SeedLayerPairs::LayerPair(&TIBLayerWithHits[1], &TIBLayerWithHits[0]));
00163     result.push_back( SeedLayerPairs::LayerPair(&TIBLayerWithHits[2], &TIBLayerWithHits[0]));
00164 
00165     result.push_back( SeedLayerPairs::LayerPair(&TOBLayerWithHits[3], &TOBLayerWithHits[5]));
00166     result.push_back( SeedLayerPairs::LayerPair(&TOBLayerWithHits[4], &TOBLayerWithHits[5]));
00167     result.push_back( SeedLayerPairs::LayerPair(&TOBLayerWithHits[3], &TOBLayerWithHits[4]));
00168  
00169   }
00170   else if (_geometry=="TEC+") {
00171     result.push_back( SeedLayerPairs::LayerPair(&TECPlusLayerWithHits[7], &TECPlusLayerWithHits[8]));
00172     result.push_back( SeedLayerPairs::LayerPair(&TECPlusLayerWithHits[6], &TECPlusLayerWithHits[8]));
00173     
00174     result.push_back( SeedLayerPairs::LayerPair(&TECPlusLayerWithHits[6], &TECPlusLayerWithHits[7]));
00175     result.push_back( SeedLayerPairs::LayerPair(&TECPlusLayerWithHits[5], &TECPlusLayerWithHits[7]));
00176     
00177     result.push_back( SeedLayerPairs::LayerPair(&TECPlusLayerWithHits[5], &TECPlusLayerWithHits[6]));
00178     result.push_back( SeedLayerPairs::LayerPair(&TECPlusLayerWithHits[4], &TECPlusLayerWithHits[6]));
00179     
00180     result.push_back( SeedLayerPairs::LayerPair(&TECPlusLayerWithHits[4], &TECPlusLayerWithHits[5]));
00181     result.push_back( SeedLayerPairs::LayerPair(&TECPlusLayerWithHits[3], &TECPlusLayerWithHits[5]));
00182     
00183     result.push_back( SeedLayerPairs::LayerPair(&TECPlusLayerWithHits[3], &TECPlusLayerWithHits[4]));
00184     result.push_back( SeedLayerPairs::LayerPair(&TECPlusLayerWithHits[2], &TECPlusLayerWithHits[4]));
00185     
00186     result.push_back( SeedLayerPairs::LayerPair(&TECPlusLayerWithHits[2], &TECPlusLayerWithHits[3]));
00187     result.push_back( SeedLayerPairs::LayerPair(&TECPlusLayerWithHits[1], &TECPlusLayerWithHits[3]));
00188     
00189     result.push_back( SeedLayerPairs::LayerPair(&TECPlusLayerWithHits[2], &TECPlusLayerWithHits[1]));
00190     result.push_back( SeedLayerPairs::LayerPair(&TECPlusLayerWithHits[2], &TECPlusLayerWithHits[0]));
00191     
00192     result.push_back( SeedLayerPairs::LayerPair(&TECPlusLayerWithHits[1], &TECPlusLayerWithHits[0]));
00193     
00194   }
00195   else if (_geometry=="CkfTIBD+"){
00196     result.push_back( SeedLayerPairs::LayerPair(&TIBLayerWithHits[0], &TIBLayerWithHits[1]));
00197     result.push_back( SeedLayerPairs::LayerPair(&TIBLayerWithHits[2], &TIBLayerWithHits[3]));
00198   } 
00199   else if (_geometry=="CkfTIBTOB"){
00200     result.push_back( SeedLayerPairs::LayerPair(&TIBLayerWithHits[0], &TIBLayerWithHits[1]));
00201     result.push_back( SeedLayerPairs::LayerPair(&TIBLayerWithHits[0], &TIBLayerWithHits[2]));
00202 
00203     result.push_back( SeedLayerPairs::LayerPair(&TOBLayerWithHits[3], &TOBLayerWithHits[5]));
00204     result.push_back( SeedLayerPairs::LayerPair(&TOBLayerWithHits[4], &TOBLayerWithHits[5]));
00205     result.push_back( SeedLayerPairs::LayerPair(&TOBLayerWithHits[3], &TOBLayerWithHits[4]));
00206   }
00207   else if (_geometry=="CkfTIF3"){
00208     result.push_back( SeedLayerPairs::LayerPair(&TIBLayerWithHits[0], &TIBLayerWithHits[1]));
00209     result.push_back( SeedLayerPairs::LayerPair(&TIBLayerWithHits[0], &TIBLayerWithHits[2]));
00210     
00211     result.push_back( SeedLayerPairs::LayerPair(&TOBLayerWithHits[3], &TOBLayerWithHits[5]));
00212     result.push_back( SeedLayerPairs::LayerPair(&TOBLayerWithHits[4], &TOBLayerWithHits[5]));
00213     result.push_back( SeedLayerPairs::LayerPair(&TOBLayerWithHits[3], &TOBLayerWithHits[4]));
00214 
00215     result.push_back( SeedLayerPairs::LayerPair(&TECPlusLayerWithHits[7], &TECPlusLayerWithHits[8]));   
00216     result.push_back( SeedLayerPairs::LayerPair(&TECPlusLayerWithHits[6], &TECPlusLayerWithHits[8]));   
00217 
00218     result.push_back( SeedLayerPairs::LayerPair(&TECPlusLayerWithHits[6], &TECPlusLayerWithHits[7]));   
00219     result.push_back( SeedLayerPairs::LayerPair(&TECPlusLayerWithHits[5], &TECPlusLayerWithHits[7]));
00220         
00221     result.push_back( SeedLayerPairs::LayerPair(&TECPlusLayerWithHits[5], &TECPlusLayerWithHits[6]));   
00222     result.push_back( SeedLayerPairs::LayerPair(&TECPlusLayerWithHits[4], &TECPlusLayerWithHits[6]));   
00223 
00224     result.push_back( SeedLayerPairs::LayerPair(&TECPlusLayerWithHits[4], &TECPlusLayerWithHits[5]));   
00225     result.push_back( SeedLayerPairs::LayerPair(&TECPlusLayerWithHits[3], &TECPlusLayerWithHits[5]));   
00226 
00227     result.push_back( SeedLayerPairs::LayerPair(&TECPlusLayerWithHits[3], &TECPlusLayerWithHits[4]));   
00228     result.push_back( SeedLayerPairs::LayerPair(&TECPlusLayerWithHits[2], &TECPlusLayerWithHits[4]));   
00229 
00230     result.push_back( SeedLayerPairs::LayerPair(&TECPlusLayerWithHits[2], &TECPlusLayerWithHits[3]));   
00231     result.push_back( SeedLayerPairs::LayerPair(&TECPlusLayerWithHits[1], &TECPlusLayerWithHits[3]));   
00232 
00233     result.push_back( SeedLayerPairs::LayerPair(&TECPlusLayerWithHits[1], &TECPlusLayerWithHits[2]));   
00234     result.push_back( SeedLayerPairs::LayerPair(&TECPlusLayerWithHits[0], &TECPlusLayerWithHits[2]));   
00235 
00236     result.push_back( SeedLayerPairs::LayerPair(&TECPlusLayerWithHits[0], &TECPlusLayerWithHits[1]));   
00237 
00238   } 
00239   else if (_geometry=="CkfTOB"){
00240     result.push_back( SeedLayerPairs::LayerPair(&TOBLayerWithHits[0], &TOBLayerWithHits[1]));
00241     result.push_back( SeedLayerPairs::LayerPair(&TOBLayerWithHits[0], &TOBLayerWithHits[2]));
00242 
00243     result.push_back( SeedLayerPairs::LayerPair(&TOBLayerWithHits[3], &TOBLayerWithHits[4]));   
00244     result.push_back( SeedLayerPairs::LayerPair(&TOBLayerWithHits[4], &TOBLayerWithHits[5]));
00245     result.push_back( SeedLayerPairs::LayerPair(&TOBLayerWithHits[3], &TOBLayerWithHits[5]));
00246   } 
00247   else {throw cms::Exception("CosmicLayerPairs") << "The geometry " << _geometry << " is not implemented ";}
00248   return result;
00249 }
00250 CosmicLayerPairs::~CosmicLayerPairs(){}
00251 
00252 
00253 
00254 void CosmicLayerPairs::init(const SiStripRecHit2DCollection &collstereo,
00255                             const SiStripRecHit2DCollection &collrphi, 
00256                             const SiStripMatchedRecHit2DCollection &collmatched,
00257                             //std::string geometry,
00258                             const edm::EventSetup& iSetup){
00260     //_geometry=geometry;
00261   //if(isFirstCall){
00262     //std::cout << "in isFirtsCall" << std::endl;
00263     edm::ESHandle<GeometricSearchTracker> track;
00264     iSetup.get<TrackerRecoGeometryRecord>().get( track );
00265         //std::cout << "about to take barrel" << std::endl; 
00266     bl=track->barrelLayers();
00267         //std::cout << "barrel taken" << std::endl;
00268     fpos=track->posTecLayers();
00269         //std::cout << "pos forw taken" << std::endl;
00270     fneg=track->negTecLayers();         
00271         //std::cout << "neg forw taken" << std::endl;
00272   //isFirstCall=false;
00273         
00274     if (_geometry=="MTCC"){//we have to distinguish the MTCC and CRACK case because they have special geometries with different neumbering of layers
00275         MTCCLayerWithHits.push_back(new LayerWithHits(bl[0], selectTIBHit(collrphi, 1)));
00276         MTCCLayerWithHits.push_back(new LayerWithHits(bl[1], selectTIBHit(collrphi, 2)));
00277         MTCCLayerWithHits.push_back(new LayerWithHits(bl[2], selectTOBHit(collrphi, 1)));
00278         MTCCLayerWithHits.push_back(new LayerWithHits(bl[3], selectTOBHit(collrphi, 2)));
00279         return;
00280     }
00281     if (_geometry=="CRACK"){
00282         CRACKLayerWithHits.push_back(new LayerWithHits(bl[6], selectTOBHit(collmatched, 7)));
00283         CRACKLayerWithHits.push_back(new LayerWithHits(bl[5], selectTOBHit(collmatched, 6)));
00284         CRACKLayerWithHits.push_back(new LayerWithHits(bl[3], selectTOBHit(collmatched, 4)));
00285         CRACKLayerWithHits.push_back(new LayerWithHits(bl[2], selectTOBHit(collmatched, 3)));
00286         CRACKLayerWithHits.push_back(new LayerWithHits(bl[6], selectTOBHit(collrphi, 7)));
00287         CRACKLayerWithHits.push_back(new LayerWithHits(bl[5], selectTOBHit(collrphi, 6)));
00288         CRACKLayerWithHits.push_back(new LayerWithHits(bl[3], selectTOBHit(collrphi, 4)));
00289         CRACKLayerWithHits.push_back(new LayerWithHits(bl[2], selectTOBHit(collrphi, 3)));
00290         CRACKLayerWithHits.push_back(new LayerWithHits(bl[4], selectTOBHit(collrphi, 5)));
00291         CRACKLayerWithHits.push_back(new LayerWithHits(bl[1], selectTOBHit(collrphi, 2)));
00292         CRACKLayerWithHits.push_back(new LayerWithHits(bl[0], selectTOBHit(collrphi, 1)));
00293         CRACKLayerWithHits.push_back(new LayerWithHits(bl[4], selectTOBHit(collmatched, 5)));
00294         CRACKLayerWithHits.push_back(new LayerWithHits(bl[1], selectTOBHit(collmatched, 2)));
00295         CRACKLayerWithHits.push_back(new LayerWithHits(bl[0], selectTOBHit(collmatched, 1)));
00296         return;
00297     }   
00298         
00299     TIBLayerWithHits.push_back(new LayerWithHits(bl[3], selectTIBHit(collrphi, 1)));  //layer
00300         //std::cout << "TIB 0" << std::endl;
00301     TIBLayerWithHits.push_back(new LayerWithHits(bl[4], selectTIBHit(collrphi, 2)));
00302         //std::cout << "TIB 1" << std::endl;
00303     TIBLayerWithHits.push_back(new LayerWithHits(bl[5], selectTIBHit(collrphi, 3)));
00304         //std::cout << "TIB 2" << std::endl;
00305     TIBLayerWithHits.push_back(new LayerWithHits(bl[6], selectTIBHit(collrphi, 4)));
00306         //std::cout << "TIB 3" << std::endl;
00307 
00308     TOBLayerWithHits.push_back(new LayerWithHits(bl[7], selectTOBHit(collrphi, 1)));
00309         //std::cout << "TOB 0" << std::endl;
00310     TOBLayerWithHits.push_back(new LayerWithHits(bl[8], selectTOBHit(collrphi, 2)));
00311         //std::cout << "TOB 1" << std::endl;
00312     TOBLayerWithHits.push_back(new LayerWithHits(bl[9], selectTOBHit(collrphi, 3)));
00313         //std::cout << "TOB 2" << std::endl;
00314     TOBLayerWithHits.push_back(new LayerWithHits(bl[10], selectTOBHit(collrphi, 4)));
00315         //std::cout << "TOB 3" << std::endl;
00316     TOBLayerWithHits.push_back(new LayerWithHits(bl[11], selectTOBHit(collrphi, 5)));
00317         //std::cout << "TOB 4" << std::endl;
00318     TOBLayerWithHits.push_back(new LayerWithHits(bl[12], selectTOBHit(collrphi, 6)));
00319         //std::cout << "TOB 5" << std::endl;
00320 
00321 
00322     TECPlusLayerWithHits.push_back(new LayerWithHits(fpos[0], selectTECHit(collrphi, 2, 1)));  //side, disk
00323         //std::cout << "wheel 0" << std::endl;
00324     TECPlusLayerWithHits.push_back(new LayerWithHits(fpos[1], selectTECHit(collrphi, 2, 2)));  
00325         //std::cout << "wheel 1" << std::endl;
00326     TECPlusLayerWithHits.push_back(new LayerWithHits(fpos[2], selectTECHit(collrphi, 2, 3)));  
00327         //std::cout << "wheel 2" << std::endl;
00328     TECPlusLayerWithHits.push_back(new LayerWithHits(fpos[3], selectTECHit(collrphi, 2, 4)));  
00329         //std::cout << "wheel 3" << std::endl;
00330     TECPlusLayerWithHits.push_back(new LayerWithHits(fpos[4], selectTECHit(collrphi, 2, 5)));  
00331         //std::cout << "wheel 4" << std::endl;
00332     TECPlusLayerWithHits.push_back(new LayerWithHits(fpos[5], selectTECHit(collrphi, 2, 6)));  
00333         //std::cout << "wheel 5" << std::endl;
00334     TECPlusLayerWithHits.push_back(new LayerWithHits(fpos[6], selectTECHit(collrphi, 2, 7)));  
00335         //std::cout << "wheel 6" << std::endl;
00336     TECPlusLayerWithHits.push_back(new LayerWithHits(fpos[7], selectTECHit(collrphi, 2, 8)));  
00337         //std::cout << "wheel 7" << std::endl;
00338     TECPlusLayerWithHits.push_back(new LayerWithHits(fpos[8], selectTECHit(collrphi, 2, 9)));  
00339         //std::cout << "wheel 8" << std::endl;
00340 
00341     TECMinusLayerWithHits.push_back(new LayerWithHits(fneg[0], selectTECHit(collrphi, 1, 1)));  //side, disk
00342         //std::cout << "wheel 0" << std::endl;
00343     TECMinusLayerWithHits.push_back(new LayerWithHits(fneg[1], selectTECHit(collrphi, 1, 2)));
00344         //std::cout << "wheel 1" << std::endl;
00345     TECMinusLayerWithHits.push_back(new LayerWithHits(fneg[2], selectTECHit(collrphi, 1, 3)));
00346         //std::cout << "wheel 2" << std::endl;
00347     TECMinusLayerWithHits.push_back(new LayerWithHits(fneg[3], selectTECHit(collrphi, 1, 4)));
00348         //std::cout << "wheel 3" << std::endl;
00349     TECMinusLayerWithHits.push_back(new LayerWithHits(fneg[4], selectTECHit(collrphi, 1, 5)));
00350         //std::cout << "wheel 4" << std::endl;
00351     TECMinusLayerWithHits.push_back(new LayerWithHits(fneg[5], selectTECHit(collrphi, 1, 6)));
00352         //std::cout << "wheel 5" << std::endl;
00353     TECMinusLayerWithHits.push_back(new LayerWithHits(fneg[6], selectTECHit(collrphi, 1, 7)));
00354         //std::cout << "wheel 6" << std::endl;
00355     TECMinusLayerWithHits.push_back(new LayerWithHits(fneg[7], selectTECHit(collrphi, 1, 8)));
00356         //std::cout << "wheel 7" << std::endl;
00357     TECMinusLayerWithHits.push_back(new LayerWithHits(fneg[8], selectTECHit(collrphi, 1, 9)));
00358         //std::cout << "wheel 8" << std::endl;
00359 }
00360 
00361 std::vector<const TrackingRecHit*> CosmicLayerPairs::selectTECHit(const SiStripRecHit2DCollection &collrphi,
00362                                                                 int side,
00363                                                                 int disk){
00364         std::vector<const TrackingRecHit*> theChoosedHits;
00365         TrackerLayerIdAccessor acc;
00366         edmNew::copyDetSetRange(collrphi, theChoosedHits, acc.stripTECDisk(side,disk));
00367         return theChoosedHits;
00368         
00369 }
00370 
00371 std::vector<const TrackingRecHit*> CosmicLayerPairs::selectTIBHit(const SiStripRecHit2DCollection &collrphi,
00372                                                                 int layer){
00373         std::vector<const TrackingRecHit*> theChoosedHits;
00374         TrackerLayerIdAccessor acc; 
00375         //std::cout << "in selectTIBHit" << std::endl;
00376         edmNew::copyDetSetRange(collrphi,theChoosedHits,acc.stripTIBLayer(layer));
00377         return theChoosedHits;
00378 
00379 }
00380 
00381 std::vector<const TrackingRecHit*> CosmicLayerPairs::selectTOBHit(const SiStripRecHit2DCollection &collrphi,
00382                                                                 int layer){
00383         std::vector<const TrackingRecHit*> theChoosedHits;
00384         TrackerLayerIdAccessor acc;
00385         //std::cout << "in selectTOBHit" << std::endl;
00386         edmNew::copyDetSetRange(collrphi,theChoosedHits,acc.stripTOBLayer(layer));
00387         return theChoosedHits;
00388 }
00389 
00390 std::vector<const TrackingRecHit*> CosmicLayerPairs::selectTECHit(const SiStripMatchedRecHit2DCollection &collmatch,
00391                                                                 int side,
00392                                                                 int disk){
00393         std::vector<const TrackingRecHit*> theChoosedHits;
00394         TrackerLayerIdAccessor acc;
00395         //std::cout << "in selectTECHit" << std::endl;
00396         edmNew::copyDetSetRange(collmatch,theChoosedHits,acc.stripTECDisk(side,disk));
00397         return theChoosedHits;
00398 
00399 }
00400 
00401 std::vector<const TrackingRecHit*> CosmicLayerPairs::selectTIBHit(const SiStripMatchedRecHit2DCollection &collmatch,
00402                                                                 int layer){
00403         std::vector<const TrackingRecHit*> theChoosedHits;
00404         TrackerLayerIdAccessor acc;
00405         //std::cout << "in selectTIBHit" << std::endl;
00406         edmNew::copyDetSetRange(collmatch,theChoosedHits,acc.stripTIBLayer(layer));
00407         return theChoosedHits;
00408 
00409 }
00410 
00411 std::vector<const TrackingRecHit*> CosmicLayerPairs::selectTOBHit(const SiStripMatchedRecHit2DCollection &collmatch,
00412                                                                 int layer){
00413         std::vector<const TrackingRecHit*> theChoosedHits;
00414         TrackerLayerIdAccessor acc;
00415         //std::cout << "in selectTOBHit" << std::endl;
00416         edmNew::copyDetSetRange(collmatch,theChoosedHits,acc.stripTOBLayer(layer));
00417         return theChoosedHits;
00418 }