33 map<DTWireId, PSimHitContainer >
35 map<DTWireId, PSimHitContainer > hitWireMapResult;
37 for(PSimHitContainer::const_iterator simhit = simhits.begin();
38 simhit != simhits.end();
40 hitWireMapResult[
DTWireId((*simhit).detUnitId())].push_back(*simhit);
43 return hitWireMapResult;
47 map<DTWireId, const PSimHit*>
50 map<DTWireId, const PSimHit*> ret;
52 for(map<DTWireId, PSimHitContainer>::const_iterator wireAndSimHit = simHitWireMap.begin();
53 wireAndSimHit != simHitWireMap.end();
56 const PSimHit* muHit = findMuSimHit((*wireAndSimHit).second);
58 ret[(*wireAndSimHit).first]=(muHit);
69 vector<const PSimHit*> muHits;
72 for (PSimHitContainer::const_iterator
hit=hits.begin();
73 hit != hits.end();
hit++) {
74 if (
abs((*hit).particleType())==13) muHits.push_back(&(*
hit));
79 else if (muHits.size()>1)
81 cout <<
"[DTHitQualityUtils]***WARNING: # muSimHits in a wire = " << muHits.size() << endl;
83 return (muHits.front());
88 pair<const PSimHit*, const PSimHit*>
98 for(map<DTWireId, const PSimHit*>::const_iterator wireAndMuSimHit = mapWireAndMuSimHit.begin();
99 wireAndMuSimHit != mapWireAndMuSimHit.end();
102 const DTWireId wireId = (*wireAndMuSimHit).first;
103 const PSimHit *theMuHit = (*wireAndMuSimHit).second;
105 int sl = ((wireId.
layerId()).superlayerId()).superLayer();
106 int layer = (wireId.
layerId()).layer();
109 if(layer > outLayer) {
111 outSimHit = theMuHit;
117 outSimHit = theMuHit;
120 if(layer < inLayer) {
134 cout <<
"Innermost SimHit on SL: " << inSL <<
" layer: " << inLayer << endl;
136 cout <<
"[DTHitQualityUtils]***Error: No Innermost SimHit found!!!" << endl;
142 cout <<
"Outermost SimHit on SL: " << outSL <<
" layer: " << outLayer << endl;
144 cout <<
"[DTHitQualityUtils]***Error: No Outermost SimHit found!!!" << endl;
153 return make_pair(inSimHit, outSimHit);
160 pair<LocalVector, LocalPoint>
165 const PSimHit* innermostMuSimHit = inAndOutSimHit.first;
166 const PSimHit* outermostMuSimHit = inAndOutSimHit.second;
174 simHitDirection = -simHitDirection.
unit();
179 outLocalPos + simHitDirection*(-outLocalPos.
z()/(simHitDirection.
mag()*
cos(simHitDirection.
theta())));
181 return make_pair(simHitDirection, simSegLocalPosition);
188 return make_pair(atan(direction.
x()/direction.
z()), atan(direction.
y()/direction.
z()));
194 double XdivZ =
tan(Angle);
195 double sigma2Angle = 1/(1+XdivZ*XdivZ);
196 sigma2Angle *= sigma2Angle*sigma2TanAngle;
static double sigmaAngle(double Angle, double sigma2TanAngle)
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) ...
Local3DPoint localPosition() const
Cos< T >::type cos(const T &t)
Tan< T >::type tan(const T &t)
Abs< T >::type abs(const T &t)
static std::pair< double, double > findSegmentAlphaAndBeta(const LocalVector &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.
const GeomDet * idToDet(DetId) const override
virtual ~DTHitQualityUtils()
Destructor.
std::vector< PSimHit > PSimHitContainer
const DTLayer * layer(const DTLayerId &id) const
Return a layer given its id.
static std::map< DTWireId, edm::PSimHitContainer > mapSimHitsPerWire(const edm::PSimHitContainer &simhits)
unsigned int detUnitId() const