Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
bccdc30
Added reading pulse shape from txt file
Aug 7, 2024
c12fed2
Initial version of energy fluctuation
Aug 1, 2024
4b4b33a
Added calculation to charge division
Aug 6, 2024
b8cd9ad
Changed units and added normalisation to total loss
Aug 7, 2024
0450046
Get max value of pulse
Aug 7, 2024
6af75a6
Corrected length calculation and added energy fluct unit
Aug 8, 2024
2b3759e
Added drift position for segments and seperate class for digitization
Aug 8, 2024
b6cc2ab
Coverted to local coordinates
Aug 15, 2024
11d9fde
Added cms method of diffusion
Aug 20, 2024
be2a422
Added calculation of Efield
Aug 28, 2024
13accb1
Get number of affected strips from induced charge
Aug 29, 2024
1bc9731
Return the integrated signal
Aug 30, 2024
2695913
Correction to charge division, module width, and cms drift time
Sep 3, 2024
0c2582b
Initial commit of parameters file
Sep 6, 2024
78cf3bc
Added pulse shape response
Sep 6, 2024
7990889
Some changes
Oct 2, 2024
05fc126
added to parameter file
Dec 17, 2024
feca7ec
Added ADC conversion and FED response
Jan 8, 2025
d022a19
Added coupling class
Jan 10, 2025
c1344eb
Removed pulse response and added coupling option
Jan 13, 2025
6236e4b
Added FED clustering algorithms
Jan 13, 2025
3aeb049
Added generation of gaussian noise for VR and for ZS mode
Jan 14, 2025
94dc943
Added comments
Jan 15, 2025
dd0c9ec
Moved digitisation classes to seperate folder
Jan 15, 2025
a09d079
Added noise classes
Jan 15, 2025
9e7359c
Changed return type of digitisation
Jan 21, 2025
ff6c5e2
Added CM Noise for APVs
Jan 22, 2025
9524eb9
Returned as a map of strips and ADC
Jan 22, 2025
d97a2fc
Incorporated FED response and fixed algorithms
Jan 23, 2025
d69d757
Range of FED ADC
Jan 26, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 14 additions & 13 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# The name of our project is "ShipRoot". CMakeLists files in this project can
# refer to the root source directory of the project as ${ShipRoot_SOURCE_DIR}
# or as ${CMAKE_SOURCE_DIR} and to the root binary directory of the project as
# refer to the root source directory of the project as ${ShipRoot_SOURCE_DIR}
# or as ${CMAKE_SOURCE_DIR} and to the root binary directory of the project as
# ${ShipRoot_BINARY_DIR} or ${CMAKE_BINARY_DIR}.
# This difference is important for the base classes which are in FAIRROOT
# This difference is important for the base classes which are in FAIRROOT
# and ShipRoot.

# Check if cmake has the required version
Expand All @@ -18,7 +18,7 @@ foreach(p
endforeach()

# Set name of our project to "ShipRoot". Has to be done
# after check of cmake version since this is a new feature
# after check of cmake version since this is a new feature
project(ShipRoot)

FIND_PATH(FAIRBASE NAMES FairRun.h PATHS
Expand All @@ -38,7 +38,7 @@ Else (FAIRBASE)
SET(FAIRROOTPATH $ENV{FAIRROOTPATH})
EndIf (FAIRBASE)

# where to look first for cmake modules, before ${CMAKE_ROOT}/Modules/
# where to look first for cmake modules, before ${CMAKE_ROOT}/Modules/
# is checked
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules")
set(CMAKE_MODULE_PATH "${FAIRROOTPATH}/share/fairbase/cmake/modules" ${CMAKE_MODULE_PATH})
Expand Down Expand Up @@ -106,14 +106,14 @@ CHECK_OUT_OF_SOURCE_BUILD()
# message
IF(NOT UNIX)
MESSAGE(FATAL_ERROR "You're not on an UNIX system. The project was up to now only tested on UNIX systems, so we break here. If you want to go on please edit the CMakeLists.txt in the source directory.")
ENDIF(NOT UNIX)
ENDIF(NOT UNIX)

# Check if the external packages are installed into a separate install
# directory
CHECK_EXTERNAL_PACKAGE_INSTALL_DIR()

# Set the build type. Possibilities are None, Debug, Release,
# RelWithDebInfo and MinSizeRel
# Set the build type. Possibilities are None, Debug, Release,
# RelWithDebInfo and MinSizeRel
#SET(CMAKE_BUILD_TYPE Debug)

# searches for needed packages
Expand All @@ -124,6 +124,7 @@ CHECK_EXTERNAL_PACKAGE_INSTALL_DIR()
find_package(ROOT 6.10.06 REQUIRED)
find_package2(PUBLIC Pythia8 REQUIRED)
find_package2(PUBLIC EvtGen REQUIRED)

# (GENERATORS REQUIRED)
find_package2(PUBLIC GEANT3)
find_package2(PUBLIC GEANT4)
Expand Down Expand Up @@ -157,8 +158,8 @@ ENDIF(DEFINED $ENV{GSL_ROOT})

Message("-- Looking for Boost ...")
# If an older version of boost is found both of the variables below are
# cached and in a second cmake run, a good boost version is found even
# if the version is to old.
# cached and in a second cmake run, a good boost version is found even
# if the version is to old.
# To overcome this problem both variables are cleared before checking
# for boost.
Unset(Boost_INCLUDE_DIR CACHE)
Expand Down Expand Up @@ -186,8 +187,8 @@ add_compile_definitions(PYTHIA8_V=${ver})
# compiler will not generate any warnings. This is usefull since one is only
# interested about warnings from the own project. SYSTEM_INCLUDE_DIRECTORIES
# is defined in FairMacros.cmake. In the moment the defined directories are
# the root and boost include directories.
Set(SYSTEM_INCLUDE_DIRECTORIES
# the root and boost include directories.
Set(SYSTEM_INCLUDE_DIRECTORIES
${SYSTEM_INCLUDE_DIRECTORIES}
${BASE_INCLUDE_DIRECTORIES}
${FAIRLOGGER_INCLUDE_DIR}
Expand Down Expand Up @@ -223,7 +224,7 @@ SET(LD_LIBRARY_PATH ${CBMLIBDIR} ${LD_LIBRARY_PATH})
# Message("Set default install path ...")
#ENDIF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)

install(DIRECTORY geometry DESTINATION pnd_install
install(DIRECTORY geometry DESTINATION pnd_install
PATTERN ".svn" EXCLUDE
)

Expand Down
19 changes: 18 additions & 1 deletion shipLHC/AdvTargetHit.cxx
Original file line number Diff line number Diff line change
@@ -1,10 +1,24 @@
#include "AdvTargetHit.h"

#include "AdvTargetPoint.h"
#include "digitisation/AdvSignal.h"
#include "digitisation/AdvDigitisation.h"
#include "FairLogger.h"
#include "TGeoBBox.h"
#include "TGeoManager.h"
#include "TGeoNavigator.h"
#include "TROOT.h"
#include "TRandom.h"
#include "TVector3.h"
#include "TStopwatch.h"

#include <TDatabasePDG.h>
#include <iomanip>
#include <typeinfo>
#include <iostream>
#include <string>
#include <map>
using std::cout;
using std::endl;

// ----- Default constructor -------------------------------------------
AdvTargetHit::AdvTargetHit()
Expand All @@ -29,7 +43,10 @@ AdvTargetHit::AdvTargetHit(Int_t detID)
AdvTargetHit::AdvTargetHit(Int_t detID, const std::vector<AdvTargetPoint*>& V)
: SndlhcHit(detID)
{
AdvDigitisation advdigi{};
fDigitisedHit = advdigi.digirunoutput(detID, V);
flag = true;

for (Int_t i = 0; i < 16; i++) {
fMasked[i] = kFALSE;
}
Expand Down
10 changes: 9 additions & 1 deletion shipLHC/AdvTargetHit.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,15 @@

#include "SiSensor.h"
#include "SndlhcHit.h"
#include "TArrayD.h"
#include "TVector3.h"
#include "digitisation/AdvSignal.h"
#include <map>

class AdvTargetPoint;

class TArrayD;

class AdvTargetHit : public SndlhcHit
{
public:
Expand All @@ -24,6 +30,7 @@ class AdvTargetHit : public SndlhcHit
bool isValid() const { return flag; }
bool isMasked(Int_t i) const { return fMasked[i]; }
void SetMasked(Int_t i) { fMasked[i] = kTRUE; }
std::map<std::string, std::vector<Int_t>> GetHit() { return fDigitisedHit; }
int constexpr GetStation() { return fDetectorID >> 17; }
int constexpr GetPlane() { return (fDetectorID >> 16) % 2; } // 0 is X-plane, 1 is Y-pane
int constexpr GetRow() { return (fDetectorID >> 13) % 8; }
Expand All @@ -32,11 +39,12 @@ class AdvTargetHit : public SndlhcHit
int constexpr GetStrip() { return (fDetectorID) % 1024; }
int constexpr GetModule() { return advsnd::target::columns * GetRow() + 1 + GetColumn(); }
bool constexpr isVertical() { return GetPlane() == 0; };


private:
bool flag; ///< flag
bool fMasked[16]; /// masked signal

std::map<std::string, std::vector<Int_t>> fDigitisedHit;
ClassDef(AdvTargetHit, 1);
};

Expand Down
11 changes: 10 additions & 1 deletion shipLHC/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ set(INCLUDE_DIRECTORIES
${BASE_INCLUDE_DIRECTORIES}
${CMAKE_SOURCE_DIR}/shipdata
${CMAKE_SOURCE_DIR}/shipLHC
${CMAKE_SOURCE_DIR}/shipLHC/digitisation
${CMAKE_SOURCE_DIR}/shipLHC/external/clhep/include
${CMAKE_SOURCE_DIR}/veto
${CMAKE_SOURCE_DIR}/genfit/core/include
${CMAKE_SOURCE_DIR}/genfit/trackReps/include
Expand All @@ -23,7 +25,7 @@ ${ROOT_LIBRARY_DIR}
${FAIRROOT_LIBRARY_DIR}

)

link_directories( ${LINK_DIRECTORIES})

set(SRCS
Expand All @@ -49,6 +51,13 @@ AdvMuFilter.cxx
AdvMuFilterPoint.cxx
SNDLHCEventHeader.cxx
sndRecoTrack.cxx
digitisation/ChargeDivision.cxx
digitisation/ChargeDrift.cxx
digitisation/InducedCharge.cxx
digitisation/FrontendDriver.cxx
digitisation/StripNoise.cxx
digitisation/SiG4UniversalFluctuation.cxx
digitisation/AdvDigitisation.cxx
)

Set(HEADERS )
Expand Down
66 changes: 66 additions & 0 deletions shipLHC/digitisation/AdvDigitisation.cxx
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
#include "AdvDigitisation.h"
#include "AdvTargetPoint.h"
#include "ChargeDivision.h"
#include "ChargeDrift.h"
#include "InducedCharge.h"
#include "FrontendDriver.h"
#include "StripNoise.h"
#include "EnergyFluctUnit.h"
#include "SurfaceSignal.h"
#include "AdvSignal.h"
#include "SiDigiParameters.h"

#include "TFile.h"
#include "TTree.h"
#include "TVector3.h"
#include "TStopwatch.h"

#include <TSystem.h>
#include <iostream>
#include <vector>
#include <fstream>
#include <map>
#include <algorithm>
using namespace std;

// Running the digitisation

/* To be included :
Saturation of FED dynamic range depending on mode
Add noise
Add FED modes */

AdvDigitisation::AdvDigitisation() {}

std::map<std::string, std::vector<Int_t>> AdvDigitisation::digirunoutput(Int_t detID, const std::vector<AdvTargetPoint *> &V)
{
// Charge Division
ChargeDivision chargedivision{};
std::vector<EnergyFluctUnit> EnergyLossVector = chargedivision.Divide(detID, V);

//Charge Drift
ChargeDrift chargedrift{};
std::vector<SurfaceSignal> DiffusionSignal = chargedrift.Drift(EnergyLossVector);

//Induced Charge on strips
InducedCharge inducedcharge{};
AdvSignal ResponseSignal = inducedcharge.IntegrateCharge(DiffusionSignal);

//FED Response
FrontendDriver frontenddriver{};
AdvSignal FEDResponseSignal = frontenddriver.FEDResponse(ResponseSignal);

//Creating map of hit
std::map<std::string, std::vector<Int_t>> DigitisedHit;
std::vector<Double_t> Charge = FEDResponseSignal.getIntegratedSignal();
std::vector<Int_t> Strips = FEDResponseSignal.getStrips();
std::vector<Int_t> ADC(Charge.size());
std::transform(Charge.begin(), Charge.end(), ADC.begin(), [](Double_t x) {
if (x>0){return (int)x;}
else {return 0;}
});
DigitisedHit["Strips"] = Strips;
DigitisedHit["ADC"] = ADC;

return DigitisedHit;
}
52 changes: 52 additions & 0 deletions shipLHC/digitisation/AdvDigitisation.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#ifndef SHIPLHC_ADVDIGITISATION_H_
#define SHIPLHC_ADVDIGITISATION_H_

#include "AdvTargetPoint.h"
#include "AdvSignal.h"
#include "TVector3.h"
#include "TGeoNavigator.h"

#include "FairGeoBuilder.h"
#include "FairGeoInterface.h"
#include "FairGeoLoader.h"
#include "FairGeoMedia.h"
#include "FairGeoMedium.h"
#include "FairGeoNode.h"
#include "FairGeoTransform.h"
#include "FairGeoVolume.h"
#include "FairRootManager.h"
#include "FairVolume.h"
#include "ShipDetectorList.h"
#include "ShipStack.h"
#include "ShipUnit.h"
#include "SiSensor.h"
#include "TGeoArb8.h"
#include "TGeoBBox.h"
#include "TGeoCompositeShape.h"
#include "TGeoGlobalMagField.h"
#include "TGeoManager.h"
#include "TGeoMaterial.h"
#include "TGeoMedium.h"
#include "TGeoSphere.h"
#include "TGeoTrd1.h"
#include "TGeoTrd2.h"
#include "TGeoTube.h"
#include "TGeoUniformMagField.h"
#include "TParticle.h"
#include "TString.h" // for TString
#include "TVector3.h"
#include "TVirtualMC.h"

#include <iostream>
#include <vector>
using namespace std;



class AdvDigitisation
{
public:
AdvDigitisation();
std::map<std::string, std::vector<Int_t>> digirunoutput(Int_t detID, const std::vector<AdvTargetPoint*>& V);
};
#endif
33 changes: 33 additions & 0 deletions shipLHC/digitisation/AdvSignal.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#ifndef SHIPLHC_ADVSIGNAL_H_
#define SHIPLHC_ADVSIGNAL_H_

#include "TVector3.h"

#include <iostream>

class AdvSignal
{
public:
AdvSignal()
: Strips_(), IntegratedSignal_()
{
}

AdvSignal(std::vector<Int_t> Strips, std::vector<Double_t> IntegratedSignal)
: Strips_(Strips)
, IntegratedSignal_(IntegratedSignal)
{
}

std::vector<Int_t> getStrips() const { return Strips_; }
std::vector<Double_t> getIntegratedSignal() const { return IntegratedSignal_; }

void setStrips(std::vector<Int_t> value) { Strips_ = value; }
void setIntegratedSignal(std::vector<Double_t> value) { IntegratedSignal_ = value; }

private:
std::vector<Int_t> Strips_;
std::vector<Double_t> IntegratedSignal_;
};

#endif // SHIPLHC_ADVSIGNAL_H_
Loading