Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:18:40

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   edm::ESGetToken<CaloTopology, CaloTopologyRecord> const caloTopologyRecordToken_;
0113   edm::ESGetToken<EcalChannelStatus, EcalChannelStatusRcd> const ecalChannelStatusRcdToken_;
0114   edm::ESGetToken<CaloGeometry, CaloGeometryRecord> const caloGeometryRecordToken_;
0115 
0116   // Input hits & clusters
0117   edm::InputTag barrelHits_;
0118   edm::InputTag endcapHits_;
0119   edm::InputTag barrelClusters_;
0120   edm::InputTag endcapClusters_;
0121 
0122   edm::EDGetTokenT<EBRecHitCollection> barrelHitsToken_;
0123   edm::EDGetTokenT<EERecHitCollection> endcapHitsToken_;
0124   edm::EDGetTokenT<ESRecHitCollection> preshHitsToken_;
0125   edm::EDGetTokenT<reco::BasicClusterCollection> barrelClustersToken_;
0126   edm::EDGetTokenT<reco::BasicClusterCollection> endcapClustersToken_;
0127 
0128   ///output hits
0129   std::string BarrelHits_;
0130   std::string EndcapHits_;
0131   std::string ESHits_;
0132 
0133   ///for pi0/eta ->gg barrel
0134   bool doSelBarrel_;
0135   double selePtGamma_;
0136   double selePtPair_;
0137   double seleMinvMaxBarrel_;
0138   double seleMinvMinBarrel_;
0139   double seleS4S9Gamma_;
0140   double seleS9S25Gamma_;
0141   double seleBeltDR2_;
0142   double seleBeltDeta_;
0143   double seleIso_;
0144   double ptMinForIsolation_;
0145   bool removePi0CandidatesForEta_;
0146   double massLowPi0Cand_;
0147   double massHighPi0Cand_;
0148   bool store5x5RecHitEB_;
0149 
0150   //for pi0/eta ->gg endcap
0151   bool doSelEndcap_;
0152   double region1_EndCap_;
0153   double selePtGammaEndCap_region1_;
0154   double selePtPairEndCap_region1_;
0155   double region2_EndCap_;
0156   double selePtGammaEndCap_region2_;
0157   double selePtPairEndCap_region2_;
0158   double selePtGammaEndCap_region3_;
0159   double selePtPairEndCap_region3_;
0160   double selePtPairMaxEndCap_region3_;
0161   double seleMinvMaxEndCap_;
0162   double seleMinvMinEndCap_;
0163   double seleS4S9GammaEndCap_;
0164   double seleS9S25GammaEndCap_;
0165   double seleIsoEndCap_;
0166   double seleBeltDR2EndCap_;
0167   double seleBeltDetaEndCap_;
0168   double ptMinForIsolationEndCap_;
0169   bool store5x5RecHitEE_;
0170 
0171   bool useRecoFlag_;
0172   bool useDBStatus_;
0173   int flagLevelRecHitsToUse_;
0174   int statusLevelRecHitsToUse_;
0175 
0176   bool storeRecHitES_;
0177   edm::InputTag preshHitProducer_;  // name of module/plugin/producer producing hits
0178   int preshNclust_;
0179   float preshClustECut;
0180   double etThresh_;
0181   double calib_planeX_;
0182   double calib_planeY_;
0183   double mip_;
0184   double gamma_;
0185 
0186   std::unique_ptr<PreshowerClusterAlgo> presh_algo_;  // algorithm doing the real work
0187 
0188   std::map<DetId, EcalRecHit> m_esrechit_map;
0189   std::set<DetId> m_used_strips;
0190 
0191   int debug_;
0192 };