30 #include "RestFrames/RestFrames_config.h"
33 namespace RestFrames {
55 const std::string& stitle,
int key)
56 : m_Log(), m_Key(key) {
73 int N = m_Owns.size();
74 for(
int i = 0; i < N; i++){
81 return RFBase::m_Empty;
89 if(dep) m_Owns.push_back(dep);
93 return (m_Key == key);
112 bool RFBase::SetBody(
bool body)
const {
114 if(!body) SetMind(body);
118 bool RFBase::SetMind(
bool mind)
const {
120 if(!mind) SetSpirit(mind);
124 bool RFBase::SetSpirit(
bool spirit)
const {
129 bool RFBase::IsSoundBody()
const {
133 bool RFBase::IsSoundMind()
const {
137 bool RFBase::IsSoundSpirit()
const {
143 m_Log << type << output << LogEnd;
147 std::string output =
"\n";
148 output +=
" Name: "+
GetName()+
"\n";
149 output +=
" Title: "+
GetTitle()+
"\n";
153 void RFBase::UnSoundBody(
const std::string&
function)
const {
155 m_Log <<
"Unable to evaluate function \"" <<
function <<
"\". ";
156 m_Log <<
"Requires a successful call to \"InitializeTree()\" ";
157 m_Log <<
"from the LabFrame associated with this tree.";
160 RFBase::m_BodyCount++;
161 if(RFBase::m_BodyCount > m_WarningTolerance &&
162 m_WarningTolerance > 0) TooManyBodies(*
this);
165 void RFBase::UnSoundMind(
const std::string&
function)
const {
167 m_Log <<
"Unable to evaluate function \"" <<
function <<
"\". ";
168 m_Log <<
"Requires a successful call to \"InitializeAnalysis()\" ";
169 m_Log <<
"from the LabFrame associated with this tree.";
172 RFBase::m_MindCount++;
173 if(RFBase::m_MindCount > m_WarningTolerance &&
174 m_WarningTolerance > 0) TooManyMinds(*
this);
177 void RFBase::UnSoundSpirit(
const std::string&
function)
const {
179 m_Log <<
"Unable to evaluate function \"" <<
function <<
"\". ";
180 m_Log <<
"Requires a successful call to \"AnalyzeEvent()\" ";
181 m_Log <<
"from the LabFrame associated with this tree.";
184 RFBase::m_SpiritCount++;
185 if(RFBase::m_SpiritCount > m_WarningTolerance &&
186 m_WarningTolerance > 0) TooManySpirits(*
this);
190 __attribute__((constructor))
191 static void initializer(
void){
192 printf(
"\n" "\x1b[36m");
193 printf(PACKAGE_NAME);
195 printf(PACKAGE_VERSION);
196 printf(
" -- Developed by Christopher Rogan (crogan@cern.ch)\n");
198 printf(
"Copyright (c) 2014-2019, Christopher Rogan\n");
200 printf(
"http://RestFrames.com\n");
201 printf(
"\x1b[0m" "\n");
205 int RFBase::m_BodyCount = 0;
206 int RFBase::m_MindCount = 0;
207 int RFBase::m_SpiritCount = 0;
209 int RFBase::m_WarningTolerance = 100;
211 RFBase RFBase::m_Empty;
213 const TVector3 RFBase::m_Empty3Vector;
214 const TLorentzVector RFBase::m_Empty4Vector;
216 double GetP(
double Mp,
double Mc1,
double Mc2){
217 if(Mp <= 0.)
return 0.;
218 Mc1 = std::max(Mc1, 0.);
219 Mc2 = std::max(Mc2, 0.);
220 return sqrt(std::max(0., (Mp*Mp-Mc1*Mc1-Mc2*Mc2)*(Mp*Mp-Mc1*Mc1-Mc2*Mc2)-4.*Mc1*Mc1*Mc2*Mc2) )/2./Mp;
224 RFBase::m_WarningTolerance = NMAX;
227 void TooManyBodies(
const RFBase& obj){
229 g_Log <<
"Too many warnings. ";
230 g_Log <<
"Need a successful call to \"InitializeTree()\" ";
231 g_Log <<
"from the LabFrame associated with the offending/";
232 g_Log <<
"unsuccessful function calls. The last call came from:";
234 g_Log <<
"Please edit your code and try again." << LogEnd;
237 void TooManyMinds(
const RFBase& obj){
239 g_Log <<
"Too many warnings. ";
240 g_Log <<
"Need a successful call to \"InitializeAnalysis()\" ";
241 g_Log <<
"from the LabFrame associated with the offending/";
242 g_Log <<
"unsuccessful function calls. The last call came from:";
244 g_Log <<
"Please edit your code and try again." << LogEnd;
247 void TooManySpirits(
const RFBase& obj){
249 g_Log <<
"Too many warnings. ";
250 g_Log <<
"Need a successful call to \"AnalyzeEvent()\" ";
251 g_Log <<
"from the LabFrame associated with the offending/";
252 g_Log <<
"unsuccessful function calls. The last call came from:";
254 g_Log <<
"Please edit your code and try again." << LogEnd;