Skip to content
Snippets Groups Projects
Commit 33d81a59 authored by Dave Casper's avatar Dave Casper
Browse files

Merge branch 'master' into 'master'

SimHitAlg

See merge request faser/calypso!94
parents a67bc80d 6faf6f8c
No related branches found
No related tags found
No related merge requests found
......@@ -22,3 +22,4 @@
tmp.*
.idea/**
cmake-debug-build/**
.vscode/**
......@@ -25,7 +25,7 @@ build_image:
- mkdir build
- cd build
- set +e && source ${ATLAS_LOCAL_ROOT_BASE}/user/atlasLocalSetup.sh; set -e
- set +e && asetup --input=../../calypso/asetup.faser master,latest,Athena; set -e
- set +e && asetup --input=../../calypso/asetup.faser Athena,22.0.18; set -e
- cmake ../../calypso
- make -j 3
artifacts:
......@@ -41,7 +41,7 @@ test_unittest:
- yum -y install man
- cd build
- set +e && source ${ATLAS_LOCAL_ROOT_BASE}/user/atlasLocalSetup.sh; set -e
- set +e && asetup --input=../../calypso/asetup.faser master,latest,Athena; set -e
- set +e && asetup --input=../../calypso/asetup.faser Athena,22.0.18; set -e
- set +e && source `find . -name 'setup.sh'`; set -e
- ctest -j12
dependencies:
......
{
"configurations": [
{
"name": "Linux",
"includePath": [
"${workspaceFolder}/**"
],
"defines": [],
"compilerPath": "/cvmfs/sft.cern.ch/lcg/releases/gcc/8.3.0-cebb0/x86_64-centos7/bin/gcc",
"cStandard": "c99",
"cppStandard": "c++17",
"intelliSenseMode": "clang-x64",
"compileCommands": "${workspaceFolder}/build/compile_commands.json"
}
],
"version": 4
}
\ No newline at end of file
......@@ -3,7 +3,7 @@ atlas_subdir( SimHitExample )
atlas_add_component( SimHitExample
src/SimHitAlg.cxx
src/components/SimHitExample_entries.cxx
LINK_LIBRARIES AthenaBaseComps GeneratorObjects TrackerSimEvent
LINK_LIBRARIES AthenaBaseComps GeneratorObjects TrackerSimEvent ScintSimEvent
)
atlas_install_joboptions( share/*.py )
\ No newline at end of file
......@@ -18,12 +18,33 @@ StatusCode SimHitAlg::initialize()
ATH_CHECK(histSvc()->regHist("/HIST/modulesSide1", m_moduleSide1));
ATH_CHECK(histSvc()->regHist("/HIST/modulesSide2", m_moduleSide2));
m_plate_preshower = new TH2D("plate", "Scint Hit Plate", 3, -1, 1, 4, 0, 1 );
m_plate_trigger = new TH2D("plate", "Scint Hit Plate", 3, -1, 1, 4, 0, 1 );
m_plate_veto = new TH2D("plate", "Scint Hit Plate", 3, -1, 1, 4, 0, 1 );
ATH_CHECK(histSvc()->regHist("/HIST/plate_preshower", m_plate_preshower));
ATH_CHECK(histSvc()->regHist("/HIST/plate_trigger", m_plate_trigger));
ATH_CHECK(histSvc()->regHist("/HIST/plate_veto", m_plate_veto));
// initialize data handle keys
ATH_CHECK( m_mcEventKey.initialize() );
ATH_CHECK( m_faserSiHitKey.initialize() );
//Sav things
ATH_CHECK( m_preshowerHitKey.initialize() );
ATH_CHECK( m_triggerHitKey.initialize() );
ATH_CHECK( m_vetoHitKey.initialize() );
ATH_MSG_INFO( "Using GenEvent collection with key " << m_mcEventKey.key());
ATH_MSG_INFO( "Using Faser SiHit collection with key " << m_faserSiHitKey.key());
ATH_MSG_INFO( "Using ScintHit collection with key " << m_preshowerHitKey.key());
ATH_MSG_INFO( "Using ScintHit collection with key " << m_triggerHitKey.key());
ATH_MSG_INFO( "Using ScintHit collection with key " << m_vetoHitKey.key());
return StatusCode::SUCCESS;
}
StatusCode SimHitAlg::execute()
......@@ -36,6 +57,14 @@ StatusCode SimHitAlg::execute()
SG::ReadHandle<FaserSiHitCollection> h_siHits(m_faserSiHitKey);
ATH_MSG_INFO("Read FaserSiHitCollection with " << h_siHits->size() << " hits");
SG::ReadHandle<ScintHitCollection> h_preshowerHits(m_preshowerHitKey);
ATH_MSG_INFO("Read ScintHitCollection/Preshower with " << h_preshowerHits->size() << " hits");
SG::ReadHandle<ScintHitCollection> h_triggerHits(m_triggerHitKey);
ATH_MSG_INFO("Read ScintHitCollection/Trigger with " << h_triggerHits->size() << " hits");
SG::ReadHandle<ScintHitCollection> h_vetoHits(m_vetoHitKey);
ATH_MSG_INFO("Read ScintHitCollectionVeto with " << h_vetoHits->size() << " hits");
// Since we have no pile-up, there should always be a single GenEvent in the container
const HepMC::GenEvent* ev = (*h_mcEvents)[0];
if (ev == nullptr)
......@@ -46,25 +75,58 @@ StatusCode SimHitAlg::execute()
ATH_MSG_INFO("Event contains " << ev->particles_size() << " truth particles" );
// The hit container might be empty because particles missed the wafers
if (h_siHits->size() == 0) return StatusCode::SUCCESS;
// Loop over all hits; print and fill histogram
for (const FaserSiHit& hit : *h_siHits)
{
hit.print();
m_hist->Fill( hit.energyLoss() );
m_module->Fill( hit.getModule(), hit.getRow() );
if (hit.getSensor() == 0)
//if (h_siHits->size() == 0) return StatusCode::SUCCESS;
if (h_siHits->size()!=0){
// Loop over all hits; print and fill histogram
for (const FaserSiHit& hit : *h_siHits)
{
m_moduleSide1->Fill( hit.getModule(), hit.getRow());
hit.print();
m_hist->Fill( hit.energyLoss() );
m_module->Fill( hit.getModule(), hit.getRow() );
if (hit.getSensor() == 0)
{
m_moduleSide1->Fill( hit.getModule(), hit.getRow());
}
else
{
m_moduleSide2->Fill( hit.getModule(), hit.getRow());
}
}
else
}
if (h_preshowerHits->size()!=0){
for (const ScintHit& hit : *h_preshowerHits)
{
m_moduleSide2->Fill( hit.getModule(), hit.getRow());
hit.print();
m_hist->Fill(hit.energyLoss());
m_plate_preshower->Fill(hit.getStation(),hit.getPlate(),hit.energyLoss());
}
}
if (h_triggerHits->size()!=0){
for (const ScintHit& hit : *h_triggerHits)
{
hit.print();
m_hist->Fill(hit.energyLoss());
m_plate_trigger->Fill(hit.getStation(),hit.getPlate(),hit.energyLoss());
}
}
if (h_vetoHits->size()!=0){
for (const ScintHit& hit : *h_vetoHits)
{
hit.print();
m_hist->Fill(hit.energyLoss());
m_plate_veto->Fill(hit.getStation(),hit.getPlate(),hit.energyLoss());
}
}
return StatusCode::SUCCESS;
}
......
#include "AthenaBaseComps/AthHistogramAlgorithm.h"
#include "GeneratorObjects/McEventCollection.h"
#include "TrackerSimEvent/FaserSiHitCollection.h"
#include "ScintSimEvent/ScintHitCollection.h" //New Sav
#include <TH1.h>
/* SimHit reading example - Ryan Rice-Smith, UC Irvine */
class SimHitAlg : public AthHistogramAlgorithm
......@@ -22,9 +24,20 @@ class SimHitAlg : public AthHistogramAlgorithm
TH2* m_moduleSide1;
TH2* m_moduleSide2;
//ScintHit Histograms
TH2* m_plate_preshower;
TH2* m_plate_trigger;
TH2* m_plate_veto;
// Read handle keys for data containers
// Any other event data can be accessed identically
// Note the key names ("GEN_EVENT" or "SCT_Hits") are Gaudi properties and can be configured at run-time
SG::ReadHandleKey<McEventCollection> m_mcEventKey { this, "McEventCollection", "GEN_EVENT" };
SG::ReadHandleKey<FaserSiHitCollection> m_faserSiHitKey { this, "FaserSiHitCollection", "SCT_Hits" };
//PreshowerHits, TriggerHits, VetoHits Sav new stuff
SG::ReadHandleKey<ScintHitCollection> m_scintHitKey { this, "ScintHitCollection", "Scint_Hits" }; //template. remove later
SG::ReadHandleKey<ScintHitCollection> m_preshowerHitKey { this, "ScintHitCollection", "PreshowerHits" };
SG::ReadHandleKey<ScintHitCollection> m_triggerHitKey { this, "ScintHitCollection", "TriggerHits" };
SG::ReadHandleKey<ScintHitCollection> m_vetoHitKey { this, "ScintHitCollection", "VetoHits" };
};
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment