added depth profiler skeleton for MM.
This commit is contained in:
parent
fc08b12769
commit
26c1f49554
1
src/external/CMakeLists.txt
vendored
1
src/external/CMakeLists.txt
vendored
@ -4,6 +4,7 @@ if (ASlibs)
|
||||
add_subdirectory(libPhotoMeissner)
|
||||
add_subdirectory(libSpinValve)
|
||||
add_subdirectory(libGbGLF)
|
||||
add_subdirectory(DepthProfile)
|
||||
endif (ASlibs)
|
||||
|
||||
if (BMWlibs)
|
||||
|
1
src/external/DepthProfile/CMakeLists.txt
vendored
Normal file
1
src/external/DepthProfile/CMakeLists.txt
vendored
Normal file
@ -0,0 +1 @@
|
||||
add_subdirectory(src)
|
1
src/external/DepthProfile/README
vendored
Normal file
1
src/external/DepthProfile/README
vendored
Normal file
@ -0,0 +1 @@
|
||||
Will describe what this is all about...
|
81
src/external/DepthProfile/inc/PDepthProfile.h
vendored
Normal file
81
src/external/DepthProfile/inc/PDepthProfile.h
vendored
Normal file
@ -0,0 +1,81 @@
|
||||
/***************************************************************************
|
||||
|
||||
PDepthProfile.h
|
||||
|
||||
Author: Andreas Suter
|
||||
e-mail: andreas.suter@psi.ch
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2013-2022 by Andreas Suter *
|
||||
* andreas.suter@psi.ch *
|
||||
* *
|
||||
* 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 _PDEPTHPROFILE_H_
|
||||
#define _PDEPTHPROFILE_H_
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "PUserFcnBase.h"
|
||||
#include "PRgeHandler.h"
|
||||
|
||||
class PDepthProfileGlobal
|
||||
{
|
||||
public:
|
||||
PDepthProfileGlobal();
|
||||
virtual ~PDepthProfileGlobal();
|
||||
|
||||
Bool_t IsValid() { return fValid; }
|
||||
virtual Int_t GetEnergyIndex(const Double_t energy) { return fRgeHandler->GetEnergyIndex(energy); }
|
||||
virtual Double_t GetMuonStoppingDensity(const Int_t energyIndex, const Double_t z) const { return fRgeHandler->Get_n(energyIndex, z); }
|
||||
|
||||
private:
|
||||
Bool_t fValid{true};
|
||||
|
||||
mutable std::vector<Double_t> fPreviousParam;
|
||||
|
||||
PRgeHandler *fRgeHandler{nullptr};
|
||||
|
||||
ClassDef(PDepthProfileGlobal, 1)
|
||||
};
|
||||
|
||||
class PDepthProfile : public PUserFcnBase
|
||||
{
|
||||
public:
|
||||
PDepthProfile() {}
|
||||
virtual ~PDepthProfile();
|
||||
|
||||
virtual Bool_t NeedGlobalPart() const { return true; }
|
||||
virtual void SetGlobalPart(std::vector<void*> &globalPart, UInt_t idx);
|
||||
virtual Bool_t GlobalPartIsValid() const;
|
||||
|
||||
virtual Double_t operator()(Double_t t, const std::vector<Double_t> ¶m) const;
|
||||
|
||||
private:
|
||||
Bool_t fValid{true};
|
||||
Bool_t fInvokedGlobal{false};
|
||||
Int_t fIdxGlobal;
|
||||
|
||||
PDepthProfileGlobal *fDepthProfileGlobal{nullptr};
|
||||
|
||||
// definition of the class for the ROOT dictionary
|
||||
ClassDef(PDepthProfile, 1)
|
||||
};
|
||||
|
||||
#endif // _PDEPTHPROFILE_H_
|
39
src/external/DepthProfile/inc/PDepthProfileLinkDef.h
vendored
Normal file
39
src/external/DepthProfile/inc/PDepthProfileLinkDef.h
vendored
Normal file
@ -0,0 +1,39 @@
|
||||
/***************************************************************************
|
||||
|
||||
PDepthProfileLinkDef.h
|
||||
|
||||
Author: Andreas Suter
|
||||
e-mail: andreas.suter@psi.ch
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2013-2022 by Andreas Suter *
|
||||
* andreas.suter@psi.ch *
|
||||
* *
|
||||
* 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. *
|
||||
***************************************************************************/
|
||||
|
||||
#ifdef __CINT__
|
||||
|
||||
#pragma link off all globals;
|
||||
#pragma link off all classes;
|
||||
#pragma link off all functions;
|
||||
|
||||
#pragma link C++ class PDepthProfileGlobal+;
|
||||
#pragma link C++ class PDepthProfile+;
|
||||
|
||||
#endif
|
78
src/external/DepthProfile/src/CMakeLists.txt
vendored
Normal file
78
src/external/DepthProfile/src/CMakeLists.txt
vendored
Normal file
@ -0,0 +1,78 @@
|
||||
# - DepthProfile library ------------------------------------------------------
|
||||
|
||||
#--- generate necessary dictionaries ------------------------------------------
|
||||
set(MUSRFIT_INC ${CMAKE_SOURCE_DIR}/src/include)
|
||||
set(DEPTH_PROFILE_INC ${CMAKE_CURRENT_SOURCE_DIR}/../inc)
|
||||
# ROOT requires that the dictonary header files are found at configuration time.
|
||||
# Hence, target_include_directories cannot be used here because, targets are
|
||||
# setup only afterwards.
|
||||
include_directories(${DEPTH_PROFILE_INC})
|
||||
|
||||
root_generate_dictionary(
|
||||
PDepthProfileDict
|
||||
PDepthProfile.h
|
||||
OPTIONS
|
||||
-I${FFTW3_INCLUDE_DIR}
|
||||
-I${MUSRFIT_INC}
|
||||
-I${DEPTH_PROFILE_INC}
|
||||
-inlineInputHeader
|
||||
LINKDEF ${DEPTH_PROFILE_INC}/PDepthProfileLinkDef.h
|
||||
MODULE PDepthProfile
|
||||
)
|
||||
|
||||
#--- create pkg-config info ---------------------------------------------------
|
||||
set(prefix "${CMAKE_INSTALL_PREFIX}")
|
||||
set(exec_prefix "\$\{prefix\}")
|
||||
set(libdir "\$\{exec_prefix\}/lib")
|
||||
set(includedir "\$\{prefix\}/include")
|
||||
set(P_DEPTH_PROFILE_VERSION "1.0.0")
|
||||
set(P_DEPTH_PROFILE_LIBRARY_NAME "PDepthProfile")
|
||||
configure_file("PDepthProfile.pc.in" "PDepthProfile.pc" @ONLY)
|
||||
|
||||
#--- lib creation -------------------------------------------------------------
|
||||
add_library(PDepthProfile SHARED
|
||||
PDepthProfile.cpp
|
||||
PDepthProfileDict.cxx
|
||||
)
|
||||
|
||||
#--- set target properties, e.g. version --------------------------------------
|
||||
set_target_properties(PDepthProfile
|
||||
PROPERTIES
|
||||
VERSION ${P_DEPTH_PROFILE_VERSION}
|
||||
)
|
||||
|
||||
#--- make sure that the include directory is found ----------------------------
|
||||
target_include_directories(
|
||||
PDepthProfile BEFORE PRIVATE
|
||||
$<BUILD_INTERFACE:${FFTW3_INCLUDE_DIR}>
|
||||
$<BUILD_INTERFACE:${MUSRFIT_INC}>
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../inc>
|
||||
)
|
||||
|
||||
#--- add library dependencies -------------------------------------------------
|
||||
target_link_libraries(PDepthProfile ${FFTW3_LIBRARY} ${ROOT_LIBRARIES} PUserFcnBase)
|
||||
|
||||
#--- install PDepthProfile solib ----------------------------------------------
|
||||
install(TARGETS PDepthProfile DESTINATION lib)
|
||||
|
||||
#--- install root pcm's and rootmaps ------------------------------------------
|
||||
install(
|
||||
FILES ${CMAKE_CURRENT_BINARY_DIR}/libPDepthProfile_rdict.pcm
|
||||
${CMAKE_CURRENT_BINARY_DIR}/libPDepthProfile.rootmap
|
||||
DESTINATION lib
|
||||
)
|
||||
|
||||
#--- install DepthProfile header ----------------------------------------------
|
||||
install(
|
||||
FILES
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../inc/PDepthProfile.h
|
||||
DESTINATION
|
||||
include
|
||||
)
|
||||
|
||||
#--- install pkg-config info --------------------------------------------------
|
||||
install(
|
||||
FILES ${CMAKE_CURRENT_BINARY_DIR}/PDepthProfile.pc
|
||||
DESTINATION lib/pkgconfig
|
||||
)
|
||||
|
150
src/external/DepthProfile/src/PDepthProfile.cpp
vendored
Normal file
150
src/external/DepthProfile/src/PDepthProfile.cpp
vendored
Normal file
@ -0,0 +1,150 @@
|
||||
/***************************************************************************
|
||||
|
||||
PDepthProfile.cpp
|
||||
|
||||
Author: Andreas Suter
|
||||
e-mail: andreas.suter@psi.ch
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2009-2022 by Andreas Suter *
|
||||
* andreas.suter@psi.ch *
|
||||
* *
|
||||
* 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. *
|
||||
***************************************************************************/
|
||||
|
||||
#include <cassert>
|
||||
#include <cmath>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include <TSAXParser.h>
|
||||
#include <TMath.h>
|
||||
|
||||
#include "PDepthProfile.h"
|
||||
|
||||
ClassImp(PDepthProfileGlobal)
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Constructor (PDepthProfileGlobal)
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>Constructor. Reads the necessary rge-files based on the depth_profile_startup.xml
|
||||
*/
|
||||
PDepthProfileGlobal::PDepthProfileGlobal()
|
||||
{
|
||||
// load all the TRIM.SP rge-files
|
||||
fRgeHandler = new PRgeHandler("./depth_profile_startup.xml");
|
||||
if (!fRgeHandler->IsValid()) {
|
||||
std::cout << std::endl << ">> PDepthProfileGlobal::PDepthProfileGlobal **PANIC ERROR**";
|
||||
std::cout << std::endl << ">> rge data handler too unhappy. Will terminate unfriendly, sorry.";
|
||||
std::cout << std::endl;
|
||||
fValid = false;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Destructor (PDepthProfileGlobal)
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>Clean up the rge-handler.
|
||||
*/
|
||||
PDepthProfileGlobal::~PDepthProfileGlobal()
|
||||
{
|
||||
if (fRgeHandler) {
|
||||
delete fRgeHandler;
|
||||
fRgeHandler = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
|
||||
ClassImp(PDepthProfile)
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Destructor (PDepthProfile)
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>Clean up the global part.
|
||||
*/
|
||||
PDepthProfile::~PDepthProfile()
|
||||
{
|
||||
if ((fDepthProfileGlobal != 0) && fInvokedGlobal) {
|
||||
delete fDepthProfileGlobal;
|
||||
fDepthProfileGlobal = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// SetGlobalPart (public)
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
* <b>return:</b>
|
||||
*
|
||||
* \param globalPart
|
||||
* \param idx
|
||||
*/
|
||||
void PDepthProfile::SetGlobalPart(std::vector<void*> &globalPart, UInt_t idx)
|
||||
{
|
||||
fIdxGlobal = static_cast<Int_t>(idx);
|
||||
|
||||
if ((Int_t)globalPart.size() <= fIdxGlobal) {
|
||||
fDepthProfileGlobal = new PDepthProfileGlobal();
|
||||
if (fDepthProfileGlobal == nullptr) {
|
||||
fValid = false;
|
||||
std::cerr << std::endl << ">> PDepthProfile::SetGlobalPart(): **ERROR** Couldn't invoke global user function object, sorry ..." << std::endl;
|
||||
} else if (!fDepthProfileGlobal->IsValid()) {
|
||||
fValid = false;
|
||||
std::cerr << std::endl << ">> PDepthProfile::SetGlobalPart(): **ERROR** initialization of global user function object failed, sorry ..." << std::endl;
|
||||
} else {
|
||||
fValid = true;
|
||||
fInvokedGlobal = true;
|
||||
globalPart.resize(fIdxGlobal+1);
|
||||
globalPart[fIdxGlobal] = dynamic_cast<PDepthProfileGlobal*>(fDepthProfileGlobal);
|
||||
}
|
||||
} else {
|
||||
fValid = true;
|
||||
fDepthProfileGlobal = (PDepthProfileGlobal*)globalPart[fIdxGlobal];
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// GlobalPartIsValid (public)
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
* <b>return:</b>
|
||||
*/
|
||||
Bool_t PDepthProfile::GlobalPartIsValid() const
|
||||
{
|
||||
return (fValid && fDepthProfileGlobal->IsValid());
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// operator()
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>Yet to be implemented.
|
||||
*/
|
||||
Double_t PDepthProfile::operator()(Double_t t, const std::vector<Double_t> ¶m) const
|
||||
{
|
||||
return 0.0;
|
||||
}
|
||||
|
10
src/external/DepthProfile/src/PDepthProfile.pc.in
vendored
Normal file
10
src/external/DepthProfile/src/PDepthProfile.pc.in
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
prefix=@prefix@
|
||||
exec_prefix=@exec_prefix@
|
||||
libdir=@libdir@
|
||||
includedir=@includedir@
|
||||
|
||||
Name: PDepthProfile
|
||||
Description: C++ shared library providing the depth profile fitter class
|
||||
Version: @P_DEPTH_PROFILE_VERSION@
|
||||
Libs: -L${libdir} -l@P_DEPTH_PROFILE_LIBRARY_NAME@
|
||||
Cflags: -I${includedir}
|
Loading…
x
Reference in New Issue
Block a user