CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_10_patch1/src/RecoMuon/MuonSeedGenerator/src/MuonOverlapSeedFromRecHits.cc

Go to the documentation of this file.
00001 #include "RecoMuon/MuonSeedGenerator/src/MuonOverlapSeedFromRecHits.h"
00002 #include "RecoMuon/MuonSeedGenerator/src/MuonDTSeedFromRecHits.h"
00003 #include "RecoMuon/MuonSeedGenerator/src/MuonCSCSeedFromRecHits.h"
00004 #include "RecoMuon/MuonSeedGenerator/src/MuonSeedPtExtractor.h"
00005 #include "DataFormats/MuonDetId/interface/CSCDetId.h"
00006 #include "DataFormats/MuonDetId/interface/DTChamberId.h"
00007 #include "RecoMuon/TrackingTools/interface/MuonPatternRecoDumper.h"
00008 #include "DataFormats/TrackingRecHit/interface/TrackingRecHit.h"
00009 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00010 #include "Geometry/CSCGeometry/interface/CSCChamberSpecs.h"
00011 #include <iomanip>
00012 
00013 
00014 MuonOverlapSeedFromRecHits::MuonOverlapSeedFromRecHits()
00015 : MuonSeedFromRecHits()
00016 {
00017 }
00018 
00019 
00020 
00021 
00022 std::vector<TrajectorySeed> MuonOverlapSeedFromRecHits::seeds() const
00023 {
00024   std::vector<TrajectorySeed> result;
00025   //@@ doesn't handle overlap between ME11 and ME12 correctly
00026   // sort by station
00027   MuonRecHitContainer barrelHits, endcapHits;
00028   for ( MuonRecHitContainer::const_iterator iter = theRhits.begin(), end = theRhits.end();
00029         iter != end; ++iter)
00030   {
00031     if((*iter)->isDT())
00032     {
00033       DTChamberId dtId((**iter).geographicalId().rawId());
00034       // try not doing seeds that start in DT station 2, if there'as a good single segment seed
00035       if(dtId.station() == 1 || (dtId.station()==2 && (*iter)->dimension() == 2))
00036       {
00037         barrelHits.push_back(*iter);
00038       }
00039     }
00040     else
00041     {
00042       endcapHits.push_back(*iter);
00043     }
00044   }
00045 
00046   ConstMuonRecHitPointer bestSegment = bestHit(barrelHits, endcapHits);
00047   for ( MuonRecHitContainer::const_iterator barrelHitItr = barrelHits.begin(),
00048         lastBarrelHit = barrelHits.end();
00049         barrelHitItr != lastBarrelHit; ++barrelHitItr)
00050   {
00051     for ( MuonRecHitContainer::const_iterator endcapHitItr = endcapHits.begin(),
00052       lastEndcapHit = endcapHits.end();
00053       endcapHitItr != lastEndcapHit; ++endcapHitItr)
00054     {
00055       TrajectorySeed seed;
00056       bool good = makeSeed(*barrelHitItr, *endcapHitItr, bestSegment, seed);
00057       if(good) result.push_back(seed);
00058       // try just one seed
00059       return result;
00060     }
00061   }
00062 
00063   //std::cout << "Overlap hits " << barrelHits.size() << " " 
00064   //                             << endcapHits.size() << std::endl;
00065 
00066   return result;
00067 }
00068 
00069 
00070 
00071 bool
00072 MuonOverlapSeedFromRecHits::makeSeed(MuonTransientTrackingRecHit::ConstMuonRecHitPointer barrelHit,
00073                                      MuonTransientTrackingRecHit::ConstMuonRecHitPointer endcapHit,
00074                                      MuonTransientTrackingRecHit::ConstMuonRecHitPointer bestSegment,
00075                                      TrajectorySeed & result) const
00076 {
00077   std::vector<double> pts = thePtExtractor->pT_extract(barrelHit, endcapHit);
00078   double minpt = 3.;
00079   double pt = pts[0];
00080   double sigmapt = pts[1];
00081     // if too small, probably an error.  Keep trying.
00082   if(pt != 0) {
00083     if(fabs(pt) > minpt)
00084     {
00085       double maxpt = 2000.;
00086       if(pt > maxpt) {
00087         pt = maxpt;
00088         sigmapt = maxpt;
00089       }
00090       if(pt < -maxpt) {
00091         pt = -maxpt;
00092         sigmapt = maxpt;
00093       }
00094     }
00095 
00096     result = createSeed(pt, sigmapt, bestSegment);
00097     //std::cout << "OVERLAPFITTED PT " << pt << " dphi " << dphi << " eta " << eta << std::endl;
00098     return true;
00099   }
00100   return false;
00101 }
00102 
00103 MuonTransientTrackingRecHit::ConstMuonRecHitPointer 
00104 MuonOverlapSeedFromRecHits::bestHit(
00105   const MuonTransientTrackingRecHit::MuonRecHitContainer & barrelHits, 
00106   const MuonTransientTrackingRecHit::MuonRecHitContainer & endcapHits) const
00107 {
00108   MuonDTSeedFromRecHits dtSeeder;
00109   MuonCSCSeedFromRecHits cscSeeder;
00110 
00111   ConstMuonRecHitPointer result;
00112   if(barrelHits.size() > endcapHits.size()) 
00113   {
00114     result = dtSeeder.bestBarrelHit(barrelHits);
00115     if (result->dimension() == 2) result = cscSeeder.bestEndcapHit(endcapHits);
00116   }
00117   else
00118   {
00119     result = cscSeeder.bestEndcapHit(endcapHits);
00120   }
00121   return result;
00122 }
00123 
00124 
00125 
00126