52 theCrackEtas(pset.getParameter<std::vector<double> >(
"crackEtas")),
53 theCrackWindow(pset.getParameter<double>(
"crackWindow"))
60 std::vector<MuonRecHitContainer> &
result)
70 vector<DetLayer*> dtLayers = muonLayers->allDTLayers();
73 vector<DetLayer*> cscForwardLayers = muonLayers->forwardCSCLayers();
74 vector<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];
100 double barreldThetaCut = 0.2;
102 double endcapdThetaCut = 1.0;
113 bool* MB1 =
zero(list8.size());
114 bool* MB2 =
zero(list7.size());
115 bool* MB3 =
zero(list6.size());
118 filterSegments(muonMeasurements.recHits(ME12Bwd,event), endcapdThetaCut),
119 filterSegments(muonMeasurements.recHits(ME2Bwd,event), endcapdThetaCut),
120 filterSegments(muonMeasurements.recHits(ME3Bwd,event), endcapdThetaCut),
121 filterSegments(muonMeasurements.recHits(ME4Bwd,event), endcapdThetaCut),
123 MB1, MB2, MB3, result);
126 filterSegments(muonMeasurements.recHits(ME12Fwd,event), endcapdThetaCut),
127 filterSegments(muonMeasurements.recHits(ME2Fwd,event), endcapdThetaCut),
128 filterSegments(muonMeasurements.recHits(ME3Fwd,event), endcapdThetaCut),
129 filterSegments(muonMeasurements.recHits(ME4Fwd,event), endcapdThetaCut),
131 MB1, MB2, MB3, result);
136 unsigned int counter = 0;
137 if ( list9.size() < 100 ) {
138 for (MuonRecHitContainer::iterator iter=list9.begin(); iter!=list9.end(); iter++ ){
140 seedSegments.push_back(*iter);
144 if(
check(seedSegments)) result.push_back(seedSegments);
149 if ( list6.size() < 100 ) {
150 for ( counter = 0; counter<list6.size(); counter++ ){
151 if ( !MB3[counter] ) {
153 seedSegments.push_back(list6[counter]);
157 if(
check(seedSegments)) result.push_back(seedSegments);
163 if ( list7.size() < 100 ) {
164 for ( counter = 0; counter<list7.size(); counter++ ){
165 if ( !MB2[counter] ) {
167 seedSegments.push_back(list7[counter]);
171 if (seedSegments.size()>1 ||
172 (seedSegments.size()==1 && seedSegments[0]->dimension()==4) )
174 result.push_back(seedSegments);
181 if ( list8.size() < 100 ) {
182 for ( counter = 0; counter<list8.size(); counter++ ){
183 if ( !MB1[counter] ) {
185 seedSegments.push_back(list8[counter]);
189 if (seedSegments.size()>1 ||
190 (seedSegments.size()==1 && seedSegments[0]->dimension()==4) )
192 result.push_back(seedSegments);
198 if ( MB3 )
delete [] MB3;
199 if ( MB2 )
delete [] MB2;
200 if ( MB1 )
delete [] MB1;
205 barreldThetaCut = 0.2;
206 endcapdThetaCut = 0.2;
210 copy(tmp.begin(),tmp.end(),back_inserter(all));
212 tmp =
filterSegments(muonMeasurements.recHits(ME2Bwd,event), endcapdThetaCut);
213 copy(tmp.begin(),tmp.end(),back_inserter(all));
215 tmp =
filterSegments(muonMeasurements.recHits(ME12Bwd,event), endcapdThetaCut);
216 copy(tmp.begin(),tmp.end(),back_inserter(all));
218 tmp =
filterSegments(muonMeasurements.recHits(ME11Bwd,event), endcapdThetaCut);
219 copy(tmp.begin(),tmp.end(),back_inserter(all));
221 tmp =
filterSegments(muonMeasurements.recHits(ME11Fwd,event), endcapdThetaCut);
222 copy(tmp.begin(),tmp.end(),back_inserter(all));
224 tmp =
filterSegments(muonMeasurements.recHits(ME12Fwd,event), endcapdThetaCut);
225 copy(tmp.begin(),tmp.end(),back_inserter(all));
227 tmp =
filterSegments(muonMeasurements.recHits(ME2Fwd,event), endcapdThetaCut);
228 copy(tmp.begin(),tmp.end(),back_inserter(all));
230 tmp =
filterSegments(muonMeasurements.recHits(ME3Fwd,event), endcapdThetaCut);
231 copy(tmp.begin(),tmp.end(),back_inserter(all));
233 tmp =
filterSegments(muonMeasurements.recHits(ME4Fwd,event), endcapdThetaCut);
234 copy(tmp.begin(),tmp.end(),back_inserter(all));
236 tmp =
filterSegments(muonMeasurements.recHits(MB4DL,event), barreldThetaCut);
237 copy(tmp.begin(),tmp.end(),back_inserter(all));
239 tmp =
filterSegments(muonMeasurements.recHits(MB3DL,event), barreldThetaCut);
240 copy(tmp.begin(),tmp.end(),back_inserter(all));
242 tmp =
filterSegments(muonMeasurements.recHits(MB2DL,event), barreldThetaCut);
243 copy(tmp.begin(),tmp.end(),back_inserter(all));
245 tmp =
filterSegments(muonMeasurements.recHits(MB1DL,event), barreldThetaCut);
246 copy(tmp.begin(),tmp.end(),back_inserter(all));
250 for(MuonRecHitContainer::const_iterator segmentItr = all.begin();
251 segmentItr != all.end(); ++segmentItr)
254 singleSegmentContainer.push_back(*segmentItr);
255 result.push_back(singleSegmentContainer);
266 result =
new bool[listSize];
267 for (
size_t i=0;
i<listSize;
i++ ) result[
i]=
false;
278 bool * MB1,
bool * MB2,
bool * MB3,
279 std::vector<MuonRecHitContainer> &
result)
287 std::vector<MuonRecHitContainer> patterns;
309 if ( list21.size() == 0 ) {
310 list11 = list22; list5 = list21;
313 if ( list24.size() < list23.size() && list24.size() > 0 ) {
314 list13 = list24; list4 = list23;
317 if ( list23.size() == 0 ) {
318 list13 = list24; list4 = list23;
326 if ( list12.size() == 0 ) {
328 if ( list11.size() <= list13.size() && list11.size() > 0 ) {
329 list1 = list11; list2 = list13;}
330 else { list1 = list13; list2 = list11;}
333 if ( list13.size() == 0 ) {
334 if ( list11.size() <= list12.size() && list11.size() > 0 ) {
335 list1 = list11; list2 = list12;}
336 else { list1 = list12; list2 = list11;}
339 if ( list12.size() != 0 && list13.size() != 0 ) {
340 if ( list11.size()<=list12.size() && list11.size()<=list13.size() && list11.size()>0 ) {
341 if ( list12.size() > list13.size() ) {
342 list2 = list13; list3 = list12;}
344 else if ( list12.size() <= list13.size() ) {
346 if ( list11.size() <= list13.size() && list11.size() > 0 ) {
347 list2 = list11; list3 = list13;}
348 else { list2 = list13; list3 = list11;}
352 if ( list11.size() <= list12.size() && list11.size() > 0 ) {
353 list2 = list11; list3 = list12;}
354 else { list2 = list12; list3 = list11;}
359 bool* ME2 =
zero(list2.size());
360 bool* ME3 =
zero(list3.size());
361 bool* ME4 =
zero(list4.size());
362 bool* ME5 =
zero(list5.size());
367 for (MuonRecHitContainer::iterator iter = list1.begin(); iter!=list1.end(); iter++ ){
368 if ( (*iter)->recHits().size() < 4 && list3.size() > 0 )
continue;
370 seedSegments.push_back(*iter);
378 if(
check(seedSegments)) patterns.push_back(seedSegments);
382 unsigned int counter;
384 for ( counter = 0; counter<list2.size(); counter++ ){
386 if ( !ME2[counter] ) {
388 seedSegments.push_back(list2[counter]);
395 if(
check(seedSegments)) patterns.push_back(seedSegments);
400 if ( list3.size() < 20 ) {
401 for ( counter = 0; counter<list3.size(); counter++ ){
402 if ( !ME3[counter] ) {
404 seedSegments.push_back(list3[counter]);
410 if(
check(seedSegments)) patterns.push_back(seedSegments);
415 if ( list4.size() < 20 ) {
416 for ( counter = 0; counter<list4.size(); counter++ ){
417 if ( !ME4[counter] ) {
419 seedSegments.push_back(list4[counter]);
424 if(
check(seedSegments)) patterns.push_back(seedSegments);
429 if ( ME5 )
delete [] ME5;
430 if ( ME4 )
delete [] ME4;
431 if ( ME3 )
delete [] ME3;
432 if ( ME2 )
delete [] ME2;
434 if(!patterns.empty())
436 result.insert(result.end(), patterns.begin(), patterns.end());
440 if(!crackSegments.empty())
443 for(MuonRecHitContainer::const_iterator crackSegmentItr = crackSegments.begin();
444 crackSegmentItr != crackSegments.end(); ++crackSegmentItr)
447 singleSegmentPattern.push_back(*crackSegmentItr);
448 result.push_back(singleSegmentPattern);
467 for (
unsigned nr = 0; nr < recHits.size(); ++nr ){
470 float deta = fabs (ptg1.eta()-ptg2.
eta());
472 float dphi = fabs(
deltaPhi(ptg1.phi(), ptg2.
phi()) );
476 float detaWindow = crack ? 0.25 : 0.2;
477 if ( deta > detaWindow || dphi > .25 ) {
481 good_rhit.push_back(recHit);
487 if(best && best->isValid() ) seedSegments.push_back(best);
497 if(good_rhit.size() == 1)
return good_rhit[0];
498 double bestDiscrim = 10000.;
499 for (MuonRecHitContainer::iterator iter=good_rhit.begin();
500 iter!=good_rhit.end(); iter++)
503 if(discrim < bestDiscrim)
505 bestDiscrim = discrim;
519 if(first->isDT() || other->isDT()) {
524 int nhits = other->recHits().size();
529 return fabs(dphig/penalty);
534 if (dphid2 >
M_PI*.5) dphid2 =
M_PI - dphid2;
539 float chisq = ((dphig/0.02)*(dphig/0.02)
540 + (dthetag/0.003)*(dthetag/0.003)
541 + (dphid2/0.06)*(dphid2/0.06)
542 + (dthetad2/0.08)*(dthetad2/0.08)
544 return chisq / penalty;
550 return (segments.size() > 1);
558 if(recHits[nr]->isCSC())
560 CSCDetId detId(recHits[nr]->geographicalId().rawId());
561 if(detId.
ring() == 4)
563 std::vector<unsigned> chamberHitNs;
564 for(
unsigned i = 0;
i < recHits.size(); ++
i)
566 if(recHits[
i]->geographicalId().rawId() == detId.
rawId())
568 chamberHitNs.push_back(
i);
571 if(chamberHitNs.size() == 3)
573 for(
unsigned i = 0;
i < 3; ++
i)
575 used[chamberHitNs[
i]] =
true;
586 double absEta = fabs(segment->globalPosition().eta());
587 for(std::vector<double>::const_iterator crackItr =
theCrackEtas.begin();
601 for(MuonRecHitContainer::const_iterator segmentItr = segments.begin();
602 segmentItr != segments.end(); ++segmentItr)
604 if((**segmentItr).hit()->dimension() == 4 &&
isCrack(*segmentItr))
606 crackSegments.push_back(*segmentItr);
618 for(MuonRecHitContainer::const_iterator segmentItr = segments.begin();
619 segmentItr != segments.end(); ++segmentItr)
631 for(MuonRecHitContainer::const_iterator segmentItr = segments.begin();
632 segmentItr != segments.end(); ++segmentItr)
634 double dtheta = (*segmentItr)->globalDirection().theta() - (*segmentItr)->globalPosition().theta();
635 if((*segmentItr)->isDT())
638 if((*segmentItr)->dimension() == 2 || fabs(dtheta) < dThetaCut)
640 result.push_back(*segmentItr);
644 LogTrace(
metname) <<
"Cutting segment " << theDumper.
dumpMuonId((**segmentItr).geographicalId()) <<
" because dtheta = " << dtheta;
648 else if((*segmentItr)->isCSC())
650 if(fabs(dtheta) < dThetaCut)
652 result.push_back(*segmentItr);
656 LogTrace(
metname) <<
"Cutting segment " << theDumper.
dumpMuonId((**segmentItr).geographicalId()) <<
" because dtheta = " << dtheta;
667 if(segments.empty())
return;
670 double dphiCut = 0.05;
671 double detaCut = 0.05;
672 std::vector<unsigned> toKill;
673 std::vector<unsigned> me1aOverlaps;
676 unsigned nseg = segments.size();
677 for(
unsigned i = 0;
i < nseg-1; ++
i)
680 for(
unsigned j =
i+1;
j < nseg; ++
j)
683 if(segments[
i]->geographicalId().rawId() != segments[
j]->geographicalId().rawId()
685 && fabs(pg1.
eta()-pg2.
eta()) < detaCut)
688 theDumper.
dumpMuonId(segments[
j]->geographicalId());
693 me1aOverlaps.push_back(i);
694 me1aOverlaps.push_back(j);
700 if(toKill.empty())
return;
703 for(
unsigned i = 0;
i < me1aOverlaps.size(); ++
i)
705 DetId detId(segments[me1aOverlaps[
i]]->geographicalId());
706 vector<unsigned> inSameChamber;
707 for(
unsigned j = 0;
j < nseg; ++
j)
709 if(
i !=
j && segments[
j]->geographicalId() == detId)
711 inSameChamber.push_back(
j);
714 if(inSameChamber.size() == 2)
716 toKill.push_back(inSameChamber[0]);
717 toKill.push_back(inSameChamber[1]);
722 for(
unsigned i = 0;
i < nseg; ++
i)
724 if(
std::find(toKill.begin(), toKill.end(),
i) == toKill.end())
726 result.push_back(segments[
i]);
730 segments.swap(result);
736 return segment->isCSC() &&
CSCDetId(segment->geographicalId()).
ring() == 4;
742 vector<TrackingRecHit*>
components = (*segment).recHits();
743 for(vector<TrackingRecHit*>::const_iterator component = components.begin();
744 component != components.end(); ++component)
746 int componentSize = (**component).recHits().size();
747 count += (componentSize == 0) ? 1 : componentSize;
MuonRecHitPointer bestMatch(const ConstMuonRecHitPointer &first, MuonRecHitContainer &good_rhit) const
const std::string metname
void filterOverlappingChambers(MuonRecHitContainer &segments) const
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)
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)
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)
MuonSeedOrcaPatternRecognition(const edm::ParameterSet &pset)
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
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
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