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

68 meta issue for several tiny patches #70

Merged
merged 26 commits into from
Sep 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
f8c987e
Patch uninitialized memory
EinarElen Sep 14, 2023
f75570a
Add collection names to python config
EinarElen Sep 14, 2023
1f9ccb9
Replace hardcoded collections
EinarElen Sep 14, 2023
7a9fcd3
Remove max depth from python config
EinarElen Sep 14, 2023
23fc8e1
Remove max depth condition
EinarElen Sep 14, 2023
07944dd
Add warning if depth setting is used, rename minPE
EinarElen Sep 14, 2023
3d5ab49
Merge branch '58-uninitialized-entries-in-hcalveto' into 68-meta-issu…
EinarElen Sep 14, 2023
2d70077
Binary search gang
EinarElen Sep 14, 2023
621f7d0
Merge branch '61-default-hcal-veto-settings-ignores-a-large-portion-o…
EinarElen Sep 14, 2023
027f5e3
Merge branch '67-hcal-reconstruction-performance-significantly-pessim…
EinarElen Sep 14, 2023
2901561
Use a floating point table for trigprim conditions
EinarElen Sep 14, 2023
7932ea1
Merge branch '66-floating-point-values-in-integer-conditions-table' i…
EinarElen Sep 14, 2023
565ae0a
Clang-format the affected files
EinarElen Sep 14, 2023
da537d6
Constructors/destructors
EinarElen Sep 14, 2023
67efe1a
Merge misses
EinarElen Sep 14, 2023
ec8b76e
Add interfaces for all processors
EinarElen Sep 14, 2023
f08df28
Minor const correctness
EinarElen Sep 14, 2023
6b50a91
Virtual/destructors
EinarElen Sep 14, 2023
ecc0a4a
Remove unused copies in recproducer
EinarElen Sep 14, 2023
8171b1a
Last virtual checkup
EinarElen Sep 14, 2023
1e739f8
Revert to integer, round explicitly
EinarElen Sep 14, 2023
7c5545a
Merge branch '66-floating-point-values-in-integer-conditions-table' i…
EinarElen Sep 14, 2023
f843844
Parens around &
EinarElen Sep 14, 2023
d5fc0f4
Remove some of the debug code
EinarElen Sep 15, 2023
fc619f2
Mark unused variables
EinarElen Sep 15, 2023
d4016b9
Shadowing in raw decoder
EinarElen Sep 15, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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