00001 #include "DQM/EcalCommon/interface/EcalDQMBinningService.h"
00002 #include "DQM/EcalCommon/interface/EcalDQMCommonUtils.h"
00003
00004 #include "FWCore/Utilities/interface/Exception.h"
00005
00006 #include "Geometry/CaloGeometry/interface/CaloGeometry.h"
00007 #include "Geometry/CaloGeometry/interface/CaloCellGeometry.h"
00008
00009 #include <algorithm>
00010
00011 #include "TMath.h"
00012
00013 using namespace ecaldqm;
00014
00015 std::vector<EcalDQMBinningService::AxisSpecs>
00016 EcalDQMBinningService::getBinningEB_(BinningType _btype, bool _isMap) const
00017 {
00018 std::vector<AxisSpecs> axes(0);
00019 AxisSpecs xaxis, yaxis;
00020
00021 if(!_isMap){
00022
00023 switch(_btype){
00024
00025
00026
00027
00028
00029
00030
00031 case kTCC:
00032 xaxis.nbins = 36;
00033 xaxis.low = 9.;
00034 xaxis.high = 45.;
00035 xaxis.title = "iTCC";
00036 break;
00037 case kDCC:
00038 xaxis.nbins = 36;
00039 xaxis.low = 9.;
00040 xaxis.high = 45.;
00041 break;
00042 case kProjEta:
00043 xaxis.nbins = nEBEtaBins;
00044 xaxis.low = -etaBound_;
00045 xaxis.high = etaBound_;
00046 xaxis.title = "eta";
00047 break;
00048 case kProjPhi:
00049 xaxis.nbins = nPhiBins;
00050 xaxis.low = -TMath::Pi() / 18.;
00051 xaxis.high = TMath::Pi() * 35./18.;
00052 xaxis.title = "phi";
00053 break;
00054 default:
00055 return axes;
00056 }
00057
00058 axes.push_back(xaxis);
00059
00060 }
00061 else{
00062
00063 switch(_btype){
00064 case kCrystal:
00065 xaxis.nbins = 360;
00066 yaxis.nbins = 170;
00067 break;
00068 case kSuperCrystal:
00069 case kTriggerTower:
00070 xaxis.nbins = 72;
00071 yaxis.nbins = 34;
00072 break;
00073 default:
00074 return axes;
00075 }
00076
00077 xaxis.low = 0.;
00078 xaxis.high = 360.;
00079 xaxis.title = "iphi";
00080 yaxis.low = -85.;
00081 yaxis.high = 85.;
00082 yaxis.title = "ieta";
00083
00084 axes.push_back(xaxis);
00085 axes.push_back(yaxis);
00086
00087 }
00088
00089 return axes;
00090 }
00091
00092 std::vector<EcalDQMBinningService::AxisSpecs>
00093 EcalDQMBinningService::getBinningEBMEM_(BinningType _btype, bool _isMap) const
00094 {
00095 std::vector<AxisSpecs> axes(0);
00096 AxisSpecs xaxis, yaxis;
00097
00098 if(_btype != kCrystal || !_isMap) return axes;
00099
00100 xaxis.nbins = 18;
00101 xaxis.low = 0.;
00102 xaxis.high = 18.;
00103 xaxis.title = "channel";
00104
00105 yaxis.nbins = 20;
00106 yaxis.low = -10.;
00107 yaxis.high = 10.;
00108 yaxis.title = "pseudo-strip";
00109
00110 axes.push_back(xaxis);
00111 axes.push_back(yaxis);
00112
00113 return axes;
00114 }
00115
00116 std::vector<EcalDQMBinningService::AxisSpecs>
00117 EcalDQMBinningService::getBinningEE_(BinningType _btype, bool _isMap, int _zside) const
00118 {
00119 std::vector<AxisSpecs> axes(0);
00120 AxisSpecs xaxis, yaxis;
00121
00122 if(!_isMap){
00123
00124 switch(_btype){
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137 case kTCC:
00138 xaxis.nbins = _zside ? 36 : 72;
00139 xaxis.low = 0.;
00140 xaxis.high = _zside ? 36. : 72.;
00141 xaxis.title = "iTCC";
00142 break;
00143 case kDCC:
00144 xaxis.nbins = _zside ? 9 : 18;
00145 xaxis.low = 0.;
00146 xaxis.high = _zside ? 9. : 18.;
00147 break;
00148 case kProjEta:
00149 if(!_zside) return axes;
00150 xaxis.nbins = nEEEtaBins;
00151 xaxis.low = _zside < 0 ? -3. : etaBound_;
00152 xaxis.high = _zside < 0 ? -etaBound_ : 3.;
00153 xaxis.title = "eta";
00154 break;
00155 case kProjPhi:
00156 xaxis.nbins = nPhiBins;
00157 xaxis.low = -TMath::Pi() / 18.;
00158 xaxis.high = TMath::Pi() * 35./18.;
00159 xaxis.title = "phi";
00160 break;
00161 default:
00162 return axes;
00163 }
00164
00165 axes.push_back(xaxis);
00166
00167 }else{
00168
00169 switch(_btype){
00170 case kCrystal:
00171 case kTriggerTower:
00172 xaxis.nbins = _zside ? 100 : 200;
00173 yaxis.nbins = 100;
00174 break;
00175 case kSuperCrystal:
00176 xaxis.nbins = _zside ? 20 : 40;
00177 yaxis.nbins = 20;
00178 break;
00179 default:
00180 return axes;
00181 }
00182
00183 xaxis.low = 0.;
00184 xaxis.high = _zside ? 100. : 200.;
00185 xaxis.title = "ix";
00186 yaxis.low = 0.;
00187 yaxis.high = 100.;
00188 yaxis.title = "iy";
00189
00190 axes.push_back(xaxis);
00191 axes.push_back(yaxis);
00192
00193 }
00194
00195 return axes;
00196 }
00197
00198 std::vector<EcalDQMBinningService::AxisSpecs>
00199 EcalDQMBinningService::getBinningEEMEM_(BinningType _btype, bool _isMap) const
00200 {
00201 std::vector<AxisSpecs> axes(0);
00202 AxisSpecs xaxis, yaxis;
00203
00204 if(_btype != kCrystal || !_isMap) return axes;
00205
00206 xaxis.nbins = 4;
00207 xaxis.low = 0.;
00208 xaxis.high = 4.;
00209 xaxis.title = "channel";
00210
00211 yaxis.nbins = 20;
00212 yaxis.low = -10.;
00213 yaxis.high = 10.;
00214 yaxis.title = "pseudo-strip";
00215
00216 axes.push_back(xaxis);
00217 axes.push_back(yaxis);
00218
00219 return axes;
00220 }
00221
00222 std::vector<EcalDQMBinningService::AxisSpecs>
00223 EcalDQMBinningService::getBinningSM_(BinningType _btype, bool _isMap, unsigned _offset) const
00224 {
00225 const bool isBarrel(_offset >= kEBmLow && _offset <= kEBpHigh);
00226
00227 std::vector<AxisSpecs> axes(0);
00228 AxisSpecs xaxis, yaxis;
00229
00230 if(!_isMap){
00231
00232 switch(_btype){
00233 case kCrystal:
00234 xaxis.nbins = isBarrel ? 1700 : getElectronicsMap()->dccConstituents(_offset + 1).size();
00235 xaxis.low = 0.;
00236 xaxis.high = xaxis.nbins;
00237 xaxis.title = "channel";
00238 break;
00239 case kTriggerTower:
00240 xaxis.nbins = isBarrel ? 68 : 80;
00241 xaxis.low = 0.;
00242 xaxis.high = xaxis.nbins;
00243 xaxis.title = "tower";
00244 break;
00245 case kSuperCrystal:
00246 xaxis.nbins = isBarrel ? 68 : getNSuperCrystals(_offset + 1);
00247 xaxis.low = 0.;
00248 xaxis.high = xaxis.nbins;
00249 xaxis.title = "tower";
00250 break;
00251 default:
00252 return axes;
00253 }
00254
00255 axes.push_back(xaxis);
00256
00257 }else{
00258
00259 int nEEX(nEESMX);
00260 if(_offset == kEEm02 || _offset == kEEm08 || _offset == kEEp02 || _offset == kEEp08) nEEX = nEESMXExt;
00261
00262 switch(_btype){
00263 case kCrystal:
00264 xaxis.nbins = isBarrel ? nEBSMEta : nEEX;
00265 yaxis.nbins = isBarrel ? nEBSMPhi : nEESMY;
00266 break;
00267 case kTriggerTower:
00268 xaxis.nbins = isBarrel ? nEBSMEta / 5 : nEEX;
00269 yaxis.nbins = isBarrel ? nEBSMPhi / 5 : nEESMY;
00270 break;
00271 case kSuperCrystal:
00272 xaxis.nbins = isBarrel ? nEBSMEta / 5 : nEEX / 5;
00273 yaxis.nbins = isBarrel ? nEBSMPhi / 5 : nEESMY / 5;
00274 break;
00275 default:
00276 return axes;
00277 }
00278 xaxis.low = xlow(_offset);
00279 xaxis.high = xaxis.low + (isBarrel ? nEBSMEta : nEEX);
00280 xaxis.title = isBarrel ? (_offset < kEBpLow ? "-ieta" : "ieta") : "ix";
00281 yaxis.low = ylow(_offset);
00282 yaxis.high = yaxis.low + (isBarrel ? nEBSMPhi : nEESMY);
00283 yaxis.title = isBarrel ? "iphi" : "iy";
00284
00285 axes.push_back(xaxis);
00286 axes.push_back(yaxis);
00287
00288 }
00289
00290 return axes;
00291 }
00292
00293 std::vector<EcalDQMBinningService::AxisSpecs>
00294 EcalDQMBinningService::getBinningSMMEM_(BinningType _btype, bool _isMap, unsigned _idcc) const
00295 {
00296 std::vector<AxisSpecs> axes(0);
00297 AxisSpecs xaxis, yaxis;
00298
00299 if(dccNoMEM.find(_idcc) != dccNoMEM.end()) return axes;
00300 if(_btype != kCrystal) return axes;
00301
00302 xaxis.nbins = 10;
00303 xaxis.low = _idcc >= kEBpLow ? 0. : -10.;
00304 xaxis.high = _idcc >= kEBpLow ? 10. : 0.;
00305 xaxis.title = "pseudo-strip";
00306
00307 axes.push_back(xaxis);
00308
00309 if(_isMap){
00310 yaxis.nbins = 1;
00311 yaxis.low = 0.;
00312 yaxis.high = 5.;
00313 yaxis.title = "channel";
00314 axes.push_back(yaxis);
00315 }
00316
00317 return axes;
00318 }
00319
00320 std::vector<EcalDQMBinningService::AxisSpecs>
00321 EcalDQMBinningService::getBinningEcal_(BinningType _btype, bool _isMap) const
00322 {
00323 std::vector<AxisSpecs> axes(0);
00324 AxisSpecs xaxis, yaxis;
00325
00326 if(!_isMap){
00327
00328 switch(_btype){
00329 case kTCC:
00330 xaxis.nbins = 108;
00331 xaxis.low = 0.;
00332 xaxis.high = 108.;
00333 xaxis.title = "iTCC";
00334 break;
00335 case kDCC:
00336 xaxis.nbins = 54;
00337 xaxis.low = 0.;
00338 xaxis.high = 54.;
00339 break;
00340 case kProjEta:
00341 xaxis.nbins = nEBEtaBins + 2 * nEEEtaBins;
00342 xaxis.edges = new double[xaxis.nbins + 1];
00343 for(int i(0); i <= nEEEtaBins; i++)
00344 xaxis.edges[i] = -3. + (3. - etaBound_) / nEEEtaBins * i;
00345 for(int i(1); i <= nEBEtaBins; i++)
00346 xaxis.edges[i + nEEEtaBins] = -etaBound_ + 2. * etaBound_ / nEBEtaBins * i;
00347 for(int i(1); i <= nEEEtaBins; i++)
00348 xaxis.edges[i + nEEEtaBins + nEBEtaBins] = etaBound_ + (3. - etaBound_) / nEEEtaBins * i;
00349 xaxis.title = "eta";
00350 break;
00351 case kProjPhi:
00352 xaxis.nbins = nPhiBins;
00353 xaxis.low = -TMath::Pi() / 18.;
00354 xaxis.high = TMath::Pi() * 35./18.;
00355 xaxis.title = "phi";
00356 break;
00357 default:
00358 return axes;
00359 }
00360
00361 axes.push_back(xaxis);
00362 }
00363 else{
00364
00365 switch(_btype){
00366 case kCrystal:
00367 xaxis.nbins = 360;
00368 yaxis.nbins = 270;
00369 break;
00370 case kSuperCrystal:
00371 xaxis.nbins = 72;
00372 yaxis.nbins = 54;
00373 break;
00374 default:
00375 return axes;
00376 }
00377
00378 xaxis.low = 0.;
00379 xaxis.high = 360.;
00380 xaxis.title = "iphi/ix/ix+100";
00381 yaxis.low = 0.;
00382 yaxis.high = 270.;
00383 yaxis.title = "ieta/iy";
00384
00385 axes.push_back(xaxis);
00386 axes.push_back(yaxis);
00387
00388 }
00389
00390 return axes;
00391 }
00392
00393
00394 const std::vector<int>*
00395 EcalDQMBinningService::getBinMapEB_(BinningType _bkey) const
00396 {
00397 std::vector<int>& binMap(binMaps_[kEB][_bkey]);
00398
00399 switch(_bkey){
00400 case kCrystal:
00401 binMap.resize(EBDetId::kSizeForDenseIndexing);
00402 for(int ix = 1; ix <= 360; ix++){
00403 for(int iy = 1; iy <= 170; iy++){
00404 uint32_t dIndex(EBDetId(iy < 86 ? iy - 86 : iy - 85, ix).hashedIndex());
00405 binMap[dIndex] = 360 * (iy - 1) + ix ;
00406 }
00407 }
00408 return &binMap;
00409
00410 case kSuperCrystal:
00411 binMap.resize(EcalTrigTowerDetId::kEBTotalTowers);
00412 for(int ix = 1; ix <= 72; ix++){
00413 for(int iy = 1; iy <= 34; iy++){
00414 int ieta(iy < 18 ? (iy - 18) * 5 : (iy - 17) * 5);
00415 int iphi(ix * 5);
00416 uint32_t dIndex(EBDetId(ieta, iphi).tower().hashedIndex());
00417 binMap[dIndex] = 72 * (iy - 1) + ix;
00418 }
00419 }
00420 return &binMap;
00421
00422 case kDCC:
00423 {
00424 int nEBDCC(kEBpHigh - kEBmLow + 1);
00425 binMap.resize(nEBDCC);
00426 for(int ix = 1; ix <= nEBDCC; ix++)
00427 binMap[ix - 1] = ix;
00428 }
00429 return &binMap;
00430
00431 case kTCC:
00432 {
00433 int nEBTCC(kEBTCCHigh - kEBTCCLow + 1);
00434 binMap.resize(nEBTCC);
00435 for(int ix = 1; ix <= nEBTCC; ix++)
00436 binMap[ix - 1] = ix;
00437 }
00438 return &binMap;
00439
00440 case kProjEta:
00441 {
00442 float binEdges[nEBEtaBins + 1];
00443 for(int i(0); i <= nEBEtaBins; i++)
00444 binEdges[i] = -etaBound_ + 2. * etaBound_ / nEBEtaBins * i;
00445 binMap.resize(170);
00446 for(int ieta(-85); ieta <= 85; ieta++){
00447 if(ieta == 0) continue;
00448 EBDetId ebid(ieta, 1);
00449 float eta(geometry_->getGeometry(ebid)->getPosition().eta());
00450 float* pBin(std::upper_bound(binEdges, binEdges + nEBEtaBins + 1, eta));
00451 uint32_t dIndex(ieta < 0 ? ieta + 85 : ieta + 84);
00452 binMap[dIndex] = static_cast<int>(pBin - binEdges);
00453 }
00454 }
00455 return &binMap;
00456
00457 case kProjPhi:
00458 {
00459 float binEdges[nPhiBins + 1];
00460 for(int i(0); i <= nPhiBins; i++)
00461 binEdges[i] = TMath::Pi() * (-1./18. + 2. / nPhiBins * i);
00462 binMap.resize(360);
00463 for(int iphi(1); iphi <= 360; iphi++){
00464 EBDetId ebid(1, iphi);
00465 float phi(geometry_->getGeometry(ebid)->getPosition().phi());
00466 if(phi < -TMath::Pi() * 1./18.) phi += 2. * TMath::Pi();
00467 float* pBin(std::upper_bound(binEdges, binEdges + nPhiBins + 1, phi));
00468 uint32_t dIndex(iphi - 1);
00469 binMap[dIndex] = static_cast<int>(pBin - binEdges);
00470 }
00471 }
00472 return &binMap;
00473
00474 default:
00475 return 0;
00476 }
00477 }
00478
00479 const std::vector<int>*
00480 EcalDQMBinningService::getBinMapEBMEM_(BinningType _bkey) const
00481 {
00482 if(_bkey != kCrystal) return 0;
00483
00484 int nEBMEM((kEBpHigh - kEBmLow + 1) * 10);
00485 std::vector<int>& binMap(binMaps_[kEBMEM][kCrystal]);
00486
00487 binMap.resize(nEBMEM);
00488 for(int ix = 1; ix <= 18; ix++){
00489 for(int iy = 1; iy <= 20; iy++){
00490 int idcc((iy < 11 ? kEBmLow : kEBpLow) + ix - 1);
00491 int pnId(iy < 11 ? 11 - iy : iy - 10);
00492 uint32_t dIndex((idcc - kEBmLow) * 10 + pnId - 1);
00493 binMap[dIndex] = 18 * (iy - 1) + ix;
00494 }
00495 }
00496 return &binMap;
00497 }
00498
00499 const std::vector<int>*
00500 EcalDQMBinningService::getBinMapEE_(BinningType _bkey, int _zside) const
00501 {
00502 unsigned okey(0);
00503 switch(_zside){
00504 case -1: okey = kEEm; break;
00505 case 0: okey = kEE; break;
00506 case 1: okey = kEEp; break;
00507 default: return 0;
00508 }
00509
00510 std::vector<int>& binMap(binMaps_[okey][_bkey]);
00511
00512 int ixmax(_zside == 0 ? 200 : 100);
00513 int zside(_zside);
00514
00515 switch(_bkey){
00516 case kCrystal:
00517 binMap.resize(_zside == 0 ? EEDetId::kSizeForDenseIndexing : EEDetId::kEEhalf);
00518 for(int ix = 1; ix <= ixmax; ix++){
00519 if(_zside == 0) zside = (ix <= 100 ? -1 : 1);
00520 int iix(_zside == 0 && ix > 100 ? ix - 100 : ix);
00521 for(int iy = 1; iy <= 100; iy++){
00522 if(!EEDetId::validDetId(iix, iy, zside)) continue;
00523 uint32_t dIndex(EEDetId(iix, iy, zside).hashedIndex());
00524 if(_zside == 1) dIndex -= EEDetId::kEEhalf;
00525 binMap[dIndex] = ixmax * (iy - 1) + ix;
00526 }
00527 }
00528 return &binMap;
00529
00530 case kSuperCrystal:
00531 binMap.resize(_zside == 0 ? EcalScDetId::kSizeForDenseIndexing : EcalScDetId::SC_PER_EE_CNT);
00532 for(int ix = 1; ix <= ixmax / 5; ix++){
00533 if(_zside == 0) zside = (ix <= 20 ? -1 : 1);
00534 int iix(_zside == 0 && ix > 20 ? ix - 20 : ix);
00535 for(int iy = 1; iy <= 20; iy++){
00536 if(!EcalScDetId::validDetId(iix, iy, zside)) continue;
00537 uint32_t dIndex(EcalScDetId(iix, iy, zside).hashedIndex());
00538 if(_zside == 1) dIndex -= EcalScDetId::SC_PER_EE_CNT;
00539 binMap[dIndex] = ixmax / 5 * (iy - 1) + ix;
00540 }
00541 }
00542 return &binMap;
00543
00544 case kDCC:
00545 {
00546 int nEEDCC(kEEmHigh - kEEmLow + kEEpHigh - kEEpLow + 2);
00547 if(_zside != 0) nEEDCC /= 2;
00548 binMap.resize(nEEDCC);
00549 for(int ix = 1; ix <= nEEDCC; ix++)
00550 binMap[ix - 1] = (ix + 5) % 9 + 1 + 9 * ((ix - 1) / 9);
00551 }
00552 return &binMap;
00553
00554 case kTCC:
00555 {
00556 int nEETCC(kEEmTCCHigh - kEEmTCCLow + kEEpTCCHigh - kEEpTCCLow + 2);
00557 if(_zside != 0) nEETCC /= 2;
00558 binMap.resize(nEETCC);
00559 for(int ix = 1; ix <= nEETCC; ix++)
00560 binMap[ix - 1] = ix;
00561 }
00562 return &binMap;
00563
00564 case kProjEta:
00565 {
00566 if(_zside == 0) return 0;
00567
00568 float binEdges[nEEEtaBins + 1];
00569 if(_zside < 0){
00570 for(int i(0); i <= nEEEtaBins; i++)
00571 binEdges[i] = -3. + (3. - etaBound_) / nEEEtaBins * i;
00572 }
00573 else{
00574 for(int i(0); i <= nEEEtaBins; i++)
00575 binEdges[i] = etaBound_ + (3. - etaBound_) / nEEEtaBins * i;
00576 }
00577 binMap.resize(EEDetId::kEEhalf / 2);
00578
00579 for(int ix = 1; ix <= 100; ix++){
00580 for(int iy = 1; iy <= 50; iy++){
00581 if(!EEDetId::validDetId(ix, iy, _zside)) continue;
00582 EEDetId eeid(ix, iy, _zside);
00583 float eta(geometry_->getGeometry(eeid)->getPosition().eta());
00584 float* pBin(std::upper_bound(binEdges, binEdges + nEEEtaBins + 1, eta));
00585 uint32_t dIndex(eeid.hashedIndex());
00586 if(_zside == 1) dIndex -= EEDetId::kEEhalf;
00587 binMap[dIndex] = static_cast<int>(pBin - binEdges);
00588 }
00589 }
00590 }
00591 return &binMap;
00592
00593 case kProjPhi:
00594 {
00595 if(_zside != 0) return 0;
00596
00597 float binEdges[nPhiBins + 1];
00598 for(int i(0); i <= nPhiBins; i++)
00599 binEdges[i] = TMath::Pi() * (-1./18. + 2. / nPhiBins * i);
00600 binMap.resize(EEDetId::kEEhalf);
00601 for(int ix = 1; ix <= 100; ix++){
00602 for(int iy = 1; iy <= 100; iy++){
00603 if(!EEDetId::validDetId(ix, iy, -1)) continue;
00604 EEDetId eeid(ix, iy, -1);
00605 float phi(geometry_->getGeometry(eeid)->getPosition().phi());
00606 if(phi < -TMath::Pi() * 1./18.) phi += 2. * TMath::Pi();
00607 float* pBin(std::upper_bound(binEdges, binEdges + nPhiBins + 1, phi));
00608 uint32_t dIndex(eeid.hashedIndex());
00609 binMap[dIndex] = static_cast<int>(pBin - binEdges);
00610 }
00611 }
00612 }
00613 return &binMap;
00614
00615 default:
00616 return 0;
00617 }
00618 }
00619
00620 const std::vector<int>*
00621 EcalDQMBinningService::getBinMapEEMEM_(BinningType _bkey) const
00622 {
00623 if(_bkey != kCrystal) return 0;
00624
00625 std::vector<int>& binMap(binMaps_[kEEMEM][kCrystal]);
00626
00627 binMap.resize((kEEmHigh - kEEmLow + kEEpHigh - kEEpLow + 2) * 10);
00628 int memIx(1);
00629 int iEEDCC(-1);
00630 int offset(0);
00631 for(int iSM(kEEmLow); iSM <= kEEpHigh; iSM++){
00632 iEEDCC++;
00633 if (dccNoMEM.find(iSM) != dccNoMEM.end()) {
00634 for (int ich(0); ich < 10; ich++)
00635 binMap[iEEDCC * 10 + ich] = 0;
00636 continue;
00637 }
00638 if (iSM == kEBmLow) {
00639 iSM = kEEpLow;
00640 offset = 10;
00641 memIx = 1;
00642 }
00643 for(int iy = 1 + offset; iy <= 10 + offset; iy++){
00644 int pnId(iy < 11 ? 11 - iy : iy - 10);
00645 uint32_t dIndex(iEEDCC * 10 + pnId - 1);
00646 binMap[dIndex] = 4 * (iy - 1) + memIx;
00647 }
00648 memIx++;
00649 }
00650
00651 return &binMap;
00652 }
00653
00654 const std::vector<int>*
00655 EcalDQMBinningService::getBinMapSM_(BinningType _bkey) const
00656 {
00657 int totalBins(0);
00658
00659 std::vector<int>& binMap(binMaps_[kSM][_bkey]);
00660
00661 switch(_bkey){
00662 case kCrystal:
00663 binMap.resize(EBDetId::kSizeForDenseIndexing + EEDetId::kSizeForDenseIndexing);
00664 for (int iDCC(0); iDCC < nDCC; iDCC++) {
00665 if(iDCC >= kEBmLow && iDCC <= kEBpHigh){
00666 for(int ix = 1; ix <= nEBSMEta; ix++){
00667 for(int iy = 1; iy <= nEBSMPhi; iy++){
00668 int ieta(ix + xlow(iDCC));
00669 int iphi(iy + ylow(iDCC));
00670 if (iDCC >= kEBpLow){
00671 iphi -= 1;
00672 iphi *= -1;
00673 }
00674 else
00675 ieta *= -1;
00676
00677 uint32_t dIndex(EBDetId(ieta, iphi).hashedIndex() + EEDetId::kEEhalf);
00678 binMap[dIndex] = totalBins + nEBSMEta * (iy - 1) + ix;
00679 }
00680 }
00681 totalBins += nEBSMBins;
00682 }
00683 else{
00684 std::vector<DetId> crystals(getElectronicsMap()->dccConstituents(iDCC + 1));
00685 int nEEX(nEESMX), nEEBins(nEESMBins);
00686 if(iDCC == kEEm02 || iDCC == kEEm08 || iDCC == kEEp02 || iDCC == kEEp08){
00687 nEEX = nEESMXExt;
00688 nEEBins = nEESMBinsExt;
00689 }
00690 for(std::vector<DetId>::iterator idItr(crystals.begin()); idItr != crystals.end(); ++idItr){
00691 EEDetId id(*idItr);
00692 uint32_t dIndex(id.hashedIndex());
00693 int ix(id.ix() - xlow(iDCC));
00694 int iy(id.iy() - ylow(iDCC));
00695 if (id.zside() > 0)
00696 dIndex += EBDetId::kSizeForDenseIndexing;
00697
00698 binMap[dIndex] = totalBins + nEEX * (iy - 1) + ix;
00699 }
00700 totalBins += nEEBins;
00701 }
00702 }
00703 return &binMap;
00704
00705 case kSuperCrystal:
00706 binMap.resize(EcalTrigTowerDetId::kEBTotalTowers + EcalScDetId::kSizeForDenseIndexing);
00707
00708 for(int iSM(0); iSM < nDCC; iSM++){
00709 if(iSM >= kEBmLow && iSM <= kEBpHigh){
00710 for(int ix = 1; ix <= nEBSMEta; ix += 5){
00711 for(int iy = 1; iy <= nEBSMPhi; iy += 5){
00712 int ieta(ix + xlow(iSM));
00713 int iphi(iy + ylow(iSM));
00714 if(iSM >= kEBpLow){
00715 iphi -= 1;
00716 iphi *= -1;
00717 }
00718 else
00719 ieta *= -1;
00720 uint32_t dIndex(EBDetId(ieta, iphi).tower().hashedIndex());
00721 binMap[dIndex + EcalScDetId::SC_PER_EE_CNT] = totalBins + nEBSMEta / 5 * (iy - 1) / 5 + (ix - 1) / 5 + 1;
00722 }
00723 }
00724 totalBins += nEBSMBins / 25;
00725 }
00726 else{
00727 int nEEX(nEESMX), nEEBins(nEESMBins);
00728 if(iSM == kEEm02 || iSM == kEEm08 || iSM == kEEp02 || iSM == kEEp08){
00729 nEEX = nEESMXExt;
00730 nEEBins = nEESMBinsExt;
00731 }
00732 for (int ix(1); ix <= nEEX / 5; ix++) {
00733 for (int iy(1); iy <= nEESMY / 5; iy++) {
00734 int sciz(1);
00735 if (iSM <= kEEmHigh) sciz = -1;
00736 int scix(ix + xlow(iSM) / 5);
00737 int sciy(iy + ylow(iSM) / 5);
00738 if(scix <= 0 || scix > 20 || sciy <= 0 || sciy > 20) continue;
00739 if(!EcalScDetId::validDetId(scix, sciy, sciz)) continue;
00740 uint32_t dIndex(EcalScDetId(scix, sciy, sciz).hashedIndex());
00741 if(sciz > 0) dIndex += EcalTrigTowerDetId::kEBTotalTowers;
00742 binMap[dIndex] = totalBins + nEEX / 5 * (iy - 1) + ix;
00743 }
00744 }
00745 totalBins += nEEBins / 25;
00746 }
00747 }
00748 return &binMap;
00749
00750 case kTriggerTower:
00751 binMap.resize(EcalTrigTowerDetId::kEBTotalTowers + EEDetId::kSizeForDenseIndexing);
00752
00753 for(int iSM(0); iSM < nDCC; iSM++){
00754 if(iSM >= kEBmLow && iSM <= kEBpHigh){
00755 for(int ix = 1; ix <= nEBSMEta; ix += 5){
00756 for(int iy = 1; iy <= nEBSMPhi; iy += 5){
00757 int ieta(ix + xlow(iSM));
00758 int iphi(iy + ylow(iSM));
00759 if(iSM >= kEBpLow){
00760 iphi -= 1;
00761 iphi *= -1;
00762 }
00763 else
00764 ieta *= -1;
00765 uint32_t dIndex(EBDetId(ieta, iphi).tower().hashedIndex());
00766 binMap[dIndex + EEDetId::kEEhalf] = totalBins + nEBSMEta / 5 * (iy - 1) / 5 + (ix - 1) / 5 + 1;
00767 }
00768 }
00769 totalBins += nEBSMBins / 25;
00770 }
00771 else{
00772 int nEEX(nEESMX), nEEBins(nEESMBins);
00773 if(iSM == kEEm02 || iSM == kEEm08 || iSM == kEEp02 || iSM == kEEp08){
00774 nEEX = nEESMXExt;
00775 nEEBins = nEESMBinsExt;
00776 }
00777
00778 int tccid[4];
00779 tccid[0] = ((iSM % 9) * 2 + 17) % 18 + 1;
00780 tccid[1] = tccid[0] % 18 + 1;
00781 tccid[2] = tccid[0] + 18;
00782 tccid[3] = tccid[1] + 18;
00783 if(iSM >= int(kEEpLow))
00784 for(int i(0); i < 4; i++) tccid[i] += kEEpTCCLow;
00785 for(int it(0); it < 4; it++){
00786 std::vector<DetId> crystals(getElectronicsMap()->tccConstituents(tccid[it]));
00787 for(std::vector<DetId>::iterator idItr(crystals.begin()); idItr != crystals.end(); ++idItr){
00788 EEDetId id(*idItr);
00789 uint32_t dIndex(id.hashedIndex());
00790 int ix(id.ix() - xlow(iSM));
00791 int iy(id.iy() - ylow(iSM));
00792 if (id.zside() > 0)
00793 dIndex += EcalTrigTowerDetId::kEBTotalTowers;
00794
00795 binMap[dIndex] = totalBins + nEEX * (iy - 1) + ix;
00796 }
00797 }
00798 totalBins += nEEBins;
00799 }
00800 }
00801 return &binMap;
00802
00803 default:
00804 return 0;
00805 }
00806 }
00807
00808 const std::vector<int>*
00809 EcalDQMBinningService::getBinMapSMMEM_(BinningType _bkey) const
00810 {
00811 if(_bkey != kCrystal) return 0;
00812
00813 int totalBins(0);
00814
00815 std::vector<int>& binMap(binMaps_[kSMMEM][_bkey]);
00816
00817 binMap.resize(nDCC * 10);
00818 for(int iSM(0); iSM < nDCC; iSM++){
00819 if (dccNoMEM.find(iSM) != dccNoMEM.end()) {
00820 for (int ich(0); ich < 10; ich++)
00821 binMap[iSM * 10 + ich] = 0;
00822 continue;
00823 }
00824 for(int ix = 1; ix <= 10; ix++){
00825 int pnId(iSM <= kEBmHigh ? 11 - ix : ix);
00826 uint32_t dIndex(iSM * 10 + pnId - 1);
00827 binMap[dIndex] = totalBins + ix;
00828 }
00829
00830 totalBins += 10;
00831 }
00832
00833 return &binMap;
00834 }
00835
00836 const std::vector<int>*
00837 EcalDQMBinningService::getBinMapEcal_(BinningType _bkey) const
00838 {
00839 std::vector<int>& binMap(binMaps_[kEcal][_bkey]);
00840
00841 switch(_bkey){
00842 case kCrystal:
00843 binMap.resize(EBDetId::kSizeForDenseIndexing + EEDetId::kSizeForDenseIndexing);
00844 for(int ix = 1; ix <= 360; ix++){
00845 for(int iy = 101; iy <= 270; iy++){
00846 uint32_t dIndex(EBDetId(iy < 186 ? iy - 186 : iy - 185, ix).hashedIndex() + EEDetId::kEEhalf);
00847 binMap[dIndex] = 360 * (iy - 1) + ix ;
00848 }
00849 }
00850 for(int ix = 1; ix <= 200; ix++){
00851 int iix(ix > 100 ? ix - 100 : ix);
00852 int zside(ix > 100 ? 1 : -1);
00853 for(int iy = 1; iy <= 100; iy++){
00854 if(!EEDetId::validDetId(iix, iy, zside)) continue;
00855 uint32_t dIndex(EEDetId(iix, iy, zside).hashedIndex());
00856 if(zside == 1) dIndex += EBDetId::kSizeForDenseIndexing;
00857 binMap[dIndex] = 360 * (iy - 1) + ix;
00858 }
00859 }
00860 return &binMap;
00861
00862 case kSuperCrystal:
00863 binMap.resize(EcalTrigTowerDetId::kEBTotalTowers + EcalScDetId::kSizeForDenseIndexing);
00864 for(int ix = 1; ix <= 72; ix++){
00865 for(int iy = 21; iy <= 54; iy++){
00866 int ieta(iy < 38 ? (iy - 38) * 5 : (iy - 37) * 5);
00867 int iphi(ix * 5);
00868 uint32_t dIndex(EBDetId(ieta, iphi).tower().hashedIndex() + EcalScDetId::SC_PER_EE_CNT);
00869 binMap[dIndex] = 72 * (iy - 1) + ix;
00870 }
00871 }
00872 for(int ix = 1; ix <= 40; ix++){
00873 int iix((ix - 1) % 20 + 1);
00874 int zside(ix > 20 ? 1 : -1);
00875 for(int iy = 1; iy <= 20; iy++){
00876 if(!EcalScDetId::validDetId(iix, iy, zside)) continue;
00877 uint32_t dIndex(EcalScDetId(iix, iy, zside).hashedIndex());
00878 if(zside == 1) dIndex += EcalTrigTowerDetId::kEBTotalTowers;
00879 binMap[dIndex] = 72 * (iy - 1) + ix;
00880 }
00881 }
00882 return &binMap;
00883
00884 case kProjEta:
00885 {
00886 float binEdges[nEBEtaBins + 2 * nEEEtaBins + 1];
00887 for(int i(0); i <= nEEEtaBins; i++)
00888 binEdges[i] = -3. + (3. - etaBound_) / nEEEtaBins * i;
00889 for(int i(1); i <= nEBEtaBins; i++)
00890 binEdges[i + nEEEtaBins] = -etaBound_ + 2. * etaBound_ / nEBEtaBins * i;
00891 for(int i(1); i <= nEEEtaBins; i++)
00892 binEdges[i + nEEEtaBins + nEBEtaBins] = etaBound_ + (3. - etaBound_) / nEEEtaBins * i;
00893
00894 float* lowEdge(binEdges);
00895 binMap.resize(170 + EEDetId::kEEhalf);
00896 for(int ix = 1; ix <= 100; ix++){
00897 for(int iy = 1; iy <= 50; iy++){
00898 if(!EEDetId::validDetId(ix, iy, -1)) continue;
00899 EEDetId eeid(ix, iy, -1);
00900 float eta(geometry_->getGeometry(eeid)->getPosition().eta());
00901 float* pBin(std::upper_bound(lowEdge, lowEdge + nEEEtaBins + 1, eta));
00902 uint32_t dIndex(eeid.hashedIndex());
00903 binMap[dIndex] = static_cast<int>(pBin - binEdges);
00904 }
00905 }
00906 lowEdge += nEEEtaBins;
00907 for(int ieta(-85); ieta <= 85; ieta++){
00908 if(ieta == 0) continue;
00909 EBDetId ebid(ieta, 1);
00910 float eta(geometry_->getGeometry(ebid)->getPosition().eta());
00911 float* pBin(std::upper_bound(lowEdge, lowEdge + nEBEtaBins + 1, eta));
00912 uint32_t dIndex(ieta < 0 ? ieta + 85 : ieta + 84);
00913 dIndex += EEDetId::kEEhalf / 2;
00914 binMap[dIndex] = static_cast<int>(pBin - binEdges);
00915 }
00916 lowEdge += nEBEtaBins;
00917 for(int ix = 1; ix <= 100; ix++){
00918 for(int iy = 1; iy <= 50; iy++){
00919 if(!EEDetId::validDetId(ix, iy, 1)) continue;
00920 EEDetId eeid(ix, iy, 1);
00921 float eta(geometry_->getGeometry(eeid)->getPosition().eta());
00922 float* pBin(std::upper_bound(lowEdge, lowEdge + nEEEtaBins + 1, eta));
00923 uint32_t dIndex(eeid.hashedIndex() - EEDetId::kEEhalf / 2 + 170);
00924 binMap[dIndex] = static_cast<int>(pBin - binEdges);
00925 }
00926 }
00927 }
00928 return &binMap;
00929
00930 case kProjPhi:
00931 {
00932 float binEdges[nPhiBins + 1];
00933 for(int i(0); i <= nPhiBins; i++)
00934 binEdges[i] = TMath::Pi() * (-1./18. + 2. / nPhiBins * i);
00935 binMap.resize(360 + EEDetId::kEEhalf);
00936 for(int ix = 1; ix <= 100; ix++){
00937 for(int iy = 1; iy <= 100; iy++){
00938 if(!EEDetId::validDetId(ix, iy, -1)) continue;
00939 EEDetId eeid(ix, iy, -1);
00940 float phi(geometry_->getGeometry(eeid)->getPosition().phi());
00941 if(phi < -TMath::Pi() * 1./18.) phi += 2. * TMath::Pi();
00942 float* pBin(std::upper_bound(binEdges, binEdges + nPhiBins + 1, phi));
00943 uint32_t dIndex(eeid.hashedIndex());
00944 binMap[dIndex] = static_cast<int>(pBin - binEdges);
00945 }
00946 }
00947 for(int iphi(1); iphi <= 360; iphi++){
00948 EBDetId ebid(1, iphi);
00949 float phi(geometry_->getGeometry(ebid)->getPosition().phi());
00950 if(phi < -TMath::Pi() * 1./18.) phi += 2. * TMath::Pi();
00951 float* pBin(std::upper_bound(binEdges, binEdges + nPhiBins + 1, phi));
00952 uint32_t dIndex(iphi - 1 + EEDetId::kEEhalf);
00953 binMap[dIndex] = static_cast<int>(pBin - binEdges);
00954 }
00955 }
00956 return &binMap;
00957
00958 case kTCC:
00959 binMap.resize(nTCC);
00960 for(int ix = 1; ix <= nTCC; ix++)
00961 binMap[ix - 1] = ix;
00962 return &binMap;
00963
00964 case kDCC:
00965 binMap.resize(nDCC);
00966 for(int ix(kEEmLow); ix <= kEEpHigh; ix++)
00967 binMap[ix] = ix + 1;
00968 return &binMap;
00969
00970 default:
00971 return 0;
00972 }
00973 }
00974
00975 void
00976 EcalDQMBinningService::findBinsCrystal_(const DetId& _id, ObjectType _okey, const std::vector<int>& _binMap, std::vector<int>& _bins) const
00977 {
00978 using namespace std;
00979
00980 bool fullRange(_okey == kSM || _okey == kEcal);
00981
00982 switch(_id.subdetId()){
00983 case EcalBarrel:
00984 {
00985 unsigned index(EBDetId(_id).denseIndex());
00986 if(fullRange) index += EEDetId::kEEhalf;
00987 if(index < _binMap.size()) _bins.push_back(_binMap[index]);
00988 break;
00989 }
00990 case EcalEndcap:
00991 if(isEcalScDetId(_id)){
00992 pair<int, int> dccSc(getElectronicsMap()->getDCCandSC(EcalScDetId(_id)));
00993 vector<DetId> detIds(getElectronicsMap()->dccTowerConstituents(dccSc.first, dccSc.second));
00994 for(vector<DetId>::iterator idItr(detIds.begin()); idItr != detIds.end(); ++idItr) {
00995 EEDetId eeid(*idItr);
00996 unsigned index(eeid.denseIndex());
00997 if(eeid.zside() > 0) {
00998 if(fullRange) index += EBDetId::kSizeForDenseIndexing;
00999 else if(_okey == kEEp) index -= EEDetId::kEEhalf;
01000 }
01001 if(index < _binMap.size()) _bins.push_back(_binMap[index]);
01002 }
01003 }
01004 else{
01005 EEDetId eeid(_id);
01006 unsigned index(eeid.denseIndex());
01007 if(eeid.zside() > 0) {
01008 if(fullRange) index += EBDetId::kSizeForDenseIndexing;
01009 else if(_okey == kEEp) index -= EEDetId::kEEhalf;
01010 }
01011 if(index < _binMap.size()) _bins.push_back(_binMap[index]);
01012 }
01013 break;
01014 case EcalTriggerTower:
01015 {
01016 EcalTrigTowerDetId ttid(_id);
01017 vector<DetId> detIds(getTrigTowerMap()->constituentsOf(ttid));
01018 for(vector<DetId>::iterator idItr(detIds.begin()); idItr != detIds.end(); ++idItr) {
01019 if(idItr->subdetId() == EcalBarrel) {
01020 unsigned index(EBDetId(*idItr).denseIndex());
01021 if(fullRange) index += EEDetId::kEEhalf;
01022 if(index < _binMap.size()) _bins.push_back(_binMap[index]);
01023 }
01024 else {
01025 EEDetId eeid(*idItr);
01026 unsigned index(eeid.denseIndex());
01027 if(eeid.zside() > 0) {
01028 if(fullRange) index += EBDetId::kSizeForDenseIndexing;
01029 else if(_okey == kEEp) index -= EEDetId::kEEhalf;
01030 }
01031 if (index < _binMap.size()) _bins.push_back(_binMap[index]);
01032 }
01033 }
01034 break;
01035 }
01036 case EcalLaserPnDiode:
01037 {
01038 EcalPnDiodeDetId pnid(_id);
01039 int iDCC(pnid.iDCCId() - 1);
01040 unsigned index(iDCC * 10 + pnid.iPnId());
01041 if(_okey == kEBMEM) index -= kEEmHigh * 10;
01042 else if(_okey == kEEMEM && iDCC >= kEEpLow) index -= (kEEpLow - kEBmLow) * 10;
01043 if(index < _binMap.size()) _bins.push_back(_binMap[index]);
01044 break;
01045 }
01046 default:
01047 break;
01048 }
01049 }
01050
01051 void
01052 EcalDQMBinningService::findBinsTriggerTower_(const DetId& _id, ObjectType _okey, const std::vector<int>& _binMap, std::vector<int>& _bins) const
01053 {
01054 using namespace std;
01055
01056 switch(_id.subdetId()){
01057 case EcalBarrel:
01058 {
01059 EcalTrigTowerDetId ttid(EBDetId(_id).tower());
01060 unsigned index(ttid.hashedIndex() + EEDetId::kEEhalf);
01061 if(index < _binMap.size()) _bins.push_back(_binMap[index]);
01062 break;
01063 }
01064 case EcalEndcap:
01065 if(!isEcalScDetId(_id)){
01066 vector<DetId> detIds(getTrigTowerMap()->constituentsOf(getTrigTowerMap()->towerOf(_id)));
01067 for(vector<DetId>::iterator idItr(detIds.begin()); idItr != detIds.end(); ++idItr){
01068 EEDetId eeid(*idItr);
01069 unsigned index(eeid.denseIndex());
01070 if(eeid.zside() > 0) index += EcalTrigTowerDetId::kEBTotalTowers;
01071 if(index < _binMap.size()) _bins.push_back(_binMap[index]);
01072 }
01073 break;
01074 }
01075 case EcalTriggerTower:
01076 {
01077 EcalTrigTowerDetId ttid(_id);
01078 if(ttid.subDet() == EcalBarrel){
01079 unsigned index(ttid.hashedIndex() + EEDetId::kEEhalf);
01080 if(index < _binMap.size()) _bins.push_back(_binMap[index]);
01081 }
01082 else{
01083 vector<DetId> detIds(getTrigTowerMap()->constituentsOf(ttid));
01084 for(vector<DetId>::iterator idItr(detIds.begin()); idItr != detIds.end(); ++idItr){
01085 EEDetId eeid(*idItr);
01086 unsigned index(eeid.denseIndex());
01087 if(eeid.zside() > 0) index += EcalTrigTowerDetId::kEBTotalTowers;
01088 if(index < _binMap.size()) _bins.push_back(_binMap[index]);
01089 }
01090 }
01091 break;
01092 }
01093 default:
01094 break;
01095 }
01096
01097 }
01098
01099 void
01100 EcalDQMBinningService::findBinsSuperCrystal_(const DetId& _id, ObjectType _okey, const std::vector<int>& _binMap, std::vector<int>& _bins) const
01101 {
01102 bool fullRange(_okey == kSM || _okey == kEcal);
01103
01104 switch(_id.subdetId()){
01105 case EcalBarrel:
01106 {
01107 unsigned index(EBDetId(_id).tower().denseIndex());
01108 if(fullRange) index += EcalScDetId::SC_PER_EE_CNT;
01109 if(index < _binMap.size()) _bins.push_back(_binMap[index]);
01110 break;
01111 }
01112 case EcalEndcap:
01113 {
01114 int zside(0);
01115 unsigned index;
01116 if (isEcalScDetId(_id)) {
01117 EcalScDetId scid(_id);
01118 zside = scid.zside();
01119 index = scid.denseIndex();
01120 }
01121 else {
01122 EEDetId eeid(_id);
01123 zside = eeid.zside();
01124 index = eeid.sc().denseIndex();
01125 }
01126 if(zside > 0) {
01127 if(fullRange) index += EcalTrigTowerDetId::kEBTotalTowers;
01128 else if(_okey == kEEp) index -= EcalScDetId::SC_PER_EE_CNT;
01129 }
01130 if(index < _binMap.size()) _bins.push_back(_binMap[index]);
01131 break;
01132 }
01133 case EcalTriggerTower:
01134 {
01135 EcalTrigTowerDetId ttid(_id);
01136 unsigned index(ttid.denseIndex());
01137 if(fullRange) index += EcalScDetId::SC_PER_EE_CNT;
01138 if(index < _binMap.size()) _bins.push_back(_binMap[index]);
01139 break;
01140 }
01141 default:
01142 break;
01143 }
01144 }
01145 void
01146 EcalDQMBinningService::findBinsDCC_(const DetId& _id, ObjectType _okey, const std::vector<int>& _binMap, std::vector<int>& _bins) const
01147 {
01148 unsigned index(dccId(_id) - 1);
01149 if(_okey == kEB) index -= kEBmLow;
01150 else if(_okey == kEE && index >= kEEpLow) index -= (kEBpHigh - kEEmHigh);
01151 else if(_okey == kEEp) index -= kEEpLow;
01152 if(index < _binMap.size()) _bins.push_back(_binMap[index]);
01153 }
01154
01155 void
01156 EcalDQMBinningService::findBinsTCC_(const DetId& _id, ObjectType _okey, const std::vector<int>& _binMap, std::vector<int>& _bins) const
01157 {
01158 unsigned index(tccId(_id) - 1);
01159 if(_okey == kEB) index -= kEBTCCLow;
01160 else if(_okey == kEE && index >= kEEpLow) index -= (kEBTCCHigh - kEEmTCCHigh);
01161 else if(_okey == kEEp) index -= kEEpTCCLow;
01162 if(index < _binMap.size()) _bins.push_back(_binMap[index]);
01163 }
01164
01165 void
01166 EcalDQMBinningService::findBinsProjEta_(const DetId& _id, ObjectType _okey, const std::vector<int>& _binMap, std::vector<int>& _bins) const
01167 {
01168 using namespace std;
01169
01170 switch(_id.subdetId()){
01171 case EcalBarrel:
01172 {
01173 EBDetId ebid(_id);
01174 unsigned index(ebid.ieta() < 0 ? ebid.ieta() + 85 : ebid.ieta() + 84);
01175 if(_okey == kEcal) index += EEDetId::kEEhalf / 2;
01176 if(index < _binMap.size()) _bins.push_back(_binMap[index]);
01177 break;
01178 }
01179 case EcalEndcap:
01180 if(!isEcalScDetId(_id)){
01181 EEDetId eeid(_id);
01182 if(eeid.iquadrant() < 3)
01183 eeid = EEDetId(eeid.ix(), 101 - eeid.iy(), eeid.zside());
01184 unsigned index(eeid.denseIndex());
01185 if(_okey == kEEp) index -= EEDetId::kEEhalf;
01186 else if(_okey == kEcal && eeid.zside() > 0) index += 170 - EEDetId::kEEhalf / 2;
01187 if(index < _binMap.size()) _bins.push_back(_binMap[index]);
01188 break;
01189 }
01190 case EcalTriggerTower:
01191 {
01192 EcalTrigTowerDetId ttid(_id);
01193 vector<DetId> detIds(getTrigTowerMap()->constituentsOf(ttid));
01194 set<int> binset;
01195 if(ttid.subDet() == EcalBarrel){
01196 for(vector<DetId>::iterator idItr(detIds.begin()); idItr != detIds.end(); ++idItr){
01197 EBDetId ebid(*idItr);
01198 unsigned index(ebid.ieta() < 0 ? ebid.ieta() + 85 : ebid.ieta() + 84);
01199 if(_okey == kEcal) index += EEDetId::kEEhalf / 2;
01200 if(index < _binMap.size()) binset.insert(_binMap[index]);
01201 }
01202 }
01203 else{
01204 for(vector<DetId>::iterator idItr(detIds.begin()); idItr != detIds.end(); ++idItr){
01205 EEDetId eeid(*idItr);
01206 if(eeid.iquadrant() < 3)
01207 eeid = EEDetId(eeid.ix(), eeid.iy() <= 50 ? eeid.iy() : 101 - eeid.iy(), eeid.zside());
01208 unsigned index(eeid.denseIndex());
01209 if(_okey == kEEp) index -= EEDetId::kEEhalf;
01210 else if(_okey == kEcal && eeid.zside() > 0) index += 170 - EEDetId::kEEhalf / 2;
01211 if(index < _binMap.size()) binset.insert(_binMap[index]);
01212 }
01213 }
01214 for(set<int>::iterator binItr(binset.begin()); binItr != binset.end(); ++binItr)
01215 _bins.push_back(*binItr);
01216 break;
01217 }
01218 default:
01219 break;
01220 }
01221 }
01222
01223 void
01224 EcalDQMBinningService::findBinsProjPhi_(const DetId& _id, ObjectType _okey, const std::vector<int>& _binMap, std::vector<int>& _bins) const
01225 {
01226 using namespace std;
01227
01228 switch(_id.subdetId()){
01229 case EcalBarrel:
01230 {
01231 EBDetId ebid(_id);
01232 unsigned index(ebid.iphi() - 1);
01233 if(_okey == kEcal) index += EEDetId::kEEhalf;
01234 if(index < _binMap.size()) _bins.push_back(_binMap[index]);
01235 break;
01236 }
01237 case EcalEndcap:
01238 if(!isEcalScDetId(_id)){
01239 EEDetId eeid(_id);
01240 unsigned index(eeid.denseIndex());
01241 if(eeid.zside() > 0) index -= EEDetId::kEEhalf;
01242 if(index < _binMap.size()) _bins.push_back(_binMap[index]);
01243 break;
01244 }
01245 case EcalTriggerTower:
01246 {
01247 EcalTrigTowerDetId ttid(_id);
01248 vector<DetId> detIds(getTrigTowerMap()->constituentsOf(ttid));
01249 set<int> binset;
01250 if(ttid.subDet() == EcalBarrel){
01251 for(vector<DetId>::iterator idItr(detIds.begin()); idItr != detIds.end(); ++idItr){
01252 EBDetId ebid(*idItr);
01253 unsigned index(ebid.iphi() - 1);
01254 if(_okey == kEcal) index += EEDetId::kEEhalf;
01255 if(index < _binMap.size()) binset.insert(_binMap[index]);
01256 }
01257 }
01258 else{
01259 for(vector<DetId>::iterator idItr(detIds.begin()); idItr != detIds.end(); ++idItr){
01260 EEDetId eeid(*idItr);
01261 unsigned index(eeid.denseIndex());
01262 if(eeid.zside() > 0) index -= EEDetId::kEEhalf;
01263 if(index < _binMap.size()) binset.insert(_binMap[index]);
01264 }
01265 }
01266 for(set<int>::iterator binItr(binset.begin()); binItr != binset.end(); ++binItr)
01267 _bins.push_back(*binItr);
01268 break;
01269 }
01270 default:
01271 break;
01272 }
01273 }