test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 
19 template <typename DetIdT> class EcalDeadChannelRecoveryNN {
20  public:
23 
24  // Arrangement within the M3x3Input matrix
25  //
26  // M3x3
27  // -----------------------------------
28  //
29  //
30  // LU UU RU 04 01 07
31  // LL CC RR or 03 00 06
32  // LD DD RD 05 02 08
33 
34  // Enumeration to switch from custom names within the 3x3 matrix.
35  enum CellID {
36  CC = 0,
37  UU = 1,
38  DD = 2,
39  LL = 3,
40  LU = 4,
41  LD = 5,
42  RR = 6,
43  RU = 7,
44  RD = 8
45  };
46 
47  // Mapping custom names in the 3x3 to (x,y) or (ieta, iphi)
48  // ex: x=+1, y=-1 (ix() == ixP && iy() == iyN -> RD)
49  // ex: x=-1, y=+1 (ieta() == ietaN && iphi() == iphiP -> LU)
50 
51  const int CellX[9] = { 0, 0, 0 /* CC, UU, DD */, -1, -1, -1 /* LL, LU, LD */,
52  1, 1, 1 /* RR, RU, RD */ };
53 
54  const int CellY[9] = { 0, -1, 1 /* CC, UU, DD */, 0, -1, 1 /* LL, LU, LD */,
55  0, -1, 1 /* RR, RU, RD */ };
56 
57  void setCaloTopology(const CaloTopology *topo);
58  double recover(const DetIdT id, const EcalRecHitCollection &hit_collection,
59  double Sum8Cut, bool *AcceptFlag);
60 
61  private:
63  Double_t tmp[9];
64  TTree *tree;
65  TMultiLayerPerceptron *mlp;
66  };
67 
69  MultiLayerPerceptronContext ctx_[9];
70 
71  void load();
72  void load_file(MultiLayerPerceptronContext &ctx, std::string fn);
73 
74  public:
75  double estimateEnergy(double *M3x3Input, double epsilon = 0.0000001);
76 
77  double makeNxNMatrice_RelMC(DetIdT itID,
78  const EcalRecHitCollection &hit_collection,
79  double *MNxN_RelMC, bool *AccFlag);
80  double makeNxNMatrice_RelDC(DetIdT itID,
81  const EcalRecHitCollection &hit_collection,
82  double *MNxN_RelDC, bool *AccFlag);
83 
84  double reorderMxNMatrix(EBDetId it, const std::vector<DetId>& window,
85  const EcalRecHitCollection& hit_collection, double *MNxN, bool* AcceptFlag);
86 };
87 
88 #endif
def window
Definition: svgfig.py:642
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)
MultiLayerPerceptronContext ctx_[9]
void setCaloTopology(const CaloTopology *topo)
double estimateEnergy(double *M3x3Input, double epsilon=0.0000001)
void load_file(MultiLayerPerceptronContext &ctx, std::string fn)
const double epsilon