Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
//==========================================================================
// AIDA Detector description implementation
//--------------------------------------------------------------------------
// Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
// All rights reserved.
//
// For the licensing terms see $DD4hepINSTALL/LICENSE.
// For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
//
// Author : M.Frank
//
//==========================================================================
// Framework include files
#include <DDDigi/DigiContext.h>
#include <DDDigi/DigiSegmentationSplitter.h>
/// Namespace for the AIDA detector description toolkit
namespace dd4hep {
/// Namespace for the Digitization part of the AIDA detector description toolkit
namespace digi {
/// Helper class to print energy deposits pre-selected by the segment splitter
/** Helper class to print energy deposits pre-selected by the segment splitter
*
* \author M.Frank
* \version 1.0
* \ingroup DD4HEP_SIMULATION
*/
class DigiSegmentDepositPrint : public DigiSegmentAction {
public:
/// Constructors used of base class
using DigiSegmentAction::DigiSegmentAction;
/// Main functional callback
virtual DepositVector
handleSegment(DigiContext& context,
const DigiSegmentContext& segment,
const DepositMapping& deposits) const override final {
char format[256];
::snprintf(format, sizeof(format),
"%s[%s] %s-id: %%d [processor:%d] Cell: %%016lX mask: %016lX hist:%%4ld entries deposit: %%f",
context.event->id(), segment.idspec.name(), segment.cname(), segment.id, segment.split_mask);
for( const auto& d : deposits ) {
if ( segment.matches(d.first) ) {
auto cell = d.first;
auto& depo = d.second;
info(format, segment.split_id(cell), cell, depo.history.size(), depo.deposit);
}
}
return {};
}
};
} // End namespace digi
} // End namespace dd4hep
#include <DDDigi/DigiFactories.h>
DECLARE_DIGISEGMENTACTION_NS(dd4hep::digi,DigiSegmentDepositPrint)