6 #include <unordered_map> 14 for (
const auto& energy_X : energy_X_tc) {
15 X_sum += energy_X.first * energy_X.second;
16 Etot += energy_X.first;
21 X_mean = X_sum / Etot;
26 const std::unordered_map<uint32_t, edm::Ptr<l1t::HGCalCluster>>& clustersPtrs = c3d.
constituents();
30 for (
const auto& id_clu : clustersPtrs) {
32 if (layer < firstLayer)
40 const std::unordered_map<uint32_t, edm::Ptr<l1t::HGCalCluster>>& clustersPtrs = c3d.
constituents();
41 std::unordered_map<int, float> layers_pt;
44 for (
const auto& id_cluster : clustersPtrs) {
46 auto itr_insert = layers_pt.emplace(layer, 0.);
47 itr_insert.first->second += id_cluster.second->pt();
48 if (itr_insert.first->second > max_pt) {
49 max_pt = itr_insert.first->second;
57 const std::unordered_map<uint32_t, edm::Ptr<l1t::HGCalCluster>>& clustersPtrs = c3d.
constituents();
61 for (
const auto& id_clu : clustersPtrs) {
63 if (layer > lastLayer)
72 const std::unordered_map<uint32_t, edm::Ptr<l1t::HGCalCluster>>& clustersPtrs = c3d.
constituents();
74 std::vector<bool>
layers(nlayers);
75 for (
const auto& id_cluster : clustersPtrs) {
76 unsigned layer = triggerGeometry.
triggerLayer(id_cluster.second->detId());
77 if (layer == 0 || layer > nlayers)
79 layers[layer - 1] =
true;
83 for (
bool layer : layers) {
88 if (length > maxlength)
95 const std::unordered_map<uint32_t, edm::Ptr<l1t::HGCalCluster>>& clustersPtrs = c3d.
constituents();
97 std::vector<std::pair<float, float>> tc_energy_eta;
99 for (
const auto& id_clu : clustersPtrs) {
100 const std::unordered_map<uint32_t, edm::Ptr<l1t::HGCalTriggerCell>>& triggerCells = id_clu.second->constituents();
102 for (
const auto& id_tc : triggerCells) {
103 tc_energy_eta.emplace_back(std::make_pair(id_tc.second->energy(), id_tc.second->eta()));
107 float SeeTot =
sigmaXX(tc_energy_eta, c3d.
eta());
113 const std::unordered_map<uint32_t, edm::Ptr<l1t::HGCalCluster>>& clustersPtrs = c3d.
constituents();
115 std::vector<std::pair<float, float>> tc_energy_phi;
117 for (
const auto& id_clu : clustersPtrs) {
118 const std::unordered_map<uint32_t, edm::Ptr<l1t::HGCalTriggerCell>>& triggerCells = id_clu.second->constituents();
120 for (
const auto& id_tc : triggerCells) {
121 tc_energy_phi.emplace_back(std::make_pair(id_tc.second->energy(), id_tc.second->phi()));
131 const std::unordered_map<uint32_t, edm::Ptr<l1t::HGCalCluster>>& clustersPtrs = c3d.
constituents();
133 std::vector<std::pair<float, float>> tc_energy_r;
135 for (
const auto& id_clu : clustersPtrs) {
136 const std::unordered_map<uint32_t, edm::Ptr<l1t::HGCalTriggerCell>>& triggerCells = id_clu.second->constituents();
138 for (
const auto& id_tc : triggerCells) {
139 float r = (id_tc.second->position().z() != 0.
140 ?
std::sqrt(
pow(id_tc.second->position().x(), 2) +
pow(id_tc.second->position().y(), 2)) /
141 std::abs(id_tc.second->position().z())
143 tc_energy_r.emplace_back(std::make_pair(id_tc.second->energy(),
r));
147 float r_mean =
meanX(tc_energy_r);
148 float Szz =
sigmaXX(tc_energy_r, r_mean);
154 std::unordered_map<int, std::vector<std::pair<float, float>>> tc_layer_energy_eta;
155 std::unordered_map<int, LorentzVector> layer_LV;
157 const std::unordered_map<uint32_t, edm::Ptr<l1t::HGCalCluster>>& clustersPtrs = c3d.
constituents();
159 for (
const auto& id_clu : clustersPtrs) {
162 layer_LV[layer] += id_clu.second->p4();
164 const std::unordered_map<uint32_t, edm::Ptr<l1t::HGCalTriggerCell>>& triggerCells = id_clu.second->constituents();
166 for (
const auto& id_tc : triggerCells) {
167 tc_layer_energy_eta[layer].emplace_back(std::make_pair(id_tc.second->energy(), id_tc.second->eta()));
171 float SigmaEtaEtaMax = 0;
173 for (
auto& tc_iter : tc_layer_energy_eta) {
174 const std::vector<std::pair<float, float>>& energy_eta_layer = tc_iter.second;
176 float SigmaEtaEtaLayer =
sigmaXX(energy_eta_layer, LV_layer.eta());
177 if (SigmaEtaEtaLayer > SigmaEtaEtaMax)
178 SigmaEtaEtaMax = SigmaEtaEtaLayer;
181 return SigmaEtaEtaMax;
185 std::unordered_map<int, std::vector<std::pair<float, float>>> tc_layer_energy_phi;
186 std::unordered_map<int, LorentzVector> layer_LV;
188 const std::unordered_map<uint32_t, edm::Ptr<l1t::HGCalCluster>>& clustersPtrs = c3d.
constituents();
190 for (
const auto& id_clu : clustersPtrs) {
193 layer_LV[layer] += id_clu.second->p4();
195 const std::unordered_map<uint32_t, edm::Ptr<l1t::HGCalTriggerCell>>& triggerCells = id_clu.second->constituents();
197 for (
const auto& id_tc : triggerCells) {
198 tc_layer_energy_phi[layer].emplace_back(std::make_pair(id_tc.second->energy(), id_tc.second->phi()));
202 float SigmaPhiPhiMax = 0;
204 for (
auto& tc_iter : tc_layer_energy_phi) {
205 const std::vector<std::pair<float, float>>& energy_phi_layer = tc_iter.second;
207 float SigmaPhiPhiLayer =
sigmaPhiPhi(energy_phi_layer, LV_layer.phi());
208 if (SigmaPhiPhiLayer > SigmaPhiPhiMax)
209 SigmaPhiPhiMax = SigmaPhiPhiLayer;
212 return SigmaPhiPhiMax;
216 std::unordered_map<int, std::vector<std::pair<float, float>>> tc_layer_energy_r;
218 const std::unordered_map<uint32_t, edm::Ptr<l1t::HGCalCluster>>& clustersPtrs = c3d.
constituents();
220 for (
const auto& id_clu : clustersPtrs) {
223 const std::unordered_map<uint32_t, edm::Ptr<l1t::HGCalTriggerCell>>& triggerCells = id_clu.second->constituents();
225 for (
const auto& id_tc : triggerCells) {
226 float r = (id_tc.second->position().z() != 0.
227 ?
std::sqrt(
pow(id_tc.second->position().x(), 2) +
pow(id_tc.second->position().y(), 2)) /
228 std::abs(id_tc.second->position().z())
230 tc_layer_energy_r[layer].emplace_back(std::make_pair(id_tc.second->energy(),
r));
234 float SigmaRRMax = 0;
236 for (
auto& tc_iter : tc_layer_energy_r) {
237 const std::vector<std::pair<float, float>>& energy_r_layer = tc_iter.second;
238 float r_mean_layer =
meanX(energy_r_layer);
239 float SigmaRRLayer =
sigmaXX(energy_r_layer, r_mean_layer);
240 if (SigmaRRLayer > SigmaRRMax)
241 SigmaRRMax = SigmaRRLayer;
248 const std::unordered_map<uint32_t, edm::Ptr<l1t::HGCalCluster>>& clustersPtrs = c3d.
constituents();
250 std::unordered_map<int, std::vector<edm::Ptr<l1t::HGCalTriggerCell>>> layers_tcs;
251 for (
const auto& id_clu : clustersPtrs) {
253 const std::unordered_map<uint32_t, edm::Ptr<l1t::HGCalTriggerCell>>& triggerCells = id_clu.second->constituents();
254 for (
const auto& id_tc : triggerCells) {
255 layers_tcs[layer].emplace_back(id_tc.second);
260 std::unordered_map<int, std::vector<std::pair<float, float>>> tc_layers_energy_r;
261 for (
const auto& layer_tcs : layers_tcs) {
262 int layer = layer_tcs.first;
264 for (
const auto& tc : layer_tcs.second) {
265 if (tc->energy() > max_tc->
energy())
268 for (
const auto& tc : layer_tcs.second) {
269 double dx = tc->position().x() - max_tc->
position().
x();
270 double dy = tc->position().y() - max_tc->
position().
y();
271 double distance_to_max =
std::sqrt(dx * dx + dy * dy);
272 if (distance_to_max < radius) {
273 float r = (tc->position().z() != 0.
274 ?
std::sqrt(tc->position().x() * tc->position().x() + tc->position().y() * tc->position().y()) /
277 tc_layers_energy_r[layer].emplace_back(std::make_pair(tc->energy(),
r));
283 std::vector<std::pair<float, float>> layers_energy_srr2;
284 for (
const auto& layer_energy_r : tc_layers_energy_r) {
285 const auto& energies_r = layer_energy_r.second;
286 float r_mean_layer =
meanX(energies_r);
287 float srr =
sigmaXX(energies_r, r_mean_layer);
288 double energy_sum = 0.;
289 for (
const auto& energy_r : energies_r) {
290 energy_sum += energy_r.first;
292 layers_energy_srr2.emplace_back(std::make_pair(energy_sum, srr * srr));
295 float srr2_mean =
meanX(layers_energy_srr2);
300 std::unordered_map<int, float> layer_energy;
302 const std::unordered_map<uint32_t, edm::Ptr<l1t::HGCalCluster>>& clustersPtrs = c3d.
constituents();
304 for (
const auto& id_clu : clustersPtrs) {
306 layer_energy[layer] += id_clu.second->energy();
311 for (
const auto& layer : layer_energy) {
312 if (layer.second > EMax)
320 const std::unordered_map<uint32_t, edm::Ptr<l1t::HGCalCluster>>& clustersPtrs = c3d.
constituents();
322 std::vector<std::pair<float, float>> tc_energy_z;
324 for (
const auto& id_clu : clustersPtrs) {
325 const std::unordered_map<uint32_t, edm::Ptr<l1t::HGCalTriggerCell>>& triggerCells = id_clu.second->constituents();
327 for (
const auto& id_tc : triggerCells) {
328 tc_energy_z.emplace_back(std::make_pair(id_tc.second->energy(), id_tc.second->position().z()));
332 float z_mean =
meanX(tc_energy_z);
333 float Szz =
sigmaXX(tc_energy_z, z_mean);
339 const std::unordered_map<uint32_t, edm::Ptr<l1t::HGCalTriggerCell>>& cellsPtrs = c2d.
constituents();
341 std::vector<std::pair<float, float>> tc_energy_eta;
343 for (
const auto& id_cell : cellsPtrs) {
344 tc_energy_eta.emplace_back(std::make_pair(id_cell.second->energy(), id_cell.second->eta()));
347 float See =
sigmaXX(tc_energy_eta, c2d.
eta());
353 const std::unordered_map<uint32_t, edm::Ptr<l1t::HGCalTriggerCell>>& cellsPtrs = c2d.
constituents();
355 std::vector<std::pair<float, float>> tc_energy_phi;
357 for (
const auto& id_cell : cellsPtrs) {
358 tc_energy_phi.emplace_back(std::make_pair(id_cell.second->energy(), id_cell.second->phi()));
367 const std::unordered_map<uint32_t, edm::Ptr<l1t::HGCalTriggerCell>>& cellsPtrs = c2d.
constituents();
369 std::vector<std::pair<float, float>> tc_energy_r;
371 for (
const auto& id_cell : cellsPtrs) {
372 float r = (id_cell.second->position().z() != 0.
373 ?
std::sqrt(
pow(id_cell.second->position().x(), 2) +
pow(id_cell.second->position().y(), 2)) /
374 std::abs(id_cell.second->position().z())
376 tc_energy_r.emplace_back(std::make_pair(id_cell.second->energy(),
r));
379 float r_mean =
meanX(tc_energy_r);
380 float Srr =
sigmaXX(tc_energy_r, r_mean);
float sigmaRRMax(const l1t::HGCalMulticluster &c3d) const
double eta() const final
momentum pseudorapidity
std::vector< LayerSetAndLayers > layers(const SeedingLayerSetsHits &sets)
float sigmaPhiPhiTot() const
float sigmaXX(const std::vector< pair< float, float >> &energy_X_tc, const float X_cluster) const
float sigmaEtaEtaMax() const
float sigmaPhiPhi(const std::vector< pair< float, float >> &energy_phi_tc, const float phi_cluster) const
int coreShowerLength(const l1t::HGCalMulticluster &c3d, const HGCalTriggerGeometryBase &triggerGeometry) const
float sigmaRRTot(const l1t::HGCalMulticluster &c3d) const
HGCalTriggerTools triggerTools_
float sigmaPhiPhiTot(const l1t::HGCalMulticluster &c3d) const
int firstLayer(const l1t::HGCalMulticluster &c3d) const
int lastLayer(const l1t::HGCalMulticluster &c3d) const
const GlobalPoint & position() const
float sigmaRRMean(const l1t::HGCalMulticluster &c3d, float radius=5.) const
double energy() const final
energy
float sigmaEtaEtaMax(const l1t::HGCalMulticluster &c3d) const
Abs< T >::type abs(const T &t)
virtual unsigned triggerLayer(const unsigned id) const =0
math::XYZTLorentzVector LorentzVector
float meanX(const std::vector< pair< float, float >> &energy_X_tc) const
float sigmaEtaEtaTot() const
int coreShowerLength() const
void fillShapes(l1t::HGCalMulticluster &, const HGCalTriggerGeometryBase &) const
int showerLength(const l1t::HGCalMulticluster &c3d) const
float sigmaRRMean() const
float sigmaZZ(const l1t::HGCalMulticluster &c3d) const
float sigmaPhiPhiMax(const l1t::HGCalMulticluster &c3d) const
int maxLayer(const l1t::HGCalMulticluster &c3d) const
float sigmaPhiPhiMax() const
float eMax(const l1t::HGCalMulticluster &c3d) const
double phi() const final
momentum azimuthal angle
float sigmaEtaEtaTot(const l1t::HGCalMulticluster &c3d) const
Power< A, B >::type pow(const A &a, const B &b)
const std::unordered_map< uint32_t, edm::Ptr< C > > & constituents() const