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 6, 6, 6, 0,
75 0, 0, 4, 4, 4, 4, 4, 4, 5, 5, 5,
76 5, 6, 6, 6, 6, 6, 6, 0, 0,
77 0, 0, 0, 4, 4, 4, 4, 5, 5, 5, 5,
78 5, 5, 6, 6, 6, 6, 0, 0, 0,
79 0, 0, 0, 0, 4, 4, 4, 5, 5, 5, 5,
80 5, 5, 6, 6, 6, 0, 0, 0, 0,
81 0, 0, 0, 0, 0, 0, 0, 5, 5, 5, 5,
82 5, 5, 0, 0, 0, 0, 0, 0, 0
86 int iym, ixm, il, ic,
ii;
95 if (ii < 0 || ii > (
int)(
sizeof(idx_) /
sizeof(
int)) || idx_[
ii] == 0) {
104 int ism_ =
sector(iX, iY);
118 static const int idx_[] = {
120 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 2, 1, 1, 1, 1, 1, 0, 0, 0,
121 5, 2, 2, 2, 2, 2, 1, 0, 0, 5, 5, 5, 3, 3, 2, 2, 2, 0, 8, 5, 5, 5, 3,
122 3, 3, 3, 3, 0, 8, 8, 5, 6, 6, 4, 4, 4, 3, 0, 8, 8, 5, 6, 6, 7, 4, 4,
123 4, 8, 8, 8, 6, 6, 7, 7, 7, 4, 4, 9, 9, 8, 6, 6, 7, 7, 7, 7, 0, 9, 9,
124 9, 10, 10, 11, 11, 7, 0, 0, 12, 9, 9, 10, 10, 11, 11, 11, 0, 0, 12, 12, 13, 10, 10,
125 11, 11, 17, 17, 0, 12, 12, 13, 13, 13, 11, 17, 17, 17, 19, 0, 12, 13, 13, 14, 15, 17, 17,
126 17, 19, 0, 12, 14, 14, 14, 15, 16, 17, 19, 19, 0, 14, 14, 14, 14, 15, 16, 16, 19, 19, 0,
127 0, 14, 15, 15, 15, 16, 16, 19, 19, 0, 0, 0, 15, 15, 15, 16, 18, 18, 18, 0, 0, 0, 0,
128 16, 16, 16, 18, 18, 18, 0, 0, 0, 0, 0, 0, 0, 18, 18, 18};
130 int iym, ixm, il, ic,
ii;
140 if (ii < 0 || ii > (
int)(
sizeof(idx_) /
sizeof(
int)) || idx_[
ii] == 0) {
147 static const int idx_[] = {
150 77, 71, 63, 55, 46, 37, 28, 18, 0, 0,
151 78, 72, 64, 56, 47, 38, 29, 19, 9, 0,
152 79, 73, 65, 57, 48, 39, 30, 20, 10, 1,
153 0, 74, 66, 58, 49, 40, 31, 21, 11, 2,
154 0, 75, 67, 59, 50, 41, 32, 22, 12, 3,
155 0, 76, 68, 60, 51, 42, 33, 23, 13, 4,
156 0, 0, 69, 61, 52, 43, 34, 24, 14, 5,
157 0, 0, 70, 62, 53, 44, 35, 25, 15, 6,
158 0, 0, 0, 0, 54, 45, 36, 26, 16, 7,
159 0, 0, 0, 0, 0, 0, 0, 27, 17, 8,
162 int iym, ixm, il, ic,
ii;
174 if (ii < 0 || ii > (
int)(
sizeof(idx_) /
sizeof(
int)) || idx_[
ii] == 0) {
181 static const int idx_[] = {
185 0, 0, 0, 0, 0, 0, 0, 3, -1, -1,
186 0, 0, 0, 0, 0, 0, 0, 0, 2, -1,
187 6, 0, 0, 0, 0, 0, 0, 0, 0, 1,
188 -1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
189 -1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
190 -1, 6, 0, 0, 0, 0, 0, 0, 0, 0,
191 -1, -1, 6, 0, 0, 0, 0, 0, 0, 0,
192 -1, -1, 5, 4, 0, 0, 0, 0, 0, 0,
193 -1, -1, -1, -1, 4, 0, 0, 0, 0, 0,
194 -1, -1, -1, -1, -1, -1, -1, 4, 0, 0,
197 int iym, ixm, il, ic,
ii;
209 if (ii < 0 || ii > (
int)(
sizeof(idx_) /
sizeof(
int)) || idx_[
ii] == -1) {
216 int isc_in_quad = sc_in_quad(iX, iY);
222 return 79 * (iquad - 1) + isc_in_quad;
237 int isect =
sector(iX, iY);
270 int isect =
sector(iX, iY);
282 if (ilmr == 8 && iquad == 4)
295 bool far = (iquad == 2 || iquad == 3);
297 bool plus = (iz > 0);
313 static const int idx_[7][25] = {
314 {21, 16, 11, 6, 1, 22, 17, 12, 7, 2, 23, 18, 13, 8, 3, 24, 19, 14, 9, 4, 25, 20, 15, 10, 5},
316 -1, -1, -1, -1, -1, 22, 17, 12, 7, 2, 23, 18, 13, 8, 3, 24, 19, 14, 9, 4, 25, 20, 15, 10, 5,
318 {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 23, -1, -1, -1, -1, 24, 19, -1, -1, -1, 25, 20, 15, -1, -1},
319 {21, 16, 11, 6, -1, 22, 17, 12, 7, -1, 23, 18, 13, 8, -1, 24, 19, 14, 9, -1, 25, 20, 15, 10, -1},
321 21, 16, 11, 6, 1, 22, 17, 12, 7, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
324 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
326 {-1, -1, -1, 6, 1, -1, -1, -1, 7, 2, -1, -1, -1, 8, 3, -1, -1, -1, 9, 4, -1, -1, -1, 10, 5}};
329 int iX_ = (
ix - 1) / 5 + 1;
330 int iY_ = (
iy - 1) / 5 + 1;
331 int jx_ =
ix - 5 * (iX_ - 1);
332 int jy_ =
iy - 5 * (iY_ - 1);
345 if (iquad == 1 || iquad == 3) {
357 int isc_type = sc_type(iX, iY);
358 assert(isc_type >= 0 && isc_type < 7);
360 int iym, ixm, il, ic,
ii;
366 if (ii < 0 || ii > (
int)(
sizeof(idx_) /
sizeof(
int)) || idx_[isc_type][
ii] == -1) {
369 return idx_[isc_type][
ii];
373 int iX = (
ix - 1) / 5 + 1;
374 int iY = (
iy - 1) / 5 + 1;
375 int isc = sc(iX, iY);
380 int icr_in_sc = crystal_in_sc(
ix,
iy);
385 return 25 * (isc - 1) + icr_in_sc;
401 int dcc_[18] = {49, 50, 51, 52, 53, 54, 46, 47, 48, 4, 5, 6, 7, 8, 9, 1, 2, 3};
402 return dcc_[
ism - 1];
409 if (idcc >= 1 && idcc <= 9) {
414 }
else if (idcc >= 46 && idcc <= 54) {
424 std::list<std::pair<float, float> >
l;
425 getBoundary(
l,
type,
num, iz, xside);
436 std::list<std::pair<float, float> >::const_iterator l_it;
437 for (l_it =
l.begin(); l_it !=
l.end(); ++l_it) {
439 ix[
ii] = l_it->first;
440 iy[
ii] = l_it->second;
444 return new TGraph(
n,
ix,
iy);
449 std::multimap<int, std::pair<int, int> > map_;
464 for (
int iy = iymin;
iy <= iymax;
iy++) {
468 for (
int ix = ixmin;
ix <= ixmax;
ix++) {
469 int icr = crystal(
ix,
iy);
472 int iX = (
ix - 1) / 5 + 1;
473 int iY = (
iy - 1) / 5 + 1;
478 num_ = dee(iX, iY, iz);
487 num_ = lmr(iX, iY, iz);
490 num_ =
lmmod(iX, iY);
493 num_ =
dcc(iX, iY, iz);
499 num_ = crystal(
ix,
iy);
515 }
else if (
in && !
ok) {
517 map_.insert(std::pair<
int, std::pair<int, int> >(
iy, std::pair<int, int>(firstix, lastix)));
521 map_.insert(std::pair<
int, std::pair<int, int> >(
iy, std::pair<int, int>(firstix, lastix)));
527 std::multimap<int, std::pair<int, int> >::const_iterator
it;
528 std::multimap<int, std::pair<int, int> >::const_iterator lastelement;
529 std::list<std::pair<float, float> > rightl;
530 for (
int iy = 1;
iy <= 100;
iy++) {
532 if (
it == map_.end())
534 int n_ = map_.count(
iy);
538 lastelement = map_.upper_bound(
iy);
539 for (;
it != lastelement; ++
it) {
540 std::pair<float, float> p_ =
it->second;
541 l.push_back(std::pair<float, float>(p_.first - 0.5,
iy - 0.5));
542 l.push_back(std::pair<float, float>(p_.first - 0.5,
iy + 0.5));
543 rightl.push_back(std::pair<float, float>(p_.second + 0.5,
iy - 0.5));
544 rightl.push_back(std::pair<float, float>(p_.second + 0.5,
iy + 0.5));
551 std::list<std::pair<float, float> >::const_iterator rightl_it;
552 for (rightl_it = rightl.begin(); rightl_it != rightl.end(); ++rightl_it) {
553 l.push_back(std::pair<float, float>(rightl_it->first, rightl_it->second));
555 l.push_back(*
l.begin());
559 int imem_ = imem % 600;
561 if (imem_ == 50 || imem_ == 51)
563 else if (imem_ == 47 || imem_ == 46)
565 else if (imem_ == 1 || imem_ == 2)
567 else if (imem_ == 5 || imem_ == 6)
682 std::pair<int, int> pns(0, 0);
850 }
else if (dee == 2) {
935 }
else if (dee == 3) {
1022 }
else if (dee == 4) {
1113 int i_[7] = {73, 76, 81, 83, 86, 91, 93};
1114 int d_[6] = {2, 1, 2, 3, 4, 3};
1115 for (
int ii = 0;
ii < 6;
ii++) {
1116 if (ilmr >= i_[
ii] && ilmr < i_[
ii + 1]) {
1122 std::cout <<
"ilmr=" << ilmr << std::endl;
1129 std::pair<int, int> out_;
1130 int dee_ = dee(ilmr);
1135 }
else if (dee_ == 2)
1139 }
else if (dee_ == 3)
1143 }
else if (dee_ == 4) {
1151 int idee = dee(ilmr);
1152 return (idee == 2 || idee == 3);
1157 int ilmr = lmr(iX, iY, iz);
1158 if (ilmr == 81 || ilmr == 91)
1164 std::vector<int> vec;
1167 int idcc = dccAndSide_.first;
1168 int iside = dccAndSide_.second;
1169 bool near_ = near(ilmr);
1170 int ism = smFromDcc(idcc);
1174 if (
ism == 5 || (
ism < 5 && !near_) || (
ism > 5 && near_)) {
1176 std::cout <<
"ism/near " <<
ism <<
"/" << near_ << std::endl;
1179 if (
ism == 1 ||
ism == 9) {
1184 }
else if (
ism == 2 ||
ism == 8) {
1189 }
else if (
ism == 3 ||
ism == 7) {
1195 }
else if (
ism == 4 ||
ism == 6) {
1209 int ilmr10 = ilmr % 10;
1232 }
else if (ilmr10 == 4) {
1249 }
else if (ilmr10 == 5) {
1266 }
else if (ilmr10 == 6) {
1283 }
else if (ilmr10 == 7) {
1301 }
else if (ilmr10 == 8) {
1321 }
else if (ilmr10 == 9) {
1338 }
else if (ilmr10 == 0) {
1349 }
else if (ilmr10 == 1) {
1365 std::vector<int> vec;
static std::pair< int, int > memFromLmr(int ilmr)
static int lmmod(SuperCrysCoord iX, SuperCrysCoord iY)
static int crystal(CrysCoord ix, CrysCoord iy)
ALPAKA_FN_ACC int dcc(int ieta, int iphi)
static void getBoundary(std::list< std::pair< float, float > > &l, int type, int num, int iz=-1, int xside=0)
ALPAKA_FN_ACC int lmmod(int ieta, int iphi)
static int apdRefTower(int ilmr, int ilmmod)
static int smFromDcc(int idcc)
static int side(SuperCrysCoord iX, SuperCrysCoord iY, int iz)
static bool near(int ilmr)
int quadrant(const DetId &detid, const TrackerTopology *tTopo_, bool phase_)
static const bool pnTheory
ALPAKA_FN_ACC int side(int ieta, int iphi)
static int dcc(SuperCrysCoord iX, SuperCrysCoord iY, int iz)
static int sc_type(SuperCrysCoord iX, SuperCrysCoord iY)
static int sc_in_quad(SuperCrysCoord iX, SuperCrysCoord iY)
static std::pair< int, int > pn(int dee, int ilmod)
static int dccFromSm(int ism)
static TString smName(int ism)
static std::pair< int, int > dccAndSide(int ilmr)
static int sm(SuperCrysCoord iX, SuperCrysCoord iY, int iz)
Abs< T >::type abs(const T &t)
static int sector(SuperCrysCoord iX, SuperCrysCoord iY)
static std::vector< int > lmmodFromLmr(int ilmr)
static TGraph * getGraphBoundary(int type, int num, int iz=-1, int xside=0)
ALPAKA_FN_ACC ALPAKA_FN_INLINE uint32_t ix(uint32_t id)
static int deeFromMem(int imem)
static std::vector< int > apdRefChannels(int ilmmod)
static int crystal_in_sc(CrysCoord ix, CrysCoord iy)
static int dee(SuperCrysCoord iX, SuperCrysCoord iY, int iz)
ALPAKA_FN_ACC ALPAKA_FN_INLINE uint32_t iy(uint32_t id)
static int quadrant(SuperCrysCoord iX, SuperCrysCoord iY)
int ism(int ieta, int iphi)
static int sc(SuperCrysCoord iX, SuperCrysCoord iY)
static int lmr(SuperCrysCoord iX, SuperCrysCoord iY, int iz)