Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-30 09:17:11

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 <DDDigi/DigiContainerProcessor.h>
0016 #include <DD4hep/DD4hepUnits.h>
0017 
0018 /// C/C++ include files
0019 #include <limits>
0020 
0021 /// Namespace for the AIDA detector description toolkit
0022 namespace dd4hep {
0023 
0024   /// Namespace for the Digitization part of the AIDA detector description toolkit
0025   namespace digi {
0026 
0027     /// Actor to zero-suppress a container of energy deposits
0028     /**
0029      *
0030      *
0031      *  \author  M.Frank
0032      *  \version 1.0
0033      *  \ingroup DD4HEP_DIGITIZATION
0034      */
0035     class DigiDepositZeroSuppress : public DigiDepositsProcessor   {
0036     protected:
0037       /// Property: Intrinsic energy resolution constant (gaussian ~ std::sqrt(energy))
0038       double m_energy_threshold                { 0e0 };
0039 
0040     public:
0041       /// Create deposit mapping with updates on same cellIDs
0042       template <typename T> void
0043       handle_deposits(DigiContext& context, T& cont, work_t& /* work */, const predicate_t& predicate)  const  {
0044         std::size_t killed  = 0UL;
0045         std::size_t handled = 0UL;
0046         for( auto& dep : cont )    {
0047           if ( predicate(dep) )   {
0048             int flag = EnergyDeposit::ZERO_SUPPRESSED;
0049             if ( dep.second.deposit * dd4hep::GeV < m_energy_threshold )   {
0050               flag |= EnergyDeposit::KILLED;
0051               ++killed;
0052             }
0053             dep.second.flag |= flag;
0054             ++handled;
0055           }
0056         }
0057         info("%s+++ %-32s Zero suppression: entries: %6ld handled: %6ld killed %6ld entries from mask: %04X",
0058              context.event->id(), cont.name.c_str(), cont.size(), handled, killed, cont.key.mask());
0059       }
0060       /// Standard constructor
0061       DigiDepositZeroSuppress(const DigiKernel& krnl, const std::string& nam)
0062         : DigiDepositsProcessor(krnl, nam)
0063       {
0064         declareProperty("threshold", m_energy_threshold);
0065         DEPOSIT_PROCESSOR_BIND_HANDLERS(DigiDepositZeroSuppress::handle_deposits);
0066       }
0067     };
0068   }    // End namespace digi
0069 }      // End namespace dd4hep
0070 
0071 #include <DDDigi/DigiFactories.h>
0072 DECLARE_DIGIACTION_NS(dd4hep::digi,DigiDepositZeroSuppress)