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];
89 debug_ =
pset.getUntrackedParameter<
bool>(
"debug");
103 doStep1_ =
pset.getUntrackedParameter<
bool>(
"doStep1",
false);
104 doStep2_ =
pset.getUntrackedParameter<
bool>(
"doStep2",
false);
105 doStep3_ =
pset.getUntrackedParameter<
bool>(
"doStep3",
false);
106 doall_ =
pset.getUntrackedParameter<
bool>(
"doall",
false);
107 local_ =
pset.getUntrackedParameter<
bool>(
"local",
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!" 256 cout <<
" -- DTRecHit S2: begin analysis:" << endl;
266 <<
" in this event, skipping!" << endl;
280 cout <<
" -- DTRecHit S3: begin analysis:" << endl;
290 <<
" in this event, skipping!" << endl;
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();
344 ret[hit1D->wireId()].push_back(*hit1D);
354 float xwire =
layer->specificTopology().wirePosition(wireId.
wire());
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());
375 float wireLenght =
layer->specificTopology().cellLenght();
379 return (entryP.
y() + exitP.
y()) / 2. + wireLenght;
383 template <
typename type>
387 const float simHitDist)
const {
389 const type *theBestRecHit =
nullptr;
393 if (fabs(distTmp - simHitDist) <
res) {
394 res = fabs(distTmp - simHitDist);
395 theBestRecHit = &(*recHit);
399 return theBestRecHit;
410 return fabs(
recHit.localPosition().x() -
layer->specificTopology().wirePosition(
recHit.wireId().wire()));
413 template <
typename type>
420 for (
const auto &wireAndSHits : simHitsPerWire) {
421 DTWireId wireId = wireAndSHits.first;
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) {
522 }
else if (
step == 2) {
548 }
else if (
step == 3) {
566 simHitGlobalPos.
eta(),
567 simHitGlobalPos.
phi(),
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);
641 simHitWireDist, simHitGlobalPos.
eta(), simHitGlobalPos.
phi(), recHitReconstructed);
645 }
else if (
step == 2) {
662 }
else if (
step == 3) {
668 simHitWireDist, simHitGlobalPos.
eta(), simHitGlobalPos.
phi(), recHitReconstructed);
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);
703 return sqrt(
recHit.localPositionError().xx());
int station() const
Return the station number.
std::map< DTWireId, edm::PSimHitContainer > mapSimHitsPerWire(const edm::PSimHitContainer &simhits)
edm::InputTag recHitLabel_
int superLayer() const
Return the superlayer number.
std::unique_ptr< HRes1DHit > hRes_S3RPhi_W0
int wire() const
Return the wire number.
std::unique_ptr< HRes1DHit > hRes_S2RZ_W2
std::unique_ptr< HRes1DHit > hRes_S1RPhi
std::unique_ptr< HRes1DHit > hRes_S3RPhi_W2
edm::EDGetTokenT< DTRecHitCollection > recHitToken_
float recHitDistFromWire(const DTRecHit1DPair &hitPair, const DTLayer *layer) const
edm::InputTag segment4DLabel_
ret
prodAgent to be discontinued
std::unique_ptr< HRes1DHit > hRes_S2RZ
Geom::Phi< T > phi() const
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
T const * product() 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
float recHitPositionError(const DTRecHit1DPair &recHit) const
edm::InputTag simHitLabel_
std::unique_ptr< HRes1DHit > hRes_S1RZ
std::map< DTWireId, std::vector< DTRecHit1DPair > > map1DRecHitsPerWire(const DTRecHitCollection *dt1DRecHitPairs) const
std::unique_ptr< HRes1DHit > hRes_S2RPhi_W2
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
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_
float simHitImpactAngle(const DTLayer *layer, const DTWireId &wireId, const PSimHit &hit) const
std::unique_ptr< HRes1DHit > hRes_S3RZ
float simHitDistFromWire(const DTLayer *layer, const DTWireId &wireId, const PSimHit &hit) const
Abs< T >::type abs(const T &t)
#define DEFINE_FWK_MODULE(type)
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< HRes1DHit > hRes_S3RPhi
std::unique_ptr< HEff1DHit > hEff_S1RZ_W1
const type * findBestRecHit(const DTLayer *layer, const DTWireId &wireId, const std::vector< type > &recHits, float simHitDist) const
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
std::unique_ptr< HEff1DHit > hEff_S1RZ_W0
std::unique_ptr< HRes1DHit > hRes_S2RPhi
edm::ESGetToken< DTGeometry, MuonGeometryRecord > muonGeomToken_
void dqmAnalyze(edm::Event const &, edm::EventSetup const &, dtrechit::Histograms const &) const override
Perform the real analysis.
Local3DPoint localPosition() const
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
std::unique_ptr< HRes1DHit > hRes_S1RZ_W0
std::unique_ptr< HEff1DHit > hEff_S1RZ
int wheel() const
Return the wheel number.
std::unique_ptr< HRes1DHit > hRes_S3RZ_W0
void fill(float distSimHit, float etaSimHit, float phiSimHit, bool fillRecHit)
std::unique_ptr< HRes1DHit > hRes_S1RZ_W1
std::unique_ptr< HEff1DHit > hEff_S2RZ_W0
float simHitDistFromFE(const DTLayer *layer, const DTWireId &wireId, const PSimHit &hit) 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
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
const DTLayer * layer(const DTLayerId &id) const
Return a layer given its id.