19 useQuality(conf.getParameter<bool>(
"useSiStripQuality")),
20 maskBad128StripBlocks( conf.existsAs<bool>(
"MaskBadAPVFibers") && conf.getParameter<bool>(
"MaskBadAPVFibers")),
24 cpeTag(conf.getParameter<edm::
ESInputTag>(
"StripCPE")),
25 matcherTag(conf.getParameter<edm::
ESInputTag>(
"Matcher")),
26 qualityTag(conf.getParameter<edm::
ESInputTag>(
"siStripQualityLabel"))
59 DS = inputhandle->begin(); DS != inputhandle->end(); DS++ ) {
if(!
useModule(DS->id()))
continue;
68 cluster = DS->begin(); cluster != DS->end(); ++cluster ) {
if(
isMasked(*cluster,bad128StripBlocks))
continue;
76 match(output,trackdirection);
84 bool bad128StripBlocks[6];
87 std::auto_ptr<Collector> collector(
new Collector(*output.
stereo, lastId));
90 for(;iregion!=refGetterhandle->
end();++iregion) {
92 const uint32_t start = region.
start();
93 const uint32_t finish = region.
finish();
94 for (uint32_t
i = start;
i < finish;
i++) {
97 DetId detId(icluster->geographicalId());
99 if(collector->empty()) collector->abort();
106 : std::auto_ptr<Collector>(
new Collector(*output.
rphi, detId));
109 if( !goodDet ||
isMasked(*icluster, bad128StripBlocks))
continue;
114 if(collector->empty()) collector->abort();
122 struct CollectorHelper {
130 Collector & m_collector;
131 CollectorMatched & m_collectorMatched;
133 std::vector<SiStripRecHit2D::ClusterRef::key_type> & m_matchedSteroClusters;
134 std::vector<SiStripRecHit2D::ClusterRegionalRef::key_type> & m_matchedSteroClustersRegional;
145 Add(CollectorHelper& ih) :
h(ih){}
150 CollectorHelper & collector() {
158 Collector & i_collector,
159 CollectorMatched & i_collectorMatched,
161 std::vector<SiStripRecHit2D::ClusterRef::key_type> & i_matchedSteroClusters,
162 std::vector<SiStripRecHit2D::ClusterRegionalRef::key_type> & i_matchedSteroClustersRegional
163 ) : regional(
false), nmatch(0),
164 m_collector(i_collector),
165 m_collectorMatched(i_collectorMatched),
166 m_fillerRphiUnm(i_fillerRphiUnm),
167 m_matchedSteroClusters(i_matchedSteroClusters),
168 m_matchedSteroClustersRegional(i_matchedSteroClustersRegional)
172 if (!m_collectorMatched.empty()){
173 nmatch+=m_collectorMatched.size();
175 edm = m_collectorMatched.end();
178 m_collector.push_back(*itm);
180 if (itm->stereoHit()->cluster().isNonnull()) {
181 m_matchedSteroClusters.push_back(itm->stereoHit()->cluster().key());
183 m_matchedSteroClustersRegional.push_back(itm->stereoHit()->cluster_regional().key());
187 m_collectorMatched.clear();
190 m_fillerRphiUnm.push_back(*it);
208 std::vector<SiStripRecHit2D::ClusterRef::key_type> matchedSteroClusters;
209 std::vector<SiStripRecHit2D::ClusterRegionalRef::key_type> matchedSteroClustersRegional;
217 if (partnerId == 0) {
219 if (!rphiHits.
empty()) {
230 if (itStereoDet == edStereoDet) {
232 if (!rphiHits.
empty()) {
246 Collector collector(*output.
matched, specDetId.glued());
252 matchedSteroClusters.clear();
253 matchedSteroClustersRegional.clear();
254 bool regional =
false;
257 CollectorHelper chelper(collector, collectorMatched,
259 matchedSteroClusters,matchedSteroClustersRegional
262 stereoHits.
begin(),stereoHits.
end(),gluedDet,trackdirection,chelper);
263 regional = chelper.regional;
264 nmatch+=chelper.nmatch;
269 stereoSimpleHits.reserve(stereoHits.
size());
271 stereoSimpleHits.push_back(&*it);
275 matcher->match(&(*it),stereoSimpleHits.begin(),stereoSimpleHits.end(),collectorMatched,gluedDet,trackdirection);
276 if (collectorMatched.
size()>0){
277 nmatch+=collectorMatched.
size();
279 edm = collectorMatched.
end();
282 collector.push_back(*itm);
284 if (itm->stereoHit()->cluster().isNonnull()) {
285 matchedSteroClusters.push_back(itm->stereoHit()->cluster().key());
287 matchedSteroClustersRegional.push_back(itm->stereoHit()->cluster_regional().key());
291 collectorMatched.
clear();
294 fillerRphiUnm.push_back(*it);
302 if (collector.empty()) collector.abort();
305 if (fillerRphiUnm.empty()) fillerRphiUnm.abort();
310 std::sort(matchedSteroClusters.begin(), matchedSteroClusters.end());
312 if (!std::binary_search(matchedSteroClusters.begin(), matchedSteroClusters.end(), it->cluster().key())) {
313 fillerStereoUnm.push_back(*it);
317 std::sort(matchedSteroClustersRegional.begin(), matchedSteroClustersRegional.end());
319 if (!std::binary_search(matchedSteroClustersRegional.begin(), matchedSteroClustersRegional.end(), it->cluster_regional().key())) {
320 fillerStereoUnm.push_back(*it);
324 if (fillerStereoUnm.empty()) fillerStereoUnm.abort();
333 if (partnerId == 0)
continue;
335 if (itRPhiDet == edRPhiDet) {
336 if (!stereoHits.
empty()) {
347 <<
" matched RecHits\n";
354 short badApvs =
quality->getBadApvs(detid);
355 short badFibers =
quality->getBadFibers(detid);
356 for (
int j = 0;
j < 6;
j++) {
357 bad128StripBlocks[
j] = (badApvs & (1 <<
j));
359 for (
int j = 0;
j < 3;
j++) {
360 if (badFibers & (1 <<
j)) {
361 bad128StripBlocks[2*
j+0] =
true;
362 bad128StripBlocks[2*
j+1] =
true;
373 if ( bad128StripBlocks[cluster.
firstStrip() >> 7] ) {
375 bad128StripBlocks[static_cast<int32_t>(cluster.
barycenter()-0.499999) >> 7] ) {
380 bad128StripBlocks[static_cast<int32_t>(cluster.
barycenter()-0.499999) >> 7] ) {
393 if(stripdet==0)
edm::LogWarning(
"SiStripRecHitConverter") <<
"Detid=" <<
id <<
" not found";
edm::Ref< typename HandleT::element_type, typename HandleT::element_type::value_type::value_type > makeRefTo(const HandleT &iHandle, typename HandleT::element_type::value_type::const_iterator itIter)
void push_back(data_type const &d)
void initialize(const edm::EventSetup &)
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
Local3DVector LocalVector
void run(edm::Handle< edmNew::DetSetVector< SiStripCluster > > input, products &output)
std::auto_ptr< SiStripRecHit2DCollection > rphiUnmatched
uint32_t quality_cache_id
edm::ESHandle< SiStripRecHitMatcher > matcher
edm::ESHandle< TrackerGeometry > tracker
uint32_t tracker_cache_id
const_iterator end() const
Return the off-the-end iterator.
uint16_t firstStrip() const
data_type const * const_iterator
SiStripRecHitConverterAlgorithm(const edm::ParameterSet &)
void fillBad128StripBlocks(const uint32_t detid, bool bad128StripBlocks[6]) const
unsigned int partnerDetId() const
std::pair< LocalPoint, LocalError > LocalValues
bool useModule(const uint32_t id) const
edm::ESInputTag matcherTag
void match(products &output, LocalVector trackdirection) const
Ref< LazyGetter< T >, T, FindValue< T > > makeRefToLazyGetter(const Handle< LazyGetter< T > > &handle, const uint32_t index)
uint32_t finish() const
Get off-the-end finish index.
std::auto_ptr< SiStripRecHit2DCollection > stereoUnmatched
std::auto_ptr< SiStripRecHit2DCollection > rphi
const_iterator begin() const
Get begin iterator.
#define TYPELOOKUP_DATA_REG(_dataclass_)
unsigned int stereo() const
stereo
std::vector< T >::const_iterator const_iterator
boost::indirect_iterator< typename collection_type::const_iterator > const_iterator
std::vector< const SiStripRecHit2D * > SimpleHitCollection
SiStripRecHit2DCollection::FastFiller Collector
uint32_t start() const
Get start index.
edm::ESHandle< StripClusterParameterEstimator > parameterestimator
bool maskBad128StripBlocks
std::auto_ptr< SiStripMatchedRecHit2DCollection > matched
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
const std::vector< uint8_t > & amplitudes() const
std::auto_ptr< SiStripRecHit2DCollection > stereo
edm::ESInputTag qualityTag
bool isMasked(const SiStripCluster &cluster, bool bad128StripBlocks[6]) const
edm::ESHandle< SiStripQuality > quality