Skip to content

Commit

Permalink
fix fill empty cells & m_do_pi0_photon_shapeVar flag
Browse files Browse the repository at this point in the history
  • Loading branch information
Tong Li committed Jun 13, 2024
1 parent 1b179d6 commit 1ea1a39
Showing 1 changed file with 4 additions and 17 deletions.
21 changes: 4 additions & 17 deletions RecFCCeeCalorimeter/src/components/AugmentClustersFCCee.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ StatusCode AugmentClustersFCCee::initialize()

// retrieve systemID_EMB (which is 4 now) from constantAsDouble("DetID_ECAL_Barrel")
systemID_EMB = m_geoSvc->getDetector()->constantAsDouble("DetID_ECAL_Barrel");
//std::cout << "systemID_EMB is " << systemID_EMB << std::endl;

// retrieve some information from the segmentation for later use
// - number of modules/phi bins => needed to account for module/phi periodicity
Expand Down Expand Up @@ -438,7 +437,7 @@ StatusCode AugmentClustersFCCee::execute([[maybe_unused]] const EventContext &ev
auto result = MergeSumAndSort(vec_theta_cell_layer[layer+startPositionToFill], vec_E_cell_layer[layer+startPositionToFill]);

// fill the zero energy cells in 1D theta-E profile
for (int i = result.first.front(); i <= result.first.back(); ++i) {
for (int i = result.first.front(); i <= result.first.back(); i += nMergedThetaCells[layer+startPositionToFill]) {
if (std::find(result.first.begin(), result.first.end(), i) == result.first.end()) {
auto it = std::lower_bound(result.first.begin(), result.first.end(), i);
int idx = it - result.first.begin();
Expand All @@ -451,10 +450,6 @@ StatusCode AugmentClustersFCCee::execute([[maybe_unused]] const EventContext &ev
// loop over theta IDs to find the local E maxima
for (size_t i = 0; i < theta_E_pair[layer+startPositionToFill].second.size(); i ++) {
//std::cout << i << " " << theta_E_pair[layer+startPositionToFill].first[i] << " " << theta_E_pair[layer+startPositionToFill].second[i] << std::endl;
// discard the first and last cell in theta
// if (i == 0 || i == (theta_E_pair[layer+startPositionToFill].second.size()-1)) continue;
// local max: E_cell is greater than the 2 neighbors
// note: this is not checking that there are holes (cells without energy...)
if (
(i == 0 && theta_E_pair[layer+startPositionToFill].second[i] > theta_E_pair[layer+startPositionToFill].second[i+1]) ||
(i == theta_E_pair[layer+startPositionToFill].second.size()-1 && theta_E_pair[layer+startPositionToFill].second[i] > theta_E_pair[layer+startPositionToFill].second[i-1]) ||
Expand Down Expand Up @@ -518,20 +513,17 @@ StatusCode AugmentClustersFCCee::execute([[maybe_unused]] const EventContext &ev

startPositionToFill = 0;
for (size_t k = 0; k < m_readoutNames.size(); k++) {
if (!m_do_pi0_photon_shapeVar) break;
if (m_systemIDs[k] != systemID_EMB) continue; // do pi0/photon shape var only for EMB
if (k > 0) startPositionToFill += m_numLayers[k - 1];
// loop over layers
for (unsigned layer = 0; layer < m_numLayers[k]; layer++) {
//// in case there's no cell in this layer (sometimes in layer 0)
//if (vec_E_cell_layer[layer+startPositionToFill].empty()) {
// vec_E_cell_layer[layer+startPositionToFill].push_back(0.);
// vec_module_cell_layer[layer+startPositionToFill].push_back(0);
//}
// this should be done with some care because it sorts modules in ascending order, but if the cluster is
// near the 1536..0 transition, then the cells will be arranged in a non physically contiguous way
auto result_2 = MergeSumAndSort(vec_module_cell_layer[layer+startPositionToFill], vec_E_cell_layer[layer+startPositionToFill]);

// fill the zero energy cells in 1D module-E profile
for (int i = result_2.first.front(); i <= result_2.first.back(); ++i) {
for (int i = result_2.first.front(); i <= result_2.first.back(); i += nMergedModules[layer+startPositionToFill]) {
if (std::find(result_2.first.begin(), result_2.first.end(), i) == result_2.first.end()) {
auto it = std::lower_bound(result_2.first.begin(), result_2.first.end(), i);
int idx = it - result_2.first.begin();
Expand All @@ -544,11 +536,6 @@ StatusCode AugmentClustersFCCee::execute([[maybe_unused]] const EventContext &ev
// loop over module IDs to find the local E maxima
for (size_t i = 0; i < module_E_pair[layer+startPositionToFill].second.size(); i ++) {
//std::cout << i << " " << module_E_pair[layer+startPositionToFill].first[i] << " " << module_E_pair[layer+startPositionToFill].second[i] << std::endl;
// discard the first and last cell in theta
// if (i == 0 || i == (theta_E_pair[layer+startPositionToFill].second.size()-1)) continue;
// local max: E_cell is greater than the 2 neighbors
// note: this is not checking that there are holes (cells without energy...)
// also, take care for clusters near 1536->0 module transition
if (
(i == 0 && module_E_pair[layer+startPositionToFill].second[i] > module_E_pair[layer+startPositionToFill].second[i+1]) ||
(i == module_E_pair[layer+startPositionToFill].second.size()-1 && module_E_pair[layer+startPositionToFill].second[i] > module_E_pair[layer+startPositionToFill].second[i-1]) ||
Expand Down

0 comments on commit 1ea1a39

Please sign in to comment.