Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make topoclustering work with the new theta-module readout for the FCC-ee calorimeter #13

Merged
Merged
Show file tree
Hide file tree
Changes from 32 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
a38b04a
add calculation of neighbours for theta-module mered readout
giovannimarchiori Sep 12, 2023
ebcf565
update scripts to create neighbours map and noise map
giovannimarchiori Sep 13, 2023
fd8fda2
update numPlanes
giovannimarchiori Sep 18, 2023
f6e7af4
add event display tool for debugging
giovannimarchiori Sep 27, 2023
16fab5a
add event display tool for debugging
giovannimarchiori Sep 27, 2023
f3faab9
add comments
giovannimarchiori Sep 27, 2023
9e2463c
add comments
giovannimarchiori Sep 27, 2023
9b0a942
add noise file for theta readout
giovannimarchiori Sep 27, 2023
222adb0
restore noise_map and create new version for theta readout
giovannimarchiori Sep 27, 2023
869e38d
update gaudi steering file for thetamodule merged readout
giovannimarchiori Sep 27, 2023
6cdf856
add little script to print neighbours
giovannimarchiori Sep 27, 2023
fb7e66c
take into account changes to seg class
giovannimarchiori Sep 27, 2023
90bf8bd
use proper cell positioning class
giovannimarchiori Sep 27, 2023
9b15e7d
remove warnings
giovannimarchiori Sep 27, 2023
aaad22c
small fix to theta range
giovannimarchiori Sep 28, 2023
90ad9e3
remove a warning
giovannimarchiori Sep 28, 2023
ca65a61
improve event display
giovannimarchiori Sep 29, 2023
7856ab3
update event display, add comments to the code
giovannimarchiori Sep 29, 2023
c7100cf
update event display, add comments to the code
giovannimarchiori Sep 29, 2023
f2a6d77
update sampling fractions in scripts using theta-module merged readou…
giovannimarchiori Sep 29, 2023
4de268e
move ReadNoiseFromFileTool for theta-based readout to new tool in FCC…
giovannimarchiori Sep 29, 2023
10ed2a3
add code to dump GDML file of detector model and convert it to ROOT f…
giovannimarchiori Oct 6, 2023
23f72ef
update sampling and leakage corrections
giovannimarchiori Oct 7, 2023
dc8137b
update sampling fraction for latest model with 1536 modules
giovannimarchiori Oct 9, 2023
4807a70
update sampling fraction for latest model with 1536 modules
giovannimarchiori Oct 9, 2023
af589b0
add property for including or not diagonal neighbours
giovannimarchiori Oct 9, 2023
97489d2
move event display to its own package
giovannimarchiori Oct 16, 2023
db9b4a0
update README for theta-based segmentation and fix capacitance calcul…
giovannimarchiori Oct 17, 2023
23b93aa
set readout use for topoclustering in default scripts not using the t…
giovannimarchiori Oct 19, 2023
08c4b8d
update traces per layer to version where we read out everything from …
giovannimarchiori Oct 23, 2023
34a50be
fix crash
giovannimarchiori Oct 24, 2023
dc99d4a
fix capacitance calculation for arbbitrary merging of cells
giovannimarchiori Oct 24, 2023
a324147
fix double counting of merged theta cells impact on shield capacitance
giovannimarchiori Oct 25, 2023
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
44 changes: 44 additions & 0 deletions FCCSW_ecal/neighbours_theta.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import os
from Gaudi.Configuration import *

# Detector geometry
from Configurables import GeoSvc
geoservice = GeoSvc("GeoSvc")
# if FCC_DETECTORS is empty, this should use relative path to working directory
path_to_detector = os.environ.get("FCCDETECTORS", "")
print(path_to_detector)
detectors_to_use=[
'Detector/DetFCCeeIDEA-LAr/compact/FCCee_DectMaster_thetamodulemerged.xml',
#'Detector/DetFCCeeIDEA-LAr/compact/FCCee_DectMaster.xml',
]

# prefix all xmls with path_to_detector
geoservice.detectors = [os.path.join(path_to_detector, _det) for _det in detectors_to_use]
geoservice.OutputLevel = INFO

# Geant4 service
# Configures the Geant simulation: geometry, physics list and user actions
from Configurables import CreateFCCeeCaloNeighbours
neighbours = CreateFCCeeCaloNeighbours("neighbours",
outputFileName = "neighbours_map_barrel_thetamodulemerged.root",
readoutNamesModuleTheta = ["ECalBarrelModuleThetaMerged"],
# readoutNamesModuleTheta = ["ECalBarrelModuleThetaMerged2"],
systemNamesModuleTheta = ["system"],
systemValuesModuleTheta = [4],
activeFieldNamesModuleTheta = ["layer"],
activeVolumesNumbers = [12],
#activeVolumesTheta = [1.2524, 1.2234, 1.1956, 1.1561, 1.1189, 1.0839, 1.0509, 0.9999, 0.9534, 0.91072],
includeDiagonalCells = False,
readoutNamesVolumes = [],
connectBarrels = False,
OutputLevel = DEBUG)

# ApplicationMgr
from Configurables import ApplicationMgr
ApplicationMgr( TopAlg = [],
EvtSel = 'NONE',
EvtMax = 1,
# order is important, as GeoSvc is needed by G4SimSvc
ExtSvc = [geoservice, neighbours],
OutputLevel=INFO
)
75 changes: 75 additions & 0 deletions FCCSW_ecal/noise_map_theta.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
from Gaudi.Configuration import *
# Detector geometry
from Configurables import GeoSvc
geoservice = GeoSvc("GeoSvc")
# if FCC_DETECTORS is empty, this should use relative path to working directory
import os
path_to_detector = os.environ.get("FCCDETECTORS", "")
print(path_to_detector)
detectors_to_use=[
'Detector/DetFCCeeIDEA-LAr/compact/FCCee_DectMaster_thetamodulemerged.xml'
]
# prefix all xmls with path_to_detector
geoservice.detectors = [os.path.join(path_to_detector, _det) for _det in detectors_to_use]
geoservice.OutputLevel = INFO

ecalBarrelReadoutName = "ECalBarrelModuleThetaMerged"
#hcalBarrelReadoutName = "ECalBarrelPhiEta"
hcalBarrelReadoutName = "HCalBarrelReadout"
BarrelNoisePath = os.environ['FCCBASEDIR']+"/LAr_scripts/data/elecNoise_ecalBarrelFCCee_theta.root"
ecalBarrelNoiseHistName = "h_elecNoise_fcc_"

from Configurables import CellPositionsECalBarrelModuleThetaSegTool
ECalBcells = CellPositionsECalBarrelModuleThetaSegTool("CellPositionsECalBarrel",
readoutName = ecalBarrelReadoutName)
# OutputLevel = DEBUG)
#print(ECalBcells)

from Configurables import CreateFCCeeCaloNoiseLevelMap, ReadNoiseFromFileTool, ReadNoiseVsThetaFromFileTool
ECalNoiseTool = ReadNoiseVsThetaFromFileTool("ReadNoiseFromFileToolECal",
useSegmentation = False,
cellPositionsTool = ECalBcells,
readoutName = ecalBarrelReadoutName,
noiseFileName = BarrelNoisePath,
elecNoiseHistoName = ecalBarrelNoiseHistName,
setNoiseOffset = False,
activeFieldName = "layer",
addPileup = False,
numRadialLayers = 12,
scaleFactor = 1/1000., #MeV to GeV
OutputLevel = INFO)

HCalNoiseTool = ReadNoiseFromFileTool("ReadNoiseFromFileToolHCal",
readoutName = hcalBarrelReadoutName,
noiseFileName = BarrelNoisePath,
elecNoiseHistoName = ecalBarrelNoiseHistName,
setNoiseOffset = False,
activeFieldName = "layer",
addPileup = False,
numRadialLayers = 12,
scaleFactor = 1/1000., #MeV to GeV
OutputLevel = INFO)

noisePerCell = CreateFCCeeCaloNoiseLevelMap("noisePerCell",
ECalBarrelNoiseTool = ECalNoiseTool,
ecalBarrelSysId = 4,
HCalBarrelNoiseTool = HCalNoiseTool,
readoutNamesModuleTheta=[ecalBarrelReadoutName],
systemNamesModuleTheta=["system"],
systemValuesModuleTheta=[4],
activeFieldNamesModuleTheta=["layer"],
activeVolumesNumbers = [12],
#activeVolumesEta = [1.2524, 1.2234, 1.1956, 1.1561, 1.1189, 1.0839, 1.0509, 0.9999, 0.9534, 0.91072],
readoutNamesVolumes = [],
outputFileName = "cellNoise_map_electronicsNoiseLevel_thetamodulemerged.root",
OutputLevel = DEBUG)

# ApplicationMgr
from Configurables import ApplicationMgr
ApplicationMgr( TopAlg = [],
EvtSel = 'NONE',
EvtMax = 1,
# order is important, as GeoSvc is needed by G4SimSvc
ExtSvc = [geoservice, noisePerCell],
OutputLevel=INFO
)
75 changes: 75 additions & 0 deletions FCCSW_ecal/printNeighbours.C
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
TTree* T = nullptr;
const std::string filename = "neighbours_map_barrel_thetamodulemerged.root";
const std::string treename = "neighbours";
ULong64_t cID;
std::vector<unsigned long> *neighbours=0;

// HELPER FUNCTIONS

// extract layer number from cellID
ULong_t Layer(ULong_t cellID) {
const ULong_t mask = (1<<8) -1;
return (cellID >> 11) & mask;
}

// extract module number from cellID
ULong_t Module(ULong_t cellID) {
const ULong_t mask = (1<<11) -1;
return (cellID >> 19) & mask;
}

// extract theta bin from cellID
ULong_t ThetaBin(ULong_t cellID) {
const ULong_t mask = (1<<10) -1;
return (cellID >> 30) & mask;
}

void printCell(ULong_t cellID) {
cout << "cellID: " << cellID << endl;
cout << "Layer: " << Layer(cellID) << endl;
cout << "Theta bin: " << ThetaBin(cellID) << endl;
cout << "Module: " << Module(cellID) << endl;
cout << endl;
}

void LoadNeighboursMap() {
if (T==nullptr) {
TFile* f = TFile::Open(filename.c_str(),"READ");
T = (TTree*) f->Get(treename.c_str());
T->SetBranchAddress("cellId", &cID);
T->SetBranchAddress("neighbours", &neighbours);
}
}

void printCellAndNeighbours(ULong64_t iEntry) {
T->GetEntry(iEntry);
cout << "=================================================" << endl;
cout << endl;
printCell(cID);
cout << "Neighbours: " << endl << endl;
for (unsigned int i=0; i<neighbours->size(); i++) {
printCell(neighbours->at(i));
}
cout << "=================================================" << endl;
}

void printNeighboursOfCell(ULong_t cellID) {
LoadNeighboursMap();
for (ULong64_t iEntry=0; iEntry<T->GetEntries(); iEntry++) {
T->GetEntry(iEntry);
if (cID == cellID) {
printCellAndNeighbours(iEntry);
return;
}
}
cout << "CellID not found" << endl;
}


void printNeighbours(int n=10) {
LoadNeighboursMap();
for (int i=0; i<n; i++) {
int entry = (int) gRandom->Uniform(T->GetEntries());
printCellAndNeighbours(entry);
}
}
1 change: 1 addition & 0 deletions FCCSW_ecal/runClueAndTopoAndSlidingWindowAndCaloSim.py
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,7 @@
#positionsHECTool = HECcells,
#positionsEMFwdTool = ECalFwdcells,
#positionsHFwdTool = HCalFwdcells,
readoutName = ecalBarrelReadoutNamePhiEta,
seedSigma = 4,
neighbourSigma = 2,
lastNeighbourSigma = 0,
Expand Down
1 change: 1 addition & 0 deletions FCCSW_ecal/runTopoAndSlidingWindowAndCaloSim.py
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,7 @@
#positionsHECTool = HECcells,
#positionsEMFwdTool = ECalFwdcells,
#positionsHFwdTool = HCalFwdcells,
readoutName = ecalBarrelReadoutNamePhiEta,
seedSigma = 4,
neighbourSigma = 2,
lastNeighbourSigma = 0,
Expand Down
Loading