57 theMatcher_ = std::make_unique<MuonSegmentMatcher>(matchParameters, iC);
85 if (!(
muon.combinedMuon().isNull())) {
89 if (!(
muon.standAloneMuon().isNull())) {
93 if (
muon.isTrackerMuon()) {
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++) {
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();
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++) {
255 if (
muon.isEnergyValid())
256 muonE =
muon.calEnergy();
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);