32 , fLoadedGDMLInfo(
"(none)")
49 if(
fGDMLFile.find(
"TEMP_GEO_GDML") != std::string::npos)
68 std::vector< art::Handle<sumdata::RunData> > rdcol;
71 const std::string newGDMLInfo = rdcol[0]->DetGDMLInfo();
75 <<
" unchanged from previous run." <<
std::endl;
81 if(!newGDMLInfo.empty()){
84 if (
fGDMLFile.find(
"TEMP_GEO_GDML") != std::string::npos){
93 std::cout<<
"The geometry stored in the file was originally named: "<<rdcol[0]->DetGeometryBaseName()<<
std::endl;
98 std::cout<<
"WARNING: Could not load geometry information " 99 <<
"from within the file. The temporary file was not " 100 <<
"successfully created, something is wrong. Will " 101 <<
"attempt to load from the gdml file directly." 108 relpathgdml += rdcol[0]->DetGeometryBaseName();
109 relpathgdml +=
".gdml";
111 if(
fGDMLFile.find(relpathgdml) != std::string::npos)
return;
116 mf::LogWarning(
"LoadNewGeometry") <<
"loading new geometry files\n" 131 mf::LogWarning(
"LoadNewGeometry") <<
"cannot find sumdata::RunData object to grab detid\n" 132 <<
"or user has determined to only use the value " 133 <<
"from the fcl file\n" 134 <<
"using currently configured geometry:\n" 155 TVector3
const&
dir)
const 159 const TVector3 x0_det_cm = startPos;
162 const TVector3 dr = dir * 0.001;
165 const TVector3 x1_det_cm = x0_det_cm + dr;
168 double x0_det[3] = {x0_det_cm.X()*
CLHEP::cm 172 double x1_det[3] = {x1_det_cm.X()*
CLHEP::cm 178 double x0_beam[3] = {0.0, 0.0, 0.0};
179 double x1_beam[3] = {0.0, 0.0, 0.0};
187 const TVector3 x0_beam_vec(x0_beam);
190 TVector3 dir_beam(x1_beam);
191 dir_beam -= x0_beam_vec;
194 return dir_beam.Unit();
novadaq::cnv::DetId fDetId
id for the detector being used
void SetDetector(novadaq::cnv::DetId det)
Call this if you have definitive special knowledge (ie you're the Geometry service) ...
Atom< bool > ForceUseFCLOnly
std::string fROOTFile
root file holding the geometry
#define DEFINE_ART_SERVICE(svc)
std::string fGDMLFile
gdml file holding the geometry
CoordinateTransformation * getCoordinateTransformation() const
void preBeginRun(art::Run const &run)
static constexpr double cm
unsigned int fRunNumber
Run number of configuration.
bool LoadGeometryFile(std::string gdmlfile, novadaq::cnv::DetId det_id=novadaq::cnv::kUNKNOWN_DET)
In case of unknown ID, guesses from the filename.
novadaq::cnv::DetId DetId() const
Prefer ds::DetectorService::DetId() instead.
TVector3 getDirectionInBeamCoordinates(TVector3 const &startPos, TVector3 const &dir) const
Get direction of the Prong in the beam coordinates.
static std::string FindGDMLFile(std::string fname)
Search for Geometry/gdml/fname in FW_SEARCH_PATH, return full path.
Collect Geo headers and supply basic geometry functions.
void getManyByType(std::vector< Handle< PROD >> &results) const
The geometry of one entire detector (near, far, ipnd)
A very simple service to remember what detector we're working in.
Geometry(const Parameters ¶ms, art::ActivityRegistry ®)
virtual void setDetectorID(novadaq::cnv::DetId) override
Method to set DetectorID.
GlobalSignal< detail::SignalResponseType::FIFO, void(Run const &)> sPreBeginRun
int MakeTmpFile(std::string gdmlInfo)
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
std::string fLoadedGDMLInfo
The geometry of one entire detector (near, far, ipnd)
std::string fGDMLFromFCL
keep track of original fcl parameter
Simple object representing a (plane, cell) pair.
Encapsulate the geometry of one entire detector (near, far, ndos)
virtual void setDetectorID(novadaq::cnv::DetId)
Method to set DetectorID.
void RemoveTmpFile(std::string fileName)
Method to remove temporary file that holds detector geometry file.