Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:26:04

0001 /**
0002  *  See header file for a description of this class.
0003  *
0004  *  \author A. Vitelli - INFN Torino, V.Palichik
0005  *  \author porting  R. Bellan
0006  *
0007  */
0008 
0009 #include "RecoMuon/MuonSeedGenerator/src/MuonSeedFinder.h"
0010 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0011 
0012 using namespace std;
0013 
0014 typedef MuonTransientTrackingRecHit::MuonRecHitPointer MuonRecHitPointer;
0015 typedef MuonTransientTrackingRecHit::ConstMuonRecHitPointer ConstMuonRecHitPointer;
0016 typedef MuonTransientTrackingRecHit::MuonRecHitContainer MuonRecHitContainer;
0017 
0018 MuonSeedFinder::MuonSeedFinder(const edm::ParameterSet& pset) : theBarrel(), theOverlap(), theEndcap() {
0019   // FIXME put it in a pSet
0020   // theMinMomentum = pset.getParameter<double>("EndCapSeedMinPt");  //3.0
0021   theMinMomentum = 3.0;
0022   thePtExtractor = new MuonSeedPtExtractor(pset);
0023   theBarrel.setPtExtractor(thePtExtractor);
0024   theOverlap.setPtExtractor(thePtExtractor);
0025   theEndcap.setPtExtractor(thePtExtractor);
0026 }
0027 
0028 void MuonSeedFinder::setBField(const MagneticField* field) {
0029   theField = field;
0030   theBarrel.setBField(field);
0031   theOverlap.setBField(field);
0032   theEndcap.setBField(field);
0033 }
0034 
0035 void MuonSeedFinder::seeds(const MuonTransientTrackingRecHit::MuonRecHitContainer& hits,
0036                            std::vector<TrajectorySeed>& result) {
0037   const std::string metname = "Muon|RecoMuon|MuonSeedFinder";
0038 
0039   //  MuonDumper debug;
0040 
0041   unsigned int num_bar = 0;
0042   for (MuonRecHitContainer::const_iterator iter = hits.begin(); iter != hits.end(); iter++) {
0043     if ((*iter)->isDT()) {
0044       theBarrel.add(*iter);
0045       theOverlap.add(*iter);
0046       num_bar++;
0047     }
0048   }
0049 
0050   unsigned int num_endcap = 0;
0051   for (MuonRecHitContainer::const_iterator iter = hits.begin(); iter != hits.end(); iter++) {
0052     if ((*iter)->isCSC() || (*iter)->isME0()) {
0053       theEndcap.add(*iter);
0054       theOverlap.add(*iter);
0055       ++num_endcap;
0056     }
0057   }
0058 
0059   // don't do dim-2 seeds in the overlap
0060   if (num_bar > 1 || (num_bar == 1 && (num_endcap == 0 || theBarrel.firstRecHit()->dimension() == 4))) {
0061     LogDebug(metname) << "Barrel Seeds " << num_bar << endl;
0062     result.push_back(theBarrel.seed());
0063   }
0064 
0065   if (num_endcap > 1 || (num_endcap == 1 && num_bar == 0)) {
0066     LogDebug(metname) << "Endcap Seeds " << num_endcap << endl;
0067     result.push_back(theEndcap.seed());
0068   }
0069 
0070   if (num_bar > 0 && num_endcap > 0) {
0071     LogTrace(metname) << "Overlap Seed" << endl;
0072     std::vector<TrajectorySeed> overlapSeeds = theOverlap.seeds();
0073     result.insert(result.end(), overlapSeeds.begin(), overlapSeeds.end());
0074   }
0075 
0076   theBarrel.clear();
0077   theOverlap.clear();
0078   theEndcap.clear();
0079 }