17 #include "TPolyLine.h"
39 jsfilename=
"CommonTools/TrackerMap/data/trackermap.txt";
40 infilename=
"CommonTools/TrackerMap/data/tracker.dat";
71 std::cout<<
"SiStripFedCabling has "<<
feds.size()<<
" active FEDS"<<std::endl;
74 for(std::vector<unsigned short>::const_iterator ifed =
feds.begin();ifed<
feds.end();ifed++){
77 for(
auto iconn = theconn.begin();iconn<theconn.end();iconn++){
88 int key = iconn->fedId()*1000+iconn->fedCh();
90 if(apvpair!=0)
std::cout <<
"Fed "<< iconn->fedId() <<
" channel " << iconn->fedCh() <<
" seem to be already loaded!"<<std::endl;
96 if(
fedMap[iconn->fedId()]==0){
fedMap[iconn->fedId()]=iconn->fedCrate();}
97 if(
slotMap[iconn->fedId()]==0){
slotMap[iconn->fedId()]=iconn->fedSlot();}
98 if(ncrates==0 || ncrates < iconn->fedCrate()) ncrates = iconn->fedCrate();
103 apvpair =
new TmApvPair(key,iconn->fedCrate());
105 apvpair->
mpos=iconn->apvPairNumber();
107 apvModuleMap.insert(std::make_pair(iconn->detId(),apvpair));
110 apvpair->
text=s.str();
117 std::map<int , TmModule *>::iterator i_mod;
121 std::ostringstream outs,outs1;
122 outs <<
" connected to ";
127 std::multimap<const int, TmApvPair*>::iterator pos;
133 outs1 << apvpair->
idex+apvpair->
crate*1000000<<
",";
138 outs<<
"("<<nchan<<
")";
140 std::string s = outs1.str(); s.erase(s.end()-1,s.end());
147 int nfec=0;
int nccu;
int nmod;
148 int crate,slot,
ring,addr,pos;
154 while(!Ccufile.eof()) {
155 Ccufile >> crate >> slot >> ring >> addr >> pos;
156 getline(Ccufile,dummys);
157 int key =crate*10000000+slot*100000+ring*1000+addr;
160 ccu =
new TmCcu(crate,slot,ring,addr);
166 for ( std::vector<SiStripFecCrate>::const_iterator icrate = fecCabling_->
crates().begin(); icrate != fecCabling_->
crates().end(); icrate++ ) {
167 for ( std::vector<SiStripFec>::const_iterator ifec = icrate->fecs().begin(); ifec != icrate->fecs().end(); ifec++ ) {
168 for ( std::vector<SiStripRing>::const_iterator iring = ifec->rings().begin(); iring != ifec->rings().end(); iring++ ) {
170 for ( std::vector<SiStripCcu>::const_iterator iccu = iring->ccus().begin(); iccu != iring->ccus().end(); iccu++ ) {
172 int key = icrate->fecCrate()*10000000+ifec->fecSlot()*100000+iring->fecRing()*1000+iccu->ccuAddr();
175 for ( std::vector<SiStripModule>::const_iterator imod = iccu->modules().begin(); imod != iccu->modules().end(); imod++ ) {
182 if(ccu==0)
std::cout <<key<<
" This ccu seems to have not been stored! " << std::endl;
else{ ccu->
nmod=nmod;ccu->
layer=layer;}
190 std::map<int , TmCcu *>::iterator i_ccu;
191 std::multimap<TmCcu*, TmModule*>::iterator it;
192 std::pair<std::multimap<TmCcu*, TmModule*>::iterator,std::multimap<TmCcu*, TmModule*>::iterator>
ret;
194 for( i_ccu=
ccuMap.begin();i_ccu !=
ccuMap.end(); i_ccu++){
195 TmCcu * ccu= i_ccu->second;
198 std::ostringstream outs;
199 std::ostringstream outs1;
203 for (it = ret.first; it != ret.second; ++it)
205 outs << (*it).second->idex <<
" ";
206 outs1 << (*it).second->getKey() <<
",";
209 ccu->
text=outs.str();
229 int npsu=0;
int nmod,nmodHV2,nmodHV3;
231 int dcs,branch,crate,board;
237 int rack_order[54]={0,1,0,2,0,3,0,
275 while(!LVfile.eof()) {
276 LVfile >> modId1 >> dcuId >> psIdinfo >> psinfo;
278 if(detCabling && detCabling->
getConnections(modId1).size()==0)
continue;
287 dcs= atoi(dcsinfo.c_str());
288 branch= atoi(branchinfo.c_str());
289 crate= atoi(crateinfo.c_str())+1;
290 board= atoi(boardinfo.c_str())+1;
291 rack = (branch+1)+(dcs-1)*6;
292 rack = rack_order[rack];
293 channel = atoi(channelinfo.c_str());
295 int key = rack*1000+crate*100+board;
300 psu =
new TmPsu(dcs,branch,rack,crate,board);
312 std::map<int , TmPsu *>::iterator ipsu;
313 std::multimap<TmPsu*, TmModule*>::iterator it;
314 std::pair<std::multimap<TmPsu*, TmModule*>::iterator,std::multimap<TmPsu*, TmModule*>::iterator>
ret;
318 TmPsu * psu= ipsu->second;
323 std::ostringstream outs;
324 std::ostringstream outs1;
326 std::ostringstream outs3;
327 std::ostringstream outs4;
329 std::ostringstream outs5;
330 std::ostringstream outs6;
335 if(enableHVProcessing){
347 for (it = ret.first; it != ret.second; ++it)
350 outs << (*it).second->idex <<
", ";
351 outs1 << (*it).second->getKey() <<
",";
353 if(enableHVProcessing){
354 if((*it).second->HVchannel==2){
356 outs3 << (*it).second->idex <<
", ";
357 outs4 << (*it).second->getKey() <<
",";}
358 else if((*it).second->HVchannel==3){
360 outs5 << (*it).second->idex <<
", ";
361 outs6 << (*it).second->getKey() <<
",";}
368 outs <<
"(" << psu->
nmod <<
")";
369 psu->
text=outs.str();
371 if(enableHVProcessing){
376 outs3 <<
"(" << psu->
nmodHV2 <<
")";
377 outs5 <<
"(" << psu->
nmodHV3 <<
")";
396 jsfilename=
"CommonTools/TrackerMap/data/trackermap.txt";
397 infilename=
"CommonTools/TrackerMap/data/tracker.dat";
416 jsfilename=
"CommonTools/TrackerMap/data/trackermap.txt";
417 infilename=
"CommonTools/TrackerMap/data/tracker.dat";
421 jsPath=
"CommonTools/TrackerMap/data/";
432 std::map<int , TmModule *>::iterator i_mod;
457 for (
int subdet=1; subdet <
ndet+1; subdet++){
458 for (
int detpart=1; detpart <
npart+1; detpart++){
460 for(
int layer=1; layer < nlayers+1; layer++){
463 int layer_g =
nlayer(subdet,detpart,layer);
466 if(subdet==3 && detpart!=2)
firstRing[layer_g-1]= 8-nrings;
492 for (
int layer=1; layer < 44; layer++){
497 if(mod !=0 )
delete mod;
507 std::map<int , TmApvPair *>::iterator i_apv;
508 for( i_apv=
apvMap.begin();i_apv !=
apvMap.end(); i_apv++){
514 std::map<int , TmCcu *>::iterator i_ccu;
515 for( i_ccu=
ccuMap.begin();i_ccu !=
ccuMap.end(); i_ccu++){
516 TmCcu * ccu= i_ccu->second;
520 std::map<int , TmPsu *>::iterator ipsu;
522 TmPsu * psu= ipsu->second;
540 double phi,
r,dx,dy, dy1;
541 double xp[4],yp[4],xp1,yp1;
542 double vhbot,vhtop,vhapo;
543 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};
544 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;
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++){
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++){
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");
918 std::cout <<
"printing " <<filename<< std::endl;
919 MyC->Print(filename.c_str());
923 MyC->Print(filename.c_str());
927 MyC->Print(filename.c_str());
930 command1=command.c_str();
931 std::cout <<
"Executing " << command1 << std::endl;
936 for(std::vector<TPolyLine*>::iterator pos1=vp.begin();pos1!=vp.end();pos1++){
952 double boxinitx=0., boxinity=0.;
965 xp[0]=boxinitx;yp[0]=boxinity;
966 xp[1]=boxinitx+dx;yp[1]=boxinity;
967 xp[2]=boxinitx+dx;yp[2]=boxinity + dy;
968 xp[3]=boxinitx;yp[3]=boxinity + dy;
969 for(
int j=0;
j<4;
j++){
975 sprintf(buffer,
"%X",apvPair->
mod->
idex);
977 s.erase(s.begin()+s.find(
"connected"),s.end());
980 if(apvPair->
red < 0){
981 if(apvPair->
count > 0) {
983 red=(color>>16)&0xFF;
984 green=(color>>8)&0xFF;
987 if(
temporary_file)*svgfile << red <<
" " << green <<
" " << blue <<
" ";
988 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=\"";
990 if(
temporary_file)*svgfile << 255 <<
" " << 255 <<
" " << 255 <<
" ";
991 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=\"";
994 if(apvPair->
red>255)apvPair->
red=255;
996 if(apvPair->
blue>255)apvPair->
blue=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=\"rgb("<<apvPair->
red<<
","<<apvPair->
green<<
","<<apvPair->
blue<<
")\" points=\"";
1001 if(apvPair->
mod->
red < 0){
1004 red=(color>>16)&0xFF;
1005 green=(color>>8)&0xFF;
1007 if(
temporary_file)*svgfile << red <<
" " << green <<
" " << blue <<
" ";
1008 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=\"";
1010 if(
temporary_file)*svgfile << 255 <<
" " << 255 <<
" " << 255 <<
" ";
1011 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=\"";
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=\"rgb("<<apvPair->
mod->
red<<
","<<apvPair->
mod->
green<<
","<<apvPair->
mod->
blue<<
")\" points=\"";
1022 for(
int k=0;
k<
np;
k++){
1024 else *svgfile << xd[
k] <<
"," << yd[
k] <<
" " ;
1027 else *svgfile <<
"\" />" <<std::endl;
1038 double boxinitx=0., boxinity=0.;
1040 int numccu_incolumn = 8;
1041 int numccu_inrow = 15;
1042 int numfec_incolumn = 5;
1043 int numfec_inrow = 4;
1044 boxinitx=boxinitx+(numfec_incolumn-(numfec_incrate-1)/numfec_inrow)*14.;
1045 boxinity=boxinity+(numfec_inrow-(numfec_incrate-1)%numfec_inrow)*16.;
1046 boxinity=boxinity+numccu_inrow-ccu->
mpos;
1047 boxinitx = boxinitx+numccu_incolumn-(int)(ccu->
getCcuRing()%numccu_incolumn);
1049 xp[0]=boxinitx;yp[0]=boxinity;
1050 xp[1]=boxinitx+dx;yp[1]=boxinity;
1051 xp[2]=boxinitx+dx;yp[2]=boxinity + dy;
1052 xp[3]=boxinitx;yp[3]=boxinity + dy;
1053 for(
int j=0;
j<4;
j++){
1059 sprintf(buffer,
"%X",ccu->
idex);
1063 s.erase(s.begin()+s.find(
"connected"),s.end());
1066 if(ccu->
count > 0) {
1068 red=(color>>16)&0xFF;
1069 green=(color>>8)&0xFF;
1072 if(
temporary_file)*svgfile << red <<
" " << green <<
" " << blue <<
" ";
1073 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=\"";
1075 if(
temporary_file)*svgfile << 255 <<
" " << 255 <<
" " << 255 <<
" ";
1076 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=\"";
1079 if(ccu->
red>255)ccu->
red=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=\"rgb("<<ccu->
red<<
","<<ccu->
green<<
","<<ccu->
blue<<
")\" points=\"";
1086 for(
int k=0;
k<
np;
k++){
1088 else *svgfile << xd[
k] <<
"," << yd[
k] <<
" " ;
1091 else *svgfile <<
"\" />" <<std::endl;
1103 double boxinitx=0., boxinity=0.;
1109 xp[0]=boxinitx;yp[0]=boxinity;
1110 xp[1]=boxinitx+dx;yp[1]=boxinity;
1111 xp[2]=boxinitx+dx;yp[2]=boxinity + dy;
1112 xp[3]=boxinitx;yp[3]=boxinity + dy;
1115 for(
int j=0;
j<4;
j++){
1132 sprintf(buffer,
"%X",psu->
idex);
1134 s.erase(s.begin()+s.find(
"connected"),s.end());
1139 red=(color>>16)&0xFF;
1140 green=(color>>8)&0xFF;
1143 if(
temporary_file)*svgfile << red <<
" " << green <<
" " << blue <<
" ";
1144 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=\"";
1148 if(
temporary_file)*svgfile << 255 <<
" " << 255 <<
" " << 255 <<
" ";
1149 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=\"";
1154 if(psu->
red>255)psu->
red=255;
1158 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=\"";
1162 for(
int k=0;
k<
np;
k++){
1164 else *svgfile << xd[
k] <<
"," << yd[
k] <<
" " ;
1167 else *svgfile <<
"\" />" <<std::endl;
1180 double boxinitx=35, boxinity=12;
1181 double dx=1.1,dy=1.3;
1184 boxinity= boxinity+(18 - psu->
getPsuBoard())*1.75;
1186 xp[0]=boxinitx;yp[0]=boxinity;
1187 xp[1]=boxinitx+dx;yp[1]=boxinity;
1188 xp[2]=boxinitx+dx;yp[2]=boxinity + dy;
1189 xp[3]=boxinitx;yp[3]=boxinity + dy;
1192 for(
int j=0;
j<4;
j++){
1198 sprintf(buffer,
"%X",psu->
idex);
1200 s.erase(s.begin()+s.find(
"connected"),s.end());
1206 redHV2=(color>>16)&0xFF;
1207 greenHV2=(color>>8)&0xFF;
1208 blueHV2=(
color)&0xFF;
1210 if(
temporary_file)*svgfile << redHV2 <<
" " << greenHV2 <<
" " << blueHV2 <<
" ";
1211 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=\"";
1214 if(
temporary_file)*svgfile << 255 <<
" " << 255 <<
" " << 255 <<
" ";
1215 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=\"";
1224 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=\"";
1228 for(
int k=0;
k<
np;
k++){
1230 else *svgfile << xd[
k] <<
"," << yd[
k] <<
" " ;
1233 else *svgfile <<
"\" />" <<std::endl;
1247 double boxinitx=36.5, boxinity=12;
1248 double dx=1.1,dy=1.3;
1251 boxinity= boxinity+(18 - psu->
getPsuBoard())*1.75;
1253 xp[0]=boxinitx;yp[0]=boxinity;
1254 xp[1]=boxinitx+dx;yp[1]=boxinity;
1255 xp[2]=boxinitx+dx;yp[2]=boxinity + dy;
1256 xp[3]=boxinitx;yp[3]=boxinity + dy;
1259 for(
int j=0;
j<4;
j++){
1265 sprintf(buffer,
"%X",psu->
idex);
1267 s.erase(s.begin()+s.find(
"connected"),s.end());
1272 redHV3=(color>>16)&0xFF;
1273 greenHV3=(color>>8)&0xFF;
1274 blueHV3=(
color)&0xFF;
1276 if(
temporary_file)*svgfile << redHV3 <<
" " << greenHV3 <<
" " << blueHV3 <<
" ";
1277 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=\"";
1280 if(
temporary_file)*svgfile << 255 <<
" " << 255 <<
" " << 255 <<
" ";
1281 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=\"";
1290 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=\"";
1294 for(
int k=0;
k<
np;
k++){
1296 else *svgfile << xd[
k] <<
"," << yd[
k] <<
" " ;
1299 else *svgfile <<
"\" />" <<std::endl;
1307 std::vector<TPolyLine*> vp;
1309 size_t found=filetype.find_last_of(
".");
1310 filetype=filetype.substr(found+1);
1311 found=outputfilename.find_last_of(
".");
1312 outputfilename=outputfilename.substr(0,found);
1315 std::ostringstream outs;
1317 outs << outputfilename <<
".coor";
1319 std::map<int , TmCcu *>::iterator i_ccu;
1320 std::multimap<TmCcu*, TmModule*>::iterator it;
1321 std::pair<std::multimap<TmCcu*, TmModule*>::iterator,std::multimap<TmCcu*, TmModule*>::iterator>
ret;
1323 bool useCcuValue=
false;
1326 for( i_ccu=
ccuMap.begin();i_ccu !=
ccuMap.end(); i_ccu++){
1327 TmCcu * ccu= i_ccu->second;
1329 if(ccu->
count > 0 || ccu->
red!=-1) { useCcuValue=
true;
break;}
1335 for( i_ccu=
ccuMap.begin();i_ccu !=
ccuMap.end(); i_ccu++){
1336 TmCcu * ccu= i_ccu->second;
1339 for (it = ret.first; it != ret.second; ++it)
1341 if( (*it).second->count>0){ccu->
value=ccu->
value+(*it).second->value;ccu->
count++;}
1349 if(
title.find(
"QTestAlarm")!=std::string::npos){
1350 for( i_ccu=
ccuMap.begin();i_ccu !=
ccuMap.end(); i_ccu++){
1351 TmCcu * ccu= i_ccu->second;
1355 for (it = ret.first; it != ret.second; ++it) {
1356 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 ) ){
1367 for( i_ccu=
ccuMap.begin();i_ccu !=
ccuMap.end(); i_ccu++){
1368 TmCcu * ccu= i_ccu->second;
1380 for( i_ccu=
ccuMap.begin();i_ccu !=
ccuMap.end(); i_ccu++){
1381 TmCcu * ccu= i_ccu->second;
1382 if(ccu!=0 && ccu->
count>0) {
1391 if(filetype==
"svg"){
1393 std::ostringstream outs;
1394 outs << outputfilename<<
".svg";
1396 *
savefile <<
"<?xml version=\"1.0\" standalone=\"no\" ?>"<<std::endl;
1397 *
savefile <<
"<svg xmlns=\"http://www.w3.org/2000/svg\""<<std::endl;
1398 *
savefile <<
"xmlns:svg=\"http://www.w3.org/2000/svg\" "<<std::endl;
1399 *
savefile <<
"xmlns:xlink=\"http://www.w3.org/1999/xlink\">"<<std::endl;
1400 *
savefile <<
"<svg:svg id=\"mainMap\" x=\"0\" y=\"0\" viewBox=\"0 0 3000 1600"<<
"\" width=\""<<width<<
"\" height=\""<<height<<
"\">"<<std::endl;
1401 *
savefile <<
"<svg:rect fill=\"lightblue\" stroke=\"none\" x=\"0\" y=\"0\" width=\"3000\" height=\"1600\" /> "<<std::endl;
1402 *
savefile <<
"<svg:g id=\"fedtrackermap\" transform=\"translate(10,1500) rotate(270)\" style=\"fill:none;stroke:black;stroke-width:0;\"> "<<std::endl;
1404 for (
int crate=1; crate < (
nfeccrates+1); crate++){
1405 if(filetype==
"xml"){
1407 std::ostringstream outs;
1408 outs << outputfilename<<
"feccrate" <<crate<<
".xml";
1410 *
savefile <<
"<?xml version=\"1.0\" standalone=\"no\"?>"<<std::endl;
1411 *
savefile <<
"<svg xmlns=\"http://www.w3.org/2000/svg\""<<std::endl;
1412 *
savefile <<
"xmlns:svg=\"http://www.w3.org/2000/svg\""<<std::endl;
1413 *
savefile <<
"xmlns:xlink=\"http://www.w3.org/1999/xlink\" >"<<std::endl;
1414 *
savefile <<
"<script type=\"text/ecmascript\" xlink:href=\"feccrate.js\" />"<<std::endl;
1415 *
savefile <<
"<svg id=\"mainMap\" x=\"0\" y=\"0\" viewBox=\"0 0 500 500\" width=\"700\" height=\"700\" onload=\"TrackerCrate.init()\">"<<std::endl;
1416 *
savefile <<
"<rect fill=\"lightblue\" stroke=\"none\" x=\"0\" y=\"0\" width=\"700\" height=\"700\" />"<<std::endl;
1417 *
savefile <<
"<g id=\"crate\" transform=\" translate(280,580) rotate(270) scale(.7,.8)\" > "<<std::endl;
1422 for ( i_ccu=
ccuMap.begin();i_ccu !=
ccuMap.end(); i_ccu++){
1423 TmCcu * ccu= i_ccu->second;
1433 if(filetype==
"xml"){
1434 *
savefile <<
"</g> </svg> <text id=\"currentElementText\" x=\"40\" y=\"30\"> " << std::endl;
1435 *
savefile <<
"<tspan id=\"line1\" x=\"40\" y=\"30\"> </tspan> " << std::endl;
1436 *
savefile <<
"<tspan id=\"line2\" x=\"40\" y=\"60\"> </tspan> " << std::endl;
1437 *
savefile <<
" </text> </svg>" << std::endl;
1443 if(filetype==
"svg"){
1444 *
savefile <<
"</g> </svg> </svg> " << std::endl;
1447 if(!print_total && !useCcuValue){
1449 for( i_ccu=
ccuMap.begin();i_ccu !=
ccuMap.end(); i_ccu++){
1450 TmCcu * ccu= i_ccu->second;
1460 const char * command1;
1461 std::string tempfilename = outputfilename +
".coor";
1464 std::ifstream tempfile(tempfilename.c_str(),
std::ios::in);
1465 TCanvas *MyC =
new TCanvas(
"MyC",
"TrackerMap",width,height);
1466 gPad->SetFillColor(38);
1468 if(
saveWebInterface)gPad->Range(0,0,3700,1600);
else gPad->Range(0,0,3800,1600);
1472 typedef std::map<int,int> ColorList;
1473 ColorList colorList;
1474 ColorList::iterator pos;
1476 while(!tempfile.eof()) {
1477 tempfile >> red >> green >> blue >>
npoints;
1478 colindex=red+green*1000+blue*1000000;
1479 pos=colorList.find(colindex);
1480 if(pos == colorList.end()){
1481 colorList[colindex]=ncolor+100;
1482 col =gROOT->GetColor(ncolor+100);
1484 col->SetRGB((Double_t)(red/255.),(Double_t)(green/255.),(Double_t)(blue/255.));
1486 c =
new TColor(ncolor+100,(Double_t)(red/255.),(Double_t)(green/255.),(Double_t)(blue/255.));
1491 tempfile >> x[
i] >> y[
i];
1494 if(ncolor>0 && ncolor<10000){
1496 for(
int i=0;
i<ncolor;
i++){colors[
i]=
i+100;}
1497 gStyle->SetPalette(ncolor,colors);
1500 tempfile.seekg(0,std::ios::beg);
1501 std::cout <<
"created palette with " << ncolor <<
" colors" << std::endl;
1502 while(!tempfile.eof()) {
1503 tempfile >> red >> green >> blue >>
npoints;
1505 tempfile >> x[
i] >> y[
i];
1507 colindex=red+green*1000+blue*1000000;
1508 pos=colorList.find(colindex);
1509 if(pos != colorList.end()){
1510 TPolyLine* pline =
new TPolyLine(npoints,y,x);
1511 vp.push_back(pline);
1512 pline->SetFillColor(colorList[colindex]);
1513 pline->SetLineWidth(0);
1520 axis =
new TGaxis(3660,36,3660,1530,lminvalue,lmaxvalue,510,
"+L");
1521 axis->SetLabelSize(0.02);
1527 l.SetTextSize(0.05);
1529 if(
tkMapLog && (fulltitle.find(
"Log10 scale") == std::string::npos)) fulltitle +=
": Log10 scale";
1530 l.DrawLatex(50,1530,fulltitle.c_str());
1533 std::cout <<
"Filetype " << filetype << std::endl;
1534 if(filetype==
"png"){
1536 MyC->Print(filename.c_str());
1538 if(filetype==
"jpg"){
1540 MyC->Print(filename.c_str());
1542 if(filetype==
"pdf"){
1544 MyC->Print(filename.c_str());
1547 command1=command.c_str();
1548 std::cout <<
"Executing " << command1 << std::endl;
1553 for(std::vector<TPolyLine*>::iterator pos1=vp.begin();pos1!=vp.end();pos1++){
1566 std::vector<TPolyLine*> vp;
1568 size_t found=filetype.find_last_of(
".");
1569 filetype=filetype.substr(found+1);
1570 found=outputfilename.find_last_of(
".");
1571 outputfilename=outputfilename.substr(0,found);
1578 std::ostringstream outs;
1580 outs << outputfilename <<
".coor";
1583 std::map<int , TmPsu *>::iterator ipsu;
1584 std::multimap<TmPsu*, TmModule*>::iterator it;
1585 std::pair<std::multimap<TmPsu*, TmModule*>::iterator,std::multimap<TmPsu*, TmModule*>::iterator>
ret;
1588 bool usePsuValue=
false;
1591 TmPsu* psu= ipsu->second;
1600 TmPsu * psu= ipsu->second;
1603 int nconn1=0;
int nconn2=0;
1604 for(it = ret.first; it != ret.second; ++it){
1605 if((*it).second->HVchannel==2&&(*it).second->count>0){ nconn1++;psu->
valueHV2=psu->
valueHV2+(*it).second->value;}
1606 if((*it).second->HVchannel==3&&(*it).second->count>0){ nconn2++;psu->
valueHV3=psu->
valueHV3+(*it).second->value;}
1616 if(
title.find(
"QTestAlarm")!=std::string::npos){
1618 TmPsu * psu= ipsu->second;
1623 for (it = ret.first; it != ret.second; ++it) {
1624 if((*it).second->HVchannel==2){
1625 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 ) ){
1629 if((*it).second->HVchannel==3){
1630 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 ) ){
1641 TmPsu * psu= ipsu->second;
1657 TmPsu * psu= ipsu->second;
1668 if(filetype==
"svg"){
1670 std::ostringstream outs;
1671 outs << outputfilename<<
".svg";
1673 *
savefile <<
"<?xml version=\"1.0\" standalone=\"no\" ?>"<<std::endl;
1674 *
savefile <<
"<svg xmlns=\"http://www.w3.org/2000/svg\""<<std::endl;
1675 *
savefile <<
"xmlns:svg=\"http://www.w3.org/2000/svg\" "<<std::endl;
1676 *
savefile <<
"xmlns:xlink=\"http://www.w3.org/1999/xlink\">"<<std::endl;
1677 *
savefile <<
"<svg:svg id=\"mainMap\" x=\"0\" y=\"0\" viewBox=\"0 0 3000 1600"<<
"\" width=\""<<width<<
"\" height=\""<<height<<
"\">"<<std::endl;
1678 *
savefile <<
"<svg:rect fill=\"lightblue\" stroke=\"none\" x=\"0\" y=\"0\" width=\"3000\" height=\"1600\" /> "<<std::endl;
1679 *
savefile <<
"<svg:g id=\"HVtrackermap\" transform=\"translate(10,1500) rotate(270)\" style=\"fill:none;stroke:black;stroke-width:0;\"> "<<std::endl;
1682 for (
int irack=1; irack < (
npsuracks+1); irack++){
1683 if(filetype==
"xml"){
1685 std::ostringstream outs;
1686 outs << outputfilename<<
"HVrack" <<irack<<
".xml";
1688 *
savefile <<
"<?xml version=\"1.0\" standalone=\"no\"?>"<<std::endl;
1689 *
savefile <<
"<svg xmlns=\"http://www.w3.org/2000/svg\""<<std::endl;
1690 *
savefile <<
"xmlns:svg=\"http://www.w3.org/2000/svg\""<<std::endl;
1691 *
savefile <<
"xmlns:xlink=\"http://www.w3.org/1999/xlink\" >"<<std::endl;
1692 *
savefile <<
"<script type=\"text/ecmascript\" xlink:href=\"rackhv.js\" />"<<std::endl;
1693 *
savefile <<
"<svg id=\"mainMap\" x=\"0\" y=\"0\" viewBox=\"0 0 500 500\" width=\"700\" height=\"700\" onload=\"TrackerRackhv.init()\">"<<std::endl;
1694 *
savefile <<
"<rect fill=\"lightblue\" stroke=\"none\" x=\"0\" y=\"0\" width=\"700\" height=\"700\" />"<<std::endl;
1695 *
savefile <<
"<g id=\"rackhv\" transform=\" translate(150,500) rotate(270) scale(1.,1.)\" > "<<std::endl;
1700 for ( ipsu=
psuMap.begin();ipsu !=
psuMap.end(); ipsu++){
1701 TmPsu * psu= ipsu->second;
1704 drawHV3(irack,psu->getPsuCrate(),print_total,psu,
savefile,usePsuValue);
1710 if(filetype==
"xml"){
1711 *
savefile <<
"</g> </svg> <text id=\"currentElementText\" x=\"40\" y=\"30\"> " << std::endl;
1712 *
savefile <<
"<tspan id=\"line1\" x=\"40\" y=\"30\"> </tspan> " << std::endl;
1713 *
savefile <<
"<tspan id=\"line2\" x=\"40\" y=\"60\"> </tspan> " << std::endl;
1714 *
savefile <<
" </text> </svg>" << std::endl;
1720 if(filetype==
"svg"){
1721 *
savefile <<
"</g> </svg> </svg> " << std::endl;
1726 if(!print_total && !usePsuValue){
1728 TmPsu *psu = ipsu->second;
1741 const char * command1;
1742 std::string tempfilename = outputfilename +
".coor";
1745 std::ifstream tempfile(tempfilename.c_str(),
std::ios::in);
1746 TCanvas *MyC =
new TCanvas(
"MyC",
"TrackerMap",width,height);
1747 gPad->SetFillColor(38);
1749 if(
saveWebInterface)gPad->Range(0,0,3700,1600);
else gPad->Range(0,0,3800,1600);
1753 typedef std::map<int,int> ColorList;
1754 ColorList colorList;
1755 ColorList::iterator pos;
1757 while(!tempfile.eof()) {
1758 tempfile >> red >> green >> blue >>
npoints;
1759 colindex=red+green*1000+blue*1000000;
1760 pos=colorList.find(colindex);
1761 if(pos == colorList.end()){
1762 colorList[colindex]=ncolor+100;
1763 col =gROOT->GetColor(ncolor+100);
1765 col->SetRGB((Double_t)(red/255.),(Double_t)(green/255.),(Double_t)(blue/255.));
1767 c =
new TColor(ncolor+100,(Double_t)(red/255.),(Double_t)(green/255.),(Double_t)(blue/255.));
1772 tempfile >> x[
i] >> y[
i];
1775 if(ncolor>0 && ncolor<10000){
1777 for(
int i=0;
i<ncolor;
i++){colors[
i]=
i+100;}
1778 gStyle->SetPalette(ncolor,colors);
1781 tempfile.seekg(0,std::ios::beg);
1782 std::cout <<
"created palette with " << ncolor <<
" colors" << std::endl;
1783 while(!tempfile.eof()) {
1784 tempfile >> red >> green >> blue >>
npoints;
1786 tempfile >> x[
i] >> y[
i];
1788 colindex=red+green*1000+blue*1000000;
1789 pos=colorList.find(colindex);
1790 if(pos != colorList.end()){
1791 TPolyLine* pline =
new TPolyLine(npoints,y,x);
1792 vp.push_back(pline);
1793 pline->SetFillColor(colorList[colindex]);
1794 pline->SetLineWidth(0);
1801 axis =
new TGaxis(3660,36,3660,1530,lminvalue,lmaxvalue,510,
"+L");
1802 axis->SetLabelSize(0.02);
1809 l.SetTextSize(0.05);
1811 if(
tkMapLog && (fulltitle.find(
"Log10 scale") == std::string::npos)) fulltitle +=
": Log10 scale";
1812 l.DrawLatex(50,1530,fulltitle.c_str());
1815 std::cout <<
"Filetype " << filetype << std::endl;
1816 if(filetype==
"png"){
1818 MyC->Print(filename.c_str());
1820 if(filetype==
"jpg"){
1822 MyC->Print(filename.c_str());
1824 if(filetype==
"pdf"){
1826 MyC->Print(filename.c_str());
1829 command1=command.c_str();
1830 std::cout <<
"Executing " << command1 << std::endl;
1835 for(std::vector<TPolyLine*>::iterator pos1=vp.begin();pos1!=vp.end();pos1++){
1849 bool rangefound=
true;
1851 std::vector<TPolyLine*> vp;
1854 size_t found=filetype.find_last_of(
".");
1855 filetype=filetype.substr(found+1);
1856 found=outputfilename.find_last_of(
".");
1857 outputfilename=outputfilename.substr(0,found);
1865 std::ostringstream outs;
1867 outs << outputfilename <<
".coor";
1870 std::map<int , TmPsu *>::iterator ipsu;
1871 std::multimap<TmPsu*, TmModule*>::iterator it;
1872 std::pair<std::multimap<TmPsu*, TmModule*>::iterator,std::multimap<TmPsu*, TmModule*>::iterator>
ret;
1875 bool usePsuValue=
false;
1878 TmPsu* psu= ipsu->second;
1880 if(psu->
count > 0 || psu->
red!=-1) { usePsuValue=
true;
break;}
1886 TmPsu * psu= ipsu->second;
1890 for(it = ret.first; it != ret.second; ++it){
1891 if((*it).second->count>0){nconn++;psu->
value=psu->
value+(*it).second->value;}
1900 if(
title.find(
"QTestAlarm")!=std::string::npos){
1902 TmPsu * psu= ipsu->second;
1908 for (it = ret.first; it != ret.second; ++it) {
1909 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 ) ){
1910 nconn++;psu->
value++;
1922 TmPsu * psu= ipsu->second;
1936 TmPsu * psu= ipsu->second;
1937 if(psu!=0 && psu->
count>0) {
1947 if(filetype==
"svg"){
1949 std::ostringstream outs;
1950 outs << outputfilename<<
".svg";
1952 *
savefile <<
"<?xml version=\"1.0\" standalone=\"no\" ?>"<<std::endl;
1953 *
savefile <<
"<svg xmlns=\"http://www.w3.org/2000/svg\""<<std::endl;
1954 *
savefile <<
"xmlns:svg=\"http://www.w3.org/2000/svg\" "<<std::endl;
1955 *
savefile <<
"xmlns:xlink=\"http://www.w3.org/1999/xlink\">"<<std::endl;
1956 *
savefile <<
"<svg:svg id=\"mainMap\" x=\"0\" y=\"0\" viewBox=\"0 0 3000 1600"<<
"\" width=\""<<width<<
"\" height=\""<<height<<
"\">"<<std::endl;
1957 *
savefile <<
"<svg:rect fill=\"lightblue\" stroke=\"none\" x=\"0\" y=\"0\" width=\"3000\" height=\"1600\" /> "<<std::endl;
1958 *
savefile <<
"<svg:g id=\"psutrackermap\" transform=\"translate(10,1500) rotate(270)\" style=\"fill:none;stroke:black;stroke-width:0;\"> "<<std::endl;
1961 for (
int irack=1; irack < (
npsuracks+1); irack++){
1962 if(filetype==
"xml"){
1964 std::ostringstream outs;
1965 outs << outputfilename<<
"psurack" <<irack<<
".xml";
1967 *
savefile <<
"<?xml version=\"1.0\" standalone=\"no\"?>"<<std::endl;
1968 *
savefile <<
"<svg xmlns=\"http://www.w3.org/2000/svg\""<<std::endl;
1969 *
savefile <<
"xmlns:svg=\"http://www.w3.org/2000/svg\""<<std::endl;
1970 *
savefile <<
"xmlns:xlink=\"http://www.w3.org/1999/xlink\" >"<<std::endl;
1971 *
savefile <<
"<script type=\"text/ecmascript\" xlink:href=\"rack.js\" />"<<std::endl;
1972 *
savefile <<
"<svg id=\"mainMap\" x=\"0\" y=\"0\" viewBox=\"0 0 500 500\" width=\"700\" height=\"700\" onload=\"TrackerCrate.init()\">"<<std::endl;
1973 *
savefile <<
"<rect fill=\"lightblue\" stroke=\"none\" x=\"0\" y=\"0\" width=\"700\" height=\"700\" />"<<std::endl;
1974 *
savefile <<
"<g id=\"rack\" transform=\" translate(150,500) rotate(270) scale(1.,1.)\" > "<<std::endl;
1980 for ( ipsu=
psuMap.begin();ipsu !=
psuMap.end(); ipsu++){
1981 TmPsu * psu= ipsu->second;
1990 if(filetype==
"xml"){
1991 *
savefile <<
"</g> </svg> <text id=\"currentElementText\" x=\"40\" y=\"30\"> " << std::endl;
1992 *
savefile <<
"<tspan id=\"line1\" x=\"40\" y=\"30\"> </tspan> " << std::endl;
1993 *
savefile <<
"<tspan id=\"line2\" x=\"40\" y=\"60\"> </tspan> " << std::endl;
1994 *
savefile <<
" </text> </svg>" << std::endl;
2000 if(filetype==
"svg"){
2001 *
savefile <<
"</g> </svg> </svg> " << std::endl;
2006 if(!print_total && !usePsuValue){
2008 TmPsu *psu = ipsu->second;
2023 const char * command1;
2024 std::string tempfilename = outputfilename +
".coor";
2027 std::ifstream tempfile(tempfilename.c_str(),
std::ios::in);
2028 TCanvas *MyC =
new TCanvas(
"MyC",
"TrackerMap",width,height);
2029 gPad->SetFillColor(38);
2032 std::cout <<
" range x " << rangex << std::endl;
2033 std::cout <<
" range y " << rangey << std::endl;
2034 gPad->Range(0,0,rangex,rangey);
2038 typedef std::map<int,int> ColorList;
2039 ColorList colorList;
2040 ColorList::iterator pos;
2042 while(!tempfile.eof()) {
2043 tempfile >> red >> green >> blue >>
npoints;
2044 colindex=red+green*1000+blue*1000000;
2045 pos=colorList.find(colindex);
2046 if(pos == colorList.end()){
2047 colorList[colindex]=ncolor+100;
2048 col =gROOT->GetColor(ncolor+100);
2050 col->SetRGB((Double_t)(red/255.),(Double_t)(green/255.),(Double_t)(blue/255.));
2052 c =
new TColor(ncolor+100,(Double_t)(red/255.),(Double_t)(green/255.),(Double_t)(blue/255.));
2057 tempfile >> x[
i] >> y[
i];
2060 if(ncolor>0 && ncolor<10000){
2062 for(
int i=0;
i<ncolor;
i++){colors[
i]=
i+100;}
2063 gStyle->SetPalette(ncolor,colors);
2066 tempfile.seekg(0,std::ios::beg);
2067 std::cout <<
"created palette with " << ncolor <<
" colors" << std::endl;
2068 while(!tempfile.eof()) {
2069 tempfile >> red >> green >> blue >>
npoints;
2071 tempfile >> x[
i] >> y[
i];
2073 colindex=red+green*1000+blue*1000000;
2074 pos=colorList.find(colindex);
2075 if(pos != colorList.end()){
2076 TPolyLine* pline =
new TPolyLine(npoints,y,x);
2077 vp.push_back(pline);
2078 pline->SetFillColor(colorList[colindex]);
2079 pline->SetLineWidth(0);
2086 axis =
new TGaxis(rangex-140,34,rangex-140,rangey-106,lminvalue,lmaxvalue,510,
"+L");
2087 axis->SetLabelSize(0.02);
2093 l.SetTextSize(0.05);
2095 if(
tkMapLog && (fulltitle.find(
"Log10 scale") == std::string::npos)) fulltitle +=
": Log10 scale";
2096 l.DrawLatex(50,rangey-200,fulltitle.c_str());
2099 std::cout <<
"Filetype " << filetype << std::endl;
2100 if(filetype==
"png"){
2102 MyC->Print(filename.c_str());
2104 if(filetype==
"jpg"){
2106 MyC->Print(filename.c_str());
2108 if(filetype==
"pdf"){
2110 MyC->Print(filename.c_str());
2113 command1=command.c_str();
2114 std::cout <<
"Executing " << command1 << std::endl;
2119 for(std::vector<TPolyLine*>::iterator pos1=vp.begin();pos1!=vp.end();pos1++){
2129 bool rangefound =
true;
2131 std::vector<TPolyLine*> vp;
2134 size_t found=filetype.find_last_of(
".");
2135 filetype=filetype.substr(found+1);
2136 found=outputfilename.find_last_of(
".");
2137 outputfilename=outputfilename.substr(0,found);
2141 std::ostringstream outs;
2143 outs << outputfilename <<
".coor";
2145 std::map<int , TmApvPair *>::iterator i_apv;
2146 std::map<int , int>::iterator i_fed;
2148 bool useApvPairValue=
false;
2149 for( i_apv=
apvMap.begin();i_apv !=
apvMap.end(); i_apv++){
2153 if(apv_mod !=0 && !apv_mod->
notInUse()){
2154 if(apvPair->
count > 0 || apvPair->
red!=-1) { useApvPairValue=
true;
break;}
2159 for( i_apv=
apvMap.begin();i_apv !=
apvMap.end(); i_apv++){
2163 if(apv_mod !=0 && !apv_mod->
notInUse() ){
2175 for(i_apv=
apvMap.begin();i_apv !=
apvMap.end(); i_apv++){
2179 if( apv_mod !=0 && !apv_mod->
notInUse() ){
2180 if(useApvPairValue){
2185 if(apv_mod->
count>0){
2196 if(filetype==
"svg"){
2198 std::ostringstream outs;
2199 outs << outputfilename<<
".svg";
2201 *
savefile <<
"<?xml version=\"1.0\" standalone=\"no\" ?>"<<std::endl;
2202 *
savefile <<
"<svg xmlns=\"http://www.w3.org/2000/svg\""<<std::endl;
2203 *
savefile <<
"xmlns:svg=\"http://www.w3.org/2000/svg\" "<<std::endl;
2204 *
savefile <<
"xmlns:xlink=\"http://www.w3.org/1999/xlink\">"<<std::endl;
2205 *
savefile <<
"<svg:svg id=\"mainMap\" x=\"0\" y=\"0\" viewBox=\"0 0 3000 1600"<<
"\" width=\""<<width<<
"\" height=\""<<height<<
"\">"<<std::endl;
2206 *
savefile <<
"<svg:rect fill=\"lightblue\" stroke=\"none\" x=\"0\" y=\"0\" width=\"3000\" height=\"1600\" /> "<<std::endl;
2207 *
savefile <<
"<svg:g id=\"fedtrackermap\" transform=\"translate(10,1500) rotate(270)\" style=\"fill:none;stroke:black;stroke-width:0;\"> "<<std::endl;
2210 if(filetype==
"xml"){
2212 std::ostringstream outs;
2213 outs << outputfilename<<
"crate" <<crate<<
".xml";
2215 *
savefile <<
"<?xml version=\"1.0\" standalone=\"no\"?>"<<std::endl;
2216 *
savefile <<
"<svg xmlns=\"http://www.w3.org/2000/svg\""<<std::endl;
2217 *
savefile <<
"xmlns:svg=\"http://www.w3.org/2000/svg\""<<std::endl;
2218 *
savefile <<
"xmlns:xlink=\"http://www.w3.org/1999/xlink\" >"<<std::endl;
2219 *
savefile <<
"<script type=\"text/ecmascript\" xlink:href=\"crate.js\" />"<<std::endl;
2220 *
savefile <<
"<svg id=\"mainMap\" x=\"0\" y=\"0\" viewBox=\"0 0 500 500\" width=\"700\" height=\"700\" onload=\"TrackerCrate.init()\">"<<std::endl;
2221 *
savefile <<
"<rect fill=\"lightblue\" stroke=\"none\" x=\"0\" y=\"0\" width=\"700\" height=\"700\" />"<<std::endl;
2222 *
savefile <<
"<g id=\"crate\" transform=\" translate(150,500) rotate(270) scale(1.,1.)\" > "<<std::endl;
2226 int numfed_incrate=0;
2227 for (i_fed=
fedMap.begin();i_fed !=
fedMap.end(); i_fed++){
2228 if(i_fed->second == crate){
2229 int fedId = i_fed->first;
2247 for (
int nconn=0;nconn<96;nconn++){
2248 int key = fedId*1000+nconn;
2252 if(apv_mod !=0 && !apv_mod->
notInUse()){
2260 if(filetype==
"xml"){
2261 *
savefile <<
"</g> </svg> <text id=\"currentElementText\" x=\"40\" y=\"30\"> " << std::endl;
2262 *
savefile <<
"<tspan id=\"line1\" x=\"40\" y=\"30\"> </tspan> " << std::endl;
2263 *
savefile <<
"<tspan id=\"line2\" x=\"40\" y=\"60\"> </tspan> " << std::endl;
2264 *
savefile <<
" </text> </svg>" << std::endl;
2270 if(filetype==
"svg"){
2271 *
savefile <<
"</g> </svg> </svg> " << std::endl;
2274 if(!print_total && !useApvPairValue){
2276 for( i_apv=
apvMap.begin();i_apv !=
apvMap.end(); i_apv++){
2280 if(apv_mod !=0 && apvPair->
mpos==0 && !apv_mod->
notInUse()){
2294 const char * command1;
2295 std::string tempfilename = outputfilename +
".coor";
2298 std::ifstream tempfile(tempfilename.c_str(),
std::ios::in);
2299 TCanvas *MyC =
new TCanvas(
"MyC",
"TrackerMap",width,height);
2300 gPad->SetFillColor(38);
2303 std::cout <<
" range x " << rangex << std::endl;
2304 std::cout <<
" range y " << rangey << std::endl;
2305 gPad->Range(0,0,rangex,rangey);
2309 typedef std::map<int,int> ColorList;
2310 ColorList colorList;
2311 ColorList::iterator pos;
2313 while(!tempfile.eof()) {
2314 tempfile >> red >> green >> blue >>
npoints;
2315 colindex=red+green*1000+blue*1000000;
2316 pos=colorList.find(colindex);
2317 if(pos == colorList.end()){
2318 colorList[colindex]=ncolor+100;
2319 col =gROOT->GetColor(ncolor+100);
2321 col->SetRGB((Double_t)(red/255.),(Double_t)(green/255.),(Double_t)(blue/255.));
2323 c =
new TColor(ncolor+100,(Double_t)(red/255.),(Double_t)(green/255.),(Double_t)(blue/255.));
2328 tempfile >> x[
i] >> y[
i];
2331 if(ncolor>0 && ncolor<10000){
2333 for(
int i=0;
i<ncolor;
i++){colors[
i]=
i+100;}
2334 gStyle->SetPalette(ncolor,colors);
2337 tempfile.seekg(0,std::ios::beg);
2338 std::cout <<
"created palette with " << ncolor <<
" colors" << std::endl;
2339 while(!tempfile.eof()) {
2340 tempfile >> red >> green >> blue >>
npoints;
2342 tempfile >> x[
i] >> y[
i];
2344 colindex=red+green*1000+blue*1000000;
2345 pos=colorList.find(colindex);
2346 if(pos != colorList.end()){
2347 TPolyLine* pline =
new TPolyLine(npoints,y,x);
2348 vp.push_back(pline);
2349 pline->SetFillColor(colorList[colindex]);
2350 pline->SetLineWidth(0);
2357 axis =
new TGaxis(rangex-140,34,rangex-140,rangey-106,lminvalue,lmaxvalue,510,
"+L");
2358 axis->SetLabelSize(0.02);
2364 l.SetTextSize(0.05);
2366 if(
tkMapLog && (fulltitle.find(
"Log10 scale") == std::string::npos)) fulltitle +=
": Log10 scale";
2367 l.DrawLatex(50,rangey-200,fulltitle.c_str());
2370 std::cout <<
"Filetype " << filetype << std::endl;
2371 if(filetype==
"png"){
2373 MyC->Print(filename.c_str());
2375 if(filetype==
"jpg"){
2377 MyC->Print(filename.c_str());
2379 if(filetype==
"pdf"){
2381 MyC->Print(filename.c_str());
2384 command1=command.c_str();
2385 std::cout <<
"Executing " << command1 << std::endl;
2390 for(std::vector<TPolyLine*>::iterator pos1=vp.begin();pos1!=vp.end();pos1++){
2401 int ipos,ipos1,ipos2,
id=0,val=0;
2405 ipos1 = line.find(
"value=\"");
2407 value = line.substr(ipos1+7,10);
2408 ipos = value.find(
"\"");
2409 value = value.substr(0,ipos);
2410 val=atoi(value.c_str());
2412 ipos2 = line.find(
"detid=\"");
2414 value = line.substr(ipos2+7,10);
2415 ipos = value.find(
"\"");
2416 value = value.substr(0,ipos);
2417 id = atoi(value.c_str());
2419 if(ipos1>0 && ipos2>0 && val>0)this->
fill(
id,val);
2420 if(ipos1>0 && ipos2>0)nline++;
2424 std::cout << nline <<
" modules found in this svg file " << std::endl;
2435 std::ostringstream outs;
2437 outs << outputfilename <<
".xml";
2443 while (getline( *jsfile, line ))
2445 *
svgfile << line << std::endl;
2447 jsfile->close();
delete jsfile;
2450 for (
int layer=1; layer < 44; layer++){
2465 for (
int layer=1; layer < 44; layer++){
2478 for (
int layer=1; layer < 44; layer++){
2491 *
svgfile <<
"</svg:g></svg:svg>"<<std::endl;
2492 *
svgfile <<
" <svg:text id=\"Title\" class=\"normalText\" x=\"300\" y=\"0\">"<<
title<<
"</svg:text>"<<std::endl;
2494 *
svgfile <<
"</svg:svg>"<<std::endl;
2495 *
svgfile <<
"</body></html>"<<std::endl;
2501 std::cout <<
"preparing the palette" << std::endl;
2504 int paletteLength = 250;
2505 int width=50*(yoffset-40)/1500;
2508 float step = float(yoffset-40)/float(paletteLength);
2509 for(
int i=1;
i<paletteLength+1;
i++){
2511 red=(color>>16)&0xFF;
2512 green=(color>>8)&0xFF;
2524 if(!
temporary_file)*svgfile <<
"<svg:rect x=\"3610\" y=\""<<(1550-6*
i)<<
"\" width=\"50\" height=\"6\" fill=\"rgb("<<red<<
","<<green<<
","<<blue<<
")\" />\n";
2525 else *svgfile << red <<
" " << green <<
" " << blue <<
" 4 " << int(step*
i)+34 <<
" " << xoffset-width <<
". " <<
2526 int(step*i)+34 <<
" " << xoffset <<
". " <<
2527 int(step*(i-1))+34 <<
" " << xoffset <<
". " <<
2528 int(step*(i-1))+34 <<
" " << xoffset-width <<
". " << std::endl;
2531 if(!
temporary_file)*svgfile <<
"<svg:rect x=\"3610\" y=\""<<(1550-6*
i)<<
"\" width=\"50\" height=\"1\" fill=\"black\" />\n";
2532 if(i%50==0&&!
temporary_file)*svgfile <<
" <svg:text class=\"normalText\" x=\"3660\" y=\""<<(1560-6*
i)<<
"\">" <<val<<
"</svg:text>"<<std::endl;
2540 int key = fedId*1000+fedCh;
2547 std::cout <<
"*** error in FedTrackerMap fillc method ***";
2552 std::multimap<const int, TmApvPair*>::iterator pos;
2562 std::cout <<
"*** error in FedTrackerMap fill by module method ***";
2567 int key = fedId*1000+fedCh;
2570 if(apvpair!=0) {apvpair->
value=current_val; apvpair->
count=1; apvpair->
red=-1;}
2572 std::cout <<
"*** error in FedTrackerMap fill_current_val method ***";
2578 int key =crate*10000000+slot*100000+ring*1000+addr;
2586 std::cout <<
"*** error in FecTrackerMap fillc method ***";
2591 int key =crate*10000000+slot*100000+ring*1000+addr;
2599 std::cout <<
"*** error in FecTrackerMap fill by module method ***";
2607 int key = rack*1000+crate*100+board;
2615 std::cout <<
"*** error in LVTrackerMap fillc method ***";
2620 int key = rack*1000+crate*100+board;
2628 std::cout <<
"*** error in LVTrackerMap fill by module method ***";
2634 int key = rack*1000+crate*100+board;
2642 std::cout <<
"*** error in HVTrackerMap (channel 2) fillc method ***";
2647 int key = rack*1000+crate*100+board;
2655 std::cout <<
"*** error in HVTrackerMap (channel 3) fillc method ***";
2661 int key = rack*1000+crate*100+board;
2669 std::cout <<
"*** error in HVTrackerMap fill by module method ***";
2673 int key = rack*1000+crate*100+board;
2681 std::cout <<
"*** error in HVTrackerMap fill by module method ***";
2690 int key = fedId*1000+fedCh;
2696 std::cout <<
"*** error in FedTrackerMap module method ***";
2700 int key = fedId*1000+fedCh;
2707 std::cout <<
"*** error inFedTrackerMap fill method ***";
2718 std::cout <<
"**************************error in fill method **************module "<<idmod<<std::endl;
2722 int key = layer*10000+ring*1000+nmod;
2729 std::cout <<
"**************************error in fill method **************"<< std::endl;
2734 std::map<const int , TmModule *>::iterator imod;
2736 fillc(imod->first,255,255,255);
2742 std::map<const int , TmModule *>::iterator imod;
2753 if(mod!=0) {mod->
value=current_val; mod->
count=1; mod->
red=-1;}
2754 else std::cout <<
"**error in fill_current_val method ***module "<<idmod<<std::endl;
2767 if(mod1!=0 && mod2!=0){
2774 std::cout <<
"**************************error in fill method **************module "<<idmod<<std::endl;
2779 int key = layer*100000+ring*1000+nmod;
2785 else std::cout <<
"**************************error in SvgModuleMap **************";
2794 else std::cout <<
"**************************error in IdModuleMap **************";
2800 int key = layer*100000+ring*1000+nmod;
2805 else std::cout <<
"**************************error in SvgModuleMap **************";
2811 int nmods, pix_sil, fow_bar,
ring, nmod, layer;
2813 float posx, posy, posz, length,
width, thickness, widthAtHalfLength;
2814 int iModule=0,old_layer=0, ntotMod =0;
2817 while(!infile.eof()) {
2818 infile >> nmods >> pix_sil >> fow_bar >> layer >> ring >> nmod >> posx >> posy
2819 >> posz>> length >> width >> thickness
2820 >> widthAtHalfLength >> idex ;
2821 getline(infile,dummys);
2822 getline(infile,name);
2823 if(old_layer!=layer){old_layer=layer;iModule=0;}
2826 int key=layer*100000+ring*1000+nmod;
2831 if(mod==0)
std::cout <<
"error in module "<<key <<std::endl;
2853 float lminvalue, lmaxvalue;
2858 red=0;green=0;blue=0;
2860 float delta=(lmaxvalue-lminvalue);
2861 float x =(value-lminvalue);
2862 if(value<lminvalue){red=0;green=0;blue=255;}
2863 if(value>lmaxvalue){red=255;green=0;blue=0;}
2864 if(value>=lminvalue&&value<=lmaxvalue){
2865 red = (int) ( x<(delta/2) ? 0 : ( x > ((3./4.)*
delta) ? 255 : 255/(delta/4) * (x-(2./4.)*
delta) ) );
2866 green= (int) ( x<delta/4 ? (x*255/(delta/4)) : ( x > ((3./4.)*
delta) ? 255-255/(delta/4) *(x-(3./4.)*
delta) : 255 ) );
2867 blue = (int) ( x<delta/4 ? 255 : ( x > ((1./2.)*
delta) ? 0 : 255-255/(delta/4) * (x-(1./4.)*
delta) ) );
2871 green = (int)((value-lminvalue)/(lmaxvalue-lminvalue)*256.);
2872 if (green > 255) green=255;
2873 red = 255; blue=0;green=255-
green;
2876 return(blue|(green<<8)|(red<<16));
2880 std::ofstream * ofilename;
2881 std::ifstream * ifilename;
2882 std::ostringstream ofname;
2887 ifilename=
findfile(
"viewerHeader.xhtml");
2888 ofname << outputfilename <<
"viewer.html";
2889 ofilename =
new std::ofstream(ofname.str().c_str(),
std::ios::out);
2890 while (getline( *ifilename, line )) { *ofilename << line << std::endl; }
2891 *ofilename <<
" var tmapname=\"" <<outputfilename <<
"\""<<std::endl;
2892 *ofilename <<
" var tmaptitle=\"" <<
title <<
"\""<<std::endl;
2893 *ofilename <<
" var ncrates=" <<
ncrates <<
";"<<std::endl;
2894 *ofilename <<
" var nfeccrates=" <<
nfeccrates <<
";"<<std::endl;
2895 *ofilename <<
" var npsuracks=" <<
npsuracks <<
";"<<std::endl;
2897 ifilename->close();
delete ifilename;
2899 ifilename=
findfile(
"viewerTrailer.xhtml");
2900 while (getline( *ifilename, line )) { *ofilename << line << std::endl; }
2901 ofilename->close();
delete ofilename;
2902 command =
"sed -i \"s/XtmapnameX/"+outputfilename+
"/g\" "+ ofname.str();
2903 std::cout <<
"Executing " << command << std::endl;
2904 system(command.c_str());
2905 command =
"sed -i \"s/XtmaptitleX/"+
title+
"/g\" "+ ofname.str();
2906 std::cout <<
"Executing " << command << std::endl;
2907 system(command.c_str());
2909 ifilename->close();
delete ifilename;
2912 ofname <<
"jqviewer.js";
2913 ofilename =
new std::ofstream(ofname.str().c_str(),
std::ios::out);
2914 while (getline( *ifilename, line )) { *ofilename << line << std::endl; }
2916 ofilename->close();
delete ofilename;
2917 ifilename->close();
delete ifilename;
2920 ofname <<
"crate.js";
2921 ofilename =
new std::ofstream(ofname.str().c_str(),
std::ios::out);
2922 while (getline( *ifilename, line )) { *ofilename << line << std::endl; }
2924 ofilename->close();
delete ofilename;
2925 ifilename->close();
delete ifilename;
2928 ofname <<
"feccrate.js";
2929 ofilename =
new std::ofstream(ofname.str().c_str(),
std::ios::out);
2930 while (getline( *ifilename, line )) { *ofilename << line << std::endl; }
2932 ofilename->close();
delete ofilename;
2933 ifilename->close();
delete ifilename;
2936 ofname <<
"layer.js";
2937 ofilename =
new std::ofstream(ofname.str().c_str(),
std::ios::out);
2938 while (getline( *ifilename, line )) { *ofilename << line << std::endl; }
2940 ofilename->close();
delete ofilename;
2941 ifilename->close();
delete ifilename;
2944 ofname <<
"rack.js";
2945 ofilename =
new std::ofstream(ofname.str().c_str(),
std::ios::out);
2946 while (getline( *ifilename, line )) { *ofilename << line << std::endl; }
2948 ofilename->close();
delete ofilename;
2949 ifilename->close();
delete ifilename;
2953 ofname <<
"rackhv.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;
2963 std::ostringstream outs,outs1,outs2;
2964 outs << outputfilename<<
".png";
2971 for (
int layer=1; layer < 44; layer++){
2972 std::ostringstream outs;
2973 outs << outputfilename <<
"layer"<<layer<<
".html";
2974 txtfile =
new std::ofstream(outs.str().c_str(),
std::ios::out);
2975 *txtfile <<
"<html><head></head> <body>" << std::endl;
2983 *txtfile <<
"<a name="<<idmod<<
"><pre>"<<std::endl;
2984 std::multimap<const int, TmApvPair*>::iterator pos;
2990 *txtfile << apvpair->
text << std::endl;
2994 *txtfile <<
"</pre><h3>"<< mod->
name<<
"</h3>"<<std::endl;
2998 *txtfile <<
"</body></html>" << std::endl;
2999 txtfile->close();
delete txtfile;
3002 outs1 << outputfilename<<
"fed.png";
3004 outs2 << outputfilename<<
".xml";
3007 std::map<int , int>::iterator i_fed;
3010 std::ostringstream outs;
3011 outs << outputfilename <<
"crate"<<crate<<
".html";
3012 txtfile =
new std::ofstream(outs.str().c_str(),
std::ios::out);
3013 *txtfile <<
"<html><head></head> <body>" << std::endl;
3014 for (i_fed=
fedMap.begin();i_fed !=
fedMap.end(); i_fed++){
3015 if(i_fed->second == crate){
3016 int fedId = i_fed->first;
3017 for (
int nconn=0;nconn<96;nconn++){
3018 int key = fedId*1000+nconn;
3022 *txtfile <<
"<a name="<<idmod<<
"><pre>"<<std::endl;
3023 *txtfile << apvPair->
text << std::endl;
3024 std::ostringstream outs;
3025 outs <<
"fedchannel " <<apvPair->
getFedId() <<
"/"<<apvPair->
getFedCh()<<
" connects to module " << apvPair->
mod->
idex ;
3026 *txtfile <<
"</pre><h3>"<< outs.str()<<
"</h3>"<<std::endl;
3031 *txtfile <<
"</body></html>" << std::endl;
3032 txtfile->close();
delete txtfile;
3036 std::ostringstream outs1,outs2;
3037 outs1 << outputfilename<<
"fec.png";
3039 outs2 << outputfilename<<
".xml";
3043 std::map<int , TmCcu *>::iterator i_ccu;
3044 std::multimap<TmCcu*, TmModule*>::iterator it;
3045 std::pair<std::multimap<TmCcu*, TmModule*>::iterator,std::multimap<TmCcu*, TmModule*>::iterator>
ret;
3046 for (
int crate=1; crate < (
nfeccrates+1); crate++){
3047 std::ostringstream outs;
3048 outs << outputfilename <<
"feccrate"<<crate<<
".html";
3049 txtfile =
new std::ofstream(outs.str().c_str(),
std::ios::out);
3050 *txtfile <<
"<html><head></head> <body>" << std::endl;
3051 for( i_ccu=
ccuMap.begin();i_ccu !=
ccuMap.end(); i_ccu++){
3052 TmCcu * ccu= i_ccu->second;
3055 *txtfile <<
"<a name="<<idmod<<
"><pre>"<<std::endl;
3056 *txtfile << ccu->
text << std::endl;
3057 std::ostringstream outs;
3058 if(ccu->
nmod==0)outs <<
"ccu is in position" << ccu->
mpos<<
"in ring but doesn't seem to have any module connected";
else
3060 outs <<
"ccu is in position " << ccu->
mpos<<
" in ring and connects " <<ccu->
nmod<<
" modules" << std::endl;
3062 for (it = ret.first; it != ret.second; ++it)
3064 outs << (*it).second->idex<<
" " << (*it).second->name <<
" value= "<< (*it).second->value<<
"\n\n";
3067 *txtfile <<
"</pre><h4>"<< outs.str()<<
"</h4>"<<std::endl;
3071 *txtfile <<
"</body></html>" << std::endl;
3072 txtfile->close();
delete txtfile;
3076 std::ostringstream outs3,outs4;
3077 outs3 << outputfilename<<
"psu.png";
3080 outs4 << outputfilename<<
".xml";
3085 std::map<int , TmPsu *>::iterator ipsu;
3086 std::multimap<TmPsu*, TmModule*>::iterator it;
3087 std::pair<std::multimap<TmPsu*, TmModule*>::iterator,std::multimap<TmPsu*, TmModule*>::iterator>
ret;
3088 for (
int rack=1; rack < (
npsuracks+1); rack++){
3089 std::ostringstream outs;
3091 outs << outputfilename <<
"psurack"<<rack<<
".html";
3092 txtfile =
new std::ofstream(outs.str().c_str(),
std::ios::out);
3093 *txtfile <<
"<html><head></head> <body>" << std::endl;
3094 for ( ipsu=
psuMap.begin();ipsu !=
psuMap.end(); ipsu++){
3095 TmPsu * psu= ipsu->second;
3097 *txtfile <<
"<a name="<<psu->
idex<<
"><pre>"<<std::endl;
3098 *txtfile << psu->
text << std::endl;
3099 std::ostringstream outs;
3100 if(psu->
nmod==0)outs <<
"Ps is in position" << psu->
getPsuBoard()<<
"in crate but doesn't seem to have any module connected";
else
3102 outs<<
"PS is in position " <<psu->
getPsuBoard()<<
" in crate and connects to "<<psu->
nmod<<
" modules. "<<std::endl;
3105 for (it = ret.first; it != ret.second; ++it)
3107 outs <<(*it).second->idex <<
" "<< (*it).second->name<<
" value= "<<(*it).second->value<<
" <br>"<<std::endl;
3110 *txtfile <<
"</pre><h4>"<< outs.str()<<
"</h4>"<<std::endl;
3114 *txtfile <<
"</body></html>" << std::endl;
3115 txtfile->close();
delete txtfile;
3121 std::ostringstream outs5,outs6;
3122 outs5 << outputfilename<<
"hv.png";
3125 outs6 << outputfilename<<
".xml";
3130 std::map<int , TmPsu *>::iterator ipsu;
3131 std::multimap<TmPsu*, TmModule*>::iterator it;
3132 std::pair<std::multimap<TmPsu*, TmModule*>::iterator,std::multimap<TmPsu*, TmModule*>::iterator>
ret;
3133 for (
int rack=1; rack < (
npsuracks+1); rack++){
3134 std::ostringstream outs;
3136 outs << outputfilename <<
"HVrack"<<rack<<
".html";
3137 txtfile =
new std::ofstream(outs.str().c_str(),
std::ios::out);
3138 *txtfile <<
"<html><head></head> <body>" << std::endl;
3139 for ( ipsu=
psuMap.begin();ipsu !=
psuMap.end(); ipsu++){
3140 TmPsu * psu= ipsu->second;
3142 *txtfile <<
"<a name="<<psu->
idex<<
"><pre>"<<std::endl;
3143 *txtfile << psu->
textHV2 << std::endl;
3144 std::ostringstream outsHV2;
3145 if(psu->
nmodHV2==0)outsHV2 <<
"HV Channel002 is in position" << psu->
getPsuBoard()<<
"in crate but doesn't seem to have any module connected";
else
3147 outsHV2<<
"HV Channel002 is in position " <<psu->
getPsuBoard()<<
" in crate and connects to "<<psu->
nmodHV2<<
" modules. "<<
" <br>"<<std::endl;
3150 for (it = ret.first; it != ret.second; ++it)
3152 if((*it).second->HVchannel==2){outsHV2 <<(*it).second->idex <<
" "<< (*it).second->name<<
" value= "<<(*it).second->value<<
" <br>"<<std::endl;}
3154 *txtfile <<
"</pre><h4>"<< outsHV2.str()<<
"</h4>"<<std::endl;
3157 *txtfile << psu->
textHV3 << std::endl;
3158 std::ostringstream outsHV3;
3159 if(psu->
nmodHV3==0)outsHV3 <<
"HV Channel003 is in position" << psu->
getPsuBoard()<<
"in crate but doesn't seem to have any module connected";
else
3161 outsHV3<<
"HV Channel003 is in position " <<psu->
getPsuBoard()<<
" in crate and connects to "<<psu->
nmodHV3<<
" modules. "<<
" <br>"<<std::endl;
3164 for (it = ret.first; it != ret.second; ++it)
3166 if((*it).second->HVchannel==3){outsHV3 <<(*it).second->idex <<
" "<< (*it).second->name<<
" value= "<<(*it).second->value<<
" <br>"<<std::endl;}
3168 *txtfile <<
"</pre><h4>"<< outsHV3.str()<<
"</h4>"<<std::endl;
3173 *txtfile <<
"</body></html>" << std::endl;
3174 txtfile->close();
delete txtfile;
3181 float minval,maxval; minval=minval1; maxval=maxval1;
3182 if(
tkMapLog && (minval<maxval)) {minval=
pow(10.,minval1);maxval=
pow(10.,maxval1);}
3186 size_t found=filetype.find_last_of(
".");
3187 filetype=filetype.substr(found+1);
3188 found=outputfilename.find_last_of(
".");
3189 outputfilename=outputfilename.substr(0,found);
3191 std::ofstream * ofilename;
3192 std::ifstream * ifilename;
3193 std::ostringstream ofname;
3198 ifilename=
findfile(
"viewerHeader.xhtml");
3199 ofname << outputfilename <<
"viewer.html";
3200 ofilename =
new std::ofstream(ofname.str().c_str(),
std::ios::out);
3201 while (getline( *ifilename, line )) { *ofilename << line << std::endl; }
3202 *ofilename <<
" var tmapname=\"" <<outputfilename <<
"\""<<std::endl;
3203 *ofilename <<
" var tmaptitle=\"" <<
title <<
"\""<<std::endl;
3204 *ofilename <<
" var ncrates=" <<
ncrates <<
";"<<std::endl;
3205 *ofilename <<
" var nfeccrates=" <<
nfeccrates <<
";"<<std::endl;
3206 *ofilename <<
" var npsuracks=" <<
npsuracks <<
";"<<std::endl;
3207 ifilename->close();
delete ifilename;
3208 ifilename=
findfile(
"viewerTrailer.xhtml");
3209 while (getline( *ifilename, line )) { *ofilename << line << std::endl; }
3210 ofilename->close();
delete ofilename;
3211 ifilename->close();
delete ifilename;
3212 command =
"sed -i \"s/XtmapnameX/"+outputfilename+
"/g\" "+ ofname.str();
3213 std::cout <<
"Executing " << command << std::endl;
3214 system(command.c_str());
3215 command =
"sed -i \"s/XtmaptitleX/"+
title+
"/g\" "+ ofname.str();
3216 std::cout <<
"Executing " << command << std::endl;
3217 system(command.c_str());
3221 ofname <<
"jqviewer.js";
3222 ofilename =
new std::ofstream(ofname.str().c_str(),
std::ios::out);
3223 while (getline( *ifilename, line )) { *ofilename << line << std::endl; }
3224 ofilename->close();
delete ofilename;
3225 ifilename->close();
delete ifilename;
3229 ofname <<
"crate.js";
3230 ofilename =
new std::ofstream(ofname.str().c_str(),
std::ios::out);
3231 while (getline( *ifilename, line )) { *ofilename << line << std::endl; }
3232 ofilename->close();
delete ofilename;
3233 ifilename->close();
delete ifilename;
3237 ofname <<
"feccrate.js";
3238 ofilename =
new std::ofstream(ofname.str().c_str(),
std::ios::out);
3239 while (getline( *ifilename, line )) { *ofilename << line << std::endl; }
3240 ofilename->close();
delete ofilename;
3241 ifilename->close();
delete ifilename;
3245 ofname <<
"rack.js";
3246 ofilename =
new std::ofstream(ofname.str().c_str(),
std::ios::out);
3247 while (getline( *ifilename, line )) { *ofilename << line << std::endl; }
3248 ofilename->close();
delete ofilename;
3249 ifilename->close();
delete ifilename;
3253 ofname <<
"rackhv.js";
3254 ofilename =
new std::ofstream(ofname.str().c_str(),
std::ios::out);
3255 while (getline( *ifilename, line )) { *ofilename << line << std::endl; }
3256 ofilename->close();
delete ofilename;
3257 ifilename->close();
delete ifilename;
3261 ofname <<
"layer.js";
3262 ofilename =
new std::ofstream(ofname.str().c_str(),
std::ios::out);
3263 while (getline( *ifilename, line )) { *ofilename << line << std::endl; }
3264 ofilename->close();
delete ofilename;
3265 ifilename->close();
delete ifilename;
3267 command =
"scp -r ../../DQM/TrackerCommon/test/jquery/ .";
3268 std::cout <<
"Executing " << command << std::endl;
3269 system(command.c_str());
3270 command =
"scp -r ../../CommonTools/TrackerMap/data/images/ .";
3271 std::cout <<
"Executing " << command << std::endl;
3272 system(command.c_str());
3275 std::ostringstream outs;
3276 outs << outputfilename<<
".png";
3280 std::ostringstream outs;
3281 outs << outputfilename<<
".png";
3287 for (
int layer=1; layer < 44; layer++){
3288 std::ostringstream outs;
3289 outs << outputfilename <<
"layer"<<layer<<
".html";
3290 txtfile =
new std::ofstream(outs.str().c_str(),
std::ios::out);
3291 *txtfile <<
"<html><head></head> <body>" << std::endl;
3299 *txtfile <<
"<a name="<<idmod<<
"><pre>"<<std::endl;
3300 std::multimap<const int, TmApvPair*>::iterator pos;
3306 *txtfile << apvpair->
text << std::endl;
3310 *txtfile <<
"</pre><h3>"<< mod->
name<<
"</h3>"<<std::endl;
3314 *txtfile <<
"</body></html>" << std::endl;
3315 txtfile->close();
delete txtfile;
3319 std::ostringstream outs1,outs2;
3321 else outs1 << outputfilename<<
"fed."<<
filetype;
3324 outs2 << outputfilename<<
".xml";
3327 std::map<int , int>::iterator i_fed;
3330 std::ostringstream outs;
3331 outs << outputfilename <<
"crate"<<crate<<
".html";
3332 txtfile =
new std::ofstream(outs.str().c_str(),
std::ios::out);
3333 *txtfile <<
"<html><head></head> <body>" << std::endl;
3334 for (i_fed=
fedMap.begin();i_fed !=
fedMap.end(); i_fed++){
3335 if(i_fed->second == crate){
3336 int fedId = i_fed->first;
3337 for (
int nconn=0;nconn<96;nconn++){
3338 int key = fedId*1000+nconn;
3342 *txtfile <<
"<a name="<<idmod<<
"><pre>"<<std::endl;
3343 *txtfile << apvPair->
text << std::endl;
3344 std::ostringstream outs;
3345 outs <<
"fedchannel " <<apvPair->
getFedId() <<
"/"<<apvPair->
getFedCh()<<
" connects to module " << apvPair->
mod->
idex ;
3346 *txtfile <<
"</pre><h3>"<< outs.str()<<
"</h3>"<<std::endl;
3351 *txtfile <<
"</body></html>" << std::endl;
3352 txtfile->close();
delete txtfile;
3357 std::ostringstream outs1,outs2;
3359 else outs1 << outputfilename<<
"fec."<<
filetype;
3362 outs2 << outputfilename<<
".xml";
3366 std::map<int , TmCcu *>::iterator i_ccu;
3367 std::multimap<TmCcu*, TmModule*>::iterator it;
3368 std::pair<std::multimap<TmCcu*, TmModule*>::iterator,std::multimap<TmCcu*, TmModule*>::iterator>
ret;
3369 for (
int crate=1; crate < (
nfeccrates+1); crate++){
3370 std::ostringstream outs;
3371 outs << outputfilename <<
"feccrate"<<crate<<
".html";
3372 txtfile =
new std::ofstream(outs.str().c_str(),
std::ios::out);
3373 *txtfile <<
"<html><head></head> <body>" << std::endl;
3374 for( i_ccu=
ccuMap.begin();i_ccu !=
ccuMap.end(); i_ccu++){
3375 TmCcu * ccu= i_ccu->second;
3378 *txtfile <<
"<a name="<<idmod<<
"><pre>"<<std::endl;
3379 *txtfile << ccu->
text << std::endl;
3380 std::ostringstream outs;
3381 if(ccu->
nmod==0)outs <<
"ccu is in position" << ccu->
mpos<<
"in ring but doesn't seem to have any module connected";
else
3383 outs <<
"ccu is in position " << ccu->
mpos<<
" in ring and connects " <<ccu->
nmod<<
" modules" << std::endl;
3385 for (it = ret.first; it != ret.second; ++it)
3387 outs << (*it).second->idex<<
" " << (*it).second->name <<
" value= "<< (*it).second->value<<
"\n\n";
3390 *txtfile <<
"</pre><h4>"<< outs.str()<<
"</h4>"<<std::endl;
3394 *txtfile <<
"</body></html>" << std::endl;
3400 std::ostringstream outs3,outs4;
3402 else outs3 << outputfilename<<
"psu."<<
filetype;
3405 outs4 << outputfilename<<
".xml";
3410 std::map<int , TmPsu *>::iterator ipsu;
3411 std::multimap<TmPsu*, TmModule*>::iterator it;
3412 std::pair<std::multimap<TmPsu*, TmModule*>::iterator,std::multimap<TmPsu*, TmModule*>::iterator>
ret;
3413 for (
int rack=1; rack < (
npsuracks+1); rack++){
3414 std::ostringstream outs;
3416 outs << outputfilename <<
"psurack"<<rack<<
".html";
3417 txtfile =
new std::ofstream(outs.str().c_str(),
std::ios::out);
3418 *txtfile <<
"<html><head></head> <body>" << std::endl;
3419 for ( ipsu=
psuMap.begin();ipsu !=
psuMap.end(); ipsu++){
3420 TmPsu * psu= ipsu->second;
3422 *txtfile <<
"<a name="<<psu->
idex<<
"><pre>"<<std::endl;
3423 *txtfile << psu->
text << std::endl;
3424 std::ostringstream outs;
3425 if(psu->
nmod==0)outs <<
"Ps is in position" << psu->
getPsuBoard()<<
"in crate but doesn't seem to have any module connected";
else
3427 outs<<
"PS is in position " <<psu->
getPsuBoard()<<
" in crate and connects to "<<psu->
nmod<<
" modules. "<<std::endl;
3430 for (it = ret.first; it != ret.second; ++it)
3432 outs <<(*it).second->idex <<
" "<< (*it).second->name<<
" value= "<<(*it).second->value<<
" <br>"<<std::endl;
3435 *txtfile <<
"</pre><h4>"<< outs.str()<<
"</h4>"<<std::endl;
3439 *txtfile <<
"</body></html>" << std::endl;
3447 std::ostringstream outs5,outs6;
3449 else outs5 << outputfilename<<
"hv."<<
filetype;
3452 outs6 << outputfilename<<
".xml";
3457 std::map<int , TmPsu *>::iterator ipsu;
3458 std::multimap<TmPsu*, TmModule*>::iterator it;
3459 std::pair<std::multimap<TmPsu*, TmModule*>::iterator,std::multimap<TmPsu*, TmModule*>::iterator>
ret;
3460 for (
int rack=1; rack < (
npsuracks+1); rack++){
3461 std::ostringstream outs;
3463 outs << outputfilename <<
"HVrack"<<rack<<
".html";
3464 txtfile =
new std::ofstream(outs.str().c_str(),
std::ios::out);
3465 *txtfile <<
"<html><head></head> <body>" << std::endl;
3466 for ( ipsu=
psuMap.begin();ipsu !=
psuMap.end(); ipsu++){
3467 TmPsu * psu= ipsu->second;
3469 *txtfile <<
"<a name="<<psu->
idex<<
"><pre>"<<std::endl;
3470 *txtfile << psu->
textHV2 << std::endl;
3471 std::ostringstream outsHV2;
3472 if(psu->
nmodHV2==0)outsHV2 <<
"HV Channel002 is in position" << psu->
getPsuBoard()<<
"in crate but doesn't seem to have any module connected";
else
3474 outsHV2<<
"HV Channel002 is in position " <<psu->
getPsuBoard()<<
" in crate and connects to "<<psu->
nmodHV2<<
" modules. "<<
" <br>"<<std::endl;
3477 for (it = ret.first; it != ret.second; ++it)
3479 if((*it).second->HVchannel==2){outsHV2 <<(*it).second->idex <<
" "<< (*it).second->name<<
" value= "<<(*it).second->value<<
" <br>"<<std::endl;}
3481 *txtfile <<
"</pre><h4>"<< outsHV2.str()<<
"</h4>"<<std::endl;
3484 *txtfile << psu->
textHV3 << std::endl;
3485 std::ostringstream outsHV3;
3486 if(psu->
nmodHV3==0)outsHV3 <<
"HV Channel003 is in position" << psu->
getPsuBoard()<<
"in crate but doesn't seem to have any module connected";
else
3488 outsHV3<<
"HV Channel003 is in position " <<psu->
getPsuBoard()<<
" in crate and connects to "<<psu->
nmodHV3<<
" modules. "<<
" <br>"<<std::endl;
3491 for (it = ret.first; it != ret.second; ++it)
3493 if((*it).second->HVchannel==3){outsHV3 <<(*it).second->idex <<
" "<< (*it).second->name<<
" value= "<<(*it).second->value<<
" <br>"<<std::endl;}
3495 *txtfile <<
"</pre><h4>"<< outsHV3.str()<<
"</h4>"<<std::endl;
3500 *txtfile <<
"</body></html>" << std::endl;
3511 std::ifstream * ifilename;
3517 ifname=
"CommonTools/TrackerMap/data/"+
filename;
3521 ifname=
"CommonTools/TrackerMap/data/"+
filename;
3524 if(!ifilename)
std::cout <<
"File " << filename <<
" missing" << std::endl;
3531 for (
int layer=1; layer < 44; layer++){
3546 for (
int layer=1; layer < 44; layer++){
3559 for (
int layer=1; layer < 44; layer++){
3560 std::ostringstream outs;
3561 outs << outputfilename <<
"layer"<<layer<<
".xml";
3562 xmlfile =
new std::ofstream(outs.str().c_str(),
std::ios::out);
3563 *xmlfile <<
"<?xml version=\"1.0\" standalone=\"no\"?>"<<std::endl;
3564 *xmlfile <<
"<svg xmlns=\"http://www.w3.org/2000/svg\""<<std::endl;
3565 *xmlfile <<
"xmlns:svg=\"http://www.w3.org/2000/svg\""<<std::endl;
3566 *xmlfile <<
"xmlns:xlink=\"http://www.w3.org/1999/xlink\" >"<<std::endl;
3567 *xmlfile <<
"<script type=\"text/ecmascript\" xlink:href=\"layer.js\" />"<<std::endl;
3568 *xmlfile <<
"<svg id=\"mainMap\" x=\"0\" y=\"0\" viewBox=\"0 0 500 500\" width=\"700\" height=\"700\" onload=\"TrackerLayer.init()\">"<<std::endl;
3569 if(layer<31)*xmlfile <<
"<g id=\"layer\" transform=\" translate(0,400) rotate(270) scale(1.,1.)\" > "<<std::endl;
3570 else *xmlfile <<
"<g id=\"layer\" transform=\" translate(0,400) rotate(270) scale(1.,0.8)\" > "<<std::endl;
3571 *xmlfile <<
"<rect fill=\"lightblue\" stroke=\"none\" x=\"0\" y=\"0\" width=\"700\" height=\"700\" />"<<std::endl;
3572 *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;
3573 *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;
3574 *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;
3575 *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;
3576 *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;
3585 drawModule(mod,key,layer,print_total,xmlfile);
3589 *xmlfile <<
"</g> </svg> <text id=\"currentElementText\" x=\"40\" y=\"30\">" << std::endl;
3590 *xmlfile <<
"<tspan id=\"line1\" x=\"40\" y=\"30\"> </tspan> " << std::endl;
3591 *xmlfile <<
"<tspan id=\"line2\" x=\"40\" y=\"60\"> </tspan> " << std::endl;
3592 *xmlfile <<
"<tspan id=\"line3\" x=\"40\" y=\"90\"> </tspan> " << std::endl;
3593 *xmlfile <<
"<tspan id=\"line4\" x=\"40\" y=\"120\"> </tspan> " << std::endl;
3595 *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;
3596 *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;
3597 *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;
3598 *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;
3599 *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;
3602 *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;
3603 *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;
3604 *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;
3605 *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;
3606 *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;
3608 *xmlfile <<
" </text> </svg>" << std::endl;
3609 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
tuple ret
prodAgent to be discontinued
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
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)
string key
FastSim: produces sample of signal events, overlayed with premixed minbias events.
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()