Skip to content
Snippets Groups Projects
Commit 5a1fb497 authored by brusale's avatar brusale
Browse files

run merging from COCOA output

parent d5520adc
Branches
No related tags found
No related merge requests found
#include "interface/ROOTLoader.h"
#include "interface/SimHistoryTool.h"
#include "interface/SimClusterMerger.h"
#include <memory>
int main() {
std::unique_ptr<ROOTLoader> rootLoader = std::make_unique<ROOTLoader>("/ceph/abrusamolino/PFTruthSamples/COCOATests/SingleElectron_Geant4_FlatEtaPt.root", "Out_Tree");
const std::vector<HitsSoA> hitsSoA = rootLoader->getHitsSoA();
std::vector<SimShowerCollection> simShowers = rootLoader->getSimShowers();
std::cout << __FILE__ << " " << __LINE__ << std::endl;
const std::vector<SimTrackCollection> simTracks = rootLoader->getSimTracks();
const std::vector<SimVertexCollection> simVertices = rootLoader->getSimVertices();
Long64_t nEvents = rootLoader->nEvents();
std::vector<SimShowerCollection> mergedSimShowers;
mergedSimShowers.resize(nEvents);
for (unsigned int i = 0; i < nEvents; ++i) {
const SimHistoryTool shtools(simTracks[i], simVertices[i]);
SimClusterMerger scMerger(&hitsSoA[i], &shtools);
std::vector<std::vector<size_t>> idx;
std::vector<SimShower> mergedSimShower = scMerger.merge(simShowers[i], idx);
mergedSimShowers[i].reserve(mergedSimShower.size());
mergedSimShowers[i] = mergedSimShower;
mergedSimShower.clear();
}
rootLoader->saveMergedSimShowers(mergedSimShowers);
}
\ No newline at end of file
#!/bin/sh
usage="$(basename "$0") [-h] [-r] [-g] [-m] NEVENTS NWORKERS -- script to run the workflow
usage="$(basename "$0") [-h] [-r] [-g] [-m] NWORKERS NEVENTS -- script to run the workflow
where:
-h show this help text
......@@ -34,14 +34,14 @@ parse_yml() {
python3 -c "import yaml; print(yaml.safe_load(open('data/config.yml')))"
}
print_step "Sourcing the LCG environment"
print_step "Sourcing the LCG stack"
source /cvmfs/sft.cern.ch/lcg/views/LCG_105/x86_64-el9-gcc11-opt/setup.sh
export CONFIG_DIRECTORY="/ceph/abrusamolino/PFTruth/config"
export CSV_DIRECTORY="/ceph/abrusamolino/PFTruth/csv"
export CONFIG_DIRECTORY="/ceph/abrusamolino/PFTruth/config-test"
export CSV_DIRECTORY="/ceph/abrusamolino/PFTruth/csv-test"
NEVENTS=$2
NWORKERS=$3
NWORKERS=${2:-4}
NEVENTS=${3:-0}
CURRENT_DIR=$(pwd)
......@@ -54,16 +54,16 @@ fi
cd $CURRENT_DIR
# Compile the project if executable does not exist
if [ ! -f "pftruth" ] || $recompile ; then
if $recompile ; then
print_step "Cleaning up before recompiling"
make clean -s
print_step "Recompiling"
make -s
make -s -j $NWORKERS
fi
if $run_merging ; then
print_step "Running the cluster merging"
./pftruth
./COCOATruth /ceph/abrusamolino/PFTruthSamples/COCOATests/SingleElectron_Geant4_FlatEtaPt.root
fi
print_step "Done"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment