49 std::unique_ptr<HRes1DHit> hRes_S3RPhiWS[3][4];
50 std::unique_ptr<HRes1DHit> hRes_S3RZWS[3][4];
67 std::unique_ptr<HEff1DHit> hEff_S1RPhiWS[3][4];
68 std::unique_ptr<HEff1DHit> hEff_S3RPhiWS[3][4];
69 std::unique_ptr<HEff1DHit> hEff_S1RZWS[3][4];
70 std::unique_ptr<HEff1DHit> hEff_S3RZWS[3][4];
74 using namespace dtrechit;
83 constexpr
bool mirrorMinusWheels =
true;
115 histograms.
hRes_S1RPhi = std::make_unique<HRes1DHit>(
"S1RPhi", booker,
true,
local_);
117 std::make_unique<HRes1DHit>(
"S1RPhi_W0", booker,
true,
local_);
119 std::make_unique<HRes1DHit>(
"S1RPhi_W1", booker,
true,
local_);
121 std::make_unique<HRes1DHit>(
"S1RPhi_W2", booker,
true,
local_);
122 histograms.
hRes_S1RZ = std::make_unique<HRes1DHit>(
"S1RZ", booker,
true,
local_);
124 std::make_unique<HRes1DHit>(
"S1RZ_W0", booker,
true,
local_);
126 std::make_unique<HRes1DHit>(
"S1RZ_W1", booker,
true,
local_);
128 std::make_unique<HRes1DHit>(
"S1RZ_W2", booker,
true,
local_);
129 histograms.
hEff_S1RPhi = std::make_unique<HEff1DHit>(
"S1RPhi", booker);
130 histograms.
hEff_S1RZ = std::make_unique<HEff1DHit>(
"S1RZ", booker);
131 histograms.
hEff_S1RZ_W0 = std::make_unique<HEff1DHit>(
"S1RZ_W0", booker);
132 histograms.
hEff_S1RZ_W1 = std::make_unique<HEff1DHit>(
"S1RZ_W1", booker);
133 histograms.
hEff_S1RZ_W2 = std::make_unique<HEff1DHit>(
"S1RZ_W2", booker);
136 histograms.
hRes_S2RPhi = std::make_unique<HRes1DHit>(
"S2RPhi", booker,
true,
local_);
138 std::make_unique<HRes1DHit>(
"S2RPhi_W0", booker,
true,
local_);
140 std::make_unique<HRes1DHit>(
"S2RPhi_W1", booker,
true,
local_);
142 std::make_unique<HRes1DHit>(
"S2RPhi_W2", booker,
true,
local_);
143 histograms.
hRes_S2RZ = std::make_unique<HRes1DHit>(
"S2RZ", booker,
true,
local_);
145 std::make_unique<HRes1DHit>(
"S2RZ_W0", booker,
true,
local_);
147 std::make_unique<HRes1DHit>(
"S2RZ_W1", booker,
true,
local_);
149 std::make_unique<HRes1DHit>(
"S2RZ_W2", booker,
true,
local_);
150 histograms.
hEff_S2RPhi = std::make_unique<HEff1DHit>(
"S2RPhi", booker);
151 histograms.
hEff_S2RZ_W0 = std::make_unique<HEff1DHit>(
"S2RZ_W0", booker);
152 histograms.
hEff_S2RZ_W1 = std::make_unique<HEff1DHit>(
"S2RZ_W1", booker);
153 histograms.
hEff_S2RZ_W2 = std::make_unique<HEff1DHit>(
"S2RZ_W2", booker);
154 histograms.
hEff_S2RZ = std::make_unique<HEff1DHit>(
"S2RZ", booker);
159 std::make_unique<HRes1DHit>(
"S3RPhi_W0", booker,
doall_,
local_);
160 histograms.
hRes_S3RPhi_W1 = std::make_unique<HRes1DHit>(
"S3RPhi_W1",
164 histograms.
hRes_S3RPhi_W2 = std::make_unique<HRes1DHit>(
"S3RPhi_W2",
170 std::make_unique<HRes1DHit>(
"S3RZ_W0", booker,
doall_,
local_);
172 std::make_unique<HRes1DHit>(
"S3RZ_W1", booker,
doall_,
local_);
174 std::make_unique<HRes1DHit>(
"S3RZ_W2", booker,
doall_,
local_);
178 TString name1 =
"RPhi_W";
179 TString name2 =
"RZ_W";
180 for (
long w = 0;
w <= 2; ++
w) {
181 for (
long s = 1;
s <= 4; ++
s) {
183 std::make_unique<HRes1DHit>((
"S3" + name1 +
w +
"_St" +
s).Data(), booker,
doall_,
local_);
185 std::make_unique<HEff1DHit>((
"S1" + name1 +
w +
"_St" +
s).Data(), booker);
187 std::make_unique<HEff1DHit>((
"S3" + name1 +
w +
"_St" +
s).Data(), booker);
190 std::make_unique<HRes1DHit>((
"S3" + name2 +
w +
"_St" +
s).Data(), booker,
doall_,
local_);
192 std::make_unique<HEff1DHit>((
"S1" + name2 +
w +
"_St" +
s).Data(), booker);
194 std::make_unique<HEff1DHit>((
"S3" + name2 +
w +
"_St" +
s).Data(), booker);
201 histograms.
hEff_S3RPhi = std::make_unique<HEff1DHit>(
"S3RPhi", booker);
202 histograms.
hEff_S3RZ = std::make_unique<HEff1DHit>(
"S3RZ", booker);
203 histograms.
hEff_S3RZ_W0 = std::make_unique<HEff1DHit>(
"S3RZ_W0", booker);
204 histograms.
hEff_S3RZ_W1 = std::make_unique<HEff1DHit>(
"S3RZ_W1", booker);
205 histograms.
hEff_S3RZ_W2 = std::make_unique<HEff1DHit>(
"S3RZ_W2", booker);
215 cout <<
"--- [DTRecHitQuality] Analysing Event: #Run: " <<
event.id().run() <<
" #Event: " <<
event.id().event()
233 cout <<
" -- DTRecHit S1: begin analysis:" << endl;
241 cout <<
"[DTRecHitQuality]**Warning: no 1DRechits with label: " <<
recHitLabel_ <<
" in this event, skipping!"
249 compute(dtGeom, simHitsPerWire, recHitsPerWire, histograms, 1);
256 cout <<
" -- DTRecHit S2: begin analysis:" << endl;
266 <<
" in this event, skipping!" << endl;
272 compute(dtGeom, simHitsPerWire, recHitsPerWire, histograms, 2);
280 cout <<
" -- DTRecHit S3: begin analysis:" << endl;
290 <<
" in this event, skipping!" << endl;
297 compute(dtGeom, simHitsPerWire, recHitsPerWire, histograms, 3);
304 map<DTWireId, vector<DTRecHit1DPair>>
ret;
306 for (
const auto &dt1DRecHitPair : *dt1DRecHitPairs) {
307 ret[dt1DRecHitPair.wireId()].push_back(dt1DRecHitPair);
316 map<DTWireId, vector<DTRecHit1D>>
ret;
319 for (
const auto &segment2D : *segment2Ds) {
320 vector<DTRecHit1D> component1DHits = segment2D.specificRecHits();
322 for (
auto &component1DHit : component1DHits) {
323 ret[component1DHit.wireId()].push_back(component1DHit);
332 map<DTWireId, vector<DTRecHit1D>>
ret;
334 for (
const auto &segment4D : *segment4Ds) {
336 vector<const TrackingRecHit *> segment2Ds = segment4D.recHits();
338 for (
auto &segment2D : segment2Ds) {
340 vector<const TrackingRecHit *> hits = segment2D->recHits();
342 for (
auto &
hit : hits) {
344 ret[hit1D->wireId()].push_back(*hit1D);
357 float xEntry = entryP.
x() - xwire;
358 float xExit = exitP.
x() - xwire;
360 return fabs(xEntry - (entryP.
z() * (xExit - xEntry)) / (exitP.
z() - entryP.
z()));
367 float theta = (exitP.
x() - entryP.
x()) / (exitP.
z() - entryP.
z());
379 return (entryP.
y() + exitP.
y()) / 2. + wireLenght;
383 template <
typename type>
387 const float simHitDist)
const {
389 const type *theBestRecHit =
nullptr;
391 for (
auto recHit = recHits.begin(); recHit != recHits.end(); recHit++) {
393 if (fabs(distTmp - simHitDist) < res) {
394 res = fabs(distTmp - simHitDist);
395 theBestRecHit = &(*recHit);
399 return theBestRecHit;
413 template <
typename type>
415 const std::map<
DTWireId, std::vector<PSimHit>> &simHitsPerWire,
416 const std::map<
DTWireId, std::vector<type>> &recHitsPerWire,
420 for (
const auto &wireAndSHits : simHitsPerWire) {
421 DTWireId wireId = wireAndSHits.first;
422 int wheel = wireId.
wheel();
425 vector<PSimHit> simHitsInCell = wireAndSHits.second;
432 if (muSimHit ==
nullptr) {
434 cout <<
" No mu SimHit in channel: " << wireId <<
", skipping! " << endl;
442 if (simHitWireDist > 2.1) {
444 cout <<
" [DTRecHitQuality]###Warning: The mu SimHit in out of the "
458 bool recHitReconstructed =
false;
461 if (recHitsPerWire.find(wireId) == recHitsPerWire.end()) {
464 cout <<
" No RecHit found at Step: " << step <<
" in cell: " << wireId << endl;
467 recHitReconstructed =
true;
469 const vector<type> &
recHits = recHitsPerWire.at(wireId);
471 cout <<
" " << recHits.size() <<
" RecHits, Step " << step <<
" in channel: " << wireId << endl;
479 cout <<
" SimHit distance from wire: " << simHitWireDist << endl
480 <<
" SimHit distance from FE: " << simHitFEDist << endl
481 <<
" SimHit angle in layer RF: " << simHitTheta << endl
482 <<
" RecHit distance from wire: " << recHitWireDist << endl;
489 if (mirrorMinusWheels && wheel < 0 && sl != 2) {
503 if (
abs(wheel) == 1) {
506 if (
abs(wheel) == 2) {
514 if (
abs(wheel) == 1) {
517 if (
abs(wheel) == 2) {
522 }
else if (step == 2) {
529 if (
abs(wheel) == 1) {
532 if (
abs(wheel) == 2) {
540 if (
abs(wheel) == 1) {
543 if (
abs(wheel) == 2) {
548 }
else if (step == 3) {
555 if (
abs(wheel) == 1) {
558 if (
abs(wheel) == 2) {
566 simHitGlobalPos.
eta(),
567 simHitGlobalPos.
phi(),
576 if (
abs(wheel) == 1) {
579 if (
abs(wheel) == 2) {
587 simHitGlobalPos.
eta(),
588 simHitGlobalPos.
phi(),
596 hRes->
fill(simHitWireDist,
600 simHitGlobalPos.
eta(),
601 simHitGlobalPos.
phi(),
604 if (hResTot !=
nullptr) {
605 hResTot->
fill(simHitWireDist,
609 simHitGlobalPos.
eta(),
610 simHitGlobalPos.
phi(),
626 simHitWireDist, simHitGlobalPos.
eta(), simHitGlobalPos.
phi(), recHitReconstructed);
633 if (
abs(wheel) == 1) {
636 if (
abs(wheel) == 2) {
641 simHitWireDist, simHitGlobalPos.
eta(), simHitGlobalPos.
phi(), recHitReconstructed);
645 }
else if (step == 2) {
654 if (
abs(wheel) == 1) {
657 if (
abs(wheel) == 2) {
662 }
else if (step == 3) {
668 simHitWireDist, simHitGlobalPos.
eta(), simHitGlobalPos.
phi(), recHitReconstructed);
675 if (
abs(wheel) == 1) {
678 if (
abs(wheel) == 2) {
683 simHitWireDist, simHitGlobalPos.
eta(), simHitGlobalPos.
phi(), recHitReconstructed);
688 hEff->
fill(simHitWireDist, simHitGlobalPos.
eta(), simHitGlobalPos.
phi(), recHitReconstructed);
689 if (hEffTot !=
nullptr) {
690 hEffTot->
fill(simHitWireDist, simHitGlobalPos.
eta(), simHitGlobalPos.
phi(), recHitReconstructed);
T getUntrackedParameter(std::string const &, T const &) const
float wirePosition(int wireNumber) const
Returns the x position in the layer of a given wire number.
tuple ret
prodAgent to be discontinued
std::map< DTWireId, edm::PSimHitContainer > mapSimHitsPerWire(const edm::PSimHitContainer &simhits)
edm::InputTag recHitLabel_
std::unique_ptr< HRes1DHit > hRes_S3RPhi_W0
std::unique_ptr< HRes1DHit > hRes_S2RZ_W2
std::unique_ptr< HRes1DHit > hRes_S1RPhi
std::unique_ptr< HRes1DHit > hRes_S3RPhi_W2
edm::EDGetTokenT< DTRecHitCollection > recHitToken_
std::unique_ptr< HRes1DHit > hRes_S3RPhiWS[3][4]
edm::InputTag segment4DLabel_
#define DEFINE_FWK_MODULE(type)
std::unique_ptr< HRes1DHit > hRes_S2RZ
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
std::unique_ptr< HEff1DHit > hEff_S3RPhi
A set of histograms fo efficiency computation for 1D RecHits (producer)
std::unique_ptr< HEff1DHit > hEff_S3RZ
std::unique_ptr< HRes1DHit > hRes_S2RPhi_W1
float simHitImpactAngle(const DTLayer *layer, const DTWireId &wireId, const PSimHit &hit) const
Geom::Phi< T > phi() const
Geom::Theta< T > theta() const
std::unique_ptr< HRes1DHit > hRes_S1RPhi_W0
LocalPoint localPosition() const override
std::unique_ptr< HRes1DHit > hRes_S3RZ_W2
edm::EDGetTokenT< DTRecSegment4DCollection > segment4DToken_
std::unique_ptr< HEff1DHit > hEff_S3RZ_W1
std::unique_ptr< HEff1DHit > hEff_S2RZ_W1
std::unique_ptr< HRes1DHit > hRes_S1RPhi_W1
edm::InputTag simHitLabel_
constexpr std::array< uint8_t, layerIndexSize > layer
std::unique_ptr< HRes1DHit > hRes_S3RZWS[3][4]
std::unique_ptr< HRes1DHit > hRes_S1RZ
std::map< DTWireId, std::vector< DTRecHit1DPair > > map1DRecHitsPerWire(const DTRecHitCollection *dt1DRecHitPairs) const
bool getData(T &iHolder) const
std::unique_ptr< HRes1DHit > hRes_S2RPhi_W2
const DTTopology & specificTopology() const
Local3DPoint exitPoint() const
Exit point in the local Det frame.
void fill(float distSimHit, float thetaSimHit, float distFESimHit, float distRecHit, float etaSimHit, float phiSimHit, float errRecHit, int station)
DTRecHitQuality(const edm::ParameterSet &pset)
Constructor.
std::unique_ptr< HRes1DHit > hRes_S1RZ_W2
Local3DPoint localPosition() const
edm::InputTag segment2DLabel_
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &, dtrechit::Histograms &) const override
Book the DQM plots.
std::unique_ptr< HEff1DHit > hEff_S1RZ_W2
std::unique_ptr< HRes1DHit > hRes_S3RZ_W1
edm::EDGetTokenT< DTRecSegment2DCollection > segment2DToken_
std::unique_ptr< HRes1DHit > hRes_S3RZ
void compute(const DTGeometry &dtGeom, const std::map< DTWireId, std::vector< PSimHit >> &simHitsPerWire, const std::map< DTWireId, std::vector< type >> &recHitsPerWire, dtrechit::Histograms const &histograms, int step) const
Abs< T >::type abs(const T &t)
int superLayer() const
Return the superlayer number.
float simHitDistFromWire(const DTLayer *layer, const DTWireId &wireId, const PSimHit &hit) const
float recHitDistFromWire(const DTRecHit1DPair &hitPair, const DTLayer *layer) const
const type * findBestRecHit(const DTLayer *layer, const DTWireId &wireId, const std::vector< type > &recHits, float simHitDist) const
const PSimHit * findMuSimHit(const edm::PSimHitContainer &hits)
Select the SimHit from a muon in a vector of SimHits.
A set of histograms of residuals and pulls for 1D RecHits.
std::unique_ptr< HEff1DHit > hEff_S1RPhiWS[3][4]
std::unique_ptr< HRes1DHit > hRes_S3RPhi
std::unique_ptr< HEff1DHit > hEff_S3RZWS[3][4]
std::unique_ptr< HEff1DHit > hEff_S1RZ_W1
std::unique_ptr< HEff1DHit > hEff_S1RZ_W0
std::unique_ptr< HRes1DHit > hRes_S2RPhi
edm::ESGetToken< DTGeometry, MuonGeometryRecord > muonGeomToken_
int wire() const
Return the wire number.
void dqmAnalyze(edm::Event const &, edm::EventSetup const &, dtrechit::Histograms const &) const override
Perform the real analysis.
T const * product() const
std::unique_ptr< HEff1DHit > hEff_S1RZWS[3][4]
std::unique_ptr< HEff1DHit > hEff_S2RPhi
std::unique_ptr< HRes1DHit > hRes_S1RPhi_W2
std::unique_ptr< HRes1DHit > hRes_S2RZ_W1
std::unique_ptr< HRes1DHit > hRes_S2RPhi_W0
LocalError localPositionError() const override
Return the 3-dimensional error on the local position.
std::unique_ptr< HRes1DHit > hRes_S1RZ_W0
std::unique_ptr< HEff1DHit > hEff_S1RZ
std::unique_ptr< HEff1DHit > hEff_S3RPhiWS[3][4]
std::unique_ptr< HRes1DHit > hRes_S3RZ_W0
void fill(float distSimHit, float etaSimHit, float phiSimHit, bool fillRecHit)
const DTLayer * layer(const DTLayerId &id) const
Return a layer given its id.
std::unique_ptr< HRes1DHit > hRes_S1RZ_W1
int station() const
Return the station number.
std::unique_ptr< HEff1DHit > hEff_S2RZ_W0
int wheel() const
Return the wheel number.
LocalPoint localPosition() const override
Return the 3-dimensional local position.
Local3DPoint entryPoint() const
Entry point in the local Det frame.
float recHitPositionError(const DTRecHit1DPair &recHit) const
std::unique_ptr< HEff1DHit > hEff_S3RZ_W2
edm::EDGetTokenT< edm::PSimHitContainer > simHitToken_
std::unique_ptr< HEff1DHit > hEff_S1RPhi
std::unique_ptr< HRes1DHit > hRes_S3RPhi_W1
LocalError localPositionError() const override
std::unique_ptr< HEff1DHit > hEff_S2RZ_W2
std::unique_ptr< HEff1DHit > hEff_S2RZ
std::unique_ptr< HRes1DHit > hRes_S2RZ_W0
std::unique_ptr< HEff1DHit > hEff_S3RZ_W0
float simHitDistFromFE(const DTLayer *layer, const DTWireId &wireId, const PSimHit &hit) const
DTWireId wireId() const
Return the wireId.