49 sigmaResAngle_ = pset.
getParameter<
double>(
"sigmaResAngle");
69 event.getByToken(simHitToken_, simHits);
72 map<DTChamberId, PSimHitContainer > simHitsPerCh;
73 for (
const auto &
simHit : *simHits) {
77 simHitsPerCh[chamberId].push_back(
simHit);
82 event.getByToken(segment4DToken_, segment4Ds);
86 cout <<
"[DTSegment2DSLPhiQuality]**Warning: no 4D Segments with label: " << segment4DLabel_
87 <<
" in this event, skipping!" << endl;
93 DTRecSegment4DCollection::id_iterator chamberId;
94 for (chamberId = segment4Ds->id_begin();
95 chamberId != segment4Ds->id_end();
105 int nMuSimHit = muSimHitPerWire.size();
106 if (nMuSimHit == 0 || nMuSimHit == 1) {
107 if (debug_ && nMuSimHit == 1) {
108 cout <<
"[DTSegment2DSLPhiQuality] Only " << nMuSimHit <<
" mu SimHit in this chamber, skipping!" << endl;
113 cout <<
"=== Chamber " << (*chamberId) <<
" has " << nMuSimHit <<
" SimHits" << endl;
121 (*chamberId),&(*dtGeom));
123 LocalVector simSegmLocalDir = dirAndPosSimSegm.first;
124 LocalPoint simSegmLocalPos = dirAndPosSimSegm.second;
130 float posSimSeg = simSegmLocalPos.
x();
132 float etaSimSeg = simSegmGlobalPos.
eta();
133 float phiSimSeg = simSegmGlobalPos.
phi();
136 cout <<
" Simulated segment: local direction " << simSegmLocalDir << endl
137 <<
" local position " << simSegmLocalPos << endl
138 <<
" angle " << angleSimSeg << endl;
143 bool recHitFound =
false;
145 int nsegm =
distance(range.first, range.second);
147 cout <<
" Chamber: " << *chamberId <<
" has " << nsegm
148 <<
" 4D segments" << endl;
158 bool bestRecHitFound =
false;
159 double deltaAlpha = 99999;
163 segment4D!= range.second;
166 if ((*segment4D).dimension() != 4) {
167 if (debug_) {
cout <<
"[DTSegment2DSLPhiQuality]***Error: This is not 4D segment!!!" << endl;
174 if ((*phiSegment2D).dimension() != 2) {
175 if (debug_) {
cout <<
"[DTSegment2DQuality]***Error: This is not 2D segment!!!" << endl;
181 LocalVector recSegDirection = (*phiSegment2D).localDirection();
185 cout <<
" RecSegment direction: " << recSegDirection << endl
186 <<
" position : " << (*phiSegment2D).localPosition() << endl
187 <<
" alpha : " << recSegAlpha << endl;
190 if (fabs(recSegAlpha - angleSimSeg) < deltaAlpha) {
191 deltaAlpha = fabs(recSegAlpha - angleSimSeg);
192 bestRecHit = &(*phiSegment2D);
193 bestRecHitFound =
true;
197 if (bestRecHitFound) {
206 if (fabs(angleBestRHit - angleSimSeg) < 5*sigmaResAngle_ &&
207 fabs(bestRecHitLocalPos.
x() - posSimSeg) < 5*sigmaResPos_) {
215 bestRecHitLocalPos.
x(),
218 sqrt(bestRecHitLocalPosErr.
xx()),
219 sqrt(bestRecHitLocalDirErr.
xx())
LocalError localPositionError() const override
local position error in SL frame
T getParameter(std::string const &) const
DTSegment2DSLPhiQuality(const edm::ParameterSet &pset)
Constructor.
void fill(float angleSimSegment, float angleRecSegment, float posSimSegment, float posRecSegment, float etaSimSegment, float phiSimSegment, float sigmaPos, float sigmaAngle)
T getUntrackedParameter(std::string const &, T const &) const
std::pair< const_iterator, const_iterator > range
iterator range
void dqmAnalyze(edm::Event const &, edm::EventSetup const &, Histograms const &) const override
Perform the real analysis.
const DTChamber * chamber(const DTChamberId &id) const
Return a DTChamber given its id.
#define DEFINE_FWK_MODULE(type)
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
void fill(float etaSimSegm, float phiSimSegm, float posSimSegm, float angleSimSegm, bool fillRecHit)
Geom::Phi< T > phi() const
def setup(process, global_tag, zero_tesla=False)
static std::map< DTWireId, const PSimHit * > mapMuSimHitsPerWire(const std::map< DTWireId, edm::PSimHitContainer > &simHitWireMap)
Create a map between the Mu SimHits and corresponding MuBarWireId ;.
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) ...
static std::pair< double, double > findSegmentAlphaAndBeta(const LocalVector &direction)
void bookHistograms(DQMStore::ConcurrentBooker &, edm::Run const &, edm::EventSetup const &, Histograms &) const override
Book the DQM plots.
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...
LocalPoint localPosition() const override
local position in SL frame
HEff2DHit * h2DHitEff_SuperPhi
LocalVector localDirection() const override
the local direction in SL frame
std::vector< PSimHit > PSimHitContainer
static std::map< DTWireId, edm::PSimHitContainer > mapSimHitsPerWire(const edm::PSimHitContainer &simhits)
LocalError localDirectionError() const override
the local direction error (xx,xy,yy) in SL frame: only xx is not 0.
HRes2DHit * h2DHitSuperPhi