13 std::vector<DetId>& vdets,
bool debug) {
21 std::cout <<
"matrixECALIds::Add " << ieta <<
" rows and " << iphi
22 <<
" columns of cells for 1 cell" << std::endl;
25 std::cout <<
"matrixECALIds::Cell 0x" << std::hex << det() << std::dec
26 <<
" " <<
id << std::endl;
29 std::cout <<
"matrixECALIds::Cell 0x" << std::hex << det() << std::dec
30 <<
" " <<
id << std::endl;
32 std::cout <<
"matrixECALIds::Cell 0x" << std::hex << det() << std::dec
33 <<
" Unknown Type" << std::endl;
37 std::vector<DetId> dets(1,det);
38 std::vector<CaloDirection> dirs(1,
NORTH);
40 *barrelGeom,*endcapGeom,debug);
43 *barrelTopo,*endcapTopo,
44 *barrelGeom,*endcapGeom,debug);
45 for (
unsigned int i1=0; i1<vdetS.size(); i1++) {
46 if (
std::count(vdets.begin(),vdets.end(),vdetS[i1]) == 0)
47 vdets.push_back(vdetS[i1]);
49 unsigned int ndet = (2*ieta+1)*(2*iphi+1);
50 if (vdets.size() != ndet) {
51 std::vector<DetId> vdetExtra;
53 *barrelGeom, *endcapGeom, vdetExtra, debug);
54 if (vdetExtra.size() > 0)
55 vdets.insert(vdets.end(), vdetExtra.begin(), vdetExtra.end());
59 std::cout <<
"matrixECALIds::Total number of cells found is "
60 << vdets.size() << std::endl;
61 for (
unsigned int i1=0; i1<vdets.size(); i1++) {
64 std::cout <<
"matrixECALIds::Cell " << i1 <<
" 0x" << std::hex
65 << vdets[i1]() << std::dec <<
" " <<
id << std::endl;
66 }
else if (vdets[i1].subdetId() ==
EcalEndcap) {
68 std::cout <<
"matrixECALIds::Cell " << i1 <<
" 0x" << std::hex
69 << vdets[i1]() << std::dec <<
" " <<
id << std::endl;
71 std::cout <<
"matrixECALIds::Cell " << i1 <<
" 0x" << std::hex
72 << vdets[i1]() << std::dec <<
" Unknown Type" << std::endl;
83 std::vector<DetId> vdets;
84 matrixECALIds(det, ieta, iphi, geo, caloTopology, vdets, debug);
90 std::vector<DetId>& vdets,
bool debug) {
98 std::cout <<
"matrixECALIds::Add " << ietaE <<
"|" << ietaW
99 <<
" rows and " << iphiN <<
"|" << iphiS
100 <<
" columns of cells for 1 cell" << std::endl;
103 std::cout <<
"matrixECALIds::Cell 0x" << std::hex << det() << std::dec
104 <<
" " <<
id << std::endl;
107 std::cout <<
"matrixECALIds::Cell 0x" << std::hex << det() << std::dec
108 <<
" " <<
id << std::endl;
110 std::cout <<
"matrixECALIds::Cell 0x" << std::hex << det() << std::dec
111 <<
" Unknown Type" << std::endl;
115 std::vector<DetId> dets(1,det);
116 std::vector<CaloDirection> dirs(1,
NORTH);
117 std::vector<int> jetaE(1,ietaE), jetaW(1,ietaW);
118 std::vector<int> jphiN(1,iphiN), jphiS(1,iphiS);
120 *barrelTopo, *endcapTopo, *barrelGeom,
124 jphiS, dirs, *barrelTopo,
125 *endcapTopo, *barrelGeom,
127 for (
unsigned int i1=0; i1<vdetS.size(); i1++) {
128 if (
std::count(vdets.begin(),vdets.end(),vdetS[i1]) == 0)
129 vdets.push_back(vdetS[i1]);
132 unsigned int ndet = (ietaE+ietaW+1)*(iphiN+iphiS+1);
133 if (vdets.size() != ndet) {
134 std::vector<DetId> vdetExtra;
136 *barrelGeom, *endcapGeom, vdetExtra, debug);
137 if (vdetExtra.size() > 0)
138 vdets.insert(vdets.end(), vdetExtra.begin(), vdetExtra.end());
142 std::cout <<
"matrixECALIds::Total number of cells found is "
143 << vdets.size() << std::endl;
144 for (
unsigned int i1=0; i1<vdets.size(); i1++) {
147 std::cout <<
"matrixECALIds::Cell " << i1 <<
" 0x" << std::hex
148 << vdets[i1]() << std::dec <<
" " <<
id << std::endl;
149 }
else if (vdets[i1].subdetId() ==
EcalEndcap) {
151 std::cout <<
"matrixECALIds::Cell " << i1 <<
" 0x" << std::hex
152 << vdets[i1]() << std::dec <<
" " <<
id << std::endl;
154 std::cout <<
"matrixECALIds::Cell " << i1 <<
" 0x" << std::hex
155 << vdets[i1]() << std::dec <<
" Unknown Type" << std::endl;
162 int iphiN,
int iphiS,
167 std::vector<DetId> vdets;
175 std::vector<CaloDirection>&
dir,
183 std::cout <<
"newECALIdNS::Add " << iphi <<
" columns of cells for "
184 << (dets.size()-
last) <<
" cells (last " << last <<
")"
186 for (
unsigned int i1=last; i1<dets.size(); i1++) {
189 std::cout <<
"newECALIdNS::Cell " << i1 <<
" " <<
id <<
" along "
190 << dir[i1] << std::endl;
191 }
else if (dets[i1].subdetId() ==
EcalEndcap) {
193 std::cout <<
"newECALIdNS::Cell " << i1 <<
" " <<
id <<
" along "
194 << dir[i1] << std::endl;
196 std::cout <<
"newECALIdNS::Cell " << i1 <<
" 0x" << std::hex
197 << dets[i1]() << std::dec <<
" Unknown Type along "
198 << dir[i1] << std::endl;
203 std::vector<DetId> vdets;
204 std::vector<CaloDirection> dirs;
205 vdets.insert(vdets.end(), dets.begin(), dets.end());
206 dirs.insert(dirs.end(), dir.begin(), dir.end());
208 std::vector<DetId> vdetE, vdetW;
210 unsigned int ndet = vdets.size();
211 std::vector<CaloDirection> dirE(ndet,
EAST), dirW(ndet,
WEST);
213 barrelGeom, endcapGeom, debug);
215 barrelGeom, endcapGeom, debug);
216 for (
unsigned int i1=0; i1<vdetW.size(); i1++) {
217 if (
std::count(vdets.begin(),vdets.end(),vdetW[i1]) == 0) {
218 vdets.push_back(vdetW[i1]);
219 dirs.push_back(dir[0]);
222 for (
unsigned int i1=0; i1<vdetE.size(); i1++) {
223 if (
std::count(vdets.begin(),vdets.end(),vdetE[i1]) == 0) {
224 vdets.push_back(vdetE[i1]);
225 dirs.push_back(dir[0]);
229 std::cout <<
"newECALIdNS::With Added cells along E/W results a set of "
230 << (vdets.size()-dets.size()) <<
" new cells" << std::endl;
231 for (
unsigned int i1=dets.size(); i1<vdets.size(); i1++) {
234 std::cout <<
"newECALIdNS::Cell " << i1 <<
" " <<
id <<
" along "
235 << dirs[i1] << std::endl;
236 }
else if (vdets[i1].subdetId() ==
EcalEndcap) {
238 std::cout <<
"newECALIdNS::Cell " << i1 <<
" " <<
id <<
" along "
239 << dirs[i1] << std::endl;
241 std::cout <<
"newECALIdNS::Cell " << i1 <<
" 0x" << std::hex
242 << vdets[i1]() << std::dec <<
" Unknown Type along "
243 << dirs[i1] << std::endl;
249 unsigned int last0 = vdets.size();
250 std::vector<DetId> vdetnew;
251 std::vector<CaloDirection> dirnew;
253 std::vector<DetId> vdetn(1);
254 std::vector<CaloDirection> dirn(1);
255 std::vector<CaloDirection> dirnE(1,
EAST), dirnW(1,
WEST);
257 for (
unsigned int i1=last; i1<dets.size(); i1++) {
258 std::vector<DetId> cells;
260 barrelGeom, endcapGeom, cells, flag, debug);
290 if (
std::count(vdets.begin(),vdets.end(),cells[0]) == 0) {
292 vdetnew.push_back(vdetn[0]);
296 else dirn[0] =
NORTH;
298 dirnew.push_back(dirn[0]);
300 endcapTopo, barrelGeom, endcapGeom,debug);
302 endcapTopo, barrelGeom, endcapGeom,debug);
303 for (
unsigned int i2=0; i2<vdetW.size(); i2++) {
304 if (
std::count(vdets.begin(),vdets.end(),vdetW[i2]) == 0 &&
305 std::count(vdetnew.begin(),vdetnew.end(),vdetW[i2]) == 0) {
306 vdets.push_back(vdetW[i2]);
307 dirs.push_back(dirn[0]);
310 for (
unsigned int i2=0; i2<vdetE.size(); i2++) {
311 if (
std::count(vdets.begin(),vdets.end(),vdetE[i2]) == 0 &&
312 std::count(vdetnew.begin(),vdetnew.end(),vdetE[i2]) == 0) {
313 vdets.push_back(vdetE[i2]);
314 dirs.push_back(dirn[0]);
322 for (
unsigned int i2=0; i2<vdetnew.size(); i2++) {
323 if (
std::count(vdets.begin(),vdets.end(),vdetnew[i2]) == 0) {
324 vdets.push_back(vdetnew[i2]);
325 dirs.push_back(dirnew[i2]);
329 std::cout <<
"newECALIdNS::Addition results a set of "
330 << (vdets.size()-last0) <<
" new cells (last " << last0
331 <<
", iphi " << iphi <<
")" << std::endl;
332 for (
unsigned int i1=last0; i1<vdets.size(); i1++) {
335 std::cout <<
"newECALIdNS::Cell " << i1 <<
" " <<
id <<
" along "
336 << dirs[i1] << std::endl;
337 }
else if (vdets[i1].subdetId() ==
EcalEndcap) {
339 std::cout <<
"newECALIdNS::Cell " << i1 <<
" " <<
id <<
" along "
340 << dirs[i1] << std::endl;
342 std::cout <<
"newECALIdNS::Cell " << i1 <<
" 0x" << std::hex
343 << vdets[i1]() << std::dec <<
" Unknown Type along "
344 << dirs[i1] << std::endl;
353 return spr::newECALIdNS(vdets,last,ieta,iphi,dirs,barrelTopo,endcapTopo,barrelGeom,endcapGeom,debug);
356 std::cout <<
"newECALIdNS::Final list consists of " << vdets.size()
357 <<
" cells" << std::endl;
358 for (
unsigned int i1=0; i1<vdets.size(); i1++) {
361 std::cout <<
"newECALIdNS::Cell " << i1 <<
" " <<
id << std::endl;
362 }
else if (vdets[i1].subdetId() ==
EcalEndcap) {
364 std::cout <<
"newECALIdNS::Cell " << i1 <<
" " <<
id << std::endl;
366 std::cout <<
"newECALIdNS::Cell " << i1 <<
" 0x" << std::hex
367 << vdets[i1]() << std::dec <<
" Unknown Type"
377 std::vector<int>& ietaE,
378 std::vector<int>& ietaW,
379 std::vector<int>& iphiN,
380 std::vector<int>& iphiS,
381 std::vector<CaloDirection>&
dir,
389 std::cout <<
"newECALIdNS::Add columns of cells for "
390 << (dets.size()-
last) <<
" cells (last) " << last << std::endl;
391 for (
unsigned int i1=last; i1<dets.size(); i1++) {
394 std::cout <<
"newECALIdNS::Cell " << i1 <<
" " <<
id <<
" along "
395 << dir[i1] <<
" # " << iphiN[i1] <<
"|" << iphiS[i1]
397 }
else if (dets[i1].subdetId() ==
EcalEndcap) {
399 std::cout <<
"newECALIdNS::Cell " << i1 <<
" " <<
id <<
" along "
400 << dir[i1] <<
" # " << iphiN[i1] <<
"|" << iphiS[i1]
403 std::cout <<
"newECALIdNS::Cell " << i1 <<
" 0x" << std::hex
404 << dets[i1]() << std::dec <<
" Unknown Type along "
405 << dir[i1] <<
" # " << iphiN[i1] <<
"|" << iphiS[i1]
411 std::vector<DetId> vdets;
412 std::vector<CaloDirection> dirs;
413 std::vector<int> jetaE, jetaW, jphiN, jphiS;
414 vdets.insert(vdets.end(), dets.begin(), dets.end());
415 dirs.insert(dirs.end(), dir.begin(), dir.end());
416 jetaE.insert(jetaE.end(), ietaE.begin(), ietaE.end());
417 jetaW.insert(jetaW.end(), ietaW.begin(), ietaW.end());
418 jphiN.insert(jphiN.end(), iphiN.begin(), iphiN.end());
419 jphiS.insert(jphiS.end(), iphiS.begin(), iphiS.end());
420 std::vector<DetId> vdetE, vdetW;
422 unsigned int ndet = vdets.size();
423 std::vector<CaloDirection> dirE(ndet,
EAST), dirW(ndet,
WEST);
425 endcapTopo, barrelGeom, endcapGeom, debug);
427 endcapTopo, barrelGeom, endcapGeom, debug);
428 for (
unsigned int i1=0; i1<vdetW.size(); i1++) {
429 if (
std::count(vdets.begin(),vdets.end(),vdetW[i1]) == 0) {
430 vdets.push_back(vdetW[i1]);
431 dirs.push_back(dir[0]);
434 jphiN.push_back(iphiN[0]);
435 jphiS.push_back(iphiS[0]);
438 for (
unsigned int i1=0; i1<vdetE.size(); i1++) {
439 if (
std::count(vdets.begin(),vdets.end(),vdetE[i1]) == 0) {
440 vdets.push_back(vdetE[i1]);
441 dirs.push_back(dir[0]);
444 jphiN.push_back(iphiN[0]);
445 jphiS.push_back(iphiS[0]);
449 std::cout <<
"newECALIdNS::With Added cells along E/W results a set of "
450 << (vdets.size()-dets.size()) <<
" new cells" << std::endl;
451 for (
unsigned int i1=dets.size(); i1<vdets.size(); i1++) {
454 std::cout <<
"newECALIdNS::Cell " << i1 <<
" " <<
id <<
" along "
455 << dirs[i1] << std::endl;
456 }
else if (vdets[i1].subdetId() ==
EcalEndcap) {
458 std::cout <<
"newECALIdNS::Cell " << i1 <<
" " <<
id <<
" along "
459 << dirs[i1] << std::endl;
461 std::cout <<
"newECALIdNS::Cell " << i1 <<
" 0x" << std::hex
462 << vdets[i1]() << std::dec <<
" Unknown Type along "
463 << dirs[i1] << std::endl;
469 unsigned int last0 = vdets.size();
470 std::vector<DetId> vdetnew;
471 std::vector<CaloDirection> dirnew;
472 std::vector<int> kphiN, kphiS, ketaE, ketaW;
474 for (
unsigned int i1=last; i1<dets.size(); i1++) {
475 int iphi = iphiS[i1];
476 if (dir[i1] ==
NORTH) iphi = iphiN[i1];
478 std::vector<DetId> vdetn(1);
479 std::vector<CaloDirection> dirn(1);
480 std::vector<CaloDirection> dirnE(1,
EAST), dirnW(1,
WEST);
482 std::vector<DetId> cells;
484 barrelGeom, endcapGeom, cells, flag, debug);
486 if (iphi > kphi) kphi = iphi;
487 if (dir[i1] ==
NORTH) jphiN[i1] = iphi;
488 else jphiS[i1] = iphi;
490 if (
std::count(vdets.begin(),vdets.end(),cells[0]) == 0) {
491 int kfiN = iphiN[i1];
492 int kfiS = iphiS[i1];
494 vdetnew.push_back(vdetn[0]);
496 if (dir[i1] ==
NORTH) kfiN = iphi;
499 int ktmp = kfiS; kfiS = kfiN; kfiN = ktmp;
501 else dirn[0] =
NORTH;
503 dirnew.push_back(dirn[0]);
504 kphiN.push_back(kfiN); ketaE.push_back(ietaE[i1]);
505 kphiS.push_back(kfiS); ketaW.push_back(ietaW[i1]);
506 std::vector<int> ietE(1,ietaE[i1]), ietW(1,ietaW[i1]);
508 endcapTopo, barrelGeom, endcapGeom,debug);
510 endcapTopo, barrelGeom, endcapGeom,debug);
511 for (
unsigned int i2=0; i2<vdetW.size(); i2++) {
512 if (
std::count(vdets.begin(),vdets.end(),vdetW[i2]) == 0 &&
513 std::count(vdetnew.begin(),vdetnew.end(),vdetW[i2]) == 0) {
514 vdets.push_back(vdetW[i2]);
515 dirs.push_back(dirn[0]);
516 jetaE.push_back(0); jphiN.push_back(kfiN);
517 jetaW.push_back(0); jphiS.push_back(kfiS);
520 for (
unsigned int i2=0; i2<vdetE.size(); i2++) {
521 if (
std::count(vdets.begin(),vdets.end(),vdetE[i2]) == 0 &&
522 std::count(vdetnew.begin(),vdetnew.end(),vdetE[i2]) == 0) {
523 vdets.push_back(vdetE[i2]);
524 dirs.push_back(dirn[0]);
525 jetaE.push_back(0); jphiN.push_back(kfiN);
526 jetaW.push_back(0); jphiS.push_back(kfiS);
534 for (
unsigned int i2=0; i2<vdetnew.size(); i2++) {
535 if (
std::count(vdets.begin(),vdets.end(),vdetnew[i2]) == 0) {
536 vdets.push_back(vdetnew[i2]);
537 dirs.push_back(dirnew[i2]);
538 jetaE.push_back(ketaE[i2]);
539 jetaW.push_back(ketaW[i2]);
540 jphiN.push_back(kphiN[i2]);
541 jphiS.push_back(kphiS[i2]);
545 std::cout <<
"newECALIdNS::Addition results a set of "
546 << (vdets.size()-last0) <<
" new cells (last " << last0
547 <<
", iphi " << kphi <<
")" << std::endl;
548 for (
unsigned int i1=last0; i1<vdets.size(); i1++) {
551 std::cout <<
"newECALIdNS::Cell " << i1 <<
" " <<
id <<
" along "
552 << dirs[i1] <<
" iphi " << jphiN[i1] <<
"|" << jphiS[i1]
553 <<
" ieta " << jetaE[i1] <<
"|" << jetaW[i1] << std::endl;
554 }
else if (vdets[i1].subdetId() ==
EcalEndcap) {
556 std::cout <<
"newECALIdNS::Cell " << i1 <<
" " <<
id <<
" along "
557 << dirs[i1] <<
" iphi " << jphiN[i1] <<
"|" << jphiS[i1]
558 <<
" ieta " << jetaE[i1] <<
"|" << jetaW[i1] << std::endl;
560 std::cout <<
"newECALIdNS::Cell " << i1 <<
" 0x" << std::hex
561 << vdets[i1]() << std::dec <<
" Unknown Type along "
562 << dirs[i1] <<
" iphi " << jphiN[i1] <<
"|" << jphiS[i1]
563 <<
" ieta " << jetaE[i1] <<
"|" << jetaW[i1] << std::endl;
572 barrelTopo, endcapTopo, barrelGeom, endcapGeom,
576 std::cout <<
"newECALIdNS::Final list consists of " << vdets.size()
577 <<
" cells" << std::endl;
578 for (
unsigned int i1=0; i1<vdets.size(); i1++) {
581 std::cout <<
"newECALIdNS::Cell " << i1 <<
" " <<
id << std::endl;
582 }
else if (vdets[i1].subdetId() ==
EcalEndcap) {
584 std::cout <<
"newECALIdNS::Cell " << i1 <<
" " <<
id << std::endl;
586 std::cout <<
"newECALIdNS::Cell " << i1 <<
" 0x" << std::hex
587 << vdets[i1]() << std::dec <<
" Unknown Type"
597 int ieta, std::vector<CaloDirection>&
dir,
605 std::cout <<
"newECALIdEW::Add " << ieta <<
" rows of cells for "
606 << last <<
":" << dets.size() <<
":" << (dets.size()-
last)
607 <<
" cells" << std::endl;
608 for (
unsigned int i1=last; i1<dets.size(); i1++) {
611 std::cout <<
"newECALIdEW::Cell " << i1 <<
" " <<
id <<
" along "
612 << dir[i1] << std::endl;
613 }
else if (dets[i1].subdetId() ==
EcalEndcap) {
615 std::cout <<
"newECALIdEW::Cell " << i1 <<
" " <<
id <<
" along "
616 << dir[i1] << std::endl;
618 std::cout <<
"newECALIdEW::Cell " << i1 <<
" 0x" << std::hex
619 << dets[i1]() << std::dec <<
" Unknown Type along "
620 << dir[i1] << std::endl;
625 std::vector<DetId> vdets; vdets.clear();
626 std::vector<CaloDirection> dirs; dirs.clear();
627 vdets.insert(vdets.end(), dets.begin(), dets.end());
628 dirs.insert(dirs.end(), dir.begin(), dir.end());
631 for (
unsigned int i1=last; i1<dets.size(); i1++) {
633 std::vector<DetId> cells;
635 barrelGeom, endcapGeom, cells, flag, debug);
665 if (
std::count(vdets.begin(),vdets.end(),cells[0]) == 0) {
671 vdets.push_back(cells[0]);
672 dirs.push_back(dirn);
680 std::cout <<
"newECALIdEW::Addition results a set of "
681 << (vdets.size()-dets.size()) <<
" new cells" << std::endl;
682 for (
unsigned int i1=dets.size(); i1<vdets.size(); i1++) {
685 std::cout <<
"newECALIdEW::Cell " << i1 <<
" " <<
id <<
" along "
686 << dirs[i1] << std::endl;
687 }
else if (vdets[i1].subdetId() ==
EcalEndcap) {
689 std::cout <<
"newECALIdEW::Cell " << i1 <<
" " <<
id <<
" along "
690 << dirs[i1] << std::endl;
692 std::cout <<
"newECALIdEW::Cell " << i1 <<
" 0x" << std::hex
693 << vdets[i1]() << std::dec <<
" Unknown Type along "
694 << dirs[i1] << std::endl;
701 return spr::newECALIdEW(vdets,last,ieta,dirs,barrelTopo,endcapTopo,barrelGeom,endcapGeom,debug);
704 std::cout <<
"newECALIdEW::Final list (EW) consists of " <<vdets.size()
705 <<
" cells" << std::endl;
706 for (
unsigned int i1=0; i1<vdets.size(); i1++) {
709 std::cout <<
"newECALIdEW::Cell " << i1 <<
" " <<
id << std::endl;
710 }
else if (vdets[i1].subdetId() ==
EcalEndcap) {
712 std::cout <<
"newECALIdEW::Cell " << i1 <<
" " <<
id << std::endl;
714 std::cout <<
"newECALIdEW::Cell " << i1 <<
" 0x" << std::hex
715 << vdets[i1]() <<std::dec <<
" Unknown Type" <<std::endl;
724 std::vector<int>& ietaE,
725 std::vector<int>& ietaW,
726 std::vector<CaloDirection>&
dir,
734 std::cout <<
"newECALIdEW::Add " << ietaE[0] <<
"|" << ietaW[0]
735 <<
" rows of cells for " << (dets.size()-
last)
736 <<
" cells (last " << last <<
")" << std::endl;
737 for (
unsigned int i1=last; i1<dets.size(); i1++) {
740 std::cout <<
"newECALIdEW::Cell " << i1 <<
" " <<
id <<
" along "
741 << dir[i1] << std::endl;
742 }
else if (dets[i1].subdetId() ==
EcalEndcap) {
744 std::cout <<
"newECALIdEW::Cell " << i1 <<
" " <<
id <<
" along "
745 << dir[i1] << std::endl;
747 std::cout <<
"newECALIdEW::Cell " << i1 <<
" 0x" << std::hex
748 << dets[i1]() << std::dec <<
" Unknown Type along "
749 << dir[i1] << std::endl;
754 std::vector<DetId> vdets;
755 vdets.insert(vdets.end(), dets.begin(), dets.end());
756 std::vector<CaloDirection> dirs;
757 dirs.insert(dirs.end(), dir.begin(), dir.end());
758 std::vector<int> jetaE, jetaW;
759 jetaE.insert(jetaE.end(), ietaE.begin(), ietaE.end());
760 jetaW.insert(jetaW.end(), ietaW.begin(), ietaW.end());
762 for (
unsigned int i1=last; i1<dets.size(); i1++) {
763 int ieta = ietaW[i1];
764 if (dir[i1] ==
EAST) ieta = ietaE[i1];
767 std::vector<DetId> cells;
769 barrelGeom, endcapGeom, cells, flag, debug);
771 if (ieta > keta) keta = ieta;
772 if (dir[i1] ==
EAST) jetaE[i1] = ieta;
773 else jetaW[i1] = ieta;
775 if (
std::count(vdets.begin(),vdets.end(),cells[0]) == 0) {
776 vdets.push_back(cells[0]);
778 int ketaE = ietaE[i1];
779 int ketaW = ietaW[i1];
780 if (dirn ==
EAST) ketaE = ieta;
783 int ktmp = ketaW; ketaW = ketaE; ketaE = ktmp;
787 dirs.push_back(dirn);
788 jetaE.push_back(ketaE);
789 jetaW.push_back(ketaW);
796 std::cout <<
"newECALIdEW::Addition results a set of "
797 << (vdets.size()-dets.size()) <<
" new cells (last "
798 << dets.size() <<
", ieta " << keta <<
")" << std::endl;
799 for (
unsigned int i1=dets.size(); i1<vdets.size(); i1++) {
802 std::cout <<
"newECALIdEW::Cell " << i1 <<
" " <<
id << std::endl;
803 }
else if (vdets[i1].subdetId() ==
EcalEndcap) {
805 std::cout <<
"newECALIdEW::Cell " << i1 <<
" " <<
id << std::endl;
807 std::cout <<
"newECALIdEW::Cell " << i1 <<
" 0x" << std::hex
808 << vdets[i1]() << std::dec <<
" Unknown Type" << std::endl;
816 endcapTopo, barrelGeom, endcapGeom, debug);
819 std::cout <<
"newECALIdEW::Final list (EW) consists of " <<vdets.size()
820 <<
" cells" << std::endl;
821 for (
unsigned int i1=0; i1<vdets.size(); i1++) {
824 std::cout <<
"newECALIdEW::Cell " << i1 <<
" " <<
id << std::endl;
825 }
else if (vdets[i1].subdetId() ==
EcalEndcap) {
827 std::cout <<
"newECALIdEW::Cell " << i1 <<
" " <<
id << std::endl;
829 std::cout <<
"newECALIdEW::Cell " << i1 <<
" 0x" << std::hex
830 << vdets[i1]() <<std::dec <<
" Unknown Type" <<std::endl;
843 std::vector<DetId>& cells,
int&
ok,
bool debug) {
849 std::vector<DetId> neighbours = barrelTopo.
getNeighbours(detId,dir);
850 if (neighbours.size()>0 && !neighbours[0].null()) {
851 cells.push_back(neighbours[0]);
852 cell = neighbours[0];
855 const int ietaAbs ( detId.
ietaAbs() ) ;
861 cell = *(ol.begin() );
863 if (neighbours.size()>0 && !neighbours[0].null()) ok = 1;
866 cells.push_back(*iptr);
871 std::vector<DetId> neighbours = endcapTopo.
getNeighbours(detId,dir);
872 if (neighbours.size()>0 && !neighbours[0].null()) {
873 cells.push_back(neighbours[0]);
874 cell = neighbours[0];
884 cell = *(ol.begin() );
886 if (neighbours.size()>0 && !neighbours[0].null()) ok = 1;
889 cells.push_back(*iptr);
894 std::cout <<
"simpleMove:: Move DetId 0x" << std::hex << det()
895 << std::dec <<
" along " << dir <<
" to get 0x" << std::hex
896 << cell() << std::dec <<
" with flag " << ok <<
" # "
898 for (
unsigned int i1=0; i1<cells.size(); ++i1)
899 std::cout <<
" " << std::hex << cells[0]() << std::dec;
908 if (debug)
std::cout <<
"extraIds::Cell " <<
id <<
" rows " << ietaW
909 <<
"|" << ietaE <<
" columns " << iphiS <<
"|"
910 << iphiN << std::endl;
911 int etaC =
id.ietaAbs();
912 int phiC =
id.iphi();
913 int zsid =
id.zside();
914 for (
int eta = -ietaW;
eta <= ietaE; ++
eta) {
915 for (
int phi = -iphiS;
phi <= iphiN; ++
phi) {
917 if (iphi < 0) iphi += 360;
918 else if (iphi > 360) iphi -= 360;
919 int ieta = zsid*(etaC+
eta);
924 cells.push_back((
DetId)
id);
932 if (debug)
std::cout <<
"extraIds::Cell " <<
id <<
" rows " << ietaW
933 <<
"|" << ietaE <<
" columns " << iphiS <<
"|"
934 << iphiN << std::endl;
937 int zsid =
id.zside();
938 for (
int kx = -ietaW; kx <= ietaE; ++kx) {
939 for (
int ky = -iphiS; ky <= iphiN; ++ky) {
946 cells.push_back((
DetId)
id);
955 std::cout <<
"extraIds:: finds " << cells.size() <<
" new cells"
957 for (
unsigned int i1=0; i1<cells.size(); ++i1) {
960 std::cout <<
"extraIds::Cell " << i1 <<
" " <<
id << std::endl;
961 }
else if (cells[i1].subdetId() ==
EcalEndcap) {
963 std::cout <<
"ectraIds::Cell " << i1 <<
" " <<
id << std::endl;
965 std::cout <<
"extraIds::Cell " << i1 <<
" 0x" << std::hex
966 << cells[i1]() <<std::dec <<
" Unknown Type" <<std::endl;
static bool validDetId(int i, int j)
check if a valid index combination
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
const OrderedListOfEEDetId * getClosestEndcapCells(EBDetId id) const
virtual std::vector< DetId > getNeighbours(const DetId &id, const CaloDirection &dir) const
void extraIds(const DetId &det, std::vector< DetId > &dets, int ietaE, int ietaW, int iphiN, int iphiS, const EcalBarrelGeometry &barrelGeom, const EcalEndcapGeometry &endcapGeom, std::vector< DetId > &cells, bool debug=false)
static bool validDetId(int crystal_ix, int crystal_iy, int iz)
std::vector< DetId > newECALIdEW(std::vector< DetId > &dets, unsigned int last, int ieta, std::vector< CaloDirection > &dir, const CaloSubdetectorTopology &barrelTopo, const CaloSubdetectorTopology &endcapTopo, const EcalBarrelGeometry &barrelGeom, const EcalEndcapGeometry &endcapGeom, bool debug=false)
virtual bool present(const DetId &id) const
is this detid present in the geometry?
int iPhiOuterRing() const
const OrderedListOfEBDetId * getClosestBarrelCells(EEDetId id) const
int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
void matrixECALIds(const DetId &det, int ieta, int iphi, const CaloGeometry *geo, const CaloTopology *caloTopology, std::vector< DetId > &vdets, bool debug=false)
static const int MAX_IETA
const CaloSubdetectorTopology * getSubdetectorTopology(const DetId &id) const
access the subdetector Topology for the given subdetector directly
MgrType::const_iterator const_iterator
void simpleMove(DetId &det, const CaloDirection &dir, const CaloSubdetectorTopology &barrelTopo, const CaloSubdetectorTopology &endcapTopo, const EcalBarrelGeometry &barrelGeom, const EcalEndcapGeometry &endcapGeom, std::vector< DetId > &cells, int &flag, bool debug=false)
CaloDirection
Codes the local directions in the cell lattice.
std::vector< DetId > newECALIdNS(std::vector< DetId > &dets, unsigned int last, int ieta, int iphi, std::vector< CaloDirection > &dir, const CaloSubdetectorTopology &barrelTopo, const CaloSubdetectorTopology &endcapTopo, const EcalBarrelGeometry &barrelGeom, const EcalEndcapGeometry &endcapGeom, bool debug=false)
int ietaAbs() const
get the absolute value of the crystal ieta