1 #ifndef LMD_LMDMC_PNDLMDGEOMETRYHELPER_H_
2 #define LMD_LMDMC_PNDLMDGEOMETRYHELPER_H_
11 #include <boost/property_tree/json_parser.hpp>
12 #include <boost/property_tree/ptree.hpp>
14 #include <TGeoManager.h>
26 stream <<
"detector half: " << (
unsigned int) hit_info.
detector_half <<
"\n";
27 stream <<
"detector plane: " << (
unsigned int) hit_info.
plane <<
"\n";
28 stream <<
"module on half plane: " << (
unsigned int) hit_info.
module <<
"\n";
29 stream <<
"side of module: " << (
unsigned int) hit_info.
module_side <<
"\n";
36 return std::tie(detector_half, plane, module, module_side, module_sensor_id)
56 stream <<
"path 1: " << overlap_info.
path1 <<
"\n";
57 stream <<
"path 2: " << overlap_info.
path2 <<
"\n";
58 stream <<
"id 1: " << overlap_info.
id1 <<
"\n";
59 stream <<
"id 2: " << overlap_info.
id2 <<
"\n";
60 stream <<
"overlapID: " << overlap_info.
overlapID <<
"\n";
61 stream <<
"matrix 1: " <<
"\n";
62 stream <<
"matrix 2: " <<
"\n";
82 std::string file_url(geo_params_config_file_url);
83 if (geo_params_config_file_url ==
"") {
84 file_url = std::getenv(
"VMCWORKDIR");
85 file_url +=
"/macro/detectors/lmd/lmd-geo-params.json";
89 read_json(file_url, geometry_properties);
91 catch (std::exception &e) {
92 std::cerr <<
"PndLmdGeometryHelper::PndLmdGeometryHelper(): ERROR! Parameter file not present!\n";
93 std::cerr <<
"Was looking for file: " << file_url <<
"\n";
99 <<
"ERROR! gGeoManager is unitialized! Please populate the gGeoManager or initialize a run!\n";
103 auto pt_general = geometry_properties.get_child(
"general");
104 for (boost::property_tree::ptree::value_type &nav_path : pt_general.get_child(
"navigation_paths")) {
105 navigation_paths.push_back(
106 std::make_pair(nav_path.second.get<std::string>(
"name"),
107 nav_path.second.get<
bool>(
"is_alignable")));
110 TString actPath = fGeoManager->GetPath();
111 std::stringstream lmd_path;
112 fGeoManager->CdTop();
113 lmd_path << fGeoManager->GetPath() <<
"/" << navigation_paths[0].first <<
"_0";
114 lmd_root_path = lmd_path.str();
115 if (actPath !=
"" && actPath !=
" ") fGeoManager->cd(actPath);
151 const std::string
getPath(
unsigned char...);
159 std::vector<std::string>
getAllAlignPaths(
bool sensors=
true,
bool modules=
false,
bool planes=
false,
160 bool halfs=
false,
bool detector=
false);
163 std::vector<PndLmdOverlapInfo>
getOverlapInfos(
int iHalf=-1,
int iPlane=-1,
int iModule=-1);
TVector3 transformPndGlobalToSensor(const TVector3 &vec, int sensorId)
PndLmdHitLocationInfo translateVolumePathToHitLocationInfo(const std::string &volume_path) const
friend std::ostream & operator<<(std::ostream &stream, const PndLmdOverlapInfo &overlap_info)
std::vector< int > getAvailableOverlapIDs()
int getSensorTwoFromOverlapID(int overlapID)
const PndLmdHitLocationInfo & createMappingEntry(int sensor_id)
static PndLmdGeometryHelper & getInstance()
bool operator<(const PndLmdHitLocationInfo &o)
TGeoManager * gGeoManager
std::vector< std::pair< std::string, bool > > navigation_paths
friend std::ostream & operator<<(std::ostream &stream, const PndLmdHitLocationInfo &hit_info)
const TGeoHMatrix getMatrixSensorToPndGlobal(const int sensorId)
std::vector< std::string > getAllAlignPaths(bool sensors=true, bool modules=false, bool planes=false, bool halfs=false, bool detector=false)
unsigned char module_side
std::vector< PndLmdOverlapInfo > getOverlapInfos(int iHalf=-1, int iPlane=-1, int iModule=-1)
std::vector< std::string > getAllAlignableVolumePaths() const
std::map< std::string, PndLmdHitLocationInfo > volume_path_to_hit_info_mapping
TGeoManager * fGeoManager
const TGeoHMatrix getMatrixPndGlobalToLmdLocal()
const TGeoHMatrix getMatrixPndGlobalToSensor(const int sensorId)
const std::string getPath(unsigned char...)
const PndLmdHitLocationInfo & getHitLocationInfo(const std::string &volume_path)
int getSensorOneFromOverlapID(int overlapID)
std::map< int, PndLmdHitLocationInfo > sensor_id_to_hit_info_mapping
void operator=(const PndLmdGeometryHelper &)=delete
unsigned char module_sensor_id
const TGeoHMatrix getMatrixLmdLocalToPndGlobal()
boost::property_tree::ptree geometry_properties
PndLmdHitLocationInfo hit1
TVector3 transformPndGlobalToLmdLocal(const TVector3 &vec)
std::string lmd_root_path
int getOverlapIdFromSensorIDs(int id1, int id2)
PndLmdHitLocationInfo hit2
bool isOverlappingArea(const int id1, const int id2)
unsigned char detector_half
virtual ~PndLmdGeometryHelper()
PndLmdGeometryHelper(const std::string &geo_params_config_file_url="")