Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:25:55

0001 #ifndef RecoMuon_MuonIdentification_MuonProducer_H
0002 #define RecoMuon_MuonIdentification_MuonProducer_H
0003 
0004 /** \class MuonProducer
0005  *  Producer meant for the Post PF reconstruction.
0006  *
0007  * This class takes the muon collection produced before the PF is run (muons1Step) and the information calculated after that 
0008  * the entire event has been reconstructed. The collections produced here are meant to be used for the final analysis (or as PAT input).
0009  * The previous muon collection is meant to be transient.
0010  *
0011  *  \author R. Bellan - UCSB <riccardo.bellan@cern.ch>
0012  */
0013 
0014 #include "FWCore/Framework/interface/stream/EDProducer.h"
0015 #include "FWCore/Utilities/interface/InputTag.h"
0016 
0017 #include "DataFormats/MuonReco/interface/MuonFwd.h"
0018 #include "DataFormats/MuonReco/interface/MuonTimeExtra.h"
0019 
0020 namespace reco {
0021   class Track;
0022 }
0023 #include "FWCore/Framework/interface/ESHandle.h"
0024 #include "Geometry/CommonDetUnit/interface/GlobalTrackingGeometry.h"
0025 
0026 #include "FWCore/Framework/interface/Event.h"
0027 #include "FWCore/Framework/interface/EventSetup.h"
0028 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0029 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0030 
0031 #include "DataFormats/MuonReco/interface/Muon.h"
0032 #include "DataFormats/MuonReco/interface/MuonTrackLinks.h"
0033 #include "DataFormats/MuonReco/interface/MuonTimeExtraMap.h"
0034 #include "DataFormats/MuonReco/interface/MuonShower.h"
0035 #include "DataFormats/MuonReco/interface/MuonCosmicCompatibility.h"
0036 #include "DataFormats/MuonReco/interface/MuonToMuonMap.h"
0037 
0038 #include "DataFormats/ParticleFlowCandidate/interface/PFCandidate.h"
0039 #include "DataFormats/ParticleFlowCandidate/interface/PFCandidateFwd.h"
0040 
0041 #include "DataFormats/Common/interface/ValueMap.h"
0042 #include "DataFormats/RecoCandidate/interface/IsoDepositFwd.h"
0043 #include "DataFormats/RecoCandidate/interface/IsoDeposit.h"
0044 #include "DataFormats/VertexReco/interface/VertexFwd.h"
0045 
0046 class MuPFIsoHelper;
0047 
0048 class MuonProducer : public edm::stream::EDProducer<> {
0049 public:
0050   /// Constructor
0051   MuonProducer(const edm::ParameterSet&);
0052 
0053   /// Destructor
0054   ~MuonProducer() override;
0055 
0056   /// reconstruct muons
0057   void produce(edm::Event&, const edm::EventSetup&) override;
0058 
0059   typedef std::vector<edm::InputTag> InputTags;
0060 
0061 protected:
0062 private:
0063   template <typename TYPE>
0064   void fillMuonMap(edm::Event& event,
0065                    const edm::OrphanHandle<reco::MuonCollection>& muonHandle,
0066                    const std::vector<TYPE>& muonExtra,
0067                    const std::string& label);
0068 
0069   std::string theAlias;
0070 
0071   void setAlias(std::string alias) {
0072     alias.erase(alias.size() - 1, alias.size());
0073     theAlias = alias;
0074   }
0075 
0076   std::string labelOrInstance(const edm::InputTag&) const;
0077 
0078 private:
0079   bool debug_;
0080   bool fastLabelling_;
0081 
0082   edm::InputTag theMuonsCollectionLabel;
0083   edm::EDGetTokenT<reco::MuonCollection> theMuonsCollectionToken_;
0084 
0085   edm::InputTag thePFCandLabel;
0086   edm::EDGetTokenT<reco::PFCandidateCollection> thePFCandToken_;
0087 
0088   bool fillIsolation_;
0089   bool writeIsoDeposits_;
0090   bool fillSelectors_;
0091   bool fillCosmicsIdMap_;
0092   bool fillPFMomentum_;
0093   bool fillPFIsolation_;
0094   bool fillDetectorBasedIsolation_;
0095   bool fillShoweringInfo_;
0096   bool fillTimingInfo_;
0097   bool computeStandardSelectors_;
0098 
0099   edm::InputTag theTrackDepositName;
0100   edm::InputTag theEcalDepositName;
0101   edm::InputTag theHcalDepositName;
0102   edm::InputTag theHoDepositName;
0103   edm::InputTag theJetDepositName;
0104 
0105   edm::EDGetTokenT<reco::IsoDepositMap> theTrackDepositToken_;
0106   edm::EDGetTokenT<reco::IsoDepositMap> theEcalDepositToken_;
0107   edm::EDGetTokenT<reco::IsoDepositMap> theHcalDepositToken_;
0108   edm::EDGetTokenT<reco::IsoDepositMap> theHoDepositToken_;
0109   edm::EDGetTokenT<reco::IsoDepositMap> theJetDepositToken_;
0110 
0111   InputTags theSelectorMapNames;
0112   std::vector<edm::EDGetTokenT<edm::ValueMap<bool> > > theSelectorMapTokens_;
0113 
0114   edm::InputTag theShowerMapName;
0115   edm::EDGetTokenT<edm::ValueMap<reco::MuonShower> > theShowerMapToken_;
0116 
0117   edm::InputTag theCosmicCompMapName;
0118   edm::EDGetTokenT<edm::ValueMap<unsigned int> > theCosmicIdMapToken_;
0119   edm::EDGetTokenT<edm::ValueMap<reco::MuonCosmicCompatibility> > theCosmicCompMapToken_;
0120   std::string theMuToMuMapName;
0121 
0122   MuPFIsoHelper* thePFIsoHelper;
0123 
0124   edm::EDGetTokenT<reco::MuonTimeExtraMap> timeMapCmbToken_;
0125   edm::EDGetTokenT<reco::MuonTimeExtraMap> timeMapDTToken_;
0126   edm::EDGetTokenT<reco::MuonTimeExtraMap> timeMapCSCToken_;
0127 
0128   std::vector<std::map<std::string, edm::InputTag> > pfIsoMapNames;
0129   std::vector<std::map<std::string, edm::EDGetTokenT<edm::ValueMap<double> > > > pfIsoMapTokens_;
0130 
0131   edm::EDGetTokenT<reco::VertexCollection> vertexes_;
0132 };
0133 #endif