25 #if (CMSSW_VERSION>=340)
47 if (Et<1e-6)
return 1./par[1] ;
48 double resolEt_overEt =
sqrt( (par[0]/
sqrt(Et))*(par[0]/
sqrt(Et)) + (par[1]/Et)*(par[1]/Et) + par[2]*par[2] ) ;
49 return 1./(Et*resolEt_overEt) ;
53 : xtal_LSB_EB_(0), xtal_LSB_EE_(0), nSample_(5), complement2_(7)
77 std::string DBsid = pSet.
getParameter<std::string>(
"DBsid") ;
78 std::string DBuser = pSet.
getParameter<std::string>(
"DBuser") ;
79 std::string DBpass = pSet.
getParameter<std::string>(
"DBpass") ;
99 std::cout <<
"data will be saved with tag and version="<< tag_<<
".version"<<version_<< std::endl;
102 std::cout <<
"ERROR: " << e.what() << std::endl;
104 std::cout <<
"Unknown error caught" << std::endl;
110 std::string outFile = pSet.
getParameter<std::string>(
"outFile") ;
161 (*out_file_ )<<
"EOF"<<std::endl ;
171 if( item.mean_x1 <150. || item.mean_x1 >250) result=
false;
172 if( item.mean_x6 <150. || item.mean_x6 >250) result=
false;
173 if( item.mean_x12 <150. || item.mean_x12 >250) result=
false;
174 if( item.rms_x1 <0 || item.rms_x1 > 2) result=
false;
175 if( item.rms_x6 <0 || item.rms_x6 > 3) result=
false;
176 if( item.rms_x12 <0 || item.rms_x12 > 5) result=
false;
182 int etaSlice = (towerInTCC-1)/4+1 ;
184 if (tccId>36 || tccId<73)
return etaSlice ;
187 if (tccId >=1 && tccId <= 18) etaSlice += 21 ;
188 if (tccId >=19 && tccId <= 36) etaSlice += 17 ;
189 if (tccId >=91 && tccId <= 108) etaSlice += 21 ;
190 if (tccId >=73 && tccId <= 90) etaSlice += 17 ;
217 TFile saving (
"EcalTPGParam.root",
"recreate") ;
219 TH2F * ICEB =
new TH2F(
"ICEB",
"IC: Barrel", 360, 1, 361, 172, -86, 86) ;
220 ICEB->GetYaxis()->SetTitle(
"eta index") ;
221 ICEB->GetXaxis()->SetTitle(
"phi index") ;
222 TH2F * tpgFactorEB =
new TH2F(
"tpgFactorEB",
"tpgFactor: Barrel", 360, 1, 361, 172, -86, 86) ;
223 tpgFactorEB->GetYaxis()->SetTitle(
"eta index") ;
224 tpgFactorEB->GetXaxis()->SetTitle(
"phi index") ;
226 TH2F * ICEEPlus =
new TH2F(
"ICEEPlus",
"IC: Plus Endcap", 120, -9, 111, 120, -9, 111) ;
227 ICEEPlus->GetYaxis()->SetTitle(
"y index") ;
228 ICEEPlus->GetXaxis()->SetTitle(
"x index") ;
229 TH2F * tpgFactorEEPlus =
new TH2F(
"tpgFactorEEPlus",
"tpgFactor: Plus Endcap", 120, -9, 111, 120, -9, 111) ;
230 tpgFactorEEPlus->GetYaxis()->SetTitle(
"y index") ;
231 tpgFactorEEPlus->GetXaxis()->SetTitle(
"x index") ;
232 TH2F * ICEEMinus =
new TH2F(
"ICEEMinus",
"IC: Minus Endcap", 120, -9, 111, 120, -9, 111) ;
233 ICEEMinus->GetYaxis()->SetTitle(
"y index") ;
234 ICEEMinus->GetXaxis()->SetTitle(
"x index") ;
235 TH2F * tpgFactorEEMinus =
new TH2F(
"tpgFactorEEMinus",
"tpgFactor: Minus Endcap", 120, -9, 111, 120, -9, 111) ;
236 tpgFactorEEMinus->GetYaxis()->SetTitle(
"y index") ;
237 tpgFactorEEMinus->GetXaxis()->SetTitle(
"x index") ;
239 TH2F * IC =
new TH2F(
"IC",
"IC", 720, -acos(-1.), acos(-1.), 600, -3., 3.) ;
240 IC->GetYaxis()->SetTitle(
"eta") ;
241 IC->GetXaxis()->SetTitle(
"phi") ;
242 TH2F * tpgFactor =
new TH2F(
"tpgFactor",
"tpgFactor", 720, -acos(-1.), acos(-1.), 600, -3., 3.) ;
243 tpgFactor->GetYaxis()->SetTitle(
"eta") ;
244 tpgFactor->GetXaxis()->SetTitle(
"phi") ;
246 TH1F * hshapeEB =
new TH1F(
"shapeEB",
"shapeEB", 250, 0., 10.) ;
247 TH1F * hshapeEE =
new TH1F(
"shapeEE",
"shapeEE", 250, 0., 10.) ;
249 TTree * ntuple =
new TTree(
"tpgmap",
"TPG geometry map") ;
250 const char * branchFloat[24] = {
"fed",
"tcc",
"tower",
"stripInTower",
"xtalInStrip",
251 "CCU",
"VFE",
"xtalInVFE",
"xtalInCCU",
"ieta",
"iphi",
252 "ix",
"iy",
"iz",
"hashedId",
"ic",
"ietaTT",
"iphiTT",
253 "TCCch",
"TCCslot",
"SLBch",
"SLBslot",
"ietaGCT",
"iphiGCT"} ;
255 for (
int i=0 ;
i<24 ;
i++) ntuple->Branch(branchFloat[
i],&
ntupleFloats_[i],branchFloat[i]) ;
260 TNtuple *ntupleSpike =
new TNtuple(
"spikeParam",
"Spike parameters",
"gainId:theta:G:g:ped:pedLin") ;
268 list<uint32_t> towerListEB ;
269 list<uint32_t> stripListEB ;
270 list<uint32_t> towerListEE ;
271 list<uint32_t> stripListEE ;
272 list<uint32_t>::iterator itList ;
274 std::map<int, uint32_t> stripMapEB ;
275 std::map<uint32_t, uint32_t> stripMapEBsintheta ;
279 std::cout <<
"Getting the pedestals from offline DB..."<<std::endl;
285 for (pedIter = pedMap.begin() ; pedIter != pedMap.end() && nPed<10 ; ++pedIter, nPed++) {
287 std::cout<<aped.mean_x12<<
", "<<aped.mean_x6<<
", "<<aped.mean_x1<<std::endl ;
293 std::cout <<
"Getting intercalib from offline DB..."<<std::endl;
300 for (calIter = calibMap.begin() ; calIter != calibMap.end() && nCal<10 ; ++calIter, nCal++) {
307 std::cout <<
"Getting the gain ratios from offline DB..."<<std::endl;
313 for (gainIter = gainMap.begin() ; gainIter != gainMap.end() && nGain<10 ; ++gainIter, nGain++) {
321 std::cout <<
"Getting the ADC to GEV from offline DB..."<<std::endl;
332 std::vector<EcalLogicID> my_EcalLogicId;
333 std::vector<EcalLogicID> my_TTEcalLogicId;
334 std::vector<EcalLogicID> my_StripEcalLogicId;
338 std::vector<EcalLogicID> my_TTEcalLogicId_EE;
339 std::vector<EcalLogicID> my_RTEcalLogicId_EE;
340 std::vector<EcalLogicID> my_StripEcalLogicId1_EE;
341 std::vector<EcalLogicID> my_StripEcalLogicId2_EE;
342 std::vector<EcalLogicID> my_CrystalEcalLogicId_EE;
345 std::cout<<
"going to get the ecal logic id set"<< std::endl;
354 "EB_crystal_number",12 );
359 "EB_trigger_tower",12 );
361 std::cout<<
"got the 3 ecal barrel logic id set"<< std::endl;
369 "EE_crystal_number",123 );
378 "ECAL_readout_strip",123 );
386 "ECAL_readout_strip",123 );
393 "EE_trigger_tower",12 );
401 "EE_readout_tower",12 );
403 std::cout<<
"got the end cap logic id set"<< std::endl;
404 std::cout<<
"now just get the latest ids for this tag (latest version) "<< std::endl;
410 std::cout <<
"trying to read previous tag if it exists tag="<<
tag_<<
".version"<<
version_<< std::endl;
412 db_-> fetchConfigSet(&fe_main_info);
427 std::cout <<
" tag did not exist a new tag will be created " << std::endl;
429 std::cout <<
"Unknown error caught" << std::endl;
438 std::map<EcalLogicID, FEConfigPedDat> pedset ;
439 std::map<EcalLogicID, FEConfigLinDat> linset ;
440 std::map<EcalLogicID, FEConfigLinParamDat> linparamset ;
441 std::map<EcalLogicID, FEConfigLUTParamDat> lutparamset ;
442 std::map<EcalLogicID, FEConfigFgrParamDat> fgrparamset ;
444 std::map<int, linStruc> linEtaSlice ;
445 std::map <std::vector<int>,
linStruc > linMap ;
448 int NbOfStripPerTCC[108][68] ;
449 for (
int i=0 ; i<108 ; i++)
450 for (
int j=0 ;
j<68 ;
j++)
451 NbOfStripPerTCC[i][
j] = 0 ;
454 for (std::vector<DetId>::const_iterator it = ebCells.begin(); it != ebCells.end(); ++it) {
461 if (stripInTower>NbOfStripPerTCC[tccNb-1][towerInTCC-1]) NbOfStripPerTCC[tccNb-1][towerInTCC-1] = stripInTower ;
463 for (std::vector<DetId>::const_iterator it = eeCells.begin(); it != eeCells.end(); ++it) {
470 if (stripInTower>NbOfStripPerTCC[tccNb-1][towerInTCC-1]) NbOfStripPerTCC[tccNb-1][towerInTCC-1] = stripInTower ;
476 if (
writeToFiles_) (*out_file_)<<
"COMMENT ====== barrel crystals ====== "<<std::endl ;
479 for (std::vector<DetId>::const_iterator it = ebCells.begin(); it != ebCells.end(); ++it) {
493 int xtalInVFE = Id.
xtalId() ;
494 int xtalWithinCCUid = 5*(VFEid-1) + xtalInVFE -1 ;
496 (*geomFile_)<<
"dccNb = "<<dccNb<<
" tccNb = "<<tccNb<<
" towerInTCC = "<<towerInTCC
497 <<
" stripInTower = "<<stripInTower<<
" xtalInStrip = "<<xtalInStrip
498 <<
" CCUid = "<<CCUid<<
" VFEid = "<<VFEid<<
" xtalInVFE = "<<xtalInVFE
499 <<
" xtalWithinCCUid = "<<xtalWithinCCUid<<
" ieta = "<<
id.ieta()<<
" iphi = "<<
id.iphi()
500 <<
" xtalhashedId = "<<
id.hashedIndex()<<
" xtalNb = "<<
id.ic()
501 <<
" ietaTT = "<<towid.
ieta()<<
" iphiTT = "<<towid.
iphi()<<std::endl ;
503 int TCCch = towerInTCC ;
504 int SLBslot = int((towerInTCC-1)/8.) + 1 ;
505 int SLBch = (towerInTCC-1)%8 + 1 ;
506 float val[] = {float(dccNb+600),float(tccNb),float(towerInTCC),float(stripInTower),
507 float(xtalInStrip),float(CCUid),float(VFEid),float(xtalInVFE),
508 float(xtalWithinCCUid),float(
id.ieta()),float(
id.iphi()),
509 -999.,-999.,float(towid.
ieta())/
float(
abs(towid.
ieta())),
511 float(
id.ic()),float(towid.
ieta()),
float(towid.
iphi()),
513 float(SLBch), float(SLBslot),
522 if (tccNb == 37 && stripInTower == 3 && xtalInStrip == 3 && (towerInTCC-1)%4==0) {
523 int etaSlice = towid.
ietaAbs() ;
525 getCoeff(coeff, calibMap,
id.rawId()) ;
526 getCoeff(coeff, gainMap,
id.rawId()) ;
527 getCoeff(coeff, pedMap,
id.rawId()) ;
529 for (
int i=0 ; i<3 ; i++) {
532 if (!ok)
std::cout <<
"unable to compute the parameters for SM="<<
id.ism()<<
" xt="<<
id.ic()<<
" " <<dec<<
id.rawId()<<std::endl ;
542 if (!ok)
std::cout<<
"SM="<<
id.ism()<<
" xt="<<
id.ic()<<
" " <<dec<<
id.rawId()<<std::endl ;
543 linEtaSlice[etaSlice] = lin ;
548 for (std::vector<DetId>::const_iterator it = ebCells.begin(); it != ebCells.end(); ++it) {
553 towerListEB.push_back(towid.
rawId()) ;
555 stripListEB.push_back(elId.
rawId() & 0xfffffff8) ;
564 int xtalInVFE = Id.
xtalId() ;
565 int xtalWithinCCUid = 5*(VFEid-1) + xtalInVFE -1 ;
566 int etaSlice = towid.
ietaAbs() ;
569 int hashedStripLogicID = 68*5*(
id.ism()-1) + 5*(towerInTCC-1) + (VFEid-1) ;
570 stripMapEB[hashedStripLogicID] = elId.
rawId() & 0xfffffff8 ;
575 if (
writeToFiles_) (*out_file_)<<
"CRYSTAL "<<dec<<
id.rawId()<<std::endl ;
579 getCoeff(coeff, calibMap,
id.rawId()) ;
580 getCoeff(coeff, gainMap,
id.rawId()) ;
581 getCoeff(coeff, pedMap,
id.rawId()) ;
582 ICEB->Fill(
id.iphi(),
id.ieta(), coeff.
calibCoeff_) ;
585 std::vector<int> xtalCCU ;
586 xtalCCU.push_back(dccNb+600) ;
587 xtalCCU.push_back(CCUid) ;
588 xtalCCU.push_back(xtalWithinCCUid) ;
589 xtalCCU.push_back(
id.rawId()) ;
594 std::map<int, linStruc>::const_iterator itLin = linEtaSlice.find(etaSlice);
595 if (itLin != linEtaSlice.end()) {
596 linMap[xtalCCU] = itLin->second ;
598 for (
int i=0 ; i<3 ; i++)
599 (*
out_file_) << hex <<
" 0x"<<itLin->second.pedestal_[
i]<<
" 0x"<<itLin->second.mult_[
i]<<
" 0x"<<itLin->second.shift_[
i]<<std::endl;
602 for (
int i=0 ; i<3 ; i++) {
604 if (i==1) {pedDB.
setPedMeanG6(itLin->second.pedestal_[i]) ; linDB.
setMultX6(itLin->second.mult_[i]) ; linDB.
setShift6(itLin->second.shift_[i]) ; }
605 if (i==2) {pedDB.
setPedMeanG1(itLin->second.pedestal_[i]) ; linDB.
setMultX1(itLin->second.mult_[i]) ; linDB.
setShift1(itLin->second.shift_[i]) ; }
608 float factor = float(itLin->second.mult_[0])*
pow(2.,-itLin->second.shift_[0])/
xtal_LSB_EB_ ;
609 tpgFactorEB->Fill(
id.iphi(),
id.ieta(), factor) ;
613 else std::cout<<
"current EtaSlice = "<<etaSlice<<
" not found in the EtaSlice map"<<std::endl ;
618 int forceBase12 = 0 ;
619 for (
int i=0 ; i<3 ; i++) {
622 if (!ok)
std::cout <<
"unable to compute the parameters for SM="<<
id.ism()<<
" xt="<<
id.ic()<<
" " <<dec<<
id.rawId()<<std::endl ;
634 double G = mult*
pow(2.,-(shift+2)) ;
635 double g = G/
sin(theta) ;
637 base = double(coeff.
pedestals_[i]) - pedestal_offset_/
g ;
638 if (base<0.) base = 0 ;
639 forceBase12 = int(base) ;
650 if (!ok)
std::cout<<
"SM="<<
id.ism()<<
" xt="<<
id.ic()<<
" " <<dec<<
id.rawId()<<std::endl ;
652 for (
int i=0 ; i<3 ; i++) {
661 tpgFactorEB->Fill(
id.iphi(),
id.ieta(), factor) ;
666 double g = G/
sin(theta) ;
667 float val[] = {float(i),float(theta),float(G),float(g),
669 ntupleSpike->Fill(val) ;
671 linMap[xtalCCU] = lin ;
675 int ixtal=(
id.ism()-1)*1700+(
id.ic()-1);
677 pedset[logicId] = pedDB ;
678 linset[logicId] = linDB ;
686 linparamset[my_EcalLogicId_EB] = linparam ;
693 fgrparamset[my_EcalLogicId_EB] = fgrparam ;
700 lutparamset[my_EcalLogicId_EB] = lutparam ;
706 if (
writeToFiles_) (*out_file_)<<
"COMMENT ====== endcap crystals ====== "<<std::endl ;
709 for (std::vector<DetId>::const_iterator it = eeCells.begin(); it != eeCells.end(); ++it) {
716 int dccNb = Id.
dccId() ;
723 int xtalInVFE = Id.
xtalId() ;
724 int xtalWithinCCUid = 5*(VFEid-1) + xtalInVFE -1 ;
726 (*geomFile_)<<
"dccNb = "<<dccNb<<
" tccNb = "<<tccNb<<
" towerInTCC = "<<towerInTCC
727 <<
" stripInTower = "<<stripInTower<<
" xtalInStrip = "<<xtalInStrip
728 <<
" CCUid = "<<CCUid<<
" VFEid = "<<VFEid<<
" xtalInVFE = "<<xtalInVFE
729 <<
" xtalWithinCCUid = "<<xtalWithinCCUid<<
" ix = "<<
id.ix()<<
" iy = "<<
id.iy()
730 <<
" xtalhashedId = "<<
id.hashedIndex()<<
" xtalNb = "<<
id.isc()
731 <<
" ietaTT = "<<towid.
ieta()<<
" iphiTT = "<<towid.
iphi()<<std::endl ;
733 int TCCch = stripInTower ;
737 SLBch = 4 + towerInTCC ;
740 SLBslot = int((towerInTCC-5)/8.) + 2 ;
741 SLBch = (towerInTCC-5)%8 + 1 ;
743 for (
int j=0 ;
j<towerInTCC-1 ;
j++) TCCch += NbOfStripPerTCC[tccNb-1][
j] ;
744 float val[] = {float(dccNb+600),float(tccNb),float(towerInTCC),float(stripInTower),
745 float(xtalInStrip),float(CCUid),float(VFEid),float(xtalInVFE),
746 float(xtalWithinCCUid),-999.,-999.,
747 float(
id.ix()),float(
id.iy()),float(towid.
ieta())/
float(
abs(towid.
ieta())),
749 float(
id.ic()),float(towid.
ieta()),
float(towid.
iphi()),
float(TCCch),
751 float(SLBch), float(SLBslot),
758 if ((tccNb == 76 || tccNb == 94) && stripInTower == 1 && xtalInStrip == 3 && (towerInTCC-1)%4==0) {
759 int etaSlice = towid.
ietaAbs() ;
761 getCoeff(coeff, calibMap,
id.rawId()) ;
762 getCoeff(coeff, gainMap,
id.rawId()) ;
763 getCoeff(coeff, pedMap,
id.rawId()) ;
765 for (
int i=0 ; i<3 ; i++) {
768 if (!ok)
std::cout <<
"unable to compute the parameters for Quadrant="<<
id.iquadrant()<<
" xt="<<
id.ic()<<
" " <<dec<<
id.rawId()<<std::endl ;
778 if (!ok)
std::cout<<
"Quadrant="<<
id.iquadrant()<<
" xt="<<
id.ic()<<
" " <<dec<<
id.rawId()<<std::endl ;
780 linEtaSlice[etaSlice] = lin ;
785 for (std::vector<DetId>::const_iterator it = eeCells.begin(); it != eeCells.end(); ++it) {
792 towerListEE.push_back(towid.
rawId()) ;
796 towerListEE.push_back(additionalTower.rawId()) ;
798 stripListEE.push_back(elId.
rawId() & 0xfffffff8) ;
799 int dccNb = Id.
dccId() ;
806 int xtalInVFE = Id.
xtalId() ;
807 int xtalWithinCCUid = 5*(VFEid-1) + xtalInVFE -1 ;
808 int etaSlice = towid.
ietaAbs() ;
813 if (
writeToFiles_) (*out_file_)<<
"CRYSTAL "<<dec<<
id.rawId()<<std::endl ;
815 int iz =
id.positiveZ() ;
816 if (iz ==0) iz = -1 ;
818 for(
int k=0;
k<(int)my_CrystalEcalLogicId_EE.size();
k++) {
820 int z= my_CrystalEcalLogicId_EE[
k].getID1() ;
821 int x= my_CrystalEcalLogicId_EE[
k].getID2() ;
822 int y= my_CrystalEcalLogicId_EE[
k].getID3() ;
824 if(
id.ix()==x &&
id.iy()==y && iz==z) {
826 logicId=my_CrystalEcalLogicId_EE[
k];
834 getCoeff(coeff, calibMap,
id.rawId()) ;
835 getCoeff(coeff, gainMap,
id.rawId()) ;
836 getCoeff(coeff, pedMap,
id.rawId()) ;
837 if (
id.zside()>0) ICEEPlus->Fill(
id.ix(),
id.iy(), coeff.
calibCoeff_) ;
838 else ICEEMinus->Fill(
id.ix(),
id.iy(), coeff.
calibCoeff_) ;
841 std::vector<int> xtalCCU ;
842 xtalCCU.push_back(dccNb+600) ;
843 xtalCCU.push_back(CCUid) ;
844 xtalCCU.push_back(xtalWithinCCUid) ;
845 xtalCCU.push_back(
id.rawId()) ;
850 std::map<int, linStruc>::const_iterator itLin = linEtaSlice.find(etaSlice);
851 if (itLin != linEtaSlice.end()) {
852 linMap[xtalCCU] = itLin->second ;
854 for (
int i=0 ; i<3 ; i++)
855 (*
out_file_) << hex <<
" 0x"<<itLin->second.pedestal_[
i]<<
" 0x"<<itLin->second.mult_[
i]<<
" 0x"<<itLin->second.shift_[
i]<<std::endl;
858 for (
int i=0 ; i<3 ; i++) {
860 if (i==1) {pedDB.
setPedMeanG6(itLin->second.pedestal_[i]) ; linDB.
setMultX6(itLin->second.mult_[i]) ; linDB.
setShift6(itLin->second.shift_[i]) ; }
861 if (i==2) {pedDB.
setPedMeanG1(itLin->second.pedestal_[i]) ; linDB.
setMultX1(itLin->second.mult_[i]) ; linDB.
setShift1(itLin->second.shift_[i]) ; }
864 float factor = float(itLin->second.mult_[0])*
pow(2.,-itLin->second.shift_[0])/
xtal_LSB_EE_ ;
865 if (
id.zside()>0) tpgFactorEEPlus->Fill(
id.ix(),
id.iy(), factor) ;
866 else tpgFactorEEMinus->Fill(
id.ix(),
id.iy(), factor) ;
870 else std::cout<<
"current EtaSlice = "<<etaSlice<<
" not found in the EtaSlice map"<<std::endl ;
875 for (
int i=0 ; i<3 ; i++) {
878 if (!ok)
std::cout <<
"unable to compute the parameters for "<<dec<<
id.rawId()<<std::endl ;
888 if (!ok)
std::cout<<
"Quadrant="<<
id.iquadrant()<<
" xt="<<
id.ic()<<
" " <<dec<<
id.rawId()<<std::endl ;
890 for (
int i=0 ; i<3 ; i++) {
899 if (
id.zside()>0) tpgFactorEEPlus->Fill(
id.ix(),
id.iy(), factor) ;
900 else tpgFactorEEMinus->Fill(
id.ix(),
id.iy(), factor) ;
905 linMap[xtalCCU] = lin ;
908 pedset[logicId] = pedDB ;
909 linset[logicId] = linDB ;
917 linparamset[my_EcalLogicId_EE] = linparam ;
923 lutparamset[my_EcalLogicId_EE] = lutparam ;
929 fgrparamset[my_EcalLogicId_EE] = fgrparam ;
937 std::string lin_tag=ltag.str();
938 std::cout<<
" LIN tag "<<lin_tag<<std::endl;
948 evgueni<<
"void getLinParamTPG_hardcoded(int fed, int ccu, int xtal,"<<std::endl ;
949 evgueni<<
" int & mult12, int & shift12, int & base12,"<<std::endl ;
950 evgueni<<
" int & mult6, int & shift6, int & base6,"<<std::endl ;
951 evgueni<<
" int & mult1, int & shift1, int & base1)"<<std::endl ;
952 evgueni<<
"{"<<std::endl;
953 evgueni<<
" mult12 = 0 ; shift12 = 0 ; base12 = 0 ; mult6 = 0 ; shift6 = 0 ; base6 = 0 ; mult1 = 0 ; shift1 = 0 ; base1 = 0 ;"<<std::endl ;
954 std::map <std::vector<int>,
linStruc>::const_iterator itLinMap ;
955 for (itLinMap = linMap.begin() ; itLinMap != linMap.end() ; itLinMap++) {
956 std::vector<int> xtalInCCU = itLinMap->first ;
957 evgueni<<
" if (fed=="<<xtalInCCU[0]<<
" && ccu=="<<xtalInCCU[1]<<
" && xtal=="<<xtalInCCU[2]<<
") {" ;
958 evgueni<<
" mult12 = "<<itLinMap->second.
mult_[0]<<
" ; shift12 = "<<itLinMap->second.shift_[0]<<
" ; base12 = "<<itLinMap->second.pedestal_[0]<<
" ; " ;
959 evgueni<<
" mult6 = "<<itLinMap->second.mult_[1]<<
" ; shift6 = "<<itLinMap->second.shift_[1]<<
" ; base6 = "<<itLinMap->second.pedestal_[1]<<
" ; " ;
960 evgueni<<
" mult1 = "<<itLinMap->second.mult_[2]<<
" ; shift1 = "<<itLinMap->second.shift_[2]<<
" ; base1 = "<<itLinMap->second.pedestal_[2]<<
" ; " ;
961 evgueni<<
" return ;}" <<std::endl ;
963 evgueni<<
"}" <<std::endl ;
972 const int NWEIGROUPS = 2 ;
973 std::vector<unsigned int> weights[NWEIGROUPS] ;
975 #if (CMSSW_VERSION>=340)
984 double phase = parameterMap.simParameters(barrel).timePhase();
987 weights[1] = weights[0] ;
990 std::map<EcalLogicID, FEConfigWeightGroupDat>
dataset;
992 for (
int igrp=0 ; igrp<NWEIGROUPS ; igrp++) {
994 if (weights[igrp].
size() == 5) {
997 (*out_file_) <<std::endl ;
998 (*out_file_) <<
"WEIGHT "<<igrp<<std::endl ;
999 for (
unsigned int sample=0 ; sample<5 ; sample++) (*
out_file_) <<
"0x" <<hex<<weights[igrp][sample]<<
" " ;
1000 (*out_file_)<<std::endl ;
1001 (*out_file_) <<std::endl ;
1004 std::cout<<
"going to write the weights for groupe:"<<igrp<<std::endl;
1023 std::map<EcalLogicID, FEConfigWeightDat> dataset2;
1026 for (
int ich=0; ich<(int)my_StripEcalLogicId.size() ; ich++){
1030 dataset2[my_StripEcalLogicId[ich]] = wut;
1034 for (
int ich=0; ich<(int)my_StripEcalLogicId1_EE.size() ; ich++){
1039 dataset2[my_StripEcalLogicId1_EE[ich]] = wut;
1042 for (
int ich=0; ich<(int)my_StripEcalLogicId2_EE.size() ; ich++){
1047 dataset2[my_StripEcalLogicId2_EE[ich]] = wut;
1052 wtag.str(
""); wtag<<
"Shape_NGroups_"<<NWEIGROUPS;
1053 std::string weight_tag=wtag.str();
1054 std::cout<<
" weight tag "<<weight_tag<<std::endl;
1064 unsigned int lowRatio, highRatio, lowThreshold, highThreshold, lutFG ;
1067 (*out_file_) <<std::endl ;
1068 (*out_file_) <<
"FG 0"<<std::endl ;
1069 (*out_file_)<<hex<<
"0x"<<lowThreshold<<
" 0x"<<highThreshold
1070 <<
" 0x"<<lowRatio<<
" 0x"<<highRatio<<
" 0x"<<lutFG
1076 unsigned int lut_strip;
1083 std::cout<<
"going to write the fgr "<< std::endl;
1084 std::map<EcalLogicID, FEConfigFgrGroupDat>
dataset;
1087 for (
int ich=0; ich<NFGRGROUPS; ich++){
1097 dataset[ecid] = gut;
1101 std::map<EcalLogicID, FEConfigFgrDat> dataset2;
1103 for (
int ich=0; ich<(int)my_TTEcalLogicId.size() ; ich++){
1110 dataset2[my_TTEcalLogicId[ich]] = wut;
1114 for (
int ich=0; ich<(int)my_RTEcalLogicId_EE.size() ; ich++){
1122 dataset2[my_RTEcalLogicId_EE[ich]] = wut;
1126 std::map<EcalLogicID, FEConfigFgrEETowerDat> dataset3;
1127 for (
int ich=0; ich<(int)my_TTEcalLogicId_EE.size() ; ich++){
1130 dataset3[my_TTEcalLogicId_EE[ich]]=fgreett;
1135 std::map<EcalLogicID, FEConfigFgrEEStripDat> dataset4;
1136 for (
int ich=0; ich<(int)my_StripEcalLogicId1_EE.size() ; ich++){
1140 dataset4[my_StripEcalLogicId1_EE[ich]] = zut;
1142 for (
int ich=0; ich<(int)my_StripEcalLogicId2_EE.size() ; ich++){
1147 dataset4[my_StripEcalLogicId2_EE[ich]] = zut;
1149 for (
int ich=0; ich<(int)my_StripEcalLogicId.size() ; ich++){
1153 uint32_t elStripId = stripMapEB[ich] ;
1154 map<uint32_t, uint32_t>::const_iterator it = stripMapEBsintheta.find(elStripId) ;
1155 if (it != stripMapEBsintheta.end()) zut.
setThreshold(it->second);
1157 std::cout<<
"ERROR: strip SFGVB threshold parameter not found for that strip:"<<thestrip.
getID1()<<
" "<<thestrip.
getID3()<<
" "<<thestrip.
getID3()<<std::endl ;
1163 dataset4[thestrip] = zut;
1169 std::string weight_tag=wtag.str();
1170 std::cout<<
" weight tag "<<weight_tag<<std::endl;
1175 std::cout<<
"going to write the sliding "<< std::endl;
1176 std::map<EcalLogicID, FEConfigSlidingDat>
dataset;
1178 for (
int ich=0; ich<(int)my_StripEcalLogicId.size() ; ich++){
1184 dataset[my_StripEcalLogicId[ich]] = wut;
1188 for (
int ich=0; ich<(int)my_StripEcalLogicId1_EE.size() ; ich++){
1194 dataset[my_StripEcalLogicId1_EE[ich]] = wut;
1196 for (
int ich=0; ich<(int)my_StripEcalLogicId2_EE.size() ; ich++){
1202 dataset[my_StripEcalLogicId2_EE[ich]] = wut;
1208 wtag.str(
""); wtag<<
"Sliding_"<<
sliding_;
1209 std::string justatag=wtag.str();
1210 std::cout<<
" sliding tag "<<justatag<<std::endl;
1223 int lut_EB[1024], lut_EE[1024] ;
1228 (*out_file_) <<std::endl ;
1229 (*out_file_) <<
"LUT 0"<<std::endl ;
1230 for (
int i=0 ; i<1024 ; i++) (*
out_file_)<<
"0x"<<hex<<lut_EB[
i]<<std::endl ;
1231 (*out_file_)<<std::endl ;
1237 bool newLUT(
false) ;
1238 for (
int i=0 ; i<1024 ; i++)
if (lut_EE[i] != lut_EB[i]) newLUT =
true ;
1240 (*out_file_) <<std::endl ;
1241 (*out_file_) <<
"LUT 1"<<std::endl ;
1242 for (
int i=0 ; i<1024 ; i++) (*
out_file_)<<
"0x"<<hex<<lut_EE[
i]<<std::endl ;
1243 (*out_file_)<<std::endl ;
1252 std::map<EcalLogicID, FEConfigLUTGroupDat>
dataset;
1258 for (
int i=0; i<1024; i++){
1263 dataset[ecid] = lut;
1269 for (
int i=0; i<1024; i++){
1274 dataset[ecide] = lute;
1281 std::map<EcalLogicID, FEConfigLUTDat> dataset2;
1283 for (
int ich=0; ich<(int)my_TTEcalLogicId.size() ; ich++){
1289 dataset2[my_TTEcalLogicId[ich]] = lut;
1293 for (
int ich=0; ich<(int)my_TTEcalLogicId_EE.size() ; ich++){
1299 dataset2[my_TTEcalLogicId_EE[ich]] = lut;
1304 ltag.str(
""); ltag<<
LUT_option_<<
"_NGroups_"<<NLUTGROUPS;
1305 std::string lut_tag=ltag.str();
1306 std::cout<<
" LUT tag "<<lut_tag<<std::endl;
1317 std::cout <<
"\n Conf ID = " << conf_id_ << std::endl;
1327 stripListEB.sort() ;
1328 stripListEB.unique() ;
1329 std::cout<<
"Number of EB strips="<<dec<<stripListEB.size()<<std::endl ;
1331 (*out_file_) <<std::endl ;
1332 for (itList = stripListEB.begin(); itList != stripListEB.end(); itList++ ) {
1333 (*out_file_) <<
"STRIP_EB "<<dec<<(*itList)<<std::endl ;
1334 (*out_file_) << hex <<
"0x" <<
sliding_<<std::endl ;
1335 (*out_file_) <<
"0" <<std::endl ;
1336 (*out_file_) <<
"0x"<<stripMapEBsintheta[(*itList)] <<
" 0x" <<
SFGVB_lut_ <<std::endl ;
1341 stripListEE.sort() ;
1342 stripListEE.unique() ;
1343 std::cout<<
"Number of EE strips="<<dec<<stripListEE.size()<<std::endl ;
1345 (*out_file_) <<std::endl ;
1346 for (itList = stripListEE.begin(); itList != stripListEE.end(); itList++ ) {
1347 (*out_file_) <<
"STRIP_EE "<<dec<<(*itList)<<std::endl ;
1348 (*out_file_) << hex <<
"0x" <<
sliding_<<std::endl ;
1349 (*out_file_) <<
" 0" << std::endl ;
1350 (*out_file_)<<hex<<
"0x"<<
threshold<<
" 0x"<<lut_strip<<std::endl ;
1360 towerListEB.sort() ;
1361 towerListEB.unique() ;
1362 std::cout<<
"Number of EB towers="<<dec<<towerListEB.size()<<std::endl ;
1364 (*out_file_) <<std::endl ;
1365 for (itList = towerListEB.begin(); itList != towerListEB.end(); itList++ ) {
1366 (*out_file_) <<
"TOWER_EB "<<dec<<(*itList)<<std::endl ;
1367 (*out_file_) <<
" 0\n 0\n" ;
1372 towerListEE.sort() ;
1373 towerListEE.unique() ;
1374 std::cout<<
"Number of EE towers="<<dec<<towerListEE.size()<<std::endl ;
1376 (*out_file_) <<std::endl ;
1377 for (itList = towerListEE.begin(); itList != towerListEE.end(); itList++ ) {
1378 (*out_file_) <<
"TOWER_EE "<<dec<<(*itList)<<std::endl ;
1379 if (newLUT) (*out_file_) <<
" 1\n" ;
1381 (*out_file_)<<hex<<
"0x"<<lut_tower<<std::endl ;
1392 tpgFactorEB->Write() ;
1394 tpgFactorEEPlus->Write() ;
1395 ICEEMinus->Write() ;
1396 tpgFactorEEMinus->Write() ;
1398 tpgFactor->Write() ;
1402 ntupleSpike->Write() ;
1408 using namespace edm;
1409 using namespace std;
1411 std::cout<<
"we are in beginJob"<<std::endl;
1419 (*out_file_)<<
"PHYSICS_EB "<<dec<<eb.
rawId()<<std::endl ;
1423 (*out_file_) <<std::endl ;
1425 (*out_file_)<<
"PHYSICS_EE "<<dec<<ee.
rawId()<<std::endl ;
1428 <<-1<<
" "<<-1<<std::endl ;
1429 (*out_file_) <<std::endl ;
1468 double factor = 1024 * ratio * gainRatio * calibCoeff *
sin(theta) * (1 << (
sliding_ + shiftDet + 2)) ;
1470 mult = (int)(factor+0.5) ;
1471 for (shift = 0 ; shift<15 ; shift++) {
1472 if (mult>=128 && mult<256)
return true ;
1474 mult = (int)(factor+0.5) ;
1476 std::cout <<
"too bad we did not manage to calculate the factor for calib="<<calibCoeff<<std::endl;
1483 (*out_file_) <<
"COMMENT put your comments here"<<std::endl ;
1485 (*out_file_) <<
"COMMENT ================================="<<std::endl ;
1486 (*out_file_) <<
"COMMENT physics EB structure"<<std::endl ;
1487 (*out_file_) <<
"COMMENT"<<std::endl ;
1488 (*out_file_) <<
"COMMENT EtSaturation (GeV), ttf_threshold_Low (GeV), ttf_threshold_High (GeV)"<<std::endl ;
1489 (*out_file_) <<
"COMMENT FG_lowThreshold (GeV), FG_highThreshold (GeV), FG_lowRatio, FG_highRatio"<<std::endl ;
1490 (*out_file_) <<
"COMMENT ================================="<<std::endl ;
1491 (*out_file_) <<
"COMMENT"<<std::endl ;
1493 (*out_file_) <<
"COMMENT ================================="<<std::endl ;
1494 (*out_file_) <<
"COMMENT physics EE structure"<<std::endl ;
1495 (*out_file_) <<
"COMMENT"<<std::endl ;
1496 (*out_file_) <<
"COMMENT EtSaturation (GeV), ttf_threshold_Low (GeV), ttf_threshold_High (GeV)"<<std::endl ;
1497 (*out_file_) <<
"COMMENT FG_Threshold (GeV), dummy, dummy, dummy"<<std::endl ;
1498 (*out_file_) <<
"COMMENT ================================="<<std::endl ;
1499 (*out_file_) <<
"COMMENT"<<std::endl ;
1501 (*out_file_) <<
"COMMENT ================================="<<std::endl ;
1502 (*out_file_) <<
"COMMENT crystal structure (same for EB and EE)"<<std::endl ;
1503 (*out_file_) <<
"COMMENT"<<std::endl ;
1504 (*out_file_) <<
"COMMENT ped, mult, shift [gain12]"<<std::endl ;
1505 (*out_file_) <<
"COMMENT ped, mult, shift [gain6]"<<std::endl ;
1506 (*out_file_) <<
"COMMENT ped, mult, shift [gain1]"<<std::endl ;
1507 (*out_file_) <<
"COMMENT ================================="<<std::endl ;
1508 (*out_file_) <<
"COMMENT"<<std::endl ;
1510 (*out_file_) <<
"COMMENT ================================="<<std::endl ;
1511 (*out_file_) <<
"COMMENT strip EB structure"<<std::endl ;
1512 (*out_file_) <<
"COMMENT"<<std::endl ;
1513 (*out_file_) <<
"COMMENT sliding_window"<<std::endl ;
1514 (*out_file_) <<
"COMMENT weightGroupId"<<std::endl ;
1515 (*out_file_) <<
"COMMENT threshold_sfg lut_sfg"<<std::endl ;
1516 (*out_file_) <<
"COMMENT ================================="<<std::endl ;
1517 (*out_file_) <<
"COMMENT"<<std::endl ;
1519 (*out_file_) <<
"COMMENT ================================="<<std::endl ;
1520 (*out_file_) <<
"COMMENT strip EE structure"<<std::endl ;
1521 (*out_file_) <<
"COMMENT"<<std::endl ;
1522 (*out_file_) <<
"COMMENT sliding_window"<<std::endl ;
1523 (*out_file_) <<
"COMMENT weightGroupId"<<std::endl ;
1524 (*out_file_) <<
"COMMENT threshold_fg lut_fg"<<std::endl ;
1525 (*out_file_) <<
"COMMENT ================================="<<std::endl ;
1526 (*out_file_) <<
"COMMENT"<<std::endl ;
1528 (*out_file_) <<
"COMMENT ================================="<<std::endl ;
1529 (*out_file_) <<
"COMMENT tower EB structure"<<std::endl ;
1530 (*out_file_) <<
"COMMENT"<<std::endl ;
1531 (*out_file_) <<
"COMMENT LUTGroupId"<<std::endl ;
1532 (*out_file_) <<
"COMMENT FgGroupId"<<std::endl ;
1533 (*out_file_) <<
"COMMENT ================================="<<std::endl ;
1534 (*out_file_) <<
"COMMENT"<<std::endl ;
1536 (*out_file_) <<
"COMMENT ================================="<<std::endl ;
1537 (*out_file_) <<
"COMMENT tower EE structure"<<std::endl ;
1538 (*out_file_) <<
"COMMENT"<<std::endl ;
1539 (*out_file_) <<
"COMMENT LUTGroupId"<<std::endl ;
1540 (*out_file_) <<
"COMMENT tower_lut_fg"<<std::endl ;
1541 (*out_file_) <<
"COMMENT ================================="<<std::endl ;
1542 (*out_file_) <<
"COMMENT"<<std::endl ;
1544 (*out_file_) <<
"COMMENT ================================="<<std::endl ;
1545 (*out_file_) <<
"COMMENT Weight structure"<<std::endl ;
1546 (*out_file_) <<
"COMMENT"<<std::endl ;
1547 (*out_file_) <<
"COMMENT weightGroupId"<<std::endl ;
1548 (*out_file_) <<
"COMMENT w0, w1, w2, w3, w4"<<std::endl ;
1549 (*out_file_) <<
"COMMENT ================================="<<std::endl ;
1550 (*out_file_) <<
"COMMENT"<<std::endl ;
1552 (*out_file_) <<
"COMMENT ================================="<<std::endl ;
1553 (*out_file_) <<
"COMMENT lut structure"<<std::endl ;
1554 (*out_file_) <<
"COMMENT"<<std::endl ;
1555 (*out_file_) <<
"COMMENT LUTGroupId"<<std::endl ;
1556 (*out_file_) <<
"COMMENT LUT[1-1024]"<<std::endl ;
1557 (*out_file_) <<
"COMMENT ================================="<<std::endl ;
1558 (*out_file_) <<
"COMMENT"<<std::endl ;
1560 (*out_file_) <<
"COMMENT ================================="<<std::endl ;
1561 (*out_file_) <<
"COMMENT fg EB structure"<<std::endl ;
1562 (*out_file_) <<
"COMMENT"<<std::endl ;
1563 (*out_file_) <<
"COMMENT FgGroupId"<<std::endl ;
1564 (*out_file_) <<
"COMMENT el, eh, tl, th, lut_fg"<<std::endl ;
1565 (*out_file_) <<
"COMMENT ================================="<<std::endl ;
1566 (*out_file_) <<
"COMMENT"<<std::endl ;
1568 (*out_file_) <<std::endl ;
1575 unsigned int max = (
unsigned int)(
pow(2.,complement2)-1) ;
1576 if (weight>0) iweight=int((1<<6)*weight+0.5) ;
1577 else iweight= max - int(-weight*(1<<6)+0.5) +1 ;
1578 iweight = iweight &
max ;
1584 double weight = double(iweight)/
pow(2., 6.) ;
1586 if ( (iweight & (1<<(complement2-1))) != 0) weight = (double(iweight)-
pow(2., complement2))/
pow(2., 6.) ;
1590 #if (CMSSW_VERSION>=340)
1596 std::cout<<
"Computing Weights..."<<std::endl ;
1597 #if (CMSSW_VERSION>=340)
1598 double timeMax = shape.timeOfMax() - shape.timeOfThr() ;
1600 double timeMax = shape.computeTimeOfMaximum() - shape.computeT0() ;
1602 double max = shape(timeMax) ;
1606 for (
unsigned int sample = 0 ; sample<
nSample_ ; sample++) {
1607 double time = timeMax - ((double)
sampleMax_-(
double)sample)*25. ;
1609 sumf += shape(time)/
max ;
1610 sumf2 += shape(time)/max * shape(time)/
max ;
1611 for (
int subtime = 0 ; subtime<25 ; subtime++) histo->Fill(
float(sample*25. + subtime)/25., shape(time+subtime)) ;
1613 double lambda = 1./(sumf2-sumf*sumf/
nSample_) ;
1614 double gamma = -lambda*sumf/
nSample_ ;
1616 for (
unsigned int sample = 0 ; sample<
nSample_ ; sample++) {
1617 double time = timeMax - ((double)
sampleMax_-(
double)sample)*25. ;
1619 weight[sample] = lambda*shape(time)/max + gamma ;
1623 int * iweight =
new int[
nSample_] ;
1628 for (
unsigned int sample = 0 ; sample<
nSample_ ; sample++) isumw += iweight[sample] ;
1630 isumw = (isumw & imax ) ;
1634 for (
unsigned int sample = 0 ; sample<
nSample_ ; sample++) {
1635 double time = timeMax - ((double)
sampleMax_-(
double)sample)*25. ;
1637 ampl += weight[sample]*shape(time) ;
1638 sumw += weight[sample] ;
1639 std::cout<<
"weight="<<weight[sample]<<
" shape="<<shape(time)<<std::endl ;
1642 std::cout<<
"Weights: sum (weight*shape) = "<<ampl<<std::endl ;
1649 while (isumw != 0 && count<10) {
1651 unsigned int index = 0 ;
1654 std::cout<<
"Correcting for bias: adding 1"<<std::endl ;
1655 for (
unsigned int sample = 0 ; sample<
nSample_ ; sample++) {
1656 int new_iweight = iweight[sample]+1 ;
1658 if (fabs(new_weight-weight[sample])<min) {
1659 min = fabs(new_weight-weight[sample]) ;
1666 std::cout<<
"Correcting for bias: subtracting 1"<<std::endl ;
1667 for (
unsigned int sample = 0 ; sample<
nSample_ ; sample++) {
1668 int new_iweight = iweight[sample]-1 ;
1670 if (fabs(new_weight-weight[sample])<min) {
1671 min = fabs(new_weight-weight[sample]) ;
1678 for (
unsigned int sample = 0 ; sample<
nSample_ ; sample++) isumw += iweight[sample] ;
1680 isumw = (isumw & imax ) ;
1681 std::cout<<
"Correcting weight number: "<<index<<
" sum weights = "<<isumw<<std::endl ;
1688 for (
unsigned int sample = 0 ; sample<
nSample_ ; sample++) isumw += iweight[sample] ;
1690 isumw = (isumw & imax ) ;
1692 for (
unsigned int sample = 0 ; sample<
nSample_ ; sample++) {
1693 double time = timeMax - ((double)
sampleMax_-(
double)sample)*25. ;
1697 ampl += new_weight*shape(time) ;
1698 std::cout<<
"weight unbiased after integer conversion="<<new_weight<<
" shape="<<shape(time)<<std::endl ;
1701 std::cout<<
"Weights: sum (weight*shape) = "<<ampl<<std::endl ;
1705 std::vector<unsigned int> theWeights ;
1706 for (
unsigned int sample = 0 ; sample<
nSample_ ; sample++) theWeights.push_back(iweight[sample]) ;
1734 for (
int i=0 ;
i<1024 ;
i++) {
1736 if (lut[
i]>0xff) lut[
i] = 0xff ;
1742 for (
int i=0 ;
i<1024 ;
i++) {
1744 if ((
i+1)%4 == 0 ) mylut++ ;
1751 func->SetParameters(LUT_stochastic, LUT_noise, LUT_constant) ;
1752 double norm = func->Integral(0., Et_sat) ;
1753 for (
int i=0 ;
i<1024 ;
i++) {
1754 double Et =
i*Et_sat/1024. ;
1755 lut[
i] = int(0xff*func->Integral(0., Et)/norm + 0.5) ;
1760 for (
int j=0 ;
j<1024 ;
j++) {
1761 double Et_GeV = Et_sat/1024*(
j+0.5) ;
1762 if (Et_GeV <= LUT_threshold) lut[
j] = 0 ;
1764 if (Et_GeV >= TTF_highThreshold) ttf = 3 ;
1765 if (Et_GeV >= TTF_lowThreshold && Et_GeV < TTF_highThreshold) ttf = 1 ;
1779 else std::cout<<
"getCoeff: "<<rawId<<
" not found in EcalIntercalibConstantMap"<<std::endl ;
1789 if (gainIter != gainMap.
end()) {
1794 else std::cout<<
"getCoeff: "<<rawId<<
" not found in EcalGainRatioMap"<<std::endl ;
1812 if (pedIter != pedMap.
end()) {
1814 coeff.
pedestals_[0] = int(aped.mean_x12 + 0.5) ;
1815 coeff.
pedestals_[1] = int(aped.mean_x6 + 0.5) ;
1816 coeff.
pedestals_[2] = int(aped.mean_x1 + 0.5) ;
1818 else std::cout<<
"getCoeff: "<<rawId<<
" not found in EcalPedestalsMap"<<std::endl ;
1828 std::map<EcalLogicID, MonPedestalsDat>::const_iterator it = pedMap.find(logicId);
1829 if (it != pedMap.end()) {
1836 <<
" not found in std::map<EcalLogicID, MonPedestalsDat>"<<std::endl ;
1840 unsigned int & lowThreshold,
unsigned int & highThreshold,
unsigned int & lut)
1843 if (lowRatio>0x7f) lowRatio = 0x7f ;
1845 if (highRatio>0x7f) highRatio = 0x7f ;
1850 if (lowThreshold>0xff) lowThreshold = 0xff ;
1852 if (highThreshold>0xff) highThreshold = 0xff ;
1878 for (
int i=1 ;
i<3 ;
i++)
1882 for (
int i=0 ;
i<3 ;
i++) {
1886 std::cout<<
"WARNING: base= "<<base[
i]<<
" for gainId[0-2]="<<
i<<
" ==> forcing at 0"<<std::endl ;
1897 gctphi = (ttphi+1)/4;
1898 if(ttphi<=2) gctphi=0;
1899 if(ttphi>=71) gctphi=0;
1905 if(tteta>0) gcteta = (tteta-1)/4 + 11;
1906 else if(tteta<0) gcteta = (tteta+1)/4 + 10;
1911 std::stringstream sdet ;
1913 if (tcc>36 && tcc<55) sdet<<
"EB-"<<tcc-36 ;
1914 else if (tcc>=55 && tcc<73) sdet<<
"EB+"<<tcc-54 ;
1915 else if (tcc<=36) sdet<<
"EE-" ;
1918 if (tcc<=36 || tcc>=73) {
1919 if (tcc>=73) tcc-=72 ;
1920 if (tcc==1 || tcc==18 || tcc==19 || tcc==36) sdet<<7 ;
1921 else if (tcc==2 || tcc==3 || tcc==20 || tcc==21) sdet<<8 ;
1922 else if (tcc==4 || tcc==5 || tcc==22 || tcc==23) sdet<<9 ;
1923 else if (tcc==6 || tcc==7 || tcc==24 || tcc==25) sdet<<1 ;
1924 else if (tcc==8 || tcc==9 || tcc==26 || tcc==27) sdet<<2 ;
1925 else if (tcc==10 || tcc==11 || tcc==28 || tcc==29) sdet<<3 ;
1926 else if (tcc==12 || tcc==13 || tcc==30 || tcc==31) sdet<<4 ;
1927 else if (tcc==14 || tcc==15 || tcc==32 || tcc==33) sdet<<5 ;
1928 else if (tcc==16 || tcc==17 || tcc==34 || tcc==35) sdet<<6 ;
1935 std::stringstream crate ;
1940 if (tcc>=40 && tcc<=42) {crate<<
"02d" ; slot = 5 + (tcc-40)*6 ;}
1941 if (tcc>=43 && tcc<=45) {crate<<
"03d" ; slot = 5 + (tcc-43)*6 ;}
1942 if (tcc>=37 && tcc<=39) {crate<<
"04d" ; slot = 5 + (tcc-37)*6 ;}
1943 if (tcc>=52 && tcc<=54) {crate<<
"06d" ; slot = 5 + (tcc-52)*6 ;}
1944 if (tcc>=46 && tcc<=48) {crate<<
"07d" ; slot = 5 + (tcc-46)*6 ;}
1945 if (tcc>=49 && tcc<=51) {crate<<
"08d" ; slot = 5 + (tcc-49)*6 ;}
1946 if (tcc>=58 && tcc<=60) {crate<<
"02h" ; slot = 5 + (tcc-58)*6 ;}
1947 if (tcc>=61 && tcc<=63) {crate<<
"03h" ; slot = 5 + (tcc-61)*6 ;}
1948 if (tcc>=55 && tcc<=57) {crate<<
"04h" ; slot = 5 + (tcc-55)*6 ;}
1949 if (tcc>=70 && tcc<=72) {crate<<
"06h" ; slot = 5 + (tcc-70)*6 ;}
1950 if (tcc>=64 && tcc<=66) {crate<<
"07h" ; slot = 5 + (tcc-64)*6 ;}
1951 if (tcc>=67 && tcc<=69) {crate<<
"08h" ; slot = 5 + (tcc-67)*6 ;}
1953 if (tcc>=76 && tcc<=81) {
1955 if (tcc%2==0) slot = 2 + (tcc-76)*3 ;
1956 else slot = 4 + (tcc-77)*3 ;
1958 if (tcc>=94 && tcc<=99) {
1960 if (tcc%2==0) slot = 3 + (tcc-94)*3 ;
1961 else slot = 5 + (tcc-95)*3 ;
1964 if (tcc>=22 && tcc<=27) {
1966 if (tcc%2==0) slot = 2 + (tcc-22)*3 ;
1967 else slot = 4 + (tcc-23)*3 ;
1969 if (tcc>=4 && tcc<=9) {
1971 if (tcc%2==0) slot = 3 + (tcc-4)*3 ;
1972 else slot = 5 + (tcc-5)*3 ;
1975 if (tcc>=82 && tcc<=87) {
1977 if (tcc%2==0) slot = 2 + (tcc-82)*3 ;
1978 else slot = 4 + (tcc-83)*3 ;
1980 if (tcc>=100 && tcc<=105) {
1982 if (tcc%2==0) slot = 3 + (tcc-100)*3 ;
1983 else slot = 5 + (tcc-101)*3 ;
1986 if (tcc>=28 && tcc<=33) {
1988 if (tcc%2==0) slot = 2 + (tcc-28)*3 ;
1989 else slot = 4 + (tcc-29)*3 ;
1991 if (tcc>=10 && tcc<=15) {
1993 if (tcc%2==0) slot = 3 + (tcc-10)*3 ;
1994 else slot = 5 + (tcc-11)*3 ;
1997 if (tcc==34) {crate<<
"04l" ; slot = 2 ;}
1998 if (tcc==16) {crate<<
"04l" ; slot = 3 ;}
1999 if (tcc==35) {crate<<
"04l" ; slot = 4 ;}
2000 if (tcc==17) {crate<<
"04l" ; slot = 5 ;}
2001 if (tcc==36) {crate<<
"04l" ; slot = 8 ;}
2002 if (tcc==18) {crate<<
"04l" ; slot = 9 ;}
2003 if (tcc==19) {crate<<
"04l" ; slot = 10 ;}
2004 if (tcc==1) {crate<<
"04l" ; slot = 11 ;}
2005 if (tcc==20) {crate<<
"04l" ; slot = 14 ;}
2006 if (tcc==2) {crate<<
"04l" ; slot = 15 ;}
2007 if (tcc==21) {crate<<
"04l" ; slot = 16 ;}
2008 if (tcc==3) {crate<<
"04l" ; slot = 17 ;}
2010 if (tcc==88) {crate<<
"06l" ; slot = 2 ;}
2011 if (tcc==106) {crate<<
"06l" ; slot = 3 ;}
2012 if (tcc==89) {crate<<
"06l" ; slot = 4 ;}
2013 if (tcc==107) {crate<<
"06l" ; slot = 5 ;}
2014 if (tcc==90) {crate<<
"06l" ; slot = 8 ;}
2015 if (tcc==108) {crate<<
"06l" ; slot = 9 ;}
2016 if (tcc==73) {crate<<
"06l" ; slot = 10 ;}
2017 if (tcc==91) {crate<<
"06l" ; slot = 11 ;}
2018 if (tcc==74) {crate<<
"06l" ; slot = 14 ;}
2019 if (tcc==92) {crate<<
"06l" ; slot = 15 ;}
2020 if (tcc==75) {crate<<
"06l" ; slot = 16 ;}
2021 if (tcc==93) {crate<<
"06l" ; slot = 17 ;}
2023 return std::pair< std::string, int > (crate.str(),slot) ;
int writeToConfDB_TPGLinearCoef(const std::map< EcalLogicID, FEConfigLinDat > &linset, const std::map< EcalLogicID, FEConfigLinParamDat > &linparamset, int iovId, std::string tag)
T getParameter(std::string const &) const
void setThreshLow(float x)
edm::ESHandle< EcalTrigTowerConstituentsMap > eTTmap_
int xtalId() const
get the channel id
void setLUTGroupId(int x)
int stripId() const
get the tower id
void setFGhighratio(float x)
const self & getMap() const
Ecal readout channel identification [32:20] Unused (so far) [19:13] DCC id [12:6] tower [5:3] strip [...
double TTF_highThreshold_EB_
unsigned int SFGVB_Threshold_
std::pair< std::string, int > getCrate(int tcc)
int getGCTRegionPhi(int ttphi)
Sin< T >::type sin(const T &t)
Geom::Phi< T > phi() const
std::string getDet(int tcc)
double oneOverEtResolEt(double *x, double *par)
Geom::Theta< T > theta() const
bool weight_unbias_recovery_
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)
unsigned int FG_lut_tower_EE_
const CaloSubdetectorGeometry * theEndcapGeometry_
double FG_lowThreshold_EB_
std::ofstream * out_file_
void computeFineGrainEBParameters(unsigned int &lowRatio, unsigned int &highRatio, unsigned int &lowThreshold, unsigned int &highThreshold, unsigned int &lut)
int writeToConfDB_TPGMain(int ped, int lin, int lut, int fgr, int sli, int wei, int bxt, int btt, std::string tag, int ver)
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
int channelId() const
get the channel id
int ieta() const
get the tower ieta
void setPedMeanG6(float mean)
int zside() const
get the z-side of the tower (1/-1)
virtual const std::vector< DetId > & getValidDetIds(DetId::Detector det=DetId::Detector(0), int subdet=0) const
Get a list of valid detector ids (for the given subdetector)
void getCoeff(coeffStruc &coeff, const EcalIntercalibConstantMap &calibMap, unsigned int rawId)
virtual const CaloCellGeometry * getGeometry(const DetId &id) const
Get the cell geometry of a given detector id. Should return false if not found.
std::vector< EcalLogicID > getEcalLogicIDSetOrdered(std::string name, int fromId1, int toId1, int fromId2=EcalLogicID::NULLID, int toId2=EcalLogicID::NULLID, int fromId3=EcalLogicID::NULLID, int toId3=EcalLogicID::NULLID, std::string mapsTo="", int orderedBy=EcalLogicID::NULLID)
Geom::Theta< T > theta() const
uint32_t rawId() const
get the raw id
U second(std::pair< T, U > const &p)
int TCCid(const EBDetId &id) const
returns the TCCid of an EBDetId
std::vector< unsigned int > computeWeights(EcalShapeBase &shape, TH1F *histo)
int hashedIndex(int ieta, int iphi)
EcalElectronicsId getElectronicsId(const DetId &id) const
Get the electronics id for this det id.
double TTF_lowThreshold_EE_
void setThreshold(unsigned int mean)
void setPedMeanG1(float mean)
void setThreshHigh(float x)
float getPedMeanG12() const
const T & max(const T &a, const T &b)
EcalPedestalsMap::const_iterator EcalPedestalsMapIterator
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")
bool useTransverseEnergy_
EcalTPGParamBuilder(edm::ParameterSet const &pSet)
void setLUTValue(int i, int x)
EcalLogicID getEcalLogicID(std::string name, int id1=EcalLogicID::NULLID, int id2=EcalLogicID::NULLID, int id3=EcalLogicID::NULLID, std::string mapsTo="")
virtual void analyze(const edm::Event &evt, const edm::EventSetup &evtSetup)
EcalTriggerElectronicsId getTriggerElectronicsId(const DetId &id) const
Get the trigger electronics id for this det id.
double LUT_stochastic_EE_
std::ofstream * geomFile_
void computeFineGrainEEParameters(unsigned int &threshold, unsigned int &lut_strip, unsigned int &lut_tower)
void setLUTGroupId(int x)
void setFgrGroupId(int x)
int pseudoStripId() const
get the tower id
int dccId() const
get the DCC (Ecal Local DCC value not global one) id
void setRatioLow(float x)
void setFgrGroupId(int x)
bool realignBaseline(linStruc &lin, float forceBase12)
bool computeLinearizerParam(double theta, double gainRatio, double calibCoeff, std::string subdet, int &mult, int &shift)
unsigned int pedestal_offset_
int iphi() const
get the tower iphi
const CaloSubdetectorGeometry * theBarrelGeometry_
bool useInterCalibration_
int writeToConfDB_TPGPedestals(const std::map< EcalLogicID, FEConfigPedDat > &pedset, int iovId, std::string tag)
void setPedMeanG12(float mean)
std::vector< Item >::const_iterator const_iterator
int DCCid(const EBDetId &id) const
returns the DCC of an EBDetId
float gain12Over6() const
float getPedMeanG1() const
EcalSubdetector subDet() const
get the subDetector associated to the Trigger Tower
void setConfigTag(std::string x)
void setFGlowratio(float x)
double TTF_highThreshold_EE_
void setSliding(float mean)
double LUT_stochastic_EB_
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)
float getPedMeanG6() const
const_iterator find(uint32_t rawId) const
static unsigned int const shift
void setWeightGroupId(int x)
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)
unsigned int complement2_
const_iterator end() 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)
void setTTThreshlow(float x)
void setWeightGroupId(int x)
unsigned int FG_lut_strip_EE_
const GlobalPoint & getPosition() const
int getEtaSlice(int tccId, int towerInTCC)
double FG_highThreshold_EB_
void setLutValue(int mean)
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)
double TTF_lowThreshold_EB_
bool checkIfOK(EcalPedestals::Item item)
const double par[8 *NPar][4]
int uncodeWeight(double weight, int complement2=7)