45 produces<TrajectorySeedCollection>();
48 theEnableDTFlag =
pset.getParameter<
bool>(
"EnableDTMeasurement");
50 theEnableCSCFlag =
pset.getParameter<
bool>(
"EnableCSCMeasurement");
52 theDTRecSegmentLabel =
pset.getParameter<
InputTag>(
"DTRecSegmentLabel");
54 theCSCRecSegmentLabel =
pset.getParameter<
InputTag>(
"CSCRecSegmentLabel");
57 theMaxSeeds =
pset.getParameter<
int>(
"MaxSeeds");
59 theMaxDTChi2 =
pset.getParameter<
double>(
"MaxDTChi2");
60 theMaxCSCChi2 =
pset.getParameter<
double>(
"MaxCSCChi2");
62 theForcePointDownFlag =
pset.existsAs<
bool>(
"ForcePointDown") ?
pset.getParameter<
bool>(
"ForcePointDown") :
true;
65 theParameters[
"topmb41"] = 0.87;
66 theParameters[
"bottommb41"] = 1.2;
67 theParameters[
"topmb42"] = 0.67;
68 theParameters[
"bottommb42"] = 0.98;
69 theParameters[
"topmb43"] = 0.34;
70 theParameters[
"bottommb43"] = 0.58;
71 theParameters[
"topmb31"] = 0.54;
72 theParameters[
"bottommb31"] = 0.77;
73 theParameters[
"topmb32"] = 0.35;
74 theParameters[
"bottommb32"] = 0.55;
75 theParameters[
"topmb21"] = 0.21;
76 theParameters[
"bottommb21"] = 0.31;
80 theCSCRecSegmentLabel,
96 delete muonMeasurements;
103 auto output = std::make_unique<TrajectorySeedCollection>();
113 vector<const DetLayer*> dtLayers = theMuonLayers->allDTLayers();
116 vector<const DetLayer*> cscForwardLayers = theMuonLayers->forwardCSCLayers();
117 vector<const DetLayer*> cscBackwardLayers = theMuonLayers->backwardCSCLayers();
119 muonMeasurements->setEvent(
event);
123 vector<MuonRecHitContainer> RHMBs;
124 vector<MuonRecHitContainer> RHMEFs;
125 vector<MuonRecHitContainer> RHMEBs;
129 for (vector<const DetLayer*>::reverse_iterator icsclayer = cscForwardLayers.rbegin();
130 icsclayer != cscForwardLayers.rend() - 1;
133 allHits.insert(allHits.end(), RHMF.begin(), RHMF.end());
136 for (vector<const DetLayer*>::reverse_iterator icsclayer = cscBackwardLayers.rbegin();
137 icsclayer != cscBackwardLayers.rend() - 1;
140 allHits.insert(allHits.end(), RHMF.begin(), RHMF.end());
143 for (vector<const DetLayer*>::reverse_iterator idtlayer = dtLayers.rbegin(); idtlayer != dtLayers.rend();
146 RHMBs.push_back(RHMB);
148 if (idtlayer != dtLayers.rbegin())
149 allHits.insert(allHits.end(), RHMB.begin(), RHMB.end());
163 createSeeds(
seeds, mb42, eSetup);
169 createSeeds(
seeds, mb31, eSetup);
174 if (!allHits.empty()) {
178 if (goodhits.empty()) {
182 createSeeds(
seeds, allHits, eSetup);
185 createSeeds(
seeds, goodhits, eSetup);
206 if (
hit->dimension() < 4) {
211 if (
hit->isDT() && (
hit->chi2() > theMaxDTChi2)) {
214 }
else if (
hit->isCSC() && (
hit->chi2() > theMaxCSCChi2)) {
226 for (MuonRecHitContainer::const_iterator
hit =
hits.begin();
hit !=
hits.end();
hit++) {
227 if (checkQuality(*
hit))
240 if (!(*hit)->isValid())
245 for (MuonRecHitContainer::iterator hit2 =
hit + 1; hit2 !=
result.end(); hit2++) {
246 if (*hit2 ==
nullptr)
248 if (!(*hit2)->isValid())
254 if (!areCorrelated((*
hit), (*hit2)))
257 if (!leftIsBetter((*
hit), (*hit2))) {
264 result2.push_back(*
hit);
279 for (MuonRecHitContainer::const_iterator ihit =
hits.begin(); ihit !=
hits.end(); ihit++) {
280 const std::vector<TrajectorySeed>& sds = createSeed((*ihit), eSetup);
283 if (
results.size() >= theMaxSeeds)
294 if (hitpairs.empty() ||
results.size() >= theMaxSeeds)
296 for (CosmicMuonSeedGenerator::MuonRecHitPairVector::const_iterator ihitpair = hitpairs.begin();
297 ihitpair != hitpairs.end();
299 const std::vector<TrajectorySeed>& sds = createSeed((*ihitpair), eSetup);
302 if (
results.size() >= theMaxSeeds)
310 std::vector<TrajectorySeed>
result;
327 if (theForcePointDownFlag) {
329 hit->globalDirection().phi() > 0)
336 polar *= fabs(
pt) / polar.
perp();
346 mat =
hit->parametersError().similarityT(
hit->projectionMatrix());
358 LogTrace(
category) <<
"mom: " << tsos.globalMomentum() <<
" phi: " << tsos.globalMomentum().phi();
366 result.push_back(tsosToSeed(tsos,
hit->geographicalId().rawId(), container));
367 result.push_back(tsosToSeed(tsos2,
hit->geographicalId().rawId(), container));
382 if ((deltaR<double>(
dir1.eta(),
dir1.phi(),
dir2.eta(),
dir2.phi()) < 0.1 ||
387 if ((deltaR<double>(
dir1.eta(),
dir1.phi(),
dir2.eta(),
dir2.phi()) < 0.1 ||
389 (deltaR<double>(
dir1.eta(),
dir1.phi(), dis.
eta(), dis.
phi()) < 0.1 ||
390 deltaR<double>(
dir2.eta(),
dir2.phi(), dis.
eta(), dis.
phi()) < 0.1))
393 if (fabs(
dir1.eta()) > 4.0 || fabs(
dir2.eta()) > 4.0) {
394 if ((fabs(
dir1.theta() -
dir2.theta()) < 0.07 || fabs(
dir1.theta() +
dir2.theta()) > 3.07) &&
395 (fabs(
dir1.theta() - dis.
theta()) < 0.07 || fabs(
dir1.theta() - dis.
theta()) < 0.07 ||
406 if ((lhs->degreesOfFreedom() > rhs->degreesOfFreedom()) ||
407 ((lhs->degreesOfFreedom() == rhs->degreesOfFreedom()) && (lhs)->chi2() < (rhs)->
chi2()))
420 if (hits1.empty() || hits2.empty())
423 for (MuonRecHitContainer::const_iterator ihit1 = hits1.begin(); ihit1 != hits1.end(); ihit1++) {
424 if (!checkQuality(*ihit1))
427 for (MuonRecHitContainer::const_iterator ihit2 = hits2.begin(); ihit2 != hits2.end(); ihit2++) {
428 if (!checkQuality(*ihit2))
431 float dphi =
deltaPhi((*ihit1)->globalPosition().barePhi(), (*ihit2)->globalPosition().barePhi());
433 if ((*ihit1)->globalPosition().y() > 0.0 && ((*ihit1)->globalPosition().y() > (*ihit2)->globalPosition().y())) {
437 }
else if ((*ihit1)->globalPosition().y() < 0.0 &&
438 ((*ihit1)->globalPosition().y() < (*ihit2)->globalPosition().y())) {
451 std::vector<TrajectorySeed>
result;
457 float dphi =
deltaPhi((hitpair.
first)->globalDirection().barePhi(), (hitpair.
second)->globalDirection().barePhi());
461 map<string, float>::const_iterator iterPar = theParameters.find(hitpair.
type);
462 if (iterPar == theParameters.end()) {
467 int charge = (dphi > 0) ? -1 : 1;
470 float paraC = (iterPar->second);
472 if (fabs(dphi) > 1
e-5) {
473 pt = paraC / fabs(dphi);
492 if (theForcePointDownFlag) {
494 hit->globalDirection().phi() > 0)
501 polar *= fabs(
pt) / polar.
perp();
507 mat =
hit->parametersError().similarityT(
hit->projectionMatrix());
509 float p_err = 0.004 / paraC;
520 LogTrace(
category) <<
"mom: " << tsos.globalMomentum() <<
" phi: " << tsos.globalMomentum().phi();
529 result.push_back(tsosToSeed(tsos,
hit->geographicalId().rawId(), container));
536 return tsosToSeed(tsos,
id, container);