49 theCrackEtas(pset.getParameter<std::vector<double> >(
"crackEtas")),
50 theCrackWindow(pset.getParameter<double>(
"crackWindow"))
60 std::vector<MuonRecHitContainer> &
result)
70 vector<const DetLayer*> dtLayers = muonLayers->allDTLayers();
73 vector<const DetLayer*> cscForwardLayers = muonLayers->forwardCSCLayers();
74 vector<const DetLayer*> cscBackwardLayers = muonLayers->backwardCSCLayers();
77 const DetLayer* ME4Bwd = cscBackwardLayers[4];
78 const DetLayer* ME3Bwd = cscBackwardLayers[3];
79 const DetLayer* ME2Bwd = cscBackwardLayers[2];
80 const DetLayer* ME12Bwd = cscBackwardLayers[1];
81 const DetLayer* ME11Bwd = cscBackwardLayers[0];
84 const DetLayer* ME11Fwd = cscForwardLayers[0];
85 const DetLayer* ME12Fwd = cscForwardLayers[1];
86 const DetLayer* ME2Fwd = cscForwardLayers[2];
87 const DetLayer* ME3Fwd = cscForwardLayers[3];
88 const DetLayer* ME4Fwd = cscForwardLayers[4];
99 double barreldThetaCut = 0.2;
101 double endcapdThetaCut = 1.0;
112 bool* MB1 =
zero(list8.size());
113 bool* MB2 =
zero(list7.size());
114 bool* MB3 =
zero(list6.size());
122 MB1, MB2, MB3, result);
130 MB1, MB2, MB3, result);
136 if ( list9.size() < 100 ) {
137 for (MuonRecHitContainer::iterator
iter=list9.begin();
iter!=list9.end();
iter++ ){
139 seedSegments.push_back(*
iter);
143 if(
check(seedSegments)) result.push_back(seedSegments);
148 if ( list6.size() < 100 ) {
149 for ( counter = 0; counter<list6.size(); counter++ ){
150 if ( !MB3[counter] ) {
152 seedSegments.push_back(list6[counter]);
156 if(
check(seedSegments)) result.push_back(seedSegments);
162 if ( list7.size() < 100 ) {
163 for ( counter = 0; counter<list7.size(); counter++ ){
164 if ( !MB2[counter] ) {
166 seedSegments.push_back(list7[counter]);
170 if (seedSegments.size()>1 ||
171 (seedSegments.size()==1 && seedSegments[0]->dimension()==4) )
173 result.push_back(seedSegments);
180 if ( list8.size() < 100 ) {
181 for ( counter = 0; counter<list8.size(); counter++ ){
182 if ( !MB1[counter] ) {
184 seedSegments.push_back(list8[counter]);
188 if (seedSegments.size()>1 ||
189 (seedSegments.size()==1 && seedSegments[0]->dimension()==4) )
191 result.push_back(seedSegments);
197 if ( MB3 )
delete [] MB3;
198 if ( MB2 )
delete [] MB2;
199 if ( MB1 )
delete [] MB1;
204 barreldThetaCut = 0.2;
205 endcapdThetaCut = 0.2;
209 copy(tmp.begin(),tmp.end(),back_inserter(all));
212 copy(tmp.begin(),tmp.end(),back_inserter(all));
215 copy(tmp.begin(),tmp.end(),back_inserter(all));
218 copy(tmp.begin(),tmp.end(),back_inserter(all));
221 copy(tmp.begin(),tmp.end(),back_inserter(all));
224 copy(tmp.begin(),tmp.end(),back_inserter(all));
227 copy(tmp.begin(),tmp.end(),back_inserter(all));
230 copy(tmp.begin(),tmp.end(),back_inserter(all));
233 copy(tmp.begin(),tmp.end(),back_inserter(all));
236 copy(tmp.begin(),tmp.end(),back_inserter(all));
239 copy(tmp.begin(),tmp.end(),back_inserter(all));
242 copy(tmp.begin(),tmp.end(),back_inserter(all));
245 copy(tmp.begin(),tmp.end(),back_inserter(all));
249 for(MuonRecHitContainer::const_iterator segmentItr = all.begin();
250 segmentItr != all.end(); ++segmentItr)
253 singleSegmentContainer.push_back(*segmentItr);
254 result.push_back(singleSegmentContainer);
265 result =
new bool[listSize];
266 for (
size_t i=0;
i<listSize;
i++ ) result[
i]=
false;
277 bool * MB1,
bool * MB2,
bool * MB3,
278 std::vector<MuonRecHitContainer> &
result)
286 std::vector<MuonRecHitContainer> patterns;
308 if ( list21.size() == 0 ) {
309 list11 = list22; list5 = list21;
312 if ( list24.size() < list23.size() && list24.size() > 0 ) {
313 list13 = list24; list4 = list23;
316 if ( list23.size() == 0 ) {
317 list13 = list24; list4 = list23;
325 if ( list12.size() == 0 ) {
327 if ( list11.size() <= list13.size() && list11.size() > 0 ) {
328 list1 = list11; list2 = list13;}
329 else { list1 = list13; list2 = list11;}
332 if ( list13.size() == 0 ) {
333 if ( list11.size() <= list12.size() && list11.size() > 0 ) {
334 list1 = list11; list2 = list12;}
335 else { list1 = list12; list2 = list11;}
338 if ( list12.size() != 0 && list13.size() != 0 ) {
339 if ( list11.size()<=list12.size() && list11.size()<=list13.size() && list11.size()>0 ) {
340 if ( list12.size() > list13.size() ) {
341 list2 = list13; list3 = list12;}
343 else if ( list12.size() <= list13.size() ) {
345 if ( list11.size() <= list13.size() && list11.size() > 0 ) {
346 list2 = list11; list3 = list13;}
347 else { list2 = list13; list3 = list11;}
351 if ( list11.size() <= list12.size() && list11.size() > 0 ) {
352 list2 = list11; list3 = list12;}
353 else { list2 = list12; list3 = list11;}
358 bool* ME2 =
zero(list2.size());
359 bool* ME3 =
zero(list3.size());
360 bool* ME4 =
zero(list4.size());
361 bool* ME5 =
zero(list5.size());
366 for (MuonRecHitContainer::iterator
iter = list1.begin();
iter!=list1.end();
iter++ ){
367 if ( (*iter)->recHits().size() < 4 && list3.size() > 0 )
continue;
369 seedSegments.push_back(*
iter);
377 if(
check(seedSegments)) patterns.push_back(seedSegments);
383 for ( counter = 0; counter<list2.size(); counter++ ){
385 if ( !ME2[counter] ) {
387 seedSegments.push_back(list2[counter]);
394 if(
check(seedSegments)) patterns.push_back(seedSegments);
399 if ( list3.size() < 20 ) {
400 for ( counter = 0; counter<list3.size(); counter++ ){
401 if ( !ME3[counter] ) {
403 seedSegments.push_back(list3[counter]);
409 if(
check(seedSegments)) patterns.push_back(seedSegments);
414 if ( list4.size() < 20 ) {
415 for ( counter = 0; counter<list4.size(); counter++ ){
416 if ( !ME4[counter] ) {
418 seedSegments.push_back(list4[counter]);
423 if(
check(seedSegments)) patterns.push_back(seedSegments);
428 if ( ME5 )
delete [] ME5;
429 if ( ME4 )
delete [] ME4;
430 if ( ME3 )
delete [] ME3;
431 if ( ME2 )
delete [] ME2;
433 if(!patterns.empty())
435 result.insert(result.end(), patterns.begin(), patterns.end());
439 if(!crackSegments.empty())
442 for(MuonRecHitContainer::const_iterator crackSegmentItr = crackSegments.begin();
443 crackSegmentItr != crackSegments.end(); ++crackSegmentItr)
446 singleSegmentPattern.push_back(*crackSegmentItr);
447 result.push_back(singleSegmentPattern);
466 for (
unsigned nr = 0; nr < recHits.size(); ++nr ){
469 float deta = fabs (ptg1.eta()-ptg2.
eta());
471 float dphi = fabs(
deltaPhi(ptg1.phi(), ptg2.
phi()) );
475 float detaWindow = crack ? 0.25 : 0.2;
476 if ( deta > detaWindow || dphi > .25 ) {
480 good_rhit.push_back(recHit);
486 if(best && best->
isValid() ) seedSegments.push_back(best);
496 if(good_rhit.size() == 1)
return good_rhit[0];
497 double bestDiscrim = 10000.;
498 for (MuonRecHitContainer::iterator
iter=good_rhit.begin();
502 if(discrim < bestDiscrim)
504 bestDiscrim = discrim;
518 if(first->isDT() || other->
isDT()) {
523 int nhits = other->
recHits().size();
528 return fabs(dphig/penalty);
533 if (dphid2 >
M_PI*.5) dphid2 =
M_PI - dphid2;
538 float chisq = ((dphig/0.02)*(dphig/0.02)
539 + (dthetag/0.003)*(dthetag/0.003)
540 + (dphid2/0.06)*(dphid2/0.06)
541 + (dthetad2/0.08)*(dthetad2/0.08)
543 return chisq / penalty;
549 return (segments.size() > 1);
557 if(recHits[nr]->isCSC())
559 CSCDetId detId(recHits[nr]->geographicalId().rawId());
560 if(detId.
ring() == 4)
562 std::vector<unsigned> chamberHitNs;
563 for(
unsigned i = 0;
i < recHits.size(); ++
i)
565 if(recHits[
i]->geographicalId().rawId() == detId.
rawId())
567 chamberHitNs.push_back(
i);
570 if(chamberHitNs.size() == 3)
572 for(
unsigned i = 0;
i < 3; ++
i)
574 used[chamberHitNs[
i]] =
true;
585 double absEta = fabs(segment->globalPosition().eta());
586 for(std::vector<double>::const_iterator crackItr =
theCrackEtas.begin();
600 for(MuonRecHitContainer::const_iterator segmentItr = segments.begin();
601 segmentItr != segments.end(); ++segmentItr)
603 if((**segmentItr).hit()->dimension() == 4 &&
isCrack(*segmentItr))
605 crackSegments.push_back(*segmentItr);
617 for(MuonRecHitContainer::const_iterator segmentItr = segments.begin();
618 segmentItr != segments.end(); ++segmentItr)
630 for(MuonRecHitContainer::const_iterator segmentItr = segments.begin();
631 segmentItr != segments.end(); ++segmentItr)
633 double dtheta = (*segmentItr)->globalDirection().theta() - (*segmentItr)->globalPosition().theta();
634 if((*segmentItr)->isDT())
637 if((*segmentItr)->dimension() == 2 || fabs(dtheta) < dThetaCut)
639 result.push_back(*segmentItr);
643 LogTrace(
metname) <<
"Cutting segment " << theDumper.
dumpMuonId((**segmentItr).geographicalId()) <<
" because dtheta = " << dtheta;
647 else if((*segmentItr)->isCSC())
649 if(fabs(dtheta) < dThetaCut)
651 result.push_back(*segmentItr);
655 LogTrace(
metname) <<
"Cutting segment " << theDumper.
dumpMuonId((**segmentItr).geographicalId()) <<
" because dtheta = " << dtheta;
666 if(segments.empty())
return;
669 double dphiCut = 0.05;
670 double detaCut = 0.05;
671 std::vector<unsigned> toKill;
672 std::vector<unsigned> me1aOverlaps;
675 unsigned nseg = segments.size();
676 for(
unsigned i = 0;
i < nseg-1; ++
i)
679 for(
unsigned j =
i+1;
j < nseg; ++
j)
682 if(segments[
i]->geographicalId().rawId() != segments[
j]->geographicalId().rawId()
684 && fabs(pg1.
eta()-pg2.
eta()) < detaCut)
687 theDumper.
dumpMuonId(segments[
j]->geographicalId());
692 me1aOverlaps.push_back(i);
693 me1aOverlaps.push_back(j);
699 if(toKill.empty())
return;
702 for(
unsigned i = 0;
i < me1aOverlaps.size(); ++
i)
704 DetId detId(segments[me1aOverlaps[
i]]->geographicalId());
705 vector<unsigned> inSameChamber;
706 for(
unsigned j = 0;
j < nseg; ++
j)
708 if(
i !=
j && segments[
j]->geographicalId() == detId)
710 inSameChamber.push_back(
j);
713 if(inSameChamber.size() == 2)
715 toKill.push_back(inSameChamber[0]);
716 toKill.push_back(inSameChamber[1]);
721 for(
unsigned i = 0;
i < nseg; ++
i)
723 if(
std::find(toKill.begin(), toKill.end(),
i) == toKill.end())
725 result.push_back(segments[
i]);
729 segments.swap(result);
735 return segment->isCSC() &&
CSCDetId(segment->geographicalId()).
ring() == 4;
741 vector<TrackingRecHit*>
components = (*segment).recHits();
742 for(vector<TrackingRecHit*>::const_iterator component = components.begin();
743 component != components.end(); ++component)
745 int componentSize = (**component).recHits().size();
746 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
uint32_t rawId() const
get the raw id
bool enableCSCMeasurement
Enable the CSC measurement.
int countHits(const MuonRecHitPointer &segment) const
const T & max(const T &a, const T &b)
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
virtual GlobalPoint globalPosition() const GCC11_FINAL
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
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