Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Apr 12, 2024
1 parent 2487714 commit d717216
Show file tree
Hide file tree
Showing 284 changed files with 17,098 additions and 18,026 deletions.
20 changes: 10 additions & 10 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"image": "ghcr.io/eic/jug_prod:master-nightly",
"postCreateCommand": "./.devcontainer/postCreateCommand.sh",
"customizations": {
"vscode": {
"extensions": [
"ms-vscode.cmake-tools",
"ms-vscode.cpptools",
"ms-vscode.cpptools-extension-pack"
]
}
"image": "ghcr.io/eic/jug_prod:master-nightly",
"postCreateCommand": "./.devcontainer/postCreateCommand.sh",
"customizations": {
"vscode": {
"extensions": [
"ms-vscode.cmake-tools",
"ms-vscode.cpptools",
"ms-vscode.cpptools-extension-pack"
]
}
}
}
270 changes: 140 additions & 130 deletions src/algorithms/calorimetry/CalorimeterClusterRecoCoG.cc

Large diffs are not rendered by default.

89 changes: 42 additions & 47 deletions src/algorithms/calorimetry/CalorimeterClusterRecoCoG.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,56 +31,51 @@
static double constWeight(double /*E*/, double /*tE*/, double /*p*/, int /*type*/) { return 1.0; }
static double linearWeight(double E, double /*tE*/, double /*p*/, int /*type*/) { return E; }
static double logWeight(double E, double tE, double base, int /*type*/) {
return std::max(0., base + std::log(E / tE));
return std::max(0., base + std::log(E / tE));
}

static const std::map<std::string, std::function<double(double, double, double, int)>> weightMethods={
{"none", constWeight},
{"linear", linearWeight},
{"log", logWeight},
static const std::map<std::string, std::function<double(double, double, double, int)>>
weightMethods = {
{"none", constWeight},
{"linear", linearWeight},
{"log", logWeight},
};

namespace eicrecon {

using ClustersWithAssociations = std::pair<
std::unique_ptr<edm4eic::ClusterCollection>,
std::unique_ptr<edm4eic::MCRecoClusterParticleAssociationCollection>
>;

using CalorimeterClusterRecoCoGAlgorithm = algorithms::Algorithm<
algorithms::Input<
edm4eic::ProtoClusterCollection,
std::optional<edm4hep::SimCalorimeterHitCollection>
>,
algorithms::Output<
edm4eic::ClusterCollection,
std::optional<edm4eic::MCRecoClusterParticleAssociationCollection>
>
>;

class CalorimeterClusterRecoCoG
: public CalorimeterClusterRecoCoGAlgorithm,
public WithPodConfig<CalorimeterClusterRecoCoGConfig> {

public:
CalorimeterClusterRecoCoG(std::string_view name)
: CalorimeterClusterRecoCoGAlgorithm{name,
{"inputProtoClusterCollection", "mcHits"},
{"outputClusterCollection", "outputAssociations"},
"Reconstruct a cluster with the Center of Gravity method. For "
"simulation results it optionally creates a Cluster <-> MCParticle "
"association provided both optional arguments are provided."} {}

public:
void init() final;

void process(const Input&, const Output&) const final;

private:
std::function<double(double, double, double, int)> weightFunc;

private:
std::optional<edm4eic::Cluster> reconstruct(const edm4eic::ProtoCluster& pcl) const;
};

} // eicrecon
using ClustersWithAssociations =
std::pair<std::unique_ptr<edm4eic::ClusterCollection>,
std::unique_ptr<edm4eic::MCRecoClusterParticleAssociationCollection>>;

using CalorimeterClusterRecoCoGAlgorithm = algorithms::Algorithm<
algorithms::Input<edm4eic::ProtoClusterCollection,
std::optional<edm4hep::SimCalorimeterHitCollection>>,
algorithms::Output<edm4eic::ClusterCollection,
std::optional<edm4eic::MCRecoClusterParticleAssociationCollection>>>;

class CalorimeterClusterRecoCoG : public CalorimeterClusterRecoCoGAlgorithm,
public WithPodConfig<CalorimeterClusterRecoCoGConfig> {

public:
CalorimeterClusterRecoCoG(std::string_view name)
: CalorimeterClusterRecoCoGAlgorithm{
name,
{"inputProtoClusterCollection", "mcHits"},
{"outputClusterCollection", "outputAssociations"},
"Reconstruct a cluster with the Center of Gravity method. For "
"simulation results it optionally creates a Cluster <-> MCParticle "
"association provided both optional arguments are provided."} {}

public:
void init() final;

void process(const Input&, const Output&) const final;

private:
std::function<double(double, double, double, int)> weightFunc;

private:
std::optional<edm4eic::Cluster> reconstruct(const edm4eic::ProtoCluster& pcl) const;
};

} // namespace eicrecon
33 changes: 16 additions & 17 deletions src/algorithms/calorimetry/CalorimeterClusterRecoCoGConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,24 @@

namespace eicrecon {

struct CalorimeterClusterRecoCoGConfig {
struct CalorimeterClusterRecoCoGConfig {

std::string energyWeight;
std::string energyWeight;

double sampFrac = 1.;
double logWeightBase = 3.6;
double sampFrac = 1.;
double logWeightBase = 3.6;

//optional: have the log weight base depend on the energy
// logWeightBaseCoeffs[0]+logWeightBaseCoeffs[1]*l+logWeightBaseCoeffs[2]*l*l + ...
// where l = log(cl.getEnergy()/logWeightBase_Eref)
// If this is empty, use the logWeightBase parameter for backwards compatibility.
std::vector<double> logWeightBaseCoeffs{};
double logWeightBase_Eref = 50 * dd4hep::MeV;
//optional: have the log weight base depend on the energy
// logWeightBaseCoeffs[0]+logWeightBaseCoeffs[1]*l+logWeightBaseCoeffs[2]*l*l + ...
// where l = log(cl.getEnergy()/logWeightBase_Eref)
// If this is empty, use the logWeightBase parameter for backwards compatibility.
std::vector<double> logWeightBaseCoeffs{};
double logWeightBase_Eref = 50 * dd4hep::MeV;

// Constrain the cluster position eta to be within
// the eta of the contributing hits. This is useful to avoid edge effects
// for endcaps.
bool enableEtaBounds = false;
// Constrain the cluster position eta to be within
// the eta of the contributing hits. This is useful to avoid edge effects
// for endcaps.
bool enableEtaBounds = false;
};

};

} // eicrecon
} // namespace eicrecon
Loading

0 comments on commit d717216

Please sign in to comment.