RestFrames
v1.0.1
RestFrames HEP Event Analysis Software Library
|
Go to the documentation of this file.
36 namespace RestFrames {
42 const std::string& stitle)
46 m_VarMassMCMC =
false;
61 m_dominMassCut =
false;
62 m_domaxMassCut =
false;
65 int today = now.GetDate();
66 int clock = now.GetTime();
68 int seed = today+clock+key;
69 m_Random =
new TRandom3(seed);
75 GeneratorFrame::~GeneratorFrame(){
76 if(m_Random)
delete m_Random;
89 return std::max(m_Mass, 0.);
126 for(
int i = 0; i < Nf; i++)
135 UnSoundMind(RF_FUNCTION);
136 return SetSpirit(
false);
138 if(!GenerateFrame()){
140 m_Log <<
"Unable to generate event for this frame.";
142 return SetSpirit(
false);
146 for(
int i = 0; i < Nchild; i++)
148 return SetSpirit(
false);
151 return SetSpirit(
true);
154 void GeneratorFrame::SetChildren(
const std::vector<TLorentzVector>& P_children){
155 int N = P_children.size();
156 for(
int i = 0; i < N; i++){
157 TLorentzVector P = P_children[i];
158 TVector3 B_child = P.BoostVector();
165 bool GeneratorFrame::InitializeGenAnalysis(){
166 return SetMind(
true);
171 UnSoundBody(RF_FUNCTION);
172 return SetMind(
false);
175 if(!InitializeGenAnalysis())
176 return SetMind(
false);
182 for(
int i = 0; i < Nchild; i++)
185 m_Log <<
"Unable to recursively initialize analysis for frame:";
187 return SetMind(
false);
190 return SetMind(
true);
194 return m_Random->Rndm();
198 return m_Random->Gaus(mu,sig);
201 bool GeneratorFrame::IterateMCMC(){
205 bool GeneratorFrame::IterateRecursiveMCMC(){
207 UnSoundMind(RF_FUNCTION);
208 return SetMind(
false);
212 return SetMind(
false);
215 for(
int i = 0; i < N; i++)
217 return SetMind(
false);
219 return SetMind(
true);
222 void GeneratorFrame::SetVariableMassMCMC(
bool var){
227 return m_VarMassMCMC;
232 UnSoundBody(RF_FUNCTION);
233 return SetBody(
false);
238 for(
int i = 0; i < N; i++)
242 mass = std::max(
GetMass(),mass);
253 void GeneratorFrame::SetMassMCMC(
double val){
256 m_Log <<
"Unable to set mass to negative value ";
257 m_Log << val <<
". Setting to zero." << LogEnd;
264 void GeneratorFrame::SetMassMCMC(
double mass,
265 GeneratorFrame& frame)
const {
266 frame.SetMassMCMC(mass);
275 m_Log << LogInfo << std::endl;
276 m_Log <<
"Total events generated: " << m_Ngen << std::endl;
277 m_Log <<
"Events in acceptance: " << m_Npass << std::endl;
278 m_Log <<
"Generator efficiency: ";
279 m_Log << 100.*double(m_Npass)/double(m_Ngen) <<
" %";
280 m_Log << std::endl << LogEnd;
285 m_Log <<
"Acceptance cuts for frame:" << std::endl;
286 if(m_dominMassCut || m_domaxMassCut){
289 m_Log << m_minMassCut <<
" < ";
292 m_Log <<
" < " << m_maxMassCut;
296 m_Log <<
" P > " << m_PCut << std::endl;
299 m_Log <<
" Pt > " << m_PtCut << std::endl;
302 m_Log <<
" |Eta| < " << m_EtaCut << std::endl;
304 m_Log <<
"Acceptance efficiency = ";
305 m_Log << 100.*double(m_Npass)/double(m_Ngen) <<
" %";
306 m_Log << std::endl << LogEnd;
310 for(
int i = 0; i < N; i++)
314 bool GeneratorFrame::EventInAcceptance()
const {
315 if(!IsSoundSpirit()){
316 UnSoundSpirit(RF_FUNCTION);
317 return SetSpirit(
false);
324 if(P.P() < (1.-1e-10)*m_PCut)
327 if(P.Pt() < (1.-1e-10)*m_PtCut)
330 if(fabs(P.Eta()) > (1.+1e-10)*m_EtaCut)
333 if(m_Mass < (1.-1e-10)*m_minMassCut)
336 if(m_Mass > (1.+1e-10)*m_maxMassCut)
340 bool evt_pass = pass;
343 for(
int i = 0; i < N; i++){
345 evt_pass = evt_pass && pass_c;
359 if(cut <= 0.)
return;
366 if(cut <= 0.)
return;
373 m_EtaCut = fabs(cut);
379 if(min > 0 || max > 0)
385 m_dominMassCut =
true;
390 m_domaxMassCut =
true;
397 m_doCuts = m_doPCut || m_doPtCut || m_doEtaCut ||
398 m_dominMassCut || m_domaxMassCut;
403 m_doCuts = m_doPCut || m_doPtCut || m_doEtaCut ||
404 m_dominMassCut || m_domaxMassCut;
409 m_doCuts = m_doPCut || m_doPtCut || m_doEtaCut ||
410 m_dominMassCut || m_domaxMassCut;
414 m_dominMassCut =
false;
415 m_domaxMassCut =
false;
416 m_doCuts = m_doPCut || m_doPtCut || m_doEtaCut ||
417 m_dominMassCut || m_domaxMassCut;
virtual void SetParentFrame(RestFrame &frame=RestFrame::Empty())
Sets the parent frame for this frame.
virtual RestFrame & GetChildFrame(int i=0) const
Get the RestFrame of the i th child.
virtual void AddChildFrame(RestFrame &frame)
Adds a child RestFrame to this frame.
int GetKey() const
Returns key of this object.
virtual GeneratorFrame const & GetParentFrame() const
Returns the parent of this frame.
void PrintGeneratorEfficiency() const
Print generator efficiency information.
abstract base class for all Frame objects
virtual void AddChildFrame(RestFrame &frame)
Adds a child RestFrame to this frame.
bool IsEmpty() const
Checks whether this is default (empty) instance of class.
TLorentzVector GetFourVector(const RestFrame &frame=RestFrame::Empty()) const
Returns this frame's four-vector in a specified frame.
virtual void GenerateMassMCMC(double &mass, double &prob, double max=-1.) const
Generates mass for Markov Chain MonteCarlo event generation.
bool IsGenFrame() const
Is this a GeneratorFrame ? (yes/no)
double GetGaus(double mu, double sig) const
Returns gaussian random number.
RFKey GetKey() const
gets object identification key
int GetNChildren() const
Returns the number of child frames inheriting from this one.
void SetEtaCut(double cut)
Sets pseudorapidity cut.
double GetRandom() const
Returns random value.
void RemovePtCut()
Removes transverse momentum cut.
static GeneratorFrame & Empty()
Returns empty GeneratorFrame.
virtual double GetMinimumMassMCMC() const
Returns minimun mass of Markov Chain MonteCarlo event generation.
virtual RestFrame const & GetParentFrame() const
Returns the parent of this frame.
void RemoveEtaCut()
Removes pseudorapidity cut.
bool AnalyzeEventRecursive()
Recursively analyze event in this frame and its children.
virtual void Clear()
Clears RestFrame of all connections to other objects.
bool IsVariableMassMCMC() const
Is this frame capable having a variable mass? (true/false)
void RemovePCut()
Removes momentum cut.
virtual GeneratorFrame & GetChildFrame(int i=0) const
Returns the frame of the i th child.
void SetMassWindowCut(double min, double max)
Sets mass frame cut.
virtual double GetProbMCMC(double mass=-1.) const
Evaluates probability of the state is in right now or the probablility of a state it could go in.
GeneratorFrame()
Empty constructor.
void SetPCut(double cut)
Sets momentum cut.
bool IsLabFrame() const
Is this a LabFrame ? (yes/no)
void SetPtCut(double cut)
Sets transverse momentum cut.
bool InitializeAnalysisRecursive()
Recursively initialize this frame and its children for analysis.
bool ClearEventRecursive()
Recursively clear event information from this frame and its children.
virtual double GetMass() const
Get the mass of this frame.
virtual void SetParentFrame(RestFrame &frame=RestFrame::Empty())
Set the parent frame for this frame.
virtual void Clear()
Clears GeneratorFrame of all connections to other objects.
void RemoveMassWindowCut()
Removes mass frame cuts.
static VisibleGenFrame & Empty()
Returns empty VisibleGenFrame.