55 theMatcher_ = std::make_unique<MuonSegmentMatcher>(matchParameters, iC);
83 if (!(
muon.combinedMuon().isNull())) {
87 if (!(
muon.standAloneMuon().isNull())) {
91 if (
muon.isTrackerMuon()) {
92 std::vector<const DTRecSegment4D*> dtSegments;
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++) {
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();
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++) {
253 if (
muon.isEnergyValid())
254 muonE =
muon.calEnergy();
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);
T getParameter(std::string const &) const
void addEcalTime(const reco::Muon &muon, TimeMeasurementSequence &cmbSeq)
void combineTMSequences(const reco::Muon &muon, const TimeMeasurementSequence &dtSeq, const TimeMeasurementSequence &cscSeq, TimeMeasurementSequence &cmbSeq)
std::vector< double > local_t0
std::unique_ptr< DTTimingExtractor > theDTTimingExtractor_
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
bool existsAs(std::string const ¶meterName, bool trackiness=true) const
checks if a parameter exists as a given type
MuonTimingFiller(const edm::ParameterSet &, edm::ConsumesCollector &&iC)
static const unsigned int BestInStationByDR
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_
float timeAtIpOutIn
b) particle is moving from outside in
int nDof
number of muon stations used
std::vector< double > weightInvbeta
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
bool isNull() const
Checks for null.
void fillTimeFromMeasurements(const TimeMeasurementSequence &tmSeq, reco::MuonTimeExtra &muTime)
std::unique_ptr< CSCTimingExtractor > theCSCTimingExtractor_
float emMax
maximal energy of ECAL crystal in the 5x5 shape
double totalWeightInvbeta
std::vector< double > weightTimeVtx
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.