19 #ifdef CSC_RENDER_PLUGIN
47 if(adr.
side == 2) sign = -1.0;
57 float eta_min = sign *
Eta(r_min, z);
58 float eta_max = sign *
Eta(r_max, z);
59 float x_min =
EtaToX(eta_min);
60 float x_max =
EtaToX(eta_max);
72 float y_min =
PhiToY(phi_min);
73 float y_max =
PhiToY(phi_max);
77 float xboxmin = (x_min < x_max ? x_min : x_max);
78 float xboxmax = (x_max > x_min ? x_max : x_min);
79 float yboxmin = (y_min < y_max ? y_min : y_max);
80 float yboxmax = (y_max > y_min ? y_max : y_min);
95 for (
unsigned int x = x1;
x < x2;
x++) {
96 for (
unsigned int y = y1;
y < y2;
y++) {
101 std::vector<unsigned int>
v;
187 if (
boxes[
i].adr == adr) {
200 if (station == 1)
return 3;
201 if (station == 2)
return 2;
202 if (station == 3)
return 2;
203 if (station == 4)
return 2;
214 if(station == 1 && ring == 1)
return 36;
215 if(station == 1 && ring == 2)
return 36;
216 if(station == 1 && ring == 3)
return 36;
217 if(station == 2 && ring == 1)
return 18;
218 if(station == 2 && ring == 2)
return 36;
219 if(station == 3 && ring == 1)
return 18;
220 if(station == 3 && ring == 2)
return 36;
221 if(station == 4 && ring == 1)
return 18;
222 if(station == 4 && ring == 2)
return 36;
233 if(station == 1 && ring == 1)
return 4;
234 if(station == 1 && ring == 2)
return 5;
235 if(station == 1 && ring == 3)
return 4;
236 if(station == 2 && ring == 1)
return 5;
237 if(station == 2 && ring == 2)
return 5;
238 if(station == 3 && ring == 1)
return 5;
239 if(station == 3 && ring == 2)
return 5;
240 if(station == 4 && ring == 1)
return 5;
241 if(station == 4 && ring == 2)
return 5;
252 if(station == 1 && ring == 1)
return 2;
253 if(station == 1 && ring == 2)
return 3;
254 if(station == 1 && ring == 3)
return 3;
255 if(station == 2 && ring == 1)
return 3;
256 if(station == 2 && ring == 2)
return 5;
257 if(station == 3 && ring == 1)
return 3;
258 if(station == 3 && ring == 2)
return 5;
259 if(station == 4 && ring == 1)
return 3;
260 if(station == 4 && ring == 2)
return 5;
304 if (
boxes[i].adr == mask) {
323 if (
boxes[i].adr == mask) {
357 if(r > 0.0 || z > 0.0) {
358 float sin_theta = r /
sqrt(r * r + z * z);
359 float cos_theta = z /
sqrt(r * r + z * z);
360 return -
log(sin_theta / (cos_theta + 1));
362 if(r == 0.0)
return FLT_MAX;
375 float eta_min = -2.5;
377 float a = (x_max - x_min) / (eta_max - eta_min);
378 float b = (eta_max * x_min - eta_min * x_max) / (eta_max - eta_min);
389 float y_max = 2.0 * 3.14159;
391 float phi_max = 2.0 * 3.14159;
392 float a = (y_max - y_min) / (phi_max - phi_min);
393 float b = (phi_max * y_min - phi_min * y_max) / (phi_max - phi_min);
406 if(station == 1 && ring == 1) z_csc = (5834.5 + 6101.5) / 2.0;
407 if(station == 1 && ring == 2) z_csc = (6790.0 + 7064.3) / 2.0;
408 if(station == 1 && ring == 3) z_csc = 6888.0;
409 if(station == 2) z_csc = (8098.0 + 8346.0) / 2.0;
410 if(station == 3) z_csc = (9414.8 + 9166.8) / 2.0;
411 if(station == 4) z_csc = 10630.0;
426 if(station == 1 && ring == 1) {
427 if(n_hv == 1) r_min_hv = 1060.0;
428 if(n_hv == 2) r_min_hv = 1500.0;
431 if(station == 1 && ring == 2) {
432 if(n_hv == 1) r_min_hv = 2815.0;
433 if(n_hv == 2) r_min_hv = 3368.2;
434 if(n_hv == 3) r_min_hv = 4025.7;
437 if(station == 1 && ring == 3) {
438 if(n_hv == 1) r_min_hv = 5120.0;
439 if(n_hv == 2) r_min_hv = 5724.1;
440 if(n_hv == 3) r_min_hv = 6230.2;
443 if(station == 2 && ring == 1) {
444 if(n_hv == 1) r_min_hv = 1469.2;
445 if(n_hv == 2) r_min_hv = 2152.3;
446 if(n_hv == 3) r_min_hv = 2763.7;
449 if(station == 3 && ring == 1) {
450 if(n_hv == 1) r_min_hv = 1668.9;
451 if(n_hv == 2) r_min_hv = 2164.9;
452 if(n_hv == 3) r_min_hv = 2763.8;
455 if(station == 4 && ring == 1) {
456 if(n_hv == 1) r_min_hv = 1876.1;
457 if(n_hv == 2) r_min_hv = 2365.9;
458 if(n_hv == 3) r_min_hv = 2865.0;
461 if((station == 2 || station == 3 || station == 4) && ring == 2) {
462 if(n_hv == 1) r_min_hv = 3640.2;
463 if(n_hv == 2) r_min_hv = 4446.3;
464 if(n_hv == 3) r_min_hv = 5053.2;
465 if(n_hv == 4) r_min_hv = 5660.1;
466 if(n_hv == 5) r_min_hv = 6267.0;
482 if(station == 1 && ring == 1) {
483 if(n_hv == 1) r_max_hv = 1500.0;
484 if(n_hv == 2) r_max_hv = 2565.0;
487 if(station == 1 && ring == 2) {
488 if(n_hv == 1) r_max_hv = 3368.2;
489 if(n_hv == 2) r_max_hv = 4025.7;
490 if(n_hv == 3) r_max_hv = 4559.9;
493 if(station == 1 && ring == 3) {
494 if(n_hv == 1) r_max_hv = 5724.1;
495 if(n_hv == 2) r_max_hv = 6230.2;
496 if(n_hv == 3) r_max_hv = 6761.5;
499 if(station == 2 && ring == 1) {
500 if(n_hv == 1) r_max_hv = 2152.3;
501 if(n_hv == 2) r_max_hv = 2763.7;
502 if(n_hv == 3) r_max_hv = 3365.8;
505 if(station == 3 && ring == 1) {
506 if(n_hv == 1) r_max_hv = 2164.9;
507 if(n_hv == 2) r_max_hv = 2763.8;
508 if(n_hv == 3) r_max_hv = 3365.8;
511 if(station == 4 && ring == 1) {
512 if(n_hv == 1) r_max_hv = 2365.9;
513 if(n_hv == 2) r_max_hv = 2865.0;
514 if(n_hv == 3) r_max_hv = 3356.3;
517 if((station == 2 || station == 3 || station == 4) && ring == 2) {
518 if(n_hv == 1) r_max_hv = 4446.3;
519 if(n_hv == 2) r_max_hv = 5053.2;
520 if(n_hv == 3) r_max_hv = 5660.1;
521 if(n_hv == 4) r_max_hv = 6267.0;
522 if(n_hv == 5) r_max_hv = 6870.8;
542 phi_min_cfeb = 0.0 + 2.0 * 3.14159 / ((float) (n_chambers)) * ((
float) (chamber - 1) + (
float) (cfeb - 1) / (
float) (n_cfeb));
561 phi_max_cfeb = 0.0 + 2.0 * 3.14159 / (float) n_chambers * ((
float) (chamber - 1) + (
float) (cfeb) / (
float) n_cfeb);
574 std::vector<std::string> tokens;
577 if (tokens.size() !=
ADDR_SIZE)
return false;
581 std::string token = tokens.at(
r);
584 unsigned int num = 0;
586 if (token.compare(
"*") != 0) {
587 if(stringToNumber<unsigned int>(num, token, std::dec)) {
static void splitString(const std::string &str, const std::string &delim, std::vector< std::string > &results)
Split string according to delimiter.
const bool AddressFromString(const std::string &str_address, Address &adr) const
Construct address from string.
unsigned int partitions_y
PartitionMap::iterator PartitionMapIterator
const float Area(const unsigned int station) const
Calculate station area in eta/phi space.
const bool NextAddressBox(unsigned int &i, const AddressBox *&box, const Address &mask) const
Address box iterator by mask.
const float Z(const int station, const int ring) const
Get Z parameter (used in address eta/phi calculation)
unsigned int partitions_x
void PrintAddress(const Address &adr) const
Prints address for debugging.
const float RMinHV(const int station, const int ring, const int n_hv) const
Get R min parameter (used in address eta/phi calculation)
Area covered by Address in eta/phy space.
const unsigned int NumberOfRings(const unsigned int station) const
Returns the number of rings for the given station.
Detector(const unsigned int p_partitions_x=0, const unsigned int p_partitions_y=0)
Constructor.
AddressBox boxes[N_ELEMENTS]
const float EtaToX(const float eta) const
Transform eta coordinate to local canvas coordinate.
const bool NextAddressBoxByPartition(unsigned int &i, const unsigned int px, const unsigned int py, AddressBox *&box)
Address box iterator by partition.
#define PARTITION_INDEX(x, y)
const unsigned int NumberOfChamberCFEBs(const unsigned int station, const unsigned int ring) const
Returns the number of CFEBs per Chamber on given Station/Ring.
const bool NextAddress(unsigned int &i, const Address *&adr, const Address &mask) const
Address iterator by mask.
static void trimString(std::string &str)
Trim string.
const unsigned int NumberOfChamberHVs(const unsigned int station, const unsigned int ring) const
Returns the number of HVs per Chamber on given Station/Ring.
float station_area[N_STATIONS]
const float PhiMinCFEB(const int station, const int ring, const int chamber, const int cfeb) const
Get Min phi boundary for particular CFEB.
const float Eta(const float r, const float z) const
const float PhiToY(const float phi) const
Transform phi coordinate to local canvas coordinate.
unsigned int GlobalChamberIndex(unsigned int side, unsigned int station, unsigned int ring, unsigned int chamber) const
Return global chamber index on his geometric location.
const unsigned int NumberOfChambers(const unsigned int station, const unsigned int ring) const
Returns the number of chambers for the given station and ring.
Structure to store detector addresses of any granularity: from whole detector to the single HV elemen...
tuple size
Write out results.
const float PhiMaxCFEB(const int station, const int ring, const int chamber, const int cfeb) const
Get Max phi boundary for particular CFEB.
const float RMaxHV(const int station, const int ring, const int n_hv) const
Get R max parameter (used in address eta/phi calculation)