Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-05-26 00:02: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 // Modified by: Joshua Hardenbrook 10-8-2014
0012 
0013 // system include files
0014 #include <memory>
0015 
0016 // user include files
0017 #include "FWCore/Framework/interface/Frameworkfwd.h"
0018 #include "FWCore/Framework/interface/stream/EDFilter.h"
0019 #include "FWCore/Framework/interface/Event.h"
0020 #include "FWCore/Framework/interface/EventSetup.h"
0021 #include "FWCore/Framework/interface/ESHandle.h"
0022 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0023 #include "DataFormats/Common/interface/Handle.h"
0024 
0025 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0026 #include "FWCore/Utilities/interface/InputTag.h"
0027 
0028 #include "DataFormats/EcalRecHit/interface/EcalRecHit.h"
0029 #include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h"
0030 
0031 // Geometry
0032 #include "Geometry/Records/interface/CaloTopologyRecord.h"
0033 #include "Geometry/CaloTopology/interface/CaloTopology.h"
0034 #include "Geometry/CaloTopology/interface/CaloSubdetectorTopology.h"
0035 #include "Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h"
0036 #include "Geometry/CaloGeometry/interface/CaloCellGeometry.h"
0037 #include "Geometry/CaloGeometry/interface/CaloGeometry.h"
0038 #include "Geometry/CaloTopology/interface/EcalEndcapTopology.h"
0039 #include "Geometry/CaloTopology/interface/EcalBarrelTopology.h"
0040 #include "Geometry/Records/interface/CaloGeometryRecord.h"
0041 
0042 #include "DataFormats/EcalDetId/interface/EBDetId.h"
0043 #include "DataFormats/EcalDetId/interface/EEDetId.h"
0044 #include "DataFormats/DetId/interface/DetId.h"
0045 
0046 #include "DataFormats/EgammaReco/interface/BasicCluster.h"
0047 #include "DataFormats/EgammaReco/interface/BasicClusterFwd.h"
0048 #include "RecoEcal/EgammaCoreTools/interface/PositionCalc.h"
0049 
0050 // ES stuff
0051 #include "DataFormats/EgammaReco/interface/PreshowerCluster.h"
0052 #include "RecoEcal/EgammaClusterAlgos/interface/PreshowerClusterAlgo.h"
0053 #include "Geometry/EcalAlgo/interface/EcalPreshowerGeometry.h"
0054 #include "Geometry/CaloTopology/interface/EcalPreshowerTopology.h"
0055 #include "DataFormats/EgammaReco/interface/PreshowerClusterFwd.h"
0056 
0057 // Ecal status
0058 #include "CondFormats/DataRecord/interface/EcalChannelStatusRcd.h"
0059 #include "CondFormats/EcalObjects/interface/EcalChannelStatus.h"
0060 
0061 #include <algorithm>
0062 #include <utility>
0063 #include <vector>
0064 
0065 namespace edm {
0066   class ConfigurationDescriptions;
0067 }
0068 
0069 class HLTRegionalEcalResonanceFilter : public edm::stream::EDFilter<> {
0070 public:
0071   explicit HLTRegionalEcalResonanceFilter(const edm::ParameterSet &);
0072   ~HLTRegionalEcalResonanceFilter() override;
0073 
0074   bool filter(edm::Event &, const edm::EventSetup &) override;
0075   static void fillDescriptions(edm::ConfigurationDescriptions &descriptions);
0076 
0077 private:
0078   // ----------member data ---------------------------
0079   void doSelection(int detector,
0080                    const reco::BasicClusterCollection *clusterCollection,
0081                    const EcalRecHitCollection *hitCollection,
0082                    const EcalChannelStatus &channelStatus,
0083                    const CaloSubdetectorTopology *topology_p,
0084                    std::map<int, std::vector<EcalRecHit> > &RecHits5x5_clus,
0085                    std::vector<int> &indCandClus,     ///good cluster all ,  5x5 rechit done already during the loop
0086                    std::vector<int> &indIsoClus,      /// Iso cluster all , 5x5 rechit not yet done
0087                    std::vector<int> &indClusSelected  /// saved so far, all
0088   );
0089 
0090   void makeClusterES(
0091       float x, float y, float z, const CaloSubdetectorGeometry *iSubGeom, const CaloSubdetectorTopology *topology_p);
0092 
0093   void calcPaircluster(const reco::BasicCluster &bc1,
0094                        const reco::BasicCluster &bc2,
0095                        float &mpair,
0096                        float &ptpair,
0097                        float &etapair,
0098                        float &phipair);
0099 
0100   bool checkStatusOfEcalRecHit(const EcalChannelStatus &channelStatus, const EcalRecHit &rh);
0101 
0102   void calcShowerShape(const reco::BasicCluster &bc,
0103                        const EcalChannelStatus &channelStatus,
0104                        const EcalRecHitCollection *recHits,
0105                        const CaloSubdetectorTopology *topology_p,
0106                        bool calc5x5,
0107                        std::vector<EcalRecHit> &rechit5x5,
0108                        float res[]);
0109 
0110   void convxtalid(int &, int &);
0111   int diff_neta_s(int, int);
0112   int diff_nphi_s(int, int);
0113 
0114   edm::ESGetToken<CaloTopology, CaloTopologyRecord> const caloTopologyRecordToken_;
0115   edm::ESGetToken<EcalChannelStatus, EcalChannelStatusRcd> const ecalChannelStatusRcdToken_;
0116   edm::ESGetToken<CaloGeometry, CaloGeometryRecord> const caloGeometryRecordToken_;
0117 
0118   // Input hits & clusters
0119   edm::InputTag barrelHits_;
0120   edm::InputTag endcapHits_;
0121   edm::InputTag barrelClusters_;
0122   edm::InputTag endcapClusters_;
0123 
0124   edm::EDGetTokenT<EBRecHitCollection> barrelHitsToken_;
0125   edm::EDGetTokenT<EERecHitCollection> endcapHitsToken_;
0126   edm::EDGetTokenT<ESRecHitCollection> preshHitsToken_;
0127   edm::EDGetTokenT<reco::BasicClusterCollection> barrelClustersToken_;
0128   edm::EDGetTokenT<reco::BasicClusterCollection> endcapClustersToken_;
0129 
0130   ///output hits
0131   std::string BarrelHits_;
0132   std::string EndcapHits_;
0133   std::string ESHits_;
0134 
0135   /// ---------BARREL CONFIGURATION
0136   bool doSelBarrel_;
0137 
0138   // EB region 1
0139   double region1_Barrel_;
0140   double selePtGammaBarrel_region1_;
0141   double selePtPairBarrel_region1_;
0142   double seleS4S9GammaBarrel_region1_;
0143   double seleIsoBarrel_region1_;
0144   double seleNxtalBarrel_region1_;
0145 
0146   // EB region 2
0147   double selePtGammaBarrel_region2_;
0148   double selePtPairBarrel_region2_;
0149   double seleS4S9GammaBarrel_region2_;
0150   double seleIsoBarrel_region2_;
0151   double seleNxtalBarrel_region2_;
0152 
0153   double seleMinvMaxBarrel_;
0154   double seleMinvMinBarrel_;
0155 
0156   //      double selePtGamma_;
0157   //      double selePtPair_;
0158   //      double seleS4S9Gamma_;
0159   //      double seleIso_;
0160   double seleS9S25Gamma_;
0161 
0162   // EB Isolation Configuraiton
0163   double seleBeltDR_;
0164   double seleBeltDeta_;
0165   double ptMinForIsolation_;
0166 
0167   bool removePi0CandidatesForEta_;
0168   double massLowPi0Cand_;
0169   double massHighPi0Cand_;
0170   bool store5x5RecHitEB_;
0171 
0172   bool doSelEndcap_;
0173 
0174   // EE region 1
0175   double region1_EndCap_;
0176   double selePtGammaEndCap_region1_;
0177   double selePtPairEndCap_region1_;
0178   double seleS4S9GammaEndCap_region1_;
0179   double seleIsoEndCap_region1_;
0180   double seleNxtalEndCap_region1_;
0181 
0182   // EE region 2
0183   double region2_EndCap_;
0184   double selePtGammaEndCap_region2_;
0185   double selePtPairEndCap_region2_;
0186   double seleS4S9GammaEndCap_region2_;
0187   double seleIsoEndCap_region2_;
0188   double seleNxtalEndCap_region2_;
0189 
0190   // EE region 3
0191   double selePtGammaEndCap_region3_;
0192   double selePtPairEndCap_region3_;
0193   double selePtPairMaxEndCap_region3_;
0194   double seleS4S9GammaEndCap_region3_;
0195   double seleIsoEndCap_region3_;
0196   double seleNxtalEndCap_region3_;
0197 
0198   double seleMinvMaxEndCap_;
0199   double seleMinvMinEndCap_;
0200   // double seleS4S9GammaEndCap_; //old non-regional filter
0201   // double seleIsoEndCap_; //old non-regional filter
0202 
0203   double seleS9S25GammaEndCap_;
0204 
0205   // EE isolation configuration
0206   double seleBeltDREndCap_;
0207   double seleBeltDetaEndCap_;
0208   double ptMinForIsolationEndCap_;
0209   bool store5x5RecHitEE_;
0210 
0211   bool useRecoFlag_;
0212   bool useDBStatus_;
0213   int flagLevelRecHitsToUse_;
0214   int statusLevelRecHitsToUse_;
0215 
0216   bool storeRecHitES_;
0217   edm::InputTag preshHitProducer_;  // name of module/plugin/producer producing hits
0218   int preshNclust_;
0219   float preshClustECut;
0220   double etThresh_;
0221   double calib_planeX_;
0222   double calib_planeY_;
0223   double mip_;
0224   double gamma_;
0225 
0226   PreshowerClusterAlgo *presh_algo_;  // algorithm doing the real work
0227 
0228   std::map<DetId, EcalRecHit> m_esrechit_map;
0229   std::set<DetId> m_used_strips;
0230 
0231   int debug_;
0232 };