CMS 3D CMS Logo

CMSSW_4_4_3_patch1/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.27 2011/06/08 15:41:13 bellan 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    
00095    // check number of common DetIds for a given trackerMuon and a stand alone
00096    // muon track
00097    int           overlap(const reco::Muon& muon, const reco::Track& track);
00098 
00099    unsigned int  chamberId(const DetId&);
00100    
00101    double phiOfMuonIneteractionRegion( const reco::Muon& muon ) const;
00102 
00103    bool checkLinks(const reco::MuonTrackLinks*) const ;
00104      
00105    TrackDetectorAssociator trackAssociator_;
00106    TrackAssociatorParameters parameters_;
00107    
00108    std::vector<edm::InputTag> inputCollectionLabels_;
00109    std::vector<std::string>   inputCollectionTypes_;
00110 
00111    MuonTimingFiller* theTimingFiller_;
00112 
00113    // selections
00114    double minPt_;
00115    double minP_;
00116    double minPCaloMuon_;
00117    int    minNumberOfMatches_;
00118    double maxAbsEta_;
00119    bool   addExtraSoftMuons_;
00120    
00121    // matching
00122    double maxAbsDx_;
00123    double maxAbsPullX_;
00124    double maxAbsDy_;
00125    double maxAbsPullY_;
00126    
00127    // what information to fill
00128    bool fillCaloCompatibility_;
00129    bool fillEnergy_;
00130    bool fillMatching_;
00131    bool fillIsolation_;
00132    bool writeIsoDeposits_;
00133    double ptThresholdToFillCandidateP4WithGlobalFit_;
00134    double sigmaThresholdToFillCandidateP4WithGlobalFit_;
00135    
00136    bool debugWithTruthMatching_;
00137 
00138    edm::Handle<reco::TrackCollection>             innerTrackCollectionHandle_;
00139    edm::Handle<reco::TrackCollection>             outerTrackCollectionHandle_;
00140    edm::Handle<reco::MuonCollection>              muonCollectionHandle_;
00141    edm::Handle<reco::MuonTrackLinksCollection>    linkCollectionHandle_;
00142    edm::Handle<reco::TrackToTrackMap>             tpfmsCollectionHandle_;
00143    edm::Handle<reco::TrackToTrackMap>             pickyCollectionHandle_;
00144    edm::Handle<reco::TrackToTrackMap>             dytCollectionHandle_;
00145    
00146    MuonCaloCompatibility muonCaloCompatibility_;
00147    reco::isodeposit::IsoDepositExtractor* muIsoExtractorCalo_;
00148    reco::isodeposit::IsoDepositExtractor* muIsoExtractorTrack_;
00149    reco::isodeposit::IsoDepositExtractor* muIsoExtractorJet_;
00150    std::string trackDepositName_;
00151    std::string ecalDepositName_;
00152    std::string hcalDepositName_;
00153    std::string hoDepositName_;
00154    std::string jetDepositName_;
00155 
00156    bool          fillGlobalTrackQuality_;
00157    bool          fillGlobalTrackRefits_ ;
00158    edm::InputTag globalTrackQualityInputTag_;
00159 
00160    bool fillTrackerKink_;
00161    std::auto_ptr<MuonKinkFinder> trackerKinkFinder_;
00162 
00163    double caloCut_;
00164    
00165    bool arbClean_;
00166    MuonMesh* meshAlgo_;
00167 
00168 };
00169 #endif