CMS 3D CMS Logo

EcalDeadChannelRecoveryNN.h
Go to the documentation of this file.
1 #ifndef RecoLocalCalo_EcalDeadChannelRecoveryAlgos_EcalDeadChannelRecoveryNN_H
2 #define RecoLocalCalo_EcalDeadChannelRecoveryAlgos_EcalDeadChannelRecoveryNN_H
3 
6 
9 
12 
13 #include <TTree.h>
14 #include <TMultiLayerPerceptron.h>
15 
16 #include <string>
17 #include <functional>
18 #include <memory>
19 
20 template <typename DetIdT> class EcalDeadChannelRecoveryNN {
21  public:
24 
25  // Arrangement within the M3x3Input matrix
26  //
27  // M3x3
28  // -----------------------------------
29  //
30  //
31  // LU UU RU 04 01 07
32  // LL CC RR or 03 00 06
33  // LD DD RD 05 02 08
34 
35  // Enumeration to switch from custom names within the 3x3 matrix.
36  enum CellID {
37  CC = 0,
38  UU = 1,
39  DD = 2,
40  LL = 3,
41  LU = 4,
42  LD = 5,
43  RR = 6,
44  RU = 7,
45  RD = 8
46  };
47 
48  // Mapping custom names in the 3x3 to (x,y) or (ieta, iphi)
49  // ex: x=+1, y=-1 (ix() == ixP && iy() == iyN -> RD)
50  // ex: x=-1, y=+1 (ieta() == ietaN && iphi() == iphiP -> LU)
51 
52  const int CellX[9] = { 0, 0, 0 /* CC, UU, DD */, -1, -1, -1 /* LL, LU, LD */,
53  1, 1, 1 /* RR, RU, RD */ };
54 
55  const int CellY[9] = { 0, -1, 1 /* CC, UU, DD */, 0, -1, 1 /* LL, LU, LD */,
56  0, -1, 1 /* RR, RU, RD */ };
57 
58  void setCaloTopology(const CaloTopology *topo);
59  double recover(const DetIdT id, const EcalRecHitCollection &hit_collection,
60  double Sum8Cut, bool *AcceptFlag);
61 
62  private:
64  Double_t tmp[9];
65  std::unique_ptr<TTree> tree;
66  std::unique_ptr<TMultiLayerPerceptron> mlp;
67  };
68 
71 
72  void load();
74 
75  public:
76  double estimateEnergy(double *M3x3Input, double epsilon = 0.0000001);
77 
78  double makeNxNMatrice_RelMC(DetIdT itID,
79  const EcalRecHitCollection &hit_collection,
80  double *MNxN_RelMC, bool *AccFlag);
81  double makeNxNMatrice_RelDC(DetIdT itID,
82  const EcalRecHitCollection &hit_collection,
83  double *MNxN_RelDC, bool *AccFlag);
84 
85  double reorderMxNMatrix(EBDetId it, const std::vector<DetId>& window,
86  const EcalRecHitCollection& hit_collection, double *MNxN, bool* AcceptFlag);
87 };
88 
89 #endif
double reorderMxNMatrix(EBDetId it, const std::vector< DetId > &window, const EcalRecHitCollection &hit_collection, double *MNxN, bool *AcceptFlag)
double makeNxNMatrice_RelMC(DetIdT itID, const EcalRecHitCollection &hit_collection, double *MNxN_RelMC, bool *AccFlag)
double makeNxNMatrice_RelDC(DetIdT itID, const EcalRecHitCollection &hit_collection, double *MNxN_RelDC, bool *AccFlag)
const CaloSubdetectorTopology * topology_
double recover(const DetIdT id, const EcalRecHitCollection &hit_collection, double Sum8Cut, bool *AcceptFlag)
def window(xmin, xmax, ymin, ymax, x=0, y=0, width=100, height=100, xlogbase=None, ylogbase=None, minusInfinity=-1000, flipx=False, flipy=True)
Definition: svgfig.py:643
MultiLayerPerceptronContext ctx_[9]
void setCaloTopology(const CaloTopology *topo)
double estimateEnergy(double *M3x3Input, double epsilon=0.0000001)
void load_file(MultiLayerPerceptronContext &ctx, std::string fn)