CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_8_patch3/src/RecoMuon/MuonSeedGenerator/src/MuonSeedFinder.cc

Go to the documentation of this file.
00001 
00012 #include "RecoMuon/MuonSeedGenerator/src/MuonSeedFinder.h"
00013 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00014 
00015 using namespace std;
00016 
00017 typedef MuonTransientTrackingRecHit::MuonRecHitPointer MuonRecHitPointer;
00018 typedef MuonTransientTrackingRecHit::ConstMuonRecHitPointer ConstMuonRecHitPointer;
00019 typedef MuonTransientTrackingRecHit::MuonRecHitContainer MuonRecHitContainer;
00020 
00021 MuonSeedFinder::MuonSeedFinder(const edm::ParameterSet & pset):
00022   theBarrel(),
00023   theOverlap(),
00024   theEndcap()
00025 {
00026   
00027   // FIXME put it in a pSet
00028   // theMinMomentum = pset.getParameter<double>("EndCapSeedMinPt");  //3.0
00029   theMinMomentum = 3.0;
00030   thePtExtractor = new MuonSeedPtExtractor(pset);
00031   theBarrel.setPtExtractor(thePtExtractor);
00032   theOverlap.setPtExtractor(thePtExtractor);
00033   theEndcap.setPtExtractor(thePtExtractor);
00034 
00035 }
00036 
00037 
00038 void MuonSeedFinder::setBField(const MagneticField * field)
00039 {
00040   theField = field;
00041   theBarrel.setBField(field);
00042   theOverlap.setBField(field);
00043   theEndcap.setBField(field);
00044 }
00045 
00046 
00047 void MuonSeedFinder::seeds(const MuonTransientTrackingRecHit::MuonRecHitContainer & hits,
00048                            std::vector<TrajectorySeed> & result)
00049 {
00050   const std::string metname = "Muon|RecoMuon|MuonSeedFinder";
00051 
00052   //  MuonDumper debug;
00053 
00054   unsigned int num_bar = 0;
00055   for ( MuonRecHitContainer::const_iterator iter = hits.begin(); iter!= hits.end(); iter++ ){
00056     if ( (*iter)->isDT() ) {
00057       theBarrel.add(*iter);
00058       theOverlap.add(*iter);
00059       num_bar++;
00060     }
00061   }
00062 
00063   unsigned int num_endcap = 0;
00064   for ( MuonRecHitContainer::const_iterator iter = hits.begin(); iter!= hits.end(); iter++ ){
00065     if ( (*iter)->isCSC() )
00066     {
00067 //std::cout << **iter << std::endl;
00068       theEndcap.add(*iter);
00069       theOverlap.add(*iter);
00070       ++num_endcap;
00071     }
00072   }
00073 
00074   // don't do dim-2 seeds in the overlap
00075   if ( num_bar >1 || (num_bar==1 && (num_endcap==0 || theBarrel.firstRecHit()->dimension() == 4))) {
00076     LogDebug(metname)
00077       << "Barrel Seeds " << num_bar << endl;
00078     result.push_back(theBarrel.seed());
00079 
00080   }
00081 
00082   if(num_endcap > 1 || (num_endcap==1 && num_bar==0))
00083   {
00084     LogDebug(metname)
00085       << "Endcap Seeds " << num_endcap << endl;
00086     result.push_back(theEndcap.seed());
00087   }
00088 
00089   if(num_bar > 0 && num_endcap > 0)
00090   {
00091     LogTrace(metname) << "Overlap Seed" << endl;
00092     std::vector<TrajectorySeed> overlapSeeds = theOverlap.seeds();
00093     result.insert(result.end(), overlapSeeds.begin(), overlapSeeds.end());
00094   }
00095 
00096   theBarrel.clear();
00097   theOverlap.clear();
00098   theEndcap.clear();
00099 
00100 
00101 }
00102