49 theCrackEtas(pset.getParameter<std::vector<double> >(
"crackEtas")),
50 theCrackWindow(pset.getParameter<double>(
"crackWindow")),
51 theDeltaPhiWindow(pset.existsAs<double>(
"deltaPhiSearchWindow") ? pset.getParameter<double>(
"deltaPhiSearchWindow") : 0.25),
52 theDeltaEtaWindow(pset.existsAs<double>(
"deltaEtaSearchWindow") ? pset.getParameter<double>(
"deltaEtaSearchWindow") : 0.2),
53 theDeltaCrackWindow(pset.existsAs<double>(
"deltaEtaCrackSearchWindow") ? pset.getParameter<double>(
"deltaEtaCrackSearchWindow") : 0.25)
64 std::vector<MuonRecHitContainer> &
result)
75 vector<const DetLayer*> dtLayers = muonLayers->allDTLayers();
78 vector<const DetLayer*> cscForwardLayers = muonLayers->forwardCSCLayers();
79 vector<const DetLayer*> cscBackwardLayers = muonLayers->backwardCSCLayers();
82 const DetLayer* ME4Bwd = cscBackwardLayers[4];
83 const DetLayer* ME3Bwd = cscBackwardLayers[3];
84 const DetLayer* ME2Bwd = cscBackwardLayers[2];
85 const DetLayer* ME12Bwd = cscBackwardLayers[1];
86 const DetLayer* ME11Bwd = cscBackwardLayers[0];
89 const DetLayer* ME11Fwd = cscForwardLayers[0];
90 const DetLayer* ME12Fwd = cscForwardLayers[1];
91 const DetLayer* ME2Fwd = cscForwardLayers[2];
92 const DetLayer* ME3Fwd = cscForwardLayers[3];
93 const DetLayer* ME4Fwd = cscForwardLayers[4];
104 double barreldThetaCut = 0.2;
106 double endcapdThetaCut = 1.0;
117 bool* MB1 =
zero(list8.size());
118 bool* MB2 =
zero(list7.size());
119 bool* MB3 =
zero(list6.size());
127 MB1, MB2, MB3, result);
135 MB1, MB2, MB3, result);
141 if ( list9.size() < 100 ) {
142 for (MuonRecHitContainer::iterator iter=list9.begin(); iter!=list9.end(); iter++ ){
144 seedSegments.push_back(*iter);
148 if(
check(seedSegments)) result.push_back(seedSegments);
153 if ( list6.size() < 100 ) {
154 for ( counter = 0; counter<list6.size(); counter++ ){
155 if ( !MB3[counter] ) {
157 seedSegments.push_back(list6[counter]);
161 if(
check(seedSegments)) result.push_back(seedSegments);
167 if ( list7.size() < 100 ) {
168 for ( counter = 0; counter<list7.size(); counter++ ){
169 if ( !MB2[counter] ) {
171 seedSegments.push_back(list7[counter]);
175 if (seedSegments.size()>1 ||
176 (seedSegments.size()==1 && seedSegments[0]->dimension()==4) )
178 result.push_back(seedSegments);
185 if ( list8.size() < 100 ) {
186 for ( counter = 0; counter<list8.size(); counter++ ){
187 if ( !MB1[counter] ) {
189 seedSegments.push_back(list8[counter]);
193 if (seedSegments.size()>1 ||
194 (seedSegments.size()==1 && seedSegments[0]->dimension()==4) )
196 result.push_back(seedSegments);
202 if ( MB3 )
delete [] MB3;
203 if ( MB2 )
delete [] MB2;
204 if ( MB1 )
delete [] MB1;
209 barreldThetaCut = 0.2;
210 endcapdThetaCut = 0.2;
214 copy(tmp.begin(),tmp.end(),back_inserter(all));
217 copy(tmp.begin(),tmp.end(),back_inserter(all));
220 copy(tmp.begin(),tmp.end(),back_inserter(all));
223 copy(tmp.begin(),tmp.end(),back_inserter(all));
226 copy(tmp.begin(),tmp.end(),back_inserter(all));
229 copy(tmp.begin(),tmp.end(),back_inserter(all));
232 copy(tmp.begin(),tmp.end(),back_inserter(all));
235 copy(tmp.begin(),tmp.end(),back_inserter(all));
238 copy(tmp.begin(),tmp.end(),back_inserter(all));
241 copy(tmp.begin(),tmp.end(),back_inserter(all));
244 copy(tmp.begin(),tmp.end(),back_inserter(all));
247 copy(tmp.begin(),tmp.end(),back_inserter(all));
250 copy(tmp.begin(),tmp.end(),back_inserter(all));
254 for(MuonRecHitContainer::const_iterator segmentItr = all.begin();
255 segmentItr != all.end(); ++segmentItr)
258 singleSegmentContainer.push_back(*segmentItr);
259 result.push_back(singleSegmentContainer);
270 result =
new bool[listSize];
271 for (
size_t i=0;
i<listSize;
i++ ) result[
i]=
false;
282 bool * MB1,
bool * MB2,
bool * MB3,
283 std::vector<MuonRecHitContainer> &
result)
291 std::vector<MuonRecHitContainer>
patterns;
313 if ( list21.size() == 0 ) {
314 list11 = list22; list5 = list21;
317 if ( list24.size() < list23.size() && list24.size() > 0 ) {
318 list13 = list24; list4 = list23;
321 if ( list23.size() == 0 ) {
322 list13 = list24; list4 = list23;
330 if ( list12.size() == 0 ) {
332 if ( list11.size() <= list13.size() && list11.size() > 0 ) {
333 list1 = list11; list2 = list13;}
334 else { list1 = list13; list2 = list11;}
337 if ( list13.size() == 0 ) {
338 if ( list11.size() <= list12.size() && list11.size() > 0 ) {
339 list1 = list11; list2 = list12;}
340 else { list1 = list12; list2 = list11;}
343 if ( list12.size() != 0 && list13.size() != 0 ) {
344 if ( list11.size()<=list12.size() && list11.size()<=list13.size() && list11.size()>0 ) {
345 if ( list12.size() > list13.size() ) {
346 list2 = list13; list3 = list12;}
348 else if ( list12.size() <= list13.size() ) {
350 if ( list11.size() <= list13.size() && list11.size() > 0 ) {
351 list2 = list11; list3 = list13;}
352 else { list2 = list13; list3 = list11;}
356 if ( list11.size() <= list12.size() && list11.size() > 0 ) {
357 list2 = list11; list3 = list12;}
358 else { list2 = list12; list3 = list11;}
363 bool* ME2 =
zero(list2.size());
364 bool* ME3 =
zero(list3.size());
365 bool* ME4 =
zero(list4.size());
366 bool* ME5 =
zero(list5.size());
371 for (MuonRecHitContainer::iterator iter = list1.begin(); iter!=list1.end(); iter++ ){
372 if ( (*iter)->recHits().size() < 4 && list3.size() > 0 )
continue;
374 seedSegments.push_back(*iter);
382 if(
check(seedSegments)) patterns.push_back(seedSegments);
388 for ( counter = 0; counter<list2.size(); counter++ ){
390 if ( !ME2[counter] ) {
392 seedSegments.push_back(list2[counter]);
399 if(
check(seedSegments)) patterns.push_back(seedSegments);
404 if ( list3.size() < 20 ) {
405 for ( counter = 0; counter<list3.size(); counter++ ){
406 if ( !ME3[counter] ) {
408 seedSegments.push_back(list3[counter]);
414 if(
check(seedSegments)) patterns.push_back(seedSegments);
419 if ( list4.size() < 20 ) {
420 for ( counter = 0; counter<list4.size(); counter++ ){
421 if ( !ME4[counter] ) {
423 seedSegments.push_back(list4[counter]);
428 if(
check(seedSegments)) patterns.push_back(seedSegments);
433 if ( ME5 )
delete [] ME5;
434 if ( ME4 )
delete [] ME4;
435 if ( ME3 )
delete [] ME3;
436 if ( ME2 )
delete [] ME2;
438 if(!patterns.empty())
440 result.insert(result.end(), patterns.begin(), patterns.end());
444 if(!crackSegments.empty())
447 for(MuonRecHitContainer::const_iterator crackSegmentItr = crackSegments.begin();
448 crackSegmentItr != crackSegments.end(); ++crackSegmentItr)
451 singleSegmentPattern.push_back(*crackSegmentItr);
452 result.push_back(singleSegmentPattern);
471 for (
unsigned nr = 0; nr < recHits.size(); ++nr ){
474 float deta = fabs (ptg1.eta()-ptg2.
eta());
485 good_rhit.push_back(recHit);
491 if(best && best->isValid() ) seedSegments.push_back(best);
501 if(good_rhit.size() == 1)
return good_rhit[0];
502 double bestDiscrim = 10000.;
503 for (MuonRecHitContainer::iterator iter=good_rhit.begin();
504 iter!=good_rhit.end(); iter++)
507 if(discrim < bestDiscrim)
509 bestDiscrim = discrim;
523 if(first->isDT() || other->isDT()) {
528 int nhits = other->recHits().size();
533 return fabs(dphig/penalty);
538 if (dphid2 >
M_PI*.5) dphid2 =
M_PI - dphid2;
543 float chisq = ((dphig/0.02)*(dphig/0.02)
544 + (dthetag/0.003)*(dthetag/0.003)
545 + (dphid2/0.06)*(dphid2/0.06)
546 + (dthetad2/0.08)*(dthetad2/0.08)
548 return chisq / penalty;
554 return (segments.size() > 1);
562 if(recHits[nr]->
isCSC())
564 CSCDetId detId(recHits[nr]->geographicalId().rawId());
565 if(detId.
ring() == 4)
567 std::vector<unsigned> chamberHitNs;
568 for(
unsigned i = 0;
i < recHits.size(); ++
i)
570 if(recHits[
i]->geographicalId().rawId() == detId.
rawId())
572 chamberHitNs.push_back(
i);
575 if(chamberHitNs.size() == 3)
577 for(
unsigned i = 0;
i < 3; ++
i)
579 used[chamberHitNs[
i]] =
true;
590 double absEta = fabs(segment->globalPosition().eta());
591 for(std::vector<double>::const_iterator crackItr =
theCrackEtas.begin();
605 for(MuonRecHitContainer::const_iterator segmentItr = segments.begin();
606 segmentItr != segments.end(); ++segmentItr)
608 if((**segmentItr).hit()->dimension() == 4 &&
isCrack(*segmentItr))
610 crackSegments.push_back(*segmentItr);
622 for(MuonRecHitContainer::const_iterator segmentItr = segments.begin();
623 segmentItr != segments.end(); ++segmentItr)
635 for(MuonRecHitContainer::const_iterator segmentItr = segments.begin();
636 segmentItr != segments.end(); ++segmentItr)
638 double dtheta = (*segmentItr)->globalDirection().theta() - (*segmentItr)->globalPosition().theta();
639 if((*segmentItr)->isDT())
642 if((*segmentItr)->dimension() == 2 || fabs(dtheta) < dThetaCut)
644 result.push_back(*segmentItr);
648 LogTrace(
metname) <<
"Cutting segment " << theDumper.
dumpMuonId((**segmentItr).geographicalId()) <<
" because dtheta = " << dtheta;
652 else if((*segmentItr)->isCSC())
654 if(fabs(dtheta) < dThetaCut)
656 result.push_back(*segmentItr);
660 LogTrace(
metname) <<
"Cutting segment " << theDumper.
dumpMuonId((**segmentItr).geographicalId()) <<
" because dtheta = " << dtheta;
671 if(segments.empty())
return;
674 double dphiCut = 0.05;
675 double detaCut = 0.05;
676 std::vector<unsigned> toKill;
677 std::vector<unsigned> me1aOverlaps;
680 unsigned nseg = segments.size();
681 for(
unsigned i = 0;
i < nseg-1; ++
i)
684 for(
unsigned j =
i+1;
j < nseg; ++
j)
687 if(segments[
i]->geographicalId().rawId() != segments[
j]->geographicalId().rawId()
689 && fabs(pg1.
eta()-pg2.
eta()) < detaCut)
692 theDumper.
dumpMuonId(segments[
j]->geographicalId());
697 me1aOverlaps.push_back(i);
698 me1aOverlaps.push_back(j);
704 if(toKill.empty())
return;
707 for(
unsigned i = 0;
i < me1aOverlaps.size(); ++
i)
709 DetId detId(segments[me1aOverlaps[
i]]->geographicalId());
710 vector<unsigned> inSameChamber;
711 for(
unsigned j = 0;
j < nseg; ++
j)
713 if(
i !=
j && segments[
j]->geographicalId() == detId)
715 inSameChamber.push_back(
j);
718 if(inSameChamber.size() == 2)
720 toKill.push_back(inSameChamber[0]);
721 toKill.push_back(inSameChamber[1]);
726 for(
unsigned i = 0;
i < nseg; ++
i)
728 if(
std::find(toKill.begin(), toKill.end(),
i) == toKill.end())
730 result.push_back(segments[
i]);
734 segments.swap(result);
740 return segment->isCSC() &&
CSCDetId(segment->geographicalId()).
ring() == 4;
746 vector<TrackingRecHit*>
components = (*segment).recHits();
747 for(vector<TrackingRecHit*>::const_iterator component = components.begin();
748 component != components.end(); ++component)
750 int componentSize = (**component).recHits().size();
751 count += (componentSize == 0) ? 1 : componentSize;
PhiMemoryImage patterns[9]
MuonTransientTrackingRecHit::ConstMuonRecHitPointer ConstMuonRecHitPointer
MuonRecHitPointer bestMatch(const ConstMuonRecHitPointer &first, MuonRecHitContainer &good_rhit) const
MuonTransientTrackingRecHit::MuonRecHitPointer MuonRecHitPointer
const std::string metname
void filterOverlappingChambers(MuonRecHitContainer &segments) const
bool isCrack(const ConstMuonRecHitPointer &segment) const
bool check(const MuonRecHitContainer &segments)
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
std::string dumpMuonId(const DetId &id) const
Geom::Theta< T > theta() const
double theDeltaCrackWindow
uint32_t rawId() const
get the raw id
bool enableCSCMeasurement
Enable the CSC measurement.
int countHits(const MuonRecHitPointer &segment) const
MuonRecHitContainer recHits(const DetLayer *layer, const edm::Event &iEvent)
returns the rechits which are on the layer
void produce(const edm::Event &event, const edm::EventSetup &eSetup, std::vector< MuonRecHitContainer > &result)
void endcapPatterns(const MuonRecHitContainer &me11, const MuonRecHitContainer &me12, const MuonRecHitContainer &me2, const MuonRecHitContainer &me3, const MuonRecHitContainer &me4, const MuonRecHitContainer &mb1, const MuonRecHitContainer &mb2, const MuonRecHitContainer &mb3, bool *MB1, bool *MB2, bool *MB3, std::vector< MuonRecHitContainer > &result)
bool * zero(unsigned listSize)
void rememberCrackSegments(const MuonRecHitContainer &segments, MuonRecHitContainer &crackSegments) const
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
MuonDetLayerMeasurements * muonMeasurements
MuonTransientTrackingRecHit::MuonRecHitContainer MuonRecHitContainer
bool isME1A(const ConstMuonRecHitPointer &segment) const
void complete(MuonRecHitContainer &seedSegments, const MuonRecHitContainer &recHits, bool *used=0) const
std::vector< std::vector< double > > tmp
void markAsUsed(int nr, const MuonRecHitContainer &recHits, bool *used) const
MuonSeedOrcaPatternRecognition(const edm::ParameterSet &pset, edm::ConsumesCollector &iC)
static std::atomic< unsigned int > counter
bool enableDTMeasurement
Enable the DT measurement.
std::vector< double > theCrackEtas
void dumpLayer(const char *name, const MuonRecHitContainer &segments) const
double discriminator(const ConstMuonRecHitPointer &first, MuonRecHitPointer &other) const
bool isCSC(const GeomDetEnumerators::SubDetector m)
edm::InputTag theCSCRecSegmentLabel
the name of the CSC rec hits collection
edm::InputTag theDTRecSegmentLabel
the name of the DT rec hits collection
MuonRecHitContainer filterSegments(const MuonRecHitContainer &segments, double dThetaCut) const
apply some cuts to segments before using them