72 theDTRecHitLabel(par.getParameter<
InputTag>(
"DTRecSegmentLabel")),
73 theCSCRecHitLabel(par.getParameter<
InputTag>(
"CSCRecSegmentLabel")),
74 theCSCSegmentsLabel(par.getParameter<
InputTag>(
"CSCSegmentLabel")),
75 theDT4DRecSegmentLabel(par.getParameter<
InputTag>(
"DT4DRecSegmentLabel"))
87 category_ =
"MuonShowerInformationFiller";
89 for (
int istat = 0; istat < 4; istat++) {
143 for (
int istat = 0; istat < 4; istat++) {
191 for (chamberIdIt = dtSegments->id_begin();
192 chamberIdIt != dtSegments->id_end();
195 if (*chamberIdIt != chamberId)
continue;
201 iseg!=range.second;++iseg) {
202 if (iseg->dimension() != 4)
continue;
212 chamberId != cscSegments->id_end(); ++chamberId) {
214 if ((*chamberId).chamber() != did.chamber())
continue;
220 iseg!=range.second;++iseg) {
221 if (iseg->dimension() != 3)
continue;
232 if (segments.empty())
return allhitscorrelated;
237 if (segments.size() == 1)
return allhitscorrelated;
239 for (MuonTransientTrackingRecHit::MuonRecHitContainer::const_iterator iseg = segments.begin() + 1;
240 iseg != segments.end(); ++iseg) {
245 for (TransientTrackingRecHit::ConstRecHitContainer::const_iterator ihit1 = hits1.begin();
246 ihit1 != hits1.end(); ++ihit1 ) {
248 bool usedbefore =
false;
251 GlobalPoint gp1dinsegHit = (*ihit1)->globalPosition();
253 for (TransientTrackingRecHit::ConstRecHitContainer::const_iterator ihit2 = allhitscorrelated.begin();
254 ihit2 != allhitscorrelated.end(); ++ihit2 ) {
258 GlobalPoint gp1dinsegHit2 = (*ihit2)->globalPosition();
260 if ( (gp1dinsegHit2 - gp1dinsegHit).
mag() < 1.0 ) usedbefore =
true;
263 if ( !usedbefore ) allhitscorrelated.push_back(*ihit1);
267 return allhitscorrelated;
279 if ( muonRecHits.empty() )
return muonRecHits;
285 stable_sort(muonRecHits.begin(), muonRecHits.end(),
AbsLessDPhi(refpoint));
287 for (MuonTransientTrackingRecHit::MuonRecHitContainer::const_iterator ihit = muonRecHits.begin(); ihit != muonRecHits.end() - 1; ++ihit) {
288 if (fabs(
deltaPhi((*(ihit+1))->globalPosition().
phi(), (*ihit)->globalPosition().phi() )) <
step) {
289 result.push_back(*ihit);
295 LogTrace(
category_) <<
"phi front: " << muonRecHits.front()->globalPosition().phi() << endl;
296 LogTrace(
category_) <<
"phi back: " << muonRecHits.back()->globalPosition().phi() << endl;
309 if ( muonRecHits.empty() )
return muonRecHits;
315 stable_sort(muonRecHits.begin(), muonRecHits.end(),
AbsLessDTheta(refpoint));
317 for (TransientTrackingRecHit::ConstRecHitContainer::const_iterator ihit = muonRecHits.begin(); ihit != muonRecHits.end() - 1; ++ihit) {
318 if (fabs((*(ihit+1))->globalPosition().
theta() - (*ihit)->globalPosition().theta() ) < step) {
319 result.push_back(*ihit);
335 if ( muonRecHits.empty() )
return muonRecHits;
337 stable_sort(muonRecHits.begin(), muonRecHits.end(),
LessPerp());
339 MuonTransientTrackingRecHit::MuonRecHitContainer::const_iterator
340 seedhit = min_element(muonRecHits.begin(), muonRecHits.end(),
LessPerp());
342 MuonTransientTrackingRecHit::MuonRecHitContainer::const_iterator ihigh = seedhit;
343 MuonTransientTrackingRecHit::MuonRecHitContainer::const_iterator ilow = seedhit;
346 while (ihigh != muonRecHits.end()-1 && ( fabs((*(ihigh+1))->globalPosition().
perp() - (*ihigh)->globalPosition().perp() ) < step) ) {
349 while (ilow != muonRecHits.begin() && ( fabs((*ilow)->globalPosition().perp() - (*(ilow -1))->globalPosition().perp()) < step ) ) {
364 vector<const GeomDet*>
total;
367 LogTrace(
category_) <<
"Consider a track " << track.
p() <<
" eta: " << track.
eta() <<
" phi " << track.
phi() << endl;
376 vector<GlobalPoint> allCrossingPoints;
378 const vector<DetLayer*>& dtlayers =
theService->detLayerGeometry()->allDTLayers();
380 for (vector<DetLayer*>::const_iterator iLayer = dtlayers.begin(); iLayer != dtlayers.end(); ++iLayer) {
386 if ((fabs(xPoint.
y()) < 1000.0) && (fabs(xPoint.
z()) < 1500 ) &&
387 (!(xPoint.
y() == 0 && xPoint.
x() == 0 && xPoint.
z() == 0))) allCrossingPoints.push_back(xPoint);
390 stable_sort(allCrossingPoints.begin(), allCrossingPoints.end(),
LessMag(innerPos) );
392 vector<const GeomDet*> tempDT;
394 for (vector<GlobalPoint>::const_iterator ipos = allCrossingPoints.begin(); ipos != allCrossingPoints.end(); ++ipos) {
397 vector<const GeomDet*>::const_iterator
begin = tempDT.begin();
398 vector<const GeomDet*>::const_iterator
end = tempDT.end();
401 total.push_back(*begin);
405 allCrossingPoints.clear();
407 const vector<DetLayer*>& csclayers =
theService->detLayerGeometry()->allCSCLayers();
408 for (vector<DetLayer*>::const_iterator iLayer = csclayers.begin(); iLayer != csclayers.end(); ++iLayer) {
413 if ((fabs(xPoint.
y()) < 1000.0) && (fabs(xPoint.
z()) < 1500.0)
414 && (!(xPoint.
y() == 0 && xPoint.
x() == 0 && xPoint.
z() == 0))) allCrossingPoints.push_back(xPoint);
416 stable_sort(allCrossingPoints.begin(), allCrossingPoints.end(),
LessMag(innerPos) );
418 vector<const GeomDet*> tempCSC;
419 for (vector<GlobalPoint>::const_iterator ipos = allCrossingPoints.begin(); ipos != allCrossingPoints.end(); ++ipos) {
422 vector<const GeomDet*>::const_iterator
begin = tempCSC.begin();
423 vector<const GeomDet*>::const_iterator
end = tempCSC.end();
426 total.push_back(*begin);
456 float a = p1.
x() - slope * p1.
y();
458 float n2 = (1 + slope *
slope);
459 float n1 = 2*a*
slope;
464 if ( n1*n1 - 4*n2*n0 > 0 ) {
465 y1 = (-n1 +
sqrt(n1*n1 - 4*n2*n0) ) / (2 * n2);
466 y2 = (-n1 -
sqrt(n1*n1 - 4*n2*n0) ) / (2 * n2);
469 float x1 = p1.
x() + slope * (y1 - p1.
y());
470 float x2 = p1.
x() + slope * (y2 - p1.
y());
472 float slopeZ = dp.
z()/dp.
y();
474 float z1 = p1.
z() + slopeZ * (y1 - p1.
y());
475 float z2 = p1.
z() + slopeZ * (y2 - p1.
y());
478 if ((p2.x()*x1 > 0) && (y1*p2.y() > 0) && (z1*p2.z() > 0)) {
504 int endcap = diskZ > 0 ? 1 : (diskZ < 0 ? -1 : 0);
509 float slopeZ = dp.
z()/dp.
y();
510 float y1 = diskZ / slopeZ;
512 float slopeX = dp.
z()/dp.
x();
513 float x1 = diskZ / slopeX;
533 if ( gp.
z() < -680.0 ) { minwheel = -3; maxwheel = -3;}
534 else if ( gp.
z() < -396.0 ) { minwheel = -2; maxwheel = -1;}
535 else if (gp.
z() < -126.8) { minwheel = -2; maxwheel = 0; }
536 else if (gp.
z() < 126.8) { minwheel = -1; maxwheel = 1; }
537 else if (gp.
z() < 396.0) { minwheel = 0; maxwheel = 2; }
538 else if (gp.
z() < 680.0) { minwheel = 1; maxwheel = 2; }
539 else { minwheel = 3; maxwheel = 3; }
542 if ( gp.
perp() > 680.0 && gp.
perp() < 755.0 ) station = 4;
543 else if ( gp.
perp() > 580.0 ) station = 3;
544 else if ( gp.
perp() > 480.0 ) station = 2;
545 else if ( gp.
perp() > 380.0 ) station = 1;
550 float phistep =
M_PI/6;
552 float phigp = (float)gp.
phi();
554 if ( fabs(
deltaPhi(phigp, 0*phistep)) < phistep ) sectors.push_back(1);
555 if ( fabs(
deltaPhi(phigp, phistep)) < phistep ) sectors.push_back(2);
556 if ( fabs(
deltaPhi(phigp, 2*phistep)) < phistep ) sectors.push_back(3);
557 if ( fabs(
deltaPhi(phigp, 3*phistep)) < phistep ) {
558 sectors.push_back(4);
559 if (station == 4) sectors.push_back(13);
561 if ( fabs(
deltaPhi(phigp, 4*phistep)) < phistep ) sectors.push_back(5);
562 if ( fabs(
deltaPhi(phigp, 5*phistep)) < phistep ) sectors.push_back(6);
563 if ( fabs(
deltaPhi(phigp, 6*phistep)) < phistep ) sectors.push_back(7);
564 if ( fabs(
deltaPhi(phigp, 7*phistep)) < phistep ) sectors.push_back(8);
565 if ( fabs(
deltaPhi(phigp, 8*phistep)) < phistep ) sectors.push_back(9);
566 if ( fabs(
deltaPhi(phigp, 9*phistep)) < phistep ) {
567 sectors.push_back(10);
568 if (station == 4) sectors.push_back(14);
570 if ( fabs(
deltaPhi(phigp, 10*phistep)) < phistep ) sectors.push_back(11);
571 if ( fabs(
deltaPhi(phigp, 11*phistep)) < phistep ) sectors.push_back(12);
574 LogTrace(
category_) <<
"number of sectors to consider: " << sectors.size() << endl;
575 LogTrace(
category_) <<
"station: " << station <<
" wheels: " << minwheel <<
" " << maxwheel << endl;
577 vector<const GeomDet*>
result;
578 if (station > 4 || station < 1)
return result;
579 if (minwheel > 2 || maxwheel < -2)
return result;
581 for (vector<int>::const_iterator isector = sectors.begin(); isector != sectors.end(); ++isector ) {
582 for (
int iwheel = minwheel; iwheel != maxwheel + 1; ++iwheel) {
583 DTChamberId chamberid(iwheel, station, (*isector));
584 result.push_back(
theService->trackingGeometry()->idToDet(chamberid));
588 LogTrace(
category_) <<
"number of GeomDets for this track: " << result.size() << endl;
602 if (gp.
z() > 0) {endcap = 1;}
else {endcap = 2;}
608 if ( fabs(gp.
z()) > 1000. && fabs(gp.
z()) < 1055.0 ) {
611 else if ( fabs(gp.
z()) > 910.0 && fabs(gp.
z()) < 965.0) {
614 else if ( fabs(gp.
z()) > 800.0 && fabs(gp.
z()) < 860.0) {
617 else if ( fabs(gp.
z()) > 570.0 && fabs(gp.
z()) < 730.0) {
623 float phistep1 =
M_PI/18.;
624 float phistep2 =
M_PI/9.;
625 float phigp = (float)gp.
phi();
633 if (gp.
perp() > 100 && gp.
perp() < 270) ring = 1;
634 else if (gp.
perp() > 270 && gp.
perp() < 450) ring = 2;
635 else if (gp.
perp() > 450 && gp.
perp() < 695) ring = 3;
636 else if (gp.
perp() > 100 && gp.
perp() < 270) ring = 4;
639 else if (station == 2) {
641 if (gp.
perp() > 140 && gp.
perp() < 350) ring = 1;
642 else if (gp.
perp() > 350 && gp.
perp() < 700) ring = 2;
645 else if (station == 3) {
647 if (gp.
perp() > 160 && gp.
perp() < 350) ring = 1;
648 else if (gp.
perp() > 350 && gp.
perp() < 700) ring = 2;
651 else if (station == 4) {
653 if (gp.
perp() > 175 && gp.
perp() < 350) ring = 1;
654 else if (gp.
perp() > 350 && gp.
perp() < 700) ring = 2;
658 if (station > 1 && ring == 1) {
661 for (
int i = 0;
i < 18;
i++) {
662 if ( fabs(
deltaPhi(phigp,
i*phistep2)) < phistep2 ) sectors.push_back(
i+1);
668 for (
int i = 0;
i < 36;
i++) {
669 if ( fabs(
deltaPhi(phigp,
i*phistep1)) < phistep1 ) sectors.push_back(
i+1);
677 LogTrace(
category_) <<
"CSC number of sectors to consider: " << sectors.size() << endl;
681 vector<const GeomDet*>
result;
682 if (station > 4 || station < 1)
return result;
683 if (endcap == 0)
return result;
684 if (ring == -1)
return result;
689 for (vector<int>::const_iterator isector = sectors.begin(); isector != sectors.end(); ++isector) {
690 for (
int ilayer = minlayer; ilayer != maxlayer + 1; ++ ilayer) {
691 CSCDetId cscid(endcap, station, ring, (*isector), ilayer);
692 result.push_back(
theService->trackingGeometry()->idToDet(cscid));
711 vector<MuonRecHitContainer> muonRecHits(4);
714 vector<TransientTrackingRecHit::ConstRecHitContainer> muonCorrelatedHits(4);
721 bool dtOverlapToCheck =
false;
722 bool cscOverlapToCheck =
false;
724 for (vector<const GeomDet*>::const_iterator igd = compatibleLayers.begin(); igd != compatibleLayers.end(); igd++ ) {
727 DetId geoId = (*igd)->geographicalId();
738 int wheel =
detid.wheel();
742 TransientTrackingRecHit::ConstRecHitContainer::const_iterator hits_begin = muonCorrelatedHitsTmp.begin();
743 TransientTrackingRecHit::ConstRecHitContainer::const_iterator hits_end = muonCorrelatedHitsTmp.end();
745 for (; hits_begin!= hits_end;++hits_begin) {
746 muonCorrelatedHits.at(station-1).push_back(*hits_begin);
750 if (
abs(wheel) == 2 && station != 4 && station != 1) dtOverlapToCheck =
true;
759 vector<const TrackingRecHit*> subrechits = (*rechit).recHits();
760 for (vector<const TrackingRecHit*>::iterator irechit = subrechits.begin(); irechit != subrechits.end(); ++irechit) {
772 int ring = did.ring();
776 TransientTrackingRecHit::ConstRecHitContainer::const_iterator hits_begin = muonCorrelatedHitsTmp.begin();
777 TransientTrackingRecHit::ConstRecHitContainer::const_iterator hits_end = muonCorrelatedHitsTmp.end();
779 for (; hits_begin!= hits_end;++hits_begin) {
780 muonCorrelatedHits.at(station-1).push_back(*hits_begin);
783 if ((station == 1 && ring == 3) && dtOverlapToCheck) cscOverlapToCheck =
true;
789 if (!cscOverlapToCheck) {
796 if (temp.empty())
continue;
799 if (temp.size() > 1) {
800 center = (temp.front()->globalPosition().perp() + temp.back()->globalPosition().perp())/2.;
802 center = temp.front()->globalPosition().perp();
807 muonRecHits.at(2).insert(muonRecHits.at(2).end(),tmpCSC1.begin(),tmpCSC1.end());
809 muonRecHits.at(1).insert(muonRecHits.at(1).end(),tmpCSC1.begin(),tmpCSC1.end());
820 for (
int stat = 0; stat < 4; stat++) {
841 for (
int stat = 0; stat != 4; stat++ ) {
842 if (!muonRecHits[stat].
empty()) {
843 stable_sort(muonRecHits[stat].
begin(), muonRecHits[stat].
end(),
LessPhi());
846 for (MuonTransientTrackingRecHit::MuonRecHitContainer::const_iterator
iseed = muonRecHits[stat].
begin();
iseed != muonRecHits[stat].end(); ++
iseed) {
847 if (!(*iseed)->isValid())
continue;
849 muonRecHitsPhiTemp.clear();
851 if (muonRecHitsPhiTemp.size() > 1) {
852 float dphi = fabs(
deltaPhi((
float)muonRecHitsPhiTemp.back()->globalPosition().phi(), (float)muonRecHitsPhiTemp.front()->globalPosition().phi()));
853 if (dphi > dphimax) {
855 muonRecHitsPhiBest = muonRecHitsPhiTemp;
861 if (!muonRecHitsPhiBest.empty()) {
862 muonRecHits[stat] = muonRecHitsPhiBest;
864 muonRecHits[stat].front();
865 GlobalPoint refpoint = muonRecHits[stat].front()->globalPosition();
870 if (!muonCorrelatedHits.at(stat).empty()) {
873 for (TransientTrackingRecHit::ConstRecHitContainer::const_iterator
iseed = muonCorrelatedHits.at(stat).begin();
iseed != muonCorrelatedHits.at(stat).end(); ++
iseed) {
874 if (!(*iseed)->isValid())
continue;
876 muonRecHitsThetaTemp.clear();
877 muonRecHitsThetaTemp =
findThetaCluster(muonCorrelatedHits.at(stat), refpoint);
879 if (muonRecHitsThetaTemp.size() > 1) {
880 float dtheta = fabs((
float)muonRecHitsThetaTemp.back()->globalPosition().theta() - (float)muonRecHitsThetaTemp.front()->globalPosition().theta());
881 if (dtheta > dthetamax) {
883 muonRecHitsThetaBest = muonRecHitsThetaTemp;
889 if (muonRecHitsThetaBest.size() > 1 && muonRecHitsPhiBest.size() > 1)
890 theStationShowerDeltaR.at(stat) =
sqrt(
pow(muonRecHitsPhiBest.front()->globalPosition().phi()-muonRecHitsPhiBest.back()->globalPosition().phi(),2)+
pow(muonRecHitsThetaBest.front()->globalPosition().theta()-muonRecHitsThetaBest.back()->globalPosition().theta(),2));
895 LogTrace(
category_) <<
"deltaR around a track containing all the station hits, by station "
double p() const
momentum vector magnitude
T getParameter(std::string const &) const
std::pair< const_iterator, const_iterator > range
iterator range
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
static const double slope[3]
Geom::Phi< T > phi() const
Global3DPoint GlobalPoint
Geom::Theta< T > theta() const
bool isGlobalMuon() const
GlobalPoint globalPosition() const
double phi() const
azimuthal angle of momentum vector
std::vector< int > nStationHits
number of all the muon RecHits per chamber crossed by a track (1D hits)
bool isStandAloneMuon() const
uint32_t rawId() const
get the raw id
static TransientTrackingRecHit::ConstRecHitContainer breakInSubRecHits(TransientTrackingRecHit::ConstRecHitPointer, int granularity)
takes a muon rechit and returns its sub-rechits given a certain granularity
C::const_iterator const_iterator
constant access iterator type
std::vector< int > nStationCorrelatedHits
number of the muon RecHits used by segments per chamber crossed by a track
double eta() const
pseudorapidity of momentum vector
Scalar radius() const
Radius of the cylinder.
static const int maxLayerId
highest layer id
virtual const BoundDisk & specificSurface() const
static const int minLayerId
lowest layer id. 0 indicates a full SL
DetId geographicalId() const
The label of this GeomDet.
static const int maxSuperLayerId
highest superlayer id
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
int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
virtual TrackRef outerTrack() const
reference to Track reconstructed in the muon detector only
std::vector< ConstRecHitPointer > ConstRecHitContainer
const Bounds & bounds() const
virtual const BoundCylinder & specificSurface() const
Extension of the interface.
static const int minSuperLayerId
loweset super layer id. 0 indicates a full chamber
T perp() const
Magnitude of transverse component.
std::vector< float > stationShowerSizeT
the transverse size of the hit cluster
Detector det() const
get the detector field from this detid
const PositionType & position() const
static MuonRecHitPointer specificBuild(const GeomDet *geom, const TrackingRecHit *rh)
std::vector< MuonRecHitPointer > MuonRecHitContainer
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")
Power< A, B >::type pow(const A &a, const B &b)
virtual TrackRef globalTrack() const
reference to Track reconstructed in both tracked and muon detector
std::vector< float > stationShowerDeltaR
the radius of the cone containing the all the hits around the track