Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:01:39

0001 
0002 // Copyright 2020, Jefferson Science Associates, LLC.
0003 // Subject to the terms in the LICENSE file found in the top-level directory.
0004 
0005 
0006 #ifndef _Cluster_h_
0007 #define _Cluster_h_
0008 
0009 #include <JANA/JObject.h>
0010 
0011 /// JObjects are plain-old data containers for inputs, intermediate results, and outputs.
0012 /// They have member functions for introspection and maintaining associations with other JObjects, but
0013 /// all of the numerical code which goes into their creation should live in a JFactory instead.
0014 /// You are allowed to include STL containers and pointers to non-POD datatypes inside your JObjects,
0015 /// however, it is highly encouraged to keep them flat and include only primitive datatypes if possible.
0016 /// Think of a JObject as being a row in a database table, with event number as an implicit foreign key.
0017 
0018 struct Cluster : public JObject {
0019     JOBJECT_PUBLIC(Cluster)
0020 
0021     double x_center;     // Pixel coordinates centered around 0,0
0022     double y_center;     // Pixel coordinates centered around 0,0
0023     double E_tot;     // Energy loss in GeV
0024     double t_begin;   // Time in us
0025     double t_end;     // Time in us
0026 
0027     Cluster(double x_center, double y_center, double E_tot, double t_begin, double t_end)
0028             : x_center(x_center), y_center(y_center), E_tot(E_tot), t_begin(t_begin), t_end(t_end) {};
0029 
0030     /// Override Summarize to tell JANA how to produce a convenient string representation for our JObject.
0031     /// This can be called from user code, but also lets JANA automatically inspect its own data. See the
0032     /// CsvWriter example. Warning: Because this is slow, it should be used for debugging and monitoring 
0033     /// but not inside the performance critical code paths.
0034 
0035     void Summarize(JObjectSummary& summary) const override {
0036         summary.add(x_center, NAME_OF(x_center), "%f", "Pixel coords <- [0,80)");
0037         summary.add(y_center, NAME_OF(y_center), "%f", "Pixel coords <- [0,24)");
0038         summary.add(E_tot, NAME_OF(E_tot), "%f", "Energy loss in GeV");
0039         summary.add(t_begin, NAME_OF(t_begin), "%f", "Earliest observed time in us");
0040         summary.add(t_end, NAME_OF(t_end), "%f", "Latest observed time in us");
0041     }
0042 
0043 };
0044 
0045 
0046 #endif // _Cluster_h_
0047