![]() |
![]() |
#include <RecoLocalTracker/SiStripRecHitConverter/interface/SiStripRecHitConverterAlgorithm.h>
Definition at line 36 of file SiStripRecHitConverterAlgorithm.h.
SiStripRecHitConverterAlgorithm::SiStripRecHitConverterAlgorithm | ( | const edm::ParameterSet & | conf | ) |
SiStripRecHitConverterAlgorithm::~SiStripRecHitConverterAlgorithm | ( | ) |
void SiStripRecHitConverterAlgorithm::fillBad128StripBlocks | ( | const SiStripQuality & | quality, | |
const uint32_t & | detid, | |||
bool | bad128StripBlocks[6] | |||
) | const [private] |
Definition at line 271 of file SiStripRecHitConverterAlgorithm.cc.
References SiStripQuality::getBadApvs(), SiStripQuality::getBadFibers(), and j.
Referenced by run().
00271 { 00272 short badApvs = quality.getBadApvs(detid); 00273 short badFibers = quality.getBadFibers(detid); 00274 for (int j = 0; j < 6; j++) { 00275 bad128StripBlocks[j] = (badApvs & (1 << j)); 00276 } 00277 for (int j = 0; j < 3; j++) { 00278 if (badFibers & (1 << j)) { 00279 bad128StripBlocks[2*j+0] = true; 00280 bad128StripBlocks[2*j+1] = true; 00281 } 00282 } 00283 }
bool SiStripRecHitConverterAlgorithm::isMasked | ( | const SiStripCluster & | cluster, | |
bool | bad128StripBlocks[6] | |||
) | const [inline, private] |
Definition at line 58 of file SiStripRecHitConverterAlgorithm.h.
References SiStripCluster::amplitudes(), SiStripCluster::barycenter(), and SiStripCluster::firstStrip().
Referenced by run().
00058 { 00059 if ( bad128StripBlocks[cluster.firstStrip() >> 7] ) { 00060 if ( bad128StripBlocks[(cluster.firstStrip()+cluster.amplitudes().size()) >> 7] || 00061 bad128StripBlocks[static_cast<int32_t>(cluster.barycenter()-0.499999) >> 7] ) { 00062 return true; 00063 } 00064 } else { 00065 if ( bad128StripBlocks[(cluster.firstStrip()+cluster.amplitudes().size()) >> 7] && 00066 bad128StripBlocks[static_cast<int32_t>(cluster.barycenter()-0.499999) >> 7] ) { 00067 return true; 00068 } 00069 } 00070 return false; 00071 }
void SiStripRecHitConverterAlgorithm::match | ( | SiStripMatchedRecHit2DCollection & | outmatched, | |
SiStripRecHit2DCollection & | outrphi, | |||
SiStripRecHit2DCollection & | outstereo, | |||
const TrackerGeometry & | tracker, | |||
const SiStripRecHitMatcher & | matcher, | |||
LocalVector | trackdirection | |||
) | const [private] |
Definition at line 199 of file SiStripRecHitConverterAlgorithm.cc.
References edm::OwnVector< T, P >::begin(), conf_, edm::OwnVector< T, P >::end(), edm::RangeMap< ID, C, P >::get(), edm::ParameterSet::getParameter(), StripSubdetector::glued(), i, edm::RangeMap< ID, C, P >::ids(), TrackerGeometry::idToDet(), iter, SiStripRecHitMatcher::match(), StripSubdetector::partnerDetId(), edm::RangeMap< ID, C, P >::put(), edm::OwnVector< T, P >::size(), and python::multivaluedict::sort().
Referenced by run().
00199 { 00200 int maximumHits2BeforeMatching = conf_.getParameter<uint32_t>("maximumHits2BeforeMatching"); 00201 bool skippedPairs = false; 00202 00203 int nmatch=0; 00204 00205 std::vector<DetId> rphidetIDs = outrphi.ids(); 00206 std::vector<DetId> stereodetIDs = outstereo.ids(); 00207 if (!__gnu_cxx::is_sorted(stereodetIDs.begin(), stereodetIDs.end())) { 00208 // this is an error in the logic of the RangeMap. Anyway, we can cope with it 00209 std::sort(stereodetIDs.begin(), stereodetIDs.end()); 00210 } 00211 for ( std::vector<DetId>::const_iterator detunit_iterator = rphidetIDs.begin(); detunit_iterator != rphidetIDs.end(); detunit_iterator++ ) {//loop over detectors 00212 edm::OwnVector<SiStripMatchedRecHit2D> collectorMatched; 00213 00214 edm::OwnVector<SiStripMatchedRecHit2D> collectorMatchedSingleHit; 00215 StripSubdetector specDetId(*detunit_iterator); 00216 unsigned int id = specDetId.partnerDetId(); 00217 const DetId theId(id); 00218 00219 //find if the detid of the stereo is in the list of stereo RH 00220 if (!std::binary_search(stereodetIDs.begin(),stereodetIDs.end(),theId)) id = 0; 00221 // Much better std::binary_search than std::find, as the list is sorted 00222 // was:// std::vector<DetId>::const_iterator partnerdetiter=std::binary_search(stereodetIDs.begin(),stereodetIDs.end(),theId); 00223 // was:// if(partnerdetiter==stereodetIDs.end()) id=0; 00224 00225 SiStripRecHit2DCollection::range monoRecHitRange = outrphi.get((*detunit_iterator)); 00226 SiStripRecHit2DCollection::const_iterator rhRangeIteratorBegin = monoRecHitRange.first; 00227 SiStripRecHit2DCollection::const_iterator rhRangeIteratorEnd = monoRecHitRange.second; 00228 SiStripRecHit2DCollection::const_iterator iter; 00229 00230 for(iter=rhRangeIteratorBegin;iter!=rhRangeIteratorEnd;++iter){//loop over the mono RH 00231 00232 if (id>0){ //if the detector has a stereo det associated and at least an hit in the stereo detector 00233 00234 const SiStripRecHit2DCollection::range rhpartnerRange = outstereo.get(theId); 00235 SiStripRecHit2DCollection::const_iterator rhpartnerRangeIteratorBegin = rhpartnerRange.first; 00236 SiStripRecHit2DCollection::const_iterator rhpartnerRangeIteratorEnd = rhpartnerRange.second; 00237 00238 if ((maximumHits2BeforeMatching > 0) && 00239 (monoRecHitRange.second - monoRecHitRange.first) * (rhpartnerRange.second - rhpartnerRange.first) > maximumHits2BeforeMatching) { 00240 skippedPairs = true; 00241 break; 00242 } 00243 00244 const GluedGeomDet* gluedDet = (const GluedGeomDet*)tracker.idToDet(DetId(specDetId.glued())); 00245 SiStripRecHitMatcher::SimpleHitCollection stereoHits; 00246 stereoHits.reserve(rhpartnerRangeIteratorEnd-rhpartnerRangeIteratorBegin); 00247 00248 for (SiStripRecHit2DCollection::const_iterator i=rhpartnerRangeIteratorBegin; i != rhpartnerRangeIteratorEnd; ++i) { 00249 stereoHits.push_back( &(*i)); // convert to simple pointer 00250 } 00251 // perform the matchin looping over the hit on the stereo dets 00252 matcher.match(&(*iter),stereoHits.begin(),stereoHits.end(),collectorMatched,gluedDet,trackdirection); 00253 00254 } 00255 } 00256 if (collectorMatched.size()>0){ 00257 nmatch+=collectorMatched.size(); 00258 StripSubdetector stripDetId(*detunit_iterator); 00259 outmatched.put(DetId(stripDetId.glued()),collectorMatched.begin(),collectorMatched.end()); 00260 } 00261 } 00262 00263 edm::LogInfo("SiStripRecHitConverter") 00264 << "found\n" 00265 << nmatch 00266 << " matched RecHits\n"; 00267 if (skippedPairs) { 00268 edm::LogWarning("SiStripRecHitConverter") << "Skipped matched rechits on some noisy modules.\n"; 00269 } 00270 }
void SiStripRecHitConverterAlgorithm::run | ( | edm::Handle< edm::RefGetter< SiStripCluster > > | input1, | |
edm::Handle< edm::LazyGetter< SiStripCluster > > | input2, | |||
SiStripMatchedRecHit2DCollection & | outmatched, | |||
SiStripRecHit2DCollection & | outrphi, | |||
SiStripRecHit2DCollection & | outstereo, | |||
const TrackerGeometry & | tracker, | |||
const StripClusterParameterEstimator & | parameterestimator, | |||
const SiStripRecHitMatcher & | matcher, | |||
const SiStripQuality * | quality = 0 | |||
) |
Definition at line 114 of file SiStripRecHitConverterAlgorithm.cc.
References edm::RegionIndex< T >::begin(), edm::OwnVector< T, P >::begin(), edm::OwnVector< T, P >::clear(), conf_, detId, edm::RefGetter< T >::end(), edm::OwnVector< T, P >::end(), edm::ParameterSet::existsAs(), fillBad128StripBlocks(), edm::RegionIndex< T >::finish(), edm::ParameterSet::getParameter(), i, TrackerGeometry::idToDetUnit(), isMasked(), SiStripQuality::IsModuleUsable(), ClusterParameterEstimator< T >::localParameters(), edm::makeRefToLazyGetter(), match(), python::trackProbabilityAnalysis_cff::parameters, edm::OwnVector< T, P >::push_back(), edm::RangeMap< ID, C, P >::put(), edm::OwnVector< T, P >::size(), edm::RegionIndex< T >::start(), and StripSubdetector::stereo().
00115 { 00116 00117 int nmono=0; 00118 int nstereo=0; 00119 bool maskBad128StripBlocks, bad128StripBlocks[6]; 00120 maskBad128StripBlocks = ((quality != 0) && conf_.existsAs<bool>("MaskBadAPVFibers") && conf_.getParameter<bool>("MaskBadAPVFibers")); 00121 00122 edm::OwnVector<SiStripRecHit2D> collectorrphi; 00123 edm::OwnVector<SiStripRecHit2D> collectorstereo; 00124 00125 DetId lastId; bool goodDet = true; 00126 00127 edm::RefGetter<SiStripCluster>::const_iterator iregion = refGetterhandle->begin(); 00128 for(;iregion!=refGetterhandle->end();++iregion) { 00129 const edm::RegionIndex<SiStripCluster>& region = *iregion; 00130 const uint32_t start = region.start(); 00131 const uint32_t finish = region.finish(); 00132 for (uint32_t i = start; i < finish; i++) { 00133 edm::RegionIndex<SiStripCluster>::const_iterator icluster = region.begin()+(i-start); 00134 00135 DetId detId(icluster->geographicalId()); 00136 const StripGeomDetUnit * stripdet=(const StripGeomDetUnit*)tracker.idToDetUnit(detId); 00137 if(stripdet==0) 00138 edm::LogWarning("SiStripRecHitConverter") 00139 <<"Detid=" 00140 <<icluster->geographicalId() 00141 <<" not found"; 00142 else { 00143 if (quality != 0) { 00144 if (detId != lastId) { 00145 lastId = detId; 00146 goodDet = quality->IsModuleUsable(detId); 00147 if (goodDet) fillBad128StripBlocks(*quality, detId, bad128StripBlocks); 00148 } 00149 if (!goodDet) continue; 00150 // if masking is on, check that the cluster is not masked 00151 if (maskBad128StripBlocks && isMasked(*icluster, bad128StripBlocks)) continue; 00152 } 00153 00154 StripSubdetector specDetId=StripSubdetector(icluster->geographicalId()); 00155 StripClusterParameterEstimator::LocalValues parameters=parameterestimator.localParameters(*icluster,*stripdet); 00156 edm::Ref< edm::LazyGetter<SiStripCluster>, SiStripCluster, edm::FindValue<SiStripCluster> > cluster = 00157 makeRefToLazyGetter(lazyGetterhandle,i); 00158 00159 if(!specDetId.stereo()){ 00160 collectorrphi.push_back(new SiStripRecHit2D(parameters.first, parameters.second,detId,cluster)); 00161 nmono++; 00162 } 00163 else{ 00164 collectorstereo.push_back(new SiStripRecHit2D(parameters.first, parameters.second,detId,cluster)); 00165 nstereo++; 00166 } 00167 00168 //If last cluster in det store clusters and clear OwnVector 00169 if (((icluster+1 )==iregion->end()) 00170 || ((icluster+1)->geographicalId() != icluster->geographicalId())) { 00171 00172 if (collectorrphi.size() > 0) { 00173 outrphi.put(detId,collectorrphi.begin(),collectorrphi.end()); 00174 collectorrphi.clear(); 00175 } 00176 00177 if (collectorstereo.size() > 0) { 00178 outstereo.put(detId, collectorstereo.begin(),collectorstereo.end()); 00179 collectorstereo.clear(); 00180 } 00181 } 00182 } 00183 } 00184 } 00185 00186 edm::LogInfo("SiStripRecHitConverter") 00187 << "found\n" 00188 << nmono 00189 << " clusters in mono detectors\n" 00190 << nstereo 00191 << " clusters in partners stereo detectors\n"; 00192 00193 00194 match(outmatched,outrphi,outstereo,tracker,matcher,LocalVector(0.,0.,0.)); 00195 00196 }
void SiStripRecHitConverterAlgorithm::run | ( | edm::Handle< edmNew::DetSetVector< SiStripCluster > > | input, | |
SiStripMatchedRecHit2DCollection & | output, | |||
SiStripRecHit2DCollection & | outrphi, | |||
SiStripRecHit2DCollection & | outstereo, | |||
const TrackerGeometry & | tracker, | |||
const StripClusterParameterEstimator & | stripcpe, | |||
const SiStripRecHitMatcher & | clustermatch_, | |||
LocalVector | trackdirection, | |||
const SiStripQuality * | quality = 0 | |||
) |
Definition at line 44 of file SiStripRecHitConverterAlgorithm.cc.
References begin, conf_, detId, end, edm::ParameterSet::existsAs(), fillBad128StripBlocks(), edm::ParameterSet::getParameter(), TrackerGeometry::idToDetUnit(), isMasked(), SiStripQuality::IsModuleUsable(), iter, ClusterParameterEstimator< T >::localParameters(), edmNew::makeRefTo(), match(), python::trackProbabilityAnalysis_cff::parameters, edm::RangeMap< ID, C, P >::put(), and StripSubdetector::stereo().
00045 { 00046 00047 int nmono=0; 00048 int nstereo=0; 00049 bool maskBad128StripBlocks, bad128StripBlocks[6]; 00050 maskBad128StripBlocks = ((quality != 0) && conf_.existsAs<bool>("MaskBadAPVFibers") && conf_.getParameter<bool>("MaskBadAPVFibers")); 00051 00052 std::vector<SiStripRecHit2D> collectorrphi, collectorstereo; 00053 for (edmNew::DetSetVector<SiStripCluster>::const_iterator DSViter=inputhandle->begin(); DSViter!=inputhandle->end();DSViter++ ) {//loop over detectors 00054 00055 unsigned int id = DSViter->id(); 00056 collectorrphi.clear(); collectorstereo.clear(); 00057 00058 // if(id!=999999999){ //if is valid detector 00059 DetId detId(id); 00060 //get geometry 00061 const StripGeomDetUnit * stripdet=(const StripGeomDetUnit*)tracker.idToDetUnit(detId); 00062 if(stripdet==0)edm::LogWarning("SiStripRecHitConverter")<<"Detid="<<id<<" not found, trying next one"; 00063 else if ((quality == 0) || quality->IsModuleUsable(detId)) { 00064 if (maskBad128StripBlocks) fillBad128StripBlocks(*quality, detId, bad128StripBlocks); 00065 edmNew::DetSet<SiStripCluster>::const_iterator begin=DSViter->begin(); 00066 edmNew::DetSet<SiStripCluster>::const_iterator end =DSViter->end(); 00067 00068 StripSubdetector specDetId=StripSubdetector(id); 00069 for(edmNew::DetSet<SiStripCluster>::const_iterator iter=begin;iter!=end;++iter){//loop over the clusters of the detector 00070 // if masking is on, check that the cluster is not masked 00071 if (maskBad128StripBlocks && isMasked(*iter, bad128StripBlocks)) continue; 00072 00073 //calculate the position and error in local coordinates 00074 StripClusterParameterEstimator::LocalValues parameters=parameterestimator.localParameters(*iter,*stripdet); 00075 00076 // GlobalPoint gcenterofstrip=(stripdet->surface()).toGlobal(parameters.first); 00077 // GlobalVector gtrackdirection=gcenterofstrip-GlobalPoint(0,0,0); 00078 // LocalVector trackdir=(stripdet->surface()).toLocal(gtrackdirection); 00079 // const LocalTrajectoryParameters trackparam=LocalTrajectoryParameters( parameters.first, trackdir,0); 00080 // parameters=parameterestimator.localParameters(*iter,*stripdet,trackparam); 00081 00082 //store the ref to the cluster 00083 SiStripRecHit2D::ClusterRef cluster=edmNew::makeRefTo(inputhandle,iter); 00084 00085 if(!specDetId.stereo()){ //if the cluster is in a mono det 00086 collectorrphi.push_back(SiStripRecHit2D(parameters.first, parameters.second,detId,cluster)); 00087 nmono++; 00088 } 00089 else{ //if the cluster in in stereo det 00090 collectorstereo.push_back(SiStripRecHit2D(parameters.first, parameters.second,detId,cluster)); 00091 nstereo++; 00092 } 00093 } 00094 if (collectorrphi.size() > 0) { 00095 outrphi.put(detId,collectorrphi.begin(),collectorrphi.end()); 00096 } 00097 if (collectorstereo.size() > 0) { 00098 outstereo.put(detId, collectorstereo.begin(),collectorstereo.end()); 00099 } 00100 } 00101 } 00102 00103 edm::LogInfo("SiStripRecHitConverter") 00104 << "found\n" 00105 << nmono 00106 << " clusters in mono detectors\n" 00107 << nstereo 00108 << " clusters in partners stereo detectors\n"; 00109 00110 // Match the clusters 00111 match(outmatched,outrphi,outstereo,tracker,matcher,trackdirection); 00112 }
void SiStripRecHitConverterAlgorithm::run | ( | edm::Handle< edmNew::DetSetVector< SiStripCluster > > | input, | |
SiStripMatchedRecHit2DCollection & | outmatched, | |||
SiStripRecHit2DCollection & | outrphi, | |||
SiStripRecHit2DCollection & | outstereo, | |||
const TrackerGeometry & | tracker, | |||
const StripClusterParameterEstimator & | stripcpe, | |||
const SiStripRecHitMatcher & | clustermatch_, | |||
const SiStripQuality * | quality = 0 | |||
) |
Runs the algorithm.
Definition at line 38 of file SiStripRecHitConverterAlgorithm.cc.
References iggi_31X_cfg::input.
00039 { 00040 run(input, outmatched,outrphi,outstereo,tracker,parameterestimator,matcher,LocalVector(0.,0.,0.),quality); 00041 }