CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
EcalTPGParamBuilder Class Reference

#include <EcalTPGParamBuilder.h>

Inheritance diagram for EcalTPGParamBuilder:
edm::EDAnalyzer

Public Member Functions

virtual void analyze (const edm::Event &evt, const edm::EventSetup &evtSetup)
 
virtual void beginJob ()
 
bool checkIfOK (EcalPedestals::Item item)
 
 EcalTPGParamBuilder (edm::ParameterSet const &pSet)
 
 ~EcalTPGParamBuilder ()
 
- Public Member Functions inherited from edm::EDAnalyzer
 EDAnalyzer ()
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 

Private Member Functions

void computeFineGrainEBParameters (unsigned int &lowRatio, unsigned int &highRatio, unsigned int &lowThreshold, unsigned int &highThreshold, unsigned int &lut)
 
void computeFineGrainEEParameters (unsigned int &threshold, unsigned int &lut_strip, unsigned int &lut_tower)
 
bool computeLinearizerParam (double theta, double gainRatio, double calibCoeff, std::string subdet, int &mult, int &shift)
 
void computeLUT (int *lut, std::string det="EB")
 
std::vector< unsigned int > computeWeights (EcalShapeBase &shape, TH1F *histo)
 
void create_header ()
 
void getCoeff (coeffStruc &coeff, const EcalIntercalibConstantMap &calibMap, unsigned int rawId)
 
void getCoeff (coeffStruc &coeff, const EcalGainRatioMap &gainMap, unsigned int rawId)
 
void getCoeff (coeffStruc &coeff, const EcalPedestalsMap &pedMap, unsigned int rawId)
 
void getCoeff (coeffStruc &coeff, const std::map< EcalLogicID, MonPedestalsDat > &pedMap, const EcalLogicID &logicId)
 
std::pair< std::string, int > getCrate (int tcc)
 
std::string getDet (int tcc)
 
int getEtaSlice (int tccId, int towerInTCC)
 
int getGCTRegionEta (int tteta)
 
int getGCTRegionPhi (int ttphi)
 
bool realignBaseline (linStruc &lin, float forceBase12)
 
int uncodeWeight (double weight, int complement2=7)
 
double uncodeWeight (int iweight, int complement2=7)
 

Private Attributes

int btt_conf_id_
 
int bxt_conf_id_
 
unsigned int complement2_
 
EcalTPGDBAppdb_
 
bool DBEE_
 
unsigned int DBrunNb_
 
double Et_sat_EB_
 
double Et_sat_EE_
 
edm::ESHandle
< EcalTrigTowerConstituentsMap
eTTmap_
 
double FG_highRatio_EB_
 
double FG_highThreshold_EB_
 
double FG_lowRatio_EB_
 
double FG_lowThreshold_EB_
 
unsigned int FG_lut_EB_
 
unsigned int FG_lut_strip_EE_
 
unsigned int FG_lut_tower_EE_
 
double FG_Threshold_EE_
 
int fgr_conf_id_
 
int forcedPedestalValue_
 
bool forceEtaSlice_
 
std::ofstream * geomFile_
 
int lin_conf_id_
 
int lut_conf_id_
 
double LUT_constant_EB_
 
double LUT_constant_EE_
 
double LUT_noise_EB_
 
double LUT_noise_EE_
 
std::string LUT_option_
 
double LUT_stochastic_EB_
 
double LUT_stochastic_EE_
 
double LUT_threshold_EB_
 
double LUT_threshold_EE_
 
int m_write_btt
 
int m_write_bxt
 
int m_write_fgr
 
int m_write_lin
 
int m_write_lut
 
int m_write_ped
 
int m_write_sli
 
int m_write_wei
 
unsigned int nSample_
 
Char_t ntupleCrate_ [10]
 
Char_t ntupleDet_ [10]
 
Float_t * ntupleFloats_
 
std::ofstream * out_file_
 
int ped_conf_id_
 
unsigned int pedestal_offset_
 
unsigned int sampleMax_
 
unsigned int SFGVB_lut_
 
unsigned int SFGVB_Threshold_
 
int sli_conf_id_
 
unsigned int sliding_
 
std::string tag_
 
const CaloSubdetectorGeometrytheBarrelGeometry_
 
const CaloSubdetectorGeometrytheEndcapGeometry_
 
const EcalElectronicsMappingtheMapping_
 
double TTF_highThreshold_EB_
 
double TTF_highThreshold_EE_
 
double TTF_lowThreshold_EB_
 
double TTF_lowThreshold_EE_
 
bool useInterCalibration_
 
bool useTransverseEnergy_
 
int version_
 
int wei_conf_id_
 
double weight_timeShift_
 
bool weight_unbias_recovery_
 
bool writeToDB_
 
bool writeToFiles_
 
double xtal_LSB_EB_
 
double xtal_LSB_EE_
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
typedef WorkerT< EDAnalyzerWorkerType
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDAnalyzer
CurrentProcessingContext const * currentContext () const
 

Detailed Description

Definition at line 64 of file EcalTPGParamBuilder.h.

Constructor & Destructor Documentation

EcalTPGParamBuilder::EcalTPGParamBuilder ( edm::ParameterSet const &  pSet)
explicit

Definition at line 52 of file EcalTPGParamBuilder.cc.

References btt_conf_id_, bxt_conf_id_, gather_cfg::cout, db_, DBEE_, Et_sat_EB_, Et_sat_EE_, cmsCodeRules.cppFunctionSkipper::exception, FG_highRatio_EB_, FG_highThreshold_EB_, FG_lowRatio_EB_, FG_lowThreshold_EB_, FG_lut_EB_, FG_lut_strip_EE_, FG_lut_tower_EE_, FG_Threshold_EE_, fgr_conf_id_, forcedPedestalValue_, forceEtaSlice_, geomFile_, edm::ParameterSet::getParameter(), lin_conf_id_, lut_conf_id_, LUT_constant_EB_, LUT_constant_EE_, LUT_noise_EB_, LUT_noise_EE_, LUT_option_, LUT_stochastic_EB_, LUT_stochastic_EE_, LUT_threshold_EB_, LUT_threshold_EE_, m_write_btt, m_write_bxt, m_write_fgr, m_write_lin, m_write_lut, m_write_ped, m_write_sli, m_write_wei, dbtoconf::out, out_file_, ped_conf_id_, pedestal_offset_, sampleMax_, SFGVB_lut_, SFGVB_Threshold_, sli_conf_id_, sliding_, tag_, TTF_highThreshold_EB_, TTF_highThreshold_EE_, TTF_lowThreshold_EB_, TTF_lowThreshold_EE_, useInterCalibration_, useTransverseEnergy_, version_, wei_conf_id_, weight_timeShift_, weight_unbias_recovery_, writeToDB_, and writeToFiles_.

54 {
55  ped_conf_id_=0;
56  lin_conf_id_=0;
57  lut_conf_id_=0;
58  wei_conf_id_=0;
59  fgr_conf_id_=0;
60  sli_conf_id_=0;
61  bxt_conf_id_=0;
62  btt_conf_id_=0;
63  tag_="";
64  version_=0;
65 
66  m_write_ped=1;
67  m_write_lin=1;
68  m_write_lut=1;
69  m_write_wei=1;
70  m_write_fgr=1;
71  m_write_sli=1;
72  m_write_bxt=1;
73  m_write_btt=1;
74 
75  writeToDB_ = pSet.getParameter<bool>("writeToDB") ;
76  DBEE_ = pSet.getParameter<bool>("allowDBEE") ;
77  std::string DBsid = pSet.getParameter<std::string>("DBsid") ;
78  std::string DBuser = pSet.getParameter<std::string>("DBuser") ;
79  std::string DBpass = pSet.getParameter<std::string>("DBpass") ;
80  //unsigned int32_t DBport = pSet.getParameter<unsigned int>("DBport") ;
81 
82  tag_ = pSet.getParameter<std::string>("TPGtag") ;
83  version_ = pSet.getParameter<unsigned int>("TPGversion") ;
84 
85  m_write_ped = pSet.getParameter<unsigned int>("TPGWritePed") ;
86  m_write_lin = pSet.getParameter<unsigned int>("TPGWriteLin") ;
87  m_write_lut = pSet.getParameter<unsigned int>("TPGWriteLut") ;
88  m_write_wei = pSet.getParameter<unsigned int>("TPGWriteWei") ;
89  m_write_fgr = pSet.getParameter<unsigned int>("TPGWriteFgr") ;
90  m_write_sli = pSet.getParameter<unsigned int>("TPGWriteSli") ;
91  m_write_bxt = pSet.getParameter<unsigned int>("TPGWriteBxt") ;
92  m_write_btt = pSet.getParameter<unsigned int>("TPGWriteBtt") ;
93 
96 
97  if (writeToDB_) {
98  try {
99  std::cout << "data will be saved with tag and version="<< tag_<< ".version"<<version_<< std::endl;
100  db_ = new EcalTPGDBApp(DBsid, DBuser, DBpass) ;
101  } catch (std::exception &e) {
102  std::cout << "ERROR: " << e.what() << std::endl;
103  } catch (...) {
104  std::cout << "Unknown error caught" << std::endl;
105  }
106  }
107 
108  writeToFiles_ = pSet.getParameter<bool>("writeToFiles") ;
109  if (writeToFiles_) {
110  std::string outFile = pSet.getParameter<std::string>("outFile") ;
111  out_file_ = new std::ofstream(outFile.c_str(), std::ios::out) ;
112  }
113  geomFile_ = new std::ofstream("geomFile.txt", std::ios::out) ;
114 
115 
116  useTransverseEnergy_ = pSet.getParameter<bool>("useTransverseEnergy") ;
117 
118  Et_sat_EB_ = pSet.getParameter<double>("Et_sat_EB") ;
119  Et_sat_EE_ = pSet.getParameter<double>("Et_sat_EE") ;
120  sliding_ = pSet.getParameter<unsigned int>("sliding") ;
121  weight_timeShift_ = pSet.getParameter<double>("weight_timeShift") ;
122  sampleMax_ = pSet.getParameter<unsigned int>("weight_sampleMax") ;
123  weight_unbias_recovery_ = pSet.getParameter<bool>("weight_unbias_recovery") ;
124 
125  forcedPedestalValue_ = pSet.getParameter<int>("forcedPedestalValue") ;
126  forceEtaSlice_ = pSet.getParameter<bool>("forceEtaSlice") ;
127 
128  LUT_option_ = pSet.getParameter<std::string>("LUT_option") ;
129  LUT_threshold_EB_ = pSet.getParameter<double>("LUT_threshold_EB") ;
130  LUT_threshold_EE_ = pSet.getParameter<double>("LUT_threshold_EE") ;
131  LUT_stochastic_EB_ = pSet.getParameter<double>("LUT_stochastic_EB") ;
132  LUT_noise_EB_ =pSet.getParameter<double>("LUT_noise_EB") ;
133  LUT_constant_EB_ =pSet.getParameter<double>("LUT_constant_EB") ;
134  LUT_stochastic_EE_ = pSet.getParameter<double>("LUT_stochastic_EE") ;
135  LUT_noise_EE_ =pSet.getParameter<double>("LUT_noise_EE") ;
136  LUT_constant_EE_ =pSet.getParameter<double>("LUT_constant_EE") ;
137 
138  TTF_lowThreshold_EB_ = pSet.getParameter<double>("TTF_lowThreshold_EB") ;
139  TTF_highThreshold_EB_ = pSet.getParameter<double>("TTF_highThreshold_EB") ;
140  TTF_lowThreshold_EE_ = pSet.getParameter<double>("TTF_lowThreshold_EE") ;
141  TTF_highThreshold_EE_ = pSet.getParameter<double>("TTF_highThreshold_EE") ;
142 
143  FG_lowThreshold_EB_ = pSet.getParameter<double>("FG_lowThreshold_EB") ;
144  FG_highThreshold_EB_ = pSet.getParameter<double>("FG_highThreshold_EB") ;
145  FG_lowRatio_EB_ = pSet.getParameter<double>("FG_lowRatio_EB") ;
146  FG_highRatio_EB_ = pSet.getParameter<double>("FG_highRatio_EB") ;
147  FG_lut_EB_ = pSet.getParameter<unsigned int>("FG_lut_EB") ;
148  FG_Threshold_EE_ = pSet.getParameter<double>("FG_Threshold_EE") ;
149  FG_lut_strip_EE_ = pSet.getParameter<unsigned int>("FG_lut_strip_EE") ;
150  FG_lut_tower_EE_ = pSet.getParameter<unsigned int>("FG_lut_tower_EE") ;
151  SFGVB_Threshold_ = pSet.getParameter<unsigned int>("SFGVB_Threshold") ;
152  SFGVB_lut_ = pSet.getParameter<unsigned int>("SFGVB_lut") ;
153  pedestal_offset_ = pSet.getParameter<unsigned int>("pedestal_offset") ;
154 
155  useInterCalibration_ = pSet.getParameter<bool>("useInterCalibration") ;
156 }
std::ofstream * out_file_
std::ofstream * geomFile_
tuple out
Definition: dbtoconf.py:99
tuple cout
Definition: gather_cfg.py:41
EcalTPGParamBuilder::~EcalTPGParamBuilder ( )

Definition at line 158 of file EcalTPGParamBuilder.cc.

References out_file_, and writeToFiles_.

159 {
160  if (writeToFiles_) {
161  (*out_file_ )<<"EOF"<<std::endl ;
162  out_file_->close() ;
163  delete out_file_ ;
164  }
165 }
std::ofstream * out_file_

Member Function Documentation

void EcalTPGParamBuilder::analyze ( const edm::Event evt,
const edm::EventSetup evtSetup 
)
virtual

Implements edm::EDAnalyzer.

Definition at line 195 of file EcalTPGParamBuilder.cc.

References abs, Reference_intrackfit_cff::barrel, newFWLiteAna::base, btt_conf_id_, bxt_conf_id_, coeffStruc::calibCoeff_, EcalTriggerElectronicsId::channelId(), computeFineGrainEBParameters(), computeFineGrainEEParameters(), computeLinearizerParam(), computeLUT(), computeWeights(), gather_cfg::cout, BeamSplash_cfg::dataset, db_, DBEE_, EcalElectronicsId::dccId(), EcalElectronicsMapping::DCCid(), DetId::Ecal, EcalBarrel, EcalEndcap, Et_sat_EB_, Et_sat_EE_, PV3DBase< T, PVType, FrameType >::eta(), eTTmap_, cmsCodeRules.cppFunctionSkipper::exception, FG_highRatio_EB_, FG_highThreshold_EB_, FG_lowRatio_EB_, FG_lowThreshold_EB_, FG_Threshold_EE_, fgr_conf_id_, first, forcedPedestalValue_, forceEtaSlice_, g, EcalMGPAGainRatio::gain12Over6(), EcalMGPAGainRatio::gain6Over1(), coeffStruc::gainRatio_, edm::EventSetup::get(), FEConfigMainInfo::getBttId(), FEConfigMainInfo::getBxtId(), getCoeff(), getCrate(), getDet(), EcalCondDBInterface::getEcalLogicID(), EcalCondDBInterface::getEcalLogicIDSetOrdered(), EcalElectronicsMapping::getElectronicsId(), FEConfigMainInfo::getFgrId(), getGCTRegionEta(), getGCTRegionPhi(), CaloSubdetectorGeometry::getGeometry(), EcalLogicID::getID1(), EcalLogicID::getID3(), FEConfigMainInfo::getLinId(), FEConfigMainInfo::getLUTId(), EcalCondObjectContainer< T >::getMap(), FEConfigMainInfo::getPedId(), CaloCellGeometry::getPosition(), FEConfigMainInfo::getSliId(), EcalElectronicsMapping::getTriggerElectronicsId(), CaloSubdetectorGeometry::getValidDetIds(), FEConfigMainInfo::getWeiId(), ecalpyutils::hashedIndex(), i, EcalTrigTowerDetId::ieta(), EcalTrigTowerDetId::ietaAbs(), EcalTrigTowerDetId::iphi(), EcalElectronicsMapping::iTT(), j, gen::k, lin_conf_id_, lut_conf_id_, LUT_option_, m_write_fgr, m_write_lin, m_write_lut, m_write_ped, m_write_sli, m_write_wei, VarParsing::mult, linStruc::mult_, ntupleCrate_, ntupleDet_, ntupleFloats_, EcalLogicID::NULLID, convertSQLiteXML::ok, dbtoconf::out, out_file_, ped_conf_id_, linStruc::pedestal_, pedestal_offset_, coeffStruc::pedestals_, PV3DBase< T, PVType, FrameType >::phi(), funct::pow(), EcalTriggerElectronicsId::pseudoStripId(), EcalTriggerElectronicsId::rawId(), DetId::rawId(), realignBaseline(), edm::second(), IODConfig::setConfigTag(), FEConfigLinParamDat::setETSat(), FEConfigLUTParamDat::setETSat(), FEConfigFgrParamDat::setFGhighratio(), FEConfigFgrParamDat::setFGhighthresh(), FEConfigFgrParamDat::setFGlowratio(), FEConfigFgrParamDat::setFGlowthresh(), FEConfigFgrDat::setFgrGroupId(), FEConfigFgrGroupDat::setFgrGroupId(), FEConfigFgrEEStripDat::setLutFgr(), FEConfigLUTDat::setLUTGroupId(), FEConfigLUTGroupDat::setLUTGroupId(), FEConfigFgrEETowerDat::setLutValue(), FEConfigLUTGroupDat::setLUTValue(), FEConfigFgrGroupDat::setLUTValue(), FEConfigLinDat::setMultX1(), FEConfigLinDat::setMultX12(), FEConfigLinDat::setMultX6(), FEConfigPedDat::setPedMeanG1(), FEConfigPedDat::setPedMeanG12(), FEConfigPedDat::setPedMeanG6(), FEConfigFgrGroupDat::setRatioHigh(), FEConfigFgrGroupDat::setRatioLow(), FEConfigLinDat::setShift1(), FEConfigLinDat::setShift12(), FEConfigLinDat::setShift6(), FEConfigSlidingDat::setSliding(), FEConfigFgrGroupDat::setThreshHigh(), FEConfigFgrGroupDat::setThreshLow(), FEConfigFgrEEStripDat::setThreshold(), FEConfigLUTParamDat::setTTThreshhigh(), FEConfigLUTParamDat::setTTThreshlow(), FEConfigWeightGroupDat::setWeight0(), FEConfigWeightGroupDat::setWeight1(), FEConfigWeightGroupDat::setWeight2(), FEConfigWeightGroupDat::setWeight3(), FEConfigWeightGroupDat::setWeight4(), FEConfigWeightGroupDat::setWeightGroupId(), FEConfigWeightDat::setWeightGroupId(), SFGVB_lut_, SFGVB_Threshold_, edm::shift, linStruc::shift_, funct::sin(), findQualityFiles::size, sli_conf_id_, sliding_, EcalElectronicsId::stripId(), EcalTrigTowerDetId::subDet(), tag_, EcalElectronicsMapping::TCCid(), theBarrelGeometry_, theEndcapGeometry_, theMapping_, PV3DBase< T, PVType, FrameType >::theta(), theta(), dtT0WireCalibration_cfg::threshold, EcalElectronicsId::towerId(), funct::true, TTF_highThreshold_EB_, TTF_highThreshold_EE_, TTF_lowThreshold_EB_, TTF_lowThreshold_EE_, useTransverseEnergy_, version_, wei_conf_id_, EcalTPGDBApp::writeToConfDB_TPGFgr(), EcalTPGDBApp::writeToConfDB_TPGLinearCoef(), EcalTPGDBApp::writeToConfDB_TPGLUT(), EcalTPGDBApp::writeToConfDB_TPGMain(), EcalTPGDBApp::writeToConfDB_TPGPedestals(), EcalTPGDBApp::writeToConfDB_TPGSliding(), EcalTPGDBApp::writeToConfDB_TPGWeight(), writeToDB_, writeToFiles_, x, xtal_LSB_EB_, xtal_LSB_EE_, EcalElectronicsId::xtalId(), detailsBasic3DVector::y, detailsBasic3DVector::z, and EcalTrigTowerDetId::zside().

196 {
197  using namespace edm;
198  using namespace std;
199 
200  // geometry
201  ESHandle<CaloGeometry> theGeometry;
202  ESHandle<CaloSubdetectorGeometry> theEndcapGeometry_handle, theBarrelGeometry_handle;
203  evtSetup.get<CaloGeometryRecord>().get( theGeometry );
204  evtSetup.get<EcalEndcapGeometryRecord>().get("EcalEndcap",theEndcapGeometry_handle);
205  evtSetup.get<EcalBarrelGeometryRecord>().get("EcalBarrel",theBarrelGeometry_handle);
206  evtSetup.get<IdealGeometryRecord>().get(eTTmap_);
207  theEndcapGeometry_ = &(*theEndcapGeometry_handle);
208  theBarrelGeometry_ = &(*theBarrelGeometry_handle);
209 
210  // electronics mapping
212  evtSetup.get< EcalMappingRcd >().get(ecalmapping);
213  theMapping_ = ecalmapping.product();
214 
215 
216  // histo
217  TFile saving ("EcalTPGParam.root","recreate") ;
218  saving.cd () ;
219  TH2F * ICEB = new TH2F("ICEB", "IC: Barrel", 360, 1, 361, 172, -86, 86) ;
220  ICEB->GetYaxis()->SetTitle("eta index") ;
221  ICEB->GetXaxis()->SetTitle("phi index") ;
222  TH2F * tpgFactorEB = new TH2F("tpgFactorEB", "tpgFactor: Barrel", 360, 1, 361, 172, -86, 86) ;
223  tpgFactorEB->GetYaxis()->SetTitle("eta index") ;
224  tpgFactorEB->GetXaxis()->SetTitle("phi index") ;
225 
226  TH2F * ICEEPlus = new TH2F("ICEEPlus", "IC: Plus Endcap", 120, -9, 111, 120, -9, 111) ;
227  ICEEPlus->GetYaxis()->SetTitle("y index") ;
228  ICEEPlus->GetXaxis()->SetTitle("x index") ;
229  TH2F * tpgFactorEEPlus = new TH2F("tpgFactorEEPlus", "tpgFactor: Plus Endcap", 120, -9, 111, 120, -9, 111) ;
230  tpgFactorEEPlus->GetYaxis()->SetTitle("y index") ;
231  tpgFactorEEPlus->GetXaxis()->SetTitle("x index") ;
232  TH2F * ICEEMinus = new TH2F("ICEEMinus", "IC: Minus Endcap", 120, -9, 111, 120, -9, 111) ;
233  ICEEMinus->GetYaxis()->SetTitle("y index") ;
234  ICEEMinus->GetXaxis()->SetTitle("x index") ;
235  TH2F * tpgFactorEEMinus = new TH2F("tpgFactorEEMinus", "tpgFactor: Minus Endcap", 120, -9, 111, 120, -9, 111) ;
236  tpgFactorEEMinus->GetYaxis()->SetTitle("y index") ;
237  tpgFactorEEMinus->GetXaxis()->SetTitle("x index") ;
238 
239  TH2F * IC = new TH2F("IC", "IC", 720, -acos(-1.), acos(-1.), 600, -3., 3.) ;
240  IC->GetYaxis()->SetTitle("eta") ;
241  IC->GetXaxis()->SetTitle("phi") ;
242  TH2F * tpgFactor = new TH2F("tpgFactor", "tpgFactor", 720, -acos(-1.), acos(-1.), 600, -3., 3.) ;
243  tpgFactor->GetYaxis()->SetTitle("eta") ;
244  tpgFactor->GetXaxis()->SetTitle("phi") ;
245 
246  TH1F * hshapeEB = new TH1F("shapeEB", "shapeEB", 250, 0., 10.) ;
247  TH1F * hshapeEE = new TH1F("shapeEE", "shapeEE", 250, 0., 10.) ;
248 
249  TTree * ntuple = new TTree("tpgmap","TPG geometry map") ;
250  const char * branchFloat[24] = {"fed","tcc","tower","stripInTower","xtalInStrip",
251  "CCU","VFE","xtalInVFE","xtalInCCU","ieta","iphi",
252  "ix","iy","iz","hashedId","ic","ietaTT","iphiTT",
253  "TCCch","TCCslot","SLBch","SLBslot","ietaGCT","iphiGCT"} ;
254  ntupleFloats_ = new Float_t[24] ;
255  for (int i=0 ; i<24 ; i++) ntuple->Branch(branchFloat[i],&ntupleFloats_[i],branchFloat[i]) ;
256  ntuple->Branch("det",ntupleDet_,"det/C") ;
257  ntuple->Branch("crate",ntupleCrate_,"crate/C") ;
258 
259 
260  TNtuple *ntupleSpike = new TNtuple("spikeParam","Spike parameters","gainId:theta:G:g:ped:pedLin") ;
261 
262 
263 
264 
266  // Initialization section //
268  list<uint32_t> towerListEB ;
269  list<uint32_t> stripListEB ;
270  list<uint32_t> towerListEE ;
271  list<uint32_t> stripListEE ;
272  list<uint32_t>::iterator itList ;
273 
274  std::map<int, uint32_t> stripMapEB ; // <EcalLogicId.hashed, strip elec id>
275  std::map<uint32_t, uint32_t> stripMapEBsintheta ; // <strip elec id, sintheta>
276 
277 
278  // Pedestals
279  std::cout <<"Getting the pedestals from offline DB..."<<std::endl;
280  ESHandle<EcalPedestals> pedHandle;
281  evtSetup.get<EcalPedestalsRcd>().get( pedHandle );
282  const EcalPedestalsMap & pedMap = pedHandle.product()->getMap() ;
283  EcalPedestalsMapIterator pedIter ;
284  int nPed = 0 ;
285  for (pedIter = pedMap.begin() ; pedIter != pedMap.end() && nPed<10 ; ++pedIter, nPed++) {
286  EcalPedestals::Item aped = (*pedIter);
287  std::cout<<aped.mean_x12<<", "<<aped.mean_x6<<", "<<aped.mean_x1<<std::endl ;
288  }
289  std::cout<<"...\n"<<std::endl ;
290 
291 
292  // Intercalib constants
293  std::cout <<"Getting intercalib from offline DB..."<<std::endl;
295  evtSetup.get<EcalIntercalibConstantsRcd>().get(pIntercalib) ;
296  const EcalIntercalibConstants * intercalib = pIntercalib.product() ;
297  const EcalIntercalibConstantMap & calibMap = intercalib->getMap() ;
299  int nCal = 0 ;
300  for (calIter = calibMap.begin() ; calIter != calibMap.end() && nCal<10 ; ++calIter, nCal++) {
301  std::cout<<(*calIter)<<std::endl ;
302  }
303  std::cout<<"...\n"<<std::endl ;
304 
305 
306  // Gain Ratios
307  std::cout <<"Getting the gain ratios from offline DB..."<<std::endl;
309  evtSetup.get<EcalGainRatiosRcd>().get(pRatio);
310  const EcalGainRatioMap & gainMap = pRatio.product()->getMap();
312  int nGain = 0 ;
313  for (gainIter = gainMap.begin() ; gainIter != gainMap.end() && nGain<10 ; ++gainIter, nGain++) {
314  const EcalMGPAGainRatio & aGain = (*gainIter) ;
315  std::cout<<aGain.gain12Over6()<<", "<<aGain.gain6Over1() * aGain.gain12Over6()<<std::endl ;
316  }
317  std::cout<<"...\n"<<std::endl ;
318 
319 
320  // ADCtoGeV
321  std::cout <<"Getting the ADC to GEV from offline DB..."<<std::endl;
323  evtSetup.get<EcalADCToGeVConstantRcd>().get(pADCToGeV) ;
324  const EcalADCToGeVConstant * ADCToGeV = pADCToGeV.product() ;
325  xtal_LSB_EB_ = ADCToGeV->getEBValue() ;
326  xtal_LSB_EE_ = ADCToGeV->getEEValue() ;
327  std::cout<<"xtal_LSB_EB_ = "<<xtal_LSB_EB_<<std::endl ;
328  std::cout<<"xtal_LSB_EE_ = "<<xtal_LSB_EE_<<std::endl ;
329  std::cout<<std::endl ;
330 
331 
332  std::vector<EcalLogicID> my_EcalLogicId;
333  std::vector<EcalLogicID> my_TTEcalLogicId;
334  std::vector<EcalLogicID> my_StripEcalLogicId;
335  EcalLogicID my_EcalLogicId_EB;
336  // Endcap identifiers
337  EcalLogicID my_EcalLogicId_EE;
338  std::vector<EcalLogicID> my_TTEcalLogicId_EE;
339  std::vector<EcalLogicID> my_RTEcalLogicId_EE;
340  std::vector<EcalLogicID> my_StripEcalLogicId1_EE;
341  std::vector<EcalLogicID> my_StripEcalLogicId2_EE;
342  std::vector<EcalLogicID> my_CrystalEcalLogicId_EE;
343 
344  if (writeToDB_){
345  std::cout<<"going to get the ecal logic id set"<< std::endl;
346 
349 
350  my_EcalLogicId = db_->getEcalLogicIDSetOrdered( "EB_crystal_number",
351  1, 36,
352  1, 1700,
354  "EB_crystal_number",12 );
355  my_TTEcalLogicId = db_->getEcalLogicIDSetOrdered( "EB_trigger_tower",
356  1, 36,
357  1, 68,
359  "EB_trigger_tower",12 );
360  my_StripEcalLogicId = db_->getEcalLogicIDSetOrdered( "EB_VFE", 1, 36, 1, 68, 1,5 , "EB_VFE",123 ); //last digi means ordered 1st by SM,then TT, then strip
361  std::cout<<"got the 3 ecal barrel logic id set"<< std::endl;
362 
363  // EE crystals identifiers
364  // EE crystals identifiers
365  my_CrystalEcalLogicId_EE = db_->getEcalLogicIDSetOrdered("EE_crystal_number",
366  -1, 1,
367  0, 200,
368  0, 200,
369  "EE_crystal_number",123 );
370 
371 
372  // EE Strip identifiers
373  // DCC=601-609 TT = ~40 EEstrip = 5
374  my_StripEcalLogicId1_EE = db_->getEcalLogicIDSetOrdered( "ECAL_readout_strip",
375  601, 609,
376  1, 100,
377  0,5 ,
378  "ECAL_readout_strip",123 );
379 
380  // EE Strip identifiers
381  // DCC=646-654 TT = ~40 EEstrip = 5
382  my_StripEcalLogicId2_EE = db_->getEcalLogicIDSetOrdered( "ECAL_readout_strip",
383  646, 654,
384  1, 100,
385  0,5 ,
386  "ECAL_readout_strip",123 );
387 
388  // TTC=72 TT = 1440
389  my_TTEcalLogicId_EE = db_->getEcalLogicIDSetOrdered( "EE_trigger_tower",
390  1, 108,
391  1, 40,
393  "EE_trigger_tower",12 );
394 
395 
396  // TTC=72 TT = 1440
397  my_RTEcalLogicId_EE = db_->getEcalLogicIDSetOrdered( "EE_readout_tower",
398  1, 1000,
399  1, 100,
401  "EE_readout_tower",12 );
402 
403  std::cout<<"got the end cap logic id set"<< std::endl;
404  std::cout<<"now just get the latest ids for this tag (latest version) "<< std::endl;
405 
406 
407  FEConfigMainInfo fe_main_info;
408  fe_main_info.setConfigTag(tag_);
409  try {
410  std::cout << "trying to read previous tag if it exists tag="<< tag_<< ".version"<<version_<< std::endl;
411 
412  db_-> fetchConfigSet(&fe_main_info);
413  ped_conf_id_=fe_main_info.getPedId();
414  lin_conf_id_=fe_main_info.getLinId();
415  lut_conf_id_=fe_main_info.getLUTId();
416  wei_conf_id_=fe_main_info.getWeiId();
417  fgr_conf_id_=fe_main_info.getFgrId();
418  sli_conf_id_=fe_main_info.getSliId();
419  if(fe_main_info.getBxtId()>0) bxt_conf_id_=fe_main_info.getBxtId();
420  if(fe_main_info.getBttId()>0 && btt_conf_id_==0 ) btt_conf_id_=fe_main_info.getBttId();
421  // those that are not written specifically in this program are propagated
422  // from the previous record with the same tag and the highest version
423 
424  std::cout<<"got it "<< std::endl;
425 
426  } catch (exception &e) {
427  std::cout << " tag did not exist a new tag will be created " << std::endl;
428  } catch (...) {
429  std::cout << "Unknown error caught" << std::endl;
430  }
431 
432  }
433 
435  // Compute linearization coeff section //
437 
438  std::map<EcalLogicID, FEConfigPedDat> pedset ;
439  std::map<EcalLogicID, FEConfigLinDat> linset ;
440  std::map<EcalLogicID, FEConfigLinParamDat> linparamset ;
441  std::map<EcalLogicID, FEConfigLUTParamDat> lutparamset ;
442  std::map<EcalLogicID, FEConfigFgrParamDat> fgrparamset ;
443 
444  std::map<int, linStruc> linEtaSlice ;
445  std::map <std::vector<int>, linStruc > linMap ;
446 
447  // count number of strip per tower
448  int NbOfStripPerTCC[108][68] ;
449  for (int i=0 ; i<108 ; i++)
450  for (int j=0 ; j<68 ; j++)
451  NbOfStripPerTCC[i][j] = 0 ;
452  const std::vector<DetId> & ebCells = theBarrelGeometry_->getValidDetIds(DetId::Ecal, EcalBarrel);
453  const std::vector<DetId> & eeCells = theEndcapGeometry_->getValidDetIds(DetId::Ecal, EcalEndcap);
454  for (std::vector<DetId>::const_iterator it = ebCells.begin(); it != ebCells.end(); ++it) {
455  EBDetId id(*it) ;
456  const EcalTrigTowerDetId towid= id.tower();
458  int tccNb = theMapping_->TCCid(towid) ;
459  int towerInTCC = theMapping_->iTT(towid) ;
460  int stripInTower = elId.pseudoStripId() ;
461  if (stripInTower>NbOfStripPerTCC[tccNb-1][towerInTCC-1]) NbOfStripPerTCC[tccNb-1][towerInTCC-1] = stripInTower ;
462  }
463  for (std::vector<DetId>::const_iterator it = eeCells.begin(); it != eeCells.end(); ++it) {
464  EEDetId id(*it) ;
465  const EcalTrigTowerDetId towid= (*eTTmap_).towerOf(id) ;
467  int tccNb = theMapping_->TCCid(towid) ;
468  int towerInTCC = theMapping_->iTT(towid) ;
469  int stripInTower = elId.pseudoStripId() ;
470  if (stripInTower>NbOfStripPerTCC[tccNb-1][towerInTCC-1]) NbOfStripPerTCC[tccNb-1][towerInTCC-1] = stripInTower ;
471  }
472 
473 
474 
475  // loop on EB xtals
476  if (writeToFiles_) (*out_file_)<<"COMMENT ====== barrel crystals ====== "<<std::endl ;
477 
478  // special case of eta slices
479  for (std::vector<DetId>::const_iterator it = ebCells.begin(); it != ebCells.end(); ++it) {
480  EBDetId id(*it) ;
482  if (!useTransverseEnergy_) theta = acos(0.) ;
483  const EcalTrigTowerDetId towid= id.tower();
485  int dccNb = theMapping_->DCCid(towid) ;
486  int tccNb = theMapping_->TCCid(towid) ;
487  int towerInTCC = theMapping_->iTT(towid) ; // from 1 to 68 (EB)
488  int stripInTower = elId.pseudoStripId() ; // from 1 to 5
489  int xtalInStrip = elId.channelId() ; // from 1 to 5
491  int CCUid = Id.towerId() ;
492  int VFEid = Id.stripId() ;
493  int xtalInVFE = Id.xtalId() ;
494  int xtalWithinCCUid = 5*(VFEid-1) + xtalInVFE -1 ; // Evgueni expects [0,24]
495 
496  (*geomFile_)<<"dccNb = "<<dccNb<<" tccNb = "<<tccNb<<" towerInTCC = "<<towerInTCC
497  <<" stripInTower = "<<stripInTower<<" xtalInStrip = "<<xtalInStrip
498  <<" CCUid = "<<CCUid<<" VFEid = "<<VFEid<<" xtalInVFE = "<<xtalInVFE
499  <<" xtalWithinCCUid = "<<xtalWithinCCUid<<" ieta = "<<id.ieta()<<" iphi = "<<id.iphi()
500  <<" xtalhashedId = "<<id.hashedIndex()<<" xtalNb = "<<id.ic()
501  <<" ietaTT = "<<towid.ieta()<<" iphiTT = "<<towid.iphi()<<std::endl ;
502 
503  int TCCch = towerInTCC ;
504  int SLBslot = int((towerInTCC-1)/8.) + 1 ;
505  int SLBch = (towerInTCC-1)%8 + 1 ;
506  float val[] = {float(dccNb+600),float(tccNb),float(towerInTCC),float(stripInTower),
507  float(xtalInStrip),float(CCUid),float(VFEid),float(xtalInVFE),
508  float(xtalWithinCCUid),float(id.ieta()),float(id.iphi()),
509  -999.,-999.,float(towid.ieta())/float(abs(towid.ieta())),
510  float(id.hashedIndex()),
511  float(id.ic()),float(towid.ieta()),float(towid.iphi()),
512  float(TCCch), float(getCrate(tccNb).second),
513  float(SLBch), float(SLBslot),
514  float(getGCTRegionEta(towid.ieta())),float(getGCTRegionPhi(towid.iphi()))} ;
515  for (int i=0 ; i<24 ; i++) ntupleFloats_[i] = val[i] ;
516 
517  sprintf(ntupleDet_,getDet(tccNb).c_str()) ;
518  sprintf(ntupleCrate_,getCrate(tccNb).first.c_str()) ;
519  ntuple->Fill() ;
520 
521 
522  if (tccNb == 37 && stripInTower == 3 && xtalInStrip == 3 && (towerInTCC-1)%4==0) {
523  int etaSlice = towid.ietaAbs() ;
524  coeffStruc coeff ;
525  getCoeff(coeff, calibMap, id.rawId()) ;
526  getCoeff(coeff, gainMap, id.rawId()) ;
527  getCoeff(coeff, pedMap, id.rawId()) ;
528  linStruc lin ;
529  for (int i=0 ; i<3 ; i++) {
530  int mult, shift ;
531  bool ok = computeLinearizerParam(theta, coeff.gainRatio_[i], coeff.calibCoeff_, "EB", mult , shift) ;
532  if (!ok) std::cout << "unable to compute the parameters for SM="<< id.ism()<<" xt="<< id.ic()<<" " <<dec<<id.rawId()<<std::endl ;
533  else {
534  lin.pedestal_[i] = coeff.pedestals_[i] ;
535  lin.mult_[i] = mult ;
536  lin.shift_[i] = shift ;
537  }
538  }
539 
540  bool ok(true) ;
541  if (forcedPedestalValue_ == -2) ok = realignBaseline(lin, 0) ;
542  if (!ok) std::cout<<"SM="<< id.ism()<<" xt="<< id.ic()<<" " <<dec<<id.rawId()<<std::endl ;
543  linEtaSlice[etaSlice] = lin ;
544  }
545  }
546 
547  // general case
548  for (std::vector<DetId>::const_iterator it = ebCells.begin(); it != ebCells.end(); ++it) {
549  EBDetId id(*it) ;
550  double theta = theBarrelGeometry_->getGeometry(id)->getPosition().theta() ;
551  if (!useTransverseEnergy_) theta = acos(0.) ;
552  const EcalTrigTowerDetId towid= id.tower();
553  towerListEB.push_back(towid.rawId()) ;
555  stripListEB.push_back(elId.rawId() & 0xfffffff8) ;
556  int dccNb = theMapping_->DCCid(towid) ;
557  //int tccNb = theMapping_->TCCid(towid) ;
558  int towerInTCC = theMapping_->iTT(towid) ; // from 1 to 68 (EB)
559  //int stripInTower = elId.pseudoStripId() ; // from 1 to 5
560  //int xtalInStrip = elId.channelId() ; // from 1 to 5
562  int CCUid = Id.towerId() ;
563  int VFEid = Id.stripId() ;
564  int xtalInVFE = Id.xtalId() ;
565  int xtalWithinCCUid = 5*(VFEid-1) + xtalInVFE -1 ; // Evgueni expects [0,24]
566  int etaSlice = towid.ietaAbs() ;
567 
568  // hashed index of strip EcalLogicID:
569  int hashedStripLogicID = 68*5*(id.ism()-1) + 5*(towerInTCC-1) + (VFEid-1) ;
570  stripMapEB[hashedStripLogicID] = elId.rawId() & 0xfffffff8 ;
571  stripMapEBsintheta[elId.rawId() & 0xfffffff8] = SFGVB_Threshold_ + abs(int(sin(theta)*pedestal_offset_)) ;
572 
573  FEConfigPedDat pedDB ;
574  FEConfigLinDat linDB ;
575  if (writeToFiles_) (*out_file_)<<"CRYSTAL "<<dec<<id.rawId()<<std::endl ;
576  // if (writeToDB_) logicId = db_->getEcalLogicID ("EB_crystal_number", id.ism(), id.ic()) ;
577 
578  coeffStruc coeff ;
579  getCoeff(coeff, calibMap, id.rawId()) ;
580  getCoeff(coeff, gainMap, id.rawId()) ;
581  getCoeff(coeff, pedMap, id.rawId()) ;
582  ICEB->Fill(id.iphi(), id.ieta(), coeff.calibCoeff_) ;
584 
585  std::vector<int> xtalCCU ;
586  xtalCCU.push_back(dccNb+600) ;
587  xtalCCU.push_back(CCUid) ;
588  xtalCCU.push_back(xtalWithinCCUid) ;
589  xtalCCU.push_back(id.rawId()) ;
590 
591  // compute and fill linearization parameters
592  // case of eta slice
593  if (forceEtaSlice_) {
594  std::map<int, linStruc>::const_iterator itLin = linEtaSlice.find(etaSlice);
595  if (itLin != linEtaSlice.end()) {
596  linMap[xtalCCU] = itLin->second ;
597  if (writeToFiles_) {
598  for (int i=0 ; i<3 ; i++)
599  (*out_file_) << hex <<" 0x"<<itLin->second.pedestal_[i]<<" 0x"<<itLin->second.mult_[i]<<" 0x"<<itLin->second.shift_[i]<<std::endl;
600  }
601  if (writeToDB_) {
602  for (int i=0 ; i<3 ; i++) {
603  if (i==0) {pedDB.setPedMeanG12(itLin->second.pedestal_[i]) ; linDB.setMultX12(itLin->second.mult_[i]) ; linDB.setShift12(itLin->second.shift_[i]) ; }
604  if (i==1) {pedDB.setPedMeanG6(itLin->second.pedestal_[i]) ; linDB.setMultX6(itLin->second.mult_[i]) ; linDB.setShift6(itLin->second.shift_[i]) ; }
605  if (i==2) {pedDB.setPedMeanG1(itLin->second.pedestal_[i]) ; linDB.setMultX1(itLin->second.mult_[i]) ; linDB.setShift1(itLin->second.shift_[i]) ; }
606  }
607  }
608  float factor = float(itLin->second.mult_[0])*pow(2.,-itLin->second.shift_[0])/xtal_LSB_EB_ ;
609  tpgFactorEB->Fill(id.iphi(), id.ieta(), factor) ;
610  tpgFactor->Fill(theBarrelGeometry_->getGeometry(id)->getPosition().phi(),
611  theBarrelGeometry_->getGeometry(id)->getPosition().eta(), factor) ;
612  }
613  else std::cout<<"current EtaSlice = "<<etaSlice<<" not found in the EtaSlice map"<<std::endl ;
614  }
615  else {
616  // general case
617  linStruc lin ;
618  int forceBase12 = 0 ;
619  for (int i=0 ; i<3 ; i++) {
620  int mult, shift ;
621  bool ok = computeLinearizerParam(theta, coeff.gainRatio_[i], coeff.calibCoeff_, "EB", mult , shift) ;
622  if (!ok) std::cout << "unable to compute the parameters for SM="<< id.ism()<<" xt="<< id.ic()<<" " <<dec<<id.rawId()<<std::endl ;
623  else {
624  //PP begin
625  // mult = 0 ; shift = 0 ;
626  // if (CCUid==1 && xtalWithinCCUid==21) {
627  // if (i==0) {mult = 0x80 ; shift = 0x3 ;}
628  // if (i==1) {mult = 0x80 ; shift = 0x2 ;}
629  // if (i==2) {mult = 0xc0 ; shift = 0x0 ;}
630  // }
631  //PP end
632  double base = coeff.pedestals_[i] ;
633  if (forcedPedestalValue_ == -3 && i==0) {
634  double G = mult*pow(2.,-(shift+2)) ;
635  double g = G/sin(theta) ;
636  // int pedestal = coeff.pedestals_[i] ;
637  base = double(coeff.pedestals_[i]) - pedestal_offset_/g ;
638  if (base<0.) base = 0 ;
639  forceBase12 = int(base) ;
640  }
641  lin.pedestal_[i] = coeff.pedestals_[i] ;
642  lin.mult_[i] = mult ;
643  lin.shift_[i] = shift ;
644  }
645  }
646 
647  bool ok(true) ;
648  if (forcedPedestalValue_ == -2) ok = realignBaseline(lin, 0) ;
649  if (forcedPedestalValue_ == -3) ok = realignBaseline(lin, forceBase12) ;
650  if (!ok) std::cout<<"SM="<< id.ism()<<" xt="<< id.ic()<<" " <<dec<<id.rawId()<<std::endl ;
651 
652  for (int i=0 ; i<3 ; i++) {
653  if (writeToFiles_) (*out_file_) << hex <<" 0x"<<lin.pedestal_[i]<<" 0x"<<lin.mult_[i]<<" 0x"<<lin.shift_[i]<<std::endl;
654  if (writeToDB_) {
655  if (i==0) {pedDB.setPedMeanG12(lin.pedestal_[i]) ; linDB.setMultX12(lin.mult_[i]) ; linDB.setShift12(lin.shift_[i]) ; }
656  if (i==1) {pedDB.setPedMeanG6(lin.pedestal_[i]) ; linDB.setMultX6(lin.mult_[i]) ; linDB.setShift6(lin.shift_[i]) ; }
657  if (i==2) {pedDB.setPedMeanG1(lin.pedestal_[i]) ; linDB.setMultX1(lin.mult_[i]) ; linDB.setShift1(lin.shift_[i]) ; }
658  }
659  if (i==0) {
660  float factor = float(lin.mult_[i])*pow(2.,-lin.shift_[i])/xtal_LSB_EB_ ;
661  tpgFactorEB->Fill(id.iphi(), id.ieta(), factor) ;
662  tpgFactor->Fill(theBarrelGeometry_->getGeometry(id)->getPosition().phi(),
663  theBarrelGeometry_->getGeometry(id)->getPosition().eta(), factor) ;
664  }
665  double G = lin.mult_[i]*pow(2.,-(lin.shift_[i]+2)) ;
666  double g = G/sin(theta) ;
667  float val[] = {float(i),float(theta),float(G),float(g),
668  float(coeff.pedestals_[i]),float(lin.pedestal_[i])} ;// first arg = gainId (0 means gain12)
669  ntupleSpike->Fill(val) ;
670  }
671  linMap[xtalCCU] = lin ;
672  }
673  if (writeToDB_) {
674  // 1700 crystals/SM in the ECAL barrel
675  int ixtal=(id.ism()-1)*1700+(id.ic()-1);
676  EcalLogicID logicId =my_EcalLogicId[ixtal];
677  pedset[logicId] = pedDB ;
678  linset[logicId] = linDB ;
679  }
680  } //ebCells
681 
682  if (writeToDB_) {
683  // EcalLogicID of the whole barrel is: my_EcalLogicId_EB
684  FEConfigLinParamDat linparam ;
685  linparam.setETSat(Et_sat_EB_);
686  linparamset[my_EcalLogicId_EB] = linparam ;
687 
688  FEConfigFgrParamDat fgrparam ;
691  fgrparam.setFGlowratio(FG_lowRatio_EB_);
693  fgrparamset[my_EcalLogicId_EB] = fgrparam ;
694 
695 
696  FEConfigLUTParamDat lutparam ;
697  lutparam.setETSat(Et_sat_EB_);
700  lutparamset[my_EcalLogicId_EB] = lutparam ;
701 
702  }
703 
704 
705  // loop on EE xtals
706  if (writeToFiles_) (*out_file_)<<"COMMENT ====== endcap crystals ====== "<<std::endl ;
707 
708  // special case of eta slices
709  for (std::vector<DetId>::const_iterator it = eeCells.begin(); it != eeCells.end(); ++it) {
710  EEDetId id(*it) ;
711  double theta = theEndcapGeometry_->getGeometry(id)->getPosition().theta() ;
712  if (!useTransverseEnergy_) theta = acos(0.) ;
713  const EcalTrigTowerDetId towid= (*eTTmap_).towerOf(id) ;
716  int dccNb = Id.dccId() ;
717  int tccNb = theMapping_->TCCid(towid) ;
718  int towerInTCC = theMapping_->iTT(towid) ;
719  int stripInTower = elId.pseudoStripId() ;
720  int xtalInStrip = elId.channelId() ;
721  int CCUid = Id.towerId() ;
722  int VFEid = Id.stripId() ;
723  int xtalInVFE = Id.xtalId() ;
724  int xtalWithinCCUid = 5*(VFEid-1) + xtalInVFE -1 ; // Evgueni expects [0,24]
725 
726  (*geomFile_)<<"dccNb = "<<dccNb<<" tccNb = "<<tccNb<<" towerInTCC = "<<towerInTCC
727  <<" stripInTower = "<<stripInTower<<" xtalInStrip = "<<xtalInStrip
728  <<" CCUid = "<<CCUid<<" VFEid = "<<VFEid<<" xtalInVFE = "<<xtalInVFE
729  <<" xtalWithinCCUid = "<<xtalWithinCCUid<<" ix = "<<id.ix()<<" iy = "<<id.iy()
730  <<" xtalhashedId = "<<id.hashedIndex()<<" xtalNb = "<<id.isc()
731  <<" ietaTT = "<<towid.ieta()<<" iphiTT = "<<towid.iphi()<<std::endl ;
732 
733  int TCCch = stripInTower ;
734  int SLBslot, SLBch ;
735  if (towerInTCC<5) {
736  SLBslot = 1 ;
737  SLBch = 4 + towerInTCC ;
738  }
739  else {
740  SLBslot = int((towerInTCC-5)/8.) + 2 ;
741  SLBch = (towerInTCC-5)%8 + 1 ;
742  }
743  for (int j=0 ; j<towerInTCC-1 ; j++) TCCch += NbOfStripPerTCC[tccNb-1][j] ;
744  float val[] = {float(dccNb+600),float(tccNb),float(towerInTCC),float(stripInTower),
745  float(xtalInStrip),float(CCUid),float(VFEid),float(xtalInVFE),
746  float(xtalWithinCCUid),-999.,-999.,
747  float(id.ix()),float(id.iy()),float(towid.ieta())/float(abs(towid.ieta())),
748  float(id.hashedIndex()),
749  float(id.ic()),float(towid.ieta()),float(towid.iphi()),float(TCCch),
750  float(getCrate(tccNb).second),
751  float(SLBch), float(SLBslot),
752  float(getGCTRegionEta(towid.ieta())),float(getGCTRegionPhi(towid.iphi()))} ;
753  for (int i=0 ; i<24 ; i++) ntupleFloats_[i] = val[i] ;
754  sprintf(ntupleDet_,getDet(tccNb).c_str()) ;
755  sprintf(ntupleCrate_,getCrate(tccNb).first.c_str()) ;
756  ntuple->Fill() ;
757 
758  if ((tccNb == 76 || tccNb == 94) && stripInTower == 1 && xtalInStrip == 3 && (towerInTCC-1)%4==0) {
759  int etaSlice = towid.ietaAbs() ;
760  coeffStruc coeff ;
761  getCoeff(coeff, calibMap, id.rawId()) ;
762  getCoeff(coeff, gainMap, id.rawId()) ;
763  getCoeff(coeff, pedMap, id.rawId()) ;
764  linStruc lin ;
765  for (int i=0 ; i<3 ; i++) {
766  int mult, shift ;
767  bool ok = computeLinearizerParam(theta, coeff.gainRatio_[i], coeff.calibCoeff_, "EE", mult , shift) ;
768  if (!ok) std::cout << "unable to compute the parameters for Quadrant="<< id.iquadrant()<<" xt="<< id.ic()<<" " <<dec<<id.rawId()<<std::endl ;
769  else {
770  lin.pedestal_[i] = coeff.pedestals_[i] ;
771  lin.mult_[i] = mult ;
772  lin.shift_[i] = shift ;
773  }
774  }
775 
776  bool ok(true) ;
777  if (forcedPedestalValue_ == -2 || forcedPedestalValue_ == -3) ok = realignBaseline(lin, 0) ;
778  if (!ok) std::cout<<"Quadrant="<< id.iquadrant()<<" xt="<< id.ic()<<" " <<dec<<id.rawId()<<std::endl ;
779 
780  linEtaSlice[etaSlice] = lin ;
781  }
782  }
783 
784  // general case
785  for (std::vector<DetId>::const_iterator it = eeCells.begin(); it != eeCells.end(); ++it) {
786  EEDetId id(*it);
787  double theta = theEndcapGeometry_->getGeometry(id)->getPosition().theta() ;
788  if (!useTransverseEnergy_) theta = acos(0.) ;
789  const EcalTrigTowerDetId towid= (*eTTmap_).towerOf(id) ;
792  towerListEE.push_back(towid.rawId()) ;
793  // special case of towers in inner rings of EE
794  if (towid.ietaAbs() == 27 || towid.ietaAbs() == 28) {
795  EcalTrigTowerDetId additionalTower(towid.zside(), towid.subDet(), towid.ietaAbs(), towid.iphi()+1) ;
796  towerListEE.push_back(additionalTower.rawId()) ;
797  }
798  stripListEE.push_back(elId.rawId() & 0xfffffff8) ;
799  int dccNb = Id.dccId() ;
800  //int tccNb = theMapping_->TCCid(towid) ;
801  //int towerInTCC = theMapping_->iTT(towid) ;
802  //int stripInTower = elId.pseudoStripId() ;
803  //int xtalInStrip = elId.channelId() ;
804  int CCUid = Id.towerId() ;
805  int VFEid = Id.stripId() ;
806  int xtalInVFE = Id.xtalId() ;
807  int xtalWithinCCUid = 5*(VFEid-1) + xtalInVFE -1 ; // Evgueni expects [0,24]
808  int etaSlice = towid.ietaAbs() ;
809 
810  EcalLogicID logicId ;
811  FEConfigPedDat pedDB ;
812  FEConfigLinDat linDB ;
813  if (writeToFiles_) (*out_file_)<<"CRYSTAL "<<dec<<id.rawId()<<std::endl ;
814  if (writeToDB_ && DBEE_) {
815  int iz = id.positiveZ() ;
816  if (iz ==0) iz = -1 ;
817 
818  for(int k=0; k<(int)my_CrystalEcalLogicId_EE.size(); k++) {
819 
820  int z= my_CrystalEcalLogicId_EE[k].getID1() ;
821  int x= my_CrystalEcalLogicId_EE[k].getID2() ;
822  int y= my_CrystalEcalLogicId_EE[k].getID3() ;
823 
824  if(id.ix()==x && id.iy()==y && iz==z) {
825 
826  logicId=my_CrystalEcalLogicId_EE[k];
827 
828  }
829  }
830 
831  }
832 
833  coeffStruc coeff ;
834  getCoeff(coeff, calibMap, id.rawId()) ;
835  getCoeff(coeff, gainMap, id.rawId()) ;
836  getCoeff(coeff, pedMap, id.rawId()) ;
837  if (id.zside()>0) ICEEPlus->Fill(id.ix(), id.iy(), coeff.calibCoeff_) ;
838  else ICEEMinus->Fill(id.ix(), id.iy(), coeff.calibCoeff_) ;
840 
841  std::vector<int> xtalCCU ;
842  xtalCCU.push_back(dccNb+600) ;
843  xtalCCU.push_back(CCUid) ;
844  xtalCCU.push_back(xtalWithinCCUid) ;
845  xtalCCU.push_back(id.rawId()) ;
846 
847  // compute and fill linearization parameters
848  // case of eta slice
849  if (forceEtaSlice_) {
850  std::map<int, linStruc>::const_iterator itLin = linEtaSlice.find(etaSlice);
851  if (itLin != linEtaSlice.end()) {
852  linMap[xtalCCU] = itLin->second ;
853  if (writeToFiles_) {
854  for (int i=0 ; i<3 ; i++)
855  (*out_file_) << hex <<" 0x"<<itLin->second.pedestal_[i]<<" 0x"<<itLin->second.mult_[i]<<" 0x"<<itLin->second.shift_[i]<<std::endl;
856  }
857  if (writeToDB_ && DBEE_) {
858  for (int i=0 ; i<3 ; i++) {
859  if (i==0) {pedDB.setPedMeanG12(itLin->second.pedestal_[i]) ; linDB.setMultX12(itLin->second.mult_[i]) ; linDB.setShift12(itLin->second.shift_[i]) ; }
860  if (i==1) {pedDB.setPedMeanG6(itLin->second.pedestal_[i]) ; linDB.setMultX6(itLin->second.mult_[i]) ; linDB.setShift6(itLin->second.shift_[i]) ; }
861  if (i==2) {pedDB.setPedMeanG1(itLin->second.pedestal_[i]) ; linDB.setMultX1(itLin->second.mult_[i]) ; linDB.setShift1(itLin->second.shift_[i]) ; }
862  }
863  }
864  float factor = float(itLin->second.mult_[0])*pow(2.,-itLin->second.shift_[0])/xtal_LSB_EE_ ;
865  if (id.zside()>0) tpgFactorEEPlus->Fill(id.ix(), id.iy(), factor) ;
866  else tpgFactorEEMinus->Fill(id.ix(), id.iy(), factor) ;
867  tpgFactor->Fill(theEndcapGeometry_->getGeometry(id)->getPosition().phi(),
868  theEndcapGeometry_->getGeometry(id)->getPosition().eta(), factor) ;
869  }
870  else std::cout<<"current EtaSlice = "<<etaSlice<<" not found in the EtaSlice map"<<std::endl ;
871  }
872  else {
873  // general case
874  linStruc lin ;
875  for (int i=0 ; i<3 ; i++) {
876  int mult, shift ;
877  bool ok = computeLinearizerParam(theta, coeff.gainRatio_[i], coeff.calibCoeff_, "EE", mult , shift) ;
878  if (!ok) std::cout << "unable to compute the parameters for "<<dec<<id.rawId()<<std::endl ;
879  else {
880  lin.pedestal_[i] = coeff.pedestals_[i] ;
881  lin.mult_[i] = mult ;
882  lin.shift_[i] = shift ;
883  }
884  }
885 
886  bool ok(true) ;
887  if (forcedPedestalValue_ == -2 || forcedPedestalValue_ == -3) ok = realignBaseline(lin, 0) ;
888  if (!ok) std::cout<<"Quadrant="<< id.iquadrant()<<" xt="<< id.ic()<<" " <<dec<<id.rawId()<<std::endl ;
889 
890  for (int i=0 ; i<3 ; i++) {
891  if (writeToFiles_) (*out_file_) << hex <<" 0x"<<lin.pedestal_[i]<<" 0x"<<lin.mult_[i]<<" 0x"<<lin.shift_[i]<<std::endl;
892  if (writeToDB_ && DBEE_) {
893  if (i==0) {pedDB.setPedMeanG12(lin.pedestal_[i]) ; linDB.setMultX12(lin.mult_[i]) ; linDB.setShift12(lin.shift_[i]) ; }
894  if (i==1) {pedDB.setPedMeanG6(lin.pedestal_[i]) ; linDB.setMultX6(lin.mult_[i]) ; linDB.setShift6(lin.shift_[i]) ; }
895  if (i==2) {pedDB.setPedMeanG1(lin.pedestal_[i]) ; linDB.setMultX1(lin.mult_[i]) ; linDB.setShift1(lin.shift_[i]) ; }
896  }
897  if (i==0) {
898  float factor = float(lin.mult_[i])*pow(2.,-lin.shift_[i])/xtal_LSB_EE_ ;
899  if (id.zside()>0) tpgFactorEEPlus->Fill(id.ix(), id.iy(), factor) ;
900  else tpgFactorEEMinus->Fill(id.ix(), id.iy(), factor) ;
901  tpgFactor->Fill(theEndcapGeometry_->getGeometry(id)->getPosition().phi(),
902  theEndcapGeometry_->getGeometry(id)->getPosition().eta(), factor) ;
903  }
904  }
905  linMap[xtalCCU] = lin ;
906  }
907  if (writeToDB_ && DBEE_) {
908  pedset[logicId] = pedDB ;
909  linset[logicId] = linDB ;
910  }
911  } //eeCells
912 
913  if (writeToDB_ ) {
914  // EcalLogicID of the whole barrel is: my_EcalLogicId_EB
915  FEConfigLinParamDat linparam ;
916  linparam.setETSat(Et_sat_EE_);
917  linparamset[my_EcalLogicId_EE] = linparam ;
918 
919  FEConfigLUTParamDat lutparam ;
920  lutparam.setETSat(Et_sat_EE_);
923  lutparamset[my_EcalLogicId_EE] = lutparam ;
924 
925 
926  FEConfigFgrParamDat fgrparam ;
927  fgrparam.setFGlowthresh(FG_Threshold_EE_);
929  fgrparamset[my_EcalLogicId_EE] = fgrparam ;
930 
931  }
932 
933  if (writeToDB_) {
934 
935  ostringstream ltag;
936  ltag.str("EB_"); ltag<<Et_sat_EB_<<"_EE_"<<Et_sat_EE_;
937  std::string lin_tag=ltag.str();
938  std::cout<< " LIN tag "<<lin_tag<<std::endl;
939 
940  if(m_write_ped==1) ped_conf_id_=db_->writeToConfDB_TPGPedestals(pedset, 1, "from_OfflineDB") ;
941  if(m_write_lin==1) lin_conf_id_=db_->writeToConfDB_TPGLinearCoef(linset,linparamset, 1, lin_tag) ;
942  }
943 
945  // Evgueni interface
947  std::ofstream evgueni("TPG_hardcoded.hh", std::ios::out) ;
948  evgueni<<"void getLinParamTPG_hardcoded(int fed, int ccu, int xtal,"<<std::endl ;
949  evgueni<<" int & mult12, int & shift12, int & base12,"<<std::endl ;
950  evgueni<<" int & mult6, int & shift6, int & base6,"<<std::endl ;
951  evgueni<<" int & mult1, int & shift1, int & base1)"<<std::endl ;
952  evgueni<<"{"<<std::endl;
953  evgueni<<" mult12 = 0 ; shift12 = 0 ; base12 = 0 ; mult6 = 0 ; shift6 = 0 ; base6 = 0 ; mult1 = 0 ; shift1 = 0 ; base1 = 0 ;"<<std::endl ;
954  std::map <std::vector<int>, linStruc>::const_iterator itLinMap ;
955  for (itLinMap = linMap.begin() ; itLinMap != linMap.end() ; itLinMap++) {
956  std::vector<int> xtalInCCU = itLinMap->first ;
957  evgueni<<" if (fed=="<<xtalInCCU[0]<<" && ccu=="<<xtalInCCU[1]<<" && xtal=="<<xtalInCCU[2]<<") {" ;
958  evgueni<<" mult12 = "<<itLinMap->second.mult_[0]<<" ; shift12 = "<<itLinMap->second.shift_[0]<<" ; base12 = "<<itLinMap->second.pedestal_[0]<<" ; " ;
959  evgueni<<" mult6 = "<<itLinMap->second.mult_[1]<<" ; shift6 = "<<itLinMap->second.shift_[1]<<" ; base6 = "<<itLinMap->second.pedestal_[1]<<" ; " ;
960  evgueni<<" mult1 = "<<itLinMap->second.mult_[2]<<" ; shift1 = "<<itLinMap->second.shift_[2]<<" ; base1 = "<<itLinMap->second.pedestal_[2]<<" ; " ;
961  evgueni<<" return ;}" <<std::endl ;
962  }
963  evgueni<<"}" <<std::endl ;
964  evgueni.close() ;
965 
966 
967 
969  // Compute weights section //
971 
972  const int NWEIGROUPS = 2 ;
973  std::vector<unsigned int> weights[NWEIGROUPS] ;
974 
975 #if (CMSSW_VERSION>=340)
976  EBShape shapeEB ;
977  EEShape shapeEE ;
978  weights[0] = computeWeights(shapeEB, hshapeEB) ;
979  weights[1] = computeWeights(shapeEE, hshapeEE) ;
980 #else
981  // loading reference signal representation
982  EcalSimParameterMap parameterMap;
983  EBDetId barrel(1,1);
984  double phase = parameterMap.simParameters(barrel).timePhase();
985  EcalShape shape(phase);
986  weights[0] = computeWeights(shape, hshapeEB) ;
987  weights[1] = weights[0] ;
988 #endif
989 
990  std::map<EcalLogicID, FEConfigWeightGroupDat> dataset;
991 
992  for (int igrp=0 ; igrp<NWEIGROUPS ; igrp++) {
993 
994  if (weights[igrp].size() == 5) {
995 
996  if (writeToFiles_) {
997  (*out_file_) <<std::endl ;
998  (*out_file_) <<"WEIGHT "<<igrp<<std::endl ;
999  for (unsigned int sample=0 ; sample<5 ; sample++) (*out_file_) << "0x" <<hex<<weights[igrp][sample]<<" " ;
1000  (*out_file_)<<std::endl ;
1001  (*out_file_) <<std::endl ;
1002  }
1003  if (writeToDB_) {
1004  std::cout<<"going to write the weights for groupe:"<<igrp<<std::endl;
1006  gut.setWeightGroupId(igrp);
1007  //PP WARNING: weights order is reverted when stored in the DB
1008  gut.setWeight0(weights[igrp][4] );
1009  gut.setWeight1(weights[igrp][3]+ 0x80); //0x80 to identify the max of the pulse in the FENIX (doesn't exist in emulator)
1010  gut.setWeight2(weights[igrp][2] );
1011  gut.setWeight3(weights[igrp][1] );
1012  gut.setWeight4(weights[igrp][0] );
1013  EcalLogicID ecid = EcalLogicID( "DUMMY", igrp,igrp); //1 dummy ID per group
1014  // Fill the dataset
1015  dataset[ecid] = gut;
1016  }
1017  }
1018  }
1019 
1020  if (writeToDB_) {
1021 
1022  // now we store in the DB the correspondence btw channels and groups
1023  std::map<EcalLogicID, FEConfigWeightDat> dataset2;
1024 
1025  // EB loop
1026  for (int ich=0; ich<(int)my_StripEcalLogicId.size() ; ich++){
1027  FEConfigWeightDat wut;
1028  int igroup = 0; // this group is for EB
1029  wut.setWeightGroupId(igroup);
1030  dataset2[my_StripEcalLogicId[ich]] = wut;
1031  }
1032 
1033  // EE loop
1034  for (int ich=0; ich<(int)my_StripEcalLogicId1_EE.size() ; ich++){
1035  FEConfigWeightDat wut;
1036  int igroup = 1; // this group is for EE
1037  wut.setWeightGroupId(igroup);
1038  // Fill the dataset
1039  dataset2[my_StripEcalLogicId1_EE[ich]] = wut;
1040  }
1041  // EE loop 2 (we had to split the ids of EE in 2 vectors to avoid crash!)
1042  for (int ich=0; ich<(int)my_StripEcalLogicId2_EE.size() ; ich++){
1043  FEConfigWeightDat wut;
1044  int igroup = 1; // this group is for EE
1045  wut.setWeightGroupId(igroup);
1046  // Fill the dataset
1047  dataset2[my_StripEcalLogicId2_EE[ich]] = wut;
1048  }
1049 
1050  // Insert the datasets
1051  ostringstream wtag;
1052  wtag.str(""); wtag<<"Shape_NGroups_"<<NWEIGROUPS;
1053  std::string weight_tag=wtag.str();
1054  std::cout<< " weight tag "<<weight_tag<<std::endl;
1055  if (m_write_wei==1) wei_conf_id_=db_->writeToConfDB_TPGWeight(dataset, dataset2, NWEIGROUPS, weight_tag) ;
1056  }
1057 
1058 
1060  // Compute FG section //
1062 
1063  // barrel
1064  unsigned int lowRatio, highRatio, lowThreshold, highThreshold, lutFG ;
1065  computeFineGrainEBParameters(lowRatio, highRatio, lowThreshold, highThreshold, lutFG) ;
1066  if (writeToFiles_) {
1067  (*out_file_) <<std::endl ;
1068  (*out_file_) <<"FG 0"<<std::endl ;
1069  (*out_file_)<<hex<<"0x"<<lowThreshold<<" 0x"<<highThreshold
1070  <<" 0x"<<lowRatio<<" 0x"<<highRatio<<" 0x"<<lutFG
1071  <<std::endl ;
1072  }
1073 
1074  // endcap
1075  unsigned int threshold, lut_tower ;
1076  unsigned int lut_strip;
1077  computeFineGrainEEParameters(threshold, lut_strip, lut_tower) ;
1078 
1079  // and here we store the fgr part
1080 
1081 
1082  if (writeToDB_) {
1083  std::cout<<"going to write the fgr "<< std::endl;
1084  std::map<EcalLogicID, FEConfigFgrGroupDat> dataset;
1085  // we create 1 group
1086  int NFGRGROUPS =1;
1087  for (int ich=0; ich<NFGRGROUPS; ich++){
1088  FEConfigFgrGroupDat gut;
1089  gut.setFgrGroupId(ich);
1090  gut.setThreshLow(lowRatio );
1091  gut.setThreshHigh(highRatio);
1092  gut.setRatioLow(lowThreshold);
1093  gut.setRatioHigh(highThreshold);
1094  gut.setLUTValue(lutFG);
1095  EcalLogicID ecid = EcalLogicID( "DUMMY", ich,ich);
1096  // Fill the dataset
1097  dataset[ecid] = gut; // we use any logic id but different, because it is in any case ignored...
1098  }
1099 
1100  // now we store in the DB the correspondence btw channels and groups
1101  std::map<EcalLogicID, FEConfigFgrDat> dataset2;
1102  // in this case I decide in a stupid way which channel belongs to which group
1103  for (int ich=0; ich<(int)my_TTEcalLogicId.size() ; ich++){
1104  FEConfigFgrDat wut;
1105  int igroup=0;
1106  wut.setFgrGroupId(igroup);
1107  // Fill the dataset
1108  // the logic ids are ordered by SM (1,...36) and TT (1,...68)
1109  // you have to calculate the right index here
1110  dataset2[my_TTEcalLogicId[ich]] = wut;
1111  }
1112 
1113  // endcap loop
1114  for (int ich=0; ich<(int)my_RTEcalLogicId_EE.size() ; ich++){
1115  // std::cout << " endcap FGR " << std::endl;
1116  FEConfigFgrDat wut;
1117  int igroup=0;
1118  wut.setFgrGroupId(igroup);
1119  // Fill the dataset
1120  // the logic ids are ordered by .... ?
1121  // you have to calculate the right index here
1122  dataset2[my_RTEcalLogicId_EE[ich]] = wut;
1123  }
1124 
1125  // endcap TT loop for the FEfgr EE Tower
1126  std::map<EcalLogicID, FEConfigFgrEETowerDat> dataset3;
1127  for (int ich=0; ich<(int)my_TTEcalLogicId_EE.size() ; ich++){
1128  FEConfigFgrEETowerDat fgreett;
1129  fgreett.setLutValue(lut_tower);
1130  dataset3[my_TTEcalLogicId_EE[ich]]=fgreett;
1131  }
1132 
1133  // endcap strip loop for the FEfgr EE strip
1134  // and barrel strip loop for the spike parameters (same structure than EE FGr)
1135  std::map<EcalLogicID, FEConfigFgrEEStripDat> dataset4;
1136  for (int ich=0; ich<(int)my_StripEcalLogicId1_EE.size() ; ich++){
1138  zut.setThreshold(threshold);
1139  zut.setLutFgr(lut_strip);
1140  dataset4[my_StripEcalLogicId1_EE[ich]] = zut;
1141  }
1142  for (int ich=0; ich<(int)my_StripEcalLogicId2_EE.size() ; ich++){
1144  zut.setThreshold(threshold);
1145  zut.setLutFgr(lut_strip);
1146  // Fill the dataset
1147  dataset4[my_StripEcalLogicId2_EE[ich]] = zut;
1148  }
1149  for (int ich=0; ich<(int)my_StripEcalLogicId.size() ; ich++){
1150  // EB
1152  EcalLogicID thestrip = my_StripEcalLogicId[ich] ;
1153  uint32_t elStripId = stripMapEB[ich] ;
1154  map<uint32_t, uint32_t>::const_iterator it = stripMapEBsintheta.find(elStripId) ;
1155  if (it != stripMapEBsintheta.end()) zut.setThreshold(it->second);
1156  else {
1157  std::cout<<"ERROR: strip SFGVB threshold parameter not found for that strip:"<<thestrip.getID1()<<" "<<thestrip.getID3()<<" "<<thestrip.getID3()<<std::endl ;
1158  std::cout<<" using value = "<<SFGVB_Threshold_+pedestal_offset_<<std::endl ;
1160  }
1161  zut.setLutFgr(SFGVB_lut_);
1162  // Fill the dataset
1163  dataset4[thestrip] = zut;
1164  }
1165 
1166  // Insert the dataset
1167  ostringstream wtag;
1168  wtag.str(""); wtag<<"FGR_"<<lutFG<<"_N_"<<NFGRGROUPS<<"_eb_"<<FG_lowThreshold_EB_<<"_EB_"<<FG_highThreshold_EB_;
1169  std::string weight_tag=wtag.str();
1170  std::cout<< " weight tag "<<weight_tag<<std::endl;
1171  if(m_write_fgr==1) fgr_conf_id_=db_->writeToConfDB_TPGFgr(dataset, dataset2, fgrparamset,dataset3, dataset4, NFGRGROUPS, weight_tag) ;
1172  }
1173 
1174  if (writeToDB_) {
1175  std::cout<<"going to write the sliding "<< std::endl;
1176  std::map<EcalLogicID, FEConfigSlidingDat> dataset;
1177  // in this case I decide in a stupid way which channel belongs to which group
1178  for (int ich=0; ich<(int)my_StripEcalLogicId.size() ; ich++){
1179  FEConfigSlidingDat wut;
1180  wut.setSliding(sliding_);
1181  // Fill the dataset
1182  // the logic ids are ordered by SM (1,...36) , TT (1,...68) and strip (1..5)
1183  // you have to calculate the right index here
1184  dataset[my_StripEcalLogicId[ich]] = wut;
1185  }
1186 
1187  // endcap loop
1188  for (int ich=0; ich<(int)my_StripEcalLogicId1_EE.size() ; ich++){
1189  FEConfigSlidingDat wut;
1190  wut.setSliding(sliding_);
1191  // Fill the dataset
1192  // the logic ids are ordered by fed tower strip
1193  // you have to calculate the right index here
1194  dataset[my_StripEcalLogicId1_EE[ich]] = wut;
1195  }
1196  for (int ich=0; ich<(int)my_StripEcalLogicId2_EE.size() ; ich++){
1197  FEConfigSlidingDat wut;
1198  wut.setSliding(sliding_);
1199  // Fill the dataset
1200  // the logic ids are ordered by ... ?
1201  // you have to calculate the right index here
1202  dataset[my_StripEcalLogicId2_EE[ich]] = wut;
1203  }
1204 
1205 
1206  // Insert the dataset
1207  ostringstream wtag;
1208  wtag.str(""); wtag<<"Sliding_"<<sliding_;
1209  std::string justatag=wtag.str();
1210  std::cout<< " sliding tag "<<justatag<<std::endl;
1211  int iov_id=0; // just a parameter ...
1212  if(m_write_sli==1) sli_conf_id_=db_->writeToConfDB_TPGSliding(dataset,iov_id, justatag) ;
1213  }
1214 
1215 
1216 
1217 
1218 
1220  // Compute LUT section //
1222 
1223  int lut_EB[1024], lut_EE[1024] ;
1224 
1225  // barrel
1226  computeLUT(lut_EB, "EB") ;
1227  if (writeToFiles_) {
1228  (*out_file_) <<std::endl ;
1229  (*out_file_) <<"LUT 0"<<std::endl ;
1230  for (int i=0 ; i<1024 ; i++) (*out_file_)<<"0x"<<hex<<lut_EB[i]<<std::endl ;
1231  (*out_file_)<<std::endl ;
1232  }
1233 
1234  // endcap
1235  computeLUT(lut_EE, "EE") ;
1236  // check first if lut_EB and lut_EE are the same
1237  bool newLUT(false) ;
1238  for (int i=0 ; i<1024 ; i++) if (lut_EE[i] != lut_EB[i]) newLUT = true ;
1239  if (newLUT && writeToFiles_) {
1240  (*out_file_) <<std::endl ;
1241  (*out_file_) <<"LUT 1"<<std::endl ;
1242  for (int i=0 ; i<1024 ; i++) (*out_file_)<<"0x"<<hex<<lut_EE[i]<<std::endl ;
1243  (*out_file_)<<std::endl ;
1244  }
1245 
1246 
1247 
1248  if (writeToDB_) {
1249 
1250 
1251 
1252  std::map<EcalLogicID, FEConfigLUTGroupDat> dataset;
1253  // we create 1 LUT group
1254  int NLUTGROUPS =0;
1255  int ich=0;
1256  FEConfigLUTGroupDat lut;
1257  lut.setLUTGroupId(ich);
1258  for (int i=0; i<1024; i++){
1259  lut.setLUTValue(i, lut_EB[i] );
1260  }
1261  EcalLogicID ecid = EcalLogicID( "DUMMY", ich,ich);
1262  // Fill the dataset
1263  dataset[ecid] = lut; // we use any logic id but different, because it is in any case ignored...
1264 
1265  ich++;
1266 
1267  FEConfigLUTGroupDat lute;
1268  lute.setLUTGroupId(ich);
1269  for (int i=0; i<1024; i++){
1270  lute.setLUTValue(i, lut_EE[i] );
1271  }
1272  EcalLogicID ecide = EcalLogicID( "DUMMY", ich,ich);
1273  // Fill the dataset
1274  dataset[ecide] = lute; // we use any logic id but different, because it is in any case ignored...
1275 
1276  ich++;
1277 
1278  NLUTGROUPS=ich;
1279 
1280  // now we store in the DB the correspondence btw channels and LUT groups
1281  std::map<EcalLogicID, FEConfigLUTDat> dataset2;
1282  // in this case I decide in a stupid way which channel belongs to which group
1283  for (int ich=0; ich<(int)my_TTEcalLogicId.size() ; ich++){
1284  FEConfigLUTDat lut;
1285  int igroup=0;
1286  lut.setLUTGroupId(igroup);
1287  // calculate the right TT - in the vector they are ordered by SM and by TT
1288  // Fill the dataset
1289  dataset2[my_TTEcalLogicId[ich]] = lut;
1290  }
1291 
1292  // endcap loop
1293  for (int ich=0; ich<(int)my_TTEcalLogicId_EE.size() ; ich++){
1294  FEConfigLUTDat lut;
1295  int igroup=1;
1296  lut.setLUTGroupId(igroup);
1297  // calculate the right TT
1298  // Fill the dataset
1299  dataset2[my_TTEcalLogicId_EE[ich]] = lut;
1300  }
1301 
1302  // Insert the dataset
1303  ostringstream ltag;
1304  ltag.str(""); ltag<<LUT_option_<<"_NGroups_"<<NLUTGROUPS;
1305  std::string lut_tag=ltag.str();
1306  std::cout<< " LUT tag "<<lut_tag<<std::endl;
1307  if(m_write_lut==1) lut_conf_id_=db_->writeToConfDB_TPGLUT(dataset, dataset2,lutparamset, NLUTGROUPS, lut_tag) ;
1308 
1309  }
1310 
1311  // last we insert the FE_CONFIG_MAIN table
1312  if (writeToDB_) {
1313 
1316 
1317  std::cout << "\n Conf ID = " << conf_id_ << std::endl;
1318 
1319  }
1320 
1321 
1323  // loop on strips and associate them with values //
1325 
1326  // Barrel
1327  stripListEB.sort() ;
1328  stripListEB.unique() ;
1329  std::cout<<"Number of EB strips="<<dec<<stripListEB.size()<<std::endl ;
1330  if (writeToFiles_) {
1331  (*out_file_) <<std::endl ;
1332  for (itList = stripListEB.begin(); itList != stripListEB.end(); itList++ ) {
1333  (*out_file_) <<"STRIP_EB "<<dec<<(*itList)<<std::endl ;
1334  (*out_file_) << hex << "0x" <<sliding_<<std::endl ;
1335  (*out_file_) <<"0" <<std::endl ;
1336  (*out_file_) <<"0x"<<stripMapEBsintheta[(*itList)] << " 0x" << SFGVB_lut_ <<std::endl ;
1337  }
1338  }
1339 
1340  // Endcap
1341  stripListEE.sort() ;
1342  stripListEE.unique() ;
1343  std::cout<<"Number of EE strips="<<dec<<stripListEE.size()<<std::endl ;
1344  if (writeToFiles_) {
1345  (*out_file_) <<std::endl ;
1346  for (itList = stripListEE.begin(); itList != stripListEE.end(); itList++ ) {
1347  (*out_file_) <<"STRIP_EE "<<dec<<(*itList)<<std::endl ;
1348  (*out_file_) << hex << "0x" <<sliding_<<std::endl ;
1349  (*out_file_) <<" 0" << std::endl ;
1350  (*out_file_)<<hex<<"0x"<<threshold<<" 0x"<<lut_strip<<std::endl ;
1351  }
1352  }
1353 
1354 
1356  // loop on towers and associate them with default values //
1358 
1359  // Barrel
1360  towerListEB.sort() ;
1361  towerListEB.unique() ;
1362  std::cout<<"Number of EB towers="<<dec<<towerListEB.size()<<std::endl ;
1363  if (writeToFiles_) {
1364  (*out_file_) <<std::endl ;
1365  for (itList = towerListEB.begin(); itList != towerListEB.end(); itList++ ) {
1366  (*out_file_) <<"TOWER_EB "<<dec<<(*itList)<<std::endl ;
1367  (*out_file_) <<" 0\n 0\n" ;
1368  }
1369  }
1370 
1371  // Endcap
1372  towerListEE.sort() ;
1373  towerListEE.unique() ;
1374  std::cout<<"Number of EE towers="<<dec<<towerListEE.size()<<std::endl ;
1375  if (writeToFiles_) {
1376  (*out_file_) <<std::endl ;
1377  for (itList = towerListEE.begin(); itList != towerListEE.end(); itList++ ) {
1378  (*out_file_) <<"TOWER_EE "<<dec<<(*itList)<<std::endl ;
1379  if (newLUT) (*out_file_) <<" 1\n" ;
1380  else (*out_file_) <<" 0\n" ;
1381  (*out_file_)<<hex<<"0x"<<lut_tower<<std::endl ;
1382  }
1383  }
1384 
1385 
1386 
1387 
1389  // store control histos //
1391  ICEB->Write() ;
1392  tpgFactorEB->Write() ;
1393  ICEEPlus->Write() ;
1394  tpgFactorEEPlus->Write() ;
1395  ICEEMinus->Write() ;
1396  tpgFactorEEMinus->Write() ;
1397  IC->Write() ;
1398  tpgFactor->Write() ;
1399  hshapeEB->Write() ;
1400  hshapeEE->Write() ;
1401  ntuple->Write() ;
1402  ntupleSpike->Write() ;
1403  saving.Close () ;
1404 }
tuple base
Main Program
Definition: newFWLiteAna.py:92
int writeToConfDB_TPGLinearCoef(const std::map< EcalLogicID, FEConfigLinDat > &linset, const std::map< EcalLogicID, FEConfigLinParamDat > &linparamset, int iovId, std::string tag)
Definition: EcalTPGDBApp.cc:42
int i
Definition: DBlmapReader.cc:9
void setThreshLow(float x)
edm::ESHandle< EcalTrigTowerConstituentsMap > eTTmap_
int xtalId() const
get the channel id
int stripId() const
get the tower id
void setFGhighratio(float x)
const self & getMap() const
void setShift12(int x)
Ecal readout channel identification [32:20] Unused (so far) [19:13] DCC id [12:6] tower [5:3] strip [...
std::pair< std::string, int > getCrate(int tcc)
int getGCTRegionPhi(int ttphi)
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
double gainRatio_[3]
Geom::Phi< T > phi() const
Definition: PV3DBase.h:63
void setMultX1(int x)
std::string getDet(int tcc)
Geom::Theta< T > theta() const
#define abs(x)
Definition: mlp_lapack.h:159
void setFGlowthresh(float x)
int towerId() const
get the tower id
void setRatioHigh(float x)
int iTT(const EcalTrigTowerDetId &id) const
returns the index of a Trigger Tower within its TCC.
int writeToConfDB_TPGSliding(const std::map< EcalLogicID, FEConfigSlidingDat > &sliset, int iovId, std::string tag)
const CaloSubdetectorGeometry * theEndcapGeometry_
void setShift6(int x)
std::ofstream * out_file_
void computeFineGrainEBParameters(unsigned int &lowRatio, unsigned int &highRatio, unsigned int &lowThreshold, unsigned int &highThreshold, unsigned int &lut)
int writeToConfDB_TPGMain(int ped, int lin, int lut, int fgr, int sli, int wei, int bxt, int btt, std::string tag, int ver)
Definition: EcalTPGDBApp.cc:68
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e g
Definition: Activities.doc:4
double double double z
int channelId() const
get the channel id
int ieta() const
get the tower ieta
void setPedMeanG6(float mean)
int zside() const
get the z-side of the tower (1/-1)
virtual const std::vector< DetId > & getValidDetIds(DetId::Detector det=DetId::Detector(0), int subdet=0) const
Get a list of valid detector ids (for the given subdetector)
void getCoeff(coeffStruc &coeff, const EcalIntercalibConstantMap &calibMap, unsigned int rawId)
virtual const CaloCellGeometry * getGeometry(const DetId &id) const
Get the cell geometry of a given detector id. Should return false if not found.
std::vector< EcalLogicID > getEcalLogicIDSetOrdered(std::string name, int fromId1, int toId1, int fromId2=EcalLogicID::NULLID, int toId2=EcalLogicID::NULLID, int fromId3=EcalLogicID::NULLID, int toId3=EcalLogicID::NULLID, std::string mapsTo="", int orderedBy=EcalLogicID::NULLID)
Geom::Theta< T > theta() const
Definition: PV3DBase.h:69
void setShift1(int x)
uint32_t rawId() const
get the raw id
Definition: DetId.h:45
U second(std::pair< T, U > const &p)
int TCCid(const EBDetId &id) const
returns the TCCid of an EBDetId
std::vector< unsigned int > computeWeights(EcalShapeBase &shape, TH1F *histo)
int hashedIndex(int ieta, int iphi)
Definition: EcalPyUtils.cc:42
EcalElectronicsId getElectronicsId(const DetId &id) const
Get the electronics id for this det id.
void setThreshold(unsigned int mean)
void setPedMeanG1(float mean)
void setThreshHigh(float x)
EcalPedestalsMap::const_iterator EcalPedestalsMapIterator
Definition: EcalPedestals.h:37
void setLutFgr(unsigned int mean)
int ietaAbs() const
get the absolute value of the tower ieta
const EcalElectronicsMapping * theMapping_
void computeLUT(int *lut, std::string det="EB")
void setLUTValue(int i, int x)
int getLinId() const
EcalLogicID getEcalLogicID(std::string name, int id1=EcalLogicID::NULLID, int id2=EcalLogicID::NULLID, int id3=EcalLogicID::NULLID, std::string mapsTo="")
int j
Definition: DBlmapReader.cc:9
EcalTriggerElectronicsId getTriggerElectronicsId(const DetId &id) const
Get the trigger electronics id for this det id.
int getWeiId() const
int getID1() const
Definition: EcalLogicID.cc:47
shaper for Ecal
void computeFineGrainEEParameters(unsigned int &threshold, unsigned int &lut_strip, unsigned int &lut_tower)
float gain6Over1() const
void setLUTGroupId(int x)
bool first
Definition: L1TdeRCT.cc:79
int pseudoStripId() const
get the tower id
int dccId() const
get the DCC (Ecal Local DCC value not global one) id
void setFgrGroupId(int x)
Definition: EBShape.h:6
int k[5][pyjets_maxn]
tuple out
Definition: dbtoconf.py:99
bool realignBaseline(linStruc &lin, float forceBase12)
bool computeLinearizerParam(double theta, double gainRatio, double calibCoeff, std::string subdet, int &mult, int &shift)
int iphi() const
get the tower iphi
const CaloSubdetectorGeometry * theBarrelGeometry_
int getFgrId() const
int writeToConfDB_TPGPedestals(const std::map< EcalLogicID, FEConfigPedDat > &pedset, int iovId, std::string tag)
Definition: EcalTPGDBApp.cc:17
void setPedMeanG12(float mean)
int getBttId() const
void setMultX6(int x)
const T & get() const
Definition: EventSetup.h:55
std::vector< Item >::const_iterator const_iterator
int DCCid(const EBDetId &id) const
returns the DCC of an EBDetId
float gain12Over6() const
T eta() const
Definition: PV3DBase.h:70
int getPedId() const
EcalSubdetector subDet() const
get the subDetector associated to the Trigger Tower
void setConfigTag(std::string x)
Definition: IODConfig.h:31
void setFGlowratio(float x)
void setSliding(float mean)
static const int NULLID
Definition: EcalLogicID.h:43
int getBxtId() const
void setTTThreshhigh(float x)
int writeToConfDB_TPGLUT(const std::map< EcalLogicID, FEConfigLUTGroupDat > &lutgroup, const std::map< EcalLogicID, FEConfigLUTDat > &lutdat, const std::map< EcalLogicID, FEConfigLUTParamDat > &lutparamset, int iovId, std::string tag)
void setMultX12(int x)
static unsigned int const shift
tuple cout
Definition: gather_cfg.py:41
int writeToConfDB_TPGFgr(const std::map< EcalLogicID, FEConfigFgrGroupDat > &lutgroup, const std::map< EcalLogicID, FEConfigFgrDat > &lutdat, const std::map< EcalLogicID, FEConfigFgrParamDat > &fgrparamset, const std::map< EcalLogicID, FEConfigFgrEETowerDat > &dataset3, const std::map< EcalLogicID, FEConfigFgrEEStripDat > &dataset4, int iovId, std::string tag)
int getLUTId() const
int writeToConfDB_TPGWeight(const std::map< EcalLogicID, FEConfigWeightGroupDat > &lutgroup, const std::map< EcalLogicID, FEConfigWeightDat > &lutdat, int iovId, std::string tag)
int getGCTRegionEta(int tteta)
int getID3() const
Definition: EcalLogicID.cc:57
Definition: DDAxes.h:10
void setTTThreshlow(float x)
void setWeightGroupId(int x)
const GlobalPoint & getPosition() const
Ecal trigger electronics identification [32:20] Unused (so far) [19:13] TCC id [12:6] TT id [5:3] pse...
void setFGhighthresh(float x)
tuple size
Write out results.
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
int getSliId() const
Definition: EEShape.h:6
void EcalTPGParamBuilder::beginJob ( void  )
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 1406 of file EcalTPGParamBuilder.cc.

References gather_cfg::cout, create_header(), DetId::Ecal, EcalBarrel, EcalEndcap, Et_sat_EB_, Et_sat_EE_, FG_highRatio_EB_, FG_highThreshold_EB_, FG_lowRatio_EB_, FG_lowThreshold_EB_, FG_Threshold_EE_, DetId::rawId(), TTF_highThreshold_EB_, TTF_highThreshold_EE_, TTF_lowThreshold_EB_, TTF_lowThreshold_EE_, and writeToFiles_.

1407 {
1408  using namespace edm;
1409  using namespace std;
1410 
1411  std::cout<<"we are in beginJob"<<std::endl;
1412 
1413  create_header() ;
1414 
1417 
1418  if (writeToFiles_) {
1419  (*out_file_)<<"PHYSICS_EB "<<dec<<eb.rawId()<<std::endl ;
1420  (*out_file_)<<Et_sat_EB_<<" "<<TTF_lowThreshold_EB_<<" "<<TTF_highThreshold_EB_<<std::endl ;
1421  (*out_file_)<<FG_lowThreshold_EB_<<" "<<FG_highThreshold_EB_<<" "
1422  <<FG_lowRatio_EB_<<" "<<FG_highRatio_EB_<<std::endl ;
1423  (*out_file_) <<std::endl ;
1424 
1425  (*out_file_)<<"PHYSICS_EE "<<dec<<ee.rawId()<<std::endl ;
1426  (*out_file_)<<Et_sat_EE_<<" "<<TTF_lowThreshold_EE_<<" "<<TTF_highThreshold_EE_<<std::endl ;
1427  (*out_file_)<<FG_Threshold_EE_<<" "<<-1<<" "
1428  <<-1<<" "<<-1<<std::endl ;
1429  (*out_file_) <<std::endl ;
1430  }
1431 
1432 }
Definition: DetId.h:20
tuple cout
Definition: gather_cfg.py:41
bool EcalTPGParamBuilder::checkIfOK ( EcalPedestals::Item  item)

Definition at line 168 of file EcalTPGParamBuilder.cc.

References query::result.

169 {
170  bool result=true;
171  if( item.mean_x1 <150. || item.mean_x1 >250) result=false;
172  if( item.mean_x6 <150. || item.mean_x6 >250) result=false;
173  if( item.mean_x12 <150. || item.mean_x12 >250) result=false;
174  if( item.rms_x1 <0 || item.rms_x1 > 2) result=false;
175  if( item.rms_x6 <0 || item.rms_x6 > 3) result=false;
176  if( item.rms_x12 <0 || item.rms_x12 > 5) result=false;
177  return result;
178 }
tuple result
Definition: query.py:137
void EcalTPGParamBuilder::computeFineGrainEBParameters ( unsigned int &  lowRatio,
unsigned int &  highRatio,
unsigned int &  lowThreshold,
unsigned int &  highThreshold,
unsigned int &  lut 
)
private

Definition at line 1839 of file EcalTPGParamBuilder.cc.

References Et_sat_EB_, FG_highRatio_EB_, FG_highThreshold_EB_, FG_lowRatio_EB_, FG_lowThreshold_EB_, and FG_lut_EB_.

Referenced by analyze().

1841 {
1842  lowRatio = int(0x80*FG_lowRatio_EB_ + 0.5) ;
1843  if (lowRatio>0x7f) lowRatio = 0x7f ;
1844  highRatio = int(0x80*FG_highRatio_EB_ + 0.5) ;
1845  if (highRatio>0x7f) highRatio = 0x7f ;
1846 
1847  // lsb at the stage of the FG calculation is:
1848  double lsb_FG = Et_sat_EB_/1024./4 ;
1849  lowThreshold = int(FG_lowThreshold_EB_/lsb_FG+0.5) ;
1850  if (lowThreshold>0xff) lowThreshold = 0xff ;
1851  highThreshold = int(FG_highThreshold_EB_/lsb_FG+0.5) ;
1852  if (highThreshold>0xff) highThreshold = 0xff ;
1853 
1854  // FG lut: FGVB response is LUT(adress) where adress is:
1855  // bit3: maxof2/ET >= lowRatio, bit2: maxof2/ET >= highRatio, bit1: ET >= lowThreshold, bit0: ET >= highThreshold
1856  // FGVB =1 if jet-like (veto active), =0 if E.M.-like
1857  // the condition for jet-like is: ET>Threshold and maxof2/ET < Ratio (only TT with enough energy are vetoed)
1858 
1859  // With the following lut, what matters is only max(TLow, Thigh) and max(Elow, Ehigh)
1860  // So, jet-like if maxof2/ettot<max(TLow, Thigh) && ettot >= max(Elow, Ehigh)
1861  if (FG_lut_EB_ == 0) lut = 0x0888 ;
1862  else lut = FG_lut_EB_ ; // let's use the users value (hope he/she knows what he/she does!)
1863 }
void EcalTPGParamBuilder::computeFineGrainEEParameters ( unsigned int &  threshold,
unsigned int &  lut_strip,
unsigned int &  lut_tower 
)
private

Definition at line 1865 of file EcalTPGParamBuilder.cc.

References Et_sat_EE_, FG_lut_strip_EE_, FG_lut_tower_EE_, and FG_Threshold_EE_.

Referenced by analyze().

1866 {
1867  // lsb for EE:
1868  double lsb_FG = Et_sat_EE_/1024. ; // FIXME is it true????
1869  threshold = int(FG_Threshold_EE_/lsb_FG+0.5) ;
1870  lut_strip = FG_lut_strip_EE_ ;
1871  lut_tower = FG_lut_tower_EE_ ;
1872 }
bool EcalTPGParamBuilder::computeLinearizerParam ( double  theta,
double  gainRatio,
double  calibCoeff,
std::string  subdet,
int &  mult,
int &  shift 
)
private

Definition at line 1436 of file EcalTPGParamBuilder.cc.

References gather_cfg::cout, Et_sat_EB_, Et_sat_EE_, funct::false, funct::sin(), sliding_, funct::true, xtal_LSB_EB_, and xtal_LSB_EE_.

Referenced by analyze().

1437 {
1438  /*
1439  Linearization coefficient are determined in order to satisfy:
1440  tpg(ADC_sat) = 1024
1441  where:
1442  tpg() is a model of the linearized tpg response on 10b
1443  ADC_sat is the number of ADC count corresponding the Et_sat, the maximum scale of the transverse energy
1444 
1445  Since we have:
1446  Et_sat = xtal_LSB * ADC_sat * gainRatio * calibCoeff * sin(theta)
1447  and a simple model of tpg() being given by:
1448  tpg(X) = [ (X*mult) >> (shift+2) ] >> (sliding+shiftDet)
1449  we must satisfy:
1450  [ (Et_sat/(xtal_LSB * gainRatio * calibCoeff * sin(theta)) * mult) >> (shift+2) ] >> (sliding+shiftDet) = 1024
1451  that is:
1452  mult = 1024/Et_sat * xtal_LSB * gainRatio * calibCoeff * sin(theta) * 2^-(sliding+shiftDet+2) * 2^-shift
1453  mult = factor * 2^-shift
1454  */
1455 
1456  // case barrel:
1457  int shiftDet = 2 ; //fixed, due to FE FENIX TCP format
1458  double ratio = xtal_LSB_EB_/Et_sat_EB_ ;
1459  // case endcap:
1460  if (subdet=="EE") {
1461  shiftDet = 2 ; //applied in TCC-EE and not in FE FENIX TCP... This parameters is setable in the TCC-EE
1462  //shiftDet = 0 ; //was like this before with FE bug
1463  ratio = xtal_LSB_EE_/Et_sat_EE_ ;
1464  }
1465 
1466 
1467 
1468  double factor = 1024 * ratio * gainRatio * calibCoeff * sin(theta) * (1 << (sliding_ + shiftDet + 2)) ;
1469  // Let's try first with shift = 0 (trivial solution)
1470  mult = (int)(factor+0.5) ;
1471  for (shift = 0 ; shift<15 ; shift++) {
1472  if (mult>=128 && mult<256) return true ;
1473  factor *= 2 ;
1474  mult = (int)(factor+0.5) ;
1475  }
1476  std::cout << "too bad we did not manage to calculate the factor for calib="<<calibCoeff<<std::endl;
1477  return false ;
1478 }
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Geom::Theta< T > theta() const
static unsigned int const shift
tuple cout
Definition: gather_cfg.py:41
void EcalTPGParamBuilder::computeLUT ( int *  lut,
std::string  det = "EB" 
)
private

Definition at line 1714 of file EcalTPGParamBuilder.cc.

References Et_sat_EB_, Et_sat_EE_, i, j, LUT_constant_EB_, LUT_constant_EE_, LUT_noise_EB_, LUT_noise_EE_, LUT_option_, LUT_stochastic_EB_, LUT_stochastic_EE_, LUT_threshold_EB_, LUT_threshold_EE_, lumiNorm::norm, oneOverEtResolEt(), TTF_highThreshold_EB_, TTF_highThreshold_EE_, TTF_lowThreshold_EB_, and TTF_lowThreshold_EE_.

Referenced by analyze().

1715 {
1716  double Et_sat = Et_sat_EB_ ;
1717  double LUT_threshold = LUT_threshold_EB_ ;
1718  double LUT_stochastic = LUT_stochastic_EB_ ;
1719  double LUT_noise = LUT_noise_EB_ ;
1720  double LUT_constant = LUT_constant_EB_ ;
1721  double TTF_lowThreshold = TTF_lowThreshold_EB_ ;
1722  double TTF_highThreshold = TTF_highThreshold_EB_ ;
1723  if (det == "EE") {
1724  Et_sat = Et_sat_EE_ ;
1725  LUT_threshold = LUT_threshold_EE_ ;
1726  LUT_stochastic = LUT_stochastic_EE_ ;
1727  LUT_noise = LUT_noise_EE_ ;
1728  LUT_constant = LUT_constant_EE_ ;
1729  TTF_lowThreshold = TTF_lowThreshold_EE_ ;
1730  TTF_highThreshold = TTF_highThreshold_EE_ ;
1731  }
1732 
1733  // initialisation with identity
1734  for (int i=0 ; i<1024 ; i++) {
1735  lut[i] = i ;
1736  if (lut[i]>0xff) lut[i] = 0xff ;
1737  }
1738 
1739  // case linear LUT
1740  if (LUT_option_ == "Linear") {
1741  int mylut = 0 ;
1742  for (int i=0 ; i<1024 ; i++) {
1743  lut[i] = mylut ;
1744  if ((i+1)%4 == 0 ) mylut++ ;
1745  }
1746  }
1747 
1748  // case LUT following Ecal resolution
1749  if (LUT_option_ == "EcalResolution") {
1750  TF1 * func = new TF1("func",oneOverEtResolEt, 0., Et_sat,3) ;
1751  func->SetParameters(LUT_stochastic, LUT_noise, LUT_constant) ;
1752  double norm = func->Integral(0., Et_sat) ;
1753  for (int i=0 ; i<1024 ; i++) {
1754  double Et = i*Et_sat/1024. ;
1755  lut[i] = int(0xff*func->Integral(0., Et)/norm + 0.5) ;
1756  }
1757  }
1758 
1759  // Now, add TTF thresholds to LUT and apply LUT threshold if needed
1760  for (int j=0 ; j<1024 ; j++) {
1761  double Et_GeV = Et_sat/1024*(j+0.5) ;
1762  if (Et_GeV <= LUT_threshold) lut[j] = 0 ; // LUT threshold
1763  int ttf = 0x0 ;
1764  if (Et_GeV >= TTF_highThreshold) ttf = 3 ;
1765  if (Et_GeV >= TTF_lowThreshold && Et_GeV < TTF_highThreshold) ttf = 1 ;
1766  ttf = ttf << 8 ;
1767  lut[j] += ttf ;
1768  }
1769 
1770 }
int i
Definition: DBlmapReader.cc:9
double oneOverEtResolEt(double *x, double *par)
tuple norm
Definition: lumiNorm.py:78
int j
Definition: DBlmapReader.cc:9
std::vector< unsigned int > EcalTPGParamBuilder::computeWeights ( EcalShapeBase shape,
TH1F *  histo 
)
private

Definition at line 1591 of file EcalTPGParamBuilder.cc.

References complement2_, prof2calltree::count, gather_cfg::cout, getHLTprescales::index, max(), min, nSample_, funct::pow(), sampleMax_, cond::rpcobgas::time, uncodeWeight(), CommonMethods::weight(), weight_timeShift_, and weight_unbias_recovery_.

Referenced by analyze().

1595 {
1596  std::cout<<"Computing Weights..."<<std::endl ;
1597 #if (CMSSW_VERSION>=340)
1598  double timeMax = shape.timeOfMax() - shape.timeOfThr() ; // timeMax w.r.t begining of pulse
1599 #else
1600  double timeMax = shape.computeTimeOfMaximum() - shape.computeT0() ; // timeMax w.r.t begining of pulse
1601 #endif
1602  double max = shape(timeMax) ;
1603 
1604  double sumf = 0. ;
1605  double sumf2 = 0. ;
1606  for (unsigned int sample = 0 ; sample<nSample_ ; sample++) {
1607  double time = timeMax - ((double)sampleMax_-(double)sample)*25. ;
1608  time -= weight_timeShift_ ;
1609  sumf += shape(time)/max ;
1610  sumf2 += shape(time)/max * shape(time)/max ;
1611  for (int subtime = 0 ; subtime<25 ; subtime++) histo->Fill(float(sample*25. + subtime)/25., shape(time+subtime)) ;
1612  }
1613  double lambda = 1./(sumf2-sumf*sumf/nSample_) ;
1614  double gamma = -lambda*sumf/nSample_ ;
1615  double * weight = new double[nSample_] ;
1616  for (unsigned int sample = 0 ; sample<nSample_ ; sample++) {
1617  double time = timeMax - ((double)sampleMax_-(double)sample)*25. ;
1618  time -= weight_timeShift_ ;
1619  weight[sample] = lambda*shape(time)/max + gamma ;
1620  }
1621 
1622 
1623  int * iweight = new int[nSample_] ;
1624  for (unsigned int sample = 0 ; sample<nSample_ ; sample++) iweight[sample] = uncodeWeight(weight[sample], complement2_) ;
1625 
1626  // Let's check:
1627  int isumw = 0 ;
1628  for (unsigned int sample = 0 ; sample<nSample_ ; sample++) isumw += iweight[sample] ;
1629  unsigned int imax = (unsigned int)(pow(2.,int(complement2_))-1) ;
1630  isumw = (isumw & imax ) ;
1631 
1632  double ampl = 0. ;
1633  double sumw = 0. ;
1634  for (unsigned int sample = 0 ; sample<nSample_ ; sample++) {
1635  double time = timeMax - ((double)sampleMax_-(double)sample)*25. ;
1636  time -= weight_timeShift_ ;
1637  ampl += weight[sample]*shape(time) ;
1638  sumw += weight[sample] ;
1639  std::cout<<"weight="<<weight[sample]<<" shape="<<shape(time)<<std::endl ;
1640  }
1641  std::cout<<"Weights: sum="<<isumw<<" in float ="<<uncodeWeight(isumw, complement2_)<<" sum of floats ="<<sumw<<std::endl ;
1642  std::cout<<"Weights: sum (weight*shape) = "<<ampl<<std::endl ;
1643 
1644 
1645 
1646  // Let's correct for bias if any
1648  int count = 0 ;
1649  while (isumw != 0 && count<10) {
1650  double min = 99. ;
1651  unsigned int index = 0 ;
1652  if ( (isumw & (1<<(complement2_-1))) != 0) {
1653  // add 1:
1654  std::cout<<"Correcting for bias: adding 1"<<std::endl ;
1655  for (unsigned int sample = 0 ; sample<nSample_ ; sample++) {
1656  int new_iweight = iweight[sample]+1 ;
1657  double new_weight = uncodeWeight(new_iweight, complement2_) ;
1658  if (fabs(new_weight-weight[sample])<min) {
1659  min = fabs(new_weight-weight[sample]) ;
1660  index = sample ;
1661  }
1662  }
1663  iweight[index] ++ ;
1664  } else {
1665  // Sub 1:
1666  std::cout<<"Correcting for bias: subtracting 1"<<std::endl ;
1667  for (unsigned int sample = 0 ; sample<nSample_ ; sample++) {
1668  int new_iweight = iweight[sample]-1 ;
1669  double new_weight = uncodeWeight(new_iweight, complement2_) ;
1670  if (fabs(new_weight-weight[sample])<min) {
1671  min = fabs(new_weight-weight[sample]) ;
1672  index = sample ;
1673  }
1674  }
1675  iweight[index] -- ;
1676  }
1677  isumw = 0 ;
1678  for (unsigned int sample = 0 ; sample<nSample_ ; sample++) isumw += iweight[sample] ;
1679  imax = (unsigned int)(pow(2.,int(complement2_))-1) ;
1680  isumw = (isumw & imax ) ;
1681  std::cout<<"Correcting weight number: "<<index<<" sum weights = "<<isumw<<std::endl ;
1682  count ++ ;
1683  }
1684  }
1685 
1686  // let's check again
1687  isumw = 0 ;
1688  for (unsigned int sample = 0 ; sample<nSample_ ; sample++) isumw += iweight[sample] ;
1689  imax = (unsigned int)(pow(2.,int(complement2_))-1) ;
1690  isumw = (isumw & imax ) ;
1691  ampl = 0. ;
1692  for (unsigned int sample = 0 ; sample<nSample_ ; sample++) {
1693  double time = timeMax - ((double)sampleMax_-(double)sample)*25. ;
1694  time -= weight_timeShift_ ;
1695  double new_weight = uncodeWeight(iweight[sample], complement2_) ;
1696  sumw += uncodeWeight(iweight[sample], complement2_) ;
1697  ampl += new_weight*shape(time) ;
1698  std::cout<<"weight unbiased after integer conversion="<<new_weight<<" shape="<<shape(time)<<std::endl ;
1699  }
1700  std::cout<<"Weights: sum="<<isumw<<" in float ="<<uncodeWeight(isumw, complement2_)<<" sum of floats ="<<sumw<<std::endl ;
1701  std::cout<<"Weights: sum (weight*shape) = "<<ampl<<std::endl ;
1702 
1703 
1704 
1705  std::vector<unsigned int> theWeights ;
1706  for (unsigned int sample = 0 ; sample<nSample_ ; sample++) theWeights.push_back(iweight[sample]) ;
1707  std::cout<<std::endl ;
1708 
1709  delete weight ;
1710  delete iweight ;
1711  return theWeights ;
1712 }
long int integer
Definition: mlp_lapack.h:12
#define min(a, b)
Definition: mlp_lapack.h:161
tuple histo
Definition: trackerHits.py:12
return((rh^lh)&mask)
const T & max(const T &a, const T &b)
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
void conversion(EventAux const &from, EventAuxiliary &to)
Definition: EventAux.cc:9
double timeOfThr() const
perl if(1 lt scalar(@::datatypes))
Definition: edlooper.cc:31
tuple cout
Definition: gather_cfg.py:41
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
int uncodeWeight(double weight, int complement2=7)
double timeOfMax() const
void EcalTPGParamBuilder::create_header ( )
private

Definition at line 1480 of file EcalTPGParamBuilder.cc.

References mathSSE::return(), and writeToFiles_.

Referenced by beginJob().

1481 {
1482  if (!writeToFiles_) return ;
1483  (*out_file_) <<"COMMENT put your comments here"<<std::endl ;
1484 
1485  (*out_file_) <<"COMMENT ================================="<<std::endl ;
1486  (*out_file_) <<"COMMENT physics EB structure"<<std::endl ;
1487  (*out_file_) <<"COMMENT"<<std::endl ;
1488  (*out_file_) <<"COMMENT EtSaturation (GeV), ttf_threshold_Low (GeV), ttf_threshold_High (GeV)"<<std::endl ;
1489  (*out_file_) <<"COMMENT FG_lowThreshold (GeV), FG_highThreshold (GeV), FG_lowRatio, FG_highRatio"<<std::endl ;
1490  (*out_file_) <<"COMMENT ================================="<<std::endl ;
1491  (*out_file_) <<"COMMENT"<<std::endl ;
1492 
1493  (*out_file_) <<"COMMENT ================================="<<std::endl ;
1494  (*out_file_) <<"COMMENT physics EE structure"<<std::endl ;
1495  (*out_file_) <<"COMMENT"<<std::endl ;
1496  (*out_file_) <<"COMMENT EtSaturation (GeV), ttf_threshold_Low (GeV), ttf_threshold_High (GeV)"<<std::endl ;
1497  (*out_file_) <<"COMMENT FG_Threshold (GeV), dummy, dummy, dummy"<<std::endl ;
1498  (*out_file_) <<"COMMENT ================================="<<std::endl ;
1499  (*out_file_) <<"COMMENT"<<std::endl ;
1500 
1501  (*out_file_) <<"COMMENT ================================="<<std::endl ;
1502  (*out_file_) <<"COMMENT crystal structure (same for EB and EE)"<<std::endl ;
1503  (*out_file_) <<"COMMENT"<<std::endl ;
1504  (*out_file_) <<"COMMENT ped, mult, shift [gain12]"<<std::endl ;
1505  (*out_file_) <<"COMMENT ped, mult, shift [gain6]"<<std::endl ;
1506  (*out_file_) <<"COMMENT ped, mult, shift [gain1]"<<std::endl ;
1507  (*out_file_) <<"COMMENT ================================="<<std::endl ;
1508  (*out_file_) <<"COMMENT"<<std::endl ;
1509 
1510  (*out_file_) <<"COMMENT ================================="<<std::endl ;
1511  (*out_file_) <<"COMMENT strip EB structure"<<std::endl ;
1512  (*out_file_) <<"COMMENT"<<std::endl ;
1513  (*out_file_) <<"COMMENT sliding_window"<<std::endl ;
1514  (*out_file_) <<"COMMENT weightGroupId"<<std::endl ;
1515  (*out_file_) <<"COMMENT threshold_sfg lut_sfg"<<std::endl ;
1516  (*out_file_) <<"COMMENT ================================="<<std::endl ;
1517  (*out_file_) <<"COMMENT"<<std::endl ;
1518 
1519  (*out_file_) <<"COMMENT ================================="<<std::endl ;
1520  (*out_file_) <<"COMMENT strip EE structure"<<std::endl ;
1521  (*out_file_) <<"COMMENT"<<std::endl ;
1522  (*out_file_) <<"COMMENT sliding_window"<<std::endl ;
1523  (*out_file_) <<"COMMENT weightGroupId"<<std::endl ;
1524  (*out_file_) <<"COMMENT threshold_fg lut_fg"<<std::endl ;
1525  (*out_file_) <<"COMMENT ================================="<<std::endl ;
1526  (*out_file_) <<"COMMENT"<<std::endl ;
1527 
1528  (*out_file_) <<"COMMENT ================================="<<std::endl ;
1529  (*out_file_) <<"COMMENT tower EB structure"<<std::endl ;
1530  (*out_file_) <<"COMMENT"<<std::endl ;
1531  (*out_file_) <<"COMMENT LUTGroupId"<<std::endl ;
1532  (*out_file_) <<"COMMENT FgGroupId"<<std::endl ;
1533  (*out_file_) <<"COMMENT ================================="<<std::endl ;
1534  (*out_file_) <<"COMMENT"<<std::endl ;
1535 
1536  (*out_file_) <<"COMMENT ================================="<<std::endl ;
1537  (*out_file_) <<"COMMENT tower EE structure"<<std::endl ;
1538  (*out_file_) <<"COMMENT"<<std::endl ;
1539  (*out_file_) <<"COMMENT LUTGroupId"<<std::endl ;
1540  (*out_file_) <<"COMMENT tower_lut_fg"<<std::endl ;
1541  (*out_file_) <<"COMMENT ================================="<<std::endl ;
1542  (*out_file_) <<"COMMENT"<<std::endl ;
1543 
1544  (*out_file_) <<"COMMENT ================================="<<std::endl ;
1545  (*out_file_) <<"COMMENT Weight structure"<<std::endl ;
1546  (*out_file_) <<"COMMENT"<<std::endl ;
1547  (*out_file_) <<"COMMENT weightGroupId"<<std::endl ;
1548  (*out_file_) <<"COMMENT w0, w1, w2, w3, w4"<<std::endl ;
1549  (*out_file_) <<"COMMENT ================================="<<std::endl ;
1550  (*out_file_) <<"COMMENT"<<std::endl ;
1551 
1552  (*out_file_) <<"COMMENT ================================="<<std::endl ;
1553  (*out_file_) <<"COMMENT lut structure"<<std::endl ;
1554  (*out_file_) <<"COMMENT"<<std::endl ;
1555  (*out_file_) <<"COMMENT LUTGroupId"<<std::endl ;
1556  (*out_file_) <<"COMMENT LUT[1-1024]"<<std::endl ;
1557  (*out_file_) <<"COMMENT ================================="<<std::endl ;
1558  (*out_file_) <<"COMMENT"<<std::endl ;
1559 
1560  (*out_file_) <<"COMMENT ================================="<<std::endl ;
1561  (*out_file_) <<"COMMENT fg EB structure"<<std::endl ;
1562  (*out_file_) <<"COMMENT"<<std::endl ;
1563  (*out_file_) <<"COMMENT FgGroupId"<<std::endl ;
1564  (*out_file_) <<"COMMENT el, eh, tl, th, lut_fg"<<std::endl ;
1565  (*out_file_) <<"COMMENT ================================="<<std::endl ;
1566  (*out_file_) <<"COMMENT"<<std::endl ;
1567 
1568  (*out_file_) <<std::endl ;
1569 }
return((rh^lh)&mask)
void EcalTPGParamBuilder::getCoeff ( coeffStruc coeff,
const EcalIntercalibConstantMap calibMap,
unsigned int  rawId 
)
private

Definition at line 1772 of file EcalTPGParamBuilder.cc.

References coeffStruc::calibCoeff_, gather_cfg::cout, EcalCondObjectContainer< T >::end(), EcalCondObjectContainer< T >::find(), mathSSE::return(), and useInterCalibration_.

Referenced by analyze().

1773 {
1774  // get current intercalibration coeff
1775  coeff.calibCoeff_ = 1. ;
1777  EcalIntercalibConstantMap::const_iterator icalit = calibMap.find(rawId);
1778  if( icalit != calibMap.end() ) coeff.calibCoeff_ = (*icalit) ;
1779  else std::cout<<"getCoeff: "<<rawId<<" not found in EcalIntercalibConstantMap"<<std::endl ;
1780 }
return((rh^lh)&mask)
std::vector< Item >::const_iterator const_iterator
const_iterator find(uint32_t rawId) const
tuple cout
Definition: gather_cfg.py:41
const_iterator end() const
void EcalTPGParamBuilder::getCoeff ( coeffStruc coeff,
const EcalGainRatioMap gainMap,
unsigned int  rawId 
)
private

Definition at line 1782 of file EcalTPGParamBuilder.cc.

References gather_cfg::cout, EcalCondObjectContainer< T >::end(), EcalCondObjectContainer< T >::find(), EcalMGPAGainRatio::gain12Over6(), EcalMGPAGainRatio::gain6Over1(), and coeffStruc::gainRatio_.

1783 {
1784  // get current gain ratio
1785  coeff.gainRatio_[0] = 1. ;
1786  coeff.gainRatio_[1] = 2. ;
1787  coeff.gainRatio_[2] = 12. ;
1788  EcalGainRatioMap::const_iterator gainIter = gainMap.find(rawId);
1789  if (gainIter != gainMap.end()) {
1790  const EcalMGPAGainRatio & aGain = (*gainIter) ;
1791  coeff.gainRatio_[1] = aGain.gain12Over6() ;
1792  coeff.gainRatio_[2] = aGain.gain6Over1() * aGain.gain12Over6() ;
1793  }
1794  else std::cout<<"getCoeff: "<<rawId<<" not found in EcalGainRatioMap"<<std::endl ;
1795 }
double gainRatio_[3]
float gain6Over1() const
std::vector< Item >::const_iterator const_iterator
float gain12Over6() const
const_iterator find(uint32_t rawId) const
tuple cout
Definition: gather_cfg.py:41
const_iterator end() const
void EcalTPGParamBuilder::getCoeff ( coeffStruc coeff,
const EcalPedestalsMap pedMap,
unsigned int  rawId 
)
private

Definition at line 1797 of file EcalTPGParamBuilder.cc.

References gather_cfg::cout, EcalCondObjectContainer< T >::end(), EcalCondObjectContainer< T >::find(), forcedPedestalValue_, coeffStruc::pedestals_, and mathSSE::return().

1798 {
1799  coeff.pedestals_[0] = 0 ;
1800  coeff.pedestals_[1] = 0 ;
1801  coeff.pedestals_[2] = 0 ;
1802 
1803  if (forcedPedestalValue_ >= 0) {
1804  coeff.pedestals_[0] = forcedPedestalValue_ ;
1805  coeff.pedestals_[1] = forcedPedestalValue_ ;
1806  coeff.pedestals_[2] = forcedPedestalValue_ ;
1807  return ;
1808  }
1809 
1810  // get current pedestal
1811  EcalPedestalsMapIterator pedIter = pedMap.find(rawId);
1812  if (pedIter != pedMap.end()) {
1813  EcalPedestals::Item aped = (*pedIter);
1814  coeff.pedestals_[0] = int(aped.mean_x12 + 0.5) ;
1815  coeff.pedestals_[1] = int(aped.mean_x6 + 0.5) ;
1816  coeff.pedestals_[2] = int(aped.mean_x1 + 0.5) ;
1817  }
1818  else std::cout<<"getCoeff: "<<rawId<<" not found in EcalPedestalsMap"<<std::endl ;
1819 }
return((rh^lh)&mask)
EcalPedestalsMap::const_iterator EcalPedestalsMapIterator
Definition: EcalPedestals.h:37
const_iterator find(uint32_t rawId) const
tuple cout
Definition: gather_cfg.py:41
const_iterator end() const
void EcalTPGParamBuilder::getCoeff ( coeffStruc coeff,
const std::map< EcalLogicID, MonPedestalsDat > &  pedMap,
const EcalLogicID logicId 
)
private

Definition at line 1821 of file EcalTPGParamBuilder.cc.

References gather_cfg::cout, EcalLogicID::getID1(), EcalLogicID::getID2(), EcalLogicID::getID3(), MonPedestalsDat::getPedMeanG1(), MonPedestalsDat::getPedMeanG12(), MonPedestalsDat::getPedMeanG6(), and coeffStruc::pedestals_.

1822 {
1823  // get current pedestal
1824  coeff.pedestals_[0] = 0 ;
1825  coeff.pedestals_[1] = 0 ;
1826  coeff.pedestals_[2] = 0 ;
1827 
1828  std::map<EcalLogicID, MonPedestalsDat>::const_iterator it = pedMap.find(logicId);
1829  if (it != pedMap.end()) {
1830  MonPedestalsDat ped = it->second ;
1831  coeff.pedestals_[0] = int(ped.getPedMeanG12() + 0.5) ;
1832  coeff.pedestals_[1] = int(ped.getPedMeanG6() + 0.5) ;
1833  coeff.pedestals_[2] = int(ped.getPedMeanG1() + 0.5) ;
1834  }
1835  else std::cout<<"getCoeff: "<<logicId.getID1()<<", "<<logicId.getID2()<<", "<<logicId.getID3()
1836  <<" not found in std::map<EcalLogicID, MonPedestalsDat>"<<std::endl ;
1837 }
int getID2() const
Definition: EcalLogicID.cc:52
float getPedMeanG12() const
int getID1() const
Definition: EcalLogicID.cc:47
float getPedMeanG1() const
float getPedMeanG6() const
tuple cout
Definition: gather_cfg.py:41
int getID3() const
Definition: EcalLogicID.cc:57
std::pair< std::string, int > EcalTPGParamBuilder::getCrate ( int  tcc)
private

Definition at line 1934 of file EcalTPGParamBuilder.cc.

References pos.

Referenced by analyze().

1934  {
1935  std::stringstream crate ;
1936  std::string pos ;
1937  int slot = 0 ;
1938 
1939  crate<<"S2D" ;
1940  if (tcc>=40 && tcc<=42) {crate<<"02d" ; slot = 5 + (tcc-40)*6 ;}
1941  if (tcc>=43 && tcc<=45) {crate<<"03d" ; slot = 5 + (tcc-43)*6 ;}
1942  if (tcc>=37 && tcc<=39) {crate<<"04d" ; slot = 5 + (tcc-37)*6 ;}
1943  if (tcc>=52 && tcc<=54) {crate<<"06d" ; slot = 5 + (tcc-52)*6 ;}
1944  if (tcc>=46 && tcc<=48) {crate<<"07d" ; slot = 5 + (tcc-46)*6 ;}
1945  if (tcc>=49 && tcc<=51) {crate<<"08d" ; slot = 5 + (tcc-49)*6 ;}
1946  if (tcc>=58 && tcc<=60) {crate<<"02h" ; slot = 5 + (tcc-58)*6 ;}
1947  if (tcc>=61 && tcc<=63) {crate<<"03h" ; slot = 5 + (tcc-61)*6 ;}
1948  if (tcc>=55 && tcc<=57) {crate<<"04h" ; slot = 5 + (tcc-55)*6 ;}
1949  if (tcc>=70 && tcc<=72) {crate<<"06h" ; slot = 5 + (tcc-70)*6 ;}
1950  if (tcc>=64 && tcc<=66) {crate<<"07h" ; slot = 5 + (tcc-64)*6 ;}
1951  if (tcc>=67 && tcc<=69) {crate<<"08h" ; slot = 5 + (tcc-67)*6 ;}
1952 
1953  if (tcc>=76 && tcc<=81) {
1954  crate<<"02l" ;
1955  if (tcc%2==0) slot = 2 + (tcc-76)*3 ;
1956  else slot = 4 + (tcc-77)*3 ;
1957  }
1958  if (tcc>=94 && tcc<=99) {
1959  crate<<"02l" ;
1960  if (tcc%2==0) slot = 3 + (tcc-94)*3 ;
1961  else slot = 5 + (tcc-95)*3 ;
1962  }
1963 
1964  if (tcc>=22 && tcc<=27) {
1965  crate<<"03l" ;
1966  if (tcc%2==0) slot = 2 + (tcc-22)*3 ;
1967  else slot = 4 + (tcc-23)*3 ;
1968  }
1969  if (tcc>=4 && tcc<=9) {
1970  crate<<"03l" ;
1971  if (tcc%2==0) slot = 3 + (tcc-4)*3 ;
1972  else slot = 5 + (tcc-5)*3 ;
1973  }
1974 
1975  if (tcc>=82 && tcc<=87) {
1976  crate<<"07l" ;
1977  if (tcc%2==0) slot = 2 + (tcc-82)*3 ;
1978  else slot = 4 + (tcc-83)*3 ;
1979  }
1980  if (tcc>=100 && tcc<=105) {
1981  crate<<"07l" ;
1982  if (tcc%2==0) slot = 3 + (tcc-100)*3 ;
1983  else slot = 5 + (tcc-101)*3 ;
1984  }
1985 
1986  if (tcc>=28 && tcc<=33) {
1987  crate<<"08l" ;
1988  if (tcc%2==0) slot = 2 + (tcc-28)*3 ;
1989  else slot = 4 + (tcc-29)*3 ;
1990  }
1991  if (tcc>=10 && tcc<=15) {
1992  crate<<"08l" ;
1993  if (tcc%2==0) slot = 3 + (tcc-10)*3 ;
1994  else slot = 5 + (tcc-11)*3 ;
1995  }
1996 
1997  if (tcc==34) {crate<<"04l" ; slot = 2 ;}
1998  if (tcc==16) {crate<<"04l" ; slot = 3 ;}
1999  if (tcc==35) {crate<<"04l" ; slot = 4 ;}
2000  if (tcc==17) {crate<<"04l" ; slot = 5 ;}
2001  if (tcc==36) {crate<<"04l" ; slot = 8 ;}
2002  if (tcc==18) {crate<<"04l" ; slot = 9 ;}
2003  if (tcc==19) {crate<<"04l" ; slot = 10 ;}
2004  if (tcc==1) {crate<<"04l" ; slot = 11 ;}
2005  if (tcc==20) {crate<<"04l" ; slot = 14 ;}
2006  if (tcc==2) {crate<<"04l" ; slot = 15 ;}
2007  if (tcc==21) {crate<<"04l" ; slot = 16 ;}
2008  if (tcc==3) {crate<<"04l" ; slot = 17 ;}
2009 
2010  if (tcc==88) {crate<<"06l" ; slot = 2 ;}
2011  if (tcc==106) {crate<<"06l" ; slot = 3 ;}
2012  if (tcc==89) {crate<<"06l" ; slot = 4 ;}
2013  if (tcc==107) {crate<<"06l" ; slot = 5 ;}
2014  if (tcc==90) {crate<<"06l" ; slot = 8 ;}
2015  if (tcc==108) {crate<<"06l" ; slot = 9 ;}
2016  if (tcc==73) {crate<<"06l" ; slot = 10 ;}
2017  if (tcc==91) {crate<<"06l" ; slot = 11 ;}
2018  if (tcc==74) {crate<<"06l" ; slot = 14 ;}
2019  if (tcc==92) {crate<<"06l" ; slot = 15 ;}
2020  if (tcc==75) {crate<<"06l" ; slot = 16 ;}
2021  if (tcc==93) {crate<<"06l" ; slot = 17 ;}
2022 
2023  return std::pair< std::string, int > (crate.str(),slot) ;
2024 }
std::string EcalTPGParamBuilder::getDet ( int  tcc)
private

Definition at line 1910 of file EcalTPGParamBuilder.cc.

Referenced by analyze().

1910  {
1911  std::stringstream sdet ;
1912 
1913  if (tcc>36 && tcc<55) sdet<<"EB-"<<tcc-36 ;
1914  else if (tcc>=55 && tcc<73) sdet<<"EB+"<<tcc-54 ;
1915  else if (tcc<=36) sdet<<"EE-" ;
1916  else sdet<<"EE+" ;
1917 
1918  if (tcc<=36 || tcc>=73) {
1919  if (tcc>=73) tcc-=72 ;
1920  if (tcc==1 || tcc==18 || tcc==19 || tcc==36) sdet<<7 ;
1921  else if (tcc==2 || tcc==3 || tcc==20 || tcc==21) sdet<<8 ;
1922  else if (tcc==4 || tcc==5 || tcc==22 || tcc==23) sdet<<9 ;
1923  else if (tcc==6 || tcc==7 || tcc==24 || tcc==25) sdet<<1 ;
1924  else if (tcc==8 || tcc==9 || tcc==26 || tcc==27) sdet<<2 ;
1925  else if (tcc==10 || tcc==11 || tcc==28 || tcc==29) sdet<<3 ;
1926  else if (tcc==12 || tcc==13 || tcc==30 || tcc==31) sdet<<4 ;
1927  else if (tcc==14 || tcc==15 || tcc==32 || tcc==33) sdet<<5 ;
1928  else if (tcc==16 || tcc==17 || tcc==34 || tcc==35) sdet<<6 ;
1929  }
1930 
1931  return sdet.str() ;
1932 }
int EcalTPGParamBuilder::getEtaSlice ( int  tccId,
int  towerInTCC 
)
private

Definition at line 180 of file EcalTPGParamBuilder.cc.

181 {
182  int etaSlice = (towerInTCC-1)/4+1 ;
183  // barrel
184  if (tccId>36 || tccId<73) return etaSlice ;
185  //endcap
186  else {
187  if (tccId >=1 && tccId <= 18) etaSlice += 21 ; // inner -
188  if (tccId >=19 && tccId <= 36) etaSlice += 17 ; // outer -
189  if (tccId >=91 && tccId <= 108) etaSlice += 21 ; // inner +
190  if (tccId >=73 && tccId <= 90) etaSlice += 17 ; // outer +
191  }
192  return etaSlice ;
193 }
int EcalTPGParamBuilder::getGCTRegionEta ( int  tteta)
private

Definition at line 1903 of file EcalTPGParamBuilder.cc.

Referenced by analyze().

1903  {
1904  int gcteta = 0;
1905  if(tteta>0) gcteta = (tteta-1)/4 + 11;
1906  else if(tteta<0) gcteta = (tteta+1)/4 + 10;
1907  return gcteta;
1908 }
int EcalTPGParamBuilder::getGCTRegionPhi ( int  ttphi)
private

Definition at line 1895 of file EcalTPGParamBuilder.cc.

Referenced by analyze().

1895  {
1896  int gctphi=0;
1897  gctphi = (ttphi+1)/4;
1898  if(ttphi<=2) gctphi=0;
1899  if(ttphi>=71) gctphi=0;
1900  return gctphi;
1901 }
bool EcalTPGParamBuilder::realignBaseline ( linStruc lin,
float  forceBase12 
)
private

Definition at line 1874 of file EcalTPGParamBuilder.cc.

References newFWLiteAna::base, gather_cfg::cout, funct::false, i, linStruc::mult_, convertSQLiteXML::ok, linStruc::pedestal_, funct::pow(), and linStruc::shift_.

Referenced by analyze().

1875 {
1876  bool ok(true) ;
1877  float base[3] = {forceBase12, float(lin.pedestal_[1]), float(lin.pedestal_[2])} ;
1878  for (int i=1 ; i<3 ; i++)
1879  base[i] = float(lin.pedestal_[i]) -
1880  float(lin.mult_[0])/float(lin.mult_[i])*pow(2., -(lin.shift_[0]-lin.shift_[i]))*(lin.pedestal_[0]-base[0]) ;
1881 
1882  for (int i=0 ; i<3 ; i++) {
1883  //std::cout<<lin.pedestal_[i]<<" "<<base[i]<<std::endl ;
1884  lin.pedestal_[i] = base[i] ;
1885  if (base[i]<0) {
1886  std::cout<<"WARNING: base= "<<base[i]<<" for gainId[0-2]="<<i<<" ==> forcing at 0"<<std::endl ;
1887  lin.pedestal_[i] = 0 ;
1888  ok = false ;
1889  }
1890  }
1891  return ok ;
1892 
1893 }
tuple base
Main Program
Definition: newFWLiteAna.py:92
int i
Definition: DBlmapReader.cc:9
tuple cout
Definition: gather_cfg.py:41
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
int EcalTPGParamBuilder::uncodeWeight ( double  weight,
int  complement2 = 7 
)
private

Definition at line 1572 of file EcalTPGParamBuilder.cc.

References max(), and funct::pow().

Referenced by computeWeights().

1573 {
1574  int iweight ;
1575  unsigned int max = (unsigned int)(pow(2.,complement2)-1) ;
1576  if (weight>0) iweight=int((1<<6)*weight+0.5) ; // +0.5 for rounding pb
1577  else iweight= max - int(-weight*(1<<6)+0.5) +1 ;
1578  iweight = iweight & max ;
1579  return iweight ;
1580 }
const T & max(const T &a, const T &b)
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
double EcalTPGParamBuilder::uncodeWeight ( int  iweight,
int  complement2 = 7 
)
private

Definition at line 1582 of file EcalTPGParamBuilder.cc.

References funct::pow(), and CommonMethods::weight().

1583 {
1584  double weight = double(iweight)/pow(2., 6.) ;
1585  // test if negative weight:
1586  if ( (iweight & (1<<(complement2-1))) != 0) weight = (double(iweight)-pow(2., complement2))/pow(2., 6.) ;
1587  return weight ;
1588 }
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40

Member Data Documentation

int EcalTPGParamBuilder::btt_conf_id_
private

Definition at line 144 of file EcalTPGParamBuilder.h.

Referenced by analyze(), and EcalTPGParamBuilder().

int EcalTPGParamBuilder::bxt_conf_id_
private

Definition at line 143 of file EcalTPGParamBuilder.h.

Referenced by analyze(), and EcalTPGParamBuilder().

unsigned int EcalTPGParamBuilder::complement2_
private

Definition at line 112 of file EcalTPGParamBuilder.h.

Referenced by computeWeights().

EcalTPGDBApp* EcalTPGParamBuilder::db_
private

Definition at line 131 of file EcalTPGParamBuilder.h.

Referenced by analyze(), and EcalTPGParamBuilder().

bool EcalTPGParamBuilder::DBEE_
private

Definition at line 135 of file EcalTPGParamBuilder.h.

Referenced by analyze(), and EcalTPGParamBuilder().

unsigned int EcalTPGParamBuilder::DBrunNb_
private

Definition at line 134 of file EcalTPGParamBuilder.h.

double EcalTPGParamBuilder::Et_sat_EB_
private
double EcalTPGParamBuilder::Et_sat_EE_
private
edm::ESHandle<EcalTrigTowerConstituentsMap> EcalTPGParamBuilder::eTTmap_
private

Definition at line 101 of file EcalTPGParamBuilder.h.

Referenced by analyze().

double EcalTPGParamBuilder::FG_highRatio_EB_
private
double EcalTPGParamBuilder::FG_highThreshold_EB_
private
double EcalTPGParamBuilder::FG_lowRatio_EB_
private
double EcalTPGParamBuilder::FG_lowThreshold_EB_
private
unsigned int EcalTPGParamBuilder::FG_lut_EB_
private

Definition at line 120 of file EcalTPGParamBuilder.h.

Referenced by computeFineGrainEBParameters(), and EcalTPGParamBuilder().

unsigned int EcalTPGParamBuilder::FG_lut_strip_EE_
private

Definition at line 122 of file EcalTPGParamBuilder.h.

Referenced by computeFineGrainEEParameters(), and EcalTPGParamBuilder().

unsigned int EcalTPGParamBuilder::FG_lut_tower_EE_
private

Definition at line 122 of file EcalTPGParamBuilder.h.

Referenced by computeFineGrainEEParameters(), and EcalTPGParamBuilder().

double EcalTPGParamBuilder::FG_Threshold_EE_
private
int EcalTPGParamBuilder::fgr_conf_id_
private

Definition at line 140 of file EcalTPGParamBuilder.h.

Referenced by analyze(), and EcalTPGParamBuilder().

int EcalTPGParamBuilder::forcedPedestalValue_
private

Definition at line 123 of file EcalTPGParamBuilder.h.

Referenced by analyze(), EcalTPGParamBuilder(), and getCoeff().

bool EcalTPGParamBuilder::forceEtaSlice_
private

Definition at line 124 of file EcalTPGParamBuilder.h.

Referenced by analyze(), and EcalTPGParamBuilder().

std::ofstream* EcalTPGParamBuilder::geomFile_
private

Definition at line 130 of file EcalTPGParamBuilder.h.

Referenced by EcalTPGParamBuilder().

int EcalTPGParamBuilder::lin_conf_id_
private

Definition at line 138 of file EcalTPGParamBuilder.h.

Referenced by analyze(), and EcalTPGParamBuilder().

int EcalTPGParamBuilder::lut_conf_id_
private

Definition at line 139 of file EcalTPGParamBuilder.h.

Referenced by analyze(), and EcalTPGParamBuilder().

double EcalTPGParamBuilder::LUT_constant_EB_
private

Definition at line 115 of file EcalTPGParamBuilder.h.

Referenced by computeLUT(), and EcalTPGParamBuilder().

double EcalTPGParamBuilder::LUT_constant_EE_
private

Definition at line 116 of file EcalTPGParamBuilder.h.

Referenced by computeLUT(), and EcalTPGParamBuilder().

double EcalTPGParamBuilder::LUT_noise_EB_
private

Definition at line 115 of file EcalTPGParamBuilder.h.

Referenced by computeLUT(), and EcalTPGParamBuilder().

double EcalTPGParamBuilder::LUT_noise_EE_
private

Definition at line 116 of file EcalTPGParamBuilder.h.

Referenced by computeLUT(), and EcalTPGParamBuilder().

std::string EcalTPGParamBuilder::LUT_option_
private

Definition at line 113 of file EcalTPGParamBuilder.h.

Referenced by analyze(), computeLUT(), and EcalTPGParamBuilder().

double EcalTPGParamBuilder::LUT_stochastic_EB_
private

Definition at line 115 of file EcalTPGParamBuilder.h.

Referenced by computeLUT(), and EcalTPGParamBuilder().

double EcalTPGParamBuilder::LUT_stochastic_EE_
private

Definition at line 116 of file EcalTPGParamBuilder.h.

Referenced by computeLUT(), and EcalTPGParamBuilder().

double EcalTPGParamBuilder::LUT_threshold_EB_
private

Definition at line 114 of file EcalTPGParamBuilder.h.

Referenced by computeLUT(), and EcalTPGParamBuilder().

double EcalTPGParamBuilder::LUT_threshold_EE_
private

Definition at line 114 of file EcalTPGParamBuilder.h.

Referenced by computeLUT(), and EcalTPGParamBuilder().

int EcalTPGParamBuilder::m_write_btt
private

Definition at line 154 of file EcalTPGParamBuilder.h.

Referenced by EcalTPGParamBuilder().

int EcalTPGParamBuilder::m_write_bxt
private

Definition at line 153 of file EcalTPGParamBuilder.h.

Referenced by EcalTPGParamBuilder().

int EcalTPGParamBuilder::m_write_fgr
private

Definition at line 151 of file EcalTPGParamBuilder.h.

Referenced by analyze(), and EcalTPGParamBuilder().

int EcalTPGParamBuilder::m_write_lin
private

Definition at line 148 of file EcalTPGParamBuilder.h.

Referenced by analyze(), and EcalTPGParamBuilder().

int EcalTPGParamBuilder::m_write_lut
private

Definition at line 149 of file EcalTPGParamBuilder.h.

Referenced by analyze(), and EcalTPGParamBuilder().

int EcalTPGParamBuilder::m_write_ped
private

Definition at line 147 of file EcalTPGParamBuilder.h.

Referenced by analyze(), and EcalTPGParamBuilder().

int EcalTPGParamBuilder::m_write_sli
private

Definition at line 152 of file EcalTPGParamBuilder.h.

Referenced by analyze(), and EcalTPGParamBuilder().

int EcalTPGParamBuilder::m_write_wei
private

Definition at line 150 of file EcalTPGParamBuilder.h.

Referenced by analyze(), and EcalTPGParamBuilder().

unsigned int EcalTPGParamBuilder::nSample_
private

Definition at line 111 of file EcalTPGParamBuilder.h.

Referenced by computeWeights().

Char_t EcalTPGParamBuilder::ntupleCrate_[10]
private

Definition at line 158 of file EcalTPGParamBuilder.h.

Referenced by analyze().

Char_t EcalTPGParamBuilder::ntupleDet_[10]
private

Definition at line 157 of file EcalTPGParamBuilder.h.

Referenced by analyze().

Float_t* EcalTPGParamBuilder::ntupleFloats_
private

Definition at line 156 of file EcalTPGParamBuilder.h.

Referenced by analyze().

std::ofstream* EcalTPGParamBuilder::out_file_
private

Definition at line 129 of file EcalTPGParamBuilder.h.

Referenced by analyze(), EcalTPGParamBuilder(), and ~EcalTPGParamBuilder().

int EcalTPGParamBuilder::ped_conf_id_
private

Definition at line 137 of file EcalTPGParamBuilder.h.

Referenced by analyze(), and EcalTPGParamBuilder().

unsigned int EcalTPGParamBuilder::pedestal_offset_
private

Definition at line 125 of file EcalTPGParamBuilder.h.

Referenced by analyze(), and EcalTPGParamBuilder().

unsigned int EcalTPGParamBuilder::sampleMax_
private

Definition at line 108 of file EcalTPGParamBuilder.h.

Referenced by computeWeights(), and EcalTPGParamBuilder().

unsigned int EcalTPGParamBuilder::SFGVB_lut_
private

Definition at line 125 of file EcalTPGParamBuilder.h.

Referenced by analyze(), and EcalTPGParamBuilder().

unsigned int EcalTPGParamBuilder::SFGVB_Threshold_
private

Definition at line 125 of file EcalTPGParamBuilder.h.

Referenced by analyze(), and EcalTPGParamBuilder().

int EcalTPGParamBuilder::sli_conf_id_
private

Definition at line 141 of file EcalTPGParamBuilder.h.

Referenced by analyze(), and EcalTPGParamBuilder().

unsigned int EcalTPGParamBuilder::sliding_
private

Definition at line 107 of file EcalTPGParamBuilder.h.

Referenced by analyze(), computeLinearizerParam(), and EcalTPGParamBuilder().

std::string EcalTPGParamBuilder::tag_
private

Definition at line 145 of file EcalTPGParamBuilder.h.

Referenced by analyze(), and EcalTPGParamBuilder().

const CaloSubdetectorGeometry* EcalTPGParamBuilder::theBarrelGeometry_
private

Definition at line 100 of file EcalTPGParamBuilder.h.

Referenced by analyze().

const CaloSubdetectorGeometry* EcalTPGParamBuilder::theEndcapGeometry_
private

Definition at line 99 of file EcalTPGParamBuilder.h.

Referenced by analyze().

const EcalElectronicsMapping* EcalTPGParamBuilder::theMapping_
private

Definition at line 102 of file EcalTPGParamBuilder.h.

Referenced by analyze().

double EcalTPGParamBuilder::TTF_highThreshold_EB_
private

Definition at line 117 of file EcalTPGParamBuilder.h.

Referenced by analyze(), beginJob(), computeLUT(), and EcalTPGParamBuilder().

double EcalTPGParamBuilder::TTF_highThreshold_EE_
private

Definition at line 118 of file EcalTPGParamBuilder.h.

Referenced by analyze(), beginJob(), computeLUT(), and EcalTPGParamBuilder().

double EcalTPGParamBuilder::TTF_lowThreshold_EB_
private

Definition at line 117 of file EcalTPGParamBuilder.h.

Referenced by analyze(), beginJob(), computeLUT(), and EcalTPGParamBuilder().

double EcalTPGParamBuilder::TTF_lowThreshold_EE_
private

Definition at line 118 of file EcalTPGParamBuilder.h.

Referenced by analyze(), beginJob(), computeLUT(), and EcalTPGParamBuilder().

bool EcalTPGParamBuilder::useInterCalibration_
private

Definition at line 126 of file EcalTPGParamBuilder.h.

Referenced by EcalTPGParamBuilder(), and getCoeff().

bool EcalTPGParamBuilder::useTransverseEnergy_
private

Definition at line 104 of file EcalTPGParamBuilder.h.

Referenced by analyze(), and EcalTPGParamBuilder().

int EcalTPGParamBuilder::version_
private

Definition at line 146 of file EcalTPGParamBuilder.h.

Referenced by analyze(), and EcalTPGParamBuilder().

int EcalTPGParamBuilder::wei_conf_id_
private

Definition at line 142 of file EcalTPGParamBuilder.h.

Referenced by analyze(), and EcalTPGParamBuilder().

double EcalTPGParamBuilder::weight_timeShift_
private

Definition at line 109 of file EcalTPGParamBuilder.h.

Referenced by computeWeights(), and EcalTPGParamBuilder().

bool EcalTPGParamBuilder::weight_unbias_recovery_
private

Definition at line 110 of file EcalTPGParamBuilder.h.

Referenced by computeWeights(), and EcalTPGParamBuilder().

bool EcalTPGParamBuilder::writeToDB_
private

Definition at line 132 of file EcalTPGParamBuilder.h.

Referenced by analyze(), and EcalTPGParamBuilder().

bool EcalTPGParamBuilder::writeToFiles_
private
double EcalTPGParamBuilder::xtal_LSB_EB_
private

Definition at line 105 of file EcalTPGParamBuilder.h.

Referenced by analyze(), and computeLinearizerParam().

double EcalTPGParamBuilder::xtal_LSB_EE_
private

Definition at line 105 of file EcalTPGParamBuilder.h.

Referenced by analyze(), and computeLinearizerParam().