7 #include <unordered_map> 17 for(
const auto& energy_X : energy_X_tc){
19 X_sum += energy_X.first*energy_X.second;
20 Etot += energy_X.first;
25 if(Etot>0) X_mean = X_sum/Etot;
33 const std::unordered_map<uint32_t, edm::Ptr<l1t::HGCalCluster>>& clustersPtrs = c3d.
constituents();
37 for(
const auto& id_clu : clustersPtrs){
40 if(layer<firstLayer) firstLayer=layer;
51 const std::unordered_map<uint32_t, edm::Ptr<l1t::HGCalCluster>>& clustersPtrs = c3d.
constituents();
52 std::unordered_map<int, float> layers_pt;
55 for(
const auto& id_cluster : clustersPtrs){
57 auto itr_insert = layers_pt.emplace(layer, 0.);
58 itr_insert.first->second += id_cluster.second->pt();
59 if(itr_insert.first->second>max_pt){
60 max_pt = itr_insert.first->second;
70 const std::unordered_map<uint32_t, edm::Ptr<l1t::HGCalCluster>>& clustersPtrs = c3d.
constituents();
74 for(
const auto& id_clu : clustersPtrs){
77 if(layer>lastLayer) lastLayer=layer;
87 const std::unordered_map<uint32_t, edm::Ptr<l1t::HGCalCluster>>& clustersPtrs = c3d.
constituents();
89 std::vector<bool>
layers(nlayers);
90 for(
const auto& id_cluster : clustersPtrs)
92 int layer = triggerGeometry.
triggerLayer(id_cluster.second->detId());
93 layers[layer-1] =
true;
97 for(
bool layer : layers)
101 if(length>maxlength) maxlength = length;
109 const std::unordered_map<uint32_t, edm::Ptr<l1t::HGCalCluster>>& clustersPtrs = c3d.
constituents();
111 std::vector<std::pair<float,float> > tc_energy_eta ;
113 for(
const auto& id_clu : clustersPtrs){
115 const std::unordered_map<uint32_t, edm::Ptr<l1t::HGCalTriggerCell>>& triggerCells = id_clu.second->constituents();
117 for(
const auto& id_tc : triggerCells){
119 tc_energy_eta.emplace_back( std::make_pair(id_tc.second->energy(),id_tc.second->eta()) );
125 float SeeTot =
sigmaXX(tc_energy_eta,c3d.
eta());
136 const std::unordered_map<uint32_t, edm::Ptr<l1t::HGCalCluster>>& clustersPtrs = c3d.
constituents();
138 std::vector<std::pair<float,float> > tc_energy_phi ;
140 for(
const auto& id_clu : clustersPtrs){
142 const std::unordered_map<uint32_t, edm::Ptr<l1t::HGCalTriggerCell>>& triggerCells = id_clu.second->constituents();
144 for(
const auto& id_tc : triggerCells){
146 tc_energy_phi.emplace_back( std::make_pair(id_tc.second->energy(),id_tc.second->phi()) );
164 const std::unordered_map<uint32_t, edm::Ptr<l1t::HGCalCluster>>& clustersPtrs = c3d.
constituents();
166 std::vector<std::pair<float,float> > tc_energy_r ;
168 for(
const auto& id_clu : clustersPtrs){
170 const std::unordered_map<uint32_t, edm::Ptr<l1t::HGCalTriggerCell>>& triggerCells = id_clu.second->constituents();
172 for(
const auto& id_tc : triggerCells){
174 float r = (id_tc.second->position().z()!=0. ?
std::sqrt(
pow(id_tc.second->position().x(),2) +
pow(id_tc.second->position().y(),2) )/
std::abs(id_tc.second->position().z()) : 0.);
175 tc_energy_r.emplace_back( std::make_pair(id_tc.second->energy(),
r) );
181 float r_mean =
meanX(tc_energy_r);
182 float Szz =
sigmaXX(tc_energy_r,r_mean);
194 std::unordered_map<int, std::vector<std::pair<float,float> > > tc_layer_energy_eta;
195 std::unordered_map<int, LorentzVector> layer_LV;
197 const std::unordered_map<uint32_t, edm::Ptr<l1t::HGCalCluster>>& clustersPtrs = c3d.
constituents();
199 for(
const auto& id_clu : clustersPtrs){
203 layer_LV[layer] += id_clu.second->p4();
205 const std::unordered_map<uint32_t, edm::Ptr<l1t::HGCalTriggerCell>>& triggerCells = id_clu.second->constituents();
207 for(
const auto& id_tc : triggerCells){
209 tc_layer_energy_eta[layer].emplace_back( std::make_pair(id_tc.second->energy(),id_tc.second->eta()) );
216 float SigmaEtaEtaMax=0;
218 for(
auto& tc_iter : tc_layer_energy_eta){
220 const std::vector<std::pair<float, float> >& energy_eta_layer = tc_iter.second;
222 float SigmaEtaEtaLayer =
sigmaXX(energy_eta_layer,LV_layer.eta());
223 if(SigmaEtaEtaLayer > SigmaEtaEtaMax) SigmaEtaEtaMax = SigmaEtaEtaLayer;
228 return SigmaEtaEtaMax;
238 std::unordered_map<int, std::vector<std::pair<float,float> > > tc_layer_energy_phi;
239 std::unordered_map<int, LorentzVector> layer_LV;
241 const std::unordered_map<uint32_t, edm::Ptr<l1t::HGCalCluster>>& clustersPtrs = c3d.
constituents();
243 for(
const auto& id_clu : clustersPtrs){
247 layer_LV[layer] += id_clu.second->p4();
249 const std::unordered_map<uint32_t, edm::Ptr<l1t::HGCalTriggerCell>>& triggerCells = id_clu.second->constituents();
251 for(
const auto& id_tc : triggerCells){
253 tc_layer_energy_phi[layer].emplace_back( std::make_pair(id_tc.second->energy(),id_tc.second->phi()) );
260 float SigmaPhiPhiMax=0;
262 for(
auto& tc_iter : tc_layer_energy_phi){
264 const std::vector<std::pair<float, float> >& energy_phi_layer = tc_iter.second;
266 float SigmaPhiPhiLayer =
sigmaPhiPhi(energy_phi_layer,LV_layer.phi());
267 if(SigmaPhiPhiLayer > SigmaPhiPhiMax) SigmaPhiPhiMax = SigmaPhiPhiLayer;
272 return SigmaPhiPhiMax;
282 std::unordered_map<int, std::vector<std::pair<float,float> > > tc_layer_energy_r;
284 const std::unordered_map<uint32_t, edm::Ptr<l1t::HGCalCluster>>& clustersPtrs = c3d.
constituents();
286 for(
const auto& id_clu : clustersPtrs){
290 const std::unordered_map<uint32_t, edm::Ptr<l1t::HGCalTriggerCell>>& triggerCells = id_clu.second->constituents();
292 for(
const auto& id_tc : triggerCells){
294 float r = (id_tc.second->position().z()!=0. ?
std::sqrt(
pow(id_tc.second->position().x(),2) +
pow(id_tc.second->position().y(),2) )/
std::abs(id_tc.second->position().z()) : 0.);
295 tc_layer_energy_r[layer].emplace_back( std::make_pair(id_tc.second->energy(),
r) );
304 for(
auto& tc_iter : tc_layer_energy_r){
306 const std::vector<std::pair<float, float> >& energy_r_layer = tc_iter.second;
307 float r_mean_layer =
meanX(energy_r_layer);
308 float SigmaRRLayer =
sigmaXX(energy_r_layer,r_mean_layer);
309 if(SigmaRRLayer > SigmaRRMax) SigmaRRMax = SigmaRRLayer;
322 const std::unordered_map<uint32_t, edm::Ptr<l1t::HGCalCluster>>& clustersPtrs = c3d.
constituents();
324 std::unordered_map<int, std::vector<edm::Ptr<l1t::HGCalTriggerCell>> > layers_tcs;
325 for(
const auto& id_clu : clustersPtrs){
327 const std::unordered_map<uint32_t, edm::Ptr<l1t::HGCalTriggerCell>>& triggerCells = id_clu.second->constituents();
328 for(
const auto& id_tc : triggerCells){
329 layers_tcs[layer].emplace_back(id_tc.second);
334 std::unordered_map<int, std::vector<std::pair<float,float> > > tc_layers_energy_r;
335 for(
const auto& layer_tcs : layers_tcs){
336 int layer = layer_tcs.first;
338 for(
const auto& tc : layer_tcs.second){
339 if(tc->energy()>max_tc->
energy()) max_tc = tc;
341 for(
const auto& tc : layer_tcs.second){
342 double dx = tc->position().x() - max_tc->
position().
x();
343 double dy = tc->position().y() - max_tc->
position().
y();
344 double distance_to_max =
std::sqrt(dx*dx+dy*dy);
345 if(distance_to_max<radius){
346 float r = (tc->position().z()!=0. ?
std::sqrt(tc->position().x()*tc->position().x() + tc->position().y()*tc->position().y())/
std::abs(tc->position().z()) : 0.);
347 tc_layers_energy_r[layer].emplace_back( std::make_pair(tc->energy(),
r));
353 std::vector<std::pair<float,float>> layers_energy_srr2;
354 for(
const auto& layer_energy_r : tc_layers_energy_r){
355 const auto& energies_r = layer_energy_r.second;
356 float r_mean_layer =
meanX(energies_r);
357 float srr =
sigmaXX(energies_r,r_mean_layer);
358 double energy_sum = 0.;
359 for(
const auto& energy_r : energies_r){
360 energy_sum += energy_r.first;
362 layers_energy_srr2.emplace_back(std::make_pair(energy_sum, srr*srr));
365 float srr2_mean =
meanX(layers_energy_srr2);
373 std::unordered_map<int, float> layer_energy;
375 const std::unordered_map<uint32_t, edm::Ptr<l1t::HGCalCluster>>& clustersPtrs = c3d.
constituents();
377 for(
const auto& id_clu : clustersPtrs){
380 layer_energy[layer] += id_clu.second->energy();
386 for(
const auto& layer : layer_energy){
388 if(layer.second>EMax) EMax = layer.second;
402 const std::unordered_map<uint32_t, edm::Ptr<l1t::HGCalCluster>>& clustersPtrs = c3d.
constituents();
404 std::vector<std::pair<float,float> > tc_energy_z ;
406 for(
const auto& id_clu : clustersPtrs){
408 const std::unordered_map<uint32_t, edm::Ptr<l1t::HGCalTriggerCell>>& triggerCells = id_clu.second->constituents();
410 for(
const auto& id_tc : triggerCells){
412 tc_energy_z.emplace_back( std::make_pair(id_tc.second->energy(),id_tc.second->position().z()) );
418 float z_mean =
meanX(tc_energy_z);
419 float Szz =
sigmaXX(tc_energy_z,z_mean);
431 const std::unordered_map<uint32_t, edm::Ptr<l1t::HGCalTriggerCell>>& cellsPtrs = c2d.
constituents();
433 std::vector<std::pair<float,float> > tc_energy_eta ;
435 for(
const auto& id_cell : cellsPtrs){
437 tc_energy_eta.emplace_back( std::make_pair(id_cell.second->energy(),id_cell.second->eta()) );
451 const std::unordered_map<uint32_t, edm::Ptr<l1t::HGCalTriggerCell>>& cellsPtrs = c2d.
constituents();
453 std::vector<std::pair<float,float> > tc_energy_phi ;
455 for(
const auto& id_cell : cellsPtrs){
457 tc_energy_phi.emplace_back( std::make_pair(id_cell.second->energy(),id_cell.second->phi()) );
472 const std::unordered_map<uint32_t, edm::Ptr<l1t::HGCalTriggerCell>>& cellsPtrs = c2d.
constituents();
474 std::vector<std::pair<float,float> > tc_energy_r ;
476 for(
const auto& id_cell : cellsPtrs){
478 float r = (id_cell.second->position().z()!=0. ?
std::sqrt(
pow(id_cell.second->position().x(),2) +
pow(id_cell.second->position().y(),2) )/
std::abs(id_cell.second->position().z()) : 0.);
479 tc_energy_r.emplace_back( std::make_pair(id_cell.second->energy(),
r) );
483 float r_mean =
meanX(tc_energy_r);
484 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)
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
float sigmaPhiPhi(const std::vector< pair< float, float > > &energy_phi_tc, const float phi_cluster) const
float meanX(const std::vector< pair< float, float > > &energy_X_tc) const
int lastLayer(const l1t::HGCalMulticluster &c3d) const
float sigmaXX(const std::vector< pair< float, float > > &energy_X_tc, const float X_cluster) 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 sigmaZZ(const l1t::HGCalMulticluster &c3d) const
float sigmaPhiPhiMax(const l1t::HGCalMulticluster &c3d) const
int maxLayer(const l1t::HGCalMulticluster &c3d) 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