24 map<DTWireId, PSimHitContainer> hitWireMapResult;
26 for (PSimHitContainer::const_iterator simhit =
simhits.begin(); simhit !=
simhits.end(); simhit++) {
30 return hitWireMapResult;
35 const map<DTWireId, PSimHitContainer> &simHitWireMap) {
36 map<DTWireId, const PSimHit *>
ret;
38 for (map<DTWireId, PSimHitContainer>::const_iterator wireAndSimHit = simHitWireMap.begin();
39 wireAndSimHit != simHitWireMap.end();
42 if (muHit !=
nullptr) {
43 ret[(*wireAndSimHit).first] = (muHit);
53 vector<const PSimHit *> muHits;
56 for (PSimHitContainer::const_iterator
hit =
hits.begin();
hit !=
hits.end();
hit++) {
57 if (
abs((*hit).particleType()) == 13)
58 muHits.push_back(&(*
hit));
63 else if (muHits.size() > 1)
65 cout <<
"[DTHitQualityUtils]***WARNING: # muSimHits in a wire = " << muHits.size() << endl;
67 return (muHits.front());
73 const map<DTWireId, const PSimHit *> &mapWireAndMuSimHit) {
78 const PSimHit *inSimHit =
nullptr;
79 const PSimHit *outSimHit =
nullptr;
81 for (map<DTWireId, const PSimHit *>::const_iterator wireAndMuSimHit = mapWireAndMuSimHit.begin();
82 wireAndMuSimHit != mapWireAndMuSimHit.end();
84 const DTWireId wireId = (*wireAndMuSimHit).first;
85 const PSimHit *theMuHit = (*wireAndMuSimHit).second;
91 if (layer > outLayer) {
102 if (layer < inLayer) {
114 if (inSimHit !=
nullptr) {
116 cout <<
"Innermost SimHit on SL: " << inSL <<
" layer: " << inLayer << endl;
118 cout <<
"[DTHitQualityUtils]***Error: No Innermost SimHit found!!!" << endl;
122 if (outSimHit !=
nullptr) {
124 cout <<
"Outermost SimHit on SL: " << outSL <<
" layer: " << outLayer << endl;
126 cout <<
"[DTHitQualityUtils]***Error: No Outermost SimHit found!!!" << endl;
135 return make_pair(inSimHit, outSimHit);
142 const pair<const PSimHit *, const PSimHit *> &inAndOutSimHit,
const DetId detId,
const DTGeometry &muonGeom) {
145 const PSimHit *innermostMuSimHit = inAndOutSimHit.first;
146 const PSimHit *outermostMuSimHit = inAndOutSimHit.second;
154 simHitDirection = -simHitDirection.
unit();
159 outLocalPos + simHitDirection * (-outLocalPos.
z() / (simHitDirection.
mag() *
cos(simHitDirection.
theta())));
161 return make_pair(simHitDirection, simSegLocalPosition);
169 return make_pair(atan(direction.
x() / direction.
z()), atan(direction.
y() / direction.
z()));
175 double XdivZ =
tan(Angle);
176 double sigma2Angle = 1 / (1 + XdivZ * XdivZ);
177 sigma2Angle *= sigma2Angle * sigma2TanAngle;
std::pair< double, double > findSegmentAlphaAndBeta(const LocalVector &direction)
std::map< DTWireId, edm::PSimHitContainer > mapSimHitsPerWire(const edm::PSimHitContainer &simhits)
unsigned int detUnitId() const
ret
prodAgent to be discontinued
std::pair< LocalVector, LocalPoint > findMuSimSegmentDirAndPos(const std::pair< const PSimHit *, const PSimHit *> &inAndOutSimHit, const DetId detId, const DTGeometry &muonGeom)
std::atomic< bool > debug
std::map< DTWireId, const PSimHit * > mapMuSimHitsPerWire(const std::map< DTWireId, edm::PSimHitContainer > &simHitWireMap)
Create a map between the Mu SimHits and corresponding MuBarWireId ;.
const GeomDet * idToDet(DetId) const override
Cos< T >::type cos(const T &t)
Tan< T >::type tan(const T &t)
Abs< T >::type abs(const T &t)
const PSimHit * findMuSimHit(const edm::PSimHitContainer &hits)
Select the SimHit from a muon in a vector of SimHits.
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
LocalVector toLocal(const reco::Track::Vector &v, const Surface &s)
Local3DPoint localPosition() const
std::pair< const PSimHit *, const PSimHit * > findMuSimSegment(const std::map< DTWireId, const PSimHit *> &mapWireAndMuSimHit)
deadvectors [0] push_back({0.0175431, 0.538005, 6.80997, 13.29})
std::vector< PSimHit > PSimHitContainer
Vector3DBase unit() const
DTLayerId layerId() const
Return the corresponding LayerId.
double sigmaAngle(double Angle, double sigma2TanAngle)
Geom::Theta< T > theta() const
const DTLayer * layer(const DTLayerId &id) const
Return a layer given its id.