Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-06-03 00:59:25

0001 /**
0002  *  See header file for a description of this class.
0003  *
0004  */
0005 
0006 #include "RecoMuon/MuonSeedGenerator/src/RPCSeedFinder.h"
0007 #include <iomanip>
0008 
0009 using namespace std;
0010 using namespace edm;
0011 
0012 RPCSeedFinder::RPCSeedFinder() {
0013   // Initiate the member
0014   isrecHitsset = false;
0015   isConfigured = false;
0016   isOutputset = false;
0017   isEventSetupset = false;
0018   oneSeed.clear();
0019 }
0020 
0021 RPCSeedFinder::~RPCSeedFinder() {}
0022 
0023 void RPCSeedFinder::configure(const edm::ParameterSet &iConfig) {
0024   oneSeed.configure(iConfig);
0025   isConfigured = true;
0026 }
0027 
0028 void RPCSeedFinder::setOutput(std::vector<weightedTrajectorySeed> *goodweightedRef,
0029                               std::vector<weightedTrajectorySeed> *candidateweightedRef) {
0030   goodweightedSeedsRef = goodweightedRef;
0031   candidateweightedSeedsRef = candidateweightedRef;
0032   isOutputset = true;
0033 }
0034 
0035 void RPCSeedFinder::setrecHits(ConstMuonRecHitContainer &recHits) {
0036   oneSeed.clear();
0037   for (ConstMuonRecHitContainer::const_iterator iter = recHits.begin(); iter != recHits.end(); iter++)
0038     oneSeed.add(*iter);
0039   isrecHitsset = true;
0040 }
0041 
0042 void RPCSeedFinder::setEventSetup(const MagneticField &field, const RPCGeometry &rpcGeom) {
0043   pField = &field;
0044   pRPCGeom = &rpcGeom;
0045   isEventSetupset = true;
0046 }
0047 
0048 void RPCSeedFinder::seed() {
0049   cout << "[RPCSeedFinder] --> seeds called" << endl;
0050 
0051   if (isrecHitsset == false || isOutputset == false || isConfigured == false || isEventSetupset == false) {
0052     cout << "Configuration or IO is not set yet" << endl;
0053     return;
0054   }
0055 
0056   weightedTrajectorySeed theweightedSeed;
0057   int isGoodSeed = 0;
0058 
0059   theweightedSeed = oneSeed.seed(*pField, *pRPCGeom, isGoodSeed);
0060   // Push back the good seed
0061   if (isGoodSeed == 1) {
0062     cout << "[RPCSeedFinder] --> Seeds from " << oneSeed.nrhit() << " recHits." << endl;
0063     goodweightedSeedsRef->push_back(theweightedSeed);
0064   }
0065   // Push back cadidate seed but not the fake seed
0066   if (isGoodSeed >= 0) {
0067     candidateweightedSeedsRef->push_back(theweightedSeed);
0068   }
0069 
0070   // Unset the signal
0071   oneSeed.clear();
0072   isrecHitsset = false;
0073 }