ATLAS Offline Software
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 
19 static dqm_algorithms::GraphPrint myInstance;
20 
22  dqm_core::AlgorithmManager::instance().registerAlgorithm("GraphPrint",this);
23 }
24 
26 
28  return new GraphPrint();
29 }
30 
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
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 
61  return result;
62 }
63 
64 void
66 {
67  out << " Just dump all the bin contents of a TGraph!" << std::endl;
68 }
dqm_algorithms::GraphPrint::execute
virtual dqm_core::Result * execute(const std::string &, const TObject &obj, const dqm_core::AlgorithmConfig &conf)
Definition: GraphPrint.cxx:31
dqm_algorithms::GraphPrint::printDescription
void printDescription(std::ostream &out)
Definition: GraphPrint.cxx:65
get_generator_info.result
result
Definition: get_generator_info.py:21
python.AthDsoLogger.out
out
Definition: AthDsoLogger.py:71
bin
Definition: BinsDiffFromStripMedian.h:43
yodamerge_tmp.npoints
npoints
Definition: yodamerge_tmp.py:250
dqm_algorithms::GraphPrint::clone
virtual GraphPrint * clone()
Definition: GraphPrint.cxx:27
x
#define x
instance
std::map< std::string, double > instance
Definition: Run_To_Get_Tags.h:8
Result
ICscStripFitter::Result Result
Definition: CalibCscStripFitter.cxx:13
python.handimod.Green
int Green
Definition: handimod.py:524
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
plotBeamSpotVxVal.bin
int bin
Definition: plotBeamSpotVxVal.py:83
y
#define y
dqm_algorithms::GraphPrint::~GraphPrint
virtual ~GraphPrint()
Definition: GraphPrint.cxx:25
GraphPrint.h
AlgorithmHelper.h
dqm_algorithms::GraphPrint
Definition: GraphPrint.h:18
python.PyAthena.obj
obj
Definition: PyAthena.py:135
dqm_algorithms::GraphPrint::GraphPrint
GraphPrint()
Definition: GraphPrint.cxx:21