This repository has been archived by the owner on May 3, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
new raw decoding processor using ecal detector map
- Loading branch information
1 parent
71c1c29
commit 2b13c9e
Showing
3 changed files
with
119 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#ifndef ECAL_ECALRAWDECODER_H_ | ||
#define ECAL_ECALRAWDECODER_H_ | ||
|
||
//----------// | ||
// LDMX // | ||
//----------// | ||
#include "Framework/EventProcessor.h" | ||
|
||
namespace ecal { | ||
|
||
/** | ||
* @class EcalRawDecoder | ||
*/ | ||
class EcalRawDecoder : public framework::Producer { | ||
public: | ||
/** | ||
* Constructor | ||
*/ | ||
EcalRawDecoder(const std::string& name, framework::Process& process); | ||
|
||
/** | ||
* Destructor | ||
*/ | ||
virtual ~EcalRawDecoder(); | ||
|
||
/** | ||
*/ | ||
virtual void configure(framework::config::Parameters&); | ||
|
||
/** | ||
*/ | ||
virtual void produce(framework::Event& event); | ||
|
||
private: | ||
/// input object of encoded data | ||
std::string input_name_; | ||
/// input pass of creating encoded data | ||
std::string input_pass_; | ||
/// output object to put onto event bus | ||
std::string output_name_; | ||
/// version of HGC ROC we are decoding | ||
int roc_version_; | ||
|
||
}; | ||
} // namespace ecal | ||
|
||
#endif |
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,71 @@ | ||
/** | ||
* @file EcalRawDecoder.cxx | ||
* @brief Class that performs basic ECal digitization | ||
* @author Cameron Bravo, SLAC National Accelerator Laboratory | ||
* @author Tom Eichlersmith, University of Minnesota | ||
*/ | ||
|
||
#include "Ecal/EcalRawDecoder.h" | ||
#include "Recon/Event/HgcrocDigiCollection.h" | ||
#include "Tools/HgcrocDecoder.h" | ||
#include "DetDescr/EcalElectronicsID.h" | ||
#include "DetDescr/EcalID.h" | ||
#include "Ecal/EcalDetectorMap.h" | ||
|
||
namespace ecal { | ||
|
||
EcalRawDecoder::EcalRawDecoder(const std::string& name, | ||
framework::Process& process) | ||
: Producer(name, process) { | ||
} | ||
|
||
EcalRawDecoder::~EcalRawDecoder() {} | ||
|
||
void EcalRawDecoder::configure(framework::config::Parameters& ps) { | ||
input_name_ = ps.getParameter<std::string>("input_name"); | ||
input_pass_ = ps.getParameter<std::string>("input_pass"); | ||
output_name_ = ps.getParameter<std::string>("output_name"); | ||
roc_version_ = ps.getParameter<int>("roc_version"); | ||
} | ||
|
||
void EcalRawDecoder::produce(framework::Event& event) { | ||
/** | ||
* Decoding of raw data | ||
* | ||
* First we unpack the encoded data into a map | ||
* of electronic IDs to sets of timesamples. | ||
* This is done by another utility class | ||
*/ | ||
tools::HgcrocDecoder decoder{roc_version_}; | ||
auto eid_to_samples{ | ||
decoder.decode(event.getCollection<uint32_t>(input_name_, input_pass_))}; | ||
|
||
/** | ||
* Translation | ||
* | ||
* Now the HgcrocDigiCollection::Sample class handles the | ||
* unpacking of individual samples; however, we still need | ||
* to translate electronic IDs into detector IDs. | ||
*/ | ||
auto detmap{getCondition<EcalDetectorMap>(EcalDetectorMap::CONDITIONS_OBJECT_NAME).emap()}; | ||
ldmx::HgcrocDigiCollection digis; | ||
for (auto const& [eid_raw, digi] : eid_to_samples) { | ||
// TODO: This checking of existence should be temporary, | ||
// the electronic ID mapping should be complete. | ||
uint32_t did_raw{eid_raw}; | ||
ldmx::EcalElectronicsID eid{eid_raw}; | ||
if (detmap.exists(eid)) { | ||
did_raw = detmap.get(eid).raw(); | ||
} | ||
|
||
digis.addDigi(did_raw, digi); | ||
} | ||
|
||
event.add(output_name_, digis); | ||
|
||
return; | ||
} // produce | ||
|
||
} // namespace ecal | ||
|
||
DECLARE_PRODUCER_NS(ecal, EcalRawDecoder); |