48 produces<TrajectorySeedCollection>();
51 theEnableDTFlag = pset.
getParameter<
bool>(
"EnableDTMeasurement");
53 theEnableCSCFlag = pset.
getParameter<
bool>(
"EnableCSCMeasurement");
66 theParameters[
"topmb41"] = 0.87;
67 theParameters[
"bottommb41"] = 1.2;
68 theParameters[
"topmb42"] = 0.67;
69 theParameters[
"bottommb42"] = 0.98;
70 theParameters[
"topmb43"] = 0.34;
71 theParameters[
"bottommb43"] = 0.58;
72 theParameters[
"topmb31"] = 0.54;
73 theParameters[
"bottommb31"] = 0.77;
74 theParameters[
"topmb32"] = 0.35;
75 theParameters[
"bottommb32"] = 0.55;
76 theParameters[
"topmb21"] = 0.21;
77 theParameters[
"bottommb21"] = 0.31;
95 std::string
category =
"Muon|RecoMuon|CosmicMuonSeedGenerator";
101 vector<DetLayer*> dtLayers = theMuonLayers->allDTLayers();
104 vector<DetLayer*> cscForwardLayers = theMuonLayers->forwardCSCLayers();
105 vector<DetLayer*> cscBackwardLayers = theMuonLayers->backwardCSCLayers();
109 theEnableDTFlag,theEnableCSCFlag,
false);
115 vector<MuonRecHitContainer> RHMBs;
116 vector<MuonRecHitContainer> RHMEFs;
117 vector<MuonRecHitContainer> RHMEBs;
121 for (vector<DetLayer*>::reverse_iterator icsclayer = cscForwardLayers.rbegin();
122 icsclayer != cscForwardLayers.rend() - 1; ++icsclayer) {
125 allHits.insert(allHits.end(),RHMF.begin(),RHMF.end());
129 for (vector<DetLayer*>::reverse_iterator icsclayer = cscBackwardLayers.rbegin();
130 icsclayer != cscBackwardLayers.rend() - 1; ++icsclayer) {
133 allHits.insert(allHits.end(),RHMF.begin(),RHMF.end());
137 for (vector<DetLayer*>::reverse_iterator idtlayer = dtLayers.rbegin();
138 idtlayer != dtLayers.rend(); ++idtlayer) {
141 RHMBs.push_back(RHMB);
143 if ( idtlayer != dtLayers.rbegin() ) allHits.insert(allHits.end(),RHMB.begin(),RHMB.end());
149 LogTrace(category)<<
"all RecHits: "<<allHits.size();
158 createSeeds(seeds, mb42, eSetup);
164 createSeeds(seeds, mb31, eSetup);
169 if ( !allHits.empty() ) {
172 LogTrace(category)<<
"good RecHits: "<<goodhits.size();
174 if ( goodhits.empty() ) {
175 LogTrace(category)<<
"No qualified Segments in Event! ";
176 LogTrace(category)<<
"Use 2D RecHit";
178 createSeeds(seeds,allHits,eSetup);
182 createSeeds(seeds,goodhits,eSetup);
186 LogTrace(category)<<
"Seeds built: "<<seeds.size();
188 for(std::vector<TrajectorySeed>::iterator seed = seeds.begin();
189 seed != seeds.end(); ++seed) {
190 output->push_back(*seed);
201 const std::string
category =
"Muon|RecoMuon|CosmicMuonSeedGenerator";
204 if ( !hit->isValid() )
return false;
206 if (hit->dimension() < 4) {
211 if (hit->isDT() && ( hit->chi2()> theMaxDTChi2 )) {
212 LogTrace(category)<<
"DT chi2 too large";
215 else if (hit->isCSC() &&( hit->chi2()> theMaxCSCChi2 ) ) {
216 LogTrace(category)<<
"CSC chi2 too large";
226 const std::string
category =
"Muon|RecoMuon|CosmicMuonSeedGenerator";
229 for (MuonRecHitContainer::const_iterator
hit = hits.begin();
hit != hits.end();
hit++) {
230 if ( checkQuality(*
hit) ) result.push_back(*
hit);
233 if ( result.size() < 2 )
return result;
238 for (MuonRecHitContainer::iterator
hit = result.begin();
hit != result.end();
hit++) {
239 if (*
hit == 0)
continue;
240 if ( !(*hit)->isValid() )
continue;
244 for (MuonRecHitContainer::iterator hit2 =
hit + 1; hit2 != result.end(); hit2++) {
245 if (*hit2 == 0)
continue;
246 if ( !(*hit2)->isValid() )
continue;
251 if ( !areCorrelated((*
hit),(*hit2)) )
continue;
253 if ( !leftIsBetter((*
hit),(*hit2)) ) {
258 if ( good ) result2.push_back(*
hit);
271 const std::string
category =
"Muon|RecoMuon|CosmicMuonSeedGenerator";
273 if (hits.size() == 0 || results.size() >= theMaxSeeds )
return;
274 for (MuonRecHitContainer::const_iterator ihit = hits.begin(); ihit != hits.end(); ihit++) {
275 const std::vector<TrajectorySeed>& sds = createSeed((*ihit),eSetup);
276 LogTrace(category)<<
"created seeds from rechit "<<sds.size();
277 results.insert(results.end(),sds.begin(),sds.end());
278 if ( results.size() >= theMaxSeeds )
break;
287 const std::string
category =
"Muon|RecoMuon|CosmicMuonSeedGenerator";
289 if (hitpairs.size() == 0 || results.size() >= theMaxSeeds )
return;
290 for (CosmicMuonSeedGenerator::MuonRecHitPairVector::const_iterator ihitpair = hitpairs.begin(); ihitpair != hitpairs.end(); ihitpair++) {
291 const std::vector<TrajectorySeed>& sds = createSeed((*ihitpair),eSetup);
292 LogTrace(category)<<
"created seeds from rechit "<<sds.size();
293 results.insert(results.end(),sds.begin(),sds.end());
294 if ( results.size() >= theMaxSeeds )
break;
302 std::vector<TrajectorySeed>
result;
304 const std::string
category =
"Muon|RecoMuon|CosmicMuonSeedGenerator";
318 hit->globalDirection().phi(),
321 if (hit->geographicalId().subdetId() ==
MuonSubdetId::DT && fabs(hit->globalDirection().eta()) < 4.0 && hit->globalDirection().phi() > 0 )
324 if (hit->geographicalId().subdetId() ==
MuonSubdetId::CSC && fabs(hit->globalDirection().eta()) > 2.3 ) {
328 polar *=fabs(pt)/polar.
perp();
338 mat = hit->parametersError().similarityT( hit->projectionMatrix() );
349 LogTrace(category)<<
"Trajectory State on Surface of Seed";
350 LogTrace(category)<<
"mom: "<<tsos.globalMomentum()<<
" phi: "<<tsos.globalMomentum().phi();
351 LogTrace(category)<<
"pos: " << tsos.globalPosition();
352 LogTrace(category) <<
"The RecSegment relies on: ";
355 result.push_back( tsosToSeed(tsos, hit->geographicalId().rawId()) );
356 result.push_back( tsosToSeed(tsos2, hit->geographicalId().rawId()) );
371 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 )
375 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 ) &&
376 (deltaR<double>(dir1.
eta(), dir1.
phi(), dis.
eta(), dis.
phi()) < 0.1 || deltaR<double>(dir2.
eta(), dir2.
phi(), dis.
eta(), dis.
phi()) < 0.1 ) )
379 if ( fabs(dir1.
eta()) > 4.0 || fabs(dir2.
eta()) > 4.0 ) {
380 if ( (fabs(dir1.
theta() - dir2.
theta()) < 0.07 ||
396 if ( (lhs->degreesOfFreedom() > rhs->degreesOfFreedom() ) ||
397 ( (lhs->degreesOfFreedom() == rhs->degreesOfFreedom() ) &&
398 (lhs)->chi2() < (rhs)->chi2() ) )
return true;
408 const std::string
category =
"Muon|RecoMuon|CosmicMuonSeedGenerator";
410 if (hits1.empty() || hits2.empty() )
return result;
412 for (MuonRecHitContainer::const_iterator ihit1 = hits1.begin(); ihit1 != hits1.end(); ihit1++) {
413 if ( !checkQuality(*ihit1) )
continue;
415 for (MuonRecHitContainer::const_iterator ihit2 = hits2.begin(); ihit2 != hits2.end(); ihit2++) {
416 if ( !checkQuality(*ihit2) )
continue;
418 float dphi =
deltaPhi((*ihit1)->globalPosition().phi(), (*ihit2)->globalPosition().phi());
420 if ((*ihit1)->globalPosition().y() > 0.0 && ( (*ihit1)->globalPosition().y() > (*ihit2)->globalPosition().y() ) ) {
421 std::string tag2 =
"top"+
tag;
424 }
else if ((*ihit1)->globalPosition().y() < 0.0 && ( (*ihit1)->globalPosition().y() < (*ihit2)->globalPosition().y() ) ) {
425 std::string tag2 =
"bottom"+
tag;
438 std::vector<TrajectorySeed>
result;
440 const std::string
category =
"Muon|RecoMuon|CosmicMuonSeedGenerator";
444 float dphi =
deltaPhi((hitpair.
first)->globalDirection().phi(), (hitpair.
second)->globalDirection().phi());
448 map<string, float>::const_iterator iterPar = theParameters.find(hitpair.
type);
449 if ( iterPar == theParameters.end() ) {
454 int charge = (dphi > 0) ? -1 : 1;
457 float paraC = (iterPar->second);
459 if (fabs(dphi) > 1
e-5) {
460 pt = paraC/fabs(dphi);
463 if (pt < 10.0 ) {
return result; }
475 hit->globalDirection().phi(),
478 if (hit->geographicalId().subdetId() ==
MuonSubdetId::DT && fabs(hit->globalDirection().eta()) < 4.0 && hit->globalDirection().phi() > 0 )
481 if (hit->geographicalId().subdetId() ==
MuonSubdetId::CSC && fabs(hit->globalDirection().eta()) > 2.3 ) {
485 polar *=fabs(pt)/polar.
perp();
491 mat = hit->parametersError().similarityT( hit->projectionMatrix() );
493 float p_err = 0.004/paraC;
494 if (pt < 10.01) p_err = 0.1;
502 LogTrace(category)<<
"Trajectory State on Surface of Seed";
503 LogTrace(category)<<
"mom: "<<tsos.globalMomentum()<<
" phi: "<<tsos.globalMomentum().phi();
504 LogTrace(category)<<
"pos: " << tsos.globalPosition();
505 LogTrace(category) <<
"The RecSegment relies on: ";
508 result.push_back( tsosToSeed(tsos, hit->geographicalId().rawId()) );
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
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
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.