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

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

Merge branch 'Cubix' into 'Cubix'

Add color mode for level scheme

See merge request !50
parents 196a51dd 581225ae
Pipeline #45530 passed with stage
in 8 minutes and 45 seconds
......@@ -63,6 +63,11 @@ CXGuiLSPlayer::CXGuiLSPlayer(const TGCompositeFrame *MotherFrame, UInt_t w, UInt
fGroupFrame->AddFrame(fPlotLSButton,new TGLayoutHints(kLHintsCenterX | kLHintsCenterY | kLHintsExpandX,15,15,10,10));
fHorizontalFrame = new TGCompositeFrame(fGroupFrame, 60, 20, kHorizontalFrame);
fHorizontalFrame->AddFrame(fArrowMode = new TGCheckButton(fHorizontalFrame, "Collored arrows mode", 99), new TGLayoutHints(kLHintsTop | kLHintsRight,5,0,0,0));
fGroupFrame->AddFrame(fHorizontalFrame,new TGLayoutHints(kLHintsCenterX | kLHintsCenterY, 0, 0, 0, 0));
fGroupFrame = new TGGroupFrame(MotherFrame, "Parameters", kVerticalFrame);
fGroupFrame->SetTextColor(CXblue);
fGroupFrame->SetTitlePos(TGGroupFrame::kLeft); // right aligned
......
......@@ -49,6 +49,8 @@ private:
TGCheckButton *fUseLifeTime;
TGComboBox *fLifeTimeScale[2];
TGCheckButton *fArrowMode;
CXLevelSchemePlayer *fLSPlayer = nullptr;
Bool_t fNucleiAreKnown = false;
......@@ -74,6 +76,8 @@ public:
void GetSpins(Int_t &min, Int_t &max);
void GetLifeTime(Float_t &min, Float_t &max);
Bool_t GetColorMode(){return fArrowMode->GetState();}
Int_t GetDataType(){return fDataTypeMode;}
Bool_t GetYrastMode(){return fYrastMode;}
......
......@@ -89,6 +89,8 @@ void CXLevelSchemePlayer::CleanArrows()
{
gPad = fMainWindow->GetSelectedPad();
if(gPad == nullptr) return;
for(int i=0 ; i<fListOfArrows->GetEntries() ; i++) {
if(gPad->GetListOfPrimitives()->FindObject(fListOfArrows->At(i))) {
gPad->GetListOfPrimitives()->Remove(fListOfArrows->At(i));
......@@ -205,6 +207,7 @@ LevelScheme *CXLevelSchemePlayer::DrawArrowsForNuc(TString NucName, TString Data
LevelScheme *RefLevel = nullptr;
CXNucleus nuc(NucName);
if(nuc.IsKnown() == false) return nullptr;
///ENSDF data
if(fGuiLSPlayer->GetDataType()==1 || fGuiLSPlayer->GetDataType()==3) {
......@@ -732,6 +735,9 @@ void CXLevelSchemePlayer::PlotLevelScheme(TString NucName, TString Type, TString
lev->SetX1(fRangeXMin);
lev->SetX2(fRangeXMax);
lev->SetLineColor(kBlack);
lev->SetLineWidth(1);
}
for(int i=0 ; i<LS_To_Plot->GetLinks().GetEntries() ; i++) {
......@@ -741,6 +747,7 @@ void CXLevelSchemePlayer::PlotLevelScheme(TString NucName, TString Type, TString
link->Paint();
}
// LS_To_Plot->SetName("");
LS_To_Plot->Draw();
LSPlayer->GetLSAxis()->SetRange(0,YMax,fRangeXMin,fRangeXMax);
......@@ -761,6 +768,8 @@ void CXLevelSchemePlayer::DrawLink(LevelScheme *ls, GammaLink *gammalink)
LSPlayer->AddLink(strenght,0,energy);
GammaLink *NewLink = (GammaLink*) ls->GetLinks().Last();
if(fGuiLSPlayer->GetColorMode()) NewLink->SetArrowStyle(2);
else NewLink->SetArrowStyle(1);
if(ls->GetLinks().GetEntries()==1) {
NewLink->RefreshPoints();
......
......@@ -593,7 +593,7 @@ double CXRadReader::EffFuncFormula(double *x, double *p)
double EG = x[0];
double eff=0;
// Paramters from Radware's web site:
// Paramters from Radware's web site: https://radware.phy.ornl.gov/gf3/#5.3.
// A=7.04 B=0.7 C=0.
// D=5.273 E=-0.863 F=0.01
// G=11
......
......@@ -859,7 +859,7 @@ LSaxis::LSaxis()
fLastY1Zoom(0),
fLastY2Zoom(0)
{
SetLabelFont(132);
}
//__________________________________________________________
......
......@@ -87,6 +87,9 @@ Level::Level()
fLabel0.SetTextSize(GetDefaultLabelSize()); fLabel1.SetTextSize(GetDefaultLabelSize());
fLabel2.SetTextSize(GetDefaultLabelSize()); fLabel3.SetTextSize(GetDefaultLabelSize());
fLabel0.SetTextFont(132); fLabel1.SetTextFont(132);
fLabel2.SetTextFont(132); fLabel3.SetTextFont(132);
}
//__________________________________________________________
......
......@@ -88,6 +88,7 @@ LevelScheme::LevelScheme()
fName.SetTextAlign(22);
fName.SetTextColor(1);
fName.SetTextFont(132);
}
//__________________________________________________________
......
......@@ -228,6 +228,8 @@ void Link::SetPoints(Double_t xi, Double_t xf)
SetBasicStylePoints(xi,xf);
if(fArrowStyle == 1)
SetAdvancedStylePoints(xi,xf);
if(fArrowStyle == 2)
SetAdvancedStylePointsColor(xi,xf);
}
void Link::SetBasicStylePoints(Double_t xi, Double_t xf)
......@@ -278,6 +280,143 @@ void Link::SetBasicStylePoints(Double_t xi, Double_t xf)
using namespace std;
void Link::SetAdvancedStylePointsColor(Double_t xi, Double_t xf)
{
// A link is basically a TPolyLine with 8 points, using a colored scale for the srenght :
//
// P1 xi P2
// | | |
// yi *********
// * *
// * *
// * *
// P3 P4 * * P5 P6
// | \* */ |
// ****** ******
// * *
// * *
// * *
// * *
// * *
// * *
// * *
// * *
// yf *
// xf
if(TMath::Abs(xi-xf) < 5)
xf=xi;
///Metric corrections
Float_t PadWidth = gPad->GetWw();
Float_t PadHeight = gPad->GetWh();
Float_t XWidth = gPad->GetX2()-gPad->GetX1();
Float_t YWidth = gPad->GetY2()-gPad->GetY1();
Float_t MetricFact = YWidth*PadWidth/(PadHeight*XWidth);
xi = MetricFact*xi;
xf = MetricFact*xf;
Double_t yi = GetIL()->GetY1();
Double_t yf = GetFL()->GetY1();
Double_t ad = (yf-yi)/(xf-xi);
if(TMath::Abs(xf-xi)<1e-10)
ad = 1e12;
Double_t bd = yi-ad*xi;
Float_t StrenghtFact = 1./100*XWidth*0.02;
//equation droite reliant xi a xf : yd = ad*x + bd
Double_t ArrowWidth = 40; // fixed strength
Float_t ArrowFact = ArrowWidth*2;
Double_t Strenght = GetStrength().Get();
Double_t Red[225] = {0,0.000632511,0.00126502,0.00189753,0.00253004,0.00316256,0.00379507,0.00442758,0.00506009,0.0056926,0.00632511,0.00695762,0.00759013,0.00822264,0.00885515,0.00948767,0.0101202,0.0107527,0.0113852,0.0120177,0.0126502,0.0132827,0.0139152,0.0145478,0.0151803,0.0158128,0.0164453,0.0170778,0.0177103,0.0183428,0.0189753,0.0196078,0.0208333,0.0220588,0.0232843,0.0245098,0.0257353,0.0269608,0.0281863,0.0294118,0.0306373,0.0318627,0.0330882,0.0343137,0.0355392,0.0367647,0.0379902,0.0392157,0.0404412,0.0416667,0.0428922,0.0441176,0.0453431,0.0465686,0.0477941,0.0490196,0.0502451,0.0514706,0.0526961,0.0539216,0.0551471,0.0563725,0.057598,0.0588235,0.0612745,0.0637255,0.0661765,0.0686275,0.0710784,0.0735294,0.0759804,0.0784314,0.0808824,0.0833333,0.0857843,0.0882353,0.0906863,0.0931373,0.0955882,0.0980392,0.10049,0.102941,0.105392,0.107843,0.110294,0.112745,0.115196,0.117647,0.120098,0.122549,0.125,0.127451,0.129902,0.132353,0.134804,0.137255,0.145466,0.153676,0.161887,0.170098,0.178309,0.18652,0.19473,0.202941,0.211152,0.219363,0.227574,0.235784,0.243995,0.252206,0.260417,0.268627,0.276838,0.285049,0.29326,0.301471,0.309681,0.317892,0.326103,0.334314,0.342524,0.350735,0.358946,0.367157,0.375368,0.383578,0.391789,0.4,0.41152,0.423039,0.434559,0.446078,0.457598,0.469118,0.480637,0.492157,0.503676,0.515196,0.526716,0.538235,0.549755,0.561275,0.572794,0.584314,0.595833,0.607353,0.618873,0.630392,0.641912,0.653431,0.664951,0.676471,0.68799,0.69951,0.711029,0.722549,0.734069,0.745588,0.757108,0.768627,0.770098,0.771569,0.773039,0.77451,0.77598,0.777451,0.778922,0.780392,0.781863,0.783333,0.784804,0.786274,0.787745,0.789216,0.790686,0.792157,0.793627,0.795098,0.796569,0.798039,0.79951,0.80098,0.802451,0.803922,0.805392,0.806863,0.808333,0.809804,0.811275,0.812745,0.814216,0.815686,0.814583,0.81348,0.812377,0.811275,0.810172,0.809069,0.807966,0.806863,0.80576,0.804657,0.803554,0.802451,0.801348,0.800245,0.799142,0.798039,0.796936,0.795833,0.79473,0.793627,0.792525,0.791422,0.790319,0.789216,0.788113,0.78701,0.785907,0.784804,0.783701,0.782598,0.781495,0.780392,0.769485};
Double_t Green[225] = {0,0.00607211,0.0121442,0.0182163,0.0242884,0.0303605,0.0364326,0.0425047,0.0485769,0.054649,0.0607211,0.0667932,0.0728653,0.0789374,0.0850095,0.0910816,0.0971537,0.103226,0.109298,0.11537,0.121442,0.127514,0.133586,0.139658,0.145731,0.151803,0.157875,0.163947,0.170019,0.176091,0.182163,0.188235,0.197549,0.206863,0.216176,0.22549,0.234804,0.244118,0.253431,0.262745,0.272059,0.281373,0.290686,0.3,0.309314,0.318627,0.327941,0.337255,0.346569,0.355882,0.365196,0.37451,0.383824,0.393137,0.402451,0.411765,0.421078,0.430392,0.439706,0.44902,0.458333,0.467647,0.476961,0.486275,0.494608,0.502941,0.511275,0.519608,0.527941,0.536274,0.544608,0.552941,0.561275,0.569608,0.577941,0.586275,0.594608,0.602941,0.611274,0.619608,0.627941,0.636275,0.644608,0.652941,0.661274,0.669608,0.677941,0.686275,0.694608,0.702941,0.711275,0.719608,0.727941,0.736274,0.744608,0.752941,0.754657,0.756373,0.758088,0.759804,0.76152,0.763235,0.764951,0.766667,0.768382,0.770098,0.771814,0.773529,0.775245,0.776961,0.778676,0.780392,0.782108,0.783824,0.785539,0.787255,0.788971,0.790686,0.792402,0.794118,0.795833,0.797549,0.799265,0.80098,0.802696,0.804412,0.806127,0.807843,0.810294,0.812745,0.815196,0.817647,0.820098,0.822549,0.825,0.827451,0.829902,0.832353,0.834804,0.837255,0.839706,0.842157,0.844608,0.847059,0.84951,0.851961,0.854412,0.856863,0.859314,0.861765,0.864216,0.866667,0.869118,0.871569,0.87402,0.876471,0.878922,0.881373,0.883824,0.886275,0.870466,0.854657,0.838848,0.823039,0.80723,0.791422,0.775613,0.759804,0.743995,0.728186,0.712377,0.696569,0.68076,0.664951,0.649142,0.633333,0.617525,0.601716,0.585907,0.570098,0.554289,0.53848,0.522672,0.506863,0.491054,0.475245,0.459436,0.443627,0.427819,0.41201,0.396201,0.380392,0.370466,0.360539,0.350613,0.340686,0.33076,0.320833,0.310907,0.30098,0.291054,0.281127,0.271201,0.261275,0.251348,0.241422,0.231495,0.221569,0.211642,0.201716,0.191789,0.181863,0.171936,0.16201,0.152083,0.142157,0.13223,0.122304,0.112377,0.102451,0.0925245,0.082598,0.0726716,0.0627451,0.0607843};
Double_t Blue[225] = {0.388235,0.393675,0.399114,0.404554,0.409994,0.415433,0.420873,0.426312,0.431752,0.437192,0.442631,0.448071,0.45351,0.45895,0.46439,0.469829,0.475269,0.480708,0.486148,0.491588,0.497027,0.502467,0.507906,0.513346,0.518786,0.524225,0.529665,0.535104,0.540544,0.545984,0.551423,0.556863,0.563725,0.570588,0.577451,0.584314,0.591176,0.598039,0.604902,0.611765,0.618627,0.62549,0.632353,0.639216,0.646078,0.652941,0.659804,0.666667,0.673529,0.680392,0.687255,0.694118,0.70098,0.707843,0.714706,0.721569,0.728431,0.735294,0.742157,0.74902,0.755882,0.762745,0.769608,0.776471,0.776838,0.777206,0.777574,0.777941,0.778309,0.778676,0.779044,0.779412,0.779779,0.780147,0.780515,0.780882,0.78125,0.781618,0.781985,0.782353,0.782721,0.783088,0.783456,0.783824,0.784191,0.784559,0.784926,0.785294,0.785662,0.786029,0.786397,0.786765,0.787132,0.7875,0.787868,0.788235,0.774632,0.761029,0.747426,0.733824,0.720221,0.706618,0.693015,0.679412,0.665809,0.652206,0.638603,0.625,0.611397,0.597794,0.584191,0.570588,0.556985,0.543382,0.529779,0.516176,0.502574,0.488971,0.475368,0.461765,0.448162,0.434559,0.420956,0.407353,0.39375,0.380147,0.366544,0.352941,0.344608,0.336275,0.327941,0.319608,0.311274,0.302941,0.294608,0.286275,0.277941,0.269608,0.261275,0.252941,0.244608,0.236275,0.227941,0.219608,0.211275,0.202941,0.194608,0.186275,0.177941,0.169608,0.161275,0.152941,0.144608,0.136275,0.127941,0.119608,0.111275,0.102941,0.0946078,0.0862745,0.0851716,0.0840686,0.0829657,0.0818627,0.0807598,0.0796569,0.0785539,0.077451,0.076348,0.0752451,0.0741422,0.0730392,0.0719363,0.0708333,0.0697304,0.0686275,0.0675245,0.0664216,0.0653186,0.0642157,0.0631127,0.0620098,0.0609069,0.0598039,0.058701,0.057598,0.0564951,0.0553922,0.0542892,0.0531863,0.0520833,0.0509804,0.0503676,0.0497549,0.0491422,0.0485294,0.0479167,0.0473039,0.0466912,0.0460784,0.0454657,0.0448529,0.0442402,0.0436275,0.0430147,0.042402,0.0417892,0.0411765,0.0405637,0.039951,0.0393382,0.0387255,0.0381127,0.0375,0.0368873,0.0362745,0.0356618,0.035049,0.0344363,0.0338235,0.0332108,0.032598,0.0319853,0.0313726,0.0306373};
Int_t colors[225] = {1179,1180,1181,1182,1183,1184,1185,1186,1187,1188,1189,1190,1191,1192,1193,1194,1195,1196,1197,1198,1199,1200,1201,1202,1203,1204,1205,1206,1207,1208,1209,1210,1211,1212,1213,1214,1215,1216,1217,1218,1219,1220,1221,1222,1223,1224,1225,1226,1227,1228,1229,1230,1231,1232,1233,1234,1235,1236,1237,1238,1239,1240,1241,1242,1243,1244,1245,1246,1247,1248,1249,1250,1251,1252,1253,1254,1255,1256,1257,1258,1259,1260,1261,1262,1263,1264,1265,1266,1267,1268,1269,1270,1271,1272,1273,1274,1275,1276,1277,1278,1279,1280,1281,1282,1283,1284,1285,1286,1287,1288,1289,1290,1291,1292,1293,1294,1295,1296,1297,1298,1299,1300,1301,1302,1303,1304,1305,1306,1307,1308,1309,1310,1311,1312,1313,1314,1315,1316,1317,1318,1319,1320,1321,1322,1323,1324,1325,1326,1327,1328,1329,1330,1331,1332,1333,1334,1335,1336,1337,1338,1339,1340,1341,1342,1343,1344,1345,1346,1347,1348,1349,1350,1351,1352,1353,1354,1355,1356,1357,1358,1359,1360,1361,1362,1363,1364,1365,1366,1367,1368,1369,1370,1371,1372,1373,1374,1375,1376,1377,1378,1379,1380,1381,1382,1383,1384,1385,1386,1387,1388,1389,1390,1391,1392,1393,1394,1395,1396,1397,1398,1399,1400,1401,1402,1403};
for(int i=0 ; i< 225 ; i++) {
if(gROOT->GetColor(colors[i]+10000) == nullptr)
new TColor(colors[i]+10000,Red[i],Green[i],Blue[i]);
}
SetFillColor(colors[((Int_t)(Strenght*224./100.))]+10000);
SetLineWidth(1);
Double_t b1 = bd - ArrowWidth*StrenghtFact*MetricFact * sqrt(ad*ad + 1); // yd1 = ad*x+b1
Double_t b2 = bd + ArrowWidth*StrenghtFact*MetricFact * sqrt(ad*ad + 1); // yd2 = ad*x+b2
Double_t x_p1 = (yi-b1)/ad;
Double_t x_p2 = (yi-b2)/ad;
Float_t ArrowPosFactor = 0.8;
Double_t Proj_x = xi + ArrowPosFactor*(xf-xi);
Double_t Proj_y = yf+0.03*YWidth;//yi + ArrowPosFactor*(yf-yi);
if(Proj_y>yi) Proj_y = yi;
Double_t ap0 = -1./ad;
Double_t bp0 = Proj_y - ap0*Proj_x; //ydp = ap0*x + bp0
Double_t xp4 = (bp0-b1)/(ad-ap0);
Double_t yp4 = ad*xp4+b1;
Double_t xp5 = (bp0-b2)/(ad-ap0);
Double_t yp5 = ad*xp5+b2;
if(ad >=1e12) {
yp4 = Proj_y;
yp5 = Proj_y;
}
Double_t xp3 = xp4 + ArrowFact*(xp4-Proj_x)*1./(sqrt((Proj_x-xp4)*(Proj_x-xp4)+(Proj_y-yp4)*(Proj_y-yp4)));
Double_t yp3 = yp4 + ArrowFact*(yp4-Proj_y)*1./(sqrt((Proj_x-xp4)*(Proj_x-xp4)+(Proj_y-yp4)*(Proj_y-yp4)));
Double_t xp6 = xp5 + ArrowFact*(xp5-Proj_x)*1./(sqrt((Proj_x-xp5)*(Proj_x-xp5)+(Proj_y-yp5)*(Proj_y-yp5)));
Double_t yp6 = yp5 + ArrowFact*(yp5-Proj_y)*1./(sqrt((Proj_x-xp5)*(Proj_x-xp5)+(Proj_y-yp5)*(Proj_y-yp5)));
Double_t height = GetFL()->GetY1() + TMath::Abs(GetIL()->GetY1() - GetFL()->GetY1())*(0.6);
if ( Link::GetIL() && Link::GetFL() ) {
SetPoint(0,x_p1/MetricFact,yi);
SetPoint(1,xi/MetricFact,yi);
SetPoint(2,x_p2/MetricFact,yi);
SetPoint(3,xp5/MetricFact,yp5);
SetPoint(4,xp6/MetricFact,yp6);
SetPoint(5,xf/MetricFact,yf);
SetPoint(6,xp3/MetricFact,yp3);
SetPoint(7,xp4/MetricFact,yp4);
SetPoint(8,x_p1/MetricFact,yi);
}
for (Int_t i = 0; i < fgkMaxLinkLabel; ++i) {
GetLabel(i).SetY(height);
}
GetLabel(0).SetX(xi/MetricFact+(xf/MetricFact-xi/MetricFact)/2. - ArrowWidth);
GetLabel(1).SetX(xi/MetricFact+(xf/MetricFact-xi/MetricFact)/2.);
GetLabel(2).SetX(xi/MetricFact+(xf/MetricFact-xi/MetricFact)/2. + ArrowWidth);
// GetLabel(0).SetX(GetX()[1] - TMath::Abs(GetIL()->GetX2() - GetIL()->GetX1())*0.25);
// GetLabel(1).SetX(GetX()[1]);
// GetLabel(2).SetX(GetX()[1] + TMath::Abs(GetIL()->GetX2() - GetIL()->GetX1())*0.25);
}
void Link::SetAdvancedStylePoints(Double_t xi, Double_t xf)
{
// A link is basically a TPolyLine with 8 points :
......@@ -420,7 +559,7 @@ void Link::RefreshPoints()
if(fArrowStyle==0) {
SetPoints(GetX()[0]+(GetX()[2]-(GetX()[0]))/2.,GetX()[5]);
}
else if(fArrowStyle==1) {
else if(fArrowStyle==1 || fArrowStyle==2) {
SetPoints(GetX()[0]+(GetX()[2]-(GetX()[0]))/2.,GetX()[5]);
}
}
......@@ -463,6 +602,7 @@ void Link::Paint(Option_t* option)
if ( !IsVisible() ) return;
TPolyLine::Paint(option);
TPolyLine::Paint("line");
if ( fVisLabel[0] == '1' ) {
GetLabel(0).Paint(option);
......
......@@ -141,6 +141,7 @@ public:
virtual void SetPoints(Double_t xi, Double_t xf);
virtual void SetBasicStylePoints(Double_t xi, Double_t xf);
virtual void SetAdvancedStylePoints(Double_t xi, Double_t xf);
virtual void SetAdvancedStylePointsColor(Double_t xi, Double_t xf);
//! update points respect to a modified level (for future application)
virtual void UpdatePoints();
......
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