354 bool computeResidual =
true;
357 vector<DTRecHit1D> recHits1D_S3;
364 if(phiRecHits.size() != 8) {
365 LogTrace(
"DTCalibValidation") <<
"[DTCalibValidation] Phi segments has: " << phiRecHits.size()
366 <<
" hits, skipping";
367 computeResidual =
false;
369 copy(phiRecHits.begin(), phiRecHits.end(), back_inserter(recHits1D_S3));
372 LogTrace(
"DTCalibValidation") <<
" [DTCalibValidation] 4D segment has not the phi segment! ";
373 computeResidual =
false;
380 if(zRecHits.size() != 4) {
381 LogTrace(
"DTCalibValidation") <<
"[DTCalibValidation] Theta segments has: " << zRecHits.size()
382 <<
" hits, skipping";
383 computeResidual =
false;
385 copy(zRecHits.begin(), zRecHits.end(), back_inserter(recHits1D_S3));
388 LogTrace(
"DTCalibValidation") <<
" [DTCalibValidation] 4D segment has not the z segment! ";
389 computeResidual =
false;
398 for(vector<DTRecHit1D>::const_iterator recHit1D = recHits1D_S3.begin();
399 recHit1D != recHits1D_S3.end();
401 const DTWireId wireId = (*recHit1D).wireId();
410 LocalPoint wirePosInLay(wireX,(*recHit1D).localPosition().y(),(*recHit1D).localPosition().z());
412 const DTChamber* chamber = dtGeom->
chamber((*recHit1D).wireId().layerId().chamberId());
421 float SegmDistance = -1;
422 if(sl == 1 || sl == 3) {
424 SegmDistance = fabs(wirePosInChamber.
x() - segPosAtZWire.
x());
425 LogTrace(
"DTCalibValidation") <<
"SegmDistance: " << SegmDistance;
428 SegmDistance = fabs(segPosAtZWire.
y() - wirePosInChamber.
y());
429 LogTrace(
"DTCalibValidation") <<
"SegmDistance: " << SegmDistance;
431 if(SegmDistance > 2.1)
432 LogTrace(
"DTCalibValidation") <<
" Warning: dist segment-wire: " << SegmDistance;
435 if(recHitsPerWire.find(wireId) == recHitsPerWire.end()) {
436 LogTrace(
"DTCalibValidation") <<
" No RecHit found at Step: " <<
step <<
" in cell: " << wireId;
438 vector<type> recHits = recHitsPerWire[wireId];
439 LogTrace(
"DTCalibValidation") <<
" " << recHits.size() <<
" RecHits, Step " <<
step <<
" in channel: " << wireId;
447 LogTrace(
"DTCalibValidation") <<
"recHitWireDist: " << recHitWireDist;
450 float residualOnDistance = recHitWireDist - SegmDistance;
451 LogTrace(
"DTCalibValidation") <<
"WireId: " << wireId <<
" ResidualOnDistance: " << residualOnDistance;
452 float residualOnPosition = -1;
453 float recHitPos = -1;
454 if(sl == 1 || sl == 3) {
455 recHitPos =
recHitPosition(*theBestRecHit, layer, chamber, segPosAtZWire.
x(), sl);
456 residualOnPosition = recHitPos - segPosAtZWire.
x();
459 recHitPos =
recHitPosition(*theBestRecHit, layer, chamber, segPosAtZWire.
y(), sl);
460 residualOnPosition = recHitPos - segPosAtZWire.
y();
462 LogTrace(
"DTCalibValidation") <<
"WireId: " << wireId <<
" ResidualOnPosition: " << residualOnPosition;
465 if(sl == 1 || sl == 3)
466 fillHistos(wireId.superlayerId(), SegmDistance, residualOnDistance, (wirePosInChamber.
x() - segPosAtZWire.
x()), residualOnPosition,
step);
468 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.
float recHitDistFromWire(const DTRecHit1DPair &hitPair, const DTLayer *layer)
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 DTLayer * layer(DTLayerId id) const
Return a layer given its id.
virtual LocalVector localDirection() const
Local direction in Chamber frame.
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)
virtual LocalPoint localPosition() const
Local position in Chamber frame.
std::vector< DTRecHit1D > specificRecHits() const
Access to specific components.
virtual int dimension() const
Dimension (in parameter space)
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 DTChamber * chamber(DTChamberId id) const
Return a DTChamber 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)