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 
0017 /// C/C++ include files
0018 #include <limits>
0019 
0020 /// Namespace for the AIDA detector description toolkit
0021 namespace dd4hep {
0022 
0023   /// Namespace for the Digitization part of the AIDA detector description toolkit
0024   namespace digi {
0025 
0026     /// Actor to merge energy deposits weighted with their energy deposit
0027     /**
0028      *  The selected deposits are placed in the output container
0029      *  supplied by the arguments. Multiple CellIDs will be merged to one single 
0030      *  deposit, where the merge computes the resulting position and
0031      *  momentum according to the contribution of the hits.
0032      *
0033      *  \author  M.Frank
0034      *  \version 1.0
0035      *  \ingroup DD4HEP_DIGITIZATION
0036      */
0037     class DigiDepositEnergyCut : public DigiDepositsProcessor   {
0038     protected:
0039       /// Property: Energy cutoff. No hits will be merged with a deposit smaller
0040       double m_cutoff { -std::numeric_limits<double>::epsilon() };
0041 
0042     public:
0043       /// Create deposit mapping with updates on same cellIDs
0044       template <typename T> void
0045       cut_energy(context_t& context, T& cont, work_t& /* work */, const predicate_t& predicate)  const  {
0046         std::size_t dropped = 0UL;
0047         for( auto& dep : cont )    {
0048           if ( predicate(dep) )   {
0049             EnergyDeposit& depo = dep.second;
0050             if ( depo.deposit < m_cutoff )   {
0051               depo.flag |= EnergyDeposit::KILLED;
0052               ++dropped;
0053             }
0054           }
0055         }
0056         if ( m_monitor ) m_monitor->count_shift(cont.size(), dropped);
0057         info("%s+++ %-32s dropped %6ld out of %6ld entries from mask: %04X",
0058              context.event->id(), cont.name.c_str(), dropped, cont.size(), cont.key.mask());
0059       }
0060 
0061       /// Standard constructor
0062       DigiDepositEnergyCut(const DigiKernel& krnl, const std::string& nam)
0063         : DigiDepositsProcessor(krnl, nam)
0064       {
0065         declareProperty("deposit_cutoff", m_cutoff);
0066         DEPOSIT_PROCESSOR_BIND_HANDLERS(DigiDepositEnergyCut::cut_energy);
0067       }
0068     };
0069   }    // End namespace digi
0070 }      // End namespace dd4hep
0071 
0072 #include <DDDigi/DigiFactories.h>
0073 DECLARE_DIGIACTION_NS(dd4hep::digi,DigiDepositEnergyCut)