72 CSCSegmentTags_(iConfig.getParameter<edm::InputTag>(
"CSCsegments")),
73 thePruneCut_(iConfig.getParameter<double>(
"PruneCut")),
74 theStripTimeOffset_(iConfig.getParameter<double>(
"CSCStripTimeOffset")),
75 theWireTimeOffset_(iConfig.getParameter<double>(
"CSCWireTimeOffset")),
76 theStripError_(iConfig.getParameter<double>(
"CSCStripError")),
77 theWireError_(iConfig.getParameter<double>(
"CSCWireError")),
78 UseWireTime(iConfig.getParameter<bool>(
"UseWireTime")),
79 UseStripTime(iConfig.getParameter<bool>(
"UseStripTime")),
80 debug(iConfig.getParameter<bool>(
"debug"))
108 std::cout <<
" *** CSC Timimng Extractor ***" << std::endl;
120 double totalWeightInvbeta=0;
121 double totalWeightVertex=0;
122 std::vector<TimeMeasurement> tms;
127 if (
sqrt(muonTrack->innerPosition().mag2()) >
sqrt(muonTrack->outerPosition().mag2())){
128 pos=muonTrack->outerPosition();
129 mom=-1*muonTrack->outerMomentum();
140 for (std::vector<const CSCSegment*>::iterator rechit = range.begin(); rechit!=range.end();++rechit) {
143 DetId id = (*rechit)->geographicalId();
147 if (!(*rechit)->specificRecHits().size())
continue;
149 const std::vector<CSCRecHit2D> hits2d = (*rechit)->specificRecHits();
152 for (std::vector<CSCRecHit2D>::const_iterator hiti=hits2d.begin(); hiti!=hits2d.end(); hiti++) {
154 const GeomDet* cscDet = theTrackingGeometry->
idToDet(hiti->geographicalId());
157 std::pair< TrajectoryStateOnSurface, double> tsos;
161 if (tsos.first.isValid()) dist = tsos.second+posp.mag();
162 else dist = cscDet->
toGlobal(hiti->localPosition()).
mag();
169 tms.push_back(thisHit);
176 tms.push_back(thisHit);
186 bool modified =
false;
187 std::vector <double> dstnc, dsegm, dtraj, hitWeightInvbeta, hitWeightVertex;
196 hitWeightInvbeta.clear();
197 hitWeightVertex.clear();
199 totalWeightInvbeta=0;
202 for (std::vector<TimeMeasurement>::iterator tm=tms.begin(); tm!=tms.end(); ++tm) {
203 dstnc.push_back(tm->distIP);
204 dsegm.push_back(tm->timeCorr);
205 hitWeightInvbeta.push_back(tm->weightInvbeta);
206 hitWeightVertex.push_back(tm->weightVertex);
207 totalWeightInvbeta+=tm->weightInvbeta;
208 totalWeightVertex+=tm->weightVertex;
211 if (totalWeightInvbeta==0)
break;
215 std::cout <<
" Points for global fit: " << dstnc.size() << std::endl;
219 for (
unsigned int i=0;
i<dstnc.size();
i++)
220 invbeta+=(1.+dsegm.at(
i)/dstnc.at(
i)*30.)*hitWeightInvbeta.at(
i)/totalWeightInvbeta;
223 std::vector<TimeMeasurement>::iterator tmmax;
227 for (
unsigned int i=0;
i<dstnc.size();
i++) {
228 diff=(1.+dsegm.at(
i)/dstnc.at(
i)*30.)-invbeta;
229 diff=diff*diff*hitWeightInvbeta.at(
i);
237 invbetaerr=
sqrt(invbetaerr/totalWeightInvbeta);
246 std::cout <<
" Measured 1/beta: " << invbeta <<
" +/- " << invbetaerr << std::endl;
252 for (
unsigned int i=0;
i<dstnc.size();
i++) {
253 tmSequence.
dstnc.push_back(dstnc.at(
i));
254 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
virtual const GeomDet * idToDet(DetId) const
virtual std::pair< TrajectoryStateOnSurface, double > propagateWithPath(const FreeTrajectoryState &, const Surface &) const
edm::ESHandle< GlobalTrackingGeometry > theTrackingGeometry
std::vector< double > weightInvbeta
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
const BoundPlane & surface() const
The nominal surface of the GeomDet.
std::vector< double > dstnc
std::vector< double > weightVertex