Skip to content

Commit

Permalink
Propagate to MtdTruthAccumulator the update of MTD hits classification
Browse files Browse the repository at this point in the history
  • Loading branch information
fabiocos committed Dec 17, 2024
1 parent 0c89fc9 commit e70390e
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 6 deletions.
13 changes: 13 additions & 0 deletions SimG4CMS/Forward/interface/MtdHitCategory.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#ifndef SimG4CMSForward_MtdHitCategory_h
#define SimG4CMSForward_MtdHitCategory_h

namespace MtdHitCategory {
static constexpr unsigned int k_idsecOffset = 1;
static constexpr unsigned int k_idloopOffset = 2;
static constexpr unsigned int k_idFromCaloOffset = 3;
static constexpr unsigned int k_idETLfromBack = 4;
static constexpr unsigned int n_categories =
std::max({k_idsecOffset, k_idloopOffset, k_idFromCaloOffset, k_idETLfromBack});
}; // namespace MtdHitCategory

#endif
7 changes: 2 additions & 5 deletions SimG4CMS/Forward/interface/MtdSD.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
#define SimG4CMSForward_MtdSD_h

#include "SimG4CMS/Forward/interface/TimingSD.h"
#include "SimG4CMS/Forward/interface/MtdHitCategory.h"

#include "FWCore/Framework/interface/Frameworkfwd.h"
#include "FWCore/ParameterSet/interface/ParameterSetfwd.h"

Expand Down Expand Up @@ -30,11 +32,6 @@ class MtdSD : public TimingSD {
void setHitClassID(const G4Step *) override;

private:
static constexpr unsigned int k_idsecOffset = 1;
static constexpr unsigned int k_idloopOffset = 2;
static constexpr unsigned int k_idFromCaloOffset = 3;
static constexpr unsigned int k_idETLfromBack = 4;

double energyCut;
double energyHistoryCut;

Expand Down
2 changes: 2 additions & 0 deletions SimG4CMS/Forward/src/MtdSD.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

#include <iostream>

using namespace MtdHitCategory;

//-------------------------------------------------------------------
MtdSD::MtdSD(const std::string& name,
const SensitiveDetectorCatalog& clg,
Expand Down
1 change: 1 addition & 0 deletions SimGeneral/CaloAnalysis/plugins/BuildFile.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
<use name="Geometry/HcalCommonData"/>
<use name="Geometry/MTDGeometryBuilder"/>
<use name="Geometry/MTDNumberingBuilder"/>
<use name="SimG4CMS/Forward"/>

<library file="*.cc" name="SimGeneralCaloAnalysisPlugins">
<flags EDM_PLUGIN="1"/>
Expand Down
4 changes: 3 additions & 1 deletion SimGeneral/CaloAnalysis/plugins/MtdTruthAccumulator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@
#include "Geometry/MTDGeometryBuilder/interface/ProxyMTDTopology.h"
#include "Geometry/MTDGeometryBuilder/interface/RectangularMTDTopology.h"

#include "SimG4CMS/Forward/interface/MtdHitCategory.h"

#include <CLHEP/Units/SystemOfUnits.h>

namespace {
Expand Down Expand Up @@ -187,7 +189,7 @@ namespace {
if (!vertex_property.simTrack)
return;
// -- loop over possible trackIdOffsets to save also sim clusters from non-direct hits
for (unsigned int offset = 0; offset < 4; offset++) {
for (unsigned int offset = 0; offset < MtdHitCategory::n_categories + 1; offset++) {
auto trackIdx = vertex_property.simTrack->trackId();
trackIdx += offset * (static_cast<int>(PSimHit::k_tidOffset));
IfLogDebug(DEBUG, messageCategoryGraph_)
Expand Down

0 comments on commit e70390e

Please sign in to comment.