39 debug_ =
pset.getUntrackedParameter<
bool>(
"debug");
53 doall_ =
pset.getUntrackedParameter<
bool>(
"doall",
false);
54 local_ =
pset.getUntrackedParameter<
bool>(
"local",
false);
64 histograms.h2DHitEff_SuperPhi = std::make_unique<HEff2DHit>(
"SuperPhi", booker);
80 map<DTChamberId, PSimHitContainer> simHitsPerCh;
85 simHitsPerCh[chamberId].push_back(
simHit);
94 cout <<
"[DTSegment2DSLPhiQuality]**Warning: no 4D Segments with label: " <<
segment4DLabel_ 95 <<
" in this event, skipping!" << endl;
102 for (chamberId = segment4Ds->id_begin(); chamberId != segment4Ds->id_end(); ++chamberId) {
110 int nMuSimHit = muSimHitPerWire.size();
111 if (nMuSimHit == 0 || nMuSimHit == 1) {
112 if (
debug_ && nMuSimHit == 1) {
113 cout <<
"[DTSegment2DSLPhiQuality] Only " << nMuSimHit <<
" mu SimHit in this chamber, skipping!" << endl;
118 cout <<
"=== Chamber " << (*chamberId) <<
" has " << nMuSimHit <<
" SimHits" << endl;
125 pair<LocalVector, LocalPoint> dirAndPosSimSegm =
128 LocalVector simSegmLocalDir = dirAndPosSimSegm.first;
129 LocalPoint simSegmLocalPos = dirAndPosSimSegm.second;
135 float posSimSeg = simSegmLocalPos.
x();
137 float etaSimSeg = simSegmGlobalPos.
eta();
138 float phiSimSeg = simSegmGlobalPos.
phi();
141 cout <<
" Simulated segment: local direction " << simSegmLocalDir << endl
142 <<
" local position " << simSegmLocalPos << endl
143 <<
" angle " << angleSimSeg << endl;
148 bool recHitFound =
false;
152 cout <<
" Chamber: " << *chamberId <<
" has " << nsegm <<
" 4D segments" << endl;
162 bool bestRecHitFound =
false;
163 double deltaAlpha = 99999;
168 if ((*segment4D).dimension() != 4) {
170 cout <<
"[DTSegment2DSLPhiQuality]***Error: This is not 4D " 179 if ((*phiSegment2D).dimension() != 2) {
181 cout <<
"[DTSegment2DQuality]***Error: This is not 2D segment!!!" << endl;
187 LocalVector recSegDirection = (*phiSegment2D).localDirection();
191 cout <<
" RecSegment direction: " << recSegDirection << endl
192 <<
" position : " << (*phiSegment2D).localPosition() << endl
193 <<
" alpha : " << recSegAlpha << endl;
196 if (fabs(recSegAlpha - angleSimSeg) < deltaAlpha) {
197 deltaAlpha = fabs(recSegAlpha - angleSimSeg);
198 bestRecHit = &(*phiSegment2D);
199 bestRecHitFound =
true;
203 if (bestRecHitFound) {
213 fabs(bestRecHitLocalPos.
x() - posSimSeg) < 5 *
sigmaResPos_) {
221 bestRecHitLocalPos.
x(),
224 sqrt(bestRecHitLocalPosErr.
xx()),
225 sqrt(bestRecHitLocalDirErr.
xx()));
231 histograms.h2DHitEff_SuperPhi->fill(etaSimSeg, phiSimSeg, posSimSeg, angleSimSeg, recHitFound);
edm::EDGetTokenT< edm::PSimHitContainer > simHitToken_
std::pair< double, double > findSegmentAlphaAndBeta(const LocalVector &direction)
DTSegment2DSLPhiQuality(const edm::ParameterSet &pset)
Constructor.
std::map< DTWireId, edm::PSimHitContainer > mapSimHitsPerWire(const edm::PSimHitContainer &simhits)
edm::ESGetToken< DTGeometry, MuonGeometryRecord > muonGeomToken_
std::pair< const_iterator, const_iterator > range
iterator range
LocalPoint localPosition() const override
local position in SL frame
LocalVector localDirection() const override
the local direction in SL frame
void dqmAnalyze(edm::Event const &, edm::EventSetup const &, dtsegment2dsl::Histograms const &) const override
Perform the real analysis.
#define DEFINE_FWK_MODULE(type)
std::unique_ptr< HEff2DHit > h2DHitEff_SuperPhi
Geom::Phi< T > phi() const
std::pair< LocalVector, LocalPoint > findMuSimSegmentDirAndPos(const std::pair< const PSimHit *, const PSimHit *> &inAndOutSimHit, const DetId detId, const DTGeometry &muonGeom)
edm::InputTag simHitLabel_
std::atomic< bool > debug
C::const_iterator const_iterator
constant access iterator type
edm::EDGetTokenT< DTRecSegment4DCollection > segment4DToken_
LocalError localDirectionError() const override
the local direction error (xx,xy,yy) in SL frame: only xx is not 0.
std::map< DTWireId, const PSimHit * > mapMuSimHitsPerWire(const std::map< DTWireId, edm::PSimHitContainer > &simHitWireMap)
Create a map between the Mu SimHits and corresponding MuBarWireId ;.
LocalError localPositionError() const override
local position error in SL frame
std::unique_ptr< HRes2DHit > h2DHitSuperPhi
edm::InputTag segment4DLabel_
std::pair< const PSimHit *, const PSimHit * > findMuSimSegment(const std::map< DTWireId, const PSimHit *> &mapWireAndMuSimHit)
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &, dtsegment2dsl::Histograms &) const override
Book the DQM plots.
std::vector< PSimHit > PSimHitContainer
const DTChamber * chamber(const DTChamberId &id) const
Return a DTChamber given its id.