14#include <TGraphErrors.h>
33 return StatusCode::SUCCESS;
37void writeChannel(std::ofstream& S, uint32_t
cool,
double slope,
double offset,
double chi)
39 S <<
"<Channel coolid='0x" << std::hex <<
cool
40 << std::dec <<
"' slope='" << slope
41 <<
"' offset='" << offset
42 <<
"' chi2='" << chi <<
"/>\n";
48 S <<
"0x" << std::hex <<
cool;
49 return std::string(
S.str());
52std::string getTitle(uint32_t
cool)
61 using std::make_unique;
70 std::ofstream xmlFile(
"rampdata.xml");
71 xmlFile <<
"<?xml version='1.0' encoding='utf-8'?>\n"
72 <<
"<TriggerTowerDecoratorData>\n"
73 <<
"<default name='slope' />\n";
75 std::unique_ptr<TGraphErrors> graph_temp = make_unique<TGraphErrors>();
76 std::unique_ptr<TF1> func = make_unique<TF1>(
"func",
"pol1", 0., 255.);
77 for(
const auto & rampDataIt : *rampDataContainer) {
78 auto coolId = rampDataIt.first;
80 ATH_MSG_DEBUG(
"Processing RampData for 0x" << std::hex << coolId << std::dec);
83 graph_temp->SetNameTitle(getName(coolId).c_str(), getTitle(coolId).c_str());
86 unsigned int nSteps = rampData.
getNSteps();
88 for(
unsigned int iStep = 0; iStep < nSteps; ++iStep) {
89 auto dataPoint = rampData.
getStep(iStep);
92 <<
" and coolId 0x" << std::hex << coolId << std::dec);
98 auto* prevStep = rampData.
getStep(iStep - 1);
99 if(prevStep && prevStep->second.mean() > dataPoint->second.mean())
continue;
102 graph->SetPoint(iStep, dataPoint->second.mean(), dataPoint->first.mean());
103 graph->SetPointError(iStep, dataPoint->second.rms(), dataPoint->first.rms());
108 if(attrListIt != energyScanResults->
end()) {
109 const auto& attrList = attrListIt->second;
110 double slope = attrList[
"Slope"].data<
double>();
111 double offset = attrList[
"Offset"].data<
double>();
112 double chi2 = attrList[
"Chi2"].data<
double>();
114 func->SetParameters(offset, slope);
115 graph->GetListOfFunctions()->Add(func->Clone((
"func" + getName(coolId)).c_str()));
120 << coolId << std::dec);
124 xmlFile <<
"</TriggerTowerDecoratorData>\n";
126 return StatusCode::SUCCESS;
131 return StatusCode::SUCCESS;
#define ATH_MSG_WARNING(x)
This file defines the class for a collection of AttributeLists where each one is associated with a ch...
#define CHECK_RECOVERABLE(EXP)
Evaluate an expression and check for errors.
const ServiceHandle< StoreGateSvc > & detStore() const
AthHistogramAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor with parameters:
TH1 * bookGetPointer(const TH1 &hist, const std::string &tDir="", const std::string &stream="")
Simplify the booking and registering (into THistSvc) of histograms.
TGraph * graph(const std::string &graphName, const std::string &tDir="", const std::string &stream="")
Simplify the retrieval of registered TGraphs.
This class is a collection of AttributeLists where each one is associated with a channel number.
const_iterator end() const
const_iterator chanAttrListPair(ChanNum chanNum) const
Access to Chan/AttributeList pairs via channel number: returns map iterator.
virtual StatusCode initialize()
virtual ~L1CaloDumpRampData()
L1CaloDumpRampData(const std::string &name, ISvcLocator *pSvcLocator)
virtual StatusCode execute()
virtual StatusCode finalize()
Container of L1CaloRampData objects.
Transient class to store the RampData calculated from calibration runs.
unsigned int getNSteps() const
const L1CaloRampDataPoint * getStep(unsigned int step) const
double chi2(TH1 *h0, TH1 *h1)
void writeChannel(const CCIovVectorMap_t &data, const Folder &destination, const std::string &tag)