31 ATH_MSG_INFO(
"L1CaloFEXTools/gFexTower2SCellDecorator::initialize()");
52 return StatusCode::SUCCESS;
61 return StatusCode::FAILURE;
66 if(!triggerTowerContainer.
isValid()) {
67 ATH_MSG_FATAL(
"Could not retrieve collection " << triggerTowerContainer.
key() );
68 return StatusCode::FAILURE;
75 return StatusCode::FAILURE;
79 ATH_MSG_WARNING(
"Nothing to decorate here, at least one container is empty. ScellContainer.size="<<ScellContainer->
size() <<
" or gTowerContainer.size=" <<
gTowerContainer->
size() <<
" or triggerTowerContainer.size=" << triggerTowerContainer->
size() );
80 return StatusCode::SUCCESS;
84 std::unordered_map< uint64_t, const CaloCell*> map_ScellID2ptr;
86 for(
const CaloCell* scell : *ScellContainer){
88 map_ScellID2ptr[
ID] = scell;
92 std::unordered_map< uint32_t, const xAOD::TriggerTower*> map_TileID2ptr;
97 if(std::abs(tower->eta())>1.5 || tower->sampling()!=1)
continue;
98 map_TileID2ptr[tower->coolId()]=tower;
121 std::vector<float> scEt;
122 std::vector<float> scEta;
123 std::vector<float> scPhi;
124 std::vector<int> scID;
125 std::vector<int> scSample;
127 std::vector<int> TileEt;
128 std::vector<float> TileEta;
129 std::vector<float> TilePhi;
135 ATH_MSG_ERROR(
"ID: "<<gFexID<<
" not found on map m_map_TTower2SCells");
136 return StatusCode::FAILURE;
139 for (
auto const& SCellID : it_TTower2SCells->second ) {
142 auto it_ScellID2ptr = map_ScellID2ptr.find(SCellID);
143 if(it_ScellID2ptr == map_ScellID2ptr.end()) {
144 ATH_MSG_WARNING(
"Scell ID: 0x"<<std::hex<<(SCellID >> 32)<<std::dec<<
" not found on map map_ScellID2ptr");
146 scEt.push_back(-9999);
147 scEta.push_back(-99);
148 scPhi.push_back(-99);
150 scID.push_back( SCellID >> 32 );
151 scSample.push_back(-99);
157 const CaloCell* myCell = it_ScellID2ptr->second;
158 float et = myCell->
et();
163 int prov = (myCell)->provenance();
164 int SCprov = prov&0xFFF;
165 bool isMasked = (SCprov&0x80)==0x80;
169 scEta.push_back(myCell->
eta());
170 scPhi.push_back(myCell->
phi());
172 scID.push_back( SCellID >> 32 );
173 scSample.push_back(
sample);
179 float tmpSCellEt = 0;
180 for(
const auto& tmpet : scEt){
187 gTowerSCellEt (*
gTower) = std::move(scEt);
188 gTowerSCellEta (*
gTower) = std::move(scEta);
189 gTowerSCellPhi (*
gTower) = std::move(scPhi);
190 gTowerSCellID (*
gTower) = std::move(scID);
191 gTowerSCellSample (*
gTower) = std::move(scSample);
192 gTowerEtMeV (*
gTower) = gFexEt * 200;
193 gTowerSCEtEncoded (*
gTower) = scSumEtEncoded;
202 for (
auto const& TileTowerID : it_TTower2Tile->second ) {
205 auto it_TileID2ptr = map_TileID2ptr.find(TileTowerID);
206 if(it_TileID2ptr == map_TileID2ptr.end()) {
210 TileEt.push_back(-9999);
211 TileEta.push_back(-99);
212 TilePhi.push_back(-99);
218 TileEt.push_back(tileTower->
jepET()*1000);
219 TileEta.push_back(tileTower->
eta());
220 float phi = tileTower->
phi() <
M_PI ? tileTower->
phi() : tileTower->
phi()-2*
M_PI;
221 TilePhi.push_back(phi);
222 TileID.push_back(TileTowerID);
231 gTowerTileEt (*
gTower) = std::move(TileEt);
233 gTowerTileEta (*
gTower) = std::move(TileEta);
234 gTowerTilePhi (*
gTower) = std::move(TilePhi);
238 return StatusCode::SUCCESS;
248 if ( !myfile.is_open() ){
250 return StatusCode::FAILURE;
254 while ( std::getline (myfile, myline) ) {
255 std::vector<uint64_t> SCellvector;
259 myline.erase(myline.begin(), std::find_if(myline.begin(), myline.end(), [](
int ch) {
260 return !std::isspace(ch);
262 if(myline[0] ==
'#')
continue;
265 std::stringstream oneSCellID(myline);
268 std::string substr =
"";
272 while(std::getline(oneSCellID, substr,
' '))
276 TTID = std::stoi(substr);
281 return StatusCode::FAILURE;
285 uint64_t scid_uint64 = std::strtoull(substr.c_str(),
nullptr, 0);
288 if(scid_uint64 == 0xffffffffffffffff)
continue;
290 SCellvector.push_back(scid_uint64);
299 return StatusCode::SUCCESS;
305 if (
ID.find(
"0x") == std::string::npos) {
306 ATH_MSG_ERROR(
"Invalid SuperCell ID " <<
ID <<
". Expecting hexadecimal number on the mapping file");
320 if ( !myfile.is_open() ){
322 return StatusCode::FAILURE;
326 while ( std::getline (myfile, myline) ) {
328 std::vector<uint32_t> Tilevector;
331 myline.erase(myline.begin(), std::find_if(myline.begin(), myline.end(), [](
int ch) {
332 return !std::isspace(ch);
334 if(myline[0] ==
'#')
continue;
337 std::stringstream oneTileID(myline);
340 std::string substr =
"";
344 while(std::getline(oneTileID, substr,
' ')){
347 gTowerID = std::stoi(substr);
350 uint32_t tileid_uint32 = std::strtoul(substr.c_str(),
nullptr, 0);
351 Tilevector.push_back(tileid_uint32);
360 return StatusCode::SUCCESS;