Belle II Software  release-05-02-19
PlumeDigitizerModule.cc
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2013 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Sam de Jong, Jerome Baudot *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 
11 #include <beast/plume/modules/PlumeDigitizerModule.h>
12 #include <beast/plume/dataobjects/PlumeSimHit.h>
13 #include <beast/plume/dataobjects/PlumeHit.h>
14 
15 #include <mdst/dataobjects/MCParticle.h>
16 #include <framework/datastore/StoreArray.h>
17 #include <framework/logging/Logger.h>
18 #include <framework/gearbox/GearDir.h>
19 
20 //c++
21 #include <string>
22 #include <fstream>
23 
24 using namespace std;
25 using namespace Belle2;
26 using namespace plume;
27 
28 
29 //-----------------------------------------------------------------
30 // Register the Module
31 //-----------------------------------------------------------------
32 REG_MODULE(PlumeDigitizer)
33 
34 //-----------------------------------------------------------------
35 // Implementation
36 //-----------------------------------------------------------------
37 
39 {
40  // Set module properties
41  setDescription("PLUME digitizer module");
42 
43  //All parameters needed are found in PLUME.xml.
44 
45 
46 }
47 
48 PlumeDigitizerModule::~PlumeDigitizerModule()
49 {
50 }
51 
52 void PlumeDigitizerModule::initialize()
53 {
54  B2INFO("Initializing PlumeDigitizer");
55  m_plumeHits.registerInDataStore();
56 
57  m_plumeSimHits.isRequired();
58  m_particles.isOptional();
59 
60  //get the sensor parameters and set the parameters of the response function
61  getXMLData();
62  setResponseModel(); // currently empty
63 
64 }
65 
66 void PlumeDigitizerModule::beginRun()
67 {
68 
69 }
70 
71 void PlumeDigitizerModule::event()
72 {
73 
74  //skip events with no plumeSimHits, but continue the event counter
75  if (m_plumeSimHits.getEntries() == 0) {
76  Event++;
77  return;
78  }
79 
80 
81  for (int i = 0; i < m_plumeSimHits.getEntries(); i++) {
82  PlumeSimHit* aHit = m_plumeSimHits[i];
83 
84  // This is where the detailed response function shall be called
85  m_nofPixels = 3;
86  m_posmm_u = aHit->getposOUT_u();
87  m_posmm_v = aHit->getposOUT_v();
88  m_posmm_x = aHit->getposIN_x();
89  m_posmm_y = aHit->getposIN_y();
90  m_posmm_z = aHit->getposIN_z();
91 
92  //create PlumeHit
93  m_plumeHits.appendNew(PlumeHit(aHit->getsensorID(), m_nofPixels, m_posmm_u, m_posmm_v, m_posmm_x, m_posmm_y,
94  m_posmm_z));
95 
96  }
97 
98  Event++;
99 }
100 
101 
102 void PlumeDigitizerModule::setResponseModel()
103 {
104 
105 
106  B2INFO("PLUME response model is so far empty, which means constant cluster size.");
107 
108 }
109 
110 
111 void PlumeDigitizerModule::getXMLData()
112 {
113  GearDir content = GearDir("/Detector/DetectorComponent[@name=\"PLUME\"]/Content/");
114 
115  //get the location of the sensors
116 // BOOST_FOREACH(const GearDir & activeParams, content.getNodes("Active")) {
117 // }
118 
119  B2INFO("Parameters gotten from PLUME.xml: ");
120 
121 }
122 
123 
124 void PlumeDigitizerModule::endRun()
125 {
126 }
127 
128 void PlumeDigitizerModule::terminate()
129 {
130 }
131 
132 
Belle2::PlumeSimHit::getposOUT_u
float getposOUT_u() const
outcoming track position u in sensor ref, in mm
Definition: PlumeSimHit.h:96
Belle2::PlumeSimHit
Class PlumeSimHit - Geant4 simulated hit for the PLUME detector.
Definition: PlumeSimHit.h:37
REG_MODULE
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Definition: Module.h:652
Belle2::PlumeSimHit::getsensorID
int getsensorID() const
sensor ID
Definition: PlumeSimHit.h:70
Belle2::PlumeSimHit::getposIN_z
float getposIN_z() const
incoming track position z in G4 ref, in mm
Definition: PlumeSimHit.h:88
Belle2::plume::PlumeDigitizerModule
PLUME digitizer.
Definition: PlumeDigitizerModule.h:43
Belle2::Module
Base class for Modules.
Definition: Module.h:74
Belle2::PlumeSimHit::getposOUT_v
float getposOUT_v() const
outcoming track position v in sensor ref, in mm
Definition: PlumeSimHit.h:98
Belle2::PlumeHit
ClassPlumeHit - digitization simulated hit for the Microtpc detector.
Definition: PlumeHit.h:36
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::GearDir
GearDir is the basic class used for accessing the parameter store.
Definition: GearDir.h:41
Belle2::PlumeSimHit::getposIN_x
float getposIN_x() const
incoming track position x in G4 ref, in mm
Definition: PlumeSimHit.h:84
Belle2::PlumeSimHit::getposIN_y
float getposIN_y() const
incoming track position y in G4 ref, in mm
Definition: PlumeSimHit.h:86