Skip to content
Snippets Groups Projects
Commit 0db48478 authored by Christopher Rob Jones's avatar Christopher Rob Jones
Browse files

DecodedDataFromMCRichHits: Add readout inefficiency emulation

parent 1d24bf71
No related branches found
No related tags found
1 merge request!4337Misc. improvements to support RICH 4D Reco
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
// Gaudi (must be first) // Gaudi (must be first)
#include "GaudiKernel/ParsersFactory.h" #include "GaudiKernel/ParsersFactory.h"
#include "GaudiKernel/RndmGenerators.h"
#include "GaudiKernel/StdArrayAsProperty.h" #include "GaudiKernel/StdArrayAsProperty.h"
// Rich (Future) Kernel // Rich (Future) Kernel
...@@ -64,6 +65,12 @@ namespace Rich::Future::MC { ...@@ -64,6 +65,12 @@ namespace Rich::Future::MC {
} }
public: public:
/// Initialize
StatusCode initialize() override {
return MultiTransformer::initialize().andThen(
[&] { m_randZeroOne = Rndm::Numbers( randSvc(), Rndm::Flat( 0.0, 1.0 ) ); } );
}
/// Algorithm execution via transform /// Algorithm execution via transform
OutData operator()( LHCb::MCRichHits const& main_mchits ) const override { OutData operator()( LHCb::MCRichHits const& main_mchits ) const override {
...@@ -111,8 +118,7 @@ namespace Rich::Future::MC { ...@@ -111,8 +118,7 @@ namespace Rich::Future::MC {
continue; continue;
} }
// Are we inside the 0-25 ns window ? // Are we inside the 0-25 ns window ?
const auto hitT = getTime( mchit ); const auto hitT = getTime( mchit );
// time with shift for each RICH
const auto hitTShifted = hitT - m_timeShift[id.rich()]; const auto hitTShifted = hitT - m_timeShift[id.rich()];
_ri_verbo << "Shifted time = " << hitTShifted << endmsg; _ri_verbo << "Shifted time = " << hitTShifted << endmsg;
if ( hitTShifted >= 0.0 && hitTShifted <= 25.0 ) { if ( hitTShifted >= 0.0 && hitTShifted <= 25.0 ) {
...@@ -148,6 +154,9 @@ namespace Rich::Future::MC { ...@@ -148,6 +154,9 @@ namespace Rich::Future::MC {
// Should never fail but just in case... // Should never fail but just in case...
if ( hits.empty() ) { continue; } if ( hits.empty() ) { continue; }
// Apply random inefficiency for each RICH
if ( m_randZeroOne.shoot() > m_detEff[id.rich()] ) { continue; }
// temporary copy of SmartID // temporary copy of SmartID
auto newID = id; auto newID = id;
...@@ -206,6 +215,12 @@ namespace Rich::Future::MC { ...@@ -206,6 +215,12 @@ namespace Rich::Future::MC {
return out_data; return out_data;
} }
private:
// data
/// random number between 0 and 1
Rndm::Numbers m_randZeroOne{};
private: private:
// Handles to access MCRichHits other than Signal, as they are not necessary there // Handles to access MCRichHits other than Signal, as they are not necessary there
DataObjectReadHandle<LHCb::MCRichHits> m_prevHits{this, "PrevLocation", "Prev/" + LHCb::MCRichHitLocation::Default}; DataObjectReadHandle<LHCb::MCRichHits> m_prevHits{this, "PrevLocation", "Prev/" + LHCb::MCRichHitLocation::Default};
...@@ -240,6 +255,10 @@ namespace Rich::Future::MC { ...@@ -240,6 +255,10 @@ namespace Rich::Future::MC {
/// Time window shift for each RICH /// Time window shift for each RICH
Gaudi::Property<DetectorArray<double>> m_timeShift{ Gaudi::Property<DetectorArray<double>> m_timeShift{
this, "TimeCalib", {0., 40.}, "Global time shift for each RICH, to get both to same calibrated point"}; this, "TimeCalib", {0., 40.}, "Global time shift for each RICH, to get both to same calibrated point"};
/// RICH Detector efficiency factor
Gaudi::Property<DetectorArray<double>> m_detEff{
this, "ReadoutEfficiency", {0.95, 0.95}, "Readout efficiency to emulate for each RICH"};
}; };
// Declaration of the Algorithm Factory // Declaration of the Algorithm Factory
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment