ATLAS Offline Software
Loading...
Searching...
No Matches
EfieldInterpolator.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
15
16#ifndef PIXELDIGITIZATION_EFIELDINTERPOLATOR_H
17#define PIXELDIGITIZATION_EFIELDINTERPOLATOR_H
18
20#include <vector>
21
22class TH1;
23class TH1D;
24class TString;
25
26// Different options to retrieve E field
27// default: interspline
29 TCAD, //use Precomputed TCAD map
30 interspline, //use interpolation based on cubic splines
31 interinvdist, //use inverse distance weighted estimate
32 linearField //linear field according to bias voltage
33};
34
36public:
37 EfieldInterpolator(const std::string& type, const std::string& name, const IInterface* parent);
39 void setLayer(int layer);
40 //Recommended constructor
41 StatusCode loadTCADlist(const std::string& TCADfileListToLoad);
42 //defFct
43
44 virtual StatusCode initialize() override;
45 virtual StatusCode finalize() override;
46
47 // Member Functions
48 const std::string loadTCADfiles(const std::string& targetList = "");
49 const std::string createInterpolationFromTCADtree(const std::string& fTCAD);//TTree* tTCAD);
50 bool initializeFromFile(const std::string& finpath);
51 bool initializeFromDirectory(const std::string& fpath);
52 double estimateEfield(std::vector<double> vvol, const std::vector<double>& vflu, const std::vector<std::vector<double> >& vfluvvol,
53 double aimFlu, double aimVol, const std::string& prepend = "", bool debug = false);
54 double estimateEfieldInvDistance(const std::vector<double> & vvol, const std::vector<double> & vflu,
55 const std::vector<std::vector<double> > & vfluvvol, double aimFlu, double aimVol,
56 double measure = 1.);
57
58 TH1D* createEfieldProfile(double aimFluence, double aimVoltage);
59 TH1D* getEfield(double aimFluence, double aimVoltage);
60 TH1D* loadEfieldFromDat(const std::string& fname, bool fillEdges = true);
61 static void scaleIntegralTo(TH1* hin, double aimInt, int first = 1, int last = -1);
62 void reliabilityCheck(double aimFluence, const std::vector<double>& fluences, double aimVoltage,
63 const std::vector<double>& voltages);
64private:
65 // Member variables
66 Gaudi::Property<bool> m_initialized
67 {
68 this, "initialized", false, "Flag whether already initalized"
69 };
70
71 Gaudi::Property<bool> m_useSpline
72 {
73 this, "useSpline", true, "Flag whether to use cubic splines for interpolation"
74 };
75
76 Gaudi::Property<int> m_sensorDepth
77 {
78 this, "sensorDepth", 200, "Depth of E fields in sensors in um"
79 };
80
82 TH1D* m_efieldProfile{}; //Final efield profile
83 std::string m_fInter; //path to .root file for saving interpolation TTree, i.e. ordered by pixeldepth z
84 std::vector<std::vector<TString> > list_files(const TString& fileList_TCADsamples);
85 static double extrapolateLinear(double x1, double y1, double x2, double y2, double xaim);
86 int fillXYvectors(const std::vector<double> &vLoop, int ifix, const std::vector<std::vector<double> > & v2vsv1,
87 std::vector<double>& xx, std::vector<double>& yy, bool regularOrder = true);
88 void fillEdgeValues(TH1D* hin);
89 bool isInterpolation(const std::vector<double>& vval, double aimval)
90 {return(vval.front() <= aimval && aimval <= vval.back());};
91 bool isInterpolation(std::vector<double>* vval, double aimval)
92 {return(vval->front() <= aimval && aimval <= vval->back());};
93 static double relativeDistance(double x1, double x2); //difference between x1 x2 scaled to x1
94 static double relativeDistance(double x1, double y1, double x2, double y2);
95 double estimateEfieldLinear(double aimVoltage);
96 void saveTGraph(std::vector<double> vvol, std::vector<double> vflu, std::vector<std::vector<double> > vfluvvol,
97 double aimFlu, double aimVol, const std::string& prepend, bool skipNegative = true);
98};
99
100#endif //> !PIXELDIGITIZATION_EFIELDINTERPOLATOR_H
interpolationMethod
@ interspline
@ interinvdist
@ linearField
const bool debug
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
Gaudi::Property< bool > m_initialized
interpolationMethod m_efieldOrigin
virtual StatusCode finalize() override
Gaudi::Property< int > m_sensorDepth
EfieldInterpolator(const std::string &type, const std::string &name, const IInterface *parent)
TH1D * loadEfieldFromDat(const std::string &fname, bool fillEdges=true)
virtual StatusCode initialize() override
bool initializeFromFile(const std::string &finpath)
std::vector< std::vector< TString > > list_files(const TString &fileList_TCADsamples)
const std::string createInterpolationFromTCADtree(const std::string &fTCAD)
static double relativeDistance(double x1, double x2)
void saveTGraph(std::vector< double > vvol, std::vector< double > vflu, std::vector< std::vector< double > > vfluvvol, double aimFlu, double aimVol, const std::string &prepend, bool skipNegative=true)
bool initializeFromDirectory(const std::string &fpath)
static double extrapolateLinear(double x1, double y1, double x2, double y2, double xaim)
StatusCode loadTCADlist(const std::string &TCADfileListToLoad)
virtual ~EfieldInterpolator()
const std::string loadTCADfiles(const std::string &targetList="")
double estimateEfield(std::vector< double > vvol, const std::vector< double > &vflu, const std::vector< std::vector< double > > &vfluvvol, double aimFlu, double aimVol, const std::string &prepend="", bool debug=false)
int fillXYvectors(const std::vector< double > &vLoop, int ifix, const std::vector< std::vector< double > > &v2vsv1, std::vector< double > &xx, std::vector< double > &yy, bool regularOrder=true)
static void scaleIntegralTo(TH1 *hin, double aimInt, int first=1, int last=-1)
void fillEdgeValues(TH1D *hin)
TH1D * getEfield(double aimFluence, double aimVoltage)
void reliabilityCheck(double aimFluence, const std::vector< double > &fluences, double aimVoltage, const std::vector< double > &voltages)
TH1D * createEfieldProfile(double aimFluence, double aimVoltage)
bool isInterpolation(const std::vector< double > &vval, double aimval)
Gaudi::Property< bool > m_useSpline
bool isInterpolation(std::vector< double > *vval, double aimval)
double estimateEfieldInvDistance(const std::vector< double > &vvol, const std::vector< double > &vflu, const std::vector< std::vector< double > > &vfluvvol, double aimFlu, double aimVol, double measure=1.)
double estimateEfieldLinear(double aimVoltage)