#include <Geometry/CaloTopology/interface/EcalTrigTowerConstituentsMap.h>
Public Member Functions | |
void | assign (const DetId &cell, const EcalTrigTowerDetId &tower) |
set the association between a DetId and a tower | |
std::vector< DetId > | constituentsOf (const EcalTrigTowerDetId &id) const |
Get the constituent detids for this tower id. | |
EcalTrigTowerConstituentsMap () | |
EcalTrigTowerDetId | towerOf (const DetId &id) const |
Get the tower id for this det id (or null if not known). | |
Private Types | |
typedef multi_index_container < MapItem, indexed_by < ordered_unique< member < MapItem, DetId, &MapItem::cell > >, ordered_non_unique< member < MapItem, EcalTrigTowerDetId, &MapItem::tower > > > > | EcalTowerMap |
typedef EcalTowerMap::nth_index < 0 >::type | EcalTowerMap_by_DetId |
typedef EcalTowerMap::nth_index < 1 >::type | EcalTowerMap_by_towerDetId |
Private Member Functions | |
DetId | changeEEDetIdQuadrantAndZ (const DetId &fromid, const int &toQuadrant, const int &tozside) const |
int | changeTowerQuadrant (int phiTower, int fromQuadrant, int toQuadrant) const |
DetId | wrapEcalTrigTowerDetId (const DetId &id) const |
Wrap a generic EcalTrigTowerDetId to the equivalent one in z+ Quadrant 1 (from 0 < phi < pi/2). | |
DetId | wrapEEDetId (const DetId &id) const |
Wrap a generic EEDetId to the equivalent one in z+ Quadrant 1 (from 0 < phi < pi/2). | |
Private Attributes | |
EcalTowerMap | m_items |
Classes | |
struct | MapItem |
Definition at line 23 of file EcalTrigTowerConstituentsMap.h.
typedef multi_index_container< MapItem, indexed_by< ordered_unique< member < MapItem,DetId,&MapItem::cell > >, ordered_non_unique< member < MapItem,EcalTrigTowerDetId,&MapItem::tower> > > > EcalTrigTowerConstituentsMap::EcalTowerMap [private] |
Definition at line 61 of file EcalTrigTowerConstituentsMap.h.
typedef EcalTowerMap::nth_index<0>::type EcalTrigTowerConstituentsMap::EcalTowerMap_by_DetId [private] |
Definition at line 63 of file EcalTrigTowerConstituentsMap.h.
typedef EcalTowerMap::nth_index<1>::type EcalTrigTowerConstituentsMap::EcalTowerMap_by_towerDetId [private] |
Definition at line 64 of file EcalTrigTowerConstituentsMap.h.
EcalTrigTowerConstituentsMap::EcalTrigTowerConstituentsMap | ( | ) |
void EcalTrigTowerConstituentsMap::assign | ( | const DetId & | cell, | |
const EcalTrigTowerDetId & | tower | |||
) |
set the association between a DetId and a tower
Definition at line 159 of file EcalTrigTowerConstituentsMap.cc.
References lat::endl(), Exception, m_items, and DetId::rawId().
Referenced by EcalTrigTowerConstituentsMapBuilder::parseTextMap().
00159 { 00160 if (m_items.find(cell)!=m_items.end()) { 00161 throw cms::Exception("EcalTrigTowers") << "Cell with id " << std::hex << cell.rawId() << std::dec << " is already mapped to a EcalTrigTower " << m_items.find(cell)->tower << std::endl; 00162 } 00163 00164 m_items.insert(MapItem(cell,tower)); 00165 }
DetId EcalTrigTowerConstituentsMap::changeEEDetIdQuadrantAndZ | ( | const DetId & | fromid, | |
const int & | toQuadrant, | |||
const int & | tozside | |||
) | const [private] |
Definition at line 102 of file EcalTrigTowerConstituentsMap.cc.
References DetId::det(), DetId::Ecal, EcalEndcap, EEDetId::iquadrant(), EEDetId::ix(), EEDetId::iy(), DetId::subdetId(), and EEDetId::XYMODE.
Referenced by constituentsOf().
00103 { 00104 if (! (fromid.det() == DetId::Ecal && fromid.subdetId() == EcalEndcap) ) 00105 return EEDetId(0); 00106 00107 EEDetId myId(fromid); 00108 int dQuadrant = toQuadrant-myId.iquadrant(); 00109 switch(dQuadrant%4){ 00110 case 0: 00111 return DetId(EEDetId(myId.ix(),myId.iy(),tozside,EEDetId::XYMODE)); 00112 break; 00113 case 1: 00114 /* adjacent tower: they are symetric*/ 00115 return DetId(EEDetId(101-myId.ix(),myId.iy(),tozside,EEDetId::XYMODE)); 00116 break; 00117 case 2: 00118 /* opposite quadrant: they are identical*/ 00119 return DetId(EEDetId(101-myId.ix(),101-myId.iy(),tozside,EEDetId::XYMODE)); 00120 break; 00121 case 3: 00122 /* adjacent tower: they are symetric*/ 00123 return DetId(EEDetId(myId.ix(),101-myId.iy(),tozside,EEDetId::XYMODE)); 00124 break; 00125 default: 00126 /*should never be reached*/ 00127 edm::LogError("EcalTrigTowerConstituentsMapError") << "This should never be reached. Profound error!"; 00128 } 00129 return EEDetId(0); 00130 }
int EcalTrigTowerConstituentsMap::changeTowerQuadrant | ( | int | phiTower, | |
int | fromQuadrant, | |||
int | toQuadrant | |||
) | const [private] |
Definition at line 132 of file EcalTrigTowerConstituentsMap.cc.
References EcalTrigTowerDetId::kEETowersInPhiPerQuadrant.
00132 { 00133 int newPhiTower = phiTower; 00134 int dQuadrant = toQuadrant-fromQuadrant; 00135 00136 switch(dQuadrant%4){ 00137 case 0: 00138 newPhiTower = phiTower; 00139 break; 00140 case 1: 00141 /* adjacent tower: they are symetric*/ 00142 newPhiTower = EcalTrigTowerDetId::kEETowersInPhiPerQuadrant * 2 - phiTower + 1; 00143 break; 00144 case 2: 00145 /* opposite quadrant: they are identical*/ 00146 newPhiTower = phiTower + EcalTrigTowerDetId::kEETowersInPhiPerQuadrant * 2; 00147 break; 00148 case 3: 00149 /* adjacent tower: they are symetric*/ 00150 newPhiTower = EcalTrigTowerDetId::kEETowersInPhiPerQuadrant * 4 - phiTower + 1; 00151 break; 00152 default: 00153 /*should never be reached*/ 00154 edm::LogError("EcalTrigTowerConstituentsMapError") << "This should never be reached. Profound error!"; 00155 } 00156 return newPhiTower; 00157 }
std::vector< DetId > EcalTrigTowerConstituentsMap::constituentsOf | ( | const EcalTrigTowerDetId & | id | ) | const |
Get the constituent detids for this tower id.
Definition at line 167 of file EcalTrigTowerConstituentsMap.cc.
References changeEEDetIdQuadrantAndZ(), e, DetId::Ecal, EcalBarrel, EcalEndcap, EcalTriggerTower, EBDetId::ETAPHIMODE, m_items, p, and wrapEcalTrigTowerDetId().
00167 { 00168 std::vector<DetId> items; 00169 00170 if ( id.det() == DetId::Ecal && id.subdetId() == EcalTriggerTower && id.subDet() == EcalBarrel ) 00171 { 00172 //-------------------- 00173 // Ecal Barrel 00174 //-------------------- 00175 // trigger towers are 5x5 crystals in the barrel 00176 int etaxtalMin=(id.ietaAbs()-1)*5+1; 00177 int phixtalMin=(id.iphi()-1)*5+1; 00178 if(phixtalMin<=0)phixtalMin+=360; 00179 int etaxtalMax=id.ietaAbs()*5; 00180 int phixtalMax=id.iphi()*5; 00181 if(phixtalMax<=0) phixtalMax+=360; 00182 for(int e=etaxtalMin;e<=etaxtalMax;e++) 00183 for(int p=phixtalMin;p<=phixtalMax;p++) 00184 items.push_back(DetId(EBDetId(id.zside()*e,p,EBDetId::ETAPHIMODE))); 00185 } 00186 else if (id.det() == DetId::Ecal && id.subdetId() == EcalTriggerTower && id.subDet() == EcalEndcap) 00187 { 00188 //-------------------- 00189 // Ecal Endcap 00190 //-------------------- 00191 DetId myId=wrapEcalTrigTowerDetId(id); 00192 EcalTowerMap_by_towerDetId::const_iterator lb,ub; 00193 boost::tuples::tie(lb,ub)=get<1>(m_items).equal_range(myId); 00194 while (lb!=ub) 00195 { 00196 EEDetId mappedId((*lb).cell); 00197 items.push_back(changeEEDetIdQuadrantAndZ(mappedId,id.iquadrant(),id.zside())); 00198 ++lb; 00199 } 00200 } 00201 00202 return items; 00203 }
EcalTrigTowerDetId EcalTrigTowerConstituentsMap::towerOf | ( | const DetId & | id | ) | const |
Get the tower id for this det id (or null if not known).
Definition at line 13 of file EcalTrigTowerConstituentsMap.cc.
References DetId::Ecal, EcalBarrel, EcalEndcap, i, m_items, EBDetId::tower(), and EEDetId::zside().
Referenced by EcalTBReadout::findTTlist(), EcalSelectiveReadout::getCrystalInterest(), EcalTBReadout::readOut(), EcalSelectiveReadoutValidation::readOutUnitOf(), EcalSelectiveReadout::runSelectiveReadout0(), EcalSelectiveReadoutValidation::setTtEtSums(), and EcalSelectiveReadoutSuppressor::setTtFlags().
00013 { 00014 if (id.det() == DetId::Ecal && id.subdetId() == EcalBarrel) 00015 { 00016 //-------------------- 00017 // Ecal Barrel 00018 //-------------------- 00019 EBDetId myId(id); 00020 return myId.tower(); 00021 } 00022 else if (id.det() == DetId::Ecal && id.subdetId() == EcalEndcap) 00023 { 00024 //-------------------- 00025 // Ecal Endcap 00026 //-------------------- 00027 EEDetId originalId(id); 00028 // DetId wrappedId=wrapEEDetId(id); 00029 DetId wrappedId(originalId); 00030 EcalTowerMap::const_iterator i=m_items.find(wrappedId); 00031 if (i!=m_items.end()) 00032 { 00033 int etaTower=i->tower.ietaAbs(); 00034 int phiTower=i->tower.iphi(); 00035 //trigger tower <-> crystal maping read 00036 //..........from file and done only for 1 quadrant 00037 //move from quadrant 1 to the actual one: 00038 // phiTower = changeTowerQuadrant(phiTower, 1, originalId.iquadrant()); 00039 // std::cout << originalId.zside() << " " << etaTower << " " << phiTower << std::endl; 00040 return EcalTrigTowerDetId(originalId.zside(),EcalEndcap,etaTower,phiTower); 00041 } 00042 } 00043 return EcalTrigTowerDetId(0); 00044 }
Wrap a generic EcalTrigTowerDetId to the equivalent one in z+ Quadrant 1 (from 0 < phi < pi/2).
Definition at line 74 of file EcalTrigTowerConstituentsMap.cc.
References DetId::det(), DetId::Ecal, EcalEndcap, EcalTriggerTower, EcalTrigTowerDetId::ietaAbs(), EcalTrigTowerDetId::iphi(), EcalTrigTowerDetId::iquadrant(), EcalTrigTowerDetId::kEETowersInPhiPerQuadrant, EcalTrigTowerDetId::subDet(), and DetId::subdetId().
Referenced by constituentsOf().
00075 { 00076 EcalTrigTowerDetId etid(id); 00077 00078 if (! (etid.det() == DetId::Ecal && etid.subdetId() == EcalTriggerTower && etid.subDet() == EcalEndcap) ) 00079 return EcalTrigTowerDetId(0); 00080 00081 switch((etid.iquadrant()-1)%4) 00082 { 00083 case 0: 00084 return DetId(EcalTrigTowerDetId(1,EcalEndcap,etid.ietaAbs(),etid.iphi())); 00085 break; 00086 case 1: 00087 return DetId(EcalTrigTowerDetId(1,EcalEndcap,etid.ietaAbs(),EcalTrigTowerDetId::kEETowersInPhiPerQuadrant * 2 - etid.iphi() + 1)); 00088 break; 00089 case 2: 00090 return DetId(EcalTrigTowerDetId(1,EcalEndcap,etid.ietaAbs(),etid.iphi() - EcalTrigTowerDetId::kEETowersInPhiPerQuadrant * 2 )); 00091 break; 00092 case 3: 00093 return DetId(EcalTrigTowerDetId(1,EcalEndcap,etid.ietaAbs(),EcalTrigTowerDetId::kEETowersInPhiPerQuadrant * 4 - etid.iphi() + 1)); 00094 break; 00095 default: 00096 /*should never be reached*/ 00097 edm::LogError("EcalTrigTowerConstituentsMapError") << "This should never be reached. Profound error!"; 00098 } 00099 return EcalTrigTowerDetId(0); 00100 }
Wrap a generic EEDetId to the equivalent one in z+ Quadrant 1 (from 0 < phi < pi/2).
Definition at line 46 of file EcalTrigTowerConstituentsMap.cc.
References DetId::det(), DetId::Ecal, EcalEndcap, EEDetId::iquadrant(), EEDetId::ix(), EEDetId::iy(), DetId::subdetId(), and EEDetId::XYMODE.
00047 { 00048 if (! (eeid.det() == DetId::Ecal && eeid.subdetId() == EcalEndcap) ) 00049 return EEDetId(0); 00050 00051 EEDetId myId(eeid); 00052 switch((myId.iquadrant()-1)%4) 00053 { 00054 case 0: 00055 return DetId(EEDetId(myId.ix(),myId.iy(),1,EEDetId::XYMODE)); 00056 break; 00057 case 1: 00058 return DetId(EEDetId(101-myId.ix(),myId.iy(),1,EEDetId::XYMODE)); 00059 break; 00060 case 2: 00061 return DetId(EEDetId(101-myId.ix(),101-myId.iy(),1,EEDetId::XYMODE)); 00062 break; 00063 case 3: 00064 return DetId(EEDetId(myId.ix(),101-myId.iy(),1,EEDetId::XYMODE)); 00065 break; 00066 default: 00067 /*should never be reached*/ 00068 edm::LogError("EcalTrigTowerConstituentsMapError") << "This should never be reached. Profound error!"; 00069 } 00070 return EEDetId(0); 00071 }
Definition at line 66 of file EcalTrigTowerConstituentsMap.h.
Referenced by assign(), constituentsOf(), and towerOf().