CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch13/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.24 2010/09/26 15:54:05 slava77 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/MuonReco/interface/Muon.h"
00041 #include "DataFormats/MuonReco/interface/MuonTrackLinks.h"
00042 #include "DataFormats/MuonReco/interface/MuonFwd.h"
00043 
00044 #include "TrackingTools/TrackAssociator/interface/TrackDetectorAssociator.h"
00045 // #include "Utilities/Timing/interface/TimerStack.h"
00046 
00047 #include "RecoMuon/MuonIdentification/interface/MuonTimingFiller.h"
00048 #include "RecoMuon/MuonIdentification/interface/MuonCaloCompatibility.h"
00049 #include "PhysicsTools/IsolationAlgos/interface/IsoDepositExtractor.h"
00050 
00051 class MuonMesh;
00052 
00053 class MuonIdProducer : public edm::EDProducer {
00054  public:
00055    enum TrackType { InnerTrack, OuterTrack, CombinedTrack };
00056         
00057    explicit MuonIdProducer(const edm::ParameterSet&);
00058    
00059    virtual ~MuonIdProducer();
00060    
00061    virtual void produce(edm::Event&, const edm::EventSetup&);
00062    virtual void beginRun(edm::Run&, const edm::EventSetup&);
00063    
00064    static double sectorPhi( const DetId& id );
00065 
00066  private:
00067    void          fillMuonId( edm::Event&, const edm::EventSetup&, reco::Muon&, 
00068                              TrackDetectorAssociator::Direction direction = TrackDetectorAssociator::InsideOut );
00069    void          fillArbitrationInfo( reco::MuonCollection* );
00070    void          fillMuonIsolation( edm::Event&, const edm::EventSetup&, reco::Muon& aMuon,
00071                                     reco::IsoDeposit& trackDep, reco::IsoDeposit& ecalDep, reco::IsoDeposit& hcalDep, reco::IsoDeposit& hoDep,
00072                                     reco::IsoDeposit& jetDep);
00073    void          fillGlbQuality( edm::Event&, const edm::EventSetup&, reco::Muon& aMuon );
00074    void          init( edm::Event&, const edm::EventSetup& );
00075    
00076    // make a muon based on a track ref
00077    reco::Muon    makeMuon( edm::Event& iEvent, const edm::EventSetup& iSetup, 
00078                            const reco::TrackRef& track, TrackType type);
00079    // make a global muon based on the links object
00080    reco::Muon    makeMuon( const reco::MuonTrackLinks& links );
00081    
00082    // make a muon based on track (p4)
00083    reco::Muon    makeMuon( const reco::Track& track );
00084    
00085    reco::CaloMuon makeCaloMuon( const reco::Muon& );
00086 
00087    // check if a silicon track satisfies the trackerMuon requirements
00088    bool          isGoodTrack( const reco::Track& track );
00089    
00090    bool          isGoodTrackerMuon( const reco::Muon& muon );
00091    
00092    // check number of common DetIds for a given trackerMuon and a stand alone
00093    // muon track
00094    int           overlap(const reco::Muon& muon, const reco::Track& track);
00095 
00096    unsigned int  chamberId(const DetId&);
00097    
00098    double phiOfMuonIneteractionRegion( const reco::Muon& muon ) const;
00099 
00100    bool checkLinks(const reco::MuonTrackLinks*) const ;
00101      
00102    TrackDetectorAssociator trackAssociator_;
00103    TrackAssociatorParameters parameters_;
00104    
00105    std::vector<edm::InputTag> inputCollectionLabels_;
00106    std::vector<std::string>   inputCollectionTypes_;
00107 
00108    MuonTimingFiller* theTimingFiller_;
00109 
00110    // selections
00111    double minPt_;
00112    double minP_;
00113    double minPCaloMuon_;
00114    int    minNumberOfMatches_;
00115    double maxAbsEta_;
00116    bool   addExtraSoftMuons_;
00117    
00118    // matching
00119    double maxAbsDx_;
00120    double maxAbsPullX_;
00121    double maxAbsDy_;
00122    double maxAbsPullY_;
00123    
00124    // what information to fill
00125    bool fillCaloCompatibility_;
00126    bool fillEnergy_;
00127    bool fillMatching_;
00128    bool fillIsolation_;
00129    bool writeIsoDeposits_;
00130    double ptThresholdToFillCandidateP4WithGlobalFit_;
00131    double sigmaThresholdToFillCandidateP4WithGlobalFit_;
00132    
00133    bool debugWithTruthMatching_;
00134 
00135    edm::Handle<reco::TrackCollection>             innerTrackCollectionHandle_;
00136    edm::Handle<reco::TrackCollection>             outerTrackCollectionHandle_;
00137    edm::Handle<reco::MuonCollection>              muonCollectionHandle_;
00138    edm::Handle<reco::MuonTrackLinksCollection>    linkCollectionHandle_;
00139    
00140    MuonCaloCompatibility muonCaloCompatibility_;
00141    reco::isodeposit::IsoDepositExtractor* muIsoExtractorCalo_;
00142    reco::isodeposit::IsoDepositExtractor* muIsoExtractorTrack_;
00143    reco::isodeposit::IsoDepositExtractor* muIsoExtractorJet_;
00144    std::string trackDepositName_;
00145    std::string ecalDepositName_;
00146    std::string hcalDepositName_;
00147    std::string hoDepositName_;
00148    std::string jetDepositName_;
00149 
00150    bool          fillGlobalTrackQuality_;
00151    edm::InputTag globalTrackQualityInputTag_;
00152    double caloCut_;
00153    
00154    bool arbClean_;
00155    MuonMesh* meshAlgo_;
00156 
00157 };
00158 #endif