Skip to content
This repository has been archived by the owner on May 9, 2024. It is now read-only.

Commit

Permalink
Merge pull request #65 from LDMX-Software/clusterInfo
Browse files Browse the repository at this point in the history
Build HCal clusters on a base class
  • Loading branch information
cmantill authored Apr 10, 2024
2 parents ac43c59 + c9c4329 commit 52ea7db
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 78 deletions.
67 changes: 3 additions & 64 deletions include/Hcal/Event/HcalCluster.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,17 @@
#ifndef EVENT_HCALCLUSTER_H_
#define EVENT_HCALCLUSTER_H_

// ROOT
#include "TObject.h" //For ClassDef
#include "TString.h"

// STL
#include <iostream>
#include <set>

// ldmx-sw
#include "Hcal/Event/HcalHit.h"
#include "Recon/Event/CaloCluster.h"

namespace ldmx {

/**
* @class HcalCluster
* @brief Stores cluster information from the ECal
* @brief Stores cluster information from the HCal
*/
class HcalCluster {
class HcalCluster : public ldmx::CaloCluster {
public:
/**
* Class constructor.
Expand All @@ -37,11 +30,6 @@ class HcalCluster {
*/
virtual ~HcalCluster();

/**
* Print a description of this object.
*/
void Print() const;

/**
* Reset the HcalCluster object.
*/
Expand All @@ -54,64 +42,15 @@ class HcalCluster {
*/
void addHits(const std::vector<const ldmx::HcalHit*> hitsVec);

/**
* Sets total energy for the cluster.
* @param energy The total energy of the cluster.
*/
void setEnergy(double energy) { energy_ = energy; }

/**
* Sets total number of hits in the cluster.
* @param nHits The total number of hits.
*/
void setNHits(int nHits) { nHits_ = nHits; }

/**
* Sets a sorted vector for the IDs of the hits
* that make up the cluster.
* @param IDs Sorted vector of hit IDs.
*/
void setIDs(std::vector<unsigned int>& hitIDs) { hitIDs_ = hitIDs; }

/**
* Sets the three coordinates of the cluster centroid
* @param x The x coordinate.
* @param y The y coordinate.
* @param z The z coordinate.
*/
void setCentroidXYZ(double x, double y, double z) {
centroidX_ = x;
centroidY_ = y;
centroidZ_ = z;
}

void setTime(double x) { time_ = x; }

double getEnergy() const { return energy_; }

int getNHits() const { return nHits_; }

double getCentroidX() const { return centroidX_; }

double getCentroidY() const { return centroidY_; }

double getCentroidZ() const { return centroidZ_; }

double getTime() const { return time_; }

const std::vector<unsigned int>& getHitIDs() const { return hitIDs_; }

bool operator<(const HcalCluster& rhs) const {
return this->getEnergy() < rhs.getEnergy();
}

private:
std::vector<unsigned int> hitIDs_;
double energy_{0};
int nHits_{0};
double centroidX_{0};
double centroidY_{0};
double centroidZ_{0};
double time_{0};

ClassDef(HcalCluster, 1);
Expand Down
4 changes: 2 additions & 2 deletions include/Hcal/Event/HcalHit.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class HcalHit : public ldmx::CalorimeterHit {
* Print out the object.
*/
void Print() const;

/**
* Get the number of photoelectrons estimated for this hit.
* @return Number of photoelectrons, including noise which affects the
Expand Down Expand Up @@ -222,7 +222,7 @@ class HcalHit : public ldmx::CalorimeterHit {
double toaNeg_;
double amplitudePos_;
double amplitudeNeg_;

/**
* The ROOT class definition.
*/
Expand Down
14 changes: 2 additions & 12 deletions src/Hcal/Event/HcalCluster.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,9 @@ ClassImp(ldmx::HcalCluster);
namespace ldmx {
HcalCluster::~HcalCluster() { Clear(); }

void HcalCluster::Print() const {
std::cout << "HcalCluster { "
<< "Energy: " << energy_ << ", "
<< "Number of hits: " << nHits_ << " }" << std::endl;
}

void HcalCluster::Clear() {
hitIDs_.clear();
energy_ = 0;
nHits_ = 0;
centroidX_ = 0;
centroidY_ = 0;
centroidZ_ = 0;
ldmx::CaloCluster::Clear();
time_ = 0;
}

void HcalCluster::addHits(const std::vector<const HcalHit *> hitsVec) {
Expand Down

0 comments on commit 52ea7db

Please sign in to comment.