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

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

Merge branch 'Cubix' into 'preprod'

Cubix

See merge request !33
parents 85eeb8f9 097dc9d0
Pipeline #27222 canceled with stages
in 4 minutes and 1 second
......@@ -18,6 +18,7 @@
#include "TGListTree.h"
#include "TClass.h"
#include "TCanvas.h"
#include "TCutG.h"
using namespace std;
......@@ -59,7 +60,7 @@ CXFileList::CXFileList(const TGCompositeFrame *MotherFrame, UInt_t w, UInt_t h)
fMenu->AddEntry("Lar&ge Icons",kLVLargeIcons);
fMenu->AddEntry("S&mall Icons",kLVSmallIcons);
fMenu->AddEntry("&List", kLVList);
// fMenu->AddEntry("&Details", kLVDetails);
// fMenu->AddEntry("&Details", kLVDetails);
fMenu->Connect("Activated(Int_t)","CXFileList",this,"DoMenu(Int_t)");
TGHorizontalFrame *h3 = new TGHorizontalFrame(fv2,10,10);
......@@ -91,7 +92,7 @@ CXFileList::CXFileList(const TGCompositeFrame *MotherFrame, UInt_t w, UInt_t h)
Resize();
DoMenu(kLVSmallIcons);
DoMenu(kLVList);
}
void CXFileList::DoubleClicked(TGListTreeItem *item, Int_t a_int)
......@@ -99,20 +100,15 @@ void CXFileList::DoubleClicked(TGListTreeItem *item, Int_t a_int)
TGListTree *sender = (TGListTree *)gTQSender;
const TGWindow *parent = sender->GetParent()->GetParent()->GetParent();
if(parent == fBrowser)
{
if(parent == fBrowser){
TObject *obj = (TObject *) item->GetUserData();
if(obj)
{
if(obj){
obj->IsA()->SetName("");
TString filename = fBrowser->FullPathName(item);
if(gSystem->IsFileInIncludePath(filename) && filename.EndsWith(".root"))
{
DisplayFile(filename);
}
}
}
}
......@@ -120,7 +116,6 @@ void CXFileList::DoubleClicked(TGListTreeItem *item, Int_t a_int)
CXFileList::~CXFileList()
{
// Cleanup.
delete fContents;
fMain->DeleteWindow(); // deletes fMain
......@@ -130,15 +125,21 @@ CXFileList::~CXFileList()
void CXFileList::DoMenu(Int_t mode)
{
// Switch view mode.
if (mode<10) {
if (mode<10)
fContents->SetViewMode((EListViewMode)mode);
} else {
else
delete this;
}
}
void CXFileList::DisplayFile(const TString &fname)
{
//Close the last opened file
if(fCurrentFile){
fCurrentFile->Close();
fCurrentFile = nullptr;
fFolders.clear();
}
// Display content of ROOT file.
TFile *file = TFile::Open(fname);
fContents->RemoveAll();
......@@ -155,7 +156,7 @@ void CXFileList::DisplayFile(const TString &fname)
TGLVEntry *entry = new TGLVEntry(fContents,name,cname);
entry->SetSubnames(key->GetTitle());
if(cname=="TList")
if(cname=="TList" || cname=="TDirectoryFile")
entry->SetPictures(gClient->GetPicture("folder_s.xpm"),gClient->GetPicture("folder_t.xpm"));
if(cname=="TCutG")
entry->SetPictures(gClient->GetPicture("bld_cut.png"),gClient->GetPicture("bld_cut.png"));
......@@ -168,49 +169,53 @@ void CXFileList::DisplayFile(const TString &fname)
entry->SetUserData((void*)StrDup(fname));
}
fMain->Resize();
fParent = file;
if(fParentFile && file!=fParentFile){
fParentFile->Close();
}
fParentFile = file;
fCurrentFile = file;
fFolders.push_back(file);
}
void CXFileList::DisplayList(TList *list)
{
// Display content of ROOT file.
TString Name = fParentFile->GetName();
TString Name = fCurrentFile->GetName();
TObjArray *arr = Name.Tokenize("/");
Name = arr->Last()->GetName();
delete arr;
TGLVEntry *entry = new TGLVEntry(fContents,Name,fParentFile->ClassName());
entry->SetUserData((void*)StrDup(fParentFile->GetName()));
fContents->RemoveAll();
// fContents->AddFile(gSystem->WorkingDirectory());
fContents->AddItem(entry);
fContents->SetPagePosition(0,0);
// fContents->SetColHeaders("Name","Title");
// fContents->SetColHeaders("Name","Title");
TObject *Folder = fFolders.back();
TGLVEntry *entry = nullptr;
if(fFolders.size()>1){
entry = new TGLVEntry(fContents,"..",Folder->ClassName());
entry->SetUserData((void*)StrDup(Folder->GetName()));
entry->SetPictures(gClient->GetPicture("folder_s.xpm"),gClient->GetPicture("folder_t.xpm"));
fContents->AddItem(entry);
}
TIter next(list);
TObject *key;
while ((key=(TObject*)next())) {
if(Folder->InheritsFrom(TDirectoryFile::Class_Name())){
key = ((TDirectoryFile*)Folder)->Get(key->GetName());
}
TString cname = key->ClassName();
TString name = key->GetName();
TGLVEntry *entry = new TGLVEntry(fContents,name,cname);
entry->SetSubnames(key->GetTitle());
fContents->AddItem(entry);
if(cname=="TList")
if(cname==TList::Class_Name() || cname==TDirectoryFile::Class_Name())
entry->SetPictures(gClient->GetPicture("folder_s.xpm"),gClient->GetPicture("folder_t.xpm"));
if(cname=="TCutG")
if(cname==TCutG::Class_Name())
entry->SetPictures(gClient->GetPicture("bld_cut.png"),gClient->GetPicture("bld_cut.png"));
if(cname.BeginsWith("TGraph"))
if(cname.BeginsWith(TGraph::Class_Name()))
entry->SetPictures(gClient->GetPicture("graph.xpm"),gClient->GetPicture("graph.xpm"));
// user data is a filename
......@@ -219,44 +224,34 @@ void CXFileList::DisplayList(TList *list)
fMain->Resize();
}
void CXFileList::DisplayDirectory(const TString &fname)
{
// Display content of directory.
fContents->SetDefaultHeaders();
gSystem->ChangeDirectory(fname);
fContents->ChangeDirectory(fname);
fContents->DisplayDirectory();
fContents->AddFile(".."); // up level directory
fContents->Sort(EFSSortMode::kSortByName);
fMain->Resize();
}
void CXFileList::DisplayObject(const TString& fname,const TString& name)
{
// Browse object located in file.
TDirectory *sav = gDirectory;
TObject* obj = nullptr;
TObject *CurrentFolder = fFolders.back();
if(fParent->InheritsFrom("TFile"))
obj = fParentFile->Get(name);
else if(fParent->InheritsFrom("TList"))
obj = fParent->FindObject(name);
if(name==".."){
fFolders.pop_back();
obj=fFolders.back();
fFolders.pop_back();
}
else if(CurrentFolder->InheritsFrom(TList::Class_Name()))
obj = ((TList*)CurrentFolder)->FindObject(name);
else if(CurrentFolder->InheritsFrom(TDirectoryFile::Class_Name()))
obj = ((TDirectoryFile*)CurrentFolder)->Get(name);
if(obj == nullptr){
DisplayFile(fParentFile->GetName());
DisplayFile(fCurrentFile->GetName());
return;
}
if (obj)
{
if (!obj->IsFolder())
{
if (!obj->IsFolder()){
TString CanvasName = fMainWindow->GetCanvas()->GetName();
if(CanvasName.BeginsWith("GxG"))
{
if(CanvasName.BeginsWith("GxG")){
cout<<" cannot plot in a Tab dedicated to Gamma Gamma projections" << endl;
return;
}
......@@ -268,12 +263,10 @@ void CXFileList::DisplayObject(const TString& fname,const TString& name)
if(gPad && (obj->InheritsFrom("TH1")
|| obj->InheritsFrom("TGraph")
|| obj->InheritsFrom("TF1")))
{
|| obj->InheritsFrom("TF1"))){
obj->Draw(fBrowser->GetDrawOption());
if(obj->InheritsFrom("TH1"))
{
if(obj->InheritsFrom("TH1")){
TH1 *hist = (TH1*)obj;
hist->SetDirectory(nullptr);
}
......@@ -281,8 +274,7 @@ void CXFileList::DisplayObject(const TString& fname,const TString& name)
gPad->Update();
gPad->GetFrame()->SetBit(TObject::kCannotPick);
}
else if(gPad && obj->InheritsFrom("TCanvas"))
{
else if(gPad && obj->InheritsFrom("TCanvas")){
TCanvas *canvas_in = (TCanvas*)obj;
CXCanvas *canvas_out = fMainWindow->GetCanvas();
canvas_out->cd();
......@@ -290,30 +282,27 @@ void CXFileList::DisplayObject(const TString& fname,const TString& name)
Int_t idraw = 0;
for(int i=0 ; i<canvas_in->GetListOfPrimitives()->GetEntries() ; i++)
{
for(int i=0 ; i<canvas_in->GetListOfPrimitives()->GetEntries() ; i++){
TObject *o = canvas_in->GetListOfPrimitives()->At(i);
if(idraw==0)
{
if(idraw==0){
idraw++;
if(o->InheritsFrom("TH2"))
if(o->InheritsFrom(TH2::Class_Name()))
o->Draw("col");
else if(o->InheritsFrom("TH1"))
else if(o->InheritsFrom(TH1::Class_Name()))
o->Draw("hist");
else if(o->InheritsFrom("TGraph"))
else if(o->InheritsFrom(TGraph::Class_Name()))
o->Draw("APL");
else
idraw--;
}
else
{
if(o->InheritsFrom("TH2"))
else{
if(o->InheritsFrom(TH2::Class_Name()))
o->Draw("col same");
else if(o->InheritsFrom("TH1"))
else if(o->InheritsFrom(TH1::Class_Name()))
o->Draw("hist same");
else if(o->InheritsFrom("TGraph"))
else if(o->InheritsFrom(TGraph::Class_Name()))
o->Draw("PL");
}
}
......@@ -323,14 +312,14 @@ void CXFileList::DisplayObject(const TString& fname,const TString& name)
fMainWindow->RefreshPad();
}
else
{
cout<<"No possibility to drawn "<<obj->ClassName()<<" objects"<<endl;
}
}
else if(obj->InheritsFrom("TList"))
{
fParent = obj;
DisplayList(((TList*)obj));
else if(obj->InheritsFrom(TList::Class_Name()) || obj->InheritsFrom(TDirectoryFile::Class_Name())){
fFolders.push_back(obj);
if(obj->InheritsFrom(TList::Class_Name()))
DisplayList((TList*)obj);
if(obj->InheritsFrom(TDirectoryFile::Class_Name()))
DisplayList(((TDirectoryFile*)obj)->GetListOfKeys());
}
}
......@@ -341,14 +330,16 @@ void CXFileList::OnClick(TGLVEntry *f, Int_t btn, Int_t x, Int_t y)
{
if (btn == kButton3)
{
TObject *CurrentFolder = fFolders.back();
TString name(f->GetTitle());
TObject* obj = nullptr;
if(fParent->InheritsFrom("TFile"))
obj = fParentFile->Get(name);
else if(fParent->InheritsFrom("TList"))
obj = fParent->FindObject(name);
if(CurrentFolder->InheritsFrom(TDirectoryFile::Class_Name()))
obj = ((TDirectoryFile*)CurrentFolder)->Get(name);
else if(CurrentFolder->InheritsFrom(TList::Class_Name()))
obj = CurrentFolder->FindObject(name);
if(obj == nullptr)
return;
......@@ -370,13 +361,8 @@ void CXFileList::OnDoubleClick(TGLVEntry *f, Int_t btn)
TString name(f->GetTitle());
const char* fname = (const char*)f->GetUserData();
if (fname) {
DisplayObject(fname, name);
} else if (name.EndsWith(".root")) {
DisplayFile(name);
} else {
DisplayDirectory(name);
}
DisplayObject(fname, name);
// set kPointer cursor
cur = gVirtualX->CreateCursor(kPointer);
gVirtualX->SetCursor(fContents->GetId(), cur);
......
......@@ -14,6 +14,7 @@ class TList;
class TFile;
class TGListTreeItem;
class CXGFileBrowser;
class TDirectoryFile;
class CXFileList : public TGVerticalFrame
{
......@@ -33,8 +34,11 @@ protected:
TGPopupMenu *fMenu;
TGTextEntry *fDrawOption;
std::vector<TObject*> fFolders;
TObject *fCurrent = nullptr;
TObject *fParent = nullptr;
TFile *fParentFile = nullptr;
TFile *fCurrentFile = nullptr;
CXGFileBrowser *fBrowser = nullptr;
......@@ -57,7 +61,6 @@ public:
private:
void DisplayFile(const TString &fname);
void DisplayDirectory(const TString &fname);
void DisplayObject(const TString& fname,const TString& name);
void DisplayList(TList *list);
......
......@@ -159,7 +159,7 @@ void CXGammaSearch::SetCalMode()
{
if(fNGammas<=1)
cout<<"Soory, I cannot determine coincidence between one or less gamma ray..."<<endl;
else if(fNGammas==1)
else if(fNGammas==2)
{
FindGammaRays(true);
FindInDoubleCoincidence();
......@@ -245,10 +245,11 @@ void CXGammaSearch::FindGammaRays(Bool_t Bash)
{
gatetrig[ig] = true;
GoodGammas.push_back(Link);
goto cnt;
}
if(gatetrig[ig])
continue;
}
cnt:;
}
Int_t NGatesTrig=0;
......@@ -257,6 +258,10 @@ cnt:;
if(NGatesTrig>=fNGammas)
{
// cout<<NGatesTrig<<" "<<fNGammas<<endl;
// cout<<GoodGammas.size()<<endl;
// cout<<Form("%s (Z=%d, A=%d, N=%d)",Nuc.GetSymbol().Data(),Nuc.GetZ(),Nuc.GetA(),Nuc.GetN())<<endl;
if(!Bash)
PrintInListBox(Form("%s (Z=%d, A=%d, N=%d)",Nuc.GetSymbol().Data(),Nuc.GetZ(),Nuc.GetA(),Nuc.GetN()),kInfo);
......@@ -286,11 +291,9 @@ cnt:;
avect.push_back(agammatrans);
if(!Bash)
{
TString GammaTitle = Form(" => %6.1f keV : %5s (%6.1f keV) --> %5s (%6.1f keV)",Energy,spinI.Data(),ELevI,spinF.Data(),ELevF);
PrintInListBox(GammaTitle.Data(),kPrint);
}
TString GammaTitle = Form(" => %6.1f keV : %5s (%6.1f keV) --> %5s (%6.1f keV)",Energy,spinI.Data(),ELevI,spinF.Data(),ELevF);
// cout<<GammaTitle<<endl;
if(!Bash) PrintInListBox(GammaTitle.Data(),kPrint);
}
fListOfGoodGammas.push_back(avect);
......@@ -306,7 +309,6 @@ cnt:;
MapSubwindows();
MapWindow();
Layout();
}
void CXGammaSearch::FindInDoubleCoincidence(Bool_t Bash)
......@@ -318,6 +320,7 @@ void CXGammaSearch::FindInDoubleCoincidence(Bool_t Bash)
std::vector<int> Index_Nuclei;
std::vector<string> Nuclei_ID;
std::vector<Float_t> DeltaE;
Int_t Number_Analysed_Gammas=0;
Int_t Count=0;
......@@ -330,7 +333,7 @@ void CXGammaSearch::FindInDoubleCoincidence(Bool_t Bash)
vector < GammaTransition > avec = fListOfGoodGammas[inuc];
if(avec.size()<3)
if(avec.size()<2)
continue;
CXNucleus Nuc(((GammaTransition)avec[0]).NucName.Data());
......@@ -354,6 +357,9 @@ void CXGammaSearch::FindInDoubleCoincidence(Bool_t Bash)
Bool_t Det = fSp->IsDet(Mat_LS,Dim_LS);
TString TransitionName[Dim_LS];
Float_t ETrans[Dim_LS];
Float_t EI[Dim_LS];
Float_t EF[Dim_LS];
//get the coordinates of the gammas
for(Int_t ig=0 ; ig<Dim_LS ; ig++)
......@@ -366,14 +372,42 @@ void CXGammaSearch::FindInDoubleCoincidence(Bool_t Bash)
{
Flag[ig] = Mat_E[ig][0];
TransitionName[ig] = Form(" %6.1f keV : %5s (%6.1f keV) --> %5s (%6.1f keV) ",GT.EGamma,GT.SpinI.Data(),GT.EI,GT.SpinF.Data(),GT.EF);
ETrans[ig] = GT.EGamma;
EI[ig] = GT.EI;
EF[ig] = GT.EF;
}
}
}
Bool_t gatetrig[fNGammas];
Float_t Gates[fNGammas];
Float_t Width[fNGammas];
for(int ig=0 ; ig<fNGammas ; ig++) {
Gates[ig] = fEnergies[ig]->GetNumber();
Width[ig] = fWidths[ig]->GetNumber();
}
for(Int_t j=0 ; j<Dim_LS ; j++)
{
for(Int_t m=0 ; m<j ; m++)
{
memset(gatetrig,0,sizeof(fNGammas));
Int_t NGatesTrig=0;
for(int ig=0 ; ig<fNGammas ; ig++) {
if(TMath::Abs(ETrans[j]-Gates[ig])<Width[ig])
gatetrig[ig] = true;
if(TMath::Abs(ETrans[m]-Gates[ig])<Width[ig])
gatetrig[ig] = true;
}
for(int ii=0 ; ii<fNGammas ; ii++)
NGatesTrig += gatetrig[ii];
if(NGatesTrig != 2)
continue;
Float_t Prob = TMath::Abs(Mat_P[j][m]);
if(Flag[j]>0 && Flag[m]>0 && Prob>0.01)
{
......@@ -381,6 +415,11 @@ void CXGammaSearch::FindInDoubleCoincidence(Bool_t Bash)
Tab_P.push_back(Prob);
Index_Nuclei.push_back(Count);
if(EI[j]>EI[m])
DeltaE.push_back(EF[j]-EI[m]);
else
DeltaE.push_back(EF[m]-EI[j]);
TString Name_Output = Form("%s# --> %s# --> %s, Prob = %1.3f", Nuc.GetSymbol().Data(),TransitionName[j].Data(),TransitionName[m].Data(),Prob);
if (Det==false)
......@@ -397,7 +436,7 @@ void CXGammaSearch::FindInDoubleCoincidence(Bool_t Bash)
}
std::vector<int> Index_Sorted;
Index_Sorted = Sort_Index(Index_Nuclei,Tab_P);
Index_Sorted = Sort_Index(Index_Nuclei,Tab_P, DeltaE);
if(!Bash)
{
......@@ -405,7 +444,7 @@ void CXGammaSearch::FindInDoubleCoincidence(Bool_t Bash)
{
TString Name = Nuclei_ID.at(Index_Sorted[j]);
TObjArray *arr = Name.Tokenize("#");
TString NucName = arr->First()->GetName();
TString NucName = Form("%s : Energy Diff = %1.3f",arr->First()->GetName(),DeltaE[Index_Sorted[j]]);
TString Transition1 = arr->At(1)->GetName();
TString Transition2 = arr->At(2)->GetName();
......@@ -427,6 +466,7 @@ void CXGammaSearch::FindInTripleCoincidence()
std::vector<int> Index_Nuclei;
std::vector<string> Nuclei_ID;
std::vector<Float_t> DeltaE;
Int_t Number_Analysed_Gammas=0;
Int_t Count=0;
......@@ -463,6 +503,9 @@ void CXGammaSearch::FindInTripleCoincidence()
Bool_t Det = fSp->IsDet(Mat_LS,Dim_LS);
TString TransitionName[Dim_LS];
Float_t ETrans[Dim_LS];
Float_t EI[Dim_LS];
Float_t EF[Dim_LS];
//get the coordinates of the gammas
for(Int_t ig=0 ; ig<Dim_LS ; ig++)
......@@ -475,16 +518,46 @@ void CXGammaSearch::FindInTripleCoincidence()
{
Flag[ig] = Mat_E[ig][0];
TransitionName[ig] = Form(" %6.1f keV : %5s (%6.1f keV) --> %5s (%6.1f keV) ",GT.EGamma,GT.SpinI.Data(),GT.EI,GT.SpinF.Data(),GT.EF);
ETrans[ig] = GT.EGamma;
EI[ig] = GT.EI;
EF[ig] = GT.EF;
}
}
}
Bool_t gatetrig[fNGammas];
Float_t Gates[fNGammas];
Float_t Width[fNGammas];
for(int ig=0 ; ig<fNGammas ; ig++) {
Gates[ig] = fEnergies[ig]->GetNumber();
Width[ig] = fWidths[ig]->GetNumber();
}
for(Int_t j=0 ; j<Dim_LS ; j++)
{
for(Int_t m=0 ; m<j ; m++)
{
for(Int_t k=0 ; k<m ; k++)
{
memset(gatetrig,0,sizeof(fNGammas));
Int_t NGatesTrig=0;
for(int ig=0 ; ig<fNGammas ; ig++) {
if(TMath::Abs(ETrans[j]-Gates[ig])<Width[ig])
gatetrig[ig] = true;
if(TMath::Abs(ETrans[m]-Gates[ig])<Width[ig])
gatetrig[ig] = true;
if(TMath::Abs(ETrans[k]-Gates[ig])<Width[ig])
gatetrig[ig] = true;
}
for(int ii=0 ; ii<fNGammas ; ii++)
NGatesTrig += gatetrig[ii];
if(NGatesTrig != 3)
continue;
Float_t Prob = TMath::Abs(Mat_P[j][m]*Mat_P[j][k]*Mat_P[m][k]);
if(Flag[j]>0 && Flag[m]>0 && Flag[k]>0 && Prob>0.01 )
......@@ -493,6 +566,25 @@ void CXGammaSearch::FindInTripleCoincidence()
Tab_P.push_back(Prob);
Index_Nuclei.push_back(Count);
if(EI[j]>EI[m] && EI[j]>EI[k]) {
if(EI[m]>EI[k])
DeltaE.push_back(EF[j]-EI[m] + EF[m]-EI[k]);
else
DeltaE.push_back(EF[j]-EI[k] + EF[k]-EI[m]);
}
else if(EI[m]>EI[j] && EI[m]>EI[k]) {
if(EI[j]>EI[k])
DeltaE.push_back(EF[m]-EI[j] + EF[j]-EI[k]);
else
DeltaE.push_back(EF[m]-EI[k] + EF[k]-EI[j]);
}