This repository has been archived by the owner on May 9, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #70 from LDMX-Software/68-meta-issue-for-several-t…
…iny-patches 68 meta issue for several tiny patches
- Loading branch information
Showing
28 changed files
with
904 additions
and
925 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 */ |
Oops, something went wrong.