71 CSCSegmentTags_(iConfig.getParameter<edm::InputTag>(
"CSCsegments")),
72 thePruneCut_(iConfig.getParameter<double>(
"PruneCut")),
73 theStripTimeOffset_(iConfig.getParameter<double>(
"CSCStripTimeOffset")),
74 theWireTimeOffset_(iConfig.getParameter<double>(
"CSCWireTimeOffset")),
75 theStripError_(iConfig.getParameter<double>(
"CSCStripError")),
76 theWireError_(iConfig.getParameter<double>(
"CSCWireError")),
77 UseWireTime(iConfig.getParameter<bool>(
"UseWireTime")),
78 UseStripTime(iConfig.getParameter<bool>(
"UseStripTime")),
79 debug(iConfig.getParameter<bool>(
"debug"))
107 std::cout <<
" *** CSC Timimng Extractor ***" << std::endl;
119 double totalWeightInvbeta=0;
120 double totalWeightVertex=0;
121 std::vector<TimeMeasurement> tms;
126 if (
sqrt(muonTrack->innerPosition().mag2()) >
sqrt(muonTrack->outerPosition().mag2())){
127 pos=muonTrack->outerPosition();
128 mom=-1*muonTrack->outerMomentum();
139 for (std::vector<const CSCSegment*>::iterator rechit = range.begin(); rechit!=range.end();++rechit) {
142 DetId id = (*rechit)->geographicalId();
146 if (!(*rechit)->specificRecHits().size())
continue;
148 const std::vector<CSCRecHit2D> hits2d = (*rechit)->specificRecHits();
151 for (std::vector<CSCRecHit2D>::const_iterator hiti=hits2d.begin(); hiti!=hits2d.end(); hiti++) {
153 const GeomDet* cscDet = theTrackingGeometry->
idToDet(hiti->geographicalId());
156 std::pair< TrajectoryStateOnSurface, double> tsos;
160 if (tsos.first.isValid()) dist = tsos.second+posp.mag();
161 else dist = cscDet->
toGlobal(hiti->localPosition()).
mag();
168 tms.push_back(thisHit);
175 tms.push_back(thisHit);
185 bool modified =
false;
186 std::vector <double> dstnc, dsegm, dtraj, hitWeightInvbeta, hitWeightVertex;
195 hitWeightInvbeta.clear();
196 hitWeightVertex.clear();
198 totalWeightInvbeta=0;
201 for (std::vector<TimeMeasurement>::iterator tm=tms.begin(); tm!=tms.end(); ++tm) {
202 dstnc.push_back(tm->distIP);
203 dsegm.push_back(tm->timeCorr);
204 hitWeightInvbeta.push_back(tm->weightInvbeta);
205 hitWeightVertex.push_back(tm->weightVertex);
206 totalWeightInvbeta+=tm->weightInvbeta;
207 totalWeightVertex+=tm->weightVertex;
210 if (totalWeightInvbeta==0)
break;
214 std::cout <<
" Points for global fit: " << dstnc.size() << std::endl;
218 for (
unsigned int i=0;
i<dstnc.size();
i++)
219 invbeta+=(1.+dsegm.at(
i)/dstnc.at(
i)*30.)*hitWeightInvbeta.at(
i)/totalWeightInvbeta;
222 std::vector<TimeMeasurement>::iterator tmmax;
226 for (
unsigned int i=0;
i<dstnc.size();
i++) {
227 diff=(1.+dsegm.at(
i)/dstnc.at(
i)*30.)-invbeta;
228 diff=diff*diff*hitWeightInvbeta.at(
i);
236 invbetaerr=
sqrt(invbetaerr/totalWeightInvbeta);
245 std::cout <<
" Measured 1/beta: " << invbeta <<
" +/- " << invbetaerr << std::endl;
251 for (
unsigned int i=0;
i<dstnc.size();
i++) {
252 tmSequence.
dstnc.push_back(dstnc.at(
i));
253 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
edm::ESHandle< Propagator > propagator(std::string propagatorName) const
get the propagator