Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-09-07 04:37:47

0001 #ifndef MuonIsolation_CaloExtractorByAssociator_H
0002 #define MuonIsolation_CaloExtractorByAssociator_H
0003 
0004 /** \class CaloExtractorByAssociator
0005  *  Extracts deposits in each calorimeter section (ECAL, HCAL, HO)
0006  *  vetoes are set based on expected crossed DetIds (xtals, towers)
0007  *  these can later be subtracted from deposits in a cone.
0008  *  All work is done by TrackDetectorAssociator. Because of the heavy
0009  *  weight of the tool, all extractions can (should?) be placed in a single place.
0010  *
0011  *  \author S. Krutelyov
0012  */
0013 
0014 #include <string>
0015 
0016 #include "PhysicsTools/IsolationAlgos/interface/IsoDepositExtractor.h"
0017 
0018 #include "FWCore/Framework/interface/ConsumesCollector.h"
0019 
0020 #include "DataFormats/RecoCandidate/interface/IsoDeposit.h"
0021 #include "DataFormats/TrackReco/interface/Track.h"
0022 #include "DataFormats/TrackReco/interface/TrackFwd.h"
0023 
0024 #include "DataFormats/CaloTowers/interface/CaloTowerCollection.h"
0025 
0026 #include "DataFormats/GeometryVector/interface/GlobalPoint.h"
0027 
0028 #include "CondFormats/EcalObjects/interface/EcalPFRecHitThresholds.h"
0029 #include "CondFormats/DataRecord/interface/EcalPFRecHitThresholdsRcd.h"
0030 #include "CondFormats/DataRecord/interface/HcalPFCutsRcd.h"
0031 #include "CondFormats/HcalObjects/interface/HcalChannelQuality.h"
0032 #include "CondFormats/DataRecord/interface/HcalChannelQualityRcd.h"
0033 #include "CondTools/Hcal/interface/HcalPFCutsHandler.h"
0034 
0035 #include "Geometry/CaloGeometry/interface/CaloGeometry.h"
0036 #include "Geometry/CaloTopology/interface/HcalTopology.h"
0037 #include "Geometry/Records/interface/CaloGeometryRecord.h"
0038 #include "MagneticField/Engine/interface/MagneticField.h"
0039 #include "MagneticField/Records/interface/IdealMagneticFieldRecord.h"
0040 #include "RecoLocalCalo/HcalRecAlgos/interface/HcalSeverityLevelComputer.h"
0041 #include "RecoLocalCalo/HcalRecAlgos/interface/HcalSeverityLevelComputerRcd.h"
0042 
0043 class TrackAssociatorParameters;
0044 class TrackDetectorAssociator;
0045 class MuonServiceProxy;
0046 
0047 namespace muonisolation {
0048 
0049   class CaloExtractorByAssociator : public reco::isodeposit::IsoDepositExtractor {
0050   public:
0051     //! constructors
0052     CaloExtractorByAssociator() {}
0053     CaloExtractorByAssociator(const edm::ParameterSet& par, edm::ConsumesCollector&& iC);
0054 
0055     //! destructor
0056     ~CaloExtractorByAssociator() override;
0057 
0058     //! allows to set extra vetoes (in addition to the muon) -- no-op at this point
0059     void fillVetos(const edm::Event& ev, const edm::EventSetup& evSetup, const reco::TrackCollection& tracks) override;
0060     //! no-op: by design of this extractor the deposits are pulled out all at a time
0061     reco::IsoDeposit deposit(const edm::Event& ev,
0062                              const edm::EventSetup& evSetup,
0063                              const reco::Track& track) const override;
0064     //! return deposits for 3 calorimeter subdetectors (ecal, hcal, ho) -- in this order
0065     std::vector<reco::IsoDeposit> deposits(const edm::Event& ev,
0066                                            const edm::EventSetup& evSetup,
0067                                            const reco::Track& track) const override;
0068 
0069   private:
0070     //! use towers or rec hits
0071     bool theUseEcalRecHitsFlag;
0072     bool theUseHcalRecHitsFlag;
0073     bool theUseHORecHitsFlag;
0074 
0075     //! Label of deposit -- suggest to set to "" (all info is in collection name anyways)
0076     std::string theDepositLabel;
0077 
0078     //! multiple deposits: labels -- expect 3 labels beginning with "e", "h", "ho"
0079     std::vector<std::string> theDepositInstanceLabels;
0080 
0081     //! propagator name to feed into the track associator
0082     std::string thePropagatorName;
0083 
0084     //! Cone cuts and thresholds
0085     //! min values of Et to be included in deposits
0086     double theThreshold_E;
0087     double theThreshold_H;
0088     double theThreshold_HO;
0089     int theMaxSeverityHB;
0090     int theMaxSeverityHE;
0091 
0092     //! cone sizes inside which the Et (towers) are not counted
0093     double theDR_Veto_E;
0094     double theDR_Veto_H;
0095     double theDR_Veto_HO;
0096     //! centers the cone on the veto direction -- makes more sense for
0097     //! very displaced tracks like in cosmics
0098     bool theCenterConeOnCalIntersection;
0099     //! max cone size in which towers are considered
0100     double theDR_Max;
0101 
0102     //! the noise "sigmas" for a hit or tower to be considered
0103     //! consider if Energy > 3.*sigma
0104     double theNoise_EB;
0105     double theNoise_EE;
0106     double theNoise_HB;
0107     double theNoise_HE;
0108     double theNoise_HO;
0109     double theNoiseTow_EB;
0110     double theNoiseTow_EE;
0111 
0112     //! Vector of calo Ids to veto -- not used
0113     std::vector<DetId> theVetoCollection;
0114 
0115     //! the event setup proxy, it takes care the services update
0116     MuonServiceProxy* theService;
0117 
0118     //! associator, its' parameters and the propagator
0119     TrackAssociatorParameters* theAssociatorParameters;
0120     TrackDetectorAssociator* theAssociator;
0121 
0122     edm::ESGetToken<MagneticField, IdealMagneticFieldRecord> bFieldToken_;
0123     edm::ESGetToken<CaloGeometry, CaloGeometryRecord> caloGeomToken_;
0124 
0125     // Ecal noise thresholds
0126     edm::ESGetToken<EcalPFRecHitThresholds, EcalPFRecHitThresholdsRcd> ecalPFRechitThresholdsToken_;
0127     bool ecalRecHitThresh_;
0128     EcalPFRecHitThresholds* ecalThresholds = nullptr;
0129 
0130     // following are needed to grab HCal thresholds from GT
0131     edm::ESGetToken<HcalPFCuts, HcalPFCutsRcd> hcalCutsToken_;
0132     bool hcalCutsFromDB_;
0133     HcalPFCuts* hcalCuts = nullptr;
0134 
0135     edm::ESGetToken<HcalTopology, HcalRecNumberingRecord> hcalTopologyToken_;
0136     edm::ESGetToken<HcalChannelQuality, HcalChannelQualityRcd> hcalChannelQualityToken_;
0137     edm::ESGetToken<HcalSeverityLevelComputer, HcalSeverityLevelComputerRcd> hcalSevLvlComputerToken_;
0138     HcalTopology* hcalTopology_;
0139     HcalChannelQuality* hcalChStatus_;
0140     HcalSeverityLevelComputer* hcalSevLvlComputer_;
0141 
0142     //! flag to turn on/off printing of a time report
0143     bool thePrintTimeReport;
0144 
0145     //! Determine noise for HCAL and ECAL (take some defaults for the time being)
0146     double noiseEcal(const CaloTower& tower) const;
0147     double noiseHcal(const CaloTower& tower) const;
0148     double noiseHOcal(const CaloTower& tower) const;
0149     double noiseRecHit(const DetId& detId) const;
0150   };
0151 
0152 }  // namespace muonisolation
0153 
0154 #endif