-
Notifications
You must be signed in to change notification settings - Fork 5
Add type for HGC/CALOROC output #101
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ruse-traveler
wants to merge
20
commits into
main
Choose a base branch
from
add-hgcroc-digitization
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
b921de7
Add type for HGCROC output
ruse-traveler 8353464
Merge branch 'main' into add-hgcroc-digitization
ruse-traveler c866c34
Make ToT a vector of samples, and rename to CALOROC
ruse-traveler 95e6f97
Make AMPLITUDE (not ToT) vector, add phase of samples
ruse-traveler e638c94
Add 1A/AB distinction
ruse-traveler 0b5f271
Upgrade ToA or ToT to vector members
ruse-traveler 85ae8ad
Add Sylvester and Norbert to authors, fix time units
ruse-traveler 55fff88
Fix typo, make units consistent
ruse-traveler 75f0537
Make units consistent
ruse-traveler 5a6441d
Make units consistent
ruse-traveler 6fa9bf5
Make units consistent
ruse-traveler 1a41810
Make non-time-related fields unsigned ints
ruse-traveler 6397ca3
Update edm4eic.yaml
veprbl 3449bf6
Merge branch 'main' into add-hgcroc-digitization
ruse-traveler 40fbf14
Make ToA/ToT comments more descriptive, fix formatting
ruse-traveler 9c28c9a
Merge low/high gain readout into amplitude field
ruse-traveler 2642c04
Begin work on unit test
ruse-traveler b0165a5
Fix typo
ruse-traveler a88692a
Make get*GainAmplitude methods consistent with getAmplitude()
ruse-traveler 6501e44
Fix still more typos
ruse-traveler File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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,21 @@ | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
#include "test_caloroc_hits.h" | ||
#include "podio/ROOTWriter.h" | ||
#include "podio/ROOTReader.h" | ||
|
||
int main(int argc, char* argv[]) { | ||
|
||
// announce start | ||
std::cout << "Start raw CALOROC tests." << std::endl; | ||
|
||
// run tests | ||
TestCALOROCHits<podio::ROOTWriter, podio::ROOTReader> test(1); | ||
test.WriteHits("edm4eic_rawcalorochits.root"); | ||
test.ReadHits("edm4eic_rawcalorochits.root"); | ||
|
||
// announce end & exit | ||
std::cout << "Raw CALOROC tests finished." << std::endl; | ||
return 0; | ||
|
||
} |
This file contains hidden or 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,126 @@ | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
#ifndef EDM4EIC_TEST_CALOROC_HITS_H | ||
#define EDM4EIC_TEST_CALOROC_HITS_H | ||
|
||
// edm for caloroc hits | ||
#include "edm4eic/RawCALOROCHitCollection.h" | ||
|
||
// podio-specific includes | ||
#include "podio/Frame.h" | ||
|
||
// stl includes | ||
#include <array> | ||
#include <iostream> | ||
#include <string> | ||
|
||
|
||
|
||
// ============================================================================ | ||
//! Test implementation of raw CALOROC hits | ||
// ============================================================================ | ||
/*! This is a simple unit test to check the implementation of both | ||
* type 1A (1 readout) and type 1B (low and high gain readouts) | ||
* raw CALOROC hits. | ||
*/ | ||
template <class WriterT, class ReaderT> | ||
class TestCALOROCHits { | ||
|
||
private: | ||
|
||
/// this is the threshold used to define the | ||
/// time-of-arrival and time-over-threshold | ||
/// values | ||
uint32_t m_threshold; | ||
|
||
/// this array defines amplitudes which mock-up a | ||
/// typical waveform produced by an HGC/CALOROC | ||
static const std::array<uint32_t, 112> m_arrAdcCounts = { | ||
0, 0, 1, 2, 11, 43, 143, 338, 542, | ||
729, 875, 963, 1000, 993, 956, 902, 840, 774, | ||
709, 647, 593, 544, 500, 461, 428, 400, 374, | ||
350, 328, 307, 286, 268, 252, 236, 221, 206, | ||
193, 181, 169, 157, 146, 137, 129, 120, 112, | ||
105, 98, 91, 85, 81, 75, 70, 65, 62, | ||
58, 54, 50, 47, 44, 42, 39, 37, 34, | ||
31, 29, 28, 27, 24, 23, 21, 20, 19, | ||
18, 17, 16, 15, 14, 13, 12, 11, 11, | ||
10, 10, 10, 9, 9, 8, 8, 7, 7, | ||
7, 6, 6, 6, 5, 5, 5, 5, 5, | ||
5, 5, 5, 4, 4, 4, 4, 4, 4, | ||
4, 4, 4, 3}; | ||
|
||
public: | ||
|
||
// ------------------------------------------------------------------------ | ||
//! Test writing CALOROC hits | ||
// ------------------------------------------------------------------------ | ||
void WriteHits(const std::string& outfilename) { | ||
|
||
std::cout << "\n --- Begin raw CALOROC write test" << std::endl; | ||
|
||
// create writer to store output hits | ||
WriterT writer(outfilename); | ||
std::cout << " - created writer, writing to:\n" | ||
<< " " << outfilename | ||
<< std::endl; | ||
|
||
// create frame & collections to hold output hits | ||
auto frame = podio::Frame(); | ||
auto ahits = edm4eic::RawCALOROCHitCollection(); | ||
auto bhits = edm4eic::RawCALOROCHitCollection(); | ||
std::cout << " - created frame/colletions" << std::endl; | ||
|
||
// 1st create a type 1A hit | ||
auto ahit = ahits.create(); | ||
ahit.setType(0); | ||
|
||
/* TODO SET 1A members here */ | ||
std::cout << " - created type 1A hit" << std::endl; | ||
|
||
// 2nd create a type 1B hit | ||
auto bhit = bhits.create(); | ||
bhit.setType(1); | ||
|
||
/* TODO SET 1B members here */ | ||
std::cout << " - created type 1B hit" << std::endl; | ||
|
||
// write hit collections to frame & add a flag to | ||
// indicate this is a test frame | ||
frame.put(std::move(ahits), "RawType1ACALOROCHits"); | ||
frame.put(std::move(bhits), "RawType1BCALOROCHits"); | ||
frame.putParameter("FrameType", "test"); | ||
std::cout << " - Saved hits to frame" << std::endl; | ||
|
||
// write frame, close writer | ||
writer.writeFrame(frame, "events"); | ||
writer.finish(); | ||
std::cout << " - Wrote frame & closed writer\n" | ||
<< " - Write test complete!" | ||
<< std::endl; | ||
|
||
// exit | ||
return; | ||
|
||
} // end 'WriteHits(std::string&)' | ||
|
||
// ------------------------------------------------------------------------ | ||
//! Test reading CALOROC hits | ||
// ------------------------------------------------------------------------ | ||
void ReadHits(const std::string& infilename) { | ||
|
||
std::cout << "\n --- Begin raw CALOROC read test" << std::endl; | ||
|
||
/* TODO put test here */ | ||
return; | ||
|
||
} // end 'ReadHits(std::string&)' | ||
|
||
// ctor/dtor | ||
TestCALOROCHits(const uint32_t threshold = 1) : m_threshold(threshold) {}; | ||
~TestCALOROCHits() {}; | ||
|
||
}; // end TestCALOROCHits<WriterT, ReaderT> | ||
|
||
|
||
#endif |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Having just fixed a whole bunch of signed/unsigned comparisons, can we please use unsigned ints where appropriate?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point! Most of these can be
uint32_t
s...