Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:27:04

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 "Geometry/CaloGeometry/interface/CaloGeometry.h"
0029 #include "Geometry/Records/interface/CaloGeometryRecord.h"
0030 #include "MagneticField/Engine/interface/MagneticField.h"
0031 #include "MagneticField/Records/interface/IdealMagneticFieldRecord.h"
0032 
0033 class TrackAssociatorParameters;
0034 class TrackDetectorAssociator;
0035 class MuonServiceProxy;
0036 
0037 namespace muonisolation {
0038 
0039   class CaloExtractorByAssociator : public reco::isodeposit::IsoDepositExtractor {
0040   public:
0041     //! constructors
0042     CaloExtractorByAssociator(){};
0043     CaloExtractorByAssociator(const edm::ParameterSet& par, edm::ConsumesCollector&& iC);
0044 
0045     //! destructor
0046     ~CaloExtractorByAssociator() override;
0047 
0048     //! allows to set extra vetoes (in addition to the muon) -- no-op at this point
0049     void fillVetos(const edm::Event& ev, const edm::EventSetup& evSetup, const reco::TrackCollection& tracks) override;
0050     //! no-op: by design of this extractor the deposits are pulled out all at a time
0051     reco::IsoDeposit deposit(const edm::Event& ev,
0052                              const edm::EventSetup& evSetup,
0053                              const reco::Track& track) const override;
0054     //! return deposits for 3 calorimeter subdetectors (ecal, hcal, ho) -- in this order
0055     std::vector<reco::IsoDeposit> deposits(const edm::Event& ev,
0056                                            const edm::EventSetup& evSetup,
0057                                            const reco::Track& track) const override;
0058 
0059   private:
0060     //! use towers or rec hits
0061     bool theUseRecHitsFlag;
0062 
0063     //! Label of deposit -- suggest to set to "" (all info is in collection name anyways)
0064     std::string theDepositLabel;
0065 
0066     //! multiple deposits: labels -- expect 3 labels beginning with "e", "h", "ho"
0067     std::vector<std::string> theDepositInstanceLabels;
0068 
0069     //! propagator name to feed into the track associator
0070     std::string thePropagatorName;
0071 
0072     //! Cone cuts and thresholds
0073     //! min values of Et to be included in deposits
0074     double theThreshold_E;
0075     double theThreshold_H;
0076     double theThreshold_HO;
0077 
0078     //! cone sizes inside which the Et (towers) are not counted
0079     double theDR_Veto_E;
0080     double theDR_Veto_H;
0081     double theDR_Veto_HO;
0082     //! centers the cone on the veto direction -- makes more sense for
0083     //! very displaced tracks like in cosmics
0084     bool theCenterConeOnCalIntersection;
0085     //! max cone size in which towers are considered
0086     double theDR_Max;
0087 
0088     //! the noise "sigmas" for a hit or tower to be considered
0089     //! consider if Energy > 3.*sigma
0090     double theNoise_EB;
0091     double theNoise_EE;
0092     double theNoise_HB;
0093     double theNoise_HE;
0094     double theNoise_HO;
0095     double theNoiseTow_EB;
0096     double theNoiseTow_EE;
0097 
0098     //! Vector of calo Ids to veto -- not used
0099     std::vector<DetId> theVetoCollection;
0100 
0101     //! the event setup proxy, it takes care the services update
0102     MuonServiceProxy* theService;
0103 
0104     //! associator, its' parameters and the propagator
0105     TrackAssociatorParameters* theAssociatorParameters;
0106     TrackDetectorAssociator* theAssociator;
0107 
0108     edm::ESGetToken<MagneticField, IdealMagneticFieldRecord> bFieldToken_;
0109     edm::ESGetToken<CaloGeometry, CaloGeometryRecord> caloGeomToken_;
0110 
0111     //! flag to turn on/off printing of a time report
0112     bool thePrintTimeReport;
0113 
0114     //! Determine noise for HCAL and ECAL (take some defaults for the time being)
0115     double noiseEcal(const CaloTower& tower) const;
0116     double noiseHcal(const CaloTower& tower) const;
0117     double noiseHOcal(const CaloTower& tower) const;
0118     double noiseRecHit(const DetId& detId) const;
0119   };
0120 
0121 }  // namespace muonisolation
0122 
0123 #endif