50 std::unique_ptr<HRes1DHit> hRes_S3RPhiWS[3][4];
51 std::unique_ptr<HRes1DHit> hRes_S3RZWS[3][4];
68 std::unique_ptr<HEff1DHit> hEff_S1RPhiWS[3][4];
69 std::unique_ptr<HEff1DHit> hEff_S3RPhiWS[3][4];
70 std::unique_ptr<HEff1DHit> hEff_S1RZWS[3][4];
71 std::unique_ptr<HEff1DHit> hEff_S3RZWS[3][4];
115 if (doall_ && doStep1_) {
116 histograms.
hRes_S1RPhi = std::make_unique<HRes1DHit>(
"S1RPhi", booker,
true, local_);
118 std::make_unique<HRes1DHit>(
"S1RPhi_W0", booker,
true, local_);
120 std::make_unique<HRes1DHit>(
"S1RPhi_W1", booker,
true, local_);
122 std::make_unique<HRes1DHit>(
"S1RPhi_W2", booker,
true, local_);
123 histograms.
hRes_S1RZ = std::make_unique<HRes1DHit>(
"S1RZ", booker,
true, local_);
125 std::make_unique<HRes1DHit>(
"S1RZ_W0", booker,
true, local_);
127 std::make_unique<HRes1DHit>(
"S1RZ_W1", booker,
true, local_);
129 std::make_unique<HRes1DHit>(
"S1RZ_W2", booker,
true, local_);
130 histograms.
hEff_S1RPhi = std::make_unique<HEff1DHit>(
"S1RPhi", booker);
131 histograms.
hEff_S1RZ = std::make_unique<HEff1DHit>(
"S1RZ", booker);
132 histograms.
hEff_S1RZ_W0 = std::make_unique<HEff1DHit>(
"S1RZ_W0", booker);
133 histograms.
hEff_S1RZ_W1 = std::make_unique<HEff1DHit>(
"S1RZ_W1", booker);
134 histograms.
hEff_S1RZ_W2 = std::make_unique<HEff1DHit>(
"S1RZ_W2", booker);
136 if (doall_ && doStep2_) {
137 histograms.
hRes_S2RPhi = std::make_unique<HRes1DHit>(
"S2RPhi", booker,
true, local_);
139 std::make_unique<HRes1DHit>(
"S2RPhi_W0", booker,
true, local_);
141 std::make_unique<HRes1DHit>(
"S2RPhi_W1", booker,
true, local_);
143 std::make_unique<HRes1DHit>(
"S2RPhi_W2", booker,
true, local_);
144 histograms.
hRes_S2RZ = std::make_unique<HRes1DHit>(
"S2RZ", booker,
true, local_);
146 std::make_unique<HRes1DHit>(
"S2RZ_W0", booker,
true, local_);
148 std::make_unique<HRes1DHit>(
"S2RZ_W1", booker,
true, local_);
150 std::make_unique<HRes1DHit>(
"S2RZ_W2", booker,
true, local_);
151 histograms.
hEff_S2RPhi = std::make_unique<HEff1DHit>(
"S2RPhi", booker);
152 histograms.
hEff_S2RZ_W0 = std::make_unique<HEff1DHit>(
"S2RZ_W0", booker);
153 histograms.
hEff_S2RZ_W1 = std::make_unique<HEff1DHit>(
"S2RZ_W1", booker);
154 histograms.
hEff_S2RZ_W2 = std::make_unique<HEff1DHit>(
"S2RZ_W2", booker);
155 histograms.
hEff_S2RZ = std::make_unique<HEff1DHit>(
"S2RZ", booker);
158 histograms.
hRes_S3RPhi = std::make_unique<HRes1DHit>(
"S3RPhi", booker, doall_, local_);
160 std::make_unique<HRes1DHit>(
"S3RPhi_W0", booker, doall_, local_);
161 histograms.
hRes_S3RPhi_W1 = std::make_unique<HRes1DHit>(
"S3RPhi_W1",
165 histograms.
hRes_S3RPhi_W2 = std::make_unique<HRes1DHit>(
"S3RPhi_W2",
169 histograms.
hRes_S3RZ = std::make_unique<HRes1DHit>(
"S3RZ", booker, doall_, local_);
171 std::make_unique<HRes1DHit>(
"S3RZ_W0", booker, doall_, local_);
173 std::make_unique<HRes1DHit>(
"S3RZ_W1", booker, doall_, local_);
175 std::make_unique<HRes1DHit>(
"S3RZ_W2", booker, doall_, local_);
179 TString name1 =
"RPhi_W";
180 TString name2 =
"RZ_W";
181 for (
long w = 0;
w <= 2; ++
w) {
182 for (
long s = 1;
s <= 4; ++
s) {
184 std::make_unique<HRes1DHit>((
"S3" + name1 +
w +
"_St" +
s).Data(), booker, doall_, local_);
186 std::make_unique<HEff1DHit>((
"S1" + name1 +
w +
"_St" +
s).Data(), booker);
188 std::make_unique<HEff1DHit>((
"S3" + name1 +
w +
"_St" +
s).Data(), booker);
191 std::make_unique<HRes1DHit>((
"S3" + name2 +
w +
"_St" +
s).Data(), booker, doall_, local_);
193 std::make_unique<HEff1DHit>((
"S1" + name2 +
w +
"_St" +
s).Data(), booker);
195 std::make_unique<HEff1DHit>((
"S3" + name2 +
w +
"_St" +
s).Data(), booker);
202 histograms.
hEff_S3RPhi = std::make_unique<HEff1DHit>(
"S3RPhi", booker);
203 histograms.
hEff_S3RZ = std::make_unique<HEff1DHit>(
"S3RZ", booker);
204 histograms.
hEff_S3RZ_W0 = std::make_unique<HEff1DHit>(
"S3RZ_W0", booker);
205 histograms.
hEff_S3RZ_W1 = std::make_unique<HEff1DHit>(
"S3RZ_W1", booker);
206 histograms.
hEff_S3RZ_W2 = std::make_unique<HEff1DHit>(
"S3RZ_W2", booker);
216 cout <<
"--- [DTRecHitQuality] Analysing Event: #Run: " <<
event.id().run() <<
" #Event: " <<
event.id().event()
226 event.getByToken(simHitToken_, simHits);
233 if (doStep1_ && doall_) {
235 cout <<
" -- DTRecHit S1: begin analysis:" << endl;
239 event.getByToken(recHitToken_, dtRecHits);
243 cout <<
"[DTRecHitQuality]**Warning: no 1DRechits with label: " << recHitLabel_ <<
" in this event, skipping!" 250 auto const &recHitsPerWire = map1DRecHitsPerWire(dtRecHits.
product());
256 if (doStep2_ && doall_) {
258 cout <<
" -- DTRecHit S2: begin analysis:" << endl;
263 event.getByToken(segment2DToken_, segment2Ds);
267 cout <<
"[DTRecHitQuality]**Warning: no 2DSegments with label: " << segment2DLabel_
268 <<
" in this event, skipping!" << endl;
273 auto const &recHitsPerWire = map1DRecHitsPerWire(segment2Ds.
product());
282 cout <<
" -- DTRecHit S3: begin analysis:" << endl;
287 event.getByToken(segment4DToken_, segment4Ds);
291 cout <<
"[DTRecHitQuality]**Warning: no 4D Segments with label: " << segment4DLabel_
292 <<
" in this event, skipping!" << endl;
298 auto const &recHitsPerWire = map1DRecHitsPerWire(segment4Ds.
product());
306 map<DTWireId, vector<DTRecHit1DPair>> ret;
308 for (
const auto &dt1DRecHitPair : *dt1DRecHitPairs) {
309 ret[dt1DRecHitPair.wireId()].push_back(dt1DRecHitPair);
318 map<DTWireId, vector<DTRecHit1D>> ret;
321 for (
const auto &segment2D : *segment2Ds) {
322 vector<DTRecHit1D> component1DHits = segment2D.specificRecHits();
324 for (
auto &component1DHit : component1DHits) {
325 ret[component1DHit.wireId()].push_back(component1DHit);
334 map<DTWireId, vector<DTRecHit1D>> ret;
336 for (
const auto &segment4D : *segment4Ds) {
338 vector<const TrackingRecHit *> segment2Ds = segment4D.recHits();
340 for (
auto &segment2D : segment2Ds) {
342 vector<const TrackingRecHit *>
hits = segment2D->recHits();
344 for (
auto &
hit : hits) {
346 ret[hit1D->wireId()].push_back(*hit1D);
359 float xEntry = entryP.
x() - xwire;
360 float xExit = exitP.
x() - xwire;
362 return fabs(xEntry - (entryP.
z() * (xExit - xEntry)) / (exitP.
z() - entryP.
z()));
369 float theta = (exitP.
x() - entryP.
x()) / (exitP.
z() - entryP.
z());
381 return (entryP.
y() + exitP.
y()) / 2. + wireLenght;
385 template <
typename type>
388 const vector<type> &recHits,
389 const float simHitDist)
const {
391 const type *theBestRecHit =
nullptr;
394 float distTmp = recHitDistFromWire(*
recHit, layer);
395 if (fabs(distTmp - simHitDist) < res) {
396 res = fabs(distTmp - simHitDist);
397 theBestRecHit = &(*recHit);
401 return theBestRecHit;
415 template <
typename type>
422 for (
const auto &wireAndSHits : simHitsPerWire) {
423 DTWireId wireId = wireAndSHits.first;
427 vector<PSimHit> simHitsInCell = wireAndSHits.second;
434 if (muSimHit ==
nullptr) {
436 cout <<
" No mu SimHit in channel: " << wireId <<
", skipping! " << endl;
442 float simHitWireDist = simHitDistFromWire(layer, wireId, *muSimHit);
444 if (simHitWireDist > 2.1) {
446 cout <<
" [DTRecHitQuality]###Warning: The mu SimHit in out of the " 455 float simHitTheta = simHitImpactAngle(layer, wireId, *muSimHit);
458 float simHitFEDist = simHitDistFromFE(layer, wireId, *muSimHit);
460 bool recHitReconstructed =
false;
463 if (recHitsPerWire.find(wireId) == recHitsPerWire.end()) {
466 cout <<
" No RecHit found at Step: " << step <<
" in cell: " << wireId << endl;
469 recHitReconstructed =
true;
471 const vector<type> &recHits = recHitsPerWire.at(wireId);
473 cout <<
" " << recHits.size() <<
" RecHits, Step " << step <<
" in channel: " << wireId << endl;
477 const type *theBestRecHit = findBestRecHit(layer, wireId, recHits, simHitWireDist);
479 float recHitWireDist = recHitDistFromWire(*theBestRecHit, layer);
481 cout <<
" SimHit distance from wire: " << simHitWireDist << endl
482 <<
" SimHit distance from FE: " << simHitFEDist << endl
483 <<
" SimHit angle in layer RF: " << simHitTheta << endl
484 <<
" RecHit distance from wire: " << recHitWireDist << endl;
486 float recHitErr = recHitPositionError(*theBestRecHit);
491 if (mirrorMinusWheels && wheel < 0 && sl != 2) {
505 if (
abs(wheel) == 1) {
508 if (
abs(wheel) == 2) {
516 if (
abs(wheel) == 1) {
519 if (
abs(wheel) == 2) {
524 }
else if (step == 2) {
531 if (
abs(wheel) == 1) {
534 if (
abs(wheel) == 2) {
542 if (
abs(wheel) == 1) {
545 if (
abs(wheel) == 2) {
550 }
else if (step == 3) {
557 if (
abs(wheel) == 1) {
560 if (
abs(wheel) == 2) {
568 simHitGlobalPos.
eta(),
569 simHitGlobalPos.
phi(),
578 if (
abs(wheel) == 1) {
581 if (
abs(wheel) == 2) {
589 simHitGlobalPos.
eta(),
590 simHitGlobalPos.
phi(),
598 hRes->
fill(simHitWireDist,
602 simHitGlobalPos.
eta(),
603 simHitGlobalPos.
phi(),
606 if (hResTot !=
nullptr) {
607 hResTot->
fill(simHitWireDist,
611 simHitGlobalPos.
eta(),
612 simHitGlobalPos.
phi(),
628 simHitWireDist, simHitGlobalPos.
eta(), simHitGlobalPos.
phi(), recHitReconstructed);
635 if (
abs(wheel) == 1) {
638 if (
abs(wheel) == 2) {
643 simHitWireDist, simHitGlobalPos.
eta(), simHitGlobalPos.
phi(), recHitReconstructed);
647 }
else if (step == 2) {
656 if (
abs(wheel) == 1) {
659 if (
abs(wheel) == 2) {
664 }
else if (step == 3) {
670 simHitWireDist, simHitGlobalPos.
eta(), simHitGlobalPos.
phi(), recHitReconstructed);
677 if (
abs(wheel) == 1) {
680 if (
abs(wheel) == 2) {
685 simHitWireDist, simHitGlobalPos.
eta(), simHitGlobalPos.
phi(), recHitReconstructed);
690 hEff->
fill(simHitWireDist, simHitGlobalPos.
eta(), simHitGlobalPos.
phi(), recHitReconstructed);
691 if (hEffTot !=
nullptr) {
692 hEffTot->
fill(simHitWireDist, simHitGlobalPos.
eta(), simHitGlobalPos.
phi(), recHitReconstructed);
LocalPoint localPosition() const override
Return the 3-dimensional local position.
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.
std::map< DTWireId, edm::PSimHitContainer > mapSimHitsPerWire(const edm::PSimHitContainer &simhits)
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
std::unique_ptr< HRes1DHit > hRes_S3RPhiWS[3][4]
LocalError localPositionError() const override
LocalError localPositionError() const override
Return the 3-dimensional error on the local position.
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
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
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
def setup(process, global_tag, zero_tesla=False)
std::unique_ptr< HRes1DHit > hRes_S3RZ_W2
std::unique_ptr< HEff1DHit > hEff_S3RZ_W1
std::unique_ptr< HEff1DHit > hEff_S2RZ_W1
std::unique_ptr< HRes1DHit > hRes_S1RPhi_W1
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
std::unique_ptr< HRes1DHit > hRes_S2RPhi_W2
const DTTopology & specificTopology() const
Local3DPoint exitPoint() const
Exit point in the local Det frame.
#define DEFINE_FWK_MODULE(type)
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
std::unique_ptr< HEff1DHit > hEff_S1RZ_W2
void dqmAnalyze(edm::Event const &, edm::EventSetup const &, dtrechit::Histograms const &) const override
Perform the real analysis.
std::unique_ptr< HRes1DHit > hRes_S3RZ_W1
std::unique_ptr< HRes1DHit > hRes_S3RZ
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
int wire() const
Return the wire number.
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
void bookHistograms(DQMStore::ConcurrentBooker &, edm::Run const &, edm::EventSetup const &, dtrechit::Histograms &) const override
Book the DQM plots.
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)
LocalPoint localPosition() const override
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.
T const * product() const
Local3DPoint entryPoint() const
Entry point in the local Det frame.
float recHitPositionError(const DTRecHit1DPair &recHit) const
std::unique_ptr< HEff1DHit > hEff_S3RZ_W2
std::unique_ptr< HEff1DHit > hEff_S1RPhi
std::unique_ptr< HRes1DHit > hRes_S3RPhi_W1
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.