69 LogTrace(
"DTCalibValidation") <<
"[DTCalibValidation] Analyze #Run: " <<
event.id().run() <<
" #Event: " <<
nevent;
72 map<DTWireId, vector<DTRecHit1DPair> > recHitsPerWire_1S;
75 map<DTWireId, vector<DTRecHit1D> > recHitsPerWire_2S;
78 LogTrace(
"DTCalibValidation") <<
" -- DTRecHit S1: begin analysis:";
84 LogTrace(
"DTCalibValidation") <<
" -- DTRecHit S2: begin analysis:";
92 LogTrace(
"DTCalibValidation") <<
" -- DTRecHit S3: begin analysis:";
102 LogTrace(
"DTCalibValidation") <<
"Anlysis on recHit at step 1";
105 LogTrace(
"DTCalibValidation") <<
"Anlysis on recHit at step 2";
109 LogTrace(
"DTCalibValidation") <<
"Anlysis on recHit at step 3";
117 map<DTWireId, vector<DTRecHit1DPair> >
ret;
121 ret[(*rechit).wireId()].push_back(*rechit);
129 map<DTWireId, vector<DTRecHit1D> >
ret;
134 vector<DTRecHit1D> component1DHits = (*segment).specificRecHits();
136 for (vector<DTRecHit1D>::const_iterator
hit = component1DHits.begin();
hit != component1DHits.end(); ++
hit) {
137 ret[(*hit).wireId()].push_back(*
hit);
146 map<DTWireId, vector<DTRecHit1D> >
ret;
151 vector<const TrackingRecHit*> segment2Ds = (*segment).recHits();
153 for (vector<const TrackingRecHit*>::const_iterator segment2D = segment2Ds.begin(); segment2D != segment2Ds.end();
156 vector<const TrackingRecHit*>
hits = (*segment2D)->recHits();
158 for (vector<const TrackingRecHit*>::const_iterator
hit =
hits.begin();
hit !=
hits.end(); ++
hit) {
169 template <
typename type>
173 const float segmDist) {
175 const type* theBestRecHit =
nullptr;
179 if (fabs(distTmp - segmDist) <
res) {
180 res = fabs(distTmp - segmDist);
181 theBestRecHit = &(*recHit);
185 return theBestRecHit;
195 return fabs(
recHit.localPosition().x() -
layer->specificTopology().wirePosition(
recHit.wireId().wire()));
207 float recHitPos = -1;
209 if (fabs(hitPosInChamber_left.
x() - segmentPos) < fabs(hitPosInChamber_right.
x() - segmentPos))
210 recHitPos = hitPosInChamber_left.
x();
212 recHitPos = hitPosInChamber_right.
x();
214 if (fabs(hitPosInChamber_left.
y() - segmentPos) < fabs(hitPosInChamber_right.
y() - segmentPos))
215 recHitPos = hitPosInChamber_left.
y();
217 recHitPos = hitPosInChamber_right.
y();
230 float recHitPos = -1;
232 recHitPos = recHitPosInChamber.
x();
234 recHitPos = recHitPosInChamber.
y();
240 template <
typename type>
245 bool computeResidual =
true;
248 vector<DTRecHit1D> recHits1D_S3;
255 if (phiRecHits.size() != 8) {
256 LogTrace(
"DTCalibValidation") <<
"[DTCalibValidation] Phi segments has: " << phiRecHits.size()
257 <<
" hits, skipping";
258 computeResidual =
false;
260 copy(phiRecHits.begin(), phiRecHits.end(), back_inserter(recHits1D_S3));
263 LogTrace(
"DTCalibValidation") <<
" [DTCalibValidation] 4D segment has not the phi segment! ";
264 computeResidual =
false;
271 if (zRecHits.size() != 4) {
272 LogTrace(
"DTCalibValidation") <<
"[DTCalibValidation] Theta segments has: " << zRecHits.size()
273 <<
" hits, skipping";
274 computeResidual =
false;
276 copy(zRecHits.begin(), zRecHits.end(), back_inserter(recHits1D_S3));
279 LogTrace(
"DTCalibValidation") <<
" [DTCalibValidation] 4D segment has not the z segment! ";
280 computeResidual =
false;
284 if (!computeResidual)
286 if (computeResidual) {
289 for (vector<DTRecHit1D>::const_iterator recHit1D = recHits1D_S3.begin(); recHit1D != recHits1D_S3.end();
291 const DTWireId wireId = (*recHit1D).wireId();
295 float wireX =
layer->specificTopology().wirePosition(wireId.
wire());
300 LocalPoint wirePosInLay(wireX, (*recHit1D).localPosition().y(), (*recHit1D).localPosition().z());
311 float SegmDistance = -1;
312 if (sl == 1 || sl == 3) {
314 SegmDistance = fabs(wirePosInChamber.
x() - segPosAtZWire.
x());
315 LogTrace(
"DTCalibValidation") <<
"SegmDistance: " << SegmDistance;
316 }
else if (sl == 2) {
318 SegmDistance = fabs(segPosAtZWire.
y() - wirePosInChamber.
y());
319 LogTrace(
"DTCalibValidation") <<
"SegmDistance: " << SegmDistance;
321 if (SegmDistance > 2.1)
322 LogTrace(
"DTCalibValidation") <<
" Warning: dist segment-wire: " << SegmDistance;
325 if (recHitsPerWire.find(wireId) == recHitsPerWire.end()) {
326 LogTrace(
"DTCalibValidation") <<
" No RecHit found at Step: " <<
step <<
" in cell: " << wireId;
328 const vector<type>&
recHits = recHitsPerWire.at(wireId);
330 <<
" in channel: " << wireId;
338 LogTrace(
"DTCalibValidation") <<
"recHitWireDist: " << recHitWireDist;
341 float residualOnDistance = recHitWireDist - SegmDistance;
342 LogTrace(
"DTCalibValidation") <<
"WireId: " << wireId <<
" ResidualOnDistance: " << residualOnDistance;
343 float residualOnPosition = -1;
344 float recHitPos = -1;
345 if (sl == 1 || sl == 3) {
347 residualOnPosition = recHitPos - segPosAtZWire.
x();
350 residualOnPosition = recHitPos - segPosAtZWire.
y();
352 LogTrace(
"DTCalibValidation") <<
"WireId: " << wireId <<
" ResidualOnPosition: " << residualOnPosition;
355 if (sl == 1 || sl == 3)
359 (wirePosInChamber.
x() - segPosAtZWire.
x()),
366 (wirePosInChamber.
y() - segPosAtZWire.
y()),
383 vector<const DTChamber*>::const_iterator ch_it =
dtGeom->
chambers().begin();
384 vector<const DTChamber*>::const_iterator ch_end =
dtGeom->
chambers().end();
385 for (; ch_it != ch_end; ++ch_it) {
386 vector<const DTSuperLayer*>::const_iterator sl_it = (*ch_it)->superLayers().begin();
387 vector<const DTSuperLayer*>::const_iterator sl_end = (*ch_it)->superLayers().end();
389 for (; sl_it != sl_end; ++sl_it) {
390 slId = (*sl_it)->id();
397 LogTrace(
"DTCalibValidation") <<
" Booking histos for SL: " << slId;
412 string slHistoName =
"_STEP" +
Step.str() +
"_W" +
wheel.str() +
"_St" +
station.str() +
"_Sec" +
sector.str() +
418 vector<MonitorElement*>
histos;
421 "hResDist" + slHistoName,
"Residuals on the distance from wire (rec_hit - segm_extr) (cm)", 200, -0.4, 0.4));
423 ibooker.
book2D(
"hResDistVsDist" + slHistoName,
424 "Residuals on the distance (cm) from wire (rec_hit - segm_extr) vs distance (cm)",
432 histos.push_back(ibooker.
book1D(
"hResPos" + slHistoName,
433 "Residuals on the position from wire (rec_hit - segm_extr) (cm)",
438 ibooker.
book2D(
"hResPosVsPos" + slHistoName,
439 "Residuals on the position (cm) from wire (rec_hit - segm_extr) vs distance (cm)",
459 histos[0]->Fill(residualOnDistance);
462 histos[2]->Fill(residualOnPosition);
Log< level::Info, true > LogVerbatim
int station() const
Return the station number.
const DTGeometry * dtGeom
float recHitDistFromWire(const DTRecHit1DPair &hitPair, const DTLayer *layer)
int wire() const
Return the wire number.
virtual void setCurrentFolder(std::string const &fullpath)
ret
prodAgent to be discontinued
T const * product() const
LocalVector localDirection() const override
Local direction in Chamber frame.
LocalPoint localPosition() const override
int dimension() const override
Dimension (in parameter space)
LocalPoint localPosition() const override
Local position in Chamber frame.
const DTSLRecSegment2D * zSegment() const
The Z segment: 0 if not zed projection available.
T getUntrackedParameter(std::string const &, T const &) const
void compute(const DTGeometry *dtGeom, const DTRecSegment4D &segment, const std::map< DTWireId, std::vector< type > > &recHitsPerWire, int step)
C::const_iterator const_iterator
constant access iterator type
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
edm::EDGetTokenT< DTRecSegment4DCollection > segment4DToken_
Cos< T >::type cos(const T &t)
std::map< DTWireId, std::vector< DTRecHit1DPair > > map1DRecHitsPerWire(const DTRecHitCollection *dt1DRecHitPairs)
void fillHistos(DTSuperLayerId slId, float distance, float residualOnDistance, float position, float residualOnPosition, int step)
~DTCalibValidation() override
Destructor.
int superlayer() const
Return the superlayer number (deprecated method name)
void analyze(const edm::Event &event, const edm::EventSetup &setup) override
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())
edm::EDGetTokenT< DTRecHitCollection > recHits1DToken_
edm::ESGetToken< DTGeometry, MuonGeometryRecord > muonGeomToken_
int wheel() const
Return the wheel number.
DTWireId wireId() const
Return the wireId.
void dqmBeginRun(const edm::Run &r, const edm::EventSetup &c) override
BeginRun.
static int position[264][3]
std::map< std::pair< DTSuperLayerId, int >, std::vector< MonitorElement * > > histosPerSL
DTCalibValidation(const edm::ParameterSet &pset)
Constructor.
edm::ParameterSet parameters
const std::vector< const DTChamber * > & chambers() const
Return a vector of all Chamber.
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
float recHitPosition(const DTRecHit1DPair &hitPair, const DTLayer *layer, const DTChamber *chamber, float segmPos, int sl)
const DTChamber * chamber(const DTChamberId &id) const
Return a DTChamber given its id.
Geom::Theta< T > theta() const
const type * findBestRecHit(const DTLayer *layer, DTWireId wireId, const std::vector< type > &recHits, const float simHitDist)
edm::EDGetTokenT< DTRecSegment2DCollection > segment2DToken_
const DTLayer * layer(const DTLayerId &id) const
Return a layer given its id.