72 CSCSegmentTags_(iConfig.getParameter<edm::InputTag>(
"CSCsegments")),
73 thePruneCut_(iConfig.getParameter<double>(
"PruneCut")),
74 theTimeOffset_(iConfig.getParameter<double>(
"CSCTimeOffset")),
75 debug(iConfig.getParameter<bool>(
"debug"))
103 std::cout <<
" *** CSC Timimng Extractor ***" << std::endl;
116 std::vector<TimeMeasurement> tms;
128 for (std::vector<const CSCSegment*>::iterator rechit = range.begin(); rechit!=range.end();++rechit) {
131 DetId id = (*rechit)->geographicalId();
135 if (!(*rechit)->specificRecHits().size())
continue;
137 const std::vector<CSCRecHit2D> hits2d = (*rechit)->specificRecHits();
140 for (std::vector<CSCRecHit2D>::const_iterator hiti=hits2d.begin(); hiti!=hits2d.end(); hiti++) {
142 const GeomDet* cscDet = theTrackingGeometry->
idToDet(hiti->geographicalId());
145 std::pair< TrajectoryStateOnSurface, double> tsos;
149 if (tsos.first.isValid()) dist = tsos.second+posp.mag();
150 else dist = cscDet->
toGlobal(hiti->localPosition()).
mag();
155 tms.push_back(thisHit);
163 bool modified =
false;
164 std::vector <double> dstnc, dsegm, dtraj, hitWeight;
177 for (std::vector<TimeMeasurement>::iterator tm=tms.begin(); tm!=tms.end(); ++tm) {
178 dstnc.push_back(tm->distIP);
179 dsegm.push_back(tm->timeCorr);
180 hitWeight.push_back(1.);
184 if (totalWeight==0)
break;
188 std::cout <<
" Points for global fit: " << dstnc.size() << std::endl;
192 for (
unsigned int i=0;
i<dstnc.size();
i++)
193 invbeta+=(1.+dsegm.at(
i)/dstnc.at(
i)*30.)*hitWeight.at(
i)/totalWeight;
196 std::vector<TimeMeasurement>::iterator tmmax;
200 for (
unsigned int i=0;
i<dstnc.size();
i++) {
201 diff=(1.+dsegm.at(
i)/dstnc.at(
i)*30.)-invbeta;
202 diff=diff*diff*hitWeight.at(
i);
204 if (diff/totalWeight>chimax) {
210 invbetaerr=
sqrt(invbetaerr/totalWeight);
219 std::cout <<
" Measured 1/beta: " << invbeta <<
" +/- " << invbetaerr << std::endl;
225 for (
unsigned int i=0;
i<dstnc.size();
i++) {
226 tmSequence.
dstnc.push_back(dstnc.at(
i));
227 tmSequence.
local_t0.push_back(dsegm.at(
i));
228 tmSequence.
weight.push_back(hitWeight.at(
i));
void update(const edm::EventSetup &setup)
update the services each event
T getParameter(std::string const &) const
std::vector< double > local_t0
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
std::vector< double > weight
virtual const GeomDet * idToDet(DetId) const
virtual std::pair< TrajectoryStateOnSurface, double > propagateWithPath(const FreeTrajectoryState &, const Surface &) const
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
edm::ESHandle< GlobalTrackingGeometry > theTrackingGeometry
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
virtual const BoundPlane & surface() const
The nominal surface of the GeomDet.