Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-07-17 01:47:55

0001 #ifndef RecoTauTag_RecoTau_AntiElectronDeadECAL_h
0002 #define RecoTauTag_RecoTau_AntiElectronDeadECAL_h
0003 
0004 /** \class AntiElectronDeadECAL
0005  *
0006  * Flag tau candidates reconstructed near dead ECAL channels,
0007  * in order to reduce e -> tau fakes not rejected by anti-e MVA discriminator
0008  *
0009  * The motivation for this flag is this presentation:
0010  *   https://indico.cern.ch/getFile.py/access?contribId=0&resId=0&materialId=slides&confId=177223
0011  *
0012  * Code adapted from:
0013  *   RecoTauTag/RecoTau/plugins/PFRecoTauDiscriminationAgainstElectronDeadECAL.cc
0014  *
0015  * \authors Lauri Andreas Wendland,
0016  *          Christian Veelken
0017  *
0018  *
0019  *
0020  */
0021 
0022 #include "FWCore/Framework/interface/EventSetup.h"
0023 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0024 #include "FWCore/Framework/interface/ESWatcher.h"
0025 #include "CondFormats/EcalObjects/interface/EcalChannelStatus.h"
0026 #include "DataFormats/Candidate/interface/Candidate.h"
0027 #include "RecoTauTag/RecoTau/interface/PositionAtECalEntranceComputer.h"
0028 
0029 #include <vector>
0030 #include <string>
0031 
0032 class EcalTrigTowerConstituentsMap;
0033 class EcalChannelStatusRcd;
0034 class CaloGeometryRecord;
0035 class IdealGeometryRecord;
0036 
0037 class AntiElectronDeadECAL {
0038 public:
0039   explicit AntiElectronDeadECAL(const edm::ParameterSet&, edm::ConsumesCollector&&);
0040   ~AntiElectronDeadECAL();
0041 
0042   void beginEvent(const edm::EventSetup&);
0043 
0044   bool operator()(const reco::Candidate* tau) const;
0045 
0046 private:
0047   const unsigned minStatus_;
0048   const double dR2_;
0049   const bool extrapolateToECalEntrance_;
0050   const int verbosity_;
0051   const edm::ESGetToken<EcalChannelStatus, EcalChannelStatusRcd> channelStatusToken_;
0052   const edm::ESGetToken<CaloGeometry, CaloGeometryRecord> caloGeometryToken_;
0053   const edm::ESGetToken<EcalTrigTowerConstituentsMap, IdealGeometryRecord> ttMapToken_;
0054 
0055   PositionAtECalEntranceComputer positionAtECalEntrance_;
0056 
0057   void updateBadTowers(const edm::EventSetup&);
0058 
0059   struct TowerInfo {
0060     TowerInfo(uint32_t id, unsigned nBad, unsigned maxStatus, double eta, double phi)
0061         : id_(id), nBad_(nBad), maxStatus_(maxStatus), eta_(eta), phi_(phi) {}
0062     uint32_t id_;
0063     unsigned nBad_;
0064     unsigned maxStatus_;
0065     double eta_;
0066     double phi_;
0067   };
0068 
0069   std::vector<TowerInfo> badTowers_;
0070   static const uint16_t statusMask_ = 0x1F;
0071 
0072   edm::ESWatcher<EcalChannelStatusRcd> channelStatusWatcher_;
0073   edm::ESWatcher<CaloGeometryRecord> caloGeometryWatcher_;
0074   edm::ESWatcher<IdealGeometryRecord> idealGeometryWatcher_;
0075 
0076   bool isFirstEvent_;
0077 };
0078 
0079 #endif  // RecoTauTag_RecoTau_AntiElectronDeadECAL_h