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

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

Add the TreeBuilder class, check root and mfm dependancies

parent 92abf8e9
#
# This is a begin of the ADF configuration record
# Option is Init. It means the Agent is reset before being initialised
#
#////ADF::ConfAgent_beg//// Agata 1 Init
#
#
Endian: kLittle
#
# List of factories required
#
# Factories for Keys
#
KeyFactory: Default
KeyFactory: Agata
#
# Factories for Frames
#
FrameFactory: Agata
#
#
# Version of the primary key that structures the data flow
# and the frame expected to reconfigure it
#
PrimaryKey: Default FS 0 1
#
# comment/uncomment to switch off/on auto-reconf
AutoConf: Agata conf:global 2 0 Agata conf:global 0 0
#
#
# Current Frames going through the data flow
#
Frame: Agata data:crystal 4 0 Agata data:crystal 65000 0
Frame: Agata data:ccrystal 4 0 Agata data:ccrystal 65000 0
Frame: Agata data:ranc0 4 0 Agata data:ranc0 65000 0
Frame: Agata data:ranc1 4 0 Agata data:ranc1 65000 0
Frame: Agata data:psa 4 0 Agata data:psa 0 0
Frame: Agata data:tracked 4 0 Agata data:tracked 0 0
Frame: Agata event:data 4 0 Agata event:data 4 0
Frame: Agata event:data:psa 4 0 Agata event:data:psa 4 0
Frame: Agata event:data:tracked 4 0 Agata event:data:tracked 4 0
Frame: Agata meta:vertex 4 0 Agata meta:vertex 0 0
#
# end of Data Flow Defaults
#
#////ADF::ConfAgent_end////
......@@ -34,7 +34,10 @@ SET(${PROJECT_NAME}_VERSION_PATCH "0")
#
# Where to look first for cmake modules
#
SET(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules)
if(DEFINED ENV{AGATASOFTWARE_TOP_DIR})
set(CMAKE_MODULE_PATH $ENV{AGATASOFTWARE_TOP_DIR}/scripts/cmake/Modules ${CMAKE_MODULE_PATH})
endif()
message("PATH to search for cmake modules ${CMAKE_MODULE_PATH}")
#
# define format for libraries (force .so for macos)
if(WIN32)
......@@ -77,12 +80,13 @@ if ( DO_MGT_INTERFACE )
endif()
endif()
#----------------------------------------------------------------------------
#----------------------------------------------------------------------------
# Find mondule using cmake find system
# ADF is mandatory !
find_package(ADF REQUIRED)
#
find_package(ROOT)
find_package(MFM)
# Find module using simple test
include(AGAPROMacroUtilities)
include(AGAPROSearchInstalledSoftware)
......@@ -109,6 +113,15 @@ SET(AGAPRO_INCLUDE_DIRS ${CMAKE_BINARY_DIR}/include)
#
# ADF
list (APPEND AGAPRO_INCLUDE_DIRS ${ADF_INCLUDE_DIRS})
# ROOT
if (ROOT_FOUND)
list(APPEND AGAPRO_INCLUDE_DIRS ${ROOT_INCLUDES})
link_directories(${ROOT_LIBRARY_DIR})
endif()
# MFM
if (MFM_FOUND)
list (APPEND AGAPRO_INCLUDE_DIRS ${MFM_INCLUDE_DIRS})
endif()
# Boost
if (HAS_BOOST)
list(APPEND AGAPRO_INCLUDE_DIRS ${Boost_INCLUDE_DIRS})
......
......@@ -11,12 +11,12 @@ Endian: kLittle
#
# Factories for Keys
#
KeyFactory: Default
KeyFactory: Agata
KeyFactory: Default -1
KeyFactory: Agata 0
#
# Factories for Frames
#
FrameFactory: Agata
FrameFactory: Agata -1
#
#
# Version of the primary key that structures the data flow
......@@ -25,100 +25,28 @@ FrameFactory: Agata
PrimaryKey: Default FS 0 1
#
# comment/uncomment to switch off/on auto-reconf
#AutoConf: Agata conf:global 2 0 Agata conf:global 0 0
AutoConf: Agata conf:global 2 0 Agata conf:global 0 0
#
#
# Current Frames going through the data flow
#
Frame: Agata data:crystal 4 0 Agata data:crystal 65000 0
Frame: Agata data:ccrystal 4 0 Agata data:ccrystal 65000 0
Frame: Agata data:ranc0 4 0 Agata data:ranc0 65000 0
Frame: Agata data:ranc1 4 0 Agata data:ranc1 65000 0
#Frame: Agata data:psa 4 0 Agata data:psa 65000 1
Frame: Agata data:psa 4 0 Agata data:psa 0 0
Frame: Agata data:tracked 4 0 Agata data:tracked 65000 0
Frame: Agata event:data 4 0 Agata event:data 4 0
Frame: Agata event:data:psa 4 0 Agata event:data:psa 4 0
Frame: Agata data:crystal 4 0 Agata data:crystal 65000 0
Frame: Agata data:ccrystal 4 0 Agata data:ccrystal 65000 0
Frame: Agata data:rcrystal 4 0 Agata data:rcrystal 65000 0
Frame: Agata data:ranc0 4 0 Agata data:ranc0 65000 0
Frame: Agata data:ranc1 4 0 Agata data:ranc1 65000 0
Frame: Agata data:ranc2 4 0 Agata data:ranc2 65000 0
Frame: Agata data:psa 4 0 Agata data:psa 0 0
Frame: Agata data:tracked 4 0 Agata data:tracked 1 0
Frame: Agata event:data 4 0 Agata event:data 4 0
Frame: Agata event:data:psa 4 0 Agata event:data:psa 4 0
Frame: Agata event:data:ranc0 4 0 Agata event:data:ranc0 4 0
Frame: Agata event:data:ranc1 4 0 Agata event:data:ranc1 4 0
Frame: Agata event:data:ranc2 4 0 Agata event:data:ranc2 4 0
Frame: Agata meta:vertex 4 0 Agata meta:vertex 0 0
Frame: Agata meta:sync 4 0 Agata meta:sync 0 0
#
# end of Data Flow Defaults
#
#////ADF::ConfAgent_end////
#
#////ADF::AgataKeyFactory_beg//// - -1 Init
#
# Definition of the message part for Agata like Keys
#
# Format: KeyNAME message mask
#
# KeyNAME is the string to be passed to the AgataKeyFactory. It should be unique !
# message is the message part as coded in the key
# mask is to be used to extract part of the message when comparing keys
#
# with 0xWAXXYYZZ
#
# W = F for simple frame, C for composite frame - A means used AgataKey factory
#
# XX = Sub-detector number (associated to a given factories)
# 01 for Agata (Agata Frame factory), pure Agata
# 02 for Agata (Agata Frame factory), raw ancillary for Agata
# > 02 for other factories
# YY = Frame type
# 01 data (produce/consume by algorithm)
# 11 meta (general, does not depend on an algorithm)
# 02 conf (conf associated to a data/meta frame)
# 03 algo (conf specific for an algorithm)
# 04 info (conf like, just some comments)
# 05 rmess (message, raw frame)
# 06 cmess (message, conf frame)
#
# ZZ = ALGO ID, should be unique in the data flow
#
#agata 0x0A000000 0x0F000000
#
#data 0x0A000100 0x0F000F00
data:crystal 0xFA010101 0xFFFFFFFF
data:ccrystal 0xFA010111 0xFFFFFFFF
data:psa 0xFA010102 0xFFFFFFFF
data:eb 0xFA010103 0xFFFFFFFF
data:merger 0xFA010104 0xFFFFFFFF
data:tracked 0xFA010105 0xFFFFFFFF
data:ranc0 0xFA0201A0 0xFFFFFFFF
data:ranc1 0xFA0201A1 0xFFFFFFFF
data:ranc2 0xFA0201A2 0xFFFFFFFF
#
#meta 0x0A001100 0x0F00FF00
meta:eof 0xFA001100 0x0FFFFFFF
meta:sync 0xFA011101 0xFFFFFFFF
meta:vertex 0xFA011102 0xFFFFFFFF
#
#conf 0x0A000200 0x0F00FF00
conf:global 0xFA000200 0xFFFFFFFF
conf:crystal 0xFA010201 0xFFFFFFFF
conf:psa 0xFA010202 0xFFFFFFFF
conf:eb 0xFA010203 0xFFFFFFFF
conf:merger 0xFA010204 0xFFFFFFFF
conf:tracked 0xFA010205 0xFFFFFFFF
conf:ranc0 0xFA0202A0 0xFFFFFFFF
conf:ranc1 0xFA0202A1 0xFFFFFFFF
conf:ranc2 0xFA0202A2 0xFFFFFFFF
#
#algo 0xFA000300 0x0F00FF00
algo:crystal 0xFA010301 0xFFFFFFFF
algo:ccrystal 0xFA010311 0xFFFFFFFF
algo:psa 0xFA010302 0xFFFFFFFF
algo:eb 0xFA010303 0xFFFFFFFF
algo:merger 0xFA010304 0xFFFFFFFF
algo:tracked 0xFA010305 0xFFFFFFFF
#
#rmess 0x0A000400 0x0F00FF00
#cmess 0x0A000500 0x0F00FF00
#
#event 0xCA000000 0xFF000000
event:data 0xCA000100 0xFF000F00
event:data:crystal 0xCA010101 0xFFFFFFFF
event:data:psa 0xCA010102 0xFFFFFFFF
event:data:tracked 0xCA010103 0xFFFFFFFF
#
#////ADF::AgataKeyFactory_end////
#
......@@ -61,6 +61,7 @@ FILTER TrackingFilterOFT
FILTER TrackingFilterMGT
FILTER BasicATSB
CONSUMER BasicAFC
CONSUMER TB_AgNedDiam
CONSUMER None pseudo-actor to close a chain without output
DISPATCHER BuilderName pseudo actor to connect the output of a chain to an input queue of a BUILDER
*********************************************************/
......@@ -107,6 +108,12 @@ DISPATCHER BuilderName pseudo actor to connect the output of a chain to an i
// None // 40 400 fake, used as last of a chain
#include "BasicAFC.h" // 41 410 no mother-daughter model
#ifdef HAS_ROOT
#include "AGAPRO_TreeBuilder.h"
#include "AGAPRO_TB_AgNedDiam.h"
#endif
// TB_AgNedDiam // 42 420
// 5 DISPATCHER femul mechanism to connect to an EventBuilder
// BuilderName // 50 destination_chain
......@@ -863,6 +870,11 @@ void listKeysAndExit()
pf6->GetParameters("", true);
delete pf6;
AGAPRO::TB_AgNedDiam *pf7 = new AGAPRO::TB_AgNedDiam;
pf7->GetParameters("", true);
delete pf7;
exit(EXIT_SUCCESS);
}
......@@ -1105,6 +1117,14 @@ bool topologyConfNew()
pActor->nrvPointer = new BasicAFC(nc);
pActor->libItem = 400;
}
// 42
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);
IF_ERRORCONFIG(error_config);
pActor->nrvPointer = new AGAPRO::TB_AgNedDiam;
pActor->libItem = 420;
}
ELSE_UNKNOWNCLASS(nc);
break;
case DISPATCHER: //// 5 // not a narval actor
......@@ -1369,6 +1389,13 @@ bool topologyConfNew()
pActor->nrvPointer = new BasicAFC(nc);
pActor->libItem = 1;
}
else if(pActor->libName == "TB_AgNedDiam") {
cout << "TB_AgNedDiam ..." << 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->libItem = 1;
}
else {
cout << "Unknown class [ " << nc << " " << nc << " ] " << pActor->libName << endl;
return false;
......
# - Try to find MFM using MFM_DIR environnment variable or in case AgataSoftware.py is used up from CMAKE_SOURCE_DIR
#
# Once done, this defines
#
# MFM_FOUND System has MFM
# MFM_INCLUDE_DIRS The MFM/GWMFM include directories - not chached
# MFM_INCLUDE_DIR The MFM/GWMFM include directories - cached
#
# MFM_LIBRARIES The libraries needed to use MFM - not cached
# MFM_LIBRARY The libraries needed to use MFM - cached
#
#
# O. Stezowski, agata_{AT}_ipnl.in2p3.fr
# I don't know why I have to add this ???
#
set(CMAKE_FIND_LIBRARY_PREFIXES "lib")
set(CMAKE_FIND_LIBRARY_SUFFIXES ".so" ".dylib" ".dll")
#
SET(CMAKE_SKIP_BUILD_RPATH FALSE)
# look for the library
#
find_library(MFM_LIBRARY MFM PATHS ${MFM_DIR} ${MFM_DIR}/lib $ENV{AGATASOFTWARE_TOP_DIR}/lib)
#
# Check for includes
#
if ( MFM_LIBRARY )
find_path(MFM_INCLUDE_DIR MFMBasicFrame.h HINTS
${MFM_DIR} ${MFM_DIR}/include $ENV{AGATASOFTWARE_TOP_DIR}/lib)
endif()
set(MFM_FOUND false)
#
if ( MFM_INCLUDE_DIR AND MFM_LIBRARY )
set(MFM_DEFAULT_MSG "MFM found.
--> includes in: ${MFM_INCLUDE_DIR},
--> lib: ${MFM_LIBRARY}")
else()
set(MFM_DEFAULT_MSG "MFM NOT found. includes in : ${MFM_INCLUDE_DIR} , lib: ${MFM_LIBRARY}")
endif()
#----------------------------------------------------------------------------
# Handle the QUIETLY and REQUIRED arguments
#
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args (MFM
"${MFM_DEFAULT_MSG}"
MFM_LIBRARY
MFM_INCLUDE_DIR
)
#----------------------------------------------------------------------------
# If we found MFM, set the needed non-cache variables
#
if(MFM_FOUND)
MESSAGE("${MFM_DEFAULT_MSG}")
set(MFM_LIBRARIES ${MFM_LIBRARY})
set(MFM_INCLUDE_DIRS ${MFM_INCLUDE_DIR})
endif()
#----------------------------------------------------------------------------
# Mark cache variables that can be adjusted as advanced
#
mark_as_advanced(MFM_INCLUDE_DIR MFM_LIBRARY)
......@@ -5,6 +5,9 @@
#cmakedefine HAS_SKSTREAM
#cmakedefine HAS_SSE
#cmakedefine HAS_C11
#cmakedefine HAS_ROOT
#cmakedefine HAS_MFM
//////////////////////////////
////// Define OS_TYPE ////////
......
......@@ -42,6 +42,21 @@ else()
SET(CMAKE_THR_TYPE 1)
endif()
endif()
if (ROOT_FOUND)
SET(HAS_ROOT ON)
message("[AGAPRO] + Configured with ROOT enabled")
else()
message("[AGAPRO] + Configured with ROOT disabled")
endif()
if (MFM_FOUND)
SET(HAS_MFM ON)
message("[AGAPRO] + Configured with MFM enabled")
else()
message("[AGAPRO] + Configured with MFM disabled")
endif()
#
#
configure_file (
......
......@@ -7,3 +7,6 @@ MESSAGE("[AGAPRO] + ${PROJECT_NAME}")
add_subdirectory(Basic)
if (ROOT_FOUND AND MFM_FOUND)
add_subdirectory(TreeBuilder)
endif()
/***************************************************************************
* 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. *
***************************************************************************/
/** \file TB_AgNedDiam.cpp compiled in libADF.so */
#ifndef AGAPRO_TB_AgNedDiam
#include "AGAPRO_TB_AgNedDiam.h"
#endif
#include <iostream>
#include <iomanip>
#include <fstream>
#include <sstream>
#include <cmath>
#include <fcntl.h>
#include <unistd.h>
#include <errno.h>
#include <stdlib.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include "AgataKeyFactory.h"
#include "AgataFrameFactory.h"
#include "TrackedFrame.h"
#include "PSAFrame.h"
#include "MFMNedaCompFrame.h"
#include "MFMDiamantFrame.h"
#include "adetParams.h"
#include "commonDefs.h"
#include "ConfReader.h"
#include "TObjArray.h"
#include "TTree.h"
using namespace ADF;
using namespace AGAPRO;
TB_AgNedDiam::TB_AgNedDiam() :
TreeBuilder(),
fTrigger(new ADF::AgataFrameTrigger("event:data &data:tracked &event:data:psa event:data:ranc0 event:data:ranc1")),
fDoTracking(false),
fDoPSAHits(false),
fDoRanc0(false),
fDoRanc1(false)
{
}
TB_AgNedDiam::~TB_AgNedDiam()
{
}
UInt_t TB_AgNedDiam::Process()
{
Log.ClearMessage();
Log.GetProcessName() = gActualClass;
Log.SetProcessMethod("Process()");
Log.SetPID(GetPID());
if(fDoTracking)
ProcessTracking();
if(fDoPSAHits)
ProcessPSAHits();
if(fDoRanc0)
ProcessRanc0();
if(fDoRanc1)
ProcessRanc1();
fTree->Fill();
}
UInt_t TB_AgNedDiam::ProcessTracking()
{
Log.ClearMessage();
Log.GetProcessName() = gActualClass;
Log.SetProcessMethod("ProcessTracking()");
Log.SetPID(GetPID());
fTrackedFrame = fTrigger->GetInputSharedFP(tTracked);
fTrackedFrame->GetFrame()->Read();
// to get the data part of the frame
const GammaTrackedInterface *data = GetCstDataPointer<GammaTrackedInterface>(fTrackedFrame);
nbTrack = data->GetNbGamma();
if(nbTrack>MaxTrackedGamma)
{
Log << error << " Number of tracked gamma : " << nbTrack << "Max nbTrack = " << MaxTrackedGamma << " event ignored !" << nline;
nbTrack=0;
return 1;
}
//! get time stamp
TSTrack = ((AgataKey *)fTrackedFrame->GetFrame()->GetKey())->GetTimeStamp();
for (UShort_t i = 0u; i < nbTrack; i++)
{
const TrackedHit *gamma1 = data->GetGamma(i);
const Hit *hit1 = gamma1->GetHit();
trackE[i] = gamma1->GetE();
trackT[i] = hit1->GetT();
trackCrystalID[i] = hit1->GetID(1);
trackX1[i] = gamma1->GetX();
trackY1[i] = gamma1->GetY();
trackZ1[i] = gamma1->GetZ();
}
return 0;
}
UInt_t TB_AgNedDiam::ProcessPSAHits()
{
Log.ClearMessage();
Log.GetProcessName() = gActualClass;
Log.SetProcessMethod("ProcessPSAHits()");
Log.SetPID(GetPID());
fEventDataPsaFrame = (ADF::AgataCompositeFrame*) fTrigger->GetInputSharedFP(tEvtPSA)->GetFrame();
fEventDataPsaFrame->Scan();
TSHit = ((AgataKey *)fEventDataPsaFrame->GetKey())->GetTimeStamp();
Double_t xLocal, yLocal, zLocal, xGlobal, yGlobal, zGlobal;
nbCores = fEventDataPsaFrame->GetNbSubFrame();
nbHits=0;
for(Int_t i=0 ; i < nbCores ; i++)
{
fEventDataPsaFrame->LinkSubFrame(i,fPSAFrame->GetFrame());
fPSAFrame->GetFrame()->Read();
PSAInterface *data = GetDataPointer<PSAInterface>(fPSAFrame);
Int_t nbHitsperCry = data->GetNbHits();
if ( nbHitsperCry == MaxHits )
{
Log << error << " Number of Hits to hit in : " << nbHitsperCry << "Max nbHits = " << MaxHits << nline;
nbHits = 0;
nbCores = 0;
TSHit = 0;
return 1;
}
// Core like branches
coreId[i] = data->GetUID();
coreE0[i] = data->GetE();
coreTS[i] = ((AgataKey *)fPSAFrame->GetFrame()->GetKey())->GetTimeStamp();
// Loop on the hit to get over the hits with the max of the energy
for (Int_t j = 0; j < nbHitsperCry; ++j)
{
const PSAHit* pHit = (PSAHit*)data->GetHit(j);
hitE[nbHits+j] = pHit->GetE();
hitX[nbHits+j] = pHit->GetX();
hitY[nbHits+j] = pHit->GetY();
hitZ[nbHits+j] = pHit->GetZ();
hitId[nbHits+j] = data->GetUID() ;
hitSg[nbHits+j] = pHit->GetID();
//Get hit position
pHit->GetXYZ(xLocal, yLocal, zLocal);
//To the AGATA global ref
Local2Global(data->GetUID(), xLocal, yLocal, zLocal, xGlobal, yGlobal, zGlobal);
// Set the Position of the hit in global ref of PRESPEC
hitGX[nbHits+j]= xGlobal; // inversion X-Y and opposite direction
hitGY[nbHits+j]= yGlobal; // inversion Y-X and opposite direction
hitGZ[nbHits+j]= zGlobal; // z
}
nbHits += nbHitsperCry;
}
}
UInt_t TB_AgNedDiam::ProcessRanc0()
{
Log.ClearMessage();
Log.GetProcessName() = gActualClass;
Log.SetProcessMethod("ProcessRanc0()");
Log.SetPID(GetPID());
fEventDataRanc0Frame = (ADF::AgataCompositeFrame*) fTrigger->GetInputSharedFP(tEvtRanc0)->GetFrame();
fEventDataRanc0Frame->Scan();
nbNEDA = fEventDataRanc0Frame->GetNbSubFrame();
if(nbNEDA>MaxNEDA)
{
Log << error <<nbNEDA<<" sub frames in event:data:ranc0 ==> maximum is "<<MaxNEDA<< nline << "Event ignored" << dolog;
nbNEDA=0;
return 1;
}
TSNEDA = ((AgataKey *)fEventDataRanc0Frame->GetKey())->GetTimeStamp();