00001 #include "RecoMuon/TransientTrackingRecHit/interface/MuonTransientTrackingRecHitBreaker.h" 00002 00003 #include "DataFormats/MuonDetId/interface/MuonSubdetId.h" 00004 00005 TransientTrackingRecHit::ConstRecHitContainer 00006 MuonTransientTrackingRecHitBreaker::breakInSubRecHits(TransientTrackingRecHit::ConstRecHitPointer muonRecHit, int granularity){ 00007 00008 const std::string metname = "Muon|RecoMuon|MuonTransientTrackingRecHitBreaker"; 00009 00010 TransientTrackingRecHit::ConstRecHitContainer recHitsForFit; 00011 00012 int subDet = muonRecHit->geographicalId().subdetId(); 00013 00014 switch(granularity){ 00015 case 0: 00016 { 00017 // Asking for 4D segments for the CSC/DT and a point for the RPC 00018 recHitsForFit.push_back( muonRecHit ); 00019 break; 00020 } 00021 case 1: 00022 { 00023 if (subDet == MuonSubdetId::DT || 00024 subDet == MuonSubdetId::CSC) 00025 // measurement->recHit() returns a 4D segment, then 00026 // DT case: asking for 2D segments. 00027 // CSC case: asking for 2D points. 00028 recHitsForFit = muonRecHit->transientHits(); 00029 00030 else if(subDet == MuonSubdetId::RPC) 00031 recHitsForFit.push_back( muonRecHit); 00032 00033 break; 00034 } 00035 00036 case 2: 00037 { 00038 if (subDet == MuonSubdetId::DT ) { 00039 00040 // Asking for 2D segments. measurement->recHit() returns a 4D segment 00041 TransientTrackingRecHit::ConstRecHitContainer segments2D = muonRecHit->transientHits(); 00042 00043 // loop over segment 00044 for (TransientTrackingRecHit::ConstRecHitContainer::const_iterator segment = segments2D.begin(); 00045 segment != segments2D.end();++segment ){ 00046 00047 // asking for 1D Rec Hit 00048 TransientTrackingRecHit::ConstRecHitContainer rechit1D = (**segment).transientHits(); 00049 00050 // load them into the recHitsForFit container 00051 copy(rechit1D.begin(),rechit1D.end(),back_inserter(recHitsForFit)); 00052 } 00053 } 00054 00055 else if(subDet == MuonSubdetId::RPC) 00056 recHitsForFit.push_back(muonRecHit); 00057 00058 else if(subDet == MuonSubdetId::CSC) 00059 // Asking for 2D points. measurement->recHit() returns a 4D segment 00060 recHitsForFit = (*muonRecHit).transientHits(); 00061 00062 break; 00063 } 00064 00065 default: 00066 { 00067 throw cms::Exception(metname) <<"Wrong granularity chosen!" 00068 <<"it will be set to 0"; 00069 break; 00070 } 00071 } 00072 00073 return recHitsForFit; 00074 }