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 #70 from LDMX-Software/68-meta-issue-for-several-t…
Browse files Browse the repository at this point in the history
…iny-patches

68 meta issue for several tiny patches
  • Loading branch information
EinarElen authored Sep 18, 2023
2 parents 43b05f8 + d4016b9 commit 9292876
Show file tree
Hide file tree
Showing 28 changed files with 904 additions and 925 deletions.
2 changes: 1 addition & 1 deletion include/Hcal/Event/HcalCluster.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class HcalCluster {
/**
* Class constructor.
*/
HcalCluster();
HcalCluster() = default;

/**
* Class destructor.
Expand Down
15 changes: 9 additions & 6 deletions include/Hcal/Event/HcalHit.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ class HcalHit : public ldmx::CalorimeterHit {
/**
* Class constructor.
*/
HcalHit() {}
HcalHit() = default;

/**
* Class destructor.
*/
virtual ~HcalHit() {}
virtual ~HcalHit() = default;

/**
* Clear the data in the object.
Expand Down Expand Up @@ -188,11 +188,14 @@ class HcalHit : public ldmx::CalorimeterHit {
/**
* Set original position
*/
void setPositionUnchanged(double position, int isX) { position_ = position; isX_ = isX; }
void setPositionUnchanged(double position, int isX) {
position_ = position;
isX_ = isX;
}

double getPosition() const { return position_;}
int getIsX() const { return isX_;}
double getTimeDiff() const { return timeDiff_;}
double getPosition() const { return position_; }
int getIsX() const { return isX_; }
double getTimeDiff() const { return timeDiff_; }

private:
/** The number of PE estimated for this hit. */
Expand Down
12 changes: 5 additions & 7 deletions include/Hcal/Event/HcalVetoResult.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ namespace ldmx {
class HcalVetoResult {
public:
/** Constructor */
HcalVetoResult();
HcalVetoResult() = default;

/** Destructor */
~HcalVetoResult();
virtual ~HcalVetoResult() = default;

/** Reset the object. */
void Clear();
Expand All @@ -38,14 +38,14 @@ class HcalVetoResult {
bool passesVeto() const { return passesVeto_; };

/** @return The maximum PE HcalHit. */
inline ldmx::HcalHit getMaxPEHit() const { return maxPEHit_; }
ldmx::HcalHit getMaxPEHit() const { return maxPEHit_; }

/**
* Sets whether the Hcal veto was passed or not.
*
* @param passesVeto Veto result.
*/
inline void setVetoResult(const bool& passesVeto = true) {
void setVetoResult(const bool& passesVeto = true) {
passesVeto_ = passesVeto;
}

Expand All @@ -54,9 +54,7 @@ class HcalVetoResult {
*
* @param maxPEHit The maximum PE HcalHit
*/
inline void setMaxPEHit(const ldmx::HcalHit maxPEHit) {
maxPEHit_ = maxPEHit;
}
void setMaxPEHit(const ldmx::HcalHit maxPEHit) { maxPEHit_ = maxPEHit; }

private:
/** Reference to max PE hit. */
Expand Down
59 changes: 59 additions & 0 deletions include/Hcal/HcalAlignPolarfires.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
#ifndef HCALALIGNPOLARFIRES_H
#define HCALALIGNPOLARFIRES_H
#include <queue>

#include "Framework/EventProcessor.h"
#include "Recon/Event/HgcrocDigiCollection.h"

namespace hcal {
/**
* Align the two polarfires with drop/keep hints signalling successful merge
*
* - Only checking for /dropped/ events
* - assuming that ticks and spills are already in correct ORDER
* - assuming spill numbering is NOT the same between the two DPMs
*/
class HcalAlignPolarfires : public framework::Producer {
/// input decoded objects (vector index == polarfire index)
std::vector<std::string> input_names_;
/// pass name for decoded objects
std::string input_pass_;
/// output object name
std::string output_name_;
/// number of 5MHz ticks difference to consider polarfires aligned
static int max_tick_diff_;

public:
struct PolarfireQueueEntry {
/// the i'th spill
int spill;
/// ticks since spill
int ticks;
ldmx::HgcrocDigiCollection digis;
PolarfireQueueEntry(const framework::Event& event,
const std::string& input_name,
const std::string& input_pass,
std::pair<int, int>& spill_counter);
bool same_event(const PolarfireQueueEntry& rhs) {
return (spill == rhs.spill and abs(ticks - rhs.ticks) < max_tick_diff_);
}
bool earlier_event(const PolarfireQueueEntry& rhs) {
if (spill == rhs.spill) return ticks < rhs.ticks;
return spill < rhs.spill;
}
};
/// queue of unmatched digis
std::queue<PolarfireQueueEntry> pf0_queue, pf1_queue;
/// spill counter
std::pair<int, int> pf0_spill_counter{0, -1}, pf1_spill_counter{0, -1};

public:
HcalAlignPolarfires(const std::string& n, framework::Process& p)
: framework::Producer(n, p) {}
virtual ~HcalAlignPolarfires() = default;
void configure(framework::config::Parameters& ps) override;
void produce(framework::Event& event) override;
};

} // namespace hcal
#endif /* HCALALIGNPOLARFIRES_H */
4 changes: 2 additions & 2 deletions include/Hcal/HcalClusterProducer.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ class HcalClusterProducer : public framework::Producer {
*
* @param parameters Set of parameters used to configure this processor.
*/
void configure(framework::config::Parameters& parameters) final override;
void configure(framework::config::Parameters& parameters) override;

virtual void produce(framework::Event& event);
void produce(framework::Event& event) override;

private:
bool verbose_{false};
Expand Down
6 changes: 3 additions & 3 deletions include/Hcal/HcalDigiProducer.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,19 @@ class HcalDigiProducer : public framework::Producer {
HcalDigiProducer(const std::string& name, framework::Process& process);

/// Default destructor
~HcalDigiProducer() = default;
virtual ~HcalDigiProducer() = default;

/**
* Configure this producer from the python configuration.
* Sets event constants and configures the noise generator, noise injector,
* and pulse function. Creates digi collection
*/
void configure(framework::config::Parameters&) final override;
void configure(framework::config::Parameters&) override;

/**
* Simulates measurement of pulse and creates digi collection for input event.
*/
void produce(framework::Event& event) final override;
void produce(framework::Event& event) override;

private:
///////////////////////////////////////////////////////////////////////////////////////
Expand Down
44 changes: 44 additions & 0 deletions include/Hcal/HcalDoubleEndRecProducer.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#ifndef HCALDOUBLEENDRECPRODUCER_H
#define HCALDOUBLEENDRECPRODUCER_H

#include "Conditions/SimpleTableCondition.h"
#include "DetDescr/DetectorID.h"
#include "DetDescr/HcalDigiID.h"
#include "DetDescr/HcalGeometry.h"
#include "DetDescr/HcalID.h"
#include "Framework/EventDef.h"
#include "Framework/EventProcessor.h"
#include "Hcal/HcalReconConditions.h"
#include "Recon/Event/HgcrocDigiCollection.h"
namespace hcal {

class HcalDoubleEndRecProducer : public framework::Producer {
private:
/// name of pass of rechits to use
std::string pass_name_{""};
/// name of rechits to use as input
std::string coll_name_{"HcalRecHits"};
/// name of pass of rechits to reconstruct
std::string rec_pass_name_{""};
/// name of rechits to reconstruct
std::string rec_coll_name_{"HcalRecHitsDoubleEnd"};

/// number of PEs per MIP
double pe_per_mip_;
/// energy per MIP [MeV]
double mip_energy_;
/// length of clock cycle [ns]
double clock_cycle_;

public:
HcalDoubleEndRecProducer(const std::string& n, framework::Process& p)
: Producer(n, p) {}

virtual ~HcalDoubleEndRecProducer() = default;
void configure(framework::config::Parameters& p) override;
void produce(framework::Event& event) override;

}; // HcalDoubleEndRecProducer
} // namespace hcal

#endif /* HCALDOUBLEENDRECPRODUCER_H */
63 changes: 63 additions & 0 deletions include/Hcal/HcalPedestalAnalyzer.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
#ifndef HCALPEDESTALANALYZER_H
#define HCALPEDESTALANALYZER_H

#include "DetDescr/HcalDigiID.h"
#include "Framework/EventProcessor.h"
#include "Recon/Event/HgcrocDigiCollection.h"
namespace hcal {

class HcalPedestalAnalyzer : public framework::Analyzer {
std::string input_name_, input_pass_;
std::string output_file_, comments_;
bool make_histos_;
bool filter_noTOT;
bool filter_noTOA;
int low_cutoff_, high_cutoff_;

struct Channel {
Channel() : hist{0}, sum{0}, sum_sq{0}, entries{0}, rejects{4, 0} {}
/// collection of hits accumulated to produce appropriately-binned
/// histograms
std::vector<int> adcs;
/// Histogram, if used
TH1* hist;
/// Sum of values
uint64_t sum;
/// Sum of values squared
double sum_sq;
/// Number of entries
int entries;
/// counts of various rejections
std::vector<int> rejects;
};

std::map<ldmx::HcalDigiID, Channel> pedestal_data_;

void create_and_fill(Channel& chan, ldmx::HcalDigiID detid);

public:
HcalPedestalAnalyzer(const std::string& n, framework::Process& p)
: framework::Analyzer(n, p) {}
virtual ~HcalPedestalAnalyzer() = default;

void configure(framework::config::Parameters& ps) override {
input_name_ = ps.getParameter<std::string>("input_name");
input_pass_ = ps.getParameter<std::string>("input_pass");
output_file_ = ps.getParameter<std::string>("output_file");
comments_ = ps.getParameter<std::string>("comments");

make_histos_ = ps.getParameter<bool>("make_histos", false);

filter_noTOT = ps.getParameter<bool>("filter_noTOT", true);
filter_noTOA = ps.getParameter<bool>("filter_noTOA", true);
low_cutoff_ = ps.getParameter<int>("low_cutoff", 10);
high_cutoff_ = ps.getParameter<int>("high_cutoff", 512);
}

void analyze(const framework::Event& event) override;
void onProcessEnd() override;
};

} // namespace hcal

#endif /* HCALPEDESTALANALYZER_H */
Loading

0 comments on commit 9292876

Please sign in to comment.