Skip to content

Commit

Permalink
Merge remote branch 'hep-fcc/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
Tony Price committed Nov 25, 2016
2 parents 2fd40d7 + fca9637 commit ba42ad9
Show file tree
Hide file tree
Showing 318 changed files with 11,322 additions and 13,523 deletions.
46 changes: 0 additions & 46 deletions Algebra/Algebra/AlgPrimitives.h

This file was deleted.

59 changes: 0 additions & 59 deletions Algebra/Algebra/RealQuadraticEquation.h

This file was deleted.

23 changes: 11 additions & 12 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.5)

option(SAS "Whether to run static code analysis with SAS." OFF)
if (SAS)
find_package(sas)
enable_sas(
FORMAT
COMPARISON_REPORT_DIR "${CMAKE_BINARY_DIR}/sas_report"
IGNORE_DIRS ${CMAKE_SOURCE_DIR}/build ${CMAKE_SOURCE_DIR}/cmake ${CMAKE_SOURCE_DIR}/doc
)
endif(SAS)

#---------------------------------------------------------------
# Load macros and functions for Gaudi-based projects
find_package(GaudiProject)
# find_package(Delphes)
#---------------------------------------------------------------

# Declare project name and version
# Syntax:
# gaudi_project(this_project this_version
# USE dep_project_1 version_1 [project_2 version_2 ...]
# [DATA pkg1 [VERSION vers1] [pkg2 ...])
gaudi_project(FCCSW HEAD
USE Gaudi v27r0 )

include_directories(
${DELPHES_INCLUDE_DIRS}
${DELPHES_EXTERNALS_INCLUDE_DIRS}
${FCCEDM_INCLUDE_DIRS}
)
10 changes: 5 additions & 5 deletions Detector/DetCommon/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
################################################################################
gaudi_subdir(DetCommon v1r0)

gaudi_depends_on_subdirs(GaudiKernel)
gaudi_depends_on_subdirs(GaudiKernel Detector/DetSegmentation)

find_package(DD4hep)
find_package(DD4hep COMPONENTS DDG4 DDSegmentation REQUIRED)
find_package(Geant4)
include(${Geant4_USE_FILE})

Expand All @@ -17,8 +17,9 @@ find_package(ROOT COMPONENTS MathCore GenVector Geom REQUIRED)
gaudi_install_headers(DetCommon)
gaudi_add_library(DetCommon
src/*.cpp
INCLUDE_DIRS DD4hep ROOT Geant4
LINK_LIBRARIES GaudiKernel DD4hep ROOT Geant4)
INCLUDE_DIRS DD4hep ROOT Geant4 DetSegmentation
LINK_LIBRARIES GaudiKernel DD4hep ROOT Geant4 DetSegmentation ${DD4hep_COMPONENT_LIBRARIES}
PUBLIC_HEADERS DetCommon)

set(LIBRARY_OUTPUT_PATH ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
message(STATUS "LIBRARY_OUTPUT_PATH -> ${LIBRARY_OUTPUT_PATH}")
Expand All @@ -28,4 +29,3 @@ include(CTest)
gaudi_add_test(DumpSimpleBox
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
FRAMEWORK tests/dumpSimpleBox.py)

115 changes: 112 additions & 3 deletions Detector/DetCommon/DetCommon/DetUtils.h
Original file line number Diff line number Diff line change
@@ -1,17 +1,126 @@
#ifndef DETECTOR_DETUTILS_H
#define DETECTOR_DETUTILS_H
#ifndef DETCOMMON_DETUTILS_H
#define DETCOMMON_DETUTILS_H

// FCCSW
#include "DetSegmentation/GridPhiEta.h"

// DD4hep
#include "DD4hep/DetFactoryHelper.h"
#include "DD4hep/Segmentations.h"
#include "DDSegmentation/BitField64.h"
#include "DDSegmentation/CartesianGridXYZ.h"
#include "DDSegmentation/CartesianGridXY.h"
#include "DDSegmentation/PolarGridRPhi.h"

// Geant
#include "G4Step.hh"

// CLHEP
#include "CLHEP/Vector/ThreeVector.h"

#include "TGeoManager.h"


/** Given a XML element with several daughters with the same name, e.g.
<detector> <layer name="1" /> <layer name="2"> </detector>
this method returns the first daughter of type nodeName whose attribute has a given value
e.g. returns <layer name="2"/> when called with (detector, "layer", "name", "1") */
namespace det {
namespace utils {
DD4hep::XML::Component getNodeByStrAttr(const DD4hep::XML::Handle_t& mother, const std::string& nodeName, const std::string& attrName,
const std::string& attrValue);

/// try to get attribute with double value, return defaultValue if attribute not found
double getAttrValueWithFallback(const DD4hep::XML::Component& node, const std::string& attrName, const double& defaultValue);

/** Retrieves the cellID based on the position of the step and the detector segmentation.
* @param aSeg Handle to the segmentation of the volume.
* @param aStep Step in which particle deposited the energy.
* @param aPreStepPoint Flag indicating if the position of the deposit is the beginning of the step (default)
* or the middle of the step.
*/

uint64_t cellID(const DD4hep::Geometry::Segmentation& aSeg, const G4Step& aStep, bool aPreStepPoint = true);

/** Get neighbours in many dimensions.
* @param[in] aDecoder Handle to the bitfield decoder.
* @param[in] aFieldNames Names of the fields for which neighbours are found.
* @param[in] aFieldExtremes Minimal and maximal values for the fields.
* @param[in] aCellId ID of cell.
* return Vector of neighbours.
*/
std::vector<uint64_t> neighbours(DD4hep::DDSegmentation::BitField64& aDecoder,
const std::vector<std::string>& aFieldNames,
const std::vector<std::pair<int,int>>& aFieldExtremes,
uint64_t aCellId);

/** Get minimal and maximal values that can be decoded in the fields of the bitfield.
* @param[in] aDecoder Handle to the bitfield decoder.
* @param[in] aFieldNames Names of the fields for which extremes are found.
* return Vector of pairs (min,max)
*/
std::vector<std::pair<int,int>> bitfieldExtremes(DD4hep::DDSegmentation::BitField64& aDecoder,
const std::vector<std::string>& aFieldNames);

/** Get the half widths of the box envelope (TGeoBBox).
* @param[in] aVolumeId The volume ID.
* return Half-widths of the volume (x,y,z).
*/
CLHEP::Hep3Vector envelopeDimensions(uint64_t aVolumeId);

/** Get the dimensions of a tube (TGeoTube).
* @param[in] aVolumeId The volume ID.
* return Dimensions of the tube (rmin, rmax, z(half-length)).
*/
CLHEP::Hep3Vector tubeDimensions(uint64_t aVolumeId);

/** Get the number of cells for the volume and a given Cartesian XY segmentation.
* For an example see: Test/TestReconstruction/tests/options/testcellcountingXYZ.py.
* @warning No offset in segmentation is currently taken into account.
* @param[in] aVolumeId The volume for which the cells are counted.
* @param[in] aSeg Handle to the segmentation of the volume.
* return Array of the number of cells in (X, Y).
*/
std::array<uint, 2> numberOfCells(uint64_t aVolumeId, const DD4hep::DDSegmentation::CartesianGridXY& aSeg);

/** Get the number of cells for the volume and a given Cartesian XYZ segmentation.
* For an example see: Test/TestReconstruction/tests/options/testcellcountingXYZ.py.
* @warning No offset in segmentation is currently taken into account.
* @param[in] aVolumeId The volume for which the cells are counted.
* @param[in] aSeg Handle to the segmentation of the volume.
* return Array of the number of cells in (X, Y, Z).
*/
std::array<uint, 3> numberOfCells(uint64_t aVolumeId, const DD4hep::DDSegmentation::CartesianGridXYZ& aSeg);

/** Get the number of cells for the volume and a given Phi-Eta segmentation.
* It is assumed that the volume has a cylindrical shape (and full azimuthal coverage)
* and that it is centred at (0,0,0).
* For an example see: Test/TestReconstruction/tests/options/testcellcountingPhiEta.py.
* @warning No offset in segmentation is currently taken into account.
* @param[in] aVolumeId The volume for which the cells are counted.
* @param[in] aSeg Handle to the segmentation of the volume.
* return Array of the number of cells in (phi, eta).
*/
std::array<uint, 2> numberOfCells(uint64_t aVolumeId, const DD4hep::DDSegmentation::GridPhiEta& aSeg);

/** Get the number of cells for the volume and a given R-phi segmentation.
* It is assumed that the volume has a cylindrical shape - TGeoTube (and full azimuthal coverage)
* and that it is centred at (0,0,0).
* For an example see: Test/TestReconstruction/tests/options/testcellcountingRPhi.py.
* @warning No offset in segmentation is currently taken into account.
* @param[in] aVolumeId The volume for which the cells are counted.
* @param[in] aSeg Handle to the segmentation of the volume.
* return Array of the number of cells in (r, phi).
*/
std::array<uint, 2> numberOfCells(uint64_t aVolumeId, const DD4hep::DDSegmentation::PolarGridRPhi& aSeg);

/** Get the number of the volumes containing a given name.
* For an example see: Test/TestReconstruction/tests/options/testcellcountingXYZ.py.
* @param[in] aHighestVolume The top volume in the geometry.
* @param[in] aMatchName Name (or its part) of the volume.
* return Number of the volumes.
*/
unsigned int countPlacedVolumes(TGeoVolume* aHighestVolume, const std::string& aMatchName);
}
}
#endif
#endif /* DETCOMMON_DETUTILS_H */
6 changes: 6 additions & 0 deletions Detector/DetCommon/compact/materials.xml
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,12 @@
<fraction n="1.0" ref="Polystyrene"/>
</material>

<material name="PE">
<D type="density" value="0.95" unit="g/cm3"/>
<fraction n="4" ref="H"/>
<fraction n="2" ref="C"/>
</material>

<material name="Kapton">
<D value="1.43" unit="g/cm3" />
<composite n="22" ref="C"/>
Expand Down
Loading

0 comments on commit ba42ad9

Please sign in to comment.