15 #include "TMultiGraph.h"
50 std::vector<int>
const &,
51 std::vector<float>
const& )
const
54 TCanvas
canvas(
"iC",
"iC",800,800);
56 canvas.SaveAs(filename.c_str());
62 std::string
const & opt_string,
63 std::vector<int>
const& ints,
64 std::vector<float>
const & floats,
65 std::vector<std::string>
const& strings)
const
67 std::stringstream ss(
"");
69 if (strings.size() < 2)
70 return (
"Error! Not enough data for initializing connection for making plots! (from \
72 std::string PayLoadInspector<BeamSpotObjects>::trend_plot)");
74 std::vector<std::string>::const_iterator iter_beg = strings.begin();
76 std::string conString= (*iter_beg);
92 dbSes.
open(conString,
true);
98 boost::shared_ptr<BeamSpotObjects> ptrBeamSpot;
103 std::vector<float> vecX;
104 std::vector<float> vecY;
105 std::vector<float> vecZ;
106 for (std::vector<float>::const_iterator iter_float = floats.begin() ;iter_beg != strings.end();++iter_beg, ++iter_float){
113 vecX.push_back(ptrBeamSpot->GetX());
114 vecY.push_back(ptrBeamSpot->GetY());
115 vecZ.push_back(ptrBeamSpot->GetZ());
116 std::cout <<
"since: "<<(*iter_float)<<
" X: "<< ptrBeamSpot->GetX() <<
" Y: "<< ptrBeamSpot->GetY() <<
" Z: " << ptrBeamSpot->GetZ() << std::endl;
124 TCanvas
canvas(
"iC",
"iC",1200,1200);
127 std::cout << *(floats.end() -1) <<
" " << *(floats.begin());
128 float max = *(floats.end() -1);
129 float min = *(floats.begin());
131 unsigned int lineWidth = 2;
132 unsigned int startColor = 2;
135 if ( result >= 0.1 ){
138 std::cout <<
"result: " << result << std::endl;
142 TGraph graphdataX(vecX.size(),
static_cast<const float *
>(&floats[0]), static_cast<const float *>(&vecX[0]));
145 graphdataX.SetLineColor(startColor++);
146 graphdataX.SetLineWidth(lineWidth);
149 TGraph graphdataY(vecY.size(),
static_cast<const float *
>(&floats[0]), static_cast<const float *>(&vecY[0]));
152 graphdataY.SetLineColor(startColor++);
153 graphdataY.SetLineWidth(lineWidth);
156 TGraph graphdataZ(vecZ.size(),
static_cast<const float *
>(&floats[0]), static_cast<const float *>(&vecZ[0]));
159 graphdataZ.SetLineColor(startColor++);
160 graphdataZ.SetLineWidth(lineWidth);
164 std::stringstream plotTitle;
165 plotTitle.precision(0);
166 plotTitle << std::fixed;
168 plotTitle <<
"BeamSpot trend graph (first="
175 mg.SetTitle( plotTitle.str().c_str());
191 TLegend
leg(0.7,0.7,0.9,0.9,
"Beam Spot Legend");
192 leg.AddEntry(&graphdataX,
"X_{0}",
"lpf");
193 leg.AddEntry(&graphdataY,
"Y_{0}",
"lpf");
194 leg.AddEntry(&graphdataZ,
"Z_{0}",
"lpf");
199 ss << filename <<
".png";
200 canvas.SaveAs((ss.str()).c_str());
std::string trend_plot(std::string const &, std::string const &, std::vector< int > const &, std::vector< float > const &, std::vector< std::string > const &) const
std::string plot(std::string const &, std::string const &, std::vector< int > const &, std::vector< float > const &) const
DbTransaction & transaction()
void open(const std::string &connectionString, bool readOnly=false)
DbConnectionConfiguration & configuration()
#define PYTHON_WRAPPER(_class, _name)
std::string summary() const
int start(bool readOnly=false)
start transaction
const T & max(const T &a, const T &b)
DbSession createSession() const
void setAuthenticationPath(const std::string &p)
boost::shared_ptr< T > getTypedObject(const std::string &objectId)