File indexing completed on 2024-04-06 12:25:38
0001 #ifndef RecoLocalCalo_EcalDeadChannelRecoveryAlgos_EcalDeadChannelRecoveryBDTG_H
0002 #define RecoLocalCalo_EcalDeadChannelRecoveryAlgos_EcalDeadChannelRecoveryBDTG_H
0003
0004 #include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h"
0005
0006 #include "DataFormats/EcalDetId/interface/EBDetId.h"
0007 #include "DataFormats/EcalDetId/interface/EEDetId.h"
0008
0009 #include "Geometry/CaloTopology/interface/CaloTopology.h"
0010 #include "Geometry/CaloTopology/interface/CaloSubdetectorTopology.h"
0011
0012 #include "CommonTools/MVAUtils/interface/TMVAZipReader.h"
0013 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0014
0015 #include "TMVA/Reader.h"
0016
0017 #include <string>
0018 #include <memory>
0019
0020 template <typename DetIdT>
0021 class EcalDeadChannelRecoveryBDTG {
0022 public:
0023 EcalDeadChannelRecoveryBDTG();
0024 ~EcalDeadChannelRecoveryBDTG();
0025
0026 void setParameters(const edm::ParameterSet &ps);
0027 void setCaloTopology(const CaloTopology *topo) { topology_ = topo; }
0028
0029 double recover(
0030 const DetIdT id, const EcalRecHitCollection &hit_collection, double single8Cut, double sum8Cut, bool *acceptFlag);
0031
0032 void loadFile();
0033 void addVariables(TMVA::Reader *reader);
0034
0035 private:
0036 const CaloTopology *topology_;
0037 struct XtalMatrix {
0038 std::array<float, 9> rEn, ieta, iphi;
0039 float sumE8;
0040 };
0041
0042 XtalMatrix mx_;
0043
0044 edm::FileInPath bdtWeightFileNoCracks_;
0045 edm::FileInPath bdtWeightFileCracks_;
0046
0047 std::unique_ptr<TMVA::Reader> readerNoCrack;
0048 std::unique_ptr<TMVA::Reader> readerCrack;
0049 };
0050
0051 #endif