2 #include "G4UnitsTable.hh" 13 #include "CLHEP/Units/PhysicalConstants.h" 14 using namespace CLHEP;
19 if(I.
name == this->name && I.
rule == this->rule && I.
id == this->id && fabs(I.
time - this->time) <= this->TimeWindow)
23 if(I.
name == this->name && I.
rule == this->rule && I.
id == this->id && this->TimeWindow == 0 && I.
TrackId == this->TrackId)
37 if(this->name == I.
name)
38 if(this->
id < I.
id)
return true;
39 if(this->time < I.
time)
return true;
46 if(this->name == I.
name)
47 if(this->
id > I.
id)
return true;
48 if(this->time > I.
time)
return true;
54 ostream &operator<<(ostream &stream, vector<identifier> Iden)
56 for(
unsigned int i=0; i<Iden.size(); i++)
58 cout <<
" identifier " << i+1 ;
61 if(Iden[i].id_sharing <1 && Iden[i].id_sharing > 0.001)
62 cout << Iden[i].name <<
" " << Iden[i].id <<
" Percentage: " << Iden[i].id_sharing << endl ;
64 cout << Iden[i].name <<
" " << Iden[i].id << endl ;
67 cout <<
" identifier time: " << Iden[0].time/ns <<
" ns - TimeWindow: " << Iden[0].TimeWindow/ns <<
" ns." << endl;
74 vector<identifier>
SetId(vector<identifier> Iden, G4VTouchable* TH,
double time,
double TimeWindow,
int TrackId)
76 vector<identifier> identity = Iden;
79 for(
unsigned int i=0; i<identity.size(); i++)
81 if(identity[i].rule.find(
"ncopy") != string::npos)
84 for(
int h=0; h<TH->GetHistoryDepth(); h++)
86 string pname = TH->GetVolume(h)->GetName();
87 int pcopy = TH->GetVolume(h)->GetCopyNo();
88 if(pname.find(identity[i].name) != string::npos) identity[i].
id = pcopy;
92 if(identity[i].
id == 0)
94 cout <<
" Something is wrong. Identity " << identity[i].id <<
" is zero. Full Identity:" << endl;
96 cout <<
" Exiting. " << endl;
101 identity[i].time = time;
102 identity[i].TimeWindow = TimeWindow;
103 identity[i].TrackId = TrackId;
112 vector<identifier> identity;
113 stringstream idvars(var);
119 identity.push_back(iden);
vector< identifier > SetId(vector< identifier > Iden, G4VTouchable *TH, double time, double TimeWindow, int TrackId)
Sets the ncopy ID accordingly to Geant4 Volumes copy number. Sets time, TimeWindow, TrackId.
vector< identifier > get_identifiers(string var)
int id
manually assing ID. 0 if "ncopy" (will be set at hit processing time)
string name
Name of the detector.
int TrackId
If Time Window is 0, it's a "flux" detector: if it's the same track, it's the same hit...
bool operator==(const identifier &I) const
Overloaded "==" operator for the class 'identifier'.
double time
Time of the first step.
bool operator<(const identifier &I) const
Overloaded "<" operator for the class 'identifier'.
bool operator>(const identifier &I) const
Overloaded ">" operator for the class 'identifier'.
string rule
"manual" or "ncopy"