285 bool computeResidual =
true;
288 vector<DTRecHit1D> recHits1D_S3;
295 if(phiRecHits.size() != 8) {
296 LogTrace(
"DTCalibValidation") <<
"[DTCalibValidation] Phi segments has: " << phiRecHits.size()
297 <<
" hits, skipping";
298 computeResidual =
false;
300 copy(phiRecHits.begin(), phiRecHits.end(), back_inserter(recHits1D_S3));
303 LogTrace(
"DTCalibValidation") <<
" [DTCalibValidation] 4D segment has not the phi segment! ";
304 computeResidual =
false;
311 if(zRecHits.size() != 4) {
312 LogTrace(
"DTCalibValidation") <<
"[DTCalibValidation] Theta segments has: " << zRecHits.size()
313 <<
" hits, skipping";
314 computeResidual =
false;
316 copy(zRecHits.begin(), zRecHits.end(), back_inserter(recHits1D_S3));
319 LogTrace(
"DTCalibValidation") <<
" [DTCalibValidation] 4D segment has not the z segment! ";
320 computeResidual =
false;
329 for(vector<DTRecHit1D>::const_iterator recHit1D = recHits1D_S3.begin();
330 recHit1D != recHits1D_S3.end();
332 const DTWireId wireId = (*recHit1D).wireId();
341 LocalPoint wirePosInLay(wireX,(*recHit1D).localPosition().y(),(*recHit1D).localPosition().z());
352 float SegmDistance = -1;
353 if(sl == 1 || sl == 3) {
355 SegmDistance = fabs(wirePosInChamber.
x() - segPosAtZWire.
x());
356 LogTrace(
"DTCalibValidation") <<
"SegmDistance: " << SegmDistance;
359 SegmDistance = fabs(segPosAtZWire.
y() - wirePosInChamber.
y());
360 LogTrace(
"DTCalibValidation") <<
"SegmDistance: " << SegmDistance;
362 if(SegmDistance > 2.1)
363 LogTrace(
"DTCalibValidation") <<
" Warning: dist segment-wire: " << SegmDistance;
366 if(recHitsPerWire.find(wireId) == recHitsPerWire.end()) {
367 LogTrace(
"DTCalibValidation") <<
" No RecHit found at Step: " <<
step <<
" in cell: " << wireId;
369 const vector<type>& recHits = recHitsPerWire.at(wireId);
370 LogTrace(
"DTCalibValidation") <<
" " << recHits.size() <<
" RecHits, Step " <<
step <<
" in channel: " << wireId;
378 LogTrace(
"DTCalibValidation") <<
"recHitWireDist: " << recHitWireDist;
381 float residualOnDistance = recHitWireDist - SegmDistance;
382 LogTrace(
"DTCalibValidation") <<
"WireId: " << wireId <<
" ResidualOnDistance: " << residualOnDistance;
383 float residualOnPosition = -1;
384 float recHitPos = -1;
385 if(sl == 1 || sl == 3) {
386 recHitPos =
recHitPosition(*theBestRecHit, layer, chamber, segPosAtZWire.
x(), sl);
387 residualOnPosition = recHitPos - segPosAtZWire.
x();
390 recHitPos =
recHitPosition(*theBestRecHit, layer, chamber, segPosAtZWire.
y(), sl);
391 residualOnPosition = recHitPos - segPosAtZWire.
y();
393 LogTrace(
"DTCalibValidation") <<
"WireId: " << wireId <<
" ResidualOnPosition: " << residualOnPosition;
396 if(sl == 1 || sl == 3)
397 fillHistos(wireId.superlayerId(), SegmDistance, residualOnDistance, (wirePosInChamber.
x() - segPosAtZWire.
x()), residualOnPosition,
step);
399 fillHistos(wireId.superlayerId(), SegmDistance, residualOnDistance, (wirePosInChamber.
y() - segPosAtZWire.
y()), residualOnPosition,
step);
float wirePosition(int wireNumber) const
Returns the x position in the layer of a given wire number.
int dimension() const override
Dimension (in parameter space)
LocalPoint localPosition() const override
Local position in Chamber frame.
float recHitDistFromWire(const DTRecHit1DPair &hitPair, const DTLayer *layer)
const DTChamber * chamber(const DTChamberId &id) const
Return a DTChamber given its id.
LocalVector localDirection() const override
Local direction in Chamber frame.
const DTChamberRecSegment2D * phiSegment() const
The superPhi segment: 0 if no phi projection available.
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
LocalPoint toLocal(const GlobalPoint &gp) const
Conversion to the R.F. of the GeomDet.
Geom::Theta< T > theta() const
const DTTopology & specificTopology() const
Cos< T >::type cos(const T &t)
void fillHistos(DTSuperLayerId slId, float distance, float residualOnDistance, float position, float residualOnPosition, int step)
std::vector< DTRecHit1D > specificRecHits() const
Access to specific components.
int wire() const
Return the wire number.
int superlayer() const
Return the superlayer number (deprecated method name)
const DTSLRecSegment2D * zSegment() const
The Z segment: 0 if not zed projection available.
const DTLayer * layer(const DTLayerId &id) const
Return a layer given its id.
float recHitPosition(const DTRecHit1DPair &hitPair, const DTLayer *layer, const DTChamber *chamber, float segmPos, int sl)
const type * findBestRecHit(const DTLayer *layer, DTWireId wireId, const std::vector< type > &recHits, const float simHitDist)