17 #include "TPolyLine.h" 40 jsfilename=
"CommonTools/TrackerMap/data/trackermap.txt";
41 infilename=
"CommonTools/TrackerMap/data/tracker.dat";
71 auto feds = tkFed->
fedIds();
72 std::cout<<
"SiStripFedCabling has "<< feds.size()<<
" active FEDS"<<std::endl;
75 for(std::vector<unsigned short>::const_iterator ifed = feds.begin();ifed<feds.end();ifed++){
78 for(
auto iconn = theconn.begin();iconn<theconn.end();iconn++){
89 int key = iconn->fedId()*1000+iconn->fedCh();
91 if(apvpair!=
nullptr)
std::cout <<
"Fed "<< iconn->fedId() <<
" channel " << iconn->fedCh() <<
" seem to be already loaded!"<<std::endl;
97 if(
fedMap[iconn->fedId()]==0){
fedMap[iconn->fedId()]=iconn->fedCrate();}
98 if(
slotMap[iconn->fedId()]==0){
slotMap[iconn->fedId()]=iconn->fedSlot();}
99 if(ncrates==0 || ncrates < iconn->fedCrate()) ncrates = iconn->fedCrate();
104 apvpair =
new TmApvPair(key,iconn->fedCrate());
106 apvpair->
mpos=iconn->apvPairNumber();
108 apvModuleMap.insert(std::make_pair(iconn->detId(),apvpair));
111 apvpair->
text=s.str();
118 std::map<int , TmModule *>::iterator i_mod;
122 std::ostringstream outs,outs1;
123 outs <<
" connected to ";
128 std::multimap<const int, TmApvPair*>::iterator
pos;
132 if(apvpair!=
nullptr){
134 outs1 << apvpair->
idex+apvpair->
crate*1000000<<
",";
139 outs<<
"("<<nchan<<
")";
141 std::string s = outs1.str(); s.erase(s.end()-1,s.end());
148 int nfec=0;
int nccu;
int nmod;
155 while(!Ccufile.eof()) {
156 Ccufile >> crate >> slot >> ring >> addr >> pos;
157 getline(Ccufile,dummys);
158 int key =crate*10000000+slot*100000+ring*1000+addr;
161 ccu =
new TmCcu(crate,slot,ring,addr);
167 for ( std::vector<SiStripFecCrate>::const_iterator icrate = fecCabling_->
crates().begin(); icrate != fecCabling_->
crates().end(); icrate++ ) {
168 for ( std::vector<SiStripFec>::const_iterator ifec = icrate->fecs().begin(); ifec != icrate->fecs().end(); ifec++ ) {
169 for ( std::vector<SiStripRing>::const_iterator iring = ifec->rings().begin(); iring != ifec->rings().end(); iring++ ) {
171 for ( std::vector<SiStripCcu>::const_iterator iccu = iring->ccus().begin(); iccu != iring->ccus().end(); iccu++ ) {
173 int key = icrate->fecCrate()*10000000+ifec->fecSlot()*100000+iring->fecRing()*1000+iccu->ccuAddr();
176 for ( std::vector<SiStripModule>::const_iterator imod = iccu->modules().begin(); imod != iccu->modules().end(); imod++ ) {
183 if(ccu==
nullptr)
std::cout <<key<<
" This ccu seems to have not been stored! " << std::endl;
else{ ccu->
nmod=nmod;ccu->
layer=layer;}
191 std::map<int , TmCcu *>::iterator i_ccu;
192 std::multimap<TmCcu*, TmModule*>::iterator it;
193 std::pair<std::multimap<TmCcu*, TmModule*>::iterator,std::multimap<TmCcu*, TmModule*>::iterator> ret;
195 for( i_ccu=
ccuMap.begin();i_ccu !=
ccuMap.end(); i_ccu++){
196 TmCcu * ccu= i_ccu->second;
199 std::ostringstream outs;
200 std::ostringstream outs1;
204 for (it = ret.first; it != ret.second; ++it)
206 outs << (*it).second->idex <<
" ";
207 outs1 << (*it).second->getKey() <<
",";
210 ccu->
text=outs.str();
230 int npsu=0;
int nmod,nmodHV2,nmodHV3;
232 int dcs,
branch,crate,board;
238 int rack_order[54]={0,1,0,2,0,3,0,
276 while(!LVfile.eof()) {
277 LVfile >> modId1 >> dcuId >> psIdinfo >> psinfo;
279 if(detCabling && detCabling->
getConnections(modId1).empty())
continue;
288 dcs= atoi(dcsinfo.c_str());
289 branch= atoi(branchinfo.c_str());
290 crate= atoi(crateinfo.c_str())+1;
291 board= atoi(boardinfo.c_str())+1;
292 rack = (branch+1)+(dcs-1)*6;
293 rack = rack_order[rack];
294 channel = atoi(channelinfo.c_str());
296 int key = rack*1000+crate*100+board;
301 psu =
new TmPsu(dcs,branch,rack,crate,board);
313 std::map<int , TmPsu *>::iterator ipsu;
314 std::multimap<TmPsu*, TmModule*>::iterator it;
315 std::pair<std::multimap<TmPsu*, TmModule*>::iterator,std::multimap<TmPsu*, TmModule*>::iterator> ret;
319 TmPsu * psu= ipsu->second;
324 std::ostringstream outs;
325 std::ostringstream outs1;
327 std::ostringstream outs3;
328 std::ostringstream outs4;
330 std::ostringstream outs5;
331 std::ostringstream outs6;
336 if(enableHVProcessing){
348 for (it = ret.first; it != ret.second; ++it)
351 outs << (*it).second->idex <<
", ";
352 outs1 << (*it).second->getKey() <<
",";
354 if(enableHVProcessing){
355 if((*it).second->HVchannel==2){
357 outs3 << (*it).second->idex <<
", ";
358 outs4 << (*it).second->getKey() <<
",";}
359 else if((*it).second->HVchannel==3){
361 outs5 << (*it).second->idex <<
", ";
362 outs6 << (*it).second->getKey() <<
",";}
369 outs <<
"(" << psu->
nmod <<
")";
370 psu->
text=outs.str();
372 if(enableHVProcessing){
377 outs3 <<
"(" << psu->
nmodHV2 <<
")";
378 outs5 <<
"(" << psu->
nmodHV3 <<
")";
397 jsfilename=
"CommonTools/TrackerMap/data/trackermap.txt";
398 infilename=
"CommonTools/TrackerMap/data/tracker.dat";
417 jsfilename=
"CommonTools/TrackerMap/data/trackermap.txt";
418 infilename=
"CommonTools/TrackerMap/data/tracker.dat";
422 jsPath=
"CommonTools/TrackerMap/data/";
433 std::map<int , TmModule *>::iterator i_mod;
458 for (
int subdet=1; subdet <
ndet+1; subdet++){
459 for (
int detpart=1; detpart <
npart+1; detpart++){
461 for(
int layer=1; layer < nlayers+1; layer++){
464 int layer_g =
nlayer(subdet,detpart,layer);
467 if(subdet==3 && detpart!=2)
firstRing[layer_g-1]= 8-nrings;
493 for (
int layer=1; layer < 44; layer++){
498 if(mod !=
nullptr )
delete mod;
508 std::map<int , TmApvPair *>::iterator i_apv;
509 for( i_apv=
apvMap.begin();i_apv !=
apvMap.end(); i_apv++){
515 std::map<int , TmCcu *>::iterator i_ccu;
516 for( i_ccu=
ccuMap.begin();i_ccu !=
ccuMap.end(); i_ccu++){
517 TmCcu * ccu= i_ccu->second;
521 std::map<int , TmPsu *>::iterator ipsu;
523 TmPsu * psu= ipsu->second;
542 double xp[4],yp[4],xp1,yp1;
543 double vhbot,vhtop,vhapo;
544 double rmedio[]={0.041,0.0701,0.0988,0.255,0.340,0.430,0.520,0.610,0.696,0.782,0.868,0.965,1.080};
545 double xt1,yt1,xs1=0.,ys1=0.,xt2,yt2,xs2,ys2,pv1,pv2;
561 if(mlay >12 && mlay <19){
563 xp[0]=r-vhtop;yp[0]=-vhapo;
564 xp[1]=r+vhtop;yp[1]=-vhapo;
565 xp[2]=r+vhtop;yp[2]=vhapo;
566 xp[3]=r-vhtop;yp[3]=vhapo;
569 xp[0]=r-vhapo;yp[0]=-vhbot;
570 xp[1]=r+vhapo;yp[1]=-vhtop;
571 xp[2]=r+vhapo;yp[2]=vhtop;
572 xp[3]=r-vhapo;yp[3]=vhbot;
574 for(
int j=0;j<4;j++){
575 xp1 = xp[j]*
cos(phi)-yp[j]*
sin(phi);
576 yp1 = xp[j]*
sin(phi)+yp[j]*
cos(phi);
577 xp[j] = xp1;yp[j]=yp1;
580 numod=mod->
idModule;
if(numod>100)numod=numod-100;
581 int vane = mod->
ring;
585 xt1=rmedio[mlay-31]; yt1=-vhtop/2.;
586 xs1 = xt1*
cos(phi)-yt1*
sin(phi);
587 ys1 = xt1*
sin(phi)+yt1*
cos(phi);
588 xt2=rmedio[mlay-31]; yt2=vhtop/2.;
589 xs2 = xt2*
cos(phi)-yt2*
sin(phi);
590 ys2 = xt2*
sin(phi)+yt2*
cos(phi);
593 if(mlay==31)dy1=0.39;
594 if(mlay==32)dy1=0.23;
595 if(mlay==33)dy1=0.16;
596 xp[0]=vane*(dx+dx/8.);yp[0]=numod*(dy1);
597 xp[1]=vane*(dx+dx/8.)+
dx;yp[1]=numod*(dy1);
598 xp[2]=vane*(dx+dx/8.)+
dx;yp[2]=numod*(dy1)+dy;
599 xp[3]=vane*(dx+dx/8.);yp[3]=numod*(dy1)+dy;
601 xt1=
r; yt1=-vhtop/2.;
602 xs1 = xt1*
cos(phi)-yt1*
sin(phi);
603 ys1 = xt1*
sin(phi)+yt1*
cos(phi);
605 xs2 = xt2*
cos(phi)-yt2*
sin(phi);
606 ys2 = xt2*
sin(phi)+yt2*
cos(phi);
609 if(fabs(pv1-pv2)>
M_PI && numod==1)pv1=pv1-2.*
M_PI;
610 if(fabs(pv1-pv2)>
M_PI && numod!=1)pv2=pv2+2.*
M_PI;
611 xp[0]=mod->
posz-vhapo/2.;yp[0]=4.2*pv1;
612 xp[1]=mod->
posz+vhapo/2.;yp[1]=4.2*pv1;
613 xp[2]=mod->
posz+vhapo/2. ;yp[2]=4.2*pv2;
614 xp[3]=mod->
posz-vhapo/2.;yp[3]=4.2*pv2;
620 if(mod->
idModule>100 ){
for(
int j=0;j<3;j++){
629 for(
int j=0;j<4;j++){
634 sprintf(buffer,
"%X",mod->
idex);
638 red=(color>>16)&0xFF;
639 green=(color>>8)&0xFF;
645 if(
temporary_file) *svgfile << red <<
" " << green <<
" " << blue <<
" ";
else 646 *svgfile <<
"<svg:polygon detid=\""<<mod->
idex<<
"\" count=\""<<mod->
count <<
"\" value=\""<<mod->
value<<
"\" id=\""<<key<<
"\" capvids=\""<<mod->
capvids<<
"\" lv=\""<<mod->
psuIdex<<
"\" hv=\""<<mod->
psuIdex*10 + mod->
HVchannel<<
"\" fec=\""<<mod->
CcuId<<
"\" onclick=\"showData(evt);\" onmouseover=\"showData(evt);\" onmouseout=\"showData(evt);\" MESSAGE=\""<<mod->
text<<
"\" POS=\""<<mod->
name<<
" \" fill=\"rgb("<<red<<
","<<green<<
","<<blue<<
")\" points=\"";
648 if(
temporary_file) *svgfile << 255 <<
" " << 255 <<
" " << 255 <<
" ";
else 649 *svgfile <<
"<svg:polygon detid=\""<<mod->
idex<<
"\" count=\""<<mod->
count <<
"\" value=\""<<mod->
value<<
"\" id=\""<<key<<
"\" capvids=\""<<mod->
capvids<<
"\" lv=\""<<mod->
psuIdex<<
"\" hv=\""<<mod->
psuIdex*10 + mod->
HVchannel<<
"\" fec=\""<<mod->
CcuId<<
"\" onclick=\"showData(evt);\" onmouseover=\"showData(evt);\" onmouseout=\"showData(evt);\" MESSAGE=\""<<mod->
text<<
"\" POS=\""<<mod->
name<<
" \" fill=\"white\" points=\"";
651 for(
int k=0;
k<
np;
k++){
653 *svgfile << xd[
k] <<
"," << yd[
k] <<
" " ;
655 if(
temporary_file)*svgfile << std::endl;
else *svgfile <<
"\" />" <<std::endl;
657 if(mod->
red>255)mod->
red=255;
661 *svgfile <<
"<svg:polygon detid=\""<<mod->
idex<<
"\" count=\""<<mod->
count <<
"\" value=\""<<mod->
value<<
"\" id=\""<<key<<
"\" capvids=\""<<mod->
capvids<<
"\" lv=\""<<mod->
psuIdex<<
"\" hv=\""<<mod->
psuIdex*10 + mod->
HVchannel<<
"\" fec=\""<<mod->
CcuId<<
"\" onclick=\"showData(evt);\" onmouseover=\"showData(evt);\" onmouseout=\"showData(evt);\" MESSAGE=\""<<mod->
text<<
"\" POS=\""<<mod->
name<<
" \" fill=\"rgb("<<mod->
red<<
","<<mod->
green<<
","<<mod->
blue<<
")\" points=\"";
663 for(
int k=0;
k<
np;
k++){
665 *svgfile << xd[
k] <<
"," << yd[
k] <<
" " ;
667 if(
temporary_file)*svgfile << std::endl;
else *svgfile <<
"\" />" <<std::endl;
679 for (
int layer=1; layer < 44; layer++){
692 return std::make_pair(minval,maxval);
702 bool rangefound =
true;
705 std::vector<TPolyLine*> vp;
707 size_t found=filetype.find_last_of(
".");
708 filetype=filetype.substr(found+1);
709 found=outputfilename.find_last_of(
".");
710 outputfilename=outputfilename.substr(0,found);
714 std::ostringstream outs;
716 outs << outputfilename <<
".coor";
719 for (
int layer=1; layer < 44; layer++){
724 if(mod !=
nullptr && !mod->
notInUse()){
736 for (
int layer=1; layer < 44; layer++){
752 *
savefile <<
"<?xml version=\"1.0\" standalone=\"no\" ?>"<<std::endl;
753 *
savefile <<
"<svg xmlns=\"http://www.w3.org/2000/svg\""<<std::endl;
754 *
savefile <<
"xmlns:svg=\"http://www.w3.org/2000/svg\" "<<std::endl;
755 *
savefile <<
"xmlns:xlink=\"http://www.w3.org/1999/xlink\">"<<std::endl;
756 *
savefile <<
"<svg:svg id=\"mainMap\" x=\"0\" y=\"0\" viewBox=\"0 0 3100 1600"<<
"\" width=\""<<width<<
"\" height=\""<<height<<
"\">"<<std::endl;
757 *
savefile <<
"<svg:rect fill=\"lightblue\" stroke=\"none\" x=\"0\" y=\"0\" width=\"3100\" height=\"1600\" /> "<<std::endl;
758 *
savefile <<
"<svg:g id=\"tracker\" transform=\"translate(10,1500) rotate(270)\" style=\"fill:none;stroke:black;stroke-width:0;\"> "<<std::endl;
760 for (
int layer=1; layer < 44; layer++){
767 if(mod !=
nullptr && !mod->
notInUse()){
776 *
savefile <<
" <svg:text id=\"Title\" class=\"normalText\" x=\"300\" y=\"0\">"<<
title<<
"</svg:text>"<<std::endl;
784 *
savefile <<
"</svg:svg>"<<std::endl;
789 const char * command1;
790 std::string tempfilename = outputfilename +
".coor";
793 command1=command.c_str();
794 std::cout <<
"Executing " << command1 << std::endl;
802 std::ifstream tempfile(tempfilename.c_str(),
std::ios::in);
803 TCanvas *MyC =
new TCanvas(
"MyC",
"TrackerMap",width,height);
804 gPad->SetFillColor(38);
808 else {gPad->Range(800,0,3800,1600);}
812 typedef std::map<int,int> ColorList;
814 ColorList::iterator
pos;
816 std::cout<<
"tempfilename "<<tempfilename<<std::endl;
817 while(!tempfile.eof()) {
818 tempfile >> red >> green >> blue >>
npoints;
819 colindex=red+green*1000+blue*1000000;
820 pos=colorList.find(colindex);
821 if(pos == colorList.end()){ colorList[colindex]=ncolor+100; col =gROOT->GetColor(ncolor+100);
822 if(col) col->SetRGB((Double_t)(red/255.),(Double_t)(green/255.),(Double_t)(blue/255.));
else c =
new TColor(ncolor+100,(Double_t)(red/255.),(Double_t)(green/255.),(Double_t)(blue/255.));
vc.push_back(c); ncolor++;}
824 tempfile >> x[
i] >> y[
i];
828 if(ncolor>0 && ncolor<10000){
830 for(
int i=0;
i<ncolor;
i++){colors[
i]=
i+100;}
831 gStyle->SetPalette(ncolor,colors);
835 tempfile.seekg(0,std::ios::beg);
836 std::cout <<
"created palette with " << ncolor <<
" colors" << std::endl;
838 while(!tempfile.eof()) {
839 tempfile >> red >> green >> blue >>
npoints;
841 tempfile >> x[
i] >> y[
i];
843 colindex=red+green*1000+blue*1000000;
844 pos=colorList.find(colindex);
845 if(pos != colorList.end()){
846 TPolyLine* pline =
new TPolyLine(npoints,y,x);
848 pline->SetFillColor(colorList[colindex]);
849 pline->SetLineWidth(0);
856 if(
onlyPixelFlag) {axis =
new TGaxis(-30,36,-30,1530,lminvalue,lmaxvalue,510,
"+L");}
857 else {axis =
new TGaxis(3660,36,3660,1530,lminvalue,lmaxvalue,510,
"+L");}
858 axis->SetLabelSize(0.02);
863 l.DrawLatex(950,1330,
"TID");
864 l.DrawLatex(2300,1330,
"TEC");
865 l.DrawLatex(300,1330,
"FPIX");
866 l.DrawLatex(20,560,
"BPIX L1");
867 l.DrawLatex(500,385,
"BPIX L2");
868 l.DrawLatex(500,945,
"BPIX L3");
871 if(
tkMapLog && (fulltitle.find(
"Log10 scale") == std::string::npos)) fulltitle +=
": Log10 scale";
873 else {l.DrawLatex(850,1500,fulltitle.c_str());}
875 else {l.DrawLatex(1730,40,
"-z");}
877 else {l.DrawLatex(1730,1360,
"+z");}
878 l.DrawLatex(1085,330,
"TIB L1");
879 l.DrawLatex(1085,1000,
"TIB L2");
880 l.DrawLatex(1585,330,
"TIB L3");
881 l.DrawLatex(1585,1000,
"TIB L4");
882 l.DrawLatex(2085,330,
"TOB L1");
883 l.DrawLatex(2085,1000,
"TOB L2");
884 l.DrawLatex(2585,330,
"TOB L3");
885 l.DrawLatex(2585,1000,
"TOB L4");
886 l.DrawLatex(3085,330,
"TOB L5");
887 l.DrawLatex(3085,1000,
"TOB L6");
888 TArrow arx(3448,1190,3448,1350,0.01,
"|>");
889 l.DrawLatex(3460,1350,
"x");
890 TArrow ary(3448,1190,3312,1190,0.01,
"|>");
891 l.DrawLatex(3312,1210,
"y");
892 TArrow arz(3485,373,3485,676,0.01,
"|>");
893 l.DrawLatex(3510,667,
"z");
894 TArrow arphi(3485,511,3037,511,0.01,
"|>");
895 l.DrawLatex(3023,520,
"#Phi");
899 arphi.SetLineWidth(3);
901 arx.SetX1(570);arx.SetX2(570);arx.SetY1(1190);arx.SetY2(1350);
902 l.DrawLatex(570+12,1190+160,
"x");
903 ary.SetX1(570);ary.SetX2(570-160);ary.SetY1(1190);ary.SetY2(1190);
904 l.DrawLatex(570-160,1190+30,
"y");
905 arz.SetX1(380);arz.SetX2(380);arz.SetY1(683-100);arz.SetY2(683+100);
906 l.DrawLatex(380+15,683+100-9,
"z");
907 arphi.SetX1(380);arphi.SetX2(380-390);arphi.SetY1(683);arphi.SetY2(683);
908 l.DrawLatex(380-390-14,683+9,
"#Phi");
924 std::cout <<
"printing " <<filename<< std::endl;
925 MyC->Print(filename.c_str());
929 MyC->Print(filename.c_str());
933 MyC->Print(filename.c_str());
936 command1=command.c_str();
937 std::cout <<
"Executing " << command1 << std::endl;
943 for(std::vector<TPolyLine*>::iterator pos1=vp.begin();pos1!=vp.end();pos1++){
959 double boxinitx=0., boxinity=0.;
972 xp[0]=boxinitx;yp[0]=boxinity;
973 xp[1]=boxinitx+
dx;yp[1]=boxinity;
974 xp[2]=boxinitx+
dx;yp[2]=boxinity +
dy;
975 xp[3]=boxinitx;yp[3]=boxinity +
dy;
976 for(
int j=0;j<4;j++){
982 sprintf(buffer,
"%X",apvPair->
mod->
idex);
984 s.erase(s.begin()+s.find(
"connected"),s.end());
987 if(apvPair->
red < 0){
988 if(apvPair->
count > 0) {
990 red=(color>>16)&0xFF;
991 green=(color>>8)&0xFF;
994 if(
temporary_file)*svgfile << red <<
" " << green <<
" " << blue <<
" ";
995 else *svgfile <<
"<svg:polygon detid=\""<<apvPair->
idex<<
"\" count=\""<<apvPair->
count <<
"\" value=\""<<apvPair->
value<<
"\" id=\""<<apvPair->
idex+crate*1000000<<
"\" cmodid=\""<<apvPair->
mod->
getKey()<<
"\" onclick=\"showData(evt);\" onmouseover=\"showData(evt);\" onmouseout=\"showData(evt);\" MESSAGE=\"""\" POS=\"Fed/Ch "<<apvPair->
getFedId()<<
"/"<<apvPair->
getFedCh()<<
" connected to "<<s<<
" Id "<<buffer<<
" \" fill=\"rgb("<<red<<
","<<green<<
","<<blue<<
")\" points=\"";
997 if(
temporary_file)*svgfile << 255 <<
" " << 255 <<
" " << 255 <<
" ";
998 else *svgfile <<
"<svg:polygon detid=\""<<apvPair->
idex<<
"\" count=\""<<apvPair->
count <<
"\" value=\""<<apvPair->
value<<
"\" id=\""<<apvPair->
idex+crate*1000000<<
"\" cmodid=\""<<apvPair->
mod->
getKey()<<
"\" onclick=\"showData(evt);\" onmouseover=\"showData(evt);\" onmouseout=\"showData(evt);\" MESSAGE=\"""\" POS=\"Fed/Ch "<<apvPair->
getFedId()<<
"/"<<apvPair->
getFedCh()<<
" connected to "<<s<<
" Id "<<buffer<<
" \" fill=\"white\" points=\"";
1001 if(apvPair->
red>255)apvPair->
red=255;
1003 if(apvPair->
blue>255)apvPair->
blue=255;
1005 else *svgfile <<
"<svg:polygon detid=\""<<apvPair->
idex<<
"\" count=\""<<apvPair->
count <<
"\" value=\""<<apvPair->
value<<
"\" id=\""<<apvPair->
idex+crate*1000000<<
"\" cmodid=\""<<apvPair->
mod->
getKey()<<
"\" onclick=\"showData(evt);\" onmouseover=\"showData(evt);\" onmouseout=\"showData(evt);\" MESSAGE=\"""\" POS=\"Fed/Ch "<<apvPair->
getFedId()<<
"/"<<apvPair->
getFedCh()<<
" connected to "<<s<<
" Id "<<buffer<<
" \" fill=\"rgb("<<apvPair->
red<<
","<<apvPair->
green<<
","<<apvPair->
blue<<
")\" points=\"";
1008 if(apvPair->
mod->
red < 0){
1011 red=(color>>16)&0xFF;
1012 green=(color>>8)&0xFF;
1014 if(
temporary_file)*svgfile << red <<
" " << green <<
" " << blue <<
" ";
1015 else *svgfile <<
"<svg:polygon detid=\""<<apvPair->
idex<<
"\" count=\""<<apvPair->
count <<
"\" value=\""<<apvPair->
value<<
"\" id=\""<<apvPair->
idex+crate*1000000<<
"\" cmodid=\""<<apvPair->
mod->
getKey()<<
"\" onclick=\"showData(evt);\" onmouseover=\"showData(evt);\" onmouseout=\"showData(evt);\" MESSAGE=\"""\" POS=\"Fed/Ch "<<apvPair->
getFedId()<<
"/"<<apvPair->
getFedCh()<<
" connected to "<<s<<
" Id "<<buffer<<
" \" fill=\"rgb("<<red<<
","<<green<<
","<<blue<<
")\" points=\"";
1017 if(
temporary_file)*svgfile << 255 <<
" " << 255 <<
" " << 255 <<
" ";
1018 else *svgfile <<
"<svg:polygon detid=\""<<apvPair->
idex<<
"\" count=\""<<apvPair->
count <<
"\" value=\""<<apvPair->
value<<
"\" id=\""<<apvPair->
idex+crate*1000000<<
"\" cmodid=\""<<apvPair->
mod->
getKey()<<
"\" onclick=\"showData(evt);\" onmouseover=\"showData(evt);\" onmouseout=\"showData(evt);\" MESSAGE=\"""\" POS=\"Fed/Ch "<<apvPair->
getFedId()<<
"/"<<apvPair->
getFedCh()<<
" connected to "<<s<<
" Id "<<buffer<<
" \" fill=\"white\" points=\"";
1025 else *svgfile <<
"<svg:polygon detid=\""<<apvPair->
idex<<
"\" count=\""<<apvPair->
count <<
"\" value=\""<<apvPair->
value<<
"\" id=\""<<apvPair->
idex+crate*1000000<<
"\" cmodid=\""<<apvPair->
mod->
getKey()<<
"\" onclick=\"showData(evt);\" onmouseover=\"showData(evt);\" onmouseout=\"showData(evt);\" MESSAGE=\"""\" POS=\"Fed/Ch "<<apvPair->
getFedId()<<
"/"<<apvPair->
getFedCh()<<
" connected to "<<s<<
" Id "<<buffer<<
" \" fill=\"rgb("<<apvPair->
mod->
red<<
","<<apvPair->
mod->
green<<
","<<apvPair->
mod->
blue<<
")\" points=\"";
1029 for(
int k=0;
k<
np;
k++){
1031 else *svgfile << xd[
k] <<
"," << yd[
k] <<
" " ;
1034 else *svgfile <<
"\" />" <<std::endl;
1045 double boxinitx=0., boxinity=0.;
1047 int numccu_incolumn = 8;
1048 int numccu_inrow = 15;
1049 int numfec_incolumn = 5;
1050 int numfec_inrow = 4;
1051 boxinitx=boxinitx+(numfec_incolumn-(numfec_incrate-1)/numfec_inrow)*14.;
1052 boxinity=boxinity+(numfec_inrow-(numfec_incrate-1)%numfec_inrow)*16.;
1053 boxinity=boxinity+numccu_inrow-ccu->
mpos;
1054 boxinitx = boxinitx+numccu_incolumn-(
int)(ccu->
getCcuRing()%numccu_incolumn);
1056 xp[0]=boxinitx;yp[0]=boxinity;
1057 xp[1]=boxinitx+
dx;yp[1]=boxinity;
1058 xp[2]=boxinitx+
dx;yp[2]=boxinity +
dy;
1059 xp[3]=boxinitx;yp[3]=boxinity +
dy;
1060 for(
int j=0;j<4;j++){
1066 sprintf(buffer,
"%X",ccu->
idex);
1070 s.erase(s.begin()+s.find(
"connected"),s.end());
1073 if(ccu->
count > 0) {
1075 red=(color>>16)&0xFF;
1076 green=(color>>8)&0xFF;
1079 if(
temporary_file)*svgfile << red <<
" " << green <<
" " << blue <<
" ";
1080 else *svgfile <<
"<svg:polygon detid=\""<<ccu->
idex<<
"\" count=\""<<ccu->
count <<
"\" value=\""<<ccu->
value<<
"\" id=\""<<ccu->
idex+crate*1000000<<
"\" cmodid=\""<<ccu->
cmodid<<
"\" layer=\""<<ccu->
layer<<
"\" onclick=\"showData(evt);\" onmouseover=\"showData(evt);\" onmouseout=\"showData(evt);\" MESSAGE=\"""\" POS=\"Slot/Ring"<<ccu->
getCcuSlot()<<
"/"<<ccu->
getCcuRing()<<
" connected to "<<s<<
" Id "<<buffer<<
" \" fill=\"rgb("<<red<<
","<<green<<
","<<blue<<
")\" points=\"";
1082 if(
temporary_file)*svgfile << 255 <<
" " << 255 <<
" " << 255 <<
" ";
1083 else *svgfile <<
"<svg:polygon detid=\""<<ccu->
idex<<
"\" count=\""<<ccu->
count <<
"\" value=\""<<ccu->
value<<
"\" id=\""<<ccu->
idex+crate*1000000<<
"\" cmodid=\""<<ccu->
cmodid<<
"\" layer=\""<<ccu->
layer<<
"\" onclick=\"showData(evt);\" onmouseover=\"showData(evt);\" onmouseout=\"showData(evt);\" MESSAGE=\"""\" POS=\"Slot/Ring "<<ccu->
getCcuSlot()<<
"/"<<ccu->
getCcuRing()<<
" connected to "<<s<<
" Id "<<buffer<<
" \" fill=\"white\" points=\"";
1086 if(ccu->
red>255)ccu->
red=255;
1090 else *svgfile <<
"<svg:polygon detid=\""<<ccu->
idex<<
"\" count=\""<<ccu->
count <<
"\" value=\""<<ccu->
value<<
"\" id=\""<<ccu->
idex+crate*1000000<<
"\" cmodid=\""<<ccu->
cmodid<<
"\" layer=\""<<ccu->
layer<<
"\" onclick=\"showData(evt);\" onmouseover=\"showData(evt);\" onmouseout=\"showData(evt);\" MESSAGE=\"""\" POS=\"Slot/Ring "<<ccu->
getCcuSlot()<<
"/"<<ccu->
getCcuRing()<<
" connected to "<<s<<
" Id "<<buffer<<
" \" fill=\"rgb("<<ccu->
red<<
","<<ccu->
green<<
","<<ccu->
blue<<
")\" points=\"";
1093 for(
int k=0;
k<
np;
k++){
1095 else *svgfile << xd[
k] <<
"," << yd[
k] <<
" " ;
1098 else *svgfile <<
"\" />" <<std::endl;
1110 double boxinitx=0., boxinity=0.;
1116 xp[0]=boxinitx;yp[0]=boxinity;
1117 xp[1]=boxinitx+
dx;yp[1]=boxinity;
1118 xp[2]=boxinitx+
dx;yp[2]=boxinity +
dy;
1119 xp[3]=boxinitx;yp[3]=boxinity +
dy;
1122 for(
int j=0;j<4;j++){
1139 sprintf(buffer,
"%X",psu->
idex);
1141 s.erase(s.begin()+s.find(
"connected"),s.end());
1146 red=(color>>16)&0xFF;
1147 green=(color>>8)&0xFF;
1150 if(
temporary_file)*svgfile << red <<
" " << green <<
" " << blue <<
" ";
1151 else *svgfile <<
"<svg:polygon detid=\""<<psu->
idex<<
"\" count=\""<<psu->
count <<
"\" value=\""<<psu->
value<<
"\" id=\""<< psu->
idex <<
"\" cmodid=\""<<psu->
cmodid_LV<<
"\" onclick=\"showData(evt);\" onmouseover=\"showData(evt);\" onmouseout=\"showData(evt);\" MESSAGE=\"""\" POS=\"easyCrate/easyBoard "<<psu->
getPsuCrate()<<
"/"<<psu->
getPsuBoard()<<
" connected to "<<s<<
" \" fill=\"rgb("<<red<<
","<<green<<
","<<blue<<
")\" points=\"";
1155 if(
temporary_file)*svgfile << 255 <<
" " << 255 <<
" " << 255 <<
" ";
1156 else *svgfile <<
"<svg:polygon detid=\""<<psu->
idex<<
"\" count=\""<<psu->
count <<
"\" value=\""<<psu->
value<<
"\" id=\""<< psu->
idex <<
"\" cmodid=\""<<psu->
cmodid_LV<<
"\" onclick=\"showData(evt);\" onmouseover=\"showData(evt);\" onmouseout=\"showData(evt);\" MESSAGE=\"""\" POS=\"easyCrate/easyBoard "<<psu->
getPsuCrate()<<
"/"<<psu->
getPsuBoard()<<
" connected to "<<s<<
" \" fill=\"white\" points=\"";
1161 if(psu->
red>255)psu->
red=255;
1165 else *svgfile <<
"<svg:polygon detid=\""<<psu->
idex<<
"\" count=\""<<psu->
count <<
"\" value=\""<<psu->
value<<
"\" id=\""<< psu->
idex <<
"\" cmodid=\""<<psu->
cmodid_LV<<
"\" onclick=\"showData(evt);\" onmouseover=\"showData(evt);\" onmouseout=\"showData(evt);\" MESSAGE=\"""\" POS=\"easyCrate/easyBoard "<<psu->
getPsuCrate()<<
"/"<<psu->
getPsuBoard()<<
" connected to "<<s<<
" \" fill=\"rgb("<<psu->
red<<
","<<psu->
green<<
","<<psu->
blue<<
")\" points=\"";
1169 for(
int k=0;
k<
np;
k++){
1171 else *svgfile << xd[
k] <<
"," << yd[
k] <<
" " ;
1174 else *svgfile <<
"\" />" <<std::endl;
1187 double boxinitx=35, boxinity=12;
1188 double dx=1.1,
dy=1.3;
1191 boxinity= boxinity+(18 - psu->
getPsuBoard())*1.75;
1193 xp[0]=boxinitx;yp[0]=boxinity;
1194 xp[1]=boxinitx+
dx;yp[1]=boxinity;
1195 xp[2]=boxinitx+
dx;yp[2]=boxinity +
dy;
1196 xp[3]=boxinitx;yp[3]=boxinity +
dy;
1199 for(
int j=0;j<4;j++){
1205 sprintf(buffer,
"%X",psu->
idex);
1207 s.erase(s.begin()+s.find(
"connected"),s.end());
1213 redHV2=(color>>16)&0xFF;
1214 greenHV2=(color>>8)&0xFF;
1215 blueHV2=(
color)&0xFF;
1217 if(
temporary_file)*svgfile << redHV2 <<
" " << greenHV2 <<
" " << blueHV2 <<
" ";
1218 else *svgfile <<
"<svg:polygon detid=\""<<psu->
idex<<
"\" count=\""<<psu->
countHV2 <<
"\" value=\""<<psu->
valueHV2<<
"\" id=\""<< psu->
idex*10+2 <<
"\" cmodid=\""<<psu->
cmodid_HV2<<
"\" onclick=\"showData(evt);\" onmouseover=\"showData(evt);\" onmouseout=\"showData(evt);\" MESSAGE=\"""\" POS=\"easyCrate/easyBoard "<<psu->
getPsuCrate()<<
"/"<<psu->
getPsuBoard()<<
" connected to "<<s<<
" \" fill=\"rgb("<<redHV2<<
","<<greenHV2<<
","<<blueHV2<<
")\" points=\"";
1221 if(
temporary_file)*svgfile << 255 <<
" " << 255 <<
" " << 255 <<
" ";
1222 else *svgfile <<
"<svg:polygon detid=\""<<psu->
idex<<
"\" count=\""<<psu->
countHV2 <<
"\" value=\""<<psu->
valueHV2<<
"\" id=\""<< psu->
idex*10+2 <<
"\" cmodid=\""<<psu->
cmodid_HV2<<
"\" onclick=\"showData(evt);\" onmouseover=\"showData(evt);\" onmouseout=\"showData(evt);\" MESSAGE=\"""\" POS=\"easyCrate/easyBoard "<<psu->
getPsuCrate()<<
"/"<<psu->
getPsuBoard()<<
" connected to "<<s<<
" \" fill=\"white\" points=\"";
1231 else *svgfile <<
"<svg:polygon detid=\""<<psu->
idex<<
"\" count=\""<<psu->
countHV2 <<
"\" value=\""<<psu->
valueHV2<<
"\" id=\""<< psu->
idex*10+2 <<
"\" cmodid=\""<<psu->
cmodid_HV2<<
"\" onclick=\"showData(evt);\" onmouseover=\"showData(evt);\" onmouseout=\"showData(evt);\" MESSAGE=\"""\" POS=\"easyCrate/easyBoard "<<psu->
getPsuCrate()<<
"/"<<psu->
getPsuBoard()<<
" connected to "<<s<<
" \" fill=\"rgb("<<psu->
redHV2<<
","<<psu->
greenHV2<<
","<<psu->
blueHV2<<
")\" points=\"";
1235 for(
int k=0;
k<
np;
k++){
1237 else *svgfile << xd[
k] <<
"," << yd[
k] <<
" " ;
1240 else *svgfile <<
"\" />" <<std::endl;
1254 double boxinitx=36.5, boxinity=12;
1255 double dx=1.1,
dy=1.3;
1258 boxinity= boxinity+(18 - psu->
getPsuBoard())*1.75;
1260 xp[0]=boxinitx;yp[0]=boxinity;
1261 xp[1]=boxinitx+
dx;yp[1]=boxinity;
1262 xp[2]=boxinitx+
dx;yp[2]=boxinity +
dy;
1263 xp[3]=boxinitx;yp[3]=boxinity +
dy;
1266 for(
int j=0;j<4;j++){
1272 sprintf(buffer,
"%X",psu->
idex);
1274 s.erase(s.begin()+s.find(
"connected"),s.end());
1279 redHV3=(color>>16)&0xFF;
1280 greenHV3=(color>>8)&0xFF;
1281 blueHV3=(
color)&0xFF;
1283 if(
temporary_file)*svgfile << redHV3 <<
" " << greenHV3 <<
" " << blueHV3 <<
" ";
1284 else *svgfile <<
"<svg:polygon detid=\""<<psu->
idex<<
"\" count=\""<<psu->
countHV3 <<
"\" value=\""<<psu->
valueHV3<<
"\" id=\""<< psu->
idex*10+3 <<
"\" cmodid=\""<<psu->
cmodid_HV3<<
"\" onclick=\"showData(evt);\" onmouseover=\"showData(evt);\" onmouseout=\"showData(evt);\" MESSAGE=\"""\" POS=\"easyCrate/easyBoard"<<psu->
getPsuCrate()<<
"/"<<psu->
getPsuBoard()<<
" connected to "<<s<<
" \" fill=\"rgb("<<redHV3<<
","<<greenHV3<<
","<<blueHV3<<
")\" points=\"";
1287 if(
temporary_file)*svgfile << 255 <<
" " << 255 <<
" " << 255 <<
" ";
1288 else *svgfile <<
"<svg:polygon detid=\""<<psu->
idex<<
"\" count=\""<<psu->
countHV3 <<
"\" value=\""<<psu->
valueHV3<<
"\" id=\""<< psu->
idex*10+3 <<
"\" cmodid=\""<<psu->
cmodid_HV3<<
"\" onclick=\"showData(evt);\" onmouseover=\"showData(evt);\" onmouseout=\"showData(evt);\" MESSAGE=\"""\" POS=\"easyCrate/easyBoard "<<psu->
getPsuCrate()<<
"/"<<psu->
getPsuBoard()<<
" connected to "<<s<<
" \" fill=\"white\" points=\"";
1297 else *svgfile <<
"<svg:polygon detid=\""<<psu->
idex<<
"\" count=\""<<psu->
countHV3 <<
"\" value=\""<<psu->
valueHV3<<
"\" id=\""<< psu->
idex*10+3 <<
"\" cmodid=\""<<psu->
cmodid_HV3<<
"\" onclick=\"showData(evt);\" onmouseover=\"showData(evt);\" onmouseout=\"showData(evt);\" MESSAGE=\"""\" POS=\"easyCrate/easyBoard "<<psu->
getPsuCrate()<<
"/"<<psu->
getPsuBoard()<<
" connected to "<<s<<
" \" fill=\"rgb("<<psu->
redHV3<<
","<<psu->
greenHV3<<
","<<psu->
blueHV3<<
")\" points=\"";
1301 for(
int k=0;
k<
np;
k++){
1303 else *svgfile << xd[
k] <<
"," << yd[
k] <<
" " ;
1306 else *svgfile <<
"\" />" <<std::endl;
1314 std::vector<TPolyLine*> vp;
1316 size_t found=filetype.find_last_of(
".");
1317 filetype=filetype.substr(found+1);
1318 found=outputfilename.find_last_of(
".");
1319 outputfilename=outputfilename.substr(0,found);
1322 std::ostringstream outs;
1324 outs << outputfilename <<
".coor";
1326 std::map<int , TmCcu *>::iterator i_ccu;
1327 std::multimap<TmCcu*, TmModule*>::iterator it;
1328 std::pair<std::multimap<TmCcu*, TmModule*>::iterator,std::multimap<TmCcu*, TmModule*>::iterator> ret;
1330 bool useCcuValue=
false;
1333 for( i_ccu=
ccuMap.begin();i_ccu !=
ccuMap.end(); i_ccu++){
1334 TmCcu * ccu= i_ccu->second;
1336 if(ccu->
count > 0 || ccu->
red!=-1) { useCcuValue=
true;
break;}
1342 for( i_ccu=
ccuMap.begin();i_ccu !=
ccuMap.end(); i_ccu++){
1343 TmCcu * ccu= i_ccu->second;
1346 for (it = ret.first; it != ret.second; ++it)
1348 if( (*it).second->count>0){ccu->
value=ccu->
value+(*it).second->value;ccu->
count++;}
1356 if(
title.find(
"QTestAlarm")!=std::string::npos){
1357 for( i_ccu=
ccuMap.begin();i_ccu !=
ccuMap.end(); i_ccu++){
1358 TmCcu * ccu= i_ccu->second;
1362 for (it = ret.first; it != ret.second; ++it) {
1363 if( !( (*it).second->red==0 && (*it).second->green==255 && (*it).second->blue==0 ) && !( (*it).second->red==255 && (*it).second->green==255 && (*it).second->blue==255 ) ){
1374 for( i_ccu=
ccuMap.begin();i_ccu !=
ccuMap.end(); i_ccu++){
1375 TmCcu * ccu= i_ccu->second;
1387 for( i_ccu=
ccuMap.begin();i_ccu !=
ccuMap.end(); i_ccu++){
1388 TmCcu * ccu= i_ccu->second;
1389 if(ccu!=
nullptr && ccu->
count>0) {
1398 if(filetype==
"svg"){
1400 std::ostringstream outs;
1401 outs << outputfilename<<
".svg";
1403 *
savefile <<
"<?xml version=\"1.0\" standalone=\"no\" ?>"<<std::endl;
1404 *
savefile <<
"<svg xmlns=\"http://www.w3.org/2000/svg\""<<std::endl;
1405 *
savefile <<
"xmlns:svg=\"http://www.w3.org/2000/svg\" "<<std::endl;
1406 *
savefile <<
"xmlns:xlink=\"http://www.w3.org/1999/xlink\">"<<std::endl;
1407 *
savefile <<
"<svg:svg id=\"mainMap\" x=\"0\" y=\"0\" viewBox=\"0 0 3000 1600"<<
"\" width=\""<<width<<
"\" height=\""<<height<<
"\">"<<std::endl;
1408 *
savefile <<
"<svg:rect fill=\"lightblue\" stroke=\"none\" x=\"0\" y=\"0\" width=\"3000\" height=\"1600\" /> "<<std::endl;
1409 *
savefile <<
"<svg:g id=\"fedtrackermap\" transform=\"translate(10,1500) rotate(270)\" style=\"fill:none;stroke:black;stroke-width:0;\"> "<<std::endl;
1411 for (
int crate=1; crate < (
nfeccrates+1); crate++){
1412 if(filetype==
"xml"){
1414 std::ostringstream outs;
1415 outs << outputfilename<<
"feccrate" <<crate<<
".xml";
1417 *
savefile <<
"<?xml version=\"1.0\" standalone=\"no\"?>"<<std::endl;
1418 *
savefile <<
"<svg xmlns=\"http://www.w3.org/2000/svg\""<<std::endl;
1419 *
savefile <<
"xmlns:svg=\"http://www.w3.org/2000/svg\""<<std::endl;
1420 *
savefile <<
"xmlns:xlink=\"http://www.w3.org/1999/xlink\" >"<<std::endl;
1421 *
savefile <<
"<script type=\"text/ecmascript\" xlink:href=\"feccrate.js\" />"<<std::endl;
1422 *
savefile <<
"<svg id=\"mainMap\" x=\"0\" y=\"0\" viewBox=\"0 0 500 500\" width=\"700\" height=\"700\" onload=\"TrackerCrate.init()\">"<<std::endl;
1423 *
savefile <<
"<rect fill=\"lightblue\" stroke=\"none\" x=\"0\" y=\"0\" width=\"700\" height=\"700\" />"<<std::endl;
1424 *
savefile <<
"<g id=\"crate\" transform=\" translate(280,580) rotate(270) scale(.7,.8)\" > "<<std::endl;
1429 for ( i_ccu=
ccuMap.begin();i_ccu !=
ccuMap.end(); i_ccu++){
1430 TmCcu * ccu= i_ccu->second;
1440 if(filetype==
"xml"){
1441 *
savefile <<
"</g> </svg> <text id=\"currentElementText\" x=\"40\" y=\"30\"> " << std::endl;
1442 *
savefile <<
"<tspan id=\"line1\" x=\"40\" y=\"30\"> </tspan> " << std::endl;
1443 *
savefile <<
"<tspan id=\"line2\" x=\"40\" y=\"60\"> </tspan> " << std::endl;
1444 *
savefile <<
" </text> </svg>" << std::endl;
1450 if(filetype==
"svg"){
1451 *
savefile <<
"</g> </svg> </svg> " << std::endl;
1454 if(!print_total && !useCcuValue){
1456 for( i_ccu=
ccuMap.begin();i_ccu !=
ccuMap.end(); i_ccu++){
1457 TmCcu * ccu= i_ccu->second;
1467 const char * command1;
1468 std::string tempfilename = outputfilename +
".coor";
1471 std::ifstream tempfile(tempfilename.c_str(),
std::ios::in);
1472 TCanvas *MyC =
new TCanvas(
"MyC",
"TrackerMap",width,height);
1473 gPad->SetFillColor(38);
1475 if(
saveWebInterface)gPad->Range(0,0,3700,1600);
else gPad->Range(0,0,3800,1600);
1479 typedef std::map<int,int> ColorList;
1480 ColorList colorList;
1481 ColorList::iterator
pos;
1483 while(!tempfile.eof()) {
1484 tempfile >> red >> green >> blue >>
npoints;
1485 colindex=red+green*1000+blue*1000000;
1486 pos=colorList.find(colindex);
1487 if(pos == colorList.end()){
1488 colorList[colindex]=ncolor+100;
1489 col =gROOT->GetColor(ncolor+100);
1491 col->SetRGB((Double_t)(red/255.),(Double_t)(green/255.),(Double_t)(blue/255.));
1493 c =
new TColor(ncolor+100,(Double_t)(red/255.),(Double_t)(green/255.),(Double_t)(blue/255.));
1499 tempfile >> x[
i] >> y[
i];
1502 if(ncolor>0 && ncolor<10000){
1504 for(
int i=0;
i<ncolor;
i++){colors[
i]=
i+100;}
1505 gStyle->SetPalette(ncolor,colors);
1508 tempfile.seekg(0,std::ios::beg);
1509 std::cout <<
"created palette with " << ncolor <<
" colors" << std::endl;
1510 while(!tempfile.eof()) {
1511 tempfile >> red >> green >> blue >>
npoints;
1513 tempfile >> x[
i] >> y[
i];
1515 colindex=red+green*1000+blue*1000000;
1516 pos=colorList.find(colindex);
1517 if(pos != colorList.end()){
1518 TPolyLine* pline =
new TPolyLine(npoints,y,x);
1519 vp.push_back(pline);
1520 pline->SetFillColor(colorList[colindex]);
1521 pline->SetLineWidth(0);
1528 axis =
new TGaxis(3660,36,3660,1530,lminvalue,lmaxvalue,510,
"+L");
1529 axis->SetLabelSize(0.02);
1535 l.SetTextSize(0.05);
1537 if(
tkMapLog && (fulltitle.find(
"Log10 scale") == std::string::npos)) fulltitle +=
": Log10 scale";
1538 l.DrawLatex(50,1530,fulltitle.c_str());
1541 std::cout <<
"Filetype " << filetype << std::endl;
1542 if(filetype==
"png"){
1544 MyC->Print(filename.c_str());
1546 if(filetype==
"jpg"){
1548 MyC->Print(filename.c_str());
1550 if(filetype==
"pdf"){
1552 MyC->Print(filename.c_str());
1555 command1=command.c_str();
1556 std::cout <<
"Executing " << command1 << std::endl;
1561 for(std::vector<TPolyLine*>::iterator pos1=vp.begin();pos1!=vp.end();pos1++){
1574 std::vector<TPolyLine*> vp;
1576 size_t found=filetype.find_last_of(
".");
1577 filetype=filetype.substr(found+1);
1578 found=outputfilename.find_last_of(
".");
1579 outputfilename=outputfilename.substr(0,found);
1586 std::ostringstream outs;
1588 outs << outputfilename <<
".coor";
1591 std::map<int , TmPsu *>::iterator ipsu;
1592 std::multimap<TmPsu*, TmModule*>::iterator it;
1593 std::pair<std::multimap<TmPsu*, TmModule*>::iterator,std::multimap<TmPsu*, TmModule*>::iterator> ret;
1596 bool usePsuValue=
false;
1599 TmPsu* psu= ipsu->second;
1608 TmPsu * psu= ipsu->second;
1611 int nconn1=0;
int nconn2=0;
1612 for(it = ret.first; it != ret.second; ++it){
1613 if((*it).second->HVchannel==2&&(*it).second->count>0){ nconn1++;psu->
valueHV2=psu->
valueHV2+(*it).second->value;}
1614 if((*it).second->HVchannel==3&&(*it).second->count>0){ nconn2++;psu->
valueHV3=psu->
valueHV3+(*it).second->value;}
1624 if(
title.find(
"QTestAlarm")!=std::string::npos){
1626 TmPsu * psu= ipsu->second;
1631 for (it = ret.first; it != ret.second; ++it) {
1632 if((*it).second->HVchannel==2){
1633 if( !( (*it).second->red==0 && (*it).second->green==255 && (*it).second->blue==0 ) && !( (*it).second->red==255 && (*it).second->green==255 && (*it).second->blue==255 ) ){
1637 if((*it).second->HVchannel==3){
1638 if( !( (*it).second->red==0 && (*it).second->green==255 && (*it).second->blue==0 ) && !( (*it).second->red==255 && (*it).second->green==255 && (*it).second->blue==255 ) ){
1649 TmPsu * psu= ipsu->second;
1665 TmPsu * psu= ipsu->second;
1676 if(filetype==
"svg"){
1678 std::ostringstream outs;
1679 outs << outputfilename<<
".svg";
1681 *
savefile <<
"<?xml version=\"1.0\" standalone=\"no\" ?>"<<std::endl;
1682 *
savefile <<
"<svg xmlns=\"http://www.w3.org/2000/svg\""<<std::endl;
1683 *
savefile <<
"xmlns:svg=\"http://www.w3.org/2000/svg\" "<<std::endl;
1684 *
savefile <<
"xmlns:xlink=\"http://www.w3.org/1999/xlink\">"<<std::endl;
1685 *
savefile <<
"<svg:svg id=\"mainMap\" x=\"0\" y=\"0\" viewBox=\"0 0 3000 1600"<<
"\" width=\""<<width<<
"\" height=\""<<height<<
"\">"<<std::endl;
1686 *
savefile <<
"<svg:rect fill=\"lightblue\" stroke=\"none\" x=\"0\" y=\"0\" width=\"3000\" height=\"1600\" /> "<<std::endl;
1687 *
savefile <<
"<svg:g id=\"HVtrackermap\" transform=\"translate(10,1500) rotate(270)\" style=\"fill:none;stroke:black;stroke-width:0;\"> "<<std::endl;
1690 for (
int irack=1; irack < (
npsuracks+1); irack++){
1691 if(filetype==
"xml"){
1693 std::ostringstream outs;
1694 outs << outputfilename<<
"HVrack" <<irack<<
".xml";
1696 *
savefile <<
"<?xml version=\"1.0\" standalone=\"no\"?>"<<std::endl;
1697 *
savefile <<
"<svg xmlns=\"http://www.w3.org/2000/svg\""<<std::endl;
1698 *
savefile <<
"xmlns:svg=\"http://www.w3.org/2000/svg\""<<std::endl;
1699 *
savefile <<
"xmlns:xlink=\"http://www.w3.org/1999/xlink\" >"<<std::endl;
1700 *
savefile <<
"<script type=\"text/ecmascript\" xlink:href=\"rackhv.js\" />"<<std::endl;
1701 *
savefile <<
"<svg id=\"mainMap\" x=\"0\" y=\"0\" viewBox=\"0 0 500 500\" width=\"700\" height=\"700\" onload=\"TrackerRackhv.init()\">"<<std::endl;
1702 *
savefile <<
"<rect fill=\"lightblue\" stroke=\"none\" x=\"0\" y=\"0\" width=\"700\" height=\"700\" />"<<std::endl;
1703 *
savefile <<
"<g id=\"rackhv\" transform=\" translate(150,500) rotate(270) scale(1.,1.)\" > "<<std::endl;
1708 for ( ipsu=
psuMap.begin();ipsu !=
psuMap.end(); ipsu++){
1709 TmPsu * psu= ipsu->second;
1712 drawHV3(irack,psu->getPsuCrate(),print_total,psu,
savefile,usePsuValue);
1718 if(filetype==
"xml"){
1719 *
savefile <<
"</g> </svg> <text id=\"currentElementText\" x=\"40\" y=\"30\"> " << std::endl;
1720 *
savefile <<
"<tspan id=\"line1\" x=\"40\" y=\"30\"> </tspan> " << std::endl;
1721 *
savefile <<
"<tspan id=\"line2\" x=\"40\" y=\"60\"> </tspan> " << std::endl;
1722 *
savefile <<
" </text> </svg>" << std::endl;
1728 if(filetype==
"svg"){
1729 *
savefile <<
"</g> </svg> </svg> " << std::endl;
1734 if(!print_total && !usePsuValue){
1736 TmPsu *psu = ipsu->second;
1749 const char * command1;
1750 std::string tempfilename = outputfilename +
".coor";
1753 std::ifstream tempfile(tempfilename.c_str(),
std::ios::in);
1754 TCanvas *MyC =
new TCanvas(
"MyC",
"TrackerMap",width,height);
1755 gPad->SetFillColor(38);
1757 if(
saveWebInterface)gPad->Range(0,0,3700,1600);
else gPad->Range(0,0,3800,1600);
1761 typedef std::map<int,int> ColorList;
1762 ColorList colorList;
1763 ColorList::iterator
pos;
1765 while(!tempfile.eof()) {
1766 tempfile >> red >> green >> blue >>
npoints;
1767 colindex=red+green*1000+blue*1000000;
1768 pos=colorList.find(colindex);
1769 if(pos == colorList.end()){
1770 colorList[colindex]=ncolor+100;
1771 col =gROOT->GetColor(ncolor+100);
1773 col->SetRGB((Double_t)(red/255.),(Double_t)(green/255.),(Double_t)(blue/255.));
1775 c =
new TColor(ncolor+100,(Double_t)(red/255.),(Double_t)(green/255.),(Double_t)(blue/255.));
1781 tempfile >> x[
i] >> y[
i];
1784 if(ncolor>0 && ncolor<10000){
1786 for(
int i=0;
i<ncolor;
i++){colors[
i]=
i+100;}
1787 gStyle->SetPalette(ncolor,colors);
1790 tempfile.seekg(0,std::ios::beg);
1791 std::cout <<
"created palette with " << ncolor <<
" colors" << std::endl;
1792 while(!tempfile.eof()) {
1793 tempfile >> red >> green >> blue >>
npoints;
1795 tempfile >> x[
i] >> y[
i];
1797 colindex=red+green*1000+blue*1000000;
1798 pos=colorList.find(colindex);
1799 if(pos != colorList.end()){
1800 TPolyLine* pline =
new TPolyLine(npoints,y,x);
1801 vp.push_back(pline);
1802 pline->SetFillColor(colorList[colindex]);
1803 pline->SetLineWidth(0);
1810 axis =
new TGaxis(3660,36,3660,1530,lminvalue,lmaxvalue,510,
"+L");
1811 axis->SetLabelSize(0.02);
1818 l.SetTextSize(0.05);
1820 if(
tkMapLog && (fulltitle.find(
"Log10 scale") == std::string::npos)) fulltitle +=
": Log10 scale";
1821 l.DrawLatex(50,1530,fulltitle.c_str());
1824 std::cout <<
"Filetype " << filetype << std::endl;
1825 if(filetype==
"png"){
1827 MyC->Print(filename.c_str());
1829 if(filetype==
"jpg"){
1831 MyC->Print(filename.c_str());
1833 if(filetype==
"pdf"){
1835 MyC->Print(filename.c_str());
1838 command1=command.c_str();
1839 std::cout <<
"Executing " << command1 << std::endl;
1844 for(std::vector<TPolyLine*>::iterator pos1=vp.begin();pos1!=vp.end();pos1++){
1858 bool rangefound=
true;
1860 std::vector<TPolyLine*> vp;
1863 size_t found=filetype.find_last_of(
".");
1864 filetype=filetype.substr(found+1);
1865 found=outputfilename.find_last_of(
".");
1866 outputfilename=outputfilename.substr(0,found);
1874 std::ostringstream outs;
1876 outs << outputfilename <<
".coor";
1879 std::map<int , TmPsu *>::iterator ipsu;
1880 std::multimap<TmPsu*, TmModule*>::iterator it;
1881 std::pair<std::multimap<TmPsu*, TmModule*>::iterator,std::multimap<TmPsu*, TmModule*>::iterator> ret;
1884 bool usePsuValue=
false;
1887 TmPsu* psu= ipsu->second;
1889 if(psu->
count > 0 || psu->
red!=-1) { usePsuValue=
true;
break;}
1895 TmPsu * psu= ipsu->second;
1899 for(it = ret.first; it != ret.second; ++it){
1900 if((*it).second->count>0){nconn++;psu->
value=psu->
value+(*it).second->value;}
1909 if(
title.find(
"QTestAlarm")!=std::string::npos){
1911 TmPsu * psu= ipsu->second;
1917 for (it = ret.first; it != ret.second; ++it) {
1918 if( !( (*it).second->red==0 && (*it).second->green==255 && (*it).second->blue==0 ) && !( (*it).second->red==255 && (*it).second->green==255 && (*it).second->blue==255 ) ){
1919 nconn++;psu->
value++;
1931 TmPsu * psu= ipsu->second;
1945 TmPsu * psu= ipsu->second;
1946 if(psu!=
nullptr && psu->
count>0) {
1956 if(filetype==
"svg"){
1958 std::ostringstream outs;
1959 outs << outputfilename<<
".svg";
1961 *
savefile <<
"<?xml version=\"1.0\" standalone=\"no\" ?>"<<std::endl;
1962 *
savefile <<
"<svg xmlns=\"http://www.w3.org/2000/svg\""<<std::endl;
1963 *
savefile <<
"xmlns:svg=\"http://www.w3.org/2000/svg\" "<<std::endl;
1964 *
savefile <<
"xmlns:xlink=\"http://www.w3.org/1999/xlink\">"<<std::endl;
1965 *
savefile <<
"<svg:svg id=\"mainMap\" x=\"0\" y=\"0\" viewBox=\"0 0 3000 1600"<<
"\" width=\""<<width<<
"\" height=\""<<height<<
"\">"<<std::endl;
1966 *
savefile <<
"<svg:rect fill=\"lightblue\" stroke=\"none\" x=\"0\" y=\"0\" width=\"3000\" height=\"1600\" /> "<<std::endl;
1967 *
savefile <<
"<svg:g id=\"psutrackermap\" transform=\"translate(10,1500) rotate(270)\" style=\"fill:none;stroke:black;stroke-width:0;\"> "<<std::endl;
1970 for (
int irack=1; irack < (
npsuracks+1); irack++){
1971 if(filetype==
"xml"){
1973 std::ostringstream outs;
1974 outs << outputfilename<<
"psurack" <<irack<<
".xml";
1976 *
savefile <<
"<?xml version=\"1.0\" standalone=\"no\"?>"<<std::endl;
1977 *
savefile <<
"<svg xmlns=\"http://www.w3.org/2000/svg\""<<std::endl;
1978 *
savefile <<
"xmlns:svg=\"http://www.w3.org/2000/svg\""<<std::endl;
1979 *
savefile <<
"xmlns:xlink=\"http://www.w3.org/1999/xlink\" >"<<std::endl;
1980 *
savefile <<
"<script type=\"text/ecmascript\" xlink:href=\"rack.js\" />"<<std::endl;
1981 *
savefile <<
"<svg id=\"mainMap\" x=\"0\" y=\"0\" viewBox=\"0 0 500 500\" width=\"700\" height=\"700\" onload=\"TrackerCrate.init()\">"<<std::endl;
1982 *
savefile <<
"<rect fill=\"lightblue\" stroke=\"none\" x=\"0\" y=\"0\" width=\"700\" height=\"700\" />"<<std::endl;
1983 *
savefile <<
"<g id=\"rack\" transform=\" translate(150,500) rotate(270) scale(1.,1.)\" > "<<std::endl;
1989 for ( ipsu=
psuMap.begin();ipsu !=
psuMap.end(); ipsu++){
1990 TmPsu * psu= ipsu->second;
1999 if(filetype==
"xml"){
2000 *
savefile <<
"</g> </svg> <text id=\"currentElementText\" x=\"40\" y=\"30\"> " << std::endl;
2001 *
savefile <<
"<tspan id=\"line1\" x=\"40\" y=\"30\"> </tspan> " << std::endl;
2002 *
savefile <<
"<tspan id=\"line2\" x=\"40\" y=\"60\"> </tspan> " << std::endl;
2003 *
savefile <<
" </text> </svg>" << std::endl;
2009 if(filetype==
"svg"){
2010 *
savefile <<
"</g> </svg> </svg> " << std::endl;
2015 if(!print_total && !usePsuValue){
2017 TmPsu *psu = ipsu->second;
2032 const char * command1;
2033 std::string tempfilename = outputfilename +
".coor";
2036 std::ifstream tempfile(tempfilename.c_str(),
std::ios::in);
2037 TCanvas *MyC =
new TCanvas(
"MyC",
"TrackerMap",width,height);
2038 gPad->SetFillColor(38);
2041 std::cout <<
" range x " << rangex << std::endl;
2042 std::cout <<
" range y " << rangey << std::endl;
2043 gPad->Range(0,0,rangex,rangey);
2047 typedef std::map<int,int> ColorList;
2048 ColorList colorList;
2049 ColorList::iterator
pos;
2051 while(!tempfile.eof()) {
2052 tempfile >> red >> green >> blue >>
npoints;
2053 colindex=red+green*1000+blue*1000000;
2054 pos=colorList.find(colindex);
2055 if(pos == colorList.end()){
2056 colorList[colindex]=ncolor+100;
2057 col =gROOT->GetColor(ncolor+100);
2059 col->SetRGB((Double_t)(red/255.),(Double_t)(green/255.),(Double_t)(blue/255.));
2061 c =
new TColor(ncolor+100,(Double_t)(red/255.),(Double_t)(green/255.),(Double_t)(blue/255.));
2066 tempfile >> x[
i] >> y[
i];
2069 if(ncolor>0 && ncolor<10000){
2071 for(
int i=0;
i<ncolor;
i++){colors[
i]=
i+100;}
2072 gStyle->SetPalette(ncolor,colors);
2075 tempfile.seekg(0,std::ios::beg);
2076 std::cout <<
"created palette with " << ncolor <<
" colors" << std::endl;
2077 while(!tempfile.eof()) {
2078 tempfile >> red >> green >> blue >>
npoints;
2080 tempfile >> x[
i] >> y[
i];
2082 colindex=red+green*1000+blue*1000000;
2083 pos=colorList.find(colindex);
2084 if(pos != colorList.end()){
2085 TPolyLine* pline =
new TPolyLine(npoints,y,x);
2086 vp.push_back(pline);
2087 pline->SetFillColor(colorList[colindex]);
2088 pline->SetLineWidth(0);
2095 axis =
new TGaxis(rangex-140,34,rangex-140,rangey-106,lminvalue,lmaxvalue,510,
"+L");
2096 axis->SetLabelSize(0.02);
2102 l.SetTextSize(0.05);
2104 if(
tkMapLog && (fulltitle.find(
"Log10 scale") == std::string::npos)) fulltitle +=
": Log10 scale";
2105 l.DrawLatex(50,rangey-200,fulltitle.c_str());
2108 std::cout <<
"Filetype " << filetype << std::endl;
2109 if(filetype==
"png"){
2111 MyC->Print(filename.c_str());
2113 if(filetype==
"jpg"){
2115 MyC->Print(filename.c_str());
2117 if(filetype==
"pdf"){
2119 MyC->Print(filename.c_str());
2122 command1=command.c_str();
2123 std::cout <<
"Executing " << command1 << std::endl;
2128 for(std::vector<TPolyLine*>::iterator pos1=vp.begin();pos1!=vp.end();pos1++){
2138 bool rangefound =
true;
2140 std::vector<TPolyLine*> vp;
2143 size_t found=filetype.find_last_of(
".");
2144 filetype=filetype.substr(found+1);
2145 found=outputfilename.find_last_of(
".");
2146 outputfilename=outputfilename.substr(0,found);
2150 std::ostringstream outs;
2152 outs << outputfilename <<
".coor";
2154 std::map<int , TmApvPair *>::iterator i_apv;
2155 std::map<int , int>::iterator i_fed;
2157 bool useApvPairValue=
false;
2158 for( i_apv=
apvMap.begin();i_apv !=
apvMap.end(); i_apv++){
2160 if(apvPair!=
nullptr) {
2162 if(apv_mod !=
nullptr && !apv_mod->
notInUse()){
2163 if(apvPair->
count > 0 || apvPair->
red!=-1) { useApvPairValue=
true;
break;}
2168 for( i_apv=
apvMap.begin();i_apv !=
apvMap.end(); i_apv++){
2170 if(apvPair!=
nullptr) {
2172 if(apv_mod !=
nullptr && !apv_mod->
notInUse() ){
2184 for(i_apv=
apvMap.begin();i_apv !=
apvMap.end(); i_apv++){
2186 if(apvPair!=
nullptr ) {
2188 if( apv_mod !=
nullptr && !apv_mod->
notInUse() ){
2189 if(useApvPairValue){
2194 if(apv_mod->
count>0){
2205 if(filetype==
"svg"){
2207 std::ostringstream outs;
2208 outs << outputfilename<<
".svg";
2210 *
savefile <<
"<?xml version=\"1.0\" standalone=\"no\" ?>"<<std::endl;
2211 *
savefile <<
"<svg xmlns=\"http://www.w3.org/2000/svg\""<<std::endl;
2212 *
savefile <<
"xmlns:svg=\"http://www.w3.org/2000/svg\" "<<std::endl;
2213 *
savefile <<
"xmlns:xlink=\"http://www.w3.org/1999/xlink\">"<<std::endl;
2214 *
savefile <<
"<svg:svg id=\"mainMap\" x=\"0\" y=\"0\" viewBox=\"0 0 3000 1600"<<
"\" width=\""<<width<<
"\" height=\""<<height<<
"\">"<<std::endl;
2215 *
savefile <<
"<svg:rect fill=\"lightblue\" stroke=\"none\" x=\"0\" y=\"0\" width=\"3000\" height=\"1600\" /> "<<std::endl;
2216 *
savefile <<
"<svg:g id=\"fedtrackermap\" transform=\"translate(10,1500) rotate(270)\" style=\"fill:none;stroke:black;stroke-width:0;\"> "<<std::endl;
2219 if(filetype==
"xml"){
2221 std::ostringstream outs;
2222 outs << outputfilename<<
"crate" <<crate<<
".xml";
2224 *
savefile <<
"<?xml version=\"1.0\" standalone=\"no\"?>"<<std::endl;
2225 *
savefile <<
"<svg xmlns=\"http://www.w3.org/2000/svg\""<<std::endl;
2226 *
savefile <<
"xmlns:svg=\"http://www.w3.org/2000/svg\""<<std::endl;
2227 *
savefile <<
"xmlns:xlink=\"http://www.w3.org/1999/xlink\" >"<<std::endl;
2228 *
savefile <<
"<script type=\"text/ecmascript\" xlink:href=\"crate.js\" />"<<std::endl;
2229 *
savefile <<
"<svg id=\"mainMap\" x=\"0\" y=\"0\" viewBox=\"0 0 500 500\" width=\"700\" height=\"700\" onload=\"TrackerCrate.init()\">"<<std::endl;
2230 *
savefile <<
"<rect fill=\"lightblue\" stroke=\"none\" x=\"0\" y=\"0\" width=\"700\" height=\"700\" />"<<std::endl;
2231 *
savefile <<
"<g id=\"crate\" transform=\" translate(150,500) rotate(270) scale(1.,1.)\" > "<<std::endl;
2235 int numfed_incrate=0;
2236 for (i_fed=
fedMap.begin();i_fed !=
fedMap.end(); i_fed++){
2237 if(i_fed->second == crate){
2238 int fedId = i_fed->first;
2256 for (
int nconn=0;nconn<96;nconn++){
2257 int key = fedId*1000+nconn;
2259 if(apvPair !=
nullptr){
2261 if(apv_mod !=
nullptr && !apv_mod->
notInUse()){
2269 if(filetype==
"xml"){
2270 *
savefile <<
"</g> </svg> <text id=\"currentElementText\" x=\"40\" y=\"30\"> " << std::endl;
2271 *
savefile <<
"<tspan id=\"line1\" x=\"40\" y=\"30\"> </tspan> " << std::endl;
2272 *
savefile <<
"<tspan id=\"line2\" x=\"40\" y=\"60\"> </tspan> " << std::endl;
2273 *
savefile <<
" </text> </svg>" << std::endl;
2279 if(filetype==
"svg"){
2280 *
savefile <<
"</g> </svg> </svg> " << std::endl;
2283 if(!print_total && !useApvPairValue){
2285 for( i_apv=
apvMap.begin();i_apv !=
apvMap.end(); i_apv++){
2287 if(apvPair!=
nullptr) {
2289 if(apv_mod !=
nullptr && apvPair->
mpos==0 && !apv_mod->
notInUse()){
2303 const char * command1;
2304 std::string tempfilename = outputfilename +
".coor";
2307 std::ifstream tempfile(tempfilename.c_str(),
std::ios::in);
2308 TCanvas *MyC =
new TCanvas(
"MyC",
"TrackerMap",width,height);
2309 gPad->SetFillColor(38);
2312 std::cout <<
" range x " << rangex << std::endl;
2313 std::cout <<
" range y " << rangey << std::endl;
2314 gPad->Range(0,0,rangex,rangey);
2318 typedef std::map<int,int> ColorList;
2319 ColorList colorList;
2320 ColorList::iterator
pos;
2322 while(!tempfile.eof()) {
2323 tempfile >> red >> green >> blue >>
npoints;
2324 colindex=red+green*1000+blue*1000000;
2325 pos=colorList.find(colindex);
2326 if(pos == colorList.end()){
2327 colorList[colindex]=ncolor+100;
2328 col =gROOT->GetColor(ncolor+100);
2330 col->SetRGB((Double_t)(red/255.),(Double_t)(green/255.),(Double_t)(blue/255.));
2332 c =
new TColor(ncolor+100,(Double_t)(red/255.),(Double_t)(green/255.),(Double_t)(blue/255.));
2337 tempfile >> x[
i] >> y[
i];
2340 if(ncolor>0 && ncolor<10000){
2342 for(
int i=0;
i<ncolor;
i++){colors[
i]=
i+100;}
2343 gStyle->SetPalette(ncolor,colors);
2346 tempfile.seekg(0,std::ios::beg);
2347 std::cout <<
"created palette with " << ncolor <<
" colors" << std::endl;
2348 while(!tempfile.eof()) {
2349 tempfile >> red >> green >> blue >>
npoints;
2351 tempfile >> x[
i] >> y[
i];
2353 colindex=red+green*1000+blue*1000000;
2354 pos=colorList.find(colindex);
2355 if(pos != colorList.end()){
2356 TPolyLine* pline =
new TPolyLine(npoints,y,x);
2357 vp.push_back(pline);
2358 pline->SetFillColor(colorList[colindex]);
2359 pline->SetLineWidth(0);
2366 axis =
new TGaxis(rangex-140,34,rangex-140,rangey-106,lminvalue,lmaxvalue,510,
"+L");
2367 axis->SetLabelSize(0.02);
2373 l.SetTextSize(0.05);
2375 if(
tkMapLog && (fulltitle.find(
"Log10 scale") == std::string::npos)) fulltitle +=
": Log10 scale";
2376 l.DrawLatex(50,rangey-200,fulltitle.c_str());
2379 std::cout <<
"Filetype " << filetype << std::endl;
2380 if(filetype==
"png"){
2382 MyC->Print(filename.c_str());
2384 if(filetype==
"jpg"){
2386 MyC->Print(filename.c_str());
2388 if(filetype==
"pdf"){
2390 MyC->Print(filename.c_str());
2393 command1=command.c_str();
2394 std::cout <<
"Executing " << command1 << std::endl;
2399 for(std::vector<TPolyLine*>::iterator pos1=vp.begin();pos1!=vp.end();pos1++){
2410 int ipos,ipos1,ipos2,
id=0,
val=0;
2414 ipos1 = line.find(
"value=\"");
2416 value = line.substr(ipos1+7,10);
2417 ipos = value.find(
"\"");
2418 value = value.substr(0,ipos);
2419 val=atoi(value.c_str());
2421 ipos2 = line.find(
"detid=\"");
2423 value = line.substr(ipos2+7,10);
2424 ipos = value.find(
"\"");
2425 value = value.substr(0,ipos);
2426 id = atoi(value.c_str());
2428 if(ipos1>0 && ipos2>0 &&
val>0)this->
fill(
id,
val);
2429 if(ipos1>0 && ipos2>0)nline++;
2433 std::cout << nline <<
" modules found in this svg file " << std::endl;
2444 std::ostringstream outs;
2446 outs << outputfilename <<
".xml";
2452 while (getline( *jsfile, line ))
2454 *
svgfile << line << std::endl;
2456 jsfile->close();
delete jsfile;
2459 for (
int layer=1; layer < 44; layer++){
2464 if(mod !=
nullptr && !mod->
notInUse()){
2474 for (
int layer=1; layer < 44; layer++){
2479 if(mod !=
nullptr && !mod->
notInUse()){
2487 for (
int layer=1; layer < 44; layer++){
2494 if(mod !=
nullptr && !mod->
notInUse()){
2500 *
svgfile <<
"</svg:g></svg:svg>"<<std::endl;
2501 *
svgfile <<
" <svg:text id=\"Title\" class=\"normalText\" x=\"300\" y=\"0\">"<<
title<<
"</svg:text>"<<std::endl;
2503 *
svgfile <<
"</svg:svg>"<<std::endl;
2504 *
svgfile <<
"</body></html>"<<std::endl;
2510 std::cout <<
"preparing the palette" << std::endl;
2513 int paletteLength = 250;
2514 int width=50*(yoffset-40)/1500;
2518 for(
int i=1;
i<paletteLength+1;
i++){
2520 red=(color>>16)&0xFF;
2521 green=(color>>8)&0xFF;
2533 if(!
temporary_file)*svgfile <<
"<svg:rect x=\"3610\" y=\""<<(1550-6*
i)<<
"\" width=\"50\" height=\"6\" fill=\"rgb("<<red<<
","<<green<<
","<<blue<<
")\" />\n";
2534 else *svgfile << red <<
" " << green <<
" " << blue <<
" 4 " <<
int(step*
i)+34 <<
" " << xoffset-width <<
". " <<
2535 int(step*i)+34 <<
" " << xoffset <<
". " <<
2536 int(step*(i-1))+34 <<
" " << xoffset <<
". " <<
2537 int(step*(i-1))+34 <<
" " << xoffset-width <<
". " << std::endl;
2540 if(!
temporary_file)*svgfile <<
"<svg:rect x=\"3610\" y=\""<<(1550-6*
i)<<
"\" width=\"50\" height=\"1\" fill=\"black\" />\n";
2541 if(i%50==0&&!
temporary_file)*svgfile <<
" <svg:text class=\"normalText\" x=\"3660\" y=\""<<(1560-6*
i)<<
"\">" <<val<<
"</svg:text>"<<std::endl;
2549 int key = fedId*1000+fedCh;
2552 if(apvpair!=
nullptr){
2556 std::cout <<
"*** error in FedTrackerMap fillc method ***";
2561 std::multimap<const int, TmApvPair*>::iterator
pos;
2565 if(apvpair!=
nullptr){
2571 std::cout <<
"*** error in FedTrackerMap fill by module method ***";
2576 int key = fedId*1000+fedCh;
2579 if(apvpair!=
nullptr) {apvpair->
value=current_val; apvpair->
count=1; apvpair->
red=-1;}
2581 std::cout <<
"*** error in FedTrackerMap fill_current_val method ***";
2587 int key =crate*10000000+slot*100000+ring*1000+addr;
2595 std::cout <<
"*** error in FecTrackerMap fillc method ***";
2600 int key =crate*10000000+slot*100000+ring*1000+addr;
2608 std::cout <<
"*** error in FecTrackerMap fill by module method ***";
2616 int key = rack*1000+crate*100+board;
2624 std::cout <<
"*** error in LVTrackerMap fillc method ***";
2629 int key = rack*1000+crate*100+board;
2637 std::cout <<
"*** error in LVTrackerMap fill by module method ***";
2643 int key = rack*1000+crate*100+board;
2651 std::cout <<
"*** error in HVTrackerMap (channel 2) fillc method ***";
2656 int key = rack*1000+crate*100+board;
2664 std::cout <<
"*** error in HVTrackerMap (channel 3) fillc method ***";
2670 int key = rack*1000+crate*100+board;
2678 std::cout <<
"*** error in HVTrackerMap fill by module method ***";
2682 int key = rack*1000+crate*100+board;
2690 std::cout <<
"*** error in HVTrackerMap fill by module method ***";
2699 int key = fedId*1000+fedCh;
2701 if(apvpair!=
nullptr){
2705 std::cout <<
"*** error in FedTrackerMap module method ***";
2709 int key = fedId*1000+fedCh;
2711 if(apvpair!=
nullptr){
2716 std::cout <<
"*** error inFedTrackerMap fill method ***";
2727 std::cout <<
"**************************error in fill method **************module "<<idmod<<std::endl;
2731 int key = layer*10000+ring*1000+nmod;
2738 std::cout <<
"**************************error in fill method **************"<< std::endl;
2743 std::map<const int , TmModule *>::iterator imod;
2745 fillc(imod->first,255,255,255);
2751 std::map<const int , TmModule *>::iterator imod;
2762 if(mod!=
nullptr) {mod->
value=current_val; mod->
count=1; mod->
red=-1;}
2763 else std::cout <<
"**error in fill_current_val method ***module "<<idmod<<std::endl;
2776 if(mod1!=
nullptr && mod2!=
nullptr){
2783 std::cout <<
"**************************error in fill method **************module "<<idmod<<std::endl;
2788 int key = layer*100000+ring*1000+nmod;
2794 else std::cout <<
"**************************error in SvgModuleMap **************";
2803 else std::cout <<
"**************************error in IdModuleMap **************";
2809 int key = layer*100000+ring*1000+nmod;
2814 else std::cout <<
"**************************error in SvgModuleMap **************";
2820 int nmods, pix_sil, fow_bar,
ring, nmod, layer;
2822 float posx, posy, posz, length,
width, thickness, widthAtHalfLength;
2823 int iModule=0,old_layer=0, ntotMod =0;
2826 while(!infile.eof()) {
2827 infile >> nmods >> pix_sil >> fow_bar >> layer >> ring >> nmod >> posx >> posy
2828 >> posz>> length >> width >> thickness
2829 >> widthAtHalfLength >> idex ;
2830 getline(infile,dummys);
2831 getline(infile,name);
2832 if(old_layer!=layer){old_layer=layer;iModule=0;}
2835 int key=layer*100000+ring*1000+nmod;
2840 if(mod==
nullptr)
std::cout <<
"error in module "<<key <<std::endl;
2862 float lminvalue, lmaxvalue;
2867 red=0;green=0;blue=0;
2869 float delta=(lmaxvalue-lminvalue);
2870 float x =(value-lminvalue);
2871 if(value<lminvalue){red=0;green=0;blue=255;}
2872 if(value>lmaxvalue){red=255;green=0;blue=0;}
2873 if(value>=lminvalue&&value<=lmaxvalue){
2874 red = (
int) ( x<(delta/2) ? 0 : ( x > ((3./4.)*
delta) ? 255 : 255/(delta/4) * (x-(2./4.)*
delta) ) );
2875 green= (
int) ( x<delta/4 ? (x*255/(delta/4)) : ( x > ((3./4.)*
delta) ? 255-255/(delta/4) *(x-(3./4.)*
delta) : 255 ) );
2876 blue = (
int) ( x<delta/4 ? 255 : ( x > ((1./2.)*
delta) ? 0 : 255-255/(delta/4) * (x-(1./4.)*
delta) ) );
2880 green = (
int)((value-lminvalue)/(lmaxvalue-lminvalue)*256.);
2881 if (green > 255) green=255;
2882 red = 255; blue=0;green=255-
green;
2885 return(blue|(green<<8)|(red<<16));
2889 std::ofstream * ofilename;
2890 std::ifstream * ifilename;
2891 std::ostringstream ofname;
2896 ifilename=
findfile(
"viewerHeader.xhtml");
2897 ofname << outputfilename <<
"viewer.html";
2898 ofilename =
new std::ofstream(ofname.str().c_str(),
std::ios::out);
2899 while (getline( *ifilename, line )) { *ofilename << line << std::endl; }
2900 *ofilename <<
" var tmapname=\"" <<outputfilename <<
"\""<<std::endl;
2901 *ofilename <<
" var tmaptitle=\"" <<
title <<
"\""<<std::endl;
2902 *ofilename <<
" var ncrates=" <<
ncrates <<
";"<<std::endl;
2903 *ofilename <<
" var nfeccrates=" <<
nfeccrates <<
";"<<std::endl;
2904 *ofilename <<
" var npsuracks=" <<
npsuracks <<
";"<<std::endl;
2906 ifilename->close();
delete ifilename;
2908 ifilename=
findfile(
"viewerTrailer.xhtml");
2909 while (getline( *ifilename, line )) { *ofilename << line << std::endl; }
2910 ofilename->close();
delete ofilename;
2911 command =
"sed -i \"s/XtmapnameX/"+outputfilename+
"/g\" "+ ofname.str();
2912 std::cout <<
"Executing " << command << std::endl;
2913 system(command.c_str());
2914 command =
"sed -i \"s/XtmaptitleX/"+
title+
"/g\" "+ ofname.str();
2915 std::cout <<
"Executing " << command << std::endl;
2916 system(command.c_str());
2918 ifilename->close();
delete ifilename;
2921 ofname <<
"jqviewer.js";
2922 ofilename =
new std::ofstream(ofname.str().c_str(),
std::ios::out);
2923 while (getline( *ifilename, line )) { *ofilename << line << std::endl; }
2925 ofilename->close();
delete ofilename;
2926 ifilename->close();
delete ifilename;
2929 ofname <<
"crate.js";
2930 ofilename =
new std::ofstream(ofname.str().c_str(),
std::ios::out);
2931 while (getline( *ifilename, line )) { *ofilename << line << std::endl; }
2933 ofilename->close();
delete ofilename;
2934 ifilename->close();
delete ifilename;
2937 ofname <<
"feccrate.js";
2938 ofilename =
new std::ofstream(ofname.str().c_str(),
std::ios::out);
2939 while (getline( *ifilename, line )) { *ofilename << line << std::endl; }
2941 ofilename->close();
delete ofilename;
2942 ifilename->close();
delete ifilename;
2945 ofname <<
"layer.js";
2946 ofilename =
new std::ofstream(ofname.str().c_str(),
std::ios::out);
2947 while (getline( *ifilename, line )) { *ofilename << line << std::endl; }
2949 ofilename->close();
delete ofilename;
2950 ifilename->close();
delete ifilename;
2953 ofname <<
"rack.js";
2954 ofilename =
new std::ofstream(ofname.str().c_str(),
std::ios::out);
2955 while (getline( *ifilename, line )) { *ofilename << line << std::endl; }
2957 ofilename->close();
delete ofilename;
2958 ifilename->close();
delete ifilename;
2962 ofname <<
"rackhv.js";
2963 ofilename =
new std::ofstream(ofname.str().c_str(),
std::ios::out);
2964 while (getline( *ifilename, line )) { *ofilename << line << std::endl; }
2966 ofilename->close();
delete ofilename;
2967 ifilename->close();
delete ifilename;
2972 std::ostringstream outs,outs1,outs2;
2973 outs << outputfilename<<
".png";
2980 for (
int layer=1; layer < 44; layer++){
2981 std::ostringstream outs;
2982 outs << outputfilename <<
"layer"<<layer<<
".html";
2983 txtfile =
new std::ofstream(outs.str().c_str(),
std::ios::out);
2984 *txtfile <<
"<html><head></head> <body>" << std::endl;
2989 if(mod !=
nullptr && !mod->
notInUse()){
2990 int idmod=mod->
idex;
2992 *txtfile <<
"<a name="<<idmod<<
"><pre>"<<std::endl;
2993 std::multimap<const int, TmApvPair*>::iterator
pos;
2997 if(apvpair!=
nullptr){
2999 *txtfile << apvpair->
text << std::endl;
3003 *txtfile <<
"</pre><h3>"<< mod->
name<<
"</h3>"<<std::endl;
3007 *txtfile <<
"</body></html>" << std::endl;
3008 txtfile->close();
delete txtfile;
3011 outs1 << outputfilename<<
"fed.png";
3013 outs2 << outputfilename<<
".xml";
3016 std::map<int , int>::iterator i_fed;
3019 std::ostringstream outs;
3020 outs << outputfilename <<
"crate"<<crate<<
".html";
3021 txtfile =
new std::ofstream(outs.str().c_str(),
std::ios::out);
3022 *txtfile <<
"<html><head></head> <body>" << std::endl;
3023 for (i_fed=
fedMap.begin();i_fed !=
fedMap.end(); i_fed++){
3024 if(i_fed->second == crate){
3025 int fedId = i_fed->first;
3026 for (
int nconn=0;nconn<96;nconn++){
3027 int key = fedId*1000+nconn;
3029 if(apvPair !=
nullptr){
3030 int idmod=apvPair->
idex;
3031 *txtfile <<
"<a name="<<idmod<<
"><pre>"<<std::endl;
3032 *txtfile << apvPair->
text << std::endl;
3033 std::ostringstream outs;
3034 outs <<
"fedchannel " <<apvPair->
getFedId() <<
"/"<<apvPair->
getFedCh()<<
" connects to module " << apvPair->
mod->
idex ;
3035 *txtfile <<
"</pre><h3>"<< outs.str()<<
"</h3>"<<std::endl;
3040 *txtfile <<
"</body></html>" << std::endl;
3041 txtfile->close();
delete txtfile;
3045 std::ostringstream outs1,outs2;
3046 outs1 << outputfilename<<
"fec.png";
3048 outs2 << outputfilename<<
".xml";
3052 std::map<int , TmCcu *>::iterator i_ccu;
3053 std::multimap<TmCcu*, TmModule*>::iterator it;
3054 std::pair<std::multimap<TmCcu*, TmModule*>::iterator,std::multimap<TmCcu*, TmModule*>::iterator> ret;
3055 for (
int crate=1; crate < (
nfeccrates+1); crate++){
3056 std::ostringstream outs;
3057 outs << outputfilename <<
"feccrate"<<crate<<
".html";
3058 txtfile =
new std::ofstream(outs.str().c_str(),
std::ios::out);
3059 *txtfile <<
"<html><head></head> <body>" << std::endl;
3060 for( i_ccu=
ccuMap.begin();i_ccu !=
ccuMap.end(); i_ccu++){
3061 TmCcu * ccu= i_ccu->second;
3063 int idmod=ccu->
idex;
3064 *txtfile <<
"<a name="<<idmod<<
"><pre>"<<std::endl;
3065 *txtfile << ccu->
text << std::endl;
3066 std::ostringstream outs;
3067 if(ccu->
nmod==0)outs <<
"ccu is in position" << ccu->
mpos<<
"in ring but doesn't seem to have any module connected";
else 3069 outs <<
"ccu is in position " << ccu->
mpos<<
" in ring and connects " <<ccu->
nmod<<
" modules" << std::endl;
3071 for (it = ret.first; it != ret.second; ++it)
3073 outs << (*it).second->idex<<
" " << (*it).second->name <<
" value= "<< (*it).second->value<<
"\n\n";
3076 *txtfile <<
"</pre><h4>"<< outs.str()<<
"</h4>"<<std::endl;
3080 *txtfile <<
"</body></html>" << std::endl;
3081 txtfile->close();
delete txtfile;
3085 std::ostringstream outs3,outs4;
3086 outs3 << outputfilename<<
"psu.png";
3089 outs4 << outputfilename<<
".xml";
3094 std::map<int , TmPsu *>::iterator ipsu;
3095 std::multimap<TmPsu*, TmModule*>::iterator it;
3096 std::pair<std::multimap<TmPsu*, TmModule*>::iterator,std::multimap<TmPsu*, TmModule*>::iterator> ret;
3097 for (
int rack=1; rack < (
npsuracks+1); rack++){
3098 std::ostringstream outs;
3100 outs << outputfilename <<
"psurack"<<rack<<
".html";
3101 txtfile =
new std::ofstream(outs.str().c_str(),
std::ios::out);
3102 *txtfile <<
"<html><head></head> <body>" << std::endl;
3103 for ( ipsu=
psuMap.begin();ipsu !=
psuMap.end(); ipsu++){
3104 TmPsu * psu= ipsu->second;
3105 if(psu!=
nullptr && psu->
getPsuRack() == rack){
3106 *txtfile <<
"<a name="<<psu->
idex<<
"><pre>"<<std::endl;
3107 *txtfile << psu->
text << std::endl;
3108 std::ostringstream outs;
3109 if(psu->
nmod==0)outs <<
"Ps is in position" << psu->
getPsuBoard()<<
"in crate but doesn't seem to have any module connected";
else 3111 outs<<
"PS is in position " <<psu->
getPsuBoard()<<
" in crate and connects to "<<psu->
nmod<<
" modules. "<<std::endl;
3114 for (it = ret.first; it != ret.second; ++it)
3116 outs <<(*it).second->idex <<
" "<< (*it).second->name<<
" value= "<<(*it).second->value<<
" <br>"<<std::endl;
3119 *txtfile <<
"</pre><h4>"<< outs.str()<<
"</h4>"<<std::endl;
3123 *txtfile <<
"</body></html>" << std::endl;
3124 txtfile->close();
delete txtfile;
3130 std::ostringstream outs5,outs6;
3131 outs5 << outputfilename<<
"hv.png";
3134 outs6 << outputfilename<<
".xml";
3139 std::map<int , TmPsu *>::iterator ipsu;
3140 std::multimap<TmPsu*, TmModule*>::iterator it;
3141 std::pair<std::multimap<TmPsu*, TmModule*>::iterator,std::multimap<TmPsu*, TmModule*>::iterator> ret;
3142 for (
int rack=1; rack < (
npsuracks+1); rack++){
3143 std::ostringstream outs;
3145 outs << outputfilename <<
"HVrack"<<rack<<
".html";
3146 txtfile =
new std::ofstream(outs.str().c_str(),
std::ios::out);
3147 *txtfile <<
"<html><head></head> <body>" << std::endl;
3148 for ( ipsu=
psuMap.begin();ipsu !=
psuMap.end(); ipsu++){
3149 TmPsu * psu= ipsu->second;
3150 if(psu!=
nullptr && psu->
getPsuRack() == rack){
3151 *txtfile <<
"<a name="<<psu->
idex<<
"><pre>"<<std::endl;
3152 *txtfile << psu->
textHV2 << std::endl;
3153 std::ostringstream outsHV2;
3154 if(psu->
nmodHV2==0)outsHV2 <<
"HV Channel002 is in position" << psu->
getPsuBoard()<<
"in crate but doesn't seem to have any module connected";
else 3156 outsHV2<<
"HV Channel002 is in position " <<psu->
getPsuBoard()<<
" in crate and connects to "<<psu->
nmodHV2<<
" modules. "<<
" <br>"<<std::endl;
3159 for (it = ret.first; it != ret.second; ++it)
3161 if((*it).second->HVchannel==2){outsHV2 <<(*it).second->idex <<
" "<< (*it).second->name<<
" value= "<<(*it).second->value<<
" <br>"<<std::endl;}
3163 *txtfile <<
"</pre><h4>"<< outsHV2.str()<<
"</h4>"<<std::endl;
3166 *txtfile << psu->
textHV3 << std::endl;
3167 std::ostringstream outsHV3;
3168 if(psu->
nmodHV3==0)outsHV3 <<
"HV Channel003 is in position" << psu->
getPsuBoard()<<
"in crate but doesn't seem to have any module connected";
else 3170 outsHV3<<
"HV Channel003 is in position " <<psu->
getPsuBoard()<<
" in crate and connects to "<<psu->
nmodHV3<<
" modules. "<<
" <br>"<<std::endl;
3173 for (it = ret.first; it != ret.second; ++it)
3175 if((*it).second->HVchannel==3){outsHV3 <<(*it).second->idex <<
" "<< (*it).second->name<<
" value= "<<(*it).second->value<<
" <br>"<<std::endl;}
3177 *txtfile <<
"</pre><h4>"<< outsHV3.str()<<
"</h4>"<<std::endl;
3182 *txtfile <<
"</body></html>" << std::endl;
3183 txtfile->close();
delete txtfile;
3190 float minval,maxval; minval=minval1; maxval=maxval1;
3191 if(
tkMapLog && (minval<maxval)) {minval=
pow(10.,minval1);maxval=
pow(10.,maxval1);}
3195 size_t found=filetype.find_last_of(
".");
3196 filetype=filetype.substr(found+1);
3197 found=outputfilename.find_last_of(
".");
3198 outputfilename=outputfilename.substr(0,found);
3200 std::ofstream * ofilename;
3201 std::ifstream * ifilename;
3202 std::ostringstream ofname;
3207 ifilename=
findfile(
"viewerHeader.xhtml");
3208 ofname << outputfilename <<
"viewer.html";
3209 ofilename =
new std::ofstream(ofname.str().c_str(),
std::ios::out);
3210 while (getline( *ifilename, line )) { *ofilename << line << std::endl; }
3211 *ofilename <<
" var tmapname=\"" <<outputfilename <<
"\""<<std::endl;
3212 *ofilename <<
" var tmaptitle=\"" <<
title <<
"\""<<std::endl;
3213 *ofilename <<
" var ncrates=" <<
ncrates <<
";"<<std::endl;
3214 *ofilename <<
" var nfeccrates=" <<
nfeccrates <<
";"<<std::endl;
3215 *ofilename <<
" var npsuracks=" <<
npsuracks <<
";"<<std::endl;
3216 ifilename->close();
delete ifilename;
3217 ifilename=
findfile(
"viewerTrailer.xhtml");
3218 while (getline( *ifilename, line )) { *ofilename << line << std::endl; }
3219 ofilename->close();
delete ofilename;
3220 ifilename->close();
delete ifilename;
3221 command =
"sed -i \"s/XtmapnameX/"+outputfilename+
"/g\" "+ ofname.str();
3222 std::cout <<
"Executing " << command << std::endl;
3223 system(command.c_str());
3224 command =
"sed -i \"s/XtmaptitleX/"+
title+
"/g\" "+ ofname.str();
3225 std::cout <<
"Executing " << command << std::endl;
3226 system(command.c_str());
3230 ofname <<
"jqviewer.js";
3231 ofilename =
new std::ofstream(ofname.str().c_str(),
std::ios::out);
3232 while (getline( *ifilename, line )) { *ofilename << line << std::endl; }
3233 ofilename->close();
delete ofilename;
3234 ifilename->close();
delete ifilename;
3238 ofname <<
"crate.js";
3239 ofilename =
new std::ofstream(ofname.str().c_str(),
std::ios::out);
3240 while (getline( *ifilename, line )) { *ofilename << line << std::endl; }
3241 ofilename->close();
delete ofilename;
3242 ifilename->close();
delete ifilename;
3246 ofname <<
"feccrate.js";
3247 ofilename =
new std::ofstream(ofname.str().c_str(),
std::ios::out);
3248 while (getline( *ifilename, line )) { *ofilename << line << std::endl; }
3249 ofilename->close();
delete ofilename;
3250 ifilename->close();
delete ifilename;
3254 ofname <<
"rack.js";
3255 ofilename =
new std::ofstream(ofname.str().c_str(),
std::ios::out);
3256 while (getline( *ifilename, line )) { *ofilename << line << std::endl; }
3257 ofilename->close();
delete ofilename;
3258 ifilename->close();
delete ifilename;
3262 ofname <<
"rackhv.js";
3263 ofilename =
new std::ofstream(ofname.str().c_str(),
std::ios::out);
3264 while (getline( *ifilename, line )) { *ofilename << line << std::endl; }
3265 ofilename->close();
delete ofilename;
3266 ifilename->close();
delete ifilename;
3270 ofname <<
"layer.js";
3271 ofilename =
new std::ofstream(ofname.str().c_str(),
std::ios::out);
3272 while (getline( *ifilename, line )) { *ofilename << line << std::endl; }
3273 ofilename->close();
delete ofilename;
3274 ifilename->close();
delete ifilename;
3276 command =
"scp -r ../../DQM/TrackerCommon/test/jquery/ .";
3277 std::cout <<
"Executing " << command << std::endl;
3278 system(command.c_str());
3279 command =
"scp -r ../../CommonTools/TrackerMap/data/images/ .";
3280 std::cout <<
"Executing " << command << std::endl;
3281 system(command.c_str());
3284 std::ostringstream outs;
3285 outs << outputfilename<<
".png";
3289 std::ostringstream outs;
3290 outs << outputfilename<<
".png";
3296 for (
int layer=1; layer < 44; layer++){
3297 std::ostringstream outs;
3298 outs << outputfilename <<
"layer"<<layer<<
".html";
3299 txtfile =
new std::ofstream(outs.str().c_str(),
std::ios::out);
3300 *txtfile <<
"<html><head></head> <body>" << std::endl;
3305 if(mod !=
nullptr && !mod->
notInUse()){
3306 int idmod=mod->
idex;
3308 *txtfile <<
"<a name="<<idmod<<
"><pre>"<<std::endl;
3309 std::multimap<const int, TmApvPair*>::iterator
pos;
3313 if(apvpair!=
nullptr){
3315 *txtfile << apvpair->
text << std::endl;
3319 *txtfile <<
"</pre><h3>"<< mod->
name<<
"</h3>"<<std::endl;
3323 *txtfile <<
"</body></html>" << std::endl;
3324 txtfile->close();
delete txtfile;
3328 std::ostringstream outs1,outs2;
3330 else outs1 << outputfilename<<
"fed."<<
filetype;
3333 outs2 << outputfilename<<
".xml";
3336 std::map<int , int>::iterator i_fed;
3339 std::ostringstream outs;
3340 outs << outputfilename <<
"crate"<<crate<<
".html";
3341 txtfile =
new std::ofstream(outs.str().c_str(),
std::ios::out);
3342 *txtfile <<
"<html><head></head> <body>" << std::endl;
3343 for (i_fed=
fedMap.begin();i_fed !=
fedMap.end(); i_fed++){
3344 if(i_fed->second == crate){
3345 int fedId = i_fed->first;
3346 for (
int nconn=0;nconn<96;nconn++){
3347 int key = fedId*1000+nconn;
3349 if(apvPair !=
nullptr){
3350 int idmod=apvPair->
idex;
3351 *txtfile <<
"<a name="<<idmod<<
"><pre>"<<std::endl;
3352 *txtfile << apvPair->
text << std::endl;
3353 std::ostringstream outs;
3354 outs <<
"fedchannel " <<apvPair->
getFedId() <<
"/"<<apvPair->
getFedCh()<<
" connects to module " << apvPair->
mod->
idex ;
3355 *txtfile <<
"</pre><h3>"<< outs.str()<<
"</h3>"<<std::endl;
3360 *txtfile <<
"</body></html>" << std::endl;
3361 txtfile->close();
delete txtfile;
3366 std::ostringstream outs1,outs2;
3368 else outs1 << outputfilename<<
"fec."<<
filetype;
3371 outs2 << outputfilename<<
".xml";
3375 std::map<int , TmCcu *>::iterator i_ccu;
3376 std::multimap<TmCcu*, TmModule*>::iterator it;
3377 std::pair<std::multimap<TmCcu*, TmModule*>::iterator,std::multimap<TmCcu*, TmModule*>::iterator> ret;
3378 for (
int crate=1; crate < (
nfeccrates+1); crate++){
3379 std::ostringstream outs;
3380 outs << outputfilename <<
"feccrate"<<crate<<
".html";
3381 txtfile =
new std::ofstream(outs.str().c_str(),
std::ios::out);
3382 *txtfile <<
"<html><head></head> <body>" << std::endl;
3383 for( i_ccu=
ccuMap.begin();i_ccu !=
ccuMap.end(); i_ccu++){
3384 TmCcu * ccu= i_ccu->second;
3386 int idmod=ccu->
idex;
3387 *txtfile <<
"<a name="<<idmod<<
"><pre>"<<std::endl;
3388 *txtfile << ccu->
text << std::endl;
3389 std::ostringstream outs;
3390 if(ccu->
nmod==0)outs <<
"ccu is in position" << ccu->
mpos<<
"in ring but doesn't seem to have any module connected";
else 3392 outs <<
"ccu is in position " << ccu->
mpos<<
" in ring and connects " <<ccu->
nmod<<
" modules" << std::endl;
3394 for (it = ret.first; it != ret.second; ++it)
3396 outs << (*it).second->idex<<
" " << (*it).second->name <<
" value= "<< (*it).second->value<<
"\n\n";
3399 *txtfile <<
"</pre><h4>"<< outs.str()<<
"</h4>"<<std::endl;
3403 *txtfile <<
"</body></html>" << std::endl;
3409 std::ostringstream outs3,outs4;
3411 else outs3 << outputfilename<<
"psu."<<
filetype;
3414 outs4 << outputfilename<<
".xml";
3419 std::map<int , TmPsu *>::iterator ipsu;
3420 std::multimap<TmPsu*, TmModule*>::iterator it;
3421 std::pair<std::multimap<TmPsu*, TmModule*>::iterator,std::multimap<TmPsu*, TmModule*>::iterator> ret;
3422 for (
int rack=1; rack < (
npsuracks+1); rack++){
3423 std::ostringstream outs;
3425 outs << outputfilename <<
"psurack"<<rack<<
".html";
3426 txtfile =
new std::ofstream(outs.str().c_str(),
std::ios::out);
3427 *txtfile <<
"<html><head></head> <body>" << std::endl;
3428 for ( ipsu=
psuMap.begin();ipsu !=
psuMap.end(); ipsu++){
3429 TmPsu * psu= ipsu->second;
3430 if(psu!=
nullptr && psu->
getPsuRack() == rack){
3431 *txtfile <<
"<a name="<<psu->
idex<<
"><pre>"<<std::endl;
3432 *txtfile << psu->
text << std::endl;
3433 std::ostringstream outs;
3434 if(psu->
nmod==0)outs <<
"Ps is in position" << psu->
getPsuBoard()<<
"in crate but doesn't seem to have any module connected";
else 3436 outs<<
"PS is in position " <<psu->
getPsuBoard()<<
" in crate and connects to "<<psu->
nmod<<
" modules. "<<std::endl;
3439 for (it = ret.first; it != ret.second; ++it)
3441 outs <<(*it).second->idex <<
" "<< (*it).second->name<<
" value= "<<(*it).second->value<<
" <br>"<<std::endl;
3444 *txtfile <<
"</pre><h4>"<< outs.str()<<
"</h4>"<<std::endl;
3448 *txtfile <<
"</body></html>" << std::endl;
3456 std::ostringstream outs5,outs6;
3458 else outs5 << outputfilename<<
"hv."<<
filetype;
3461 outs6 << outputfilename<<
".xml";
3466 std::map<int , TmPsu *>::iterator ipsu;
3467 std::multimap<TmPsu*, TmModule*>::iterator it;
3468 std::pair<std::multimap<TmPsu*, TmModule*>::iterator,std::multimap<TmPsu*, TmModule*>::iterator> ret;
3469 for (
int rack=1; rack < (
npsuracks+1); rack++){
3470 std::ostringstream outs;
3472 outs << outputfilename <<
"HVrack"<<rack<<
".html";
3473 txtfile =
new std::ofstream(outs.str().c_str(),
std::ios::out);
3474 *txtfile <<
"<html><head></head> <body>" << std::endl;
3475 for ( ipsu=
psuMap.begin();ipsu !=
psuMap.end(); ipsu++){
3476 TmPsu * psu= ipsu->second;
3477 if(psu!=
nullptr && psu->
getPsuRack() == rack){
3478 *txtfile <<
"<a name="<<psu->
idex<<
"><pre>"<<std::endl;
3479 *txtfile << psu->
textHV2 << std::endl;
3480 std::ostringstream outsHV2;
3481 if(psu->
nmodHV2==0)outsHV2 <<
"HV Channel002 is in position" << psu->
getPsuBoard()<<
"in crate but doesn't seem to have any module connected";
else 3483 outsHV2<<
"HV Channel002 is in position " <<psu->
getPsuBoard()<<
" in crate and connects to "<<psu->
nmodHV2<<
" modules. "<<
" <br>"<<std::endl;
3486 for (it = ret.first; it != ret.second; ++it)
3488 if((*it).second->HVchannel==2){outsHV2 <<(*it).second->idex <<
" "<< (*it).second->name<<
" value= "<<(*it).second->value<<
" <br>"<<std::endl;}
3490 *txtfile <<
"</pre><h4>"<< outsHV2.str()<<
"</h4>"<<std::endl;
3493 *txtfile << psu->
textHV3 << std::endl;
3494 std::ostringstream outsHV3;
3495 if(psu->
nmodHV3==0)outsHV3 <<
"HV Channel003 is in position" << psu->
getPsuBoard()<<
"in crate but doesn't seem to have any module connected";
else 3497 outsHV3<<
"HV Channel003 is in position " <<psu->
getPsuBoard()<<
" in crate and connects to "<<psu->
nmodHV3<<
" modules. "<<
" <br>"<<std::endl;
3500 for (it = ret.first; it != ret.second; ++it)
3502 if((*it).second->HVchannel==3){outsHV3 <<(*it).second->idex <<
" "<< (*it).second->name<<
" value= "<<(*it).second->value<<
" <br>"<<std::endl;}
3504 *txtfile <<
"</pre><h4>"<< outsHV3.str()<<
"</h4>"<<std::endl;
3509 *txtfile <<
"</body></html>" << std::endl;
3520 std::ifstream * ifilename;
3526 ifname=
"CommonTools/TrackerMap/data/"+
filename;
3530 ifname=
"CommonTools/TrackerMap/data/"+
filename;
3533 if(!ifilename)
std::cout <<
"File " << filename <<
" missing" << std::endl;
3540 for (
int layer=1; layer < 44; layer++){
3545 if(mod !=
nullptr && !mod->
notInUse()){
3555 for (
int layer=1; layer < 44; layer++){
3560 if(mod !=
nullptr && !mod->
notInUse()){
3568 for (
int layer=1; layer < 44; layer++){
3569 std::ostringstream outs;
3570 outs << outputfilename <<
"layer"<<layer<<
".xml";
3571 xmlfile =
new std::ofstream(outs.str().c_str(),
std::ios::out);
3572 *xmlfile <<
"<?xml version=\"1.0\" standalone=\"no\"?>"<<std::endl;
3573 *xmlfile <<
"<svg xmlns=\"http://www.w3.org/2000/svg\""<<std::endl;
3574 *xmlfile <<
"xmlns:svg=\"http://www.w3.org/2000/svg\""<<std::endl;
3575 *xmlfile <<
"xmlns:xlink=\"http://www.w3.org/1999/xlink\" >"<<std::endl;
3576 *xmlfile <<
"<script type=\"text/ecmascript\" xlink:href=\"layer.js\" />"<<std::endl;
3577 *xmlfile <<
"<svg id=\"mainMap\" x=\"0\" y=\"0\" viewBox=\"0 0 500 500\" width=\"700\" height=\"700\" onload=\"TrackerLayer.init()\">"<<std::endl;
3578 if(layer<31)*xmlfile <<
"<g id=\"layer\" transform=\" translate(0,400) rotate(270) scale(1.,1.)\" > "<<std::endl;
3579 else *xmlfile <<
"<g id=\"layer\" transform=\" translate(0,400) rotate(270) scale(1.,0.8)\" > "<<std::endl;
3580 *xmlfile <<
"<rect fill=\"lightblue\" stroke=\"none\" x=\"0\" y=\"0\" width=\"700\" height=\"700\" />"<<std::endl;
3581 *xmlfile <<
"<svg:polygon id=\"fed\" mapAttribute=\"fed\" points=\"250,40 250,10 230,10 230,40\" onclick=\"chooseMap(evt);\" onmouseover=\"chooseMap(evt);\" onmouseout=\"chooseMap(evt);\" fill=\"rgb(0,127,255)\"/>"<<std::endl;
3582 *xmlfile <<
"<svg:polygon id=\"fec\" mapAttribute=\"fec\" points=\"228,40 228,10 208,10 208,40\" onclick=\"chooseMap(evt);\" onmouseover=\"chooseMap(evt);\" onmouseout=\"chooseMap(evt);\" fill=\"rgb(0,127,255)\"/>"<<std::endl;
3583 *xmlfile <<
"<svg:polygon id=\"lv\" mapAttribute=\"lv\" points=\"206,40 206,10 186,10 186,40\" onclick=\"chooseMap(evt);\" onmouseover=\"chooseMap(evt);\" onmouseout=\"chooseMap(evt);\" fill=\"rgb(0,127,255)\"/>"<<std::endl;
3584 *xmlfile <<
"<svg:polygon id=\"hv\" mapAttribute=\"hv\" points=\"184,40 184,10 164,10 164,40\" onclick=\"chooseMap(evt);\" onmouseover=\"chooseMap(evt);\" onmouseout=\"chooseMap(evt);\" fill=\"rgb(0,127,255)\"/>"<<std::endl;
3585 *xmlfile <<
"<svg:polygon id=\"plot\" mapAttribute=\"plot\" points=\"155,45 155,5 135,5 135,45\" onclick=\"chooseMap(evt);\" onmouseover=\"chooseMap(evt);\" onmouseout=\"chooseMap(evt);\" fill=\"rgb(200,0,0)\"/>"<<std::endl;
3593 if(mod !=
nullptr && !mod->
notInUse()){
3594 drawModule(mod,key,layer,print_total,xmlfile);
3598 *xmlfile <<
"</g> </svg> <text id=\"currentElementText\" x=\"40\" y=\"30\">" << std::endl;
3599 *xmlfile <<
"<tspan id=\"line1\" x=\"40\" y=\"30\"> </tspan> " << std::endl;
3600 *xmlfile <<
"<tspan id=\"line2\" x=\"40\" y=\"60\"> </tspan> " << std::endl;
3601 *xmlfile <<
"<tspan id=\"line3\" x=\"40\" y=\"90\"> </tspan> " << std::endl;
3602 *xmlfile <<
"<tspan id=\"line4\" x=\"40\" y=\"120\"> </tspan> " << std::endl;
3604 *xmlfile <<
"<tspan mapAttribute=\"fed\" onclick=\"chooseMap(evt);\" onmouseover=\"chooseMap(evt);\" onmouseout=\"chooseMap(evt);\" x=\"15\" y=\"228\" font-size=\"12\" font-family=\"arial\" fill=\"white\">FED</tspan> " <<std::endl;
3605 *xmlfile <<
"<tspan mapAttribute=\"fec\" onclick=\"chooseMap(evt);\" onmouseover=\"chooseMap(evt);\" onmouseout=\"chooseMap(evt);\" x=\"15\" y=\"258\" font-size=\"12\" font-family=\"arial\" fill=\"white\">FEC</tspan> " <<std::endl;
3606 *xmlfile <<
"<tspan mapAttribute=\"lv\" onclick=\"chooseMap(evt);\" onmouseover=\"chooseMap(evt);\" onmouseout=\"chooseMap(evt);\" x=\"18\" y=\"289\" font-size=\"12\" font-family=\"arial\" fill=\"white\">LV</tspan> " <<std::endl;
3607 *xmlfile <<
"<tspan mapAttribute=\"hv\" onclick=\"chooseMap(evt);\" onmouseover=\"chooseMap(evt);\" onmouseout=\"chooseMap(evt);\" x=\"18\" y=\"319\" font-size=\"12\" font-family=\"arial\" fill=\"white\">HV</tspan> " <<std::endl;
3608 *xmlfile <<
"<tspan mapAttribute=\"plot\" onclick=\"chooseMap(evt);\" onmouseover=\"chooseMap(evt);\" onmouseout=\"chooseMap(evt);\" x=\"12\" y=\"360\" font-size=\"12\" font-family=\"arial\" fill=\"white\">PLOT</tspan> " <<std::endl;
3611 *xmlfile <<
"<tspan mapAttribute=\"fed\" onclick=\"chooseMap(evt);\" onmouseover=\"chooseMap(evt);\" onmouseout=\"chooseMap(evt);\" x=\"21\" y=\"228\" font-size=\"12\" font-family=\"arial\" fill=\"white\">FED</tspan> " <<std::endl;
3612 *xmlfile <<
"<tspan mapAttribute=\"fec\" onclick=\"chooseMap(evt);\" onmouseover=\"chooseMap(evt);\" onmouseout=\"chooseMap(evt);\" x=\"21\" y=\"258\" font-size=\"12\" font-family=\"arial\" fill=\"white\">FEC</tspan> " <<std::endl;
3613 *xmlfile <<
"<tspan mapAttribute=\"lv\" onclick=\"chooseMap(evt);\" onmouseover=\"chooseMap(evt);\" onmouseout=\"chooseMap(evt);\" x=\"24\" y=\"289\" font-size=\"12\" font-family=\"arial\" fill=\"white\">LV</tspan> " <<std::endl;
3614 *xmlfile <<
"<tspan mapAttribute=\"hv\" onclick=\"chooseMap(evt);\" onmouseover=\"chooseMap(evt);\" onmouseout=\"chooseMap(evt);\" x=\"24\" y=\"319\" font-size=\"12\" font-family=\"arial\" fill=\"white\">HV</tspan> " <<std::endl;
3615 *xmlfile <<
"<tspan mapAttribute=\"plot\" onclick=\"chooseMap(evt);\" onmouseover=\"chooseMap(evt);\" onmouseout=\"chooseMap(evt);\" x=\"17\" y=\"360\" font-size=\"12\" font-family=\"arial\" fill=\"white\">PLOT</tspan> " <<std::endl;
3617 *xmlfile <<
" </text> </svg>" << std::endl;
3618 xmlfile->close();
delete xmlfile;
3630 legInfos_.back()->SetFillColor(kBlue-9);
3634 legInfos_.back()->SetFillColor(kPink-9);
3636 legInfos_.back()->SetFillColor(kOrange+2);
3638 legInfos_.back()->SetFillColor(kYellow);
3642 legInfos_.back()->SetFillColor(kViolet-5);
3643 legKeys_ = {
"Good Modules",
"Excluded FED",
"FED errors",
"# Clusters",
3644 "# Digis",
"PCL bad",
"# Clusters & Digis",
"DCS Error"};
3647 TLegend* myL=
new TLegend(0.56,0.87,0.95,0.99);
3648 myL->SetNColumns(2);
3649 myL->SetBorderSize(0);
3650 myL->SetFillColor(38);
std::vector< TPolyLine * > legInfos_
void fill_hv_channel2(int rack, int crate, int board, float qty)
T getUntrackedParameter(std::string const &, T const &) const
#define NUMFEDCRATE_INCOLUMN
TrackerMap(std::string s=" ", int xsize1=340, int ysize1=200)
double ydpixelc(double y)
std::ifstream * findfile(std::string filename)
#define NUMPSURACK_INCOLUMN
double ydpixelfec(double y)
int getmoduleCount(int subdet, int partdet, int layer, int ring)
void fillc_hv_channel2(int rack, int crate, int board, int red, int green, int blue)
std::ifstream * inputfile
void save_as_psutrackermap(bool print_total=true, float minval=0., float maxval=0., std::string s="psu_svgmap.svg", int width=100+(360+100)*5+300, int height=50+(150+50)*6+300)
CaloTopology const * topology(0)
~TrackerMap()
default destructor
static const uint32_t invalid32_
int module(int fedId, int fedCh)
void defwindow(int num_lay)
Sin< T >::type sin(const T &t)
#define NUMFEDCH_INCOLUMN
void save_as_HVtrackermap(bool print_total=true, float minval=0., float maxval=0., std::string s="psu_svgmap.svg", int width=1500, int height=800)
double xdpixelc(double x)
void defpsuwindow(int num_rack)
int getlayerCount(int subdet, int partdet)
void fill_current_val_fed_channel(int fedId, int fedCh, float current_val)
const std::vector< SiStripFecCrate > & crates() const
#define NUMFEDCRATE_INROW
void fillc_fec_channel(int crate, int slot, int ring, int addr, int red, int green, int blue)
double xdpixelfec(double x)
const std::vector< const FedChannelConnection * > & getConnections(uint32_t det_id) const
double phival(double x, double y)
txtfile
Delete all three files at once to make sure the user never sees stale data (e.g.
void fillc_lv_channel(int rack, int crate, int board, int red, int green, int blue)
std::vector< std::string > legKeys_
int getringCount(int subdet, int partdet, int layer)
double xdpixelpsu(double x)
void drawHV3(int rack, int numcrate_inrack, bool print_total, TmPsu *psu, std::ofstream *svgfile, bool usePsuValue)
FedsConstIterRange fedIds() const
void save(bool print_total=true, float minval=0., float maxval=0., std::string s="svgmap.svg", int width=1500, int height=800)
Cos< T >::type cos(const T &t)
void deffecwindow(int num_crate)
void load(std::string s="tmap.svg")
void drawModule(TmModule *mod, int key, int layer, bool total, std::ofstream *file)
void drawApvPair(int crate, int numfed_incrate, bool total, TmApvPair *apvPair, std::ofstream *file, bool useApvPairValue)
void fillc_fed_channel(int fedId, int fedCh, int red, int green, int blue)
xmlfile
Make an XML representation of the misalignment.
int getcolor(float value, int palette)
void fillc(int idmod, int RGBcode)
void printlayers(bool print_total=true, float minval=0., float maxval=0., std::string s="layer")
void drawHV2(int rack, int numcrate_inrack, bool print_total, TmPsu *psu, std::ofstream *svgfile, bool usePsuValue)
void drawCcu(int crate, int numfed_incrate, bool total, TmCcu *ccu, std::ofstream *file, bool useCcuValue)
void save_as_fedtrackermap(bool print_total=true, float minval=0., float maxval=0., std::string s="fed_svgmap.svg", int width=100+(90+100)*31+300, int height=150+(2940+150)*1+300)
void fill_hv_channel3(int rack, int crate, int board, float qty)
#define NUMPSUCRATE_INCOLUMN
static const uint16_t invalid_
ConnsConstIterRange fedConnections(uint16_t fed_id) const
Contains cabling info at the device level, including DetId, APV pair numbers, hardware addresses...
void setRange(float min, float max)
void drawPalette(std::ofstream *file, int xoffset=3660, int yoffset=1540)
int nlayer(int det, int part, int lay)
void print(bool print_total=true, float minval=0., float maxval=0., std::string s="svgmap")
void fill_fec_channel(int crate, int slot, int ring, int addr, float qty)
void fill_current_val(int idmod, float current_val)
void setText(int idmod, std::string s)
static bool isRingStereo(int key)
void defcwindow(int num_crate)
T mod(const T &a, const T &b)
void fill_lv_channel(int rack, int crate, int board, float qty)
std::vector< TColor * > vc
void printall(bool print_total=true, float minval=0., float maxval=0., std::string s="svgmap", int width=6000, int height=3200)
Power< A, B >::type pow(const A &a, const B &b)
void drawPsu(int rack, int numcrate_inrack, bool print_total, TmPsu *psu, std::ofstream *svgfile, bool usePsuValue)
void fill(int layer, int ring, int nmod, float x)
double ydpixelpsu(double y)
void save_as_fectrackermap(bool print_total=true, float minval=0., float maxval=0., std::string s="fec_svgmap.svg", int width=1500, int height=800)
void fill_fed_channel(int fedId, int fedCh, float qty)
void fillc_hv_channel3(int rack, int crate, int board, int red, int green, int blue)
std::pair< float, float > getAutomaticRange()