25 const string metname =
"Muon|RecoMuon|SETPatternRecognition";
31 useRPCs = filterPSet.getParameter<
bool>(
"EnableRPCMeasurement");
44 std::vector<MuonRecHitContainer> & segments_clusters)
46 const string metname =
"Muon|RecoMuon|SETMuonSeedSeed";
60 std::vector<DTChamberId> chambers_DT;
61 std::vector<DTChamberId>::const_iterator chIt_DT;
64 for(chIt_DT=chambers_DT.begin(); chIt_DT != chambers_DT.end(); ++chIt_DT){
66 ((*rechit).chamberId().wheel()) == ((*chIt_DT).wheel()) &&
67 ((*rechit).chamberId().station() == (*chIt_DT).station()) &&
68 ((*rechit).chamberId().sector() == (*chIt_DT).sector())){
73 chambers_DT.push_back((*rechit).chamberId());
76 rechit->localPosition(), rechit->localPositionError(),
77 rechit->localDirection(), rechit->localDirectionError(),
78 rechit->chi2(), rechit->degreesOfFreedom())){
81 if( (rechit->hasZed() && rechit->hasPhi()) ) {
84 else if(rechit->hasZed()) {
87 else if(rechit->hasPhi()) {
102 std::vector<CSCDetId> chambers_CSC;
103 std::vector<CSCDetId>::const_iterator chIt_CSC;
106 for(chIt_CSC=chambers_CSC.begin(); chIt_CSC != chambers_CSC.end(); ++chIt_CSC){
107 if (((*rechit).cscDetId().chamber() == (*chIt_CSC).chamber()) &&
108 ((*rechit).cscDetId().station() == (*chIt_CSC).station()) &&
109 ((*rechit).cscDetId().ring() == (*chIt_CSC).ring()) &&
110 ((*rechit).cscDetId().endcap() == (*chIt_CSC).endcap())){
115 chambers_CSC.push_back((*rechit).cscDetId().chamberId());
118 rechit->localPosition(), rechit->localPositionError(),
119 rechit->localDirection(), rechit->localDirectionError(),
120 rechit->chi2(), rechit->degreesOfFreedom())){
137 const LocalError localDirectionError (0.,0.,0.);
138 const double chi2 = 1.;
141 rechit->localPosition(), rechit->localPositionError(),
142 localDirection, localDirectionError,
154 edm::LogWarning(
"tooManyActiveChambers")<<
" Too many active chambers : nDT = "<<chambers_DT.size()
155 <<
" nCSC = "<<chambers_CSC.size()<<
" Skip them all.";
157 muonRecHits_DT2D_hasPhi.clear();
158 muonRecHits_DT2D_hasZed.clear();
159 muonRecHits_RPC.clear();
170 bool useDT2D_hasPhi =
true;
171 bool useDT2D_hasZed =
true;
172 double dXclusBoxMax = 0.60;
173 double dYclusBoxMax = 0.;
186 float dXclus_box = 0.0;
187 float dYclus_box = 0.0;
191 std::vector< MuonRecHitContainer > seeds;
193 std::vector<float> running_meanX;
194 std::vector<float> running_meanY;
196 std::vector<float> seed_minX;
197 std::vector<float> seed_maxX;
198 std::vector<float> seed_minY;
199 std::vector<float> seed_maxY;
204 for (MuonRecHitContainer::const_iterator it = muonRecHits.begin(); it != muonRecHits.end(); ++it ) {
214 temp.push_back((*it));
216 seeds.push_back(temp);
221 running_meanX.push_back( (*it)->globalPosition().phi() );
222 running_meanY.push_back( (*it)->globalPosition().theta() );
225 seed_minX.push_back( (*it)->globalPosition().phi() );
226 seed_maxX.push_back( (*it)->globalPosition().phi() );
227 seed_minY.push_back( (*it)->globalPosition().theta() );
228 seed_maxY.push_back( (*it)->globalPosition().theta() );
233 for(
unsigned int NNN = 0; NNN < seeds.size(); ++NNN) {
235 for(
unsigned int MMM = NNN+1; MMM < seeds.size(); ++MMM) {
236 if(running_meanX[MMM] == 999999. || running_meanX[NNN] == 999999. ) {
244 double temp_meanX = running_meanX[NNN];
245 double temp_minX = seed_minX[NNN];
246 double temp_maxX = seed_maxX[NNN];
250 dXclus = running_meanX[NNN] - running_meanX[MMM];
252 temp_meanX = temp_meanX - 2.*
TMath::Pi();
257 temp_meanX = temp_meanX + 2.*
TMath::Pi();
267 if ( temp_meanX > running_meanX[MMM] ) dXclus_box = temp_minX - seed_maxX[MMM];
268 else dXclus_box = seed_minX[MMM] - temp_maxX;
269 if ( running_meanY[NNN] > running_meanY[MMM] ) dYclus_box = seed_minY[NNN] - seed_maxY[MMM];
270 else dYclus_box = seed_minY[MMM] - seed_maxY[NNN];
273 if( dXclus_box < dXclusBoxMax && dYclus_box < dYclusBoxMax ) {
279 running_meanX[MMM] = (temp_meanX*seeds[NNN].size() + running_meanX[MMM]*seeds[MMM].size()) / (seeds[NNN].
size()+seeds[MMM].size());
280 running_meanY[MMM] = (running_meanY[NNN]*seeds[NNN].size() + running_meanY[MMM]*seeds[MMM].size()) / (seeds[NNN].
size()+seeds[MMM].size());
284 if ( temp_minX <= seed_minX[MMM] ) seed_minX[MMM] = temp_minX;
285 if ( temp_maxX > seed_maxX[MMM] ) seed_maxX[MMM] = temp_maxX;
286 if ( seed_minY[NNN] <= seed_minY[MMM] ) seed_minY[MMM] = seed_minY[NNN];
287 if ( seed_maxY[NNN] > seed_maxY[MMM] ) seed_maxY[MMM] = seed_maxY[NNN];
292 running_meanX[MMM] = running_meanX[MMM] - 2.*
TMath::Pi();
293 seed_minX[MMM] = seed_minX[MMM] - 2.*
TMath::Pi();
294 seed_maxX[MMM] = seed_maxX[MMM] - 2.*
TMath::Pi();
297 running_meanX[MMM] = running_meanX[MMM] + 2.*
TMath::Pi();
298 seed_minX[MMM] = seed_minX[MMM] + 2.*
TMath::Pi();
299 seed_maxX[MMM] = seed_maxX[MMM] + 2.*
TMath::Pi();
303 seeds[MMM].insert(seeds[MMM].
end(),seeds[NNN].
begin(),seeds[NNN].
end());
306 running_meanX[NNN] = 999999.;
307 running_meanY[NNN] = 999999.;
315 bool tooCloseClusters =
false;
317 std::vector <double> seedTheta(seeds.size());
318 for(
unsigned int iSeed = 0;iSeed<seeds.size();++iSeed){
319 seedTheta[iSeed] = seeds[iSeed][0]->globalPosition().theta();
321 double dTheta = fabs(seedTheta[iSeed] - seedTheta[iSeed-1]);
323 tooCloseClusters =
true;
335 for(
unsigned int NNN = 0; NNN < seeds.size(); ++NNN) {
336 if(running_meanX[NNN] == 999999.)
continue;
340 for (MuonRecHitContainer::const_iterator it2 = muonRecHits_DT2D_hasZed.begin(); it2 != muonRecHits_DT2D_hasZed.end(); ++it2 ) {
342 if (((*it2)->globalPosition().theta() < seed_maxY[NNN] + dYclusBoxMax) && ((*it2)->globalPosition().theta() > seed_minY[NNN] - dYclusBoxMax)) {
349 ((*it2)->globalPosition().phi() + 0.09) < (seed_minX[NNN] - dXclusBoxMax)
351 ((*it2)->globalPosition().phi() - 0.09) < (seed_minX[NNN] - dXclusBoxMax)
355 ((*it2)->globalPosition().phi() + 0.09) > (seed_maxX[NNN] + dXclusBoxMax)
357 ((*it2)->globalPosition().phi() - 0.09) > (seed_maxX[NNN] + dXclusBoxMax)
361 seeds[NNN].push_back((*it2));
370 if (useDT2D_hasPhi) {
372 for (MuonRecHitContainer::const_iterator it2 = muonRecHits_DT2D_hasPhi.begin(); it2 != muonRecHits_DT2D_hasPhi.end(); ++it2 ) {
373 if (((*it2)->globalPosition().phi() < seed_maxX[NNN] + dXclusBoxMax) && ((*it2)->globalPosition().phi() > seed_minX[NNN] - dXclusBoxMax)) {
377 ((*it2)->globalPosition().theta() + 0.3) < (seed_minY[NNN] - dYclusBoxMax)
379 ((*it2)->globalPosition().theta() - 0.3) < (seed_minY[NNN] - dYclusBoxMax)
383 ((*it2)->globalPosition().theta() + 0.3) > (seed_maxY[NNN] + dYclusBoxMax)
385 ((*it2)->globalPosition().theta() - 0.3) > (seed_maxY[NNN] + dYclusBoxMax)
389 seeds[NNN].push_back((*it2));
399 if(seeds[NNN].
size()>1){
400 for(
unsigned int iRH = 0 ;iRH<seeds[NNN].size() ;++iRH){
401 if( iRH && detId_prev != seeds[NNN][iRH]->
hit()->geographicalId()){
405 detId_prev = seeds[NNN][iRH]->hit()->geographicalId();
409 if (
useRPCs && !secondCh && !tooCloseClusters) {
410 for (MuonRecHitContainer::const_iterator it2 = muonRecHits_RPC.begin(); it2 != muonRecHits_RPC.end(); ++it2 ) {
411 if (((*it2)->globalPosition().phi() < seed_maxX[NNN] + dXclusBoxMax) && ((*it2)->globalPosition().phi() > seed_minX[NNN] - dXclusBoxMax)) {
415 ((*it2)->globalPosition().theta() + 0.3) < (seed_minY[NNN] - dYclusBoxMax)
417 ((*it2)->globalPosition().theta() - 0.3) < (seed_minY[NNN] - dYclusBoxMax)
421 ((*it2)->globalPosition().theta() + 0.3) > (seed_maxY[NNN] + dYclusBoxMax)
423 ((*it2)->globalPosition().theta() - 0.3) > (seed_maxY[NNN] + dYclusBoxMax)
427 seeds[NNN].push_back((*it2));
438 for(
unsigned int NNN = 0; NNN < seeds.size(); ++NNN) {
439 if(running_meanX[NNN] == 999999.)
continue;
441 segments_clusters.push_back(seeds[NNN]);
449 const double& chi2,
const int& ndf){
451 bool dropTheSegment =
true;
460 if(insideCh && !parallelSegment){
461 dropTheSegment =
false;
466 return dropTheSegment;
T getParameter(std::string const &) const
virtual bool inside(const Local3DPoint &) const =0
Determine if the point is inside the bounds.
double minLocalSegmentAngle
const std::string metname
edm::InputTag CSCRecSegmentLabel
const Bounds & bounds() const
const Plane & surface() const
The nominal surface of the GeomDet.
C::const_iterator const_iterator
constant access iterator type
double outsideChamberErrorScale
bool segmentCleaning(const DetId &detId, const LocalPoint &localPosition, const LocalError &localError, const LocalVector &localDirection, const LocalError &localDirectionError, const double &chi2, const int &ndf)
bool insert(Storage &iStorage, ItemType *iItem, const IdTag &iIdTag)
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
MuonServiceProxy * theService
MuonTransientTrackingRecHit::MuonRecHitContainer MuonRecHitContainer
edm::InputTag DTRecSegmentLabel
virtual void produce(const edm::Event &event, const edm::EventSetup &eSetup, std::vector< MuonRecHitContainer > &result)
SETPatternRecognition(const edm::ParameterSet &pset)
static MuonRecHitPointer specificBuild(const GeomDet *geom, const TrackingRecHit *rh)
tuple size
Write out results.
edm::InputTag RPCRecSegmentLabel