Jpp test-rotations-new
the software that should make you happy
Loading...
Searching...
No Matches
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.
 
void randomize (pos_type *p)
 Randomize position.
 
void randomize (dir_type *p)
 Randomize direction.
 
void randomize (Hit *p)
 Randomize hit.
 
void randomize (pdg_type *p)
 Randomize PDG particle type.
 
void randomize (Trk *p)
 Randomize track.
 
void randomize (Evt *p)
 Randomize event.
 
bool operator== (const Hit &first, const Hit &second)
 Equal operator hit.
 
bool operator== (const Trk &first, const Trk &second)
 Equal operator track.
 
bool operator== (const Evt &first, const Evt &second)
 Equal operator event.
 

Variables

static bool use_root
 Global file format parameter.
 

Function Documentation

◆ randomize() [1/7]

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 x
Definition Vec.hh:14
double y
Definition Vec.hh:14

◆ randomize() [2/7]

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};

◆ randomize() [3/7]

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};

◆ randomize() [4/7]

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}
static bool use_root
Global file format parameter.
int pmt_id
global PMT identifier as found in evt files
Definition Hit.hh:20
int dom_id
module identifier from the data (unique in the detector).
Definition Hit.hh:14
int origin
track id of the track that created this hit (mc only)
Definition Hit.hh:29
Vec pos
hit position
Definition Hit.hh:25
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
int type
particle type or parametrisation used for hit (mc only)
Definition Hit.hh:28
unsigned int tdc
hit tdc (=time in ns)
Definition Hit.hh:16
unsigned int channel_id
PMT channel id {0,1, .., 30} local to moduke.
Definition Hit.hh:15
unsigned int tot
tot value as stored in raw data (int for pyroot)
Definition Hit.hh:17
double t
hit time (from tdc+calibration or MC truth)
Definition Hit.hh:23

◆ randomize() [5/7]

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}
Extensions to Evt data format.
Collection of particles.
Definition JPDB.hh:117
Auxiliary class to handle particle name, codes and mass.
Definition JPDB.hh:37
int geant
GEANT code of particle.
Definition JPDB.hh:96
int pdg
PDG code of particle.
Definition JPDB.hh:95

◆ randomize() [6/7]

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}
int type
MC: particle type in PDG encoding.
Definition Trk.hh:24
int id
track identifier
Definition Trk.hh:16
Vec dir
track direction
Definition Trk.hh:18
std::string comment
use as you like
Definition Trk.hh:35
double E
Energy [GeV] (either MC truth or reconstructed)
Definition Trk.hh:20
double t
track time [ns] (when the particle is at pos )
Definition Trk.hh:19
double len
length, if applicable [m]
Definition Trk.hh:22
double lik
likelihood or lambda value (for aafit, lambda)
Definition Trk.hh:23
Vec pos
postion [m] of the track at time t
Definition Trk.hh:17

◆ randomize() [7/7]

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}
The Evt class respresent a Monte Carlo (MC) event as well as an offline event.
Definition Evt.hh:21
int mc_id
identifier of the MC event (as found in ascii or antcc file).
Definition Evt.hh:24
int frame_index
from the raw data
Definition Evt.hh:29
int run_id
DAQ run identifier.
Definition Evt.hh:26
ULong64_t trigger_mask
trigger mask from raw data (i.e. the trigger bits)
Definition Evt.hh:30
std::vector< Hit > hits
list of hits
Definition Evt.hh:38
int mc_run_id
MC run identifier.
Definition Evt.hh:27
std::vector< Hit > mc_hits
MC: list of MC truth hits.
Definition Evt.hh:48
std::vector< Trk > mc_trks
MC: list of MC truth tracks.
Definition Evt.hh:49
int det_id
detector identifier from DAQ
Definition Evt.hh:23
ULong64_t trigger_counter
trigger counter
Definition Evt.hh:31
int id
offline event identifier
Definition Evt.hh:22
std::vector< Trk > trks
list of reconstructed tracks (can be several because of prefits,showers, etc).
Definition Evt.hh:39

◆ operator==() [1/3]

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}

◆ operator==() [2/3]

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}
std::vector< int > hit_ids
list of associated hit-ids (corresponds to Hit::id).
Definition Trk.hh:33
std::vector< double > error_matrix
(NxN) error covariance matrix for fit parameters (stored as linear vector)
Definition Trk.hh:34
std::vector< double > fitinf
place to store additional fit info, see km3net-dataformat/definitions/fitparameters....
Definition Trk.hh:32
std::vector< int > rec_stages
list of identifyers of succesfull fitting stages resulting in this track
Definition Trk.hh:26
int rec_type
identifier of the fitting algorithm/chain/strategy, see km3net-dataformat/definitions/reconstruction....
Definition Trk.hh:25

◆ operator==() [3/3]

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}

Variable Documentation

◆ use_root

bool use_root
static

Global file format parameter.

Definition at line 22 of file JAAnetTestkit.hh.