ATLAS Offline Software
Public Member Functions | Protected Attributes | Private Attributes | List of all members
ALFA_SimHitsTestTool Class Reference

#include <ALFA_SimHitsTestTool.h>

Inheritance diagram for ALFA_SimHitsTestTool:
Collaboration diagram for ALFA_SimHitsTestTool:

Public Member Functions

 ALFA_SimHitsTestTool (const std::string &type, const std::string &name, const IInterface *parent)
 
StatusCode initialize ()
 
StatusCode processEvent ()
 

Protected Attributes

std::string m_path {"/truth/"}
 
ServiceHandle< ITHistSvc > m_histSvc {"THistSvc", "SimTestHisto"}
 

Private Attributes

TH2 * m_hit_map_h [8]
 
TH2 * m_E_layer_sum_h [8]
 
TH1 * m_E_full_sum_h [8]
 
TH1 * m_E_gvs {}
 

structors and AlgTool implementation

std::string m_key
 The MC truth key. More...
 
HepMC::ConstGenParticlePtr getPrimary ()
 

Detailed Description

Definition at line 11 of file ALFA_SimHitsTestTool.h.

Constructor & Destructor Documentation

◆ ALFA_SimHitsTestTool()

ALFA_SimHitsTestTool::ALFA_SimHitsTestTool ( const std::string &  type,
const std::string &  name,
const IInterface *  parent 
)

Definition at line 20 of file ALFA_SimHitsTestTool.cxx.

22 {
23  for (int i(0); i<8; ++i) {
24  m_E_full_sum_h[i]=nullptr;
25  m_E_layer_sum_h[i]=nullptr;
26  m_hit_map_h[i]=nullptr;
27  }
28 }

Member Function Documentation

◆ getPrimary()

HepMC::ConstGenParticlePtr SimTestToolBase::getPrimary ( )
protectedinherited

Definition at line 20 of file SimTestToolBase.cxx.

21 {
22  const McEventCollection* mcCollection;
23  if (evtStore()->retrieve(mcCollection,m_key).isSuccess()) {
25  for (e=mcCollection->begin();e!=mcCollection->end(); ++e) {
26  for (auto p : (**e)) {
28  return p;
29  }
30  }
31  }
32  }
33  return 0;
34 }

◆ initialize()

StatusCode ALFA_SimHitsTestTool::initialize ( )
virtual

Reimplemented from SimTestToolBase.

Definition at line 30 of file ALFA_SimHitsTestTool.cxx.

31 {
32  m_path+="ALFA/";
33 
34  _TH1D(m_E_gvs,"edep_full_in_gvs", 8, -0.5, 7.5);
35  _SET_TITLE(m_E_gvs, "Energy deposit in GVS","Station","E (MeV)");
36 
37  std::stringstream s;
38  for (unsigned int j=0; j<8; j++) {
39  s.str("");
40  s << j+1;
41 
42  _TH1D(m_E_full_sum_h[j],("edep_full_in_det_no."+s.str()).c_str(), 100, 0., 5.);
43  _SET_TITLE(m_E_full_sum_h[j], "Energy deposit in full detector","E (MeV)","N");
44 
45  _TH2D(m_E_layer_sum_h[j],("edep_per_layer_detector_no."+s.str()).c_str(), 100, 0., 0.5, 22, 0., 21.);
46  _SET_TITLE(m_E_layer_sum_h[j], "Energy deposit in layers","E (MeV)","layer");
47 
48  _TH2D(m_hit_map_h[j],("hitmap_det_no."+s.str()).c_str(), 22, 0., 21., 66, 0., 65.);
49  _SET_TITLE(m_hit_map_h[j], "hit map - layer vs fiber","layer","fiber");
50  }
51 
52  return StatusCode::SUCCESS;
53 }

◆ processEvent()

StatusCode ALFA_SimHitsTestTool::processEvent ( )

Definition at line 55 of file ALFA_SimHitsTestTool.cxx.

55  {
56 
57  int fiber, plate, sign, station;
58 
59  double E_fiber_sum[8][10][64][2];
60  double E_full_sum[8];
61  double E_layer_sum[8][20];
62 
63  // cleaning
64  const int station_max{8};
65  const int plate_max{10};
66  const int fiber_max{64};
67 
68  for ( int l = 0; l < station_max; l++ ) {
69  E_full_sum[l] = 0.;
70  for ( int i = 0; i < plate_max; i++ ) {
71  E_layer_sum[l][i] = 0.;
72  E_layer_sum[l][i+plate_max] = 0.;
73  for ( int j = 0; j < fiber_max; j++ ) {
74  for ( int k = 0; k < 2; k++ ) {
75  E_fiber_sum[l][i][j][k] = 0.;
76  }
77  }
78  }
79  }
80 
81 
82  const ALFA_HitCollection* coll_handle = nullptr;
83  CHECK( evtStore()->retrieve(coll_handle,"ALFA_HitCollection") );
84 
85 
86  for (const ALFA_Hit& hit : *coll_handle) {
87 
88  station = hit.GetStationNumber();
89  plate = hit.GetPlateNumber();
90  fiber = hit.GetFiberNumber();
91  sign = hit.GetSignFiber();
92  if (plate==100) {
93  // Treat hits in GVS separately.
94  m_E_gvs->Fill(station,(hit.GetEnergyDeposit()));
95  continue;
96  }
97  E_fiber_sum[station-1][plate-1][fiber-1][(1-sign)/2] += (hit.GetEnergyDeposit());
98  }
99 
100  for ( int l = 0; l < station_max; l++ ) {
101  for ( int i = 0; i < plate_max; i++ ){
102  for ( int j = 0; j < fiber_max; j++ ) {
103  for ( int k = 0; k < 2; k++ ) {
104  E_full_sum[l] += E_fiber_sum[l][i][j][k];
105  E_layer_sum[l][2*i+k] += E_fiber_sum[l][i][j][k];
106  if (E_fiber_sum[l][i][j][k] > 0.) {
107  m_hit_map_h[l]->Fill(2*i+k+1,j+1);
108  }
109  }
110  }
111  }
112  }
113 
114  for ( int l = 0; l < station_max; l++ ) {
115  m_E_full_sum_h[l]->Fill(E_full_sum[l]);
116  for ( int i = 0; i < 2*plate_max; i++ ) {
117  m_E_layer_sum_h[l]->Fill(E_layer_sum[l][i],i+1);
118  }
119  }
120 
121  return StatusCode::SUCCESS;
122 }

Member Data Documentation

◆ m_E_full_sum_h

TH1* ALFA_SimHitsTestTool::m_E_full_sum_h[8]
private

Definition at line 26 of file ALFA_SimHitsTestTool.h.

◆ m_E_gvs

TH1* ALFA_SimHitsTestTool::m_E_gvs {}
private

Definition at line 27 of file ALFA_SimHitsTestTool.h.

◆ m_E_layer_sum_h

TH2* ALFA_SimHitsTestTool::m_E_layer_sum_h[8]
private

Definition at line 25 of file ALFA_SimHitsTestTool.h.

◆ m_histSvc

ServiceHandle<ITHistSvc> SimTestHisto::m_histSvc {"THistSvc", "SimTestHisto"}
protectedinherited

Definition at line 35 of file SimTestHisto.h.

◆ m_hit_map_h

TH2* ALFA_SimHitsTestTool::m_hit_map_h[8]
private

Definition at line 24 of file ALFA_SimHitsTestTool.h.

◆ m_key

std::string SimTestToolBase::m_key
protectedinherited

The MC truth key.

Definition at line 34 of file SimTestToolBase.h.

◆ m_path

std::string SimTestHisto::m_path {"/truth/"}
protectedinherited

Definition at line 34 of file SimTestHisto.h.


The documentation for this class was generated from the following files:
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
AllowedVariables::e
e
Definition: AsgElectronSelectorTool.cxx:37
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
AtlasHitsVector
Definition: AtlasHitsVector.h:33
ALFA_SimHitsTestTool::m_E_layer_sum_h
TH2 * m_E_layer_sum_h[8]
Definition: ALFA_SimHitsTestTool.h:25
UploadAMITag.l
list l
Definition: UploadAMITag.larcaf.py:158
_SET_TITLE
#define _SET_TITLE(var, title, xaxis, yaxis)
Definition: SimTestHisto.h:93
SimTestToolBase::SimTestToolBase
SimTestToolBase(const std::string &type, const std::string &name, const IInterface *parent)
Definition: SimTestToolBase.cxx:11
_TH1D
#define _TH1D(var, name, nbin, xmin, xmax)
Definition: SimTestHisto.h:47
ALFA_SimHitsTestTool::m_E_gvs
TH1 * m_E_gvs
Definition: ALFA_SimHitsTestTool.h:27
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
HepMC::is_simulation_particle
bool is_simulation_particle(const T &p)
Method to establish if a particle (or barcode) was created during the simulation (TODO update to be s...
Definition: MagicNumbers.h:342
lumiFormat.i
int i
Definition: lumiFormat.py:85
test_pyathena.parent
parent
Definition: test_pyathena.py:15
sign
int sign(int a)
Definition: TRT_StrawNeighbourSvc.h:107
_TH2D
#define _TH2D(var, name, nbinx, xmin, xmax, nbiny, ymin, ymax)
Definition: SimTestHisto.h:81
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:422
McEventCollection
This defines the McEventCollection, which is really just an ObjectVector of McEvent objects.
Definition: McEventCollection.h:33
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
ALFA_SimHitsTestTool::m_hit_map_h
TH2 * m_hit_map_h[8]
Definition: ALFA_SimHitsTestTool.h:24
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
ALFA_SimHitsTestTool::m_E_full_sum_h
TH1 * m_E_full_sum_h[8]
Definition: ALFA_SimHitsTestTool.h:26
DataVector::end
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
ALFA_Hit
Definition: ALFA_Hit.h:11
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
SimTestHisto::m_path
std::string m_path
Definition: SimTestHisto.h:34
SimTestToolBase::m_key
std::string m_key
The MC truth key.
Definition: SimTestToolBase.h:34
DataVector::begin
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
fitman.k
k
Definition: fitman.py:528