CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
EcalTPGParamBuilder.h
Go to the documentation of this file.
1 #ifndef CalibCalorimetry_EcalTPGTools_EcalTPGParamBuilder_h
2 #define CalibCalorimetry_EcalTPGTools_EcalTPGParamBuilder_h
3 
4 //Author: Pascal Paganini - LLR
5 //Date: 2006/07/10 15:58:06 $
6 
7 // system include files
8 #include <memory>
9 
10 // user include files
19 
25 
39 
40 //modif-alex-27-july-2015
42 
46 
47 #include <TH1F.h>
48 
49 #include <vector>
50 #include <string>
51 #include <map>
52 #include <iostream>
53 
54 class EcalTPGDBApp;
55 
56 class coeffStruc {
57 public:
59  double calibCoeff_;
60  double gainRatio_[3];
61  int pedestals_[3];
62 };
63 
64 class linStruc {
65 public:
66  linStruc() {}
67  int pedestal_[3];
68  int mult_[3];
69  int shift_[3];
70 };
71 
73 public:
74  explicit EcalTPGParamBuilder(edm::ParameterSet const& pSet);
75  ~EcalTPGParamBuilder() override;
76  void analyze(const edm::Event& evt, const edm::EventSetup& evtSetup) override;
77  void beginJob() override;
78 
79 private:
82  double theta, double gainRatio, double calibCoeff, std::string subdet, int& mult, int& shift);
83  void create_header();
84  int uncodeWeight(double weight, int complement2 = 7);
85  double uncodeWeight(int iweight, int complement2 = 7);
86  std::vector<unsigned int> computeWeights(EcalShapeBase& shape, TH1F* histo);
87  void computeLUT(int* lut, std::string det = "EB");
88  //void getCoeff(coeffStruc & coeff, const EcalIntercalibConstantMap & calibMap, uint rawId) ; //modif-alex-27-july-2015 uncomment to go back
89  void getCoeff(coeffStruc& coeff, const EcalGainRatioMap& gainMap, uint rawId);
90  void getCoeff(coeffStruc& coeff, const EcalPedestalsMap& pedMap, uint rawId);
91  void getCoeff(coeffStruc& coeff, const std::map<EcalLogicID, MonPedestalsDat>& pedMap, const EcalLogicID& logicId);
92 
93  //modif-alex-27-july-2015
94  void getCoeff(coeffStruc& coeff,
95  const EcalIntercalibConstantMap& calibMap,
96  const EcalLaserAlphaMap& laserAlphaMap,
97  uint rawId,
98  std::string& ss);
99 
100  void computeFineGrainEBParameters(uint& lowRatio, uint& highRatio, uint& lowThreshold, uint& highThreshold, uint& lut);
101  void computeFineGrainEEParameters(uint& threshold, uint& lut_strip, uint& lut_tower);
102  int getEtaSlice(int tccId, int towerInTCC);
103  bool realignBaseline(linStruc& lin, float forceBase12, int cmsswid);
104  int getGCTRegionPhi(int ttphi);
105  int getGCTRegionEta(int tteta);
106  std::string getDet(int tcc);
107  std::pair<std::string, int> getCrate(int tcc);
108 
117 
124 
128  unsigned int sliding_;
129  unsigned int sampleMax_;
137  static constexpr uint NWEIGHTS = 5; // It can be up to 6, but in Run 1,2,3 only 5 weights have been used
138 
154 
155  unsigned int nSample_;
156  unsigned int complement2_;
164  unsigned int FG_lut_EB_;
170  int SFGVB_SpikeKillingThreshold_; //modif-alex 01/21/11
172 
173  //modif-alex-30/01/2012
176 
177  //modif-alex-02/02/11
182  std::map<int, std::vector<int> > delays_EB_;
183  std::map<int, std::vector<int> > phases_EB_;
184  std::map<int, std::vector<int> > delays_EE_;
185  std::map<int, std::vector<int> > phases_EE_;
186 
187  //modif-alex 30/01/2012
188  std::map<int, double> Transparency_Correction_;
189 
192 
193  std::ofstream* out_file_;
194  std::ofstream* geomFile_;
198  unsigned int DBrunNb_;
199  bool DBEE_;
200 
208  int spi_conf_id_; //modif-alex 21/01.11
209  int del_conf_id_; //modif-alex 21/01.11
215  int version_;
223  int m_write_spi; //modif-alex 21/01/11
224  int m_write_del; //modif-alex 21/01/11
228 
229  Int_t* ntupleInts_;
230  Char_t ntupleDet_[10];
231  Char_t ntupleCrate_[10];
232 };
233 #endif
unsigned int TPmode_FenixEBStripOutput_
std::string weight_even_idMapFile_
std::map< int, std::vector< int > > phases_EB_
unsigned int TPmode_FenixEBStripInfobit2_
unsigned int TPmode_FenixEBTcpInfobit1_
edm::ESGetToken< EcalIntercalibConstants, EcalIntercalibConstantsRcd > ecalIntercalibConstantsToken_
unsigned int TPmode_FenixEBTcpOutput_
static constexpr uint NWEIGHTS
edm::ESGetToken< EcalElectronicsMapping, EcalMappingRcd > ecalmappingToken_
std::pair< std::string, int > getCrate(int tcc)
int getGCTRegionPhi(int ttphi)
double gainRatio_[3]
std::string getDet(int tcc)
Geom::Theta< T > theta() const
edm::ESGetToken< EcalLaserAPDPNRatios, EcalLaserAPDPNRatiosRcd > ecalLaserAPDPNRatiosToken_
std::string weight_even_weightGroupFile_
unsigned int TPmode_FenixEEStripOutput_
edm::ESGetToken< CaloSubdetectorGeometry, EcalBarrelGeometryRecord > theBarrelGeometryToken_
const CaloSubdetectorGeometry * theEndcapGeometry_
std::ofstream * out_file_
std::map< int, std::vector< int > > delays_EB_
edm::ESGetToken< EcalLaserAlphas, EcalLaserAlphasRcd > ecalLaserAlphasToken_
edm::ESGetToken< EcalGainRatios, EcalGainRatiosRcd > ecalGainRatiosToken_
std::vector< unsigned int > computeWeights(EcalShapeBase &shape, TH1F *histo)
std::map< int, std::vector< int > > delays_EE_
const EcalElectronicsMapping * theMapping_
void computeLUT(int *lut, std::string det="EB")
EcalTPGParamBuilder(edm::ParameterSet const &pSet)
edm::ESGetToken< EcalADCToGeVConstant, EcalADCToGeVConstantRcd > ecalADCToGeVConstantToken_
void analyze(const edm::Event &evt, const edm::EventSetup &evtSetup) override
unsigned int TPmode_FenixEEStripInfobit2_
std::ofstream * geomFile_
Definition: EBShape.h:7
void computeFineGrainEEParameters(uint &threshold, uint &lut_strip, uint &lut_tower)
const EcalTrigTowerConstituentsMap * eTTmap_
edm::ESGetToken< EcalTrigTowerConstituentsMap, IdealGeometryRecord > eTTmapToken_
bool computeLinearizerParam(double theta, double gainRatio, double calibCoeff, std::string subdet, int &mult, int &shift)
const CaloSubdetectorGeometry * theBarrelGeometry_
unsigned int TPmode_FenixEETcpInfobit1_
bool realignBaseline(linStruc &lin, float forceBase12, int cmsswid)
unsigned int TPmode_FenixEETcpOutput_
unsigned tccId(DetId const &, EcalElectronicsMapping const *)
edm::ESGetToken< EcalPedestals, EcalPedestalsRcd > ecalPedestalsToken_
std::string weight_odd_idMapFile_
edm::ESGetToken< CaloSubdetectorGeometry, EcalEndcapGeometryRecord > theEndcapGeometryToken_
static unsigned int const shift
std::string weight_odd_weightGroupFile_
int getGCTRegionEta(int tteta)
int weight
Definition: histoStyle.py:51
std::map< int, double > Transparency_Correction_
int getEtaSlice(int tccId, int towerInTCC)
std::map< int, std::vector< int > > phases_EE_
bool checkIfOK(EcalPedestals::Item item)
Definition: EEShape.h:7
void computeFineGrainEBParameters(uint &lowRatio, uint &highRatio, uint &lowThreshold, uint &highThreshold, uint &lut)
void getCoeff(coeffStruc &coeff, const EcalGainRatioMap &gainMap, uint rawId)
int uncodeWeight(double weight, int complement2=7)