55 if ( verbose )
std::cout <<
"Initializing EcalElectronicsMapping ..." << std::endl;
61 Numbers::map = handle.
product();
65 Numbers::mapTT = handleTT.
product();
69 Numbers::geometry = handleGeom.
product();
71 if ( verbose )
std::cout <<
"done." << std::endl;
82 if( ism >= 1 && ism <= 18 )
return( -ism );
85 if( ism >= 19 && ism <= 36 )
return( +ism - 18 );
87 throw cms::Exception(
"InvalidParameter") <<
"Wrong SM id determination: iSM = " <<
ism;
100 s <<
"EB" << std::setw(3) << std::setfill(
'0')
101 << std::setiosflags( std::ios::showpos )
102 << std::setiosflags( std::ios::internal )
104 << std::resetiosflags( std::ios::showpos )
105 << std::resetiosflags( std::ios::internal );
117 if( ism == 1 )
return( -7 );
118 if( ism == 2 )
return( -8 );
119 if( ism == 3 )
return( -9 );
120 if( ism == 4 )
return( -1 );
121 if( ism == 5 )
return( -2 );
122 if( ism == 6 )
return( -3 );
123 if( ism == 7 )
return( -4 );
124 if( ism == 8 )
return( -5 );
125 if( ism == 9 )
return( -6 );
128 if( ism == 10 )
return( +7 );
129 if( ism == 11 )
return( +8 );
130 if( ism == 12 )
return( +9 );
131 if( ism == 13 )
return( +1 );
132 if( ism == 14 )
return( +2 );
133 if( ism == 15 )
return( +3 );
134 if( ism == 16 )
return( +4 );
135 if( ism == 17 )
return( +5 );
136 if( ism == 18 )
return( +6 );
138 throw cms::Exception(
"InvalidParameter") <<
"Wrong SM id determination: iSM = " <<
ism;
148 return(
id.subdet() );
158 return(
id.subdet() );
178 return(
id.subdet() );
188 return(
id.subdet() );
211 if ( idcc >= 1 && idcc <= 9 )
return(
EcalEndcap );
214 if ( idcc >= 10 && idcc <= 45 )
return(
EcalBarrel);
217 if ( idcc >= 46 && idcc <= 54 )
return(
EcalEndcap );
219 throw cms::Exception(
"InvalidParameter") <<
"Wrong DCC id: dcc = " << idcc;
231 std::ostringstream
s;
232 s <<
"EE" << std::setw(3) << std::setfill(
'0')
233 << std::setiosflags( std::ios::showpos )
234 << std::setiosflags( std::ios::internal )
236 << std::resetiosflags( std::ios::showpos )
237 << std::resetiosflags( std::ios::internal );
251 if( ism >= 1 && ism <= 18 )
return( ism+18 );
253 if( ism >= 19 && ism <= 36 )
return( ism-18 );
259 if( ism >= 1 && ism <= 9 )
return( ism+9 );
261 if (ism >= 10 && ism <= 18 )
return( ism-9 );
267 throw cms::Exception(
"InvalidParameter") <<
"Invalid subdetector: subdet = " << subdet;
277 if( !Numbers::map )
throw cms::Exception(
"ObjectUnavailable") <<
"ECAL Geometry not available";
280 int idcc = eid.
dccId();
283 if( idcc >= 10 && idcc <= 45 )
return( idcc - 9 );
285 throw cms::Exception(
"InvalidParameter") <<
"Wrong DCC id: dcc = " << idcc;
296 if( !Numbers::map )
throw cms::Exception(
"ObjectUnavailable") <<
"ECAL Geometry not available";
299 int idcc = eid.
dccId();
302 if( idcc >= 1 && idcc <= 9 )
return( idcc );
305 if( idcc >= 46 && idcc <= 54 )
return( idcc - 45 + 9 );
307 throw cms::Exception(
"InvalidParameter") <<
"Wrong DCC id: dcc = " << idcc;
317 if( !Numbers::map )
throw cms::Exception(
"ObjectUnavailable") <<
"ECAL Geometry not available";
323 int idcc = Numbers::map->
DCCid(
id);
326 if( idcc >= 10 && idcc <= 45 )
return( idcc - 9 );
328 throw cms::Exception(
"InvalidParameter") <<
"Wrong DCC id: dcc = " << idcc;
332 int idcc = Numbers::map->
DCCid(
id);
335 if( idcc >= 1 && idcc <= 9 )
return( idcc );
338 if( idcc >= 46 && idcc <= 54 )
return( idcc - 45 + 9 );
340 throw cms::Exception(
"InvalidParameter") <<
"Wrong DCC id: dcc = " << idcc;
344 throw cms::Exception(
"InvalidParameter") <<
"Invalid subdetector: subdet = " << subdet;
354 int idcc =
id.dccId();
357 if( idcc >= 1 && idcc <= 9 )
return( idcc );
360 if( idcc >= 10 && idcc <= 45 )
return( idcc - 9 );
363 if( idcc >= 46 && idcc <= 54 )
return( idcc - 45 + 9 );
365 throw cms::Exception(
"InvalidParameter") <<
"Wrong DCC id: dcc = " << idcc;
375 int idcc =
id.iDCCId();
378 if( idcc >= 1 && idcc <= 9 )
return( idcc );
381 if( idcc >= 10 && idcc <= 45 )
return( idcc - 9 );
384 if( idcc >= 46 && idcc <= 54 )
return( idcc - 45 + 9 );
386 throw cms::Exception(
"InvalidParameter") <<
"Wrong DCC id: dcc = " << idcc;
396 std::pair<int, int> dccsc = Numbers::map->
getDCCandSC(
id );
398 int idcc = dccsc.first;
401 if( idcc >= 1 && idcc <= 9 )
return( idcc );
404 if( idcc >= 10 && idcc <= 45 )
return( idcc - 9 );
407 if( idcc >= 46 && idcc <= 54 )
return( idcc - 45 + 9 );
409 throw cms::Exception(
"InvalidParameter") <<
"Wrong DCC id: dcc = " << idcc;
422 if( idcc >= 1 && idcc <= 9 )
return( idcc );
425 if( idcc >= 10 && idcc <= 45 )
return( idcc - 9 );
428 if( idcc >= 46 && idcc <= 54 )
return( idcc - 45 + 9 );
430 throw cms::Exception(
"InvalidParameter") <<
"Wrong DCC id: dcc = " << idcc;
440 std::pair<int, int> dccsc = Numbers::map->
getDCCandSC(
id );
442 return static_cast<unsigned>(dccsc.second);
454 int iet = 1 + ((i1-1)/5);
455 int ipt = 1 + ((i2-1)/5);
457 return( (ipt-1) + 4*(iet-1) + 1 );
461 if( !Numbers::map )
throw( std::runtime_error(
"ECAL Geometry not available" ) );
467 if( ism >= 1 && ism <= 9 ) iz = -1;
468 if( ism >= 10 && ism <= 18 ) iz = +1;
474 return( static_cast<unsigned>( eid.
towerId() ));
478 throw cms::Exception(
"InvalidParameter") <<
"Invalid subdetector: subdet = " << subdet;
494 if( !Numbers::mapTT )
throw cms::Exception(
"ObjectUnavailable") <<
"ECAL Geometry not available";
500 if( ism >= 1 && ism <= 9 ) iz = -1;
501 if( ism >= 10 && ism <= 18 ) iz = +1;
507 return( static_cast<unsigned>(
iTT(towid) ) );
511 throw cms::Exception(
"InvalidParameter") <<
"Invalid subdetector: subdet = " << subdet;
521 if( !Numbers::map )
throw cms::Exception(
"ObjectUnavailable") <<
"ECAL Geometry not available";
527 throw cms::Exception(
"InvalidParameter") <<
"Invalid subdetector: subdet = " << subdet;
537 if( !Numbers::mapTT )
throw cms::Exception(
"ObjectUnavailable") <<
"ECAL Geometry not available";
545 return( static_cast<unsigned>( Numbers::map->TCCid(towid) ) );
551 if( ism >= 1 && ism <= 9 ) iz = -1;
552 if( ism >= 10 && ism <= 18 ) iz = +1;
558 return( static_cast<unsigned>( Numbers::map->TCCid(towid) ) );
562 throw cms::Exception(
"InvalidSubdetector") <<
"subdet = " << subdet;
572 if( !Numbers::map )
throw cms::Exception(
"ObjectUnavailable") <<
"ECAL Geometry not available";
576 if( subdet ==
EcalBarrel || subdet ==
EcalEndcap )
return( static_cast<unsigned>( Numbers::map->TCCid(
id) ) );
578 throw cms::Exception(
"InvalidParameter") <<
"Invalid subdetector: subdet = " << subdet;
588 if( !Numbers::map )
throw cms::Exception(
"ObjectUnavailable") <<
"ECAL Geometry not available";
590 int itcc = Numbers::map->
TCCid(
id);
591 int itt = Numbers::map->
iTT(
id);
593 unsigned index = 100*(itcc-1) + (itt-1);
612 int ie = (ic-1)/20 + 1;
613 int ip = (ic-1)%20 + 1;
615 if( ie > 5 && ip < 11 )
return 1;
632 if ( ism == 8 && ix > 50 )
return 1;
635 if ( ism == 17 && ix > 50 )
return 1;
647 if( !Numbers::map )
throw cms::Exception(
"ObjectUnavailable") <<
"ECAL Geometry not available";
649 int idcc =
id.dccId();
650 int isc =
id.towerId();
662 if( !Numbers::map )
throw cms::Exception(
"ObjectUnavailable") <<
"ECAL Geometry not available";
664 unsigned index = 100*(idcc-1) + (isc-1);
682 if( !Numbers::map )
throw cms::Exception(
"ObjectUnavailable") <<
"ECAL Geometry not available";
686 int idcc = eid.
dccId();
689 const std::vector<EcalScDetId> ids = Numbers::map->
getEcalScDetId( idcc, isc,
true );
701 unsigned ic = (ip-1) + 20*(ie-1) + 1;
717 if( ism >= 1 && ism <= 9 ) iz = -1;
718 if( ism >= 10 && ism <= 18 ) iz = +1;
722 return( 1000*ix + iy );
742 if( !Numbers::map )
throw cms::Exception(
"ObjectUnavailable") <<
"ECAL Geometry not available";
746 if( ism >= 1 && ism <= 9 ) iz = -1;
747 if( ism >= 10 && ism <= 18 ) iz = +1;
755 int channel = eid.
xtalId();
758 if( ism == 8 || ism == 17 ) {
759 if( vfe > 17 ) vfe = vfe - 7;
762 unsigned ic = (vfe-1)*25 + (strip-1)*5 + channel;
776 if( ism == 1 || ism == 15 )
return( - 5 );
777 if( ism == 2 || ism == 14 )
return( + 0 );
778 if( ism == 3 || ism == 13 )
return( + 10 );
779 if( ism == 4 || ism == 12 )
return( + 40 );
780 if( ism == 5 || ism == 11 )
return( + 50 );
781 if( ism == 6 || ism == 10 )
return( + 55 );
782 if( ism == 7 || ism == 18 )
return( + 50 );
783 if( ism == 8 || ism == 17 )
return( + 25 );
784 if( ism == 9 || ism == 16 )
return( + 0 );
815 if( ism == 1 || ism == 10 )
return( + 20 );
816 if( ism == 2 || ism == 11 )
return( + 45 );
817 if( ism == 3 || ism == 12 )
return( + 55 );
818 if( ism == 4 || ism == 13 )
return( + 55 );
819 if( ism == 5 || ism == 14 )
return( + 45 );
820 if( ism == 6 || ism == 15 )
return( + 20 );
821 if( ism == 7 || ism == 16 )
return( + 0 );
822 if( ism == 8 || ism == 17 )
return( - 5 );
823 if( ism == 9 || ism == 18 )
return( + 0 );
837 if( ism >= 1 && ism <= 9 ) iz = -1;
838 if( ism >= 10 && ism <= 18 ) iz = +1;
860 if( ism >= 1 && ism <= 9 ) iz = -1;
861 if( ism >= 10 && ism <= 18 ) iz = +1;
912 for(vector<DetId>::iterator cItr(
crystals.begin()); cItr !=
crystals.end(); ++cItr)
922 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)