62 LogTrace(
"DTCalibValidationFromMuons") <<
"[DTCalibValidationFromMuons] Analyze #Run: " <<
event.id().run()
66 LogTrace(
"DTCalibValidationFromMuons") <<
" -- DTRecHit S3: begin analysis:";
76 vector<const DTRecSegment4D *> selectedSegment4Ds;
78 for (
auto &imuon : *
muons) {
79 for (
const auto &ch : imuon.matches()) {
80 DetId chId(ch.id.rawId());
87 if (!imuon.isGlobalMuon())
90 int nsegs = ch.segmentMatches.size();
99 float dx = (posHit.
x() ? posHit.
x() - ch.x : 0);
100 float dy = (posHit.
y() ? posHit.
y() - ch.y : 0);
103 selectedSegment4Ds.push_back(&(*segment));
109 for (
auto segment : selectedSegment4Ds) {
110 LogTrace(
"DTCalibValidationFromMuons") <<
"Anlysis on recHit at step 3";
122 return fabs(
recHit.localPosition().x() -
layer->specificTopology().wirePosition(
recHit.wireId().wire()));
134 float recHitPos = -1;
136 if (fabs(hitPosInChamber_left.
x() - segmentPos) < fabs(hitPosInChamber_right.
x() - segmentPos))
137 recHitPos = hitPosInChamber_left.
x();
139 recHitPos = hitPosInChamber_right.
x();
141 if (fabs(hitPosInChamber_left.
y() - segmentPos) < fabs(hitPosInChamber_right.
y() - segmentPos))
142 recHitPos = hitPosInChamber_left.
y();
144 recHitPos = hitPosInChamber_right.
y();
157 float recHitPos = -1;
159 recHitPos = recHitPosInChamber.
x();
161 recHitPos = recHitPosInChamber.
y();
168 bool computeResidual =
true;
171 vector<DTRecHit1D> recHits1D_S3;
178 if (phiRecHits.size() < 7) {
179 LogTrace(
"DTCalibValidationFromMuons") <<
"[DTCalibValidationFromMuons] Phi segments has: " << phiRecHits.size()
180 <<
" hits, skipping";
181 computeResidual =
false;
183 copy(phiRecHits.begin(), phiRecHits.end(), back_inserter(recHits1D_S3));
186 LogTrace(
"DTCalibValidationFromMuons") <<
" [DTCalibValidationFromMuons] 4D segment has no phi segment! ";
187 computeResidual =
false;
194 if (zRecHits.size() != 4) {
195 LogTrace(
"DTCalibValidationFromMuons") <<
"[DTCalibValidationFromMuons] Theta segments has: " << zRecHits.size()
196 <<
" hits, skipping";
197 computeResidual =
false;
199 copy(zRecHits.begin(), zRecHits.end(), back_inserter(recHits1D_S3));
202 LogTrace(
"DTCalibValidationFromMuons") <<
" [DTCalibValidationFromMuons] 4D segment has not the z segment! ";
203 computeResidual =
false;
207 if (!computeResidual)
210 if (computeResidual) {
214 for (vector<DTRecHit1D>::const_iterator recHit1D = recHits1D_S3.begin(); recHit1D != recHits1D_S3.end();
216 const DTWireId wireId = (*recHit1D).wireId();
220 float wireX =
layer->specificTopology().wirePosition(wireId.
wire());
226 LocalPoint wirePosInLay(wireX, (*recHit1D).localPosition().y(), (*recHit1D).localPosition().z());
237 float SegmDistance = -1;
238 if (sl == 1 || sl == 3) {
240 SegmDistance = fabs(wirePosInChamber.
x() - segPosAtZWire.
x());
241 LogTrace(
"DTCalibValidationFromMuons") <<
"SegmDistance: " << SegmDistance;
242 }
else if (sl == 2) {
244 SegmDistance = fabs(segPosAtZWire.
y() - wirePosInChamber.
y());
245 LogTrace(
"DTCalibValidationFromMuons") <<
"SegmDistance: " << SegmDistance;
248 if (SegmDistance > 2.1)
249 LogTrace(
"DTCalibValidationFromMuons") <<
" Warning: dist segment-wire: " << SegmDistance;
253 LogTrace(
"DTCalibValidationFromMuons") <<
"recHitWireDist: " << recHitWireDist;
256 float residualOnDistance = recHitWireDist - SegmDistance;
257 LogTrace(
"DTCalibValidationFromMuons") <<
"WireId: " << wireId <<
" ResidualOnDistance: " << residualOnDistance;
258 float residualOnPosition = -1;
259 float recHitPos = -1;
260 if (sl == 1 || sl == 3) {
262 residualOnPosition = recHitPos - segPosAtZWire.
x();
265 residualOnPosition = recHitPos - segPosAtZWire.
y();
267 LogTrace(
"DTCalibValidationFromMuons") <<
"WireId: " << wireId <<
" ResidualOnPosition: " << residualOnPosition;
270 if (sl == 1 || sl == 3)
274 (wirePosInChamber.
x() - segPosAtZWire.
x()),
281 (wirePosInChamber.
y() - segPosAtZWire.
y()),
297 vector<const DTChamber *>::const_iterator ch_it =
dtGeom->
chambers().begin();
298 vector<const DTChamber *>::const_iterator ch_end =
dtGeom->
chambers().end();
299 for (; ch_it != ch_end; ++ch_it) {
300 vector<const DTSuperLayer *>::const_iterator sl_it = (*ch_it)->superLayers().begin();
301 vector<const DTSuperLayer *>::const_iterator sl_end = (*ch_it)->superLayers().end();
303 for (; sl_it != sl_end; ++sl_it) {
304 slId = (*sl_it)->id();
310 LogTrace(
"DTCalibValidationFromMuons") <<
" Booking histos for SL: " << slId;
319 stringstream superLayer;
325 string slHistoName =
"_STEP" + Step.str() +
"_W" +
wheel.str() +
"_St" +
station.str() +
"_Sec" + sector.str() +
326 "_SL" + superLayer.str();
329 "/Sector" + sector.str());
331 vector<MonitorElement *>
histos;
334 "hResDist" + slHistoName,
"Residuals on the distance from wire (rec_hit - segm_extr) (cm)", 200, -0.4, 0.4));
335 histos.push_back(ibooker.
book2D(
"hResDistVsDist" + slHistoName,
336 "Residuals on the distance (cm) from wire (rec_hit " 337 "- segm_extr) vs distance (cm)",
356 histos[0]->Fill(residualOnDistance);
Log< level::Info, true > LogVerbatim
int station() const
Return the station number.
void analyze(const edm::Event &event, const edm::EventSetup &setup) override
std::pair< const_iterator, const_iterator > range
iterator range
int wire() const
Return the wire number.
virtual void setCurrentFolder(std::string const &fullpath)
T const * product() const
LocalVector localDirection() const override
Local direction in Chamber frame.
void fillHistos(DTSuperLayerId slId, float distance, float residualOnDistance, float position, float residualOnPosition, int step)
float recHitPosition(const DTRecHit1DPair &hitPair, const DTLayer *layer, const DTChamber *chamber, float segmPos, int sl)
DTCalibValidationFromMuons(const edm::ParameterSet &pset)
Constructor.
LocalPoint localPosition() const override
int dimension() const override
Dimension (in parameter space)
edm::ParameterSet parameters
edm::EDGetTokenT< reco::MuonCollection > muonToken_
LocalPoint localPosition() const override
Local position in Chamber frame.
const DTSLRecSegment2D * zSegment() const
The Z segment: 0 if not zed projection available.
void dqmBeginRun(const edm::Run &r, const edm::EventSetup &c) override
BeginRun.
constexpr std::array< uint8_t, layerIndexSize > layer
void compute(const DTGeometry *dtGeom, const DTRecSegment4D &segment)
T getUntrackedParameter(std::string const &, T const &) const
C::const_iterator const_iterator
constant access iterator type
float recHitDistFromWire(const DTRecHit1DPair &hitPair, const DTLayer *layer)
Cos< T >::type cos(const T &t)
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
std::map< std::pair< DTSuperLayerId, int >, std::vector< MonitorElement * > > histosPerSL
int superlayer() const
Return the superlayer number (deprecated method name)
edm::ESGetToken< DTGeometry, MuonGeometryRecord > muonGeomToken_
const DTChamberRecSegment2D * phiSegment() const
The superPhi segment: 0 if no phi projection available.
std::vector< DTRecHit1D > specificRecHits() const
Access to specific components.
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
~DTCalibValidationFromMuons() override
Destructor.
int wheel() const
Return the wheel number.
static int position[264][3]
DTSuperLayerId superlayerId() const
Return the corresponding SuperLayerId.
const std::vector< const DTChamber * > & chambers() const
Return a vector of all Chamber.
const DTGeometry * dtGeom
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
edm::EDGetTokenT< DTRecSegment4DCollection > segment4DToken_
const DTChamber * chamber(const DTChamberId &id) const
Return a DTChamber given its id.
Geom::Theta< T > theta() const
const DTLayer * layer(const DTLayerId &id) const
Return a layer given its id.