GRSISort "v4.0.0.5"
An extension of the ROOT analysis Framework
Loading...
Searching...
No Matches
THILFragment.cxx
Go to the documentation of this file.
1#include "THILFragment.h"
2#include "Globals.h"
3
5{
6 /// Default constructor
7 Clear();
8}
9
22
24{
25 /// Default destructor
26}
27
28void THILFragment::Clear(Option_t* opt)
29{
30 /// Clears all fields of the THILFragment and TFragment
32 fGermaniumId.clear();
33 fGermaniumEnergy.clear();
34 fGermaniumTime.clear();
35 fSiliconId.clear();
36 fSiliconEnergy.clear();
37 fEventNumber = 0;
38 fEventTime = 0;
39 fUsTime = 0;
40}
41
42TObject* THILFragment::Clone(const char*) const
43{
44 auto result = new THILFragment;
45 *result = *this;
46 result->ClearTransients();
47 return result;
48}
49
50bool THILFragment::Good(bool verbose) const
51{
52 /// This function checks whether this event is good, i.e. the length of all germanium
53 /// and all silicon vectors matches and there is at least one silicon and one germanium hit.
54
55 if(fGermaniumId.empty() || fSiliconId.empty()) {
56 if(verbose) std::cout << this << ": Either no germanium IDs (" << fGermaniumId.size() << ") or no silicon IDs (" << fSiliconId.size() << ")" << std::endl;
57 return false;
58 }
59 if(fGermaniumId.size() != fGermaniumEnergy.size() || fGermaniumId.size() != fGermaniumTime.size()) {
60 if(verbose) std::cout << this << ": Size of germanium IDs (" << fGermaniumId.size() << ") doesn't match size of germanium energies (" << fGermaniumEnergy.size() << ") or size of germanium times (" << fGermaniumTime.size() << ")" << std::endl;
61 return false;
62 }
63 if(fSiliconId.size() != fSiliconEnergy.size()) {
64 if(verbose) std::cout << this << ": Size of silicon IDs (" << fSiliconId.size() << ") doesn't match size of silicon energies (" << fSiliconEnergy.size() << ")" << std::endl;
65 return false;
66 }
67
68 return true;
69}
70
71void THILFragment::Print(std::ostream& out) const
72{
73 std::stringstream str;
74 str << "THILFragment " << this << ", #" << fEventNumber << ": " << fGermaniumId.size() << " germaniums and " << fSiliconId.size() << " silicons at event time " << fEventTime << ", and microsecond time " << fUsTime << std::endl;
75 str << "# Ge# GeEn GeTime Si# SiEn" << std::endl;
76 for(size_t h = 0; h < fGermaniumId.size(); ++h) {
77 if(h < fSiliconId.size()) {
78 str << std::setw(2) << h << " " << std::setw(3) << (int)fGermaniumId.at(h) << " " << std::setw(4) << fGermaniumEnergy.at(h) << " " << std::setw(6) << fGermaniumTime.at(h) << " " << std::setw(3) << (int)fSiliconId.at(h) << " " << std::setw(4) << fSiliconEnergy.at(h) << std::endl;
79 } else {
80 str << std::setw(2) << h << " " << std::setw(3) << (int)fGermaniumId.at(h) << " " << std::setw(4) << fGermaniumEnergy.at(h) << " " << std::setw(6) << fGermaniumTime.at(h) << std::endl;
81 }
82 }
83 str << "============================" << std::endl;
84 out << str.str();
85}
void Clear(Option_t *opt="") override
Definition TFragment.cxx:17
std::vector< uint16_t > fGermaniumEnergy
std::vector< uint8_t > fGermaniumId
bool Good(bool verbose=false) const
uint16_t fUsTime
void Print(std::ostream &out) const override
TObject * Clone(const char *name="") const override
uint64_t fEventTime
uint32_t fEventNumber
void Clear(Option_t *opt="") override
std::vector< uint8_t > fSiliconId
std::vector< uint16_t > fSiliconEnergy
std::vector< uint16_t > fGermaniumTime