14 #include "GaudiKernel/ITHistSvc.h"
63 return StatusCode::SUCCESS;
70 std::vector<double> RoiEta_mon;
71 std::vector<double> RoiPhi_mon;
72 std::vector<double> RoiZed_mon;
97 CluEta, CluPhi, CluNum,
98 nL1RoIs, nRoIinClusters, nClusters,
99 dPhi_cluSeed, dR_cluSeed, dEta_cluSeed,
105 trigCompColl.record(std::make_unique<xAOD::TrigCompositeContainer>(),std::make_unique<xAOD::TrigCompositeAuxContainer>())
123 auto roiCollection = roiCollectionHdl.get();
125 if (roiCollection->size() < 2){
126 ATH_MSG_WARNING(
"Input TrigRoiDescriptorCollection isn't the correct size! Potential L1 menu inconsistency. Got " << roiCollection->size() <<
" RoIs");
127 return StatusCode::SUCCESS;
130 nL1RoIs = roiCollection->size();
139 RoiEta_mon.push_back(roi->eta());
140 RoiPhi_mon.push_back(roi->phi());
142 my_lvl1_clu_roi.
eta = roi->eta();
143 my_lvl1_clu_roi.
phi = roi->phi();
144 my_lvl1_clu_roi.
nroi = 0;
145 muonClu[n_cl] = my_lvl1_clu_roi;
146 muonClu0[n_cl] = my_lvl1_clu_roi;
151 ATH_MSG_DEBUG(
"Accumulated " << n_cl <<
" ROI Directions: ");
153 for (
int unsigned i=0;
i<RoiEta_mon.size();
i++) {
154 ATH_MSG_DEBUG(
" [" << RoiEta_mon.at(
i) <<
"," << RoiPhi_mon.at(
i) <<
"]");
162 for(
int i_cl=0; i_cl<n_cl; ++i_cl) {
163 ATH_MSG_DEBUG(
"Initial RoI Coordinates: eta = " << muonClu0[i_cl].
eta <<
", phi = " << muonClu0[i_cl].
phi);
164 bool improvement =
true;
169 double cosPhi_avg=0.0;
170 double sinPhi_avg=0.0;
172 for (
int j_cl=0; j_cl<n_cl; ++j_cl) {
175 ATH_MSG_DEBUG(
" Adding Following RoI: eta = " << muonClu0[j_cl].
eta <<
", phi = " << muonClu0[j_cl].
phi);
178 muonClu[i_cl].
eta = muonClu[i_cl].
eta + (muonClu0[j_cl].
eta-muonClu[i_cl].
eta)/n_in_clu;
182 eta_avg += muonClu0[j_cl].
eta;
183 cosPhi_avg +=
cos(muonClu0[j_cl].
phi);
184 sinPhi_avg +=
sin(muonClu0[j_cl].
phi);
194 muonClu[i_cl].
eta = eta_avg/n_in_clu;
195 muonClu[i_cl].
phi = atan2(sinPhi_avg,cosPhi_avg);
201 for (
int j_cl=0; j_cl<n_cl; ++j_cl) {
208 ATH_MSG_DEBUG(
"Finding the number of Muon RoIs in the new Cluster.... " << n_in_clu2);
209 if(n_in_clu2>muonClu[i_cl].nroi){
210 muonClu[i_cl].
nroi=n_in_clu2;
212 }
else improvement =
false;
224 for(
int i_cl=0; i_cl<n_cl; ++i_cl) {
225 nRoisInClu += muonClu[i_cl].
nroi;
226 if(muonClu[i_cl].nroi>ncl_max){
227 CluEta = muonClu[i_cl].
eta;
228 CluPhi = muonClu[i_cl].
phi;
229 CluNum = muonClu[i_cl].
nroi;
230 ncl_max = muonClu[i_cl].
nroi;
232 ATH_MSG_DEBUG(
" -- ncl_max loop: i_cl = " << i_cl <<
" with ncl_max = " << ncl_max);
235 nRoIinClusters = nRoisInClu;
241 return StatusCode::FAILURE;
245 dEta_cluSeed = muonClu0[sel_cl].
eta-muonClu[sel_cl].
eta;
246 dR_cluSeed =
DeltaR(muonClu0[sel_cl],muonClu[sel_cl]);
248 ATH_MSG_DEBUG(
"RoI Cluster Coordinates: eta = " << CluEta <<
", phi = " << CluPhi <<
", nRoI = " << CluNum);
249 ATH_MSG_DEBUG(
"Found the Cluster with the maximum number of RoIs.... " << ncl_max);
251 ATH_MSG_DEBUG(
"Create an output Collection seeded by the input");
255 trigCompColl->push_back(compClu);
257 ATH_MSG_ERROR(
"Write of MuonRoICluster TrigCompositeContainer object into trigCompColl failed!");
259 return StatusCode::FAILURE;
264 muRoiClusEta(*compClu) =
static_cast<float>(CluEta);
265 muRoiClusPhi(*compClu) =
static_cast<float>(CluPhi);
266 muRoiClusNRoi(*compClu) =
static_cast<int>(CluNum);
271 if( (
static_cast<int>(CluNum) >= 3 && std::abs(
static_cast<double>(CluEta)) < 1.0) || \
272 (
static_cast<int>(CluNum) >= 4 && std::abs(
static_cast<double>(CluEta)) >= 1.0 && std::abs(
static_cast<double>(CluEta)) <= 2.5) )
274 double phiHalfWidth = 0.35;
277 TrigRoiDescriptor* roiClus =
new TrigRoiDescriptor(
static_cast<double>(CluEta),
static_cast<double>(CluEta)-0.4,
static_cast<double>(CluEta)+0.4,
static_cast<double>(CluPhi), phiMinus, phiPlus);
284 ATH_MSG_DEBUG(
" REGTEST \t Cluster with : " <<
static_cast<int>(CluNum) <<
" LVL1-Roi");
285 ATH_MSG_DEBUG(
" REGTEST \t Cluster Eta " <<
static_cast<double>(CluEta) <<
" Cluster Phi " <<
static_cast<double>(CluPhi));
288 return StatusCode::SUCCESS;
294 float delEta = (p_roi).
eta-(q_roi).eta;
296 return(sqrt(delPhi*delPhi+delEta*delEta));