41 #define NUMPSUCH_INROW 18
42 #define NUMPSUCRATE_INCOLUMN 5
43 #define NUMPSURACK_INCOLUMN 6
44 #define NUMPSURACK_INROW 5
45 #define XPSURSIZE 150 // (5)*1.5 boxes
46 #define YPSURSIZE 360 // 18 boxes
48 #define YPSUOFFSET 100
50 #define NUMFEDCH_INCOLUMN 12
51 #define NUMFEDCH_INROW 8
52 #define NUMFED_INCOLUMN 21
53 #define NUMFED_INROW 1
56 #define NUMFEDCRATE_INCOLUMN 1
57 #define NUMFEDCRATE_INROW 31
60 #define XFEDCSIZE 2940 // 14*21 boxes
61 #define YFEDCSIZE 90 // 9 boxes
62 #define XFEDOFFSET 150
63 #define YFEDOFFSET 100
82 void print(
bool print_total=
true,
float minval=0.,
float maxval=0.,
std::string s=
"svgmap");
83 void printall(
bool print_total=
true,
float minval=0.,
float maxval=0.,
std::string s=
"svgmap",
int width=6000,
int height=3200);
86 void save(
bool print_total=
true,
float minval=0.,
float maxval=0.,
std::string s=
"svgmap.svg",
int width=1500,
int height=800);
95 void drawApvPair(
int crate,
int numfed_incrate,
bool total,
TmApvPair* apvPair,std::ofstream * file,
bool useApvPairValue);
96 void drawCcu(
int crate,
int numfed_incrate,
bool total,
TmCcu* ccu,std::ofstream * file,
bool useCcuValue);
97 void drawPsu(
int rack,
int numcrate_inrack,
bool print_total,
TmPsu* psu,std::ofstream *
svgfile,
bool usePsuValue);
98 void drawHV2(
int rack,
int numcrate_inrack,
bool print_total,
TmPsu* psu,std::ofstream * svgfile,
bool usePsuValue);
99 void drawHV3(
int rack,
int numcrate_inrack,
bool print_total,
TmPsu* psu,std::ofstream * svgfile,
bool usePsuValue);
101 void fill(
int layer ,
int ring,
int nmod,
float x );
102 void fill(
int idmod,
float qty );
103 void fillc(
int idmod,
int RGBcode) {
fillc(idmod,(RGBcode>>16) & 0xFF , (RGBcode>>8) & 0xFF, RGBcode & 0xFF);}
105 void fillc(
int layer,
int ring,
int nmod,
int red,
int green,
int blue);
120 int module(
int fedId,
int fedCh);
124 void drawPalette(std::ofstream * file,
int xoffset=3660,
int yoffset=1540);
138 std::vector<TColor*>
vc;
147 typedef std::map<const int , int>
SvgFed;
150 typedef std::map<const int , TmCcu*>
MapCcu;
154 typedef std::map<const int , TmPsu*>
MapPsu;
175 double phi1=atan(y/x);
177 if(y<0. && x>0) phi = phi1+2.*
M_PI;
178 if(x<0.)phi=phi1+
M_PI;
179 if(fabs(y)<0.000001 && x>0)phi=0;
180 if(fabs(y)<0.000001&&x<0)phi=
M_PI;
181 if(fabs(x)<0.000001&&y>0)phi=M_PI/2.;
182 if(fabs(x)<0.000001&&y<0)phi=3.*M_PI/2.;
201 layer = ix/(2*
ysize);
202 if(iy < 2*
xsize)layer=layer*2+1;
else layer=layer*2;
216 if(partdet == 1 || partdet == 3){
219 else { ncomponent = 3; }
222 if(partdet == 1 || partdet == 3){
225 else { ncomponent = 4; }
228 if(partdet == 1 || partdet == 3){
231 else { ncomponent = 6; }
312 if(num_crate==1||num_crate==3)
ix = xoffset+
xsize*2;
313 if(num_crate==2||num_crate==4)
ix = xoffset;
314 iy = yoffset+((num_crate-1)/2)*
ysize*4;
332 if(num_lay >12 && num_lay < 19){
338 if(num_lay>33&&num_lay<38){
xmax=2.0;}
339 if(num_lay>37){
ymax=8.;}
343 if(num_lay >12 && num_lay < 19){
349 if(num_lay>33&&num_lay<38){
xmin=-1.;
xmax=1.;}
355 if(num_lay==15||num_lay==14)
iy=(15-num_lay)*2*
ysize;
else
357 if(num_lay>15&&num_lay<31){
359 if(num_lay==16||num_lay==17)
iy=(num_lay-16)*2*
ysize;
else
362 if(num_lay==31){
ix=(int)(1.5*
xsize);
iy=0;}
365 if(num_lay==34){
int il=(num_lay-30)/2;
ix=
xsize;
iy=il*(int)(2.57*
ysize);}
366 if(num_lay>34 && num_lay%2==0){
int il=(num_lay-30)/2;
ix=
xsize;
iy=il*(int)(2.5*
ysize);}
367 if(num_lay>34 && num_lay%2!=0){
int il=(num_lay-30)/2;
ix=2*
xsize;
iy=il*(int)(2.5*
ysize);}
374 if(partdet== 1 || partdet== 3){
377 else{ncomponent = 8;}
380 if(partdet== 1 || partdet== 3){
383 else{ncomponent = 12;}
387 if (layer== 1) ncomponent = 4;
388 if (layer== 2 || layer== 3) ncomponent = 5;
389 if (layer== 4 || layer== 5 || layer== 6) ncomponent = 6;
390 if (layer== 7 || layer== 8 || layer== 9) ncomponent = 7;
393 if (layer== 9) ncomponent = 4;
394 if (layer== 8 || layer== 7) ncomponent = 5;
395 if (layer== 6 || layer== 5 || layer== 4) ncomponent = 6;
396 if (layer== 3 || layer== 2 || layer== 1) ncomponent = 7;
406 int spicchif[] ={24,24,40,56,40,56,80};
407 int spicchib[] ={20,32,44,30,38,46,56,42,48,54,60,66,74};
408 int numero_layer = 0;
411 numero_layer = layer-1;
413 numero_layer = numero_layer+3;
416 numero_layer = numero_layer+7;
418 ncomponent = spicchib[numero_layer];
421 if(subdet== 1)ncomponent=24;
423 ncomponent = spicchif[ring-1];
427 static int layerno(
int subdet,
int leftright,
int layer){
428 if(subdet==6&&leftright==1)
return(10-layer);
429 if(subdet==6&&leftright==2)
return(layer+21);
430 if(subdet==4&&leftright==1)
return(4-layer+9);
431 if(subdet==4&&leftright==2)
return(layer+18);
432 if(subdet==2&&leftright==1)
return(4-layer+12);
433 if(subdet==2&&leftright==2)
return(layer+15);
434 if(subdet==1)
return(layer+30);
435 if(subdet==3)
return(layer+33);
436 if(subdet==5)
return(layer+37);
441 int layer=key/100000;
442 int ring = key - layer*100000;
444 if(layer==34 || layer==35 || layer==38 || layer==39)
return true;
445 if(layer<13 || (layer>18&&layer<31))
446 if(ring==1 || ring==2 || ring==5)
return true;
450 if(det==3 && part==1)
return lay;
451 if(det==2 && part==1)
return lay+9;
452 if(det==1 && part==1)
return lay+12;
453 if(det==1 && part==3)
return lay+15;
454 if(det==2 && part==3)
return lay+18;
455 if(det==3 && part==3)
return lay+21;
456 if(det==1 && part==2)
return lay+30;
457 if(det==2 && part==2)
return lay+33;
458 if(det==3 && part==2)
return lay+37;
464 std::ostringstream ons;
466 if(layer < 10) ons <<
"TEC -z Layer " << layer;
467 if(layer < 13 && layer > 9) ons <<
"TID -z Layer " << layer-9;
468 if(layer < 16 && layer > 12) ons <<
"FPIX -z Layer " << layer-12;
469 if(layer < 19 && layer > 15) ons <<
"FPIX +z Layer " << layer-15;
470 if(layer < 22 && layer > 18) ons <<
"TID +z Layer " << layer-18;
471 if(layer < 31 && layer > 21) ons <<
"TEC +z Layer " << layer-21;
472 if(layer < 34 && layer > 30) ons <<
"TPB Layer " << layer-30;
473 if(layer < 38 && layer > 33) ons <<
"TIB Layer " << layer-33;
474 if(layer > 37) ons <<
"TOB Layer " << layer-37;
void fill_hv_channel2(int rack, int crate, int board, float qty)
#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)
std::string layername(int layer)
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 addPixel(bool addPixelfl)
~TrackerMap()
default destructor
int module(int fedId, int fedCh)
std::multimap< const int, TmApvPair * > ModApvPair
void defwindow(int num_lay)
#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)
std::map< const int, int > SvgFed
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)
void add(const std::vector< const T * > &source, std::vector< const T * > &dest)
#define NUMFEDCRATE_INROW
std::multimap< TmPsu *, TmModule * > PsuModule
void fillc_fec_channel(int crate, int slot, int ring, int addr, int red, int green, int blue)
void setTitle(std::string s)
double xdpixelfec(double x)
double phival(double x, double y)
std::map< const int, TmPsu * > MapPsu
void fillc_lv_channel(int rack, int crate, int board, int red, int green, int blue)
std::map< const int, TmApvPair * > SvgApvPair
void showPalette(bool printflag1)
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 drawHV3(int rack, int numcrate_inrack, bool print_total, TmPsu *psu, std::ofstream *svgfile, bool usePsuValue)
std::map< const int, TmModule * > SmoduleMap
void setPalette(int numpalette)
void save(bool print_total=true, float minval=0., float maxval=0., std::string s="svgmap.svg", int width=1500, int height=800)
void deffecwindow(int num_crate)
void load(std::string s="tmap.svg")
std::map< const int, TmCcu * > MapCcu
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)
static int layerno(int subdet, int leftright, int layer)
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 fill_hv_channel3(int rack, int crate, int board, float qty)
#define NUMPSUCRATE_INCOLUMN
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)
int find_layer(int ix, int iy)
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::map< const int, TmModule * > ImoduleMap
std::vector< TColor * > vc
void onlyPixel(bool onlyPixelfl)
void printall(bool print_total=true, float minval=0., float maxval=0., std::string s="svgmap", int width=6000, int height=3200)
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)
std::multimap< TmCcu *, TmModule * > FecModule
void fillc_hv_channel3(int rack, int crate, int board, int red, int green, int blue)
std::pair< float, float > getAutomaticRange()