16 #include "TPolyLine.h"
38 jsfilename=
"CommonTools/TrackerMap/data/trackermap.txt";
39 infilename=
"CommonTools/TrackerMap/data/tracker.dat";
69 const std::vector<unsigned short> feds = tkFed->
feds();
70 std::cout<<
"SiStripFedCabling has "<< feds.size()<<
" active FEDS"<<std::endl;
73 for(std::vector<unsigned short>::const_iterator ifed = feds.begin();ifed<feds.end();ifed++){
74 const std::vector<FedChannelConnection> theconn = tkFed->
connections( *ifed );
76 for(std::vector<FedChannelConnection>::const_iterator iconn = theconn.begin();iconn<theconn.end();iconn++){
87 int key = iconn->fedId()*1000+iconn->fedCh();
89 if(apvpair!=0)
std::cout <<
"Fed "<< iconn->fedId() <<
" channel " << iconn->fedCh() <<
" seem to be already loaded!"<<std::endl;
95 if(
fedMap[iconn->fedId()]==0){
fedMap[iconn->fedId()]=iconn->fedCrate();}
96 if(
slotMap[iconn->fedId()]==0){
slotMap[iconn->fedId()]=iconn->fedSlot();}
97 if(ncrates==0 || ncrates < iconn->fedCrate()) ncrates = iconn->fedCrate();
102 apvpair =
new TmApvPair(key,iconn->fedCrate());
104 apvpair->
mpos=iconn->apvPairNumber();
106 apvModuleMap.insert(std::make_pair(iconn->detId(),apvpair));
109 apvpair->
text=s.str();
116 std::map<int , TmModule *>::iterator i_mod;
120 std::ostringstream outs,outs1;
121 outs <<
" connected to ";
126 std::multimap<const int, TmApvPair*>::iterator
pos;
132 outs1 << apvpair->
idex+apvpair->
crate*1000000<<
",";
137 outs<<
"("<<nchan<<
")";
139 std::string s = outs1.str(); s.erase(s.end()-1,s.end());
146 int nfec=0;
int nccu;
int nmod;
153 while(!Ccufile.eof()) {
154 Ccufile >> crate >> slot >> ring >> addr >>
pos;
155 getline(Ccufile,dummys);
156 int key =crate*10000000+slot*100000+ring*1000+addr;
159 ccu =
new TmCcu(crate,slot,ring,addr);
165 for ( std::vector<SiStripFecCrate>::const_iterator icrate = fecCabling_->
crates().begin(); icrate != fecCabling_->
crates().end(); icrate++ ) {
166 for ( std::vector<SiStripFec>::const_iterator ifec = icrate->fecs().begin(); ifec != icrate->fecs().end(); ifec++ ) {
167 for ( std::vector<SiStripRing>::const_iterator iring = ifec->rings().begin(); iring != ifec->rings().end(); iring++ ) {
169 for ( std::vector<SiStripCcu>::const_iterator iccu = iring->ccus().begin(); iccu != iring->ccus().end(); iccu++ ) {
171 int key = icrate->fecCrate()*10000000+ifec->fecSlot()*100000+iring->fecRing()*1000+iccu->ccuAddr();
174 for ( std::vector<SiStripModule>::const_iterator imod = iccu->modules().begin(); imod != iccu->modules().end(); imod++ ) {
181 if(ccu==0)
std::cout <<key<<
" This ccu seems to have not been stored! " << std::endl;
else{ ccu->
nmod=nmod;ccu->
layer=layer;}
189 std::map<int , TmCcu *>::iterator i_ccu;
190 std::multimap<TmCcu*, TmModule*>::iterator it;
191 std::pair<std::multimap<TmCcu*, TmModule*>::iterator,std::multimap<TmCcu*, TmModule*>::iterator>
ret;
193 for( i_ccu=
ccuMap.begin();i_ccu !=
ccuMap.end(); i_ccu++){
194 TmCcu * ccu= i_ccu->second;
197 std::ostringstream outs;
198 std::ostringstream outs1;
202 for (it = ret.first; it != ret.second; ++it)
204 outs << (*it).second->idex <<
" ";
205 outs1 << (*it).second->getKey() <<
",";
208 ccu->
text=outs.str();
228 int npsu=0;
int nmod,nmodHV2,nmodHV3;
230 int dcs,branch,crate,board;
236 int rack_order[54]={0,1,0,2,0,3,0,
274 while(!LVfile.eof()) {
275 LVfile >> modId1 >> dcuId >> psIdinfo >> psinfo;
277 if(detCabling && detCabling->
getConnections(modId1).size()==0)
continue;
286 dcs= atoi(dcsinfo.c_str());
287 branch= atoi(branchinfo.c_str());
288 crate= atoi(crateinfo.c_str())+1;
289 board= atoi(boardinfo.c_str())+1;
290 rack = (branch+1)+(dcs-1)*6;
291 rack = rack_order[rack];
292 channel = atoi(channelinfo.c_str());
294 int key = rack*1000+crate*100+board;
299 psu =
new TmPsu(dcs,branch,rack,crate,board);
311 std::map<int , TmPsu *>::iterator ipsu;
312 std::multimap<TmPsu*, TmModule*>::iterator it;
313 std::pair<std::multimap<TmPsu*, TmModule*>::iterator,std::multimap<TmPsu*, TmModule*>::iterator>
ret;
317 TmPsu * psu= ipsu->second;
322 std::ostringstream outs;
323 std::ostringstream outs1;
325 std::ostringstream outs3;
326 std::ostringstream outs4;
328 std::ostringstream outs5;
329 std::ostringstream outs6;
334 if(enableHVProcessing){
346 for (it = ret.first; it != ret.second; ++it)
349 outs << (*it).second->idex <<
", ";
350 outs1 << (*it).second->getKey() <<
",";
352 if(enableHVProcessing){
353 if((*it).second->HVchannel==2){
355 outs3 << (*it).second->idex <<
", ";
356 outs4 << (*it).second->getKey() <<
",";}
357 else if((*it).second->HVchannel==3){
359 outs5 << (*it).second->idex <<
", ";
360 outs6 << (*it).second->getKey() <<
",";}
367 outs <<
"(" << psu->
nmod <<
")";
368 psu->
text=outs.str();
370 if(enableHVProcessing){
375 outs3 <<
"(" << psu->
nmodHV2 <<
")";
376 outs5 <<
"(" << psu->
nmodHV3 <<
")";
395 jsfilename=
"CommonTools/TrackerMap/data/trackermap.txt";
396 infilename=
"CommonTools/TrackerMap/data/tracker.dat";
415 jsfilename=
"CommonTools/TrackerMap/data/trackermap.txt";
416 infilename=
"CommonTools/TrackerMap/data/tracker.dat";
420 jsPath=
"CommonTools/TrackerMap/data/";
431 std::map<int , TmModule *>::iterator i_mod;
455 for (
int subdet=1; subdet <
ndet+1; subdet++){
456 for (
int detpart=1; detpart <
npart+1; detpart++){
458 for(
int layer=1; layer < nlayers+1; layer++){
461 int layer_g =
nlayer(subdet,detpart,layer);
464 if(subdet==3 && detpart!=2)
firstRing[layer_g-1]= 8-nrings;
490 for (
int layer=1; layer < 44; layer++){
495 if(mod !=0 )
delete mod;
505 std::map<int , TmApvPair *>::iterator i_apv;
506 for( i_apv=
apvMap.begin();i_apv !=
apvMap.end(); i_apv++){
512 std::map<int , TmCcu *>::iterator i_ccu;
513 for( i_ccu=
ccuMap.begin();i_ccu !=
ccuMap.end(); i_ccu++){
514 TmCcu * ccu= i_ccu->second;
518 std::map<int , TmPsu *>::iterator ipsu;
520 TmPsu * psu= ipsu->second;
538 double phi,
r,dx,dy, dy1;
539 double xp[4],yp[4],xp1,yp1;
540 double vhbot,vhtop,vhapo;
541 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};
542 double xt1,yt1,xs1=0.,ys1=0.,xt2,yt2,xs2,ys2,pv1,pv2;
559 if(mlay >12 && mlay <19){
561 xp[0]=r-vhtop;yp[0]=-vhapo;
562 xp[1]=r+vhtop;yp[1]=-vhapo;
563 xp[2]=r+vhtop;yp[2]=vhapo;
564 xp[3]=r-vhtop;yp[3]=vhapo;
567 xp[0]=r-vhapo;yp[0]=-vhbot;
568 xp[1]=r+vhapo;yp[1]=-vhtop;
569 xp[2]=r+vhapo;yp[2]=vhtop;
570 xp[3]=r-vhapo;yp[3]=vhbot;
572 for(
int j=0;
j<4;
j++){
573 xp1 = xp[
j]*
cos(phi)-yp[
j]*
sin(phi);
574 yp1 = xp[
j]*
sin(phi)+yp[
j]*
cos(phi);
575 xp[
j] = xp1;yp[
j]=yp1;
578 numod=mod->
idModule;
if(numod>100)numod=numod-100;
579 int vane = mod->
ring;
583 xt1=rmedio[mlay-31]; yt1=-vhtop/2.;
584 xs1 = xt1*
cos(phi)-yt1*
sin(phi);
585 ys1 = xt1*
sin(phi)+yt1*
cos(phi);
586 xt2=rmedio[mlay-31]; yt2=vhtop/2.;
587 xs2 = xt2*
cos(phi)-yt2*
sin(phi);
588 ys2 = xt2*
sin(phi)+yt2*
cos(phi);
591 if(mlay==31)dy1=0.39;
592 if(mlay==32)dy1=0.23;
593 if(mlay==33)dy1=0.16;
594 xp[0]=vane*(dx+dx/8.);yp[0]=numod*(dy1);
595 xp[1]=vane*(dx+dx/8.)+dx;yp[1]=numod*(dy1);
596 xp[2]=vane*(dx+dx/8.)+dx;yp[2]=numod*(dy1)+dy;
597 xp[3]=vane*(dx+dx/8.);yp[3]=numod*(dy1)+dy;
599 xt1=
r; yt1=-vhtop/2.;
600 xs1 = xt1*
cos(phi)-yt1*
sin(phi);
601 ys1 = xt1*
sin(phi)+yt1*
cos(phi);
603 xs2 = xt2*
cos(phi)-yt2*
sin(phi);
604 ys2 = xt2*
sin(phi)+yt2*
cos(phi);
607 if(fabs(pv1-pv2)>
M_PI && numod==1)pv1=pv1-2.*
M_PI;
608 if(fabs(pv1-pv2)>
M_PI && numod!=1)pv2=pv2+2.*
M_PI;
609 xp[0]=mod->
posz-vhapo/2.;yp[0]=4.2*pv1;
610 xp[1]=mod->
posz+vhapo/2.;yp[1]=4.2*pv1;
611 xp[2]=mod->
posz+vhapo/2. ;yp[2]=4.2*pv2;
612 xp[3]=mod->
posz-vhapo/2.;yp[3]=4.2*pv2;
627 for(
int j=0;
j<4;
j++){
632 sprintf(buffer,
"%X",mod->
idex);
636 red=(color>>16)&0xFF;
637 green=(color>>8)&0xFF;
643 if(
temporary_file) *svgfile << red <<
" " << green <<
" " << blue <<
" ";
else
644 *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=\"";
646 if(
temporary_file) *svgfile << 255 <<
" " << 255 <<
" " << 255 <<
" ";
else
647 *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=\"";
649 for(
int k=0;
k<
np;
k++){
651 *svgfile << xd[
k] <<
"," << yd[
k] <<
" " ;
653 if(
temporary_file)*svgfile << std::endl;
else *svgfile <<
"\" />" <<std::endl;
655 if(mod->
red>255)mod->
red=255;
659 *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=\"";
661 for(
int k=0;
k<
np;
k++){
663 *svgfile << xd[
k] <<
"," << yd[
k] <<
" " ;
665 if(
temporary_file)*svgfile << std::endl;
else *svgfile <<
"\" />" <<std::endl;
677 for (
int layer=1; layer < 44; layer++){
690 return std::make_pair(minval,maxval);
700 bool rangefound =
true;
703 std::vector<TPolyLine*> vp;
705 size_t found=filetype.find_last_of(
".");
706 filetype=filetype.substr(found+1);
707 found=outputfilename.find_last_of(
".");
708 outputfilename=outputfilename.substr(0,found);
712 std::ostringstream outs;
714 outs << outputfilename <<
".coor";
717 for (
int layer=1; layer < 44; layer++){
734 for (
int layer=1; layer < 44; layer++){
750 *
savefile <<
"<?xml version=\"1.0\" standalone=\"no\" ?>"<<std::endl;
751 *
savefile <<
"<svg xmlns=\"http://www.w3.org/2000/svg\""<<std::endl;
752 *
savefile <<
"xmlns:svg=\"http://www.w3.org/2000/svg\" "<<std::endl;
753 *
savefile <<
"xmlns:xlink=\"http://www.w3.org/1999/xlink\">"<<std::endl;
754 *
savefile <<
"<svg:svg id=\"mainMap\" x=\"0\" y=\"0\" viewBox=\"0 0 3100 1600"<<
"\" width=\""<<width<<
"\" height=\""<<height<<
"\">"<<std::endl;
755 *
savefile <<
"<svg:rect fill=\"lightblue\" stroke=\"none\" x=\"0\" y=\"0\" width=\"3100\" height=\"1600\" /> "<<std::endl;
756 *
savefile <<
"<svg:g id=\"tracker\" transform=\"translate(10,1500) rotate(270)\" style=\"fill:none;stroke:black;stroke-width:0;\"> "<<std::endl;
758 for (
int layer=1; layer < 44; layer++){
774 *
savefile <<
" <svg:text id=\"Title\" class=\"normalText\" x=\"300\" y=\"0\">"<<
title<<
"</svg:text>"<<std::endl;
779 *
savefile <<
"</svg:svg>"<<std::endl;
784 const char * command1;
785 std::string tempfilename = outputfilename +
".coor";
788 command1=command.c_str();
789 std::cout <<
"Executing " << command1 << std::endl;
795 int red,
green,blue,npoints,colindex,ncolor;
798 TCanvas *MyC =
new TCanvas(
"MyC",
"TrackerMap",width,height);
799 gPad->SetFillColor(38);
801 if(
addPixelFlag)gPad->Range(0,0,3800,1600);
else gPad->Range(800,0,3800,1600);
805 typedef std::map<int,int> ColorList;
807 ColorList::iterator
pos;
809 std::cout<<
"tempfilename "<<tempfilename<<std::endl;
810 while(!tempfile.eof()) {
811 tempfile >> red >> green >> blue >> npoints;
812 colindex=red+green*1000+blue*1000000;
813 pos=colorList.find(colindex);
814 if(pos == colorList.end()){ colorList[colindex]=ncolor+100; col =gROOT->GetColor(ncolor+100);
815 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++;}
816 for (
int i=0;
i<npoints;
i++){
817 tempfile >> x[
i] >> y[
i];
821 if(ncolor>0 && ncolor<10000){
823 for(
int i=0;
i<ncolor;
i++){colors[
i]=
i+100;}
824 gStyle->SetPalette(ncolor,colors);
828 tempfile.seekg(0,std::ios::beg);
829 std::cout <<
"created palette with " << ncolor <<
" colors" << std::endl;
831 while(!tempfile.eof()) {
832 tempfile >> red >> green >> blue >> npoints;
833 for (
int i=0;
i<npoints;
i++){
834 tempfile >> x[
i] >> y[
i];
836 colindex=red+green*1000+blue*1000000;
837 pos=colorList.find(colindex);
838 if(pos != colorList.end()){
839 TPolyLine* pline =
new TPolyLine(npoints,y,x);
841 pline->SetFillColor(colorList[colindex]);
842 pline->SetLineWidth(0);
849 axis =
new TGaxis(3660,36,3660,1530,lminvalue,lmaxvalue,510,
"+L");
850 axis->SetLabelSize(0.02);
855 l.DrawLatex(950,1330,
"TID");
856 l.DrawLatex(2300,1330,
"TEC");
857 l.DrawLatex(300,1330,
"FPIX");
858 l.DrawLatex(20,560,
"BPIX L1");
859 l.DrawLatex(500,385,
"BPIX L2");
860 l.DrawLatex(500,945,
"BPIX L3");
863 if(
tkMapLog && (fulltitle.find(
"Log10 scale") == std::string::npos)) fulltitle +=
": Log10 scale";
864 l.DrawLatex(850,1500,fulltitle.c_str());
865 l.DrawLatex(1730,40,
"-z");
866 l.DrawLatex(1730,1360,
"+z");
867 l.DrawLatex(1085,330,
"TIB L1");
868 l.DrawLatex(1085,1000,
"TIB L2");
869 l.DrawLatex(1585,330,
"TIB L3");
870 l.DrawLatex(1585,1000,
"TIB L4");
871 l.DrawLatex(2085,330,
"TOB L1");
872 l.DrawLatex(2085,1000,
"TOB L2");
873 l.DrawLatex(2585,330,
"TOB L3");
874 l.DrawLatex(2585,1000,
"TOB L4");
875 l.DrawLatex(3085,330,
"TOB L5");
876 l.DrawLatex(3085,1000,
"TOB L6");
877 TArrow arx(3448,1190,3448,1350,0.01,
"|>");
878 l.DrawLatex(3460,1350,
"x");
879 TArrow ary(3448,1190,3312,1190,0.01,
"|>");
880 l.DrawLatex(3312,1210,
"y");
881 TArrow arz(3485,373,3485,676,0.01,
"|>");
882 l.DrawLatex(3510,667,
"z");
883 TArrow arphi(3485,511,3037,511,0.01,
"|>");
884 l.DrawLatex(3023,520,
"#Phi");
888 arphi.SetLineWidth(3);
897 std::cout <<
"printing " <<filename<< std::endl;
898 MyC->Print(filename.c_str());
902 MyC->Print(filename.c_str());
906 MyC->Print(filename.c_str());
909 command1=command.c_str();
910 std::cout <<
"Executing " << command1 << std::endl;
915 for(std::vector<TPolyLine*>::iterator pos1=vp.begin();pos1!=vp.end();pos1++){
931 double boxinitx=0., boxinity=0.;
944 xp[0]=boxinitx;yp[0]=boxinity;
945 xp[1]=boxinitx+dx;yp[1]=boxinity;
946 xp[2]=boxinitx+dx;yp[2]=boxinity + dy;
947 xp[3]=boxinitx;yp[3]=boxinity + dy;
948 for(
int j=0;
j<4;
j++){
954 sprintf(buffer,
"%X",apvPair->
mod->
idex);
956 s.erase(s.begin()+s.find(
"connected"),s.end());
959 if(apvPair->
red < 0){
960 if(apvPair->
count > 0) {
962 red=(color>>16)&0xFF;
963 green=(color>>8)&0xFF;
966 if(
temporary_file)*svgfile << red <<
" " << green <<
" " << blue <<
" ";
967 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=\"";
969 if(
temporary_file)*svgfile << 255 <<
" " << 255 <<
" " << 255 <<
" ";
970 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=\"";
973 if(apvPair->
red>255)apvPair->
red=255;
975 if(apvPair->
blue>255)apvPair->
blue=255;
977 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=\"";
980 if(apvPair->
mod->
red < 0){
983 red=(color>>16)&0xFF;
984 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=\"";
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->
mod->
red<<
","<<apvPair->
mod->
green<<
","<<apvPair->
mod->
blue<<
")\" points=\"";
1001 for(
int k=0;
k<
np;
k++){
1003 else *svgfile << xd[
k] <<
"," << yd[
k] <<
" " ;
1006 else *svgfile <<
"\" />" <<std::endl;
1017 double boxinitx=0., boxinity=0.;
1019 int numccu_incolumn = 8;
1020 int numccu_inrow = 15;
1021 int numfec_incolumn = 5;
1022 int numfec_inrow = 4;
1023 boxinitx=boxinitx+(numfec_incolumn-(numfec_incrate-1)/numfec_inrow)*14.;
1024 boxinity=boxinity+(numfec_inrow-(numfec_incrate-1)%numfec_inrow)*16.;
1025 boxinity=boxinity+numccu_inrow-ccu->
mpos;
1026 boxinitx = boxinitx+numccu_incolumn-(int)(ccu->
getCcuRing()%numccu_incolumn);
1028 xp[0]=boxinitx;yp[0]=boxinity;
1029 xp[1]=boxinitx+dx;yp[1]=boxinity;
1030 xp[2]=boxinitx+dx;yp[2]=boxinity + dy;
1031 xp[3]=boxinitx;yp[3]=boxinity + dy;
1032 for(
int j=0;
j<4;
j++){
1038 sprintf(buffer,
"%X",ccu->
idex);
1042 s.erase(s.begin()+s.find(
"connected"),s.end());
1045 if(ccu->
count > 0) {
1047 red=(color>>16)&0xFF;
1048 green=(color>>8)&0xFF;
1051 if(
temporary_file)*svgfile << red <<
" " << green <<
" " << blue <<
" ";
1052 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=\"";
1054 if(
temporary_file)*svgfile << 255 <<
" " << 255 <<
" " << 255 <<
" ";
1055 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=\"";
1058 if(ccu->
red>255)ccu->
red=255;
1062 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=\"";
1065 for(
int k=0;
k<
np;
k++){
1067 else *svgfile << xd[
k] <<
"," << yd[
k] <<
" " ;
1070 else *svgfile <<
"\" />" <<std::endl;
1082 double boxinitx=0., boxinity=0.;
1088 xp[0]=boxinitx;yp[0]=boxinity;
1089 xp[1]=boxinitx+dx;yp[1]=boxinity;
1090 xp[2]=boxinitx+dx;yp[2]=boxinity + dy;
1091 xp[3]=boxinitx;yp[3]=boxinity + dy;
1094 for(
int j=0;
j<4;
j++){
1111 sprintf(buffer,
"%X",psu->
idex);
1113 s.erase(s.begin()+s.find(
"connected"),s.end());
1118 red=(color>>16)&0xFF;
1119 green=(color>>8)&0xFF;
1122 if(
temporary_file)*svgfile << red <<
" " << green <<
" " << blue <<
" ";
1123 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=\"";
1127 if(
temporary_file)*svgfile << 255 <<
" " << 255 <<
" " << 255 <<
" ";
1128 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=\"";
1133 if(psu->
red>255)psu->
red=255;
1137 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=\"";
1141 for(
int k=0;
k<
np;
k++){
1143 else *svgfile << xd[
k] <<
"," << yd[
k] <<
" " ;
1146 else *svgfile <<
"\" />" <<std::endl;
1159 double boxinitx=35, boxinity=12;
1160 double dx=1.1,dy=1.3;
1163 boxinity= boxinity+(18 - psu->
getPsuBoard())*1.75;
1165 xp[0]=boxinitx;yp[0]=boxinity;
1166 xp[1]=boxinitx+dx;yp[1]=boxinity;
1167 xp[2]=boxinitx+dx;yp[2]=boxinity + dy;
1168 xp[3]=boxinitx;yp[3]=boxinity + dy;
1171 for(
int j=0;
j<4;
j++){
1177 sprintf(buffer,
"%X",psu->
idex);
1179 s.erase(s.begin()+s.find(
"connected"),s.end());
1185 redHV2=(color>>16)&0xFF;
1186 greenHV2=(color>>8)&0xFF;
1187 blueHV2=(
color)&0xFF;
1189 if(
temporary_file)*svgfile << redHV2 <<
" " << greenHV2 <<
" " << blueHV2 <<
" ";
1190 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=\"";
1193 if(
temporary_file)*svgfile << 255 <<
" " << 255 <<
" " << 255 <<
" ";
1194 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=\"";
1203 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=\"";
1207 for(
int k=0;
k<
np;
k++){
1209 else *svgfile << xd[
k] <<
"," << yd[
k] <<
" " ;
1212 else *svgfile <<
"\" />" <<std::endl;
1226 double boxinitx=36.5, boxinity=12;
1227 double dx=1.1,dy=1.3;
1230 boxinity= boxinity+(18 - psu->
getPsuBoard())*1.75;
1232 xp[0]=boxinitx;yp[0]=boxinity;
1233 xp[1]=boxinitx+dx;yp[1]=boxinity;
1234 xp[2]=boxinitx+dx;yp[2]=boxinity + dy;
1235 xp[3]=boxinitx;yp[3]=boxinity + dy;
1238 for(
int j=0;
j<4;
j++){
1244 sprintf(buffer,
"%X",psu->
idex);
1246 s.erase(s.begin()+s.find(
"connected"),s.end());
1251 redHV3=(color>>16)&0xFF;
1252 greenHV3=(color>>8)&0xFF;
1253 blueHV3=(
color)&0xFF;
1255 if(
temporary_file)*svgfile << redHV3 <<
" " << greenHV3 <<
" " << blueHV3 <<
" ";
1256 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=\"";
1259 if(
temporary_file)*svgfile << 255 <<
" " << 255 <<
" " << 255 <<
" ";
1260 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=\"";
1269 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=\"";
1273 for(
int k=0;
k<
np;
k++){
1275 else *svgfile << xd[
k] <<
"," << yd[
k] <<
" " ;
1278 else *svgfile <<
"\" />" <<std::endl;
1286 std::vector<TPolyLine*> vp;
1288 size_t found=filetype.find_last_of(
".");
1289 filetype=filetype.substr(found+1);
1290 found=outputfilename.find_last_of(
".");
1291 outputfilename=outputfilename.substr(0,found);
1294 std::ostringstream outs;
1296 outs << outputfilename <<
".coor";
1298 std::map<int , TmCcu *>::iterator i_ccu;
1299 std::multimap<TmCcu*, TmModule*>::iterator it;
1300 std::pair<std::multimap<TmCcu*, TmModule*>::iterator,std::multimap<TmCcu*, TmModule*>::iterator>
ret;
1302 bool useCcuValue=
false;
1305 for( i_ccu=
ccuMap.begin();i_ccu !=
ccuMap.end(); i_ccu++){
1306 TmCcu * ccu= i_ccu->second;
1308 if(ccu->
count > 0 || ccu->
red!=-1) { useCcuValue=
true;
break;}
1314 for( i_ccu=
ccuMap.begin();i_ccu !=
ccuMap.end(); i_ccu++){
1315 TmCcu * ccu= i_ccu->second;
1318 for (it = ret.first; it != ret.second; ++it)
1320 if( (*it).second->count>0){ccu->
value=ccu->
value+(*it).second->value;ccu->
count++;}
1328 if(
title==
" Tracker Map from QTestAlarm"){
1329 for( i_ccu=
ccuMap.begin();i_ccu !=
ccuMap.end(); i_ccu++){
1330 TmCcu * ccu= i_ccu->second;
1334 for (it = ret.first; it != ret.second; ++it) {
1335 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 ) ){
1346 for( i_ccu=
ccuMap.begin();i_ccu !=
ccuMap.end(); i_ccu++){
1347 TmCcu * ccu= i_ccu->second;
1359 for( i_ccu=
ccuMap.begin();i_ccu !=
ccuMap.end(); i_ccu++){
1360 TmCcu * ccu= i_ccu->second;
1361 if(ccu!=0 && ccu->
count>0) {
1370 if(filetype==
"svg"){
1372 std::ostringstream outs;
1373 outs << outputfilename<<
".svg";
1375 *
savefile <<
"<?xml version=\"1.0\" standalone=\"no\" ?>"<<std::endl;
1376 *
savefile <<
"<svg xmlns=\"http://www.w3.org/2000/svg\""<<std::endl;
1377 *
savefile <<
"xmlns:svg=\"http://www.w3.org/2000/svg\" "<<std::endl;
1378 *
savefile <<
"xmlns:xlink=\"http://www.w3.org/1999/xlink\">"<<std::endl;
1379 *
savefile <<
"<svg:svg id=\"mainMap\" x=\"0\" y=\"0\" viewBox=\"0 0 3000 1600"<<
"\" width=\""<<width<<
"\" height=\""<<height<<
"\">"<<std::endl;
1380 *
savefile <<
"<svg:rect fill=\"lightblue\" stroke=\"none\" x=\"0\" y=\"0\" width=\"3000\" height=\"1600\" /> "<<std::endl;
1381 *
savefile <<
"<svg:g id=\"fedtrackermap\" transform=\"translate(10,1500) rotate(270)\" style=\"fill:none;stroke:black;stroke-width:0;\"> "<<std::endl;
1383 for (
int crate=1; crate < (
nfeccrates+1); crate++){
1384 if(filetype==
"xml"){
1386 std::ostringstream outs;
1387 outs << outputfilename<<
"feccrate" <<crate<<
".xml";
1389 *
savefile <<
"<?xml version=\"1.0\" standalone=\"no\"?>"<<std::endl;
1390 *
savefile <<
"<svg xmlns=\"http://www.w3.org/2000/svg\""<<std::endl;
1391 *
savefile <<
"xmlns:svg=\"http://www.w3.org/2000/svg\""<<std::endl;
1392 *
savefile <<
"xmlns:xlink=\"http://www.w3.org/1999/xlink\" >"<<std::endl;
1393 *
savefile <<
"<script type=\"text/ecmascript\" xlink:href=\"feccrate.js\" />"<<std::endl;
1394 *
savefile <<
"<svg id=\"mainMap\" x=\"0\" y=\"0\" viewBox=\"0 0 500 500\" width=\"700\" height=\"700\" onload=\"TrackerCrate.init()\">"<<std::endl;
1395 *
savefile <<
"<rect fill=\"lightblue\" stroke=\"none\" x=\"0\" y=\"0\" width=\"700\" height=\"700\" />"<<std::endl;
1396 *
savefile <<
"<g id=\"crate\" transform=\" translate(280,580) rotate(270) scale(.7,.8)\" > "<<std::endl;
1401 for ( i_ccu=
ccuMap.begin();i_ccu !=
ccuMap.end(); i_ccu++){
1402 TmCcu * ccu= i_ccu->second;
1412 if(filetype==
"xml"){
1413 *
savefile <<
"</g> </svg> <text id=\"currentElementText\" x=\"40\" y=\"30\"> " << std::endl;
1414 *
savefile <<
"<tspan id=\"line1\" x=\"40\" y=\"30\"> </tspan> " << std::endl;
1415 *
savefile <<
"<tspan id=\"line2\" x=\"40\" y=\"60\"> </tspan> " << std::endl;
1416 *
savefile <<
" </text> </svg>" << std::endl;
1422 if(filetype==
"svg"){
1423 *
savefile <<
"</g> </svg> </svg> " << std::endl;
1426 if(!print_total && !useCcuValue){
1428 for( i_ccu=
ccuMap.begin();i_ccu !=
ccuMap.end(); i_ccu++){
1429 TmCcu * ccu= i_ccu->second;
1439 const char * command1;
1440 std::string tempfilename = outputfilename +
".coor";
1441 int red,
green,blue,npoints,colindex,ncolor;
1444 TCanvas *MyC =
new TCanvas(
"MyC",
"TrackerMap",width,height);
1445 gPad->SetFillColor(38);
1447 if(
saveWebInterface)gPad->Range(0,0,3700,1600);
else gPad->Range(0,0,3800,1600);
1451 typedef std::map<int,int> ColorList;
1452 ColorList colorList;
1453 ColorList::iterator
pos;
1455 while(!tempfile.eof()) {
1456 tempfile >> red >> green >> blue >> npoints;
1457 colindex=red+green*1000+blue*1000000;
1458 pos=colorList.find(colindex);
1459 if(pos == colorList.end()){
1460 colorList[colindex]=ncolor+100;
1461 col =gROOT->GetColor(ncolor+100);
1463 col->SetRGB((Double_t)(red/255.),(Double_t)(green/255.),(Double_t)(blue/255.));
1465 c =
new TColor(ncolor+100,(Double_t)(red/255.),(Double_t)(green/255.),(Double_t)(blue/255.));
1469 for (
int i=0;
i<npoints;
i++){
1470 tempfile >> x[
i] >> y[
i];
1473 if(ncolor>0 && ncolor<10000){
1475 for(
int i=0;
i<ncolor;
i++){colors[
i]=
i+100;}
1476 gStyle->SetPalette(ncolor,colors);
1479 tempfile.seekg(0,std::ios::beg);
1480 std::cout <<
"created palette with " << ncolor <<
" colors" << std::endl;
1481 while(!tempfile.eof()) {
1482 tempfile >> red >> green >> blue >> npoints;
1483 for (
int i=0;
i<npoints;
i++){
1484 tempfile >> x[
i] >> y[
i];
1486 colindex=red+green*1000+blue*1000000;
1487 pos=colorList.find(colindex);
1488 if(pos != colorList.end()){
1489 TPolyLine* pline =
new TPolyLine(npoints,y,x);
1490 vp.push_back(pline);
1491 pline->SetFillColor(colorList[colindex]);
1492 pline->SetLineWidth(0);
1499 axis =
new TGaxis(3660,36,3660,1530,lminvalue,lmaxvalue,510,
"+L");
1500 axis->SetLabelSize(0.02);
1506 l.SetTextSize(0.05);
1508 if(
tkMapLog && (fulltitle.find(
"Log10 scale") == std::string::npos)) fulltitle +=
": Log10 scale";
1509 l.DrawLatex(50,1530,fulltitle.c_str());
1512 std::cout <<
"Filetype " << filetype << std::endl;
1513 if(filetype==
"png"){
1515 MyC->Print(filename.c_str());
1517 if(filetype==
"jpg"){
1519 MyC->Print(filename.c_str());
1521 if(filetype==
"pdf"){
1523 MyC->Print(filename.c_str());
1526 command1=command.c_str();
1527 std::cout <<
"Executing " << command1 << std::endl;
1532 for(std::vector<TPolyLine*>::iterator pos1=vp.begin();pos1!=vp.end();pos1++){
1545 std::vector<TPolyLine*> vp;
1547 size_t found=filetype.find_last_of(
".");
1548 filetype=filetype.substr(found+1);
1549 found=outputfilename.find_last_of(
".");
1550 outputfilename=outputfilename.substr(0,found);
1557 std::ostringstream outs;
1559 outs << outputfilename <<
".coor";
1562 std::map<int , TmPsu *>::iterator ipsu;
1563 std::multimap<TmPsu*, TmModule*>::iterator it;
1564 std::pair<std::multimap<TmPsu*, TmModule*>::iterator,std::multimap<TmPsu*, TmModule*>::iterator>
ret;
1567 bool usePsuValue=
false;
1570 TmPsu* psu= ipsu->second;
1579 TmPsu * psu= ipsu->second;
1582 int nconn1=0;
int nconn2=0;
1583 for(it = ret.first; it != ret.second; ++it){
1584 if((*it).second->HVchannel==2&&(*it).second->count>0){ nconn1++;psu->
valueHV2=psu->
valueHV2+(*it).second->value;}
1585 if((*it).second->HVchannel==3&&(*it).second->count>0){ nconn2++;psu->
valueHV3=psu->
valueHV3+(*it).second->value;}
1595 if(
title==
" Tracker Map from QTestAlarm"){
1597 TmPsu * psu= ipsu->second;
1602 for (it = ret.first; it != ret.second; ++it) {
1603 if((*it).second->HVchannel==2){
1604 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 ) ){
1608 if((*it).second->HVchannel==3){
1609 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 ) ){
1620 TmPsu * psu= ipsu->second;
1636 TmPsu * psu= ipsu->second;
1647 if(filetype==
"svg"){
1649 std::ostringstream outs;
1650 outs << outputfilename<<
".svg";
1652 *
savefile <<
"<?xml version=\"1.0\" standalone=\"no\" ?>"<<std::endl;
1653 *
savefile <<
"<svg xmlns=\"http://www.w3.org/2000/svg\""<<std::endl;
1654 *
savefile <<
"xmlns:svg=\"http://www.w3.org/2000/svg\" "<<std::endl;
1655 *
savefile <<
"xmlns:xlink=\"http://www.w3.org/1999/xlink\">"<<std::endl;
1656 *
savefile <<
"<svg:svg id=\"mainMap\" x=\"0\" y=\"0\" viewBox=\"0 0 3000 1600"<<
"\" width=\""<<width<<
"\" height=\""<<height<<
"\">"<<std::endl;
1657 *
savefile <<
"<svg:rect fill=\"lightblue\" stroke=\"none\" x=\"0\" y=\"0\" width=\"3000\" height=\"1600\" /> "<<std::endl;
1658 *
savefile <<
"<svg:g id=\"HVtrackermap\" transform=\"translate(10,1500) rotate(270)\" style=\"fill:none;stroke:black;stroke-width:0;\"> "<<std::endl;
1661 for (
int irack=1; irack < (
npsuracks+1); irack++){
1662 if(filetype==
"xml"){
1664 std::ostringstream outs;
1665 outs << outputfilename<<
"HVrack" <<irack<<
".xml";
1667 *
savefile <<
"<?xml version=\"1.0\" standalone=\"no\"?>"<<std::endl;
1668 *
savefile <<
"<svg xmlns=\"http://www.w3.org/2000/svg\""<<std::endl;
1669 *
savefile <<
"xmlns:svg=\"http://www.w3.org/2000/svg\""<<std::endl;
1670 *
savefile <<
"xmlns:xlink=\"http://www.w3.org/1999/xlink\" >"<<std::endl;
1671 *
savefile <<
"<script type=\"text/ecmascript\" xlink:href=\"rackhv.js\" />"<<std::endl;
1672 *
savefile <<
"<svg id=\"mainMap\" x=\"0\" y=\"0\" viewBox=\"0 0 500 500\" width=\"700\" height=\"700\" onload=\"TrackerRackhv.init()\">"<<std::endl;
1673 *
savefile <<
"<rect fill=\"lightblue\" stroke=\"none\" x=\"0\" y=\"0\" width=\"700\" height=\"700\" />"<<std::endl;
1674 *
savefile <<
"<g id=\"rackhv\" transform=\" translate(150,500) rotate(270) scale(1.,1.)\" > "<<std::endl;
1679 for ( ipsu=
psuMap.begin();ipsu !=
psuMap.end(); ipsu++){
1680 TmPsu * psu= ipsu->second;
1683 drawHV3(irack,psu->getPsuCrate(),print_total,psu,
savefile,usePsuValue);
1689 if(filetype==
"xml"){
1690 *
savefile <<
"</g> </svg> <text id=\"currentElementText\" x=\"40\" y=\"30\"> " << std::endl;
1691 *
savefile <<
"<tspan id=\"line1\" x=\"40\" y=\"30\"> </tspan> " << std::endl;
1692 *
savefile <<
"<tspan id=\"line2\" x=\"40\" y=\"60\"> </tspan> " << std::endl;
1693 *
savefile <<
" </text> </svg>" << std::endl;
1699 if(filetype==
"svg"){
1700 *
savefile <<
"</g> </svg> </svg> " << std::endl;
1705 if(!print_total && !usePsuValue){
1707 TmPsu *psu = ipsu->second;
1720 const char * command1;
1721 std::string tempfilename = outputfilename +
".coor";
1722 int red,
green,blue,npoints,colindex,ncolor;
1725 TCanvas *MyC =
new TCanvas(
"MyC",
"TrackerMap",width,height);
1726 gPad->SetFillColor(38);
1728 if(
saveWebInterface)gPad->Range(0,0,3700,1600);
else gPad->Range(0,0,3800,1600);
1732 typedef std::map<int,int> ColorList;
1733 ColorList colorList;
1734 ColorList::iterator
pos;
1736 while(!tempfile.eof()) {
1737 tempfile >> red >> green >> blue >> npoints;
1738 colindex=red+green*1000+blue*1000000;
1739 pos=colorList.find(colindex);
1740 if(pos == colorList.end()){
1741 colorList[colindex]=ncolor+100;
1742 col =gROOT->GetColor(ncolor+100);
1744 col->SetRGB((Double_t)(red/255.),(Double_t)(green/255.),(Double_t)(blue/255.));
1746 c =
new TColor(ncolor+100,(Double_t)(red/255.),(Double_t)(green/255.),(Double_t)(blue/255.));
1750 for (
int i=0;
i<npoints;
i++){
1751 tempfile >> x[
i] >> y[
i];
1754 if(ncolor>0 && ncolor<10000){
1756 for(
int i=0;
i<ncolor;
i++){colors[
i]=
i+100;}
1757 gStyle->SetPalette(ncolor,colors);
1760 tempfile.seekg(0,std::ios::beg);
1761 std::cout <<
"created palette with " << ncolor <<
" colors" << std::endl;
1762 while(!tempfile.eof()) {
1763 tempfile >> red >> green >> blue >> npoints;
1764 for (
int i=0;
i<npoints;
i++){
1765 tempfile >> x[
i] >> y[
i];
1767 colindex=red+green*1000+blue*1000000;
1768 pos=colorList.find(colindex);
1769 if(pos != colorList.end()){
1770 TPolyLine* pline =
new TPolyLine(npoints,y,x);
1771 vp.push_back(pline);
1772 pline->SetFillColor(colorList[colindex]);
1773 pline->SetLineWidth(0);
1780 axis =
new TGaxis(3660,36,3660,1530,lminvalue,lmaxvalue,510,
"+L");
1781 axis->SetLabelSize(0.02);
1788 l.SetTextSize(0.05);
1790 if(
tkMapLog && (fulltitle.find(
"Log10 scale") == std::string::npos)) fulltitle +=
": Log10 scale";
1791 l.DrawLatex(50,1530,fulltitle.c_str());
1794 std::cout <<
"Filetype " << filetype << std::endl;
1795 if(filetype==
"png"){
1797 MyC->Print(filename.c_str());
1799 if(filetype==
"jpg"){
1801 MyC->Print(filename.c_str());
1803 if(filetype==
"pdf"){
1805 MyC->Print(filename.c_str());
1808 command1=command.c_str();
1809 std::cout <<
"Executing " << command1 << std::endl;
1814 for(std::vector<TPolyLine*>::iterator pos1=vp.begin();pos1!=vp.end();pos1++){
1828 bool rangefound=
true;
1830 std::vector<TPolyLine*> vp;
1833 size_t found=filetype.find_last_of(
".");
1834 filetype=filetype.substr(found+1);
1835 found=outputfilename.find_last_of(
".");
1836 outputfilename=outputfilename.substr(0,found);
1844 std::ostringstream outs;
1846 outs << outputfilename <<
".coor";
1849 std::map<int , TmPsu *>::iterator ipsu;
1850 std::multimap<TmPsu*, TmModule*>::iterator it;
1851 std::pair<std::multimap<TmPsu*, TmModule*>::iterator,std::multimap<TmPsu*, TmModule*>::iterator>
ret;
1854 bool usePsuValue=
false;
1857 TmPsu* psu= ipsu->second;
1859 if(psu->
count > 0 || psu->
red!=-1) { usePsuValue=
true;
break;}
1865 TmPsu * psu= ipsu->second;
1869 for(it = ret.first; it != ret.second; ++it){
1870 if((*it).second->count>0){nconn++;psu->
value=psu->
value+(*it).second->value;}
1879 if(
title==
" Tracker Map from QTestAlarm"){
1881 TmPsu * psu= ipsu->second;
1887 for (it = ret.first; it != ret.second; ++it) {
1888 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 ) ){
1889 nconn++;psu->
value++;
1901 TmPsu * psu= ipsu->second;
1915 TmPsu * psu= ipsu->second;
1916 if(psu!=0 && psu->
count>0) {
1926 if(filetype==
"svg"){
1928 std::ostringstream outs;
1929 outs << outputfilename<<
".svg";
1931 *
savefile <<
"<?xml version=\"1.0\" standalone=\"no\" ?>"<<std::endl;
1932 *
savefile <<
"<svg xmlns=\"http://www.w3.org/2000/svg\""<<std::endl;
1933 *
savefile <<
"xmlns:svg=\"http://www.w3.org/2000/svg\" "<<std::endl;
1934 *
savefile <<
"xmlns:xlink=\"http://www.w3.org/1999/xlink\">"<<std::endl;
1935 *
savefile <<
"<svg:svg id=\"mainMap\" x=\"0\" y=\"0\" viewBox=\"0 0 3000 1600"<<
"\" width=\""<<width<<
"\" height=\""<<height<<
"\">"<<std::endl;
1936 *
savefile <<
"<svg:rect fill=\"lightblue\" stroke=\"none\" x=\"0\" y=\"0\" width=\"3000\" height=\"1600\" /> "<<std::endl;
1937 *
savefile <<
"<svg:g id=\"psutrackermap\" transform=\"translate(10,1500) rotate(270)\" style=\"fill:none;stroke:black;stroke-width:0;\"> "<<std::endl;
1940 for (
int irack=1; irack < (
npsuracks+1); irack++){
1941 if(filetype==
"xml"){
1943 std::ostringstream outs;
1944 outs << outputfilename<<
"psurack" <<irack<<
".xml";
1946 *
savefile <<
"<?xml version=\"1.0\" standalone=\"no\"?>"<<std::endl;
1947 *
savefile <<
"<svg xmlns=\"http://www.w3.org/2000/svg\""<<std::endl;
1948 *
savefile <<
"xmlns:svg=\"http://www.w3.org/2000/svg\""<<std::endl;
1949 *
savefile <<
"xmlns:xlink=\"http://www.w3.org/1999/xlink\" >"<<std::endl;
1950 *
savefile <<
"<script type=\"text/ecmascript\" xlink:href=\"rack.js\" />"<<std::endl;
1951 *
savefile <<
"<svg id=\"mainMap\" x=\"0\" y=\"0\" viewBox=\"0 0 500 500\" width=\"700\" height=\"700\" onload=\"TrackerCrate.init()\">"<<std::endl;
1952 *
savefile <<
"<rect fill=\"lightblue\" stroke=\"none\" x=\"0\" y=\"0\" width=\"700\" height=\"700\" />"<<std::endl;
1953 *
savefile <<
"<g id=\"rack\" transform=\" translate(150,500) rotate(270) scale(1.,1.)\" > "<<std::endl;
1959 for ( ipsu=
psuMap.begin();ipsu !=
psuMap.end(); ipsu++){
1960 TmPsu * psu= ipsu->second;
1969 if(filetype==
"xml"){
1970 *
savefile <<
"</g> </svg> <text id=\"currentElementText\" x=\"40\" y=\"30\"> " << std::endl;
1971 *
savefile <<
"<tspan id=\"line1\" x=\"40\" y=\"30\"> </tspan> " << std::endl;
1972 *
savefile <<
"<tspan id=\"line2\" x=\"40\" y=\"60\"> </tspan> " << std::endl;
1973 *
savefile <<
" </text> </svg>" << std::endl;
1979 if(filetype==
"svg"){
1980 *
savefile <<
"</g> </svg> </svg> " << std::endl;
1985 if(!print_total && !usePsuValue){
1987 TmPsu *psu = ipsu->second;
2002 const char * command1;
2003 std::string tempfilename = outputfilename +
".coor";
2004 int red,
green,blue,npoints,colindex,ncolor;
2007 TCanvas *MyC =
new TCanvas(
"MyC",
"TrackerMap",width,height);
2008 gPad->SetFillColor(38);
2011 std::cout <<
" range x " << rangex << std::endl;
2012 std::cout <<
" range y " << rangey << std::endl;
2013 gPad->Range(0,0,rangex,rangey);
2017 typedef std::map<int,int> ColorList;
2018 ColorList colorList;
2019 ColorList::iterator
pos;
2021 while(!tempfile.eof()) {
2022 tempfile >> red >> green >> blue >> npoints;
2023 colindex=red+green*1000+blue*1000000;
2024 pos=colorList.find(colindex);
2025 if(pos == colorList.end()){
2026 colorList[colindex]=ncolor+100;
2027 col =gROOT->GetColor(ncolor+100);
2029 col->SetRGB((Double_t)(red/255.),(Double_t)(green/255.),(Double_t)(blue/255.));
2031 c =
new TColor(ncolor+100,(Double_t)(red/255.),(Double_t)(green/255.),(Double_t)(blue/255.));
2035 for (
int i=0;
i<npoints;
i++){
2036 tempfile >> x[
i] >> y[
i];
2039 if(ncolor>0 && ncolor<10000){
2041 for(
int i=0;
i<ncolor;
i++){colors[
i]=
i+100;}
2042 gStyle->SetPalette(ncolor,colors);
2045 tempfile.seekg(0,std::ios::beg);
2046 std::cout <<
"created palette with " << ncolor <<
" colors" << std::endl;
2047 while(!tempfile.eof()) {
2048 tempfile >> red >> green >> blue >> npoints;
2049 for (
int i=0;
i<npoints;
i++){
2050 tempfile >> x[
i] >> y[
i];
2052 colindex=red+green*1000+blue*1000000;
2053 pos=colorList.find(colindex);
2054 if(pos != colorList.end()){
2055 TPolyLine* pline =
new TPolyLine(npoints,y,x);
2056 vp.push_back(pline);
2057 pline->SetFillColor(colorList[colindex]);
2058 pline->SetLineWidth(0);
2065 axis =
new TGaxis(rangex-140,34,rangex-140,rangey-106,lminvalue,lmaxvalue,510,
"+L");
2066 axis->SetLabelSize(0.02);
2072 l.SetTextSize(0.05);
2074 if(
tkMapLog && (fulltitle.find(
"Log10 scale") == std::string::npos)) fulltitle +=
": Log10 scale";
2075 l.DrawLatex(50,rangey-200,fulltitle.c_str());
2078 std::cout <<
"Filetype " << filetype << std::endl;
2079 if(filetype==
"png"){
2081 MyC->Print(filename.c_str());
2083 if(filetype==
"jpg"){
2085 MyC->Print(filename.c_str());
2087 if(filetype==
"pdf"){
2089 MyC->Print(filename.c_str());
2092 command1=command.c_str();
2093 std::cout <<
"Executing " << command1 << std::endl;
2098 for(std::vector<TPolyLine*>::iterator pos1=vp.begin();pos1!=vp.end();pos1++){
2108 bool rangefound =
true;
2110 std::vector<TPolyLine*> vp;
2113 size_t found=filetype.find_last_of(
".");
2114 filetype=filetype.substr(found+1);
2115 found=outputfilename.find_last_of(
".");
2116 outputfilename=outputfilename.substr(0,found);
2120 std::ostringstream outs;
2122 outs << outputfilename <<
".coor";
2124 std::map<int , TmApvPair *>::iterator i_apv;
2125 std::map<int , int>::iterator i_fed;
2127 bool useApvPairValue=
false;
2128 for( i_apv=
apvMap.begin();i_apv !=
apvMap.end(); i_apv++){
2132 if(apv_mod !=0 && !apv_mod->
notInUse()){
2133 if(apvPair->
count > 0 || apvPair->
red!=-1) { useApvPairValue=
true;
break;}
2138 for( i_apv=
apvMap.begin();i_apv !=
apvMap.end(); i_apv++){
2142 if(apv_mod !=0 && !apv_mod->
notInUse() ){
2154 for(i_apv=
apvMap.begin();i_apv !=
apvMap.end(); i_apv++){
2158 if( apv_mod !=0 && !apv_mod->
notInUse() ){
2159 if(useApvPairValue){
2164 if(apv_mod->
count>0){
2175 if(filetype==
"svg"){
2177 std::ostringstream outs;
2178 outs << outputfilename<<
".svg";
2180 *
savefile <<
"<?xml version=\"1.0\" standalone=\"no\" ?>"<<std::endl;
2181 *
savefile <<
"<svg xmlns=\"http://www.w3.org/2000/svg\""<<std::endl;
2182 *
savefile <<
"xmlns:svg=\"http://www.w3.org/2000/svg\" "<<std::endl;
2183 *
savefile <<
"xmlns:xlink=\"http://www.w3.org/1999/xlink\">"<<std::endl;
2184 *
savefile <<
"<svg:svg id=\"mainMap\" x=\"0\" y=\"0\" viewBox=\"0 0 3000 1600"<<
"\" width=\""<<width<<
"\" height=\""<<height<<
"\">"<<std::endl;
2185 *
savefile <<
"<svg:rect fill=\"lightblue\" stroke=\"none\" x=\"0\" y=\"0\" width=\"3000\" height=\"1600\" /> "<<std::endl;
2186 *
savefile <<
"<svg:g id=\"fedtrackermap\" transform=\"translate(10,1500) rotate(270)\" style=\"fill:none;stroke:black;stroke-width:0;\"> "<<std::endl;
2189 if(filetype==
"xml"){
2191 std::ostringstream outs;
2192 outs << outputfilename<<
"crate" <<crate<<
".xml";
2194 *
savefile <<
"<?xml version=\"1.0\" standalone=\"no\"?>"<<std::endl;
2195 *
savefile <<
"<svg xmlns=\"http://www.w3.org/2000/svg\""<<std::endl;
2196 *
savefile <<
"xmlns:svg=\"http://www.w3.org/2000/svg\""<<std::endl;
2197 *
savefile <<
"xmlns:xlink=\"http://www.w3.org/1999/xlink\" >"<<std::endl;
2198 *
savefile <<
"<script type=\"text/ecmascript\" xlink:href=\"crate.js\" />"<<std::endl;
2199 *
savefile <<
"<svg id=\"mainMap\" x=\"0\" y=\"0\" viewBox=\"0 0 500 500\" width=\"700\" height=\"700\" onload=\"TrackerCrate.init()\">"<<std::endl;
2200 *
savefile <<
"<rect fill=\"lightblue\" stroke=\"none\" x=\"0\" y=\"0\" width=\"700\" height=\"700\" />"<<std::endl;
2201 *
savefile <<
"<g id=\"crate\" transform=\" translate(150,500) rotate(270) scale(1.,1.)\" > "<<std::endl;
2205 int numfed_incrate=0;
2206 for (i_fed=
fedMap.begin();i_fed !=
fedMap.end(); i_fed++){
2207 if(i_fed->second == crate){
2208 int fedId = i_fed->first;
2210 numfed_incrate =
slotMap[fedId];
2226 for (
int nconn=0;nconn<96;nconn++){
2227 int key = fedId*1000+nconn;
2231 if(apv_mod !=0 && !apv_mod->
notInUse()){
2239 if(filetype==
"xml"){
2240 *
savefile <<
"</g> </svg> <text id=\"currentElementText\" x=\"40\" y=\"30\"> " << std::endl;
2241 *
savefile <<
"<tspan id=\"line1\" x=\"40\" y=\"30\"> </tspan> " << std::endl;
2242 *
savefile <<
"<tspan id=\"line2\" x=\"40\" y=\"60\"> </tspan> " << std::endl;
2243 *
savefile <<
" </text> </svg>" << std::endl;
2249 if(filetype==
"svg"){
2250 *
savefile <<
"</g> </svg> </svg> " << std::endl;
2253 if(!print_total && !useApvPairValue){
2255 for( i_apv=
apvMap.begin();i_apv !=
apvMap.end(); i_apv++){
2259 if(apv_mod !=0 && apvPair->
mpos==0 && !apv_mod->
notInUse()){
2273 const char * command1;
2274 std::string tempfilename = outputfilename +
".coor";
2275 int red,
green,blue,npoints,colindex,ncolor;
2278 TCanvas *MyC =
new TCanvas(
"MyC",
"TrackerMap",width,height);
2279 gPad->SetFillColor(38);
2282 std::cout <<
" range x " << rangex << std::endl;
2283 std::cout <<
" range y " << rangey << std::endl;
2284 gPad->Range(0,0,rangex,rangey);
2288 typedef std::map<int,int> ColorList;
2289 ColorList colorList;
2290 ColorList::iterator
pos;
2292 while(!tempfile.eof()) {
2293 tempfile >> red >> green >> blue >> npoints;
2294 colindex=red+green*1000+blue*1000000;
2295 pos=colorList.find(colindex);
2296 if(pos == colorList.end()){
2297 colorList[colindex]=ncolor+100;
2298 col =gROOT->GetColor(ncolor+100);
2300 col->SetRGB((Double_t)(red/255.),(Double_t)(green/255.),(Double_t)(blue/255.));
2302 c =
new TColor(ncolor+100,(Double_t)(red/255.),(Double_t)(green/255.),(Double_t)(blue/255.));
2306 for (
int i=0;
i<npoints;
i++){
2307 tempfile >> x[
i] >> y[
i];
2310 if(ncolor>0 && ncolor<10000){
2312 for(
int i=0;
i<ncolor;
i++){colors[
i]=
i+100;}
2313 gStyle->SetPalette(ncolor,colors);
2316 tempfile.seekg(0,std::ios::beg);
2317 std::cout <<
"created palette with " << ncolor <<
" colors" << std::endl;
2318 while(!tempfile.eof()) {
2319 tempfile >> red >> green >> blue >> npoints;
2320 for (
int i=0;
i<npoints;
i++){
2321 tempfile >> x[
i] >> y[
i];
2323 colindex=red+green*1000+blue*1000000;
2324 pos=colorList.find(colindex);
2325 if(pos != colorList.end()){
2326 TPolyLine* pline =
new TPolyLine(npoints,y,x);
2327 vp.push_back(pline);
2328 pline->SetFillColor(colorList[colindex]);
2329 pline->SetLineWidth(0);
2336 axis =
new TGaxis(rangex-140,34,rangex-140,rangey-106,lminvalue,lmaxvalue,510,
"+L");
2337 axis->SetLabelSize(0.02);
2343 l.SetTextSize(0.05);
2345 if(
tkMapLog && (fulltitle.find(
"Log10 scale") == std::string::npos)) fulltitle +=
": Log10 scale";
2346 l.DrawLatex(50,rangey-200,fulltitle.c_str());
2349 std::cout <<
"Filetype " << filetype << std::endl;
2350 if(filetype==
"png"){
2352 MyC->Print(filename.c_str());
2354 if(filetype==
"jpg"){
2356 MyC->Print(filename.c_str());
2358 if(filetype==
"pdf"){
2360 MyC->Print(filename.c_str());
2363 command1=command.c_str();
2364 std::cout <<
"Executing " << command1 << std::endl;
2369 for(std::vector<TPolyLine*>::iterator pos1=vp.begin();pos1!=vp.end();pos1++){
2380 int ipos,ipos1,ipos2,
id=0,val=0;
2384 ipos1 = line.find(
"value=\"");
2386 value = line.substr(ipos1+7,10);
2387 ipos = value.find(
"\"");
2388 value = value.substr(0,ipos);
2389 val=atoi(value.c_str());
2391 ipos2 = line.find(
"detid=\"");
2393 value = line.substr(ipos2+7,10);
2394 ipos = value.find(
"\"");
2395 value = value.substr(0,ipos);
2396 id = atoi(value.c_str());
2398 if(ipos1>0 && ipos2>0 && val>0)this->
fill(
id,val);
2399 if(ipos1>0 && ipos2>0)nline++;
2403 std::cout << nline <<
" modules found in this svg file " << std::endl;
2414 std::ostringstream outs;
2416 outs << outputfilename <<
".xml";
2422 while (getline( *jsfile, line ))
2424 *
svgfile << line << std::endl;
2426 jsfile->close();
delete jsfile;
2429 for (
int layer=1; layer < 44; layer++){
2444 for (
int layer=1; layer < 44; layer++){
2457 for (
int layer=1; layer < 44; layer++){
2470 *
svgfile <<
"</svg:g></svg:svg>"<<std::endl;
2471 *
svgfile <<
" <svg:text id=\"Title\" class=\"normalText\" x=\"300\" y=\"0\">"<<
title<<
"</svg:text>"<<std::endl;
2473 *
svgfile <<
"</svg:svg>"<<std::endl;
2474 *
svgfile <<
"</body></html>"<<std::endl;
2480 std::cout <<
"preparing the palette" << std::endl;
2483 int paletteLength = 250;
2484 int width=50*(yoffset-40)/1500;
2487 float step = float(yoffset-40)/float(paletteLength);
2488 for(
int i=1;
i<paletteLength+1;
i++){
2490 red=(color>>16)&0xFF;
2491 green=(color>>8)&0xFF;
2503 if(!
temporary_file)*svgfile <<
"<svg:rect x=\"3610\" y=\""<<(1550-6*
i)<<
"\" width=\"50\" height=\"6\" fill=\"rgb("<<red<<
","<<green<<
","<<blue<<
")\" />\n";
2504 else *svgfile << red <<
" " << green <<
" " << blue <<
" 4 " << int(step*
i)+34 <<
" " << xoffset-width <<
". " <<
2505 int(step*i)+34 <<
" " << xoffset <<
". " <<
2506 int(step*(i-1))+34 <<
" " << xoffset <<
". " <<
2507 int(step*(i-1))+34 <<
" " << xoffset-width <<
". " << std::endl;
2510 if(!
temporary_file)*svgfile <<
"<svg:rect x=\"3610\" y=\""<<(1550-6*
i)<<
"\" width=\"50\" height=\"1\" fill=\"black\" />\n";
2511 if(i%50==0&&!
temporary_file)*svgfile <<
" <svg:text class=\"normalText\" x=\"3660\" y=\""<<(1560-6*
i)<<
"\">" <<val<<
"</svg:text>"<<std::endl;
2519 int key = fedId*1000+fedCh;
2526 std::cout <<
"*** error in FedTrackerMap fillc method ***";
2531 std::multimap<const int, TmApvPair*>::iterator
pos;
2541 std::cout <<
"*** error in FedTrackerMap fill by module method ***";
2546 int key = fedId*1000+fedCh;
2549 if(apvpair!=0) {apvpair->
value=current_val; apvpair->
count=1; apvpair->
red=-1;}
2551 std::cout <<
"*** error in FedTrackerMap fill_current_val method ***";
2557 int key =crate*10000000+slot*100000+ring*1000+addr;
2565 std::cout <<
"*** error in FecTrackerMap fillc method ***";
2570 int key =crate*10000000+slot*100000+ring*1000+addr;
2578 std::cout <<
"*** error in FecTrackerMap fill by module method ***";
2586 int key = rack*1000+crate*100+board;
2594 std::cout <<
"*** error in LVTrackerMap fillc method ***";
2599 int key = rack*1000+crate*100+board;
2607 std::cout <<
"*** error in LVTrackerMap fill by module method ***";
2613 int key = rack*1000+crate*100+board;
2621 std::cout <<
"*** error in HVTrackerMap (channel 2) fillc method ***";
2626 int key = rack*1000+crate*100+board;
2634 std::cout <<
"*** error in HVTrackerMap (channel 3) fillc method ***";
2640 int key = rack*1000+crate*100+board;
2648 std::cout <<
"*** error in HVTrackerMap fill by module method ***";
2652 int key = rack*1000+crate*100+board;
2660 std::cout <<
"*** error in HVTrackerMap fill by module method ***";
2669 int key = fedId*1000+fedCh;
2675 std::cout <<
"*** error in FedTrackerMap module method ***";
2679 int key = fedId*1000+fedCh;
2686 std::cout <<
"*** error inFedTrackerMap fill method ***";
2697 std::cout <<
"**************************error in fill method **************module "<<idmod<<std::endl;
2701 int key = layer*10000+ring*1000+nmod;
2708 std::cout <<
"**************************error in fill method **************"<< std::endl;
2713 std::map<const int , TmModule *>::iterator imod;
2715 fillc(imod->first,255,255,255);
2721 std::map<const int , TmModule *>::iterator imod;
2732 if(mod!=0) {mod->
value=current_val; mod->
count=1; mod->
red=-1;}
2733 else std::cout <<
"**error in fill_current_val method ***module "<<idmod<<std::endl;
2746 if(mod1!=0 && mod2!=0){
2753 std::cout <<
"**************************error in fill method **************module "<<idmod<<std::endl;
2758 int key = layer*100000+ring*1000+nmod;
2764 else std::cout <<
"**************************error in SvgModuleMap **************";
2773 else std::cout <<
"**************************error in IdModuleMap **************";
2779 int key = layer*100000+ring*1000+nmod;
2784 else std::cout <<
"**************************error in SvgModuleMap **************";
2790 int nmods, pix_sil, fow_bar,
ring, nmod, layer;
2792 float posx, posy, posz, length,
width, thickness, widthAtHalfLength;
2793 int iModule=0,old_layer=0, ntotMod =0;
2796 while(!infile.eof()) {
2797 infile >> nmods >> pix_sil >> fow_bar >> layer >> ring >> nmod >> posx >> posy
2798 >> posz>> length >> width >> thickness
2799 >> widthAtHalfLength >> idex ;
2800 getline(infile,dummys);
2801 getline(infile,name);
2802 if(old_layer!=layer){old_layer=layer;iModule=0;}
2805 int key=layer*100000+ring*1000+nmod;
2810 if(mod==0)
std::cout <<
"error in module "<<key <<std::endl;
2832 float lminvalue, lmaxvalue;
2837 red=0;green=0;blue=0;
2839 float delta=(lmaxvalue-lminvalue);
2840 float x =(value-lminvalue);
2841 if(value<lminvalue){red=0;green=0;blue=255;}
2842 if(value>lmaxvalue){red=255;green=0;blue=0;}
2843 if(value>=lminvalue&&value<=lmaxvalue){
2844 red = (int) ( x<(delta/2) ? 0 : ( x > ((3./4.)*
delta) ? 255 : 255/(delta/4) * (x-(2./4.)*
delta) ) );
2845 green= (int) ( x<delta/4 ? (x*255/(delta/4)) : ( x > ((3./4.)*
delta) ? 255-255/(delta/4) *(x-(3./4.)*
delta) : 255 ) );
2846 blue = (int) ( x<delta/4 ? 255 : ( x > ((1./2.)*
delta) ? 0 : 255-255/(delta/4) * (x-(1./4.)*
delta) ) );
2850 green = (int)((value-lminvalue)/(lmaxvalue-lminvalue)*256.);
2851 if (green > 255) green=255;
2852 red = 255; blue=0;green=255-
green;
2855 return(blue|(green<<8)|(red<<16));
2859 std::ofstream * ofilename;
2860 std::ifstream * ifilename;
2861 std::ostringstream ofname;
2866 ifilename=
findfile(
"viewerHeader.xhtml");
2867 ofname << outputfilename <<
"viewer.html";
2868 ofilename =
new std::ofstream(ofname.str().c_str(),
std::ios::out);
2869 while (getline( *ifilename, line )) { *ofilename << line << std::endl; }
2870 *ofilename <<
" var tmapname=\"" <<outputfilename <<
"\""<<std::endl;
2871 *ofilename <<
" var tmaptitle=\"" <<
title <<
"\""<<std::endl;
2872 *ofilename <<
" var ncrates=" <<
ncrates <<
";"<<std::endl;
2873 *ofilename <<
" var nfeccrates=" <<
nfeccrates <<
";"<<std::endl;
2874 *ofilename <<
" var npsuracks=" <<
npsuracks <<
";"<<std::endl;
2876 ifilename->close();
delete ifilename;
2878 ifilename=
findfile(
"viewerTrailer.xhtml");
2879 while (getline( *ifilename, line )) { *ofilename << line << std::endl; }
2880 ofilename->close();
delete ofilename;
2881 command =
"sed -i \"s/XtmapnameX/"+outputfilename+
"/g\" "+ ofname.str();
2882 std::cout <<
"Executing " << command << std::endl;
2883 system(command.c_str());
2884 command =
"sed -i \"s/XtmaptitleX/"+
title+
"/g\" "+ ofname.str();
2885 std::cout <<
"Executing " << command << std::endl;
2886 system(command.c_str());
2888 ifilename->close();
delete ifilename;
2891 ofname <<
"jqviewer.js";
2892 ofilename =
new std::ofstream(ofname.str().c_str(),
std::ios::out);
2893 while (getline( *ifilename, line )) { *ofilename << line << std::endl; }
2895 ofilename->close();
delete ofilename;
2896 ifilename->close();
delete ifilename;
2899 ofname <<
"crate.js";
2900 ofilename =
new std::ofstream(ofname.str().c_str(),
std::ios::out);
2901 while (getline( *ifilename, line )) { *ofilename << line << std::endl; }
2903 ofilename->close();
delete ofilename;
2904 ifilename->close();
delete ifilename;
2907 ofname <<
"feccrate.js";
2908 ofilename =
new std::ofstream(ofname.str().c_str(),
std::ios::out);
2909 while (getline( *ifilename, line )) { *ofilename << line << std::endl; }
2911 ofilename->close();
delete ofilename;
2912 ifilename->close();
delete ifilename;
2915 ofname <<
"layer.js";
2916 ofilename =
new std::ofstream(ofname.str().c_str(),
std::ios::out);
2917 while (getline( *ifilename, line )) { *ofilename << line << std::endl; }
2919 ofilename->close();
delete ofilename;
2920 ifilename->close();
delete ifilename;
2923 ofname <<
"rack.js";
2924 ofilename =
new std::ofstream(ofname.str().c_str(),
std::ios::out);
2925 while (getline( *ifilename, line )) { *ofilename << line << std::endl; }
2927 ofilename->close();
delete ofilename;
2928 ifilename->close();
delete ifilename;
2932 ofname <<
"rackhv.js";
2933 ofilename =
new std::ofstream(ofname.str().c_str(),
std::ios::out);
2934 while (getline( *ifilename, line )) { *ofilename << line << std::endl; }
2936 ofilename->close();
delete ofilename;
2937 ifilename->close();
delete ifilename;
2942 std::ostringstream outs,outs1,outs2;
2943 outs << outputfilename<<
".png";
2950 for (
int layer=1; layer < 44; layer++){
2951 std::ostringstream outs;
2952 outs << outputfilename <<
"layer"<<layer<<
".html";
2953 txtfile =
new std::ofstream(outs.str().c_str(),
std::ios::out);
2954 *txtfile <<
"<html><head></head> <body>" << std::endl;
2960 int idmod=mod->
idex;
2962 *txtfile <<
"<a name="<<idmod<<
"><pre>"<<std::endl;
2963 std::multimap<const int, TmApvPair*>::iterator
pos;
2969 *txtfile << apvpair->
text << std::endl;
2973 *txtfile <<
"</pre><h3>"<< mod->
name<<
"</h3>"<<std::endl;
2977 *txtfile <<
"</body></html>" << std::endl;
2978 txtfile->close();
delete txtfile;
2981 outs1 << outputfilename<<
"fed.png";
2983 outs2 << outputfilename<<
".xml";
2986 std::map<int , int>::iterator i_fed;
2989 std::ostringstream outs;
2990 outs << outputfilename <<
"crate"<<crate<<
".html";
2991 txtfile =
new std::ofstream(outs.str().c_str(),
std::ios::out);
2992 *txtfile <<
"<html><head></head> <body>" << std::endl;
2993 for (i_fed=
fedMap.begin();i_fed !=
fedMap.end(); i_fed++){
2994 if(i_fed->second == crate){
2995 int fedId = i_fed->first;
2996 for (
int nconn=0;nconn<96;nconn++){
2997 int key = fedId*1000+nconn;
3000 int idmod=apvPair->
idex;
3001 *txtfile <<
"<a name="<<idmod<<
"><pre>"<<std::endl;
3002 *txtfile << apvPair->
text << std::endl;
3003 std::ostringstream outs;
3004 outs <<
"fedchannel " <<apvPair->
getFedId() <<
"/"<<apvPair->
getFedCh()<<
" connects to module " << apvPair->
mod->
idex ;
3005 *txtfile <<
"</pre><h3>"<< outs.str()<<
"</h3>"<<std::endl;
3010 *txtfile <<
"</body></html>" << std::endl;
3011 txtfile->close();
delete txtfile;
3015 std::ostringstream outs1,outs2;
3016 outs1 << outputfilename<<
"fec.png";
3018 outs2 << outputfilename<<
".xml";
3022 std::map<int , TmCcu *>::iterator i_ccu;
3023 std::multimap<TmCcu*, TmModule*>::iterator it;
3024 std::pair<std::multimap<TmCcu*, TmModule*>::iterator,std::multimap<TmCcu*, TmModule*>::iterator>
ret;
3025 for (
int crate=1; crate < (
nfeccrates+1); crate++){
3026 std::ostringstream outs;
3027 outs << outputfilename <<
"feccrate"<<crate<<
".html";
3028 txtfile =
new std::ofstream(outs.str().c_str(),
std::ios::out);
3029 *txtfile <<
"<html><head></head> <body>" << std::endl;
3030 for( i_ccu=
ccuMap.begin();i_ccu !=
ccuMap.end(); i_ccu++){
3031 TmCcu * ccu= i_ccu->second;
3033 int idmod=ccu->
idex;
3034 *txtfile <<
"<a name="<<idmod<<
"><pre>"<<std::endl;
3035 *txtfile << ccu->
text << std::endl;
3036 std::ostringstream outs;
3037 if(ccu->
nmod==0)outs <<
"ccu is in position" << ccu->
mpos<<
"in ring but doesn't seem to have any module connected";
else
3039 outs <<
"ccu is in position " << ccu->
mpos<<
" in ring and connects " <<ccu->
nmod<<
" modules" << std::endl;
3041 for (it = ret.first; it != ret.second; ++it)
3043 outs << (*it).second->idex<<
" " << (*it).second->name <<
" value= "<< (*it).second->value<<
"\n\n";
3046 *txtfile <<
"</pre><h4>"<< outs.str()<<
"</h4>"<<std::endl;
3050 *txtfile <<
"</body></html>" << std::endl;
3051 txtfile->close();
delete txtfile;
3055 std::ostringstream outs3,outs4;
3056 outs3 << outputfilename<<
"psu.png";
3059 outs4 << outputfilename<<
".xml";
3064 std::map<int , TmPsu *>::iterator ipsu;
3065 std::multimap<TmPsu*, TmModule*>::iterator it;
3066 std::pair<std::multimap<TmPsu*, TmModule*>::iterator,std::multimap<TmPsu*, TmModule*>::iterator>
ret;
3067 for (
int rack=1; rack < (
npsuracks+1); rack++){
3068 std::ostringstream outs;
3070 outs << outputfilename <<
"psurack"<<rack<<
".html";
3071 txtfile =
new std::ofstream(outs.str().c_str(),
std::ios::out);
3072 *txtfile <<
"<html><head></head> <body>" << std::endl;
3073 for ( ipsu=
psuMap.begin();ipsu !=
psuMap.end(); ipsu++){
3074 TmPsu * psu= ipsu->second;
3076 *txtfile <<
"<a name="<<psu->
idex<<
"><pre>"<<std::endl;
3077 *txtfile << psu->
text << std::endl;
3078 std::ostringstream outs;
3079 if(psu->
nmod==0)outs <<
"Ps is in position" << psu->
getPsuBoard()<<
"in crate but doesn't seem to have any module connected";
else
3081 outs<<
"PS is in position " <<psu->
getPsuBoard()<<
" in crate and connects to "<<psu->
nmod<<
" modules. "<<std::endl;
3084 for (it = ret.first; it != ret.second; ++it)
3086 outs <<(*it).second->idex <<
" "<< (*it).second->name<<
" value= "<<(*it).second->value<<
" <br>"<<std::endl;
3089 *txtfile <<
"</pre><h4>"<< outs.str()<<
"</h4>"<<std::endl;
3093 *txtfile <<
"</body></html>" << std::endl;
3094 txtfile->close();
delete txtfile;
3100 std::ostringstream outs5,outs6;
3101 outs5 << outputfilename<<
"hv.png";
3104 outs6 << outputfilename<<
".xml";
3109 std::map<int , TmPsu *>::iterator ipsu;
3110 std::multimap<TmPsu*, TmModule*>::iterator it;
3111 std::pair<std::multimap<TmPsu*, TmModule*>::iterator,std::multimap<TmPsu*, TmModule*>::iterator>
ret;
3112 for (
int rack=1; rack < (
npsuracks+1); rack++){
3113 std::ostringstream outs;
3115 outs << outputfilename <<
"HVrack"<<rack<<
".html";
3116 txtfile =
new std::ofstream(outs.str().c_str(),
std::ios::out);
3117 *txtfile <<
"<html><head></head> <body>" << std::endl;
3118 for ( ipsu=
psuMap.begin();ipsu !=
psuMap.end(); ipsu++){
3119 TmPsu * psu= ipsu->second;
3121 *txtfile <<
"<a name="<<psu->
idex<<
"><pre>"<<std::endl;
3122 *txtfile << psu->
textHV2 << std::endl;
3123 std::ostringstream outsHV2;
3124 if(psu->
nmodHV2==0)outsHV2 <<
"HV Channel002 is in position" << psu->
getPsuBoard()<<
"in crate but doesn't seem to have any module connected";
else
3126 outsHV2<<
"HV Channel002 is in position " <<psu->
getPsuBoard()<<
" in crate and connects to "<<psu->
nmodHV2<<
" modules. "<<
" <br>"<<std::endl;
3129 for (it = ret.first; it != ret.second; ++it)
3131 if((*it).second->HVchannel==2){outsHV2 <<(*it).second->idex <<
" "<< (*it).second->name<<
" value= "<<(*it).second->value<<
" <br>"<<std::endl;}
3133 *txtfile <<
"</pre><h4>"<< outsHV2.str()<<
"</h4>"<<std::endl;
3136 *txtfile << psu->
textHV3 << std::endl;
3137 std::ostringstream outsHV3;
3138 if(psu->
nmodHV3==0)outsHV3 <<
"HV Channel003 is in position" << psu->
getPsuBoard()<<
"in crate but doesn't seem to have any module connected";
else
3140 outsHV3<<
"HV Channel003 is in position " <<psu->
getPsuBoard()<<
" in crate and connects to "<<psu->
nmodHV3<<
" modules. "<<
" <br>"<<std::endl;
3143 for (it = ret.first; it != ret.second; ++it)
3145 if((*it).second->HVchannel==3){outsHV3 <<(*it).second->idex <<
" "<< (*it).second->name<<
" value= "<<(*it).second->value<<
" <br>"<<std::endl;}
3147 *txtfile <<
"</pre><h4>"<< outsHV3.str()<<
"</h4>"<<std::endl;
3152 *txtfile <<
"</body></html>" << std::endl;
3153 txtfile->close();
delete txtfile;
3160 float minval,maxval; minval=minval1; maxval=maxval1;
3161 if(
tkMapLog && (minval<maxval)) {minval=
pow(10.,minval1);maxval=
pow(10.,maxval1);}
3165 size_t found=filetype.find_last_of(
".");
3166 filetype=filetype.substr(found+1);
3167 found=outputfilename.find_last_of(
".");
3168 outputfilename=outputfilename.substr(0,found);
3170 std::ofstream * ofilename;
3171 std::ifstream * ifilename;
3172 std::ostringstream ofname;
3177 ifilename=
findfile(
"viewerHeader.xhtml");
3178 ofname << outputfilename <<
"viewer.html";
3179 ofilename =
new std::ofstream(ofname.str().c_str(),
std::ios::out);
3180 while (getline( *ifilename, line )) { *ofilename << line << std::endl; }
3181 *ofilename <<
" var tmapname=\"" <<outputfilename <<
"\""<<std::endl;
3182 *ofilename <<
" var tmaptitle=\"" <<
title <<
"\""<<std::endl;
3183 *ofilename <<
" var ncrates=" <<
ncrates <<
";"<<std::endl;
3184 *ofilename <<
" var nfeccrates=" <<
nfeccrates <<
";"<<std::endl;
3185 *ofilename <<
" var npsuracks=" <<
npsuracks <<
";"<<std::endl;
3186 ifilename->close();
delete ifilename;
3187 ifilename=
findfile(
"viewerTrailer.xhtml");
3188 while (getline( *ifilename, line )) { *ofilename << line << std::endl; }
3189 ofilename->close();
delete ofilename;
3190 ifilename->close();
delete ifilename;
3191 command =
"sed -i \"s/XtmapnameX/"+outputfilename+
"/g\" "+ ofname.str();
3192 std::cout <<
"Executing " << command << std::endl;
3193 system(command.c_str());
3194 command =
"sed -i \"s/XtmaptitleX/"+
title+
"/g\" "+ ofname.str();
3195 std::cout <<
"Executing " << command << std::endl;
3196 system(command.c_str());
3200 ofname <<
"jqviewer.js";
3201 ofilename =
new std::ofstream(ofname.str().c_str(),
std::ios::out);
3202 while (getline( *ifilename, line )) { *ofilename << line << std::endl; }
3203 ofilename->close();
delete ofilename;
3204 ifilename->close();
delete ifilename;
3208 ofname <<
"crate.js";
3209 ofilename =
new std::ofstream(ofname.str().c_str(),
std::ios::out);
3210 while (getline( *ifilename, line )) { *ofilename << line << std::endl; }
3211 ofilename->close();
delete ofilename;
3212 ifilename->close();
delete ifilename;
3216 ofname <<
"feccrate.js";
3217 ofilename =
new std::ofstream(ofname.str().c_str(),
std::ios::out);
3218 while (getline( *ifilename, line )) { *ofilename << line << std::endl; }
3219 ofilename->close();
delete ofilename;
3220 ifilename->close();
delete ifilename;
3224 ofname <<
"rack.js";
3225 ofilename =
new std::ofstream(ofname.str().c_str(),
std::ios::out);
3226 while (getline( *ifilename, line )) { *ofilename << line << std::endl; }
3227 ofilename->close();
delete ofilename;
3228 ifilename->close();
delete ifilename;
3232 ofname <<
"rackhv.js";
3233 ofilename =
new std::ofstream(ofname.str().c_str(),
std::ios::out);
3234 while (getline( *ifilename, line )) { *ofilename << line << std::endl; }
3235 ofilename->close();
delete ofilename;
3236 ifilename->close();
delete ifilename;
3240 ofname <<
"layer.js";
3241 ofilename =
new std::ofstream(ofname.str().c_str(),
std::ios::out);
3242 while (getline( *ifilename, line )) { *ofilename << line << std::endl; }
3243 ofilename->close();
delete ofilename;
3244 ifilename->close();
delete ifilename;
3246 command =
"scp -r ../../DQM/TrackerCommon/test/jquery/ .";
3247 std::cout <<
"Executing " << command << std::endl;
3248 system(command.c_str());
3249 command =
"scp -r ../../CommonTools/TrackerMap/data/images/ .";
3250 std::cout <<
"Executing " << command << std::endl;
3251 system(command.c_str());
3254 std::ostringstream outs;
3255 outs << outputfilename<<
".png";
3259 std::ostringstream outs;
3260 outs << outputfilename<<
".png";
3266 for (
int layer=1; layer < 44; layer++){
3267 std::ostringstream outs;
3268 outs << outputfilename <<
"layer"<<layer<<
".html";
3269 txtfile =
new std::ofstream(outs.str().c_str(),
std::ios::out);
3270 *txtfile <<
"<html><head></head> <body>" << std::endl;
3276 int idmod=mod->
idex;
3278 *txtfile <<
"<a name="<<idmod<<
"><pre>"<<std::endl;
3279 std::multimap<const int, TmApvPair*>::iterator
pos;
3285 *txtfile << apvpair->
text << std::endl;
3289 *txtfile <<
"</pre><h3>"<< mod->
name<<
"</h3>"<<std::endl;
3293 *txtfile <<
"</body></html>" << std::endl;
3294 txtfile->close();
delete txtfile;
3298 std::ostringstream outs1,outs2;
3300 else outs1 << outputfilename<<
"fed."<<
filetype;
3303 outs2 << outputfilename<<
".xml";
3306 std::map<int , int>::iterator i_fed;
3309 std::ostringstream outs;
3310 outs << outputfilename <<
"crate"<<crate<<
".html";
3311 txtfile =
new std::ofstream(outs.str().c_str(),
std::ios::out);
3312 *txtfile <<
"<html><head></head> <body>" << std::endl;
3313 for (i_fed=
fedMap.begin();i_fed !=
fedMap.end(); i_fed++){
3314 if(i_fed->second == crate){
3315 int fedId = i_fed->first;
3316 for (
int nconn=0;nconn<96;nconn++){
3317 int key = fedId*1000+nconn;
3320 int idmod=apvPair->
idex;
3321 *txtfile <<
"<a name="<<idmod<<
"><pre>"<<std::endl;
3322 *txtfile << apvPair->
text << std::endl;
3323 std::ostringstream outs;
3324 outs <<
"fedchannel " <<apvPair->
getFedId() <<
"/"<<apvPair->
getFedCh()<<
" connects to module " << apvPair->
mod->
idex ;
3325 *txtfile <<
"</pre><h3>"<< outs.str()<<
"</h3>"<<std::endl;
3330 *txtfile <<
"</body></html>" << std::endl;
3331 txtfile->close();
delete txtfile;
3336 std::ostringstream outs1,outs2;
3338 else outs1 << outputfilename<<
"fec."<<
filetype;
3341 outs2 << outputfilename<<
".xml";
3345 std::map<int , TmCcu *>::iterator i_ccu;
3346 std::multimap<TmCcu*, TmModule*>::iterator it;
3347 std::pair<std::multimap<TmCcu*, TmModule*>::iterator,std::multimap<TmCcu*, TmModule*>::iterator>
ret;
3348 for (
int crate=1; crate < (
nfeccrates+1); crate++){
3349 std::ostringstream outs;
3350 outs << outputfilename <<
"feccrate"<<crate<<
".html";
3351 txtfile =
new std::ofstream(outs.str().c_str(),
std::ios::out);
3352 *txtfile <<
"<html><head></head> <body>" << std::endl;
3353 for( i_ccu=
ccuMap.begin();i_ccu !=
ccuMap.end(); i_ccu++){
3354 TmCcu * ccu= i_ccu->second;
3356 int idmod=ccu->
idex;
3357 *txtfile <<
"<a name="<<idmod<<
"><pre>"<<std::endl;
3358 *txtfile << ccu->
text << std::endl;
3359 std::ostringstream outs;
3360 if(ccu->
nmod==0)outs <<
"ccu is in position" << ccu->
mpos<<
"in ring but doesn't seem to have any module connected";
else
3362 outs <<
"ccu is in position " << ccu->
mpos<<
" in ring and connects " <<ccu->
nmod<<
" modules" << std::endl;
3364 for (it = ret.first; it != ret.second; ++it)
3366 outs << (*it).second->idex<<
" " << (*it).second->name <<
" value= "<< (*it).second->value<<
"\n\n";
3369 *txtfile <<
"</pre><h4>"<< outs.str()<<
"</h4>"<<std::endl;
3373 *txtfile <<
"</body></html>" << std::endl;
3379 std::ostringstream outs3,outs4;
3381 else outs3 << outputfilename<<
"psu."<<
filetype;
3384 outs4 << outputfilename<<
".xml";
3389 std::map<int , TmPsu *>::iterator ipsu;
3390 std::multimap<TmPsu*, TmModule*>::iterator it;
3391 std::pair<std::multimap<TmPsu*, TmModule*>::iterator,std::multimap<TmPsu*, TmModule*>::iterator>
ret;
3392 for (
int rack=1; rack < (
npsuracks+1); rack++){
3393 std::ostringstream outs;
3395 outs << outputfilename <<
"psurack"<<rack<<
".html";
3396 txtfile =
new std::ofstream(outs.str().c_str(),
std::ios::out);
3397 *txtfile <<
"<html><head></head> <body>" << std::endl;
3398 for ( ipsu=
psuMap.begin();ipsu !=
psuMap.end(); ipsu++){
3399 TmPsu * psu= ipsu->second;
3401 *txtfile <<
"<a name="<<psu->
idex<<
"><pre>"<<std::endl;
3402 *txtfile << psu->
text << std::endl;
3403 std::ostringstream outs;
3404 if(psu->
nmod==0)outs <<
"Ps is in position" << psu->
getPsuBoard()<<
"in crate but doesn't seem to have any module connected";
else
3406 outs<<
"PS is in position " <<psu->
getPsuBoard()<<
" in crate and connects to "<<psu->
nmod<<
" modules. "<<std::endl;
3409 for (it = ret.first; it != ret.second; ++it)
3411 outs <<(*it).second->idex <<
" "<< (*it).second->name<<
" value= "<<(*it).second->value<<
" <br>"<<std::endl;
3414 *txtfile <<
"</pre><h4>"<< outs.str()<<
"</h4>"<<std::endl;
3418 *txtfile <<
"</body></html>" << std::endl;
3426 std::ostringstream outs5,outs6;
3428 else outs5 << outputfilename<<
"hv."<<
filetype;
3431 outs6 << outputfilename<<
".xml";
3436 std::map<int , TmPsu *>::iterator ipsu;
3437 std::multimap<TmPsu*, TmModule*>::iterator it;
3438 std::pair<std::multimap<TmPsu*, TmModule*>::iterator,std::multimap<TmPsu*, TmModule*>::iterator>
ret;
3439 for (
int rack=1; rack < (
npsuracks+1); rack++){
3440 std::ostringstream outs;
3442 outs << outputfilename <<
"HVrack"<<rack<<
".html";
3443 txtfile =
new std::ofstream(outs.str().c_str(),
std::ios::out);
3444 *txtfile <<
"<html><head></head> <body>" << std::endl;
3445 for ( ipsu=
psuMap.begin();ipsu !=
psuMap.end(); ipsu++){
3446 TmPsu * psu= ipsu->second;
3448 *txtfile <<
"<a name="<<psu->
idex<<
"><pre>"<<std::endl;
3449 *txtfile << psu->
textHV2 << std::endl;
3450 std::ostringstream outsHV2;
3451 if(psu->
nmodHV2==0)outsHV2 <<
"HV Channel002 is in position" << psu->
getPsuBoard()<<
"in crate but doesn't seem to have any module connected";
else
3453 outsHV2<<
"HV Channel002 is in position " <<psu->
getPsuBoard()<<
" in crate and connects to "<<psu->
nmodHV2<<
" modules. "<<
" <br>"<<std::endl;
3456 for (it = ret.first; it != ret.second; ++it)
3458 if((*it).second->HVchannel==2){outsHV2 <<(*it).second->idex <<
" "<< (*it).second->name<<
" value= "<<(*it).second->value<<
" <br>"<<std::endl;}
3460 *txtfile <<
"</pre><h4>"<< outsHV2.str()<<
"</h4>"<<std::endl;
3463 *txtfile << psu->
textHV3 << std::endl;
3464 std::ostringstream outsHV3;
3465 if(psu->
nmodHV3==0)outsHV3 <<
"HV Channel003 is in position" << psu->
getPsuBoard()<<
"in crate but doesn't seem to have any module connected";
else
3467 outsHV3<<
"HV Channel003 is in position " <<psu->
getPsuBoard()<<
" in crate and connects to "<<psu->
nmodHV3<<
" modules. "<<
" <br>"<<std::endl;
3470 for (it = ret.first; it != ret.second; ++it)
3472 if((*it).second->HVchannel==3){outsHV3 <<(*it).second->idex <<
" "<< (*it).second->name<<
" value= "<<(*it).second->value<<
" <br>"<<std::endl;}
3474 *txtfile <<
"</pre><h4>"<< outsHV3.str()<<
"</h4>"<<std::endl;
3479 *txtfile <<
"</body></html>" << std::endl;
3490 std::ifstream * ifilename;
3496 ifname=
"CommonTools/TrackerMap/data/"+
filename;
3500 ifname=
"CommonTools/TrackerMap/data/"+
filename;
3503 if(!ifilename)
std::cout <<
"File " << filename <<
" missing" << std::endl;
3510 for (
int layer=1; layer < 44; layer++){
3525 for (
int layer=1; layer < 44; layer++){
3538 for (
int layer=1; layer < 44; layer++){
3539 std::ostringstream outs;
3540 outs << outputfilename <<
"layer"<<layer<<
".xml";
3541 xmlfile =
new std::ofstream(outs.str().c_str(),
std::ios::out);
3542 *xmlfile <<
"<?xml version=\"1.0\" standalone=\"no\"?>"<<std::endl;
3543 *xmlfile <<
"<svg xmlns=\"http://www.w3.org/2000/svg\""<<std::endl;
3544 *xmlfile <<
"xmlns:svg=\"http://www.w3.org/2000/svg\""<<std::endl;
3545 *xmlfile <<
"xmlns:xlink=\"http://www.w3.org/1999/xlink\" >"<<std::endl;
3546 *xmlfile <<
"<script type=\"text/ecmascript\" xlink:href=\"layer.js\" />"<<std::endl;
3547 *xmlfile <<
"<svg id=\"mainMap\" x=\"0\" y=\"0\" viewBox=\"0 0 500 500\" width=\"700\" height=\"700\" onload=\"TrackerLayer.init()\">"<<std::endl;
3548 if(layer<31)*xmlfile <<
"<g id=\"layer\" transform=\" translate(0,400) rotate(270) scale(1.,1.)\" > "<<std::endl;
3549 else *xmlfile <<
"<g id=\"layer\" transform=\" translate(0,400) rotate(270) scale(1.,0.8)\" > "<<std::endl;
3550 *xmlfile <<
"<rect fill=\"lightblue\" stroke=\"none\" x=\"0\" y=\"0\" width=\"700\" height=\"700\" />"<<std::endl;
3551 *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;
3552 *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;
3553 *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;
3554 *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;
3555 *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;
3564 drawModule(mod,key,layer,print_total,xmlfile);
3568 *xmlfile <<
"</g> </svg> <text id=\"currentElementText\" x=\"40\" y=\"30\">" << std::endl;
3569 *xmlfile <<
"<tspan id=\"line1\" x=\"40\" y=\"30\"> </tspan> " << std::endl;
3570 *xmlfile <<
"<tspan id=\"line2\" x=\"40\" y=\"60\"> </tspan> " << std::endl;
3571 *xmlfile <<
"<tspan id=\"line3\" x=\"40\" y=\"90\"> </tspan> " << std::endl;
3572 *xmlfile <<
"<tspan id=\"line4\" x=\"40\" y=\"120\"> </tspan> " << std::endl;
3574 *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;
3575 *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;
3576 *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;
3577 *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;
3578 *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;
3581 *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;
3582 *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;
3583 *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;
3584 *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;
3585 *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;
3587 *xmlfile <<
" </text> </svg>" << std::endl;
3588 xmlfile->close();
delete xmlfile;
void drawHV3(int rack, int numcrate_inrack, bool print_total, TmPsu *psu, ofstream *svgfile, bool usePsuValue)
void fill_hv_channel2(int rack, int crate, int board, float qty)
T getUntrackedParameter(std::string const &, T const &) const
#define NUMFEDCRATE_INCOLUMN
TrackerMap(std::string s=" ", int xsize1=340, int ysize1=200)
double ydpixelc(double y)
std::ifstream * findfile(std::string filename)
#define NUMPSURACK_INCOLUMN
double ydpixelfec(double y)
int getmoduleCount(int subdet, int partdet, int layer, int ring)
const std::vector< uint16_t > & feds() const
void fillc_hv_channel2(int rack, int crate, int board, int red, int green, int blue)
std::ifstream * inputfile
~TrackerMap()
default destructor
static const uint32_t invalid32_
void drawPsu(int rack, int numcrate_inrack, bool print_total, TmPsu *psu, ofstream *svgfile, bool usePsuValue)
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)
std::vector< Color_t > colors
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)
void save_as_psutrackermap(bool print_total=true, float minval=0., float maxval=0., std::string s="psu_svgmap.svg", int width=YPSUOFFSET+(YPSURSIZE+YPSUOFFSET)*NUMPSURACK_INROW+300, int height=XPSUOFFSET+(XPSURSIZE+XPSUOFFSET)*NUMPSURACK_INCOLUMN+300)
double xdpixelpsu(double x)
const T & max(const T &a, const T &b)
void save(bool print_total=true, float minval=0., float maxval=0., std::string s="svgmap.svg", int width=1500, int height=800)
void drawHV2(int rack, int numcrate_inrack, bool print_total, TmPsu *psu, ofstream *svgfile, bool usePsuValue)
Cos< T >::type cos(const T &t)
void deffecwindow(int num_crate)
void load(std::string s="tmap.svg")
void drawModule(TmModule *mod, int key, int layer, bool total, std::ofstream *file)
void drawApvPair(int crate, int numfed_incrate, bool total, TmApvPair *apvPair, std::ofstream *file, bool useApvPairValue)
void fillc_fed_channel(int fedId, int fedCh, int red, int green, int blue)
int getcolor(float value, int palette)
void fillc(int idmod, int RGBcode)
void printlayers(bool print_total=true, float minval=0., float maxval=0., std::string s="layer")
void drawCcu(int crate, int numfed_incrate, bool total, TmCcu *ccu, std::ofstream *file, bool useCcuValue)
void fill_hv_channel3(int rack, int crate, int board, float qty)
#define NUMPSUCRATE_INCOLUMN
static const uint16_t invalid_
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)
void save_as_fedtrackermap(bool print_total=true, float minval=0., float maxval=0., std::string s="fed_svgmap.svg", int width=YFEDOFFSET+(YFEDCSIZE+YFEDOFFSET)*NUMFEDCRATE_INROW+300, int height=XFEDOFFSET+(XFEDCSIZE+XFEDOFFSET)*NUMFEDCRATE_INCOLUMN+300)
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 fill(int layer, int ring, int nmod, float x)
double ydpixelpsu(double y)
const std::vector< FedChannelConnection > & connections(uint16_t fed_id) const
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()