CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_10_patch2/src/DQM/EcalCommon/src/GeometryHelper.cc

Go to the documentation of this file.
00001 #include "DQM/EcalCommon/interface/GeometryHelper.h"
00002 
00003 #include <utility>
00004 
00005 #include "TH1.h"
00006 
00007 #include "DQMServices/Core/interface/DQMStore.h"
00008 #include "DQMServices/Core/interface/MonitorElement.h"
00009 #include "DQM/EcalCommon/interface/Numbers.h"
00010 #include "DataFormats/EcalDetId/interface/EEDetId.h"
00011 #include "DataFormats/EcalDetId/interface/EcalScDetId.h"
00012 #include "DataFormats/EcalDetId/interface/EcalTrigTowerDetId.h"
00013 #include "DataFormats/EcalDetId/interface/EcalTriggerElectronicsId.h"
00014 #include "Geometry/EcalMapping/interface/EcalElectronicsMapping.h"
00015 
00016 namespace ecaldqm {
00017 
00018   std::map<std::string, MeInfo> MeInfoMap::infos;
00019 
00020   void
00021   MeInfoMap::set(MonitorElement *me, ObjectType otype, BinningType btype, int ism)
00022   {
00023 
00024     if( !me ) return;
00025 
00026     MeInfo info;
00027     info.otype = otype;
00028     info.btype = btype;
00029     info.ism = ism;
00030 
00031     MeInfoMap::infos[ me->getFullname() ] = info;
00032 
00033   }
00034 
00035   const MeInfo *
00036   MeInfoMap::get(MonitorElement *me)
00037   {
00038     if( !me ) return NULL;
00039 
00040     std::map<std::string, MeInfo>::const_iterator it = MeInfoMap::infos.find( me->getFullname() );
00041 
00042     if( it == MeInfoMap::infos.end() ) return NULL;
00043 
00044     return &(it->second);
00045   }
00046 
00047   MonitorElement *
00048   bookME(DQMStore *dqmStore, const std::string &name, const std::string &title, const std::string &className, ObjectType otype, BinningType btype, int ism, double lowZ, double highZ, const char *option)
00049   {
00050     if( !dqmStore ) return NULL;
00051 
00052     if( className != "TH2F" && className != "TProfile2D" ) return NULL;
00053 
00054     Double_t xmin, ymin;
00055     Double_t xmax, ymax;
00056 
00057     xmin = ymin = 0.;
00058     xmax = ymax = 0.;
00059 
00060     switch(otype){
00061     case kFullEE:
00062       xmax = 200.;
00063       ymax = 100.;
00064       break;
00065     case kEEp:
00066     case kEEm:
00067       xmax = 100.;
00068       ymax = 100.;
00069       break;
00070     case kEEpFar:
00071     case kEEmFar:
00072       xmin = 50.;
00073       xmax = 100.;
00074       ymax = 100.;
00075       break;
00076     case kEEpNear:
00077     case kEEmNear:
00078       xmax = 50.;
00079       ymax = 100.;
00080       break;
00081     case kSM:
00082       xmin = Numbers::ix0EE(ism);
00083       xmax = xmin + 50;
00084       ymin = Numbers::iy0EE(ism);
00085       ymax = ymin + 50;
00086       break;
00087     }
00088 
00089     Int_t nBinsX, nBinsY;
00090 
00091     switch(btype){
00092     case kCrystal:
00093     case kTriggerTower:
00094       nBinsX = (Int_t)(xmax - xmin);
00095       nBinsY = (Int_t)(ymax - ymin);
00096       break;
00097     case kSuperCrystal:
00098       nBinsX = (Int_t)(xmax - xmin) / 5;
00099       nBinsY = (Int_t)(ymax - ymin) / 5;
00100       break;
00101     default:
00102       nBinsX = nBinsY = 0;
00103       break;
00104     }
00105 
00106     MonitorElement *me;
00107 
00108     if( className == "TH2F" )
00109       me = dqmStore->book2D(name, title, nBinsX, xmin, xmax, nBinsY, ymin, ymax);
00110     else
00111       me = dqmStore->bookProfile2D(name, title, nBinsX, xmin, xmax, nBinsY, ymin, ymax, lowZ, highZ);
00112 
00113     MeInfoMap::set( me, otype, btype, ism );
00114 
00115     return me;
00116   }
00117 
00118   void
00119   fillME(MonitorElement *me, const EEDetId &id, double wz, double wprof)
00120   {
00121 
00122     if( !me ) return;
00123 
00124     const MeInfo *info = MeInfoMap::get( me );
00125 
00126     if( !info ) return;
00127 
00128     if(info->btype == kCrystal){
00129 
00130       float x = id.ix() - 0.5;
00131       float y = id.iy() - 0.5;
00132       if( info->otype == kSM && id.zside() < 0 ) x = 100 - x;
00133       if( info->otype == kFullEE && id.zside() > 0 ) x += 100;
00134 
00135       if( me->kind() == MonitorElement::DQM_KIND_TH2F ) me->Fill( x, y, wz );
00136       else if( me->kind() == MonitorElement::DQM_KIND_TPROFILE2D ) me->Fill( x, y, wz, wprof );
00137       return;
00138 
00139     }else if(info->btype == kSuperCrystal){
00140 
00141       EcalScDetId scid( Numbers::getEcalScDetId( id ) );
00142       fillME( me, scid, wz, wprof );
00143       return;
00144 
00145     }else if(info->btype == kTriggerTower){
00146 
00147       const EcalElectronicsMapping *map = Numbers::getElectronicsMapping();
00148       EcalTriggerElectronicsId teid( map->getTriggerElectronicsId( id ) );
00149       EcalTrigTowerDetId ttid( map->getTrigTowerDetId( teid.tccId(), teid.ttId() ) );
00150       fillME( me, ttid, wz, wprof );
00151       return;
00152 
00153     }
00154 
00155   }
00156 
00157   void
00158   fillME(MonitorElement *me, const EcalScDetId &id, double wz, double wprof)
00159   {
00160 
00161     if( !me ) return;
00162 
00163     const MeInfo *info = MeInfoMap::get( me );
00164 
00165     if( !info ) return;
00166 
00167     if(info->btype == kCrystal){
00168 
00169       const EcalElectronicsMapping *map = Numbers::getElectronicsMapping();
00170       std::pair<int,int> p = map->getDCCandSC( id );
00171       std::vector<DetId> vcry = map->dccTowerConstituents( p.first, p.second );
00172       for(unsigned u = 0; u < vcry.size(); u++){
00173         EEDetId cid( vcry[u] );
00174 
00175         float x = cid.ix() - 0.5;
00176         float y = cid.iy() - 0.5;
00177         if( info->otype == kSM && cid.zside() < 0 ) x = 100 - x;
00178         if( info->otype == kFullEE && cid.zside() > 0 ) x += 100;
00179 
00180         if( me->kind() == MonitorElement::DQM_KIND_TH2F ) me->Fill( x, y, wz );
00181         else if( me->kind() == MonitorElement::DQM_KIND_TPROFILE2D ) me->Fill( x, y, wz, wprof );
00182 
00183       }
00184       return;
00185 
00186     }else if(info->btype == kSuperCrystal){
00187 
00188       float x = id.ix() * 5 - 2.5;
00189       float y = id.iy() * 5 - 2.5;
00190       if( info->otype == kSM && id.zside() < 0 ) x = 100 - x;
00191       if( info->otype == kFullEE && id.zside() > 0 ) x += 100;
00192 
00193       if( me->kind() == MonitorElement::DQM_KIND_TH2F ) me->Fill( x, y, wz );
00194       else if( me->kind() == MonitorElement::DQM_KIND_TPROFILE2D ) me->Fill( x, y, wz, wprof );
00195       return;
00196 
00197     }
00198 
00199   }
00200 
00201   void
00202   fillME(MonitorElement *me, const EcalTrigTowerDetId &id, double wz, double wprof)
00203   {
00204 
00205     if( !me ) return;
00206 
00207     const MeInfo *info = MeInfoMap::get( me );
00208 
00209     if( !info ) return;
00210 
00211     if(info->btype == kTriggerTower || info->btype == kCrystal){
00212 
00213       std::vector<DetId> vcry = *( Numbers::crystals( id ) );
00214       for(unsigned u = 0; u < vcry.size(); u++){
00215         EEDetId cid( vcry[u] );
00216 
00217         float x = cid.ix() - 0.5;
00218         float y = cid.iy() - 0.5;
00219         if( info->otype == kSM && cid.zside() < 0 ) x = 100 - x;
00220         if( info->otype == kFullEE && cid.zside() > 0 ) x += 100;
00221 
00222         if( me->kind() == MonitorElement::DQM_KIND_TH2F ) me->Fill( x, y, wz );
00223         else if( me->kind() == MonitorElement::DQM_KIND_TPROFILE2D ) me->Fill( x, y, wz, wprof );
00224       }
00225       return;
00226 
00227     }
00228 
00229   }
00230 
00231   int
00232   getBinME(MonitorElement *me, const EEDetId &id)
00233   {
00234     if( !me ) return -1;
00235     int kind = me->kind();
00236     if( kind < MonitorElement::DQM_KIND_TH2F || 
00237         kind == MonitorElement::DQM_KIND_TPROFILE ||
00238         kind == MonitorElement::DQM_KIND_TH3F ) return -1;
00239 
00240     const MeInfo *info = MeInfoMap::get( me );
00241     if( !info ) return -1;
00242 
00243     int ix = id.ix();
00244     int iy = id.iy();
00245     int zside = id.zside();
00246     int nx;
00247     int ism = info->ism;
00248 
00249     if(info->otype == kSM){
00250 
00251       if(zside > 0){
00252         ix -= Numbers::ix0EE(ism);
00253         iy -= Numbers::iy0EE(ism);
00254       }else{
00255         ix = 101 - ix - Numbers::ix0EE(ism);
00256         iy -= Numbers::iy0EE(ism);
00257       }
00258       nx = 50;
00259 
00260     }else{
00261 
00262       switch(info->otype){
00263       case kFullEE:
00264         if(zside > 0) ix += 100;
00265         nx = 200;
00266         break;
00267       case kEEp:
00268         if(zside < 0) return -1;
00269         nx = 100;
00270         break;
00271       case kEEm:
00272         if(zside > 0) return -1;
00273         nx = 100;
00274         break;
00275       case kEEpFar:
00276         if(zside < 0 || ix > 50) return -1;
00277         nx = 50;
00278         break;
00279       case kEEpNear:
00280         if(zside < 0 || ix < 51) return -1;
00281         ix -= 50;
00282         nx = 50;
00283         break;
00284       case kEEmFar:
00285         if(zside > 0 || ix > 50) return -1;
00286         nx = 50;
00287         break;
00288       case kEEmNear:
00289         if(zside > 0 || ix < 51) return -1;
00290         ix -= 50;
00291         nx = 50;
00292         break;
00293       default:
00294         return -1;
00295       }
00296 
00297     }
00298 
00299     int scale = info->btype == kSuperCrystal ? 5 : 1;
00300     ix = (ix - 1) / scale + 1;
00301     iy = (iy - 1) / scale + 1;
00302     nx = nx / scale;
00303 
00304     return iy * (nx + 2) + ix;
00305   }
00306 
00307   int
00308   getBinME(MonitorElement *me, const EcalScDetId &id)
00309   {
00310     if( !me ) return -1;
00311     int kind = me->kind();
00312     if( kind < MonitorElement::DQM_KIND_TH2F || 
00313         kind == MonitorElement::DQM_KIND_TPROFILE ||
00314         kind == MonitorElement::DQM_KIND_TH3F ) return -1;
00315 
00316     const MeInfo *info = MeInfoMap::get( me );
00317     if( !info ) return -1;
00318 
00319     if(info->btype != kSuperCrystal) return -1;
00320 
00321     int ix = id.ix();
00322     int iy = id.iy();
00323     int zside = id.zside();
00324     int nx;
00325     int ism = info->ism;
00326 
00327     if(info->otype == kSM){
00328 
00329       if(zside > 0){
00330         ix -= Numbers::ix0EE(ism) / 5;
00331         iy -= Numbers::iy0EE(ism) / 5;
00332       }else{
00333         ix = 21 - ix - Numbers::ix0EE(ism) / 5;
00334         iy -= Numbers::iy0EE(ism) / 5;
00335       }
00336       nx = 10;
00337 
00338     }else{
00339 
00340       switch(info->otype){
00341       case kFullEE:
00342         if(zside > 0) ix += 20;
00343         nx = 40;
00344         break;
00345       case kEEp:
00346         if(zside < 0) return -1;
00347         nx = 20;
00348         break;
00349       case kEEm:
00350         if(zside > 0) return -1;
00351         nx = 20;
00352         break;
00353       case kEEpFar:
00354         if(zside < 0 || ix > 10) return -1;
00355         nx = 10;
00356         break;
00357       case kEEpNear:
00358         if(zside < 0 || ix < 11) return -1;
00359         ix -= 10;
00360         nx = 10;
00361         break;
00362       case kEEmFar:
00363         if(zside > 0 || ix > 10) return -1;
00364         nx = 10;
00365         break;
00366       case kEEmNear:
00367         if(zside > 0 || ix < 11) return -1;
00368         ix -= 10;
00369         nx = 10;
00370         break;
00371       default:
00372         return -1;
00373       }
00374 
00375     }
00376 
00377     return iy * (nx + 2) + ix;
00378 
00379   }
00380 
00381   // the choices are either dynamic_casting or overloading. prefer overload in the interest of overhead reduction
00382   double
00383   getBinContentME(MonitorElement *me, const EEDetId &id)
00384   {
00385     if( !me ) return 0.;
00386     if( me->kind() < MonitorElement::DQM_KIND_TH1F ) return 0.;
00387 
00388     return ((TH1 *)me->getRootObject())->GetBinContent( getBinME( me, id ) );
00389   }
00390 
00391   double
00392   getBinContentME(MonitorElement *me, const EcalScDetId &id)
00393   {
00394     if( !me ) return 0.;
00395     if( me->kind() < MonitorElement::DQM_KIND_TH1F ) return 0.;
00396 
00397     return ((TH1 *)me->getRootObject())->GetBinContent( getBinME( me, id ) );
00398   }
00399 
00400   double
00401   getBinContentME(MonitorElement *me, const EcalTrigTowerDetId &id)
00402   {
00403     if( !me ) return 0.;
00404     if( me->kind() < MonitorElement::DQM_KIND_TH1F ) return 0.;
00405 
00406     const MeInfo *info = MeInfoMap::get( me );
00407     if( !info || info->btype != kTriggerTower ) return 0.;
00408 
00409     std::vector<DetId> *crystals = Numbers::crystals( id );
00410     if( !crystals->size() ) return 0.;
00411 
00412     return ((TH1 *)me->getRootObject())->GetBinContent( getBinME( me, EEDetId( crystals->at(0) ) ) );
00413   }
00414 
00415   double
00416   getBinErrorME(MonitorElement *me, const EEDetId &id)
00417   {
00418     if( !me ) return 0.;
00419     if( me->kind() < MonitorElement::DQM_KIND_TH1F ) return 0.;
00420 
00421     return ((TH1 *)me->getRootObject())->GetBinError( getBinME( me, id ) );
00422   }
00423 
00424   double
00425   getBinErrorME(MonitorElement *me, const EcalScDetId &id)
00426   {
00427     if( !me ) return 0.;
00428     if( me->kind() < MonitorElement::DQM_KIND_TH1F ) return 0.;
00429 
00430     return ((TH1 *)me->getRootObject())->GetBinError( getBinME( me, id ) );
00431   }
00432 
00433   double
00434   getBinErrorME(MonitorElement *me, const EcalTrigTowerDetId &id)
00435   {
00436     if( !me ) return 0.;
00437     if( me->kind() < MonitorElement::DQM_KIND_TH1F ) return 0.;
00438 
00439     const MeInfo *info = MeInfoMap::get( me );
00440     if( !info || info->btype != kTriggerTower ) return 0.;
00441 
00442     std::vector<DetId> *crystals = Numbers::crystals( id );
00443     if( !crystals->size() ) return 0.;
00444 
00445     return ((TH1 *)me->getRootObject())->GetBinError( getBinME( me, EEDetId( crystals->at(0) ) ) );
00446   }
00447 
00448   double
00449   getBinEntriesME(MonitorElement *me, const EEDetId &id)
00450   {
00451     if( !me ) return 0.;
00452     if( me->kind() != MonitorElement::DQM_KIND_TPROFILE2D ) return 0.;
00453 
00454     return ((TProfile2D *)me->getRootObject())->GetBinEntries( getBinME( me, id ) );
00455   }
00456 
00457   double
00458   getBinEntriesME(MonitorElement *me, const EcalScDetId &id)
00459   {
00460     if( !me ) return 0.;
00461     if( me->kind() != MonitorElement::DQM_KIND_TPROFILE2D ) return 0.;
00462 
00463     return ((TProfile2D *)me->getRootObject())->GetBinEntries( getBinME( me, id ) );
00464   }
00465 
00466   double
00467   getBinEntriesME(MonitorElement *me, const EcalTrigTowerDetId &id)
00468   {
00469     if( !me ) return 0.;
00470     if( me->kind() != MonitorElement::DQM_KIND_TPROFILE2D ) return 0.;
00471 
00472     const MeInfo *info = MeInfoMap::get( me );
00473     if( !info || info->btype != kTriggerTower ) return 0.;
00474 
00475     std::vector<DetId> *crystals = Numbers::crystals( id );
00476     if( !crystals->size() ) return 0.;
00477 
00478 
00479     return ((TProfile2D *)me->getRootObject())->GetBinEntries( getBinME( me, EEDetId( crystals->at(0) ) ) );
00480   }
00481 
00482   void
00483   setBinContentME(MonitorElement *me, const EEDetId &id, double content)
00484   {
00485     if( !me ) return;
00486     if( me->kind() < MonitorElement::DQM_KIND_TH1F ) return;
00487 
00488     const MeInfo *info = MeInfoMap::get( me );
00489     if( !info ) return;
00490 
00491     if(info->btype == kCrystal){
00492 
00493       ((TH1 *)me->getRootObject())->SetBinContent( getBinME( me, id ), content );
00494       return;
00495 
00496     }else if(info->btype == kSuperCrystal){
00497 
00498       EcalScDetId scid( Numbers::getEcalScDetId( id ) );
00499       ((TH1 *)me->getRootObject())->SetBinContent( getBinME( me, id ), content );
00500       return;
00501 
00502     }else if(info->btype == kTriggerTower){
00503 
00504       const EcalElectronicsMapping *map = Numbers::getElectronicsMapping();
00505       EcalTriggerElectronicsId teid( map->getTriggerElectronicsId( id ) );
00506       std::vector<DetId> vcry = map->ttConstituents( teid.tccId(), teid.ttId() );
00507       for(unsigned u = 0; u < vcry.size(); u++)
00508         ((TH1 *)me->getRootObject())->SetBinContent( getBinME( me, EEDetId(vcry[u]) ), content );
00509       return;
00510 
00511     }
00512   }
00513 
00514   void
00515   setBinContentME(MonitorElement *me, const EcalScDetId &id, double content)
00516   {
00517     if( !me ) return;
00518     if( me->kind() < MonitorElement::DQM_KIND_TH1F ) return;
00519 
00520     const MeInfo *info = MeInfoMap::get( me );
00521     if( !info ) return;
00522 
00523     if(info->btype == kCrystal){
00524 
00525       const EcalElectronicsMapping *map = Numbers::getElectronicsMapping();
00526       std::pair<int,int> p = map->getDCCandSC( id );
00527       std::vector<DetId> vcry = map->dccTowerConstituents( p.first, p.second );
00528       for(unsigned u = 0; u < vcry.size(); u++)
00529         ((TH1 *)me->getRootObject())->SetBinContent( getBinME( me, EEDetId(vcry[u]) ), content );
00530       return;
00531 
00532     }else if(info->btype == kSuperCrystal){
00533 
00534       ((TH1 *)me->getRootObject())->SetBinContent( getBinME( me, id ), content );
00535       return;
00536 
00537     }
00538   }
00539 
00540   void
00541   setBinContentME(MonitorElement *me, const EcalTrigTowerDetId &id, double content)
00542   {
00543     if( !me ) return;
00544     if( me->kind() < MonitorElement::DQM_KIND_TH1F ) return;
00545 
00546     const MeInfo *info = MeInfoMap::get( me );
00547     if( !info ) return;
00548 
00549     if(info->btype == kCrystal || info->btype == kTriggerTower){
00550 
00551       std::vector<DetId> *crystals = Numbers::crystals( id );
00552       for(unsigned u = 0; u < crystals->size(); u++)
00553         ((TH1 *)me->getRootObject())->SetBinContent( getBinME( me, EEDetId(crystals->at(u)) ), content );
00554       return;
00555 
00556     }
00557   }
00558 
00559   void
00560   setBinErrorME(MonitorElement *me, const EEDetId &id, double error)
00561   {
00562     if( !me ) return;
00563     if( me->kind() < MonitorElement::DQM_KIND_TH1F ) return;
00564 
00565     const MeInfo *info = MeInfoMap::get( me );
00566     if( !info ) return;
00567 
00568     if(info->btype == kCrystal){
00569 
00570       ((TH1 *)me->getRootObject())->SetBinError( getBinME( me, id ), error );
00571       return;
00572 
00573     }else if(info->btype == kSuperCrystal){
00574 
00575       EcalScDetId scid( Numbers::getEcalScDetId( id ) );
00576       ((TH1 *)me->getRootObject())->SetBinError( getBinME( me, id ), error );
00577       return;
00578 
00579     }else if(info->btype == kTriggerTower){
00580 
00581       const EcalElectronicsMapping *map = Numbers::getElectronicsMapping();
00582       EcalTriggerElectronicsId teid( map->getTriggerElectronicsId( id ) );
00583       std::vector<DetId> vcry = map->ttConstituents( teid.tccId(), teid.ttId() );
00584       for(unsigned u = 0; u < vcry.size(); u++)
00585         ((TH1 *)me->getRootObject())->SetBinError( getBinME( me, EEDetId(vcry[u]) ), error );
00586       return;
00587 
00588     }
00589   }
00590 
00591   void
00592   setBinErrorME(MonitorElement *me, const EcalScDetId &id, double error)
00593   {
00594     if( !me ) return;
00595     if( me->kind() < MonitorElement::DQM_KIND_TH1F ) return;
00596 
00597     const MeInfo *info = MeInfoMap::get( me );
00598     if( !info ) return;
00599 
00600     if(info->btype == kCrystal){
00601 
00602       const EcalElectronicsMapping *map = Numbers::getElectronicsMapping();
00603       std::pair<int,int> p = map->getDCCandSC( id );
00604       std::vector<DetId> vcry = map->dccTowerConstituents( p.first, p.second );
00605       for(unsigned u = 0; u < vcry.size(); u++)
00606         ((TH1 *)me->getRootObject())->SetBinError( getBinME( me, EEDetId(vcry[u]) ), error );
00607       return;
00608 
00609     }else if(info->btype == kSuperCrystal){
00610 
00611       ((TH1 *)me->getRootObject())->SetBinError( getBinME( me, id ), error );
00612       return;
00613 
00614     }
00615   }
00616 
00617   void
00618   setBinErrorME(MonitorElement *me, const EcalTrigTowerDetId &id, double error)
00619   {
00620     if( !me ) return;
00621     if( me->kind() < MonitorElement::DQM_KIND_TH1F ) return;
00622 
00623     const MeInfo *info = MeInfoMap::get( me );
00624     if( !info ) return;
00625 
00626     if(info->btype == kCrystal || info->btype == kTriggerTower){
00627 
00628       std::vector<DetId> *crystals = Numbers::crystals( id );
00629       for(unsigned u = 0; u < crystals->size(); u++)
00630         ((TH1 *)me->getRootObject())->SetBinError( getBinME( me, EEDetId(crystals->at(u)) ), error );
00631       return;
00632 
00633     }
00634   }
00635 
00636   void
00637   setBinEntriesME(MonitorElement *me, const EEDetId &id, double entries)
00638   {
00639     if( !me ) return;
00640     if( me->kind() != MonitorElement::DQM_KIND_TPROFILE2D ) return;
00641 
00642     const MeInfo *info = MeInfoMap::get( me );
00643     if( !info ) return;
00644 
00645     if(info->btype == kCrystal){
00646 
00647       ((TProfile2D *)me->getRootObject())->SetBinEntries( getBinME( me, id ), entries );
00648       return;
00649 
00650     }else if(info->btype == kSuperCrystal){
00651 
00652       EcalScDetId scid( Numbers::getEcalScDetId( id ) );
00653       ((TProfile2D *)me->getRootObject())->SetBinError( getBinME( me, id ), entries );
00654       return;
00655 
00656     }else if(info->btype == kTriggerTower){
00657 
00658       const EcalElectronicsMapping *map = Numbers::getElectronicsMapping();
00659       EcalTriggerElectronicsId teid( map->getTriggerElectronicsId( id ) );
00660       std::vector<DetId> vcry = map->ttConstituents( teid.tccId(), teid.ttId() );
00661       for(unsigned u = 0; u < vcry.size(); u++)
00662         ((TProfile2D *)me->getRootObject())->SetBinError( getBinME( me, EEDetId(vcry[u]) ), entries );
00663       return;
00664 
00665     }
00666 
00667   }
00668 
00669   void
00670   setBinEntriesME(MonitorElement *me, const EcalScDetId &id, double entries)
00671   {
00672     if( !me ) return;
00673     if( me->kind() != MonitorElement::DQM_KIND_TPROFILE2D ) return;
00674 
00675     const MeInfo *info = MeInfoMap::get( me );
00676     if( !info ) return;
00677 
00678     if(info->btype == kCrystal){
00679 
00680       const EcalElectronicsMapping *map = Numbers::getElectronicsMapping();
00681       std::pair<int,int> p = map->getDCCandSC( id );
00682       std::vector<DetId> vcry = map->dccTowerConstituents( p.first, p.second );
00683       for(unsigned u = 0; u < vcry.size(); u++)
00684         ((TProfile2D *)me->getRootObject())->SetBinEntries( getBinME( me, EEDetId(vcry[u]) ), entries );
00685       return;
00686 
00687     }else if(info->btype == kSuperCrystal){
00688 
00689       ((TProfile2D *)me->getRootObject())->SetBinError( getBinME( me, id ), entries );
00690       return;
00691 
00692     }
00693   }
00694 
00695   void
00696   setBinEntriesME(MonitorElement *me, const EcalTrigTowerDetId &id, double entries)
00697   {
00698     if( !me ) return;
00699     if( me->kind() != MonitorElement::DQM_KIND_TPROFILE2D ) return;
00700 
00701     const MeInfo *info = MeInfoMap::get( me );
00702     if( !info ) return;
00703 
00704     if(info->btype == kCrystal || info->btype == kTriggerTower){
00705 
00706       std::vector<DetId> *crystals = Numbers::crystals( id );
00707       for(unsigned u = 0; u < crystals->size(); u++)
00708         ((TProfile2D *)me->getRootObject())->SetBinError( getBinME( me, EEDetId(crystals->at(u)) ), entries );
00709       return;
00710 
00711     }
00712   }
00713 
00714 }