Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PHGenIntegralv1.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file PHGenIntegralv1.cc
1 // $Id: $
2 
11 #include "PHGenIntegralv1.h"
12 
13 #include <phool/PHObject.h> // for PHObject
14 
15 #include <cstdlib>
16 #include <iostream>
17 
18 using namespace std;
19 
21  : m_NProcessedEvent(0)
22  , m_NGeneratorAcceptedEvent(0)
23  , m_IntegratedLumi(0.)
24  , m_SumOfWeight(0.)
25  , m_Description("Source Not Provided")
26 {}
27 
29  : m_NProcessedEvent(0)
30  , m_NGeneratorAcceptedEvent(0)
31  , m_IntegratedLumi(0.)
32  , m_SumOfWeight(0.)
33  , m_Description(description)
34 {}
35 
36 void PHGenIntegralv1::identify(ostream& os) const
37 {
38  os << "PHGenIntegralv1::identify: " << get_Description() << endl
39  << " N_Generator_Accepted_Event = " << get_N_Generator_Accepted_Event() << " @ " << get_CrossSection_Generator_Accepted_Event() << " pb" << endl
40  << " N_Processed_Event = " << get_N_Processed_Event() << " @ " << get_CrossSection_Processed_Event() << " pb" << endl
41  << " Sum_Of_Weight = " << get_Sum_Of_Weight() << endl
42  << " Integrated_Lumi = " << get_Integrated_Lumi() << " pb^-1" << endl;
43 }
44 
46 {
49  m_IntegratedLumi = 0;
50  m_SumOfWeight = 0;
51  m_Description = "Source Not Provided";
52 }
53 
54 int PHGenIntegralv1::Integrate(PHObject* incoming_object)
55 {
56  const PHGenIntegral* in_gen = dynamic_cast<const PHGenIntegral*>(incoming_object);
57 
58  if (!in_gen)
59  {
60  cout << "PHGenIntegralv1::Integrate - Fatal Error - "
61  << "input object is not a PHGenIntegral: ";
62  incoming_object->identify();
63 
64  exit(EXIT_FAILURE);
65  }
66 
67  if (m_IntegratedLumi == 0 and m_NProcessedEvent == 0)
68  {
69  m_Description = in_gen->get_Description();
70  }
71  else if (m_Description != in_gen->get_Description())
72  {
73  m_Description = m_Description + ", and " + in_gen->get_Description();
74  }
75 
79  m_SumOfWeight += in_gen->get_Sum_Of_Weight();
80 
81  return m_NProcessedEvent;
82 }
83 
84 void PHGenIntegralv1::CopyFrom(const PHObject* incoming_object)
85 {
86  const PHGenIntegral* in_gen = dynamic_cast<const PHGenIntegral*>(incoming_object);
87 
88  if (!in_gen)
89  {
90  cout << "PHGenIntegralv1::CopyFrom - Fatal Error - "
91  << "input object is not a PHGenIntegral: ";
92  incoming_object->identify();
93 
94  exit(EXIT_FAILURE);
95  }
96 
100  m_SumOfWeight = in_gen->get_Sum_Of_Weight();
101  m_Description = in_gen->get_Description();
102 }