9#include <beast/microtpc/modules/TPCStudyModule.h>
10#include <beast/microtpc/dataobjects/MicrotpcSimHit.h>
11#include <framework/datastore/StoreArray.h>
12#include <framework/logging/Logger.h>
13#include <framework/gearbox/GearDir.h>
14#include <framework/gearbox/Const.h>
15#include <boost/foreach.hpp>
21#include <Math/Vector3D.h>
26int co_ctr[4] = {0, 0, 0, 0};
27int coe_ctr[4] = {0, 0, 0, 0};
28int h1_ctr[4] = {0, 0, 0, 0};
29int n_ctr[4] = {0, 0, 0, 0};
30int he4_ctr[4] = {0, 0, 0, 0};
31int o16_ctr[4] = {0, 0, 0, 0};
32int c12_ctr[4] = {0, 0, 0, 0};
33int ctr_ele[4] = {0, 0, 0, 0};
34int ctr_pos[4] = {0, 0, 0, 0};
35int ctr_pro[4] = {0, 0, 0, 0};
36int ctr_neu[4] = {0, 0, 0, 0};
37int ctr_good_neu[4] = {0, 0, 0, 0};
38int ctr_bad_neu[4] = {0, 0, 0, 0};
39int ctr_bak[4] = {0, 0, 0, 0};
44using namespace microtpc;
75 for (
int i = 0; i < 11; i ++) {
76 h_tpc_kin[i] =
new TH1F(TString::Format(
"tpc_kin_%d", i),
"", 1000, 0., 100.);
77 h_tpc_xy[i] =
new TH2F(TString::Format(
"tpc_xy_%d", i),
"", 300, -3., 3., 300, -3., 3.);
84 B2INFO(
"TPCStudyModule: Initialize");
99 int old_trkID[4] = { -1, -1, -1, -1};
100 int old_trkID_h1[4] = { -1, -1, -1, -1};
101 int old_trkID_he4[4] = { -1, -1, -1, -1};
102 int old_trkID_c12[4] = { -1, -1, -1, -1};
103 int old_trkID_o16[4] = { -1, -1, -1, -1};
104 bool aneu[4] = {
false,
false,
false,
false};
105 bool apro[4] = {
false,
false,
false,
false};
106 bool atrk[4] = {
false,
false,
false,
false};
107 bool aele[4] = {
false,
false,
false,
false};
108 bool apos[4] = {
false,
false,
false,
false};
110 vector <double> RecoilE;
112 int NbofPart[4] = {0, 0, 0, 0};
114 cout <<
"Look at evt " << ctr << endl;
121 double xpos = position.X() / 100. -
TPCCenter[detNb].X();
122 double ypos = position.Y() / 100. -
TPCCenter[detNb].Y();
123 double zpos = position.Z() / 100. -
TPCCenter[detNb].Z() +
m_z_DG / 2.;
128 if (pdg == 1000020040)
h_tpc_xy[8]->Fill(xpos, ypos);
133 old_trkID[detNb] = trkID;
134 Pdg[detNb].push_back(pdg);
138 if (pdg == 1000020040) {
140 old_trkID_he4[detNb] = trkID;
149 if (pdg == 1000060120) {
151 old_trkID_c12[detNb] = trkID;
160 if (pdg == 1000080160) {
162 old_trkID_o16[detNb] = trkID;
173 old_trkID_h1[detNb] = trkID;
200 for (
int i = 0; i < 4; i ++) {
201 if (apro[i] && atrk[i] && aneu[i]) co_ctr[i]++;
202 if (apro[i] && atrk[i] && aneu[i] && aele[i]) coe_ctr[i]++;
203 if (apro[i] && atrk[i]) {
204 for (
int j = 0; j < (int) RecoilE.size(); j ++) {
209 if (apro[i] && aneu[i]) ctr_bak[i] ++;
210 if (atrk[i] && aneu[i]) {
211 for (
int j = 0; j < (int) RecoilE.size(); j ++) {
215 if (NbofPart[i] == 1) ctr_good_neu[i] ++;
216 if (NbofPart[i] > 1) ctr_bad_neu[i] ++;
218 if (atrk[i] && aele[i]) {
219 for (
int j = 0; j < (int) RecoilE.size(); j ++) {
224 if (atrk[i] && apos[i]) {
225 for (
int j = 0; j < (int) RecoilE.size(); j ++) {
232 for (
int i = 0; i < 4; i ++) {
233 if (NbofPart[i] > 0) {
234 cout <<
"det # " << i <<
" number of particle " << NbofPart[i] << endl;
235 for (
int j = 0; j < (int) Pdg[i].size(); j ++) {
236 cout <<
" pdg " << Pdg[i][j] << endl;
246 GearDir content =
GearDir(
"/Detector/DetectorComponent[@name=\"MICROTPC\"]/Content/");
249 BOOST_FOREACH(
const GearDir & activeParams, content.getNodes(
"Active")) {
261 m_z_DG = content.getDouble(
"z_DG");
263 B2INFO(
"TpcDigitizer: Aquired tpc locations and gas parameters");
264 B2INFO(
" from MICROTPC.xml. There are " <<
nTPC <<
" TPCs implemented");
269 cout <<
" Total nb of evts " << ctr << endl;
270 for (
int i = 0; i < 4; i ++) {
271 cout <<
"n " << n_ctr[i] <<
" n-recoil-p " << co_ctr[i] <<
" n-recoil " << ctr_neu[i] <<
" p-n " << ctr_bak[i] <<
" p-He4 " <<
272 ctr_pro[i] <<
" H1 " << h1_ctr[i] <<
" He4 " << he4_ctr[i] <<
" C12 " << c12_ctr[i] <<
" O16 " << o16_ctr[i] <<
" good n-recoil " <<
273 ctr_good_neu[i] <<
" bad n-recoil " << ctr_bad_neu[i];
274 cout <<
" w/ e- " << ctr_ele[i] <<
" w/ e+ " << ctr_pos[i] <<
" n-p-recoil-e- " << coe_ctr[i] << endl;
static const ParticleType neutron
neutron particle
static const ChargedStable proton
proton particle
static const ChargedStable electron
electron particle
GearDir is the basic class used for accessing the parameter store.
HistoModule.h is supposed to be used instead of Module.h for the modules with histogram definitions t...
ClassMicrotpcSimHit - Geant4 simulated hit for the Microtpc detector.
float getEnergyDep() const
Return the energy deposition in electrons.
int gettkID() const
Return track ID.
float gettkKEnergy() const
Return the kinetic energy of the track.
ROOT::Math::XYZVector gettkPos() const
Return the track position.
float getdetNb() const
Return the TPC number.
int gettkPDG() const
Return the PDG number of the track.
void setDescription(const std::string &description)
Sets the description of the module.
Accessor to arrays stored in the data store.
double getLength(const std::string &path="") const noexcept(false)
Get the parameter path as a double converted to the standard length unit.
double m_ChipRowY
Chip row y dimension.
virtual void initialize() override
Initialize the Module.
virtual void event() override
Event processor.
int nTPC
number of detectors.
virtual void endRun() override
End-of-run action.
TPCStudyModule()
Constructor: Sets the description, the properties and the parameters of the module.
double m_ChipColumnX
Chip column x dimension.
virtual void getXMLData()
reads data from MICROTPC.xml: tube location, drift data filename, sigma of impulse response function
virtual ~TPCStudyModule()
Destructor.
int m_ChipRowNb
Chip row number.
std::vector< ROOT::Math::XYZVector > TPCCenter
TPC coordinate.
TH1F * h_tpc_kin[100]
Event counter.
TH2F * h_tpc_xy[100]
Track XY.
int m_ChipColumnNb
Chip column number.
virtual void defineHisto() override
Defines the histograms.
void addParam(const std::string &name, T ¶mVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module.
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Abstract base class for different kinds of events.