71 thePruneCut_(iConfig.getParameter<double>(
"PruneCut")),
72 theStripTimeOffset_(iConfig.getParameter<double>(
"CSCStripTimeOffset")),
73 theWireTimeOffset_(iConfig.getParameter<double>(
"CSCWireTimeOffset")),
74 theStripError_(iConfig.getParameter<double>(
"CSCStripError")),
75 theWireError_(iConfig.getParameter<double>(
"CSCWireError")),
76 UseWireTime(iConfig.getParameter<bool>(
"UseWireTime")),
77 UseStripTime(iConfig.getParameter<bool>(
"UseStripTime")),
78 debug(iConfig.getParameter<bool>(
"debug"))
106 std::cout <<
" *** CSC Timimng Extractor ***" << std::endl;
118 double totalWeightInvbeta=0;
119 double totalWeightVertex=0;
120 std::vector<TimeMeasurement> tms;
125 if (
sqrt(muonTrack->innerPosition().mag2()) >
sqrt(muonTrack->outerPosition().mag2())){
126 pos=muonTrack->outerPosition();
127 mom=-1*muonTrack->outerMomentum();
138 for (std::vector<const CSCSegment*>::iterator rechit = range.begin(); rechit!=range.end();++rechit) {
141 DetId id = (*rechit)->geographicalId();
145 if (!(*rechit)->specificRecHits().size())
continue;
147 const std::vector<CSCRecHit2D> hits2d = (*rechit)->specificRecHits();
150 for (std::vector<CSCRecHit2D>::const_iterator hiti=hits2d.begin(); hiti!=hits2d.end(); hiti++) {
152 const GeomDet* cscDet = theTrackingGeometry->
idToDet(hiti->geographicalId());
155 std::pair< TrajectoryStateOnSurface, double> tsos;
159 if (tsos.first.isValid()) dist = tsos.second+posp.mag();
160 else dist = cscDet->
toGlobal(hiti->localPosition()).
mag();
167 tms.push_back(thisHit);
174 tms.push_back(thisHit);
184 bool modified =
false;
185 std::vector <double> dstnc, dsegm, dtraj, hitWeightInvbeta, hitWeightVertex;
194 hitWeightInvbeta.clear();
195 hitWeightVertex.clear();
197 totalWeightInvbeta=0;
200 for (std::vector<TimeMeasurement>::iterator tm=tms.begin(); tm!=tms.end(); ++tm) {
201 dstnc.push_back(tm->distIP);
202 dsegm.push_back(tm->timeCorr);
203 hitWeightInvbeta.push_back(tm->weightInvbeta);
204 hitWeightVertex.push_back(tm->weightVertex);
205 totalWeightInvbeta+=tm->weightInvbeta;
206 totalWeightVertex+=tm->weightVertex;
209 if (totalWeightInvbeta==0)
break;
213 std::cout <<
" Points for global fit: " << dstnc.size() << std::endl;
217 for (
unsigned int i=0;
i<dstnc.size();
i++)
218 invbeta+=(1.+dsegm.at(
i)/dstnc.at(
i)*30.)*hitWeightInvbeta.at(
i)/totalWeightInvbeta;
221 std::vector<TimeMeasurement>::iterator tmmax;
225 for (
unsigned int i=0;
i<dstnc.size();
i++) {
226 diff=(1.+dsegm.at(
i)/dstnc.at(
i)*30.)-invbeta;
227 diff=diff*diff*hitWeightInvbeta.at(
i);
235 invbetaerr=
sqrt(invbetaerr/totalWeightInvbeta);
244 std::cout <<
" Measured 1/beta: " << invbeta <<
" +/- " << invbetaerr << std::endl;
250 for (
unsigned int i=0;
i<dstnc.size();
i++) {
251 tmSequence.
dstnc.push_back(dstnc.at(
i));
252 tmSequence.
local_t0.push_back(dsegm.at(
i));
void update(const edm::EventSetup &setup)
update the services each event
T getParameter(std::string const &) const
std::vector< double > local_t0
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
std::vector< const CSCSegment * > matchCSC(const reco::Track &muon, const edm::Event &event)
edm::ESHandle< MagneticField > magneticField() const
get the magnetic field
const Plane & surface() const
The nominal surface of the GeomDet.
virtual const GeomDet * idToDet(DetId) const
edm::ESHandle< GlobalTrackingGeometry > theTrackingGeometry
std::vector< double > weightInvbeta
virtual std::pair< TrajectoryStateOnSurface, double > propagateWithPath(const FreeTrajectoryState &, const Surface &) const final
double totalWeightInvbeta
XYZVectorD XYZVector
spatial vector with cartesian internal representation
XYZPointD XYZPoint
point in space with cartesian internal representation
T const * product() const
edm::ESHandle< GlobalTrackingGeometry > trackingGeometry() const
get the tracking geometry
std::vector< double > dstnc
std::vector< double > weightVertex