53 sigmaResAngle_ = pset.
getParameter<
double>(
"sigmaResAngle");
60 histograms.
h2DHitSuperPhi = std::make_unique<HRes2DHit> (
"SuperPhi", booker, doall_, local_);
61 if (doall_) { histograms.
h2DHitEff_SuperPhi = std::make_unique<HEff2DHit> (
"SuperPhi", booker);
73 event.getByToken(simHitToken_, simHits);
76 map<DTChamberId, PSimHitContainer > simHitsPerCh;
77 for (
const auto &
simHit : *simHits) {
81 simHitsPerCh[chamberId].push_back(
simHit);
86 event.getByToken(segment4DToken_, segment4Ds);
90 cout <<
"[DTSegment2DSLPhiQuality]**Warning: no 4D Segments with label: " << segment4DLabel_
91 <<
" in this event, skipping!" << endl;
97 DTRecSegment4DCollection::id_iterator chamberId;
98 for (chamberId = segment4Ds->id_begin();
99 chamberId != segment4Ds->id_end();
109 int nMuSimHit = muSimHitPerWire.size();
110 if (nMuSimHit == 0 || nMuSimHit == 1) {
111 if (debug_ && nMuSimHit == 1) {
112 cout <<
"[DTSegment2DSLPhiQuality] Only " << nMuSimHit <<
" mu SimHit in this chamber, skipping!" << endl;
117 cout <<
"=== Chamber " << (*chamberId) <<
" has " << nMuSimHit <<
" SimHits" << endl;
125 (*chamberId),&(*dtGeom));
127 LocalVector simSegmLocalDir = dirAndPosSimSegm.first;
128 LocalPoint simSegmLocalPos = dirAndPosSimSegm.second;
134 float posSimSeg = simSegmLocalPos.
x();
136 float etaSimSeg = simSegmGlobalPos.
eta();
137 float phiSimSeg = simSegmGlobalPos.
phi();
140 cout <<
" Simulated segment: local direction " << simSegmLocalDir << endl
141 <<
" local position " << simSegmLocalPos << endl
142 <<
" angle " << angleSimSeg << endl;
147 bool recHitFound =
false;
149 int nsegm =
distance(range.first, range.second);
151 cout <<
" Chamber: " << *chamberId <<
" has " << nsegm
152 <<
" 4D segments" << endl;
162 bool bestRecHitFound =
false;
163 double deltaAlpha = 99999;
167 segment4D!= range.second;
170 if ((*segment4D).dimension() != 4) {
171 if (debug_) {
cout <<
"[DTSegment2DSLPhiQuality]***Error: This is not 4D segment!!!" << endl;
178 if ((*phiSegment2D).dimension() != 2) {
179 if (debug_) {
cout <<
"[DTSegment2DQuality]***Error: This is not 2D segment!!!" << endl;
185 LocalVector recSegDirection = (*phiSegment2D).localDirection();
189 cout <<
" RecSegment direction: " << recSegDirection << endl
190 <<
" position : " << (*phiSegment2D).localPosition() << endl
191 <<
" alpha : " << recSegAlpha << endl;
194 if (fabs(recSegAlpha - angleSimSeg) < deltaAlpha) {
195 deltaAlpha = fabs(recSegAlpha - angleSimSeg);
196 bestRecHit = &(*phiSegment2D);
197 bestRecHitFound =
true;
201 if (bestRecHitFound) {
210 if (fabs(angleBestRHit - angleSimSeg) < 5*sigmaResAngle_ &&
211 fabs(bestRecHitLocalPos.
x() - posSimSeg) < 5*sigmaResPos_) {
219 bestRecHitLocalPos.
x(),
222 sqrt(bestRecHitLocalPosErr.
xx()),
223 sqrt(bestRecHitLocalDirErr.
xx())
std::pair< double, double > findSegmentAlphaAndBeta(const LocalVector &direction)
LocalError localPositionError() const override
local position error in SL frame
T getParameter(std::string const &) const
DTSegment2DSLPhiQuality(const edm::ParameterSet &pset)
Constructor.
void dqmAnalyze(edm::Event const &, edm::EventSetup const &, dtsegment2dsl::Histograms const &) const override
Perform the real analysis.
T getUntrackedParameter(std::string const &, T const &) const
std::pair< const_iterator, const_iterator > range
iterator range
const DTChamber * chamber(const DTChamberId &id) const
Return a DTChamber given its id.
std::map< DTWireId, const PSimHit * > mapMuSimHitsPerWire(const std::map< DTWireId, edm::PSimHitContainer > &simHitWireMap)
Create a map between the Mu SimHits and corresponding MuBarWireId ;.
#define DEFINE_FWK_MODULE(type)
std::unique_ptr< HEff2DHit > h2DHitEff_SuperPhi
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Geom::Phi< T > phi() const
def setup(process, global_tag, zero_tesla=False)
std::atomic< bool > debug
std::map< DTWireId, edm::PSimHitContainer > mapSimHitsPerWire(const edm::PSimHitContainer &simhits)
std::unique_ptr< HRes2DHit > h2DHitSuperPhi
LocalPoint localPosition() const override
local position in SL frame
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...
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) ...
LocalVector localDirection() const override
the local direction in SL frame
void bookHistograms(DQMStore::ConcurrentBooker &, edm::Run const &, edm::EventSetup const &, dtsegment2dsl::Histograms &) const override
Book the DQM plots.
std::vector< PSimHit > PSimHitContainer
LocalError localDirectionError() const override
the local direction error (xx,xy,yy) in SL frame: only xx is not 0.