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

Support for PandoraPFA on ALLEGRO #31

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 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
3 changes: 3 additions & 0 deletions include/DDCaloHitCreator.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ typedef std::vector<EVENT::CalorimeterHit *> CalorimeterHitVector;
class DDCaloHitCreator
{
public:
// give access to the private memebers from DDCaloHitCreatorALLEGRO
friend class DDCaloHitCreatorALLEGRO;

typedef std::vector<std::string> StringVector;
typedef std::vector<float> FloatVector;

Expand Down
132 changes: 132 additions & 0 deletions include/DDCaloHitCreatorALLEGRO.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
/**
* @file DDMarlinPandora/include/DDCaloHitCreatorALLEGRO.h
*
* @brief Header file for the calo hit creator class.
*
* $Log: $
*/

#ifndef DDCALO_HIT_CREATORALLEGRO_H
#define DDCALO_HIT_CREATORALLEGRO_H 1

#include "EVENT/CalorimeterHit.h"
#include "EVENT/LCEvent.h"

#include <IMPL/CalorimeterHitImpl.h>

#include "Api/PandoraApi.h"

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

#include "DDCaloHitCreator.h"


/**
* @brief DDCaloHitCreator class
*/
class DDCaloHitCreatorALLEGRO : public DDCaloHitCreator
{
public:
typedef std::vector<std::string> StringVector;
typedef std::vector<float> FloatVector;

/**
* @brief Constructor
*
* @param settings the creator settings
* @param pPandora address of the relevant pandora instance
*/
DDCaloHitCreatorALLEGRO(const Settings &settings, const pandora::Pandora *const pPandora);

/**
* @brief Destructor
*/
~DDCaloHitCreatorALLEGRO();

/**
* @brief Create calo hits
*
* @param pLCEvent the lcio event
*/
pandora::StatusCode CreateCaloHits(const EVENT::LCEvent *const pLCEvent);

private:
/**
* @brief Create ecal calo hits
*
* @param pLCEvent the lcio event
*/
pandora::StatusCode CreateECalCaloHits(const EVENT::LCEvent *const pLCEvent);

/**
* @brief Create hcal calo hits
*
* @param pLCEvent the lcio event
*/
pandora::StatusCode CreateHCalCaloHits(const EVENT::LCEvent *const pLCEvent);

/**
* @brief Create muon calo hits
*
* @param pLCEvent the lcio event
*/
pandora::StatusCode CreateMuonCaloHits(const EVENT::LCEvent *const pLCEvent);

/**
* @brief Get common calo hit properties: position, parent address, input energy and time
*
* @param pCaloHit the lcio calorimeter hit
* @param caloHitParameters the calo hit parameters to populate
*/
void GetCommonCaloHitProperties(const EVENT::CalorimeterHit *const pCaloHit, PandoraApi::CaloHit::Parameters &caloHitParameters) const;

/**
* @brief Get end cap specific calo hit properties: cell size, absorber radiation and interaction lengths, normal vector
*
* @param pCaloHit the lcio calorimeter hit
* @param layers the vector of layers from DDRec extensions
* @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::rec::LayeredCalorimeterStruct::Layer> &layers,
PandoraApi::CaloHit::Parameters &caloHitParameters, float &absorberCorrection) const;

/**
* @brief Get barrel specific calo hit properties: cell size, absorber radiation and interaction lengths, normal vector
*
* @param pCaloHit the lcio calorimeter hit
* @param layers the vector of layers from DDRec extensions
* @param barrelSymmetryOrder the barrel order of symmetry
* @param caloHitParameters the calo hit parameters to populate
* @param normalVector is the normalVector to the sensitive layers in local coordinates
* @param absorberCorrection to receive the absorber thickness correction for the mip equivalent energy
*/
void GetBarrelCaloHitProperties( const EVENT::CalorimeterHit *const pCaloHit,
const std::vector<dd4hep::rec::LayeredCalorimeterStruct::Layer> &layers,
unsigned int barrelSymmetryOrder,
PandoraApi::CaloHit::Parameters &caloHitParameters,
FloatVector const& normalVector,
float &absorberCorrection ) const;

/**
* @brief Get number of active layers from position of a calo hit to the edge of the detector
*
* @param pCaloHit the lcio calorimeter hit
*/
int GetNLayersFromEdge(const EVENT::CalorimeterHit *const pCaloHit) const;

/**
* @brief Get the maximum radius of a calo hit in a polygonal detector structure
*
* @param pCaloHit the lcio calorimeter hit
* @param symmetryOrder the symmetry order
* @param phi0 the angular orientation
*
* @return the maximum radius
*/
float GetMaximumRadius(const EVENT::CalorimeterHit *const pCaloHit, const unsigned int symmetryOrder, const float phi0) const;

};
#endif // #ifndef CALO_HIT_CREATOR_H
3 changes: 3 additions & 0 deletions include/DDGeometryCreator.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
class DDGeometryCreator
{
public:
// give access to the private memebers from DDGeometryCreatorALLEGRO
friend class DDGeometryCreatorALLEGRO;

/**
* @brief Settings class
*/
Expand Down
63 changes: 63 additions & 0 deletions include/DDGeometryCreatorALLEGRO.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
/**
* @file DDMarlinPandora/include/DDGeometryCreatorALLEGRO.h
*
* @brief Header file for the geometry creator class.
*
* $Log: $
*/

#ifndef DDGEOMETRYALLEGRO_CREATOR_H
#define DDGEOMETRYALLEGRO_CREATOR_H 1

#include "Api/PandoraApi.h"

#include "DDRec/DetectorData.h"
#include "DDGeometryCreator.h"

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

/**
* @brief DDGeometryCreator class
*/
class DDGeometryCreatorALLEGRO : public DDGeometryCreator
{
public:
/**
* @brief Constructor
*
* @param settings the creator settings
* @param pPandora address of the relevant pandora instance
*/
DDGeometryCreatorALLEGRO(const Settings &settings, const pandora::Pandora *const pPandora);

/**
* @brief Destructor
*/
~DDGeometryCreatorALLEGRO();

/**
* @brief Create geometry
*/
pandora::StatusCode CreateGeometry() const;

private:
/**
* @brief Set mandatory sub detector parameters
*
* @param subDetectorTypeMap the sub detector type map
*/
void SetMandatorySubDetectorParameters(SubDetectorTypeMap &subDetectorTypeMap) const;

/**
* @brief Set sub detector parameters to their gear default values
*
* @param inputParameters input parameters, from gear
* @param subDetectorName the sub detector name
* @param subDetectorType the sub detector type
* @param parameters the sub detector parameters
*/
void SetDefaultSubDetectorParameters(const dd4hep::rec::LayeredCalorimeterData &inputParameters, const std::string &subDetectorName,
const pandora::SubDetectorType subDetectorType, PandoraApi::Geometry::SubDetector::Parameters &parameters) const;
};

#endif // #ifndef GEOMETRY_CREATOR_H
5 changes: 4 additions & 1 deletion include/DDPandoraPFANewProcessor.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@

#include "DDCaloHitCreator.h"
#include "DDGeometryCreator.h"
#include "DDCaloHitCreatorALLEGRO.h"
#include "DDGeometryCreatorALLEGRO.h"
#include "DDMCParticleCreator.h"
#include "DDPfoCreator.h"
#include "DDTrackCreatorBase.h"
Expand Down Expand Up @@ -72,7 +74,8 @@ class DDPandoraPFANewProcessor : public marlin::Processor
//Detector names not needed anymore, accessed by det type flags
std::string m_trackCreatorName = ""; ///< The name of the DDTrackCreator implementation to use


// Detector name (used by ALLEGRO)
std::string m_detectorName = "";
};

/**
Expand Down
110 changes: 110 additions & 0 deletions include/DDTrackCreatorALLEGRO.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
/**
* @file DDMarlinPandora/include/DDTrackCreatorALLEGRO.h
*
* @brief Header file for the ILD implementation of the track creator class.
*
* $Log: $
*/

#ifndef DDTRACK_CREATOR_ALLEGRO_H
#define DDTRACK_CREATOR_ALLEGRO_H 1

#include "DDTrackCreatorBase.h"

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

/**
* @brief DDTrackCreatorALLEGRO class
*/
class DDTrackCreatorALLEGRO : public DDTrackCreatorBase
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not inherit from DDTrackCreatorCLIC and reduce the amount of copy-pasta?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The functions re-used in the DDTrackCreatorALLEGRO are supposed to change for ALLEGRO. Currently only few things are disabled, but implementation of the (truth) tracks in the ALLEGRO is not finished yet.

{
public:

/**
* @brief Constructor
*
* @param settings the creator settings
* @param pPandora address of the relevant pandora instance
*/
DDTrackCreatorALLEGRO(const Settings &settings, const pandora::Pandora *const pPandora);

/**
* @brief Destructor
*/
virtual ~DDTrackCreatorALLEGRO();

/**
* @brief Create tracks implementation, insert user code here. Detector specific
*
* @param pLCEvent the lcio event
*/
pandora::StatusCode CreateTracks(EVENT::LCEvent *pLCEvent);



protected:


//Detector-specific configuration variables
float m_trackerInnerR; ///< Inner radius of the barrel tracker
float m_trackerOuterR; ///< Outer radius of the barrel tracker
float m_trackerZmax; ///< max extent of the tracker along z
float m_cosTracker;

DoubleVector m_endcapDiskInnerRadii; ///< List of endcapDisk inner radii
DoubleVector m_endcapDiskOuterRadii; ///< List of endcapDisk outer radii
DoubleVector m_endcapDiskZPositions; ///< List of endcapDisk z positions
unsigned int m_nEndcapDiskLayers; ///< Number of endcapDisk layers
unsigned int m_barrelTrackerLayers; ///< Number of barrel tracker layers

float m_tanLambdaEndcapDisk; ///< Tan lambda for first endcapDisk layer

/**
* @brief Whether track passes the quality cuts required in order to be used to form a pfo. Detector specific
*
* @param pTrack the lcio track
* @param trackParameters the track parameters
*
* @return boolean
*/

virtual bool PassesQualityCuts(const EVENT::Track *const pTrack, const PandoraApi::Track::Parameters &trackParameters) const;

/**
* @brief Decide whether track reaches the ecal surface. Detector specific
*
* @param pTrack the lcio track
* @param trackParameters the track parameters
*/
virtual void TrackReachesECAL(const EVENT::Track *const pTrack, PandoraApi::Track::Parameters &trackParameters) const;

/**
* @brief Determine whether a track can be used to form a pfo under the following conditions:
* 1) if the track proves to be associated with a cluster, OR
* 2) if the track proves to have no cluster associations
* Detector specific
*
* @param pTrack the lcio track
* @param trackParameters the track parameters
*/
virtual void DefineTrackPfoUsage(const EVENT::Track *const pTrack, PandoraApi::Track::Parameters &trackParameters) const;

/**
* @brief Copy track states stored in lcio tracks to pandora track parameters
*
* @param pTrack the lcio track
* @param trackParameters the track parameters
*/
// void GetTrackStates(const EVENT::Track *const pTrack, PandoraApi::Track::Parameters &trackParameters) const;

/**
* @brief Obtain track time when it reaches ECAL
*
* @param pTrack the lcio track
*/
// float CalculateTrackTimeAtCalorimeter(const EVENT::Track *const pTrack) const;
};



#endif // #ifndef DDTRACK_CREATOR_ALLEGRO_H
Loading