48 debug_ =
pset.getUntrackedParameter<
bool>(
"debug");
63 cout <<
"[DTSegment2DQuality] Constructor called " << endl;
71 histograms.h2DHitRPhi = std::make_unique<HRes2DHit>(
"RPhi", booker,
true,
true);
72 histograms.h2DHitRZ = std::make_unique<HRes2DHit>(
"RZ", booker,
true,
true);
73 histograms.h2DHitRZ_W0 = std::make_unique<HRes2DHit>(
"RZ_W0", booker,
true,
true);
74 histograms.h2DHitRZ_W1 = std::make_unique<HRes2DHit>(
"RZ_W1", booker,
true,
true);
75 histograms.h2DHitRZ_W2 = std::make_unique<HRes2DHit>(
"RZ_W2", booker,
true,
true);
77 histograms.h2DHitEff_RPhi = std::make_unique<HEff2DHit>(
"RPhi", booker);
78 histograms.h2DHitEff_RZ = std::make_unique<HEff2DHit>(
"RZ", booker);
79 histograms.h2DHitEff_RZ_W0 = std::make_unique<HEff2DHit>(
"RZ_W0", booker);
80 histograms.h2DHitEff_RZ_W1 = std::make_unique<HEff2DHit>(
"RZ_W1", booker);
81 histograms.h2DHitEff_RZ_W2 = std::make_unique<HEff2DHit>(
"RZ_W2", booker);
83 cout <<
"[DTSegment2DQuality] hitsos created " << endl;
99 map<DTSuperLayerId, PSimHitContainer> simHitsPerSl;
104 simHitsPerSl[slId].push_back(
simHit);
111 if (not segment2Ds.
isValid()) {
114 <<
" in this event, skipping !" << endl;
121 for (slId = segment2Ds->id_begin(); slId != segment2Ds->id_end(); ++slId) {
129 int nMuSimHit = muSimHitPerWire.size();
130 if (nMuSimHit == 0
or nMuSimHit == 1) {
131 if (
debug_ and nMuSimHit == 1) {
132 cout <<
"[DTSegment2DQuality] Only " << nMuSimHit <<
" mu SimHit in this SL, skipping !" << endl;
137 cout <<
"=== SL " << (*slId) <<
" has " << nMuSimHit <<
" SimHits" << endl;
143 if (inAndOutSimHit.first == inAndOutSimHit.second) {
144 cout <<
"[DTHitQualityUtils]***Warning: outermost and innermost SimHit " 151 pair<LocalVector, LocalPoint> dirAndPosSimSegm =
154 LocalVector simSegmLocalDir = dirAndPosSimSegm.first;
155 LocalPoint simSegmLocalPos = dirAndPosSimSegm.second;
157 cout <<
" Simulated segment: local direction " << simSegmLocalDir << endl
158 <<
" local position " << simSegmLocalPos << endl;
165 float posSimSeg = simSegmLocalPos.
x();
167 float etaSimSeg = simSegmGlobalPos.
eta();
168 float phiSimSeg = simSegmGlobalPos.
phi();
172 bool recHitFound =
false;
176 cout <<
" Sl: " << *slId <<
" has " << nsegm <<
" 2D segments" << endl;
186 bool bestRecHitFound =
false;
187 double deltaAlpha = 99999;
192 if ((*segment2D).dimension() != 2) {
194 cout <<
"[DTSegment2DQuality]***Error: This is not 2D segment !!!" << endl;
199 LocalVector recSegDirection = (*segment2D).localDirection();
200 LocalPoint recSegPosition = (*segment2D).localPosition();
204 cout <<
" RecSegment direction: " << recSegDirection << endl
205 <<
" position : " << recSegPosition << endl
206 <<
" alpha : " << recSegAlpha << endl;
209 if (fabs(recSegAlpha - angleSimSeg) < deltaAlpha) {
210 deltaAlpha = fabs(recSegAlpha - angleSimSeg);
211 bestRecHit = &(*segment2D);
212 bestRecHitFound =
true;
216 if (bestRecHitFound) {
227 fabs(bestRecHitLocalPos.
x() - posSimSeg) < 5 *
sigmaResPos_) {
233 if ((*slId).superlayer() == 1
or (*slId).superlayer() == 3) {
235 }
else if ((*slId).superlayer() == 2) {
239 bestRecHitLocalPos.
x(),
242 sqrt(bestRecHitLocalPosErr.
xx()),
243 sqrt(bestRecHitLocalDirErr.
xx()));
244 if (
abs((*slId).wheel()) == 0) {
246 }
else if (
abs((*slId).wheel()) == 1) {
248 }
else if (
abs((*slId).wheel()) == 2) {
252 hRes->fill(angleSimSeg,
255 bestRecHitLocalPos.
x(),
258 sqrt(bestRecHitLocalPosErr.
xx()),
259 sqrt(bestRecHitLocalDirErr.
xx()));
265 if ((*slId).superlayer() == 1
or (*slId).superlayer() == 3) {
267 }
else if ((*slId).superlayer() == 2) {
268 histograms.h2DHitEff_RZ->fill(etaSimSeg, phiSimSeg, posSimSeg, angleSimSeg, recHitFound);
269 if (
abs((*slId).wheel()) == 0) {
271 }
else if (
abs((*slId).wheel()) == 1) {
273 }
else if (
abs((*slId).wheel()) == 2) {
277 hEff->
fill(etaSimSeg, phiSimSeg, posSimSeg, angleSimSeg, recHitFound);
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &, dtsegment2d::Histograms &) const override
Book the DQM plots.
std::pair< double, double > findSegmentAlphaAndBeta(const LocalVector &direction)
std::map< DTWireId, edm::PSimHitContainer > mapSimHitsPerWire(const edm::PSimHitContainer &simhits)
std::pair< const_iterator, const_iterator > range
iterator range
LocalPoint localPosition() const override
local position in SL frame
edm::EDGetTokenT< edm::PSimHitContainer > simHitToken_
LocalVector localDirection() const override
the local direction in SL frame
Geom::Phi< T > phi() const
void fill(float etaSimSegm, float phiSimSegm, float posSimSegm, float angleSimSegm, bool fillRecHit)
std::pair< LocalVector, LocalPoint > findMuSimSegmentDirAndPos(const std::pair< const PSimHit *, const PSimHit *> &inAndOutSimHit, const DetId detId, const DTGeometry &muonGeom)
edm::ESGetToken< DTGeometry, MuonGeometryRecord > muonGeomToken_
DTSegment2DQuality(const edm::ParameterSet &pset)
Constructor.
std::atomic< bool > debug
std::unique_ptr< HRes2DHit > h2DHitRZ_W2
C::const_iterator const_iterator
constant access iterator type
const DTSuperLayer * superLayer(const DTSuperLayerId &id) const
Return a DTSuperLayer given its id.
LocalError localDirectionError() const override
the local direction error (xx,xy,yy) in SL frame: only xx is not 0.
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
std::map< DTWireId, const PSimHit * > mapMuSimHitsPerWire(const std::map< DTWireId, edm::PSimHitContainer > &simHitWireMap)
Create a map between the Mu SimHits and corresponding MuBarWireId ;.
Abs< T >::type abs(const T &t)
LocalError localPositionError() const override
local position error in SL frame
#define DEFINE_FWK_MODULE(type)
edm::EDGetTokenT< DTRecSegment2DCollection > segment2DToken_
std::unique_ptr< HEff2DHit > h2DHitEff_RZ_W1
std::unique_ptr< HRes2DHit > h2DHitRZ_W0
std::unique_ptr< HEff2DHit > h2DHitEff_RZ_W0
edm::InputTag simHitLabel_
std::unique_ptr< HEff2DHit > h2DHitEff_RPhi
std::unique_ptr< HRes2DHit > h2DHitRPhi
std::pair< const PSimHit *, const PSimHit * > findMuSimSegment(const std::map< DTWireId, const PSimHit *> &mapWireAndMuSimHit)
void dqmAnalyze(edm::Event const &, edm::EventSetup const &, dtsegment2d::Histograms const &) const override
Perform the real analysis.
std::unique_ptr< HRes2DHit > h2DHitRZ_W1
std::vector< PSimHit > PSimHitContainer
std::unique_ptr< HEff2DHit > h2DHitEff_RZ
edm::InputTag segment2DLabel_
std::unique_ptr< HEff2DHit > h2DHitEff_RZ_W2
std::unique_ptr< HRes2DHit > h2DHitRZ