Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-01-04 23:06:06

0001 /**
0002 
0003 Description: Producer for EcalRecHits to be used for pi0/eta ECAL calibration. 
0004 
0005 
0006  Implementation:
0007      <Notes on implementation>
0008 */
0009 //
0010 // Original Authors:  Vladimir Litvine , Yong Yang
0011 
0012 // system include files
0013 #include <memory>
0014 #include <algorithm>
0015 #include <utility>
0016 #include <vector>
0017 
0018 // user include files
0019 #include "FWCore/Framework/interface/Frameworkfwd.h"
0020 #include "FWCore/Framework/interface/stream/EDFilter.h"
0021 #include "FWCore/Framework/interface/Event.h"
0022 #include "FWCore/Framework/interface/EventSetup.h"
0023 #include "FWCore/Framework/interface/ESHandle.h"
0024 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0025 #include "DataFormats/Common/interface/Handle.h"
0026 
0027 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0028 #include "FWCore/Utilities/interface/InputTag.h"
0029 
0030 #include "DataFormats/EcalRecHit/interface/EcalRecHit.h"
0031 #include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h"
0032 
0033 // Geometry
0034 #include "Geometry/Records/interface/CaloTopologyRecord.h"
0035 #include "Geometry/CaloTopology/interface/CaloTopology.h"
0036 #include "Geometry/CaloTopology/interface/CaloSubdetectorTopology.h"
0037 #include "Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h"
0038 #include "Geometry/CaloGeometry/interface/CaloCellGeometry.h"
0039 #include "Geometry/CaloGeometry/interface/CaloGeometry.h"
0040 #include "Geometry/CaloTopology/interface/EcalEndcapTopology.h"
0041 #include "Geometry/CaloTopology/interface/EcalBarrelTopology.h"
0042 #include "Geometry/Records/interface/CaloGeometryRecord.h"
0043 
0044 #include "DataFormats/EcalDetId/interface/EBDetId.h"
0045 #include "DataFormats/EcalDetId/interface/EEDetId.h"
0046 #include "DataFormats/DetId/interface/DetId.h"
0047 
0048 #include "DataFormats/EgammaReco/interface/BasicCluster.h"
0049 #include "DataFormats/EgammaReco/interface/BasicClusterFwd.h"
0050 #include "RecoEcal/EgammaCoreTools/interface/PositionCalc.h"
0051 
0052 // ES stuff
0053 #include "DataFormats/EgammaReco/interface/PreshowerCluster.h"
0054 #include "RecoEcal/EgammaClusterAlgos/interface/PreshowerClusterAlgo.h"
0055 #include "Geometry/EcalAlgo/interface/EcalPreshowerGeometry.h"
0056 #include "Geometry/CaloTopology/interface/EcalPreshowerTopology.h"
0057 #include "DataFormats/EgammaReco/interface/PreshowerClusterFwd.h"
0058 
0059 // Ecal status
0060 #include "CondFormats/DataRecord/interface/EcalChannelStatusRcd.h"
0061 #include "CondFormats/EcalObjects/interface/EcalChannelStatus.h"
0062 
0063 namespace edm {
0064   class ConfigurationDescriptions;
0065 }
0066 
0067 class HLTEcalResonanceFilter : public edm::stream::EDFilter<> {
0068 public:
0069   explicit HLTEcalResonanceFilter(const edm::ParameterSet &);
0070   ~HLTEcalResonanceFilter() override;
0071 
0072   bool filter(edm::Event &, const edm::EventSetup &) override;
0073   static void fillDescriptions(edm::ConfigurationDescriptions &descriptions);
0074 
0075 private:
0076   // ----------member data ---------------------------
0077   void doSelection(int detector,
0078                    const reco::BasicClusterCollection *clusterCollection,
0079                    const EcalRecHitCollection *hitCollection,
0080                    const EcalChannelStatus &channelStatus,
0081                    const CaloSubdetectorTopology *topology_p,
0082                    std::map<int, std::vector<EcalRecHit> > &RecHits5x5_clus,
0083                    std::vector<int> &indCandClus,     ///good cluster all ,  5x5 rechit done already during the loop
0084                    std::vector<int> &indIsoClus,      /// Iso cluster all , 5x5 rechit not yet done
0085                    std::vector<int> &indClusSelected  /// saved so far, all
0086   );
0087 
0088   void makeClusterES(
0089       float x, float y, float z, const CaloSubdetectorGeometry *iSubGeom, const CaloSubdetectorTopology *topology_p);
0090 
0091   void calcPaircluster(const reco::BasicCluster &bc1,
0092                        const reco::BasicCluster &bc2,
0093                        float &mpair,
0094                        float &ptpair,
0095                        float &etapair,
0096                        float &phipair);
0097 
0098   bool checkStatusOfEcalRecHit(const EcalChannelStatus &channelStatus, const EcalRecHit &rh);
0099 
0100   void calcShowerShape(const reco::BasicCluster &bc,
0101                        const EcalChannelStatus &channelStatus,
0102                        const EcalRecHitCollection *recHits,
0103                        const CaloSubdetectorTopology *topology_p,
0104                        bool calc5x5,
0105                        std::vector<EcalRecHit> &rechit5x5,
0106                        float res[]);
0107 
0108   void convxtalid(int &, int &);
0109   int diff_neta_s(int, int);
0110   int diff_nphi_s(int, int);
0111 
0112   static float DeltaPhi(float phi1, float phi2);
0113   static float GetDeltaR(float eta1, float eta2, float phi1, float phi2);
0114 
0115   edm::ESGetToken<CaloTopology, CaloTopologyRecord> const caloTopologyRecordToken_;
0116   edm::ESGetToken<EcalChannelStatus, EcalChannelStatusRcd> const ecalChannelStatusRcdToken_;
0117   edm::ESGetToken<CaloGeometry, CaloGeometryRecord> const caloGeometryRecordToken_;
0118 
0119   // Input hits & clusters
0120   edm::InputTag barrelHits_;
0121   edm::InputTag endcapHits_;
0122   edm::InputTag barrelClusters_;
0123   edm::InputTag endcapClusters_;
0124 
0125   edm::EDGetTokenT<EBRecHitCollection> barrelHitsToken_;
0126   edm::EDGetTokenT<EERecHitCollection> endcapHitsToken_;
0127   edm::EDGetTokenT<ESRecHitCollection> preshHitsToken_;
0128   edm::EDGetTokenT<reco::BasicClusterCollection> barrelClustersToken_;
0129   edm::EDGetTokenT<reco::BasicClusterCollection> endcapClustersToken_;
0130 
0131   ///output hits
0132   std::string BarrelHits_;
0133   std::string EndcapHits_;
0134   std::string ESHits_;
0135 
0136   ///for pi0/eta ->gg barrel
0137   bool doSelBarrel_;
0138   double selePtGamma_;
0139   double selePtPair_;
0140   double seleMinvMaxBarrel_;
0141   double seleMinvMinBarrel_;
0142   double seleS4S9Gamma_;
0143   double seleS9S25Gamma_;
0144   double seleBeltDR_;
0145   double seleBeltDeta_;
0146   double seleIso_;
0147   double ptMinForIsolation_;
0148   bool removePi0CandidatesForEta_;
0149   double massLowPi0Cand_;
0150   double massHighPi0Cand_;
0151   bool store5x5RecHitEB_;
0152 
0153   //for pi0/eta ->gg endcap
0154   bool doSelEndcap_;
0155   double region1_EndCap_;
0156   double selePtGammaEndCap_region1_;
0157   double selePtPairEndCap_region1_;
0158   double region2_EndCap_;
0159   double selePtGammaEndCap_region2_;
0160   double selePtPairEndCap_region2_;
0161   double selePtGammaEndCap_region3_;
0162   double selePtPairEndCap_region3_;
0163   double selePtPairMaxEndCap_region3_;
0164   double seleMinvMaxEndCap_;
0165   double seleMinvMinEndCap_;
0166   double seleS4S9GammaEndCap_;
0167   double seleS9S25GammaEndCap_;
0168   double seleIsoEndCap_;
0169   double seleBeltDREndCap_;
0170   double seleBeltDetaEndCap_;
0171   double ptMinForIsolationEndCap_;
0172   bool store5x5RecHitEE_;
0173 
0174   bool useRecoFlag_;
0175   bool useDBStatus_;
0176   int flagLevelRecHitsToUse_;
0177   int statusLevelRecHitsToUse_;
0178 
0179   bool storeRecHitES_;
0180   edm::InputTag preshHitProducer_;  // name of module/plugin/producer producing hits
0181   int preshNclust_;
0182   float preshClustECut;
0183   double etThresh_;
0184   double calib_planeX_;
0185   double calib_planeY_;
0186   double mip_;
0187   double gamma_;
0188 
0189   std::unique_ptr<PreshowerClusterAlgo> presh_algo_;  // algorithm doing the real work
0190 
0191   std::map<DetId, EcalRecHit> m_esrechit_map;
0192   std::set<DetId> m_used_strips;
0193 
0194   int debug_;
0195 };