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 edm::EDConsumerBase

Public Member Functions

virtual void analyze (const edm::Event &evt, const edm::EventSetup &evtSetup)
 
virtual void beginJob ()
 
bool checkIfOK (const EcalPedestals::Item &item)
 
 EcalTPGParamBuilder (edm::ParameterSet const &pSet)
 
 ~EcalTPGParamBuilder ()
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (std::string const &iProcessName, std::string const &iModuleLabel, bool iPrint, std::vector< char const * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

void computeFineGrainEBParameters (uint &lowRatio, uint &highRatio, uint &lowThreshold, uint &highThreshold, uint &lut)
 
void computeFineGrainEEParameters (uint &threshold, uint &lut_strip, uint &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, uint rawId)
 
void getCoeff (coeffStruc &coeff, const EcalGainRatioMap &gainMap, uint rawId)
 
void getCoeff (coeffStruc &coeff, const EcalPedestalsMap &pedMap, uint 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 bst_conf_id_
 
int btt_conf_id_
 
int bxt_conf_id_
 
unsigned int complement2_
 
EcalTPGDBAppdb_
 
bool DBEE_
 
int del_conf_id_
 
std::map< int, std::vector< int > > delays_EB_
 
std::map< int, std::vector< int > > delays_EE_
 
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_
 
bool H2_
 
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_bst
 
int m_write_btt
 
int m_write_bxt
 
int m_write_del
 
int m_write_fgr
 
int m_write_lin
 
int m_write_lut
 
int m_write_ped
 
int m_write_sli
 
int m_write_spi
 
int m_write_wei
 
unsigned int nSample_
 
Char_t ntupleCrate_ [10]
 
Char_t ntupleDet_ [10]
 
Int_t * ntupleInts_
 
std::ofstream * out_file_
 
int ped_conf_id_
 
unsigned int pedestal_offset_
 
std::map< int, std::vector< int > > phases_EB_
 
std::map< int, std::vector< int > > phases_EE_
 
unsigned int sampleMax_
 
unsigned int SFGVB_lut_
 
int SFGVB_SpikeKillingThreshold_
 
unsigned int SFGVB_Threshold_
 
int sli_conf_id_
 
unsigned int sliding_
 
int spi_conf_id_
 
std::string tag_
 
const CaloSubdetectorGeometrytheBarrelGeometry_
 
const CaloSubdetectorGeometrytheEndcapGeometry_
 
const EcalElectronicsMappingtheMapping_
 
std::string TimingDelays_EB_
 
std::string TimingDelays_EE_
 
std::string TimingPhases_EB_
 
std::string TimingPhases_EE_
 
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
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Definition at line 54 of file EcalTPGParamBuilder.h.

Constructor & Destructor Documentation

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

Definition at line 52 of file EcalTPGParamBuilder.cc.

References bst_conf_id_, btt_conf_id_, bxt_conf_id_, gather_cfg::cout, db_, DBEE_, del_conf_id_, delays_EB_, delays_EE_, alignCSCRings::e, Et_sat_EB_, Et_sat_EE_, 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(), edm::ParameterSet::getUntrackedParameter(), H2_, 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_bst, m_write_btt, m_write_bxt, m_write_del, m_write_fgr, m_write_lin, m_write_lut, m_write_ped, m_write_sli, m_write_spi, m_write_wei, GenerateHcalLaserBadRunList::out, out_file_, GetRecoTauVFromDQM_MC_cff::outFile, ped_conf_id_, pedestal_offset_, phases_EB_, phases_EE_, sampleMax_, SFGVB_lut_, SFGVB_SpikeKillingThreshold_, SFGVB_Threshold_, funct::sin(), sli_conf_id_, sliding_, spi_conf_id_, AlCaHLTBitMon_QueryRunRegistry::string, tag_, TimingDelays_EB_, TimingDelays_EE_, TimingPhases_EB_, TimingPhases_EE_, 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  spi_conf_id_=0; //modif-alex 21/01/11
62  del_conf_id_=0; //modif-alex 21/01/11
63  bxt_conf_id_=0;
64  btt_conf_id_=0;
65  bst_conf_id_=0;
66  tag_="";
67  version_=0;
68 
69  m_write_ped=1;
70  m_write_lin=1;
71  m_write_lut=1;
72  m_write_wei=1;
73  m_write_fgr=1;
74  m_write_sli=1;
75  m_write_spi=1; //modif-alex 21/01/11
76  m_write_del=1; //modif-alex 21/01/11
77  m_write_bxt=1;
78  m_write_btt=1;
79  m_write_bst=1;
80 
81  writeToDB_ = pSet.getParameter<bool>("writeToDB") ;
82  DBEE_ = pSet.getParameter<bool>("allowDBEE") ;
83  string DBsid = pSet.getParameter<std::string>("DBsid") ;
84  string DBuser = pSet.getParameter<std::string>("DBuser") ;
85  string DBpass = pSet.getParameter<std::string>("DBpass") ;
86  //uint32_t DBport = pSet.getParameter<unsigned int>("DBport") ;
87 
88  tag_ = pSet.getParameter<std::string>("TPGtag") ;
89  version_ = pSet.getParameter<unsigned int>("TPGversion") ;
90 
91  m_write_ped = pSet.getParameter<unsigned int>("TPGWritePed") ;
92  m_write_lin = pSet.getParameter<unsigned int>("TPGWriteLin") ;
93  m_write_lut = pSet.getParameter<unsigned int>("TPGWriteLut") ;
94  m_write_wei = pSet.getParameter<unsigned int>("TPGWriteWei") ;
95  m_write_fgr = pSet.getParameter<unsigned int>("TPGWriteFgr") ;
96  m_write_sli = pSet.getParameter<unsigned int>("TPGWriteSli") ;
97  m_write_spi = pSet.getParameter<unsigned int>("TPGWriteSpi") ; //modif-alex 21/01/11
98  m_write_del = pSet.getParameter<unsigned int>("TPGWriteDel") ; //modif-alex 21/01/11
99  m_write_bxt = pSet.getParameter<unsigned int>("TPGWriteBxt") ;
100  m_write_btt = pSet.getParameter<unsigned int>("TPGWriteBtt") ;
101  m_write_bst = pSet.getParameter<unsigned int>("TPGWriteBst") ;
102 
106 
107  if(m_write_ped != 0 && m_write_ped != 1 ) ped_conf_id_=m_write_ped;
108 
109  try {
110  if (writeToDB_) std::cout << "data will be saved with tag and version="<< tag_<< ".version"<<version_<< endl;
111  db_ = new EcalTPGDBApp(DBsid, DBuser, DBpass) ;
112  } catch (exception &e) {
113  cout << "ERROR: " << e.what() << endl;
114  } catch (...) {
115  cout << "Unknown error caught" << endl;
116  }
117 
118  writeToFiles_ = pSet.getParameter<bool>("writeToFiles") ;
119  if (writeToFiles_) {
120  std::string outFile = pSet.getParameter<std::string>("outFile") ;
121  out_file_ = new std::ofstream(outFile.c_str(), std::ios::out) ;
122  }
123  geomFile_ = new std::ofstream("geomFile.txt", std::ios::out) ;
124 
125 
126  useTransverseEnergy_ = pSet.getParameter<bool>("useTransverseEnergy") ;
127 
128  Et_sat_EB_ = pSet.getParameter<double>("Et_sat_EB") ;
129  Et_sat_EE_ = pSet.getParameter<double>("Et_sat_EE") ;
130  sliding_ = pSet.getParameter<unsigned int>("sliding") ;
131  weight_timeShift_ = pSet.getParameter<double>("weight_timeShift") ;
132  sampleMax_ = pSet.getParameter<unsigned int>("weight_sampleMax") ;
133  weight_unbias_recovery_ = pSet.getParameter<bool>("weight_unbias_recovery") ;
134 
135  forcedPedestalValue_ = pSet.getParameter<int>("forcedPedestalValue") ;
136  forceEtaSlice_ = pSet.getParameter<bool>("forceEtaSlice") ;
137 
138  LUT_option_ = pSet.getParameter<std::string>("LUT_option") ;
139  LUT_threshold_EB_ = pSet.getParameter<double>("LUT_threshold_EB") ;
140  LUT_threshold_EE_ = pSet.getParameter<double>("LUT_threshold_EE") ;
141  LUT_stochastic_EB_ = pSet.getParameter<double>("LUT_stochastic_EB") ;
142  LUT_noise_EB_ =pSet.getParameter<double>("LUT_noise_EB") ;
143  LUT_constant_EB_ =pSet.getParameter<double>("LUT_constant_EB") ;
144  LUT_stochastic_EE_ = pSet.getParameter<double>("LUT_stochastic_EE") ;
145  LUT_noise_EE_ =pSet.getParameter<double>("LUT_noise_EE") ;
146  LUT_constant_EE_ =pSet.getParameter<double>("LUT_constant_EE") ;
147 
148  TTF_lowThreshold_EB_ = pSet.getParameter<double>("TTF_lowThreshold_EB") ;
149  TTF_highThreshold_EB_ = pSet.getParameter<double>("TTF_highThreshold_EB") ;
150  TTF_lowThreshold_EE_ = pSet.getParameter<double>("TTF_lowThreshold_EE") ;
151  TTF_highThreshold_EE_ = pSet.getParameter<double>("TTF_highThreshold_EE") ;
152 
153  FG_lowThreshold_EB_ = pSet.getParameter<double>("FG_lowThreshold_EB") ;
154  FG_highThreshold_EB_ = pSet.getParameter<double>("FG_highThreshold_EB") ;
155  FG_lowRatio_EB_ = pSet.getParameter<double>("FG_lowRatio_EB") ;
156  FG_highRatio_EB_ = pSet.getParameter<double>("FG_highRatio_EB") ;
157  FG_lut_EB_ = pSet.getParameter<unsigned int>("FG_lut_EB") ;
158  FG_Threshold_EE_ = pSet.getParameter<double>("FG_Threshold_EE") ;
159  FG_lut_strip_EE_ = pSet.getParameter<unsigned int>("FG_lut_strip_EE") ;
160  FG_lut_tower_EE_ = pSet.getParameter<unsigned int>("FG_lut_tower_EE") ;
161  SFGVB_Threshold_ = pSet.getParameter<unsigned int>("SFGVB_Threshold") ;
162  SFGVB_lut_ = pSet.getParameter<unsigned int>("SFGVB_lut") ;
163  SFGVB_SpikeKillingThreshold_ = pSet.getParameter<int>("SFGVB_SpikeKillingThreshold") ; //modif-alex 21/01/11
164  pedestal_offset_ = pSet.getParameter<unsigned int>("pedestal_offset") ;
165 
166  useInterCalibration_ = pSet.getParameter<bool>("useInterCalibration") ;
167  H2_ = pSet.getUntrackedParameter<bool>("H2",false) ;
168 
169  //modif-alex-23/02/2011
170  //convert the spike killing first from GeV to ADC (10 bits)
171  //depending on the saturation scale: Et_sat_EB_
172  if(SFGVB_SpikeKillingThreshold_ == -1 || (SFGVB_SpikeKillingThreshold_ > Et_sat_EB_))
173  SFGVB_SpikeKillingThreshold_ = 1023; //nokilling
174  else
175  SFGVB_SpikeKillingThreshold_ = int(SFGVB_SpikeKillingThreshold_ * 1024/Et_sat_EB_);
176  std::cout << "INFO:SPIKE KILLING THRESHOLD (ADC)=" << SFGVB_SpikeKillingThreshold_ << std::endl;
177 
178  //modif-alex-02/02/11
179  //TIMING information
180  TimingDelays_EB_ = pSet.getParameter<std::string>("timing_delays_EB") ;
181  TimingDelays_EE_ = pSet.getParameter<std::string>("timing_delays_EE") ;
182  TimingPhases_EB_ = pSet.getParameter<std::string>("timing_phases_EB") ;
183  TimingPhases_EE_ = pSet.getParameter<std::string>("timing_phases_EE") ;
184 
185  std::cout << "INFO: READING timing files" << std::endl;
186  std::ifstream delay_eb(TimingDelays_EB_.c_str());
187  if(!delay_eb) std::cout << "ERROR: File " << TimingDelays_EB_.c_str() << " could not be opened" << std::endl;
188  std::ifstream delay_ee(TimingDelays_EE_.c_str());
189  if(!delay_ee) std::cout << "ERROR: File " << TimingDelays_EE_.c_str() << " could not be opened" << std::endl;
190  std::ifstream phase_eb(TimingPhases_EB_.c_str());
191  if(!phase_eb) std::cout << "ERROR: File " << TimingPhases_EB_.c_str() << " could not be opened" << std::endl;
192  std::ifstream phase_ee(TimingPhases_EE_.c_str());
193  if(!phase_ee) std::cout << "ERROR: File " << TimingPhases_EE_.c_str() << " could not be opened" << std::endl;
194 
195  char buf[1024];
196  //READING DELAYS EB
197  delay_eb.getline(buf,sizeof(buf),'\n');
198  while( delay_eb ) {
199  std::stringstream sin(buf);
200 
201  int tcc;
202  sin >> tcc;
203 
204  vector<int> vec_delays_eb;
205  for(int ieb=0; ieb<68; ++ieb){
206  int time_delay = -1;
207  sin >> time_delay;
208  vec_delays_eb.push_back(time_delay);
209  if(time_delay==-1) std::cout << "ERROR:Barrel timing delay -1, check file" << std::endl;
210  }
211 
212  if(vec_delays_eb.size()!=68)
213  std::cout << "ERROR:Barrel timing delay wrong, not enough towers, check file" << std::endl;
214 
215  if (delays_EB_.find(tcc) == delays_EB_.end())
216  delays_EB_.insert(make_pair(tcc,vec_delays_eb));
217 
218  cout << tcc << " ";
219  for(unsigned int ieb=0; ieb<vec_delays_eb.size(); ++ieb)
220  cout << vec_delays_eb[ieb] << " ";
221  cout << endl;
222 
223  delay_eb.getline(buf,sizeof(buf),'\n');
224  }//loop delay file EB
225  delay_eb.close();
226 
227  //READING PHASES EB
228  phase_eb.getline(buf,sizeof(buf),'\n');
229  while( phase_eb ) {
230  std::stringstream sin(buf);
231  int tcc;
232  sin >> tcc;
233 
234  vector<int> vec_phases_eb;
235  for(unsigned int ieb=0; ieb<68; ++ieb){
236  int time_phase = -1;
237  sin >> time_phase;
238  vec_phases_eb.push_back(time_phase);
239  if(time_phase==-1) std::cout << "ERROR:Barrel timing phase -1, check file" << std::endl;
240  }
241 
242  if(vec_phases_eb.size()!=68)
243  std::cout << "ERROR:Barrel timing phase wrong, not enough towers, check file" << std::endl;
244 
245  if (phases_EB_.find(tcc) == phases_EB_.end())
246  phases_EB_.insert(make_pair(tcc,vec_phases_eb));
247 
248  cout << tcc << " ";
249  for(unsigned int ieb=0; ieb<vec_phases_eb.size(); ++ieb)
250  cout << vec_phases_eb[ieb] << " ";
251  cout << endl;
252 
253  phase_eb.getline(buf,sizeof(buf),'\n');
254  }//loop phase file EB
255  phase_eb.close();
256 
257  //READING DELAYS EE//------------------------------------------------
258  delay_ee.getline(buf,sizeof(buf),'\n');
259  while( delay_ee ) {
260  std::stringstream sin(buf);
261  int tcc;
262  sin >> tcc;
263 
264  vector<int> vec_delays_ee;
265  for(unsigned int iee=0; iee<48; ++iee){
266  int time_delay = -1;
267  sin >> time_delay;
268  vec_delays_ee.push_back(time_delay);
269  if(time_delay==-1) std::cout << "ERROR:EE timing delay -1, check file" << std::endl;
270  }
271 
272  if(vec_delays_ee.size()!=48)
273  std::cout << "ERROR:EE timing delay wrong, not enough towers, check file" << std::endl;
274 
275  if (delays_EE_.find(tcc) == delays_EE_.end())
276  delays_EE_.insert(make_pair(tcc,vec_delays_ee));
277 
278  cout << tcc << " ";
279  for(unsigned int iee=0; iee<vec_delays_ee.size(); ++iee)
280  cout << vec_delays_ee[iee] << " ";
281  cout << endl;
282 
283  delay_ee.getline(buf,sizeof(buf),'\n');
284  }//loop delay file EE
285  delay_ee.close();
286 
287 
288  //READING PHASES EE
289  phase_ee.getline(buf,sizeof(buf),'\n');
290  while( phase_ee ) {
291  std::stringstream sin(buf);
292  int tcc;
293  sin >> tcc;
294 
295  vector<int> vec_phases_ee;
296  for(unsigned int iee=0; iee<48; ++iee){
297  int time_phase = -1;
298  sin >> time_phase;
299  vec_phases_ee.push_back(time_phase);
300  if(time_phase==-1) std::cout << "ERROR:EE timing phase -1, check file" << std::endl;
301  }
302 
303  if(vec_phases_ee.size()!=48)
304  std::cout << "ERROR:EE timing phase wrong, not enough towers, check file" << std::endl;
305 
306  if (phases_EE_.find(tcc) == phases_EE_.end())
307  phases_EE_.insert(make_pair(tcc,vec_phases_ee));
308 
309  cout << tcc << " ";
310  for(unsigned int iee=0; iee<vec_phases_ee.size(); ++iee)
311  cout << vec_phases_ee[iee] << " ";
312  cout << endl;
313 
314  phase_ee.getline(buf,sizeof(buf),'\n');
315  }//loop phase file EE
316  phase_ee.close();
317 
318  std::cout << "INFO: DONE reading timing files for EB and EE" << std::endl;
319 
320 }
std::map< int, std::vector< int > > phases_EB_
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
std::ofstream * out_file_
std::map< int, std::vector< int > > delays_EB_
std::map< int, std::vector< int > > delays_EE_
std::ofstream * geomFile_
tuple cout
Definition: gather_cfg.py:145
std::map< int, std::vector< int > > phases_EE_
EcalTPGParamBuilder::~EcalTPGParamBuilder ( )

Definition at line 322 of file EcalTPGParamBuilder.cc.

References out_file_, and writeToFiles_.

323 {
324  if (writeToFiles_) {
325  (*out_file_ )<<"EOF"<<std::endl ;
326  out_file_->close() ;
327  delete out_file_ ;
328  }
329 }
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 359 of file EcalTPGParamBuilder.cc.

References funct::abs(), newFWLiteAna::base, bst_conf_id_, btt_conf_id_, bxt_conf_id_, coeffStruc::calibCoeff_, EcalTriggerElectronicsId::channelId(), computeFineGrainEBParameters(), computeFineGrainEEParameters(), computeLinearizerParam(), computeLUT(), computeWeights(), gather_cfg::cout, dataset::dataset, db_, DBEE_, EcalElectronicsId::dccId(), EcalElectronicsMapping::DCCid(), TauDecayModes::dec, del_conf_id_, delays_EB_, delays_EE_, alignCSCRings::e, DetId::Ecal, EcalBarrel, EcalEndcap, Et_sat_EB_, Et_sat_EE_, PV3DBase< T, PVType, FrameType >::eta(), eTTmap_, cppFunctionSkipper::exception, EcalCondDBInterface::fetchDataSet(), FG_highRatio_EB_, FG_highThreshold_EB_, FG_lowRatio_EB_, FG_lowThreshold_EB_, FG_Threshold_EE_, fgr_conf_id_, plotBeamSpotDB::first, forcedPedestalValue_, forceEtaSlice_, g, callgraph::G, EcalMGPAGainRatio::gain12Over6(), EcalMGPAGainRatio::gain6Over1(), coeffStruc::gainRatio_, edm::EventSetup::get(), FEConfigMainInfo::getBstId(), FEConfigMainInfo::getBttId(), FEConfigMainInfo::getBxtId(), getCoeff(), getCrate(), getDet(), EcalCondDBInterface::getEcalLogicID(), EcalCondDBInterface::getEcalLogicIDSetOrdered(), EcalElectronicsMapping::getElectronicsId(), FEConfigMainInfo::getFgrId(), getGCTRegionEta(), getGCTRegionPhi(), CaloSubdetectorGeometry::getGeometry(), EcalLogicID::getID1(), EcalLogicID::getID2(), EcalLogicID::getID3(), FEConfigMainInfo::getLinId(), EcalLogicID::getLogicID(), FEConfigMainInfo::getLUTId(), EcalCondObjectContainer< T >::getMap(), EcalLogicID::getName(), FEConfigMainInfo::getPedId(), FEConfigPedDat::getPedMeanG1(), FEConfigPedDat::getPedMeanG12(), FEConfigPedDat::getPedMeanG6(), CaloCellGeometry::getPosition(), FEConfigMainInfo::getSliId(), FEConfigMainInfo::getSpiId(), FEConfigMainInfo::getTimId(), EcalElectronicsMapping::getTriggerElectronicsId(), CaloSubdetectorGeometry::getValidDetIds(), FEConfigMainInfo::getWeiId(), H2_, ecalpyutils::hashedIndex(), i, EcalTrigTowerDetId::ieta(), EcalTrigTowerDetId::ietaAbs(), EcalCondObjectContainer< T >::insert(), EcalTrigTowerDetId::iphi(), EcalElectronicsMapping::iTT(), j, relval_2017::k, lin_conf_id_, lumiPlot::lut, lut_conf_id_, LUT_option_, lumiCalc2::lute, m_write_del, m_write_fgr, m_write_lin, m_write_lut, m_write_ped, m_write_sli, m_write_spi, m_write_wei, EcalPedestal::mean_x1, EcalPedestal::mean_x12, EcalPedestal::mean_x6, VarParsing::mult, linStruc::mult_, ntupleCrate_, ntupleDet_, ntupleInts_, EcalLogicID::NULLID, convertSQLiteXML::ok, GenerateHcalLaserBadRunList::out, out_file_, AlCaHLTBitMon_ParallelJobs::p, ped_conf_id_, linStruc::pedestal_, pedestal_offset_, coeffStruc::pedestals_, phases_EB_, phases_EE_, PV3DBase< T, PVType, FrameType >::phi(), funct::pow(), edm::ESHandle< class >::product(), EcalTriggerElectronicsId::pseudoStripId(), EcalTriggerElectronicsId::rawId(), DetId::rawId(), realignBaseline(), EcalPedestal::rms_x1, EcalPedestal::rms_x12, EcalPedestal::rms_x6, compare_using_db::sample, IODConfig::setConfigTag(), FEConfigLinParamDat::setETSat(), FEConfigLUTParamDat::setETSat(), FEConfigFgrParamDat::setFGhighratio(), FEConfigFgrParamDat::setFGhighthresh(), FEConfigFgrParamDat::setFGlowratio(), FEConfigFgrParamDat::setFGlowthresh(), FEConfigFgrGroupDat::setFgrGroupId(), FEConfigFgrDat::setFgrGroupId(), FEConfigPedInfo::setId(), FEConfigFgrEEStripDat::setLutFgr(), FEConfigLUTGroupDat::setLUTGroupId(), FEConfigLUTDat::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(), FEConfigSpikeDat::setSpikeThreshold(), FEConfigFgrGroupDat::setThreshHigh(), FEConfigFgrGroupDat::setThreshLow(), FEConfigFgrEEStripDat::setThreshold(), FEConfigTimingDat::setTimingPar1(), FEConfigTimingDat::setTimingPar2(), FEConfigLUTParamDat::setTTThreshhigh(), FEConfigLUTParamDat::setTTThreshlow(), FEConfigWeightGroupDat::setWeight0(), FEConfigWeightGroupDat::setWeight1(), FEConfigWeightGroupDat::setWeight2(), FEConfigWeightGroupDat::setWeight3(), FEConfigWeightGroupDat::setWeight4(), FEConfigWeightDat::setWeightGroupId(), FEConfigWeightGroupDat::setWeightGroupId(), SFGVB_lut_, SFGVB_SpikeKillingThreshold_, SFGVB_Threshold_, edm::shift, linStruc::shift_, funct::sin(), findQualityFiles::size, sli_conf_id_, sliding_, EBDetId::SMCRYSTALMODE, spi_conf_id_, AlCaHLTBitMon_QueryRunRegistry::string, EcalElectronicsId::stripId(), EcalTrigTowerDetId::subDet(), tag_, EcalElectronicsMapping::TCCid(), theBarrelGeometry_, theEndcapGeometry_, theMapping_, PV3DBase< T, PVType, FrameType >::theta(), theta(), dtDQMClient_cfg::threshold, EcalElectronicsId::towerId(), funct::true, TTF_highThreshold_EB_, TTF_highThreshold_EE_, TTF_lowThreshold_EB_, TTF_lowThreshold_EE_, useTransverseEnergy_, version_, wei_conf_id_, create_public_pileup_plots::weights, EcalTPGDBApp::writeToConfDB_Delay(), EcalTPGDBApp::writeToConfDB_Spike(), 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(), EEDetId::XYMODE, y, z, EcalTrigTowerDetId::zside(), and ecaldqm::zside().

360 {
361  using namespace edm;
362  using namespace std;
363 
364  // geometry
365  ESHandle<CaloGeometry> theGeometry;
366  ESHandle<CaloSubdetectorGeometry> theEndcapGeometry_handle, theBarrelGeometry_handle;
367  evtSetup.get<CaloGeometryRecord>().get( theGeometry );
368  evtSetup.get<EcalEndcapGeometryRecord>().get("EcalEndcap",theEndcapGeometry_handle);
369  evtSetup.get<EcalBarrelGeometryRecord>().get("EcalBarrel",theBarrelGeometry_handle);
370  evtSetup.get<IdealGeometryRecord>().get(eTTmap_);
371  theEndcapGeometry_ = &(*theEndcapGeometry_handle);
372  theBarrelGeometry_ = &(*theBarrelGeometry_handle);
373 
374  // electronics mapping
376  evtSetup.get< EcalMappingRcd >().get(ecalmapping);
377  theMapping_ = ecalmapping.product();
378 
379 
380  // histo
381  TFile saving ("EcalTPGParam.root","recreate") ;
382  saving.cd () ;
383  TH2F * ICEB = new TH2F("ICEB", "IC: Barrel", 360, 1, 361, 172, -86, 86) ;
384  ICEB->GetYaxis()->SetTitle("eta index") ;
385  ICEB->GetXaxis()->SetTitle("phi index") ;
386  TH2F * tpgFactorEB = new TH2F("tpgFactorEB", "tpgFactor: Barrel", 360, 1, 361, 172, -86, 86) ;
387  tpgFactorEB->GetYaxis()->SetTitle("eta index") ;
388  tpgFactorEB->GetXaxis()->SetTitle("phi index") ;
389 
390  TH2F * ICEEPlus = new TH2F("ICEEPlus", "IC: Plus Endcap", 120, -9, 111, 120, -9, 111) ;
391  ICEEPlus->GetYaxis()->SetTitle("y index") ;
392  ICEEPlus->GetXaxis()->SetTitle("x index") ;
393  TH2F * tpgFactorEEPlus = new TH2F("tpgFactorEEPlus", "tpgFactor: Plus Endcap", 120, -9, 111, 120, -9, 111) ;
394  tpgFactorEEPlus->GetYaxis()->SetTitle("y index") ;
395  tpgFactorEEPlus->GetXaxis()->SetTitle("x index") ;
396  TH2F * ICEEMinus = new TH2F("ICEEMinus", "IC: Minus Endcap", 120, -9, 111, 120, -9, 111) ;
397  ICEEMinus->GetYaxis()->SetTitle("y index") ;
398  ICEEMinus->GetXaxis()->SetTitle("x index") ;
399  TH2F * tpgFactorEEMinus = new TH2F("tpgFactorEEMinus", "tpgFactor: Minus Endcap", 120, -9, 111, 120, -9, 111) ;
400  tpgFactorEEMinus->GetYaxis()->SetTitle("y index") ;
401  tpgFactorEEMinus->GetXaxis()->SetTitle("x index") ;
402 
403  TH2F * IC = new TH2F("IC", "IC", 720, -acos(-1.), acos(-1.), 600, -3., 3.) ;
404  IC->GetYaxis()->SetTitle("eta") ;
405  IC->GetXaxis()->SetTitle("phi") ;
406  TH2F * tpgFactor = new TH2F("tpgFactor", "tpgFactor", 720, -acos(-1.), acos(-1.), 600, -3., 3.) ;
407  tpgFactor->GetYaxis()->SetTitle("eta") ;
408  tpgFactor->GetXaxis()->SetTitle("phi") ;
409 
410  TH1F * hshapeEB = new TH1F("shapeEB", "shapeEB", 250, 0., 10.) ;
411  TH1F * hshapeEE = new TH1F("shapeEE", "shapeEE", 250, 0., 10.) ;
412 
413  TTree * ntuple = new TTree("tpgmap","TPG geometry map") ;
414  const std::string branchFloat[26] = {"fed","tcc","tower","stripInTower","xtalInStrip",
415  "CCU","VFE","xtalInVFE","xtalInCCU","ieta","iphi",
416  "ix","iy","iz","hashedId","ic","cmsswId","dbId","ietaTT","iphiTT",
417  "TCCch","TCCslot","SLBch","SLBslot","ietaGCT","iphiGCT"} ;
418  ntupleInts_ = new Int_t[26] ;
419  for (int i=0 ; i<26 ; i++) ntuple->Branch(branchFloat[i].c_str(),&ntupleInts_[i],(branchFloat[i]+string("/I")).c_str()) ;
420  ntuple->Branch("det",ntupleDet_,"det/C") ;
421  ntuple->Branch("crate",ntupleCrate_,"crate/C") ;
422 
423 
424  TNtuple *ntupleSpike = new TNtuple("spikeParam","Spike parameters","gainId:theta:G:g:ped:pedLin") ;
425 
426 
427 
428 
430  // Initialization section //
432  list<uint32_t> towerListEB ;
433  list<uint32_t> stripListEB ;
434  list<uint32_t> towerListEE ;
435  list<uint32_t> stripListEE ;
436  list<uint32_t>::iterator itList ;
437 
438  map<int, uint32_t> stripMapEB ; // <EcalLogicId.hashed, strip elec id>
439  map<uint32_t, uint32_t> stripMapEBsintheta ; // <strip elec id, sintheta>
440 
441 
442  // Pedestals
443 
444  EcalPedestalsMap pedMap ;
445 
446  if(m_write_ped == 1) {
447  std::cout <<"Getting the pedestals from offline DB..."<<endl;
448 
449  ESHandle<EcalPedestals> pedHandle;
450  evtSetup.get<EcalPedestalsRcd>().get( pedHandle );
451  pedMap = pedHandle.product()->getMap() ;
452 
453 
454  EcalPedestalsMapIterator pedIter ;
455  int nPed = 0 ;
456  for (pedIter = pedMap.begin() ; pedIter != pedMap.end() && nPed<10 ; ++pedIter, nPed++) {
457  EcalPedestals::Item aped = (*pedIter);
458  std::cout<<aped.mean_x12<<", "<<aped.mean_x6<<", "<<aped.mean_x1<<std::endl ;
459  }
460  } else if(m_write_ped==0) {
461  std::cout <<"Getting the pedestals from previous configuration"<<std::endl;
462 
463  EcalPedestals peds ;
464 
465  FEConfigMainInfo fe_main_info;
466  fe_main_info.setConfigTag(tag_);
467  try {
468  std::cout << "trying to read previous tag if it exists tag="<< tag_<< ".version"<<version_<< endl;
469  db_-> fetchConfigSet(&fe_main_info);
470  if(fe_main_info.getPedId()>0 ) ped_conf_id_=fe_main_info.getPedId();
471 
472  FEConfigPedInfo fe_ped_info;
473  fe_ped_info.setId(ped_conf_id_);
474  db_-> fetchConfigSet(&fe_ped_info);
475  std::map<EcalLogicID, FEConfigPedDat> dataset_TpgPed;
476  db_->fetchDataSet(&dataset_TpgPed, &fe_ped_info);
477 
478  typedef std::map<EcalLogicID, FEConfigPedDat>::const_iterator CIfeped;
479  EcalLogicID ecid_xt;
480  FEConfigPedDat rd_ped;
481  int icells=0;
482  for (CIfeped p = dataset_TpgPed.begin(); p != dataset_TpgPed.end(); ++p)
483  {
484  ecid_xt = p->first;
485  rd_ped = p->second;
486 
487  std::string ecid_name=ecid_xt.getName();
488 
489  // EB data
490  if (ecid_name=="EB_crystal_number") {
491 
492 
493  int sm_num=ecid_xt.getID1();
494  int xt_num=ecid_xt.getID2();
495 
496  EBDetId ebdetid(sm_num,xt_num,EBDetId::SMCRYSTALMODE);
497  EcalPedestals::Item item;
498  item.mean_x1 =rd_ped.getPedMeanG1() ;
499  item.mean_x6 =rd_ped.getPedMeanG6();
500  item.mean_x12 =rd_ped.getPedMeanG12();
501  item.rms_x1 =0.5 ;
502  item.rms_x6 =1. ;
503  item.rms_x12 =1.2 ;
504 
505  if(icells<10) std::cout << " copy the EB data " << " ped = " << item.mean_x12<< std::endl;
506 
507  peds.insert(std::make_pair(ebdetid.rawId(),item));
508 
509  ++icells;
510  }else if (ecid_name=="EE_crystal_number"){
511 
512  // EE data
513  int z=ecid_xt.getID1();
514  int x=ecid_xt.getID2();
515  int y=ecid_xt.getID3();
516  EEDetId eedetid(x,y,z,EEDetId::XYMODE);
517  EcalPedestals::Item item;
518  item.mean_x1 =rd_ped.getPedMeanG1() ;
519  item.mean_x6 =rd_ped.getPedMeanG6();
520  item.mean_x12 =rd_ped.getPedMeanG12();
521  item.rms_x1 =0.5 ;
522  item.rms_x6 =1. ;
523  item.rms_x12 =1.2 ;
524 
525  peds.insert(std::make_pair(eedetid.rawId(),item));
526  ++icells;
527  }
528  }
529 
530  pedMap = peds.getMap() ;
531 
532  EcalPedestalsMapIterator pedIter ;
533  int nPed = 0 ;
534  for (pedIter = pedMap.begin() ; pedIter != pedMap.end() && nPed<10 ; ++pedIter, nPed++) {
535  EcalPedestals::Item aped = (*pedIter);
536  std::cout<<aped.mean_x12<<", "<<aped.mean_x6<<", "<<aped.mean_x1<<std::endl ;
537  }
538 
539 
540  } catch (exception &e) {
541  cout << " error reading previous pedestals " << endl;
542  } catch (...) {
543  cout << "Unknown error reading previous pedestals " << endl;
544  }
545 
546 
547 
548 
549  } else if(m_write_ped >1) {
550  std::cout <<"Getting the pedestals from configuration number"<< m_write_ped <<std::endl;
551 
552 
553 
554  EcalPedestals peds ;
555 
556  try {
557 
558  FEConfigPedInfo fe_ped_info;
559  fe_ped_info.setId(m_write_ped);
560  db_-> fetchConfigSet(&fe_ped_info);
561  std::map<EcalLogicID, FEConfigPedDat> dataset_TpgPed;
562  db_->fetchDataSet(&dataset_TpgPed, &fe_ped_info);
563 
564  typedef std::map<EcalLogicID, FEConfigPedDat>::const_iterator CIfeped;
565  EcalLogicID ecid_xt;
566  FEConfigPedDat rd_ped;
567  int icells=0;
568  for (CIfeped p = dataset_TpgPed.begin(); p != dataset_TpgPed.end(); ++p)
569  {
570  ecid_xt = p->first;
571  rd_ped = p->second;
572 
573  std::string ecid_name=ecid_xt.getName();
574 
575  // EB data
576  if (ecid_name=="EB_crystal_number") {
577  if(icells<10) std::cout << " copy the EB data " << " icells = " << icells << std::endl;
578  int sm_num=ecid_xt.getID1();
579  int xt_num=ecid_xt.getID2();
580 
581  EBDetId ebdetid(sm_num,xt_num,EBDetId::SMCRYSTALMODE);
582  EcalPedestals::Item item;
583  item.mean_x1 =(unsigned int)rd_ped.getPedMeanG1() ;
584  item.mean_x6 =(unsigned int)rd_ped.getPedMeanG6();
585  item.mean_x12 =(unsigned int)rd_ped.getPedMeanG12();
586  item.rms_x1 =0.5 ;
587  item.rms_x6 =1. ;
588  item.rms_x12 =1.2 ;
589 
590  peds.insert(std::make_pair(ebdetid.rawId(),item));
591  ++icells;
592  }else if (ecid_name=="EE_crystal_number"){
593 
594  // EE data
595  int z=ecid_xt.getID1();
596  int x=ecid_xt.getID2();
597  int y=ecid_xt.getID3();
598  EEDetId eedetid(x,y,z,EEDetId::XYMODE);
599  EcalPedestals::Item item;
600  item.mean_x1 =(unsigned int)rd_ped.getPedMeanG1();
601  item.mean_x6 =(unsigned int)rd_ped.getPedMeanG6();
602  item.mean_x12 =(unsigned int)rd_ped.getPedMeanG12();
603  item.rms_x1 =0.5 ;
604  item.rms_x6 =1. ;
605  item.rms_x12 =1.2 ;
606 
607  peds.insert(std::make_pair(eedetid.rawId(),item));
608  ++icells;
609  }
610  }
611 
612  pedMap = peds.getMap() ;
613 
614  EcalPedestalsMapIterator pedIter ;
615  int nPed = 0 ;
616  for (pedIter = pedMap.begin() ; pedIter != pedMap.end() && nPed<10 ; ++pedIter, nPed++) {
617  EcalPedestals::Item aped = (*pedIter);
618  std::cout<<aped.mean_x12<<", "<<aped.mean_x6<<", "<<aped.mean_x1<<std::endl ;
619  }
620 
621 
622  } catch (exception &e) {
623  cout << " error reading previous pedestals " << endl;
624  } catch (...) {
625  cout << "Unknown error reading previous pedestals " << endl;
626  }
627 
628 
629  }
630 
631 
632 
633  std::cout<<"...\n"<<std::endl ;
634 
635 
636  // Intercalib constants
637  std::cout <<"Getting intercalib from offline DB..."<<endl;
639  evtSetup.get<EcalIntercalibConstantsRcd>().get(pIntercalib) ;
640  const EcalIntercalibConstants * intercalib = pIntercalib.product() ;
641  const EcalIntercalibConstantMap & calibMap = intercalib->getMap() ;
643  int nCal = 0 ;
644  for (calIter = calibMap.begin() ; calIter != calibMap.end() && nCal<10 ; ++calIter, nCal++) {
645  std::cout<<(*calIter)<<std::endl ;
646  }
647  std::cout<<"...\n"<<std::endl ;
648  float calibvec[1700] ;
649  if (H2_) {
650  std::cout<<"H2: overwriting IC coef with file"<<std::endl ;
651  std::ifstream calibfile("calib_sm36.txt", std::ios::out) ;
652  int idata, icry ;
653  float fdata, fcali ;
654  std::string strdata ;
655  if (calibfile.is_open()) {
656  calibfile >> strdata >> strdata >> strdata >> strdata >> strdata ;
657  while(!calibfile.eof()) {
658  calibfile >> idata >> icry >> fcali >> fdata >> fdata ;
659  calibvec[icry-1] = fcali ;
660  if(calibfile.eof()){
661  break ; // avoid last line duplication
662  }
663  }
664  }
665  }
666 
667  // Gain Ratios
668  std::cout <<"Getting the gain ratios from offline DB..."<<endl;
670  evtSetup.get<EcalGainRatiosRcd>().get(pRatio);
671  const EcalGainRatioMap & gainMap = pRatio.product()->getMap();
673  int nGain = 0 ;
674  for (gainIter = gainMap.begin() ; gainIter != gainMap.end() && nGain<10 ; ++gainIter, nGain++) {
675  const EcalMGPAGainRatio & aGain = (*gainIter) ;
676  std::cout<<aGain.gain12Over6()<<", "<<aGain.gain6Over1() * aGain.gain12Over6()<<std::endl ;
677  }
678  std::cout<<"...\n"<<std::endl ;
679 
680 
681  // ADCtoGeV
682  std::cout <<"Getting the ADC to GEV from offline DB..."<<endl;
684  evtSetup.get<EcalADCToGeVConstantRcd>().get(pADCToGeV) ;
685  const EcalADCToGeVConstant * ADCToGeV = pADCToGeV.product() ;
686  xtal_LSB_EB_ = ADCToGeV->getEBValue() ;
687  xtal_LSB_EE_ = ADCToGeV->getEEValue() ;
688  std::cout<<"xtal_LSB_EB_ = "<<xtal_LSB_EB_<<std::endl ;
689  std::cout<<"xtal_LSB_EE_ = "<<xtal_LSB_EE_<<std::endl ;
690  std::cout<<std::endl ;
691 
692 
693  vector<EcalLogicID> my_EcalLogicId;
694  vector<EcalLogicID> my_TTEcalLogicId;
695  vector<EcalLogicID> my_StripEcalLogicId;
696  EcalLogicID my_EcalLogicId_EB;
697  // Endcap identifiers
698  EcalLogicID my_EcalLogicId_EE;
699  vector<EcalLogicID> my_TTEcalLogicId_EE;
700  vector<EcalLogicID> my_RTEcalLogicId_EE;
701  vector<EcalLogicID> my_StripEcalLogicId1_EE;
702  vector<EcalLogicID> my_StripEcalLogicId2_EE;
703  vector<EcalLogicID> my_CrystalEcalLogicId_EE;
704  vector<EcalLogicID> my_TTEcalLogicId_EB_by_TCC;
705  vector<EcalLogicID> my_StripEcalLogicId_EE_strips_by_TCC;
706 
707 
708  std::cout<<"going to get the ecal logic id set"<< endl;
711  my_EcalLogicId = db_->getEcalLogicIDSetOrdered( "EB_crystal_number",
712  1, 36,
713  1, 1700,
715  "EB_crystal_number",12 );
716  my_TTEcalLogicId = db_->getEcalLogicIDSetOrdered( "EB_trigger_tower",
717  1, 36,
718  1, 68,
720  "EB_trigger_tower",12 );
721  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
722  std::cout<<"got the 3 ecal barrel logic id set"<< endl;
723 
724  // EE crystals identifiers
725  my_CrystalEcalLogicId_EE = db_->getEcalLogicIDSetOrdered("EE_crystal_number",
726  -1, 1,
727  0, 200,
728  0, 200,
729  "EE_crystal_number",123 );
730 
731  // EE Strip identifiers
732  // DCC=601-609 TT = ~40 EEstrip = 5
733  my_StripEcalLogicId1_EE = db_->getEcalLogicIDSetOrdered( "ECAL_readout_strip",
734  601, 609,
735  1, 100,
736  0,5 ,
737  "ECAL_readout_strip",123 );
738  // EE Strip identifiers
739  // DCC=646-654 TT = ~40 EEstrip = 5
740  my_StripEcalLogicId2_EE = db_->getEcalLogicIDSetOrdered( "ECAL_readout_strip",
741  646, 654,
742  1, 100,
743  0,5 ,
744  "ECAL_readout_strip",123 );
745  // ----> modif here 31/1/2011
746  // EE Strip identifiers by TCC tower strip
747  // TCC=1-108 TT = ~40 EEstrip = 1-5
748  my_StripEcalLogicId_EE_strips_by_TCC = db_->getEcalLogicIDSetOrdered( "EE_trigger_strip",
749  1, 108,
750  1, 100,
751  1,5 ,
752  "EE_trigger_strip",123 );
753 
754 
755  // ----> modif here 31/1/2011
756  // ECAL Barrel trigger towers by TCC/tower identifiers
757  // TTC=38-72 TT = 1-68
758  my_TTEcalLogicId_EB_by_TCC = db_->getEcalLogicIDSetOrdered( "ECAL_trigger_tower",
759  1, 108,
760  1, 68,
762  "ECAL_trigger_tower",12 );
763 
764  // EE TT identifiers
765  // TTC=72 TT = 1440
766  my_TTEcalLogicId_EE = db_->getEcalLogicIDSetOrdered( "EE_trigger_tower",
767  1, 108,
768  1, 40,
770  "EE_trigger_tower",12 );
771 
772  // EE TT identifiers
773  // TTC=72 TT = 1440
774  my_RTEcalLogicId_EE = db_->getEcalLogicIDSetOrdered( "EE_readout_tower",
775  1, 1000,
776  1, 100,
778  "EE_readout_tower",12 );
779 
780  std::cout<<"got the end cap logic id set"<< endl;
781 
782  if (writeToDB_) {
783  std::cout<<"Getting the latest ids for this tag (latest version) "<< endl;
784 
785  FEConfigMainInfo fe_main_info;
786  fe_main_info.setConfigTag(tag_);
787  try {
788  std::cout << "trying to read previous tag if it exists tag="<< tag_<< ".version"<<version_<< endl;
789 
790  db_-> fetchConfigSet(&fe_main_info);
791  if(fe_main_info.getPedId()>0 && ped_conf_id_ ==0 ) ped_conf_id_=fe_main_info.getPedId();
792  lin_conf_id_=fe_main_info.getLinId();
793  lut_conf_id_=fe_main_info.getLUTId();
794  wei_conf_id_=fe_main_info.getWeiId();
795  fgr_conf_id_=fe_main_info.getFgrId();
796  sli_conf_id_=fe_main_info.getSliId();
797  spi_conf_id_=fe_main_info.getSpiId(); //modif-alex 21/01/11
798  del_conf_id_=fe_main_info.getTimId(); //modif-alex 21/01/11
799  if(fe_main_info.getBxtId()>0 && bxt_conf_id_==0 ) bxt_conf_id_=fe_main_info.getBxtId();
800  if(fe_main_info.getBttId()>0 && btt_conf_id_==0 ) btt_conf_id_=fe_main_info.getBttId();
801  if(fe_main_info.getBstId()>0 && bst_conf_id_==0 ) bst_conf_id_=fe_main_info.getBstId();
802  // those that are not written specifically in this program are propagated
803  // from the previous record with the same tag and the highest version
804 
805  std::cout<<"got it "<< endl;
806 
807  } catch (exception &e) {
808  cout << " tag did not exist a new tag will be created " << endl;
809  } catch (...) {
810  cout << "Unknown error caught" << endl;
811  }
812 
813  }
814 
816  // Compute linearization coeff section //
818 
819  map<EcalLogicID, FEConfigPedDat> pedset ;
820  map<EcalLogicID, FEConfigLinDat> linset ;
821  map<EcalLogicID, FEConfigLinParamDat> linparamset ;
822  map<EcalLogicID, FEConfigLUTParamDat> lutparamset ;
823  map<EcalLogicID, FEConfigFgrParamDat> fgrparamset ;
824 
825  map<int, linStruc> linEtaSlice ;
826  map< vector<int>, linStruc > linMap ;
827 
828  // count number of strip per tower
829  int NbOfStripPerTCC[108][68] ;
830  for (int i=0 ; i<108 ; i++)
831  for (int j=0 ; j<68 ; j++)
832  NbOfStripPerTCC[i][j] = 0 ;
833  const std::vector<DetId> & ebCells = theBarrelGeometry_->getValidDetIds(DetId::Ecal, EcalBarrel);
834  const std::vector<DetId> & eeCells = theEndcapGeometry_->getValidDetIds(DetId::Ecal, EcalEndcap);
835  for (vector<DetId>::const_iterator it = ebCells.begin(); it != ebCells.end(); ++it) {
836  EBDetId id(*it) ;
837  const EcalTrigTowerDetId towid= id.tower();
839  int tccNb = theMapping_->TCCid(towid) ;
840  int towerInTCC = theMapping_->iTT(towid) ;
841  int stripInTower = elId.pseudoStripId() ;
842  if (stripInTower>NbOfStripPerTCC[tccNb-1][towerInTCC-1]) NbOfStripPerTCC[tccNb-1][towerInTCC-1] = stripInTower ;
843  }
844  for (vector<DetId>::const_iterator it = eeCells.begin(); it != eeCells.end(); ++it) {
845  EEDetId id(*it) ;
846  const EcalTrigTowerDetId towid= (*eTTmap_).towerOf(id) ;
848  int tccNb = theMapping_->TCCid(towid) ;
849  int towerInTCC = theMapping_->iTT(towid) ;
850  int stripInTower = elId.pseudoStripId() ;
851  if (stripInTower>NbOfStripPerTCC[tccNb-1][towerInTCC-1]) NbOfStripPerTCC[tccNb-1][towerInTCC-1] = stripInTower ;
852  }
853 
854 
855 
856  // loop on EB xtals
857  if (writeToFiles_) (*out_file_)<<"COMMENT ====== barrel crystals ====== "<<std::endl ;
858 
859  // special case of eta slices
860  for (vector<DetId>::const_iterator it = ebCells.begin(); it != ebCells.end(); ++it) {
861  EBDetId id(*it) ;
863  if (!useTransverseEnergy_) theta = acos(0.) ;
864  const EcalTrigTowerDetId towid= id.tower();
866  int dccNb = theMapping_->DCCid(towid) ;
867  int tccNb = theMapping_->TCCid(towid) ;
868  int towerInTCC = theMapping_->iTT(towid) ; // from 1 to 68 (EB)
869  int stripInTower = elId.pseudoStripId() ; // from 1 to 5
870  int xtalInStrip = elId.channelId() ; // from 1 to 5
872  int CCUid = Id.towerId() ;
873  int VFEid = Id.stripId() ;
874  int xtalInVFE = Id.xtalId() ;
875  int xtalWithinCCUid = 5*(VFEid-1) + xtalInVFE -1 ; // Evgueni expects [0,24]
876 
877  (*geomFile_)<<"dccNb = "<<dccNb<<" tccNb = "<<tccNb<<" towerInTCC = "<<towerInTCC
878  <<" stripInTower = "<<stripInTower<<" xtalInStrip = "<<xtalInStrip
879  <<" CCUid = "<<CCUid<<" VFEid = "<<VFEid<<" xtalInVFE = "<<xtalInVFE
880  <<" xtalWithinCCUid = "<<xtalWithinCCUid<<" ieta = "<<id.ieta()<<" iphi = "<<id.iphi()
881  <<" xtalhashedId = "<<id.hashedIndex()<<" xtalNb = "<<id.ic()
882  <<" ietaTT = "<<towid.ieta()<<" iphiTT = "<<towid.iphi()<<endl ;
883 
884  int TCCch = towerInTCC ;
885  int SLBslot = int((towerInTCC-1)/8.) + 1 ;
886  int SLBch = (towerInTCC-1)%8 + 1 ;
887  int cmsswId = id.rawId() ;
888  int ixtal=(id.ism()-1)*1700+(id.ic()-1);
889  EcalLogicID logicId =my_EcalLogicId[ixtal];
890  int dbId = logicId.getLogicID() ;
891  int val[] = {dccNb+600,tccNb,towerInTCC,stripInTower,
892  xtalInStrip,CCUid,VFEid,xtalInVFE,xtalWithinCCUid,id.ieta(),id.iphi(),
893  -999,-999,towid.ieta()/abs(towid.ieta()),id.hashedIndex(),
894  id.ic(), cmsswId, dbId,
895  towid.ieta(),towid.iphi(), TCCch, getCrate(tccNb).second, SLBch, SLBslot,
896  getGCTRegionEta(towid.ieta()),getGCTRegionPhi(towid.iphi())} ;
897  for (int i=0 ; i<26 ; i++) ntupleInts_[i] = val[i] ;
898 
899  strcpy(ntupleDet_,getDet(tccNb).c_str()) ;
900  strcpy(ntupleCrate_,getCrate(tccNb).first.c_str()) ;
901  ntuple->Fill() ;
902 
903 
904  if (tccNb == 37 && stripInTower == 3 && xtalInStrip == 3 && (towerInTCC-1)%4==0) {
905  int etaSlice = towid.ietaAbs() ;
906  coeffStruc coeff ;
907  getCoeff(coeff, calibMap, id.rawId()) ;
908  getCoeff(coeff, gainMap, id.rawId()) ;
909  getCoeff(coeff, pedMap, id.rawId()) ;
910  linStruc lin ;
911  for (int i=0 ; i<3 ; i++) {
912  int mult, shift ;
913  bool ok = computeLinearizerParam(theta, coeff.gainRatio_[i], coeff.calibCoeff_, "EB", mult , shift) ;
914  if (!ok) std::cout << "unable to compute the parameters for SM="<< id.ism()<<" xt="<< id.ic()<<" " <<dec<<id.rawId()<<std::endl ;
915  else {
916  lin.pedestal_[i] = coeff.pedestals_[i] ;
917  lin.mult_[i] = mult ;
918  lin.shift_[i] = shift ;
919  }
920  }
921 
922  bool ok(true) ;
923  if (forcedPedestalValue_ == -2) ok = realignBaseline(lin, 0) ;
924  if (!ok) std::cout<<"SM="<< id.ism()<<" xt="<< id.ic()<<" " <<dec<<id.rawId()<<std::endl ;
925  linEtaSlice[etaSlice] = lin ;
926  }
927  }
928 
929  // general case
930  for (vector<DetId>::const_iterator it = ebCells.begin(); it != ebCells.end(); ++it) {
931  EBDetId id(*it) ;
932  double theta = theBarrelGeometry_->getGeometry(id)->getPosition().theta() ;
933  if (!useTransverseEnergy_) theta = acos(0.) ;
934  const EcalTrigTowerDetId towid= id.tower();
935  towerListEB.push_back(towid.rawId()) ;
937  stripListEB.push_back(elId.rawId() & 0xfffffff8) ;
938  int dccNb = theMapping_->DCCid(towid) ;
939  //int tccNb = theMapping_->TCCid(towid) ;
940  int towerInTCC = theMapping_->iTT(towid) ; // from 1 to 68 (EB)
941  //int stripInTower = elId.pseudoStripId() ; // from 1 to 5
942  //int xtalInStrip = elId.channelId() ; // from 1 to 5
944  int CCUid = Id.towerId() ;
945  int VFEid = Id.stripId() ;
946  int xtalInVFE = Id.xtalId() ;
947  int xtalWithinCCUid = 5*(VFEid-1) + xtalInVFE -1 ; // Evgueni expects [0,24]
948  int etaSlice = towid.ietaAbs() ;
949 
950  // hashed index of strip EcalLogicID:
951  int hashedStripLogicID = 68*5*(id.ism()-1) + 5*(towerInTCC-1) + (VFEid-1) ;
952  stripMapEB[hashedStripLogicID] = elId.rawId() & 0xfffffff8 ;
953  stripMapEBsintheta[elId.rawId() & 0xfffffff8] = SFGVB_Threshold_ + abs(int(sin(theta)*pedestal_offset_)) ;
954 
955  //modif-debug
956  /*
957  FEConfigFgrEEStripDat stripdebug;
958  EcalLogicID thestrip_debug = my_StripEcalLogicId[hashedStripLogicID] ;
959  if(towid.ieta() == 6 && towid.iphi() == 7){
960  std::cout << "xtal info=" << id << " VFE=" << VFEid << std::endl;
961  std::cout << "TOWER DEBUG ieta=" << towid.ieta() << " iphi=" << towid.iphi() << " SFGVB=" << SFGVB_Threshold_ + abs(int(sin(theta)*pedestal_offset_))
962  << " dbId=" << (elId.rawId() & 0xfffffff8) << " " << hashedStripLogicID << " " << thestrip_debug.getLogicID() << std::endl; //modif-debug
963  }//EB+3 TT24
964  */
965  //std::cout<<std::dec<<SFGVB_Threshold_ + abs(int(sin(theta)*pedestal_offset_))<<" "<<SFGVB_Threshold_<<" "<<abs(int(sin(theta)*pedestal_offset_))<<std::endl ;
966 
967  FEConfigPedDat pedDB ;
968  FEConfigLinDat linDB ;
969  if (writeToFiles_) (*out_file_)<<"CRYSTAL "<<dec<<id.rawId()<<std::endl ;
970  // if (writeToDB_) logicId = db_->getEcalLogicID ("EB_crystal_number", id.ism(), id.ic()) ;
971 
972  coeffStruc coeff ;
973  getCoeff(coeff, calibMap, id.rawId()) ;
974  if (H2_) coeff.calibCoeff_ = calibvec[id.ic()-1] ;
975  getCoeff(coeff, gainMap, id.rawId()) ;
976  getCoeff(coeff, pedMap, id.rawId()) ;
977  ICEB->Fill(id.iphi(), id.ieta(), coeff.calibCoeff_) ;
979 
980  vector<int> xtalCCU ;
981  xtalCCU.push_back(dccNb+600) ;
982  xtalCCU.push_back(CCUid) ;
983  xtalCCU.push_back(xtalWithinCCUid) ;
984  xtalCCU.push_back(id.rawId()) ;
985 
986  // compute and fill linearization parameters
987  // case of eta slice
988  if (forceEtaSlice_) {
989  map<int, linStruc>::const_iterator itLin = linEtaSlice.find(etaSlice);
990  if (itLin != linEtaSlice.end()) {
991  linMap[xtalCCU] = itLin->second ;
992  if (writeToFiles_) {
993  for (int i=0 ; i<3 ; i++)
994  (*out_file_) << hex <<" 0x"<<itLin->second.pedestal_[i]<<" 0x"<<itLin->second.mult_[i]<<" 0x"<<itLin->second.shift_[i]<<std::endl;
995  }
996  if (writeToDB_) {
997  for (int i=0 ; i<3 ; i++) {
998  if (i==0) {pedDB.setPedMeanG12(itLin->second.pedestal_[i]) ; linDB.setMultX12(itLin->second.mult_[i]) ; linDB.setShift12(itLin->second.shift_[i]) ; }
999  if (i==1) {pedDB.setPedMeanG6(itLin->second.pedestal_[i]) ; linDB.setMultX6(itLin->second.mult_[i]) ; linDB.setShift6(itLin->second.shift_[i]) ; }
1000  if (i==2) {pedDB.setPedMeanG1(itLin->second.pedestal_[i]) ; linDB.setMultX1(itLin->second.mult_[i]) ; linDB.setShift1(itLin->second.shift_[i]) ; }
1001  }
1002  }
1003  float factor = float(itLin->second.mult_[0])*pow(2.,-itLin->second.shift_[0])/xtal_LSB_EB_ ;
1004  tpgFactorEB->Fill(id.iphi(), id.ieta(), factor) ;
1005  tpgFactor->Fill(theBarrelGeometry_->getGeometry(id)->getPosition().phi(),
1006  theBarrelGeometry_->getGeometry(id)->getPosition().eta(), factor) ;
1007  }
1008  else std::cout<<"current EtaSlice = "<<etaSlice<<" not found in the EtaSlice map"<<std::endl ;
1009  }
1010  else {
1011  // general case
1012  linStruc lin ;
1013  int forceBase12 = 0 ;
1014  for (int i=0 ; i<3 ; i++) {
1015  int mult, shift ;
1016  bool ok = computeLinearizerParam(theta, coeff.gainRatio_[i], coeff.calibCoeff_, "EB", mult , shift) ;
1017  if (!ok) std::cout << "unable to compute the parameters for SM="<< id.ism()<<" xt="<< id.ic()<<" " <<dec<<id.rawId()<<std::endl ;
1018  else {
1019  //PP begin
1020  // mult = 0 ; shift = 0 ;
1021  // if (CCUid==1 && xtalWithinCCUid==21) {
1022  // if (i==0) {mult = 0x80 ; shift = 0x3 ;}
1023  // if (i==1) {mult = 0x80 ; shift = 0x2 ;}
1024  // if (i==2) {mult = 0xc0 ; shift = 0x0 ;}
1025  // }
1026  //PP end
1027  double base = coeff.pedestals_[i] ;
1028  if (forcedPedestalValue_ == -3 && i==0) {
1029  double G = mult*pow(2.0,-(shift+2)) ;
1030  double g = G/sin(theta) ;
1031  // int pedestal = coeff.pedestals_[i] ;
1032  base = double(coeff.pedestals_[i]) - pedestal_offset_/g ;
1033  if (base<0.) base = 0 ;
1034  forceBase12 = int(base) ;
1035  }
1036  lin.pedestal_[i] = coeff.pedestals_[i] ;
1037  lin.mult_[i] = mult ;
1038  lin.shift_[i] = shift ;
1039 
1040 // if (xtalWithinCCUid != 14) {
1041 // forceBase12 = 0 ;
1042 // lin.pedestal_[i] = 0 ;
1043 // lin.mult_[i] = 0 ;
1044 // lin.shift_[i] = 0 ;
1045 // }
1046 
1047  }
1048  }
1049 
1050  bool ok(true) ;
1051  if (forcedPedestalValue_ == -2) ok = realignBaseline(lin, 0) ;
1052  if (forcedPedestalValue_ == -3) ok = realignBaseline(lin, forceBase12) ;
1053  if (!ok) std::cout<<"SM="<< id.ism()<<" xt="<< id.ic()<<" " <<dec<<id.rawId()<<std::endl ;
1054 
1055  for (int i=0 ; i<3 ; i++) {
1056  if (writeToFiles_) (*out_file_) << hex <<" 0x"<<lin.pedestal_[i]<<" 0x"<<lin.mult_[i]<<" 0x"<<lin.shift_[i]<<std::endl;
1057  if (writeToDB_) {
1058  if (i==0) {pedDB.setPedMeanG12(lin.pedestal_[i]) ; linDB.setMultX12(lin.mult_[i]) ; linDB.setShift12(lin.shift_[i]) ; }
1059  if (i==1) {pedDB.setPedMeanG6(lin.pedestal_[i]) ; linDB.setMultX6(lin.mult_[i]) ; linDB.setShift6(lin.shift_[i]) ; }
1060  if (i==2) {pedDB.setPedMeanG1(lin.pedestal_[i]) ; linDB.setMultX1(lin.mult_[i]) ; linDB.setShift1(lin.shift_[i]) ; }
1061  }
1062  if (i==0) {
1063  float factor = float(lin.mult_[i])*pow(2.,-lin.shift_[i])/xtal_LSB_EB_ ;
1064  tpgFactorEB->Fill(id.iphi(), id.ieta(), factor) ;
1065  tpgFactor->Fill(theBarrelGeometry_->getGeometry(id)->getPosition().phi(),
1066  theBarrelGeometry_->getGeometry(id)->getPosition().eta(), factor) ;
1067  }
1068  double G = lin.mult_[i]*pow(2.0,-(lin.shift_[i]+2)) ;
1069  double g = G/sin(theta) ;
1070  float val[] = { float(i),
1071  float(theta),
1072  float(G),
1073  float(g),
1074  float(coeff.pedestals_[i]),
1075  float(lin.pedestal_[i])};// first arg = gainId (0 means gain12)
1076  ntupleSpike->Fill(val) ;
1077  }
1078  linMap[xtalCCU] = lin ;
1079  }
1080  if (writeToDB_) {
1081  // 1700 crystals/SM in the ECAL barrel
1082  int ixtal=(id.ism()-1)*1700+(id.ic()-1);
1083  EcalLogicID logicId =my_EcalLogicId[ixtal];
1084  pedset[logicId] = pedDB ;
1085  linset[logicId] = linDB ;
1086  }
1087  } //ebCells
1088 
1089  if (writeToDB_) {
1090  // EcalLogicID of the whole barrel is: my_EcalLogicId_EB
1091  FEConfigLinParamDat linparam ;
1092  linparam.setETSat(Et_sat_EB_);
1093  linparamset[my_EcalLogicId_EB] = linparam ;
1094 
1095  FEConfigFgrParamDat fgrparam ;
1098  fgrparam.setFGlowratio(FG_lowRatio_EB_);
1099  fgrparam.setFGhighratio(FG_highRatio_EB_);
1100  fgrparamset[my_EcalLogicId_EB] = fgrparam ;
1101 
1102 
1103  FEConfigLUTParamDat lutparam ;
1104  lutparam.setETSat(Et_sat_EB_);
1107  lutparamset[my_EcalLogicId_EB] = lutparam ;
1108 
1109  }
1110 
1111 
1112  // loop on EE xtals
1113  if (writeToFiles_) (*out_file_)<<"COMMENT ====== endcap crystals ====== "<<std::endl ;
1114 
1115  // special case of eta slices
1116  for (vector<DetId>::const_iterator it = eeCells.begin(); it != eeCells.end(); ++it) {
1117  EEDetId id(*it) ;
1118  double theta = theEndcapGeometry_->getGeometry(id)->getPosition().theta() ;
1119  if (!useTransverseEnergy_) theta = acos(0.) ;
1120  const EcalTrigTowerDetId towid= (*eTTmap_).towerOf(id) ;
1123  int dccNb = Id.dccId() ;
1124  int tccNb = theMapping_->TCCid(towid) ;
1125  int towerInTCC = theMapping_->iTT(towid) ;
1126  int stripInTower = elId.pseudoStripId() ;
1127  int xtalInStrip = elId.channelId() ;
1128  int CCUid = Id.towerId() ;
1129  int VFEid = Id.stripId() ;
1130  int xtalInVFE = Id.xtalId() ;
1131  int xtalWithinCCUid = 5*(VFEid-1) + xtalInVFE -1 ; // Evgueni expects [0,24]
1132 
1133  (*geomFile_)<<"dccNb = "<<dccNb<<" tccNb = "<<tccNb<<" towerInTCC = "<<towerInTCC
1134  <<" stripInTower = "<<stripInTower<<" xtalInStrip = "<<xtalInStrip
1135  <<" CCUid = "<<CCUid<<" VFEid = "<<VFEid<<" xtalInVFE = "<<xtalInVFE
1136  <<" xtalWithinCCUid = "<<xtalWithinCCUid<<" ix = "<<id.ix()<<" iy = "<<id.iy()
1137  <<" xtalhashedId = "<<id.hashedIndex()<<" xtalNb = "<<id.isc()
1138  <<" ietaTT = "<<towid.ieta()<<" iphiTT = "<<towid.iphi()<<endl ;
1139 
1140  int TCCch = stripInTower ;
1141  int SLBslot, SLBch ;
1142  if (towerInTCC<5) {
1143  SLBslot = 1 ;
1144  SLBch = 4 + towerInTCC ;
1145  }
1146  else {
1147  SLBslot = int((towerInTCC-5)/8.) + 2 ;
1148  SLBch = (towerInTCC-5)%8 + 1 ;
1149  }
1150  for (int j=0 ; j<towerInTCC-1 ; j++) TCCch += NbOfStripPerTCC[tccNb-1][j] ;
1151 
1152  int cmsswId = id.rawId() ;
1153  EcalLogicID logicId ;
1154  int iz = id.positiveZ() ;
1155  if (iz ==0) iz = -1 ;
1156  for (int k=0; k<(int)my_CrystalEcalLogicId_EE.size(); k++) {
1157  int z= my_CrystalEcalLogicId_EE[k].getID1() ;
1158  int x= my_CrystalEcalLogicId_EE[k].getID2() ;
1159  int y= my_CrystalEcalLogicId_EE[k].getID3() ;
1160  if (id.ix()==x && id.iy()==y && iz==z) logicId=my_CrystalEcalLogicId_EE[k];
1161  }
1162  int dbId = logicId.getLogicID() ;
1163 
1164  int val[] = {dccNb+600,tccNb,towerInTCC,stripInTower,
1165  xtalInStrip,CCUid,VFEid,xtalInVFE,xtalWithinCCUid,-999,-999,
1166  id.ix(),id.iy(),towid.ieta()/abs(towid.ieta()),id.hashedIndex(),
1167  id.ic(),cmsswId, dbId,
1168  towid.ieta(),towid.iphi(),TCCch, getCrate(tccNb).second, SLBch, SLBslot,
1169  getGCTRegionEta(towid.ieta()),getGCTRegionPhi(towid.iphi())} ;
1170  for (int i=0 ; i<26 ; i++) ntupleInts_[i] = val[i] ;
1171  strcpy(ntupleDet_,getDet(tccNb).c_str()) ;
1172  strcpy(ntupleCrate_,getCrate(tccNb).first.c_str()) ;
1173  ntuple->Fill() ;
1174 
1175  if ((tccNb == 76 || tccNb == 94) && stripInTower == 1 && xtalInStrip == 3 && (towerInTCC-1)%4==0) {
1176  int etaSlice = towid.ietaAbs() ;
1177  coeffStruc coeff ;
1178  getCoeff(coeff, calibMap, id.rawId()) ;
1179  getCoeff(coeff, gainMap, id.rawId()) ;
1180  getCoeff(coeff, pedMap, id.rawId()) ;
1181  linStruc lin ;
1182  for (int i=0 ; i<3 ; i++) {
1183  int mult, shift ;
1184  bool ok = computeLinearizerParam(theta, coeff.gainRatio_[i], coeff.calibCoeff_, "EE", mult , shift) ;
1185  if (!ok) std::cout << "unable to compute the parameters for Quadrant="<< id.iquadrant()<<" xt="<< id.ic()<<" " <<dec<<id.rawId()<<std::endl ;
1186  else {
1187  lin.pedestal_[i] = coeff.pedestals_[i] ;
1188  lin.mult_[i] = mult ;
1189  lin.shift_[i] = shift ;
1190  }
1191  }
1192 
1193  bool ok(true) ;
1194  if (forcedPedestalValue_ == -2 || forcedPedestalValue_ == -3) ok = realignBaseline(lin, 0) ;
1195  if (!ok) std::cout<<"Quadrant="<< id.iquadrant()<<" xt="<< id.ic()<<" " <<dec<<id.rawId()<<std::endl ;
1196 
1197  linEtaSlice[etaSlice] = lin ;
1198  }
1199  }
1200 
1201  // general case
1202  for (vector<DetId>::const_iterator it = eeCells.begin(); it != eeCells.end(); ++it) {
1203  EEDetId id(*it);
1204  double theta = theEndcapGeometry_->getGeometry(id)->getPosition().theta() ;
1205  if (!useTransverseEnergy_) theta = acos(0.) ;
1206  const EcalTrigTowerDetId towid= (*eTTmap_).towerOf(id) ;
1209  towerListEE.push_back(towid.rawId()) ;
1210  // special case of towers in inner rings of EE
1211  if (towid.ietaAbs() == 27 || towid.ietaAbs() == 28) {
1212  EcalTrigTowerDetId additionalTower(towid.zside(), towid.subDet(), towid.ietaAbs(), towid.iphi()+1) ;
1213  towerListEE.push_back(additionalTower.rawId()) ;
1214  }
1215  stripListEE.push_back(elId.rawId() & 0xfffffff8) ;
1216  int dccNb = Id.dccId() ;
1217  //int tccNb = theMapping_->TCCid(towid) ;
1218  //int towerInTCC = theMapping_->iTT(towid) ;
1219  //int stripInTower = elId.pseudoStripId() ;
1220  //int xtalInStrip = elId.channelId() ;
1221  int CCUid = Id.towerId() ;
1222  int VFEid = Id.stripId() ;
1223  int xtalInVFE = Id.xtalId() ;
1224  int xtalWithinCCUid = 5*(VFEid-1) + xtalInVFE -1 ; // Evgueni expects [0,24]
1225  int etaSlice = towid.ietaAbs() ;
1226 
1227  EcalLogicID logicId ;
1228  FEConfigPedDat pedDB ;
1229  FEConfigLinDat linDB ;
1230  if (writeToFiles_) (*out_file_)<<"CRYSTAL "<<dec<<id.rawId()<<std::endl ;
1231  if (writeToDB_ && DBEE_) {
1232  int iz = id.positiveZ() ;
1233  if (iz ==0) iz = -1 ;
1234  for (int k=0; k<(int)my_CrystalEcalLogicId_EE.size(); k++) {
1235  int z= my_CrystalEcalLogicId_EE[k].getID1() ;
1236  int x= my_CrystalEcalLogicId_EE[k].getID2() ;
1237  int y= my_CrystalEcalLogicId_EE[k].getID3() ;
1238  if (id.ix()==x && id.iy()==y && iz==z) logicId=my_CrystalEcalLogicId_EE[k];
1239  }
1240  }
1241 
1242  coeffStruc coeff ;
1243  getCoeff(coeff, calibMap, id.rawId()) ;
1244  getCoeff(coeff, gainMap, id.rawId()) ;
1245  getCoeff(coeff, pedMap, id.rawId()) ;
1246  if (id.zside()>0) ICEEPlus->Fill(id.ix(), id.iy(), coeff.calibCoeff_) ;
1247  else ICEEMinus->Fill(id.ix(), id.iy(), coeff.calibCoeff_) ;
1249 
1250  vector<int> xtalCCU ;
1251  xtalCCU.push_back(dccNb+600) ;
1252  xtalCCU.push_back(CCUid) ;
1253  xtalCCU.push_back(xtalWithinCCUid) ;
1254  xtalCCU.push_back(id.rawId()) ;
1255 
1256  // compute and fill linearization parameters
1257  // case of eta slice
1258  if (forceEtaSlice_) {
1259  map<int, linStruc>::const_iterator itLin = linEtaSlice.find(etaSlice);
1260  if (itLin != linEtaSlice.end()) {
1261  linMap[xtalCCU] = itLin->second ;
1262  if (writeToFiles_) {
1263  for (int i=0 ; i<3 ; i++)
1264  (*out_file_) << hex <<" 0x"<<itLin->second.pedestal_[i]<<" 0x"<<itLin->second.mult_[i]<<" 0x"<<itLin->second.shift_[i]<<std::endl;
1265  }
1266  if (writeToDB_ && DBEE_) {
1267  for (int i=0 ; i<3 ; i++) {
1268  if (i==0) {pedDB.setPedMeanG12(itLin->second.pedestal_[i]) ; linDB.setMultX12(itLin->second.mult_[i]) ; linDB.setShift12(itLin->second.shift_[i]) ; }
1269  if (i==1) {pedDB.setPedMeanG6(itLin->second.pedestal_[i]) ; linDB.setMultX6(itLin->second.mult_[i]) ; linDB.setShift6(itLin->second.shift_[i]) ; }
1270  if (i==2) {pedDB.setPedMeanG1(itLin->second.pedestal_[i]) ; linDB.setMultX1(itLin->second.mult_[i]) ; linDB.setShift1(itLin->second.shift_[i]) ; }
1271  }
1272  }
1273  float factor = float(itLin->second.mult_[0])*pow(2.,-itLin->second.shift_[0])/xtal_LSB_EE_ ;
1274  if (id.zside()>0) tpgFactorEEPlus->Fill(id.ix(), id.iy(), factor) ;
1275  else tpgFactorEEMinus->Fill(id.ix(), id.iy(), factor) ;
1276  tpgFactor->Fill(theEndcapGeometry_->getGeometry(id)->getPosition().phi(),
1277  theEndcapGeometry_->getGeometry(id)->getPosition().eta(), factor) ;
1278  }
1279  else std::cout<<"current EtaSlice = "<<etaSlice<<" not found in the EtaSlice map"<<std::endl ;
1280  }
1281  else {
1282  // general case
1283  linStruc lin ;
1284  for (int i=0 ; i<3 ; i++) {
1285  int mult, shift ;
1286  bool ok = computeLinearizerParam(theta, coeff.gainRatio_[i], coeff.calibCoeff_, "EE", mult , shift) ;
1287  if (!ok) std::cout << "unable to compute the parameters for "<<dec<<id.rawId()<<std::endl ;
1288  else {
1289  lin.pedestal_[i] = coeff.pedestals_[i] ;
1290  lin.mult_[i] = mult ;
1291  lin.shift_[i] = shift ;
1292  }
1293  }
1294 
1295  bool ok(true) ;
1296  if (forcedPedestalValue_ == -2 || forcedPedestalValue_ == -3) ok = realignBaseline(lin, 0) ;
1297  if (!ok) std::cout<<"Quadrant="<< id.iquadrant()<<" xt="<< id.ic()<<" " <<dec<<id.rawId()<<std::endl ;
1298 
1299  for (int i=0 ; i<3 ; i++) {
1300  if (writeToFiles_) (*out_file_) << hex <<" 0x"<<lin.pedestal_[i]<<" 0x"<<lin.mult_[i]<<" 0x"<<lin.shift_[i]<<std::endl;
1301  if (writeToDB_ && DBEE_) {
1302  if (i==0) {pedDB.setPedMeanG12(lin.pedestal_[i]) ; linDB.setMultX12(lin.mult_[i]) ; linDB.setShift12(lin.shift_[i]) ; }
1303  if (i==1) {pedDB.setPedMeanG6(lin.pedestal_[i]) ; linDB.setMultX6(lin.mult_[i]) ; linDB.setShift6(lin.shift_[i]) ; }
1304  if (i==2) {pedDB.setPedMeanG1(lin.pedestal_[i]) ; linDB.setMultX1(lin.mult_[i]) ; linDB.setShift1(lin.shift_[i]) ; }
1305  }
1306  if (i==0) {
1307  float factor = float(lin.mult_[i])*pow(2.,-lin.shift_[i])/xtal_LSB_EE_ ;
1308  if (id.zside()>0) tpgFactorEEPlus->Fill(id.ix(), id.iy(), factor) ;
1309  else tpgFactorEEMinus->Fill(id.ix(), id.iy(), factor) ;
1310  tpgFactor->Fill(theEndcapGeometry_->getGeometry(id)->getPosition().phi(),
1311  theEndcapGeometry_->getGeometry(id)->getPosition().eta(), factor) ;
1312  }
1313  }
1314  linMap[xtalCCU] = lin ;
1315  }
1316  if (writeToDB_ && DBEE_) {
1317  pedset[logicId] = pedDB ;
1318  linset[logicId] = linDB ;
1319  }
1320  } //eeCells
1321 
1322  if (writeToDB_ ) {
1323  // EcalLogicID of the whole barrel is: my_EcalLogicId_EB
1324  FEConfigLinParamDat linparam ;
1325  linparam.setETSat(Et_sat_EE_);
1326  linparamset[my_EcalLogicId_EE] = linparam ;
1327 
1328  FEConfigLUTParamDat lutparam ;
1329  lutparam.setETSat(Et_sat_EE_);
1332  lutparamset[my_EcalLogicId_EE] = lutparam ;
1333 
1334 
1335  FEConfigFgrParamDat fgrparam ;
1336  fgrparam.setFGlowthresh(FG_Threshold_EE_);
1337  fgrparam.setFGhighthresh(FG_Threshold_EE_);
1338  fgrparamset[my_EcalLogicId_EE] = fgrparam ;
1339 
1340  }
1341 
1342  if (writeToDB_) {
1343 
1344  ostringstream ltag;
1345  ltag.str("EB_"); ltag<<Et_sat_EB_<<"_EE_"<<Et_sat_EE_;
1346  std::string lin_tag=ltag.str();
1347  std::cout<< " LIN tag "<<lin_tag<<endl;
1348 
1349  if(m_write_ped==1) {
1350  ped_conf_id_=db_->writeToConfDB_TPGPedestals(pedset, 1, "from_OfflineDB") ;
1351  } else {
1352  std::cout<< "the ped id ="<<ped_conf_id_<<" will be used for the pedestals "<<std::endl;
1353  }
1354 
1355  if(m_write_lin==1) lin_conf_id_=db_->writeToConfDB_TPGLinearCoef(linset,linparamset, 1, lin_tag) ;
1356  }
1357 
1359  // Evgueni interface
1361  std::ofstream evgueni("TPG_hardcoded.hh", std::ios::out) ;
1362  evgueni<<"void getLinParamTPG_hardcoded(int fed, int ccu, int xtal,"<<endl ;
1363  evgueni<<" int & mult12, int & shift12, int & base12,"<<endl ;
1364  evgueni<<" int & mult6, int & shift6, int & base6,"<<endl ;
1365  evgueni<<" int & mult1, int & shift1, int & base1)"<<endl ;
1366  evgueni<<"{"<<endl;
1367  evgueni<<" mult12 = 0 ; shift12 = 0 ; base12 = 0 ; mult6 = 0 ; shift6 = 0 ; base6 = 0 ; mult1 = 0 ; shift1 = 0 ; base1 = 0 ;"<<endl ;
1368  map< vector<int>, linStruc>::const_iterator itLinMap ;
1369  for (itLinMap = linMap.begin() ; itLinMap != linMap.end() ; ++itLinMap) {
1370  vector<int> xtalInCCU = itLinMap->first ;
1371  evgueni<<" if (fed=="<<xtalInCCU[0]<<" && ccu=="<<xtalInCCU[1]<<" && xtal=="<<xtalInCCU[2]<<") {" ;
1372  evgueni<<" mult12 = "<<itLinMap->second.mult_[0]<<" ; shift12 = "<<itLinMap->second.shift_[0]<<" ; base12 = "<<itLinMap->second.pedestal_[0]<<" ; " ;
1373  evgueni<<" mult6 = "<<itLinMap->second.mult_[1]<<" ; shift6 = "<<itLinMap->second.shift_[1]<<" ; base6 = "<<itLinMap->second.pedestal_[1]<<" ; " ;
1374  evgueni<<" mult1 = "<<itLinMap->second.mult_[2]<<" ; shift1 = "<<itLinMap->second.shift_[2]<<" ; base1 = "<<itLinMap->second.pedestal_[2]<<" ; " ;
1375  evgueni<<" return ;}" <<endl ;
1376  }
1377  evgueni<<"}" <<endl ;
1378  evgueni.close() ;
1379 
1380 
1381 
1383  // Compute weights section //
1385 
1386  const int NWEIGROUPS = 2 ;
1387  std::vector<unsigned int> weights[NWEIGROUPS] ;
1388 
1389  EBShape shapeEB ;
1390  EEShape shapeEE ;
1391  weights[0] = computeWeights(shapeEB, hshapeEB) ;
1392  weights[1] = computeWeights(shapeEE, hshapeEE) ;
1393 
1394  map<EcalLogicID, FEConfigWeightGroupDat> dataset;
1395 
1396  for (int igrp=0 ; igrp<NWEIGROUPS ; igrp++) {
1397 
1398  if (weights[igrp].size() == 5) {
1399 
1400  if (writeToFiles_) {
1401  (*out_file_) <<std::endl ;
1402  (*out_file_) <<"WEIGHT "<<igrp<<endl ;
1403  for (unsigned int sample=0 ; sample<5 ; sample++) (*out_file_) << "0x" <<hex<<weights[igrp][sample]<<" " ;
1404  (*out_file_)<<std::endl ;
1405  (*out_file_) <<std::endl ;
1406  }
1407  if (writeToDB_) {
1408  std::cout<<"going to write the weights for groupe:"<<igrp<<endl;
1410  gut.setWeightGroupId(igrp);
1411  //PP WARNING: weights order is reverted when stored in the DB
1412  gut.setWeight0(weights[igrp][4] );
1413  gut.setWeight1(weights[igrp][3]+ 0x80); //0x80 to identify the max of the pulse in the FENIX (doesn't exist in emulator)
1414  gut.setWeight2(weights[igrp][2] );
1415  gut.setWeight3(weights[igrp][1] );
1416  gut.setWeight4(weights[igrp][0] );
1417  EcalLogicID ecid = EcalLogicID( "DUMMY", igrp,igrp); //1 dummy ID per group
1418  // Fill the dataset
1419  dataset[ecid] = gut;
1420  }
1421  }
1422  }
1423 
1424  if (writeToDB_) {
1425 
1426  // now we store in the DB the correspondence btw channels and groups
1427  map<EcalLogicID, FEConfigWeightDat> dataset2;
1428 
1429  // EB loop
1430  for (int ich=0; ich<(int)my_StripEcalLogicId.size() ; ich++){
1431  FEConfigWeightDat wut;
1432  int igroup = 0; // this group is for EB
1433  wut.setWeightGroupId(igroup);
1434  dataset2[my_StripEcalLogicId[ich]] = wut;
1435  }
1436 
1437  // EE loop
1438  for (int ich=0; ich<(int)my_StripEcalLogicId1_EE.size() ; ich++){
1439  FEConfigWeightDat wut;
1440  int igroup = 1; // this group is for EE
1441  wut.setWeightGroupId(igroup);
1442  // Fill the dataset
1443  dataset2[my_StripEcalLogicId1_EE[ich]] = wut;
1444  }
1445  // EE loop 2 (we had to split the ids of EE in 2 vectors to avoid crash!)
1446  for (int ich=0; ich<(int)my_StripEcalLogicId2_EE.size() ; ich++){
1447  FEConfigWeightDat wut;
1448  int igroup = 1; // this group is for EE
1449  wut.setWeightGroupId(igroup);
1450  // Fill the dataset
1451  dataset2[my_StripEcalLogicId2_EE[ich]] = wut;
1452  }
1453 
1454  // Insert the datasets
1455  ostringstream wtag;
1456  wtag.str(""); wtag<<"Shape_NGroups_"<<NWEIGROUPS;
1457  std::string weight_tag=wtag.str();
1458  std::cout<< " weight tag "<<weight_tag<<endl;
1459  if (m_write_wei==1) wei_conf_id_=db_->writeToConfDB_TPGWeight(dataset, dataset2, NWEIGROUPS, weight_tag) ;
1460  }
1461 
1462 
1464  // Compute FG section //
1466 
1467  // barrel
1468  unsigned int lowRatio, highRatio, lowThreshold, highThreshold, lutFG ;
1469  computeFineGrainEBParameters(lowRatio, highRatio, lowThreshold, highThreshold, lutFG) ;
1470  if (writeToFiles_) {
1471  (*out_file_) <<std::endl ;
1472  (*out_file_) <<"FG 0"<<std::endl ;
1473  (*out_file_)<<hex<<"0x"<<lowThreshold<<" 0x"<<highThreshold
1474  <<" 0x"<<lowRatio<<" 0x"<<highRatio<<" 0x"<<lutFG
1475  <<std::endl ;
1476  }
1477 
1478  // endcap
1479  unsigned int threshold, lut_tower ;
1480  unsigned int lut_strip;
1481  computeFineGrainEEParameters(threshold, lut_strip, lut_tower) ;
1482 
1483  // and here we store the fgr part
1484 
1485 
1486  if (writeToDB_) {
1487  std::cout<<"going to write the fgr "<< endl;
1488  map<EcalLogicID, FEConfigFgrGroupDat> dataset;
1489  // we create 1 group
1490  int NFGRGROUPS =1;
1491  for (int ich=0; ich<NFGRGROUPS; ich++){
1492  FEConfigFgrGroupDat gut;
1493  gut.setFgrGroupId(ich);
1494  gut.setThreshLow(lowRatio );
1495  gut.setThreshHigh(highRatio);
1496  gut.setRatioLow(lowThreshold);
1497  gut.setRatioHigh(highThreshold);
1498  gut.setLUTValue(lutFG);
1499  EcalLogicID ecid = EcalLogicID( "DUMMY", ich,ich);
1500  // Fill the dataset
1501  dataset[ecid] = gut; // we use any logic id but different, because it is in any case ignored...
1502  }
1503 
1504  // now we store in the DB the correspondence btw channels and groups
1505  map<EcalLogicID, FEConfigFgrDat> dataset2;
1506  // in this case I decide in a stupid way which channel belongs to which group
1507  for (int ich=0; ich<(int)my_TTEcalLogicId.size() ; ich++){
1508  FEConfigFgrDat wut;
1509  int igroup=0;
1510  wut.setFgrGroupId(igroup);
1511  // Fill the dataset
1512  // the logic ids are ordered by SM (1,...36) and TT (1,...68)
1513  // you have to calculate the right index here
1514  dataset2[my_TTEcalLogicId[ich]] = wut;
1515  }
1516 
1517  // endcap loop
1518  for (int ich=0; ich<(int)my_RTEcalLogicId_EE.size() ; ich++){
1519  // std::cout << " endcap FGR " << std::endl;
1520  FEConfigFgrDat wut;
1521  int igroup=0;
1522  wut.setFgrGroupId(igroup);
1523  // Fill the dataset
1524  // the logic ids are ordered by .... ?
1525  // you have to calculate the right index here
1526  dataset2[my_RTEcalLogicId_EE[ich]] = wut;
1527  }
1528 
1529  // endcap TT loop for the FEfgr EE Tower
1530  map<EcalLogicID, FEConfigFgrEETowerDat> dataset3;
1531  for (int ich=0; ich<(int)my_TTEcalLogicId_EE.size() ; ich++){
1532  FEConfigFgrEETowerDat fgreett;
1533  fgreett.setLutValue(lut_tower);
1534  dataset3[my_TTEcalLogicId_EE[ich]]=fgreett;
1535  }
1536 
1537  // endcap strip loop for the FEfgr EE strip
1538  // and barrel strip loop for the spike parameters (same structure than EE FGr)
1539  map<EcalLogicID, FEConfigFgrEEStripDat> dataset4;
1540  for (int ich=0; ich<(int)my_StripEcalLogicId1_EE.size() ; ich++){
1542  zut.setThreshold(threshold);
1543  zut.setLutFgr(lut_strip);
1544  dataset4[my_StripEcalLogicId1_EE[ich]] = zut;
1545  }
1546  for (int ich=0; ich<(int)my_StripEcalLogicId2_EE.size() ; ich++){
1548  zut.setThreshold(threshold);
1549  zut.setLutFgr(lut_strip);
1550  // Fill the dataset
1551  dataset4[my_StripEcalLogicId2_EE[ich]] = zut;
1552  }
1553  for (int ich=0; ich<(int)my_StripEcalLogicId.size() ; ich++){
1554  // EB
1556  EcalLogicID thestrip = my_StripEcalLogicId[ich] ;
1557  uint32_t elStripId = stripMapEB[ich] ;
1558  map<uint32_t, uint32_t>::const_iterator it = stripMapEBsintheta.find(elStripId) ;
1559  if (it != stripMapEBsintheta.end()) zut.setThreshold(it->second);
1560  else {
1561  cout<<"ERROR: strip SFGVB threshold parameter not found for that strip:"<<thestrip.getID1()<<" "<<thestrip.getID3()<<" "<<thestrip.getID3()<<endl ;
1562  cout<<" using value = "<<SFGVB_Threshold_+pedestal_offset_<<endl ;
1564  }
1565  zut.setLutFgr(SFGVB_lut_);
1566  // Fill the dataset
1567  dataset4[thestrip] = zut;
1568  }
1569 
1570  // Insert the dataset
1571  ostringstream wtag;
1572  wtag.str(""); wtag<<"FGR_"<<lutFG<<"_N_"<<NFGRGROUPS<<"_eb_"<<FG_lowThreshold_EB_<<"_EB_"<<FG_highThreshold_EB_;
1573  std::string weight_tag=wtag.str();
1574  std::cout<< " weight tag "<<weight_tag<<endl;
1575  if(m_write_fgr==1) fgr_conf_id_=db_->writeToConfDB_TPGFgr(dataset, dataset2, fgrparamset,dataset3, dataset4, NFGRGROUPS, weight_tag) ;
1576 
1577  //modif-alex 21/01/11
1578  map<EcalLogicID, FEConfigSpikeDat> datasetspike; //loob EB TT
1579  for (int ich=0; ich<(int)my_TTEcalLogicId.size() ; ich++){
1580  FEConfigSpikeDat spiketh;
1582  datasetspike[my_TTEcalLogicId[ich]] = spiketh;
1583  }//loop EB TT towers
1584 
1585  //modif-alex 21/01/11
1586  ostringstream stag;
1587  stag.str(""); stag<<"SpikeTh"<<SFGVB_SpikeKillingThreshold_;
1588  std::string spike_tag=stag.str();
1589  std::cout<< " spike tag "<<spike_tag<<endl;
1590  if(m_write_spi==1) spi_conf_id_=db_->writeToConfDB_Spike(datasetspike, spike_tag) ; //modif-alex 21/01/11
1591 
1592  //modif-alex 31/01/11
1593  //DELAYS EB
1594  map<EcalLogicID, FEConfigTimingDat> datasetdelay; // the loop goes from TCC 38 to 72 and throught the towers from 1 to 68
1595  for (int ich=0; ich<(int)my_TTEcalLogicId_EB_by_TCC.size() ; ich++){
1596  FEConfigTimingDat delay;
1597 
1598  EcalLogicID logiciddelay = my_TTEcalLogicId_EB_by_TCC[ich] ;
1599  int id1_tcc=my_TTEcalLogicId_EB_by_TCC[ich].getID1(); // the TCC
1600  int id2_tt =my_TTEcalLogicId_EB_by_TCC[ich].getID2(); // the tower
1601  std::map<int, vector<int> >::const_iterator ittEB = delays_EB_.find(id1_tcc);
1602  std::vector<int> TimingDelaysEB = ittEB->second;
1603 
1604  if (ittEB != delays_EB_.end()){
1605  if(TimingDelaysEB[id2_tt-1] == -1){
1606  std::cout << "ERROR: Barrel timing delay not specified, check file, putting default value 1" << std::endl;
1607  delay.setTimingPar1(1);
1608  }
1609  else delay.setTimingPar1(TimingDelaysEB[id2_tt-1]);
1610  } else {
1611  std::cout << "ERROR:Barrel Could not find delay parameter for that trigger tower " << std::endl;
1612  std::cout << "Using default value = 1" << std::endl;
1613  delay.setTimingPar1(1);
1614  }
1615 
1616  std::map<int, vector<int> >::const_iterator ittpEB = phases_EB_.find(id1_tcc);
1617  std::vector<int> TimingPhasesEB = ittpEB->second;
1618 
1619  if (ittpEB != phases_EB_.end()){
1620  if(TimingPhasesEB[id2_tt-1] == -1){
1621  std::cout << "ERROR: Barrel timing phase not specified, check file, putting default value 0" << std::endl;
1622  delay.setTimingPar2(0);
1623  }
1624  else delay.setTimingPar2(TimingPhasesEB[id2_tt-1]);
1625  } else {
1626  std::cout << "ERROR:Barrel Could not find phase parameter for that trigger tower " << std::endl;
1627  std::cout << "Using default value = 0" << std::endl;
1628  delay.setTimingPar2(0);
1629  }
1630 
1631  std::cout << ich << " tcc=" << id1_tcc << " TT=" << id2_tt << " logicId=" << logiciddelay.getLogicID()
1632  << " delay=" << TimingDelaysEB[id2_tt-1] << " phase=" << TimingPhasesEB[id2_tt-1] << std::endl;
1633 
1634  //delay.setTimingPar1(1);
1635  //delay.setTimingPar2(2);
1636  datasetdelay[my_TTEcalLogicId_EB_by_TCC[ich]] = delay;
1637  }//loop EB TT towers
1638 
1639  //DELAYS EE
1640  int stripindex = 0;
1641  int tccin = 1;
1642  for (int ich=0; ich<(int)my_StripEcalLogicId_EE_strips_by_TCC.size() ; ich++){
1643  FEConfigTimingDat delay;
1644  //int id1_strip=my_StripEcalLogicId_EE_strips_by_TCC[ich].getID1(); // the TCC
1645  //int id2_strip=my_StripEcalLogicId_EE_strips_by_TCC[ich].getID2(); // the Tower
1646  //int id3_strip=my_StripEcalLogicId_EE_strips_by_TCC[ich].getID3(); // the strip
1647 
1648  EcalLogicID logiciddelay = my_StripEcalLogicId_EE_strips_by_TCC[ich] ;
1649  int id1_tcc=my_StripEcalLogicId_EE_strips_by_TCC[ich].getID1(); // the TCC
1650  int id2_tt =my_StripEcalLogicId_EE_strips_by_TCC[ich].getID2(); // the tower
1651  int id3_st =my_StripEcalLogicId_EE_strips_by_TCC[ich].getID3(); // the strip
1652 
1653  //reset strip counter
1654  if(id1_tcc != tccin) {tccin = id1_tcc; stripindex=0;}
1655 
1656  std::map<int, vector<int> >::const_iterator ittEE = delays_EE_.find(id1_tcc);
1657  std::vector<int> TimingDelaysEE = ittEE->second;
1658 
1659  if (ittEE != delays_EE_.end()){
1660  if(TimingDelaysEE[stripindex] == -1){
1661  std::cout << "ERROR: Endcap timing delay not specified, check file, putting default value 1" << std::endl;
1662  delay.setTimingPar1(1);
1663  }
1664  else delay.setTimingPar1(TimingDelaysEE[stripindex]);
1665  } else {
1666  std::cout << "ERROR:Endcap Could not find delay parameter for that trigger tower " << std::endl;
1667  std::cout << "Using default value = 1" << std::endl;
1668  delay.setTimingPar1(1);
1669  }
1670 
1671  std::map<int, vector<int> >::const_iterator ittpEE = phases_EE_.find(id1_tcc);
1672  std::vector<int> TimingPhasesEE = ittpEE->second;
1673 
1674  if (ittpEE != phases_EE_.end()){
1675  if(TimingPhasesEE[stripindex] == -1){
1676  std::cout << "ERROR: Endcap timing phase not specified, check file, putting default value 0" << std::endl;
1677  delay.setTimingPar2(0);
1678  }
1679  else delay.setTimingPar2(TimingPhasesEE[stripindex]);
1680  } else {
1681  std::cout << "ERROR:Endcap Could not find phase parameter for that trigger tower " << std::endl;
1682  std::cout << "Using default value = 0" << std::endl;
1683  delay.setTimingPar2(0);
1684  }
1685 
1686  std::cout << ich << " stripindex=" << stripindex << " tcc=" << id1_tcc << " TT=" << id2_tt << " id3_st=" << id3_st
1687  << " logicId=" << logiciddelay.getLogicID()
1688  << " delay=" << TimingDelaysEE[stripindex] << " phase=" << TimingPhasesEE[stripindex] << std::endl;
1689 
1690 
1691  //delay.setTimingPar1(1);
1692  //delay.setTimingPar2(2);
1693  datasetdelay[my_StripEcalLogicId_EE_strips_by_TCC[ich]] = delay;
1694  stripindex++;
1695  }//loop EE strip towers
1696 
1697  ostringstream de_tag;
1698  de_tag.str(""); de_tag<<"DelaysFromFile";
1699  std::string delay_tag=de_tag.str();
1700  std::cout<< " delay tag "<<delay_tag<<endl;
1701  if(m_write_del==1) del_conf_id_=db_->writeToConfDB_Delay(datasetdelay, delay_tag) ; //modif-alex 31/01/11
1702 
1703 
1704  } //write to DB
1705 
1706  if (writeToDB_) {
1707  std::cout<<"going to write the sliding "<< endl;
1708  map<EcalLogicID, FEConfigSlidingDat> dataset;
1709  // in this case I decide in a stupid way which channel belongs to which group
1710  for (int ich=0; ich<(int)my_StripEcalLogicId.size() ; ich++){
1711  FEConfigSlidingDat wut;
1712  wut.setSliding(sliding_);
1713  // Fill the dataset
1714  // the logic ids are ordered by SM (1,...36) , TT (1,...68) and strip (1..5)
1715  // you have to calculate the right index here
1716  dataset[my_StripEcalLogicId[ich]] = wut;
1717  }
1718 
1719  // endcap loop
1720  for (int ich=0; ich<(int)my_StripEcalLogicId1_EE.size() ; ich++){
1721  FEConfigSlidingDat wut;
1722  wut.setSliding(sliding_);
1723  // Fill the dataset
1724  // the logic ids are ordered by fed tower strip
1725  // you have to calculate the right index here
1726  dataset[my_StripEcalLogicId1_EE[ich]] = wut;
1727  }
1728  for (int ich=0; ich<(int)my_StripEcalLogicId2_EE.size() ; ich++){
1729  FEConfigSlidingDat wut;
1730  wut.setSliding(sliding_);
1731  // Fill the dataset
1732  // the logic ids are ordered by ... ?
1733  // you have to calculate the right index here
1734  dataset[my_StripEcalLogicId2_EE[ich]] = wut;
1735  }
1736 
1737 
1738  // Insert the dataset
1739  ostringstream wtag;
1740  wtag.str(""); wtag<<"Sliding_"<<sliding_;
1741  std::string justatag=wtag.str();
1742  std::cout<< " sliding tag "<<justatag<<endl;
1743  int iov_id=0; // just a parameter ...
1744  if(m_write_sli==1) sli_conf_id_=db_->writeToConfDB_TPGSliding(dataset,iov_id, justatag) ;
1745  }
1746 
1747 
1748 
1749 
1750 
1752  // Compute LUT section //
1754 
1755  int lut_EB[1024], lut_EE[1024] ;
1756 
1757  // barrel
1758  computeLUT(lut_EB, "EB") ;
1759  if (writeToFiles_) {
1760  (*out_file_) <<std::endl ;
1761  (*out_file_) <<"LUT 0"<<std::endl ;
1762  for (int i=0 ; i<1024 ; i++) (*out_file_)<<"0x"<<hex<<lut_EB[i]<<endl ;
1763  (*out_file_)<<endl ;
1764  }
1765 
1766  // endcap
1767  computeLUT(lut_EE, "EE") ;
1768  // check first if lut_EB and lut_EE are the same
1769  bool newLUT(false) ;
1770  for (int i=0 ; i<1024 ; i++) if (lut_EE[i] != lut_EB[i]) newLUT = true ;
1771  if (newLUT && writeToFiles_) {
1772  (*out_file_) <<std::endl ;
1773  (*out_file_) <<"LUT 1"<<std::endl ;
1774  for (int i=0 ; i<1024 ; i++) (*out_file_)<<"0x"<<hex<<lut_EE[i]<<endl ;
1775  (*out_file_)<<endl ;
1776  }
1777 
1778 
1779 
1780  if (writeToDB_) {
1781 
1782 
1783 
1784  map<EcalLogicID, FEConfigLUTGroupDat> dataset;
1785  // we create 1 LUT group
1786  int NLUTGROUPS =0;
1787  int ich=0;
1789  lut.setLUTGroupId(ich);
1790  for (int i=0; i<1024; i++){
1791  lut.setLUTValue(i, lut_EB[i] );
1792  }
1793  EcalLogicID ecid = EcalLogicID( "DUMMY", ich,ich);
1794  // Fill the dataset
1795  dataset[ecid] = lut; // we use any logic id but different, because it is in any case ignored...
1796 
1797  ich++;
1798 
1800  lute.setLUTGroupId(ich);
1801  for (int i=0; i<1024; i++){
1802  lute.setLUTValue(i, lut_EE[i] );
1803  }
1804  EcalLogicID ecide = EcalLogicID( "DUMMY", ich,ich);
1805  // Fill the dataset
1806  dataset[ecide] = lute; // we use any logic id but different, because it is in any case ignored...
1807 
1808  ich++;
1809 
1810  NLUTGROUPS=ich;
1811 
1812  // now we store in the DB the correspondence btw channels and LUT groups
1813  map<EcalLogicID, FEConfigLUTDat> dataset2;
1814  // in this case I decide in a stupid way which channel belongs to which group
1815  for (int ich=0; ich<(int)my_TTEcalLogicId.size() ; ich++){
1817  int igroup=0;
1818  lut.setLUTGroupId(igroup);
1819  // calculate the right TT - in the vector they are ordered by SM and by TT
1820  // Fill the dataset
1821  dataset2[my_TTEcalLogicId[ich]] = lut;
1822  }
1823 
1824  // endcap loop
1825  for (int ich=0; ich<(int)my_TTEcalLogicId_EE.size() ; ich++){
1827  int igroup=1;
1828  lut.setLUTGroupId(igroup);
1829  // calculate the right TT
1830  // Fill the dataset
1831  dataset2[my_TTEcalLogicId_EE[ich]] = lut;
1832  }
1833 
1834  // Insert the dataset
1835  ostringstream ltag;
1836  ltag.str(""); ltag<<LUT_option_<<"_NGroups_"<<NLUTGROUPS;
1837  std::string lut_tag=ltag.str();
1838  std::cout<< " LUT tag "<<lut_tag<<endl;
1839  if(m_write_lut==1) lut_conf_id_=db_->writeToConfDB_TPGLUT(dataset, dataset2,lutparamset, NLUTGROUPS, lut_tag) ;
1840 
1841  }
1842 
1843  // last we insert the FE_CONFIG_MAIN table
1844  if (writeToDB_) {
1845 
1846  //int conf_id_=db_->writeToConfDB_TPGMain(ped_conf_id_,lin_conf_id_, lut_conf_id_, fgr_conf_id_,
1847  // sli_conf_id_, wei_conf_id_, bxt_conf_id_, btt_conf_id_, tag_, version_) ;
1850 
1851  std::cout << "\n Conf ID = " << conf_id_ << std::endl;
1852 
1853  }
1854 
1855 
1857  // loop on strips and associate them with values //
1859 
1860  // Barrel
1861  stripListEB.sort() ;
1862  stripListEB.unique() ;
1863  cout<<"Number of EB strips="<<dec<<stripListEB.size()<<endl ;
1864  if (writeToFiles_) {
1865  (*out_file_) <<std::endl ;
1866  for (itList = stripListEB.begin(); itList != stripListEB.end(); ++itList ) {
1867  (*out_file_) <<"STRIP_EB "<<dec<<(*itList)<<endl ;
1868  (*out_file_) << hex << "0x" <<sliding_<<std::endl ;
1869  (*out_file_) <<"0" <<std::endl ;
1870  (*out_file_) <<"0x"<<stripMapEBsintheta[(*itList)] << " 0x" << SFGVB_lut_ <<std::endl ;
1871  }
1872  }
1873 
1874  // Endcap
1875  stripListEE.sort() ;
1876  stripListEE.unique() ;
1877  cout<<"Number of EE strips="<<dec<<stripListEE.size()<<endl ;
1878  if (writeToFiles_) {
1879  (*out_file_) <<std::endl ;
1880  for (itList = stripListEE.begin(); itList != stripListEE.end(); ++itList ) {
1881  (*out_file_) <<"STRIP_EE "<<dec<<(*itList)<<endl ;
1882  (*out_file_) << hex << "0x" <<sliding_<<std::endl ;
1883  (*out_file_) <<" 0" << std::endl ;
1884  (*out_file_)<<hex<<"0x"<<threshold<<" 0x"<<lut_strip<<std::endl ;
1885  }
1886  }
1887 
1888 
1890  // loop on towers and associate them with default values //
1892 
1893  // Barrel
1894  towerListEB.sort() ;
1895  towerListEB.unique() ;
1896  cout<<"Number of EB towers="<<dec<<towerListEB.size()<<endl ;
1897  if (writeToFiles_) {
1898  (*out_file_) <<std::endl ;
1899  for (itList = towerListEB.begin(); itList != towerListEB.end(); ++itList ) {
1900  (*out_file_) <<"TOWER_EB "<<dec<<(*itList)<<endl ;
1901  (*out_file_) <<" 0\n 0\n" ;
1902  (*out_file_) <<" " << SFGVB_SpikeKillingThreshold_ << std::endl; //modif-alex
1903  }
1904  }
1905 
1906  // Endcap
1907  towerListEE.sort() ;
1908  towerListEE.unique() ;
1909  cout<<"Number of EE towers="<<dec<<towerListEE.size()<<endl ;
1910  if (writeToFiles_) {
1911  (*out_file_) <<std::endl ;
1912  for (itList = towerListEE.begin(); itList != towerListEE.end(); ++itList ) {
1913  (*out_file_) <<"TOWER_EE "<<dec<<(*itList)<<endl ;
1914  if (newLUT) (*out_file_) <<" 1\n" ;
1915  else (*out_file_) <<" 0\n" ;
1916  (*out_file_)<<hex<<"0x"<<lut_tower<<std::endl ;
1917  }
1918  }
1919 
1920 
1921 
1922 
1924  // store control histos //
1926  ICEB->Write() ;
1927  tpgFactorEB->Write() ;
1928  ICEEPlus->Write() ;
1929  tpgFactorEEPlus->Write() ;
1930  ICEEMinus->Write() ;
1931  tpgFactorEEMinus->Write() ;
1932  IC->Write() ;
1933  tpgFactor->Write() ;
1934  hshapeEB->Write() ;
1935  hshapeEE->Write() ;
1936  ntuple->Write() ;
1937  ntupleSpike->Write() ;
1938  saving.Close () ;
1939 }
tuple base
Main Program
Definition: newFWLiteAna.py:91
int writeToConfDB_TPGLinearCoef(const std::map< EcalLogicID, FEConfigLinDat > &linset, const std::map< EcalLogicID, FEConfigLinParamDat > &linparamset, int iovId, std::string tag)
Definition: EcalTPGDBApp.cc:42
std::map< int, std::vector< int > > phases_EB_
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)
float getPedMeanG1() const
Ecal readout channel identification [32:20] Unused (so far) [19:13] DCC id [12:6] tower [5:3] strip [...
void setTimingPar2(int x)
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]
static const int XYMODE
Definition: EEDetId.h:339
Geom::Phi< T > phi() const
Definition: PV3DBase.h:69
void setMultX1(int x)
std::string getDet(int tcc)
Geom::Theta< T > theta() const
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 zside(DetId const &)
int writeToConfDB_TPGSliding(const std::map< EcalLogicID, FEConfigSlidingDat > &sliset, int iovId, std::string tag)
int writeToConfDB_Delay(const std::map< EcalLogicID, FEConfigTimingDat > &delaygroupset, std::string tag)
const CaloSubdetectorGeometry * theEndcapGeometry_
void setShift6(int x)
int writeToConfDB_TPGMain(int ped, int lin, int lut, int fgr, int sli, int wei, int spi, int tim, int bxt, int btt, int bst, std::string tag, int ver)
Definition: EcalTPGDBApp.cc:68
std::ofstream * out_file_
std::map< int, std::vector< int > > delays_EB_
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
int channelId() const
get the channel id
int ieta() const
get the tower ieta
void setPedMeanG6(float mean)
void getCoeff(coeffStruc &coeff, const EcalIntercalibConstantMap &calibMap, uint rawId)
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)
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)
int getID2() const
Definition: EcalLogicID.cc:51
Geom::Theta< T > theta() const
Definition: PV3DBase.h:75
void setShift1(int x)
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
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.
std::string getName() const
Definition: EcalLogicID.cc:36
void setThreshold(unsigned int mean)
void setPedMeanG1(float mean)
void setThreshHigh(float x)
std::map< int, std::vector< int > > delays_EE_
EcalPedestalsMap::const_iterator EcalPedestalsMapIterator
Definition: EcalPedestals.h:52
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")
int getTimId() const
void fetchDataSet(std::map< EcalLogicID, DATT > *fillMap, IOVT *iov)
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 getSpiId() const
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
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:46
float gain6Over1() const
tuple lut
Definition: lumiPlot.py:244
void setLUTGroupId(int x)
int getLogicID() const
Definition: EcalLogicID.cc:41
int pseudoStripId() const
get the tower id
int dccId() const
get the DCC (Ecal Local DCC value not global one) id
void setSpikeThreshold(int x)
float getPedMeanG12() const
void setTimingPar1(int x)
void insert(std::pair< uint32_t, Item > const &a)
void setFgrGroupId(int x)
Definition: EBShape.h:6
int writeToConfDB_Spike(const std::map< EcalLogicID, FEConfigSpikeDat > &spikegroupset, std::string tag)
void computeFineGrainEEParameters(uint &threshold, uint &lut_strip, uint &lut_tower)
tuple G
Definition: callgraph.py:12
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:56
std::vector< Item >::const_iterator const_iterator
tuple dataset
Definition: dataset.py:868
T const * product() const
Definition: ESHandle.h:86
int DCCid(const EBDetId &id) const
returns the DCC of an EBDetId
float gain12Over6() const
float getPedMeanG6() const
T eta() const
Definition: PV3DBase.h:76
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:42
int getBxtId() const
int getBstId() 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)
void setId(int id)
static unsigned int const shift
tuple cout
Definition: gather_cfg.py:145
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:56
void setTTThreshlow(float x)
static const int SMCRYSTALMODE
Definition: EBDetId.h:167
void setWeightGroupId(int x)
const GlobalPoint & getPosition() const
Returns the position of reference for this cell.
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
std::map< int, std::vector< int > > phases_EE_
int getSliId() const
Definition: EEShape.h:6
void computeFineGrainEBParameters(uint &lowRatio, uint &highRatio, uint &lowThreshold, uint &highThreshold, uint &lut)
tuple lute
Definition: lumiCalc2.py:239
void EcalTPGParamBuilder::beginJob ( void  )
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 1941 of file EcalTPGParamBuilder.cc.

References gather_cfg::cout, create_header(), TauDecayModes::dec, 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_.

1942 {
1943  using namespace edm;
1944  using namespace std;
1945 
1946  std::cout<<"we are in beginJob"<<endl;
1947 
1948  create_header() ;
1949 
1952 
1953  if (writeToFiles_) {
1954  (*out_file_)<<"PHYSICS_EB "<<dec<<eb.rawId()<<std::endl ;
1955  (*out_file_)<<Et_sat_EB_<<" "<<TTF_lowThreshold_EB_<<" "<<TTF_highThreshold_EB_<<std::endl ;
1956  (*out_file_)<<FG_lowThreshold_EB_<<" "<<FG_highThreshold_EB_<<" "
1957  <<FG_lowRatio_EB_<<" "<<FG_highRatio_EB_<<std::endl ;
1958  //(*out_file_) << SFGVB_SpikeKillingThreshold_ << std::endl; //modif-alex02/02/2011
1959  (*out_file_) <<std::endl ;
1960 
1961  (*out_file_)<<"PHYSICS_EE "<<dec<<ee.rawId()<<std::endl ;
1962  (*out_file_)<<Et_sat_EE_<<" "<<TTF_lowThreshold_EE_<<" "<<TTF_highThreshold_EE_<<std::endl ;
1963  (*out_file_)<<FG_Threshold_EE_<<" "<<-1<<" "
1964  <<-1<<" "<<-1<<std::endl ;
1965  (*out_file_) <<std::endl ;
1966  }
1967 
1968 }
Definition: DetId.h:18
tuple cout
Definition: gather_cfg.py:145
bool EcalTPGParamBuilder::checkIfOK ( const EcalPedestals::Item item)

Definition at line 332 of file EcalTPGParamBuilder.cc.

References EcalPedestal::mean_x1, EcalPedestal::mean_x12, EcalPedestal::mean_x6, query::result, EcalPedestal::rms_x1, EcalPedestal::rms_x12, and EcalPedestal::rms_x6.

333 {
334  bool result=true;
335  if( item.mean_x1 <150. || item.mean_x1 >250) result=false;
336  if( item.mean_x6 <150. || item.mean_x6 >250) result=false;
337  if( item.mean_x12 <150. || item.mean_x12 >250) result=false;
338  if( item.rms_x1 <0 || item.rms_x1 > 2) result=false;
339  if( item.rms_x6 <0 || item.rms_x6 > 3) result=false;
340  if( item.rms_x12 <0 || item.rms_x12 > 5) result=false;
341  return result;
342 }
tuple result
Definition: query.py:137
void EcalTPGParamBuilder::computeFineGrainEBParameters ( uint &  lowRatio,
uint &  highRatio,
uint &  lowThreshold,
uint &  highThreshold,
uint &  lut 
)
private

Definition at line 2370 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().

2372 {
2373  lowRatio = int(0x80*FG_lowRatio_EB_ + 0.5) ;
2374  if (lowRatio>0x7f) lowRatio = 0x7f ;
2375  highRatio = int(0x80*FG_highRatio_EB_ + 0.5) ;
2376  if (highRatio>0x7f) highRatio = 0x7f ;
2377 
2378  // lsb at the stage of the FG calculation is:
2379  double lsb_FG = Et_sat_EB_/1024./4 ;
2380  lowThreshold = int(FG_lowThreshold_EB_/lsb_FG+0.5) ;
2381  if (lowThreshold>0xff) lowThreshold = 0xff ;
2382  highThreshold = int(FG_highThreshold_EB_/lsb_FG+0.5) ;
2383  if (highThreshold>0xff) highThreshold = 0xff ;
2384 
2385  // FG lut: FGVB response is LUT(adress) where adress is:
2386  // bit3: maxof2/ET >= lowRatio, bit2: maxof2/ET >= highRatio, bit1: ET >= lowThreshold, bit0: ET >= highThreshold
2387  // FGVB =1 if jet-like (veto active), =0 if E.M.-like
2388  // the condition for jet-like is: ET>Threshold and maxof2/ET < Ratio (only TT with enough energy are vetoed)
2389 
2390  // With the following lut, what matters is only max(TLow, Thigh) and max(Elow, Ehigh)
2391  // So, jet-like if maxof2/ettot<max(TLow, Thigh) && ettot >= max(Elow, Ehigh)
2392  if (FG_lut_EB_ == 0) lut = 0x0888 ;
2393  else lut = FG_lut_EB_ ; // let's use the users value (hope he/she knows what he/she does!)
2394 }
tuple lut
Definition: lumiPlot.py:244
void EcalTPGParamBuilder::computeFineGrainEEParameters ( uint &  threshold,
uint &  lut_strip,
uint &  lut_tower 
)
private

Definition at line 2396 of file EcalTPGParamBuilder.cc.

References Et_sat_EE_, FG_lut_strip_EE_, FG_lut_tower_EE_, and FG_Threshold_EE_.

Referenced by analyze().

2397 {
2398  // lsb for EE:
2399  double lsb_FG = Et_sat_EE_/1024. ; // FIXME is it true????
2400  threshold = int(FG_Threshold_EE_/lsb_FG+0.5) ;
2401  lut_strip = FG_lut_strip_EE_ ;
2402  lut_tower = FG_lut_tower_EE_ ;
2403 }
bool EcalTPGParamBuilder::computeLinearizerParam ( double  theta,
double  gainRatio,
double  calibCoeff,
std::string  subdet,
int &  mult,
int &  shift 
)
private

Definition at line 1972 of file EcalTPGParamBuilder.cc.

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

Referenced by analyze().

1973 {
1974  /*
1975  Linearization coefficient are determined in order to satisfy:
1976  tpg(ADC_sat) = 1024
1977  where:
1978  tpg() is a model of the linearized tpg response on 10b
1979  ADC_sat is the number of ADC count corresponding the Et_sat, the maximum scale of the transverse energy
1980 
1981  Since we have:
1982  Et_sat = xtal_LSB * ADC_sat * gainRatio * calibCoeff * sin(theta)
1983  and a simple model of tpg() being given by:
1984  tpg(X) = [ (X*mult) >> (shift+2) ] >> (sliding+shiftDet)
1985  we must satisfy:
1986  [ (Et_sat/(xtal_LSB * gainRatio * calibCoeff * sin(theta)) * mult) >> (shift+2) ] >> (sliding+shiftDet) = 1024
1987  that is:
1988  mult = 1024/Et_sat * xtal_LSB * gainRatio * calibCoeff * sin(theta) * 2^-(sliding+shiftDet+2) * 2^-shift
1989  mult = factor * 2^-shift
1990  */
1991 
1992  // case barrel:
1993  int shiftDet = 2 ; //fixed, due to FE FENIX TCP format
1994  double ratio = xtal_LSB_EB_/Et_sat_EB_ ;
1995  // case endcap:
1996  if (subdet=="EE") {
1997  shiftDet = 2 ; //applied in TCC-EE and not in FE FENIX TCP... This parameters is setable in the TCC-EE
1998  //shiftDet = 0 ; //was like this before with FE bug
1999  ratio = xtal_LSB_EE_/Et_sat_EE_ ;
2000  }
2001 
2002 
2003 
2004  double factor = 1024 * ratio * gainRatio * calibCoeff * sin(theta) * (1 << (sliding_ + shiftDet + 2)) ;
2005  // Let's try first with shift = 0 (trivial solution)
2006  mult = (int)(factor+0.5) ;
2007  for (shift = 0 ; shift<15 ; shift++) {
2008  if (mult>=128 && mult<256) return true ;
2009  factor *= 2 ;
2010  mult = (int)(factor+0.5) ;
2011  }
2012  std::cout << "too bad we did not manage to calculate the factor for calib="<<calibCoeff<<endl;
2013  return false ;
2014 }
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:145
volatile std::atomic< bool > shutdown_flag false
void EcalTPGParamBuilder::computeLUT ( int *  lut,
std::string  det = "EB" 
)
private

Definition at line 2244 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_, oneOverEtResolEt(), TTF_highThreshold_EB_, TTF_highThreshold_EE_, TTF_lowThreshold_EB_, and TTF_lowThreshold_EE_.

Referenced by analyze().

2245 {
2246  double Et_sat = Et_sat_EB_ ;
2247  double LUT_threshold = LUT_threshold_EB_ ;
2248  double LUT_stochastic = LUT_stochastic_EB_ ;
2249  double LUT_noise = LUT_noise_EB_ ;
2250  double LUT_constant = LUT_constant_EB_ ;
2251  double TTF_lowThreshold = TTF_lowThreshold_EB_ ;
2252  double TTF_highThreshold = TTF_highThreshold_EB_ ;
2253  if (det == "EE") {
2254  Et_sat = Et_sat_EE_ ;
2255  LUT_threshold = LUT_threshold_EE_ ;
2256  LUT_stochastic = LUT_stochastic_EE_ ;
2257  LUT_noise = LUT_noise_EE_ ;
2258  LUT_constant = LUT_constant_EE_ ;
2259  TTF_lowThreshold = TTF_lowThreshold_EE_ ;
2260  TTF_highThreshold = TTF_highThreshold_EE_ ;
2261  }
2262 
2263  // initialisation with identity
2264  for (int i=0 ; i<1024 ; i++) {
2265  lut[i] = i ;
2266  if (lut[i]>0xff) lut[i] = 0xff ;
2267  }
2268 
2269  // case linear LUT
2270  if (LUT_option_ == "Linear") {
2271  int mylut = 0 ;
2272  for (int i=0 ; i<1024 ; i++) {
2273  lut[i] = mylut ;
2274  if ((i+1)%4 == 0 ) mylut++ ;
2275  //if ((i+1)%8 == 0 ) mylut++ ;//modif-alex 16/12/2010 LSB==500MeV ONLY USED FOR BEAMV4 key
2276  }
2277  }
2278 
2279  // case LUT following Ecal resolution
2280  if (LUT_option_ == "EcalResolution") {
2281  TF1 * func = new TF1("func",oneOverEtResolEt, 0., Et_sat,3) ;
2282  func->SetParameters(LUT_stochastic, LUT_noise, LUT_constant) ;
2283  double norm = func->Integral(0., Et_sat) ;
2284  for (int i=0 ; i<1024 ; i++) {
2285  double Et = i*Et_sat/1024. ;
2286  lut[i] = int(0xff*func->Integral(0., Et)/norm + 0.5) ;
2287  }
2288  }
2289 
2290  // Now, add TTF thresholds to LUT and apply LUT threshold if needed
2291  for (int j=0 ; j<1024 ; j++) {
2292  double Et_GeV = Et_sat/1024*(j+0.5) ;
2293  if (Et_GeV <= LUT_threshold) lut[j] = 0 ; // LUT threshold
2294  int ttf = 0x0 ;
2295  if (Et_GeV >= TTF_highThreshold) ttf = 3 ;
2296  if (Et_GeV >= TTF_lowThreshold && Et_GeV < TTF_highThreshold) ttf = 1 ;
2297  ttf = ttf << 8 ;
2298  lut[j] += ttf ;
2299  }
2300 
2301 }
int i
Definition: DBlmapReader.cc:9
double oneOverEtResolEt(double *x, double *par)
int j
Definition: DBlmapReader.cc:9
tuple lut
Definition: lumiPlot.py:244
std::vector< unsigned int > EcalTPGParamBuilder::computeWeights ( EcalShapeBase shape,
TH1F *  histo 
)
private

Definition at line 2128 of file EcalTPGParamBuilder.cc.

References complement2_, KineDebug3::count(), gather_cfg::cout, cmsHarvester::index, bookConverter::max, min(), nSample_, funct::pow(), compare_using_db::sample, sampleMax_, HLT_FULL_cff::timeMax, EcalShapeBase::timeOfMax(), EcalShapeBase::timeOfThr(), uncodeWeight(), puppiForMET_cff::weight, weight_timeShift_, and weight_unbias_recovery_.

Referenced by analyze().

2129 {
2130  std::cout<<"Computing Weights..."<<std::endl ;
2131  double timeMax = shape.timeOfMax() - shape.timeOfThr() ; // timeMax w.r.t begining of pulse
2132  double max = shape(timeMax) ;
2133 
2134  double sumf = 0. ;
2135  double sumf2 = 0. ;
2136  for (unsigned int sample = 0 ; sample<nSample_ ; sample++) {
2137  double time = timeMax - ((double)sampleMax_-(double)sample)*25. ;
2138  time -= weight_timeShift_ ;
2139  sumf += shape(time)/max ;
2140  sumf2 += shape(time)/max * shape(time)/max ;
2141  for (int subtime = 0 ; subtime<25 ; subtime++) histo->Fill(float(sample*25. + subtime)/25., shape(time+subtime)) ;
2142  }
2143  double lambda = 1./(sumf2-sumf*sumf/nSample_) ;
2144  double gamma = -lambda*sumf/nSample_ ;
2145  double * weight = new double[nSample_] ;
2146  for (unsigned int sample = 0 ; sample<nSample_ ; sample++) {
2147  double time = timeMax - ((double)sampleMax_-(double)sample)*25. ;
2148  time -= weight_timeShift_ ;
2149  weight[sample] = lambda*shape(time)/max + gamma ;
2150  }
2151 
2152 
2153  int * iweight = new int[nSample_] ;
2154  for (unsigned int sample = 0 ; sample<nSample_ ; sample++) iweight[sample] = uncodeWeight(weight[sample], complement2_) ;
2155 
2156  // Let's check:
2157  int isumw = 0 ;
2158  for (unsigned int sample = 0 ; sample<nSample_ ; sample++) isumw += iweight[sample] ;
2159  unsigned int imax = (unsigned int)(pow(2.,int(complement2_))-1) ;
2160  isumw = (isumw & imax ) ;
2161 
2162  double ampl = 0. ;
2163  double sumw = 0. ;
2164  for (unsigned int sample = 0 ; sample<nSample_ ; sample++) {
2165  double time = timeMax - ((double)sampleMax_-(double)sample)*25. ;
2166  time -= weight_timeShift_ ;
2167  ampl += weight[sample]*shape(time) ;
2168  sumw += weight[sample] ;
2169  std::cout<<"weight="<<weight[sample]<<" shape="<<shape(time)<<std::endl ;
2170  }
2171  std::cout<<"Weights: sum="<<isumw<<" in float ="<<uncodeWeight(isumw, complement2_)<<" sum of floats ="<<sumw<<std::endl ;
2172  std::cout<<"Weights: sum (weight*shape) = "<<ampl<<std::endl ;
2173 
2174 
2175 
2176  // Let's correct for bias if any
2178  int count = 0 ;
2179  while (isumw != 0 && count<10) {
2180  double min = 99. ;
2181  unsigned int index = 0 ;
2182  if ( (isumw & (1<<(complement2_-1))) != 0) {
2183  // add 1:
2184  std::cout<<"Correcting for bias: adding 1"<<std::endl ;
2185  for (unsigned int sample = 0 ; sample<nSample_ ; sample++) {
2186  int new_iweight = iweight[sample]+1 ;
2187  double new_weight = uncodeWeight(new_iweight, complement2_) ;
2188  if (fabs(new_weight-weight[sample])<min) {
2189  min = fabs(new_weight-weight[sample]) ;
2190  index = sample ;
2191  }
2192  }
2193  iweight[index] ++ ;
2194  } else {
2195  // Sub 1:
2196  std::cout<<"Correcting for bias: subtracting 1"<<std::endl ;
2197  for (unsigned int sample = 0 ; sample<nSample_ ; sample++) {
2198  int new_iweight = iweight[sample]-1 ;
2199  double new_weight = uncodeWeight(new_iweight, complement2_) ;
2200  if (fabs(new_weight-weight[sample])<min) {
2201  min = fabs(new_weight-weight[sample]) ;
2202  index = sample ;
2203  }
2204  }
2205  iweight[index] -- ;
2206  }
2207  isumw = 0 ;
2208  for (unsigned int sample = 0 ; sample<nSample_ ; sample++) isumw += iweight[sample] ;
2209  imax = (unsigned int)(pow(2.,int(complement2_))-1) ;
2210  isumw = (isumw & imax ) ;
2211  std::cout<<"Correcting weight number: "<<index<<" sum weights = "<<isumw<<std::endl ;
2212  count ++ ;
2213  }
2214  }
2215 
2216  // let's check again
2217  isumw = 0 ;
2218  for (unsigned int sample = 0 ; sample<nSample_ ; sample++) isumw += iweight[sample] ;
2219  imax = (unsigned int)(pow(2.,int(complement2_))-1) ;
2220  isumw = (isumw & imax ) ;
2221  ampl = 0. ;
2222  for (unsigned int sample = 0 ; sample<nSample_ ; sample++) {
2223  double time = timeMax - ((double)sampleMax_-(double)sample)*25. ;
2224  time -= weight_timeShift_ ;
2225  double new_weight = uncodeWeight(iweight[sample], complement2_) ;
2226  sumw += uncodeWeight(iweight[sample], complement2_) ;
2227  ampl += new_weight*shape(time) ;
2228  std::cout<<"weight unbiased after integer conversion="<<new_weight<<" shape="<<shape(time)<<std::endl ;
2229  }
2230  std::cout<<"Weights: sum="<<isumw<<" in float ="<<uncodeWeight(isumw, complement2_)<<" sum of floats ="<<sumw<<std::endl ;
2231  std::cout<<"Weights: sum (weight*shape) = "<<ampl<<std::endl ;
2232 
2233 
2234 
2235  std::vector<unsigned int> theWeights ;
2236  for (unsigned int sample = 0 ; sample<nSample_ ; sample++) theWeights.push_back(iweight[sample]) ;
2237  std::cout<<std::endl ;
2238 
2239  delete[] weight ;
2240  delete[] iweight ;
2241  return theWeights ;
2242 }
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
T min(T a, T b)
Definition: MathUtil.h:58
void conversion(EventAux const &from, EventAuxiliary &to)
Definition: EventAux.cc:9
double timeOfThr() const
return(e1-e2)*(e1-e2)+dp *dp
if(dp >Float(M_PI)) dp-
tuple cout
Definition: gather_cfg.py:145
for(const auto &isodef:isoDefs)
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 2016 of file EcalTPGParamBuilder.cc.

References reco::return(), and writeToFiles_.

Referenced by beginJob().

2017 {
2018  if (!writeToFiles_) return ;
2019  (*out_file_) <<"COMMENT put your comments here"<<std::endl ;
2020 
2021  (*out_file_) <<"COMMENT ================================="<<std::endl ;
2022  (*out_file_) <<"COMMENT physics EB structure"<<std::endl ;
2023  (*out_file_) <<"COMMENT"<<std::endl ;
2024  (*out_file_) <<"COMMENT EtSaturation (GeV), ttf_threshold_Low (GeV), ttf_threshold_High (GeV)"<<std::endl ;
2025  (*out_file_) <<"COMMENT FG_lowThreshold (GeV), FG_highThreshold (GeV), FG_lowRatio, FG_highRatio"<<std::endl ;
2026  //(*out_file_) <<"COMMENT SFGVB_SpikeKillingThreshold (GeV)"<<std::endl ; //modif-alex-02/02/2011
2027  (*out_file_) <<"COMMENT ================================="<<std::endl ;
2028  (*out_file_) <<"COMMENT"<<std::endl ;
2029 
2030  (*out_file_) <<"COMMENT ================================="<<std::endl ;
2031  (*out_file_) <<"COMMENT physics EE structure"<<std::endl ;
2032  (*out_file_) <<"COMMENT"<<std::endl ;
2033  (*out_file_) <<"COMMENT EtSaturation (GeV), ttf_threshold_Low (GeV), ttf_threshold_High (GeV)"<<std::endl ;
2034  (*out_file_) <<"COMMENT FG_Threshold (GeV), dummy, dummy, dummy"<<std::endl ;
2035  (*out_file_) <<"COMMENT ================================="<<std::endl ;
2036  (*out_file_) <<"COMMENT"<<std::endl ;
2037 
2038  (*out_file_) <<"COMMENT ================================="<<std::endl ;
2039  (*out_file_) <<"COMMENT crystal structure (same for EB and EE)"<<std::endl ;
2040  (*out_file_) <<"COMMENT"<<std::endl ;
2041  (*out_file_) <<"COMMENT ped, mult, shift [gain12]"<<std::endl ;
2042  (*out_file_) <<"COMMENT ped, mult, shift [gain6]"<<std::endl ;
2043  (*out_file_) <<"COMMENT ped, mult, shift [gain1]"<<std::endl ;
2044  (*out_file_) <<"COMMENT ================================="<<std::endl ;
2045  (*out_file_) <<"COMMENT"<<std::endl ;
2046 
2047  (*out_file_) <<"COMMENT ================================="<<std::endl ;
2048  (*out_file_) <<"COMMENT strip EB structure"<<std::endl ;
2049  (*out_file_) <<"COMMENT"<<std::endl ;
2050  (*out_file_) <<"COMMENT sliding_window"<<std::endl ;
2051  (*out_file_) <<"COMMENT weightGroupId"<<std::endl ;
2052  (*out_file_) <<"COMMENT threshold_sfg lut_sfg"<<std::endl ;
2053  (*out_file_) <<"COMMENT ================================="<<std::endl ;
2054  (*out_file_) <<"COMMENT"<<std::endl ;
2055 
2056  (*out_file_) <<"COMMENT ================================="<<std::endl ;
2057  (*out_file_) <<"COMMENT strip EE structure"<<std::endl ;
2058  (*out_file_) <<"COMMENT"<<std::endl ;
2059  (*out_file_) <<"COMMENT sliding_window"<<std::endl ;
2060  (*out_file_) <<"COMMENT weightGroupId"<<std::endl ;
2061  (*out_file_) <<"COMMENT threshold_fg lut_fg"<<std::endl ;
2062  (*out_file_) <<"COMMENT ================================="<<std::endl ;
2063  (*out_file_) <<"COMMENT"<<std::endl ;
2064 
2065  (*out_file_) <<"COMMENT ================================="<<std::endl ;
2066  (*out_file_) <<"COMMENT tower EB structure"<<std::endl ;
2067  (*out_file_) <<"COMMENT"<<std::endl ;
2068  (*out_file_) <<"COMMENT LUTGroupId"<<std::endl ;
2069  (*out_file_) <<"COMMENT FgGroupId"<<std::endl ;
2070  (*out_file_) <<"COMMENT spike_killing_threshold"<<std::endl ;//modif alex
2071  (*out_file_) <<"COMMENT ================================="<<std::endl ;
2072  (*out_file_) <<"COMMENT"<<std::endl ;
2073 
2074  (*out_file_) <<"COMMENT ================================="<<std::endl ;
2075  (*out_file_) <<"COMMENT tower EE structure"<<std::endl ;
2076  (*out_file_) <<"COMMENT"<<std::endl ;
2077  (*out_file_) <<"COMMENT LUTGroupId"<<std::endl ;
2078  (*out_file_) <<"COMMENT tower_lut_fg"<<std::endl ;
2079  (*out_file_) <<"COMMENT ================================="<<std::endl ;
2080  (*out_file_) <<"COMMENT"<<std::endl ;
2081 
2082  (*out_file_) <<"COMMENT ================================="<<std::endl ;
2083  (*out_file_) <<"COMMENT Weight structure"<<std::endl ;
2084  (*out_file_) <<"COMMENT"<<std::endl ;
2085  (*out_file_) <<"COMMENT weightGroupId"<<std::endl ;
2086  (*out_file_) <<"COMMENT w0, w1, w2, w3, w4"<<std::endl ;
2087  (*out_file_) <<"COMMENT ================================="<<std::endl ;
2088  (*out_file_) <<"COMMENT"<<std::endl ;
2089 
2090  (*out_file_) <<"COMMENT ================================="<<std::endl ;
2091  (*out_file_) <<"COMMENT lut structure"<<std::endl ;
2092  (*out_file_) <<"COMMENT"<<std::endl ;
2093  (*out_file_) <<"COMMENT LUTGroupId"<<std::endl ;
2094  (*out_file_) <<"COMMENT LUT[1-1024]"<<std::endl ;
2095  (*out_file_) <<"COMMENT ================================="<<std::endl ;
2096  (*out_file_) <<"COMMENT"<<std::endl ;
2097 
2098  (*out_file_) <<"COMMENT ================================="<<std::endl ;
2099  (*out_file_) <<"COMMENT fg EB structure"<<std::endl ;
2100  (*out_file_) <<"COMMENT"<<std::endl ;
2101  (*out_file_) <<"COMMENT FgGroupId"<<std::endl ;
2102  (*out_file_) <<"COMMENT el, eh, tl, th, lut_fg"<<std::endl ;
2103  (*out_file_) <<"COMMENT ================================="<<std::endl ;
2104  (*out_file_) <<"COMMENT"<<std::endl ;
2105 
2106  (*out_file_) <<std::endl ;
2107 }
return(e1-e2)*(e1-e2)+dp *dp
void EcalTPGParamBuilder::getCoeff ( coeffStruc coeff,
const EcalIntercalibConstantMap calibMap,
uint  rawId 
)
private

Referenced by analyze().

void EcalTPGParamBuilder::getCoeff ( coeffStruc coeff,
const EcalGainRatioMap gainMap,
uint  rawId 
)
private
void EcalTPGParamBuilder::getCoeff ( coeffStruc coeff,
const EcalPedestalsMap pedMap,
uint  rawId 
)
private
void EcalTPGParamBuilder::getCoeff ( coeffStruc coeff,
const std::map< EcalLogicID, MonPedestalsDat > &  pedMap,
const EcalLogicID logicId 
)
private

Definition at line 2352 of file EcalTPGParamBuilder.cc.

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

2353 {
2354  // get current pedestal
2355  coeff.pedestals_[0] = 0 ;
2356  coeff.pedestals_[1] = 0 ;
2357  coeff.pedestals_[2] = 0 ;
2358 
2359  map<EcalLogicID, MonPedestalsDat>::const_iterator it = pedMap.find(logicId);
2360  if (it != pedMap.end()) {
2361  MonPedestalsDat ped = it->second ;
2362  coeff.pedestals_[0] = int(ped.getPedMeanG12() + 0.5) ;
2363  coeff.pedestals_[1] = int(ped.getPedMeanG6() + 0.5) ;
2364  coeff.pedestals_[2] = int(ped.getPedMeanG1() + 0.5) ;
2365  }
2366  else std::cout<<"getCoeff: "<<logicId.getID1()<<", "<<logicId.getID2()<<", "<<logicId.getID3()
2367  <<" not found in map<EcalLogicID, MonPedestalsDat>"<<std::endl ;
2368 }
int getID2() const
Definition: EcalLogicID.cc:51
float getPedMeanG12() const
int getID1() const
Definition: EcalLogicID.cc:46
float getPedMeanG1() const
float getPedMeanG6() const
tuple cout
Definition: gather_cfg.py:145
int getID3() const
Definition: EcalLogicID.cc:56
std::pair< std::string, int > EcalTPGParamBuilder::getCrate ( int  tcc)
private

Definition at line 2468 of file EcalTPGParamBuilder.cc.

References AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by analyze().

2468  {
2469  std::stringstream crate ;
2470  std::string pos ;
2471  int slot = 0 ;
2472 
2473  crate<<"S2D" ;
2474  if (tcc>=40 && tcc<=42) {crate<<"02d" ; slot = 5 + (tcc-40)*6 ;}
2475  if (tcc>=43 && tcc<=45) {crate<<"03d" ; slot = 5 + (tcc-43)*6 ;}
2476  if (tcc>=37 && tcc<=39) {crate<<"04d" ; slot = 5 + (tcc-37)*6 ;}
2477  if (tcc>=52 && tcc<=54) {crate<<"06d" ; slot = 5 + (tcc-52)*6 ;}
2478  if (tcc>=46 && tcc<=48) {crate<<"07d" ; slot = 5 + (tcc-46)*6 ;}
2479  if (tcc>=49 && tcc<=51) {crate<<"08d" ; slot = 5 + (tcc-49)*6 ;}
2480  if (tcc>=58 && tcc<=60) {crate<<"02h" ; slot = 5 + (tcc-58)*6 ;}
2481  if (tcc>=61 && tcc<=63) {crate<<"03h" ; slot = 5 + (tcc-61)*6 ;}
2482  if (tcc>=55 && tcc<=57) {crate<<"04h" ; slot = 5 + (tcc-55)*6 ;}
2483  if (tcc>=70 && tcc<=72) {crate<<"06h" ; slot = 5 + (tcc-70)*6 ;}
2484  if (tcc>=64 && tcc<=66) {crate<<"07h" ; slot = 5 + (tcc-64)*6 ;}
2485  if (tcc>=67 && tcc<=69) {crate<<"08h" ; slot = 5 + (tcc-67)*6 ;}
2486 
2487  if (tcc>=76 && tcc<=81) {
2488  crate<<"02l" ;
2489  if (tcc%2==0) slot = 2 + (tcc-76)*3 ;
2490  else slot = 4 + (tcc-77)*3 ;
2491  }
2492  if (tcc>=94 && tcc<=99) {
2493  crate<<"02l" ;
2494  if (tcc%2==0) slot = 3 + (tcc-94)*3 ;
2495  else slot = 5 + (tcc-95)*3 ;
2496  }
2497 
2498  if (tcc>=22 && tcc<=27) {
2499  crate<<"03l" ;
2500  if (tcc%2==0) slot = 2 + (tcc-22)*3 ;
2501  else slot = 4 + (tcc-23)*3 ;
2502  }
2503  if (tcc>=4 && tcc<=9) {
2504  crate<<"03l" ;
2505  if (tcc%2==0) slot = 3 + (tcc-4)*3 ;
2506  else slot = 5 + (tcc-5)*3 ;
2507  }
2508 
2509  if (tcc>=82 && tcc<=87) {
2510  crate<<"07l" ;
2511  if (tcc%2==0) slot = 2 + (tcc-82)*3 ;
2512  else slot = 4 + (tcc-83)*3 ;
2513  }
2514  if (tcc>=100 && tcc<=105) {
2515  crate<<"07l" ;
2516  if (tcc%2==0) slot = 3 + (tcc-100)*3 ;
2517  else slot = 5 + (tcc-101)*3 ;
2518  }
2519 
2520  if (tcc>=28 && tcc<=33) {
2521  crate<<"08l" ;
2522  if (tcc%2==0) slot = 2 + (tcc-28)*3 ;
2523  else slot = 4 + (tcc-29)*3 ;
2524  }
2525  if (tcc>=10 && tcc<=15) {
2526  crate<<"08l" ;
2527  if (tcc%2==0) slot = 3 + (tcc-10)*3 ;
2528  else slot = 5 + (tcc-11)*3 ;
2529  }
2530 
2531  if (tcc==34) {crate<<"04l" ; slot = 2 ;}
2532  if (tcc==16) {crate<<"04l" ; slot = 3 ;}
2533  if (tcc==35) {crate<<"04l" ; slot = 4 ;}
2534  if (tcc==17) {crate<<"04l" ; slot = 5 ;}
2535  if (tcc==36) {crate<<"04l" ; slot = 8 ;}
2536  if (tcc==18) {crate<<"04l" ; slot = 9 ;}
2537  if (tcc==19) {crate<<"04l" ; slot = 10 ;}
2538  if (tcc==1) {crate<<"04l" ; slot = 11 ;}
2539  if (tcc==20) {crate<<"04l" ; slot = 14 ;}
2540  if (tcc==2) {crate<<"04l" ; slot = 15 ;}
2541  if (tcc==21) {crate<<"04l" ; slot = 16 ;}
2542  if (tcc==3) {crate<<"04l" ; slot = 17 ;}
2543 
2544  if (tcc==88) {crate<<"06l" ; slot = 2 ;}
2545  if (tcc==106) {crate<<"06l" ; slot = 3 ;}
2546  if (tcc==89) {crate<<"06l" ; slot = 4 ;}
2547  if (tcc==107) {crate<<"06l" ; slot = 5 ;}
2548  if (tcc==90) {crate<<"06l" ; slot = 8 ;}
2549  if (tcc==108) {crate<<"06l" ; slot = 9 ;}
2550  if (tcc==73) {crate<<"06l" ; slot = 10 ;}
2551  if (tcc==91) {crate<<"06l" ; slot = 11 ;}
2552  if (tcc==74) {crate<<"06l" ; slot = 14 ;}
2553  if (tcc==92) {crate<<"06l" ; slot = 15 ;}
2554  if (tcc==75) {crate<<"06l" ; slot = 16 ;}
2555  if (tcc==93) {crate<<"06l" ; slot = 17 ;}
2556 
2557  return std::pair< std::string, int > (crate.str(),slot) ;
2558 }
std::string EcalTPGParamBuilder::getDet ( int  tcc)
private

Definition at line 2444 of file EcalTPGParamBuilder.cc.

Referenced by analyze().

2444  {
2445  std::stringstream sdet ;
2446 
2447  if (tcc>36 && tcc<55) sdet<<"EB-"<<tcc-36 ;
2448  else if (tcc>=55 && tcc<73) sdet<<"EB+"<<tcc-54 ;
2449  else if (tcc<=36) sdet<<"EE-" ;
2450  else sdet<<"EE+" ;
2451 
2452  if (tcc<=36 || tcc>=73) {
2453  if (tcc>=73) tcc-=72 ;
2454  if (tcc==1 || tcc==18 || tcc==19 || tcc==36) sdet<<7 ;
2455  else if (tcc==2 || tcc==3 || tcc==20 || tcc==21) sdet<<8 ;
2456  else if (tcc==4 || tcc==5 || tcc==22 || tcc==23) sdet<<9 ;
2457  else if (tcc==6 || tcc==7 || tcc==24 || tcc==25) sdet<<1 ;
2458  else if (tcc==8 || tcc==9 || tcc==26 || tcc==27) sdet<<2 ;
2459  else if (tcc==10 || tcc==11 || tcc==28 || tcc==29) sdet<<3 ;
2460  else if (tcc==12 || tcc==13 || tcc==30 || tcc==31) sdet<<4 ;
2461  else if (tcc==14 || tcc==15 || tcc==32 || tcc==33) sdet<<5 ;
2462  else if (tcc==16 || tcc==17 || tcc==34 || tcc==35) sdet<<6 ;
2463  }
2464 
2465  return sdet.str() ;
2466 }
int EcalTPGParamBuilder::getEtaSlice ( int  tccId,
int  towerInTCC 
)
private

Definition at line 344 of file EcalTPGParamBuilder.cc.

345 {
346  int etaSlice = (towerInTCC-1)/4+1 ;
347  // barrel
348  if (tccId>36 || tccId<73) return etaSlice ;
349  //endcap
350  else {
351  if (tccId >=1 && tccId <= 18) etaSlice += 21 ; // inner -
352  if (tccId >=19 && tccId <= 36) etaSlice += 17 ; // outer -
353  if (tccId >=91 && tccId <= 108) etaSlice += 21 ; // inner +
354  if (tccId >=73 && tccId <= 90) etaSlice += 17 ; // outer +
355  }
356  return etaSlice ;
357 }
unsigned tccId(DetId const &)
int EcalTPGParamBuilder::getGCTRegionEta ( int  tteta)
private

Definition at line 2437 of file EcalTPGParamBuilder.cc.

Referenced by analyze().

2437  {
2438  int gcteta = 0;
2439  if(tteta>0) gcteta = (tteta-1)/4 + 11;
2440  else if(tteta<0) gcteta = (tteta+1)/4 + 10;
2441  return gcteta;
2442 }
int EcalTPGParamBuilder::getGCTRegionPhi ( int  ttphi)
private

Definition at line 2429 of file EcalTPGParamBuilder.cc.

Referenced by analyze().

2429  {
2430  int gctphi=0;
2431  gctphi = (ttphi+1)/4;
2432  if(ttphi<=2) gctphi=0;
2433  if(ttphi>=71) gctphi=0;
2434  return gctphi;
2435 }
bool EcalTPGParamBuilder::realignBaseline ( linStruc lin,
float  forceBase12 
)
private

Definition at line 2405 of file EcalTPGParamBuilder.cc.

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

Referenced by analyze().

2406 {
2407  bool ok(true) ;
2408  float base[3] = {forceBase12, float(lin.pedestal_[1]), float(lin.pedestal_[2])} ;
2409  for (int i=1 ; i<3 ; i++) {
2410  if (lin.mult_[i]>0) {
2411  base[i] = float(lin.pedestal_[i]) -
2412  float(lin.mult_[0])/float(lin.mult_[i])*pow(2., -(lin.shift_[0]-lin.shift_[i]))*(lin.pedestal_[0]-base[0]) ;
2413  } else base[i] = 0 ;
2414  }
2415 
2416  for (int i=0 ; i<3 ; i++) {
2417  lin.pedestal_[i] = base[i] ;
2418  //cout<<lin.pedestal_[i]<<" "<<base[i]<<endl ;
2419  if (base[i]<0 || lin.pedestal_[i]>1000) {
2420  cout<<"WARNING: base= "<<base[i]<<", "<<lin.pedestal_[i]<<" for gainId[0-2]="<<i<<" ==> forcing at 0"<<endl ;
2421  lin.pedestal_[i] = 0 ;
2422  ok = false ;
2423  }
2424  }
2425  return ok ;
2426 
2427 }
tuple base
Main Program
Definition: newFWLiteAna.py:91
int i
Definition: DBlmapReader.cc:9
tuple cout
Definition: gather_cfg.py:145
volatile std::atomic< bool > shutdown_flag false
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 2110 of file EcalTPGParamBuilder.cc.

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

Referenced by computeWeights().

2111 {
2112  int iweight ;
2113  unsigned int max = (unsigned int)(pow(2.,complement2)-1) ;
2114  if (weight>0) iweight=int((1<<6)*weight+0.5) ; // +0.5 for rounding pb
2115  else iweight= max - int(-weight*(1<<6)+0.5) +1 ;
2116  iweight = iweight & max ;
2117  return iweight ;
2118 }
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 2120 of file EcalTPGParamBuilder.cc.

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

2121 {
2122  double weight = double(iweight)/pow(2., 6.) ;
2123  // test if negative weight:
2124  if ( (iweight & (1<<(complement2-1))) != 0) weight = (double(iweight)-pow(2., complement2))/pow(2., 6.) ;
2125  return weight ;
2126 }
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40

Member Data Documentation

int EcalTPGParamBuilder::bst_conf_id_
private

Definition at line 142 of file EcalTPGParamBuilder.h.

Referenced by analyze(), and EcalTPGParamBuilder().

int EcalTPGParamBuilder::btt_conf_id_
private

Definition at line 141 of file EcalTPGParamBuilder.h.

Referenced by analyze(), and EcalTPGParamBuilder().

int EcalTPGParamBuilder::bxt_conf_id_
private

Definition at line 140 of file EcalTPGParamBuilder.h.

Referenced by analyze(), and EcalTPGParamBuilder().

unsigned int EcalTPGParamBuilder::complement2_
private

Definition at line 98 of file EcalTPGParamBuilder.h.

Referenced by computeWeights().

EcalTPGDBApp* EcalTPGParamBuilder::db_
private

Definition at line 127 of file EcalTPGParamBuilder.h.

Referenced by analyze(), and EcalTPGParamBuilder().

bool EcalTPGParamBuilder::DBEE_
private

Definition at line 130 of file EcalTPGParamBuilder.h.

Referenced by analyze(), and EcalTPGParamBuilder().

int EcalTPGParamBuilder::del_conf_id_
private

Definition at line 139 of file EcalTPGParamBuilder.h.

Referenced by analyze(), and EcalTPGParamBuilder().

std::map<int, std::vector<int> > EcalTPGParamBuilder::delays_EB_
private

Definition at line 120 of file EcalTPGParamBuilder.h.

Referenced by analyze(), and EcalTPGParamBuilder().

std::map<int, std::vector<int> > EcalTPGParamBuilder::delays_EE_
private

Definition at line 122 of file EcalTPGParamBuilder.h.

Referenced by analyze(), and EcalTPGParamBuilder().

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

Definition at line 87 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 106 of file EcalTPGParamBuilder.h.

Referenced by computeFineGrainEBParameters(), and EcalTPGParamBuilder().

unsigned int EcalTPGParamBuilder::FG_lut_strip_EE_
private

Definition at line 108 of file EcalTPGParamBuilder.h.

Referenced by computeFineGrainEEParameters(), and EcalTPGParamBuilder().

unsigned int EcalTPGParamBuilder::FG_lut_tower_EE_
private

Definition at line 108 of file EcalTPGParamBuilder.h.

Referenced by computeFineGrainEEParameters(), and EcalTPGParamBuilder().

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

Definition at line 135 of file EcalTPGParamBuilder.h.

Referenced by analyze(), and EcalTPGParamBuilder().

int EcalTPGParamBuilder::forcedPedestalValue_
private

Definition at line 109 of file EcalTPGParamBuilder.h.

Referenced by analyze(), and EcalTPGParamBuilder().

bool EcalTPGParamBuilder::forceEtaSlice_
private

Definition at line 110 of file EcalTPGParamBuilder.h.

Referenced by analyze(), and EcalTPGParamBuilder().

std::ofstream* EcalTPGParamBuilder::geomFile_
private

Definition at line 126 of file EcalTPGParamBuilder.h.

Referenced by EcalTPGParamBuilder().

bool EcalTPGParamBuilder::H2_
private

Definition at line 113 of file EcalTPGParamBuilder.h.

Referenced by analyze(), and EcalTPGParamBuilder().

int EcalTPGParamBuilder::lin_conf_id_
private

Definition at line 133 of file EcalTPGParamBuilder.h.

Referenced by analyze(), and EcalTPGParamBuilder().

int EcalTPGParamBuilder::lut_conf_id_
private

Definition at line 134 of file EcalTPGParamBuilder.h.

Referenced by analyze(), and EcalTPGParamBuilder().

double EcalTPGParamBuilder::LUT_constant_EB_
private

Definition at line 101 of file EcalTPGParamBuilder.h.

Referenced by computeLUT(), and EcalTPGParamBuilder().

double EcalTPGParamBuilder::LUT_constant_EE_
private

Definition at line 102 of file EcalTPGParamBuilder.h.

Referenced by computeLUT(), and EcalTPGParamBuilder().

double EcalTPGParamBuilder::LUT_noise_EB_
private

Definition at line 101 of file EcalTPGParamBuilder.h.

Referenced by computeLUT(), and EcalTPGParamBuilder().

double EcalTPGParamBuilder::LUT_noise_EE_
private

Definition at line 102 of file EcalTPGParamBuilder.h.

Referenced by computeLUT(), and EcalTPGParamBuilder().

std::string EcalTPGParamBuilder::LUT_option_
private

Definition at line 99 of file EcalTPGParamBuilder.h.

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

double EcalTPGParamBuilder::LUT_stochastic_EB_
private

Definition at line 101 of file EcalTPGParamBuilder.h.

Referenced by computeLUT(), and EcalTPGParamBuilder().

double EcalTPGParamBuilder::LUT_stochastic_EE_
private

Definition at line 102 of file EcalTPGParamBuilder.h.

Referenced by computeLUT(), and EcalTPGParamBuilder().

double EcalTPGParamBuilder::LUT_threshold_EB_
private

Definition at line 100 of file EcalTPGParamBuilder.h.

Referenced by computeLUT(), and EcalTPGParamBuilder().

double EcalTPGParamBuilder::LUT_threshold_EE_
private

Definition at line 100 of file EcalTPGParamBuilder.h.

Referenced by computeLUT(), and EcalTPGParamBuilder().

int EcalTPGParamBuilder::m_write_bst
private

Definition at line 155 of file EcalTPGParamBuilder.h.

Referenced by 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_del
private

Definition at line 152 of file EcalTPGParamBuilder.h.

Referenced by analyze(), and EcalTPGParamBuilder().

int EcalTPGParamBuilder::m_write_fgr
private

Definition at line 149 of file EcalTPGParamBuilder.h.

Referenced by analyze(), and EcalTPGParamBuilder().

int EcalTPGParamBuilder::m_write_lin
private

Definition at line 146 of file EcalTPGParamBuilder.h.

Referenced by analyze(), and EcalTPGParamBuilder().

int EcalTPGParamBuilder::m_write_lut
private

Definition at line 147 of file EcalTPGParamBuilder.h.

Referenced by analyze(), and EcalTPGParamBuilder().

int EcalTPGParamBuilder::m_write_ped
private

Definition at line 145 of file EcalTPGParamBuilder.h.

Referenced by analyze(), and EcalTPGParamBuilder().

int EcalTPGParamBuilder::m_write_sli
private

Definition at line 150 of file EcalTPGParamBuilder.h.

Referenced by analyze(), and EcalTPGParamBuilder().

int EcalTPGParamBuilder::m_write_spi
private

Definition at line 151 of file EcalTPGParamBuilder.h.

Referenced by analyze(), and EcalTPGParamBuilder().

int EcalTPGParamBuilder::m_write_wei
private

Definition at line 148 of file EcalTPGParamBuilder.h.

Referenced by analyze(), and EcalTPGParamBuilder().

unsigned int EcalTPGParamBuilder::nSample_
private

Definition at line 97 of file EcalTPGParamBuilder.h.

Referenced by computeWeights().

Char_t EcalTPGParamBuilder::ntupleCrate_[10]
private

Definition at line 159 of file EcalTPGParamBuilder.h.

Referenced by analyze().

Char_t EcalTPGParamBuilder::ntupleDet_[10]
private

Definition at line 158 of file EcalTPGParamBuilder.h.

Referenced by analyze().

Int_t* EcalTPGParamBuilder::ntupleInts_
private

Definition at line 157 of file EcalTPGParamBuilder.h.

Referenced by analyze().

std::ofstream* EcalTPGParamBuilder::out_file_
private

Definition at line 125 of file EcalTPGParamBuilder.h.

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

int EcalTPGParamBuilder::ped_conf_id_
private

Definition at line 132 of file EcalTPGParamBuilder.h.

Referenced by analyze(), and EcalTPGParamBuilder().

unsigned int EcalTPGParamBuilder::pedestal_offset_
private

Definition at line 111 of file EcalTPGParamBuilder.h.

Referenced by analyze(), and EcalTPGParamBuilder().

std::map<int, std::vector<int> > EcalTPGParamBuilder::phases_EB_
private

Definition at line 121 of file EcalTPGParamBuilder.h.

Referenced by analyze(), and EcalTPGParamBuilder().

std::map<int, std::vector<int> > EcalTPGParamBuilder::phases_EE_
private

Definition at line 123 of file EcalTPGParamBuilder.h.

Referenced by analyze(), and EcalTPGParamBuilder().

unsigned int EcalTPGParamBuilder::sampleMax_
private

Definition at line 94 of file EcalTPGParamBuilder.h.

Referenced by computeWeights(), and EcalTPGParamBuilder().

unsigned int EcalTPGParamBuilder::SFGVB_lut_
private

Definition at line 111 of file EcalTPGParamBuilder.h.

Referenced by analyze(), and EcalTPGParamBuilder().

int EcalTPGParamBuilder::SFGVB_SpikeKillingThreshold_
private

Definition at line 112 of file EcalTPGParamBuilder.h.

Referenced by analyze(), and EcalTPGParamBuilder().

unsigned int EcalTPGParamBuilder::SFGVB_Threshold_
private

Definition at line 111 of file EcalTPGParamBuilder.h.

Referenced by analyze(), and EcalTPGParamBuilder().

int EcalTPGParamBuilder::sli_conf_id_
private

Definition at line 136 of file EcalTPGParamBuilder.h.

Referenced by analyze(), and EcalTPGParamBuilder().

unsigned int EcalTPGParamBuilder::sliding_
private

Definition at line 93 of file EcalTPGParamBuilder.h.

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

int EcalTPGParamBuilder::spi_conf_id_
private

Definition at line 138 of file EcalTPGParamBuilder.h.

Referenced by analyze(), and EcalTPGParamBuilder().

std::string EcalTPGParamBuilder::tag_
private

Definition at line 143 of file EcalTPGParamBuilder.h.

Referenced by analyze(), and EcalTPGParamBuilder().

const CaloSubdetectorGeometry* EcalTPGParamBuilder::theBarrelGeometry_
private

Definition at line 86 of file EcalTPGParamBuilder.h.

Referenced by analyze().

const CaloSubdetectorGeometry* EcalTPGParamBuilder::theEndcapGeometry_
private

Definition at line 85 of file EcalTPGParamBuilder.h.

Referenced by analyze().

const EcalElectronicsMapping* EcalTPGParamBuilder::theMapping_
private

Definition at line 88 of file EcalTPGParamBuilder.h.

Referenced by analyze().

std::string EcalTPGParamBuilder::TimingDelays_EB_
private

Definition at line 116 of file EcalTPGParamBuilder.h.

Referenced by EcalTPGParamBuilder().

std::string EcalTPGParamBuilder::TimingDelays_EE_
private

Definition at line 117 of file EcalTPGParamBuilder.h.

Referenced by EcalTPGParamBuilder().

std::string EcalTPGParamBuilder::TimingPhases_EB_
private

Definition at line 118 of file EcalTPGParamBuilder.h.

Referenced by EcalTPGParamBuilder().

std::string EcalTPGParamBuilder::TimingPhases_EE_
private

Definition at line 119 of file EcalTPGParamBuilder.h.

Referenced by EcalTPGParamBuilder().

double EcalTPGParamBuilder::TTF_highThreshold_EB_
private

Definition at line 103 of file EcalTPGParamBuilder.h.

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

double EcalTPGParamBuilder::TTF_highThreshold_EE_
private

Definition at line 104 of file EcalTPGParamBuilder.h.

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

double EcalTPGParamBuilder::TTF_lowThreshold_EB_
private

Definition at line 103 of file EcalTPGParamBuilder.h.

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

double EcalTPGParamBuilder::TTF_lowThreshold_EE_
private

Definition at line 104 of file EcalTPGParamBuilder.h.

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

bool EcalTPGParamBuilder::useInterCalibration_
private

Definition at line 113 of file EcalTPGParamBuilder.h.

Referenced by EcalTPGParamBuilder().

bool EcalTPGParamBuilder::useTransverseEnergy_
private

Definition at line 90 of file EcalTPGParamBuilder.h.

Referenced by analyze(), and EcalTPGParamBuilder().

int EcalTPGParamBuilder::version_
private

Definition at line 144 of file EcalTPGParamBuilder.h.

Referenced by analyze(), and EcalTPGParamBuilder().

int EcalTPGParamBuilder::wei_conf_id_
private

Definition at line 137 of file EcalTPGParamBuilder.h.

Referenced by analyze(), and EcalTPGParamBuilder().

double EcalTPGParamBuilder::weight_timeShift_
private

Definition at line 95 of file EcalTPGParamBuilder.h.

Referenced by computeWeights(), and EcalTPGParamBuilder().

bool EcalTPGParamBuilder::weight_unbias_recovery_
private

Definition at line 96 of file EcalTPGParamBuilder.h.

Referenced by computeWeights(), and EcalTPGParamBuilder().

bool EcalTPGParamBuilder::writeToDB_
private

Definition at line 128 of file EcalTPGParamBuilder.h.

Referenced by analyze(), and EcalTPGParamBuilder().

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

Definition at line 91 of file EcalTPGParamBuilder.h.

Referenced by analyze(), and computeLinearizerParam().

double EcalTPGParamBuilder::xtal_LSB_EE_
private

Definition at line 91 of file EcalTPGParamBuilder.h.

Referenced by analyze(), and computeLinearizerParam().