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 _Hit_h_
0007 #define _Hit_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 Hit : public JObject {
0019     JOBJECT_PUBLIC(Hit)
0020 
0021     int x;     // Pixel coordinates centered around 0,0
0022     int y;     // Pixel coordinates centered around 0,0
0023     double E;  // Energy loss in GeV
0024     double t;  // Time in ms
0025 
0026 
0027     /// Make it convenient to construct one of these things
0028     Hit(int x, int y, double E, double t) : x(x), y(y), E(E), t(t) {};
0029 
0030 
0031     /// Override Summarize to tell JANA how to produce a convenient string representation for our JObject.
0032     /// This can be called from user code, but also lets JANA automatically inspect its own data. See the
0033     /// CsvWriter example. Warning: Because this is slow, it should be used for debugging and monitoring 
0034     /// but not inside the performance critical code paths.
0035 
0036     void Summarize(JObjectSummary& summary) const override {
0037         summary.add(x, NAME_OF(x), "%d", "Pixel coordinates centered around 0,0");
0038         summary.add(y, NAME_OF(y), "%d", "Pixel coordinates centered around 0,0");
0039         summary.add(E, NAME_OF(E), "%f", "Energy loss in GeV");
0040         summary.add(t, NAME_OF(t), "%f", "Time in ms");
0041     }
0042 };
0043 
0044 
0045 #endif // _Hit_h_
0046