#include <Alignment/OfflineValidation/interface/TrackerValidationVariables.h>
Public Member Functions | |
void | fillHitQuantities (const edm::Event &, std::vector< AVHitStruct > &v_avhitout) |
void | fillTrackQuantities (const edm::Event &, std::vector< AVTrackStruct > &v_avtrackout) |
TrackerValidationVariables (const edm::EventSetup &, const edm::ParameterSet &) | |
TrackerValidationVariables () | |
~TrackerValidationVariables () | |
Private Attributes | |
const edm::ParameterSet | conf_ |
double | fBfield |
edm::ESHandle< TrackerGeometry > | tkgeom |
Classes | |
struct | AVHitStruct |
struct | AVTrackStruct |
Definition at line 14 of file TrackerValidationVariables.h.
TrackerValidationVariables::TrackerValidationVariables | ( | ) |
TrackerValidationVariables::TrackerValidationVariables | ( | const edm::EventSetup & | es, | |
const edm::ParameterSet & | iSetup | |||
) |
Definition at line 47 of file TrackerValidationVariables.cc.
References edm::EventSetup::get(), and tkgeom.
00048 : conf_(iSetup), fBfield(4.06) 00049 { 00050 es.get<TrackerDigiGeometryRecord>().get( tkgeom ); 00051 //es.get<SiStripDetCablingRcd>().get( SiStripDetCabling_ ); 00052 }
TrackerValidationVariables::~TrackerValidationVariables | ( | ) |
void TrackerValidationVariables::fillHitQuantities | ( | const edm::Event & | iEvent, | |
std::vector< AVHitStruct > & | v_avhitout | |||
) |
Definition at line 57 of file TrackerValidationVariables.cc.
References conf_, deltaPhi(), dPhi(), err1, err2, edm::Event::getByLabel(), edm::ParameterSet::getParameter(), TrajectoryStateOnSurface::globalDirection(), TrajectoryStateOnSurface::globalPosition(), it, TrajectoryStateOnSurface::localError(), RadialStripTopology::localPitch(), TrajectoryStateOnSurface::localPosition(), LogDebug, RadialStripTopology::measurementError(), RadialStripTopology::measurementPosition(), RadialStripTopology::originToIntersection(), TrackerValidationVariables::AVHitStruct::overlapres, PV3DBase< T, PVType, FrameType >::phi(), TrackerValidationVariables::AVHitStruct::phi, PixelSubdetector::PixelBarrel, PixelSubdetector::PixelEndcap, LocalTrajectoryError::positionError(), dttmaxenums::R, TrackerValidationVariables::AVHitStruct::rawDetId, DetId::rawId(), res, TrackerValidationVariables::AVHitStruct::resErrX, TrackerValidationVariables::AVHitStruct::resErrY, TrackerValidationVariables::AVHitStruct::resX, TrackerValidationVariables::AVHitStruct::resXprime, TrackerValidationVariables::AVHitStruct::resY, funct::sqrt(), DetId::subdetId(), StripSubdetector::TEC, StripSubdetector::TIB, StripSubdetector::TID, StripSubdetector::TOB, Surface::toGlobal(), GeomDetUnit::topology(), DetId::Tracker, TrackerAlignableId::typeAndLayerFromDetId(), MeasurementError::uu(), PV3DBase< T, PVType, FrameType >::x(), PV2DBase< T, PVType, FrameType >::x(), LocalError::xx(), PV3DBase< T, PVType, FrameType >::y(), RadialStripTopology::yDistanceToIntersection(), LocalError::yy(), and PV3DBase< T, PVType, FrameType >::z().
Referenced by MonitorTrackResiduals::analyze(), and TrackerOfflineValidation::analyze().
00059 { 00060 edm::Handle<std::vector<Trajectory> > trajCollectionHandle; 00061 iEvent.getByLabel(conf_.getParameter<std::string>("trajectoryInput"),trajCollectionHandle); 00062 00063 TrajectoryStateCombiner tsoscomb; 00064 edm::LogVerbatim("TrackerValidationVariables") << "trajColl->size(): " << trajCollectionHandle->size() ; 00065 for(std::vector<Trajectory>::const_iterator it = trajCollectionHandle->begin(), itEnd = trajCollectionHandle->end(); 00066 it!=itEnd;++it){ 00067 std::vector<TrajectoryMeasurement> tmColl = it->measurements(); 00068 for(std::vector<TrajectoryMeasurement>::const_iterator itTraj = tmColl.begin(), itTrajEnd = tmColl.end(); 00069 itTraj != itTrajEnd; ++itTraj) { 00070 00071 00072 if(! itTraj->updatedState().isValid()) continue; 00073 00074 00075 TrajectoryStateOnSurface tsos = tsoscomb( itTraj->forwardPredictedState(), itTraj->backwardPredictedState() ); 00076 TransientTrackingRecHit::ConstRecHitPointer hit = itTraj->recHit(); 00077 if(! hit->isValid() || hit->geographicalId().det() != DetId::Tracker ) { 00078 continue; 00079 } else { 00080 AVHitStruct hitStruct; 00081 const DetId & hit_detId = hit->geographicalId(); 00082 uint IntRawDetID = (hit_detId.rawId()); 00083 uint IntSubDetID = (hit_detId.subdetId()); 00084 00085 if(IntSubDetID == 0 ) 00086 continue; 00087 00088 align::LocalVector res = tsos.localPosition() - hit->localPosition(); 00089 00090 LocalError err1 = tsos.localError().positionError(); 00091 LocalError err2 = hit->localPositionError(); 00092 00093 float errX = std::sqrt( err1.xx() + err2.xx() ); 00094 float errY = std::sqrt( err1.yy() + err2.yy() ); 00095 00096 LogDebug("TrackerValidationVariables") << "Residual x/y " << res.x() << '/' << res.y() 00097 << ", Error x/y " << errX << '/' << errY; 00098 00099 // begin partly copied from Tifanalyser 00100 00101 const GeomDetUnit* detUnit = hit->detUnit(); 00102 double dPhi = -999, dR = -999, dZ = -999, phiorientation = -999; 00103 double R = 0.; 00104 double origintointersect = 0.; 00105 00106 hitStruct.resX = res.x(); 00107 hitStruct.resErrX = errX; 00108 hitStruct.resErrY = errY; 00109 00110 if(detUnit) { 00111 const Surface& surface = hit->detUnit()->surface(); 00112 LocalPoint lPModule(0.,0.,0.), lPhiDirection(1.,0.,0.), lROrZDirection(0.,1.,0.); 00113 GlobalPoint gPModule = surface.toGlobal(lPModule), 00114 gPhiDirection = surface.toGlobal(lPhiDirection), 00115 gROrZDirection = surface.toGlobal(lROrZDirection); 00116 phiorientation = deltaPhi(gPhiDirection.phi(),gPModule.phi()) >= 0 ? +1. : -1.; 00117 00118 dPhi = tsos.globalPosition().phi() - hit->globalPosition().phi(); 00119 00120 if(IntSubDetID == PixelSubdetector::PixelBarrel || IntSubDetID == PixelSubdetector::PixelEndcap || 00121 IntSubDetID == StripSubdetector::TIB || 00122 IntSubDetID == StripSubdetector::TOB) { 00123 hitStruct.resXprime = (res.x())*(phiorientation ); 00124 dZ = gROrZDirection.z() - gPModule.z(); 00125 } else if (IntSubDetID == StripSubdetector::TID || IntSubDetID == StripSubdetector::TEC) { 00126 const RadialStripTopology* theTopol = dynamic_cast<const RadialStripTopology*>(&(detUnit->topology())); 00127 origintointersect = static_cast<float>(theTopol->originToIntersection()); 00128 00129 MeasurementPoint theMeasHitPos = theTopol->measurementPosition(hit->localPosition()); 00130 MeasurementPoint theMeasStatePos = theTopol->measurementPosition(tsos.localPosition()); 00131 Measurement2DVector residual = theMeasStatePos - theMeasHitPos; 00132 00133 MeasurementError theMeasHitErr = theTopol->measurementError(hit->localPosition(),err2); 00134 MeasurementError theMeasStateErr = theTopol->measurementError(tsos.localPosition(),err1); 00135 00136 double localPitch = theTopol->localPitch(hit->localPosition()); 00137 00138 float measErr = std::sqrt( theMeasHitErr.uu()*localPitch*localPitch + theMeasStateErr.uu() ); 00139 R = origintointersect; 00140 dR = theTopol->yDistanceToIntersection( tsos.localPosition().y()) - 00141 theTopol->yDistanceToIntersection( hit->localPosition().y()); 00142 00143 hitStruct.resXprime = residual.x()*localPitch ; 00144 00145 } else { 00146 edm::LogWarning("TrackerValidationVariables") << "@SUB=TrackerValidationVariables::fillHitQuantities" 00147 << "No valid tracker subdetector " << IntSubDetID; 00148 hitStruct.resXprime = -999; 00149 } 00150 00151 } 00152 00153 00154 if(dR != -999) hitStruct.resY = dR; 00155 else if(dZ != -999) hitStruct.resY = res.y() * (dZ >=0.? +1 : -1) ; 00156 else hitStruct.resY = res.y(); 00157 00158 hitStruct.rawDetId = IntRawDetID; 00159 hitStruct.phi = tsos.globalDirection().phi(); 00160 00161 // first try for overlapp residuals 00162 if(itTraj+1 != itTrajEnd) { 00163 TransientTrackingRecHit::ConstRecHitPointer hit2 = (itTraj+1)->recHit(); 00164 TrackerAlignableId ali1, ali2; 00165 if(hit2->isValid() && 00166 ali1.typeAndLayerFromDetId(hit->geographicalId()) == ali2.typeAndLayerFromDetId(hit2->geographicalId()) ) { 00167 TrajectoryStateOnSurface tsos2 = tsoscomb( (itTraj+1)->forwardPredictedState(), (itTraj+1)->backwardPredictedState() ); 00168 align::LocalVector res2 = tsos2.localPosition() - hit2->localPosition(); 00169 float overlapresidual = res2.x() - res.x(); 00170 hitStruct.overlapres = std::make_pair(hit2->geographicalId().rawId(),overlapresidual); 00171 } 00172 } 00173 00174 v_avhitout.push_back(hitStruct); 00175 } 00176 } 00177 } 00178 00179 }
void TrackerValidationVariables::fillTrackQuantities | ( | const edm::Event & | iEvent, | |
std::vector< AVTrackStruct > & | v_avtrackout | |||
) |
Definition at line 182 of file TrackerValidationVariables.cc.
References TrackerValidationVariables::AVTrackStruct::charge, TrackerValidationVariables::AVTrackStruct::chi2, conf_, TrackerValidationVariables::AVTrackStruct::d0, TrackerValidationVariables::AVTrackStruct::dz, TrackerValidationVariables::AVTrackStruct::eta, fBfield, edm::Event::getByLabel(), edm::ParameterSet::getParameter(), i, TrackerValidationVariables::AVTrackStruct::kappa, TrackerValidationVariables::AVTrackStruct::normchi2, TrackerValidationVariables::AVTrackStruct::phi, TrackerValidationVariables::AVTrackStruct::pt, TrackerValidationVariables::AVTrackStruct::px, TrackerValidationVariables::AVTrackStruct::py, and TrackerValidationVariables::AVTrackStruct::pz.
Referenced by TrackerOfflineValidation::analyze().
00184 { 00185 // get track collection from the event 00186 edm::InputTag TkTag = conf_.getParameter<edm::InputTag>("Tracks"); 00187 edm::Handle<reco::TrackCollection> RecoTracks; 00188 iEvent.getByLabel(TkTag,RecoTracks); 00189 edm::LogInfo("TrackInfoAnalyzerExample")<<"track collection size "<< RecoTracks->size(); 00190 00191 // Put here all track based quantities such as eta, phi, pt,.... 00192 int i=0; 00193 for( reco::TrackCollection::const_iterator RecoTrack = RecoTracks->begin(), RecoTrackEnd = RecoTracks->end(); 00194 RecoTrack !=RecoTrackEnd ; ++i, ++RecoTrack) { 00195 AVTrackStruct trackStruct; 00196 trackStruct.pt = RecoTrack->pt(); 00197 trackStruct.px = RecoTrack->px(); 00198 trackStruct.py = RecoTrack->py(); 00199 trackStruct.pz = RecoTrack->pz(); 00200 trackStruct.eta = RecoTrack->eta(); 00201 trackStruct.phi = RecoTrack->phi(); 00202 trackStruct.chi2 = RecoTrack->chi2(); 00203 trackStruct.normchi2 = RecoTrack->normalizedChi2(); 00204 trackStruct.kappa = -RecoTrack->charge()*0.002998*fBfield/RecoTrack->pt(); 00205 trackStruct.charge = RecoTrack->charge(); 00206 trackStruct.d0 = RecoTrack->d0(); 00207 trackStruct.dz = RecoTrack->dz(); 00208 v_avtrackout.push_back(trackStruct); 00209 } 00210 00211 }
const edm::ParameterSet TrackerValidationVariables::conf_ [private] |
Definition at line 53 of file TrackerValidationVariables.h.
Referenced by fillHitQuantities(), and fillTrackQuantities().
double TrackerValidationVariables::fBfield [private] |
Definition at line 54 of file TrackerValidationVariables.h.
Referenced by TrackerValidationVariables().