61 sigmaResAngle_ = pset.
getParameter<
double>(
"sigmaResAngle");
64 cout <<
"[DTSegment2DQuality] Constructor called " << endl;
69 histograms.
h2DHitRPhi = std::make_unique<HRes2DHit> (
"RPhi", booker,
true,
true);
70 histograms.
h2DHitRZ = std::make_unique<HRes2DHit> (
"RZ", booker,
true,
true);
71 histograms.
h2DHitRZ_W0 = std::make_unique<HRes2DHit> (
"RZ_W0", booker,
true,
true);
72 histograms.
h2DHitRZ_W1 = std::make_unique<HRes2DHit> (
"RZ_W1", booker,
true,
true);
73 histograms.
h2DHitRZ_W2 = std::make_unique<HRes2DHit> (
"RZ_W2", booker,
true,
true);
75 histograms.
h2DHitEff_RPhi = std::make_unique<HEff2DHit> (
"RPhi", booker);
76 histograms.
h2DHitEff_RZ = std::make_unique<HEff2DHit> (
"RZ", booker);
77 histograms.
h2DHitEff_RZ_W0 = std::make_unique<HEff2DHit> (
"RZ_W0", booker);
78 histograms.
h2DHitEff_RZ_W1 = std::make_unique<HEff2DHit> (
"RZ_W1", booker);
79 histograms.
h2DHitEff_RZ_W2 = std::make_unique<HEff2DHit> (
"RZ_W2", booker);
81 cout <<
"[DTSegment2DQuality] hitsos created " << endl;
93 event.getByToken(simHitToken_, simHits);
96 map<DTSuperLayerId, PSimHitContainer > simHitsPerSl;
97 for (
const auto &
simHit : *simHits) {
101 simHitsPerSl[slId].push_back(
simHit);
106 event.getByToken(segment2DToken_, segment2Ds);
108 if (not segment2Ds.
isValid()) {
109 if (debug_) {
cout <<
"[DTSegment2DQuality]**Warning: no 2DSegments with label: " << segment2DLabel_
110 <<
" in this event, skipping !" << endl;
116 DTRecSegment2DCollection::id_iterator slId;
117 for (slId = segment2Ds->id_begin();
118 slId != segment2Ds->id_end();
128 int nMuSimHit = muSimHitPerWire.size();
129 if (nMuSimHit == 0
or nMuSimHit == 1) {
130 if (debug_ and nMuSimHit == 1) {
131 cout <<
"[DTSegment2DQuality] Only " << nMuSimHit <<
" mu SimHit in this SL, skipping !" << endl;
136 cout <<
"=== SL " << (*slId) <<
" has " << nMuSimHit <<
" SimHits" << endl;
142 if (inAndOutSimHit.first == inAndOutSimHit.second ) {
143 cout <<
"[DTHitQualityUtils]***Warning: outermost and innermost SimHit are the same !" << endl;
151 LocalVector simSegmLocalDir = dirAndPosSimSegm.first;
152 LocalPoint simSegmLocalPos = dirAndPosSimSegm.second;
154 cout <<
" Simulated segment: local direction " << simSegmLocalDir << endl
155 <<
" local position " << simSegmLocalPos << endl;
162 float posSimSeg = simSegmLocalPos.
x();
164 float etaSimSeg = simSegmGlobalPos.
eta();
165 float phiSimSeg = simSegmGlobalPos.
phi();
169 bool recHitFound =
false;
171 int nsegm =
distance(range.first, range.second);
173 cout <<
" Sl: " << *slId <<
" has " << nsegm
174 <<
" 2D segments" << endl;
184 bool bestRecHitFound =
false;
185 double deltaAlpha = 99999;
189 segment2D != range.second;
192 if ((*segment2D).dimension() != 2) {
193 if (debug_) {
cout <<
"[DTSegment2DQuality]***Error: This is not 2D segment !!!" << endl;
198 LocalVector recSegDirection = (*segment2D).localDirection();
199 LocalPoint recSegPosition = (*segment2D).localPosition();
203 cout <<
" RecSegment direction: " << recSegDirection << endl
204 <<
" position : " << recSegPosition << endl
205 <<
" alpha : " << recSegAlpha << endl;
208 if (fabs(recSegAlpha - angleSimSeg) < deltaAlpha) {
209 deltaAlpha = fabs(recSegAlpha - angleSimSeg);
210 bestRecHit = &(*segment2D);
211 bestRecHitFound =
true;
215 if (bestRecHitFound) {
225 if (fabs(angleBestRHit - angleSimSeg) < 5*sigmaResAngle_ and
226 fabs(bestRecHitLocalPos.
x() - posSimSeg) < 5*sigmaResPos_) {
232 if ((*slId).superlayer() == 1
or (*slId).superlayer() == 3) {
234 }
else if ((*slId).superlayer() == 2) {
235 histograms.
h2DHitRZ->fill(angleSimSeg,
238 bestRecHitLocalPos.
x(),
241 sqrt(bestRecHitLocalPosErr.
xx()),
242 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())
266 if ((*slId).superlayer() == 1
or (*slId).superlayer() == 3) {
268 }
else if ((*slId).superlayer() == 2) {
269 histograms.
h2DHitEff_RZ->fill(etaSimSeg, phiSimSeg, posSimSeg, angleSimSeg, recHitFound);
270 if (
abs((*slId).wheel()) == 0) {
272 }
else if (
abs((*slId).wheel()) == 1) {
274 }
else if (
abs((*slId).wheel()) == 2) {
278 hEff->
fill(etaSimSeg, phiSimSeg, posSimSeg, angleSimSeg, recHitFound);
std::pair< double, double > findSegmentAlphaAndBeta(const LocalVector &direction)
LocalError localPositionError() const override
local position error in SL frame
T getParameter(std::string const &) const
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
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)
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)
DTSegment2DQuality(const edm::ParameterSet &pset)
Constructor.
std::atomic< bool > debug
std::unique_ptr< HRes2DHit > h2DHitRZ_W2
std::map< DTWireId, edm::PSimHitContainer > mapSimHitsPerWire(const edm::PSimHitContainer &simhits)
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
void bookHistograms(DQMStore::ConcurrentBooker &, edm::Run const &, edm::EventSetup const &, dtsegment2d::Histograms &) const override
Book the DQM plots.
Abs< T >::type abs(const T &t)
std::unique_ptr< HEff2DHit > h2DHitEff_RZ_W1
LocalPoint localPosition() const override
local position in SL frame
std::unique_ptr< HRes2DHit > h2DHitRZ_W0
std::unique_ptr< HEff2DHit > h2DHitEff_RZ_W0
std::unique_ptr< HEff2DHit > h2DHitEff_RPhi
std::unique_ptr< HRes2DHit > h2DHitRPhi
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
std::unique_ptr< HRes2DHit > h2DHitRZ_W1
std::vector< PSimHit > PSimHitContainer
void dqmAnalyze(edm::Event const &, edm::EventSetup const &, dtsegment2d::Histograms const &) const override
Perform the real analysis.
LocalError localDirectionError() const override
the local direction error (xx,xy,yy) in SL frame: only xx is not 0.
std::unique_ptr< HEff2DHit > h2DHitEff_RZ
const DTSuperLayer * superLayer(const DTSuperLayerId &id) const
Return a DTSuperLayer given its id.
std::unique_ptr< HEff2DHit > h2DHitEff_RZ_W2
std::unique_ptr< HRes2DHit > h2DHitRZ