HIPO  4.3.0
High Performance Output data format for experimental physics
reaction.cpp
Go to the documentation of this file.
1 
5 #include <iostream>
6 #include "reaction.h"
7 
9 
10 extern "C" {
11 
12  void reaction_get_vector_debug(double *vec){
13  printf("c extern x-component = %f\n",vec[0]);
14  vec[0] = 0.1; vec[1] = 0.2; vec[2] = 0.3;
15  }
16 
17  void reaction_define(const char *file, double energy, int *pids, int *counts, int length){
18  __reaction = new fizika::reaction(file,energy,pids,counts,length);
19  }
20 
21  void reaction_get_vector(double *vec, int *signs, int *pids, int *skips, double *masses, int length){
22  fizika::lorentz4 v = __reaction->get(signs, pids, skips, masses, length);
23  //printf("vector from REACTIONH = %f %f %f %f\n",v.x(),v.y(),v.z(),v.e());
24  vec[0] = v.x(); vec[1] = v.y(); vec[2] = v.z(); vec[3] = v.e();
25  }
26 
27  void reaction_get_cm(double *vec){
29  vec[0] = v.x(); vec[1] = v.y(); vec[2] = v.z(); vec[3] = v.e();
30  }
31 
33  bool status = __reaction->is_valid();
34  return status==true?1:0;
35  }
36 
37  bool reaction_next(){
38  bool status = __reaction->next();
39  return status==true?1:0;
40  //return __reaction->next();
41  }
42 
43  void get_format_string(char *data){
44  printf("data from \"C\" : [%s]\n",data);
45  strcpy(data,"troubles"); data[5] = 0;
46  }
47 }
Four-component Lorentz vector for relativistic kinematics.
Definition: fizika.h:213
double y() const
Definition: fizika.h:239
double x() const
Definition: fizika.h:237
double e() const
Definition: fizika.h:252
double z() const
Definition: fizika.h:241
Physics analysis helper for filtering and reconstructing reactions from HIPO data.
Definition: reaction.h:37
bool next()
Advance to the next event and read all banks.
Definition: reaction.h:164
fizika::lorentz4 & cm()
Definition: reaction.h:109
bool is_valid()
Check if the current event passes the particle filter.
Definition: reaction.h:179
fizika::lorentz4 get(std::initializer_list< std::tuple< int, int, int, double > > desc)
Reconstruct a Lorentz vector from a particle combination.
Definition: reaction.h:129
void get_format_string(char *data)
Definition: reaction.cpp:43
fizika::reaction * __reaction
Definition: reaction.cpp:8
void reaction_get_cm(double *vec)
Definition: reaction.cpp:27
void reaction_get_vector_debug(double *vec)
Definition: reaction.cpp:12
void reaction_define(const char *file, double energy, int *pids, int *counts, int length)
Definition: reaction.cpp:17
void reaction_get_vector(double *vec, int *signs, int *pids, int *skips, double *masses, int length)
Definition: reaction.cpp:21
bool reaction_is_valid()
Definition: reaction.cpp:32
bool reaction_next()
Definition: reaction.cpp:37
Physics analysis utilities for reaction filtering and reconstruction from HIPO events.