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/DigiContext.h>
0016 #include <DDDigi/DigiContainerProcessor.h>
0017 
0018 /// Namespace for the AIDA detector description toolkit
0019 namespace dd4hep {
0020   /// Namespace for the Digitization part of the AIDA detector description toolkit
0021   namespace digi {
0022 
0023     /// Actor to select energy deposits according to the supplied segmentation
0024     /** Actor to select energy deposits according to the supplied segmentation
0025      *
0026      *  The selected deposits are placed in the output container
0027      *  supplied by the arguments.
0028      *
0029      *  \author  M.Frank
0030      *  \version 1.0
0031      *  \ingroup DD4HEP_DIGITIZATION
0032      */
0033     class DigiCellMultiplicityCounter : public DigiContainerProcessor   {
0034     public:
0035       /// Standard constructor
0036       using DigiContainerProcessor::DigiContainerProcessor;
0037 
0038       template <typename T> void count_deposits(const char* tag, const T& cont)  const  {
0039     std::map<CellID, std::size_t> entries;
0040     for( const auto& dep : cont )   {
0041       CellID        cell = dep.first;
0042       entries[cell] += 1;
0043     }
0044     info("%s+++ %-32s has %6ld entries and %6ld unique cells",
0045          tag, cont.name.c_str(), cont.size(), entries.size());
0046       }
0047       /// Main functional callback
0048       virtual void execute(DigiContext& context, work_t& work, const predicate_t&)  const override final  {
0049     if ( const auto* m = work.get_input<DepositMapping>() )
0050       count_deposits(context.event->id(), *m);
0051     else if ( const auto* v = work.get_input<DepositVector>() )
0052       count_deposits(context.event->id(), *v);
0053     else
0054       except("Request to handle unknown data type: %s", work.input_type_name().c_str());
0055       }
0056     };
0057   }    // End namespace digi
0058 }      // End namespace dd4hep
0059 
0060 #include <DDDigi/DigiFactories.h>
0061 DECLARE_DIGIACTION_NS(dd4hep::digi,DigiCellMultiplicityCounter)