Docker-in-Docker (DinD) capabilities of public runners deactivated. More info

Commit b65f1c76 authored by Jérémie Dudouet's avatar Jérémie Dudouet
Browse files

Update the level scheme representation in advanced visualization

parent 9662d0eb
...@@ -245,6 +245,21 @@ Bool_t BaseLSPlayer::Disconnect(TCanvas *canvas) ...@@ -245,6 +245,21 @@ Bool_t BaseLSPlayer::Disconnect(TCanvas *canvas)
return localCanvas != 0x0; return localCanvas != 0x0;
} }
void BaseLSPlayer::RefreshLinks()
{
for(int i=0 ; i<GetLinkList().GetEntries() ; i++) {
if(GetLinkList().At(i)->InheritsFrom("Gw::Link")) {
Link* link = static_cast<Link*>(GetLinkList().At(i));
link->RefreshPoints();
link->Paint();
}
}
gPad->Modified();
gPad->Update();
}
//__________________________________________________________ //__________________________________________________________
void BaseLSPlayer::HandleMovement(Int_t eventType, Int_t eventX, Int_t eventY, TObject* select) void BaseLSPlayer::HandleMovement(Int_t eventType, Int_t eventX, Int_t eventY, TObject* select)
{ {
...@@ -254,19 +269,7 @@ void BaseLSPlayer::HandleMovement(Int_t eventType, Int_t eventX, Int_t eventY, T ...@@ -254,19 +269,7 @@ void BaseLSPlayer::HandleMovement(Int_t eventType, Int_t eventX, Int_t eventY, T
pad->cd(); pad->cd();
if (eventType == kButton1Up) { if (eventType == kButton1Up) {
RefreshLinks();
for(int i=0 ; i<GetLinkList().GetEntries() ; i++)
{
if(GetLinkList().At(i)->InheritsFrom("Gw::Link"))
{
Link* link = static_cast<Link*>(GetLinkList().At(i));
link->RefreshPoints();
link->Paint();
}
}
gPad->Modified();
gPad->Update();
} }
if (eventType == kMouseMotion) { if (eventType == kMouseMotion) {
...@@ -684,6 +687,9 @@ void BaseLSPlayer::Draw(Option_t *opt) ...@@ -684,6 +687,9 @@ void BaseLSPlayer::Draw(Option_t *opt)
} }
if ( TVirtualPad::Pad() != 0 ) { // in principle, gpad exists if ( TVirtualPad::Pad() != 0 ) { // in principle, gpad exists
TVirtualPad::Pad()->Connect("RangeAxisChanged()", "BaseLSPlayer", this, "RefreshLinks()");
TVirtualPad::Pad()->GetRange(xRminOld, yRminOld, xRmaxOld, yRmaxOld); TVirtualPad::Pad()->GetRange(xRminOld, yRminOld, xRmaxOld, yRmaxOld);
xminOld = GetXMin(xRminOld, xRmaxOld); xminOld = GetXMin(xRminOld, xRmaxOld);
...@@ -802,20 +808,22 @@ Int_t BaseLSPlayer::ImportLevelScheme(const Char_t* filename, Option_t* opt) ...@@ -802,20 +808,22 @@ Int_t BaseLSPlayer::ImportLevelScheme(const Char_t* filename, Option_t* opt)
TString Options(opt); TString Options(opt);
bool Noverbose = Options.Contains("NV"); bool Noverbose = Options.Contains("NoVerbose");
Options.ReplaceAll("NV",""); Options.ReplaceAll("NoVerbose","");
Bool_t NoGraphical = Options.Contains("NoGraphical");
Options.ReplaceAll("NoGraphical","");
if ( fname.EndsWith(".ags") ) { if ( fname.EndsWith(".ags") ) {
RadLevelSchemeReader reader(filename, Options.Data()); RadLevelSchemeReader reader(filename, Options.Data());
ok= reader.Import(*fLevelScheme); ok= reader.Import(*fLevelScheme);
DoStyle(kRadware); if(!NoGraphical) DoStyle(kRadware);
} }
if ( fname.EndsWith(".ens") ) { if ( fname.EndsWith(".ens") ) {
EnsdfLevelSchemeReader reader(filename, Options.Data()); EnsdfLevelSchemeReader reader(filename, Options.Data());
if(Noverbose) reader.SetQuietMode(); if(Noverbose) reader.SetQuietMode();
ok = reader.Import(*fLevelScheme); ok = reader.Import(*fLevelScheme);
DoStyle(kEnsdf); if(!NoGraphical) DoStyle(kEnsdf);
} }
return ok; return ok;
...@@ -941,7 +949,7 @@ void LSaxis::ExecuteEvent(Int_t eventType, Int_t eventX, Int_t eventY) ...@@ -941,7 +949,7 @@ void LSaxis::ExecuteEvent(Int_t eventType, Int_t eventX, Int_t eventY)
//__________________________________________________________ //__________________________________________________________
void LSaxis::SetRange(Int_t ymin, Int_t ymax, Int_t xmin, Int_t xmax) void LSaxis::SetRange(Int_t ymin, Int_t ymax, Int_t xmin, Int_t xmax)
{ {
TVirtualPad* pad = TVirtualPad::Pad(); TPad* pad = (TPad*)TVirtualPad::Pad();
pad->cd(); pad->cd();
SetWmin(ymin); SetWmin(ymin);
...@@ -966,12 +974,14 @@ void LSaxis::SetRange(Int_t ymin, Int_t ymax, Int_t xmin, Int_t xmax) ...@@ -966,12 +974,14 @@ void LSaxis::SetRange(Int_t ymin, Int_t ymax, Int_t xmin, Int_t xmax)
fLastY2Zoom = ymax; fLastY2Zoom = ymax;
fLastX1Zoom = xmin; fLastX1Zoom = xmin;
fLastX2Zoom = xmax; fLastX2Zoom = xmax;
pad->RangeAxisChanged();
} }
//__________________________________________________________ //__________________________________________________________
void LSaxis::UnZoom() void LSaxis::UnZoom()
{ {
TVirtualPad* pad = TVirtualPad::Pad(); TPad* pad = (TPad*)TVirtualPad::Pad();
pad->cd(); pad->cd();
SetWmin(fLastY1Zoom); SetWmin(fLastY1Zoom);
...@@ -986,7 +996,8 @@ void LSaxis::UnZoom() ...@@ -986,7 +996,8 @@ void LSaxis::UnZoom()
SetY1(yMin); SetY2(yMax); SetY1(yMin); SetY2(yMax);
pad->Range(pad->GetX1(), yRmin, pad->GetX2(), yRmax); pad->Range(pad->GetX1(), yRmin, pad->GetX2(), yRmax);
pad->Modified(true); pad->Modified();
pad->RangeAxisChanged();
} }
ClassImp(BaseLSPlayer) ClassImp(BaseLSPlayer)
...@@ -251,6 +251,8 @@ namespace Gw { ...@@ -251,6 +251,8 @@ namespace Gw {
LSaxis *GetLSAxis(){return fAxis;} LSaxis *GetLSAxis(){return fAxis;}
virtual void RefreshLinks();
protected: protected:
//! set/get fLastX/fLastY //! set/get fLastX/fLastY
......
...@@ -203,7 +203,7 @@ void GLSPlayer::Draw(Option_t *opt) ...@@ -203,7 +203,7 @@ void GLSPlayer::Draw(Option_t *opt)
} }
//__________________________________________________________ //__________________________________________________________
void GLSPlayer::AddGroundLevel(Int_t z, Int_t a, Option_t* opt, Float_t energy, Float_t errEnergy) NuclearLevel *GLSPlayer::AddGroundLevel(Int_t z, Int_t a, Option_t* opt, Float_t energy, Float_t errEnergy)
{ {
// add ground state level // add ground state level
fLog.SetProcessMethod( "AddGroundLevel(Int_t, Int_t, Option_t*, Float_t, Float_t )"); fLog.SetProcessMethod( "AddGroundLevel(Int_t, Int_t, Option_t*, Float_t, Float_t )");
...@@ -243,7 +243,7 @@ void GLSPlayer::AddGroundLevel(Int_t z, Int_t a, Option_t* opt, Float_t energy, ...@@ -243,7 +243,7 @@ void GLSPlayer::AddGroundLevel(Int_t z, Int_t a, Option_t* opt, Float_t energy,
TVirtualPad* pad = TVirtualPad::Pad(); TVirtualPad* pad = TVirtualPad::Pad();
if (!pad) { if (!pad) {
fLog << error << "Pad not existing" << dolog; fLog << error << "Pad not existing" << dolog;
return; return nullptr;
} }
pad->cd(); pad->cd();
...@@ -296,6 +296,8 @@ void GLSPlayer::AddGroundLevel(Int_t z, Int_t a, Option_t* opt, Float_t energy, ...@@ -296,6 +296,8 @@ void GLSPlayer::AddGroundLevel(Int_t z, Int_t a, Option_t* opt, Float_t energy,
fLevelScheme->Draw("ground"); fLevelScheme->Draw("ground");
fLog << dolog; fLog << dolog;
return level;
} }
//__________________________________________________________ //__________________________________________________________
...@@ -1146,13 +1148,13 @@ void GLSPlayer::MoveCascade(Float_t mv, Bool_t lastLevel) ...@@ -1146,13 +1148,13 @@ void GLSPlayer::MoveCascade(Float_t mv, Bool_t lastLevel)
} }
//__________________________________________________________ //__________________________________________________________
void GLSPlayer::AddLevel(Float_t energy, Float_t errEnergy, const Char_t* dJp) NuclearLevel *GLSPlayer::AddLevel(Float_t energy, Float_t errEnergy, const Char_t* dJp)
{ {
fLog.SetProcessMethod("AddLevel(Float_t, Float_t, const Char_t* )"); fLog.SetProcessMethod("AddLevel(Float_t, Float_t, const Char_t* )");
if (GetCurrentLevel() == 0) { if (GetCurrentLevel() == 0) {
fLog << error << "No level selected" << dolog; fLog << error << "No level selected" << dolog;
return; return nullptr;
} }
//! this is the treatment of the spin / parity inside opt //! this is the treatment of the spin / parity inside opt
...@@ -1170,7 +1172,7 @@ void GLSPlayer::AddLevel(Float_t energy, Float_t errEnergy, const Char_t* dJp) ...@@ -1170,7 +1172,7 @@ void GLSPlayer::AddLevel(Float_t energy, Float_t errEnergy, const Char_t* dJp)
parity = "+"; parity = "+";
parity_offset = spin.Index("+"); parity_offset = spin.Index("+");
} }
spin.Remove(parity_offset); spin.Remove(parity_offset,1);
TList* levels = &GetLevelList(); TList* levels = &GetLevelList();
...@@ -1206,6 +1208,8 @@ void GLSPlayer::AddLevel(Float_t energy, Float_t errEnergy, const Char_t* dJp) ...@@ -1206,6 +1208,8 @@ void GLSPlayer::AddLevel(Float_t energy, Float_t errEnergy, const Char_t* dJp)
fLevelScheme->Draw(); fLevelScheme->Draw();
fLog << dolog; fLog << dolog;
return level;
} }
//__________________________________________________________ //__________________________________________________________
......
...@@ -118,10 +118,10 @@ namespace Gw { ...@@ -118,10 +118,10 @@ namespace Gw {
virtual void AddFirstLevel(Float_t energy = 300, Float_t errEnergy = 1, const Char_t* jp = "0+", Option_t* opt = "left"); // *MENU={Hierarchy="LS/AddFirstLevel"}* virtual void AddFirstLevel(Float_t energy = 300, Float_t errEnergy = 1, const Char_t* jp = "0+", Option_t* opt = "left"); // *MENU={Hierarchy="LS/AddFirstLevel"}*
//! Add new level to the current cascade //! Add new level to the current cascade
virtual void AddLevel(Float_t energy = 300, Float_t errEnergy = 1, const Char_t* dJp = "0/1+"); // *MENU={Hierarchy="LS/AddLevel"}* virtual NuclearLevel *AddLevel(Float_t energy = 300, Float_t errEnergy = 1, const Char_t* dJp = "0/1+"); // *MENU={Hierarchy="LS/AddLevel"}*
//! Add ground state level //! Add ground state level
virtual void AddGroundLevel(Int_t z = 66, Int_t a = 152, Option_t* opt = "0/1+", Float_t energy = 0, Float_t errEnergy = 1); //*MENU={Hierarchy="LS/AddGroundLevel"}* virtual NuclearLevel *AddGroundLevel(Int_t z = 66, Int_t a = 152, Option_t* opt = "0/1+", Float_t energy = 0, Float_t errEnergy = 1); //*MENU={Hierarchy="LS/AddGroundLevel"}*
//! Add arrows to the LS between two selected levels //! Add arrows to the LS between two selected levels
virtual void AddArrow(Option_t* opt = "|>"); // *MENU={Hierarchy="LS/AddArrow"}* virtual void AddArrow(Option_t* opt = "|>"); // *MENU={Hierarchy="LS/AddArrow"}*
......
...@@ -332,8 +332,11 @@ void Link::SetAdvancedStylePoints(Double_t xi, Double_t xf) ...@@ -332,8 +332,11 @@ void Link::SetAdvancedStylePoints(Double_t xi, Double_t xf)
//equation droite reliant xi a xf : yd = ad*x + bd //equation droite reliant xi a xf : yd = ad*x + bd
Double_t b1 = bd - GetStrength().Get()*StrenghtFact*MetricFact * sqrt(ad*ad + 1); // yd1 = ad*x+b1 Double_t Strenght = GetStrength().Get();
Double_t b2 = bd + GetStrength().Get()*StrenghtFact*MetricFact * sqrt(ad*ad + 1); // yd2 = ad*x+b2 if(Strenght<5) Strenght = 5;
Double_t b1 = bd - Strenght*StrenghtFact*MetricFact * sqrt(ad*ad + 1); // yd1 = ad*x+b1
Double_t b2 = bd + Strenght*StrenghtFact*MetricFact * sqrt(ad*ad + 1); // yd2 = ad*x+b2
Double_t x_p1 = (yi-b1)/ad; Double_t x_p1 = (yi-b1)/ad;
...@@ -386,9 +389,9 @@ void Link::SetAdvancedStylePoints(Double_t xi, Double_t xf) ...@@ -386,9 +389,9 @@ void Link::SetAdvancedStylePoints(Double_t xi, Double_t xf)
GetLabel(i).SetY(height); GetLabel(i).SetY(height);
} }
GetLabel(0).SetX(xi/MetricFact+(xf/MetricFact-xi/MetricFact)/2. - GetStrength().Get()); GetLabel(0).SetX(xi/MetricFact+(xf/MetricFact-xi/MetricFact)/2. - Strenght);
GetLabel(1).SetX(xi/MetricFact+(xf/MetricFact-xi/MetricFact)/2.); GetLabel(1).SetX(xi/MetricFact+(xf/MetricFact-xi/MetricFact)/2.);
GetLabel(2).SetX(xi/MetricFact+(xf/MetricFact-xi/MetricFact)/2. + GetStrength().Get()); GetLabel(2).SetX(xi/MetricFact+(xf/MetricFact-xi/MetricFact)/2. + Strenght);
// GetLabel(0).SetX(GetX()[1] - TMath::Abs(GetIL()->GetX2() - GetIL()->GetX1())*0.25); // GetLabel(0).SetX(GetX()[1] - TMath::Abs(GetIL()->GetX2() - GetIL()->GetX1())*0.25);
...@@ -411,6 +414,17 @@ Int_t Link::Compare(const TObject* obj) const ...@@ -411,6 +414,17 @@ Int_t Link::Compare(const TObject* obj) const
} }
} }
//__________________________________________________________
void Link::RefreshPoints()
{
if(fArrowStyle==0) {
SetPoints(GetX()[0]+(GetX()[2]-(GetX()[0]))/2.,GetX()[5]);
}
else if(fArrowStyle==1) {
SetPoints(GetX()[0]+(GetX()[2]-(GetX()[0]))/2.,GetX()[5]);
}
}
//__________________________________________________________ //__________________________________________________________
void Link::UpdatePoints() void Link::UpdatePoints()
{ {
......
...@@ -134,7 +134,7 @@ public: ...@@ -134,7 +134,7 @@ public:
virtual void SetVertical(){SetPoints((GetX()[5]+GetX()[1])/2.,(GetX()[5]+GetX()[1])/2.);} //*MENU* virtual void SetVertical(){SetPoints((GetX()[5]+GetX()[1])/2.,(GetX()[5]+GetX()[1])/2.);} //*MENU*
virtual void SetAmbiguous(Bool_t isambiguous = true); //*MENU* virtual void SetAmbiguous(Bool_t isambiguous = true); //*MENU*
virtual Bool_t IsAmbiguous(){return fIsAmbiguous;} virtual Bool_t IsAmbiguous(){return fIsAmbiguous;}
virtual void RefreshPoints() {SetPoints(GetX()[0]+(GetX()[2]-(GetX()[0]))/2.,GetX()[5]);} virtual void RefreshPoints();
//! to set points from the levels and the Strength //! to set points from the levels and the Strength
virtual void SetPoints(); virtual void SetPoints();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment