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;
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;
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++;}
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;
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.find(
"QTestAlarm")!=std::string::npos){
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";
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.));
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.));
1773 tempfile >> x[
i] >> y[
i];
1776 if(ncolor>0 && ncolor<10000){
1778 for(
int i=0;
i<ncolor;
i++){colors[
i]=
i+100;}
1779 gStyle->SetPalette(ncolor,colors);
1782 tempfile.seekg(0,std::ios::beg);
1783 std::cout <<
"created palette with " << ncolor <<
" colors" << std::endl;
1784 while(!tempfile.eof()) {
1785 tempfile >> red >> green >> blue >>
npoints;
1787 tempfile >> x[
i] >> y[
i];
1789 colindex=red+green*1000+blue*1000000;
1790 pos=colorList.find(colindex);
1791 if(pos != colorList.end()){
1792 TPolyLine* pline =
new TPolyLine(npoints,y,x);
1793 vp.push_back(pline);
1794 pline->SetFillColor(colorList[colindex]);
1795 pline->SetLineWidth(0);
1802 axis =
new TGaxis(3660,36,3660,1530,lminvalue,lmaxvalue,510,
"+L");
1803 axis->SetLabelSize(0.02);
1810 l.SetTextSize(0.05);
1812 if(
tkMapLog && (fulltitle.find(
"Log10 scale") == std::string::npos)) fulltitle +=
": Log10 scale";
1813 l.DrawLatex(50,1530,fulltitle.c_str());
1816 std::cout <<
"Filetype " << filetype << std::endl;
1817 if(filetype==
"png"){
1819 MyC->Print(filename.c_str());
1821 if(filetype==
"jpg"){
1823 MyC->Print(filename.c_str());
1825 if(filetype==
"pdf"){
1827 MyC->Print(filename.c_str());
1830 command1=command.c_str();
1831 std::cout <<
"Executing " << command1 << std::endl;
1836 for(std::vector<TPolyLine*>::iterator pos1=vp.begin();pos1!=vp.end();pos1++){
1850 bool rangefound=
true;
1852 std::vector<TPolyLine*> vp;
1855 size_t found=filetype.find_last_of(
".");
1856 filetype=filetype.substr(found+1);
1857 found=outputfilename.find_last_of(
".");
1858 outputfilename=outputfilename.substr(0,found);
1866 std::ostringstream outs;
1868 outs << outputfilename <<
".coor";
1871 std::map<int , TmPsu *>::iterator ipsu;
1872 std::multimap<TmPsu*, TmModule*>::iterator it;
1873 std::pair<std::multimap<TmPsu*, TmModule*>::iterator,std::multimap<TmPsu*, TmModule*>::iterator>
ret;
1876 bool usePsuValue=
false;
1879 TmPsu* psu= ipsu->second;
1881 if(psu->
count > 0 || psu->
red!=-1) { usePsuValue=
true;
break;}
1887 TmPsu * psu= ipsu->second;
1891 for(it = ret.first; it != ret.second; ++it){
1892 if((*it).second->count>0){nconn++;psu->
value=psu->
value+(*it).second->value;}
1901 if(
title.find(
"QTestAlarm")!=std::string::npos){
1903 TmPsu * psu= ipsu->second;
1909 for (it = ret.first; it != ret.second; ++it) {
1910 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 ) ){
1911 nconn++;psu->
value++;
1923 TmPsu * psu= ipsu->second;
1937 TmPsu * psu= ipsu->second;
1938 if(psu!=0 && psu->
count>0) {
1948 if(filetype==
"svg"){
1950 std::ostringstream outs;
1951 outs << outputfilename<<
".svg";
1953 *
savefile <<
"<?xml version=\"1.0\" standalone=\"no\" ?>"<<std::endl;
1954 *
savefile <<
"<svg xmlns=\"http://www.w3.org/2000/svg\""<<std::endl;
1955 *
savefile <<
"xmlns:svg=\"http://www.w3.org/2000/svg\" "<<std::endl;
1956 *
savefile <<
"xmlns:xlink=\"http://www.w3.org/1999/xlink\">"<<std::endl;
1957 *
savefile <<
"<svg:svg id=\"mainMap\" x=\"0\" y=\"0\" viewBox=\"0 0 3000 1600"<<
"\" width=\""<<width<<
"\" height=\""<<height<<
"\">"<<std::endl;
1958 *
savefile <<
"<svg:rect fill=\"lightblue\" stroke=\"none\" x=\"0\" y=\"0\" width=\"3000\" height=\"1600\" /> "<<std::endl;
1959 *
savefile <<
"<svg:g id=\"psutrackermap\" transform=\"translate(10,1500) rotate(270)\" style=\"fill:none;stroke:black;stroke-width:0;\"> "<<std::endl;
1962 for (
int irack=1; irack < (
npsuracks+1); irack++){
1963 if(filetype==
"xml"){
1965 std::ostringstream outs;
1966 outs << outputfilename<<
"psurack" <<irack<<
".xml";
1968 *
savefile <<
"<?xml version=\"1.0\" standalone=\"no\"?>"<<std::endl;
1969 *
savefile <<
"<svg xmlns=\"http://www.w3.org/2000/svg\""<<std::endl;
1970 *
savefile <<
"xmlns:svg=\"http://www.w3.org/2000/svg\""<<std::endl;
1971 *
savefile <<
"xmlns:xlink=\"http://www.w3.org/1999/xlink\" >"<<std::endl;
1972 *
savefile <<
"<script type=\"text/ecmascript\" xlink:href=\"rack.js\" />"<<std::endl;
1973 *
savefile <<
"<svg id=\"mainMap\" x=\"0\" y=\"0\" viewBox=\"0 0 500 500\" width=\"700\" height=\"700\" onload=\"TrackerCrate.init()\">"<<std::endl;
1974 *
savefile <<
"<rect fill=\"lightblue\" stroke=\"none\" x=\"0\" y=\"0\" width=\"700\" height=\"700\" />"<<std::endl;
1975 *
savefile <<
"<g id=\"rack\" transform=\" translate(150,500) rotate(270) scale(1.,1.)\" > "<<std::endl;
1981 for ( ipsu=
psuMap.begin();ipsu !=
psuMap.end(); ipsu++){
1982 TmPsu * psu= ipsu->second;
1991 if(filetype==
"xml"){
1992 *
savefile <<
"</g> </svg> <text id=\"currentElementText\" x=\"40\" y=\"30\"> " << std::endl;
1993 *
savefile <<
"<tspan id=\"line1\" x=\"40\" y=\"30\"> </tspan> " << std::endl;
1994 *
savefile <<
"<tspan id=\"line2\" x=\"40\" y=\"60\"> </tspan> " << std::endl;
1995 *
savefile <<
" </text> </svg>" << std::endl;
2001 if(filetype==
"svg"){
2002 *
savefile <<
"</g> </svg> </svg> " << std::endl;
2007 if(!print_total && !usePsuValue){
2009 TmPsu *psu = ipsu->second;
2024 const char * command1;
2025 std::string tempfilename = outputfilename +
".coor";
2028 std::ifstream tempfile(tempfilename.c_str(),
std::ios::in);
2029 TCanvas *MyC =
new TCanvas(
"MyC",
"TrackerMap",width,height);
2030 gPad->SetFillColor(38);
2033 std::cout <<
" range x " << rangex << std::endl;
2034 std::cout <<
" range y " << rangey << std::endl;
2035 gPad->Range(0,0,rangex,rangey);
2039 typedef std::map<int,int> ColorList;
2040 ColorList colorList;
2041 ColorList::iterator pos;
2043 while(!tempfile.eof()) {
2044 tempfile >> red >> green >> blue >>
npoints;
2045 colindex=red+green*1000+blue*1000000;
2046 pos=colorList.find(colindex);
2047 if(pos == colorList.end()){
2048 colorList[colindex]=ncolor+100;
2049 col =gROOT->GetColor(ncolor+100);
2051 col->SetRGB((Double_t)(red/255.),(Double_t)(green/255.),(Double_t)(blue/255.));
2053 c =
new TColor(ncolor+100,(Double_t)(red/255.),(Double_t)(green/255.),(Double_t)(blue/255.));
2058 tempfile >> x[
i] >> y[
i];
2061 if(ncolor>0 && ncolor<10000){
2063 for(
int i=0;
i<ncolor;
i++){colors[
i]=
i+100;}
2064 gStyle->SetPalette(ncolor,colors);
2067 tempfile.seekg(0,std::ios::beg);
2068 std::cout <<
"created palette with " << ncolor <<
" colors" << std::endl;
2069 while(!tempfile.eof()) {
2070 tempfile >> red >> green >> blue >>
npoints;
2072 tempfile >> x[
i] >> y[
i];
2074 colindex=red+green*1000+blue*1000000;
2075 pos=colorList.find(colindex);
2076 if(pos != colorList.end()){
2077 TPolyLine* pline =
new TPolyLine(npoints,y,x);
2078 vp.push_back(pline);
2079 pline->SetFillColor(colorList[colindex]);
2080 pline->SetLineWidth(0);
2087 axis =
new TGaxis(rangex-140,34,rangex-140,rangey-106,lminvalue,lmaxvalue,510,
"+L");
2088 axis->SetLabelSize(0.02);
2094 l.SetTextSize(0.05);
2096 if(
tkMapLog && (fulltitle.find(
"Log10 scale") == std::string::npos)) fulltitle +=
": Log10 scale";
2097 l.DrawLatex(50,rangey-200,fulltitle.c_str());
2100 std::cout <<
"Filetype " << filetype << std::endl;
2101 if(filetype==
"png"){
2103 MyC->Print(filename.c_str());
2105 if(filetype==
"jpg"){
2107 MyC->Print(filename.c_str());
2109 if(filetype==
"pdf"){
2111 MyC->Print(filename.c_str());
2114 command1=command.c_str();
2115 std::cout <<
"Executing " << command1 << std::endl;
2120 for(std::vector<TPolyLine*>::iterator pos1=vp.begin();pos1!=vp.end();pos1++){
2130 bool rangefound =
true;
2132 std::vector<TPolyLine*> vp;
2135 size_t found=filetype.find_last_of(
".");
2136 filetype=filetype.substr(found+1);
2137 found=outputfilename.find_last_of(
".");
2138 outputfilename=outputfilename.substr(0,found);
2142 std::ostringstream outs;
2144 outs << outputfilename <<
".coor";
2146 std::map<int , TmApvPair *>::iterator i_apv;
2147 std::map<int , int>::iterator i_fed;
2149 bool useApvPairValue=
false;
2150 for( i_apv=
apvMap.begin();i_apv !=
apvMap.end(); i_apv++){
2154 if(apv_mod !=0 && !apv_mod->
notInUse()){
2155 if(apvPair->
count > 0 || apvPair->
red!=-1) { useApvPairValue=
true;
break;}
2160 for( i_apv=
apvMap.begin();i_apv !=
apvMap.end(); i_apv++){
2164 if(apv_mod !=0 && !apv_mod->
notInUse() ){
2176 for(i_apv=
apvMap.begin();i_apv !=
apvMap.end(); i_apv++){
2180 if( apv_mod !=0 && !apv_mod->
notInUse() ){
2181 if(useApvPairValue){
2186 if(apv_mod->
count>0){
2197 if(filetype==
"svg"){
2199 std::ostringstream outs;
2200 outs << outputfilename<<
".svg";
2202 *
savefile <<
"<?xml version=\"1.0\" standalone=\"no\" ?>"<<std::endl;
2203 *
savefile <<
"<svg xmlns=\"http://www.w3.org/2000/svg\""<<std::endl;
2204 *
savefile <<
"xmlns:svg=\"http://www.w3.org/2000/svg\" "<<std::endl;
2205 *
savefile <<
"xmlns:xlink=\"http://www.w3.org/1999/xlink\">"<<std::endl;
2206 *
savefile <<
"<svg:svg id=\"mainMap\" x=\"0\" y=\"0\" viewBox=\"0 0 3000 1600"<<
"\" width=\""<<width<<
"\" height=\""<<height<<
"\">"<<std::endl;
2207 *
savefile <<
"<svg:rect fill=\"lightblue\" stroke=\"none\" x=\"0\" y=\"0\" width=\"3000\" height=\"1600\" /> "<<std::endl;
2208 *
savefile <<
"<svg:g id=\"fedtrackermap\" transform=\"translate(10,1500) rotate(270)\" style=\"fill:none;stroke:black;stroke-width:0;\"> "<<std::endl;
2211 if(filetype==
"xml"){
2213 std::ostringstream outs;
2214 outs << outputfilename<<
"crate" <<crate<<
".xml";
2216 *
savefile <<
"<?xml version=\"1.0\" standalone=\"no\"?>"<<std::endl;
2217 *
savefile <<
"<svg xmlns=\"http://www.w3.org/2000/svg\""<<std::endl;
2218 *
savefile <<
"xmlns:svg=\"http://www.w3.org/2000/svg\""<<std::endl;
2219 *
savefile <<
"xmlns:xlink=\"http://www.w3.org/1999/xlink\" >"<<std::endl;
2220 *
savefile <<
"<script type=\"text/ecmascript\" xlink:href=\"crate.js\" />"<<std::endl;
2221 *
savefile <<
"<svg id=\"mainMap\" x=\"0\" y=\"0\" viewBox=\"0 0 500 500\" width=\"700\" height=\"700\" onload=\"TrackerCrate.init()\">"<<std::endl;
2222 *
savefile <<
"<rect fill=\"lightblue\" stroke=\"none\" x=\"0\" y=\"0\" width=\"700\" height=\"700\" />"<<std::endl;
2223 *
savefile <<
"<g id=\"crate\" transform=\" translate(150,500) rotate(270) scale(1.,1.)\" > "<<std::endl;
2227 int numfed_incrate=0;
2228 for (i_fed=
fedMap.begin();i_fed !=
fedMap.end(); i_fed++){
2229 if(i_fed->second == crate){
2230 int fedId = i_fed->first;
2248 for (
int nconn=0;nconn<96;nconn++){
2249 int key = fedId*1000+nconn;
2253 if(apv_mod !=0 && !apv_mod->
notInUse()){
2261 if(filetype==
"xml"){
2262 *
savefile <<
"</g> </svg> <text id=\"currentElementText\" x=\"40\" y=\"30\"> " << std::endl;
2263 *
savefile <<
"<tspan id=\"line1\" x=\"40\" y=\"30\"> </tspan> " << std::endl;
2264 *
savefile <<
"<tspan id=\"line2\" x=\"40\" y=\"60\"> </tspan> " << std::endl;
2265 *
savefile <<
" </text> </svg>" << std::endl;
2271 if(filetype==
"svg"){
2272 *
savefile <<
"</g> </svg> </svg> " << std::endl;
2275 if(!print_total && !useApvPairValue){
2277 for( i_apv=
apvMap.begin();i_apv !=
apvMap.end(); i_apv++){
2281 if(apv_mod !=0 && apvPair->
mpos==0 && !apv_mod->
notInUse()){
2295 const char * command1;
2296 std::string tempfilename = outputfilename +
".coor";
2299 std::ifstream tempfile(tempfilename.c_str(),
std::ios::in);
2300 TCanvas *MyC =
new TCanvas(
"MyC",
"TrackerMap",width,height);
2301 gPad->SetFillColor(38);
2304 std::cout <<
" range x " << rangex << std::endl;
2305 std::cout <<
" range y " << rangey << std::endl;
2306 gPad->Range(0,0,rangex,rangey);
2310 typedef std::map<int,int> ColorList;
2311 ColorList colorList;
2312 ColorList::iterator pos;
2314 while(!tempfile.eof()) {
2315 tempfile >> red >> green >> blue >>
npoints;
2316 colindex=red+green*1000+blue*1000000;
2317 pos=colorList.find(colindex);
2318 if(pos == colorList.end()){
2319 colorList[colindex]=ncolor+100;
2320 col =gROOT->GetColor(ncolor+100);
2322 col->SetRGB((Double_t)(red/255.),(Double_t)(green/255.),(Double_t)(blue/255.));
2324 c =
new TColor(ncolor+100,(Double_t)(red/255.),(Double_t)(green/255.),(Double_t)(blue/255.));
2329 tempfile >> x[
i] >> y[
i];
2332 if(ncolor>0 && ncolor<10000){
2334 for(
int i=0;
i<ncolor;
i++){colors[
i]=
i+100;}
2335 gStyle->SetPalette(ncolor,colors);
2338 tempfile.seekg(0,std::ios::beg);
2339 std::cout <<
"created palette with " << ncolor <<
" colors" << std::endl;
2340 while(!tempfile.eof()) {
2341 tempfile >> red >> green >> blue >>
npoints;
2343 tempfile >> x[
i] >> y[
i];
2345 colindex=red+green*1000+blue*1000000;
2346 pos=colorList.find(colindex);
2347 if(pos != colorList.end()){
2348 TPolyLine* pline =
new TPolyLine(npoints,y,x);
2349 vp.push_back(pline);
2350 pline->SetFillColor(colorList[colindex]);
2351 pline->SetLineWidth(0);
2358 axis =
new TGaxis(rangex-140,34,rangex-140,rangey-106,lminvalue,lmaxvalue,510,
"+L");
2359 axis->SetLabelSize(0.02);
2365 l.SetTextSize(0.05);
2367 if(
tkMapLog && (fulltitle.find(
"Log10 scale") == std::string::npos)) fulltitle +=
": Log10 scale";
2368 l.DrawLatex(50,rangey-200,fulltitle.c_str());
2371 std::cout <<
"Filetype " << filetype << std::endl;
2372 if(filetype==
"png"){
2374 MyC->Print(filename.c_str());
2376 if(filetype==
"jpg"){
2378 MyC->Print(filename.c_str());
2380 if(filetype==
"pdf"){
2382 MyC->Print(filename.c_str());
2385 command1=command.c_str();
2386 std::cout <<
"Executing " << command1 << std::endl;
2391 for(std::vector<TPolyLine*>::iterator pos1=vp.begin();pos1!=vp.end();pos1++){
2402 int ipos,ipos1,ipos2,
id=0,
val=0;
2406 ipos1 = line.find(
"value=\"");
2408 value = line.substr(ipos1+7,10);
2409 ipos = value.find(
"\"");
2410 value = value.substr(0,ipos);
2411 val=atoi(value.c_str());
2413 ipos2 = line.find(
"detid=\"");
2415 value = line.substr(ipos2+7,10);
2416 ipos = value.find(
"\"");
2417 value = value.substr(0,ipos);
2418 id = atoi(value.c_str());
2420 if(ipos1>0 && ipos2>0 &&
val>0)this->
fill(
id,
val);
2421 if(ipos1>0 && ipos2>0)nline++;
2425 std::cout << nline <<
" modules found in this svg file " << std::endl;
2436 std::ostringstream outs;
2438 outs << outputfilename <<
".xml";
2444 while (getline( *jsfile, line ))
2446 *
svgfile << line << std::endl;
2448 jsfile->close();
delete jsfile;
2451 for (
int layer=1; layer < 44; layer++){
2466 for (
int layer=1; layer < 44; layer++){
2479 for (
int layer=1; layer < 44; layer++){
2492 *
svgfile <<
"</svg:g></svg:svg>"<<std::endl;
2493 *
svgfile <<
" <svg:text id=\"Title\" class=\"normalText\" x=\"300\" y=\"0\">"<<
title<<
"</svg:text>"<<std::endl;
2495 *
svgfile <<
"</svg:svg>"<<std::endl;
2496 *
svgfile <<
"</body></html>"<<std::endl;
2502 std::cout <<
"preparing the palette" << std::endl;
2505 int paletteLength = 250;
2506 int width=50*(yoffset-40)/1500;
2509 float step = float(yoffset-40)/float(paletteLength);
2510 for(
int i=1;
i<paletteLength+1;
i++){
2512 red=(color>>16)&0xFF;
2513 green=(color>>8)&0xFF;
2525 if(!
temporary_file)*svgfile <<
"<svg:rect x=\"3610\" y=\""<<(1550-6*
i)<<
"\" width=\"50\" height=\"6\" fill=\"rgb("<<red<<
","<<green<<
","<<blue<<
")\" />\n";
2526 else *svgfile << red <<
" " << green <<
" " << blue <<
" 4 " << int(step*
i)+34 <<
" " << xoffset-width <<
". " <<
2527 int(step*i)+34 <<
" " << xoffset <<
". " <<
2528 int(step*(i-1))+34 <<
" " << xoffset <<
". " <<
2529 int(step*(i-1))+34 <<
" " << xoffset-width <<
". " << std::endl;
2532 if(!
temporary_file)*svgfile <<
"<svg:rect x=\"3610\" y=\""<<(1550-6*
i)<<
"\" width=\"50\" height=\"1\" fill=\"black\" />\n";
2533 if(i%50==0&&!
temporary_file)*svgfile <<
" <svg:text class=\"normalText\" x=\"3660\" y=\""<<(1560-6*
i)<<
"\">" <<val<<
"</svg:text>"<<std::endl;
2541 int key = fedId*1000+fedCh;
2548 std::cout <<
"*** error in FedTrackerMap fillc method ***";
2553 std::multimap<const int, TmApvPair*>::iterator pos;
2563 std::cout <<
"*** error in FedTrackerMap fill by module method ***";
2568 int key = fedId*1000+fedCh;
2571 if(apvpair!=0) {apvpair->
value=current_val; apvpair->
count=1; apvpair->
red=-1;}
2573 std::cout <<
"*** error in FedTrackerMap fill_current_val method ***";
2579 int key =crate*10000000+slot*100000+ring*1000+addr;
2587 std::cout <<
"*** error in FecTrackerMap fillc method ***";
2592 int key =crate*10000000+slot*100000+ring*1000+addr;
2600 std::cout <<
"*** error in FecTrackerMap fill by module method ***";
2608 int key = rack*1000+crate*100+board;
2616 std::cout <<
"*** error in LVTrackerMap fillc method ***";
2621 int key = rack*1000+crate*100+board;
2629 std::cout <<
"*** error in LVTrackerMap fill by module method ***";
2635 int key = rack*1000+crate*100+board;
2643 std::cout <<
"*** error in HVTrackerMap (channel 2) fillc method ***";
2648 int key = rack*1000+crate*100+board;
2656 std::cout <<
"*** error in HVTrackerMap (channel 3) fillc method ***";
2662 int key = rack*1000+crate*100+board;
2670 std::cout <<
"*** error in HVTrackerMap fill by module method ***";
2674 int key = rack*1000+crate*100+board;
2682 std::cout <<
"*** error in HVTrackerMap fill by module method ***";
2691 int key = fedId*1000+fedCh;
2697 std::cout <<
"*** error in FedTrackerMap module method ***";
2701 int key = fedId*1000+fedCh;
2708 std::cout <<
"*** error inFedTrackerMap fill method ***";
2719 std::cout <<
"**************************error in fill method **************module "<<idmod<<std::endl;
2723 int key = layer*10000+ring*1000+nmod;
2730 std::cout <<
"**************************error in fill method **************"<< std::endl;
2735 std::map<const int , TmModule *>::iterator imod;
2737 fillc(imod->first,255,255,255);
2743 std::map<const int , TmModule *>::iterator imod;
2754 if(mod!=0) {mod->
value=current_val; mod->
count=1; mod->
red=-1;}
2755 else std::cout <<
"**error in fill_current_val method ***module "<<idmod<<std::endl;
2768 if(mod1!=0 && mod2!=0){
2775 std::cout <<
"**************************error in fill method **************module "<<idmod<<std::endl;
2780 int key = layer*100000+ring*1000+nmod;
2786 else std::cout <<
"**************************error in SvgModuleMap **************";
2795 else std::cout <<
"**************************error in IdModuleMap **************";
2801 int key = layer*100000+ring*1000+nmod;
2806 else std::cout <<
"**************************error in SvgModuleMap **************";
2812 int nmods, pix_sil, fow_bar,
ring, nmod, layer;
2814 float posx, posy, posz, length,
width, thickness, widthAtHalfLength;
2815 int iModule=0,old_layer=0, ntotMod =0;
2818 while(!infile.eof()) {
2819 infile >> nmods >> pix_sil >> fow_bar >> layer >> ring >> nmod >> posx >> posy
2820 >> posz>> length >> width >> thickness
2821 >> widthAtHalfLength >> idex ;
2822 getline(infile,dummys);
2823 getline(infile,name);
2824 if(old_layer!=layer){old_layer=layer;iModule=0;}
2827 int key=layer*100000+ring*1000+nmod;
2832 if(mod==0)
std::cout <<
"error in module "<<key <<std::endl;
2854 float lminvalue, lmaxvalue;
2859 red=0;green=0;blue=0;
2861 float delta=(lmaxvalue-lminvalue);
2862 float x =(value-lminvalue);
2863 if(value<lminvalue){red=0;green=0;blue=255;}
2864 if(value>lmaxvalue){red=255;green=0;blue=0;}
2865 if(value>=lminvalue&&value<=lmaxvalue){
2866 red = (int) ( x<(delta/2) ? 0 : ( x > ((3./4.)*
delta) ? 255 : 255/(delta/4) * (x-(2./4.)*
delta) ) );
2867 green= (int) ( x<delta/4 ? (x*255/(delta/4)) : ( x > ((3./4.)*
delta) ? 255-255/(delta/4) *(x-(3./4.)*
delta) : 255 ) );
2868 blue = (int) ( x<delta/4 ? 255 : ( x > ((1./2.)*
delta) ? 0 : 255-255/(delta/4) * (x-(1./4.)*
delta) ) );
2872 green = (int)((value-lminvalue)/(lmaxvalue-lminvalue)*256.);
2873 if (green > 255) green=255;
2874 red = 255; blue=0;green=255-
green;
2877 return(blue|(green<<8)|(red<<16));
2881 std::ofstream * ofilename;
2882 std::ifstream * ifilename;
2883 std::ostringstream ofname;
2888 ifilename=
findfile(
"viewerHeader.xhtml");
2889 ofname << outputfilename <<
"viewer.html";
2890 ofilename =
new std::ofstream(ofname.str().c_str(),
std::ios::out);
2891 while (getline( *ifilename, line )) { *ofilename << line << std::endl; }
2892 *ofilename <<
" var tmapname=\"" <<outputfilename <<
"\""<<std::endl;
2893 *ofilename <<
" var tmaptitle=\"" <<
title <<
"\""<<std::endl;
2894 *ofilename <<
" var ncrates=" <<
ncrates <<
";"<<std::endl;
2895 *ofilename <<
" var nfeccrates=" <<
nfeccrates <<
";"<<std::endl;
2896 *ofilename <<
" var npsuracks=" <<
npsuracks <<
";"<<std::endl;
2898 ifilename->close();
delete ifilename;
2900 ifilename=
findfile(
"viewerTrailer.xhtml");
2901 while (getline( *ifilename, line )) { *ofilename << line << std::endl; }
2902 ofilename->close();
delete ofilename;
2903 command =
"sed -i \"s/XtmapnameX/"+outputfilename+
"/g\" "+ ofname.str();
2904 std::cout <<
"Executing " << command << std::endl;
2905 system(command.c_str());
2906 command =
"sed -i \"s/XtmaptitleX/"+
title+
"/g\" "+ ofname.str();
2907 std::cout <<
"Executing " << command << std::endl;
2908 system(command.c_str());
2910 ifilename->close();
delete ifilename;
2913 ofname <<
"jqviewer.js";
2914 ofilename =
new std::ofstream(ofname.str().c_str(),
std::ios::out);
2915 while (getline( *ifilename, line )) { *ofilename << line << std::endl; }
2917 ofilename->close();
delete ofilename;
2918 ifilename->close();
delete ifilename;
2921 ofname <<
"crate.js";
2922 ofilename =
new std::ofstream(ofname.str().c_str(),
std::ios::out);
2923 while (getline( *ifilename, line )) { *ofilename << line << std::endl; }
2925 ofilename->close();
delete ofilename;
2926 ifilename->close();
delete ifilename;
2929 ofname <<
"feccrate.js";
2930 ofilename =
new std::ofstream(ofname.str().c_str(),
std::ios::out);
2931 while (getline( *ifilename, line )) { *ofilename << line << std::endl; }
2933 ofilename->close();
delete ofilename;
2934 ifilename->close();
delete ifilename;
2937 ofname <<
"layer.js";
2938 ofilename =
new std::ofstream(ofname.str().c_str(),
std::ios::out);
2939 while (getline( *ifilename, line )) { *ofilename << line << std::endl; }
2941 ofilename->close();
delete ofilename;
2942 ifilename->close();
delete ifilename;
2945 ofname <<
"rack.js";
2946 ofilename =
new std::ofstream(ofname.str().c_str(),
std::ios::out);
2947 while (getline( *ifilename, line )) { *ofilename << line << std::endl; }
2949 ofilename->close();
delete ofilename;
2950 ifilename->close();
delete ifilename;
2954 ofname <<
"rackhv.js";
2955 ofilename =
new std::ofstream(ofname.str().c_str(),
std::ios::out);
2956 while (getline( *ifilename, line )) { *ofilename << line << std::endl; }
2958 ofilename->close();
delete ofilename;
2959 ifilename->close();
delete ifilename;
2964 std::ostringstream outs,outs1,outs2;
2965 outs << outputfilename<<
".png";
2972 for (
int layer=1; layer < 44; layer++){
2973 std::ostringstream outs;
2974 outs << outputfilename <<
"layer"<<layer<<
".html";
2975 txtfile =
new std::ofstream(outs.str().c_str(),
std::ios::out);
2976 *txtfile <<
"<html><head></head> <body>" << std::endl;
2984 *txtfile <<
"<a name="<<idmod<<
"><pre>"<<std::endl;
2985 std::multimap<const int, TmApvPair*>::iterator pos;
2991 *txtfile << apvpair->
text << std::endl;
2995 *txtfile <<
"</pre><h3>"<< mod->
name<<
"</h3>"<<std::endl;
2999 *txtfile <<
"</body></html>" << std::endl;
3000 txtfile->close();
delete txtfile;
3003 outs1 << outputfilename<<
"fed.png";
3005 outs2 << outputfilename<<
".xml";
3008 std::map<int , int>::iterator i_fed;
3011 std::ostringstream outs;
3012 outs << outputfilename <<
"crate"<<crate<<
".html";
3013 txtfile =
new std::ofstream(outs.str().c_str(),
std::ios::out);
3014 *txtfile <<
"<html><head></head> <body>" << std::endl;
3015 for (i_fed=
fedMap.begin();i_fed !=
fedMap.end(); i_fed++){
3016 if(i_fed->second == crate){
3017 int fedId = i_fed->first;
3018 for (
int nconn=0;nconn<96;nconn++){
3019 int key = fedId*1000+nconn;
3023 *txtfile <<
"<a name="<<idmod<<
"><pre>"<<std::endl;
3024 *txtfile << apvPair->
text << std::endl;
3025 std::ostringstream outs;
3026 outs <<
"fedchannel " <<apvPair->
getFedId() <<
"/"<<apvPair->
getFedCh()<<
" connects to module " << apvPair->
mod->
idex ;
3027 *txtfile <<
"</pre><h3>"<< outs.str()<<
"</h3>"<<std::endl;
3032 *txtfile <<
"</body></html>" << std::endl;
3033 txtfile->close();
delete txtfile;
3037 std::ostringstream outs1,outs2;
3038 outs1 << outputfilename<<
"fec.png";
3040 outs2 << outputfilename<<
".xml";
3044 std::map<int , TmCcu *>::iterator i_ccu;
3045 std::multimap<TmCcu*, TmModule*>::iterator it;
3046 std::pair<std::multimap<TmCcu*, TmModule*>::iterator,std::multimap<TmCcu*, TmModule*>::iterator>
ret;
3047 for (
int crate=1; crate < (
nfeccrates+1); crate++){
3048 std::ostringstream outs;
3049 outs << outputfilename <<
"feccrate"<<crate<<
".html";
3050 txtfile =
new std::ofstream(outs.str().c_str(),
std::ios::out);
3051 *txtfile <<
"<html><head></head> <body>" << std::endl;
3052 for( i_ccu=
ccuMap.begin();i_ccu !=
ccuMap.end(); i_ccu++){
3053 TmCcu * ccu= i_ccu->second;
3056 *txtfile <<
"<a name="<<idmod<<
"><pre>"<<std::endl;
3057 *txtfile << ccu->
text << std::endl;
3058 std::ostringstream outs;
3059 if(ccu->
nmod==0)outs <<
"ccu is in position" << ccu->
mpos<<
"in ring but doesn't seem to have any module connected";
else
3061 outs <<
"ccu is in position " << ccu->
mpos<<
" in ring and connects " <<ccu->
nmod<<
" modules" << std::endl;
3063 for (it = ret.first; it != ret.second; ++it)
3065 outs << (*it).second->idex<<
" " << (*it).second->name <<
" value= "<< (*it).second->value<<
"\n\n";
3068 *txtfile <<
"</pre><h4>"<< outs.str()<<
"</h4>"<<std::endl;
3072 *txtfile <<
"</body></html>" << std::endl;
3073 txtfile->close();
delete txtfile;
3077 std::ostringstream outs3,outs4;
3078 outs3 << outputfilename<<
"psu.png";
3081 outs4 << outputfilename<<
".xml";
3086 std::map<int , TmPsu *>::iterator ipsu;
3087 std::multimap<TmPsu*, TmModule*>::iterator it;
3088 std::pair<std::multimap<TmPsu*, TmModule*>::iterator,std::multimap<TmPsu*, TmModule*>::iterator>
ret;
3089 for (
int rack=1; rack < (
npsuracks+1); rack++){
3090 std::ostringstream outs;
3092 outs << outputfilename <<
"psurack"<<rack<<
".html";
3093 txtfile =
new std::ofstream(outs.str().c_str(),
std::ios::out);
3094 *txtfile <<
"<html><head></head> <body>" << std::endl;
3095 for ( ipsu=
psuMap.begin();ipsu !=
psuMap.end(); ipsu++){
3096 TmPsu * psu= ipsu->second;
3098 *txtfile <<
"<a name="<<psu->
idex<<
"><pre>"<<std::endl;
3099 *txtfile << psu->
text << std::endl;
3100 std::ostringstream outs;
3101 if(psu->
nmod==0)outs <<
"Ps is in position" << psu->
getPsuBoard()<<
"in crate but doesn't seem to have any module connected";
else
3103 outs<<
"PS is in position " <<psu->
getPsuBoard()<<
" in crate and connects to "<<psu->
nmod<<
" modules. "<<std::endl;
3106 for (it = ret.first; it != ret.second; ++it)
3108 outs <<(*it).second->idex <<
" "<< (*it).second->name<<
" value= "<<(*it).second->value<<
" <br>"<<std::endl;
3111 *txtfile <<
"</pre><h4>"<< outs.str()<<
"</h4>"<<std::endl;
3115 *txtfile <<
"</body></html>" << std::endl;
3116 txtfile->close();
delete txtfile;
3122 std::ostringstream outs5,outs6;
3123 outs5 << outputfilename<<
"hv.png";
3126 outs6 << outputfilename<<
".xml";
3131 std::map<int , TmPsu *>::iterator ipsu;
3132 std::multimap<TmPsu*, TmModule*>::iterator it;
3133 std::pair<std::multimap<TmPsu*, TmModule*>::iterator,std::multimap<TmPsu*, TmModule*>::iterator>
ret;
3134 for (
int rack=1; rack < (
npsuracks+1); rack++){
3135 std::ostringstream outs;
3137 outs << outputfilename <<
"HVrack"<<rack<<
".html";
3138 txtfile =
new std::ofstream(outs.str().c_str(),
std::ios::out);
3139 *txtfile <<
"<html><head></head> <body>" << std::endl;
3140 for ( ipsu=
psuMap.begin();ipsu !=
psuMap.end(); ipsu++){
3141 TmPsu * psu= ipsu->second;
3143 *txtfile <<
"<a name="<<psu->
idex<<
"><pre>"<<std::endl;
3144 *txtfile << psu->
textHV2 << std::endl;
3145 std::ostringstream outsHV2;
3146 if(psu->
nmodHV2==0)outsHV2 <<
"HV Channel002 is in position" << psu->
getPsuBoard()<<
"in crate but doesn't seem to have any module connected";
else
3148 outsHV2<<
"HV Channel002 is in position " <<psu->
getPsuBoard()<<
" in crate and connects to "<<psu->
nmodHV2<<
" modules. "<<
" <br>"<<std::endl;
3151 for (it = ret.first; it != ret.second; ++it)
3153 if((*it).second->HVchannel==2){outsHV2 <<(*it).second->idex <<
" "<< (*it).second->name<<
" value= "<<(*it).second->value<<
" <br>"<<std::endl;}
3155 *txtfile <<
"</pre><h4>"<< outsHV2.str()<<
"</h4>"<<std::endl;
3158 *txtfile << psu->
textHV3 << std::endl;
3159 std::ostringstream outsHV3;
3160 if(psu->
nmodHV3==0)outsHV3 <<
"HV Channel003 is in position" << psu->
getPsuBoard()<<
"in crate but doesn't seem to have any module connected";
else
3162 outsHV3<<
"HV Channel003 is in position " <<psu->
getPsuBoard()<<
" in crate and connects to "<<psu->
nmodHV3<<
" modules. "<<
" <br>"<<std::endl;
3165 for (it = ret.first; it != ret.second; ++it)
3167 if((*it).second->HVchannel==3){outsHV3 <<(*it).second->idex <<
" "<< (*it).second->name<<
" value= "<<(*it).second->value<<
" <br>"<<std::endl;}
3169 *txtfile <<
"</pre><h4>"<< outsHV3.str()<<
"</h4>"<<std::endl;
3174 *txtfile <<
"</body></html>" << std::endl;
3175 txtfile->close();
delete txtfile;
3182 float minval,maxval; minval=minval1; maxval=maxval1;
3183 if(
tkMapLog && (minval<maxval)) {minval=
pow(10.,minval1);maxval=
pow(10.,maxval1);}
3187 size_t found=filetype.find_last_of(
".");
3188 filetype=filetype.substr(found+1);
3189 found=outputfilename.find_last_of(
".");
3190 outputfilename=outputfilename.substr(0,found);
3192 std::ofstream * ofilename;
3193 std::ifstream * ifilename;
3194 std::ostringstream ofname;
3199 ifilename=
findfile(
"viewerHeader.xhtml");
3200 ofname << outputfilename <<
"viewer.html";
3201 ofilename =
new std::ofstream(ofname.str().c_str(),
std::ios::out);
3202 while (getline( *ifilename, line )) { *ofilename << line << std::endl; }
3203 *ofilename <<
" var tmapname=\"" <<outputfilename <<
"\""<<std::endl;
3204 *ofilename <<
" var tmaptitle=\"" <<
title <<
"\""<<std::endl;
3205 *ofilename <<
" var ncrates=" <<
ncrates <<
";"<<std::endl;
3206 *ofilename <<
" var nfeccrates=" <<
nfeccrates <<
";"<<std::endl;
3207 *ofilename <<
" var npsuracks=" <<
npsuracks <<
";"<<std::endl;
3208 ifilename->close();
delete ifilename;
3209 ifilename=
findfile(
"viewerTrailer.xhtml");
3210 while (getline( *ifilename, line )) { *ofilename << line << std::endl; }
3211 ofilename->close();
delete ofilename;
3212 ifilename->close();
delete ifilename;
3213 command =
"sed -i \"s/XtmapnameX/"+outputfilename+
"/g\" "+ ofname.str();
3214 std::cout <<
"Executing " << command << std::endl;
3215 system(command.c_str());
3216 command =
"sed -i \"s/XtmaptitleX/"+
title+
"/g\" "+ ofname.str();
3217 std::cout <<
"Executing " << command << std::endl;
3218 system(command.c_str());
3222 ofname <<
"jqviewer.js";
3223 ofilename =
new std::ofstream(ofname.str().c_str(),
std::ios::out);
3224 while (getline( *ifilename, line )) { *ofilename << line << std::endl; }
3225 ofilename->close();
delete ofilename;
3226 ifilename->close();
delete ifilename;
3230 ofname <<
"crate.js";
3231 ofilename =
new std::ofstream(ofname.str().c_str(),
std::ios::out);
3232 while (getline( *ifilename, line )) { *ofilename << line << std::endl; }
3233 ofilename->close();
delete ofilename;
3234 ifilename->close();
delete ifilename;
3238 ofname <<
"feccrate.js";
3239 ofilename =
new std::ofstream(ofname.str().c_str(),
std::ios::out);
3240 while (getline( *ifilename, line )) { *ofilename << line << std::endl; }
3241 ofilename->close();
delete ofilename;
3242 ifilename->close();
delete ifilename;
3246 ofname <<
"rack.js";
3247 ofilename =
new std::ofstream(ofname.str().c_str(),
std::ios::out);
3248 while (getline( *ifilename, line )) { *ofilename << line << std::endl; }
3249 ofilename->close();
delete ofilename;
3250 ifilename->close();
delete ifilename;
3254 ofname <<
"rackhv.js";
3255 ofilename =
new std::ofstream(ofname.str().c_str(),
std::ios::out);
3256 while (getline( *ifilename, line )) { *ofilename << line << std::endl; }
3257 ofilename->close();
delete ofilename;
3258 ifilename->close();
delete ifilename;
3262 ofname <<
"layer.js";
3263 ofilename =
new std::ofstream(ofname.str().c_str(),
std::ios::out);
3264 while (getline( *ifilename, line )) { *ofilename << line << std::endl; }
3265 ofilename->close();
delete ofilename;
3266 ifilename->close();
delete ifilename;
3268 command =
"scp -r ../../DQM/TrackerCommon/test/jquery/ .";
3269 std::cout <<
"Executing " << command << std::endl;
3270 system(command.c_str());
3271 command =
"scp -r ../../CommonTools/TrackerMap/data/images/ .";
3272 std::cout <<
"Executing " << command << std::endl;
3273 system(command.c_str());
3276 std::ostringstream outs;
3277 outs << outputfilename<<
".png";
3281 std::ostringstream outs;
3282 outs << outputfilename<<
".png";
3288 for (
int layer=1; layer < 44; layer++){
3289 std::ostringstream outs;
3290 outs << outputfilename <<
"layer"<<layer<<
".html";
3291 txtfile =
new std::ofstream(outs.str().c_str(),
std::ios::out);
3292 *txtfile <<
"<html><head></head> <body>" << std::endl;
3300 *txtfile <<
"<a name="<<idmod<<
"><pre>"<<std::endl;
3301 std::multimap<const int, TmApvPair*>::iterator pos;
3307 *txtfile << apvpair->
text << std::endl;
3311 *txtfile <<
"</pre><h3>"<< mod->
name<<
"</h3>"<<std::endl;
3315 *txtfile <<
"</body></html>" << std::endl;
3316 txtfile->close();
delete txtfile;
3320 std::ostringstream outs1,outs2;
3322 else outs1 << outputfilename<<
"fed."<<
filetype;
3325 outs2 << outputfilename<<
".xml";
3328 std::map<int , int>::iterator i_fed;
3331 std::ostringstream outs;
3332 outs << outputfilename <<
"crate"<<crate<<
".html";
3333 txtfile =
new std::ofstream(outs.str().c_str(),
std::ios::out);
3334 *txtfile <<
"<html><head></head> <body>" << std::endl;
3335 for (i_fed=
fedMap.begin();i_fed !=
fedMap.end(); i_fed++){
3336 if(i_fed->second == crate){
3337 int fedId = i_fed->first;
3338 for (
int nconn=0;nconn<96;nconn++){
3339 int key = fedId*1000+nconn;
3343 *txtfile <<
"<a name="<<idmod<<
"><pre>"<<std::endl;
3344 *txtfile << apvPair->
text << std::endl;
3345 std::ostringstream outs;
3346 outs <<
"fedchannel " <<apvPair->
getFedId() <<
"/"<<apvPair->
getFedCh()<<
" connects to module " << apvPair->
mod->
idex ;
3347 *txtfile <<
"</pre><h3>"<< outs.str()<<
"</h3>"<<std::endl;
3352 *txtfile <<
"</body></html>" << std::endl;
3353 txtfile->close();
delete txtfile;
3358 std::ostringstream outs1,outs2;
3360 else outs1 << outputfilename<<
"fec."<<
filetype;
3363 outs2 << outputfilename<<
".xml";
3367 std::map<int , TmCcu *>::iterator i_ccu;
3368 std::multimap<TmCcu*, TmModule*>::iterator it;
3369 std::pair<std::multimap<TmCcu*, TmModule*>::iterator,std::multimap<TmCcu*, TmModule*>::iterator>
ret;
3370 for (
int crate=1; crate < (
nfeccrates+1); crate++){
3371 std::ostringstream outs;
3372 outs << outputfilename <<
"feccrate"<<crate<<
".html";
3373 txtfile =
new std::ofstream(outs.str().c_str(),
std::ios::out);
3374 *txtfile <<
"<html><head></head> <body>" << std::endl;
3375 for( i_ccu=
ccuMap.begin();i_ccu !=
ccuMap.end(); i_ccu++){
3376 TmCcu * ccu= i_ccu->second;
3379 *txtfile <<
"<a name="<<idmod<<
"><pre>"<<std::endl;
3380 *txtfile << ccu->
text << std::endl;
3381 std::ostringstream outs;
3382 if(ccu->
nmod==0)outs <<
"ccu is in position" << ccu->
mpos<<
"in ring but doesn't seem to have any module connected";
else
3384 outs <<
"ccu is in position " << ccu->
mpos<<
" in ring and connects " <<ccu->
nmod<<
" modules" << std::endl;
3386 for (it = ret.first; it != ret.second; ++it)
3388 outs << (*it).second->idex<<
" " << (*it).second->name <<
" value= "<< (*it).second->value<<
"\n\n";
3391 *txtfile <<
"</pre><h4>"<< outs.str()<<
"</h4>"<<std::endl;
3395 *txtfile <<
"</body></html>" << std::endl;
3401 std::ostringstream outs3,outs4;
3403 else outs3 << outputfilename<<
"psu."<<
filetype;
3406 outs4 << outputfilename<<
".xml";
3411 std::map<int , TmPsu *>::iterator ipsu;
3412 std::multimap<TmPsu*, TmModule*>::iterator it;
3413 std::pair<std::multimap<TmPsu*, TmModule*>::iterator,std::multimap<TmPsu*, TmModule*>::iterator>
ret;
3414 for (
int rack=1; rack < (
npsuracks+1); rack++){
3415 std::ostringstream outs;
3417 outs << outputfilename <<
"psurack"<<rack<<
".html";
3418 txtfile =
new std::ofstream(outs.str().c_str(),
std::ios::out);
3419 *txtfile <<
"<html><head></head> <body>" << std::endl;
3420 for ( ipsu=
psuMap.begin();ipsu !=
psuMap.end(); ipsu++){
3421 TmPsu * psu= ipsu->second;
3423 *txtfile <<
"<a name="<<psu->
idex<<
"><pre>"<<std::endl;
3424 *txtfile << psu->
text << std::endl;
3425 std::ostringstream outs;
3426 if(psu->
nmod==0)outs <<
"Ps is in position" << psu->
getPsuBoard()<<
"in crate but doesn't seem to have any module connected";
else
3428 outs<<
"PS is in position " <<psu->
getPsuBoard()<<
" in crate and connects to "<<psu->
nmod<<
" modules. "<<std::endl;
3431 for (it = ret.first; it != ret.second; ++it)
3433 outs <<(*it).second->idex <<
" "<< (*it).second->name<<
" value= "<<(*it).second->value<<
" <br>"<<std::endl;
3436 *txtfile <<
"</pre><h4>"<< outs.str()<<
"</h4>"<<std::endl;
3440 *txtfile <<
"</body></html>" << std::endl;
3448 std::ostringstream outs5,outs6;
3450 else outs5 << outputfilename<<
"hv."<<
filetype;
3453 outs6 << outputfilename<<
".xml";
3458 std::map<int , TmPsu *>::iterator ipsu;
3459 std::multimap<TmPsu*, TmModule*>::iterator it;
3460 std::pair<std::multimap<TmPsu*, TmModule*>::iterator,std::multimap<TmPsu*, TmModule*>::iterator>
ret;
3461 for (
int rack=1; rack < (
npsuracks+1); rack++){
3462 std::ostringstream outs;
3464 outs << outputfilename <<
"HVrack"<<rack<<
".html";
3465 txtfile =
new std::ofstream(outs.str().c_str(),
std::ios::out);
3466 *txtfile <<
"<html><head></head> <body>" << std::endl;
3467 for ( ipsu=
psuMap.begin();ipsu !=
psuMap.end(); ipsu++){
3468 TmPsu * psu= ipsu->second;
3470 *txtfile <<
"<a name="<<psu->
idex<<
"><pre>"<<std::endl;
3471 *txtfile << psu->
textHV2 << std::endl;
3472 std::ostringstream outsHV2;
3473 if(psu->
nmodHV2==0)outsHV2 <<
"HV Channel002 is in position" << psu->
getPsuBoard()<<
"in crate but doesn't seem to have any module connected";
else
3475 outsHV2<<
"HV Channel002 is in position " <<psu->
getPsuBoard()<<
" in crate and connects to "<<psu->
nmodHV2<<
" modules. "<<
" <br>"<<std::endl;
3478 for (it = ret.first; it != ret.second; ++it)
3480 if((*it).second->HVchannel==2){outsHV2 <<(*it).second->idex <<
" "<< (*it).second->name<<
" value= "<<(*it).second->value<<
" <br>"<<std::endl;}
3482 *txtfile <<
"</pre><h4>"<< outsHV2.str()<<
"</h4>"<<std::endl;
3485 *txtfile << psu->
textHV3 << std::endl;
3486 std::ostringstream outsHV3;
3487 if(psu->
nmodHV3==0)outsHV3 <<
"HV Channel003 is in position" << psu->
getPsuBoard()<<
"in crate but doesn't seem to have any module connected";
else
3489 outsHV3<<
"HV Channel003 is in position " <<psu->
getPsuBoard()<<
" in crate and connects to "<<psu->
nmodHV3<<
" modules. "<<
" <br>"<<std::endl;
3492 for (it = ret.first; it != ret.second; ++it)
3494 if((*it).second->HVchannel==3){outsHV3 <<(*it).second->idex <<
" "<< (*it).second->name<<
" value= "<<(*it).second->value<<
" <br>"<<std::endl;}
3496 *txtfile <<
"</pre><h4>"<< outsHV3.str()<<
"</h4>"<<std::endl;
3501 *txtfile <<
"</body></html>" << std::endl;
3512 std::ifstream * ifilename;
3518 ifname=
"CommonTools/TrackerMap/data/"+
filename;
3522 ifname=
"CommonTools/TrackerMap/data/"+
filename;
3525 if(!ifilename)
std::cout <<
"File " << filename <<
" missing" << std::endl;
3532 for (
int layer=1; layer < 44; layer++){
3547 for (
int layer=1; layer < 44; layer++){
3560 for (
int layer=1; layer < 44; layer++){
3561 std::ostringstream outs;
3562 outs << outputfilename <<
"layer"<<layer<<
".xml";
3563 xmlfile =
new std::ofstream(outs.str().c_str(),
std::ios::out);
3564 *xmlfile <<
"<?xml version=\"1.0\" standalone=\"no\"?>"<<std::endl;
3565 *xmlfile <<
"<svg xmlns=\"http://www.w3.org/2000/svg\""<<std::endl;
3566 *xmlfile <<
"xmlns:svg=\"http://www.w3.org/2000/svg\""<<std::endl;
3567 *xmlfile <<
"xmlns:xlink=\"http://www.w3.org/1999/xlink\" >"<<std::endl;
3568 *xmlfile <<
"<script type=\"text/ecmascript\" xlink:href=\"layer.js\" />"<<std::endl;
3569 *xmlfile <<
"<svg id=\"mainMap\" x=\"0\" y=\"0\" viewBox=\"0 0 500 500\" width=\"700\" height=\"700\" onload=\"TrackerLayer.init()\">"<<std::endl;
3570 if(layer<31)*xmlfile <<
"<g id=\"layer\" transform=\" translate(0,400) rotate(270) scale(1.,1.)\" > "<<std::endl;
3571 else *xmlfile <<
"<g id=\"layer\" transform=\" translate(0,400) rotate(270) scale(1.,0.8)\" > "<<std::endl;
3572 *xmlfile <<
"<rect fill=\"lightblue\" stroke=\"none\" x=\"0\" y=\"0\" width=\"700\" height=\"700\" />"<<std::endl;
3573 *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;
3574 *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;
3575 *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;
3576 *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;
3577 *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;
3586 drawModule(mod,key,layer,print_total,xmlfile);
3590 *xmlfile <<
"</g> </svg> <text id=\"currentElementText\" x=\"40\" y=\"30\">" << std::endl;
3591 *xmlfile <<
"<tspan id=\"line1\" x=\"40\" y=\"30\"> </tspan> " << std::endl;
3592 *xmlfile <<
"<tspan id=\"line2\" x=\"40\" y=\"60\"> </tspan> " << std::endl;
3593 *xmlfile <<
"<tspan id=\"line3\" x=\"40\" y=\"90\"> </tspan> " << std::endl;
3594 *xmlfile <<
"<tspan id=\"line4\" x=\"40\" y=\"120\"> </tspan> " << std::endl;
3596 *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;
3597 *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;
3598 *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;
3599 *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;
3600 *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;
3603 *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;
3604 *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;
3605 *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;
3606 *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;
3607 *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;
3609 *xmlfile <<
" </text> </svg>" << std::endl;
3610 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()