48 produces<TrajectorySeedCollection>();
51 theEnableDTFlag = pset.
getParameter<
bool>(
"EnableDTMeasurement");
53 theEnableCSCFlag = pset.
getParameter<
bool>(
"EnableCSCMeasurement");
68 theParameters[
"topmb41"] = 0.87;
69 theParameters[
"bottommb41"] = 1.2;
70 theParameters[
"topmb42"] = 0.67;
71 theParameters[
"bottommb42"] = 0.98;
72 theParameters[
"topmb43"] = 0.34;
73 theParameters[
"bottommb43"] = 0.58;
74 theParameters[
"topmb31"] = 0.54;
75 theParameters[
"bottommb31"] = 0.77;
76 theParameters[
"topmb32"] = 0.35;
77 theParameters[
"bottommb32"] = 0.55;
78 theParameters[
"topmb21"] = 0.21;
79 theParameters[
"bottommb21"] = 0.31;
85 delete theTSTransform;
98 std::string
category =
"Muon|RecoMuon|CosmicMuonSeedGenerator";
104 vector<DetLayer*> dtLayers = theMuonLayers->allDTLayers();
107 vector<DetLayer*> cscForwardLayers = theMuonLayers->forwardCSCLayers();
108 vector<DetLayer*> cscBackwardLayers = theMuonLayers->backwardCSCLayers();
112 theEnableDTFlag,theEnableCSCFlag,
false);
118 vector<MuonRecHitContainer> RHMBs;
119 vector<MuonRecHitContainer> RHMEFs;
120 vector<MuonRecHitContainer> RHMEBs;
124 for (vector<DetLayer*>::reverse_iterator icsclayer = cscForwardLayers.rbegin();
125 icsclayer != cscForwardLayers.rend() - 1; ++icsclayer) {
128 allHits.insert(allHits.end(),RHMF.begin(),RHMF.end());
132 for (vector<DetLayer*>::reverse_iterator icsclayer = cscBackwardLayers.rbegin();
133 icsclayer != cscBackwardLayers.rend() - 1; ++icsclayer) {
136 allHits.insert(allHits.end(),RHMF.begin(),RHMF.end());
140 for (vector<DetLayer*>::reverse_iterator idtlayer = dtLayers.rbegin();
141 idtlayer != dtLayers.rend(); ++idtlayer) {
144 RHMBs.push_back(RHMB);
146 if ( idtlayer != dtLayers.rbegin() ) allHits.insert(allHits.end(),RHMB.begin(),RHMB.end());
152 LogTrace(category)<<
"all RecHits: "<<allHits.size();
161 createSeeds(seeds, mb42, eSetup);
167 createSeeds(seeds, mb31, eSetup);
172 if ( !allHits.empty() ) {
175 LogTrace(category)<<
"good RecHits: "<<goodhits.size();
177 if ( goodhits.empty() ) {
178 LogTrace(category)<<
"No qualified Segments in Event! ";
179 LogTrace(category)<<
"Use 2D RecHit";
181 createSeeds(seeds,allHits,eSetup);
185 createSeeds(seeds,goodhits,eSetup);
189 LogTrace(category)<<
"Seeds built: "<<seeds.size();
191 for(std::vector<TrajectorySeed>::iterator seed = seeds.begin();
192 seed != seeds.end(); ++seed) {
193 output->push_back(*seed);
204 const std::string
category =
"Muon|RecoMuon|CosmicMuonSeedGenerator";
207 if ( !hit->isValid() )
return false;
209 if (hit->dimension() < 4) {
214 if (hit->isDT() && ( hit->chi2()> theMaxDTChi2 )) {
215 LogTrace(category)<<
"DT chi2 too large";
218 else if (hit->isCSC() &&( hit->chi2()> theMaxCSCChi2 ) ) {
219 LogTrace(category)<<
"CSC chi2 too large";
229 const std::string
category =
"Muon|RecoMuon|CosmicMuonSeedGenerator";
232 for (MuonRecHitContainer::const_iterator
hit = hits.begin();
hit != hits.end();
hit++) {
233 if ( checkQuality(*
hit) ) result.push_back(*
hit);
236 if ( result.size() < 2 )
return result;
241 for (MuonRecHitContainer::iterator
hit = result.begin();
hit != result.end();
hit++) {
242 if (*
hit == 0)
continue;
243 if ( !(*hit)->isValid() )
continue;
247 for (MuonRecHitContainer::iterator hit2 =
hit + 1; hit2 != result.end(); hit2++) {
248 if (*hit2 == 0)
continue;
249 if ( !(*hit2)->isValid() )
continue;
254 if ( !areCorrelated((*
hit),(*hit2)) )
continue;
256 if ( !leftIsBetter((*
hit),(*hit2)) ) {
261 if ( good ) result2.push_back(*
hit);
274 const std::string
category =
"Muon|RecoMuon|CosmicMuonSeedGenerator";
276 if (hits.size() == 0 || results.size() >= theMaxSeeds )
return;
277 for (MuonRecHitContainer::const_iterator ihit = hits.begin(); ihit != hits.end(); ihit++) {
278 const std::vector<TrajectorySeed>& sds = createSeed((*ihit),eSetup);
279 LogTrace(category)<<
"created seeds from rechit "<<sds.size();
280 results.insert(results.end(),sds.begin(),sds.end());
281 if ( results.size() >= theMaxSeeds )
break;
290 const std::string
category =
"Muon|RecoMuon|CosmicMuonSeedGenerator";
292 if (hitpairs.size() == 0 || results.size() >= theMaxSeeds )
return;
293 for (CosmicMuonSeedGenerator::MuonRecHitPairVector::const_iterator ihitpair = hitpairs.begin(); ihitpair != hitpairs.end(); ihitpair++) {
294 const std::vector<TrajectorySeed>& sds = createSeed((*ihitpair),eSetup);
295 LogTrace(category)<<
"created seeds from rechit "<<sds.size();
296 results.insert(results.end(),sds.begin(),sds.end());
297 if ( results.size() >= theMaxSeeds )
break;
305 std::vector<TrajectorySeed>
result;
307 const std::string
category =
"Muon|RecoMuon|CosmicMuonSeedGenerator";
321 hit->globalDirection().phi(),
324 if (hit->geographicalId().subdetId() ==
MuonSubdetId::DT && fabs(hit->globalDirection().eta()) < 4.0 && hit->globalDirection().phi() > 0 )
327 if (hit->geographicalId().subdetId() ==
MuonSubdetId::CSC && fabs(hit->globalDirection().eta()) > 2.3 ) {
331 polar *=fabs(pt)/polar.
perp();
341 mat = hit->parametersError().similarityT( hit->projectionMatrix() );
352 LogTrace(category)<<
"Trajectory State on Surface of Seed";
353 LogTrace(category)<<
"mom: "<<tsos.globalMomentum()<<
" phi: "<<tsos.globalMomentum().phi();
354 LogTrace(category)<<
"pos: " << tsos.globalPosition();
355 LogTrace(category) <<
"The RecSegment relies on: ";
358 result.push_back( tsosToSeed(tsos, hit->geographicalId().rawId()) );
359 result.push_back( tsosToSeed(tsos2, hit->geographicalId().rawId()) );
374 if ( (deltaR<double>(dir1.
eta(), dir1.
phi(), dir2.
eta(), dir2.
phi()) < 0.1 || deltaR<double>(dir1.
eta(), dir1.
phi(), -dir2.
eta(), -dir2.
phi()) < 0.1 )
378 if ( (deltaR<double>(dir1.
eta(), dir1.
phi(), dir2.
eta(), dir2.
phi()) < 0.1 || deltaR<double>(dir1.
eta(), dir1.
phi(), -dir2.
eta(), -dir2.
phi()) < 0.1 ) &&
379 (deltaR<double>(dir1.
eta(), dir1.
phi(), dis.
eta(), dis.
phi()) < 0.1 || deltaR<double>(dir2.
eta(), dir2.
phi(), dis.
eta(), dis.
phi()) < 0.1 ) )
382 if ( fabs(dir1.
eta()) > 4.0 || fabs(dir2.
eta()) > 4.0 ) {
383 if ( (fabs(dir1.
theta() - dir2.
theta()) < 0.07 ||
399 if ( (lhs->degreesOfFreedom() > rhs->degreesOfFreedom() ) ||
400 ( (lhs->degreesOfFreedom() == rhs->degreesOfFreedom() ) &&
401 (lhs)->chi2() < (rhs)->chi2() ) )
return true;
411 const std::string
category =
"Muon|RecoMuon|CosmicMuonSeedGenerator";
413 if (hits1.empty() || hits2.empty() )
return result;
415 for (MuonRecHitContainer::const_iterator ihit1 = hits1.begin(); ihit1 != hits1.end(); ihit1++) {
416 if ( !checkQuality(*ihit1) )
continue;
418 for (MuonRecHitContainer::const_iterator ihit2 = hits2.begin(); ihit2 != hits2.end(); ihit2++) {
419 if ( !checkQuality(*ihit2) )
continue;
421 float dphi =
deltaPhi((*ihit1)->globalPosition().phi(), (*ihit2)->globalPosition().phi());
423 if ((*ihit1)->globalPosition().y() > 0.0 && ( (*ihit1)->globalPosition().y() > (*ihit2)->globalPosition().y() ) ) {
424 std::string tag2 =
"top"+
tag;
427 }
else if ((*ihit1)->globalPosition().y() < 0.0 && ( (*ihit1)->globalPosition().y() < (*ihit2)->globalPosition().y() ) ) {
428 std::string tag2 =
"bottom"+
tag;
441 std::vector<TrajectorySeed>
result;
443 const std::string
category =
"Muon|RecoMuon|CosmicMuonSeedGenerator";
447 float dphi =
deltaPhi((hitpair.
first)->globalDirection().phi(), (hitpair.
second)->globalDirection().phi());
451 map<string, float>::const_iterator iterPar = theParameters.find(hitpair.
type);
452 if ( iterPar == theParameters.end() ) {
457 int charge = (dphi > 0) ? -1 : 1;
460 float paraC = (iterPar->second);
462 if (fabs(dphi) > 1e-5) {
463 pt = paraC/fabs(dphi);
466 if (pt < 10.0 ) {
return result; }
478 hit->globalDirection().phi(),
481 if (hit->geographicalId().subdetId() ==
MuonSubdetId::DT && fabs(hit->globalDirection().eta()) < 4.0 && hit->globalDirection().phi() > 0 )
484 if (hit->geographicalId().subdetId() ==
MuonSubdetId::CSC && fabs(hit->globalDirection().eta()) > 2.3 ) {
488 polar *=fabs(pt)/polar.
perp();
494 mat = hit->parametersError().similarityT( hit->projectionMatrix() );
496 float p_err = 0.004/paraC;
497 if (pt < 10.01) p_err = 0.1;
505 LogTrace(category)<<
"Trajectory State on Surface of Seed";
506 LogTrace(category)<<
"mom: "<<tsos.globalMomentum()<<
" phi: "<<tsos.globalMomentum().phi();
507 LogTrace(category)<<
"pos: " << tsos.globalPosition();
508 LogTrace(category) <<
"The RecSegment relies on: ";
511 result.push_back( tsosToSeed(tsos, hit->geographicalId().rawId()) );
519 theTSTransform->persistentState(tsos,
id);
T getParameter(std::string const &) const
virtual void produce(edm::Event &, const edm::EventSetup &)
reconstruct muon's seeds
MuonTransientTrackingRecHit::MuonRecHitContainer selectSegments(const MuonTransientTrackingRecHit::MuonRecHitContainer &) const
select seed candidates from Segments in Event
MuonTransientTrackingRecHit::MuonRecHitPointer MuonRecHitPointer
double deltaPhi(float phi1, float phi2)
Geom::Phi< T > phi() const
MuonTransientTrackingRecHit::MuonRecHitPointer first
std::string dumpMuonId(const DetId &id) const
Geom::Theta< T > theta() const
bool areCorrelated(const MuonTransientTrackingRecHit::MuonRecHitPointer &, const MuonTransientTrackingRecHit::MuonRecHitPointer &) const
check if two rechits are correlated
std::vector< TrajectorySeed > TrajectorySeedCollection
MuonRecHitContainer recHits(const DetLayer *layer, const edm::Event &iEvent)
returns the rechits which are on the layer
bool leftIsBetter(const MuonTransientTrackingRecHit::MuonRecHitPointer &, const MuonTransientTrackingRecHit::MuonRecHitPointer &) const
compare quality of two rechits
std::vector< TrajectorySeed > createSeed(const MuonTransientTrackingRecHit::MuonRecHitPointer &, const edm::EventSetup &) const
create TrajectorySeed from MuonTransientTrackingRecHit
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
std::vector< MuonRecHitPair > MuonRecHitPairVector
CLHEP::HepVector AlgebraicVector
bool checkQuality(const MuonTransientTrackingRecHit::MuonRecHitPointer &) const
determine if a MuonTransientTrackingRecHit is qualified to build seed
MuonTransientTrackingRecHit::MuonRecHitPointer second
void setEvent(const edm::Event &)
set event
static const std::string category("Muon|RecoMuon|L3MuonCandidateProducerFromMuons")
CLHEP::HepSymMatrix AlgebraicSymMatrix
MuonTransientTrackingRecHit::MuonRecHitContainer MuonRecHitContainer
std::vector< MuonRecHitPair > makeSegPairs(const MuonTransientTrackingRecHit::MuonRecHitContainer &, const MuonTransientTrackingRecHit::MuonRecHitContainer &, std::string) const
TrajectorySeed tsosToSeed(const TrajectoryStateOnSurface &, uint32_t) const
uint32_t dimension(pat::CandKinResolution::Parametrization parametrization)
Returns the number of free parameters in a parametrization (3 or 4)
void createSeeds(TrajectorySeedCollection &results, const MuonTransientTrackingRecHit::MuonRecHitContainer &hits, const edm::EventSetup &eSetup) const
generate TrajectorySeeds and put them into results
std::vector< MuonRecHitPointer > MuonRecHitContainer
CosmicMuonSeedGenerator(const edm::ParameterSet &)
Constructor.
virtual ~CosmicMuonSeedGenerator()
Destructor.