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

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

Definition of a new TreeBuilder for a better integration of the ancilaries

Now, the ancilaries are different subclasses of the TB_Detector class and can directly been added from the gen conf, as well as the definition of the trigger

The different available detectors are now : AGATA_Builder, AGATA_Tracking, NEDA, DIAMANT, VAMOS (empty squeleton for the moment to prepare to the integration of the VAMOS MUGAST campain)

Femul as been adapted in consequence

The zPrograms/Makefile has been modified to remove the warnings from the compilation of these old programs from DINO
parent aabef3d0
......@@ -872,7 +872,7 @@ void listKeysAndExit()
delete pf6;
#if defined(HAS_MFM) && defined(HAS_ROOT)
AGAPRO::TB_AgNedDiam *pf7 = new AGAPRO::TB_AgNedDiam;
AGAPRO::TreeBuilder *pf7 = new AGAPRO::TreeBuilder;
pf7->GetParameters("", true);
delete pf7;
#endif
......@@ -1121,11 +1121,11 @@ bool topologyConfNew()
}
// 42
#if defined(HAS_MFM) && defined(HAS_ROOT)
else if(pActor->libName == "TB_AgNedDiam") { // no mother-daughter model
cout << "TB_AgNedDiam ..." << endl;
AGAPRO::TB_AgNedDiam::process_config(pActor->libConf.c_str(), &error_config);
else if(pActor->libName == "TreeBuilder") { // no mother-daughter model
cout << "TreeBuilder ..." << endl;
AGAPRO::TreeBuilder::process_config(pActor->libConf.c_str(), &error_config);
IF_ERRORCONFIG(error_config);
pActor->nrvPointer = new AGAPRO::TB_AgNedDiam;
pActor->nrvPointer = new AGAPRO::TreeBuilder;
pActor->libItem = 420;
}
#endif
......@@ -1394,11 +1394,11 @@ bool topologyConfNew()
pActor->libItem = 1;
}
#if defined(HAS_MFM) && defined(HAS_ROOT)
else if(pActor->libName == "TB_AgNedDiam") {
cout << "TB_AgNedDiam ..." << endl;
else if(pActor->libName == "TreeBuilder") {
cout << "TreeBuilder ..." << endl;
BasicAFC::process_config(pActor->libConf.c_str(), &error_config);
if(error_config) {cout << pActor->libName << "::process_config failed" << endl; return false;}
pActor->nrvPointer = new TB_AgNedDiam;
pActor->nrvPointer = new TreeBuilder;
pActor->libItem = 1;
}
#endif
......
......@@ -18,87 +18,30 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
/** @file TB_AgNedDiam.h header file for TB_AgNedDiam.cpp */
#ifndef _TB_AGATA
#define _TB_AGATA
#ifndef _TB_AgNedDiam
#define _TB_AgNedDiam
#include "AGAPRO_TB_Detector.h"
#include "AGAPRO_TreeBuilder.h"
#include "NarvalInterface.h"
#include "AgataCompositeFrame.h"
#include "Trigger.h"
#include "CycleServer.h"
class TGeoCombiTrans;
#include "TString.h"
#include <map>
class MFMNedaCompFrame;
class MFMDiamantFrame;
//! Post preprocessing histogramer
/*!
*/
namespace AGAPRO {
struct core_property
{
Float_t E;
Int_t Id;
Float_t HighHitE;
Float_t HighHitX;
Float_t HighHitY;
Float_t HighHitZ;
Int_t HighHitId;
ULong64_t HighHitTS;
};
/// ****** Builder ******///
class TB_AgNedDiam : public TreeBuilder
class TB_AGATA_Builder : public TB_Detector
{
enum SubTriggers { tGlobal, tTracked, tEvtPSA, tEvtRanc0, tEvtRanc1 };
protected: //Evt properties
ADF::SharedFP *fFrameEvent; //! input and ouput frames
ADF::AgataCompositeFrame *fAgataComposite;
ADF::AgataFrameTrigger *fTrigger; //! Trigger for the input frame
ADF::SharedFP *fTrackedFrame;
ADF::AgataCompositeFrame *fEventDataPsaFrame;
ADF::SharedFP *fPSAFrame;
ADF::AgataCompositeFrame *fEventDataRanc0Frame;
ADF::SharedFP *fDataRanc0Frame;
MFMNedaCompFrame *fMFMDataRanc0Frame;
ADF::AgataCompositeFrame *fEventDataRanc1Frame;
ADF::SharedFP *fDataRanc1Frame;
MFMDiamantFrame *fMFMDataRanc1Frame;
protected:
bool fDoTracking;
bool fDoPSAHits;
bool fDoRanc0;
bool fDoRanc1;
/// tracking tree variables
private:
static const Int_t MaxTrackedGamma = 500;
Int_t nbTrack; // Current number of tracked gamma-rays
Float_t trackE[MaxTrackedGamma]; // Energies of the tracked gamma
Float_t trackX1[MaxTrackedGamma]; // X position of the first interaction point
Float_t trackY1[MaxTrackedGamma]; // Y position of the first interaction point
Float_t trackZ1[MaxTrackedGamma]; // Z position of the first interaction point
Float_t trackT[MaxTrackedGamma]; // time of the track gamma
Int_t trackCrystalID[MaxTrackedGamma]; // CrystalID of the first interaction point of the track
ULong64_t TSTrack;
struct core_property
{
Float_t E;
Int_t Id;
Float_t HighHitE;
Float_t HighHitX;
Float_t HighHitY;
Float_t HighHitZ;
Int_t HighHitId;
ULong64_t HighHitTS;
};
protected:
......@@ -132,67 +75,58 @@ protected:
ULong64_t coreTS[MaxCore]; // timestamp of cores
ULong64_t AddTS[MaxCore]; // timestamp of he hit with highest energy
ULong64_t TSHit; // global timestamp
ULong64_t TSHit;
TObjArray* fMatrixList = nullptr;
protected:
static const Int_t MaxNEDA = 128; //8 boards * 16 channels
static const Int_t MaxChannel = 16;
Int_t nbNEDA;
UShort_t NEDABoardId[MaxNEDA], NEDAChannelId[MaxNEDA], NEDAId[MaxNEDA];
UShort_t NEDATdc[MaxNEDA], NEDAFast[MaxNEDA], NEDASlow[MaxNEDA] ,NEDAZco[MaxNEDA], NEDATime[MaxNEDA];
ULong64_t TSNEDAHit[MaxNEDA];
ULong64_t TSNEDA;
UShort_t NEDANeural[MaxNEDA];
Bool_t NEDAFlag[MaxNEDA];
public:
TB_AGATA_Builder(TString name="", TString ADFKey="");
virtual ~TB_AGATA_Builder();
map< Int_t, Int_t > fNEDALookUpTable;
void Init();
void InitValues();
void InitTree();
void Process(Int_t idet);
protected:
static const Int_t MaxDIAMANT = 96; //6 boards * 16 channels
Int_t nbDIAMANT;
UShort_t DIAMANTBoardId[MaxDIAMANT], DIAMANTChannelId[MaxDIAMANT], DIAMANTId[MaxDIAMANT];
UInt_t Status1[MaxDIAMANT], Status2[MaxDIAMANT];
Float_t Energy[MaxDIAMANT], Top[MaxDIAMANT], PID[MaxDIAMANT];
ULong64_t TSDIAMANTHit[MaxDIAMANT];
ULong64_t TSDIAMANT;
virtual TGeoCombiTrans* FillTransMatrix(Double_t* trans, Double_t* rot);
virtual void Local2Global(Int_t detID, Double_t xl, Double_t yl, Double_t zl, Double_t& xg, Double_t& yg, Double_t& zg);
virtual bool ReadTransformation();
map< Int_t, Int_t > fDIAMANTLookUpTable;
static bool coreCompare(const core_property& firstElem, const core_property& secondElem) {
return firstElem.E > secondElem.E;
}
};
public:
TB_AgNedDiam();
virtual ~TB_AgNedDiam();
/// ****** Tracking ******///
virtual UInt_t Process();
class TB_AGATA_Tracking : public TB_Detector
{
UInt_t ProcessTracking();
UInt_t ProcessPSAHits();
UInt_t ProcessRanc0();
UInt_t ProcessRanc1();
protected:
virtual Int_t SetInput(); //! to init your local variables with the ones from the buffers
void InitValues();
static const Int_t MaxTrackedGamma = 500;
void LoadLUT(Int_t anc);
Int_t nbTrack; // Current number of tracked gamma-rays
Float_t trackE[MaxTrackedGamma]; // Energies of the tracked gamma
void InitPSAHits();
void InitTracking();
void InitRanc0();
void InitRanc1();
Float_t trackX1[MaxTrackedGamma]; // X position of the first interaction point
Float_t trackY1[MaxTrackedGamma]; // Y position of the first interaction point
Float_t trackZ1[MaxTrackedGamma]; // Z position of the first interaction point
void InitTree();
Float_t trackT[MaxTrackedGamma]; // time of the track gamma
Int_t trackCrystalID[MaxTrackedGamma]; // CrystalID of the first interaction point of the track
virtual void process_initialise ( UInt_t *error_code ); //! Constructor implementation
ULong64_t TSTrack;
public:
virtual UInt_t GetParameters(const std::string& confFile, Bool_t doList=false) override;
TB_AGATA_Tracking(TString name="", TString ADFKey="");
virtual ~TB_AGATA_Tracking();
static bool coreCompare(const core_property& firstElem, const core_property& secondElem) {
return firstElem.E > secondElem.E;
}
void Init();
void InitValues();
void InitTree();
void Process(Int_t idet);
};
}
......
/***************************************************************************
* Copyright (C) 2018 by Jeremie Dudouet *
* jeremie.dudouet(AT)csnsm.in2p3.fr *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#ifndef AGAPRO_TB_DIAMANT
#include "AGAPRO_TB_DIAMANT.h"
#endif
#include "MFMDiamantFrame.h"
using namespace AGAPRO;
TB_DIAMANT::TB_DIAMANT(TString name, TString ADFKey) : TB_Detector(name,ADFKey)
{
gActualClass = "TB_DIAMANT";
}
TB_DIAMANT::~TB_DIAMANT()
{
if(fDIAMANTFrame)
delete fDIAMANTFrame;
}
void TB_DIAMANT::Init()
{
fFrame = fTrigger->AddUtility("data:ranc1",ConfAgent::theGlobalAgent());
fDIAMANTFrame = new MFMDiamantFrame();
LoadLUT();
}
void TB_DIAMANT::InitValues()
{
Log.ClearMessage();
Log.GetProcessName() = gActualClass;
Log.SetProcessMethod("InitValues()");
nbDIAMANT = 0;
TSDIAMANT = 0;
}
void TB_DIAMANT::InitTree()
{
Log.ClearMessage();
Log.GetProcessName() = gActualClass;
Log.SetProcessMethod("InitfTree()");
if(fTree == nullptr)
return;
fTree->Branch("nbDIAMANT", &nbDIAMANT, "nbDIAMANT/I");
fTree->Branch("DIAMANTBoard", DIAMANTBoardId, "DIAMANTBoard[nbDIAMANT]/s" );
fTree->Branch("DIAMANTChannel", DIAMANTChannelId, "DIAMANTChannel[nbDIAMANT]/s" );
fTree->Branch("DIAMANTId", DIAMANTId, "DIAMANTId[nbDIAMANT]/s" );
fTree->Branch("DIAMANT_Stat1" ,Status1, "DIAMANT_Stat1[nbDIAMANT]/I" );
fTree->Branch("DIAMANT_Stat2" ,Status2, "DIAMANT_Stat2[nbDIAMANT]/I" );
fTree->Branch("DIAMANT_E" ,Energy, "DIAMANT_E[nbDIAMANT]/F" );
fTree->Branch("DIAMANT_Top" ,Top, "DIAMANT_Top[nbDIAMANT]/F" );
fTree->Branch("DIAMANT_PID" ,PID, "DIAMANT_PID[nbDIAMANT]/F" );
fTree->Branch("TSDIAMANT_Hit" ,TSDIAMANTHit, "TSDIAMANT_Hit[nbDIAMANT]/l" );
fTree->Branch("TSDIAMANT", &TSDIAMANT, "TSDIAMANT/l" );
}
void TB_DIAMANT::Process(Int_t idet)
{
Log.ClearMessage();
Log.GetProcessName() = gActualClass;
Log.SetProcessMethod("Process()");
fCompFrame = (ADF::AgataCompositeFrame*) fTrigger->GetInputSharedFP(idet+1)->GetFrame();
fCompFrame->Scan();
nbDIAMANT = fCompFrame->GetNbSubFrame();
if(nbDIAMANT>MaxDIAMANT)
{
Log << error <<nbDIAMANT<<" sub frames in event:data:ranc1 ==> maximum is "<<MaxDIAMANT<< nline << "Event ignored" << dolog;
nbDIAMANT=0;
return;
}
TSDIAMANT = ((AgataKey *)fCompFrame->GetKey())->GetTimeStamp();
for(Int_t i = 0u; i <nbDIAMANT; i++)
{
fCompFrame->LinkSubFrame(i,fFrame->GetFrame());
fFrame->GetFrame()->Read();
fDIAMANTFrame->SetAttributs(((ADF::RawFrame *)fFrame->GetFrame())->RawBuffer().Address());
DIAMANTBoardId[i] = fDIAMANTFrame->GetBoardId();
DIAMANTChannelId[i] = fDIAMANTFrame->GetTGCristalId() ;
DIAMANTId[i] = fLookUpTable[DIAMANTBoardId[i]*MaxChannel+DIAMANTChannelId[i]];
Status1[i] = fDIAMANTFrame->GetStatus(0);
Status2[i] = fDIAMANTFrame->GetStatus(1);
Energy[i] = fDIAMANTFrame->GetEnergy()/512.;
Top[i] = fDIAMANTFrame->GetTop()/64.;
TSDIAMANTHit[i] = fDIAMANTFrame->GetTimeStamp();
if (Top[i] > 0 && Energy[i] > 0)
PID[i] = 1.-Top[i]*1./Energy[i];
}
}
void TB_DIAMANT::LoadLUT()
{
TString FileName = fConfPath + "/diamant_id_lookup";
ifstream file(FileName.Data());
string line;
TString Buffer;
if(!file)
Log << error <<"DIAMANT look up table (diamant_id_lookup) not found !"<<dolog;
while(file)
{
getline(file,line);
Buffer=line;
if(Buffer.BeginsWith("#"))
continue;
Buffer.ReplaceAll("\t"," ");
TObjArray *arr = Buffer.Tokenize(" ");
if(arr->GetEntries() != 3)
continue;
Int_t BoardID = ((TString)arr->At(1)->GetName()).Atoi();
Int_t ChannelID = ((TString)arr->At(2)->GetName()).Atoi();
Int_t ID = ((TString)arr->At(0)->GetName()).Atoi();
fLookUpTable[BoardID*MaxChannel+ChannelID] = ID;
}
}
/***************************************************************************
* Copyright (C) 2004 by Jeremie Dudouet *
* jeremie.dudouet(AT)csnsm.in2p3.fr *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#ifndef _TB_DIAMANT
#define _TB_DIAMANT
#include "AGAPRO_TB_Detector.h"
class MFMDiamantFrame;
namespace AGAPRO {
class TB_DIAMANT : public TB_Detector
{
protected:
MFMDiamantFrame *fDIAMANTFrame = nullptr;
protected:
static const Int_t MaxDIAMANT = 96; //6 boards * 16 channels
static const Int_t MaxChannel = 16;
Int_t nbDIAMANT;
UShort_t DIAMANTBoardId[MaxDIAMANT], DIAMANTChannelId[MaxDIAMANT], DIAMANTId[MaxDIAMANT];
UInt_t Status1[MaxDIAMANT], Status2[MaxDIAMANT];
Float_t Energy[MaxDIAMANT], Top[MaxDIAMANT], PID[MaxDIAMANT];
ULong64_t TSDIAMANTHit[MaxDIAMANT];
ULong64_t TSDIAMANT;
map< Int_t, Int_t > fLookUpTable;
public:
TB_DIAMANT(TString name="", TString ADFKey="");
virtual ~TB_DIAMANT();
void Init();
void InitValues();
void InitTree();
void Process(Int_t idet);
protected:
void LoadLUT();
};
}
#endif
/***************************************************************************
* Copyright (C) 2018 by Jeremie Dudouet *
* jeremie.dudouet(AT)csnsm.in2p3.fr *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#ifndef AGAPRO_TB_Detector
#include "AGAPRO_TB_Detector.h"
#endif
using namespace AGAPRO;
TB_Detector::TB_Detector(TString name, TString ADFKey) :
fName(name),
fTriggerName(ADFKey),
Log(Form("Log_%s",name.Data())),
gActualClass("TB_Detector")
{
}
TB_Detector::~TB_Detector()
{
if(fCompFrame)
delete fCompFrame;
if(fFrame)
delete fFrame;
}
/***************************************************************************
* Copyright (C) 2004 by Jeremie Dudouet *
* jeremie.dudouet(AT)csnsm.in2p3.fr *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#ifndef _TB_Detector
#define _TB_Detector
#include <iostream>
#include <iomanip>
#include <fstream>
#include <sstream>
#include "AgataKeyFactory.h"
#include "AgataCompositeFrame.h"
#include "Trigger.h"
#include "Rtypes.h"
#include "TString.h"
#include "TTree.h"
using namespace std;
using namespace ADF;
namespace AGAPRO {
class TB_Detector
{
public:
std::string gMotherClass = "TB_Detector";
std::string gActualClass;
protected:
LogMessage Log;
protected:
TString fName = "";
TString fConfPath = "";
TString fTriggerName = "";
Bool_t fIsTriggered = false;
AgataFrameTrigger *fTrigger = nullptr;
AgataCompositeFrame *fCompFrame = nullptr;
SharedFP *fFrame = nullptr;
TTree *fTree = nullptr;
public:
TB_Detector(TString name="", TString ADFKey="");
virtual ~TB_Detector();
virtual void Init(){;}
virtual void InitValues(){;}
virtual void InitTree(){;}
virtual void Process(Int_t){;}
void SetName(TString name){fName = name;}
TString GetName(){return fName;}
void SetTree(TTree *tree){fTree = tree;}
TTree *GetTree(){return fTree;}
void SetConfPath(TString confpath){fConfPath = confpath;}
TString GetConfPath(){return fConfPath;}
void SetTriggerName(TString trig){fTriggerName = trig;}
TString GetTriggerName(){return fTriggerName;}
void SetTrigger(ADF::AgataFrameTrigger *trig){fTrigger = trig;}
ADF::AgataFrameTrigger *GetTrigger(){return fTrigger;}
void SetTriggered(Bool_t ok){fIsTriggered = ok;}
Bool_t IsTriggered(){return fIsTriggered;}
};