Jpp - the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Classes | Functions | Variables
JAAnetTestkit.hh File Reference
#include "TRandom3.h"
#include "km3net-dataformat/offline/Head.hh"
#include "km3net-dataformat/offline/Evt.hh"
#include "JAAnet/JPDB.hh"
#include "JMath/JRandom.hh"

Go to the source code of this file.

Classes

struct  pos_type
 Type definition for position. More...
 
struct  dir_type
 Type definition for direction. More...
 
struct  pdg_type
 PDG particle type. More...
 

Functions

void randomize (Vec *p)
 Randomize 3D vector. More...
 
void randomize (pos_type *p)
 Randomize position. More...
 
void randomize (dir_type *p)
 Randomize direction. More...
 
void randomize (Hit *p)
 Randomize hit. More...
 
void randomize (pdg_type *p)
 Randomize PDG particle type. More...
 
void randomize (Trk *p)
 Randomize track. More...
 
void randomize (Evt *p)
 Randomize event. More...
 
bool operator== (const Hit &first, const Hit &second)
 Equal operator hit. More...
 
bool operator== (const Trk &first, const Trk &second)
 Equal operator track. More...
 
bool operator== (const Evt &first, const Evt &second)
 Equal operator event. More...
 

Variables

static bool use_root
 Global file format parameter. More...
 

Function Documentation

void randomize ( Vec p)
inline

Randomize 3D vector.

Parameters
ppointer to valid object

Definition at line 30 of file JAAnetTestkit.hh.

31 {
32  p->x = getRandom<double>();
33  p->y = getRandom<double>();
34  p->z = getRandom<double>();
35 };
double z
Definition: Vec.hh:14
double y
Definition: Vec.hh:14
double x
Definition: Vec.hh:14
void randomize ( pos_type p)
inline

Randomize position.

Parameters
ppointer to valid object

Definition at line 49 of file JAAnetTestkit.hh.

50 {
51  p->x = getRandom<double>(-1.0e4, +1.0e4, 1.0);
52  p->y = getRandom<double>(-1.0e4, +1.0e4, 1.0);
53  p->z = getRandom<double>(-1.0e4, +1.0e4, 1.0);
54 };
double z
Definition: Vec.hh:14
double y
Definition: Vec.hh:14
double x
Definition: Vec.hh:14
void randomize ( dir_type p)
inline

Randomize direction.

Parameters
ppointer to valid object

Definition at line 68 of file JAAnetTestkit.hh.

69 {
70  p->x = getRandom<double>(-1.0, +1.0, 1.0e-3);
71  p->y = getRandom<double>(-1.0, +1.0, 1.0e-3);
72  p->z = getRandom<double>(-1.0, +1.0, 1.0e-3);
73 };
double z
Definition: Vec.hh:14
double y
Definition: Vec.hh:14
double x
Definition: Vec.hh:14
void randomize ( Hit p)
inline

Randomize hit.

Parameters
ppointer to valid object

Definition at line 81 of file JAAnetTestkit.hh.

82 {
83  p->id = getRandom<int>(0, 1000);
84  if (use_root) {
85  p->dom_id = getRandom<int>(0, 1000);
86  p->channel_id = getRandom<unsigned int>(0, 31);
87  p->tdc = getRandom<unsigned int>();
88  p->tot = getRandom<unsigned int>(0, 256);
89  p->trig = getRandom<int>(0, 1000);
90  }
91  p->pmt_id = getRandom<int>(0, 1000);
92  p->t = getRandom<double>(0.0, 100.0e6, 0.1);
93  p->a = getRandom<double>(0.0, 100.0e0, 0.1);
94  if (use_root) {
95  p->pos = getRandom<pos_type>();
96  p->dir = getRandom<dir_type>();
97  }
98  p->type = getRandom<int>(0, 1000);
99  p->origin = getRandom<int>(0, 1000);
100 }
Vec pos
hit position
Definition: Hit.hh:25
int pmt_id
global PMT identifier as found in evt files
Definition: Hit.hh:20
unsigned int tdc
hit tdc (=time in ns)
Definition: Hit.hh:16
static bool use_root
Global file format parameter.
int origin
track id of the track that created this hit
Definition: Hit.hh:29
double a
hit amplitude (in p.e.)
Definition: Hit.hh:24
int id
Definition: Hit.hh:11
Vec dir
hit direction; i.e. direction of the PMT
Definition: Hit.hh:26
ULong64_t trig
non-zero if the hit is a trigger hit.
Definition: Hit.hh:18
double t
hit time (from tdc+calibration or MC truth)
Definition: Hit.hh:23
int dom_id
module identifier from the data (unique in the detector).
Definition: Hit.hh:14
unsigned int tot
tot value as stored in raw data (int for pyroot)
Definition: Hit.hh:17
unsigned int channel_id
PMT channel id {0,1, .., 31} local to moduke.
Definition: Hit.hh:15
int type
particle type or parametrisation used for hit (mc only)
Definition: Hit.hh:28
void randomize ( pdg_type p)
inline

Randomize PDG particle type.

Parameters
ppointer to valid object

Definition at line 119 of file JAAnetTestkit.hh.

120 {
121  using namespace JAANET;
122 
123  const JPDB& pdb = JPDB::getInstance();
124 
125  for ( ; ; ) {
126 
127  const JParticle& particle = pdb[getRandom<int>(0, pdb.size())];
128 
129  if ( (use_root) || (particle.geant != GEANT4_TYPE_NEUTRINO && particle.geant != 0) ) {
130 
131  p->type = abs(particle.pdg);
132 
133  return;
134  }
135  }
136 }
static bool use_root
Global file format parameter.
Collection of particles.
Definition: JPDB.hh:104
static const JPDB & getInstance()
Get particle data book.
Definition: JPDB.hh:120
Auxiliary class to handle particle name, codes and mass.
Definition: JPDB.hh:32
int geant
GEANT code of particle.
Definition: JPDB.hh:86
int pdg
PDG code of particle.
Definition: JPDB.hh:85
void randomize ( Trk p)
inline

Randomize track.

Parameters
ppointer to valid object

Definition at line 144 of file JAAnetTestkit.hh.

145 {
146  p->id = getRandom<int>(0, 1000);
147  p->pos = getRandom<pos_type>();
148  p->dir = getRandom<dir_type>();
149  p->t = getRandom<double>(0.0, 1.0e6, 1.0);
150  p->E = getRandom<double>(1.0, 1.0e6, 1.0);
151  if (use_root) {
152  p->len = getRandom<double>();
153  p->lik = getRandom<double>();
154  }
155  p->type = getRandom<pdg_type>();
156 
157  p->comment = "track_in:"; // aanet storage specifier
158 }
double t
track time [ns] (when the particle is at pos )
Definition: Trk.hh:18
Vec dir
track direction
Definition: Trk.hh:17
std::string comment
use as you like
Definition: Trk.hh:33
static bool use_root
Global file format parameter.
double E
Energy [GeV] (either MC truth or reconstructed)
Definition: Trk.hh:19
double len
length, if applicable [m]
Definition: Trk.hh:21
int type
MC: particle type in PDG encoding.
Definition: Trk.hh:23
int id
track identifier
Definition: Trk.hh:15
Vec pos
postion of the track at time t [m]
Definition: Trk.hh:16
double lik
likelihood or lambda value (for aafit, lambda)
Definition: Trk.hh:22
void randomize ( Evt p)
inline

Randomize event.

Parameters
ppointer to valid object

Definition at line 166 of file JAAnetTestkit.hh.

167 {
168  new (p) Evt();
169 
170  if (use_root) {
171  p->id = getRandom<int>(0, 1000);
172  p->det_id = getRandom<int>(0, 1000);
173  }
174  p->mc_id = getRandom<int>(0, 1000);
175  if (use_root) {
176  p->run_id = getRandom<int>(0, 1000);
177  p->mc_run_id = getRandom<int>(0, 1000);
178  p->frame_index = getRandom<int>(0, 1000);
179  p->trigger_mask = getRandom<ULong64_t>(0, 1000);
180  p->trigger_counter = getRandom<ULong64_t>(0, 1000);
181  }
182 
183  for (int i = getRandom<int>(1, 1000); i != 0; --i) {
184  p->mc_hits.push_back(getRandom<Hit>());
185  }
186 
187  for (int i = getRandom<int>(1, 100); i != 0; --i) {
188  p->mc_trks.push_back(getRandom<Trk>());
189  }
190 
191  if (use_root) {
192 
193  for (int i = getRandom<int>(1, 1000); i != 0; --i) {
194  p->hits.push_back(getRandom<Hit>());
195  }
196 
197  for (int i = getRandom<int>(1, 100); i != 0; --i) {
198  p->trks.push_back(getRandom<Trk>());
199  }
200  }
201 }
ULong64_t trigger_counter
trigger counter
Definition: Evt.hh:30
static bool use_root
Global file format parameter.
int frame_index
from the raw data
Definition: Evt.hh:28
int mc_run_id
MC run identifier.
Definition: Evt.hh:26
int mc_id
identifier of the MC event (as found in ascii or antcc file).
Definition: Evt.hh:23
int run_id
DAQ run identifier.
Definition: Evt.hh:25
int det_id
detector identifier from DAQ
Definition: Evt.hh:22
std::vector< Trk > trks
list of reconstructed tracks (can be several because of prefits,showers, etc).
Definition: Evt.hh:36
std::vector< Hit > mc_hits
MC: list of MC truth hits.
Definition: Evt.hh:45
int id
offline event identifier
Definition: Evt.hh:21
std::vector< Hit > hits
list of hits
Definition: Evt.hh:35
std::vector< Trk > mc_trks
MC: list of MC truth tracks.
Definition: Evt.hh:46
ULong64_t trigger_mask
trigger mask from raw data (i.e. the trigger bits)
Definition: Evt.hh:29
The Evt class respresent a Monte Carlo (MC) event as well as an offline event.
Definition: Evt.hh:19
bool operator== ( const Hit first,
const Hit second 
)
inline

Equal operator hit.

Parameters
firstfirst hit
secondsecond hit
Returns
true if hits are equal; else false

Definition at line 211 of file JAAnetTestkit.hh.

212 {
213  return (first.id == second.id &&
214  first.channel_id == second.channel_id &&
215  first.tdc == second.tdc &&
216  first.tot == second.tot &&
217  first.trig == second.trig &&
218  first.pmt_id == second.pmt_id &&
219  first.t == second.t &&
220  first.a == second.a &&
221  first.pos == second.pos &&
222  first.dir == second.dir &&
223  first.type == second.type &&
224  first.origin == second.origin);
225 }
Vec pos
hit position
Definition: Hit.hh:25
int pmt_id
global PMT identifier as found in evt files
Definition: Hit.hh:20
unsigned int tdc
hit tdc (=time in ns)
Definition: Hit.hh:16
int origin
track id of the track that created this hit
Definition: Hit.hh:29
double a
hit amplitude (in p.e.)
Definition: Hit.hh:24
int id
Definition: Hit.hh:11
Vec dir
hit direction; i.e. direction of the PMT
Definition: Hit.hh:26
ULong64_t trig
non-zero if the hit is a trigger hit.
Definition: Hit.hh:18
double t
hit time (from tdc+calibration or MC truth)
Definition: Hit.hh:23
unsigned int tot
tot value as stored in raw data (int for pyroot)
Definition: Hit.hh:17
unsigned int channel_id
PMT channel id {0,1, .., 31} local to moduke.
Definition: Hit.hh:15
int type
particle type or parametrisation used for hit (mc only)
Definition: Hit.hh:28
bool operator== ( const Trk first,
const Trk second 
)
inline

Equal operator track.

Parameters
firstfirst track
secondsecond track
Returns
true if tracks are equal; else false

Definition at line 235 of file JAAnetTestkit.hh.

236 {
237  return (first.id == second.id &&
238  first.pos == second.pos &&
239  first.dir == second.dir &&
240  first.t == second.t &&
241  first.E == second.E &&
242  first.len == second.len &&
243  first.lik == second.lik &&
244  first.type == second.type &&
245  first.rec_type == second.rec_type &&
246  first.rec_stages == second.rec_stages &&
247  first.fitinf == second.fitinf &&
248  first.hit_ids == second.hit_ids &&
249  first.error_matrix == second.error_matrix);
250 }
double t
track time [ns] (when the particle is at pos )
Definition: Trk.hh:18
Vec dir
track direction
Definition: Trk.hh:17
double E
Energy [GeV] (either MC truth or reconstructed)
Definition: Trk.hh:19
std::vector< int > hit_ids
list of associated hit-ids (corresponds to Hit::id).
Definition: Trk.hh:31
std::vector< double > fitinf
place to store additional fit info, for jgandalf, see JFitParameters.hh
Definition: Trk.hh:30
double len
length, if applicable [m]
Definition: Trk.hh:21
int type
MC: particle type in PDG encoding.
Definition: Trk.hh:23
int id
track identifier
Definition: Trk.hh:15
Vec pos
postion of the track at time t [m]
Definition: Trk.hh:16
std::vector< int > rec_stages
list of identifyers of succesfull fitting stages resulting in this track
Definition: Trk.hh:25
std::vector< double > error_matrix
(NxN) error covariance matrix for fit parameters (stored as linear vector)
Definition: Trk.hh:32
double lik
likelihood or lambda value (for aafit, lambda)
Definition: Trk.hh:22
int rec_type
identifyer for the overall fitting algorithm/chain/strategy
Definition: Trk.hh:24
bool operator== ( const Evt first,
const Evt second 
)
inline

Equal operator event.

Parameters
firstfirst event
secondsecond event
Returns
true if events are equal; else false

Definition at line 260 of file JAAnetTestkit.hh.

261 {
262  return (first.id == second.id &&
263  first.det_id == second.det_id &&
264  first.mc_id == second.mc_id &&
265  first.run_id == second.run_id &&
266  first.mc_run_id == second.mc_run_id &&
267  first.frame_index == second.frame_index &&
268  first.trigger_mask == second.trigger_mask &&
269  first.trigger_counter == second.trigger_counter &&
270  first.hits == second.hits &&
271  first.trks == second.trks &&
272  first.mc_hits == second.mc_hits &&
273  first.mc_trks == second.mc_trks);
274 }
ULong64_t trigger_counter
trigger counter
Definition: Evt.hh:30
int frame_index
from the raw data
Definition: Evt.hh:28
int mc_run_id
MC run identifier.
Definition: Evt.hh:26
int mc_id
identifier of the MC event (as found in ascii or antcc file).
Definition: Evt.hh:23
int run_id
DAQ run identifier.
Definition: Evt.hh:25
int det_id
detector identifier from DAQ
Definition: Evt.hh:22
std::vector< Trk > trks
list of reconstructed tracks (can be several because of prefits,showers, etc).
Definition: Evt.hh:36
std::vector< Hit > mc_hits
MC: list of MC truth hits.
Definition: Evt.hh:45
int id
offline event identifier
Definition: Evt.hh:21
std::vector< Hit > hits
list of hits
Definition: Evt.hh:35
std::vector< Trk > mc_trks
MC: list of MC truth tracks.
Definition: Evt.hh:46
ULong64_t trigger_mask
trigger mask from raw data (i.e. the trigger bits)
Definition: Evt.hh:29

Variable Documentation

bool use_root
static

Global file format parameter.

Definition at line 22 of file JAAnetTestkit.hh.