1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
|
// -*- Mode: C++; c-basic-offset: 8; -*-
#include "Geometry/EcalMapping/interface/EcalElectronicsMapping.h"
#include "DataFormats/EcalDetId/interface/EEDetId.h"
#include "DataFormats/EcalDetId/interface/EBDetId.h"
#include "DataFormats/EcalDetId/interface/EcalTrigTowerDetId.h"
#include "DataFormats/EcalDetId/interface/EcalElectronicsId.h"
#include "DataFormats/EcalDetId/interface/EcalTriggerElectronicsId.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include "FWCore/Utilities/interface/Exception.h"
#include <cassert>
#include <sstream>
using boost::multi_index_container;
using namespace boost::multi_index;
// -----------------------------------------------------------------------
//
// -- Conventions :
//
// DCCid and TCCid numbering : cf slides of Ph. Gras :
// in EE- : DCCid between 1 and 8.
// DCCid number 1 covers the range -30 deg < phi < 10 deg.
// in EB- : DCCid between 10 and 27.
// DCCid number 10 covers the range -10 deg < phi < 10 deg.
// in EB+: DCCid between 28 and 45.
// DCCid number 28 covers the range -10 deg < phi < 10 deg.
// in EE+: DCCid between 46 and 54;
// DCCid number 46 covers the range -30 deg < phi < 10 deg.
//
// SMid : 1-18 correspond to EB+ (SMid 1 corresponds to DCC 28)
// 19-36 correspond to EB-
//
// ------------------------------------------------------------------------
EcalElectronicsMapping::EcalElectronicsMapping() {
// Fill the map (Barrel) for the Laser Monitoring readout numbers :
// Each DCC actually corresponds to 2 LMs, ilm and ilm + 1
int ilm = MIN_LM_EBM;
for (int dcc = MIN_DCCID_EBM; dcc <= MAX_DCCID_EBM; dcc++) {
LaserMonitoringMap_EB[dcc] = ilm;
ilm += 2;
}
ilm = MIN_LM_EBP;
for (int dcc = MIN_DCCID_EBP; dcc <= MAX_DCCID_EBP; dcc++) {
LaserMonitoringMap_EB[dcc] = ilm;
ilm += 2;
}
// Fill the map (EndCap) for the Laser Monitoring readout numbers :
// Each DCC corresponds to onr LM, but DCC 8 (LM 80 and 81) and DCC 53 (LM 90 and 91)
ilm = MIN_LM_EEM;
for (int dcc = MIN_DCCID_EEM; dcc <= MAX_DCCID_EEM; dcc++) {
LaserMonitoringMap_EE[dcc] = ilm;
ilm += 1;
if (dcc == 8)
ilm += 1;
}
ilm = MIN_LM_EEP;
for (int dcc = MIN_DCCID_EEP; dcc <= MAX_DCCID_EEP; dcc++) {
LaserMonitoringMap_EE[dcc] = ilm;
ilm += 1;
if (dcc == 53)
ilm += 1;
}
}
int EcalElectronicsMapping::DCCid(const EBDetId& id) const
// SM id, between 1 (phi = -10 deg) and 18 in EB+
// between 19 (phi = -10 deg) and 27 in EB-.
// returns DCCid, currently between 10 and 27 (EB-), 28 and 45 (EB+).
// For the EE case, use getElectronicsId.
{
int dcc = id.ism();
if (id.zside() < 0) {
dcc += DCCID_PHI0_EBM - 19;
} else {
dcc += DCCID_PHI0_EBP - 1;
}
return dcc;
}
int EcalElectronicsMapping::TCCid(const EBDetId& id) const
// SM id, between 1 (phi = -10 deg) and 18 in EB+
// between 19 (phi = -10 deg) and 27 in EB-.
// returns TCCid, currently between 37 and 54 (EB-), 55 and 72 (EB+).
// For the EE case, use getEcalTriggerElectronicsId.
{
int tcc = id.ism();
if (id.zside() < 0) {
tcc += TCCID_PHI0_EBM - 19;
} else {
tcc += TCCID_PHI0_EBP - 1;
}
return tcc;
}
int EcalElectronicsMapping::iTT(const EcalTrigTowerDetId& id) const
// returns the index of a Trigger Tower within its TCC.
// This is between 1 and 68 for the Barrel, and between
// 1 and 32 to 34 (t.b.c.) for the EndCap.
{
if (id.subDet() == EcalBarrel) {
int ie = id.ietaAbs() - 1;
int ip;
int phi = id.iphi();
phi += 2;
if (phi > 72)
phi = phi - 72;
if (id.zside() < 0) {
ip = ((phi - 1) % kEBTowersInPhi) + 1;
} else {
ip = kEBTowersInPhi - ((phi - 1) % kEBTowersInPhi);
}
return (ie * kEBTowersInPhi) + ip;
} else if (id.subDet() == EcalEndcap) {
int ie = id.ietaAbs();
bool inner = (ie >= iEEEtaMinInner);
if (inner) {
ie = ie - iEEEtaMinInner;
ie = ie % kEETowersInEtaPerInnerTCC;
} else {
ie = ie - iEEEtaMinOuter;
ie = ie % kEETowersInEtaPerOuterTCC;
}
int ip = id.iphi();
ip = (ip + 1) % (kEETowersInPhiPerQuadrant * 4);
// now iphi between 0 and 71,
// with iphi=0,1,2,3 in 1st Phi sector
ip = ip % kEETowersInPhiPerTCC;
int itt = kEETowersInPhiPerTCC * ie + ip + 1;
return itt;
} else {
throw cms::Exception("InvalidDetId") << " Wrong EcalTrigTowerDetId in EcalElectronicsMapping::iTT. ";
return 0;
}
}
int EcalElectronicsMapping::TCCid(const EcalTrigTowerDetId& id) const {
if (id.subDet() == EcalBarrel) {
int phi = id.iphi() + 2;
if (phi > 72)
phi = phi - 72;
int tcc = (phi - 1) / kEBTowersInPhi + 1;
if (id.zside() < 0)
tcc += 18; // now id is the SMid
if (id.zside() < 0) {
tcc += TCCID_PHI0_EBM - 19;
} else {
tcc += TCCID_PHI0_EBP - 1;
}
return tcc;
}
else if (id.subDet() == EcalEndcap) {
int ie = id.ietaAbs();
bool inner = (ie >= iEEEtaMinInner);
int ip = id.iphi(); // iphi = 1 corresponds to 0 < phi < 5 degrees
ip = (ip + 1) % (kEETowersInPhiPerQuadrant * 4);
// now iphi between 0 and 71,
// with iphi=0,1,2,3 in 1st Phi sector
int Phiindex = ip / 4;
if (inner) {
if (id.ieta() > 0)
Phiindex += TCCID_PHI0_EEP_IN;
else
Phiindex += TCCID_PHI0_EEM_IN;
} else {
if (id.ieta() > 0)
Phiindex += TCCID_PHI0_EEP_OUT;
else
Phiindex += TCCID_PHI0_EEM_OUT;
}
return Phiindex;
} else {
throw cms::Exception("InvalidDetId") << " Wrong EcalTrigTowerDetId in EcalElectronicsMapping::TCCid.";
return 0;
}
}
int EcalElectronicsMapping::DCCid(const EcalTrigTowerDetId& id) const {
// This is needed for digitoraw. For a given Trigger Tower,
// one needs to know to which FED it gets written.
if (id.subDet() == EcalBarrel) {
int phi = id.iphi() + 2;
if (phi > 72)
phi = phi - 72;
int dcc = (phi - 1) / kEBTowersInPhi + 1;
if (id.zside() < 0)
dcc += 18; // now id is the SMid
if (id.zside() < 0) {
dcc += DCCID_PHI0_EBM - 19;
} else {
dcc += DCCID_PHI0_EBP - 1;
}
return dcc;
} else if (id.subDet() == EcalEndcap) { //FIXME : yes I need to improve this part of the code...
int tccid = TCCid(id);
int dcc = 0;
int offset = 0;
if (tccid >= 73) {
tccid = tccid - 72;
offset = 45;
}
if (tccid == 24 || tccid == 25 || tccid == 6 || tccid == 7)
dcc = 4;
if (tccid == 26 || tccid == 27 || tccid == 8 || tccid == 9)
dcc = 5;
if (tccid == 28 || tccid == 29 || tccid == 10 || tccid == 11)
dcc = 6;
if (tccid == 30 || tccid == 31 || tccid == 12 || tccid == 13)
dcc = 7;
if (tccid == 32 || tccid == 33 || tccid == 14 || tccid == 15)
dcc = 8;
if (tccid == 34 || tccid == 35 || tccid == 16 || tccid == 17)
dcc = 9;
if (tccid == 36 || tccid == 19 || tccid == 18 || tccid == 1)
dcc = 1;
if (tccid == 20 || tccid == 21 || tccid == 2 || tccid == 3)
dcc = 2;
if (tccid == 22 || tccid == 23 || tccid == 4 || tccid == 5)
dcc = 3;
dcc += offset;
return dcc;
} else {
throw cms::Exception("InvalidDetId") << " Wrong EcalTrigTowerDetId in EcalElectronicsMapping::DCCid.";
return 0;
}
}
EcalTrigTowerDetId EcalElectronicsMapping::getTrigTowerDetId(int TCCid, int iTT) const {
// needed for unpacking code.
EcalSubdetector sub = subdet(TCCid, TCCMODE);
int zIndex = zside(TCCid, TCCMODE);
if (sub == EcalBarrel) {
int DCCid = 0;
int jtower = iTT - 1;
if (zIndex > 0)
DCCid = TCCid - TCCID_PHI0_EBP + DCCID_PHI0_EBP;
else
DCCid = TCCid - TCCID_PHI0_EBM + DCCID_PHI0_EBM;
int SMid = (zIndex > 0) ? DCCid - 27 : DCCid + 9;
int etaTT = jtower / kTowersInPhi + 1; // between 1 and 17
int phiTT;
if (zIndex > 0)
phiTT = (SMid - 1) * kTowersInPhi + (kTowersInPhi - (jtower % kTowersInPhi)) - 1;
else
phiTT = (SMid - 19) * kTowersInPhi + jtower % kTowersInPhi;
phiTT++;
phiTT = phiTT - 2;
if (phiTT <= 0)
phiTT = 72 + phiTT;
EcalTrigTowerDetId tdetid(zIndex, EcalBarrel, etaTT, phiTT, EcalTrigTowerDetId::SUBDETIJMODE);
return tdetid;
}
else if (sub == EcalEndcap) {
bool EEminus = (zIndex < 0);
bool EEplus = (zIndex > 0);
if ((!EEminus) && (!EEplus))
throw cms::Exception("InvalidDetId") << "EcalElectronicsMapping: Cannot create EcalTrigTowerDetId object. ";
int iz = 0;
int tcc = TCCid;
if (tcc < TCCID_PHI0_EEM_OUT + kTCCinPhi)
iz = -1;
else if (tcc >= TCCID_PHI0_EEP_OUT)
iz = +1;
bool inner = false;
if (iz < 0 && tcc >= TCCID_PHI0_EEM_IN && tcc < TCCID_PHI0_EEM_IN + kTCCinPhi)
inner = true;
if (iz > 0 && tcc >= TCCID_PHI0_EEP_IN && tcc < TCCID_PHI0_EEP_IN + kTCCinPhi)
inner = true;
bool outer = !inner;
int ieta = (iTT - 1) / kEETowersInPhiPerTCC;
int iphi = (iTT - 1) % kEETowersInPhiPerTCC;
if (inner)
ieta += iEEEtaMinInner;
else
ieta += iEEEtaMinOuter;
if (iz < 0)
ieta = -ieta;
int TCC_origin = 0;
if (inner && iz < 0)
TCC_origin = TCCID_PHI0_EEM_IN;
if (outer && iz < 0)
TCC_origin = TCCID_PHI0_EEM_OUT;
if (inner && iz > 0)
TCC_origin = TCCID_PHI0_EEP_IN;
if (outer && iz > 0)
TCC_origin = TCCID_PHI0_EEP_OUT;
tcc = tcc - TCC_origin;
iphi += kEETowersInPhiPerTCC * tcc;
iphi = (iphi - 2 + 4 * kEETowersInPhiPerQuadrant) % (4 * kEETowersInPhiPerQuadrant) + 1;
int tower_i = abs(ieta);
int tower_j = iphi;
EcalTrigTowerDetId tdetid(zIndex, EcalEndcap, tower_i, tower_j, EcalTrigTowerDetId::SUBDETIJMODE);
return tdetid;
} else {
throw cms::Exception("InvalidDetId") << " Wrong indices in EcalElectronicsMapping::getTrigTowerDetId. TCCid = "
<< TCCid << " iTT = " << iTT << ".";
}
}
EcalElectronicsId EcalElectronicsMapping::getElectronicsId(const DetId& id) const {
EcalSubdetector subdet = EcalSubdetector(id.subdetId());
if (subdet == EcalBarrel) {
const EBDetId ebdetid = EBDetId(id);
int dcc = DCCid(ebdetid);
bool EBPlus = (zside(dcc, DCCMODE) > 0);
bool EBMinus = !EBPlus;
EcalTrigTowerDetId trigtower = ebdetid.tower();
// int tower = trigtower.iTT();
int tower = iTT(trigtower);
int ieta = EBDetId(id).ietaAbs();
int iphi = EBDetId(id).iphi();
int strip(0);
int channel(0);
bool RightTower = rightTower(tower);
if (RightTower) {
strip = (ieta - 1) % 5;
if (strip % 2 == 0) {
if (EBMinus)
channel = (iphi - 1) % 5;
if (EBPlus)
channel = 4 - ((iphi - 1) % 5);
} else {
if (EBMinus)
channel = 4 - ((iphi - 1) % 5);
if (EBPlus)
channel = (iphi - 1) % 5;
}
} else {
strip = 4 - ((ieta - 1) % 5);
if (strip % 2 == 0) {
if (EBMinus)
channel = 4 - ((iphi - 1) % 5);
if (EBPlus)
channel = (iphi - 1) % 5;
} else {
if (EBMinus)
channel = (iphi - 1) % 5;
if (EBPlus)
channel = 4 - ((iphi - 1) % 5);
}
}
strip += 1;
channel += 1;
EcalElectronicsId elid = EcalElectronicsId(dcc, tower, strip, channel);
return elid;
} else if (subdet == EcalEndcap) {
EcalElectronicsMap_by_DetId::const_iterator it = get<0>(m_items).find(id);
if (it == get<0>(m_items).end()) {
EcalElectronicsId elid(0);
edm::LogError("EcalElectronicsMapping") << "Ecal mapping was asked non valid id";
return elid;
}
EcalElectronicsId elid = it->elid;
return elid;
} else {
throw cms::Exception("InvalidDetId") << " Wrong DetId in EcalElectronicsMapping::getElectronicsId.";
}
}
EcalTriggerElectronicsId EcalElectronicsMapping::getTriggerElectronicsId(const DetId& id) const {
EcalSubdetector subdet = EcalSubdetector(id.subdetId());
if (subdet == EcalBarrel) {
const EcalElectronicsId& elid = getElectronicsId(id);
EcalTriggerElectronicsId trelid = getTriggerElectronicsId(elid);
return trelid;
} else if (subdet == EcalEndcap) {
EcalElectronicsMap_by_DetId::const_iterator it = get<0>(m_items).find(id);
if (it == get<0>(m_items).end()) {
EcalTriggerElectronicsId trelid(0);
edm::LogError("EcalElectronicsMapping") << "Ecal mapping was asked non valid trig id";
return trelid;
}
EcalTriggerElectronicsId trelid = it->trelid;
return trelid;
} else {
throw cms::Exception("InvalidDetId") << " Wrong DetId in EcalElectronicsMapping::getTriggerElectronicsId.";
}
}
DetId EcalElectronicsMapping::getDetId(const EcalElectronicsId& id) const {
EcalSubdetector subdet = id.subdet();
if (subdet == EcalBarrel) {
int dcc = id.dccId();
int tower = id.towerId();
int strip = id.stripId();
int channel = id.xtalId();
int smid = 0;
int iphi = 0;
bool EBPlus = (id.zside() > 0);
bool EBMinus = !EBPlus;
if (id.zside() < 0) {
smid = dcc + 19 - DCCID_PHI0_EBM;
iphi = (smid - 19) * kCrystalsInPhi;
iphi += 5 * ((tower - 1) % kTowersInPhi);
} else {
smid = dcc + 1 - DCCID_PHI0_EBP;
iphi = (smid - 1) * kCrystalsInPhi;
iphi += 5 * (kTowersInPhi - ((tower - 1) % kTowersInPhi) - 1);
}
bool RightTower = rightTower(tower);
int ieta = 5 * ((tower - 1) / kTowersInPhi) + 1;
if (RightTower) {
ieta += (strip - 1);
if (strip % 2 == 1) {
if (EBMinus)
iphi += (channel - 1) + 1;
if (EBPlus)
iphi += (4 - (channel - 1)) + 1;
} else {
if (EBMinus)
iphi += (4 - (channel - 1)) + 1;
if (EBPlus)
iphi += (channel - 1) + 1;
}
} else {
ieta += 4 - (strip - 1);
if (strip % 2 == 1) {
if (EBMinus)
iphi += (4 - (channel - 1)) + 1;
if (EBPlus)
iphi += (channel - 1) + 1;
} else {
if (EBMinus)
iphi += (channel - 1) + 1;
if (EBPlus)
iphi += (4 - (channel - 1)) + 1;
}
}
if (id.zside() < 0)
ieta = -ieta;
EBDetId e(ieta, iphi, EBDetId::ETAPHIMODE);
return e;
}
else if (subdet == EcalEndcap) {
EcalElectronicsMap_by_ElectronicsId::const_iterator it = get<1>(m_items).find(id);
if (it == (get<1>(m_items).end())) {
DetId cell(0);
edm::LogError("EcalElectronicsMapping") << "Ecal mapping was asked non DetId";
return cell;
}
DetId cell = it->cell;
return cell;
} else
throw cms::Exception("InvalidDetId") << "Wrong EcalElectronicsId in EcalElectronicsMapping::getDetId.";
}
EcalTriggerElectronicsId EcalElectronicsMapping::getTriggerElectronicsId(const EcalElectronicsId& id) const {
EcalSubdetector subdet = id.subdet();
if (subdet == EcalBarrel) {
int strip = id.stripId();
int xtal = id.xtalId();
int tower = id.towerId();
int tcc = id.dccId();
if (id.zside() < 0) {
tcc += TCCID_PHI0_EBM - DCCID_PHI0_EBM;
} else {
tcc += TCCID_PHI0_EBP - DCCID_PHI0_EBP;
}
EcalTriggerElectronicsId trelid(tcc, tower, strip, xtal);
return trelid;
} else if (subdet == EcalEndcap) {
EcalElectronicsMap_by_ElectronicsId::const_iterator it = get<1>(m_items).find(id);
if (it == get<1>(m_items).end()) {
EcalTriggerElectronicsId trelid(0);
edm::LogError("EcalElectronicsMapping") << "Ecal mapping was asked non valid id";
return trelid;
}
EcalTriggerElectronicsId trelid = it->trelid;
return trelid;
} else
throw cms::Exception("InvalidDetId")
<< "Wrong EcalElectronicsId in EcalElectronicsMapping::getTriggerElectronicsId.";
}
DetId EcalElectronicsMapping::getDetId(const EcalTriggerElectronicsId& id) const {
EcalSubdetector subdet = id.subdet();
if (subdet == EcalBarrel) {
const EcalElectronicsId& elid = getElectronicsId(id);
DetId cell = getDetId(elid);
return cell;
} else if (subdet == EcalEndcap) {
EcalElectronicsMap_by_TriggerElectronicsId::const_iterator it = get<2>(m_items).find(id);
if (it == get<2>(m_items).end()) {
DetId cell(0);
edm::LogError("EcalElectronicsMapping") << "Ecal mapping was asked non valid DetId";
return cell;
}
DetId cell = it->cell;
return cell;
} else
throw cms::Exception("InvalidDetId") << "Wrong EcalTriggerElectronicsId in EcalElectronicsMapping::getDetId.";
}
EcalElectronicsId EcalElectronicsMapping::getElectronicsId(const EcalTriggerElectronicsId& id) const {
EcalSubdetector subdet = id.subdet();
if (subdet == EcalBarrel) {
int strip = id.pseudoStripId();
int xtal = id.channelId();
int tower = id.ttId();
int dcc = id.tccId();
if (id.zside() < 0) {
dcc -= TCCID_PHI0_EBM - DCCID_PHI0_EBM;
} else {
dcc -= TCCID_PHI0_EBP - DCCID_PHI0_EBP;
}
EcalElectronicsId elid(dcc, tower, strip, xtal);
return elid;
} else if (subdet == EcalEndcap) {
EcalElectronicsMap_by_TriggerElectronicsId::const_iterator it = get<2>(m_items).find(id);
if (it == get<2>(m_items).end()) {
EcalElectronicsId elid(0);
edm::LogError("EcalElectronicsMapping") << "Ecal mapping was asked non valid id";
return elid;
}
EcalElectronicsId elid = it->elid;
return elid;
} else
throw cms::Exception("InvalidDetId")
<< "Wrong EcalTriggerElectronicsId in EcalElectronicsMapping::getElectronicsId.";
}
std::vector<DetId> EcalElectronicsMapping::dccConstituents(int dccId) const {
EcalSubdetector sub = subdet(dccId, DCCMODE);
std::vector<DetId> items;
if (sub == EcalBarrel) {
for (int tower = 1; tower <= kEBTowersPerSM; tower++) {
std::vector<DetId> xtals = dccTowerConstituents(dccId, tower);
int size = xtals.size();
for (int i = 0; i < size; i++) {
DetId detid = xtals[i];
items.emplace_back(detid);
}
}
return items;
} else if (sub == EcalEndcap) {
EcalElectronicsMap_by_DccId::const_iterator lb, ub;
boost::tuples::tie(lb, ub) = get<3>(m_items).equal_range(dccId);
while (lb != ub) {
DetId cell = lb->cell;
items.emplace_back(cell);
++lb;
}
return items;
} else
throw cms::Exception("InvalidDetId") << "Wrong dccId = " << dccId
<< " in EcalElectronicsMapping::dccConstituents. ";
}
std::vector<DetId> EcalElectronicsMapping::dccTowerConstituents(int dccId, int tower) const {
EcalSubdetector sub = subdet(dccId, DCCMODE);
std::vector<DetId> items;
if (sub == EcalBarrel) {
int iz = zside(dccId, DCCMODE);
int smid = 0;
int iphi = 0;
if (iz < 0) {
smid = dccId + 19 - DCCID_PHI0_EBM;
iphi = (smid - 19) * kCrystalsInPhi;
iphi += 5 * ((tower - 1) % kTowersInPhi);
} else {
smid = dccId + 1 - DCCID_PHI0_EBP;
iphi = (smid - 1) * kCrystalsInPhi;
iphi += 5 * (kTowersInPhi - ((tower - 1) % kTowersInPhi) - 1);
}
int ieta = 5 * ((tower - 1) / kTowersInPhi) + 1;
for (int ip = 1; ip <= 5; ip++) {
for (int ie = 0; ie <= 4; ie++) {
int ieta_xtal = ieta + ie;
int iphi_xtal = iphi + ip;
if (iz < 0)
ieta_xtal = -ieta_xtal;
EBDetId ebdetid(ieta_xtal, iphi_xtal, EBDetId::ETAPHIMODE);
items.emplace_back(ebdetid);
}
}
return items;
}
else if (sub == EcalEndcap) {
EcalElectronicsMap_by_DccId_and_TowerId::const_iterator lb, ub;
boost::tuples::tie(lb, ub) = get<4>(m_items).equal_range(boost::make_tuple(int(dccId), int(tower)));
while (lb != ub) {
DetId cell = lb->cell;
items.emplace_back(cell);
++lb;
}
return items;
} else
throw cms::Exception("InvalidDetId") << "Wrong dccId = " << dccId << " tower = " << tower
<< " in EcalElectronicsMapping::dccTowerConstituents.";
}
std::vector<DetId> EcalElectronicsMapping::stripConstituents(int dccId, int tower, int strip) const {
EcalSubdetector sub = subdet(dccId, DCCMODE);
std::vector<DetId> items;
if (sub == EcalBarrel) {
int iz = zside(dccId, DCCMODE);
bool RightTower = rightTower(tower);
int smid = 0;
int iphi = 0;
if (iz < 0) {
smid = dccId + 19 - DCCID_PHI0_EBM;
iphi = (smid - 19) * kCrystalsInPhi;
iphi += 5 * ((tower - 1) % kTowersInPhi);
} else {
smid = dccId + 1 - DCCID_PHI0_EBP;
iphi = (smid - 1) * kCrystalsInPhi;
iphi += 5 * (kTowersInPhi - ((tower - 1) % kTowersInPhi) - 1);
}
int ieta = 5 * ((tower - 1) / kTowersInPhi) + 1;
if (RightTower) {
ieta += (strip - 1);
} else {
ieta += 4 - (strip - 1);
}
for (int ip = 1; ip <= 5; ip++) {
int ieta_xtal = ieta;
int iphi_xtal = iphi + ip;
if (iz < 0)
ieta_xtal = -ieta_xtal;
EBDetId ebdetid(ieta_xtal, iphi_xtal, EBDetId::ETAPHIMODE);
items.emplace_back(ebdetid);
}
return items;
} else {
EcalElectronicsMap_by_DccId_TowerId_and_StripId::const_iterator lb, ub;
boost::tuples::tie(lb, ub) = get<5>(m_items).equal_range(boost::make_tuple(int(dccId), int(tower), int(strip)));
while (lb != ub) {
DetId cell = lb->cell;
items.emplace_back(cell);
++lb;
}
return items;
}
}
std::vector<DetId> EcalElectronicsMapping::tccConstituents(int tccId) const {
EcalSubdetector sub = subdet(tccId, TCCMODE);
std::vector<DetId> items;
if (sub == EcalBarrel) {
int iz = zside(tccId, TCCMODE);
int dccId = tccId;
if (iz > 0)
dccId = dccId - TCCID_PHI0_EBP + DCCID_PHI0_EBP;
else
dccId = dccId - TCCID_PHI0_EBM + DCCID_PHI0_EBM;
items = dccConstituents(dccId);
return items;
} else {
EcalElectronicsMap_by_TccId::const_iterator lb, ub;
boost::tuples::tie(lb, ub) = get<6>(m_items).equal_range(tccId);
while (lb != ub) {
DetId cell = lb->cell;
items.emplace_back(cell);
++lb;
}
return items;
}
}
std::vector<DetId> EcalElectronicsMapping::ttConstituents(int tccId, int tt) const {
EcalSubdetector sub = subdet(tccId, TCCMODE);
std::vector<DetId> items;
if (sub == EcalBarrel) {
int iz = zside(tccId, TCCMODE);
int dccId = tccId;
if (iz > 0)
dccId = dccId - TCCID_PHI0_EBP + DCCID_PHI0_EBP;
else
dccId = dccId - TCCID_PHI0_EBM + DCCID_PHI0_EBM;
items = dccTowerConstituents(dccId, tt);
return items;
} else {
EcalElectronicsMap_by_TccId_and_TtId::const_iterator lb, ub;
boost::tuples::tie(lb, ub) = get<7>(m_items).equal_range(boost::make_tuple(int(tccId), int(tt)));
while (lb != ub) {
DetId cell = lb->cell;
items.emplace_back(cell);
++lb;
}
return items;
}
}
std::vector<DetId> EcalElectronicsMapping::pseudoStripConstituents(int tccId, int tt, int pseudostrip) const {
EcalSubdetector sub = subdet(tccId, TCCMODE);
std::vector<DetId> items;
if (sub == EcalBarrel) {
int iz = zside(tccId, TCCMODE);
int dccId = tccId;
if (iz > 0)
dccId = dccId - TCCID_PHI0_EBP + DCCID_PHI0_EBP;
else
dccId = dccId - TCCID_PHI0_EBM + DCCID_PHI0_EBM;
items = stripConstituents(dccId, tt, pseudostrip);
return items;
} else {
EcalElectronicsMap_by_TccId_TtId_and_PseudostripId::const_iterator lb, ub;
boost::tuples::tie(lb, ub) = get<8>(m_items).equal_range(boost::make_tuple(int(tccId), int(tt), int(pseudostrip)));
while (lb != ub) {
DetId cell = lb->cell;
items.emplace_back(cell);
++lb;
}
return items;
}
}
void EcalElectronicsMapping::assign(const DetId& cell,
const EcalElectronicsId& elid,
const EcalTriggerElectronicsId& tower) {
m_items.insert(MapItem(cell, elid, tower));
}
std::pair<int, int> EcalElectronicsMapping::getDCCandSC(EcalScDetId id) const {
// pair.first = DCC id
// pair.second = DCC_channel
// For digi2raw, read the SRflags and write the SR block :
// need to find out, for an EcalScDetId, which is the DCC and the DCC_channel
std::pair<int, int> ind;
EEDetId dum;
int ix = id.ix();
int iy = id.iy();
int zside = id.zside();
ix = (ix - 1) * 5 + 1;
iy = (iy - 1) * 5 + 1;
ix = 5 * (ix / 5) + 1;
iy = 5 * (iy / 5) + 1;
int ix_c = ix;
int iy_c = iy;
if (!dum.validDetId(ix_c, iy_c, zside)) {
ix_c = ix + 4;
iy_c = iy;
if (!dum.validDetId(ix_c, iy_c, zside)) {
ix_c = ix + 4;
iy_c = iy + 4;
if (!dum.validDetId(ix_c, iy_c, zside)) {
ix_c = ix;
iy_c = iy + 4;
}
}
}
EEDetId eedetid(ix_c, iy_c, zside, EEDetId::XYMODE);
EcalElectronicsId elid = getElectronicsId(eedetid);
int Dccid = elid.dccId();
int DCC_Channel = elid.towerId();
ind.first = Dccid;
ind.second = DCC_Channel;
return ind;
}
std::vector<EcalScDetId> EcalElectronicsMapping::getEcalScDetId(int DCCid,
int DCC_Channel,
bool ignoreSingleCrystal) const {
//Debug output switch:
const bool debug = false;
// For unpacking of ST flags.
//result: SCs readout by the DCC channel DCC_channel of DCC DCCid.
//Vector of 1 or 2 elements: most of the time there is only
//one SC read-out by the DCC channel, but for some channels
//there are 2 partial SCs which were grouped.
std::vector<EcalScDetId> scDetIds;
//There are 4 SCs in each endcap whose one crystal is read out
//by a different DCC channel than the others.
//Number of crystals of the SC read out by the DCC channel:
std::vector<int> nReadoutXtals;
std::vector<DetId> xtals = dccTowerConstituents(DCCid, DCC_Channel);
if (debug) {
std::ostringstream st1;
st1 << __FILE__ << ":" << __LINE__ << ": " << xtals.size() << " crystals read out by channel " << DCC_Channel
<< " of DCC " << DCCid << ": ";
for (auto xtal : xtals) {
st1 << EEDetId(xtal) << " ";
}
edm::LogVerbatim("EcalMapping") << st1.str() << "\n";
}
if (xtals.empty())
throw cms::Exception("InvalidDetId") << "EcalElectronicsMapping : can not create EcalScDetId for DCC " << DCCid
<< " and DCC_Channel " << DCC_Channel << ".";
for (auto xtal : xtals) {
EEDetId eedetid = xtal;
int ix = eedetid.ix();
int iy = eedetid.iy();
int iz = eedetid.zside();
int ix_SC = (ix - 1) / 5 + 1;
int iy_SC = (iy - 1) / 5 + 1;
//Supercrystal (SC) the crystal belongs to:
EcalScDetId scdetid(ix_SC, iy_SC, iz);
size_t iSc = 0;
//look if the SC was already included:
while (iSc < scDetIds.size() && scDetIds[iSc] != scdetid)
++iSc;
if (iSc == scDetIds.size()) { //SC not yet included
scDetIds.emplace_back(scdetid);
nReadoutXtals.emplace_back(1); //crystal counter of the added SC
} else { //SC already included
++nReadoutXtals[iSc]; // counting crystals in the SC
}
}
if (ignoreSingleCrystal) {
//For simplification, SC read out by two different DCC channels
//will be associated to the DCC channel reading most of the crystals,
//the other DCC channel which read only one crystal is discarded.
//Discards SC with only one crystal read out by the considered,
//DCC channel:
assert(scDetIds.size() == nReadoutXtals.size());
for (size_t iSc = 0; iSc < scDetIds.size(); /*NOOP*/) {
if (nReadoutXtals[iSc] <= 1) {
if (debug)
edm::LogVerbatim("EcalMapping") << "EcalElectronicsMapping::getEcalScDetId: Ignore SC " << scDetIds[iSc]
<< " whose only one channel is read out by "
"the DCC channel (DCC "
<< DCCid << ", ch " << DCC_Channel << ").\n";
scDetIds.erase(scDetIds.begin() + iSc);
nReadoutXtals.erase(nReadoutXtals.begin() + iSc);
} else {
++iSc; //next SC;
}
}
}
return scDetIds;
}
EcalSubdetector EcalElectronicsMapping::subdet(int dcctcc, int mode) const {
if (mode == DCCMODE) {
if ((dcctcc >= MIN_DCCID_EBM && dcctcc <= MAX_DCCID_EBM) || (dcctcc >= MIN_DCCID_EBP && dcctcc <= MAX_DCCID_EBP))
return EcalBarrel;
else
return EcalEndcap;
} else if (mode == TCCMODE) {
if ((dcctcc >= MIN_TCCID_EBM && dcctcc <= MAX_TCCID_EBM) || (dcctcc >= MIN_TCCID_EBP && dcctcc <= MAX_TCCID_EBP))
return EcalBarrel;
else
return EcalEndcap;
} else
throw cms::Exception("InvalidDetId") << " Wrong mode in EcalElectronicsMapping::subdet " << mode << ".";
}
int EcalElectronicsMapping::zside(int dcctcc, int mode) const {
if (mode == DCCMODE) {
if (dcctcc >= MIN_DCCID_EBM && dcctcc <= MAX_DCCID_EBM)
return -1;
if (dcctcc >= MIN_DCCID_EBP && dcctcc <= MAX_DCCID_EBP)
return +1;
if (dcctcc >= MIN_DCCID_EEM && dcctcc <= MAX_DCCID_EEM)
return -1;
if (dcctcc >= MIN_DCCID_EEP && dcctcc <= MAX_DCCID_EEP)
return +1;
} else if (mode == TCCMODE) {
if (dcctcc >= MIN_TCCID_EBM && dcctcc <= MAX_TCCID_EBM)
return -1;
if (dcctcc >= MIN_TCCID_EBP && dcctcc <= MAX_TCCID_EBP)
return +1;
if (dcctcc >= MIN_TCCID_EEM && dcctcc <= MAX_TCCID_EEM)
return -1;
if (dcctcc >= MIN_TCCID_EEP && dcctcc <= MAX_TCCID_EEP)
return +1;
} else {
throw cms::Exception("InvalidDetId") << " Wrong mode in EcalElectronicsMapping::zside " << mode << ".";
}
return 0;
}
bool EcalElectronicsMapping::rightTower(int tower) const {
// for EB, two types of tower (LVRB top/bottom)
if ((tower > 12 && tower < 21) || (tower > 28 && tower < 37) || (tower > 44 && tower < 53) ||
(tower > 60 && tower < 69))
return true;
else
return false;
}
int EcalElectronicsMapping::DCCBoundary(int FED) const {
if (FED >= MIN_DCCID_EEM && FED <= MAX_DCCID_EEM)
return MIN_DCCID_EEM;
if (FED >= MIN_DCCID_EBM && FED <= MAX_DCCID_EBM)
return MIN_DCCID_EBM;
if (FED >= MIN_DCCID_EBP && FED <= MAX_DCCID_EBP)
return MIN_DCCID_EBP;
if (FED >= MIN_DCCID_EEP && FED <= MAX_DCCID_EEP)
return MIN_DCCID_EEP;
return -1;
}
std::vector<int> EcalElectronicsMapping::GetListofFEDs(const RectangularEtaPhiRegion& region) const {
std::vector<int> FEDs;
GetListofFEDs(region, FEDs);
return FEDs;
}
void EcalElectronicsMapping::GetListofFEDs(const RectangularEtaPhiRegion& region, std::vector<int>& FEDs) const {
// for regional unpacking.
// get list of FEDs corresponding to a region in (eta,phi)
// std::vector<int> FEDs;
double radTodeg = 180. / M_PI;
;
bool debug = false;
double etalow = region.etaLow();
double philow = region.phiLow() * radTodeg;
if (debug)
edm::LogVerbatim("EcalMapping") << " etalow philow " << etalow << " " << philow;
int FED_LB = GetFED(etalow, philow); // left, bottom
double phihigh = region.phiHigh() * radTodeg;
if (debug)
edm::LogVerbatim("EcalMapping") << " etalow phihigh " << etalow << " " << phihigh;
int FED_LT = GetFED(etalow, phihigh); // left, top
int DCC_BoundaryL = DCCBoundary(FED_LB);
int deltaL = 18;
if (FED_LB < MIN_DCCID_EBM || FED_LB > MAX_DCCID_EBP)
deltaL = 9;
if (philow < -170 && phihigh > 170) {
FED_LB = DCC_BoundaryL;
FED_LT = DCC_BoundaryL + deltaL - 1;
}
if (debug)
edm::LogVerbatim("EcalMapping") << " FED_LB FED_LT " << FED_LB << " " << FED_LT;
bool dummy = true;
int idx = 0;
while (dummy) {
int iL = (FED_LB - DCC_BoundaryL + idx) % deltaL + DCC_BoundaryL;
FEDs.emplace_back(iL);
if (debug)
edm::LogVerbatim("EcalMapping") << " add fed " << iL;
if (iL == FED_LT)
break;
idx++;
}
double etahigh = region.etaHigh();
int FED_RB = GetFED(etahigh, philow); // right, bottom
if (FED_RB == FED_LB)
return; // FEDs;
int FED_RT = GetFED(etahigh, phihigh); // right, top
if (debug)
edm::LogVerbatim("EcalMapping") << "etahigh philow phihigh " << etahigh << " " << philow << " " << phihigh;
int DCC_BoundaryR = DCCBoundary(FED_RB);
int deltaR = 18;
if (FED_RB < MIN_DCCID_EBM || FED_RB > MAX_DCCID_EBP)
deltaR = 9;
if (philow < -170 && phihigh > 170) {
FED_RB = DCC_BoundaryR;
FED_RT = DCC_BoundaryR + deltaR - 1;
}
if (debug)
edm::LogVerbatim("EcalMapping") << " FED_RB FED_RT " << FED_RB << " " << FED_RT;
idx = 0;
while (dummy) {
int iR = (FED_RB - DCC_BoundaryR + idx) % deltaR + DCC_BoundaryR;
FEDs.emplace_back(iR);
if (debug)
edm::LogVerbatim("EcalMapping") << " add fed " << iR;
if (iR == FED_RT)
break;
idx++;
}
if (FED_LB >= MIN_DCCID_EBM && FED_LB <= MAX_DCCID_EBM && FED_RB >= MIN_DCCID_EEP && FED_RB <= MAX_DCCID_EEP) {
int minR = FED_LB + 18;
int maxR = FED_LT + 18;
int idx = 0;
while (dummy) {
int iR = (minR - MIN_DCCID_EBP + idx) % 18 + MIN_DCCID_EBP;
FEDs.emplace_back(iR);
if (debug)
edm::LogVerbatim("EcalMapping") << " add fed " << iR;
if (iR == maxR)
break;
idx++;
}
return; // FEDs;
}
if (FED_LB >= MIN_DCCID_EEM && FED_LB <= MAX_DCCID_EEM && FED_RB >= MIN_DCCID_EBP && FED_RB <= MAX_DCCID_EBP) {
int minL = FED_RB - 18;
int maxL = FED_RT - 18;
int idx = 0;
while (dummy) {
int iL = (minL - MIN_DCCID_EBM + idx) % 18 + MIN_DCCID_EBM;
FEDs.emplace_back(iL);
if (debug)
edm::LogVerbatim("EcalMapping") << " add fed " << iL;
if (iL == maxL)
break;
idx++;
}
return; // FEDs;
}
if (FED_LB >= MIN_DCCID_EEM && FED_LB <= MAX_DCCID_EEM && FED_RB >= MIN_DCCID_EEP && FED_RB <= MAX_DCCID_EEP) {
int minL = (FED_LB - 1) * 2 + MIN_DCCID_EBM;
if (minL == MIN_DCCID_EBM)
minL = MAX_DCCID_EBM;
else
minL = minL - 1;
int maxL = (FED_LT - 1) * 2 + MIN_DCCID_EBM;
int idx = 0;
while (dummy) {
int iL = (minL - MIN_DCCID_EBM + idx) % 18 + MIN_DCCID_EBM;
FEDs.emplace_back(iL);
if (debug)
edm::LogVerbatim("EcalMapping") << " add fed " << iL;
if (iL == maxL)
break;
idx++;
}
int minR = minL + 18;
int maxR = maxL + 18;
idx = 0;
while (dummy) {
int iR = (minR - MIN_DCCID_EBP + idx) % 18 + MIN_DCCID_EBP;
FEDs.emplace_back(iR);
if (debug)
edm::LogVerbatim("EcalMapping") << " add fed " << iR;
if (iR == maxR)
break;
idx++;
}
}
return; // FEDs;
}
int EcalElectronicsMapping::GetFED(double eta, double phi) const {
// for regional unpacking.
// eta is signed, phi is in degrees.
int DCC_Phi0 = 0;
bool IsBarrel = true;
if (fabs(eta) > 1.479)
IsBarrel = false;
bool Positive = (eta > 0);
if (IsBarrel && Positive)
DCC_Phi0 = DCCID_PHI0_EBP;
if (IsBarrel && (!Positive))
DCC_Phi0 = DCCID_PHI0_EBM;
if ((!IsBarrel) && Positive)
DCC_Phi0 = MIN_DCCID_EEP;
if ((!IsBarrel) && (!Positive))
DCC_Phi0 = MIN_DCCID_EEM;
// phi between 0 and 360 deg :
if (phi < 0)
phi += 360;
if (phi > 360.)
phi = 360.;
if (phi < 0)
phi = 0.;
if (IsBarrel)
phi = phi - 350;
else
phi = phi - 330;
if (phi < 0)
phi += 360;
int iphi = -1;
if (IsBarrel)
iphi = (int)(phi / 20.);
else
iphi = (int)(phi / 40.);
// edm::LogVerbatim("EcalMapping") << " in GetFED : phi iphi DCC0 " << phi << " " << iphi << " " << DCC_Phi0;
int DCC = iphi + DCC_Phi0;
// edm::LogVerbatim("EcalMapping") << " eta phi " << eta << " " << " " << phi << " is in FED " << DCC;
return DCC;
}
int EcalElectronicsMapping::getLMNumber(const DetId& id) const {
// Laser Monitoring readout number.
EcalSubdetector subdet = EcalSubdetector(id.subdetId());
if (subdet == EcalBarrel) {
const EBDetId ebdetid = EBDetId(id);
int dccid = DCCid(ebdetid);
std::map<int, int>::const_iterator it = LaserMonitoringMap_EB.find(dccid);
if (it != LaserMonitoringMap_EB.end()) {
int ilm = it->second;
int iETA = ebdetid.ietaSM();
int iPHI = ebdetid.iphiSM();
if (iPHI > 10 && iETA > 5) {
ilm++;
};
return ilm;
} else
throw cms::Exception("InvalidDCCId") << "Wrong DCCId (EB) in EcalElectronicsMapping::getLMNumber.";
}
else if (subdet == EcalEndcap) {
EcalElectronicsId elid = getElectronicsId(id);
int dccid = elid.dccId();
EEDetId eedetid = EEDetId(id);
std::map<int, int>::const_iterator it = LaserMonitoringMap_EE.find(dccid);
if (it != LaserMonitoringMap_EB.end()) {
int ilm = it->second;
if (dccid == 8) {
int ix = eedetid.ix();
if (ix > 50)
ilm += 1;
}
if (dccid == 53) {
int ix = eedetid.ix();
if (ix > 50)
ilm += 1;
}
return ilm;
} else
throw cms::Exception("InvalidDCCId") << "Wrong DCCId (EE) in EcalElectronicsMapping::getLMNumber.";
}
return -1;
}
|