52 if ( verbose )
std::cout <<
"Initializing EcalElectronicsMapping ..." << std::endl;
58 Numbers::map = handle.
product();
62 Numbers::mapTT = handleTT.
product();
66 Numbers::geometry = handleGeom.
product();
68 if ( verbose )
std::cout <<
"done." << std::endl;
79 if( ism >= 1 && ism <= 18 )
return( -ism );
82 if( ism >= 19 && ism <= 36 )
return( +ism - 18 );
84 throw cms::Exception(
"InvalidParameter") <<
"Wrong SM id determination: iSM = " <<
ism;
97 s <<
"EB" << std::setw(3) << std::setfill(
'0')
98 << std::setiosflags( std::ios::showpos )
99 << std::setiosflags( std::ios::internal )
101 << std::resetiosflags( std::ios::showpos )
102 << std::resetiosflags( std::ios::internal );
114 if( ism == 1 )
return( -7 );
115 if( ism == 2 )
return( -8 );
116 if( ism == 3 )
return( -9 );
117 if( ism == 4 )
return( -1 );
118 if( ism == 5 )
return( -2 );
119 if( ism == 6 )
return( -3 );
120 if( ism == 7 )
return( -4 );
121 if( ism == 8 )
return( -5 );
122 if( ism == 9 )
return( -6 );
125 if( ism == 10 )
return( +7 );
126 if( ism == 11 )
return( +8 );
127 if( ism == 12 )
return( +9 );
128 if( ism == 13 )
return( +1 );
129 if( ism == 14 )
return( +2 );
130 if( ism == 15 )
return( +3 );
131 if( ism == 16 )
return( +4 );
132 if( ism == 17 )
return( +5 );
133 if( ism == 18 )
return( +6 );
135 throw cms::Exception(
"InvalidParameter") <<
"Wrong SM id determination: iSM = " <<
ism;
145 return(
id.subdet() );
155 return(
id.subdet() );
175 return(
id.subdet() );
185 return(
id.subdet() );
208 if ( idcc >= 1 && idcc <= 9 )
return(
EcalEndcap );
211 if ( idcc >= 10 && idcc <= 45 )
return(
EcalBarrel);
214 if ( idcc >= 46 && idcc <= 54 )
return(
EcalEndcap );
216 throw cms::Exception(
"InvalidParameter") <<
"Wrong DCC id: dcc = " << idcc;
228 std::ostringstream
s;
229 s <<
"EE" << std::setw(3) << std::setfill(
'0')
230 << std::setiosflags( std::ios::showpos )
231 << std::setiosflags( std::ios::internal )
233 << std::resetiosflags( std::ios::showpos )
234 << std::resetiosflags( std::ios::internal );
248 if( ism >= 1 && ism <= 18 )
return( ism+18 );
250 if( ism >= 19 && ism <= 36 )
return( ism-18 );
256 if( ism >= 1 && ism <= 9 )
return( ism+9 );
258 if (ism >= 10 && ism <= 18 )
return( ism-9 );
264 throw cms::Exception(
"InvalidParameter") <<
"Invalid subdetector: subdet = " << subdet;
274 if( !Numbers::map )
throw cms::Exception(
"ObjectUnavailable") <<
"ECAL Geometry not available";
277 int idcc = eid.
dccId();
280 if( idcc >= 10 && idcc <= 45 )
return( idcc - 9 );
282 throw cms::Exception(
"InvalidParameter") <<
"Wrong DCC id: dcc = " << idcc;
293 if( !Numbers::map )
throw cms::Exception(
"ObjectUnavailable") <<
"ECAL Geometry not available";
296 int idcc = eid.
dccId();
299 if( idcc >= 1 && idcc <= 9 )
return( idcc );
302 if( idcc >= 46 && idcc <= 54 )
return( idcc - 45 + 9 );
304 throw cms::Exception(
"InvalidParameter") <<
"Wrong DCC id: dcc = " << idcc;
314 if( !Numbers::map )
throw cms::Exception(
"ObjectUnavailable") <<
"ECAL Geometry not available";
320 int idcc = Numbers::map->
DCCid(
id);
323 if( idcc >= 10 && idcc <= 45 )
return( idcc - 9 );
325 throw cms::Exception(
"InvalidParameter") <<
"Wrong DCC id: dcc = " << idcc;
329 int idcc = Numbers::map->
DCCid(
id);
332 if( idcc >= 1 && idcc <= 9 )
return( idcc );
335 if( idcc >= 46 && idcc <= 54 )
return( idcc - 45 + 9 );
337 throw cms::Exception(
"InvalidParameter") <<
"Wrong DCC id: dcc = " << idcc;
341 throw cms::Exception(
"InvalidParameter") <<
"Invalid subdetector: subdet = " << subdet;
351 int idcc =
id.dccId();
354 if( idcc >= 1 && idcc <= 9 )
return( idcc );
357 if( idcc >= 10 && idcc <= 45 )
return( idcc - 9 );
360 if( idcc >= 46 && idcc <= 54 )
return( idcc - 45 + 9 );
362 throw cms::Exception(
"InvalidParameter") <<
"Wrong DCC id: dcc = " << idcc;
372 int idcc =
id.iDCCId();
375 if( idcc >= 1 && idcc <= 9 )
return( idcc );
378 if( idcc >= 10 && idcc <= 45 )
return( idcc - 9 );
381 if( idcc >= 46 && idcc <= 54 )
return( idcc - 45 + 9 );
383 throw cms::Exception(
"InvalidParameter") <<
"Wrong DCC id: dcc = " << idcc;
393 std::pair<int, int> dccsc = Numbers::map->
getDCCandSC(
id );
395 int idcc = dccsc.first;
398 if( idcc >= 1 && idcc <= 9 )
return( idcc );
401 if( idcc >= 10 && idcc <= 45 )
return( idcc - 9 );
404 if( idcc >= 46 && idcc <= 54 )
return( idcc - 45 + 9 );
406 throw cms::Exception(
"InvalidParameter") <<
"Wrong DCC id: dcc = " << idcc;
419 if( idcc >= 1 && idcc <= 9 )
return( idcc );
422 if( idcc >= 10 && idcc <= 45 )
return( idcc - 9 );
425 if( idcc >= 46 && idcc <= 54 )
return( idcc - 45 + 9 );
427 throw cms::Exception(
"InvalidParameter") <<
"Wrong DCC id: dcc = " << idcc;
437 std::pair<int, int> dccsc = Numbers::map->
getDCCandSC(
id );
439 return static_cast<unsigned>(dccsc.second);
451 int iet = 1 + ((i1-1)/5);
452 int ipt = 1 + ((i2-1)/5);
454 return( (ipt-1) + 4*(iet-1) + 1 );
458 if( !Numbers::map )
throw( std::runtime_error(
"ECAL Geometry not available" ) );
464 if( ism >= 1 && ism <= 9 ) iz = -1;
465 if( ism >= 10 && ism <= 18 ) iz = +1;
471 return( static_cast<unsigned>( eid.
towerId() ));
475 throw cms::Exception(
"InvalidParameter") <<
"Invalid subdetector: subdet = " << subdet;
491 if( !Numbers::mapTT )
throw cms::Exception(
"ObjectUnavailable") <<
"ECAL Geometry not available";
497 if( ism >= 1 && ism <= 9 ) iz = -1;
498 if( ism >= 10 && ism <= 18 ) iz = +1;
504 return( static_cast<unsigned>(
iTT(towid) ) );
508 throw cms::Exception(
"InvalidParameter") <<
"Invalid subdetector: subdet = " << subdet;
518 if( !Numbers::map )
throw cms::Exception(
"ObjectUnavailable") <<
"ECAL Geometry not available";
524 throw cms::Exception(
"InvalidParameter") <<
"Invalid subdetector: subdet = " << subdet;
534 if( !Numbers::mapTT )
throw cms::Exception(
"ObjectUnavailable") <<
"ECAL Geometry not available";
542 return( static_cast<unsigned>( Numbers::map->TCCid(towid) ) );
548 if( ism >= 1 && ism <= 9 ) iz = -1;
549 if( ism >= 10 && ism <= 18 ) iz = +1;
555 return( static_cast<unsigned>( Numbers::map->TCCid(towid) ) );
559 throw cms::Exception(
"InvalidSubdetector") <<
"subdet = " << subdet;
569 if( !Numbers::map )
throw cms::Exception(
"ObjectUnavailable") <<
"ECAL Geometry not available";
573 if( subdet ==
EcalBarrel || subdet ==
EcalEndcap )
return( static_cast<unsigned>( Numbers::map->TCCid(
id) ) );
575 throw cms::Exception(
"InvalidParameter") <<
"Invalid subdetector: subdet = " << subdet;
585 if( !Numbers::map )
throw cms::Exception(
"ObjectUnavailable") <<
"ECAL Geometry not available";
587 int itcc = Numbers::map->
TCCid(
id);
588 int itt = Numbers::map->
iTT(
id);
590 unsigned index = 100*(itcc-1) + (itt-1);
609 int ie = (ic-1)/20 + 1;
610 int ip = (ic-1)%20 + 1;
612 if( ie > 5 && ip < 11 )
return 1;
629 if ( ism == 8 && ix > 50 )
return 1;
632 if ( ism == 17 && ix > 50 )
return 1;
644 if( !Numbers::map )
throw cms::Exception(
"ObjectUnavailable") <<
"ECAL Geometry not available";
646 int idcc =
id.dccId();
647 int isc =
id.towerId();
659 if( !Numbers::map )
throw cms::Exception(
"ObjectUnavailable") <<
"ECAL Geometry not available";
661 unsigned index = 100*(idcc-1) + (isc-1);
679 if( !Numbers::map )
throw cms::Exception(
"ObjectUnavailable") <<
"ECAL Geometry not available";
683 int idcc = eid.
dccId();
686 const std::vector<EcalScDetId> ids = Numbers::map->
getEcalScDetId( idcc, isc,
true );
698 unsigned ic = (ip-1) + 20*(ie-1) + 1;
714 if( ism >= 1 && ism <= 9 ) iz = -1;
715 if( ism >= 10 && ism <= 18 ) iz = +1;
719 return( 1000*ix + iy );
739 if( !Numbers::map )
throw cms::Exception(
"ObjectUnavailable") <<
"ECAL Geometry not available";
743 if( ism >= 1 && ism <= 9 ) iz = -1;
744 if( ism >= 10 && ism <= 18 ) iz = +1;
752 int channel = eid.
xtalId();
755 if( ism == 8 || ism == 17 ) {
756 if( vfe > 17 ) vfe = vfe - 7;
759 unsigned ic = (vfe-1)*25 + (strip-1)*5 + channel;
773 if( ism == 1 || ism == 15 )
return( - 5 );
774 if( ism == 2 || ism == 14 )
return( + 0 );
775 if( ism == 3 || ism == 13 )
return( + 10 );
776 if( ism == 4 || ism == 12 )
return( + 40 );
777 if( ism == 5 || ism == 11 )
return( + 50 );
778 if( ism == 6 || ism == 10 )
return( + 55 );
779 if( ism == 7 || ism == 18 )
return( + 50 );
780 if( ism == 8 || ism == 17 )
return( + 25 );
781 if( ism == 9 || ism == 16 )
return( + 0 );
812 if( ism == 1 || ism == 10 )
return( + 20 );
813 if( ism == 2 || ism == 11 )
return( + 45 );
814 if( ism == 3 || ism == 12 )
return( + 55 );
815 if( ism == 4 || ism == 13 )
return( + 55 );
816 if( ism == 5 || ism == 14 )
return( + 45 );
817 if( ism == 6 || ism == 15 )
return( + 20 );
818 if( ism == 7 || ism == 16 )
return( + 0 );
819 if( ism == 8 || ism == 17 )
return( - 5 );
820 if( ism == 9 || ism == 18 )
return( + 0 );
834 if( ism >= 1 && ism <= 9 ) iz = -1;
835 if( ism >= 10 && ism <= 18 ) iz = +1;
857 if( ism >= 1 && ism <= 9 ) iz = -1;
858 if( ism >= 10 && ism <= 18 ) iz = +1;
909 for(vector<DetId>::iterator cItr(
crystals.begin()); cItr !=
crystals.end(); ++cItr)
919 if( !Numbers::map )
throw cms::Exception(
"ObjectUnavailable") <<
"ECAL Geometry not available";
static bool validDetId(int ix, int iy, int iz)
static std::string sEE(const unsigned ism)
static const unsigned crystalsTCCArraySize_
static bool validEE(const unsigned ism, const unsigned ix, const unsigned iy)
int xtalId() const
get the channel id
static int iEE(const unsigned ism)
static int ix0EEm(const unsigned ism)
static unsigned icEE(const unsigned ism, const unsigned ix, const unsigned iy)
static unsigned nCCUs(const unsigned ism)
int stripId() const
get the tower id
std::vector< DetId > tccConstituents(int tccId) const
Get the constituent detids for this dccId.
Some "id" conversions.
static std::string sEB(const unsigned ism)
Ecal readout channel identification [32:20] Unused (so far) [19:13] DCC id [12:6] tower [5:3] strip [...
static bool validEESc(const unsigned ism, const unsigned ix, const unsigned iy)
Geom::Phi< T > phi() const
static unsigned nTTs(const unsigned itcc)
int towerId() const
get the tower id
static int ix0EE(const unsigned ism)
int iTT(const EcalTrigTowerDetId &id) const
returns the index of a Trigger Tower within its TCC.
static const int kCrystalsPerSM
static const EcalElectronicsMapping * getElectronicsMapping()
std::pair< int, int > getDCCandSC(EcalScDetId id) const
static unsigned icEB(const unsigned ism, const unsigned ix, const unsigned iy)
static std::vector< DetId > crystalsDCC_[crystalsDCCArraySize_]
static int iy0EE(const unsigned ism)
EcalTrigTowerDetId towerOf(const DetId &id) const
Get the tower id for this det id (or null if not known)
static const EcalElectronicsMapping * map
int TCCid(const EBDetId &id) const
returns the TCCid of an EBDetId
EcalElectronicsId getElectronicsId(const DetId &id) const
Get the electronics id for this det id.
static std::vector< DetId > * crystals(const EcalTrigTowerDetId &id)
static unsigned iTCC(const unsigned ism, const EcalSubdetector subdet, const unsigned i1, const unsigned i2)
static unsigned iSC(const EcalScDetId &id)
static unsigned indexEB(const unsigned ism, const unsigned ie, const unsigned ip)
const GlobalPoint & getPosition(const DetId &id) const
Get the position of a given detector id.
int dccId() const
get the DCC (Ecal Local DCC value not global one) id
static const int ETAPHIMODE
std::vector< EcalScDetId > getEcalScDetId(int DCCid, int DCC_Channel, bool ignoreSingleCrystal=true) const
std::vector< DetId > ttConstituents(int tccId, int tt) const
Get the constituent detids for this dccId.
static void initGeometry(const edm::EventSetup &setup, bool verbose=false)
static bool validDetId(int crystal_ix, int crystal_iy, int iz)
T const * product() const
int DCCid(const EBDetId &id) const
returns the DCC of an EBDetId
static float eta(const DetId &id)
static unsigned indexEE(const unsigned ism, const unsigned ix, const unsigned iy)
static unsigned iSM(const unsigned ism, const EcalSubdetector subdet)
static const EcalTrigTowerConstituentsMap * mapTT
static std::vector< DetId > crystalsTCC_[crystalsTCCArraySize_]
static const unsigned crystalsDCCArraySize_
static unsigned RtHalf(const EBDetId &id)
static const EcalScDetId getEcalScDetId(const EEDetId &id)
static int iEB(const unsigned ism)
static EcalSubdetector subDet(const EBDetId &id)
static const CaloGeometry * geometry
int ism(int ieta, int iphi)
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")
tuple size
Write out results.
static unsigned iTT(const unsigned ism, const EcalSubdetector subdet, const unsigned i1, const unsigned i2)
std::vector< DetId > dccTowerConstituents(int dccId, int tower) const
Get the constituent detids for this dccId.
static float phi(const DetId &id)