57 sigmaResAngle_ = pset.
getParameter<
double>(
"sigmaResAngle");
60 cout <<
"[DTSegment2DQuality] Constructor called " << endl;
77 cout <<
"[DTSegment2DQuality] hitsos created " << endl;
89 event.getByToken(simHitToken_, simHits);
92 map<DTSuperLayerId, PSimHitContainer > simHitsPerSl;
93 for (
const auto &
simHit : *simHits) {
97 simHitsPerSl[slId].push_back(
simHit);
102 event.getByToken(segment2DToken_, segment2Ds);
104 if (not segment2Ds.
isValid()) {
105 if (debug_) {
cout <<
"[DTSegment2DQuality]**Warning: no 2DSegments with label: " << segment2DLabel_
106 <<
" in this event, skipping !" << endl;
112 DTRecSegment2DCollection::id_iterator slId;
113 for (slId = segment2Ds->id_begin();
114 slId != segment2Ds->id_end();
124 int nMuSimHit = muSimHitPerWire.size();
125 if (nMuSimHit == 0
or nMuSimHit == 1) {
126 if (debug_ and nMuSimHit == 1) {
127 cout <<
"[DTSegment2DQuality] Only " << nMuSimHit <<
" mu SimHit in this SL, skipping !" << endl;
132 cout <<
"=== SL " << (*slId) <<
" has " << nMuSimHit <<
" SimHits" << endl;
138 if (inAndOutSimHit.first == inAndOutSimHit.second ) {
139 cout <<
"[DTHitQualityUtils]***Warning: outermost and innermost SimHit are the same !" << endl;
147 LocalVector simSegmLocalDir = dirAndPosSimSegm.first;
148 LocalPoint simSegmLocalPos = dirAndPosSimSegm.second;
150 cout <<
" Simulated segment: local direction " << simSegmLocalDir << endl
151 <<
" local position " << simSegmLocalPos << endl;
158 float posSimSeg = simSegmLocalPos.
x();
160 float etaSimSeg = simSegmGlobalPos.
eta();
161 float phiSimSeg = simSegmGlobalPos.
phi();
165 bool recHitFound =
false;
167 int nsegm =
distance(range.first, range.second);
169 cout <<
" Sl: " << *slId <<
" has " << nsegm
170 <<
" 2D segments" << endl;
180 bool bestRecHitFound =
false;
181 double deltaAlpha = 99999;
185 segment2D != range.second;
188 if ((*segment2D).dimension() != 2) {
189 if (debug_) {
cout <<
"[DTSegment2DQuality]***Error: This is not 2D segment !!!" << endl;
194 LocalVector recSegDirection = (*segment2D).localDirection();
195 LocalPoint recSegPosition = (*segment2D).localPosition();
199 cout <<
" RecSegment direction: " << recSegDirection << endl
200 <<
" position : " << recSegPosition << endl
201 <<
" alpha : " << recSegAlpha << endl;
204 if (fabs(recSegAlpha - angleSimSeg) < deltaAlpha) {
205 deltaAlpha = fabs(recSegAlpha - angleSimSeg);
206 bestRecHit = &(*segment2D);
207 bestRecHitFound =
true;
211 if (bestRecHitFound) {
221 if (fabs(angleBestRHit - angleSimSeg) < 5*sigmaResAngle_ and
222 fabs(bestRecHitLocalPos.
x() - posSimSeg) < 5*sigmaResPos_) {
228 if ((*slId).superlayer() == 1
or (*slId).superlayer() == 3) {
230 }
else if ((*slId).superlayer() == 2) {
234 bestRecHitLocalPos.
x(),
237 sqrt(bestRecHitLocalPosErr.
xx()),
238 sqrt(bestRecHitLocalDirErr.
xx())
240 if (
abs((*slId).wheel()) == 0) {
242 }
else if (
abs((*slId).wheel()) == 1) {
244 }
else if (
abs((*slId).wheel()) == 2) {
248 hRes->
fill(angleSimSeg,
251 bestRecHitLocalPos.
x(),
254 sqrt(bestRecHitLocalPosErr.
xx()),
255 sqrt(bestRecHitLocalDirErr.
xx())
262 if ((*slId).superlayer() == 1
or (*slId).superlayer() == 3) {
264 }
else if ((*slId).superlayer() == 2) {
265 histograms.
h2DHitEff_RZ->
fill(etaSimSeg, phiSimSeg, posSimSeg, angleSimSeg, recHitFound);
266 if (
abs((*slId).wheel()) == 0) {
268 }
else if (
abs((*slId).wheel()) == 1) {
270 }
else if (
abs((*slId).wheel()) == 2) {
274 hEff->
fill(etaSimSeg, phiSimSeg, posSimSeg, angleSimSeg, recHitFound);
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
HEff2DHit * h2DHitEff_RZ_W0
#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.
static std::map< DTWireId, const PSimHit * > mapMuSimHitsPerWire(const std::map< DTWireId, edm::PSimHitContainer > &simHitWireMap)
Create a map between the Mu SimHits and corresponding MuBarWireId ;.
HEff2DHit * h2DHitEff_RZ_W2
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) ...
HEff2DHit * h2DHitEff_RPhi
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
Abs< T >::type abs(const T &t)
static std::pair< double, double > findSegmentAlphaAndBeta(const LocalVector &direction)
void dqmAnalyze(edm::Event const &, edm::EventSetup const &, Histograms const &) const override
Perform the real analysis.
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
void bookHistograms(DQMStore::ConcurrentBooker &, edm::Run const &, edm::EventSetup const &, Histograms &) const override
Book the DQM plots.
HEff2DHit * h2DHitEff_RZ_W1
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.
const DTSuperLayer * superLayer(const DTSuperLayerId &id) const
Return a DTSuperLayer given its id.