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"))
61 DS = inputhandle->begin(); DS != dse; ++DS ) {
74 cluster = (*DS).begin(); cluster != cle; ++cluster ) {
76 if(
isMasked(*cluster,bad128StripBlocks))
continue;
84 match(output,trackdirection);
92 bool bad128StripBlocks[6];
95 std::auto_ptr<Collector> collector(
new Collector(*output.
stereo, lastId));
98 for(;iregion!=refGetterhandle->
end();++iregion) {
101 const uint32_t finish = region.
finish();
102 for (uint32_t
i = start;
i < finish;
i++) {
105 DetId detId(icluster->geographicalId());
106 if(detId != lastId) {
107 if(collector->empty()) collector->abort();
114 : std::auto_ptr<Collector>(
new Collector(*output.
rphi, detId));
117 if( !goodDet ||
isMasked(*icluster, bad128StripBlocks))
continue;
120 collector->push_back(SiStripRecHit2D( parameters.first, parameters.second, detId,
makeRefToLazyGetter(lazyGetterhandle,
i) ));
122 if(collector->empty()) collector->abort();
130 struct CollectorHelper {
138 Collector & m_collector;
139 CollectorMatched & m_collectorMatched;
141 std::vector<SiStripRecHit2D::ClusterRef::key_type> & m_matchedSteroClusters;
142 std::vector<SiStripRecHit2D::ClusterRegionalRef::key_type> & m_matchedSteroClustersRegional;
153 Add(CollectorHelper& ih) :
h(ih){}
155 void operator()(SiStripMatchedRecHit2D
const & rh) {
h.m_collectorMatched.push_back(rh);}
158 CollectorHelper & collector() {
162 void operator()(SiStripMatchedRecHit2D
const & rh) {m_collectorMatched.push_back(rh);}
166 Collector & i_collector,
167 CollectorMatched & i_collectorMatched,
169 std::vector<SiStripRecHit2D::ClusterRef::key_type> & i_matchedSteroClusters,
170 std::vector<SiStripRecHit2D::ClusterRegionalRef::key_type> & i_matchedSteroClustersRegional
171 ) : regional(
false), nmatch(0),
172 m_collector(i_collector),
173 m_collectorMatched(i_collectorMatched),
174 m_fillerRphiUnm(i_fillerRphiUnm),
175 m_matchedSteroClusters(i_matchedSteroClusters),
176 m_matchedSteroClustersRegional(i_matchedSteroClustersRegional)
180 if (!m_collectorMatched.empty()){
181 nmatch+=m_collectorMatched.size();
183 edm = m_collectorMatched.end();
186 m_collector.push_back(*itm);
188 if (itm->stereoHit().cluster().isNonnull()) {
189 m_matchedSteroClusters.push_back(itm->stereoClusterRef().key());
191 m_matchedSteroClustersRegional.push_back(itm->stereoClusterRef().key());
195 m_collectorMatched.clear();
198 m_fillerRphiUnm.push_back(*it);
216 std::vector<SiStripRecHit2D::ClusterRef::key_type> matchedSteroClusters;
217 std::vector<SiStripRecHit2D::ClusterRegionalRef::key_type> matchedSteroClustersRegional;
225 if (partnerId == 0) {
227 if (!rphiHits.
empty()) {
238 if (itStereoDet == edStereoDet) {
240 if (!rphiHits.
empty()) {
254 Collector collector(*output.
matched, specDetId.glued());
260 matchedSteroClusters.clear();
261 matchedSteroClustersRegional.clear();
262 bool regional =
false;
265 CollectorHelper chelper(collector, collectorMatched,
267 matchedSteroClusters,matchedSteroClustersRegional
270 stereoHits.
begin(),stereoHits.
end(),gluedDet,trackdirection,chelper);
271 regional = chelper.regional;
272 nmatch+=chelper.nmatch;
277 stereoSimpleHits.reserve(stereoHits.
size());
279 stereoSimpleHits.push_back(&*it);
283 matcher->match(&(*it),stereoSimpleHits.begin(),stereoSimpleHits.end(),collectorMatched,gluedDet,trackdirection);
284 if (collectorMatched.
size()>0){
285 nmatch+=collectorMatched.
size();
287 edm = collectorMatched.
end();
290 collector.push_back(*itm);
292 if (itm->stereoHit().cluster().isNonnull()) {
293 matchedSteroClusters.push_back(itm->stereoClusterRef().key());
295 matchedSteroClustersRegional.push_back(itm->stereoClusterRef().key());
299 collectorMatched.
clear();
302 fillerRphiUnm.push_back(*it);
310 if (collector.empty()) collector.abort();
313 if (fillerRphiUnm.empty()) fillerRphiUnm.abort();
318 std::sort(matchedSteroClusters.begin(), matchedSteroClusters.end());
320 if (!std::binary_search(matchedSteroClusters.begin(), matchedSteroClusters.end(), it->cluster().key())) {
321 fillerStereoUnm.push_back(*it);
325 std::sort(matchedSteroClustersRegional.begin(), matchedSteroClustersRegional.end());
327 if (!std::binary_search(matchedSteroClustersRegional.begin(), matchedSteroClustersRegional.end(), it->cluster_regional().key())) {
328 fillerStereoUnm.push_back(*it);
332 if (fillerStereoUnm.empty()) fillerStereoUnm.abort();
341 if (partnerId == 0)
continue;
343 if (itRPhiDet == edRPhiDet) {
344 if (!stereoHits.
empty()) {
355 <<
" matched RecHits\n";
362 short badApvs =
quality->getBadApvs(detid);
363 short badFibers =
quality->getBadFibers(detid);
364 for (
int j = 0;
j < 6;
j++) {
365 bad128StripBlocks[
j] = (badApvs & (1 <<
j));
367 for (
int j = 0;
j < 3;
j++) {
368 if (badFibers & (1 <<
j)) {
369 bad128StripBlocks[2*
j+0] =
true;
370 bad128StripBlocks[2*
j+1] =
true;
381 if ( bad128StripBlocks[cluster.
firstStrip() >> 7] ) {
383 bad128StripBlocks[static_cast<int32_t>(cluster.
barycenter()-0.499999) >> 7] ) {
388 bad128StripBlocks[static_cast<int32_t>(cluster.
barycenter()-0.499999) >> 7] ) {
401 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
tuple start
Check for commandline option errors.
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
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
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
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