ATLAS Offline Software
Loading...
Searching...
No Matches
DGraph Class Reference
Inheritance diagram for DGraph:
Collaboration diagram for DGraph:

Public Member Functions

 DGraph (char *, string, const string &, int, int, bool)

Public Attributes

TGraph * rtgraph

Detailed Description

Definition at line 1927 of file TRTCalib_makeplots.cxx.

Constructor & Destructor Documentation

◆ DGraph()

DGraph::DGraph ( char * infile,
string path,
const string & folder,
int det,
int lay,
bool isinverted )

Definition at line 1935 of file TRTCalib_makeplots.cxx.

1936{
1937
1938 this->SetName(Form("Dv_%i_%i", det, lay));
1939
1940 vector<string> levels;
1941 while (true)
1942 {
1943 if (const auto f = path.find(','); f==std::string::npos ){
1944 break;
1945 } else {
1946 levels.push_back(path.substr(0, f));
1947 path.erase(0, f+1);
1948 }
1949 }
1950 levels.push_back(path.substr(0, path.find(',')));
1951
1952 TFile *file = new TFile(infile);
1953 file->cd();
1954
1955 cout << " In DGraph. Folder: " << folder << " det " << det << " lay " << lay << endl;
1956 for (unsigned int i = 0; i < levels.size(); i++)
1957 cout << " " << levels.at(i);
1958 cout << endl;
1959 cout << " infile:" << string(infile) << endl;
1960
1961 TDirectory *trt = (TDirectory *)file->FindKey("TRT_all")->ReadObj();
1962 if (folder != "")
1963 {
1964 TDirectory *thisDet = (TDirectory *)trt->FindKey(folder.c_str())->ReadObj();
1965 cout << "PLOT FOR " << folder << endl;
1966 if (thisDet->FindKey("rtgraph"))
1967 {
1968 rtgraph = (TGraphErrors *)thisDet->FindKey("rtgraph")->ReadObj();
1969 cout << " folder: " << folder << " found rtgraph " << endl;
1970 }
1971 else
1972 {
1973 rtgraph = nullptr;
1974 cout << " folder: " << folder << " did not find rtgraph " << endl;
1975 }
1976 }
1977 else if (trt->FindKey("rtgraph"))
1978 {
1979 rtgraph = (TGraphErrors *)trt->FindKey("rtgraph")->ReadObj();
1980 cout << " no folder, found rtgraph " << endl;
1981 }
1982 else
1983 {
1984 rtgraph = nullptr;
1985 cout << " no folder, no rtgraph " << endl;
1986 }
1987
1988 if (rtgraph)
1989 {
1990 TF1 *rtfunc = (TF1 *)rtgraph->GetListOfFunctions()->First();
1991
1992 double p0 = rtfunc->GetParameter(0);
1993 double p1 = rtfunc->GetParameter(1);
1994 double p2 = rtfunc->GetParameter(2);
1995 double p3 = rtfunc->GetParameter(3);
1996
1997 cout << " R-t PARAMETERS: " << p0 << " " << p1 << " " << p2 << " " << p3 << endl;
1998
1999 const bool isdines = false; //hardcoded flag
2000
2001 if (isdines)
2002 {
2003 //coverity[dead_error_begin]
2004 string vrrelation;
2005 if (isinverted)
2006 vrrelation = "x*[2]/sqrt([0]*[0]+x*x)";
2007 else
2008 vrrelation = "sqrt([0]*[0]+x*x)/(x*[2])";
2009
2010 TF1 *vr1 = new TF1("vr-relation", vrrelation.c_str(), 0.0001, 2.0);
2011 vr1->SetParameters(p0, p1, p2);
2012
2013 for (int i = 0; i <= 100; i++)
2014 {
2015 float r = 0.1 + (2.0 - 0.1) * (float)i / 100;
2016 float v1 = vr1->Eval(r, 0, 0, 0);
2017 this->SetPoint(i, r, v1);
2018 }
2019
2020 vr1->Delete();
2021 }
2022 else
2023 {
2024 cout << " USING POLYNOMIAL R-t RELATION" << endl;
2025
2026 string rtrelation = "[0]+x*([1]+x*([2]+x*[3]))";
2027 string vtrelation;
2028 if (isinverted)
2029 vtrelation = "1/([0]+2*x*[1]+3*x*x*[2])";
2030 else
2031 vtrelation = "[0]+2*x*[1]+3*x*x*[2]";
2032
2033 TF1 *rt1 = new TF1("rt-relation", rtrelation.c_str(), -10000, 10000);
2034 rt1->SetParameters(p0, p1, p2, p3);
2035 TF1 *vt1 = new TF1("vt-relation", vtrelation.c_str(), -10000, 10000);
2036 vt1->SetParameters(p1, p2, p3);
2037
2038 for (int i = 0; i <= 1000; i++)
2039 {
2040 float t1 = -5 + i * 0.05;
2041 float r1 = rt1->Eval(t1, 0, 0, 0);
2042 this->SetPoint(i, t1, r1);
2043 }
2044
2045 rt1->Delete();
2046 vt1->Delete();
2047 }
2048 }
2049}
int r
Definition globals.cxx:22
std::vector< ALFA_RawDataCollection_p1 > t1
path
python interpreter configuration --------------------------------------—
Definition athena.py:128
TFile * file

Member Data Documentation

◆ rtgraph

TGraph* DGraph::rtgraph

Definition at line 1932 of file TRTCalib_makeplots.cxx.


The documentation for this class was generated from the following file: