-
Notifications
You must be signed in to change notification settings - Fork 100
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test using signal DDCore handler
- Loading branch information
1 parent
17d70cd
commit dc73db6
Showing
2 changed files
with
154 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<lccdd> | ||
<!-- #========================================================================== | ||
# AIDA Detector description implementation | ||
#========================================================================== | ||
# Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) | ||
# All rights reserved. | ||
# | ||
# For the licensing terms see $DD4hepINSTALL/LICENSE. | ||
# For the list of contributors see $DD4hepINSTALL/doc/CREDITS. | ||
# | ||
#========================================================================== | ||
--> | ||
|
||
<info name="SiliconBlock" | ||
title="Test with 2 simple silicon boxes" | ||
author="Markus Frank" | ||
url="http://www.cern.ch/lhcb" | ||
status="development" | ||
version="$Id: compact.xml 513 2013-04-05 14:31:53Z gaede $"> | ||
<comment>Alignment test with 2 simple boxes</comment> | ||
</info> | ||
|
||
<includes> | ||
<gdmlFile ref="${DD4hepINSTALL}/DDDetectors/compact/elements.xml"/> | ||
<gdmlFile ref="${DD4hepINSTALL}/DDDetectors/compact/materials.xml"/> | ||
</includes> | ||
|
||
<materials> | ||
<material name="G4_PbWO4"> | ||
<D type="density" unit="g/cm3" value="8.28"/> | ||
<composite n="4" ref="O"/> | ||
<composite n="1" ref="Pb"/> | ||
<composite n="1" ref="W"/> | ||
</material> | ||
</materials> | ||
|
||
<define> | ||
<constant name="world_size" value="30*m"/> | ||
<constant name="world_x" value="world_size"/> | ||
<constant name="world_y" value="world_size"/> | ||
<constant name="world_z" value="world_size"/> | ||
</define> | ||
|
||
<display> | ||
<vis name="Invisible" showDaughters="false" visible="false"/> | ||
<vis name="InvisibleWithChildren" showDaughters="true" visible="false"/> | ||
<vis name="VisibleRed" r="1.0" g="0.0" b="0.0" showDaughters="true" visible="true"/> | ||
<vis name="VisibleBlue" r="0.0" g="0.0" b="1.0" showDaughters="false" visible="true"/> | ||
<vis name="VisibleGreen" alpha="1.0" r="0.0" g="1.0" b="0.0" drawingStyle="solid" lineStyle="solid" showDaughters="true" visible="true"/> | ||
</display> | ||
|
||
<limits> | ||
<limitset name="SiRegionLimitSet"> | ||
<limit name="step_length_max" particles="*" value="5.0" unit="mm" /> | ||
<limit name="track_length_max" particles="*" value="1.0" unit="mm" /> | ||
</limitset> | ||
</limits> | ||
|
||
<regions> | ||
<region name="SiRegion" eunit="MeV" lunit="mm" cut="0.001" threshold="0.001"> | ||
<limitsetref name="SiRegionLimitSet"/> | ||
</region> | ||
</regions> | ||
|
||
<detectors> | ||
<detector id="1" name="SiliconBlockUpper" type="DD4hep_BoxSegment" readout="SiliconUpperHits" vis="VisibleGreen" sensitive="true" region="SiRegion" limits="SiRegionLimitSet"> | ||
<material name="Silicon"/> | ||
<sensitive type="tracker"/> | ||
<box x="30*mm" y="100*cm" z="100*cm"/> | ||
<position x="4*cm" y="0" z="0"/> | ||
<rotation x="0" y="0" z="0"/> | ||
</detector> | ||
<detector id="2" name="InterruptTrigger" type="InterruptTrigger"/> | ||
<detector id="3" name="SiliconBlockDown" type="DD4hep_BoxSegment" readout="SiliconDownHits" vis="VisibleRed" sensitive="true" region="SiRegion" limits="SiRegionLimitSet"> | ||
<material name="Silicon"/> | ||
<sensitive type="tracker"/> | ||
<box x="30*mm" y="100*cm" z="100*cm"/> | ||
<position x="-4*cm" y="0" z="0"/> | ||
<rotation x="0" y="0" z="0"/> | ||
</detector> | ||
</detectors> | ||
|
||
<readouts> | ||
<readout name="SiliconUpperHits"> | ||
<segmentation type="CartesianGridXY" grid_size_x="5*mm" grid_size_y="5*mm"/> | ||
<id>system:8,x:24:-12,y:-12</id> | ||
</readout> | ||
<readout name="SiliconDownHits"> | ||
<segmentation type="CartesianGridXY" grid_size_x="5*mm" grid_size_y="5*mm"/> | ||
<id>system:8,x:24:-12,y:-12</id> | ||
</readout> | ||
</readouts> | ||
|
||
<fields> | ||
<field name="GlobalSolenoid" type="solenoid" | ||
inner_field="5.0*tesla" | ||
outer_field="-1.5*tesla" | ||
zmax="2*m" | ||
outer_radius="3*m"> | ||
</field> | ||
</fields> | ||
|
||
</lccdd> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
//========================================================================== | ||
// AIDA Detector description implementation | ||
//-------------------------------------------------------------------------- | ||
// Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) | ||
// All rights reserved. | ||
// | ||
// For the licensing terms see $DD4hepINSTALL/LICENSE. | ||
// For the list of contributors see $DD4hepINSTALL/doc/CREDITS. | ||
// | ||
// Author : M.Frank | ||
// | ||
//========================================================================== | ||
|
||
// Framework includes | ||
#include "DD4hep/DetFactoryHelper.h" | ||
#include "DD4hep/SignalHandler.h" | ||
#include "DD4hep/Printout.h" | ||
|
||
// C/C++ include files | ||
#include <cstdio> | ||
#include <csignal> | ||
#include <unistd.h> | ||
|
||
using namespace dd4hep; | ||
|
||
static bool signal_handler(void* user_context, int signal) { | ||
printout(ALWAYS,"SignalHandler", | ||
"+++ Caught signal: %d context: %p. exit process.", | ||
signal, user_context); | ||
::fflush(stdout); | ||
::exit(EINVAL); | ||
return true; | ||
} | ||
|
||
static Ref_t create_detector(Detector& , xml_h e, SensitiveDetector ) { | ||
// XML detector object: DDCore/XML/XMLDetector.h | ||
xml_dim_t x_det = e; | ||
//Create the DetElement for dd4hep | ||
DetElement d_det(x_det.nameStr(),x_det.id()); | ||
|
||
SignalHandler handler; | ||
handler.registerHandler(SIGINT, (void*)0xFEEDBABE, signal_handler); | ||
|
||
printout(ALWAYS,"SignalTrigger","+++ Sending interrupt signal to self..."); | ||
::kill(::getpid(), SIGINT); | ||
|
||
return d_det; | ||
} | ||
|
||
DECLARE_DETELEMENT(InterruptTrigger,create_detector) |