57 theMatcher_ = std::make_unique<MuonSegmentMatcher>(matchParameters, iC);
94 std::vector<const DTRecSegment4D*> dtSegments;
97 for (
auto& segment :
chamber.segmentMatches) {
103 if (!(segment.dtSegmentRef.isNull()))
104 dtSegments.push_back(segment.dtSegmentRef.get());
105 if (!(segment.cscSegmentRef.isNull()))
106 cscSegments.push_back(segment.cscSegmentRef.get());
147 std::vector<double>
x,
y;
148 double invbeta(0), invbetaerr(0);
149 double vertexTime(0), vertexTimeErr(0), vertexTimeR(0), vertexTimeRErr(0);
150 double freeBeta(0), freeBetaErr(0), freeTime(0), freeTimeErr(0);
152 if (tmSeq.
dstnc.size() <= 1)
155 for (
unsigned int i = 0;
i < tmSeq.
dstnc.size();
i++) {
158 x.push_back(tmSeq.
dstnc.at(
i) / 30.);
166 for (
unsigned int i = 0;
i < tmSeq.
dstnc.size();
i++) {
167 diff = (1. + tmSeq.
local_t0.at(
i) / tmSeq.
dstnc.at(
i) * 30.) - invbeta;
169 diff = tmSeq.
local_t0.at(
i) - vertexTime;
171 diff = tmSeq.
local_t0.at(
i) + 2 * tmSeq.
dstnc.at(
i) / 30. - vertexTimeR;
175 double cf = 1. / (tmSeq.
dstnc.size() - 1);
187 rawFit(freeBeta, freeBetaErr, freeTime, freeTimeErr, x, y);
196 double trpc = 0, trpc2 = 0;
202 const std::vector<const RPCRecHit*> rpcHits =
theMatcher_->matchRPC(*staTrack, iEvent);
203 const int nrpc = rpcHits.size();
204 for (
const auto& hitRPC : rpcHits) {
205 const double time = hitRPC->timeError() < 0 ? hitRPC->BunchX() * 25. : hitRPC->time();
207 trpc2 += time *
time;
213 trpc2 = trpc2 / nrpc;
215 const double trpcerr =
sqrt(
std::max(0., trpc2 - trpc * trpc));
231 for (
unsigned int i = 0;
i < dtSeq.
dstnc.size();
i++) {
242 for (
unsigned int i = 0;
i < cscSeq.
dstnc.size();
i++) {
269 double hitWeight = 1 / (emErr * emErr);
274 cmbSeq.
weightInvbeta.push_back(hitDist * hitDist * hitWeight / (30. * 30.));
276 cmbSeq.
dstnc.push_back(hitDist);
286 const std::vector<double>& hitsx,
287 const std::vector<double>& hitsy) {
288 double s = 0,
sx = 0,
sy = 0,
x,
y;
289 double sxx = 0, sxy = 0;
298 if (hitsx.size() == 1) {
301 for (
unsigned int i = 0;
i != hitsx.size();
i++) {
311 double d = s * sxx -
sx *
sx;
312 freeTime = (sxx *
sy - sx * sxy) / d;
313 freeBeta = (s * sxy - sx *
sy) / d;
314 freeBetaErr =
sqrt(sxx / d);
315 freeTimeErr =
sqrt(s / d);
T getParameter(std::string const &) const
void addEcalTime(const reco::Muon &muon, TimeMeasurementSequence &cmbSeq)
bool existsAs(std::string const ¶meterName, bool trackiness=true) const
checks if a parameter exists as a given type
void combineTMSequences(const reco::Muon &muon, const TimeMeasurementSequence &dtSeq, const TimeMeasurementSequence &cscSeq, TimeMeasurementSequence &cmbSeq)
std::vector< double > local_t0
std::unique_ptr< DTTimingExtractor > theDTTimingExtractor_
virtual TrackRef innerTrack() const
void fillRPCTime(const reco::Muon &muon, reco::MuonTime &muTime, edm::Event &iEvent)
void fillTiming(const reco::Muon &muon, reco::MuonTimeExtra &dtTime, reco::MuonTimeExtra &cscTime, reco::MuonTime &rpcTime, reco::MuonTimeExtra &combinedTime, edm::Event &iEvent, const edm::EventSetup &iSetup)
double totalWeightTimeVtx
MuonTimingFiller(const edm::ParameterSet &, edm::ConsumesCollector &&iC)
static const unsigned int BestInStationByDR
float ecal_time
Calorimeter timing.
bool isTrackerMuon() const override
void rawFit(double &a, double &da, double &b, double &db, const std::vector< double > &hitsx, const std::vector< double > &hitsy)
std::unique_ptr< MuonSegmentMatcher > theMatcher_
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
float timeAtIpOutIn
b) particle is moving from outside in
int nDof
number of muon stations used
std::vector< double > weightInvbeta
bool isNull() const
Checks for null.
void fillTimeFromMeasurements(const TimeMeasurementSequence &tmSeq, reco::MuonTimeExtra &muTime)
bool isEnergyValid() const
TrackRef standAloneMuon() const override
reference to a stand-alone muon Track
std::unique_ptr< CSCTimingExtractor > theCSCTimingExtractor_
MuonEnergy calEnergy() const
get energy deposition information
float emMax
maximal energy of ECAL crystal in the 5x5 shape
double totalWeightInvbeta
std::vector< double > weightTimeVtx
TrackRef combinedMuon() const override
reference to a stand-alone muon Track
std::vector< MuonChamberMatch > & matches()
get muon matching information
DetId ecal_id
DetId of the central ECAL crystal.
static const unsigned int BelongsToTrackByDR
std::vector< double > dstnc
math::XYZPointF ecal_position
Trajectory position at the calorimeter.