ATLAS Offline Software
Loading...
Searching...
No Matches
GraphPrint.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3*/
4
8#include <TGraphErrors.h>
9#include <TClass.h>
10#include <dqm_core/AlgorithmConfig.h>
12#include <dqm_core/Result.h>
13#include <ers/ers.h>
14#include <string>
15#include <sstream>
16#include <iostream>
17#include <dqm_core/AlgorithmManager.h>
18
20
22 dqm_core::AlgorithmManager::instance().registerAlgorithm("GraphPrint",this);
23}
24
26
30
31dqm_core::Result* dqm_algorithms::GraphPrint::execute(const std::string & name,
32 const TObject & obj,
33 const dqm_core::AlgorithmConfig & /* config */ )
34{
35 const TGraph* graph;
36 if ( obj.IsA()->InheritsFrom("TGraph") )
37 {
38 ERS_DEBUG(2,"Got TGraph called: "<<obj.GetName()<<" of type:"<<obj.IsA()->GetName());
39 graph = static_cast<const TGraph*>(&obj);
40 }
41 else
42 {
43 throw dqm_core::BadConfig(ERS_HERE,name,"Object is not a TGraph ");
44 }
45 Int_t npoints = graph->GetN();
46
47 // Everything is now configured correctly, we can start
48 dqm_core::Result* result = new dqm_core::Result;
49 for ( Int_t bin = 0 ; bin < npoints ; ++bin) //Loop on all points
50 {
51 Double_t x = 0, y = 0;
52 graph->GetPoint(bin,x,y);
53 // Check point error bars
54 ERS_DEBUG(3,"Looking at point "<<bin<< " and I see x = " << x << " and y = " << y);
55 std::string binname = Form("Candidate %d in LB %.0f, Event", bin, x);
56 //std::string binname = Form("Candidate %d LB %d Event:", bin, int(x));
57 result->tags_[binname.c_str()] = y;
58 }
59
60 result->status_=dqm_core::Result::Green;
61 return result;
62}
63
64void
66{
67 out << " Just dump all the bin contents of a TGraph!" << std::endl;
68}
static dqm_algorithms::BinContentComp myInstance
file declares the dqm_algorithms::GraphPrint class.
#define y
#define x
virtual dqm_core::Result * execute(const std::string &, const TObject &obj, const dqm_core::AlgorithmConfig &conf)
virtual GraphPrint * clone()
void printDescription(std::ostream &out)