21 std::vector<DetId>& vdets,
23 bool ignoreTransition) {
33 std::cout <<
"matrixECALIds::Add " <<
ieta <<
" rows and " <<
iphi <<
" columns of cells for 1 cell" << std::endl;
37 std::vector<DetId> dets(1, det);
38 std::vector<CaloDirection>
dirs(1,
NORTH);
40 dets, 0,
ieta,
iphi,
dirs, barrelTopo, endcapTopo, barrelGeom, endcapGeom,
debug, ignoreTransition);
43 dets, 0,
ieta,
iphi,
dirs, barrelTopo, endcapTopo, barrelGeom, endcapGeom,
debug, ignoreTransition);
44 for (
unsigned int i1 = 0;
i1 < vdetS.size();
i1++) {
45 if (
std::count(vdets.begin(), vdets.end(), vdetS[
i1]) == 0)
46 vdets.push_back(vdetS[
i1]);
48 unsigned int ndet = (2 *
ieta + 1) * (2 *
iphi + 1);
49 if (vdets.size() != ndet) {
50 std::vector<DetId> vdetExtra;
52 if (!vdetExtra.empty())
53 vdets.insert(vdets.end(), vdetExtra.begin(), vdetExtra.end());
58 std::cout <<
"matrixECALIds::Total number of cells found is " << vdets.size() << std::endl;
70 bool ignoreTransition) {
71 std::vector<DetId> vdets;
82 bool ignoreTransition) {
91 int ietaphi = (
int)(
dR / 2.0) + 1;
92 std::vector<DetId> vdets, vdetx;
94 for (
unsigned int i = 0;
i < vdets.size(); ++
i) {
104 vdetx.push_back(vdets[
i]);
110 std::cout <<
"matrixECALIds::Final List of cells for dR " <<
dR <<
" is with " << vdetx.size()
111 <<
" from original list of " << vdets.size() << std::endl;
125 std::vector<DetId>& vdets,
127 bool ignoreTransition) {
137 std::cout <<
"matrixECALIds::Add " << ietaE <<
"|" << ietaW <<
" rows and " << iphiN <<
"|" << iphiS
138 <<
" columns of cells for 1 cell" << std::endl;
142 std::vector<DetId> dets(1, det);
143 std::vector<CaloDirection>
dirs(1,
NORTH);
144 std::vector<int> jetaE(1, ietaE), jetaW(1, ietaW);
145 std::vector<int> jphiN(1, iphiN), jphiS(1, iphiS);
173 for (
unsigned int i1 = 0;
i1 < vdetS.size();
i1++) {
174 if (
std::count(vdets.begin(), vdets.end(), vdetS[
i1]) == 0)
175 vdets.push_back(vdetS[
i1]);
178 unsigned int ndet = (ietaE + ietaW + 1) * (iphiN + iphiS + 1);
179 if (vdets.size() != ndet) {
180 std::vector<DetId> vdetExtra;
181 spr::extraIds(det, vdets, ietaE, ietaW, iphiN, iphiS, barrelGeom, endcapGeom, vdetExtra,
debug);
182 if (!vdetExtra.empty())
183 vdets.insert(vdets.end(), vdetExtra.begin(), vdetExtra.end());
188 std::cout <<
"matrixECALIds::Total number of cells found is " << vdets.size() << std::endl;
202 bool ignoreTransition) {
203 std::vector<DetId> vdets;
212 std::vector<CaloDirection>&
dir,
218 bool ignoreTransition) {
221 std::cout <<
"newECALIdNS::Add " <<
iphi <<
" columns of cells for " << (dets.size() -
last) <<
" cells (last "
222 <<
last <<
")" << std::endl;
226 std::vector<DetId> vdets;
227 std::vector<CaloDirection>
dirs;
228 vdets.insert(vdets.end(), dets.begin(), dets.end());
231 std::vector<DetId> vdetE, vdetW;
233 unsigned int ndet = vdets.size();
234 std::vector<CaloDirection> dirE(ndet,
EAST), dirW(ndet,
WEST);
236 dets,
last,
ieta, dirE, barrelTopo, endcapTopo, barrelGeom, endcapGeom,
debug, ignoreTransition);
238 dets,
last,
ieta, dirW, barrelTopo, endcapTopo, barrelGeom, endcapGeom,
debug, ignoreTransition);
239 for (
unsigned int i1 = 0;
i1 < vdetW.size();
i1++) {
240 if (
std::count(vdets.begin(), vdets.end(), vdetW[
i1]) == 0) {
241 vdets.push_back(vdetW[
i1]);
245 for (
unsigned int i1 = 0;
i1 < vdetE.size();
i1++) {
246 if (
std::count(vdets.begin(), vdets.end(), vdetE[
i1]) == 0) {
247 vdets.push_back(vdetE[
i1]);
253 std::cout <<
"newECALIdNS::With Added cells along E/W results a set of " << (vdets.size() - dets.size())
254 <<
" new cells" << std::endl;
260 unsigned int last0 = vdets.size();
261 std::vector<DetId> vdetnew;
262 std::vector<CaloDirection> dirnew;
264 std::vector<DetId> vdetn(1);
265 std::vector<CaloDirection> dirn(1);
266 std::vector<CaloDirection> dirnE(1,
EAST), dirnW(1,
WEST);
268 for (
unsigned int i1 =
last;
i1 < dets.size();
i1++) {
269 std::vector<DetId>
cells;
271 dets[
i1],
dir[
i1], barrelTopo, endcapTopo, barrelGeom, endcapGeom,
cells,
flag,
debug, ignoreTransition);
275 vdetnew.push_back(vdetn[0]);
278 if (dirn[0] ==
NORTH)
283 dirnew.push_back(dirn[0]);
285 vdetn, 0,
ieta, dirnE, barrelTopo, endcapTopo, barrelGeom, endcapGeom,
debug, ignoreTransition);
287 vdetn, 0,
ieta, dirnW, barrelTopo, endcapTopo, barrelGeom, endcapGeom,
debug, ignoreTransition);
288 for (
unsigned int i2 = 0;
i2 < vdetW.size();
i2++) {
289 if (
std::count(vdets.begin(), vdets.end(), vdetW[
i2]) == 0 &&
290 std::count(vdetnew.begin(), vdetnew.end(), vdetW[
i2]) == 0) {
291 vdets.push_back(vdetW[
i2]);
292 dirs.push_back(dirn[0]);
295 for (
unsigned int i2 = 0;
i2 < vdetE.size();
i2++) {
296 if (
std::count(vdets.begin(), vdets.end(), vdetE[
i2]) == 0 &&
297 std::count(vdetnew.begin(), vdetnew.end(), vdetE[
i2]) == 0) {
298 vdets.push_back(vdetE[
i2]);
299 dirs.push_back(dirn[0]);
307 for (
unsigned int i2 = 0;
i2 < vdetnew.size();
i2++) {
308 if (
std::count(vdets.begin(), vdets.end(), vdetnew[
i2]) == 0) {
309 vdets.push_back(vdetnew[
i2]);
310 dirs.push_back(dirnew[
i2]);
315 std::cout <<
"newECALIdNS::Addition results a set of " << (vdets.size() - last0) <<
" new cells (last "
316 << last0 <<
", iphi " <<
iphi <<
")" << std::endl;
326 vdets,
last,
ieta,
iphi,
dirs, barrelTopo, endcapTopo, barrelGeom, endcapGeom,
debug, ignoreTransition);
330 std::cout <<
"newECALIdNS::Final list consists of " << vdets.size() <<
" cells" << std::endl;
340 std::vector<int>& ietaE,
341 std::vector<int>& ietaW,
342 std::vector<int>& iphiN,
343 std::vector<int>& iphiS,
344 std::vector<CaloDirection>&
dir,
350 bool ignoreTransition) {
353 std::cout <<
"newECALIdNS::Add columns of cells for " << (dets.size() -
last) <<
" cells (last) " <<
last
355 for (
unsigned int i1 =
last;
i1 < dets.size();
i1++) {
357 std::cout <<
" along " <<
dir[
i1] <<
" # " << iphiN[
i1] <<
"|" << iphiS[
i1] << std::endl;
361 std::vector<DetId> vdets;
362 std::vector<CaloDirection>
dirs;
363 std::vector<int> jetaE, jetaW, jphiN, jphiS;
364 vdets.insert(vdets.end(), dets.begin(), dets.end());
366 jetaE.insert(jetaE.end(), ietaE.begin(), ietaE.end());
367 jetaW.insert(jetaW.end(), ietaW.begin(), ietaW.end());
368 jphiN.insert(jphiN.end(), iphiN.begin(), iphiN.end());
369 jphiS.insert(jphiS.end(), iphiS.begin(), iphiS.end());
370 std::vector<DetId> vdetE, vdetW;
372 unsigned int ndet = vdets.size();
373 std::vector<CaloDirection> dirE(ndet,
EAST), dirW(ndet,
WEST);
375 dets,
last, ietaE, ietaW, dirE, barrelTopo, endcapTopo, barrelGeom, endcapGeom,
debug, ignoreTransition);
377 dets,
last, ietaE, ietaW, dirW, barrelTopo, endcapTopo, barrelGeom, endcapGeom,
debug, ignoreTransition);
378 for (
unsigned int i1 = 0;
i1 < vdetW.size();
i1++) {
379 if (
std::count(vdets.begin(), vdets.end(), vdetW[
i1]) == 0) {
380 vdets.push_back(vdetW[
i1]);
384 jphiN.push_back(iphiN[0]);
385 jphiS.push_back(iphiS[0]);
388 for (
unsigned int i1 = 0;
i1 < vdetE.size();
i1++) {
389 if (
std::count(vdets.begin(), vdets.end(), vdetE[
i1]) == 0) {
390 vdets.push_back(vdetE[
i1]);
394 jphiN.push_back(iphiN[0]);
395 jphiS.push_back(iphiS[0]);
400 std::cout <<
"newECALIdNS::With Added cells along E/W results a set of " << (vdets.size() - dets.size())
401 <<
" new cells" << std::endl;
407 unsigned int last0 = vdets.size();
408 std::vector<DetId> vdetnew;
409 std::vector<CaloDirection> dirnew;
410 std::vector<int> kphiN, kphiS, ketaE, ketaW;
412 for (
unsigned int i1 =
last;
i1 < dets.size();
i1++) {
417 std::vector<DetId> vdetn(1);
418 std::vector<CaloDirection> dirn(1);
419 std::vector<CaloDirection> dirnE(1,
EAST), dirnW(1,
WEST);
421 std::vector<DetId>
cells;
423 dets[
i1],
dir[
i1], barrelTopo, endcapTopo, barrelGeom, endcapGeom,
cells,
flag,
debug, ignoreTransition);
433 int kfiN = iphiN[
i1];
434 int kfiS = iphiS[
i1];
436 vdetnew.push_back(vdetn[0]);
446 if (dirn[0] ==
NORTH)
451 dirnew.push_back(dirn[0]);
452 kphiN.push_back(kfiN);
453 ketaE.push_back(ietaE[
i1]);
454 kphiS.push_back(kfiS);
455 ketaW.push_back(ietaW[
i1]);
456 std::vector<int> ietE(1, ietaE[
i1]), ietW(1, ietaW[
i1]);
458 vdetn, 0, ietE, ietW, dirnE, barrelTopo, endcapTopo, barrelGeom, endcapGeom,
debug, ignoreTransition);
460 vdetn, 0, ietE, ietW, dirnW, barrelTopo, endcapTopo, barrelGeom, endcapGeom,
debug, ignoreTransition);
461 for (
unsigned int i2 = 0;
i2 < vdetW.size();
i2++) {
462 if (
std::count(vdets.begin(), vdets.end(), vdetW[
i2]) == 0 &&
463 std::count(vdetnew.begin(), vdetnew.end(), vdetW[
i2]) == 0) {
464 vdets.push_back(vdetW[
i2]);
465 dirs.push_back(dirn[0]);
467 jphiN.push_back(kfiN);
469 jphiS.push_back(kfiS);
472 for (
unsigned int i2 = 0;
i2 < vdetE.size();
i2++) {
473 if (
std::count(vdets.begin(), vdets.end(), vdetE[
i2]) == 0 &&
474 std::count(vdetnew.begin(), vdetnew.end(), vdetE[
i2]) == 0) {
475 vdets.push_back(vdetE[
i2]);
476 dirs.push_back(dirn[0]);
478 jphiN.push_back(kfiN);
480 jphiS.push_back(kfiS);
488 for (
unsigned int i2 = 0;
i2 < vdetnew.size();
i2++) {
489 if (
std::count(vdets.begin(), vdets.end(), vdetnew[
i2]) == 0) {
490 vdets.push_back(vdetnew[
i2]);
491 dirs.push_back(dirnew[
i2]);
492 jetaE.push_back(ketaE[
i2]);
493 jetaW.push_back(ketaW[
i2]);
494 jphiN.push_back(kphiN[
i2]);
495 jphiS.push_back(kphiS[
i2]);
500 std::cout <<
"newECALIdNS::Addition results a set of " << (vdets.size() - last0) <<
" new cells (last " << last0
501 <<
", iphi " << kphi <<
")" << std::endl;
502 for (
unsigned int i1 = last0;
i1 < vdets.size();
i1++) {
504 std::cout <<
" along " <<
dirs[
i1] <<
" iphi " << jphiN[
i1] <<
"|" << jphiS[
i1] <<
" ieta " << jetaE[
i1] <<
"|"
505 << jetaW[
i1] << std::endl;
529 std::cout <<
"newECALIdNS::Final list consists of " << vdets.size() <<
" cells" << std::endl;
540 std::vector<CaloDirection>&
dir,
546 bool ignoreTransition) {
549 std::cout <<
"newECALIdEW::Add " <<
ieta <<
" rows of cells for " <<
last <<
":" << dets.size() <<
":"
550 << (dets.size() -
last) <<
" cells" << std::endl;
554 std::vector<DetId> vdets;
556 std::vector<CaloDirection>
dirs;
558 vdets.insert(vdets.end(), dets.begin(), dets.end());
562 for (
unsigned int i1 =
last;
i1 < dets.size();
i1++) {
564 std::vector<DetId>
cells;
566 dets[
i1],
dir[
i1], barrelTopo, endcapTopo, barrelGeom, endcapGeom,
cells,
flag,
debug, ignoreTransition);
576 vdets.push_back(
cells[0]);
577 dirs.push_back(dirn);
586 std::cout <<
"newECALIdEW::Addition results a set of " << (vdets.size() - dets.size()) <<
" new cells"
594 vdets,
last,
ieta,
dirs, barrelTopo, endcapTopo, barrelGeom, endcapGeom,
debug, ignoreTransition);
598 std::cout <<
"newECALIdEW::Final list (EW) consists of " << vdets.size() <<
" cells" << std::endl;
608 std::vector<int>& ietaE,
609 std::vector<int>& ietaW,
610 std::vector<CaloDirection>&
dir,
616 bool ignoreTransition) {
619 std::cout <<
"newECALIdEW::Add " << ietaE[0] <<
"|" << ietaW[0] <<
" rows of cells for " << (dets.size() -
last)
620 <<
" cells (last " <<
last <<
")" << std::endl;
624 std::vector<DetId> vdets;
625 vdets.insert(vdets.end(), dets.begin(), dets.end());
626 std::vector<CaloDirection>
dirs;
628 std::vector<int> jetaE, jetaW;
629 jetaE.insert(jetaE.end(), ietaE.begin(), ietaE.end());
630 jetaW.insert(jetaW.end(), ietaW.begin(), ietaW.end());
632 for (
unsigned int i1 =
last;
i1 < dets.size();
i1++) {
638 std::vector<DetId>
cells;
640 dets[
i1],
dir[
i1], barrelTopo, endcapTopo, barrelGeom, endcapGeom,
cells,
flag,
debug, ignoreTransition);
650 vdets.push_back(
cells[0]);
652 int ketaE = ietaE[
i1];
653 int ketaW = ietaW[
i1];
667 dirs.push_back(dirn);
668 jetaE.push_back(ketaE);
669 jetaW.push_back(ketaW);
677 std::cout <<
"newECALIdEW::Addition results a set of " << (vdets.size() - dets.size()) <<
" new cells (last "
678 << dets.size() <<
", ieta " << keta <<
")" << std::endl;
685 vdets,
last, jetaE, jetaW,
dirs, barrelTopo, endcapTopo, barrelGeom, endcapGeom,
debug, ignoreTransition);
689 std::cout <<
"newECALIdEW::Final list (EW) consists of " << vdets.size() <<
" cells" << std::endl;
703 std::vector<DetId>&
cells,
710 bool ignoreTransition) {
717 if (!neighbours.empty() && !neighbours[0].null()) {
718 cells.push_back(neighbours[0]);
719 cell = neighbours[0];
722 const int ietaAbs(detId.
ietaAbs());
727 cell = *(ol.begin());
729 if (!neighbours.empty() && !neighbours[0].null())
734 cells.push_back(*iptr);
740 if (!neighbours.empty() && !neighbours[0].null()) {
741 cells.push_back(neighbours[0]);
742 cell = neighbours[0];
748 if (
iphi != 0 && (!ignoreTransition)) {
752 cell = *(ol.begin());
754 if (!neighbours.empty() && !neighbours[0].null())
759 cells.push_back(*iptr);
765 std::cout <<
"simpleMove:: Move DetId 0x" << std::hex << det() <<
std::dec <<
" along " <<
dir <<
" to get 0x"
766 << std::hex << cell() <<
std::dec <<
" with flag " <<
ok <<
" # " <<
cells.size();
775 std::vector<DetId>& dets,
782 std::vector<DetId>&
cells,
793 std::cout <<
"extraIds::Cell " <<
id <<
" rows " << ietaW <<
"|" << ietaE <<
" columns " << iphiS <<
"|"
794 << iphiN << std::endl;
796 int etaC =
id.ietaAbs();
797 int phiC =
id.iphi();
798 int zsid =
id.zside();
799 for (
int eta = -ietaW;
eta <= ietaE; ++
eta) {
800 for (
int phi = -iphiS; phi <= iphiN; ++phi) {
801 int iphi = phiC + phi;
806 int ieta = zsid * (etaC +
eta);
821 std::cout <<
"extraIds::Cell " <<
id <<
" rows " << ietaW <<
"|" << ietaE <<
" columns " << iphiS <<
"|"
822 << iphiN << std::endl;
826 int zsid =
id.zside();
827 for (
int kx = -ietaW; kx <= ietaE; ++kx) {
828 for (
int ky = -iphiS; ky <= iphiN; ++ky) {
845 std::cout <<
"extraIds:: finds " <<
cells.size() <<
" new cells" << std::endl;