Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:14:07

0001 //==========================================================================
0002 //  AIDA Detector description implementation 
0003 //--------------------------------------------------------------------------
0004 // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
0005 // All rights reserved.
0006 //
0007 // For the licensing terms see $DD4hepINSTALL/LICENSE.
0008 // For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
0009 //
0010 // Author     : M.Frank
0011 //
0012 //==========================================================================
0013 
0014 // Framework include files
0015 #include <DD4hep/InstanceCount.h>
0016 #include <DDDigi/DigiKernel.h>
0017 #include <DDDigi/DigiSegmentation.h>
0018 #include <DDDigi/noise/DigiSignalProcessorSequence.h>
0019 
0020 // C/C++ include files
0021 #include <stdexcept>
0022 
0023 using namespace dd4hep::digi;
0024 
0025 template <> void 
0026 DigiParallelWorker<DigiSignalProcessor, 
0027            DigiSignalProcessorSequence::CallData,
0028            int>::execute(void* data) const  {
0029   calldata_t* args = reinterpret_cast<calldata_t*>(data);
0030   args->value += (*action)(args->context);
0031 }
0032 
0033 /// Standard constructor
0034 DigiSignalProcessorSequence::DigiSignalProcessorSequence(const DigiKernel& kernel, const std::string& nam)
0035   : DigiSignalProcessor(kernel, nam)
0036 {
0037   InstanceCount::increment(this);
0038 }
0039 
0040 /// Default destructor
0041 DigiSignalProcessorSequence::~DigiSignalProcessorSequence() {
0042   InstanceCount::decrement(this);
0043 }
0044 
0045 /// Adopt a new action as part of the sequence. Sequence takes ownership.
0046 void DigiSignalProcessorSequence::adopt(DigiSignalProcessor* action)    {
0047   if (action)    {
0048     m_actors.insert(new Worker(action, 0));
0049     return;
0050   }
0051   except("DigiSignalProcessorSequence","++ Attempt to add invalid actor!");
0052 }
0053 
0054 /// Pre-track action callback
0055 double DigiSignalProcessorSequence::operator()(DigiCellContext& context)  const   {
0056   CallData args { context, 0e0 };
0057   double result = context.data.signal;
0058   auto group = m_actors.get_group();
0059   for ( const auto* p : group.actors() )  {
0060     args.value = 0e0;
0061     p->execute(&args);
0062     result += args.value;
0063   }
0064   return context.data.kill ? 0e0 : result;
0065 }