ATLAS Offline Software
Loading...
Searching...
No Matches
EfieldInterpolator Class Reference

#include <EfieldInterpolator.h>

Inheritance diagram for EfieldInterpolator:
Collaboration diagram for EfieldInterpolator:

Public Member Functions

 EfieldInterpolator (const std::string &type, const std::string &name, const IInterface *parent)
virtual ~EfieldInterpolator ()
void setLayer (int layer)
StatusCode loadTCADlist (const std::string &TCADfileListToLoad)
virtual StatusCode initialize () override
virtual StatusCode finalize () override
const std::string loadTCADfiles (const std::string &targetList="")
const std::string createInterpolationFromTCADtree (const std::string &fTCAD)
bool initializeFromFile (const std::string &finpath)
bool initializeFromDirectory (const std::string &fpath)
double estimateEfield (std::vector< double > vvol, const std::vector< double > &vflu, const std::vector< std::vector< double > > &vfluvvol, double aimFlu, double aimVol, std::string_view prepend="", bool debug=false)
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.)
TH1D * createEfieldProfile (double aimFluence, double aimVoltage)
TH1D * getEfield (double aimFluence, double aimVoltage)
TH1D * loadEfieldFromDat (const std::string &fname, bool fillEdges=true)
void reliabilityCheck (double aimFluence, const std::vector< double > &fluences, double aimVoltage, const std::vector< double > &voltages)
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
virtual StatusCode sysInitialize () override
 Perform system initialization for an algorithm.
virtual StatusCode sysStart () override
 Handle START transition.
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles.
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles.
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T, V, H > &t)
void updateVHKA (Gaudi::Details::PropertyBase &)
MsgStream & msg () const
bool msgLvl (const MSG::Level lvl) const

Static Public Member Functions

static void scaleIntegralTo (TH1 *hin, double aimInt, int first=1, int last=-1)

Protected Member Functions

void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce (T &h)
void extraDeps_update_handler (Gaudi::Details::PropertyBase &ExtraDeps)
 Add StoreName to extra input/output deps as needed.

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t

Private Member Functions

std::vector< std::vector< TString > > list_files (const TString &fileList_TCADsamples)
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)
void fillEdgeValues (TH1D *hin)
bool isInterpolation (const std::vector< double > &vval, double aimval)
bool isInterpolation (std::vector< double > *vval, double aimval)
double estimateEfieldLinear (double aimVoltage)
void saveTGraph (std::vector< double > vvol, std::vector< double > vflu, std::vector< std::vector< double > > vfluvvol, double aimFlu, double aimVol, std::string_view prepend, bool skipNegative=true)
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Static Private Member Functions

static double extrapolateLinear (double x1, double y1, double x2, double y2, double xaim)
static double relativeDistance (double x1, double x2)
static double relativeDistance (double x1, double y1, double x2, double y2)

Private Attributes

Gaudi::Property< bool > m_initialized
Gaudi::Property< bool > m_useSpline
Gaudi::Property< int > m_sensorDepth
interpolationMethod m_efieldOrigin
TH1D * m_efieldProfile {}
std::string m_fInter
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default).
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default).
std::vector< SG::VarHandleKeyArray * > m_vhka
bool m_varHandleArraysDeclared

Detailed Description

Definition at line 37 of file EfieldInterpolator.h.

Member Typedef Documentation

◆ StoreGateSvc_t

typedef ServiceHandle<StoreGateSvc> AthCommonDataStore< AthCommonMsg< AlgTool > >::StoreGateSvc_t
privateinherited

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ EfieldInterpolator()

EfieldInterpolator::EfieldInterpolator ( const std::string & type,
const std::string & name,
const IInterface * parent )

Definition at line 27 of file EfieldInterpolator.cxx.

27 :
28 AthAlgTool(type, name, parent),
@ interspline
AthAlgTool()
Default constructor:
interpolationMethod m_efieldOrigin

◆ ~EfieldInterpolator()

EfieldInterpolator::~EfieldInterpolator ( )
virtualdefault

Member Function Documentation

◆ createEfieldProfile()

TH1D * EfieldInterpolator::createEfieldProfile ( double aimFluence,
double aimVoltage )

Definition at line 691 of file EfieldInterpolator.cxx.

691 {
692 if (!m_initialized) {
693 ATH_MSG_WARNING("ERROR: EfieldInterpolator not properly intialized from " << m_fInter);
694 return nullptr;
695 }
696 if (aimFluence > 1e12) aimFluence = aimFluence / 1e14; //adapt units - TCAD files save 20 for 20e14 neq/cm2
697 TString title = "hefieldz";
698 TString info = "#Phi=";
699 info += TString::Format("%.2f", aimFluence);
700 info += "-U=";
701 info += TString::Format("%.0f", aimVoltage);
702 info += ";Pixeldepth z [#mum]";
703 info += ";E [V/cm]";
704 m_efieldProfile = new TH1D(title, info, m_sensorDepth, -0.5, m_sensorDepth + 0.5);
705 double pixeldepth;
706 std::vector<double> xfluence;
707 std::vector<double> yvoltage;
708 std::vector<std::vector<double> > efieldfluvol;
709 TFile* ftreeInterpolation = TFile::Open(m_fInter.c_str());
710 TTreeReader myReader("tz", ftreeInterpolation);
711 TTreeReaderValue<std::vector<double> > involtage(myReader, "yvoltage");
712 TTreeReaderValue<std::vector<double> > influence(myReader, "xfluence");
713 TTreeReaderValue<std::vector<std::vector<double> > > inefield(myReader, "efieldfluvol");
714 TTreeReaderValue<double> inpixeldepth(myReader, "pixeldepth");
715 int ientry = 0;
716 while (myReader.Next()) {
717 ATH_MSG_DEBUG("TTree entry: " << ientry);
718 pixeldepth = *inpixeldepth;
719 xfluence = *influence;
720 yvoltage = *involtage;
721 efieldfluvol = *inefield;
722 // Check if interpolation is reliable based on given TCAD samples
723 if (ientry < 2) {
724 reliabilityCheck(aimFluence, xfluence, aimVoltage, yvoltage);
725 }
726 double aimEf = 0.;
727 switch (m_efieldOrigin) {
728 case interspline: aimEf = estimateEfield(yvoltage, xfluence, efieldfluvol, aimFluence, aimVoltage);
729 break;
730
731 case interinvdist: aimEf = estimateEfieldInvDistance(yvoltage, xfluence, efieldfluvol, aimFluence, aimVoltage);
732 break;
733
734 case linearField: m_useSpline = false;
735 aimEf = estimateEfield(yvoltage, xfluence, efieldfluvol, aimFluence, aimVoltage);
736 break;
737
738 case TCAD: aimEf = estimateEfieldLinear(aimVoltage);
739 if (aimEf < 0.) ATH_MSG_ERROR("TCAD E field negative at" << pixeldepth << " !");
740 break;
741 }
742
743 if (aimEf < 0.) {
744 if (m_useSpline) {
745 TString debugName = "negativeSplineZ";
746 debugName += TString::Format("%.0f", pixeldepth);
747 aimEf = estimateEfield(yvoltage, xfluence, efieldfluvol, aimFluence, aimVoltage, debugName.Data(), true);
748 ATH_MSG_INFO("InterpolatorMessage: linearly interpolated e=" << aimEf << ", z=" << pixeldepth << " Phi=," << aimFluence << " U=" << aimVoltage);
749 m_useSpline = false;
750 m_efieldOrigin = linearField; // not as good as interpolation
751 } else {
752 TString debugName = "negativeLinearZ";
753 debugName += TString::Format("%.0f", pixeldepth);
754 aimEf = estimateEfield(yvoltage, xfluence, efieldfluvol, aimFluence, aimVoltage, debugName.Data(), true);
755 ATH_MSG_ERROR("InterpolatorMessage: spline and linear interpolation failed => InvDistWeighhted e=" << aimEf << ", z=" << pixeldepth << " Phi=," << aimFluence << " U=" << aimVoltage);
756 m_efieldOrigin = interinvdist; // not as good as interpolation (linear or spline) but guaranteed to be positive
757 }
758
759 myReader.Restart();
760 }
761 m_efieldProfile->SetBinContent(m_efieldProfile->FindBin(pixeldepth), aimEf);
762 ientry++;
763 }
764 ftreeInterpolation->Close();
765 //Check edge values
766 ATH_MSG_DEBUG("Fill edges");
768 scaleIntegralTo(m_efieldProfile, aimVoltage * 10000, 2, m_sensorDepth); //exclude first and last bin
769 TString newtitle = m_efieldProfile->GetTitle();
770 switch (m_efieldOrigin) {
771 case interspline: newtitle += " spline";
772 break;
773
774 case interinvdist: newtitle += " inverse distance";
775 break;
776
777 case linearField: newtitle += " linear";
778 break;
779
780 case TCAD: newtitle += " TCAD";
781 break;
782 }
783
784 m_efieldProfile->SetTitle(newtitle.Data());
785 ATH_MSG_DEBUG("Created Efield");
786 m_efieldProfile->SetLineWidth(3);
787 m_efieldProfile->SetLineStyle(2);
788 m_efieldProfile->SetLineColor(4);
789 m_efieldProfile->SetStats(0);
790 return m_efieldProfile;
791}
#define ATH_MSG_ERROR(x)
#define ATH_MSG_INFO(x)
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
@ interinvdist
@ linearField
Gaudi::Property< bool > m_initialized
Gaudi::Property< int > m_sensorDepth
double estimateEfield(std::vector< double > vvol, const std::vector< double > &vflu, const std::vector< std::vector< double > > &vfluvvol, double aimFlu, double aimVol, std::string_view prepend="", bool debug=false)
static void scaleIntegralTo(TH1 *hin, double aimInt, int first=1, int last=-1)
void fillEdgeValues(TH1D *hin)
void reliabilityCheck(double aimFluence, const std::vector< double > &fluences, double aimVoltage, const std::vector< double > &voltages)
Gaudi::Property< bool > m_useSpline
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)

◆ createInterpolationFromTCADtree()

const std::string EfieldInterpolator::createInterpolationFromTCADtree ( const std::string & fTCAD)

Definition at line 364 of file EfieldInterpolator.cxx.

364 {
365 TString tmpfinter = fTCAD;
366
367 tmpfinter.ReplaceAll("toTTree", "toInterpolationTTree");
368 TFile* faim = new TFile(tmpfinter, "Recreate");
369 TFile* ftreeTCAD = new TFile(fTCAD.c_str());
370 TTreeReader myReader("tcad", ftreeTCAD);
371 TTreeReaderValue<double> involtage(myReader, "voltage");
372 TTreeReaderValue<double> influence(myReader, "fluence");
373 TTreeReaderValue<std::vector<double> > inefield(myReader, "efield");
374 TTreeReaderValue<std::vector<int> > inpixeldepth(myReader, "pixeldepth");
375 // Get Data from TCAD tree
376 // Loop tree once to initialize values
377 // Finding which values for fluence and bias voltage exist
378 // do not hardcode values to maintain compatibility with new simulations available
379 std::vector<double> allFluences; // serves as x-axis
380 std::vector<double> allVoltages; // serves as y-axis
381 std::vector<double> allEfield;
382 int ne = 0;
383 double tmpflu, tmpvol;
384 while (myReader.Next()) {
385 tmpflu = *influence;
386 tmpvol = *involtage;
387 //Check if (double) value of fluence and bias voltage is already saved: if not save
388 if (std::find_if(allFluences.begin(), allFluences.end(), [&tmpflu](const double& b) {
389 return(std::abs(tmpflu - b) < 1E-6);
390 }) == allFluences.end()) allFluences.push_back(tmpflu);
391 if (std::find_if(allVoltages.begin(), allVoltages.end(), [&tmpvol](const double& b) {
392 return(std::abs(tmpvol - b) < 1E-6);
393 }) == allVoltages.end()) allVoltages.push_back(tmpvol);
394 ne++;
395 }
396 //put into ascending order
397 std::sort(allFluences.begin(), allFluences.end());
398 std::sort(allVoltages.begin(), allVoltages.end());
399 for (double & allFluence : allFluences) ATH_MSG_DEBUG("fluences recorded: " << allFluence);
400 for (double & allVoltage : allVoltages) ATH_MSG_DEBUG("voltages recorded: " << allVoltage);
401 std::vector<double> tmpef;
402 myReader.Restart(); //available from ROOT 6.10.
403 //Exclude TCAD efield values close to sensor edge
404 int leftEdge = 3; //unify maps - different startting points from z=1 to z=2 and z=3. Simulation not reliable at edges,
405 // skip first and last
406 int rightEdge = m_sensorDepth - 2;
407 std::vector<int> tmpz;
408 int nz = rightEdge - leftEdge;
409 // Temporary saving to avoid nesting tree loops
410 // ie read all z values at once -> add to each branch-param dimension for z
411 std::vector<double> zpixeldepth(nz, -1);
412 std::vector<std::vector<double> > zfluence(nz, std::vector<double>(ne, -1));
413 std::vector<std::vector<double> > zvoltage(nz, std::vector<double>(ne, -1));
414 std::vector<std::vector<double> > zefield(nz, std::vector<double>(ne, -1));
415 std::vector<std::vector<std::vector<double> > > zefieldmap(nz, std::vector<std::vector<double> >(allFluences.size(), std::vector<double>(allVoltages.size(), -1)));
416 int iev = 0;
417 ATH_MSG_INFO("Access TTreeReader second time\n");
418
419 while (myReader.Next()) {
420 tmpz = *inpixeldepth; //Pixeldepth of current TCAD map
421 ATH_MSG_DEBUG("Number of available z values = " << tmpz.size());
422 if (tmpz.at(0) > leftEdge) ATH_MSG_WARNING("Map starting from high pixeldepth = " << tmpz.at(0) << ". Might trouble readout.");
423 for (int iz = leftEdge; iz < rightEdge; iz++) {
424 int index = 0;
425 //Safety check:
426 //files starting from z=1, z=2 or z=3
427 //determine correct index to match sensor depth
428 ATH_MSG_DEBUG("Access tmpz \n");
429 ATH_MSG_DEBUG("Adapt index shift \n");
430 while ((tmpz.at(index) != iz) && (index < nz)) {
431 ATH_MSG_DEBUG("Adapt possible index shift for missing edge values: pixeldepth tree = " << nz << " current index = " << index);
432 index++;
433 }
434 if (iz % 2 == 0) ATH_MSG_DEBUG("Index " << index << " - iev " << iev << " - iz " << iz);
435 tmpflu = *influence;
436 tmpvol = *involtage;
437 tmpef = *inefield;
438 zfluence.at(iz - leftEdge).at(iev) = tmpflu; // assign value to certain pixeldepth(z)
439 zvoltage.at(iz - leftEdge).at(iev) = tmpvol;
440 zefield.at(iz - leftEdge).at(iev) = tmpef.at(index);
441 ((zefieldmap.at(iz - leftEdge)).at(isContainedAt(allFluences, tmpflu))).at(isContainedAt(allVoltages, tmpvol)) = tmpef.at(index);
442 ATH_MSG_DEBUG("Event #" << iev << "-z=" << iz << ": fluence =" << tmpflu << " voltage=" << tmpvol << ", E=" << tmpef.at(index));
443 }
444 iev++;
445 }
446 ATH_MSG_DEBUG("# Start filling interpolation tree \n");
447 //Filling the interpolation tree
448 faim->cd();
449 TTree* tz_tmp = new TTree("tz", "All TCAD E field simulations stored splitted by pixel depth");
450 double pixeldepth = -1.;
451 std::vector<double> fluence;
452 std::vector<double> voltage;
453 std::vector<double> xfluence;
454 std::vector<double> yvoltage;
455 std::vector<double> efield;
456 std::vector<std::vector<double> > efieldfluvol;
457
458 tz_tmp->Branch("pixeldepth", &pixeldepth);
459 tz_tmp->Branch("voltage", &voltage);
460 tz_tmp->Branch("fluence", &fluence);
461 tz_tmp->Branch("yvoltage", &yvoltage);
462 tz_tmp->Branch("xfluence", &xfluence);
463 tz_tmp->Branch("efield", &efield);
464 tz_tmp->Branch("efieldfluvol", &efieldfluvol);
465 for (int iz = leftEdge; iz < rightEdge; iz++) {
466 pixeldepth = iz;
467 fluence = zfluence.at(iz - leftEdge);
468 voltage = zvoltage.at(iz - leftEdge);
469 efield = zefield.at(iz - leftEdge);
470 efieldfluvol = zefieldmap.at(iz - leftEdge);
471 xfluence = allFluences;
472 yvoltage = allVoltages;
473 ATH_MSG_DEBUG("Fill tree for z =" << iz << " pd=" << pixeldepth);
474 faim->cd();
475 tz_tmp->Fill();
476 }
477
478 //Save new Interpolation tree
479 faim->cd();
480 tz_tmp->Write();
481 faim->Close();
482 m_fInter = tmpfinter.Data();
483 return m_fInter;
484}
int isContainedAt(const std::vector< double > &v, double val)
mapped_type at(key_type key) const
Look up an element in the map.
str index
Definition DeMoScan.py:362
void sort(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of sort for DataVector/List.

◆ declareGaudiProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T, V, H > & hndl,
const SG::VarHandleKeyType &  )
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKey>

Definition at line 156 of file AthCommonDataStore.h.

158 {
160 hndl.value(),
161 hndl.documentation());
162
163 }
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)

◆ declareProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( Gaudi::Property< T, V, H > & t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145 {
146 typedef typename SG::HandleClassifier<T>::type htype;
148 }
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>

◆ detStore()

const ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< AlgTool > >::detStore ( ) const
inlineinherited

The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 95 of file AthCommonDataStore.h.

◆ estimateEfield()

double EfieldInterpolator::estimateEfield ( std::vector< double > vvol,
const std::vector< double > & vflu,
const std::vector< std::vector< double > > & vfluvvol,
double aimFlu,
double aimVol,
std::string_view prepend = "",
bool debug = false )

Definition at line 552 of file EfieldInterpolator.cxx.

552 {
553 ATH_MSG_DEBUG("Estimating efield");
554 std::vector<double> evol; // e field values for fixed voltages inter- or extrapolated to fluence of interest
555 std::vector<double> vvolWoEp; // fixed voltages values for which no extrapolation is used to obatin E field in
556 // between fluences
557 std::vector<double> evolWoEp;
558 //Loop the voltages
559 for (uint ifix = 0; ifix < vvol.size(); ifix++) {
560 std::vector<double> vx;// = new std::vector<double> ;
561 std::vector<double> vy;// = new std::vector<double>;
562 double efflu = -1.;
563 int availableTCADpoints = fillXYvectors(vflu, ifix, vfluvvol, vx, vy);
564 ATH_MSG_DEBUG("Number of available TCAD points for voltage " << vvol.at(ifix) << ": " << availableTCADpoints);
565 TString name = "FluenceEfield_";
566 name += ifix;
567 name += "FixVol";
568 name += TString::Format("%.0f", vvol.at(ifix));
569 name += "-aimFlu";
570 name += TString::Format("%.1f", aimFlu);
571 name += "-aimVol";
572 name += TString::Format("%.0f", aimVol);
573
574 TGraph* tmpgr = new TGraph(CastStdVec(vx), CastStdVec(vy));
575 tmpgr->SetTitle(name.Data());
576 if (isInterpolation(vx, aimFlu)) {
577 name += "_ip";
578 } else {
579 name += "_ep";
580 }
581 if (m_useSpline) {
582 efflu = tmpgr->Eval(aimFlu, nullptr, "S");
583 } else {
584 efflu = tmpgr->Eval(aimFlu); //linear extrapolation
585 }
586 if (debug) {
587 TString aimFile = m_fInter;
588 aimFile.ReplaceAll(".root", "_debug");
589 if (!prepend.empty()) {
590 aimFile += "_";
591 aimFile += TString{prepend};
592 }
593 aimFile += "_";
594 aimFile += name;
595 aimFile += ".root";
596 tmpgr->SaveAs(aimFile);
597 }
598 if (isInterpolation(vx, aimFlu)) {
599 // try without extrapolation: skip extrapolated values
600 vvolWoEp.push_back(vvol.at(ifix));
601 evolWoEp.push_back(efflu);
602 }
603
604 delete tmpgr;
605 evol.push_back(efflu); //includes extrapolated values
606 }//end loop voltages
607
608 //Check for debugging distribution of available E field values in fluence and
609 if (debug) {
610 saveTGraph(vvol, vflu, vfluvvol, aimFlu, aimVol, prepend);
611 }
612 // if possible to reach voltage of interest without any extrapolation in previous step, prefer this
613 if (isInterpolation(vvolWoEp, aimVol) && vvolWoEp.size() > 1) {
614 vvol = std::move(vvolWoEp);
615 evol = std::move(evolWoEp);
616 } else {
617 ATH_MSG_WARNING("E field created on extrapolation. Please check if reasonable!");
618 }
619
620 TString name = "VoltageEfield";
621 name += "-aimFlu";
622 name += TString::Format("%.1f", aimFlu);
623 name += "-aimVol";
624 name += TString::Format("%.0f", aimVol);
625 double aimEf = -1;
626 auto tmpgr = std::make_unique<TGraph>(CastStdVec(vvol), CastStdVec(evol));
627 tmpgr->SetTitle(name.Data());
628 if (isInterpolation(vvol, aimVol)) {
629 name += "_ip";
630 } else {
631 name += "_ep";
632 }
633 if (m_useSpline) {
634 aimEf = tmpgr->Eval(aimVol, nullptr, "S");
635 } else {
636 aimEf = tmpgr->Eval(aimVol); //linear extrapolation
637 }
638 if (debug) {
639 TString aimFile = m_fInter;
640 aimFile.ReplaceAll(".root", "_debug");
641 if (!prepend.empty()) {
642 aimFile += "_";
643 aimFile += TString{prepend};
644 }
645 aimFile += "_";
646 aimFile += name;
647 aimFile += ".root";
648
649 tmpgr->SaveAs(aimFile);
650 }
651 return aimEf;
652}
TVectorD CastStdVec(const std::vector< double > &vin)
unsigned int uint
const bool debug
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)
bool isInterpolation(const std::vector< double > &vval, double aimval)
void saveTGraph(std::vector< double > vvol, std::vector< double > vflu, std::vector< std::vector< double > > vfluvvol, double aimFlu, double aimVol, std::string_view prepend, bool skipNegative=true)

◆ estimateEfieldInvDistance()

double EfieldInterpolator::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. )

Definition at line 526 of file EfieldInterpolator.cxx.

526 {
527 ATH_MSG_WARNING("Use interpolation method _Inverse distance weighted_ - guarantees positive E field but no reliable interpolation");
528 double weight = 0.;
529 double meanEf = 0.;
530 double distance = 1.;
531 double efEntry = 0.;
532 //Loop available efield values for fluence/voltage - take weighted mean
533 for (uint ivol = 0; ivol < vvol.size(); ivol++) {
534 for (uint iflu = 0; iflu < vflu.size(); iflu++) {
535 efEntry = vfluvvol.at(iflu).at(ivol);
536 if (efEntry > 0.) { //Otherwise (-1), TCAD not available
537 distance = relativeDistance(aimVol, aimFlu, vvol.at(ivol), vflu.at(iflu));
538 if (distance < 0.00001) return efEntry;//fluence and voltage almost correpsond to available TCAD simulation
539
540 meanEf += efEntry * TMath::Power((1. / distance), measure);
541 weight += TMath::Power((1. / distance), measure);
542 }
543 }
544 }
545 if (weight == 0.) return 0.;
546 return(meanEf / weight);
547}
static double relativeDistance(double x1, double x2)
float distance(const Amg::Vector3D &p1, const Amg::Vector3D &p2)
calculates the distance between two point in 3D space

◆ estimateEfieldLinear()

double EfieldInterpolator::estimateEfieldLinear ( double aimVoltage)
private

Definition at line 521 of file EfieldInterpolator.cxx.

521 {
522 return aimVoltage / (float) m_efieldProfile->GetNbinsX() * 10000; //10^4 for unit conversion
523}

◆ evtStore()

ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore ( )
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 85 of file AthCommonDataStore.h.

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::extraDeps_update_handler ( Gaudi::Details::PropertyBase & ExtraDeps)
protectedinherited

Add StoreName to extra input/output deps as needed.

use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given

◆ extrapolateLinear()

double EfieldInterpolator::extrapolateLinear ( double x1,
double y1,
double x2,
double y2,
double xaim )
staticprivate

Definition at line 236 of file EfieldInterpolator.cxx.

236 {
237 // follow linear extrapolation: y=mx+b
238 double delx = x2 - x1;
239
240 if (delx == 0) return 0.; // slope not defined
241
242 double dely = y2 - y1;
243 double b = y1 - (dely / delx) * x1;
244 return(xaim * (dely / delx) + b);
245}

◆ fillEdgeValues()

void EfieldInterpolator::fillEdgeValues ( TH1D * hin)
private

Definition at line 794 of file EfieldInterpolator.cxx.

794 {
795 int nBins = hin->GetNbinsX();
796
797 //Check first and last bins if filled
798 // if not extrapolate linearly from two neighbouring values
799 // empty (or zero) e field values cause unphysical behaviour in ATHENA/Allpix
800 for (int i = 5; i > 0; i--) {
801 //first bins
802 float curval = hin->GetBinContent(i);
803 float binii = hin->GetBinContent(i + 1);
804 float biniii = hin->GetBinContent(i + 2);
805 float bini = hin->GetBinContent(i);
806 if ((bini < 0.01 && binii > 0.01 && biniii > 0.01) || ((biniii - binii) / (float) binii * (binii - bini) / (float) binii < -0.2)) {//either neighbour filled and bin negative, or edge detected, i.e. slope changes sign and relatively larger than middle entry
807 bini = extrapolateLinear(i + 1, binii, i + 2, biniii, i);
808 if (bini > 0) {
809 hin->SetBinContent(i, bini);
810 } else {
811 ATH_MSG_WARNING("Could not correct bin " << i << " for zero or edge ");
812 if (curval <= 0.) hin->SetBinContent(i, 1.); //avoid negative Efield
813 }
814 } else {
815 ATH_MSG_INFO("No need to fill edge bin: " << i);
816 }
817 //Last bins = right hand edge
818 curval = hin->GetBinContent(nBins + 1 - i);
819 binii = hin->GetBinContent(nBins + 1 - i - 1);
820 biniii = hin->GetBinContent(nBins + 1 - i - 2);
821 bini = hin->GetBinContent(nBins + 1 - i);
822 if ((bini < 0.01 && binii > 0.01 && biniii > 0.01) || ((biniii - binii) / (float) binii * (binii - bini) / (float) binii < -0.2)) {//left neighbour filled and bin below negative or slope changes sign and magnitude
823 bini = extrapolateLinear(nBins + 1 - i - 2, hin->GetBinContent(nBins + 1 - i - 2), nBins + 1 - i - 1, hin->GetBinContent(nBins + 1 - i - 1), nBins + 1 - i);
824 if (bini > 0.) {
825 hin->SetBinContent(nBins + 1 - i, bini);
826 } else {
827 ATH_MSG_WARNING("Could not correct bin" << nBins + 1 - i << " for zero or edge ");
828 if (curval <= 0.) hin->SetBinContent(nBins + 1 - i, 1.); //avoid negative Efield
829 }
830 } else {
831 ATH_MSG_INFO("No need to fill edge bin: " << (nBins - i));
832 }
833 }
834}
static double extrapolateLinear(double x1, double y1, double x2, double y2, double xaim)

◆ fillXYvectors()

int EfieldInterpolator::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 )
private

Definition at line 487 of file EfieldInterpolator.cxx.

487 {
488 yy.clear();
489 xx.clear();
490 int nfills = 0;
491 if (regularOrder) {
492 for (uint ie = 0; ie < v2vsv1.size(); ie++) {
493 double ef = v2vsv1.at(ie).at(ifix); // different fluences for voltage ifix
494 if (ef > 0) {
495 yy.push_back(ef);
496 xx.push_back(vLoop.at(ie));
497 nfills++;
498 } else {
499 ATH_MSG_DEBUG("E field value not available for Phi=" << vLoop.at(ie) << " index Vol= " << ifix);
500 //Values not ordered in a regular fluence-bias voltage grid
501 }
502 }
503 } else {
504 for (uint ie = 0; ie < v2vsv1.at(0).size(); ie++) {
505 double ef = v2vsv1.at(ifix).at(ie);
506 if (ef > 0) {
507 yy.push_back(ef);
508 xx.push_back(vLoop.at(ie));
509 nfills++;
510 } else {
511 ATH_MSG_DEBUG("E field value not available for Phi=" << vLoop.at(ifix) << " U=" << vLoop.at(ie));
512 //Values not ordered in a regular fluence-bias voltage grid
513 }
514 }
515 }
516
517 return nfills;
518}
size_t size() const
Number of registered mappings.

◆ finalize()

StatusCode EfieldInterpolator::finalize ( )
overridevirtual

Definition at line 38 of file EfieldInterpolator.cxx.

38 {
39 ATH_MSG_DEBUG("Finalizing " << name() << "...");
40 return StatusCode::SUCCESS;
41}

◆ getEfield()

TH1D * EfieldInterpolator::getEfield ( double aimFluence,
double aimVoltage )

Definition at line 838 of file EfieldInterpolator.cxx.

838 {
839 if (m_initialized) {
840 m_efieldProfile = createEfieldProfile(aimFluence, aimVoltage);
841 } else {
842 ATH_MSG_WARNING("EfieldInterpolator not initialized! Not able to produce E field.");
843 }
844 return m_efieldProfile;
845}
TH1D * createEfieldProfile(double aimFluence, double aimVoltage)

◆ initialize()

StatusCode EfieldInterpolator::initialize ( )
overridevirtual

Definition at line 33 of file EfieldInterpolator.cxx.

33 {
34 ATH_MSG_DEBUG("Initializing " << name() << "...");
35 return StatusCode::SUCCESS;
36}

◆ initializeFromDirectory()

bool EfieldInterpolator::initializeFromDirectory ( const std::string & fpath)

Definition at line 93 of file EfieldInterpolator.cxx.

93 {
94 //similar to function loadTCADfiles()
95 //instead of reading file list, list files from directory fpath and create file listing information
96
97 //retrieve fluence and bias voltage from file name (including path, directory names fluence value)
98 //skip files which do not dollow naming declaration
99
100 //Create textfile for tmp storage
101 std::ofstream efieldscalib;
102 efieldscalib.open("listOfEfields.txt");
103 TPRegexp rvo("\\b-[0-9](\\w+)V\\b");
104 TPRegexp rfl("\\bfl([\\w.]+)e[0-9]{1,2}");
105 TString ext = ".dat";
106 TString sflu, svol, fullpath;
107 TSystemDirectory dir((TString)fpath, (TString)fpath);
108 TList* files = dir.GetListOfFiles();
109 if (files) {
110 TSystemFile* file;
111 TString fname;
112 TIter next(files);
113 while ((file = (TSystemFile*) next())) {
114 fname = file->GetName();
115 if (fname.BeginsWith("fl") && file->IsDirectory()) {
116 TString deeppath = fpath;
117 deeppath += fname;
118 deeppath += "/reference/";
119 TSystemDirectory deepdir(deeppath, deeppath);
120 TList* deepfiles = deepdir.GetListOfFiles();
121 if (deepfiles) {
122 TSystemFile* deepfile;
123 TString deepfname;
124 TIter deepnext(deepfiles);
125 while ((deepfile = (TSystemFile*) deepnext())) {
126 deepfname = deepfile->GetName();
127 if (!deepfile->IsDirectory() && deepfname.EndsWith(ext)) {
128 svol = deepfname(rvo);
129 svol.ReplaceAll("-", "");
130 svol.ReplaceAll("V", "");
131 sflu = deeppath(rfl);
132 sflu.ReplaceAll("fl", "");
133 fullpath = deeppath;
134 fullpath += deepfname;
135 if (!deepfname.Contains("pruned")) {
136 if (!sflu.IsFloat()) {
137 ATH_MSG_INFO("EfieldInterpolator load from directory - could not resolve fluence from " << fullpath);
138 continue;
139 }
140 if (!svol.IsFloat()) {
141 ATH_MSG_INFO("EfieldInterpolator load from directory - could not resolve voltage from " << fullpath);
142 continue;
143 }
144 } else {
145 ATH_MSG_INFO("Skip pruned files: " << fullpath);
146 continue;
147 }
148 efieldscalib << fullpath << " " << sflu << " " << svol << std::endl;
149 }
150 }
151 }
152 }
153 }
154 }
155 efieldscalib.close();
156 bool success = initializeFromFile("listOfEfields.txt");
157 if (success) ATH_MSG_INFO("Initialized from directory");
158 return success;
159}
bool initializeFromFile(const std::string &finpath)
std::vector< std::string > files
file names and file pointers
Definition hcg.cxx:52
TFile * file

◆ initializeFromFile()

bool EfieldInterpolator::initializeFromFile ( const std::string & finpath)

Definition at line 162 of file EfieldInterpolator.cxx.

162 {
163 TString fpath = finpath;
164
165 m_initialized = false;
166 TString fTCAD = "";
167 if (fpath.EndsWith(".txt")) {
168 //File list path, fluence and bias voltage of TCAD simulation as plain text
169 fTCAD = loadTCADfiles(fpath.Data());
170 ATH_MSG_INFO("Loaded file " << fpath << " - all maps accumulated in " << fTCAD);
172 ATH_MSG_INFO("created interpolation tree ");
173 m_initialized = true;
174 ATH_MSG_INFO("Loaded from .txt file");
175 } else {
176 if (fpath.EndsWith("toTTree.root")) {
177 //File list TCAD efield maps as leaves
179 m_initialized = true;
180 } else {
181 if (fpath.EndsWith(".root")) {
182 //File list is already transformed to tree
183 m_fInter = fpath;
184 m_initialized = true;
185 }
186 }
187 }
188 ATH_MSG_INFO("Interpolation has been initialized from file " << m_fInter << " - successful " << m_initialized);
189 return m_initialized;
190}
const std::string createInterpolationFromTCADtree(const std::string &fTCAD)
const std::string loadTCADfiles(const std::string &targetList="")

◆ inputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::inputHandles ( ) const
overridevirtualinherited

Return this algorithm's input handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ isInterpolation() [1/2]

bool EfieldInterpolator::isInterpolation ( const std::vector< double > & vval,
double aimval )
inlineprivate

Definition at line 91 of file EfieldInterpolator.h.

92 {return(vval.front() <= aimval && aimval <= vval.back());};

◆ isInterpolation() [2/2]

bool EfieldInterpolator::isInterpolation ( std::vector< double > * vval,
double aimval )
inlineprivate

Definition at line 93 of file EfieldInterpolator.h.

94 {return(vval->front() <= aimval && aimval <= vval->back());};
return m_collEvts back().back().max_entries

◆ list_files()

std::vector< std::vector< TString > > EfieldInterpolator::list_files ( const TString & fileList_TCADsamples)
private

Definition at line 334 of file EfieldInterpolator.cxx.

334 {
335 std::vector<std::vector<TString> > filelist;
336 TString tmpname = "";
337 TString tmpfluence = "";
338 TString tmpvolt = "";
339 std::vector<TString> vstr;
340 std::ifstream in;
341 ATH_MSG_DEBUG("Try to open: " << fileList_TCADsamples.Data());
342 in.open(fileList_TCADsamples);
343 while (1) {
344 in >> tmpname >> tmpfluence >> tmpvolt;
345 if (!in.good()) break;
346 if (tmpname.BeginsWith('#')) continue;
347 if (tmpname.EndsWith(".dat")) {
348 vstr.push_back(tmpname);
349 vstr.push_back(tmpfluence);
350 vstr.push_back(tmpvolt);
351 filelist.push_back(vstr);
352 ATH_MSG_DEBUG("Found and load:" << tmpfluence.Atof() << " neq/cm2 " << tmpvolt.Atof() << "V - " << tmpname.Data());
353 vstr.clear();
354 } else {
355 ATH_MSG_WARNING("Wrong extension: " << tmpname.Data() << " -- check input ");
356 }
357 }
358 in.close();
359 return filelist;
360}
filelist
print ("Checking files %s..." % fullfile)
Definition envutil.py:133

◆ loadEfieldFromDat()

TH1D * EfieldInterpolator::loadEfieldFromDat ( const std::string & fname,
bool fillEdges = true )

Definition at line 249 of file EfieldInterpolator.cxx.

249 {
250 TH1D* hefieldz = new TH1D("hefieldz", "hefieldz", m_sensorDepth + 1, -0.5, m_sensorDepth + 0.5);
251
252 std::ifstream in;
253 in.open(fname);
254 TString z, e;
255 int nlines = 0;
256 ATH_MSG_INFO("Load E field from " << fname);
257 while (1) {
258 in >> z >> e;
259 if (!in.good()) break;
260 if (nlines < 3) printf("e=%s=%f, z=%s=%f \n", e.Data(), e.Atof(), z.Data(), z.Atof());
261 nlines++;
262 hefieldz->Fill(z.Atof(), e.Atof());
263 }
264 in.close();
265 if (fillEdges) EfieldInterpolator::fillEdgeValues(hefieldz);
266 return hefieldz;
267}
#define z

◆ loadTCADfiles()

const std::string EfieldInterpolator::loadTCADfiles ( const std::string & targetList = "")

Definition at line 270 of file EfieldInterpolator.cxx.

270 {
271 bool isIBL = true;
272 TString tl = targetList;
273 TString fName = targetList;
274
275 fName.ReplaceAll(".txt", "_toTTree.root");
276 fName = fName.Remove(0, fName.Last('/') + 1); //Remove prepending path and store in run directory
277 TFile* bufferTCADtree = new TFile(fName.Data(), "RECREATE");
278
279 if (tl.Length() < 1) {
280 tl = "list_TCAD_efield_maps.txt";
281 ATH_MSG_WARNING("No List to load! Set default: " << tl.Data());
282 }
283 std::ifstream in;
284 TTree* tcadtree = new TTree("tcad", "All TCAD E field simulations stored as individual events in tree");
285 double voltage = -1.;
286 double fluence = -1.;
287 std::vector<double> efield;
288 std::vector<Int_t> pixeldepth;
289 tcadtree->Branch("voltage", &voltage, "voltage/D");
290 tcadtree->Branch("fluence", &fluence, "fluence/D");
291 tcadtree->Branch("efield", &efield);
292 tcadtree->Branch("pixeldepth", &pixeldepth);
293 //Get vetcor of {filename, fluence, bias voltage}
294 std::vector<std::vector<TString> > infile = list_files(tl);
295 TString z, e;
296 TString tmp = "";
297 for (uint ifile = 0; ifile < infile.size(); ifile++) {
298 tmp = infile.at(ifile).at(0);
299 in.open(infile.at(ifile).at(0));
300 // Number format eg 10e14 also 1.2e13
301 //fluence = (infile.at(ifile).at(1).ReplaceAll("e14","")).Atof();
302 fluence = (infile.at(ifile).at(1)).Atof();
303 fluence = fluence * 1e-14; //choose fluence e14 as default unit
304 voltage = infile.at(ifile).at(2).Atof();
305 Int_t nlines = 0;
306 efield.clear();
307 pixeldepth.clear();
308 while (1) {
309 in >> z >> e;
310 if (!in.good()) {
311 ATH_MSG_DEBUG("Break for file No. " << ifile << ": " << infile.at(ifile).at(0) << " . After " << nlines << " steps");
312 break;
313 }
314 ATH_MSG_DEBUG("Reading input line: fluence=" << (infile.at(ifile).at(1)).Data() << fluence << " voltage=" << voltage << " e=" << e.Atof() << "=" << e.Data() << ", z=" << (int) z.Atof() << "=" << z.Data() << " in file = " << ifile);
315 nlines++;
316 efield.push_back(e.Atof());
317 pixeldepth.push_back((int) z.Atof());
318 if (z.Atof() > 200) isIBL = false; // Pixel depth to huge to be IBL
319 }
320 bufferTCADtree->cd();
321 tcadtree->Fill();
322 in.close();
323 }
324 if (!isIBL) {
325 ATH_MSG_INFO("Pixel depth read from file too big for IBL. Set to B layer, depth = 250um\n");
326 m_sensorDepth = 250;
327 }
328 bufferTCADtree->cd();
329 tcadtree->Write();
330 bufferTCADtree->Close();
331 return fName.Data();
332}
bool isIBL(uint32_t robId)
std::vector< std::vector< TString > > list_files(const TString &fileList_TCADsamples)

◆ loadTCADlist()

StatusCode EfieldInterpolator::loadTCADlist ( const std::string & TCADfileListToLoad)

Definition at line 78 of file EfieldInterpolator.cxx.

78 {
80 ATH_MSG_INFO("Load from list " << TCADfileListToLoad);
81 if (!initializeFromFile(TCADfileListToLoad)) {
82 ATH_MSG_WARNING("ERROR: Initialize failed looking for file " << TCADfileListToLoad);
83 //Check if given path links to directory:
84 if (!initializeFromDirectory(TCADfileListToLoad)) {
85 ;
86 return StatusCode::FAILURE;
87 }
88 }
89 ATH_MSG_INFO("Finished loading TCAD list");
90 return StatusCode::SUCCESS;
91}
bool initializeFromDirectory(const std::string &fpath)

◆ msg()

MsgStream & AthCommonMsg< AlgTool >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24 {
25 return this->msgStream();
26 }

◆ msgLvl()

bool AthCommonMsg< AlgTool >::msgLvl ( const MSG::Level lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

30 {
31 return this->msgLevel(lvl);
32 }

◆ outputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::outputHandles ( ) const
overridevirtualinherited

Return this algorithm's output handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ relativeDistance() [1/2]

double EfieldInterpolator::relativeDistance ( double x1,
double x2 )
staticprivate

Definition at line 225 of file EfieldInterpolator.cxx.

225 {
226 if (x1 == 0.) return 0.;
227
228 return((x1 - x2) / x1);
229}

◆ relativeDistance() [2/2]

double EfieldInterpolator::relativeDistance ( double x1,
double y1,
double x2,
double y2 )
staticprivate

Definition at line 232 of file EfieldInterpolator.cxx.

232 {
233 return(std::sqrt(relativeDistance(x1, x2) * relativeDistance(x1, x2) + relativeDistance(y1, y2) * relativeDistance(y1, y2)));
234}

◆ reliabilityCheck()

void EfieldInterpolator::reliabilityCheck ( double aimFluence,
const std::vector< double > & fluences,
double aimVoltage,
const std::vector< double > & voltages )

Definition at line 193 of file EfieldInterpolator.cxx.

194 {
195 bool tooLowVolt = true;
196 bool tooHighVolt = true;
197
198 for (const auto iv : voltages) {
199 if (aimVoltage < iv) tooHighVolt = false;
200 if (aimVoltage > iv) tooLowVolt = false;
201 }
202 bool tooLowFlu = true;
203 bool tooHighFlu = true;
204 for (double fluence : fluences) {
205 if (aimFluence < fluence) tooHighFlu = false;
206 if (aimFluence > fluence) tooLowFlu = false;
207 }
208 if (tooLowFlu) ATH_MSG_WARNING(
209 "WARNING: The fluence value you specified (" << aimFluence << ") is too low to be reliably interpolated!");
210 if (tooLowVolt) ATH_MSG_WARNING(
211 "WARNING: The voltage value you specified (" << aimVoltage << ") is too low to be reliably interpolated!");
212 if (tooHighFlu) ATH_MSG_WARNING(
213 "WARNING: The fluence value you specified (" << aimFluence << ") is too high to be reliably interpolated!");
214 if (tooHighVolt) ATH_MSG_WARNING("WARNING: The voltage value you specified (" << aimVoltage << ") is too high to be reliably interpolated!");
215
216 // Results from Closure Test
217 // TCAD files save 20 for 20e14 neq/cm2
218 if (12.2 < aimFluence || aimFluence < 1.) ATH_MSG_WARNING(" WARNING: The fluence value you specified (" << aimFluence << ") is outside the range within it could be reliably interpolated!"); //Based on closure test June 2018 - max fluences available: ... 10 12 15 20
219 if (1010. < aimVoltage || aimVoltage < 79.) ATH_MSG_WARNING(" WARNING: The voltage value you specified (" << aimVoltage << ") is outside the range within it could be reliably interpolated!"); }

◆ renounce()

std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > AthCommonDataStore< AthCommonMsg< AlgTool > >::renounce ( T & h)
inlineprotectedinherited

Definition at line 380 of file AthCommonDataStore.h.

381 {
382 h.renounce();
384 }
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce(T &h)

◆ renounceArray()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::renounceArray ( SG::VarHandleKeyArray & handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364 {
366 }

◆ saveTGraph()

void EfieldInterpolator::saveTGraph ( std::vector< double > vvol,
std::vector< double > vflu,
std::vector< std::vector< double > > vfluvvol,
double aimFlu,
double aimVol,
std::string_view prepend,
bool skipNegative = true )
private

Definition at line 655 of file EfieldInterpolator.cxx.

655 {
656 TString name = "VoltageEfield";
657
658 name += "-aimFlu";
659 name += TString::Format("%.1f", aimFlu);
660 name += "-aimVol";
661 name += TString::Format("%.0f", aimVol);
662 TGraph2D* tmpgr = new TGraph2D();
663 tmpgr->GetYaxis()->SetTitle("voltage");
664 tmpgr->GetXaxis()->SetTitle("fluence");
665 tmpgr->SetTitle(name.Data());
666 ATH_MSG_DEBUG("E field values: " << vfluvvol.size() << " x " << vfluvvol.at(0).size() << ", flu(x)" << vflu.size() << ", vol(y)" << vvol.size());
667 int npoint = 0;
668 for (uint ix = 0; ix < vfluvvol.size(); ix++) {
669 for (uint iy = 0; iy < vfluvvol.at(ix).size(); iy++) {
670 printf("Set point %i, %f,%f,%f\n", npoint, vflu.at(ix), vvol.at(iy), vfluvvol.at(ix).at(iy));
671 if (vfluvvol.at(ix).at(iy) < 0) {
672 if (!skipNegative) tmpgr->SetPoint(npoint, vflu.at(ix), vvol.at(iy), -1);
673 } else {
674 tmpgr->SetPoint(npoint, vflu.at(ix), vvol.at(iy), vfluvvol.at(ix).at(iy));
675 }
676 npoint++;
677 }
678 }
679 TString aimFile = m_fInter;
680 aimFile.ReplaceAll(".root", "_debugAvailableEfieldVals");
681 if (!prepend.empty()) {
682 aimFile += "_";
683 aimFile += TString{prepend};
684 }
685 aimFile += "_";
686 aimFile += name;
687 aimFile += ".root";
688 tmpgr->SaveAs(aimFile);
689}

◆ scaleIntegralTo()

void EfieldInterpolator::scaleIntegralTo ( TH1 * hin,
double aimInt,
int first = 1,
int last = -1 )
static

Definition at line 221 of file EfieldInterpolator.cxx.

221 {
222 hin->Scale(aimInt / (float) hin->Integral(first, last));
223}

◆ setLayer()

void EfieldInterpolator::setLayer ( int layer)

Definition at line 66 of file EfieldInterpolator.cxx.

66 {
67 ATH_MSG_INFO("Create interpolator for layer " << layer);
68 if (layer > 0) {
69 //it's b layer
70 m_sensorDepth = 250;
71 } else {
72 //IBL
73 m_sensorDepth = 200;
74 }
75 ATH_MSG_INFO("EfieldInterpolator: Default ctor");
76}

◆ sysInitialize()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysInitialize ( )
overridevirtualinherited

Perform system initialization for an algorithm.

We override this to declare all the elements of handle key arrays at the end of initialization. See comments on updateVHKA.

Reimplemented in asg::AsgMetadataTool, AthCheckedComponent< AthAlgTool >, AthCheckedComponent<::AthAlgTool >, and DerivationFramework::CfAthAlgTool.

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysStart ( )
overridevirtualinherited

Handle START transition.

We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.

◆ updateVHKA()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::updateVHKA ( Gaudi::Details::PropertyBase & )
inlineinherited

Definition at line 308 of file AthCommonDataStore.h.

308 {
309 // debug() << "updateVHKA for property " << p.name() << " " << p.toString()
310 // << " size: " << m_vhka.size() << endmsg;
311 for (auto &a : m_vhka) {
313 for (auto k : keys) {
314 k->setOwner(this);
315 }
316 }
317 }
std::vector< SG::VarHandleKeyArray * > m_vhka

Member Data Documentation

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default).

Definition at line 393 of file AthCommonDataStore.h.

◆ m_efieldOrigin

interpolationMethod EfieldInterpolator::m_efieldOrigin
private

Definition at line 83 of file EfieldInterpolator.h.

◆ m_efieldProfile

TH1D* EfieldInterpolator::m_efieldProfile {}
private

Definition at line 84 of file EfieldInterpolator.h.

84{}; //Final efield profile

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default).

Definition at line 390 of file AthCommonDataStore.h.

◆ m_fInter

std::string EfieldInterpolator::m_fInter
private

Definition at line 85 of file EfieldInterpolator.h.

◆ m_initialized

Gaudi::Property<bool> EfieldInterpolator::m_initialized
private
Initial value:
{
this, "initialized", false, "Flag whether already initalized"
}

Definition at line 68 of file EfieldInterpolator.h.

69 {
70 this, "initialized", false, "Flag whether already initalized"
71 };

◆ m_sensorDepth

Gaudi::Property<int> EfieldInterpolator::m_sensorDepth
private
Initial value:
{
this, "sensorDepth", 200, "Depth of E fields in sensors in um"
}

Definition at line 78 of file EfieldInterpolator.h.

79 {
80 this, "sensorDepth", 200, "Depth of E fields in sensors in um"
81 };

◆ m_useSpline

Gaudi::Property<bool> EfieldInterpolator::m_useSpline
private
Initial value:
{
this, "useSpline", true, "Flag whether to use cubic splines for interpolation"
}

Definition at line 73 of file EfieldInterpolator.h.

74 {
75 this, "useSpline", true, "Flag whether to use cubic splines for interpolation"
76 };

◆ m_varHandleArraysDeclared

bool AthCommonDataStore< AthCommonMsg< AlgTool > >::m_varHandleArraysDeclared
privateinherited

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

std::vector<SG::VarHandleKeyArray*> AthCommonDataStore< AthCommonMsg< AlgTool > >::m_vhka
privateinherited

Definition at line 398 of file AthCommonDataStore.h.


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