CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_1/src/RecoMuon/MuonIdentification/plugins/MuonIdProducer.h

Go to the documentation of this file.
00001 #ifndef MuonIdentification_MuonIdProducer_h
00002 #define MuonIdentification_MuonIdProducer_h
00003 
00004 // -*- C++ -*-
00005 //
00006 // Package:    MuonIdentification
00007 // Class:      MuonIdProducer
00008 // 
00009 /*
00010 
00011  Description: reco::Muon producer that can fill various information:
00012               - track-segment matching
00013               - energy deposition
00014               - muon isolation
00015               - muon hypothesis compatibility (calorimeter)
00016               Acceptable inputs:
00017               - reco::TrackCollection
00018               - reco::MuonCollection
00019               - reco::MuonTrackLinksCollection
00020 */
00021 //
00022 // Original Author:  Dmytro Kovalskyi
00023 // $Id: MuonIdProducer.h,v 1.28 2012/08/21 21:20:01 mskim Exp $
00024 //
00025 //
00026 
00027 
00028 // user include files
00029 #include "FWCore/Framework/interface/Frameworkfwd.h"
00030 #include "FWCore/Framework/interface/EDProducer.h"
00031 
00032 #include "FWCore/Framework/interface/Event.h"
00033 #include "FWCore/Framework/interface/EventSetup.h"
00034 #include "FWCore/Framework/interface/MakerMacros.h"
00035 
00036 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00037 
00038 #include "DataFormats/Common/interface/Handle.h"
00039 #include "DataFormats/TrackReco/interface/Track.h"
00040 #include "DataFormats/TrackReco/interface/TrackToTrackMap.h"
00041 #include "DataFormats/MuonReco/interface/Muon.h"
00042 #include "DataFormats/MuonReco/interface/MuonTrackLinks.h"
00043 #include "DataFormats/MuonReco/interface/MuonFwd.h"
00044 
00045 #include "TrackingTools/TrackAssociator/interface/TrackDetectorAssociator.h"
00046 // #include "Utilities/Timing/interface/TimerStack.h"
00047 
00048 #include "RecoMuon/MuonIdentification/interface/MuonTimingFiller.h"
00049 #include "RecoMuon/MuonIdentification/interface/MuonCaloCompatibility.h"
00050 #include "PhysicsTools/IsolationAlgos/interface/IsoDepositExtractor.h"
00051 
00052 class MuonMesh;
00053 class MuonKinkFinder;
00054 
00055 class MuonIdProducer : public edm::EDProducer {
00056  public:
00057    typedef reco::Muon::MuonTrackType TrackType;
00058   
00059    explicit MuonIdProducer(const edm::ParameterSet&);
00060    
00061    virtual ~MuonIdProducer();
00062    
00063    virtual void produce(edm::Event&, const edm::EventSetup&);
00064    virtual void beginRun(edm::Run&, const edm::EventSetup&);
00065    
00066    static double sectorPhi( const DetId& id );
00067 
00068  private:
00069    void          fillMuonId( edm::Event&, const edm::EventSetup&, reco::Muon&, 
00070                              TrackDetectorAssociator::Direction direction = TrackDetectorAssociator::InsideOut );
00071    void          fillArbitrationInfo( reco::MuonCollection* );
00072    void          fillMuonIsolation( edm::Event&, const edm::EventSetup&, reco::Muon& aMuon,
00073                                     reco::IsoDeposit& trackDep, reco::IsoDeposit& ecalDep, reco::IsoDeposit& hcalDep, reco::IsoDeposit& hoDep,
00074                                     reco::IsoDeposit& jetDep);
00075    void          fillGlbQuality( edm::Event&, const edm::EventSetup&, reco::Muon& aMuon );
00076    void          fillTrackerKink( reco::Muon& aMuon ); 
00077    void          init( edm::Event&, const edm::EventSetup& );
00078    
00079    // make a muon based on a track ref
00080    reco::Muon    makeMuon( edm::Event& iEvent, const edm::EventSetup& iSetup, 
00081                            const reco::TrackRef& track, TrackType type);
00082    // make a global muon based on the links object
00083    reco::Muon    makeMuon( const reco::MuonTrackLinks& links );
00084    
00085    // make a muon based on track (p4)
00086    reco::Muon    makeMuon( const reco::Track& track );
00087    
00088    reco::CaloMuon makeCaloMuon( const reco::Muon& );
00089 
00090    // check if a silicon track satisfies the trackerMuon requirements
00091    bool          isGoodTrack( const reco::Track& track );
00092    
00093    bool          isGoodTrackerMuon( const reco::Muon& muon );
00094    bool          isGoodRPCMuon( const reco::Muon& muon );
00095    
00096    // check number of common DetIds for a given trackerMuon and a stand alone
00097    // muon track
00098    int           overlap(const reco::Muon& muon, const reco::Track& track);
00099 
00100    unsigned int  chamberId(const DetId&);
00101    
00102    double phiOfMuonIneteractionRegion( const reco::Muon& muon ) const;
00103 
00104    bool checkLinks(const reco::MuonTrackLinks*) const ;
00105      
00106    TrackDetectorAssociator trackAssociator_;
00107    TrackAssociatorParameters parameters_;
00108    
00109    std::vector<edm::InputTag> inputCollectionLabels_;
00110    std::vector<std::string>   inputCollectionTypes_;
00111 
00112    MuonTimingFiller* theTimingFiller_;
00113 
00114    // selections
00115    double minPt_;
00116    double minP_;
00117    double minPCaloMuon_;
00118    int    minNumberOfMatches_;
00119    double maxAbsEta_;
00120    bool   addExtraSoftMuons_;
00121    
00122    // matching
00123    double maxAbsDx_;
00124    double maxAbsPullX_;
00125    double maxAbsDy_;
00126    double maxAbsPullY_;
00127    
00128    // what information to fill
00129    bool fillCaloCompatibility_;
00130    bool fillEnergy_;
00131    bool fillMatching_;
00132    bool fillIsolation_;
00133    bool writeIsoDeposits_;
00134    double ptThresholdToFillCandidateP4WithGlobalFit_;
00135    double sigmaThresholdToFillCandidateP4WithGlobalFit_;
00136    
00137    bool debugWithTruthMatching_;
00138 
00139    edm::Handle<reco::TrackCollection>             innerTrackCollectionHandle_;
00140    edm::Handle<reco::TrackCollection>             outerTrackCollectionHandle_;
00141    edm::Handle<reco::MuonCollection>              muonCollectionHandle_;
00142    edm::Handle<reco::MuonTrackLinksCollection>    linkCollectionHandle_;
00143    edm::Handle<reco::TrackToTrackMap>             tpfmsCollectionHandle_;
00144    edm::Handle<reco::TrackToTrackMap>             pickyCollectionHandle_;
00145    edm::Handle<reco::TrackToTrackMap>             dytCollectionHandle_;
00146    
00147    MuonCaloCompatibility muonCaloCompatibility_;
00148    reco::isodeposit::IsoDepositExtractor* muIsoExtractorCalo_;
00149    reco::isodeposit::IsoDepositExtractor* muIsoExtractorTrack_;
00150    reco::isodeposit::IsoDepositExtractor* muIsoExtractorJet_;
00151    std::string trackDepositName_;
00152    std::string ecalDepositName_;
00153    std::string hcalDepositName_;
00154    std::string hoDepositName_;
00155    std::string jetDepositName_;
00156 
00157    bool          fillGlobalTrackQuality_;
00158    bool          fillGlobalTrackRefits_ ;
00159    edm::InputTag globalTrackQualityInputTag_;
00160 
00161    bool fillTrackerKink_;
00162    std::auto_ptr<MuonKinkFinder> trackerKinkFinder_;
00163 
00164    double caloCut_;
00165    
00166    bool arbClean_;
00167    MuonMesh* meshAlgo_;
00168 
00169 };
00170 #endif