35 map<DTWireId, PSimHitContainer >
37 map<DTWireId, PSimHitContainer > hitWireMapResult;
39 for(PSimHitContainer::const_iterator simhit = simhits.begin();
40 simhit != simhits.end();
42 hitWireMapResult[
DTWireId((*simhit).detUnitId())].push_back(*simhit);
45 return hitWireMapResult;
49 map<DTWireId, const PSimHit*>
52 map<DTWireId, const PSimHit*>
ret;
54 for(map<DTWireId, PSimHitContainer>::const_iterator wireAndSimHit = simHitWireMap.begin();
55 wireAndSimHit != simHitWireMap.end();
58 const PSimHit* muHit = findMuSimHit((*wireAndSimHit).second);
60 ret[(*wireAndSimHit).first]=(muHit);
71 vector<const PSimHit*> muHits;
74 for (PSimHitContainer::const_iterator
hit=hits.begin();
75 hit != hits.end();
hit++) {
76 if (
abs((*hit).particleType())==13) muHits.push_back(&(*
hit));
81 else if (muHits.size()>1)
83 cout <<
"[DTHitQualityUtils]***WARNING: # muSimHits in a wire = " << muHits.size() << endl;
85 return (muHits.front());
90 pair<const PSimHit*, const PSimHit*>
100 for(map<DTWireId, const PSimHit*>::const_iterator wireAndMuSimHit = mapWireAndMuSimHit.begin();
101 wireAndMuSimHit != mapWireAndMuSimHit.end();
104 const DTWireId wireId = (*wireAndMuSimHit).first;
105 const PSimHit *theMuHit = (*wireAndMuSimHit).second;
107 int sl = ((wireId.
layerId()).superlayerId()).superLayer();
108 int layer = (wireId.
layerId()).layer();
111 if(layer > outLayer) {
113 outSimHit = theMuHit;
119 outSimHit = theMuHit;
122 if(layer < inLayer) {
136 cout <<
"Innermost SimHit on SL: " << inSL <<
" layer: " << inLayer << endl;
138 cout <<
"[DTHitQualityUtils]***Error: No Innermost SimHit found!!!" << endl;
144 cout <<
"Outermost SimHit on SL: " << outSL <<
" layer: " << outLayer << endl;
146 cout <<
"[DTHitQualityUtils]***Error: No Outermost SimHit found!!!" << endl;
155 return make_pair(inSimHit, outSimHit);
162 pair<LocalVector, LocalPoint>
167 const PSimHit* innermostMuSimHit = inAndOutSimHit.first;
168 const PSimHit* outermostMuSimHit = inAndOutSimHit.second;
176 simHitDirection = -simHitDirection.
unit();
181 outLocalPos + simHitDirection*(-outLocalPos.
z()/(simHitDirection.
mag()*
cos(simHitDirection.
theta())));
183 return make_pair(simHitDirection, simSegLocalPosition);
193 return make_pair((direction.
x()/direction.
z()), (direction.
y()/direction.
z()));
virtual const GeomDet * idToDet(DetId) const
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
static const PSimHit * findMuSimHit(const edm::PSimHitContainer &hits)
Select the SimHit from a muon in a vector of SimHits.
LocalVector toLocal(const reco::Track::Vector &v, const Surface &s)
DTHitQualityUtils()
Constructor.
static std::map< DTWireId, const PSimHit * > mapMuSimHitsPerWire(const std::map< DTWireId, edm::PSimHitContainer > &simHitWireMap)
Create a map between the Mu SimHits and corresponding MuBarWireId ;.
Geom::Theta< T > theta() const
static std::pair< const PSimHit *, const PSimHit * > findMuSimSegment(const std::map< DTWireId, const PSimHit * > &mapWireAndMuSimHit)
Find Innermost and outermost SimHit from Mu in a SL (they identify a simulated segment) ...
const DTLayer * layer(DTLayerId id) const
Return a layer given its id.
Local3DPoint localPosition() const
Cos< T >::type cos(const T &t)
static std::pair< double, double > findSegmentAlphaAndBeta(const LocalVector &direction)
Find the angles from a segment direction:
Vector3DBase unit() const
static std::pair< LocalVector, LocalPoint > findMuSimSegmentDirAndPos(const std::pair< const PSimHit *, const PSimHit * > &inAndOutSimHit, const DetId detId, const DTGeometry *muonGeom)
Find direction and position of a segment (in local RF) from outer and inner mu SimHit in the RF of ob...
DTLayerId layerId() const
Return the corresponding LayerId.
virtual ~DTHitQualityUtils()
Destructor.
std::vector< PSimHit > PSimHitContainer
static std::map< DTWireId, edm::PSimHitContainer > mapSimHitsPerWire(const edm::PSimHitContainer &simhits)
unsigned int detUnitId() const