Skip to content
Snippets Groups Projects
Commit 63190e9a authored by fangwx@ihep.ac.cn's avatar fangwx@ihep.ac.cn Committed by lintao@ihep.ac.cn
Browse files

move hard-coded codes to functions

parent 6e1d2f82
No related branches found
No related tags found
1 merge request!26move hard-coded codes to functions
......@@ -11,6 +11,7 @@ gaudi_add_module(GaudiPandora
LINK EventSeeder
GearSvc
DataHelperLib
DecoderHelperLib
DetInterface
Gaudi::GaudiKernel
k4FWCore::k4FWCore
......
......@@ -21,7 +21,7 @@
#include "PandoraPFAlg.h"
#include "CaloHitCreator.h"
#include "DecoderHelper/DD4hep2Lcio.h"
#include <algorithm>
#include <cmath>
#include <limits>
......@@ -322,7 +322,8 @@ pandora::StatusCode CaloHitCreator::CreateECalCaloHits(const CollectionMaps& col
}
else{
Stave = m_decoder->get(pCaloHit->getCellID(), "stave");
Stave = Stave <=2 ? Stave+5 : Stave-3 ;//change to correct style
Stave = DD4hep2Lcio::CEPCv4::getEcalStave(Stave);
//Stave = Stave <=2 ? Stave+5 : Stave-3 ;//change to correct style
}
//std::cout<<"0Stave="<<Stave<<",0layer="<<caloHitParameters.m_layer.Get()<<std::endl;
if (Stave<0) throw "wrong Stave";
......@@ -449,7 +450,8 @@ pandora::StatusCode CaloHitCreator::CreateHCalCaloHits(const CollectionMaps& col
}
else{
Stave = m_decoder->get(pCaloHit->getCellID(), "stave");
Stave = Stave ==0 ? Stave+7 : Stave-1 ;//correct, same with LCIO
Stave = DD4hep2Lcio::CEPCv4::getHcalStave(Stave);
//Stave = Stave ==0 ? Stave+7 : Stave-1 ;//correct, same with LCIO
/*
1 0
**** ****
......@@ -583,7 +585,8 @@ pandora::StatusCode CaloHitCreator::CreateMuonCaloHits(const CollectionMaps& col
}
else{
Stave = m_decoder->get(pCaloHit->getCellID(), "stave");
Stave = 12 - Stave ;//correct to be same with LCIO
Stave = DD4hep2Lcio::CEPCv4::getMuonStave(Stave);
//Stave = 12 - Stave ;//correct to be same with LCIO
if(Stave<0) throw("throw wrong stave number?");
}
......
......@@ -2,4 +2,5 @@ add_subdirectory(DataHelper)
add_subdirectory(KalTest)
add_subdirectory(KalDet)
add_subdirectory(KiTrack)
add_subdirectory(DecoderHelper)
gaudi_add_library(DecoderHelperLib
SOURCES src/DD4hep2Lcio.cc
)
install(TARGETS DecoderHelperLib
EXPORT CEPCSWTargets
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT bin
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT shlib
COMPONENT dev)
#ifndef DD4HEP2LCIO_H
#define DD4HEP2LCIO_H
namespace DD4hep2Lcio {
namespace CEPCv4 {
int getEcalLayer(int dd4hep_layer);
int getEcalStave(int dd4hep_stave);
int getHcalLayer(int dd4hep_layer);
int getHcalStave(int dd4hep_stave);
int getMuonLayer(int dd4hep_layer);
int getMuonStave(int dd4hep_stave);
}
}
#endif
#include "DecoderHelper/DD4hep2Lcio.h"
int DD4hep2Lcio::CEPCv4::getEcalLayer(int dd4hep_layer){
return dd4hep_layer - 1 ;
}
int DD4hep2Lcio::CEPCv4::getEcalStave(int dd4hep_stave){
int lcio_stave = dd4hep_stave <=2 ? dd4hep_stave+5 : dd4hep_stave-3 ;
return lcio_stave ;
}
int DD4hep2Lcio::CEPCv4::getHcalLayer(int dd4hep_layer){
return dd4hep_layer - 1 ;
}
int DD4hep2Lcio::CEPCv4::getHcalStave(int dd4hep_stave){
int lcio_stave = dd4hep_stave ==0 ? dd4hep_stave+7 : dd4hep_stave-1 ;
/*
1 0
**** ****
2 * * 0 1 * * 7
* * * *
3* * 7 ---> 2* * 6
* * * *
4 * * 6 3 * * 5
**** ****
5 4
*/
return lcio_stave ;
}
int DD4hep2Lcio::CEPCv4::getMuonLayer(int dd4hep_layer){
return dd4hep_layer - 1 ;
}
int DD4hep2Lcio::CEPCv4::getMuonStave(int dd4hep_stave){
return 12 - dd4hep_stave ;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment