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

Adapt to changes in namespaces and LCDD --> Detector #8

Merged
merged 1 commit into from
Jun 20, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
8 changes: 4 additions & 4 deletions include/DDCaloHitCreator.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
#include "Api/PandoraApi.h"

#include <DDRec/DetectorData.h>
#include <DD4hep/LCDD.h>
#include <DD4hep/Detector.h>
#include <DD4hep/DetElement.h>



Expand Down Expand Up @@ -203,7 +203,7 @@ class DDCaloHitCreator
* @param caloHitParameters the calo hit parameters to populate
* @param absorberCorrection to receive the absorber thickness correction for the mip equivalent energy
*/
void GetEndCapCaloHitProperties(const EVENT::CalorimeterHit *const pCaloHit, const std::vector<DD4hep::DDRec::LayeredCalorimeterStruct::Layer> &layers,
void GetEndCapCaloHitProperties(const EVENT::CalorimeterHit *const pCaloHit, const std::vector<dd4hep::rec::LayeredCalorimeterStruct::Layer> &layers,
PandoraApi::CaloHit::Parameters &caloHitParameters, float &absorberCorrection) const;

/**
Expand All @@ -217,7 +217,7 @@ class DDCaloHitCreator
* @param absorberCorrection to receive the absorber thickness correction for the mip equivalent energy
*/
void GetBarrelCaloHitProperties( const EVENT::CalorimeterHit *const pCaloHit,
const std::vector<DD4hep::DDRec::LayeredCalorimeterStruct::Layer> &layers,
const std::vector<dd4hep::rec::LayeredCalorimeterStruct::Layer> &layers,
unsigned int barrelSymmetryOrder,
PandoraApi::CaloHit::Parameters &caloHitParameters,
FloatVector const& normalVector,
Expand Down Expand Up @@ -250,7 +250,7 @@ class DDCaloHitCreator

CalorimeterHitVector m_calorimeterHitVector; ///< The calorimeter hit vector

DD4hep::Geometry::VolumeManager m_volumeManager; ///< DD4hep volume manager
dd4hep::VolumeManager m_volumeManager; ///< DD4hep volume manager

};

Expand Down
2 changes: 1 addition & 1 deletion include/DDGeometryCreator.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ class DDGeometryCreator
* @param subDetectorType the sub detector type
* @param parameters the sub detector parameters
*/
void SetDefaultSubDetectorParameters(const DD4hep::DDRec::LayeredCalorimeterData &inputParameters, const std::string &subDetectorName,
void SetDefaultSubDetectorParameters(const dd4hep::rec::LayeredCalorimeterData &inputParameters, const std::string &subDetectorName,
const pandora::SubDetectorType subDetectorType, PandoraApi::Geometry::SubDetector::Parameters &parameters) const;

/**
Expand Down
13 changes: 5 additions & 8 deletions src/DDCaloDigi.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
#include "CLHEP/Random/RandGauss.h"
#include "CLHEP/Random/RandFlat.h"

#include "DD4hep/LCDD.h"
#include "DD4hep/Factories.h"
#include "DD4hep/DD4hepUnits.h"
#include "DDRec/DetectorData.h"
Expand All @@ -39,8 +38,6 @@
using namespace std;
using namespace lcio ;
using namespace marlin ;
using namespace DD4hep ;
using namespace DD4hep::Geometry;

// protect against rounding errors
// will not find caps smaller than this
Expand All @@ -50,7 +47,7 @@ const float slop = 0.25; // (mm)


//forward declarations. See in DDPandoraPFANewProcessor.cc
DD4hep::DDRec::LayeredCalorimeterData * getExtension(unsigned int includeFlag, unsigned int excludeFlag=0);
dd4hep::rec::LayeredCalorimeterData * getExtension(unsigned int includeFlag, unsigned int excludeFlag=0);

DDCaloDigi aDDCaloDigi ;

Expand Down Expand Up @@ -558,12 +555,12 @@ void DDCaloDigi::init() {

try {

DDRec::LayeredCalorimeterData* ecalBarrelData = getExtension(( DD4hep::DetType::CALORIMETER | DD4hep::DetType::ELECTROMAGNETIC | DD4hep::DetType::BARREL), ( DD4hep::DetType::AUXILIARY | DD4hep::DetType::FORWARD ));
dd4hep::rec::LayeredCalorimeterData* ecalBarrelData = getExtension(( dd4hep::DetType::CALORIMETER | dd4hep::DetType::ELECTROMAGNETIC | dd4hep::DetType::BARREL), ( dd4hep::DetType::AUXILIARY | dd4hep::DetType::FORWARD ));

DDRec::LayeredCalorimeterData* ecalEndcapData = getExtension(( DD4hep::DetType::CALORIMETER | DD4hep::DetType::ELECTROMAGNETIC | DD4hep::DetType::ENDCAP), ( DD4hep::DetType::AUXILIARY | DD4hep::DetType::FORWARD ));
dd4hep::rec::LayeredCalorimeterData* ecalEndcapData = getExtension(( dd4hep::DetType::CALORIMETER | dd4hep::DetType::ELECTROMAGNETIC | dd4hep::DetType::ENDCAP), ( dd4hep::DetType::AUXILIARY | dd4hep::DetType::FORWARD ));

const std::vector<DD4hep::DDRec::LayeredCalorimeterStruct::Layer>& ecalBarrelLayers = ecalBarrelData->layers;
const std::vector<DD4hep::DDRec::LayeredCalorimeterStruct::Layer>& ecalEndcapLayers = ecalEndcapData->layers;
const std::vector<dd4hep::rec::LayeredCalorimeterStruct::Layer>& ecalBarrelLayers = ecalBarrelData->layers;
const std::vector<dd4hep::rec::LayeredCalorimeterStruct::Layer>& ecalEndcapLayers = ecalEndcapData->layers;

// determine geometry of ECAL
int symmetry = ecalBarrelData->inner_symmetry;
Expand Down
48 changes: 24 additions & 24 deletions src/DDCaloHitCreator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@

//forward declarations. See in DDPandoraPFANewProcessor.cc

// DD4hep::DDRec::LayeredCalorimeterData * getExtension(std::string detectorName);
DD4hep::DDRec::LayeredCalorimeterData * getExtension(unsigned int includeFlag, unsigned int excludeFlag=0);
// dd4hep::rec::LayeredCalorimeterData * getExtension(std::string detectorName);
dd4hep::rec::LayeredCalorimeterData * getExtension(unsigned int includeFlag, unsigned int excludeFlag=0);

// double getCoilOuterR();

Expand All @@ -40,9 +40,9 @@ DDCaloHitCreator::DDCaloHitCreator(const Settings &settings, const pandora::Pand
m_volumeManager()
{

const std::vector<DD4hep::DDRec::LayeredCalorimeterStruct::Layer>& barrelLayers= getExtension(( DD4hep::DetType::CALORIMETER | DD4hep::DetType::HADRONIC | DD4hep::DetType::BARREL), ( DD4hep::DetType::AUXILIARY | DD4hep::DetType::FORWARD ))->layers;
const std::vector<dd4hep::rec::LayeredCalorimeterStruct::Layer>& barrelLayers= getExtension(( dd4hep::DetType::CALORIMETER | dd4hep::DetType::HADRONIC | dd4hep::DetType::BARREL), ( dd4hep::DetType::AUXILIARY | dd4hep::DetType::FORWARD ))->layers;

const std::vector<DD4hep::DDRec::LayeredCalorimeterStruct::Layer>& endcapLayers= getExtension(( DD4hep::DetType::CALORIMETER | DD4hep::DetType::HADRONIC | DD4hep::DetType::ENDCAP), ( DD4hep::DetType::AUXILIARY | DD4hep::DetType::FORWARD ))->layers;
const std::vector<dd4hep::rec::LayeredCalorimeterStruct::Layer>& endcapLayers= getExtension(( dd4hep::DetType::CALORIMETER | dd4hep::DetType::HADRONIC | dd4hep::DetType::ENDCAP), ( dd4hep::DetType::AUXILIARY | dd4hep::DetType::FORWARD ))->layers;

///Take thicknesses from last layer (was like that before with gear)
m_hCalEndCapLayerThickness =(endcapLayers.back().inner_thickness+endcapLayers.back().outer_thickness)/dd4hep::mm;
Expand All @@ -51,11 +51,11 @@ DDCaloHitCreator::DDCaloHitCreator(const Settings &settings, const pandora::Pand
if ((m_hCalEndCapLayerThickness < std::numeric_limits<float>::epsilon()) || (m_hCalBarrelLayerThickness < std::numeric_limits<float>::epsilon()))
throw pandora::StatusCodeException(pandora::STATUS_CODE_INVALID_PARAMETER);

DD4hep::Geometry::LCDD& lcdd = DD4hep::Geometry::LCDD::getInstance();
m_volumeManager = lcdd.volumeManager();
dd4hep::Detector& theDetector = dd4hep::Detector::getInstance();
m_volumeManager = theDetector.volumeManager();
if( not m_volumeManager.isValid() ){
lcdd.apply("DD4hepVolumeManager",0,0);
m_volumeManager = lcdd.volumeManager();
theDetector.apply("DD4hepVolumeManager",0,0);
m_volumeManager = theDetector.volumeManager();
}

}
Expand Down Expand Up @@ -101,8 +101,8 @@ pandora::StatusCode DDCaloHitCreator::CreateECalCaloHits(const EVENT::LCEvent *c

streamlog_out( DEBUG1 ) << "Creating " << *iter << " hits" << std::endl;

const std::vector<DD4hep::DDRec::LayeredCalorimeterStruct::Layer>& barrelLayers= getExtension( ( DD4hep::DetType::CALORIMETER | DD4hep::DetType::ELECTROMAGNETIC | DD4hep::DetType::BARREL), ( DD4hep::DetType::AUXILIARY | DD4hep::DetType::FORWARD ) )->layers;
const std::vector<DD4hep::DDRec::LayeredCalorimeterStruct::Layer>& endcapLayers= getExtension( ( DD4hep::DetType::CALORIMETER | DD4hep::DetType::ELECTROMAGNETIC | DD4hep::DetType::ENDCAP), ( DD4hep::DetType::AUXILIARY | DD4hep::DetType::FORWARD ) )->layers;
const std::vector<dd4hep::rec::LayeredCalorimeterStruct::Layer>& barrelLayers= getExtension( ( dd4hep::DetType::CALORIMETER | dd4hep::DetType::ELECTROMAGNETIC | dd4hep::DetType::BARREL), ( dd4hep::DetType::AUXILIARY | dd4hep::DetType::FORWARD ) )->layers;
const std::vector<dd4hep::rec::LayeredCalorimeterStruct::Layer>& endcapLayers= getExtension( ( dd4hep::DetType::CALORIMETER | dd4hep::DetType::ELECTROMAGNETIC | dd4hep::DetType::ENDCAP), ( dd4hep::DetType::AUXILIARY | dd4hep::DetType::FORWARD ) )->layers;


UTIL::CellIDDecoder<CalorimeterHit> cellIdDecoder(pCaloHitCollection);
Expand Down Expand Up @@ -245,8 +245,8 @@ pandora::StatusCode DDCaloHitCreator::CreateHCalCaloHits(const EVENT::LCEvent *c

streamlog_out( DEBUG1 ) << "Creating " << *iter << " hits" << std::endl;

const std::vector<DD4hep::DDRec::LayeredCalorimeterStruct::Layer>& barrelLayers= getExtension( ( DD4hep::DetType::CALORIMETER | DD4hep::DetType::HADRONIC | DD4hep::DetType::BARREL), ( DD4hep::DetType::AUXILIARY | DD4hep::DetType::FORWARD ) )->layers;
const std::vector<DD4hep::DDRec::LayeredCalorimeterStruct::Layer>& endcapLayers= getExtension( ( DD4hep::DetType::CALORIMETER | DD4hep::DetType::HADRONIC| DD4hep::DetType::ENDCAP), ( DD4hep::DetType::AUXILIARY ) | DD4hep::DetType::FORWARD )->layers;
const std::vector<dd4hep::rec::LayeredCalorimeterStruct::Layer>& barrelLayers= getExtension( ( dd4hep::DetType::CALORIMETER | dd4hep::DetType::HADRONIC | dd4hep::DetType::BARREL), ( dd4hep::DetType::AUXILIARY | dd4hep::DetType::FORWARD ) )->layers;
const std::vector<dd4hep::rec::LayeredCalorimeterStruct::Layer>& endcapLayers= getExtension( ( dd4hep::DetType::CALORIMETER | dd4hep::DetType::HADRONIC| dd4hep::DetType::ENDCAP), ( dd4hep::DetType::AUXILIARY ) | dd4hep::DetType::FORWARD )->layers;



Expand Down Expand Up @@ -327,10 +327,10 @@ pandora::StatusCode DDCaloHitCreator::CreateMuonCaloHits(const EVENT::LCEvent *c

streamlog_out( DEBUG1 ) << "Creating " << *iter << " hits" << std::endl;

const std::vector<DD4hep::DDRec::LayeredCalorimeterStruct::Layer>& barrelLayers= getExtension(( DD4hep::DetType::CALORIMETER | DD4hep::DetType::MUON| DD4hep::DetType::BARREL), ( DD4hep::DetType::AUXILIARY | DD4hep::DetType::FORWARD ))->layers;
const std::vector<DD4hep::DDRec::LayeredCalorimeterStruct::Layer>& endcapLayers= getExtension(( DD4hep::DetType::CALORIMETER | DD4hep::DetType::MUON| DD4hep::DetType::ENDCAP), ( DD4hep::DetType::AUXILIARY | DD4hep::DetType::FORWARD ))->layers;
const std::vector<dd4hep::rec::LayeredCalorimeterStruct::Layer>& barrelLayers= getExtension(( dd4hep::DetType::CALORIMETER | dd4hep::DetType::MUON| dd4hep::DetType::BARREL), ( dd4hep::DetType::AUXILIARY | dd4hep::DetType::FORWARD ))->layers;
const std::vector<dd4hep::rec::LayeredCalorimeterStruct::Layer>& endcapLayers= getExtension(( dd4hep::DetType::CALORIMETER | dd4hep::DetType::MUON| dd4hep::DetType::ENDCAP), ( dd4hep::DetType::AUXILIARY | dd4hep::DetType::FORWARD ))->layers;
///FIXME: WHAT ABOUT MORE MUON SYSTEMS?
// const std::vector<DD4hep::DDRec::LayeredCalorimeterStruct::Layer>& plugLayers= getExtension(( DD4hep::DetType::CALORIMETER | DD4hep::DetType::HADRONIC | DD4hep::DetType::AUXILIARY ))->layers;
// const std::vector<dd4hep::rec::LayeredCalorimeterStruct::Layer>& plugLayers= getExtension(( dd4hep::DetType::CALORIMETER | dd4hep::DetType::HADRONIC | dd4hep::DetType::AUXILIARY ))->layers;
UTIL::CellIDDecoder<CalorimeterHit> cellIdDecoder(pCaloHitCollection);
const std::string layerCodingString(pCaloHitCollection->getParameters().getStringVal(LCIO::CellIDEncoding));
const std::string layerCoding("layer");
Expand Down Expand Up @@ -430,7 +430,7 @@ pandora::StatusCode DDCaloHitCreator::CreateLCalCaloHits(const EVENT::LCEvent *c
streamlog_out( DEBUG1 ) << "Creating " << *iter << " hits" << std::endl;

///FIXME: WHAT ABOUT OTHER ECALS?
const std::vector<DD4hep::DDRec::LayeredCalorimeterStruct::Layer>& endcapLayers= getExtension( DD4hep::DetType::CALORIMETER | DD4hep::DetType::ENDCAP | DD4hep::DetType::ELECTROMAGNETIC | DD4hep::DetType::FORWARD , DD4hep::DetType::AUXILIARY )->layers;
const std::vector<dd4hep::rec::LayeredCalorimeterStruct::Layer>& endcapLayers= getExtension( dd4hep::DetType::CALORIMETER | dd4hep::DetType::ENDCAP | dd4hep::DetType::ELECTROMAGNETIC | dd4hep::DetType::FORWARD , dd4hep::DetType::AUXILIARY )->layers;


UTIL::CellIDDecoder<CalorimeterHit> cellIdDecoder(pCaloHitCollection);
Expand Down Expand Up @@ -504,7 +504,7 @@ pandora::StatusCode DDCaloHitCreator::CreateLHCalCaloHits(const EVENT::LCEvent *
streamlog_out( DEBUG1 ) << "Creating " << *iter << " hits" << std::endl;

///FIXME! WHAT ABOUT MORE HCALS?
const std::vector<DD4hep::DDRec::LayeredCalorimeterStruct::Layer>& endcapLayers= getExtension(DD4hep::DetType::CALORIMETER | DD4hep::DetType::ENDCAP | DD4hep::DetType::HADRONIC| DD4hep::DetType::FORWARD)->layers;
const std::vector<dd4hep::rec::LayeredCalorimeterStruct::Layer>& endcapLayers= getExtension(dd4hep::DetType::CALORIMETER | dd4hep::DetType::ENDCAP | dd4hep::DetType::HADRONIC| dd4hep::DetType::FORWARD)->layers;

UTIL::CellIDDecoder<CalorimeterHit> cellIdDecoder(pCaloHitCollection);
const std::string layerCodingString(pCaloHitCollection->getParameters().getStringVal(LCIO::CellIDEncoding));
Expand Down Expand Up @@ -576,7 +576,7 @@ void DDCaloHitCreator::GetCommonCaloHitProperties(const EVENT::CalorimeterHit *c

//------------------------------------------------------------------------------------------------------------------------------------------

void DDCaloHitCreator::GetEndCapCaloHitProperties(const EVENT::CalorimeterHit *const pCaloHit, const std::vector<DD4hep::DDRec::LayeredCalorimeterStruct::Layer> &layers,
void DDCaloHitCreator::GetEndCapCaloHitProperties(const EVENT::CalorimeterHit *const pCaloHit, const std::vector<dd4hep::rec::LayeredCalorimeterStruct::Layer> &layers,
PandoraApi::CaloHit::Parameters &caloHitParameters, float &absorberCorrection) const
{
caloHitParameters.m_hitRegion = pandora::ENDCAP;
Expand Down Expand Up @@ -639,7 +639,7 @@ void DDCaloHitCreator::GetEndCapCaloHitProperties(const EVENT::CalorimeterHit *c
//------------------------------------------------------------------------------------------------------------------------------------------

void DDCaloHitCreator::GetBarrelCaloHitProperties( const EVENT::CalorimeterHit *const pCaloHit,
const std::vector<DD4hep::DDRec::LayeredCalorimeterStruct::Layer> &layers,
const std::vector<dd4hep::rec::LayeredCalorimeterStruct::Layer> &layers,
unsigned int barrelSymmetryOrder,
PandoraApi::CaloHit::Parameters &caloHitParameters,
FloatVector const& normalVector,
Expand Down Expand Up @@ -699,13 +699,13 @@ void DDCaloHitCreator::GetBarrelCaloHitProperties( const EVENT::CalorimeterHit *
if ( pCaloHit->getCellID0() != 0 ) {

auto staveDetElement = m_volumeManager.lookupDetElement( pCaloHit->getCellID0() );
DD4hep::Geometry::Position local1(0.0, 0.0, 0.0);
DD4hep::Geometry::Position local2(normalVector[0],normalVector[1],normalVector[2]);
DD4hep::Geometry::Position global1(0.0, 0.0, 0.0);
DD4hep::Geometry::Position global2(0.0, 0.0, 0.0);
dd4hep::Position local1(0.0, 0.0, 0.0);
dd4hep::Position local2(normalVector[0],normalVector[1],normalVector[2]);
dd4hep::Position global1(0.0, 0.0, 0.0);
dd4hep::Position global2(0.0, 0.0, 0.0);
staveDetElement.nominal().localToWorld( local1, global1 );
staveDetElement.nominal().localToWorld( local2, global2 );
DD4hep::Geometry::Position normal( global2-global1 );
dd4hep::Position normal( global2-global1 );

streamlog_out(DEBUG6) << " detelement: " << staveDetElement.name()
<< " parent: " << staveDetElement.parent().name()
Expand Down
Loading