16 #include "TPolyLine.h"
38 jsfilename=
"CommonTools/TrackerMap/data/trackermap.txt";
39 infilename=
"CommonTools/TrackerMap/data/tracker.dat";
70 std::cout<<
"SiStripFedCabling has "<<
feds.size()<<
" active FEDS"<<std::endl;
73 for(std::vector<unsigned short>::const_iterator ifed =
feds.begin();ifed<
feds.end();ifed++){
76 for(
auto iconn = theconn.begin();iconn<theconn.end();iconn++){
87 int key = iconn->fedId()*1000+iconn->fedCh();
89 if(apvpair!=0)
std::cout <<
"Fed "<< iconn->fedId() <<
" channel " << iconn->fedCh() <<
" seem to be already loaded!"<<std::endl;
95 if(
fedMap[iconn->fedId()]==0){
fedMap[iconn->fedId()]=iconn->fedCrate();}
96 if(
slotMap[iconn->fedId()]==0){
slotMap[iconn->fedId()]=iconn->fedSlot();}
97 if(ncrates==0 || ncrates < iconn->fedCrate()) ncrates = iconn->fedCrate();
102 apvpair =
new TmApvPair(key,iconn->fedCrate());
104 apvpair->
mpos=iconn->apvPairNumber();
106 apvModuleMap.insert(std::make_pair(iconn->detId(),apvpair));
109 apvpair->
text=s.str();
116 std::map<int , TmModule *>::iterator i_mod;
120 std::ostringstream outs,outs1;
121 outs <<
" connected to ";
126 std::multimap<const int, TmApvPair*>::iterator pos;
132 outs1 << apvpair->
idex+apvpair->
crate*1000000<<
",";
137 outs<<
"("<<nchan<<
")";
139 std::string s = outs1.str(); s.erase(s.end()-1,s.end());
146 int nfec=0;
int nccu;
int nmod;
147 int crate,slot,
ring,addr,pos;
153 while(!Ccufile.eof()) {
154 Ccufile >> crate >> slot >> ring >> addr >> pos;
155 getline(Ccufile,dummys);
156 int key =crate*10000000+slot*100000+ring*1000+addr;
159 ccu =
new TmCcu(crate,slot,ring,addr);
165 for ( std::vector<SiStripFecCrate>::const_iterator icrate = fecCabling_->
crates().begin(); icrate != fecCabling_->
crates().end(); icrate++ ) {
166 for ( std::vector<SiStripFec>::const_iterator ifec = icrate->fecs().begin(); ifec != icrate->fecs().end(); ifec++ ) {
167 for ( std::vector<SiStripRing>::const_iterator iring = ifec->rings().begin(); iring != ifec->rings().end(); iring++ ) {
169 for ( std::vector<SiStripCcu>::const_iterator iccu = iring->ccus().begin(); iccu != iring->ccus().end(); iccu++ ) {
171 int key = icrate->fecCrate()*10000000+ifec->fecSlot()*100000+iring->fecRing()*1000+iccu->ccuAddr();
174 for ( std::vector<SiStripModule>::const_iterator imod = iccu->modules().begin(); imod != iccu->modules().end(); imod++ ) {
181 if(ccu==0)
std::cout <<key<<
" This ccu seems to have not been stored! " << std::endl;
else{ ccu->
nmod=nmod;ccu->
layer=layer;}
189 std::map<int , TmCcu *>::iterator i_ccu;
190 std::multimap<TmCcu*, TmModule*>::iterator it;
191 std::pair<std::multimap<TmCcu*, TmModule*>::iterator,std::multimap<TmCcu*, TmModule*>::iterator>
ret;
193 for( i_ccu=
ccuMap.begin();i_ccu !=
ccuMap.end(); i_ccu++){
194 TmCcu * ccu= i_ccu->second;
197 std::ostringstream outs;
198 std::ostringstream outs1;
202 for (it = ret.first; it != ret.second; ++it)
204 outs << (*it).second->idex <<
" ";
205 outs1 << (*it).second->getKey() <<
",";
208 ccu->
text=outs.str();
228 int npsu=0;
int nmod,nmodHV2,nmodHV3;
230 int dcs,branch,crate,board;
236 int rack_order[54]={0,1,0,2,0,3,0,
274 while(!LVfile.eof()) {
275 LVfile >> modId1 >> dcuId >> psIdinfo >> psinfo;
277 if(detCabling && detCabling->
getConnections(modId1).size()==0)
continue;
286 dcs= atoi(dcsinfo.c_str());
287 branch= atoi(branchinfo.c_str());
288 crate= atoi(crateinfo.c_str())+1;
289 board= atoi(boardinfo.c_str())+1;
290 rack = (branch+1)+(dcs-1)*6;
291 rack = rack_order[rack];
292 channel = atoi(channelinfo.c_str());
294 int key = rack*1000+crate*100+board;
299 psu =
new TmPsu(dcs,branch,rack,crate,board);
311 std::map<int , TmPsu *>::iterator ipsu;
312 std::multimap<TmPsu*, TmModule*>::iterator it;
313 std::pair<std::multimap<TmPsu*, TmModule*>::iterator,std::multimap<TmPsu*, TmModule*>::iterator>
ret;
317 TmPsu * psu= ipsu->second;
322 std::ostringstream outs;
323 std::ostringstream outs1;
325 std::ostringstream outs3;
326 std::ostringstream outs4;
328 std::ostringstream outs5;
329 std::ostringstream outs6;
334 if(enableHVProcessing){
346 for (it = ret.first; it != ret.second; ++it)
349 outs << (*it).second->idex <<
", ";
350 outs1 << (*it).second->getKey() <<
",";
352 if(enableHVProcessing){
353 if((*it).second->HVchannel==2){
355 outs3 << (*it).second->idex <<
", ";
356 outs4 << (*it).second->getKey() <<
",";}
357 else if((*it).second->HVchannel==3){
359 outs5 << (*it).second->idex <<
", ";
360 outs6 << (*it).second->getKey() <<
",";}
367 outs <<
"(" << psu->
nmod <<
")";
368 psu->
text=outs.str();
370 if(enableHVProcessing){
375 outs3 <<
"(" << psu->
nmodHV2 <<
")";
376 outs5 <<
"(" << psu->
nmodHV3 <<
")";
395 jsfilename=
"CommonTools/TrackerMap/data/trackermap.txt";
396 infilename=
"CommonTools/TrackerMap/data/tracker.dat";
415 jsfilename=
"CommonTools/TrackerMap/data/trackermap.txt";
416 infilename=
"CommonTools/TrackerMap/data/tracker.dat";
420 jsPath=
"CommonTools/TrackerMap/data/";
431 std::map<int , TmModule *>::iterator i_mod;
456 for (
int subdet=1; subdet <
ndet+1; subdet++){
457 for (
int detpart=1; detpart <
npart+1; detpart++){
459 for(
int layer=1; layer < nlayers+1; layer++){
462 int layer_g =
nlayer(subdet,detpart,layer);
465 if(subdet==3 && detpart!=2)
firstRing[layer_g-1]= 8-nrings;
491 for (
int layer=1; layer < 44; layer++){
496 if(mod !=0 )
delete mod;
506 std::map<int , TmApvPair *>::iterator i_apv;
507 for( i_apv=
apvMap.begin();i_apv !=
apvMap.end(); i_apv++){
513 std::map<int , TmCcu *>::iterator i_ccu;
514 for( i_ccu=
ccuMap.begin();i_ccu !=
ccuMap.end(); i_ccu++){
515 TmCcu * ccu= i_ccu->second;
519 std::map<int , TmPsu *>::iterator ipsu;
521 TmPsu * psu= ipsu->second;
539 double phi,
r,dx,dy, dy1;
540 double xp[4],yp[4],xp1,yp1;
541 double vhbot,vhtop,vhapo;
542 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};
543 double xt1,yt1,xs1=0.,ys1=0.,xt2,yt2,xs2,ys2,pv1,pv2;
560 if(mlay >12 && mlay <19){
562 xp[0]=r-vhtop;yp[0]=-vhapo;
563 xp[1]=r+vhtop;yp[1]=-vhapo;
564 xp[2]=r+vhtop;yp[2]=vhapo;
565 xp[3]=r-vhtop;yp[3]=vhapo;
568 xp[0]=r-vhapo;yp[0]=-vhbot;
569 xp[1]=r+vhapo;yp[1]=-vhtop;
570 xp[2]=r+vhapo;yp[2]=vhtop;
571 xp[3]=r-vhapo;yp[3]=vhbot;
573 for(
int j=0;
j<4;
j++){
574 xp1 = xp[
j]*
cos(phi)-yp[
j]*
sin(phi);
575 yp1 = xp[
j]*
sin(phi)+yp[
j]*
cos(phi);
576 xp[
j] = xp1;yp[
j]=yp1;
579 numod=mod->
idModule;
if(numod>100)numod=numod-100;
580 int vane = mod->
ring;
584 xt1=rmedio[mlay-31]; yt1=-vhtop/2.;
585 xs1 = xt1*
cos(phi)-yt1*
sin(phi);
586 ys1 = xt1*
sin(phi)+yt1*
cos(phi);
587 xt2=rmedio[mlay-31]; yt2=vhtop/2.;
588 xs2 = xt2*
cos(phi)-yt2*
sin(phi);
589 ys2 = xt2*
sin(phi)+yt2*
cos(phi);
592 if(mlay==31)dy1=0.39;
593 if(mlay==32)dy1=0.23;
594 if(mlay==33)dy1=0.16;
595 xp[0]=vane*(dx+dx/8.);yp[0]=numod*(dy1);
596 xp[1]=vane*(dx+dx/8.)+dx;yp[1]=numod*(dy1);
597 xp[2]=vane*(dx+dx/8.)+dx;yp[2]=numod*(dy1)+dy;
598 xp[3]=vane*(dx+dx/8.);yp[3]=numod*(dy1)+dy;
600 xt1=
r; yt1=-vhtop/2.;
601 xs1 = xt1*
cos(phi)-yt1*
sin(phi);
602 ys1 = xt1*
sin(phi)+yt1*
cos(phi);
604 xs2 = xt2*
cos(phi)-yt2*
sin(phi);
605 ys2 = xt2*
sin(phi)+yt2*
cos(phi);
608 if(fabs(pv1-pv2)>
M_PI && numod==1)pv1=pv1-2.*
M_PI;
609 if(fabs(pv1-pv2)>
M_PI && numod!=1)pv2=pv2+2.*
M_PI;
610 xp[0]=mod->
posz-vhapo/2.;yp[0]=4.2*pv1;
611 xp[1]=mod->
posz+vhapo/2.;yp[1]=4.2*pv1;
612 xp[2]=mod->
posz+vhapo/2. ;yp[2]=4.2*pv2;
613 xp[3]=mod->
posz-vhapo/2.;yp[3]=4.2*pv2;
628 for(
int j=0;
j<4;
j++){
633 sprintf(buffer,
"%X",mod->
idex);
637 red=(color>>16)&0xFF;
638 green=(color>>8)&0xFF;
644 if(
temporary_file) *svgfile << red <<
" " << green <<
" " << blue <<
" ";
else
645 *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=\"";
647 if(
temporary_file) *svgfile << 255 <<
" " << 255 <<
" " << 255 <<
" ";
else
648 *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=\"";
650 for(
int k=0;
k<
np;
k++){
652 *svgfile << xd[
k] <<
"," << yd[
k] <<
" " ;
654 if(
temporary_file)*svgfile << std::endl;
else *svgfile <<
"\" />" <<std::endl;
656 if(mod->
red>255)mod->
red=255;
660 *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=\"";
662 for(
int k=0;
k<
np;
k++){
664 *svgfile << xd[
k] <<
"," << yd[
k] <<
" " ;
666 if(
temporary_file)*svgfile << std::endl;
else *svgfile <<
"\" />" <<std::endl;
678 for (
int layer=1; layer < 44; layer++){
691 return std::make_pair(minval,maxval);
701 bool rangefound =
true;
704 std::vector<TPolyLine*> vp;
706 size_t found=filetype.find_last_of(
".");
707 filetype=filetype.substr(found+1);
708 found=outputfilename.find_last_of(
".");
709 outputfilename=outputfilename.substr(0,found);
713 std::ostringstream outs;
715 outs << outputfilename <<
".coor";
718 for (
int layer=1; layer < 44; layer++){
735 for (
int layer=1; layer < 44; layer++){
751 *
savefile <<
"<?xml version=\"1.0\" standalone=\"no\" ?>"<<std::endl;
752 *
savefile <<
"<svg xmlns=\"http://www.w3.org/2000/svg\""<<std::endl;
753 *
savefile <<
"xmlns:svg=\"http://www.w3.org/2000/svg\" "<<std::endl;
754 *
savefile <<
"xmlns:xlink=\"http://www.w3.org/1999/xlink\">"<<std::endl;
755 *
savefile <<
"<svg:svg id=\"mainMap\" x=\"0\" y=\"0\" viewBox=\"0 0 3100 1600"<<
"\" width=\""<<width<<
"\" height=\""<<height<<
"\">"<<std::endl;
756 *
savefile <<
"<svg:rect fill=\"lightblue\" stroke=\"none\" x=\"0\" y=\"0\" width=\"3100\" height=\"1600\" /> "<<std::endl;
757 *
savefile <<
"<svg:g id=\"tracker\" transform=\"translate(10,1500) rotate(270)\" style=\"fill:none;stroke:black;stroke-width:0;\"> "<<std::endl;
759 for (
int layer=1; layer < 44; layer++){
775 *
savefile <<
" <svg:text id=\"Title\" class=\"normalText\" x=\"300\" y=\"0\">"<<
title<<
"</svg:text>"<<std::endl;
783 *
savefile <<
"</svg:svg>"<<std::endl;
788 const char * command1;
789 std::string tempfilename = outputfilename +
".coor";
792 command1=command.c_str();
793 std::cout <<
"Executing " << command1 << std::endl;
799 int red,
green,blue,npoints,colindex,ncolor;
801 std::ifstream tempfile(tempfilename.c_str(),
std::ios::in);
802 TCanvas *MyC =
new TCanvas(
"MyC",
"TrackerMap",width,height);
803 gPad->SetFillColor(38);
807 else {gPad->Range(800,0,3800,1600);}
811 typedef std::map<int,int> ColorList;
813 ColorList::iterator pos;
815 std::cout<<
"tempfilename "<<tempfilename<<std::endl;
816 while(!tempfile.eof()) {
817 tempfile >> red >> green >> blue >> npoints;
818 colindex=red+green*1000+blue*1000000;
819 pos=colorList.find(colindex);
820 if(pos == colorList.end()){ colorList[colindex]=ncolor+100; col =gROOT->GetColor(ncolor+100);
821 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++;}
822 for (
int i=0;
i<npoints;
i++){
823 tempfile >> x[
i] >> y[
i];
827 if(ncolor>0 && ncolor<10000){
829 for(
int i=0;
i<ncolor;
i++){colors[
i]=
i+100;}
830 gStyle->SetPalette(ncolor,colors);
834 tempfile.seekg(0,std::ios::beg);
835 std::cout <<
"created palette with " << ncolor <<
" colors" << std::endl;
837 while(!tempfile.eof()) {
838 tempfile >> red >> green >> blue >> npoints;
839 for (
int i=0;
i<npoints;
i++){
840 tempfile >> x[
i] >> y[
i];
842 colindex=red+green*1000+blue*1000000;
843 pos=colorList.find(colindex);
844 if(pos != colorList.end()){
845 TPolyLine* pline =
new TPolyLine(npoints,y,x);
847 pline->SetFillColor(colorList[colindex]);
848 pline->SetLineWidth(0);
855 if(
onlyPixelFlag) {axis =
new TGaxis(-30,36,-30,1530,lminvalue,lmaxvalue,510,
"+L");}
856 else {axis =
new TGaxis(3660,36,3660,1530,lminvalue,lmaxvalue,510,
"+L");}
857 axis->SetLabelSize(0.02);
862 l.DrawLatex(950,1330,
"TID");
863 l.DrawLatex(2300,1330,
"TEC");
864 l.DrawLatex(300,1330,
"FPIX");
865 l.DrawLatex(20,560,
"BPIX L1");
866 l.DrawLatex(500,385,
"BPIX L2");
867 l.DrawLatex(500,945,
"BPIX L3");
870 if(
tkMapLog && (fulltitle.find(
"Log10 scale") == std::string::npos)) fulltitle +=
": Log10 scale";
872 else {l.DrawLatex(850,1500,fulltitle.c_str());}
874 else {l.DrawLatex(1730,40,
"-z");}
876 else {l.DrawLatex(1730,1360,
"+z");}
877 l.DrawLatex(1085,330,
"TIB L1");
878 l.DrawLatex(1085,1000,
"TIB L2");
879 l.DrawLatex(1585,330,
"TIB L3");
880 l.DrawLatex(1585,1000,
"TIB L4");
881 l.DrawLatex(2085,330,
"TOB L1");
882 l.DrawLatex(2085,1000,
"TOB L2");
883 l.DrawLatex(2585,330,
"TOB L3");
884 l.DrawLatex(2585,1000,
"TOB L4");
885 l.DrawLatex(3085,330,
"TOB L5");
886 l.DrawLatex(3085,1000,
"TOB L6");
887 TArrow arx(3448,1190,3448,1350,0.01,
"|>");
888 l.DrawLatex(3460,1350,
"x");
889 TArrow ary(3448,1190,3312,1190,0.01,
"|>");
890 l.DrawLatex(3312,1210,
"y");
891 TArrow arz(3485,373,3485,676,0.01,
"|>");
892 l.DrawLatex(3510,667,
"z");
893 TArrow arphi(3485,511,3037,511,0.01,
"|>");
894 l.DrawLatex(3023,520,
"#Phi");
898 arphi.SetLineWidth(3);
900 arx.SetX1(570);arx.SetX2(570);arx.SetY1(1190);arx.SetY2(1350);
901 l.DrawLatex(570+12,1190+160,
"x");
902 ary.SetX1(570);ary.SetX2(570-160);ary.SetY1(1190);ary.SetY2(1190);
903 l.DrawLatex(570-160,1190+30,
"y");
904 arz.SetX1(380);arz.SetX2(380);arz.SetY1(683-100);arz.SetY2(683+100);
905 l.DrawLatex(380+15,683+100-9,
"z");
906 arphi.SetX1(380);arphi.SetX2(380-390);arphi.SetY1(683);arphi.SetY2(683);
907 l.DrawLatex(380-390-14,683+9,
"#Phi");
917 std::cout <<
"printing " <<filename<< std::endl;
918 MyC->Print(filename.c_str());
922 MyC->Print(filename.c_str());
926 MyC->Print(filename.c_str());
929 command1=command.c_str();
930 std::cout <<
"Executing " << command1 << std::endl;
935 for(std::vector<TPolyLine*>::iterator pos1=vp.begin();pos1!=vp.end();pos1++){
951 double boxinitx=0., boxinity=0.;
964 xp[0]=boxinitx;yp[0]=boxinity;
965 xp[1]=boxinitx+dx;yp[1]=boxinity;
966 xp[2]=boxinitx+dx;yp[2]=boxinity + dy;
967 xp[3]=boxinitx;yp[3]=boxinity + dy;
968 for(
int j=0;
j<4;
j++){
974 sprintf(buffer,
"%X",apvPair->
mod->
idex);
976 s.erase(s.begin()+s.find(
"connected"),s.end());
979 if(apvPair->
red < 0){
980 if(apvPair->
count > 0) {
982 red=(color>>16)&0xFF;
983 green=(color>>8)&0xFF;
986 if(
temporary_file)*svgfile << red <<
" " << green <<
" " << blue <<
" ";
987 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=\"";
989 if(
temporary_file)*svgfile << 255 <<
" " << 255 <<
" " << 255 <<
" ";
990 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=\"";
993 if(apvPair->
red>255)apvPair->
red=255;
995 if(apvPair->
blue>255)apvPair->
blue=255;
997 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=\"";
1000 if(apvPair->
mod->
red < 0){
1003 red=(color>>16)&0xFF;
1004 green=(color>>8)&0xFF;
1006 if(
temporary_file)*svgfile << red <<
" " << green <<
" " << blue <<
" ";
1007 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=\"";
1009 if(
temporary_file)*svgfile << 255 <<
" " << 255 <<
" " << 255 <<
" ";
1010 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=\"";
1017 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=\"";
1021 for(
int k=0;
k<
np;
k++){
1023 else *svgfile << xd[
k] <<
"," << yd[
k] <<
" " ;
1026 else *svgfile <<
"\" />" <<std::endl;
1037 double boxinitx=0., boxinity=0.;
1039 int numccu_incolumn = 8;
1040 int numccu_inrow = 15;
1041 int numfec_incolumn = 5;
1042 int numfec_inrow = 4;
1043 boxinitx=boxinitx+(numfec_incolumn-(numfec_incrate-1)/numfec_inrow)*14.;
1044 boxinity=boxinity+(numfec_inrow-(numfec_incrate-1)%numfec_inrow)*16.;
1045 boxinity=boxinity+numccu_inrow-ccu->
mpos;
1046 boxinitx = boxinitx+numccu_incolumn-(int)(ccu->
getCcuRing()%numccu_incolumn);
1048 xp[0]=boxinitx;yp[0]=boxinity;
1049 xp[1]=boxinitx+dx;yp[1]=boxinity;
1050 xp[2]=boxinitx+dx;yp[2]=boxinity + dy;
1051 xp[3]=boxinitx;yp[3]=boxinity + dy;
1052 for(
int j=0;
j<4;
j++){
1058 sprintf(buffer,
"%X",ccu->
idex);
1062 s.erase(s.begin()+s.find(
"connected"),s.end());
1065 if(ccu->
count > 0) {
1067 red=(color>>16)&0xFF;
1068 green=(color>>8)&0xFF;
1071 if(
temporary_file)*svgfile << red <<
" " << green <<
" " << blue <<
" ";
1072 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=\"";
1074 if(
temporary_file)*svgfile << 255 <<
" " << 255 <<
" " << 255 <<
" ";
1075 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=\"";
1078 if(ccu->
red>255)ccu->
red=255;
1082 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=\"";
1085 for(
int k=0;
k<
np;
k++){
1087 else *svgfile << xd[
k] <<
"," << yd[
k] <<
" " ;
1090 else *svgfile <<
"\" />" <<std::endl;
1102 double boxinitx=0., boxinity=0.;
1108 xp[0]=boxinitx;yp[0]=boxinity;
1109 xp[1]=boxinitx+dx;yp[1]=boxinity;
1110 xp[2]=boxinitx+dx;yp[2]=boxinity + dy;
1111 xp[3]=boxinitx;yp[3]=boxinity + dy;
1114 for(
int j=0;
j<4;
j++){
1131 sprintf(buffer,
"%X",psu->
idex);
1133 s.erase(s.begin()+s.find(
"connected"),s.end());
1138 red=(color>>16)&0xFF;
1139 green=(color>>8)&0xFF;
1142 if(
temporary_file)*svgfile << red <<
" " << green <<
" " << blue <<
" ";
1143 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=\"";
1147 if(
temporary_file)*svgfile << 255 <<
" " << 255 <<
" " << 255 <<
" ";
1148 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=\"";
1153 if(psu->
red>255)psu->
red=255;
1157 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=\"";
1161 for(
int k=0;
k<
np;
k++){
1163 else *svgfile << xd[
k] <<
"," << yd[
k] <<
" " ;
1166 else *svgfile <<
"\" />" <<std::endl;
1179 double boxinitx=35, boxinity=12;
1180 double dx=1.1,dy=1.3;
1183 boxinity= boxinity+(18 - psu->
getPsuBoard())*1.75;
1185 xp[0]=boxinitx;yp[0]=boxinity;
1186 xp[1]=boxinitx+dx;yp[1]=boxinity;
1187 xp[2]=boxinitx+dx;yp[2]=boxinity + dy;
1188 xp[3]=boxinitx;yp[3]=boxinity + dy;
1191 for(
int j=0;
j<4;
j++){
1197 sprintf(buffer,
"%X",psu->
idex);
1199 s.erase(s.begin()+s.find(
"connected"),s.end());
1205 redHV2=(color>>16)&0xFF;
1206 greenHV2=(color>>8)&0xFF;
1207 blueHV2=(
color)&0xFF;
1209 if(
temporary_file)*svgfile << redHV2 <<
" " << greenHV2 <<
" " << blueHV2 <<
" ";
1210 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=\"";
1213 if(
temporary_file)*svgfile << 255 <<
" " << 255 <<
" " << 255 <<
" ";
1214 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=\"";
1223 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=\"";
1227 for(
int k=0;
k<
np;
k++){
1229 else *svgfile << xd[
k] <<
"," << yd[
k] <<
" " ;
1232 else *svgfile <<
"\" />" <<std::endl;
1246 double boxinitx=36.5, boxinity=12;
1247 double dx=1.1,dy=1.3;
1250 boxinity= boxinity+(18 - psu->
getPsuBoard())*1.75;
1252 xp[0]=boxinitx;yp[0]=boxinity;
1253 xp[1]=boxinitx+dx;yp[1]=boxinity;
1254 xp[2]=boxinitx+dx;yp[2]=boxinity + dy;
1255 xp[3]=boxinitx;yp[3]=boxinity + dy;
1258 for(
int j=0;
j<4;
j++){
1264 sprintf(buffer,
"%X",psu->
idex);
1266 s.erase(s.begin()+s.find(
"connected"),s.end());
1271 redHV3=(color>>16)&0xFF;
1272 greenHV3=(color>>8)&0xFF;
1273 blueHV3=(
color)&0xFF;
1275 if(
temporary_file)*svgfile << redHV3 <<
" " << greenHV3 <<
" " << blueHV3 <<
" ";
1276 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=\"";
1279 if(
temporary_file)*svgfile << 255 <<
" " << 255 <<
" " << 255 <<
" ";
1280 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=\"";
1289 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=\"";
1293 for(
int k=0;
k<
np;
k++){
1295 else *svgfile << xd[
k] <<
"," << yd[
k] <<
" " ;
1298 else *svgfile <<
"\" />" <<std::endl;
1306 std::vector<TPolyLine*> vp;
1308 size_t found=filetype.find_last_of(
".");
1309 filetype=filetype.substr(found+1);
1310 found=outputfilename.find_last_of(
".");
1311 outputfilename=outputfilename.substr(0,found);
1314 std::ostringstream outs;
1316 outs << outputfilename <<
".coor";
1318 std::map<int , TmCcu *>::iterator i_ccu;
1319 std::multimap<TmCcu*, TmModule*>::iterator it;
1320 std::pair<std::multimap<TmCcu*, TmModule*>::iterator,std::multimap<TmCcu*, TmModule*>::iterator>
ret;
1322 bool useCcuValue=
false;
1325 for( i_ccu=
ccuMap.begin();i_ccu !=
ccuMap.end(); i_ccu++){
1326 TmCcu * ccu= i_ccu->second;
1328 if(ccu->
count > 0 || ccu->
red!=-1) { useCcuValue=
true;
break;}
1334 for( i_ccu=
ccuMap.begin();i_ccu !=
ccuMap.end(); i_ccu++){
1335 TmCcu * ccu= i_ccu->second;
1338 for (it = ret.first; it != ret.second; ++it)
1340 if( (*it).second->count>0){ccu->
value=ccu->
value+(*it).second->value;ccu->
count++;}
1348 if(
title==
" Tracker Map from QTestAlarm"){
1349 for( i_ccu=
ccuMap.begin();i_ccu !=
ccuMap.end(); i_ccu++){
1350 TmCcu * ccu= i_ccu->second;
1354 for (it = ret.first; it != ret.second; ++it) {
1355 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 ) ){
1366 for( i_ccu=
ccuMap.begin();i_ccu !=
ccuMap.end(); i_ccu++){
1367 TmCcu * ccu= i_ccu->second;
1379 for( i_ccu=
ccuMap.begin();i_ccu !=
ccuMap.end(); i_ccu++){
1380 TmCcu * ccu= i_ccu->second;
1381 if(ccu!=0 && ccu->
count>0) {
1390 if(filetype==
"svg"){
1392 std::ostringstream outs;
1393 outs << outputfilename<<
".svg";
1395 *
savefile <<
"<?xml version=\"1.0\" standalone=\"no\" ?>"<<std::endl;
1396 *
savefile <<
"<svg xmlns=\"http://www.w3.org/2000/svg\""<<std::endl;
1397 *
savefile <<
"xmlns:svg=\"http://www.w3.org/2000/svg\" "<<std::endl;
1398 *
savefile <<
"xmlns:xlink=\"http://www.w3.org/1999/xlink\">"<<std::endl;
1399 *
savefile <<
"<svg:svg id=\"mainMap\" x=\"0\" y=\"0\" viewBox=\"0 0 3000 1600"<<
"\" width=\""<<width<<
"\" height=\""<<height<<
"\">"<<std::endl;
1400 *
savefile <<
"<svg:rect fill=\"lightblue\" stroke=\"none\" x=\"0\" y=\"0\" width=\"3000\" height=\"1600\" /> "<<std::endl;
1401 *
savefile <<
"<svg:g id=\"fedtrackermap\" transform=\"translate(10,1500) rotate(270)\" style=\"fill:none;stroke:black;stroke-width:0;\"> "<<std::endl;
1403 for (
int crate=1; crate < (
nfeccrates+1); crate++){
1404 if(filetype==
"xml"){
1406 std::ostringstream outs;
1407 outs << outputfilename<<
"feccrate" <<crate<<
".xml";
1409 *
savefile <<
"<?xml version=\"1.0\" standalone=\"no\"?>"<<std::endl;
1410 *
savefile <<
"<svg xmlns=\"http://www.w3.org/2000/svg\""<<std::endl;
1411 *
savefile <<
"xmlns:svg=\"http://www.w3.org/2000/svg\""<<std::endl;
1412 *
savefile <<
"xmlns:xlink=\"http://www.w3.org/1999/xlink\" >"<<std::endl;
1413 *
savefile <<
"<script type=\"text/ecmascript\" xlink:href=\"feccrate.js\" />"<<std::endl;
1414 *
savefile <<
"<svg id=\"mainMap\" x=\"0\" y=\"0\" viewBox=\"0 0 500 500\" width=\"700\" height=\"700\" onload=\"TrackerCrate.init()\">"<<std::endl;
1415 *
savefile <<
"<rect fill=\"lightblue\" stroke=\"none\" x=\"0\" y=\"0\" width=\"700\" height=\"700\" />"<<std::endl;
1416 *
savefile <<
"<g id=\"crate\" transform=\" translate(280,580) rotate(270) scale(.7,.8)\" > "<<std::endl;
1421 for ( i_ccu=
ccuMap.begin();i_ccu !=
ccuMap.end(); i_ccu++){
1422 TmCcu * ccu= i_ccu->second;
1432 if(filetype==
"xml"){
1433 *
savefile <<
"</g> </svg> <text id=\"currentElementText\" x=\"40\" y=\"30\"> " << std::endl;
1434 *
savefile <<
"<tspan id=\"line1\" x=\"40\" y=\"30\"> </tspan> " << std::endl;
1435 *
savefile <<
"<tspan id=\"line2\" x=\"40\" y=\"60\"> </tspan> " << std::endl;
1436 *
savefile <<
" </text> </svg>" << std::endl;
1442 if(filetype==
"svg"){
1443 *
savefile <<
"</g> </svg> </svg> " << std::endl;
1446 if(!print_total && !useCcuValue){
1448 for( i_ccu=
ccuMap.begin();i_ccu !=
ccuMap.end(); i_ccu++){
1449 TmCcu * ccu= i_ccu->second;
1459 const char * command1;
1460 std::string tempfilename = outputfilename +
".coor";
1461 int red,
green,blue,npoints,colindex,ncolor;
1463 std::ifstream tempfile(tempfilename.c_str(),
std::ios::in);
1464 TCanvas *MyC =
new TCanvas(
"MyC",
"TrackerMap",width,height);
1465 gPad->SetFillColor(38);
1467 if(
saveWebInterface)gPad->Range(0,0,3700,1600);
else gPad->Range(0,0,3800,1600);
1471 typedef std::map<int,int> ColorList;
1472 ColorList colorList;
1473 ColorList::iterator pos;
1475 while(!tempfile.eof()) {
1476 tempfile >> red >> green >> blue >> npoints;
1477 colindex=red+green*1000+blue*1000000;
1478 pos=colorList.find(colindex);
1479 if(pos == colorList.end()){
1480 colorList[colindex]=ncolor+100;
1481 col =gROOT->GetColor(ncolor+100);
1483 col->SetRGB((Double_t)(red/255.),(Double_t)(green/255.),(Double_t)(blue/255.));
1485 c =
new TColor(ncolor+100,(Double_t)(red/255.),(Double_t)(green/255.),(Double_t)(blue/255.));
1489 for (
int i=0;
i<npoints;
i++){
1490 tempfile >> x[
i] >> y[
i];
1493 if(ncolor>0 && ncolor<10000){
1495 for(
int i=0;
i<ncolor;
i++){colors[
i]=
i+100;}
1496 gStyle->SetPalette(ncolor,colors);
1499 tempfile.seekg(0,std::ios::beg);
1500 std::cout <<
"created palette with " << ncolor <<
" colors" << std::endl;
1501 while(!tempfile.eof()) {
1502 tempfile >> red >> green >> blue >> npoints;
1503 for (
int i=0;
i<npoints;
i++){
1504 tempfile >> x[
i] >> y[
i];
1506 colindex=red+green*1000+blue*1000000;
1507 pos=colorList.find(colindex);
1508 if(pos != colorList.end()){
1509 TPolyLine* pline =
new TPolyLine(npoints,y,x);
1510 vp.push_back(pline);
1511 pline->SetFillColor(colorList[colindex]);
1512 pline->SetLineWidth(0);
1519 axis =
new TGaxis(3660,36,3660,1530,lminvalue,lmaxvalue,510,
"+L");
1520 axis->SetLabelSize(0.02);
1526 l.SetTextSize(0.05);
1528 if(
tkMapLog && (fulltitle.find(
"Log10 scale") == std::string::npos)) fulltitle +=
": Log10 scale";
1529 l.DrawLatex(50,1530,fulltitle.c_str());
1532 std::cout <<
"Filetype " << filetype << std::endl;
1533 if(filetype==
"png"){
1535 MyC->Print(filename.c_str());
1537 if(filetype==
"jpg"){
1539 MyC->Print(filename.c_str());
1541 if(filetype==
"pdf"){
1543 MyC->Print(filename.c_str());
1546 command1=command.c_str();
1547 std::cout <<
"Executing " << command1 << std::endl;
1552 for(std::vector<TPolyLine*>::iterator pos1=vp.begin();pos1!=vp.end();pos1++){
1565 std::vector<TPolyLine*> vp;
1567 size_t found=filetype.find_last_of(
".");
1568 filetype=filetype.substr(found+1);
1569 found=outputfilename.find_last_of(
".");
1570 outputfilename=outputfilename.substr(0,found);
1577 std::ostringstream outs;
1579 outs << outputfilename <<
".coor";
1582 std::map<int , TmPsu *>::iterator ipsu;
1583 std::multimap<TmPsu*, TmModule*>::iterator it;
1584 std::pair<std::multimap<TmPsu*, TmModule*>::iterator,std::multimap<TmPsu*, TmModule*>::iterator>
ret;
1587 bool usePsuValue=
false;
1590 TmPsu* psu= ipsu->second;
1599 TmPsu * psu= ipsu->second;
1602 int nconn1=0;
int nconn2=0;
1603 for(it = ret.first; it != ret.second; ++it){
1604 if((*it).second->HVchannel==2&&(*it).second->count>0){ nconn1++;psu->
valueHV2=psu->
valueHV2+(*it).second->value;}
1605 if((*it).second->HVchannel==3&&(*it).second->count>0){ nconn2++;psu->
valueHV3=psu->
valueHV3+(*it).second->value;}
1615 if(
title==
" Tracker Map from QTestAlarm"){
1617 TmPsu * psu= ipsu->second;
1622 for (it = ret.first; it != ret.second; ++it) {
1623 if((*it).second->HVchannel==2){
1624 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 ) ){
1628 if((*it).second->HVchannel==3){
1629 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 ) ){
1640 TmPsu * psu= ipsu->second;
1656 TmPsu * psu= ipsu->second;
1667 if(filetype==
"svg"){
1669 std::ostringstream outs;
1670 outs << outputfilename<<
".svg";
1672 *
savefile <<
"<?xml version=\"1.0\" standalone=\"no\" ?>"<<std::endl;
1673 *
savefile <<
"<svg xmlns=\"http://www.w3.org/2000/svg\""<<std::endl;
1674 *
savefile <<
"xmlns:svg=\"http://www.w3.org/2000/svg\" "<<std::endl;
1675 *
savefile <<
"xmlns:xlink=\"http://www.w3.org/1999/xlink\">"<<std::endl;
1676 *
savefile <<
"<svg:svg id=\"mainMap\" x=\"0\" y=\"0\" viewBox=\"0 0 3000 1600"<<
"\" width=\""<<width<<
"\" height=\""<<height<<
"\">"<<std::endl;
1677 *
savefile <<
"<svg:rect fill=\"lightblue\" stroke=\"none\" x=\"0\" y=\"0\" width=\"3000\" height=\"1600\" /> "<<std::endl;
1678 *
savefile <<
"<svg:g id=\"HVtrackermap\" transform=\"translate(10,1500) rotate(270)\" style=\"fill:none;stroke:black;stroke-width:0;\"> "<<std::endl;
1681 for (
int irack=1; irack < (
npsuracks+1); irack++){
1682 if(filetype==
"xml"){
1684 std::ostringstream outs;
1685 outs << outputfilename<<
"HVrack" <<irack<<
".xml";
1687 *
savefile <<
"<?xml version=\"1.0\" standalone=\"no\"?>"<<std::endl;
1688 *
savefile <<
"<svg xmlns=\"http://www.w3.org/2000/svg\""<<std::endl;
1689 *
savefile <<
"xmlns:svg=\"http://www.w3.org/2000/svg\""<<std::endl;
1690 *
savefile <<
"xmlns:xlink=\"http://www.w3.org/1999/xlink\" >"<<std::endl;
1691 *
savefile <<
"<script type=\"text/ecmascript\" xlink:href=\"rackhv.js\" />"<<std::endl;
1692 *
savefile <<
"<svg id=\"mainMap\" x=\"0\" y=\"0\" viewBox=\"0 0 500 500\" width=\"700\" height=\"700\" onload=\"TrackerRackhv.init()\">"<<std::endl;
1693 *
savefile <<
"<rect fill=\"lightblue\" stroke=\"none\" x=\"0\" y=\"0\" width=\"700\" height=\"700\" />"<<std::endl;
1694 *
savefile <<
"<g id=\"rackhv\" transform=\" translate(150,500) rotate(270) scale(1.,1.)\" > "<<std::endl;
1699 for ( ipsu=
psuMap.begin();ipsu !=
psuMap.end(); ipsu++){
1700 TmPsu * psu= ipsu->second;
1703 drawHV3(irack,psu->getPsuCrate(),print_total,psu,
savefile,usePsuValue);
1709 if(filetype==
"xml"){
1710 *
savefile <<
"</g> </svg> <text id=\"currentElementText\" x=\"40\" y=\"30\"> " << std::endl;
1711 *
savefile <<
"<tspan id=\"line1\" x=\"40\" y=\"30\"> </tspan> " << std::endl;
1712 *
savefile <<
"<tspan id=\"line2\" x=\"40\" y=\"60\"> </tspan> " << std::endl;
1713 *
savefile <<
" </text> </svg>" << std::endl;
1719 if(filetype==
"svg"){
1720 *
savefile <<
"</g> </svg> </svg> " << std::endl;
1725 if(!print_total && !usePsuValue){
1727 TmPsu *psu = ipsu->second;
1740 const char * command1;
1741 std::string tempfilename = outputfilename +
".coor";
1742 int red,
green,blue,npoints,colindex,ncolor;
1744 std::ifstream tempfile(tempfilename.c_str(),
std::ios::in);
1745 TCanvas *MyC =
new TCanvas(
"MyC",
"TrackerMap",width,height);
1746 gPad->SetFillColor(38);
1748 if(
saveWebInterface)gPad->Range(0,0,3700,1600);
else gPad->Range(0,0,3800,1600);
1752 typedef std::map<int,int> ColorList;
1753 ColorList colorList;
1754 ColorList::iterator pos;
1756 while(!tempfile.eof()) {
1757 tempfile >> red >> green >> blue >> npoints;
1758 colindex=red+green*1000+blue*1000000;
1759 pos=colorList.find(colindex);
1760 if(pos == colorList.end()){
1761 colorList[colindex]=ncolor+100;
1762 col =gROOT->GetColor(ncolor+100);
1764 col->SetRGB((Double_t)(red/255.),(Double_t)(green/255.),(Double_t)(blue/255.));
1766 c =
new TColor(ncolor+100,(Double_t)(red/255.),(Double_t)(green/255.),(Double_t)(blue/255.));
1770 for (
int i=0;
i<npoints;
i++){
1771 tempfile >> x[
i] >> y[
i];
1774 if(ncolor>0 && ncolor<10000){
1776 for(
int i=0;
i<ncolor;
i++){colors[
i]=
i+100;}
1777 gStyle->SetPalette(ncolor,colors);
1780 tempfile.seekg(0,std::ios::beg);
1781 std::cout <<
"created palette with " << ncolor <<
" colors" << std::endl;
1782 while(!tempfile.eof()) {
1783 tempfile >> red >> green >> blue >> npoints;
1784 for (
int i=0;
i<npoints;
i++){
1785 tempfile >> x[
i] >> y[
i];
1787 colindex=red+green*1000+blue*1000000;
1788 pos=colorList.find(colindex);
1789 if(pos != colorList.end()){
1790 TPolyLine* pline =
new TPolyLine(npoints,y,x);
1791 vp.push_back(pline);
1792 pline->SetFillColor(colorList[colindex]);
1793 pline->SetLineWidth(0);
1800 axis =
new TGaxis(3660,36,3660,1530,lminvalue,lmaxvalue,510,
"+L");
1801 axis->SetLabelSize(0.02);
1808 l.SetTextSize(0.05);
1810 if(
tkMapLog && (fulltitle.find(
"Log10 scale") == std::string::npos)) fulltitle +=
": Log10 scale";
1811 l.DrawLatex(50,1530,fulltitle.c_str());
1814 std::cout <<
"Filetype " << filetype << std::endl;
1815 if(filetype==
"png"){
1817 MyC->Print(filename.c_str());
1819 if(filetype==
"jpg"){
1821 MyC->Print(filename.c_str());
1823 if(filetype==
"pdf"){
1825 MyC->Print(filename.c_str());
1828 command1=command.c_str();
1829 std::cout <<
"Executing " << command1 << std::endl;
1834 for(std::vector<TPolyLine*>::iterator pos1=vp.begin();pos1!=vp.end();pos1++){
1848 bool rangefound=
true;
1850 std::vector<TPolyLine*> vp;
1853 size_t found=filetype.find_last_of(
".");
1854 filetype=filetype.substr(found+1);
1855 found=outputfilename.find_last_of(
".");
1856 outputfilename=outputfilename.substr(0,found);
1864 std::ostringstream outs;
1866 outs << outputfilename <<
".coor";
1869 std::map<int , TmPsu *>::iterator ipsu;
1870 std::multimap<TmPsu*, TmModule*>::iterator it;
1871 std::pair<std::multimap<TmPsu*, TmModule*>::iterator,std::multimap<TmPsu*, TmModule*>::iterator>
ret;
1874 bool usePsuValue=
false;
1877 TmPsu* psu= ipsu->second;
1879 if(psu->
count > 0 || psu->
red!=-1) { usePsuValue=
true;
break;}
1885 TmPsu * psu= ipsu->second;
1889 for(it = ret.first; it != ret.second; ++it){
1890 if((*it).second->count>0){nconn++;psu->
value=psu->
value+(*it).second->value;}
1899 if(
title==
" Tracker Map from QTestAlarm"){
1901 TmPsu * psu= ipsu->second;
1907 for (it = ret.first; it != ret.second; ++it) {
1908 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 ) ){
1909 nconn++;psu->
value++;
1921 TmPsu * psu= ipsu->second;
1935 TmPsu * psu= ipsu->second;
1936 if(psu!=0 && psu->
count>0) {
1946 if(filetype==
"svg"){
1948 std::ostringstream outs;
1949 outs << outputfilename<<
".svg";
1951 *
savefile <<
"<?xml version=\"1.0\" standalone=\"no\" ?>"<<std::endl;
1952 *
savefile <<
"<svg xmlns=\"http://www.w3.org/2000/svg\""<<std::endl;
1953 *
savefile <<
"xmlns:svg=\"http://www.w3.org/2000/svg\" "<<std::endl;
1954 *
savefile <<
"xmlns:xlink=\"http://www.w3.org/1999/xlink\">"<<std::endl;
1955 *
savefile <<
"<svg:svg id=\"mainMap\" x=\"0\" y=\"0\" viewBox=\"0 0 3000 1600"<<
"\" width=\""<<width<<
"\" height=\""<<height<<
"\">"<<std::endl;
1956 *
savefile <<
"<svg:rect fill=\"lightblue\" stroke=\"none\" x=\"0\" y=\"0\" width=\"3000\" height=\"1600\" /> "<<std::endl;
1957 *
savefile <<
"<svg:g id=\"psutrackermap\" transform=\"translate(10,1500) rotate(270)\" style=\"fill:none;stroke:black;stroke-width:0;\"> "<<std::endl;
1960 for (
int irack=1; irack < (
npsuracks+1); irack++){
1961 if(filetype==
"xml"){
1963 std::ostringstream outs;
1964 outs << outputfilename<<
"psurack" <<irack<<
".xml";
1966 *
savefile <<
"<?xml version=\"1.0\" standalone=\"no\"?>"<<std::endl;
1967 *
savefile <<
"<svg xmlns=\"http://www.w3.org/2000/svg\""<<std::endl;
1968 *
savefile <<
"xmlns:svg=\"http://www.w3.org/2000/svg\""<<std::endl;
1969 *
savefile <<
"xmlns:xlink=\"http://www.w3.org/1999/xlink\" >"<<std::endl;
1970 *
savefile <<
"<script type=\"text/ecmascript\" xlink:href=\"rack.js\" />"<<std::endl;
1971 *
savefile <<
"<svg id=\"mainMap\" x=\"0\" y=\"0\" viewBox=\"0 0 500 500\" width=\"700\" height=\"700\" onload=\"TrackerCrate.init()\">"<<std::endl;
1972 *
savefile <<
"<rect fill=\"lightblue\" stroke=\"none\" x=\"0\" y=\"0\" width=\"700\" height=\"700\" />"<<std::endl;
1973 *
savefile <<
"<g id=\"rack\" transform=\" translate(150,500) rotate(270) scale(1.,1.)\" > "<<std::endl;
1979 for ( ipsu=
psuMap.begin();ipsu !=
psuMap.end(); ipsu++){
1980 TmPsu * psu= ipsu->second;
1989 if(filetype==
"xml"){
1990 *
savefile <<
"</g> </svg> <text id=\"currentElementText\" x=\"40\" y=\"30\"> " << std::endl;
1991 *
savefile <<
"<tspan id=\"line1\" x=\"40\" y=\"30\"> </tspan> " << std::endl;
1992 *
savefile <<
"<tspan id=\"line2\" x=\"40\" y=\"60\"> </tspan> " << std::endl;
1993 *
savefile <<
" </text> </svg>" << std::endl;
1999 if(filetype==
"svg"){
2000 *
savefile <<
"</g> </svg> </svg> " << std::endl;
2005 if(!print_total && !usePsuValue){
2007 TmPsu *psu = ipsu->second;
2022 const char * command1;
2023 std::string tempfilename = outputfilename +
".coor";
2024 int red,
green,blue,npoints,colindex,ncolor;
2026 std::ifstream tempfile(tempfilename.c_str(),
std::ios::in);
2027 TCanvas *MyC =
new TCanvas(
"MyC",
"TrackerMap",width,height);
2028 gPad->SetFillColor(38);
2031 std::cout <<
" range x " << rangex << std::endl;
2032 std::cout <<
" range y " << rangey << std::endl;
2033 gPad->Range(0,0,rangex,rangey);
2037 typedef std::map<int,int> ColorList;
2038 ColorList colorList;
2039 ColorList::iterator pos;
2041 while(!tempfile.eof()) {
2042 tempfile >> red >> green >> blue >> npoints;
2043 colindex=red+green*1000+blue*1000000;
2044 pos=colorList.find(colindex);
2045 if(pos == colorList.end()){
2046 colorList[colindex]=ncolor+100;
2047 col =gROOT->GetColor(ncolor+100);
2049 col->SetRGB((Double_t)(red/255.),(Double_t)(green/255.),(Double_t)(blue/255.));
2051 c =
new TColor(ncolor+100,(Double_t)(red/255.),(Double_t)(green/255.),(Double_t)(blue/255.));
2055 for (
int i=0;
i<npoints;
i++){
2056 tempfile >> x[
i] >> y[
i];
2059 if(ncolor>0 && ncolor<10000){
2061 for(
int i=0;
i<ncolor;
i++){colors[
i]=
i+100;}
2062 gStyle->SetPalette(ncolor,colors);
2065 tempfile.seekg(0,std::ios::beg);
2066 std::cout <<
"created palette with " << ncolor <<
" colors" << std::endl;
2067 while(!tempfile.eof()) {
2068 tempfile >> red >> green >> blue >> npoints;
2069 for (
int i=0;
i<npoints;
i++){
2070 tempfile >> x[
i] >> y[
i];
2072 colindex=red+green*1000+blue*1000000;
2073 pos=colorList.find(colindex);
2074 if(pos != colorList.end()){
2075 TPolyLine* pline =
new TPolyLine(npoints,y,x);
2076 vp.push_back(pline);
2077 pline->SetFillColor(colorList[colindex]);
2078 pline->SetLineWidth(0);
2085 axis =
new TGaxis(rangex-140,34,rangex-140,rangey-106,lminvalue,lmaxvalue,510,
"+L");
2086 axis->SetLabelSize(0.02);
2092 l.SetTextSize(0.05);
2094 if(
tkMapLog && (fulltitle.find(
"Log10 scale") == std::string::npos)) fulltitle +=
": Log10 scale";
2095 l.DrawLatex(50,rangey-200,fulltitle.c_str());
2098 std::cout <<
"Filetype " << filetype << std::endl;
2099 if(filetype==
"png"){
2101 MyC->Print(filename.c_str());
2103 if(filetype==
"jpg"){
2105 MyC->Print(filename.c_str());
2107 if(filetype==
"pdf"){
2109 MyC->Print(filename.c_str());
2112 command1=command.c_str();
2113 std::cout <<
"Executing " << command1 << std::endl;
2118 for(std::vector<TPolyLine*>::iterator pos1=vp.begin();pos1!=vp.end();pos1++){
2128 bool rangefound =
true;
2130 std::vector<TPolyLine*> vp;
2133 size_t found=filetype.find_last_of(
".");
2134 filetype=filetype.substr(found+1);
2135 found=outputfilename.find_last_of(
".");
2136 outputfilename=outputfilename.substr(0,found);
2140 std::ostringstream outs;
2142 outs << outputfilename <<
".coor";
2144 std::map<int , TmApvPair *>::iterator i_apv;
2145 std::map<int , int>::iterator i_fed;
2147 bool useApvPairValue=
false;
2148 for( i_apv=
apvMap.begin();i_apv !=
apvMap.end(); i_apv++){
2152 if(apv_mod !=0 && !apv_mod->
notInUse()){
2153 if(apvPair->
count > 0 || apvPair->
red!=-1) { useApvPairValue=
true;
break;}
2158 for( i_apv=
apvMap.begin();i_apv !=
apvMap.end(); i_apv++){
2162 if(apv_mod !=0 && !apv_mod->
notInUse() ){
2174 for(i_apv=
apvMap.begin();i_apv !=
apvMap.end(); i_apv++){
2178 if( apv_mod !=0 && !apv_mod->
notInUse() ){
2179 if(useApvPairValue){
2184 if(apv_mod->
count>0){
2195 if(filetype==
"svg"){
2197 std::ostringstream outs;
2198 outs << outputfilename<<
".svg";
2200 *
savefile <<
"<?xml version=\"1.0\" standalone=\"no\" ?>"<<std::endl;
2201 *
savefile <<
"<svg xmlns=\"http://www.w3.org/2000/svg\""<<std::endl;
2202 *
savefile <<
"xmlns:svg=\"http://www.w3.org/2000/svg\" "<<std::endl;
2203 *
savefile <<
"xmlns:xlink=\"http://www.w3.org/1999/xlink\">"<<std::endl;
2204 *
savefile <<
"<svg:svg id=\"mainMap\" x=\"0\" y=\"0\" viewBox=\"0 0 3000 1600"<<
"\" width=\""<<width<<
"\" height=\""<<height<<
"\">"<<std::endl;
2205 *
savefile <<
"<svg:rect fill=\"lightblue\" stroke=\"none\" x=\"0\" y=\"0\" width=\"3000\" height=\"1600\" /> "<<std::endl;
2206 *
savefile <<
"<svg:g id=\"fedtrackermap\" transform=\"translate(10,1500) rotate(270)\" style=\"fill:none;stroke:black;stroke-width:0;\"> "<<std::endl;
2209 if(filetype==
"xml"){
2211 std::ostringstream outs;
2212 outs << outputfilename<<
"crate" <<crate<<
".xml";
2214 *
savefile <<
"<?xml version=\"1.0\" standalone=\"no\"?>"<<std::endl;
2215 *
savefile <<
"<svg xmlns=\"http://www.w3.org/2000/svg\""<<std::endl;
2216 *
savefile <<
"xmlns:svg=\"http://www.w3.org/2000/svg\""<<std::endl;
2217 *
savefile <<
"xmlns:xlink=\"http://www.w3.org/1999/xlink\" >"<<std::endl;
2218 *
savefile <<
"<script type=\"text/ecmascript\" xlink:href=\"crate.js\" />"<<std::endl;
2219 *
savefile <<
"<svg id=\"mainMap\" x=\"0\" y=\"0\" viewBox=\"0 0 500 500\" width=\"700\" height=\"700\" onload=\"TrackerCrate.init()\">"<<std::endl;
2220 *
savefile <<
"<rect fill=\"lightblue\" stroke=\"none\" x=\"0\" y=\"0\" width=\"700\" height=\"700\" />"<<std::endl;
2221 *
savefile <<
"<g id=\"crate\" transform=\" translate(150,500) rotate(270) scale(1.,1.)\" > "<<std::endl;
2225 int numfed_incrate=0;
2226 for (i_fed=
fedMap.begin();i_fed !=
fedMap.end(); i_fed++){
2227 if(i_fed->second == crate){
2228 int fedId = i_fed->first;
2246 for (
int nconn=0;nconn<96;nconn++){
2247 int key = fedId*1000+nconn;
2251 if(apv_mod !=0 && !apv_mod->
notInUse()){
2259 if(filetype==
"xml"){
2260 *
savefile <<
"</g> </svg> <text id=\"currentElementText\" x=\"40\" y=\"30\"> " << std::endl;
2261 *
savefile <<
"<tspan id=\"line1\" x=\"40\" y=\"30\"> </tspan> " << std::endl;
2262 *
savefile <<
"<tspan id=\"line2\" x=\"40\" y=\"60\"> </tspan> " << std::endl;
2263 *
savefile <<
" </text> </svg>" << std::endl;
2269 if(filetype==
"svg"){
2270 *
savefile <<
"</g> </svg> </svg> " << std::endl;
2273 if(!print_total && !useApvPairValue){
2275 for( i_apv=
apvMap.begin();i_apv !=
apvMap.end(); i_apv++){
2279 if(apv_mod !=0 && apvPair->
mpos==0 && !apv_mod->
notInUse()){
2293 const char * command1;
2294 std::string tempfilename = outputfilename +
".coor";
2295 int red,
green,blue,npoints,colindex,ncolor;
2297 std::ifstream tempfile(tempfilename.c_str(),
std::ios::in);
2298 TCanvas *MyC =
new TCanvas(
"MyC",
"TrackerMap",width,height);
2299 gPad->SetFillColor(38);
2302 std::cout <<
" range x " << rangex << std::endl;
2303 std::cout <<
" range y " << rangey << std::endl;
2304 gPad->Range(0,0,rangex,rangey);
2308 typedef std::map<int,int> ColorList;
2309 ColorList colorList;
2310 ColorList::iterator pos;
2312 while(!tempfile.eof()) {
2313 tempfile >> red >> green >> blue >> npoints;
2314 colindex=red+green*1000+blue*1000000;
2315 pos=colorList.find(colindex);
2316 if(pos == colorList.end()){
2317 colorList[colindex]=ncolor+100;
2318 col =gROOT->GetColor(ncolor+100);
2320 col->SetRGB((Double_t)(red/255.),(Double_t)(green/255.),(Double_t)(blue/255.));
2322 c =
new TColor(ncolor+100,(Double_t)(red/255.),(Double_t)(green/255.),(Double_t)(blue/255.));
2326 for (
int i=0;
i<npoints;
i++){
2327 tempfile >> x[
i] >> y[
i];
2330 if(ncolor>0 && ncolor<10000){
2332 for(
int i=0;
i<ncolor;
i++){colors[
i]=
i+100;}
2333 gStyle->SetPalette(ncolor,colors);
2336 tempfile.seekg(0,std::ios::beg);
2337 std::cout <<
"created palette with " << ncolor <<
" colors" << std::endl;
2338 while(!tempfile.eof()) {
2339 tempfile >> red >> green >> blue >> npoints;
2340 for (
int i=0;
i<npoints;
i++){
2341 tempfile >> x[
i] >> y[
i];
2343 colindex=red+green*1000+blue*1000000;
2344 pos=colorList.find(colindex);
2345 if(pos != colorList.end()){
2346 TPolyLine* pline =
new TPolyLine(npoints,y,x);
2347 vp.push_back(pline);
2348 pline->SetFillColor(colorList[colindex]);
2349 pline->SetLineWidth(0);
2356 axis =
new TGaxis(rangex-140,34,rangex-140,rangey-106,lminvalue,lmaxvalue,510,
"+L");
2357 axis->SetLabelSize(0.02);
2363 l.SetTextSize(0.05);
2365 if(
tkMapLog && (fulltitle.find(
"Log10 scale") == std::string::npos)) fulltitle +=
": Log10 scale";
2366 l.DrawLatex(50,rangey-200,fulltitle.c_str());
2369 std::cout <<
"Filetype " << filetype << std::endl;
2370 if(filetype==
"png"){
2372 MyC->Print(filename.c_str());
2374 if(filetype==
"jpg"){
2376 MyC->Print(filename.c_str());
2378 if(filetype==
"pdf"){
2380 MyC->Print(filename.c_str());
2383 command1=command.c_str();
2384 std::cout <<
"Executing " << command1 << std::endl;
2389 for(std::vector<TPolyLine*>::iterator pos1=vp.begin();pos1!=vp.end();pos1++){
2400 int ipos,ipos1,ipos2,
id=0,val=0;
2404 ipos1 = line.find(
"value=\"");
2406 value = line.substr(ipos1+7,10);
2407 ipos = value.find(
"\"");
2408 value = value.substr(0,ipos);
2409 val=atoi(value.c_str());
2411 ipos2 = line.find(
"detid=\"");
2413 value = line.substr(ipos2+7,10);
2414 ipos = value.find(
"\"");
2415 value = value.substr(0,ipos);
2416 id = atoi(value.c_str());
2418 if(ipos1>0 && ipos2>0 && val>0)this->
fill(
id,val);
2419 if(ipos1>0 && ipos2>0)nline++;
2423 std::cout << nline <<
" modules found in this svg file " << std::endl;
2434 std::ostringstream outs;
2436 outs << outputfilename <<
".xml";
2442 while (getline( *jsfile, line ))
2444 *
svgfile << line << std::endl;
2446 jsfile->close();
delete jsfile;
2449 for (
int layer=1; layer < 44; layer++){
2464 for (
int layer=1; layer < 44; layer++){
2477 for (
int layer=1; layer < 44; layer++){
2490 *
svgfile <<
"</svg:g></svg:svg>"<<std::endl;
2491 *
svgfile <<
" <svg:text id=\"Title\" class=\"normalText\" x=\"300\" y=\"0\">"<<
title<<
"</svg:text>"<<std::endl;
2493 *
svgfile <<
"</svg:svg>"<<std::endl;
2494 *
svgfile <<
"</body></html>"<<std::endl;
2500 std::cout <<
"preparing the palette" << std::endl;
2503 int paletteLength = 250;
2504 int width=50*(yoffset-40)/1500;
2507 float step = float(yoffset-40)/float(paletteLength);
2508 for(
int i=1;
i<paletteLength+1;
i++){
2510 red=(color>>16)&0xFF;
2511 green=(color>>8)&0xFF;
2523 if(!
temporary_file)*svgfile <<
"<svg:rect x=\"3610\" y=\""<<(1550-6*
i)<<
"\" width=\"50\" height=\"6\" fill=\"rgb("<<red<<
","<<green<<
","<<blue<<
")\" />\n";
2524 else *svgfile << red <<
" " << green <<
" " << blue <<
" 4 " << int(step*
i)+34 <<
" " << xoffset-width <<
". " <<
2525 int(step*i)+34 <<
" " << xoffset <<
". " <<
2526 int(step*(i-1))+34 <<
" " << xoffset <<
". " <<
2527 int(step*(i-1))+34 <<
" " << xoffset-width <<
". " << std::endl;
2530 if(!
temporary_file)*svgfile <<
"<svg:rect x=\"3610\" y=\""<<(1550-6*
i)<<
"\" width=\"50\" height=\"1\" fill=\"black\" />\n";
2531 if(i%50==0&&!
temporary_file)*svgfile <<
" <svg:text class=\"normalText\" x=\"3660\" y=\""<<(1560-6*
i)<<
"\">" <<val<<
"</svg:text>"<<std::endl;
2539 int key = fedId*1000+fedCh;
2546 std::cout <<
"*** error in FedTrackerMap fillc method ***";
2551 std::multimap<const int, TmApvPair*>::iterator pos;
2561 std::cout <<
"*** error in FedTrackerMap fill by module method ***";
2566 int key = fedId*1000+fedCh;
2569 if(apvpair!=0) {apvpair->
value=current_val; apvpair->
count=1; apvpair->
red=-1;}
2571 std::cout <<
"*** error in FedTrackerMap fill_current_val method ***";
2577 int key =crate*10000000+slot*100000+ring*1000+addr;
2585 std::cout <<
"*** error in FecTrackerMap fillc method ***";
2590 int key =crate*10000000+slot*100000+ring*1000+addr;
2598 std::cout <<
"*** error in FecTrackerMap fill by module method ***";
2606 int key = rack*1000+crate*100+board;
2614 std::cout <<
"*** error in LVTrackerMap fillc method ***";
2619 int key = rack*1000+crate*100+board;
2627 std::cout <<
"*** error in LVTrackerMap fill by module method ***";
2633 int key = rack*1000+crate*100+board;
2641 std::cout <<
"*** error in HVTrackerMap (channel 2) fillc method ***";
2646 int key = rack*1000+crate*100+board;
2654 std::cout <<
"*** error in HVTrackerMap (channel 3) fillc method ***";
2660 int key = rack*1000+crate*100+board;
2668 std::cout <<
"*** error in HVTrackerMap fill by module method ***";
2672 int key = rack*1000+crate*100+board;
2680 std::cout <<
"*** error in HVTrackerMap fill by module method ***";
2689 int key = fedId*1000+fedCh;
2695 std::cout <<
"*** error in FedTrackerMap module method ***";
2699 int key = fedId*1000+fedCh;
2706 std::cout <<
"*** error inFedTrackerMap fill method ***";
2717 std::cout <<
"**************************error in fill method **************module "<<idmod<<std::endl;
2721 int key = layer*10000+ring*1000+nmod;
2728 std::cout <<
"**************************error in fill method **************"<< std::endl;
2733 std::map<const int , TmModule *>::iterator imod;
2735 fillc(imod->first,255,255,255);
2741 std::map<const int , TmModule *>::iterator imod;
2752 if(mod!=0) {mod->
value=current_val; mod->
count=1; mod->
red=-1;}
2753 else std::cout <<
"**error in fill_current_val method ***module "<<idmod<<std::endl;
2766 if(mod1!=0 && mod2!=0){
2773 std::cout <<
"**************************error in fill method **************module "<<idmod<<std::endl;
2778 int key = layer*100000+ring*1000+nmod;
2784 else std::cout <<
"**************************error in SvgModuleMap **************";
2793 else std::cout <<
"**************************error in IdModuleMap **************";
2799 int key = layer*100000+ring*1000+nmod;
2804 else std::cout <<
"**************************error in SvgModuleMap **************";
2810 int nmods, pix_sil, fow_bar,
ring, nmod, layer;
2812 float posx, posy, posz, length,
width, thickness, widthAtHalfLength;
2813 int iModule=0,old_layer=0, ntotMod =0;
2816 while(!infile.eof()) {
2817 infile >> nmods >> pix_sil >> fow_bar >> layer >> ring >> nmod >> posx >> posy
2818 >> posz>> length >> width >> thickness
2819 >> widthAtHalfLength >> idex ;
2820 getline(infile,dummys);
2821 getline(infile,name);
2822 if(old_layer!=layer){old_layer=layer;iModule=0;}
2825 int key=layer*100000+ring*1000+nmod;
2830 if(mod==0)
std::cout <<
"error in module "<<key <<std::endl;
2852 float lminvalue, lmaxvalue;
2857 red=0;green=0;blue=0;
2859 float delta=(lmaxvalue-lminvalue);
2860 float x =(value-lminvalue);
2861 if(value<lminvalue){red=0;green=0;blue=255;}
2862 if(value>lmaxvalue){red=255;green=0;blue=0;}
2863 if(value>=lminvalue&&value<=lmaxvalue){
2864 red = (int) ( x<(delta/2) ? 0 : ( x > ((3./4.)*
delta) ? 255 : 255/(delta/4) * (x-(2./4.)*
delta) ) );
2865 green= (int) ( x<delta/4 ? (x*255/(delta/4)) : ( x > ((3./4.)*
delta) ? 255-255/(delta/4) *(x-(3./4.)*
delta) : 255 ) );
2866 blue = (int) ( x<delta/4 ? 255 : ( x > ((1./2.)*
delta) ? 0 : 255-255/(delta/4) * (x-(1./4.)*
delta) ) );
2870 green = (int)((value-lminvalue)/(lmaxvalue-lminvalue)*256.);
2871 if (green > 255) green=255;
2872 red = 255; blue=0;green=255-
green;
2875 return(blue|(green<<8)|(red<<16));
2879 std::ofstream * ofilename;
2880 std::ifstream * ifilename;
2881 std::ostringstream ofname;
2886 ifilename=
findfile(
"viewerHeader.xhtml");
2887 ofname << outputfilename <<
"viewer.html";
2888 ofilename =
new std::ofstream(ofname.str().c_str(),
std::ios::out);
2889 while (getline( *ifilename, line )) { *ofilename << line << std::endl; }
2890 *ofilename <<
" var tmapname=\"" <<outputfilename <<
"\""<<std::endl;
2891 *ofilename <<
" var tmaptitle=\"" <<
title <<
"\""<<std::endl;
2892 *ofilename <<
" var ncrates=" <<
ncrates <<
";"<<std::endl;
2893 *ofilename <<
" var nfeccrates=" <<
nfeccrates <<
";"<<std::endl;
2894 *ofilename <<
" var npsuracks=" <<
npsuracks <<
";"<<std::endl;
2896 ifilename->close();
delete ifilename;
2898 ifilename=
findfile(
"viewerTrailer.xhtml");
2899 while (getline( *ifilename, line )) { *ofilename << line << std::endl; }
2900 ofilename->close();
delete ofilename;
2901 command =
"sed -i \"s/XtmapnameX/"+outputfilename+
"/g\" "+ ofname.str();
2902 std::cout <<
"Executing " << command << std::endl;
2903 system(command.c_str());
2904 command =
"sed -i \"s/XtmaptitleX/"+
title+
"/g\" "+ ofname.str();
2905 std::cout <<
"Executing " << command << std::endl;
2906 system(command.c_str());
2908 ifilename->close();
delete ifilename;
2911 ofname <<
"jqviewer.js";
2912 ofilename =
new std::ofstream(ofname.str().c_str(),
std::ios::out);
2913 while (getline( *ifilename, line )) { *ofilename << line << std::endl; }
2915 ofilename->close();
delete ofilename;
2916 ifilename->close();
delete ifilename;
2919 ofname <<
"crate.js";
2920 ofilename =
new std::ofstream(ofname.str().c_str(),
std::ios::out);
2921 while (getline( *ifilename, line )) { *ofilename << line << std::endl; }
2923 ofilename->close();
delete ofilename;
2924 ifilename->close();
delete ifilename;
2927 ofname <<
"feccrate.js";
2928 ofilename =
new std::ofstream(ofname.str().c_str(),
std::ios::out);
2929 while (getline( *ifilename, line )) { *ofilename << line << std::endl; }
2931 ofilename->close();
delete ofilename;
2932 ifilename->close();
delete ifilename;
2935 ofname <<
"layer.js";
2936 ofilename =
new std::ofstream(ofname.str().c_str(),
std::ios::out);
2937 while (getline( *ifilename, line )) { *ofilename << line << std::endl; }
2939 ofilename->close();
delete ofilename;
2940 ifilename->close();
delete ifilename;
2943 ofname <<
"rack.js";
2944 ofilename =
new std::ofstream(ofname.str().c_str(),
std::ios::out);
2945 while (getline( *ifilename, line )) { *ofilename << line << std::endl; }
2947 ofilename->close();
delete ofilename;
2948 ifilename->close();
delete ifilename;
2952 ofname <<
"rackhv.js";
2953 ofilename =
new std::ofstream(ofname.str().c_str(),
std::ios::out);
2954 while (getline( *ifilename, line )) { *ofilename << line << std::endl; }
2956 ofilename->close();
delete ofilename;
2957 ifilename->close();
delete ifilename;
2962 std::ostringstream outs,outs1,outs2;
2963 outs << outputfilename<<
".png";
2970 for (
int layer=1; layer < 44; layer++){
2971 std::ostringstream outs;
2972 outs << outputfilename <<
"layer"<<layer<<
".html";
2973 txtfile =
new std::ofstream(outs.str().c_str(),
std::ios::out);
2974 *txtfile <<
"<html><head></head> <body>" << std::endl;
2980 int idmod=mod->
idex;
2982 *txtfile <<
"<a name="<<idmod<<
"><pre>"<<std::endl;
2983 std::multimap<const int, TmApvPair*>::iterator pos;
2989 *txtfile << apvpair->
text << std::endl;
2993 *txtfile <<
"</pre><h3>"<< mod->
name<<
"</h3>"<<std::endl;
2997 *txtfile <<
"</body></html>" << std::endl;
2998 txtfile->close();
delete txtfile;
3001 outs1 << outputfilename<<
"fed.png";
3003 outs2 << outputfilename<<
".xml";
3006 std::map<int , int>::iterator i_fed;
3009 std::ostringstream outs;
3010 outs << outputfilename <<
"crate"<<crate<<
".html";
3011 txtfile =
new std::ofstream(outs.str().c_str(),
std::ios::out);
3012 *txtfile <<
"<html><head></head> <body>" << std::endl;
3013 for (i_fed=
fedMap.begin();i_fed !=
fedMap.end(); i_fed++){
3014 if(i_fed->second == crate){
3015 int fedId = i_fed->first;
3016 for (
int nconn=0;nconn<96;nconn++){
3017 int key = fedId*1000+nconn;
3020 int idmod=apvPair->
idex;
3021 *txtfile <<
"<a name="<<idmod<<
"><pre>"<<std::endl;
3022 *txtfile << apvPair->
text << std::endl;
3023 std::ostringstream outs;
3024 outs <<
"fedchannel " <<apvPair->
getFedId() <<
"/"<<apvPair->
getFedCh()<<
" connects to module " << apvPair->
mod->
idex ;
3025 *txtfile <<
"</pre><h3>"<< outs.str()<<
"</h3>"<<std::endl;
3030 *txtfile <<
"</body></html>" << std::endl;
3031 txtfile->close();
delete txtfile;
3035 std::ostringstream outs1,outs2;
3036 outs1 << outputfilename<<
"fec.png";
3038 outs2 << outputfilename<<
".xml";
3042 std::map<int , TmCcu *>::iterator i_ccu;
3043 std::multimap<TmCcu*, TmModule*>::iterator it;
3044 std::pair<std::multimap<TmCcu*, TmModule*>::iterator,std::multimap<TmCcu*, TmModule*>::iterator>
ret;
3045 for (
int crate=1; crate < (
nfeccrates+1); crate++){
3046 std::ostringstream outs;
3047 outs << outputfilename <<
"feccrate"<<crate<<
".html";
3048 txtfile =
new std::ofstream(outs.str().c_str(),
std::ios::out);
3049 *txtfile <<
"<html><head></head> <body>" << std::endl;
3050 for( i_ccu=
ccuMap.begin();i_ccu !=
ccuMap.end(); i_ccu++){
3051 TmCcu * ccu= i_ccu->second;
3053 int idmod=ccu->
idex;
3054 *txtfile <<
"<a name="<<idmod<<
"><pre>"<<std::endl;
3055 *txtfile << ccu->
text << std::endl;
3056 std::ostringstream outs;
3057 if(ccu->
nmod==0)outs <<
"ccu is in position" << ccu->
mpos<<
"in ring but doesn't seem to have any module connected";
else
3059 outs <<
"ccu is in position " << ccu->
mpos<<
" in ring and connects " <<ccu->
nmod<<
" modules" << std::endl;
3061 for (it = ret.first; it != ret.second; ++it)
3063 outs << (*it).second->idex<<
" " << (*it).second->name <<
" value= "<< (*it).second->value<<
"\n\n";
3066 *txtfile <<
"</pre><h4>"<< outs.str()<<
"</h4>"<<std::endl;
3070 *txtfile <<
"</body></html>" << std::endl;
3071 txtfile->close();
delete txtfile;
3075 std::ostringstream outs3,outs4;
3076 outs3 << outputfilename<<
"psu.png";
3079 outs4 << outputfilename<<
".xml";
3084 std::map<int , TmPsu *>::iterator ipsu;
3085 std::multimap<TmPsu*, TmModule*>::iterator it;
3086 std::pair<std::multimap<TmPsu*, TmModule*>::iterator,std::multimap<TmPsu*, TmModule*>::iterator>
ret;
3087 for (
int rack=1; rack < (
npsuracks+1); rack++){
3088 std::ostringstream outs;
3090 outs << outputfilename <<
"psurack"<<rack<<
".html";
3091 txtfile =
new std::ofstream(outs.str().c_str(),
std::ios::out);
3092 *txtfile <<
"<html><head></head> <body>" << std::endl;
3093 for ( ipsu=
psuMap.begin();ipsu !=
psuMap.end(); ipsu++){
3094 TmPsu * psu= ipsu->second;
3096 *txtfile <<
"<a name="<<psu->
idex<<
"><pre>"<<std::endl;
3097 *txtfile << psu->
text << std::endl;
3098 std::ostringstream outs;
3099 if(psu->
nmod==0)outs <<
"Ps is in position" << psu->
getPsuBoard()<<
"in crate but doesn't seem to have any module connected";
else
3101 outs<<
"PS is in position " <<psu->
getPsuBoard()<<
" in crate and connects to "<<psu->
nmod<<
" modules. "<<std::endl;
3104 for (it = ret.first; it != ret.second; ++it)
3106 outs <<(*it).second->idex <<
" "<< (*it).second->name<<
" value= "<<(*it).second->value<<
" <br>"<<std::endl;
3109 *txtfile <<
"</pre><h4>"<< outs.str()<<
"</h4>"<<std::endl;
3113 *txtfile <<
"</body></html>" << std::endl;
3114 txtfile->close();
delete txtfile;
3120 std::ostringstream outs5,outs6;
3121 outs5 << outputfilename<<
"hv.png";
3124 outs6 << outputfilename<<
".xml";
3129 std::map<int , TmPsu *>::iterator ipsu;
3130 std::multimap<TmPsu*, TmModule*>::iterator it;
3131 std::pair<std::multimap<TmPsu*, TmModule*>::iterator,std::multimap<TmPsu*, TmModule*>::iterator>
ret;
3132 for (
int rack=1; rack < (
npsuracks+1); rack++){
3133 std::ostringstream outs;
3135 outs << outputfilename <<
"HVrack"<<rack<<
".html";
3136 txtfile =
new std::ofstream(outs.str().c_str(),
std::ios::out);
3137 *txtfile <<
"<html><head></head> <body>" << std::endl;
3138 for ( ipsu=
psuMap.begin();ipsu !=
psuMap.end(); ipsu++){
3139 TmPsu * psu= ipsu->second;
3141 *txtfile <<
"<a name="<<psu->
idex<<
"><pre>"<<std::endl;
3142 *txtfile << psu->
textHV2 << std::endl;
3143 std::ostringstream outsHV2;
3144 if(psu->
nmodHV2==0)outsHV2 <<
"HV Channel002 is in position" << psu->
getPsuBoard()<<
"in crate but doesn't seem to have any module connected";
else
3146 outsHV2<<
"HV Channel002 is in position " <<psu->
getPsuBoard()<<
" in crate and connects to "<<psu->
nmodHV2<<
" modules. "<<
" <br>"<<std::endl;
3149 for (it = ret.first; it != ret.second; ++it)
3151 if((*it).second->HVchannel==2){outsHV2 <<(*it).second->idex <<
" "<< (*it).second->name<<
" value= "<<(*it).second->value<<
" <br>"<<std::endl;}
3153 *txtfile <<
"</pre><h4>"<< outsHV2.str()<<
"</h4>"<<std::endl;
3156 *txtfile << psu->
textHV3 << std::endl;
3157 std::ostringstream outsHV3;
3158 if(psu->
nmodHV3==0)outsHV3 <<
"HV Channel003 is in position" << psu->
getPsuBoard()<<
"in crate but doesn't seem to have any module connected";
else
3160 outsHV3<<
"HV Channel003 is in position " <<psu->
getPsuBoard()<<
" in crate and connects to "<<psu->
nmodHV3<<
" modules. "<<
" <br>"<<std::endl;
3163 for (it = ret.first; it != ret.second; ++it)
3165 if((*it).second->HVchannel==3){outsHV3 <<(*it).second->idex <<
" "<< (*it).second->name<<
" value= "<<(*it).second->value<<
" <br>"<<std::endl;}
3167 *txtfile <<
"</pre><h4>"<< outsHV3.str()<<
"</h4>"<<std::endl;
3172 *txtfile <<
"</body></html>" << std::endl;
3173 txtfile->close();
delete txtfile;
3180 float minval,maxval; minval=minval1; maxval=maxval1;
3181 if(
tkMapLog && (minval<maxval)) {minval=
pow(10.,minval1);maxval=
pow(10.,maxval1);}
3185 size_t found=filetype.find_last_of(
".");
3186 filetype=filetype.substr(found+1);
3187 found=outputfilename.find_last_of(
".");
3188 outputfilename=outputfilename.substr(0,found);
3190 std::ofstream * ofilename;
3191 std::ifstream * ifilename;
3192 std::ostringstream ofname;
3197 ifilename=
findfile(
"viewerHeader.xhtml");
3198 ofname << outputfilename <<
"viewer.html";
3199 ofilename =
new std::ofstream(ofname.str().c_str(),
std::ios::out);
3200 while (getline( *ifilename, line )) { *ofilename << line << std::endl; }
3201 *ofilename <<
" var tmapname=\"" <<outputfilename <<
"\""<<std::endl;
3202 *ofilename <<
" var tmaptitle=\"" <<
title <<
"\""<<std::endl;
3203 *ofilename <<
" var ncrates=" <<
ncrates <<
";"<<std::endl;
3204 *ofilename <<
" var nfeccrates=" <<
nfeccrates <<
";"<<std::endl;
3205 *ofilename <<
" var npsuracks=" <<
npsuracks <<
";"<<std::endl;
3206 ifilename->close();
delete ifilename;
3207 ifilename=
findfile(
"viewerTrailer.xhtml");
3208 while (getline( *ifilename, line )) { *ofilename << line << std::endl; }
3209 ofilename->close();
delete ofilename;
3210 ifilename->close();
delete ifilename;
3211 command =
"sed -i \"s/XtmapnameX/"+outputfilename+
"/g\" "+ ofname.str();
3212 std::cout <<
"Executing " << command << std::endl;
3213 system(command.c_str());
3214 command =
"sed -i \"s/XtmaptitleX/"+
title+
"/g\" "+ ofname.str();
3215 std::cout <<
"Executing " << command << std::endl;
3216 system(command.c_str());
3220 ofname <<
"jqviewer.js";
3221 ofilename =
new std::ofstream(ofname.str().c_str(),
std::ios::out);
3222 while (getline( *ifilename, line )) { *ofilename << line << std::endl; }
3223 ofilename->close();
delete ofilename;
3224 ifilename->close();
delete ifilename;
3228 ofname <<
"crate.js";
3229 ofilename =
new std::ofstream(ofname.str().c_str(),
std::ios::out);
3230 while (getline( *ifilename, line )) { *ofilename << line << std::endl; }
3231 ofilename->close();
delete ofilename;
3232 ifilename->close();
delete ifilename;
3236 ofname <<
"feccrate.js";
3237 ofilename =
new std::ofstream(ofname.str().c_str(),
std::ios::out);
3238 while (getline( *ifilename, line )) { *ofilename << line << std::endl; }
3239 ofilename->close();
delete ofilename;
3240 ifilename->close();
delete ifilename;
3244 ofname <<
"rack.js";
3245 ofilename =
new std::ofstream(ofname.str().c_str(),
std::ios::out);
3246 while (getline( *ifilename, line )) { *ofilename << line << std::endl; }
3247 ofilename->close();
delete ofilename;
3248 ifilename->close();
delete ifilename;
3252 ofname <<
"rackhv.js";
3253 ofilename =
new std::ofstream(ofname.str().c_str(),
std::ios::out);
3254 while (getline( *ifilename, line )) { *ofilename << line << std::endl; }
3255 ofilename->close();
delete ofilename;
3256 ifilename->close();
delete ifilename;
3260 ofname <<
"layer.js";
3261 ofilename =
new std::ofstream(ofname.str().c_str(),
std::ios::out);
3262 while (getline( *ifilename, line )) { *ofilename << line << std::endl; }
3263 ofilename->close();
delete ofilename;
3264 ifilename->close();
delete ifilename;
3266 command =
"scp -r ../../DQM/TrackerCommon/test/jquery/ .";
3267 std::cout <<
"Executing " << command << std::endl;
3268 system(command.c_str());
3269 command =
"scp -r ../../CommonTools/TrackerMap/data/images/ .";
3270 std::cout <<
"Executing " << command << std::endl;
3271 system(command.c_str());
3274 std::ostringstream outs;
3275 outs << outputfilename<<
".png";
3279 std::ostringstream outs;
3280 outs << outputfilename<<
".png";
3286 for (
int layer=1; layer < 44; layer++){
3287 std::ostringstream outs;
3288 outs << outputfilename <<
"layer"<<layer<<
".html";
3289 txtfile =
new std::ofstream(outs.str().c_str(),
std::ios::out);
3290 *txtfile <<
"<html><head></head> <body>" << std::endl;
3296 int idmod=mod->
idex;
3298 *txtfile <<
"<a name="<<idmod<<
"><pre>"<<std::endl;
3299 std::multimap<const int, TmApvPair*>::iterator pos;
3305 *txtfile << apvpair->
text << std::endl;
3309 *txtfile <<
"</pre><h3>"<< mod->
name<<
"</h3>"<<std::endl;
3313 *txtfile <<
"</body></html>" << std::endl;
3314 txtfile->close();
delete txtfile;
3318 std::ostringstream outs1,outs2;
3320 else outs1 << outputfilename<<
"fed."<<
filetype;
3323 outs2 << outputfilename<<
".xml";
3326 std::map<int , int>::iterator i_fed;
3329 std::ostringstream outs;
3330 outs << outputfilename <<
"crate"<<crate<<
".html";
3331 txtfile =
new std::ofstream(outs.str().c_str(),
std::ios::out);
3332 *txtfile <<
"<html><head></head> <body>" << std::endl;
3333 for (i_fed=
fedMap.begin();i_fed !=
fedMap.end(); i_fed++){
3334 if(i_fed->second == crate){
3335 int fedId = i_fed->first;
3336 for (
int nconn=0;nconn<96;nconn++){
3337 int key = fedId*1000+nconn;
3340 int idmod=apvPair->
idex;
3341 *txtfile <<
"<a name="<<idmod<<
"><pre>"<<std::endl;
3342 *txtfile << apvPair->
text << std::endl;
3343 std::ostringstream outs;
3344 outs <<
"fedchannel " <<apvPair->
getFedId() <<
"/"<<apvPair->
getFedCh()<<
" connects to module " << apvPair->
mod->
idex ;
3345 *txtfile <<
"</pre><h3>"<< outs.str()<<
"</h3>"<<std::endl;
3350 *txtfile <<
"</body></html>" << std::endl;
3351 txtfile->close();
delete txtfile;
3356 std::ostringstream outs1,outs2;
3358 else outs1 << outputfilename<<
"fec."<<
filetype;
3361 outs2 << outputfilename<<
".xml";
3365 std::map<int , TmCcu *>::iterator i_ccu;
3366 std::multimap<TmCcu*, TmModule*>::iterator it;
3367 std::pair<std::multimap<TmCcu*, TmModule*>::iterator,std::multimap<TmCcu*, TmModule*>::iterator>
ret;
3368 for (
int crate=1; crate < (
nfeccrates+1); crate++){
3369 std::ostringstream outs;
3370 outs << outputfilename <<
"feccrate"<<crate<<
".html";
3371 txtfile =
new std::ofstream(outs.str().c_str(),
std::ios::out);
3372 *txtfile <<
"<html><head></head> <body>" << std::endl;
3373 for( i_ccu=
ccuMap.begin();i_ccu !=
ccuMap.end(); i_ccu++){
3374 TmCcu * ccu= i_ccu->second;
3376 int idmod=ccu->
idex;
3377 *txtfile <<
"<a name="<<idmod<<
"><pre>"<<std::endl;
3378 *txtfile << ccu->
text << std::endl;
3379 std::ostringstream outs;
3380 if(ccu->
nmod==0)outs <<
"ccu is in position" << ccu->
mpos<<
"in ring but doesn't seem to have any module connected";
else
3382 outs <<
"ccu is in position " << ccu->
mpos<<
" in ring and connects " <<ccu->
nmod<<
" modules" << std::endl;
3384 for (it = ret.first; it != ret.second; ++it)
3386 outs << (*it).second->idex<<
" " << (*it).second->name <<
" value= "<< (*it).second->value<<
"\n\n";
3389 *txtfile <<
"</pre><h4>"<< outs.str()<<
"</h4>"<<std::endl;
3393 *txtfile <<
"</body></html>" << std::endl;
3399 std::ostringstream outs3,outs4;
3401 else outs3 << outputfilename<<
"psu."<<
filetype;
3404 outs4 << outputfilename<<
".xml";
3409 std::map<int , TmPsu *>::iterator ipsu;
3410 std::multimap<TmPsu*, TmModule*>::iterator it;
3411 std::pair<std::multimap<TmPsu*, TmModule*>::iterator,std::multimap<TmPsu*, TmModule*>::iterator>
ret;
3412 for (
int rack=1; rack < (
npsuracks+1); rack++){
3413 std::ostringstream outs;
3415 outs << outputfilename <<
"psurack"<<rack<<
".html";
3416 txtfile =
new std::ofstream(outs.str().c_str(),
std::ios::out);
3417 *txtfile <<
"<html><head></head> <body>" << std::endl;
3418 for ( ipsu=
psuMap.begin();ipsu !=
psuMap.end(); ipsu++){
3419 TmPsu * psu= ipsu->second;
3421 *txtfile <<
"<a name="<<psu->
idex<<
"><pre>"<<std::endl;
3422 *txtfile << psu->
text << std::endl;
3423 std::ostringstream outs;
3424 if(psu->
nmod==0)outs <<
"Ps is in position" << psu->
getPsuBoard()<<
"in crate but doesn't seem to have any module connected";
else
3426 outs<<
"PS is in position " <<psu->
getPsuBoard()<<
" in crate and connects to "<<psu->
nmod<<
" modules. "<<std::endl;
3429 for (it = ret.first; it != ret.second; ++it)
3431 outs <<(*it).second->idex <<
" "<< (*it).second->name<<
" value= "<<(*it).second->value<<
" <br>"<<std::endl;
3434 *txtfile <<
"</pre><h4>"<< outs.str()<<
"</h4>"<<std::endl;
3438 *txtfile <<
"</body></html>" << std::endl;
3446 std::ostringstream outs5,outs6;
3448 else outs5 << outputfilename<<
"hv."<<
filetype;
3451 outs6 << outputfilename<<
".xml";
3456 std::map<int , TmPsu *>::iterator ipsu;
3457 std::multimap<TmPsu*, TmModule*>::iterator it;
3458 std::pair<std::multimap<TmPsu*, TmModule*>::iterator,std::multimap<TmPsu*, TmModule*>::iterator>
ret;
3459 for (
int rack=1; rack < (
npsuracks+1); rack++){
3460 std::ostringstream outs;
3462 outs << outputfilename <<
"HVrack"<<rack<<
".html";
3463 txtfile =
new std::ofstream(outs.str().c_str(),
std::ios::out);
3464 *txtfile <<
"<html><head></head> <body>" << std::endl;
3465 for ( ipsu=
psuMap.begin();ipsu !=
psuMap.end(); ipsu++){
3466 TmPsu * psu= ipsu->second;
3468 *txtfile <<
"<a name="<<psu->
idex<<
"><pre>"<<std::endl;
3469 *txtfile << psu->
textHV2 << std::endl;
3470 std::ostringstream outsHV2;
3471 if(psu->
nmodHV2==0)outsHV2 <<
"HV Channel002 is in position" << psu->
getPsuBoard()<<
"in crate but doesn't seem to have any module connected";
else
3473 outsHV2<<
"HV Channel002 is in position " <<psu->
getPsuBoard()<<
" in crate and connects to "<<psu->
nmodHV2<<
" modules. "<<
" <br>"<<std::endl;
3476 for (it = ret.first; it != ret.second; ++it)
3478 if((*it).second->HVchannel==2){outsHV2 <<(*it).second->idex <<
" "<< (*it).second->name<<
" value= "<<(*it).second->value<<
" <br>"<<std::endl;}
3480 *txtfile <<
"</pre><h4>"<< outsHV2.str()<<
"</h4>"<<std::endl;
3483 *txtfile << psu->
textHV3 << std::endl;
3484 std::ostringstream outsHV3;
3485 if(psu->
nmodHV3==0)outsHV3 <<
"HV Channel003 is in position" << psu->
getPsuBoard()<<
"in crate but doesn't seem to have any module connected";
else
3487 outsHV3<<
"HV Channel003 is in position " <<psu->
getPsuBoard()<<
" in crate and connects to "<<psu->
nmodHV3<<
" modules. "<<
" <br>"<<std::endl;
3490 for (it = ret.first; it != ret.second; ++it)
3492 if((*it).second->HVchannel==3){outsHV3 <<(*it).second->idex <<
" "<< (*it).second->name<<
" value= "<<(*it).second->value<<
" <br>"<<std::endl;}
3494 *txtfile <<
"</pre><h4>"<< outsHV3.str()<<
"</h4>"<<std::endl;
3499 *txtfile <<
"</body></html>" << std::endl;
3510 std::ifstream * ifilename;
3516 ifname=
"CommonTools/TrackerMap/data/"+
filename;
3520 ifname=
"CommonTools/TrackerMap/data/"+
filename;
3523 if(!ifilename)
std::cout <<
"File " << filename <<
" missing" << std::endl;
3530 for (
int layer=1; layer < 44; layer++){
3545 for (
int layer=1; layer < 44; layer++){
3558 for (
int layer=1; layer < 44; layer++){
3559 std::ostringstream outs;
3560 outs << outputfilename <<
"layer"<<layer<<
".xml";
3561 xmlfile =
new std::ofstream(outs.str().c_str(),
std::ios::out);
3562 *xmlfile <<
"<?xml version=\"1.0\" standalone=\"no\"?>"<<std::endl;
3563 *xmlfile <<
"<svg xmlns=\"http://www.w3.org/2000/svg\""<<std::endl;
3564 *xmlfile <<
"xmlns:svg=\"http://www.w3.org/2000/svg\""<<std::endl;
3565 *xmlfile <<
"xmlns:xlink=\"http://www.w3.org/1999/xlink\" >"<<std::endl;
3566 *xmlfile <<
"<script type=\"text/ecmascript\" xlink:href=\"layer.js\" />"<<std::endl;
3567 *xmlfile <<
"<svg id=\"mainMap\" x=\"0\" y=\"0\" viewBox=\"0 0 500 500\" width=\"700\" height=\"700\" onload=\"TrackerLayer.init()\">"<<std::endl;
3568 if(layer<31)*xmlfile <<
"<g id=\"layer\" transform=\" translate(0,400) rotate(270) scale(1.,1.)\" > "<<std::endl;
3569 else *xmlfile <<
"<g id=\"layer\" transform=\" translate(0,400) rotate(270) scale(1.,0.8)\" > "<<std::endl;
3570 *xmlfile <<
"<rect fill=\"lightblue\" stroke=\"none\" x=\"0\" y=\"0\" width=\"700\" height=\"700\" />"<<std::endl;
3571 *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;
3572 *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;
3573 *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;
3574 *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;
3575 *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;
3584 drawModule(mod,key,layer,print_total,xmlfile);
3588 *xmlfile <<
"</g> </svg> <text id=\"currentElementText\" x=\"40\" y=\"30\">" << std::endl;
3589 *xmlfile <<
"<tspan id=\"line1\" x=\"40\" y=\"30\"> </tspan> " << std::endl;
3590 *xmlfile <<
"<tspan id=\"line2\" x=\"40\" y=\"60\"> </tspan> " << std::endl;
3591 *xmlfile <<
"<tspan id=\"line3\" x=\"40\" y=\"90\"> </tspan> " << std::endl;
3592 *xmlfile <<
"<tspan id=\"line4\" x=\"40\" y=\"120\"> </tspan> " << std::endl;
3594 *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;
3595 *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;
3596 *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;
3597 *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;
3598 *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;
3601 *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;
3602 *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;
3603 *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;
3604 *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;
3605 *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;
3607 *xmlfile <<
" </text> </svg>" << std::endl;
3608 xmlfile->close();
delete xmlfile;
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)
~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
tuple txtfile
Delete all three files at once to make sure the user never sees stale data (e.g.
#define NUMFEDCRATE_INROW
void fillc_fec_channel(int crate, int slot, int ring, int addr, int red, int green, int blue)
tuple xmlfile
Make an XML representation of the misalignment.
double xdpixelfec(double x)
const std::vector< const FedChannelConnection * > & getConnections(uint32_t det_id) const
double phival(double x, double y)
void fillc_lv_channel(int rack, int crate, int board, int red, int green, int blue)
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)
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()