Skip to content

Commit

Permalink
enable muon calohit creation in ALLEGRO
Browse files Browse the repository at this point in the history
  • Loading branch information
Archil Durglishvili committed Dec 6, 2024
1 parent b884d48 commit bd2e2e2
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 20 deletions.
19 changes: 6 additions & 13 deletions src/DDCaloHitCreatorALLEGRO.cc
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,7 @@ pandora::StatusCode DDCaloHitCreatorALLEGRO::CreateCaloHits(const EVENT::LCEvent
{
PANDORA_RETURN_RESULT_IF(pandora::STATUS_CODE_SUCCESS, !=, this->CreateECalCaloHits(pLCEvent));
PANDORA_RETURN_RESULT_IF(pandora::STATUS_CODE_SUCCESS, !=, this->CreateHCalCaloHits(pLCEvent));
// FIXME! AD: for the moment we do not create the muon CaloHits
// PANDORA_RETURN_RESULT_IF(pandora::STATUS_CODE_SUCCESS, !=, this->CreateMuonCaloHits(pLCEvent));
PANDORA_RETURN_RESULT_IF(pandora::STATUS_CODE_SUCCESS, !=, this->CreateMuonCaloHits(pLCEvent));

return pandora::STATUS_CODE_SUCCESS;
}
Expand Down Expand Up @@ -116,7 +115,7 @@ pandora::StatusCode DDCaloHitCreatorALLEGRO::CreateECalCaloHits(const EVENT::LCE
float absorberCorrection(1.);

// check if the hit in barrel
// NOTE: ECal barrel systemID is hardcoded
// FIXME! AD: ECal barrel systemID is hardcoded
if (cellIdDecoder(pCaloHit)["system"] == 4)
{
this->GetBarrelCaloHitProperties(pCaloHit, barrelLayers, m_settings.m_eCalBarrelInnerSymmetry, caloHitParameters, m_settings.m_eCalBarrelNormalVector, absorberCorrection);
Expand Down Expand Up @@ -211,7 +210,7 @@ pandora::StatusCode DDCaloHitCreatorALLEGRO::CreateHCalCaloHits(const EVENT::LCE
float absorberCorrection(1.);

// check if the hit in barrel
// NOTE: HCal barrel systemID is hardcoded here
// FIXME! AD: HCal barrel systemID is hardcoded here
if (cellIdDecoder(pCaloHit)["system"] == 8)
{
this->GetBarrelCaloHitProperties(pCaloHit, barrelLayers, m_settings.m_hCalBarrelInnerSymmetry, caloHitParameters, m_settings.m_hCalBarrelNormalVector, absorberCorrection);
Expand Down Expand Up @@ -270,7 +269,6 @@ pandora::StatusCode DDCaloHitCreatorALLEGRO::CreateMuonCaloHits(const EVENT::LCE

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::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));
Expand All @@ -294,17 +292,11 @@ pandora::StatusCode DDCaloHitCreatorALLEGRO::CreateMuonCaloHits(const EVENT::LCE
const float radius(std::sqrt(pCaloHit->getPosition()[0] * pCaloHit->getPosition()[0] +
pCaloHit->getPosition()[1] * pCaloHit->getPosition()[1]));

const bool isWithinCoil(radius < m_settings.m_coilOuterR);
const bool isInBarrelRegion(std::fabs(pCaloHit->getPosition()[2]) < m_settings.m_muonBarrelOuterZ);

float absorberCorrection(1.);

if (isInBarrelRegion && isWithinCoil)
{
std::cout<<"BIG WARNING: CANNOT HANDLE PLUG HITS (no plug in CLIC model), DO NOTHING!"<<std::endl;
// this->GetEndCapCaloHitProperties(pCaloHit, plugLayers, caloHitParameters, absorberCorrection);
}
else if (isInBarrelRegion)
if (isInBarrelRegion)
{

this->GetBarrelCaloHitProperties(pCaloHit, barrelLayers, m_settings.m_muonBarrelInnerSymmetry, caloHitParameters, m_settings.m_muonBarrelNormalVector, absorberCorrection);
Expand Down Expand Up @@ -332,6 +324,7 @@ pandora::StatusCode DDCaloHitCreatorALLEGRO::CreateMuonCaloHits(const EVENT::LCE
}

PANDORA_THROW_RESULT_IF(pandora::STATUS_CODE_SUCCESS, !=, PandoraApi::CaloHit::Create(m_pandora, caloHitParameters));

m_calorimeterHitVector.push_back(pCaloHit);
}
catch (pandora::StatusCodeException &statusCodeException)
Expand Down Expand Up @@ -361,7 +354,7 @@ void DDCaloHitCreatorALLEGRO::GetCommonCaloHitProperties(const EVENT::Calorimete
const float *pCaloHitPosition(pCaloHit->getPosition());
const pandora::CartesianVector positionVector(pCaloHitPosition[0], pCaloHitPosition[1], pCaloHitPosition[2]);

// FIXME! AD: for ECAL the che cell gemoetry should be pandora::POINTING with cellSize0 = DeltaEta and cellSize1 = DeltaPhi
// FIXME! AD: for ECAL the cell gemoetry should be pandora::POINTING with cellSize0 = DeltaEta and cellSize1 = DeltaPhi
caloHitParameters.m_cellGeometry = pandora::RECTANGULAR;
caloHitParameters.m_positionVector = positionVector;
caloHitParameters.m_expectedDirection = positionVector.GetUnitVector();
Expand Down
32 changes: 26 additions & 6 deletions src/DDGeometryCreatorALLEGRO.cc
Original file line number Diff line number Diff line change
Expand Up @@ -99,16 +99,14 @@ void DDGeometryCreatorALLEGRO::SetMandatorySubDetectorParameters(SubDetectorType
trackerParameters.m_nLayers = 0;
subDetectorTypeMap[pandora::INNER_TRACKER] = trackerParameters;
*/
/*

///FIXME:Implement a parameter for the Coil/Solenoid name
///NOTE: Is this the way to go, or should we go with reco structure?
try{
PandoraApi::Geometry::SubDetector::Parameters coilParameters;

/*
const dd4hep::rec::LayeredCalorimeterData * coilExtension= getExtension( ( dd4hep::DetType::COIL ) );
coilParameters.m_subDetectorName = "Coil";
coilParameters.m_subDetectorType = pandora::COIL;
coilParameters.m_innerRCoordinate = coilExtension->extent[0]/ dd4hep::mm;
Expand All @@ -122,18 +120,40 @@ void DDGeometryCreatorALLEGRO::SetMandatorySubDetectorParameters(SubDetectorType
coilParameters.m_isMirroredInZ = true;
coilParameters.m_nLayers = 0;
subDetectorTypeMap[pandora::COIL] = coilParameters;
*/

// FIXME! AD: below an ugly way is used to define the geometry of the Solenoid since we do not have the LayeredCalorimeterData for Coil in ALLEGRO
//Get ECal Barrel extension
const dd4hep::rec::LayeredCalorimeterData * eCalBarrelExtension= getExtension( ( dd4hep::DetType::CALORIMETER | dd4hep::DetType::ELECTROMAGNETIC | dd4hep::DetType::BARREL),
( dd4hep::DetType::AUXILIARY | dd4hep::DetType::FORWARD ) );
//Get HCal Barrel extension
const dd4hep::rec::LayeredCalorimeterData * hCalBarrelExtension= getExtension( ( dd4hep::DetType::CALORIMETER | dd4hep::DetType::HADRONIC | dd4hep::DetType::BARREL),
( dd4hep::DetType::AUXILIARY | dd4hep::DetType::FORWARD ) );
coilParameters.m_subDetectorName = "Coil";
coilParameters.m_subDetectorType = pandora::COIL;
coilParameters.m_innerRCoordinate = eCalBarrelExtension->extent[1]/ dd4hep::mm; // ECAL barrel outer R is assumed to be the inner R for the Solenoid
coilParameters.m_innerZCoordinate = 0.f;
coilParameters.m_innerPhiCoordinate = 0.f;
coilParameters.m_innerSymmetryOrder = 0;
coilParameters.m_outerRCoordinate = hCalBarrelExtension->extent[0]/ dd4hep::mm; // HCAL barrel inner R is assumed to be the outer R for the Solenoid
coilParameters.m_outerZCoordinate = eCalBarrelExtension->extent[3]/ dd4hep::mm; // Solenoid outer Z is assumed to be the same as ECAL barrel outer Z
coilParameters.m_outerPhiCoordinate = 0.f;
coilParameters.m_outerSymmetryOrder = 0;
coilParameters.m_isMirroredInZ = true;
coilParameters.m_nLayers = 0;
subDetectorTypeMap[pandora::COIL] = coilParameters;

} catch ( std::exception & e ) {
streamlog_out(ERROR) << "Failed to access COIL parameters: "<<e.what()<<std::endl;
}
*/
}

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

void DDGeometryCreatorALLEGRO::SetDefaultSubDetectorParameters(const dd4hep::rec::LayeredCalorimeterData &inputParameters, const std::string &subDetectorName,
const pandora::SubDetectorType subDetectorType, PandoraApi::Geometry::SubDetector::Parameters &parameters) const
{
const std::vector<dd4hep::rec::LayeredCalorimeterStruct::Layer>& layers= inputParameters.layers;
const std::vector<dd4hep::rec::LayeredCalorimeterStruct::Layer>& layers= inputParameters.layers;

parameters.m_subDetectorName = subDetectorName;
parameters.m_subDetectorType = subDetectorType;
Expand Down
2 changes: 1 addition & 1 deletion src/DDTrackCreatorALLEGRO.cc
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ pandora::StatusCode DDTrackCreatorALLEGRO::CreateTracks(EVENT::LCEvent *pLCEvent
{
this->GetTrackStates(pTrack, trackParameters);
this->TrackReachesECAL(pTrack, trackParameters);
// FIXME! this is disabled for ALLEGRO since I am not sure what to do here with truth tracks
// FIXME! AD: this is disabled for ALLEGRO since I am not sure what to do here with truth tracks
//this->GetTrackStatesAtCalo(pTrack, trackParameters);
this->DefineTrackPfoUsage(pTrack, trackParameters);

Expand Down

0 comments on commit bd2e2e2

Please sign in to comment.