19 std::istringstream
iss ;
24 gzf = gzopen(file,
"rb") ;
44 explicit operator bool()
const
46 return ((
eof ==
true) ?
false : !
iss.fail());
53 while ((
bool)gis && !(gis.
iss >> var))
64 dbFilename_(iConfig.getUntrackedParameter<std::
string>(
"DatabaseFile",
"")),
65 flagPrint_(iConfig.getParameter<bool>(
"WriteInFile"))
102 auto prod = std::make_unique<EcalTPGPedestals>();
104 std::map<uint32_t, std::vector<uint32_t> >::const_iterator it ;
108 item.
mean_x6 = (it->second)[3] ;
109 item.
mean_x1 = (it->second)[6] ;
110 prod->setValue(it->first,item) ;
117 auto prod = std::make_unique<EcalTPGLinearizationConst>();
119 std::map<uint32_t, std::vector<uint32_t> >::const_iterator it ;
123 item.
mult_x6 = (it->second)[4] ;
124 item.
mult_x1 = (it->second)[7] ;
128 prod->setValue(it->first,item) ;
135 auto prod = std::make_unique<EcalTPGSlidingWindow>();
137 for (
int subdet=0 ; subdet<2 ; subdet++) {
138 std::map<uint32_t, std::vector<uint32_t> >::const_iterator it ;
140 prod->setValue(it->first,(it->second)[0]) ;
148 auto prod = std::make_unique<EcalTPGFineGrainEBIdMap>();
151 std::map<uint32_t, std::vector<uint32_t> >::const_iterator it ;
153 fg.
setValues((it->second)[0], (it->second)[1], (it->second)[2], (it->second)[3], (it->second)[4]) ;
154 prod->setValue(it->first,fg) ;
161 auto prod = std::make_unique<EcalTPGFineGrainStripEE>();
164 std::map<uint32_t, std::vector<uint32_t> >::const_iterator it ;
168 item.
lut = (it->second)[3] ;
169 prod->setValue(it->first,item) ;
175 item.
lut = (it->second)[3] ;
176 prod->setValue(it->first,item) ;
183 auto prod = std::make_unique<EcalTPGFineGrainTowerEE>();
185 std::map<uint32_t, std::vector<uint32_t> >::const_iterator it ;
187 prod->setValue(it->first,(it->second)[1]) ;
194 auto prod = std::make_unique<EcalTPGLutIdMap>();
197 std::map<uint32_t, std::vector<uint32_t> >::const_iterator it ;
199 unsigned int lutArray[1024] ;
200 for (
int i=0 ;
i <1024 ;
i++) lutArray[
i] = (it->second)[
i] ;
202 prod->setValue(it->first,lut) ;
209 auto prod = std::make_unique<EcalTPGWeightIdMap>();
212 std::map<uint32_t, std::vector<uint32_t> >::const_iterator it ;
219 prod->setValue(it->first,weights) ;
226 auto prod = std::make_unique<EcalTPGWeightGroup>();
228 for (
int subdet=0 ; subdet<2 ; subdet++) {
229 std::map<uint32_t, std::vector<uint32_t> >::const_iterator it ;
231 prod->setValue(it->first,(it->second)[1]) ;
239 auto prod = std::make_unique<EcalTPGLutGroup>();
241 for (
int subdet=0 ; subdet<2 ; subdet++) {
242 std::map<uint32_t, std::vector<uint32_t> >::const_iterator it ;
244 prod->setValue(it->first,(it->second)[0]) ;
252 auto prod = std::make_unique<EcalTPGFineGrainEBGroup>();
254 std::map<uint32_t, std::vector<uint32_t> >::const_iterator it ;
256 prod->setValue(it->first,(it->second)[1]) ;
263 auto prod = std::make_unique<EcalTPGPhysicsConst>();
265 std::map<uint32_t, std::vector<float> >::const_iterator it ;
268 item.
EtSat = (it->second)[0] ;
275 prod->setValue(it->first,item) ;
282 auto prod = std::make_unique<EcalTPGCrystalStatus>();
284 std::map<uint32_t, std::vector<uint32_t> >::const_iterator it ;
289 prod->setValue(it->first,badXValue) ;
297 auto prod = std::make_unique<EcalTPGStripStatus>();
305 auto prod = std::make_unique<EcalTPGTowerStatus>();
307 std::map<uint32_t, std::vector<uint32_t> >::const_iterator it ;
311 prod->setValue(it->first,0) ;
316 prod->setValue(it->first,0) ;
324 auto prod = std::make_unique<EcalTPGSpike>();
327 std::map<uint32_t, std::vector<uint32_t> >::const_iterator it;
330 prod->setValue(it->first, (it->second)[2]);
343 std::vector<unsigned int> param ;
344 std::vector<float> paramF ;
345 int NBstripparams[2] = {4, 4} ;
357 finalFileName = fileInPath.
fullPath() ;
361 edm::LogWarning(
"EcalTPG") <<
"Couldnt find database file via fileinpath, trying with pathname directly!!";
368 while (gis>>dataCard) {
370 if (dataCard ==
"PHYSICS_EB" || dataCard ==
"PHYSICS_EE") {
382 for (
int i=0 ;
i <7 ;
i++) {
384 paramF.push_back(dataF) ;
390 std::ostringstream oss;
400 std::ostringstream oss;
422 if (dataCard ==
"CRYSTAL") {
433 std::cout <<
"COMMENT ====== barrel crystals ====== " <<std::endl;
436 std::cout <<
"COMMENT ====== endcap crystals ====== " <<std::endl;
444 for (
int i=0 ;
i <9 ;
i++) {
445 gis>>std::hex>>
data ;
447 param.push_back(data);
451 std::ostringstream oss;
452 oss << std::hex<<
data;
460 }
else if(
i>2 &&
i<6){
461 std::ostringstream oss;
462 oss << std::hex <<
data;
469 }
else if(
i>5 &&
i<9){
470 std::ostringstream oss;
471 oss << std::hex<<
data;
493 if (dataCard ==
"STRIP_EB") {
502 for (
int i=0 ;
i <NBstripparams[0] ;
i++) {
503 gis>>std::hex>>
data ;
505 param.push_back(data);
509 std::cout<<
"0x"<<std::hex<< data << std::endl;
512 std::cout<<
""<<std::hex<< data << std::endl;
515 std::ostringstream oss;
517 oss<<
"0x"<<std::hex<<
data;
521 std::ostringstream oss;
522 oss<<
" 0x"<<std::hex<<
data;
536 if (dataCard ==
"STRIP_EE") {
546 for (
int i=0 ;
i <NBstripparams[1] ;
i++) {
547 gis>>std::hex>>
data ;
548 param.push_back(data);
552 std::cout<<
"0x"<<std::hex<<data << std::endl;
554 std::cout<<
" "<<std::hex<<data<< std::endl;
556 std::ostringstream oss;
558 oss<<
"0x"<<std::hex<<
data;
562 std::ostringstream oss;
563 oss<<
" 0x"<<std::hex<<
data;
577 if(dataCard ==
"TOWER_EE"){
584 for (
int i=0 ;
i <2 ;
i++) {
585 gis>>std::hex>>
data ;
586 param.push_back(data);
601 if (dataCard ==
"TOWER_EB") {
608 for (
int i=0 ;
i <3 ;
i++) {
615 param.push_back(data) ;
622 if (dataCard ==
"WEIGHT") {
635 for (
int i=0 ;
i <5 ;
i++) {
636 gis>>std::hex>>
data ;
637 param.push_back(data);
640 std::ostringstream oss;
641 oss << std::hex<<
data;
660 if (dataCard ==
"FG") {
671 for (
int i=0 ;
i <5 ;
i++) {
672 gis>>std::hex>>
data ;
673 param.push_back(data);
676 std::ostringstream oss;
677 oss << std::hex<<
data;
696 if (dataCard ==
"LUT") {
703 for (
int i=0 ;
i <1024 ;
i++) {
704 gis>>std::hex>>
data ;
705 param.push_back(data);
708 std::cout<<
"0x"<<std::hex<<data <<std::endl;
724 std::vector<int> range ;
727 range.push_back(37) ;
728 range.push_back(73) ;
730 range.push_back(69) ;
738 range.push_back(73) ;
739 range.push_back(109) ;
742 range.push_back(37) ;
745 range.push_back(29) ;
756 if (towerNbInTcc>0) {
757 range[2] = towerNbInTcc ;
758 range[3] = towerNbInTcc+1 ;
760 if (stripNbInTower>0) {
761 range[4] = stripNbInTower ;
762 range[5] = stripNbInTower+1 ;
764 if (xtalNbInStrip>0) {
765 range[6] = xtalNbInStrip ;
766 range[7] = xtalNbInStrip+1 ;
std::vector< int > getRange(int subdet, int smNb, int towerNbInSm, int stripNbInTower=0, int xtalNbInStrip=0)
std::unique_ptr< EcalTPGWeightGroup > produceWeightGroup(const EcalTPGWeightGroupRcd &)
std::unique_ptr< EcalTPGCrystalStatus > produceBadX(const EcalTPGCrystalStatusRcd &)
void setValues(const uint32_t &ThresholdETLow, const uint32_t &ThresholdETHigh, const uint32_t &RatioLow, const uint32_t &RatioHigh, const uint32_t &LUT)
std::unique_ptr< EcalTPGLinearizationConst > produceLinearizationConst(const EcalTPGLinearizationConstRcd &)
std::map< uint32_t, std::vector< uint32_t > > mapTower_[2]
std::unique_ptr< EcalTPGFineGrainEBIdMap > produceFineGrainEB(const EcalTPGFineGrainEBIdMapRcd &)
std::unique_ptr< EcalTPGLutIdMap > produceLUT(const EcalTPGLutIdMapRcd &)
void setLut(const unsigned int *lut)
void setWhatProduced(T *iThis, const es::Label &iLabel=es::Label())
std::unique_ptr< EcalTPGTowerStatus > produceBadTT(const EcalTPGTowerStatusRcd &)
std::unique_ptr< EcalTPGPedestals > producePedestals(const EcalTPGPedestalsRcd &)
std::unique_ptr< EcalTPGPhysicsConst > producePhysicsConst(const EcalTPGPhysicsConstRcd &)
void setStatusCode(const uint16_t &val)
std::map< uint32_t, std::vector< uint32_t > > mapXtal_
~EcalTrigPrimESProducer()
std::unique_ptr< EcalTPGFineGrainTowerEE > produceFineGrainEEtower(const EcalTPGFineGrainTowerEERcd &)
std::unique_ptr< EcalTPGSpike > produceSpike(const EcalTPGSpikeRcd &)
std::map< uint32_t, std::vector< uint32_t > > mapWeight_
std::unique_ptr< EcalTPGSlidingWindow > produceSlidingWindow(const EcalTPGSlidingWindowRcd &)
std::unique_ptr< EcalTPGFineGrainEBGroup > produceFineGrainEBGroup(const EcalTPGFineGrainEBGroupRcd &)
EcalTrigPrimESProducer(const edm::ParameterSet &)
std::unique_ptr< EcalTPGLutGroup > produceLutGroup(const EcalTPGLutGroupRcd &)
std::map< uint32_t, std::vector< uint32_t > > mapFg_
double ttf_threshold_High
std::istream & operator>>(std::istream &input, CLHEP::HepGenMatrix &matrix)
std::map< uint32_t, std::vector< float > > mapPhys_
char data[epos_bytes_allocation]
volatile std::atomic< bool > shutdown_flag false
std::unique_ptr< EcalTPGFineGrainStripEE > produceFineGrainEEstrip(const EcalTPGFineGrainStripEERcd &)
std::string fullPath() const
std::unique_ptr< EcalTPGWeightIdMap > produceWeight(const EcalTPGWeightIdMapRcd &)
std::unique_ptr< EcalTPGStripStatus > produceBadStrip(const EcalTPGStripStatusRcd &)
void setValues(const uint32_t &w0, const uint32_t &w1, const uint32_t &w2, const uint32_t &w3, const uint32_t &w4)
std::map< uint32_t, std::vector< uint32_t > > mapLut_
std::map< uint32_t, std::vector< uint32_t > > mapStrip_[2]