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)
63 std::vector<MuonRecHitContainer> &
result)
74 vector<const DetLayer*> dtLayers = muonLayers->allDTLayers();
77 vector<const DetLayer*> cscForwardLayers = muonLayers->forwardCSCLayers();
78 vector<const DetLayer*> cscBackwardLayers = muonLayers->backwardCSCLayers();
81 const DetLayer* ME4Bwd = cscBackwardLayers[4];
82 const DetLayer* ME3Bwd = cscBackwardLayers[3];
83 const DetLayer* ME2Bwd = cscBackwardLayers[2];
84 const DetLayer* ME12Bwd = cscBackwardLayers[1];
85 const DetLayer* ME11Bwd = cscBackwardLayers[0];
88 const DetLayer* ME11Fwd = cscForwardLayers[0];
89 const DetLayer* ME12Fwd = cscForwardLayers[1];
90 const DetLayer* ME2Fwd = cscForwardLayers[2];
91 const DetLayer* ME3Fwd = cscForwardLayers[3];
92 const DetLayer* ME4Fwd = cscForwardLayers[4];
103 double barreldThetaCut = 0.2;
105 double endcapdThetaCut = 1.0;
116 bool* MB1 =
zero(list8.size());
117 bool* MB2 =
zero(list7.size());
118 bool* MB3 =
zero(list6.size());
126 MB1, MB2, MB3, result);
134 MB1, MB2, MB3, result);
140 if ( list9.size() < 100 ) {
141 for (MuonRecHitContainer::iterator
iter=list9.begin();
iter!=list9.end();
iter++ ){
143 seedSegments.push_back(*
iter);
147 if(
check(seedSegments)) result.push_back(seedSegments);
152 if ( list6.size() < 100 ) {
153 for ( counter = 0; counter<list6.size(); counter++ ){
154 if ( !MB3[counter] ) {
156 seedSegments.push_back(list6[counter]);
160 if(
check(seedSegments)) result.push_back(seedSegments);
166 if ( list7.size() < 100 ) {
167 for ( counter = 0; counter<list7.size(); counter++ ){
168 if ( !MB2[counter] ) {
170 seedSegments.push_back(list7[counter]);
174 if (seedSegments.size()>1 ||
175 (seedSegments.size()==1 && seedSegments[0]->dimension()==4) )
177 result.push_back(seedSegments);
184 if ( list8.size() < 100 ) {
185 for ( counter = 0; counter<list8.size(); counter++ ){
186 if ( !MB1[counter] ) {
188 seedSegments.push_back(list8[counter]);
192 if (seedSegments.size()>1 ||
193 (seedSegments.size()==1 && seedSegments[0]->dimension()==4) )
195 result.push_back(seedSegments);
201 if ( MB3 )
delete [] MB3;
202 if ( MB2 )
delete [] MB2;
203 if ( MB1 )
delete [] MB1;
208 barreldThetaCut = 0.2;
209 endcapdThetaCut = 0.2;
213 copy(tmp.begin(),tmp.end(),back_inserter(all));
216 copy(tmp.begin(),tmp.end(),back_inserter(all));
219 copy(tmp.begin(),tmp.end(),back_inserter(all));
222 copy(tmp.begin(),tmp.end(),back_inserter(all));
225 copy(tmp.begin(),tmp.end(),back_inserter(all));
228 copy(tmp.begin(),tmp.end(),back_inserter(all));
231 copy(tmp.begin(),tmp.end(),back_inserter(all));
234 copy(tmp.begin(),tmp.end(),back_inserter(all));
237 copy(tmp.begin(),tmp.end(),back_inserter(all));
240 copy(tmp.begin(),tmp.end(),back_inserter(all));
243 copy(tmp.begin(),tmp.end(),back_inserter(all));
246 copy(tmp.begin(),tmp.end(),back_inserter(all));
249 copy(tmp.begin(),tmp.end(),back_inserter(all));
253 for(MuonRecHitContainer::const_iterator segmentItr = all.begin();
254 segmentItr != all.end(); ++segmentItr)
257 singleSegmentContainer.push_back(*segmentItr);
258 result.push_back(singleSegmentContainer);
269 result =
new bool[listSize];
270 for (
size_t i=0;
i<listSize;
i++ ) result[
i]=
false;
281 bool * MB1,
bool * MB2,
bool * MB3,
282 std::vector<MuonRecHitContainer> &
result)
290 std::vector<MuonRecHitContainer> patterns;
312 if ( list21.size() == 0 ) {
313 list11 = list22; list5 = list21;
316 if ( list24.size() < list23.size() && list24.size() > 0 ) {
317 list13 = list24; list4 = list23;
320 if ( list23.size() == 0 ) {
321 list13 = list24; list4 = list23;
329 if ( list12.size() == 0 ) {
331 if ( list11.size() <= list13.size() && list11.size() > 0 ) {
332 list1 = list11; list2 = list13;}
333 else { list1 = list13; list2 = list11;}
336 if ( list13.size() == 0 ) {
337 if ( list11.size() <= list12.size() && list11.size() > 0 ) {
338 list1 = list11; list2 = list12;}
339 else { list1 = list12; list2 = list11;}
342 if ( list12.size() != 0 && list13.size() != 0 ) {
343 if ( list11.size()<=list12.size() && list11.size()<=list13.size() && list11.size()>0 ) {
344 if ( list12.size() > list13.size() ) {
345 list2 = list13; list3 = list12;}
347 else if ( list12.size() <= list13.size() ) {
349 if ( list11.size() <= list13.size() && list11.size() > 0 ) {
350 list2 = list11; list3 = list13;}
351 else { list2 = list13; list3 = list11;}
355 if ( list11.size() <= list12.size() && list11.size() > 0 ) {
356 list2 = list11; list3 = list12;}
357 else { list2 = list12; list3 = list11;}
362 bool* ME2 =
zero(list2.size());
363 bool* ME3 =
zero(list3.size());
364 bool* ME4 =
zero(list4.size());
365 bool* ME5 =
zero(list5.size());
370 for (MuonRecHitContainer::iterator
iter = list1.begin();
iter!=list1.end();
iter++ ){
371 if ( (*iter)->recHits().size() < 4 && list3.size() > 0 )
continue;
373 seedSegments.push_back(*
iter);
381 if(
check(seedSegments)) patterns.push_back(seedSegments);
387 for ( counter = 0; counter<list2.size(); counter++ ){
389 if ( !ME2[counter] ) {
391 seedSegments.push_back(list2[counter]);
398 if(
check(seedSegments)) patterns.push_back(seedSegments);
403 if ( list3.size() < 20 ) {
404 for ( counter = 0; counter<list3.size(); counter++ ){
405 if ( !ME3[counter] ) {
407 seedSegments.push_back(list3[counter]);
413 if(
check(seedSegments)) patterns.push_back(seedSegments);
418 if ( list4.size() < 20 ) {
419 for ( counter = 0; counter<list4.size(); counter++ ){
420 if ( !ME4[counter] ) {
422 seedSegments.push_back(list4[counter]);
427 if(
check(seedSegments)) patterns.push_back(seedSegments);
432 if ( ME5 )
delete [] ME5;
433 if ( ME4 )
delete [] ME4;
434 if ( ME3 )
delete [] ME3;
435 if ( ME2 )
delete [] ME2;
437 if(!patterns.empty())
439 result.insert(result.end(), patterns.begin(), patterns.end());
443 if(!crackSegments.empty())
446 for(MuonRecHitContainer::const_iterator crackSegmentItr = crackSegments.begin();
447 crackSegmentItr != crackSegments.end(); ++crackSegmentItr)
450 singleSegmentPattern.push_back(*crackSegmentItr);
451 result.push_back(singleSegmentPattern);
470 for (
unsigned nr = 0; nr < recHits.size(); ++nr ){
473 float deta = fabs (ptg1.eta()-ptg2.
eta());
475 float dphi = fabs(
deltaPhi(ptg1.phi(), ptg2.
phi()) );
484 good_rhit.push_back(recHit);
490 if(best && best->
isValid() ) seedSegments.push_back(best);
500 if(good_rhit.size() == 1)
return good_rhit[0];
501 double bestDiscrim = 10000.;
502 for (MuonRecHitContainer::iterator
iter=good_rhit.begin();
506 if(discrim < bestDiscrim)
508 bestDiscrim = discrim;
522 if(first->isDT() || other->
isDT()) {
527 int nhits = other->
recHits().size();
532 return fabs(dphig/penalty);
537 if (dphid2 >
M_PI*.5) dphid2 =
M_PI - dphid2;
542 float chisq = ((dphig/0.02)*(dphig/0.02)
543 + (dthetag/0.003)*(dthetag/0.003)
544 + (dphid2/0.06)*(dphid2/0.06)
545 + (dthetad2/0.08)*(dthetad2/0.08)
547 return chisq / penalty;
553 return (segments.size() > 1);
561 if(recHits[nr]->
isCSC())
563 CSCDetId detId(recHits[nr]->geographicalId().rawId());
564 if(detId.
ring() == 4)
566 std::vector<unsigned> chamberHitNs;
567 for(
unsigned i = 0;
i < recHits.size(); ++
i)
569 if(recHits[
i]->geographicalId().rawId() == detId.
rawId())
571 chamberHitNs.push_back(
i);
574 if(chamberHitNs.size() == 3)
576 for(
unsigned i = 0;
i < 3; ++
i)
578 used[chamberHitNs[
i]] =
true;
589 double absEta = fabs(segment->globalPosition().eta());
590 for(std::vector<double>::const_iterator crackItr =
theCrackEtas.begin();
604 for(MuonRecHitContainer::const_iterator segmentItr = segments.begin();
605 segmentItr != segments.end(); ++segmentItr)
607 if((**segmentItr).hit()->dimension() == 4 &&
isCrack(*segmentItr))
609 crackSegments.push_back(*segmentItr);
621 for(MuonRecHitContainer::const_iterator segmentItr = segments.begin();
622 segmentItr != segments.end(); ++segmentItr)
634 for(MuonRecHitContainer::const_iterator segmentItr = segments.begin();
635 segmentItr != segments.end(); ++segmentItr)
637 double dtheta = (*segmentItr)->globalDirection().theta() - (*segmentItr)->globalPosition().theta();
638 if((*segmentItr)->isDT())
641 if((*segmentItr)->dimension() == 2 || fabs(dtheta) < dThetaCut)
643 result.push_back(*segmentItr);
647 LogTrace(
metname) <<
"Cutting segment " << theDumper.
dumpMuonId((**segmentItr).geographicalId()) <<
" because dtheta = " << dtheta;
651 else if((*segmentItr)->isCSC())
653 if(fabs(dtheta) < dThetaCut)
655 result.push_back(*segmentItr);
659 LogTrace(
metname) <<
"Cutting segment " << theDumper.
dumpMuonId((**segmentItr).geographicalId()) <<
" because dtheta = " << dtheta;
670 if(segments.empty())
return;
673 double dphiCut = 0.05;
674 double detaCut = 0.05;
675 std::vector<unsigned> toKill;
676 std::vector<unsigned> me1aOverlaps;
679 unsigned nseg = segments.size();
680 for(
unsigned i = 0;
i < nseg-1; ++
i)
683 for(
unsigned j =
i+1;
j < nseg; ++
j)
686 if(segments[
i]->geographicalId().rawId() != segments[
j]->geographicalId().rawId()
688 && fabs(pg1.
eta()-pg2.
eta()) < detaCut)
691 theDumper.
dumpMuonId(segments[
j]->geographicalId());
696 me1aOverlaps.push_back(i);
697 me1aOverlaps.push_back(j);
703 if(toKill.empty())
return;
706 for(
unsigned i = 0;
i < me1aOverlaps.size(); ++
i)
708 DetId detId(segments[me1aOverlaps[
i]]->geographicalId());
709 vector<unsigned> inSameChamber;
710 for(
unsigned j = 0;
j < nseg; ++
j)
712 if(
i !=
j && segments[
j]->geographicalId() == detId)
714 inSameChamber.push_back(
j);
717 if(inSameChamber.size() == 2)
719 toKill.push_back(inSameChamber[0]);
720 toKill.push_back(inSameChamber[1]);
725 for(
unsigned i = 0;
i < nseg; ++
i)
727 if(
std::find(toKill.begin(), toKill.end(),
i) == toKill.end())
729 result.push_back(segments[
i]);
733 segments.swap(result);
739 return segment->isCSC() &&
CSCDetId(segment->geographicalId()).
ring() == 4;
745 vector<TrackingRecHit*>
components = (*segment).recHits();
746 for(vector<TrackingRecHit*>::const_iterator component = components.begin();
747 component != components.end(); ++component)
749 int componentSize = (**component).recHits().size();
750 count += (componentSize == 0) ? 1 : componentSize;
MuonTransientTrackingRecHit::ConstMuonRecHitPointer ConstMuonRecHitPointer
MuonRecHitPointer bestMatch(const ConstMuonRecHitPointer &first, MuonRecHitContainer &good_rhit) const
const std::string metname
void filterOverlappingChambers(MuonRecHitContainer &segments) const
virtual GlobalVector globalDirection() const
Direction in 3D for segments, otherwise (0,0,0)
Geom::Phi< T > phi() 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)
bool isDT() const
if this rec hit is a DT rec hit
virtual std::vector< const TrackingRecHit * > recHits() const override
Access to component RecHits (if any)
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
virtual GlobalPoint globalPosition() const
MuonRecHitContainer filterSegments(const MuonRecHitContainer &segments, double dThetaCut) const
apply some cuts to segments before using them