CMS 3D CMS Logo

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

#include <EcalTPGParamBuilder.h>

Inheritance diagram for EcalTPGParamBuilder:
edm::EDAnalyzer

Public Member Functions

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

Private Member Functions

void computeFineGrainEBParameters (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_
 
unsigned int DBrunNb_
 
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
 
typedef WorkerT< EDAnalyzerWorkerType
 
- 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::EDAnalyzer
CurrentProcessingContext const * currentContext () const
 

Detailed Description

Definition at line 64 of file EcalTPGParamBuilder.h.

Constructor & Destructor Documentation

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

Definition at line 54 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, dbtoconf::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_, 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_.

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

Definition at line 324 of file EcalTPGParamBuilder.cc.

References out_file_, and writeToFiles_.

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

References abs, Reference_intrackfit_cff::barrel, 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(), 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_, first, forcedPedestalValue_, forceEtaSlice_, 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, errorMatrix2Lands_multiChannel::id, EcalTrigTowerDetId::ieta(), EcalTrigTowerDetId::ietaAbs(), EcalCondObjectContainer< T >::insert(), EcalTrigTowerDetId::iphi(), EcalElectronicsMapping::iTT(), j, gen::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, VarParsing::mult, linStruc::mult_, ntupleCrate_, ntupleDet_, ntupleInts_, EcalLogicID::NULLID, convertSQLiteXML::ok, dbtoconf::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(), compare_using_db::sample, IODConfig::setConfigTag(), FEConfigLinParamDat::setETSat(), FEConfigLUTParamDat::setETSat(), FEConfigFgrParamDat::setFGhighratio(), FEConfigFgrParamDat::setFGhighthresh(), FEConfigFgrParamDat::setFGlowratio(), FEConfigFgrParamDat::setFGlowthresh(), FEConfigFgrDat::setFgrGroupId(), FEConfigFgrGroupDat::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_, EcalSimParameterMap::simParameters(), funct::sin(), findQualityFiles::size, sli_conf_id_, sliding_, EBDetId::SMCRYSTALMODE, spi_conf_id_, EcalElectronicsId::stripId(), EcalTrigTowerDetId::subDet(), tag_, EcalElectronicsMapping::TCCid(), theBarrelGeometry_, theEndcapGeometry_, theMapping_, PV3DBase< T, PVType, FrameType >::theta(), theta(), dtDQMClient_cfg::threshold, CaloSimParameters::timePhase(), 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_, vdt::x, xtal_LSB_EB_, xtal_LSB_EE_, EcalElectronicsId::xtalId(), EEDetId::XYMODE, detailsBasic3DVector::y, detailsBasic3DVector::z, and EcalTrigTowerDetId::zside().

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

Reimplemented from edm::EDAnalyzer.

Definition at line 1953 of file EcalTPGParamBuilder.cc.

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

1954 {
1955  using namespace edm;
1956  using namespace std;
1957 
1958  std::cout<<"we are in beginJob"<<endl;
1959 
1960  create_header() ;
1961 
1964 
1965  if (writeToFiles_) {
1966  (*out_file_)<<"PHYSICS_EB "<<dec<<eb.rawId()<<std::endl ;
1967  (*out_file_)<<Et_sat_EB_<<" "<<TTF_lowThreshold_EB_<<" "<<TTF_highThreshold_EB_<<std::endl ;
1968  (*out_file_)<<FG_lowThreshold_EB_<<" "<<FG_highThreshold_EB_<<" "
1969  <<FG_lowRatio_EB_<<" "<<FG_highRatio_EB_<<std::endl ;
1970  //(*out_file_) << SFGVB_SpikeKillingThreshold_ << std::endl; //modif-alex02/02/2011
1971  (*out_file_) <<std::endl ;
1972 
1973  (*out_file_)<<"PHYSICS_EE "<<dec<<ee.rawId()<<std::endl ;
1974  (*out_file_)<<Et_sat_EE_<<" "<<TTF_lowThreshold_EE_<<" "<<TTF_highThreshold_EE_<<std::endl ;
1975  (*out_file_)<<FG_Threshold_EE_<<" "<<-1<<" "
1976  <<-1<<" "<<-1<<std::endl ;
1977  (*out_file_) <<std::endl ;
1978  }
1979 
1980 }
Definition: DetId.h:20
tuple cout
Definition: gather_cfg.py:121
bool EcalTPGParamBuilder::checkIfOK ( EcalPedestals::Item  item)

Definition at line 334 of file EcalTPGParamBuilder.cc.

References query::result.

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

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

2392 {
2393  lowRatio = int(0x80*FG_lowRatio_EB_ + 0.5) ;
2394  if (lowRatio>0x7f) lowRatio = 0x7f ;
2395  highRatio = int(0x80*FG_highRatio_EB_ + 0.5) ;
2396  if (highRatio>0x7f) highRatio = 0x7f ;
2397 
2398  // lsb at the stage of the FG calculation is:
2399  double lsb_FG = Et_sat_EB_/1024./4 ;
2400  lowThreshold = int(FG_lowThreshold_EB_/lsb_FG+0.5) ;
2401  if (lowThreshold>0xff) lowThreshold = 0xff ;
2402  highThreshold = int(FG_highThreshold_EB_/lsb_FG+0.5) ;
2403  if (highThreshold>0xff) highThreshold = 0xff ;
2404 
2405  // FG lut: FGVB response is LUT(adress) where adress is:
2406  // bit3: maxof2/ET >= lowRatio, bit2: maxof2/ET >= highRatio, bit1: ET >= lowThreshold, bit0: ET >= highThreshold
2407  // FGVB =1 if jet-like (veto active), =0 if E.M.-like
2408  // the condition for jet-like is: ET>Threshold and maxof2/ET < Ratio (only TT with enough energy are vetoed)
2409 
2410  // With the following lut, what matters is only max(TLow, Thigh) and max(Elow, Ehigh)
2411  // So, jet-like if maxof2/ettot<max(TLow, Thigh) && ettot >= max(Elow, Ehigh)
2412  if (FG_lut_EB_ == 0) lut = 0x0888 ;
2413  else lut = FG_lut_EB_ ; // let's use the users value (hope he/she knows what he/she does!)
2414 }
tuple lut
Definition: lumiPlot.py:244
void EcalTPGParamBuilder::computeFineGrainEEParameters ( uint &  threshold,
uint &  lut_strip,
uint &  lut_tower 
)
private

Definition at line 2416 of file EcalTPGParamBuilder.cc.

References Et_sat_EE_, FG_lut_strip_EE_, FG_lut_tower_EE_, and FG_Threshold_EE_.

Referenced by analyze().

2417 {
2418  // lsb for EE:
2419  double lsb_FG = Et_sat_EE_/1024. ; // FIXME is it true????
2420  threshold = int(FG_Threshold_EE_/lsb_FG+0.5) ;
2421  lut_strip = FG_lut_strip_EE_ ;
2422  lut_tower = FG_lut_tower_EE_ ;
2423 }
bool EcalTPGParamBuilder::computeLinearizerParam ( double  theta,
double  gainRatio,
double  calibCoeff,
std::string  subdet,
int &  mult,
int &  shift 
)
private

Definition at line 1984 of file EcalTPGParamBuilder.cc.

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

Referenced by analyze().

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

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

2265 {
2266  double Et_sat = Et_sat_EB_ ;
2267  double LUT_threshold = LUT_threshold_EB_ ;
2268  double LUT_stochastic = LUT_stochastic_EB_ ;
2269  double LUT_noise = LUT_noise_EB_ ;
2270  double LUT_constant = LUT_constant_EB_ ;
2271  double TTF_lowThreshold = TTF_lowThreshold_EB_ ;
2272  double TTF_highThreshold = TTF_highThreshold_EB_ ;
2273  if (det == "EE") {
2274  Et_sat = Et_sat_EE_ ;
2275  LUT_threshold = LUT_threshold_EE_ ;
2276  LUT_stochastic = LUT_stochastic_EE_ ;
2277  LUT_noise = LUT_noise_EE_ ;
2278  LUT_constant = LUT_constant_EE_ ;
2279  TTF_lowThreshold = TTF_lowThreshold_EE_ ;
2280  TTF_highThreshold = TTF_highThreshold_EE_ ;
2281  }
2282 
2283  // initialisation with identity
2284  for (int i=0 ; i<1024 ; i++) {
2285  lut[i] = i ;
2286  if (lut[i]>0xff) lut[i] = 0xff ;
2287  }
2288 
2289  // case linear LUT
2290  if (LUT_option_ == "Linear") {
2291  int mylut = 0 ;
2292  for (int i=0 ; i<1024 ; i++) {
2293  lut[i] = mylut ;
2294  if ((i+1)%4 == 0 ) mylut++ ;
2295  //if ((i+1)%8 == 0 ) mylut++ ;//modif-alex 16/12/2010 LSB==500MeV ONLY USED FOR BEAMV4 key
2296  }
2297  }
2298 
2299  // case LUT following Ecal resolution
2300  if (LUT_option_ == "EcalResolution") {
2301  TF1 * func = new TF1("func",oneOverEtResolEt, 0., Et_sat,3) ;
2302  func->SetParameters(LUT_stochastic, LUT_noise, LUT_constant) ;
2303  double norm = func->Integral(0., Et_sat) ;
2304  for (int i=0 ; i<1024 ; i++) {
2305  double Et = i*Et_sat/1024. ;
2306  lut[i] = int(0xff*func->Integral(0., Et)/norm + 0.5) ;
2307  }
2308  }
2309 
2310  // Now, add TTF thresholds to LUT and apply LUT threshold if needed
2311  for (int j=0 ; j<1024 ; j++) {
2312  double Et_GeV = Et_sat/1024*(j+0.5) ;
2313  if (Et_GeV <= LUT_threshold) lut[j] = 0 ; // LUT threshold
2314  int ttf = 0x0 ;
2315  if (Et_GeV >= TTF_highThreshold) ttf = 3 ;
2316  if (Et_GeV >= TTF_lowThreshold && Et_GeV < TTF_highThreshold) ttf = 1 ;
2317  ttf = ttf << 8 ;
2318  lut[j] += ttf ;
2319  }
2320 
2321 }
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 2141 of file EcalTPGParamBuilder.cc.

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

Referenced by analyze().

2145 {
2146  std::cout<<"Computing Weights..."<<std::endl ;
2147 #if (CMSSW_VERSION>=340)
2148  double timeMax = shape.timeOfMax() - shape.timeOfThr() ; // timeMax w.r.t begining of pulse
2149 #else
2150  double timeMax = shape.computeTimeOfMaximum() - shape.computeT0() ; // timeMax w.r.t begining of pulse
2151 #endif
2152  double max = shape(timeMax) ;
2153 
2154  double sumf = 0. ;
2155  double sumf2 = 0. ;
2156  for (unsigned int sample = 0 ; sample<nSample_ ; sample++) {
2157  double time = timeMax - ((double)sampleMax_-(double)sample)*25. ;
2158  time -= weight_timeShift_ ;
2159  sumf += shape(time)/max ;
2160  sumf2 += shape(time)/max * shape(time)/max ;
2161  for (int subtime = 0 ; subtime<25 ; subtime++) histo->Fill(float(sample*25. + subtime)/25., shape(time+subtime)) ;
2162  }
2163  double lambda = 1./(sumf2-sumf*sumf/nSample_) ;
2164  double gamma = -lambda*sumf/nSample_ ;
2165  double * weight = new double[nSample_] ;
2166  for (unsigned int sample = 0 ; sample<nSample_ ; sample++) {
2167  double time = timeMax - ((double)sampleMax_-(double)sample)*25. ;
2168  time -= weight_timeShift_ ;
2169  weight[sample] = lambda*shape(time)/max + gamma ;
2170  }
2171 
2172 
2173  int * iweight = new int[nSample_] ;
2174  for (unsigned int sample = 0 ; sample<nSample_ ; sample++) iweight[sample] = uncodeWeight(weight[sample], complement2_) ;
2175 
2176  // Let's check:
2177  int isumw = 0 ;
2178  for (unsigned int sample = 0 ; sample<nSample_ ; sample++) isumw += iweight[sample] ;
2179  unsigned int imax = (unsigned int)(pow(2.,int(complement2_))-1) ;
2180  isumw = (isumw & imax ) ;
2181 
2182  double ampl = 0. ;
2183  double sumw = 0. ;
2184  for (unsigned int sample = 0 ; sample<nSample_ ; sample++) {
2185  double time = timeMax - ((double)sampleMax_-(double)sample)*25. ;
2186  time -= weight_timeShift_ ;
2187  ampl += weight[sample]*shape(time) ;
2188  sumw += weight[sample] ;
2189  std::cout<<"weight="<<weight[sample]<<" shape="<<shape(time)<<std::endl ;
2190  }
2191  std::cout<<"Weights: sum="<<isumw<<" in float ="<<uncodeWeight(isumw, complement2_)<<" sum of floats ="<<sumw<<std::endl ;
2192  std::cout<<"Weights: sum (weight*shape) = "<<ampl<<std::endl ;
2193 
2194 
2195 
2196  // Let's correct for bias if any
2198  int count = 0 ;
2199  while (isumw != 0 && count<10) {
2200  double min = 99. ;
2201  unsigned int index = 0 ;
2202  if ( (isumw & (1<<(complement2_-1))) != 0) {
2203  // add 1:
2204  std::cout<<"Correcting for bias: adding 1"<<std::endl ;
2205  for (unsigned int sample = 0 ; sample<nSample_ ; sample++) {
2206  int new_iweight = iweight[sample]+1 ;
2207  double new_weight = uncodeWeight(new_iweight, complement2_) ;
2208  if (fabs(new_weight-weight[sample])<min) {
2209  min = fabs(new_weight-weight[sample]) ;
2210  index = sample ;
2211  }
2212  }
2213  iweight[index] ++ ;
2214  } else {
2215  // Sub 1:
2216  std::cout<<"Correcting for bias: subtracting 1"<<std::endl ;
2217  for (unsigned int sample = 0 ; sample<nSample_ ; sample++) {
2218  int new_iweight = iweight[sample]-1 ;
2219  double new_weight = uncodeWeight(new_iweight, complement2_) ;
2220  if (fabs(new_weight-weight[sample])<min) {
2221  min = fabs(new_weight-weight[sample]) ;
2222  index = sample ;
2223  }
2224  }
2225  iweight[index] -- ;
2226  }
2227  isumw = 0 ;
2228  for (unsigned int sample = 0 ; sample<nSample_ ; sample++) isumw += iweight[sample] ;
2229  imax = (unsigned int)(pow(2.,int(complement2_))-1) ;
2230  isumw = (isumw & imax ) ;
2231  std::cout<<"Correcting weight number: "<<index<<" sum weights = "<<isumw<<std::endl ;
2232  count ++ ;
2233  }
2234  }
2235 
2236  // let's check again
2237  isumw = 0 ;
2238  for (unsigned int sample = 0 ; sample<nSample_ ; sample++) isumw += iweight[sample] ;
2239  imax = (unsigned int)(pow(2.,int(complement2_))-1) ;
2240  isumw = (isumw & imax ) ;
2241  ampl = 0. ;
2242  for (unsigned int sample = 0 ; sample<nSample_ ; sample++) {
2243  double time = timeMax - ((double)sampleMax_-(double)sample)*25. ;
2244  time -= weight_timeShift_ ;
2245  double new_weight = uncodeWeight(iweight[sample], complement2_) ;
2246  sumw += uncodeWeight(iweight[sample], complement2_) ;
2247  ampl += new_weight*shape(time) ;
2248  std::cout<<"weight unbiased after integer conversion="<<new_weight<<" shape="<<shape(time)<<std::endl ;
2249  }
2250  std::cout<<"Weights: sum="<<isumw<<" in float ="<<uncodeWeight(isumw, complement2_)<<" sum of floats ="<<sumw<<std::endl ;
2251  std::cout<<"Weights: sum (weight*shape) = "<<ampl<<std::endl ;
2252 
2253 
2254 
2255  std::vector<unsigned int> theWeights ;
2256  for (unsigned int sample = 0 ; sample<nSample_ ; sample++) theWeights.push_back(iweight[sample]) ;
2257  std::cout<<std::endl ;
2258 
2259  delete weight ;
2260  delete iweight ;
2261  return theWeights ;
2262 }
long int integer
Definition: mlp_lapack.h:12
#define min(a, b)
Definition: mlp_lapack.h:161
const T & max(const T &a, const T &b)
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
void conversion(EventAux const &from, EventAuxiliary &to)
Definition: EventAux.cc:9
double timeOfThr() const
perl if(1 lt scalar(@::datatypes))
Definition: edlooper.cc:31
tuple cout
Definition: gather_cfg.py:121
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 2028 of file EcalTPGParamBuilder.cc.

References hitfit::return, and writeToFiles_.

Referenced by beginJob().

2029 {
2030  if (!writeToFiles_) return ;
2031  (*out_file_) <<"COMMENT put your comments here"<<std::endl ;
2032 
2033  (*out_file_) <<"COMMENT ================================="<<std::endl ;
2034  (*out_file_) <<"COMMENT physics EB structure"<<std::endl ;
2035  (*out_file_) <<"COMMENT"<<std::endl ;
2036  (*out_file_) <<"COMMENT EtSaturation (GeV), ttf_threshold_Low (GeV), ttf_threshold_High (GeV)"<<std::endl ;
2037  (*out_file_) <<"COMMENT FG_lowThreshold (GeV), FG_highThreshold (GeV), FG_lowRatio, FG_highRatio"<<std::endl ;
2038  //(*out_file_) <<"COMMENT SFGVB_SpikeKillingThreshold (GeV)"<<std::endl ; //modif-alex-02/02/2011
2039  (*out_file_) <<"COMMENT ================================="<<std::endl ;
2040  (*out_file_) <<"COMMENT"<<std::endl ;
2041 
2042  (*out_file_) <<"COMMENT ================================="<<std::endl ;
2043  (*out_file_) <<"COMMENT physics EE structure"<<std::endl ;
2044  (*out_file_) <<"COMMENT"<<std::endl ;
2045  (*out_file_) <<"COMMENT EtSaturation (GeV), ttf_threshold_Low (GeV), ttf_threshold_High (GeV)"<<std::endl ;
2046  (*out_file_) <<"COMMENT FG_Threshold (GeV), dummy, dummy, dummy"<<std::endl ;
2047  (*out_file_) <<"COMMENT ================================="<<std::endl ;
2048  (*out_file_) <<"COMMENT"<<std::endl ;
2049 
2050  (*out_file_) <<"COMMENT ================================="<<std::endl ;
2051  (*out_file_) <<"COMMENT crystal structure (same for EB and EE)"<<std::endl ;
2052  (*out_file_) <<"COMMENT"<<std::endl ;
2053  (*out_file_) <<"COMMENT ped, mult, shift [gain12]"<<std::endl ;
2054  (*out_file_) <<"COMMENT ped, mult, shift [gain6]"<<std::endl ;
2055  (*out_file_) <<"COMMENT ped, mult, shift [gain1]"<<std::endl ;
2056  (*out_file_) <<"COMMENT ================================="<<std::endl ;
2057  (*out_file_) <<"COMMENT"<<std::endl ;
2058 
2059  (*out_file_) <<"COMMENT ================================="<<std::endl ;
2060  (*out_file_) <<"COMMENT strip EB structure"<<std::endl ;
2061  (*out_file_) <<"COMMENT"<<std::endl ;
2062  (*out_file_) <<"COMMENT sliding_window"<<std::endl ;
2063  (*out_file_) <<"COMMENT weightGroupId"<<std::endl ;
2064  (*out_file_) <<"COMMENT threshold_sfg lut_sfg"<<std::endl ;
2065  (*out_file_) <<"COMMENT ================================="<<std::endl ;
2066  (*out_file_) <<"COMMENT"<<std::endl ;
2067 
2068  (*out_file_) <<"COMMENT ================================="<<std::endl ;
2069  (*out_file_) <<"COMMENT strip EE structure"<<std::endl ;
2070  (*out_file_) <<"COMMENT"<<std::endl ;
2071  (*out_file_) <<"COMMENT sliding_window"<<std::endl ;
2072  (*out_file_) <<"COMMENT weightGroupId"<<std::endl ;
2073  (*out_file_) <<"COMMENT threshold_fg lut_fg"<<std::endl ;
2074  (*out_file_) <<"COMMENT ================================="<<std::endl ;
2075  (*out_file_) <<"COMMENT"<<std::endl ;
2076 
2077  (*out_file_) <<"COMMENT ================================="<<std::endl ;
2078  (*out_file_) <<"COMMENT tower EB structure"<<std::endl ;
2079  (*out_file_) <<"COMMENT"<<std::endl ;
2080  (*out_file_) <<"COMMENT LUTGroupId"<<std::endl ;
2081  (*out_file_) <<"COMMENT FgGroupId"<<std::endl ;
2082  (*out_file_) <<"COMMENT spike_killing_threshold"<<std::endl ;//modif alex
2083  (*out_file_) <<"COMMENT ================================="<<std::endl ;
2084  (*out_file_) <<"COMMENT"<<std::endl ;
2085 
2086  (*out_file_) <<"COMMENT ================================="<<std::endl ;
2087  (*out_file_) <<"COMMENT tower EE structure"<<std::endl ;
2088  (*out_file_) <<"COMMENT"<<std::endl ;
2089  (*out_file_) <<"COMMENT LUTGroupId"<<std::endl ;
2090  (*out_file_) <<"COMMENT tower_lut_fg"<<std::endl ;
2091  (*out_file_) <<"COMMENT ================================="<<std::endl ;
2092  (*out_file_) <<"COMMENT"<<std::endl ;
2093 
2094  (*out_file_) <<"COMMENT ================================="<<std::endl ;
2095  (*out_file_) <<"COMMENT Weight structure"<<std::endl ;
2096  (*out_file_) <<"COMMENT"<<std::endl ;
2097  (*out_file_) <<"COMMENT weightGroupId"<<std::endl ;
2098  (*out_file_) <<"COMMENT w0, w1, w2, w3, w4"<<std::endl ;
2099  (*out_file_) <<"COMMENT ================================="<<std::endl ;
2100  (*out_file_) <<"COMMENT"<<std::endl ;
2101 
2102  (*out_file_) <<"COMMENT ================================="<<std::endl ;
2103  (*out_file_) <<"COMMENT lut structure"<<std::endl ;
2104  (*out_file_) <<"COMMENT"<<std::endl ;
2105  (*out_file_) <<"COMMENT LUTGroupId"<<std::endl ;
2106  (*out_file_) <<"COMMENT LUT[1-1024]"<<std::endl ;
2107  (*out_file_) <<"COMMENT ================================="<<std::endl ;
2108  (*out_file_) <<"COMMENT"<<std::endl ;
2109 
2110  (*out_file_) <<"COMMENT ================================="<<std::endl ;
2111  (*out_file_) <<"COMMENT fg EB structure"<<std::endl ;
2112  (*out_file_) <<"COMMENT"<<std::endl ;
2113  (*out_file_) <<"COMMENT FgGroupId"<<std::endl ;
2114  (*out_file_) <<"COMMENT el, eh, tl, th, lut_fg"<<std::endl ;
2115  (*out_file_) <<"COMMENT ================================="<<std::endl ;
2116  (*out_file_) <<"COMMENT"<<std::endl ;
2117 
2118  (*out_file_) <<std::endl ;
2119 }
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 2372 of file EcalTPGParamBuilder.cc.

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

2373 {
2374  // get current pedestal
2375  coeff.pedestals_[0] = 0 ;
2376  coeff.pedestals_[1] = 0 ;
2377  coeff.pedestals_[2] = 0 ;
2378 
2379  map<EcalLogicID, MonPedestalsDat>::const_iterator it = pedMap.find(logicId);
2380  if (it != pedMap.end()) {
2381  MonPedestalsDat ped = it->second ;
2382  coeff.pedestals_[0] = int(ped.getPedMeanG12() + 0.5) ;
2383  coeff.pedestals_[1] = int(ped.getPedMeanG6() + 0.5) ;
2384  coeff.pedestals_[2] = int(ped.getPedMeanG1() + 0.5) ;
2385  }
2386  else std::cout<<"getCoeff: "<<logicId.getID1()<<", "<<logicId.getID2()<<", "<<logicId.getID3()
2387  <<" not found in map<EcalLogicID, MonPedestalsDat>"<<std::endl ;
2388 }
int getID2() const
Definition: EcalLogicID.cc:52
float getPedMeanG12() const
int getID1() const
Definition: EcalLogicID.cc:47
float getPedMeanG1() const
float getPedMeanG6() const
tuple cout
Definition: gather_cfg.py:121
int getID3() const
Definition: EcalLogicID.cc:57
std::pair< std::string, int > EcalTPGParamBuilder::getCrate ( int  tcc)
private

Definition at line 2488 of file EcalTPGParamBuilder.cc.

References pos.

Referenced by analyze().

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

Definition at line 2464 of file EcalTPGParamBuilder.cc.

Referenced by analyze().

2464  {
2465  std::stringstream sdet ;
2466 
2467  if (tcc>36 && tcc<55) sdet<<"EB-"<<tcc-36 ;
2468  else if (tcc>=55 && tcc<73) sdet<<"EB+"<<tcc-54 ;
2469  else if (tcc<=36) sdet<<"EE-" ;
2470  else sdet<<"EE+" ;
2471 
2472  if (tcc<=36 || tcc>=73) {
2473  if (tcc>=73) tcc-=72 ;
2474  if (tcc==1 || tcc==18 || tcc==19 || tcc==36) sdet<<7 ;
2475  else if (tcc==2 || tcc==3 || tcc==20 || tcc==21) sdet<<8 ;
2476  else if (tcc==4 || tcc==5 || tcc==22 || tcc==23) sdet<<9 ;
2477  else if (tcc==6 || tcc==7 || tcc==24 || tcc==25) sdet<<1 ;
2478  else if (tcc==8 || tcc==9 || tcc==26 || tcc==27) sdet<<2 ;
2479  else if (tcc==10 || tcc==11 || tcc==28 || tcc==29) sdet<<3 ;
2480  else if (tcc==12 || tcc==13 || tcc==30 || tcc==31) sdet<<4 ;
2481  else if (tcc==14 || tcc==15 || tcc==32 || tcc==33) sdet<<5 ;
2482  else if (tcc==16 || tcc==17 || tcc==34 || tcc==35) sdet<<6 ;
2483  }
2484 
2485  return sdet.str() ;
2486 }
int EcalTPGParamBuilder::getEtaSlice ( int  tccId,
int  towerInTCC 
)
private

Definition at line 346 of file EcalTPGParamBuilder.cc.

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

Definition at line 2457 of file EcalTPGParamBuilder.cc.

Referenced by analyze().

2457  {
2458  int gcteta = 0;
2459  if(tteta>0) gcteta = (tteta-1)/4 + 11;
2460  else if(tteta<0) gcteta = (tteta+1)/4 + 10;
2461  return gcteta;
2462 }
int EcalTPGParamBuilder::getGCTRegionPhi ( int  ttphi)
private

Definition at line 2449 of file EcalTPGParamBuilder.cc.

Referenced by analyze().

2449  {
2450  int gctphi=0;
2451  gctphi = (ttphi+1)/4;
2452  if(ttphi<=2) gctphi=0;
2453  if(ttphi>=71) gctphi=0;
2454  return gctphi;
2455 }
bool EcalTPGParamBuilder::realignBaseline ( linStruc lin,
float  forceBase12 
)
private

Definition at line 2425 of file EcalTPGParamBuilder.cc.

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

Referenced by analyze().

2426 {
2427  bool ok(true) ;
2428  float base[3] = {forceBase12, float(lin.pedestal_[1]), float(lin.pedestal_[2])} ;
2429  for (int i=1 ; i<3 ; i++) {
2430  if (lin.mult_[i]>0) {
2431  base[i] = float(lin.pedestal_[i]) -
2432  float(lin.mult_[0])/float(lin.mult_[i])*pow(2., -(lin.shift_[0]-lin.shift_[i]))*(lin.pedestal_[0]-base[0]) ;
2433  } else base[i] = 0 ;
2434  }
2435 
2436  for (int i=0 ; i<3 ; i++) {
2437  lin.pedestal_[i] = base[i] ;
2438  //cout<<lin.pedestal_[i]<<" "<<base[i]<<endl ;
2439  if (base[i]<0 || lin.pedestal_[i]>1000) {
2440  cout<<"WARNING: base= "<<base[i]<<", "<<lin.pedestal_[i]<<" for gainId[0-2]="<<i<<" ==> forcing at 0"<<endl ;
2441  lin.pedestal_[i] = 0 ;
2442  ok = false ;
2443  }
2444  }
2445  return ok ;
2446 
2447 }
tuple base
Main Program
Definition: newFWLiteAna.py:92
int i
Definition: DBlmapReader.cc:9
tuple cout
Definition: gather_cfg.py:121
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 2122 of file EcalTPGParamBuilder.cc.

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

Referenced by computeWeights().

2123 {
2124  int iweight ;
2125  unsigned int max = (unsigned int)(pow(2.,complement2)-1) ;
2126  if (weight>0) iweight=int((1<<6)*weight+0.5) ; // +0.5 for rounding pb
2127  else iweight= max - int(-weight*(1<<6)+0.5) +1 ;
2128  iweight = iweight & max ;
2129  return iweight ;
2130 }
const T & max(const T &a, const T &b)
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
double EcalTPGParamBuilder::uncodeWeight ( int  iweight,
int  complement2 = 7 
)
private

Definition at line 2132 of file EcalTPGParamBuilder.cc.

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

2133 {
2134  double weight = double(iweight)/pow(2., 6.) ;
2135  // test if negative weight:
2136  if ( (iweight & (1<<(complement2-1))) != 0) weight = (double(iweight)-pow(2., complement2))/pow(2., 6.) ;
2137  return weight ;
2138 }
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 157 of file EcalTPGParamBuilder.h.

Referenced by analyze(), and EcalTPGParamBuilder().

int EcalTPGParamBuilder::btt_conf_id_
private

Definition at line 156 of file EcalTPGParamBuilder.h.

Referenced by analyze(), and EcalTPGParamBuilder().

int EcalTPGParamBuilder::bxt_conf_id_
private

Definition at line 155 of file EcalTPGParamBuilder.h.

Referenced by analyze(), and EcalTPGParamBuilder().

unsigned int EcalTPGParamBuilder::complement2_
private

Definition at line 112 of file EcalTPGParamBuilder.h.

Referenced by computeWeights().

EcalTPGDBApp* EcalTPGParamBuilder::db_
private

Definition at line 141 of file EcalTPGParamBuilder.h.

Referenced by analyze(), and EcalTPGParamBuilder().

bool EcalTPGParamBuilder::DBEE_
private

Definition at line 145 of file EcalTPGParamBuilder.h.

Referenced by analyze(), and EcalTPGParamBuilder().

unsigned int EcalTPGParamBuilder::DBrunNb_
private

Definition at line 144 of file EcalTPGParamBuilder.h.

int EcalTPGParamBuilder::del_conf_id_
private

Definition at line 154 of file EcalTPGParamBuilder.h.

Referenced by analyze(), and EcalTPGParamBuilder().

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

Definition at line 134 of file EcalTPGParamBuilder.h.

Referenced by analyze(), and EcalTPGParamBuilder().

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

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

Referenced by analyze().

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

Definition at line 120 of file EcalTPGParamBuilder.h.

Referenced by computeFineGrainEBParameters(), and EcalTPGParamBuilder().

unsigned int EcalTPGParamBuilder::FG_lut_strip_EE_
private

Definition at line 122 of file EcalTPGParamBuilder.h.

Referenced by computeFineGrainEEParameters(), and EcalTPGParamBuilder().

unsigned int EcalTPGParamBuilder::FG_lut_tower_EE_
private

Definition at line 122 of file EcalTPGParamBuilder.h.

Referenced by computeFineGrainEEParameters(), and EcalTPGParamBuilder().

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

Definition at line 150 of file EcalTPGParamBuilder.h.

Referenced by analyze(), and EcalTPGParamBuilder().

int EcalTPGParamBuilder::forcedPedestalValue_
private

Definition at line 123 of file EcalTPGParamBuilder.h.

Referenced by analyze(), and EcalTPGParamBuilder().

bool EcalTPGParamBuilder::forceEtaSlice_
private

Definition at line 124 of file EcalTPGParamBuilder.h.

Referenced by analyze(), and EcalTPGParamBuilder().

std::ofstream* EcalTPGParamBuilder::geomFile_
private

Definition at line 140 of file EcalTPGParamBuilder.h.

Referenced by EcalTPGParamBuilder().

bool EcalTPGParamBuilder::H2_
private

Definition at line 127 of file EcalTPGParamBuilder.h.

Referenced by analyze(), and EcalTPGParamBuilder().

int EcalTPGParamBuilder::lin_conf_id_
private

Definition at line 148 of file EcalTPGParamBuilder.h.

Referenced by analyze(), and EcalTPGParamBuilder().

int EcalTPGParamBuilder::lut_conf_id_
private

Definition at line 149 of file EcalTPGParamBuilder.h.

Referenced by analyze(), and EcalTPGParamBuilder().

double EcalTPGParamBuilder::LUT_constant_EB_
private

Definition at line 115 of file EcalTPGParamBuilder.h.

Referenced by computeLUT(), and EcalTPGParamBuilder().

double EcalTPGParamBuilder::LUT_constant_EE_
private

Definition at line 116 of file EcalTPGParamBuilder.h.

Referenced by computeLUT(), and EcalTPGParamBuilder().

double EcalTPGParamBuilder::LUT_noise_EB_
private

Definition at line 115 of file EcalTPGParamBuilder.h.

Referenced by computeLUT(), and EcalTPGParamBuilder().

double EcalTPGParamBuilder::LUT_noise_EE_
private

Definition at line 116 of file EcalTPGParamBuilder.h.

Referenced by computeLUT(), and EcalTPGParamBuilder().

std::string EcalTPGParamBuilder::LUT_option_
private

Definition at line 113 of file EcalTPGParamBuilder.h.

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

double EcalTPGParamBuilder::LUT_stochastic_EB_
private

Definition at line 115 of file EcalTPGParamBuilder.h.

Referenced by computeLUT(), and EcalTPGParamBuilder().

double EcalTPGParamBuilder::LUT_stochastic_EE_
private

Definition at line 116 of file EcalTPGParamBuilder.h.

Referenced by computeLUT(), and EcalTPGParamBuilder().

double EcalTPGParamBuilder::LUT_threshold_EB_
private

Definition at line 114 of file EcalTPGParamBuilder.h.

Referenced by computeLUT(), and EcalTPGParamBuilder().

double EcalTPGParamBuilder::LUT_threshold_EE_
private

Definition at line 114 of file EcalTPGParamBuilder.h.

Referenced by computeLUT(), and EcalTPGParamBuilder().

int EcalTPGParamBuilder::m_write_bst
private

Definition at line 170 of file EcalTPGParamBuilder.h.

Referenced by EcalTPGParamBuilder().

int EcalTPGParamBuilder::m_write_btt
private

Definition at line 169 of file EcalTPGParamBuilder.h.

Referenced by EcalTPGParamBuilder().

int EcalTPGParamBuilder::m_write_bxt
private

Definition at line 168 of file EcalTPGParamBuilder.h.

Referenced by EcalTPGParamBuilder().

int EcalTPGParamBuilder::m_write_del
private

Definition at line 167 of file EcalTPGParamBuilder.h.

Referenced by analyze(), and EcalTPGParamBuilder().

int EcalTPGParamBuilder::m_write_fgr
private

Definition at line 164 of file EcalTPGParamBuilder.h.

Referenced by analyze(), and EcalTPGParamBuilder().

int EcalTPGParamBuilder::m_write_lin
private

Definition at line 161 of file EcalTPGParamBuilder.h.

Referenced by analyze(), and EcalTPGParamBuilder().

int EcalTPGParamBuilder::m_write_lut
private

Definition at line 162 of file EcalTPGParamBuilder.h.

Referenced by analyze(), and EcalTPGParamBuilder().

int EcalTPGParamBuilder::m_write_ped
private

Definition at line 160 of file EcalTPGParamBuilder.h.

Referenced by analyze(), and EcalTPGParamBuilder().

int EcalTPGParamBuilder::m_write_sli
private

Definition at line 165 of file EcalTPGParamBuilder.h.

Referenced by analyze(), and EcalTPGParamBuilder().

int EcalTPGParamBuilder::m_write_spi
private

Definition at line 166 of file EcalTPGParamBuilder.h.

Referenced by analyze(), and EcalTPGParamBuilder().

int EcalTPGParamBuilder::m_write_wei
private

Definition at line 163 of file EcalTPGParamBuilder.h.

Referenced by analyze(), and EcalTPGParamBuilder().

unsigned int EcalTPGParamBuilder::nSample_
private

Definition at line 111 of file EcalTPGParamBuilder.h.

Referenced by computeWeights().

Char_t EcalTPGParamBuilder::ntupleCrate_[10]
private

Definition at line 174 of file EcalTPGParamBuilder.h.

Referenced by analyze().

Char_t EcalTPGParamBuilder::ntupleDet_[10]
private

Definition at line 173 of file EcalTPGParamBuilder.h.

Referenced by analyze().

Int_t* EcalTPGParamBuilder::ntupleInts_
private

Definition at line 172 of file EcalTPGParamBuilder.h.

Referenced by analyze().

std::ofstream* EcalTPGParamBuilder::out_file_
private

Definition at line 139 of file EcalTPGParamBuilder.h.

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

int EcalTPGParamBuilder::ped_conf_id_
private

Definition at line 147 of file EcalTPGParamBuilder.h.

Referenced by analyze(), and EcalTPGParamBuilder().

unsigned int EcalTPGParamBuilder::pedestal_offset_
private

Definition at line 125 of file EcalTPGParamBuilder.h.

Referenced by analyze(), and EcalTPGParamBuilder().

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

Definition at line 135 of file EcalTPGParamBuilder.h.

Referenced by analyze(), and EcalTPGParamBuilder().

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

Definition at line 137 of file EcalTPGParamBuilder.h.

Referenced by analyze(), and EcalTPGParamBuilder().

unsigned int EcalTPGParamBuilder::sampleMax_
private

Definition at line 108 of file EcalTPGParamBuilder.h.

Referenced by computeWeights(), and EcalTPGParamBuilder().

unsigned int EcalTPGParamBuilder::SFGVB_lut_
private

Definition at line 125 of file EcalTPGParamBuilder.h.

Referenced by analyze(), and EcalTPGParamBuilder().

int EcalTPGParamBuilder::SFGVB_SpikeKillingThreshold_
private

Definition at line 126 of file EcalTPGParamBuilder.h.

Referenced by analyze(), and EcalTPGParamBuilder().

unsigned int EcalTPGParamBuilder::SFGVB_Threshold_
private

Definition at line 125 of file EcalTPGParamBuilder.h.

Referenced by analyze(), and EcalTPGParamBuilder().

int EcalTPGParamBuilder::sli_conf_id_
private

Definition at line 151 of file EcalTPGParamBuilder.h.

Referenced by analyze(), and EcalTPGParamBuilder().

unsigned int EcalTPGParamBuilder::sliding_
private

Definition at line 107 of file EcalTPGParamBuilder.h.

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

int EcalTPGParamBuilder::spi_conf_id_
private

Definition at line 153 of file EcalTPGParamBuilder.h.

Referenced by analyze(), and EcalTPGParamBuilder().

std::string EcalTPGParamBuilder::tag_
private

Definition at line 158 of file EcalTPGParamBuilder.h.

Referenced by analyze(), and EcalTPGParamBuilder().

const CaloSubdetectorGeometry* EcalTPGParamBuilder::theBarrelGeometry_
private

Definition at line 100 of file EcalTPGParamBuilder.h.

Referenced by analyze().

const CaloSubdetectorGeometry* EcalTPGParamBuilder::theEndcapGeometry_
private

Definition at line 99 of file EcalTPGParamBuilder.h.

Referenced by analyze().

const EcalElectronicsMapping* EcalTPGParamBuilder::theMapping_
private

Definition at line 102 of file EcalTPGParamBuilder.h.

Referenced by analyze().

std::string EcalTPGParamBuilder::TimingDelays_EB_
private

Definition at line 130 of file EcalTPGParamBuilder.h.

Referenced by EcalTPGParamBuilder().

std::string EcalTPGParamBuilder::TimingDelays_EE_
private

Definition at line 131 of file EcalTPGParamBuilder.h.

Referenced by EcalTPGParamBuilder().

std::string EcalTPGParamBuilder::TimingPhases_EB_
private

Definition at line 132 of file EcalTPGParamBuilder.h.

Referenced by EcalTPGParamBuilder().

std::string EcalTPGParamBuilder::TimingPhases_EE_
private

Definition at line 133 of file EcalTPGParamBuilder.h.

Referenced by EcalTPGParamBuilder().

double EcalTPGParamBuilder::TTF_highThreshold_EB_
private

Definition at line 117 of file EcalTPGParamBuilder.h.

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

double EcalTPGParamBuilder::TTF_highThreshold_EE_
private

Definition at line 118 of file EcalTPGParamBuilder.h.

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

double EcalTPGParamBuilder::TTF_lowThreshold_EB_
private

Definition at line 117 of file EcalTPGParamBuilder.h.

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

double EcalTPGParamBuilder::TTF_lowThreshold_EE_
private

Definition at line 118 of file EcalTPGParamBuilder.h.

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

bool EcalTPGParamBuilder::useInterCalibration_
private

Definition at line 127 of file EcalTPGParamBuilder.h.

Referenced by EcalTPGParamBuilder().

bool EcalTPGParamBuilder::useTransverseEnergy_
private

Definition at line 104 of file EcalTPGParamBuilder.h.

Referenced by analyze(), and EcalTPGParamBuilder().

int EcalTPGParamBuilder::version_
private

Definition at line 159 of file EcalTPGParamBuilder.h.

Referenced by analyze(), and EcalTPGParamBuilder().

int EcalTPGParamBuilder::wei_conf_id_
private

Definition at line 152 of file EcalTPGParamBuilder.h.

Referenced by analyze(), and EcalTPGParamBuilder().

double EcalTPGParamBuilder::weight_timeShift_
private

Definition at line 109 of file EcalTPGParamBuilder.h.

Referenced by computeWeights(), and EcalTPGParamBuilder().

bool EcalTPGParamBuilder::weight_unbias_recovery_
private

Definition at line 110 of file EcalTPGParamBuilder.h.

Referenced by computeWeights(), and EcalTPGParamBuilder().

bool EcalTPGParamBuilder::writeToDB_
private

Definition at line 142 of file EcalTPGParamBuilder.h.

Referenced by analyze(), and EcalTPGParamBuilder().

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

Definition at line 105 of file EcalTPGParamBuilder.h.

Referenced by analyze(), and computeLinearizerParam().

double EcalTPGParamBuilder::xtal_LSB_EE_
private

Definition at line 105 of file EcalTPGParamBuilder.h.

Referenced by analyze(), and computeLinearizerParam().