Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:24:38

0001 #ifndef RecoEcal_EgammaClusterAlgos_EndcapPiZeroDiscriminatorAlgo_h
0002 #define RecoEcal_EgammaClusterAlgos_EndcapPiZeroDiscriminatorAlgo_h
0003 
0004 #include "DataFormats/EcalDetId/interface/ESDetId.h"
0005 #include "DataFormats/EcalRecHit/interface/EcalRecHit.h"
0006 #include "RecoCaloTools/Navigation/interface/EcalPreshowerNavigator.h"
0007 
0008 // C/C++ headers
0009 #include <string>
0010 #include <vector>
0011 #include <map>
0012 
0013 // authors A. Kyriakis , D. Maletic
0014 
0015 class EndcapPiZeroDiscriminatorAlgo {
0016 public:
0017   typedef std::map<DetId, EcalRecHit> RecHitsMap;
0018 
0019   EndcapPiZeroDiscriminatorAlgo() : preshStripEnergyCut_(0.), preshSeededNstr_(5) {}
0020 
0021   EndcapPiZeroDiscriminatorAlgo(double stripEnergyCut, int nStripCut, const std::string& path);
0022 
0023   std::vector<float> findPreshVector(ESDetId strip, RecHitsMap* rechits_map, CaloSubdetectorTopology* topology_p);
0024 
0025   void findPi0Road(ESDetId strip, EcalPreshowerNavigator& theESNav, int plane, std::vector<ESDetId>& vout);
0026 
0027   bool goodPi0Strip(RecHitsMap::iterator candidate_it, ESDetId lastID);
0028 
0029   bool calculateNNInputVariables(
0030       std::vector<float>& vph1, std::vector<float>& vph2, float pS1_max, float pS9_max, float pS25_max, int EScorr);
0031 
0032   void calculateBarrelNNInputVariables(float et,
0033                                        double s1,
0034                                        double s9,
0035                                        double s25,
0036                                        double m2,
0037                                        double cee,
0038                                        double cep,
0039                                        double cpp,
0040                                        double s4,
0041                                        double s6,
0042                                        double ratio,
0043                                        double xcog,
0044                                        double ycog);
0045 
0046   float GetNNOutput(float EE_Et);
0047 
0048   float GetBarrelNNOutput(float EB_Et);
0049 
0050   std::vector<float> const& get_input_vector() const { return input_var; }
0051 
0052 private:
0053   void readWeightFile(const char* WFile, int& Layers, int& Indim, int& Hidden, int& Outdim);
0054   float getNNoutput(int sel_wfile, int Layers, int Indim, int Hidden, int Outdim, int barrelstart) const;
0055   float Activation_fun(float SUM) const;
0056 
0057   double preshStripEnergyCut_;
0058   int preshSeededNstr_;
0059   int debugLevel_;
0060 
0061   int EE_Layers, EE_Indim, EE_Hidden, EE_Outdim;
0062   int EB_Layers, EB_Indim, EB_Hidden, EB_Outdim;
0063 
0064   std::vector<float> I_H_Weight_all;
0065   std::vector<float> H_O_Weight_all;
0066   std::vector<float> H_Thresh_all;
0067   std::vector<float> O_Thresh_all;
0068 
0069   std::vector<float> input_var;
0070   //   float input_var[25]; // array with the 25 variables to be used as input in NN
0071 };
0072 #endif