1 #include "RecoLuminosity/ROOTSchema/interface/HTMLGenerator.hh"
17 #include "RecoLuminosity/TCPReceiver/interface/LumiStructures.hh"
19 HCAL_HLX::HTMLGenerator::HTMLGenerator(){
21 RFReader_ =
new ROOTFileReader;
22 lumiSection_ =
new LUMI_SECTION;
30 previousRunNumber = 0;
32 HistoNames.push_back(
"ETSum");
33 HistoNames.push_back(
"OccBelowSet1");
34 HistoNames.push_back(
"OccBetweenSet1");
35 HistoNames.push_back(
"OccAboveSet1");
36 HistoNames.push_back(
"OccBelowSet2");
37 HistoNames.push_back(
"OccBetweenSet2");
38 HistoNames.push_back(
"OccAboveSet2");
39 HistoNames.push_back(
"LHC");
41 std::vector< std::string > HLXToHFMap;
43 HLXToHFMap.push_back(
"HLX 1 - hf- s26,27 - iPhi 51");
44 HLXToHFMap.push_back(
"HLX 2 - hf- s28,29 - iPhi 55");
45 HLXToHFMap.push_back(
"HLX 3 - hf- s30,31 - iPhi 59");
46 HLXToHFMap.push_back(
"HLX 4 - hf- s32,33 - iPhi 63");
47 HLXToHFMap.push_back(
"HLX 5 - hf- s34,35 - iPhi 67");
48 HLXToHFMap.push_back(
"HLX 6 - hf- s36,1 - iPhi 71");
49 HLXToHFMap.push_back(
"HLX 7 - hf+ s26,27 - iPhi 51");
50 HLXToHFMap.push_back(
"HLX 8 - hf+ s28,29 - iPhi 55");
51 HLXToHFMap.push_back(
"HLX 9 - hf+ s30,31 - iPhi 59");
52 HLXToHFMap.push_back(
"HLX 10 - hf+ s32,33 - iPhi 63");
53 HLXToHFMap.push_back(
"HLX 11 - hf+ s34,35 - iPhi 67");
54 HLXToHFMap.push_back(
"HLX 12 - hf+ s36,1 - iPhi 71");
55 HLXToHFMap.push_back(
"HLX 13 - hf- s14,15 - iPhi 27");
56 HLXToHFMap.push_back(
"HLX 14 - hf- s16,17 - iPhi 31");
57 HLXToHFMap.push_back(
"HLX 15 - hf- s18,19 - iPhi 35");
58 HLXToHFMap.push_back(
"HLX 16 - hf- s20,21 - iPhi 39");
59 HLXToHFMap.push_back(
"HLX 17 - hf- s22,23 - iPhi 43");
60 HLXToHFMap.push_back(
"HLX 18 - hf- s24,25 - iPhi 47");
61 HLXToHFMap.push_back(
"HLX 19 - hf+ s14,15 - iPhi 27");
62 HLXToHFMap.push_back(
"HLX 20 - hf+ s16,17 - iPhi 31");
63 HLXToHFMap.push_back(
"HLX 21 - hf+ s18,19 - iPhi 35");
64 HLXToHFMap.push_back(
"HLX 22 - hf+ s20,21 - iPhi 39");
65 HLXToHFMap.push_back(
"HLX 23 - hf+ s22,23 - iPhi 43");
66 HLXToHFMap.push_back(
"HLX 24 - hf+ s24,25 - iPhi 47");
67 HLXToHFMap.push_back(
"HLX 25 - hf- s2,3 - iPhi 3");
68 HLXToHFMap.push_back(
"HLX 26 - hf- s4,5 - iPhi 7");
69 HLXToHFMap.push_back(
"HLX 27 - hf- s6,7 - iPhi 11");
70 HLXToHFMap.push_back(
"HLX 28 - hf- s8,9 - iPhi 15");
71 HLXToHFMap.push_back(
"HLX 29 - hf- s10,11 - iPhi 19");
72 HLXToHFMap.push_back(
"HLX 30 - hf- s12,13 - iPhi 23");
73 HLXToHFMap.push_back(
"HLX 31 - hf+ s2,3 - iPhi 3");
74 HLXToHFMap.push_back(
"HLX 32 - hf+ s4,5 - iPhi 7");
75 HLXToHFMap.push_back(
"HLX 33 - hf+ s6,7 - iPhi 11");
76 HLXToHFMap.push_back(
"HLX 34 - hf+ s8,9 - iPhi 15");
77 HLXToHFMap.push_back(
"HLX 35 - hf+ s10,11 - iPhi 19");
78 HLXToHFMap.push_back(
"HLX 36 - hf+ s12,13 - iPhi 23");
80 int iEta[] = {-41,-41,-41,-41,-41,-41,
81 29, 29, 29, 29, 29, 29,
82 -41,-41,-41,-41,-41,-41,
83 29, 29, 29, 29, 29, 29,
84 -41,-41,-41,-41,-41,-41,
85 29, 29, 29, 29, 29, 29};
87 int iPhi[] = { 51,55,59,63,67,71,
94 for(
unsigned int iHLX = 0; iHLX < 36; ++iHLX ){
95 HLXToHFMap_[iHLX] = HLXToHFMap[iHLX];
96 iEta_[iHLX] = iEta[iHLX];
97 iPhi_[iHLX] = iPhi[iHLX];
102 c1_ =
new TCanvas(
"c1",
"c1",700,500);
108 BinWidth_ = (
unsigned int)(XMax_ - XMin_)/NBins_;
110 for(
unsigned int iHisto = 0; iHisto < 8; ++iHisto ){
111 HLXHistos_[iHisto] =
new TH1F(HistoNames[iHisto].c_str(),
"", NBins_, XMin_, XMax_);
112 HLXHistos_[iHisto]->GetXaxis()->SetTitle(
"Bunch Crossing");
113 HLXHistos_[iHisto]->GetYaxis()->SetTitleOffset(1.3);
114 HLXHistos_[iHisto]->SetFillColor(kBlue);
117 HLXHistos_[0]->GetYaxis()->SetTitle(
"Et Sum (1 LS)");
118 HLXHistos_[7]->GetYaxis()->SetTitle(
"LHC (1 LS)");
119 for(
unsigned int iHisto = 0; iHisto < 6; ++iHisto ){
120 HLXHistos_[iHisto+1]->GetYaxis()->SetTitle(
"Occupancy (1 LS)");
123 EtSummary_ =
new TH2F(
"EtSummary",
"Avg Et Sum Per Wedge", 12, -42, 42, 18, 0, 72);
124 EtSummary_->GetXaxis()->SetTitle(
"i #eta");
125 EtSummary_->GetYaxis()->SetTitle(
"i #phi");
126 OccSummary_ =
new TH2F(
"OccSummary",
"Avg Occupancy Per Wedge", 12, -42, 42, 18, 0, 72);
127 OccSummary_->GetXaxis()->SetTitle(
"i #eta");
128 OccSummary_->GetYaxis()->SetTitle(
"i #phi");
130 MaxEtSummary_ =
new TH2F(
"MaxEtSummary",
"BX with Max Et Sum Per Wedge", 12, -42, 42, 18, 0, 72);
131 MaxEtSummary_->GetXaxis()->SetTitle(
"i #eta");
132 MaxEtSummary_->GetYaxis()->SetTitle(
"i #phi");
133 MaxLHCSummary_ =
new TH2F(
"MaxLHCSummary",
"BX with Max LHC Occupancy Per Wedge", 12, -42, 42, 18, 0, 72);
134 MaxLHCSummary_->GetXaxis()->SetTitle(
"i #eta");
135 MaxLHCSummary_->GetYaxis()->SetTitle(
"i #phi");
137 ETLumiHisto_ =
new TH1F(
"ETLumi",
"E_{T} Lumi", NBins_, XMin_, XMax_);
138 ETLumiHisto_->GetXaxis()->SetTitle(
"Bunch Crossing");
139 OccLumiSet1Histo_ =
new TH1F(
"OccLumiSet1",
"Occupancy Lumi Set1", NBins_, XMin_, XMax_);
140 OccLumiSet1Histo_->GetXaxis()->SetTitle(
"Bunch Crossing");
141 OccLumiSet2Histo_ =
new TH1F(
"OccLumiSet2",
"Occupancy Lumi Set2", NBins_, XMin_, XMax_);
142 OccLumiSet2Histo_->GetXaxis()->SetTitle(
"Bunch Crossing");
146 HCAL_HLX::HTMLGenerator::~HTMLGenerator(){
153 delete HLXHistos_[0];
154 delete HLXHistos_[1];
155 delete HLXHistos_[2];
156 delete HLXHistos_[3];
157 delete HLXHistos_[4];
158 delete HLXHistos_[5];
159 delete HLXHistos_[6];
160 delete HLXHistos_[7];
163 delete OccLumiSet1Histo_;
164 delete OccLumiSet2Histo_;
169 delete MaxEtSummary_;
170 delete MaxLHCSummary_;
176 void HCAL_HLX::HTMLGenerator::SetEtSumOnly(
const bool bEtSumOnly ){
177 bEtSumOnly_ = bEtSumOnly;
178 RFReader_->SetEtSumOnly( bEtSumOnly );
181 void HCAL_HLX::HTMLGenerator::SetHistoBins(
unsigned int NBins,
double XMin,
double XMax){
193 for(
unsigned int iHisto = 0; iHisto < 8; ++iHisto){
194 HLXHistos_[iHisto]->SetBins(NBins_, XMin_, XMax_);
196 ETLumiHisto_->SetBins(NBins_, XMin_, XMax_);
197 OccLumiSet1Histo_->SetBins(NBins_, XMin_, XMax_);
198 OccLumiSet2Histo_->SetBins(NBins_, XMin_, XMax_);
200 BinWidth_ = (
unsigned int )(XMax_ - XMin_)/NBins_;
207 RFReader_->SetFileName( fileName );
208 RFReader_->GetEntry( iEntry );
209 RFReader_->GetLumiSection( *lumiSection_ );
211 MakeDir( outputDir_ + GetRunDir() + GetLSDir(), writeMode_ );
213 for(
unsigned int iHLX = 0; iHLX < 36; ++iHLX){
214 MakeDir(outputDir_ + GetRunDir() + GetLSDir() + GetHLXDir(iHLX), writeMode_ );
215 GenerateHLXPage(iHLX);
216 MakeDir(outputDir_ + GetRunDir() + GetLSDir() + GetHLXDir(iHLX) + GetHLXPicDir(iHLX), writeMode_ );
217 GenerateHLXPlots(iHLX);
220 GenerateAveragePlots();
221 GenerateAveragePage();
223 GenerateComparePlots();
224 GenerateComparePage();
230 for(
unsigned int iHisto = 0; iHisto < 8; ++iHisto){
231 GenerateHistoGroupPage(HistoNames[iHisto]);
234 GenerateSectionPage();
241 void HCAL_HLX::HTMLGenerator::SetInputDir(
const std::string &inDir ){
243 RFReader_->SetDir( inDir );
246 void HCAL_HLX::HTMLGenerator::SetFileType(
const std::string &fileType){
248 RFReader_->SetFileType( fileType );
253 std::string HCAL_HLX::HTMLGenerator::GetRunDir(){
258 dirName.str(std::string());
259 dirName << std::setw(3) << std::setfill(
'0') << (lumiSection_->hdr.runNumber / 1000000)
260 <<
"/" << std::setw(3) << std::setfill(
'0') << (lumiSection_->hdr.runNumber % 1000000) / 1000
261 <<
"/" << std::setw(3) << std::setfill(
'0') << (lumiSection_->hdr.runNumber % 1000)
264 return dirName.str();
267 std::string HCAL_HLX::HTMLGenerator::GetLSDir(){
270 dirName.str(std::string());
271 dirName << std::setw(4) << std::setfill(
'0') << lumiSection_->hdr.sectionNumber <<
"/";
273 return dirName.str();
276 std::string HCAL_HLX::HTMLGenerator::GetHLXDir(
const unsigned short int &HLXID){
279 dirName.str(std::string());
280 dirName <<
"HLX" << std::setw(2) << std::setfill(
'0') << HLXID <<
"/";
282 return dirName.str();
285 std::string HCAL_HLX::HTMLGenerator::GetHLXPicDir(
const unsigned short int &HLXID ){
292 void HCAL_HLX::HTMLGenerator::GenerateIndexPage(){
295 fileName = outputDir_ +
"index.html";
297 if( !fileExists(fileName) ){
298 std::string fileTitle =
"Luminosity Monitoring System";
300 MakeEmptyWebPage( fileName, fileTitle);
301 InsertLineAfter( fileName,
"<H1>\nLuminosity Monitoring System\n</H1>",
"<body>");
305 if( lumiSection_->hdr.runNumber != previousRunNumber ){
306 std::stringstream runLine;
307 runLine <<
"<a href = \""
309 <<
"index.html\"> Run - "
310 << lumiSection_->hdr.runNumber <<
"</a> "
313 previousRunNumber = lumiSection_->hdr.runNumber;
314 InsertLineBefore( fileName, runLine.str(),
"</body>");
318 void HCAL_HLX::HTMLGenerator::GenerateRunPage(){
322 fileName = outputDir_ + GetRunDir() +
"index.html";
324 if(!fileExists(fileName)){
325 std::stringstream fileTitle;
327 fileTitle <<
"Luminosity File Reader - Run " << lumiSection_->hdr.runNumber;
328 MakeEmptyWebPage(fileName, fileTitle.str());
331 std::stringstream sectionLine;
333 sectionLine <<
"<a href = \""
335 <<
"index.html\"> Run - "
336 << lumiSection_->hdr.runNumber <<
" Section "
337 << lumiSection_->hdr.sectionNumber <<
"</a> "
338 << TimeStampLong() <<
"</br>";
340 InsertLineBefore( fileName, sectionLine.str(),
"</body>");
343 void HCAL_HLX::HTMLGenerator::GenerateSectionPage(){
347 std::ofstream fileStr;
350 fileName = outputDir_ + GetRunDir() + GetLSDir() +
"index.html";
351 fileStr.open(fileName.c_str());
353 fileStr <<
"<html>" << std::endl;
354 fileStr <<
"<title>" << std::endl;
355 fileStr <<
"Luminosity File Reader - " <<
"Run " << lumiSection_->hdr.runNumber <<
" - "
356 <<
" Lumi Section - " << lumiSection_->hdr.sectionNumber << std::endl;
357 fileStr <<
"</title>" << std::endl;
358 fileStr <<
"<body>" << std::endl;
360 fileStr <<
"<a href=\""
363 << HistoNames[0] <<
"</a></br>" << std::endl;
366 for(
int unsigned iHisto = 1; iHisto < 8; ++iHisto){
367 fileStr <<
"<a href=\""
368 << HistoNames[iHisto]
370 << HistoNames[iHisto] <<
"</a></br>" << std::endl;
372 fileStr <<
"<a href=\"Luminosity/index.html\">Luminosity</a>" << std::endl;
375 fileStr <<
"</br>" << std::endl;
376 fileStr <<
"</br>" << std::endl;
378 fileStr <<
"<hr>" << std::endl;
379 fileStr <<
"Summary" << std::endl;
380 fileStr <<
"<hr>" << std::endl;
383 gStyle->SetOptStat(0);
384 gStyle->SetPalette(1);
388 MaxEtSummary_->Reset();
390 float MaxAvgEt = 0.0;
391 float MinAvgEt = 1000000000.0;
392 for(
unsigned int iHLX = 0; iHLX < 36; ++iHLX ){
395 unsigned int MaxEtBX = 0;
396 float AvgEtSum = 0.0;
398 for(
unsigned int iBX = static_cast<unsigned int>(XMin_); iBX < XMax_; ++iBX){
400 AvgEtSum += lumiSection_->etSum[iHLX].data[iBX];
403 if( lumiSection_->etSum[iHLX].data[iBX] > MaxEt ){
404 MaxEt = lumiSection_->etSum[iHLX].data[iBX];
410 AvgEtSum /= ((XMax_ - XMin_)*lumiSection_->hdr.numOrbits);
412 if( AvgEtSum > MaxAvgEt ) MaxAvgEt = AvgEtSum;
413 if( AvgEtSum < MinAvgEt ) MinAvgEt = AvgEtSum;
415 EtSummary_->Fill( iEta_[iHLX], iPhi_[iHLX], AvgEtSum );
416 EtSummary_->Fill( iEta_[iHLX] +7, iPhi_[iHLX], AvgEtSum );
418 MaxEtSummary_->Fill( iEta_[iHLX], iPhi_[iHLX], MaxEtBX );
419 MaxEtSummary_->Fill( iEta_[iHLX] +7, iPhi_[iHLX], MaxEtBX );
422 fileStr <<
"<img src=\"EtSummary.png\" usemap=\"#HLXSummary\" border=\"0\" width=\"45%\">" << std::endl;
423 fileStr <<
"<img src=\"MaxEtSummary.png\" usemap=\"#HLXSummary\" border=\"0\" width=\"45%\">" << std::endl;
425 std::string picName = outputDir_ + GetRunDir() + GetLSDir() +
"EtSummary." + plotExt_;
426 EtSummary_->GetZaxis()->SetRangeUser( MinAvgEt - 0.0000001, MaxAvgEt + 0.0000001 );
427 EtSummary_->Draw(
"colz");
428 c1_->SaveAs(picName.c_str());
430 picName = outputDir_ + GetRunDir() + GetLSDir() +
"MaxEtSummary." + plotExt_;
431 MaxEtSummary_->GetZaxis()->SetRangeUser( 0, 3564 );
432 MaxEtSummary_->Draw(
"colz");
433 c1_->SaveAs(picName.c_str());
437 MaxLHCSummary_->Reset();
438 OccSummary_->Reset();
441 float MinOcc = 1000000000.0;
443 for(
int iHLX = 0; iHLX < 36; ++iHLX){
445 unsigned int MaxLHCBX = 0;
448 float AvgOccSet1 = 0.0;
449 float AvgOccSet2 = 0.0;
451 for(
int iBX = 100; iBX < 3500; ++iBX){
452 AvgOccSet1 += lumiSection_->occupancy[iHLX].data[0][iBX];
453 AvgOccSet2 += lumiSection_->occupancy[iHLX].data[3][iBX];
454 if( lumiSection_->lhc[iHLX].data[iBX] > MaxLHC ){
455 MaxLHC = lumiSection_->lhc[iHLX].data[iBX];
460 AvgOccSet1 /= (3400.0*lumiSection_->hdr.numOrbits);
461 AvgOccSet2 /= (3400.0*lumiSection_->hdr.numOrbits);
464 if( AvgOccSet1 > MaxOcc ){
467 if( AvgOccSet1 < MinOcc ){
472 if( AvgOccSet2 > MaxOcc ){
475 if( AvgOccSet1 < MinOcc ){
479 if( iEta_[iHLX] > 0 ){
480 OccSummary_->Fill( iEta_[iHLX] +7 , iPhi_[iHLX], AvgOccSet1 );
481 OccSummary_->Fill( iEta_[iHLX], iPhi_[iHLX], AvgOccSet2 );
484 if( iEta_[iHLX] < 0 ){
485 OccSummary_->Fill( iEta_[iHLX], iPhi_[iHLX], AvgOccSet1 );
486 OccSummary_->Fill( iEta_[iHLX] + 7, iPhi_[iHLX], AvgOccSet2 );
489 MaxLHCSummary_->Fill( iEta_[iHLX], iPhi_[iHLX], MaxLHCBX );
490 MaxLHCSummary_->Fill( iEta_[iHLX] +7, iPhi_[iHLX], MaxLHCBX );
493 picName = outputDir_ + GetRunDir() + GetLSDir() +
"MaxLHCSummary." + plotExt_;
494 MaxLHCSummary_->GetZaxis()->SetRangeUser( 0, 3564 );
495 MaxLHCSummary_->Draw(
"colz");
496 c1_->SaveAs(picName.c_str());
498 picName = outputDir_ + GetRunDir() + GetLSDir() +
"OccSummary.png";
499 OccSummary_->GetZaxis()->SetRangeUser( MinOcc - 0.0000001, MaxOcc + 0.0000001 );
500 OccSummary_->Draw(
"colz");
501 c1_->SaveAs(picName.c_str());
503 fileStr <<
"<img src=\"OccSummary.png\" usemap=\"#HLXSummary\" border=\"0\" width=\"45%\"></br>" << std::endl;
504 fileStr <<
"<img src=\"MaxLHCSummary.png\" usemap=\"#HLXSummary\" border=\"0\" width=\"45%\"></br>" << std::endl;
507 fileStr <<
"<hr>" << std::endl;
508 fileStr <<
"<H2>" << std::endl;
509 fileStr <<
"HLX ID </br>" << std::endl;
510 fileStr <<
"<hr>" << std::endl;
511 fileStr <<
"</H2>" << std::endl;
512 fileStr <<
"<H3>" << std::endl;
513 fileStr <<
"<verbatim>" << std::endl;
515 for(
unsigned int iHLX = 0; iHLX < 36; ++iHLX){
516 fileStr <<
"<a href=\"HLX"
517 << std::setw(2) << std::setfill(
'0') << iHLX
520 <<
"</a> </br>" << std::endl;
523 fileStr <<
"</verbatim>" << std::endl;
524 fileStr <<
"</H3>" << std::endl;
527 unsigned int HFPlusLeftEdge = 532;
528 unsigned int HFPlusRightEdge = 625;
529 unsigned int HFMinusLeftEdge = 70;
530 unsigned int HFMinusRightEdge = 160;
532 unsigned int BoxTop = 47;
533 unsigned int BoxHeight = 20;
535 unsigned int HTMLMap_[] = { 5,4,3,2,1,0,
542 fileStr <<
"<map name='HLXSummary'>" << std::endl;
543 for(
unsigned int iBox = 0; iBox < 18; ++iBox ){
544 fileStr <<
"<area shape='rect' coords='" << HFMinusLeftEdge <<
"," << BoxTop + iBox*(BoxHeight + 1)
545 <<
"," << HFMinusRightEdge <<
"," << BoxTop + (iBox + 1)*(BoxHeight + 1) -1 <<
"' href='HLX"
546 << std::setw(2) << std::setfill(
'0') << HTMLMap_[iBox] <<
"/index.html' >" << std::endl;
548 fileStr <<
"<area shape='rect' coords='" << HFPlusLeftEdge <<
"," << BoxTop + iBox*(BoxHeight + 1)
549 <<
"," << HFPlusRightEdge <<
"," << BoxTop + (iBox + 1)*(BoxHeight + 1) -1 <<
"' href='HLX"
550 << std::setw(2) << std::setfill(
'0') << HTMLMap_[iBox + 18] <<
"/index.html' >" << std::endl;
553 fileStr <<
"</map>" << std::endl;
555 fileStr <<
"</body>" << std::endl;
556 fileStr <<
"</html>" << std::endl;
561 void HCAL_HLX::HTMLGenerator::GenerateHLXPage(
const unsigned short int &HLXID){
565 fileName.str(std::string());
566 fileName << outputDir_ << GetRunDir() << GetLSDir() << GetHLXDir(HLXID) <<
"index.html";
568 std::ofstream fileStr;
569 fileStr.open(fileName.str().c_str());
571 fileStr <<
"<html>" << std::endl;
572 fileStr <<
"<title>" << std::endl;
573 fileStr <<
"Luminosity File Reader - "
574 <<
"Run " << lumiSection_->hdr.runNumber
575 <<
" Lumi Section " << lumiSection_->hdr.sectionNumber
576 << HLXToHFMap_[HLXID]
578 fileStr <<
"</title>" << std::endl;
579 fileStr <<
"<body>" << std::endl;
581 fileStr <<
"<H1>" << std::endl;
582 fileStr <<
"Luminosity File Reader - "
583 <<
"Run " << lumiSection_->hdr.runNumber <<
" - "
584 <<
" Lumi Section " << lumiSection_->hdr.sectionNumber <<
" - "
585 << HLXToHFMap_[HLXID]
587 fileStr <<
"</H1>" << std::endl;
588 fileStr <<
"<hr>" << std::endl;
591 fileStr <<
"<a href=\"Pics/"<< HistoNames[0] <<
"." << plotExt_ <<
"\"><img src=\"Pics/"
592 << HistoNames[0] <<
"." << plotExt_ <<
"\" width=\"30%\"></a>" << std::endl;
596 fileStr <<
"<a href=\"Pics/"<< HistoNames[7] <<
"." << plotExt_ <<
"\"><img src=\"Pics/"
597 << HistoNames[7] <<
"." << plotExt_ <<
"\" width=\"30%\"></a></br>"<< std::endl;
600 fileStr <<
"<a href=\"Pics/"<< HistoNames[1] <<
"." << plotExt_ <<
"\"><img src=\"Pics/"
601 << HistoNames[1] <<
"." << plotExt_ <<
"\" width=\"30%\"></a>" << std::endl;
602 fileStr <<
"<a href=\"Pics/"<< HistoNames[2] <<
"." << plotExt_ <<
"\"><img src=\"Pics/"
603 << HistoNames[2] <<
"." << plotExt_ <<
"\" width=\"30%\"></a>" << std::endl;
604 fileStr <<
"<a href=\"Pics/"<< HistoNames[3] <<
"." << plotExt_ <<
"\"><img src=\"Pics/"
605 << HistoNames[3] <<
"." << plotExt_ <<
"\" width=\"30%\"></a></br>" << std::endl;
608 fileStr <<
"<a href=\"Pics/"<< HistoNames[4] <<
"." << plotExt_ <<
"\"><img src=\"Pics/"
609 << HistoNames[4] <<
"." << plotExt_ <<
"\" width=\"30%\"></a>" << std::endl;
610 fileStr <<
"<a href=\"Pics/"<< HistoNames[5] <<
"." << plotExt_ <<
"\"><img src=\"Pics/"
611 << HistoNames[5] <<
"." << plotExt_ <<
"\" width=\"30%\"></a>" << std::endl;
612 fileStr <<
"<a href=\"Pics/"<< HistoNames[6] <<
"." << plotExt_ <<
"\"><img src=\"Pics/"
613 << HistoNames[6] <<
"." << plotExt_ <<
"\" width=\"30%\"></a></br>"<< std::endl;
616 fileStr <<
"</body>" << std::endl;
617 fileStr <<
"</html>" << std::endl;
622 void HCAL_HLX::HTMLGenerator::GenerateHLXPlots(
const unsigned short int & HLXID){
624 for(
unsigned int iHisto = 0; iHisto < 8; ++iHisto ){
625 HLXHistos_[iHisto]->Reset();
626 std::stringstream HistoTitle;
627 HistoTitle.str(std::string());
628 HistoTitle << HistoNames[iHisto] <<
" - " << HLXToHFMap_[HLXID];
629 HLXHistos_[iHisto]->SetTitle(HistoTitle.str().c_str());
632 if( lumiSection_->hdr.numOrbits > 0 ){
634 double EtSumNoise[4];
642 for(
unsigned int iBX = 2750; iBX < 3250; ++iBX ){
643 EtSumNoise[iBX % 4] += lumiSection_->etSum[HLXID].data[iBX];
646 EtSumNoise[0] /= 125.0;
647 EtSumNoise[1] /= 125.0;
648 EtSumNoise[2] /= 125.0;
649 EtSumNoise[3] /= 125.0;
651 for(
unsigned int iBX = 0; iBX < 3564; ++iBX ){
653 HLXHistos_[0]->Fill( iBX, (lumiSection_->etSum[HLXID].data[iBX] - EtSumNoise[iBX % 4]) / (
float)(lumiSection_->hdr.numOrbits));
657 for(
unsigned int iBX = 0; iBX < 3564; ++iBX ){
658 HLXHistos_[7]->Fill( iBX, lumiSection_->lhc[HLXID].data[iBX]);
660 for(
unsigned int k = 0;
k < 6; ++
k){
661 HLXHistos_[
k+1]->Fill(iBX, ((
float)(lumiSection_->occupancy[HLXID].data[
k][iBX]) / (
float)(lumiSection_->hdr.numOrbits)));
667 const std::string HLXPicsDir = outputDir_ + GetRunDir() + GetLSDir() + GetHLXDir(HLXID) + GetHLXPicDir(HLXID);
674 HLXHistos_[0]->Draw();
675 std::string plotFileName = HLXPicsDir + HistoNames[0 ] +
"." + plotExt_;
676 c1_->SaveAs(plotFileName.c_str());
680 for(
unsigned int iHisto = 1; iHisto < 8; ++iHisto ){
681 HLXHistos_[iHisto]->Draw();
682 std::string plotFileName = HLXPicsDir + HistoNames[ iHisto ] +
"." + plotExt_;
683 c1_->SaveAs(plotFileName.c_str());
688 void HCAL_HLX::HTMLGenerator::GenerateComparePlots(){}
690 void HCAL_HLX::HTMLGenerator::GenerateComparePage(){}
692 void HCAL_HLX::HTMLGenerator::GenerateAveragePlots(){}
694 void HCAL_HLX::HTMLGenerator::GenerateAveragePage(){}
696 void HCAL_HLX::HTMLGenerator::GenerateHistoGroupPage(
const std::string &
HistoName){
701 pageDir = outputDir_ + GetRunDir() + GetLSDir() +
HistoName;
702 MakeDir(pageDir, writeMode_);
704 fileName = pageDir +
"/index.html";
706 std::ofstream fileStr;
707 fileStr.open(fileName.c_str());
709 fileStr <<
"<html>" << std::endl;
710 fileStr <<
"<title>" << std::endl;
711 fileStr <<
"Luminosity File Reader - "
712 <<
"Run " << lumiSection_->hdr.runNumber
713 <<
" Lumi Section " << lumiSection_->hdr.sectionNumber
714 <<
" - " << HistoName
716 fileStr <<
"</title>" << std::endl;
717 fileStr <<
"<body>" << std::endl;
719 fileStr <<
"<H1>" << std::endl;
720 fileStr <<
"Luminosity File Reader - "
721 <<
"Run " << lumiSection_->hdr.runNumber
722 <<
" Lumi Section " << lumiSection_->hdr.sectionNumber
723 <<
" - " << HistoName
725 fileStr <<
"</H1>" << std::endl;
726 fileStr <<
"<hr>" << std::endl;
728 for(
int HLXID = 0; HLXID < 36; HLXID++){
729 fileStr <<
"<a href=\"../HLX" << std::setw(2) << std::setfill(
'0') << HLXID
730 <<
"/Pics/" << HistoName <<
"." << plotExt_ <<
"\"><img src=\"../HLX"
731 << std::setw(2) << std::setfill(
'0') << HLXID <<
"/Pics/" << HistoName <<
"."
732 << plotExt_ <<
"\" width=\"15%\" ></a>" << std::endl;
734 fileStr <<
"</body>" << std::endl;
735 fileStr <<
"</html>" << std::endl;
739 void HCAL_HLX::HTMLGenerator::GenerateLumiPage(){
744 pageDir = outputDir_ + GetRunDir() + GetLSDir() +
"Luminosity/";
745 MakeDir(pageDir +
"/Pics" , writeMode_ );
747 fileName = pageDir +
"index.html";
749 std::ofstream fileStr;
751 fileStr.open(fileName.c_str());
753 fileStr <<
"<html>" << std::endl;
754 fileStr <<
"<title>" << std::endl;
755 fileStr <<
"Luminosity File Reader - "
756 <<
"Run " << lumiSection_->hdr.runNumber
757 <<
" Lumi Section " << lumiSection_->hdr.sectionNumber
760 fileStr <<
"</title>" << std::endl;
761 fileStr <<
"<body>" << std::endl;
763 fileStr <<
"<H1>" << std::endl;
764 fileStr <<
"Luminosity File Reader - "
765 <<
"Run " << lumiSection_->hdr.runNumber
766 <<
" Lumi Section " << lumiSection_->hdr.sectionNumber
769 fileStr <<
"</H1>" << std::endl;
770 fileStr <<
"<hr>" << std::endl;
772 fileStr <<
"<a href=\"Pics/EtSumLumi.png\"\"><img src=\"Pics/EtSumLumi.png\" width=\"30%\" ></a>" << std::endl;
773 fileStr <<
"<a href=\"Pics/OccLumiSet1.png\"\"><img src=\"Pics/OccLumiSet1.png\" width=\"30%\" ></a>" << std::endl;
774 fileStr <<
"<a href=\"Pics/OccLumiSet2.png\"\"><img src=\"Pics/OccLumiSet2.png\" width=\"30%\" ></a>" << std::endl;
781 for(
unsigned int iBX = 0; iBX < 3564; ++iBX ){
782 int Bin = (int)(iBX - XMin_)/BinWidth_ + 1;
783 if( Bin < 1 ) Bin = 0;
784 if( Bin > (
int)NBins_ ) Bin = NBins_ + 1;
786 ETLumiHisto_->
Fill(iBX, lumiSection_->lumiDetail.ETLumi[iBX]);
787 ETLumiHisto_-> SetBinError( Bin, lumiSection_->lumiDetail.ETLumiErr[iBX]);
788 OccLumiSet1Histo_->Fill(iBX, lumiSection_->lumiDetail.OccLumi[0][iBX]);
789 OccLumiSet1Histo_->SetBinError( Bin, lumiSection_->lumiDetail.OccLumiErr[0][iBX]);
790 OccLumiSet2Histo_->Fill(iBX, lumiSection_->lumiDetail.OccLumi[1][iBX]);
791 OccLumiSet2Histo_->SetBinError( Bin, lumiSection_->lumiDetail.OccLumiErr[1][iBX]);
794 ETLumiHisto_->Draw();
795 c1_->SaveAs( (pageDir +
"/Pics/EtSumLumi.png").c_str() );
797 OccLumiSet1Histo_->Draw();
798 c1_->SaveAs( (pageDir +
"/Pics/OccLumiSet1.png").c_str() );
800 OccLumiSet2Histo_->Draw();
801 c1_->SaveAs( (pageDir +
"/Pics/OccLumiSet2.png").c_str() );
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)