55 theMatcher_ = std::make_unique<MuonSegmentMatcher>(matchParameters, iC);
56 theDTTimingExtractor_ = std::make_unique<DTTimingExtractor>(dtTimingParameters, theMatcher_.get(), iC);
92 std::vector<const DTRecSegment4D*> dtSegments;
94 for (
auto& chamber : muon.
matches()) {
95 for (
auto& segment : chamber.segmentMatches) {
101 if (!(segment.dtSegmentRef.isNull()))
102 dtSegments.push_back(segment.dtSegmentRef.get());
103 if (!(segment.cscSegmentRef.isNull()))
104 cscSegments.push_back(segment.cscSegmentRef.get());
145 std::vector<double>
x,
y;
146 double invbeta(0), invbetaerr(0);
147 double vertexTime(0), vertexTimeErr(0), vertexTimeR(0), vertexTimeRErr(0);
148 double freeBeta(0), freeBetaErr(0), freeTime(0), freeTimeErr(0);
150 if (tmSeq.
dstnc.size() <= 1)
153 for (
unsigned int i = 0;
i < tmSeq.
dstnc.size();
i++) {
156 x.push_back(tmSeq.
dstnc.at(
i) / 30.);
164 for (
unsigned int i = 0;
i < tmSeq.
dstnc.size();
i++) {
165 diff = (1. + tmSeq.
local_t0.at(
i) / tmSeq.
dstnc.at(
i) * 30.) - invbeta;
167 diff = tmSeq.
local_t0.at(
i) - vertexTime;
169 diff = tmSeq.
local_t0.at(
i) + 2 * tmSeq.
dstnc.at(
i) / 30. - vertexTimeR;
173 double cf = 1. / (tmSeq.
dstnc.size() - 1);
185 rawFit(freeBeta, freeBetaErr, freeTime, freeTimeErr, x, y);
194 double trpc = 0, trpc2 = 0;
200 const std::vector<const RPCRecHit*> rpcHits =
theMatcher_->matchRPC(*staTrack, iEvent);
201 const int nrpc = rpcHits.size();
202 for (
const auto& hitRPC : rpcHits) {
203 const double time = hitRPC->timeError() < 0 ? hitRPC->BunchX() * 25. : hitRPC->time();
205 trpc2 += time * time;
211 trpc2 = trpc2 / nrpc;
213 const double trpcerr =
sqrt(
std::max(0., trpc2 - trpc * trpc));
229 for (
unsigned int i = 0;
i < dtSeq.
dstnc.size();
i++) {
240 for (
unsigned int i = 0;
i < cscSeq.
dstnc.size();
i++) {
267 double hitWeight = 1 / (emErr * emErr);
272 cmbSeq.
weightInvbeta.push_back(hitDist * hitDist * hitWeight / (30. * 30.));
274 cmbSeq.
dstnc.push_back(hitDist);
284 const std::vector<double>& hitsx,
285 const std::vector<double>& hitsy) {
286 double s = 0, sx = 0, sy = 0,
x,
y;
287 double sxx = 0, sxy = 0;
296 if (hitsx.size() == 1) {
299 for (
unsigned int i = 0;
i != hitsx.size();
i++) {
309 double d = s * sxx - sx * sx;
310 freeTime = (sxx * sy - sx * sxy) / d;
311 freeBeta = (s * sxy - sx * sy) / d;
312 freeBetaErr =
sqrt(sxx / d);
313 freeTimeErr =
sqrt(s / d);
void addEcalTime(const reco::Muon &muon, TimeMeasurementSequence &cmbSeq)
TrackRef combinedMuon() const override
reference to a stand-alone muon Track
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
bool isTrackerMuon() const override
float ecal_time
Calorimeter timing.
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
TrackRef standAloneMuon() const override
reference to a stand-alone muon Track
bool isNull() const
Checks for null.
void fillTimeFromMeasurements(const TimeMeasurementSequence &tmSeq, reco::MuonTimeExtra &muTime)
bool isEnergyValid() const
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
T getParameter(std::string const &) const
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.