Public Member Functions | Private Attributes | List of all members
DUNE::CTreeGeometry Class Reference
Inheritance diagram for DUNE::CTreeGeometry:
art::EDAnalyzer art::detail::Analyzer art::detail::LegacyModule art::Observer art::ModuleBase

Public Member Functions

 CTreeGeometry (fhicl::ParameterSet const &pset)
 
virtual ~CTreeGeometry ()
 
void beginJob ()
 
void endJob ()
 
void analyze (const art::Event &evt)
 
void reconfigure (fhicl::ParameterSet const &pset)
 
void saveChannelWireMap ()
 
void printGeometry ()
 
- Public Member Functions inherited from art::EDAnalyzer
 EDAnalyzer (fhicl::ParameterSet const &pset)
 
template<typename Config >
 EDAnalyzer (Table< Config > const &config)
 
std::string workerType () const
 
- Public Member Functions inherited from art::detail::Analyzer
virtual ~Analyzer () noexcept
 
 Analyzer (fhicl::ParameterSet const &pset)
 
template<typename Config >
 Analyzer (Table< Config > const &config)
 
void doBeginJob ()
 
void doEndJob ()
 
void doRespondToOpenInputFile (FileBlock const &fb)
 
void doRespondToCloseInputFile (FileBlock const &fb)
 
void doRespondToOpenOutputFiles (FileBlock const &fb)
 
void doRespondToCloseOutputFiles (FileBlock const &fb)
 
bool doBeginRun (RunPrincipal &rp, ModuleContext const &mc)
 
bool doEndRun (RunPrincipal &rp, ModuleContext const &mc)
 
bool doBeginSubRun (SubRunPrincipal &srp, ModuleContext const &mc)
 
bool doEndSubRun (SubRunPrincipal &srp, ModuleContext const &mc)
 
bool doEvent (EventPrincipal &ep, ModuleContext const &mc, std::atomic< std::size_t > &counts_run, std::atomic< std::size_t > &counts_passed, std::atomic< std::size_t > &counts_failed)
 
- Public Member Functions inherited from art::Observer
 ~Observer () noexcept
 
 Observer (Observer const &)=delete
 
 Observer (Observer &&)=delete
 
Observeroperator= (Observer const &)=delete
 
Observeroperator= (Observer &&)=delete
 
void registerProducts (ProductDescriptions &, ModuleDescription const &)
 
void fillDescriptions (ModuleDescription const &)
 
std::string const & processName () const
 
bool wantAllEvents () const
 
bool wantEvent (Event const &e)
 
fhicl::ParameterSetID selectorConfig () const
 
Handle< TriggerResultsgetTriggerResults (Event const &e) const
 
- Public Member Functions inherited from art::ModuleBase
virtual ~ModuleBase () noexcept
 
 ModuleBase ()
 
ModuleDescription const & moduleDescription () const
 
void setModuleDescription (ModuleDescription const &)
 
std::array< std::vector< ProductInfo >, NumBranchTypes > const & getConsumables () const
 
void sortConsumables (std::string const &current_process_name)
 
template<typename T , BranchType BT>
ViewToken< T > consumesView (InputTag const &tag)
 
template<typename T , BranchType BT>
ViewToken< T > mayConsumeView (InputTag const &tag)
 

Private Attributes

bool fSaveChannelWireMap
 
art::ServiceHandle< geo::GeometryfGeom
 
int fNcryostats
 
int fNTPC
 
vector< float > fTPC_x
 
vector< float > fTPC_y
 
vector< float > fTPC_z
 
int fNplanes
 
vector< int > fPlane_type
 
vector< int > fPlane_view
 
vector< double > fPlane_wirepitch
 
vector< double > fPlane_wireangle
 
vector< int > fPlane_wires
 
int fNchannels
 

Additional Inherited Members

- Public Types inherited from art::EDAnalyzer
using WorkerType = WorkerT< EDAnalyzer >
 
using ModuleType = EDAnalyzer
 
- Protected Member Functions inherited from art::Observer
 Observer (fhicl::ParameterSet const &config)
 
 Observer (std::vector< std::string > const &paths, fhicl::ParameterSet const &config)
 
detail::ProcessAndEventSelectorsprocessAndEventSelectors ()
 
- Protected Member Functions inherited from art::ModuleBase
ConsumesCollectorconsumesCollector ()
 
template<typename T , BranchType = InEvent>
ProductToken< T > consumes (InputTag const &)
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > consumesView (InputTag const &)
 
template<typename T , BranchType = InEvent>
void consumesMany ()
 
template<typename T , BranchType = InEvent>
ProductToken< T > mayConsume (InputTag const &)
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > mayConsumeView (InputTag const &)
 
template<typename T , BranchType = InEvent>
void mayConsumeMany ()
 

Detailed Description

Definition at line 70 of file CTreeGeometry_module.cc.

Constructor & Destructor Documentation

DUNE::CTreeGeometry::CTreeGeometry ( fhicl::ParameterSet const &  pset)
explicit

Definition at line 116 of file CTreeGeometry_module.cc.

117  : EDAnalyzer(parameterSet)
118 {
119  reconfigure(parameterSet);
120 }
void reconfigure(fhicl::ParameterSet const &pset)
EDAnalyzer(fhicl::ParameterSet const &pset)
Definition: EDAnalyzer.h:27
DUNE::CTreeGeometry::~CTreeGeometry ( )
virtual

Definition at line 124 of file CTreeGeometry_module.cc.

125 {
126 }

Member Function Documentation

void DUNE::CTreeGeometry::analyze ( const art::Event evt)

Definition at line 256 of file CTreeGeometry_module.cc.

257 {
258 
259  // fEvent = event.id().event();
260  // fRun = event.run();
261  // fSubRun = event.subRun();
262 
263  // printEvent();
264 
265 }
void DUNE::CTreeGeometry::beginJob ( )
virtual

Reimplemented from art::EDAnalyzer.

Definition at line 136 of file CTreeGeometry_module.cc.

137 {
138 
139  fNcryostats = fGeom->Ncryostats(); // 1
140 
141  fNTPC = fGeom->NTPC();
142  for (int i=0; i<fNTPC; i++) {
143  fTPC_x.push_back(fGeom->DetHalfWidth(i)*2);
144  fTPC_y.push_back(fGeom->DetHalfHeight(i)*2);
145  fTPC_z.push_back(fGeom->DetLength(i));
146  }
147 
148  fNplanes = fGeom->Nplanes();
149  for (int i=0; i<fNplanes; i++) {
150  fPlane_type.push_back(fGeom->SignalType(geo::PlaneID(0, 0, i)));
151  fPlane_view.push_back(fGeom->Plane(i).View());
152  // fPlane_wirepitch[i] = fGeom->WirePitch(fPlane_view[i]); // this doesn't seem to return the correct value!
153  fPlane_wirepitch.push_back(fGeom->WirePitch(fPlane_view[i], 1, 0)); // this doesn't seem to return the correct value);
155  fPlane_wires.push_back(fGeom->Nwires(i));
156  }
157 
159 
160  printGeometry();
161 
162 
163  // Save Channel Map to text file.
164  if (fSaveChannelWireMap) {
166  }
167 
168 }
PlaneGeo const & Plane(unsigned int const p, unsigned int const tpc=0, unsigned int const cstat=0) const
Returns the specified wire.
geo::Length_t DetHalfWidth(geo::TPCID const &tpcid) const
Returns the half width of the active volume of the specified TPC.
The data type to uniquely identify a Plane.
Definition: geo_types.h:468
SigType_t SignalType(geo::PlaneID const &pid) const
Returns the type of signal on the channels of specified TPC plane.
unsigned int Ncryostats() const
Returns the number of cryostats in the detector.
geo::Length_t WirePitch(geo::PlaneID const &planeid) const
Returns the distance between two consecutive wires.
unsigned int Nwires(unsigned int p, unsigned int tpc=0, unsigned int cstat=0) const
Returns the total number of wires in the specified plane.
unsigned int Nchannels() const
Returns the number of TPC readout channels in the detector.
vector< double > fPlane_wirepitch
vector< double > fPlane_wireangle
View_t View() const
Which coordinate does this plane measure.
Definition: PlaneGeo.h:184
unsigned int Nplanes(unsigned int tpc=0, unsigned int cstat=0) const
Returns the total number of wire planes in the specified TPC.
geo::Length_t DetHalfHeight(geo::TPCID const &tpcid) const
Returns the half height of the active volume of the specified TPC.
art::ServiceHandle< geo::Geometry > fGeom
geo::Length_t DetLength(geo::TPCID const &tpcid) const
Returns the length of the active volume of the specified TPC.
unsigned int NTPC(unsigned int cstat=0) const
Returns the total number of TPCs in the specified cryostat.
double WireAngleToVertical(geo::View_t view, geo::TPCID const &tpcid) const
Returns the angle of the wires in the specified view from vertical.
void DUNE::CTreeGeometry::endJob ( )
virtual

Reimplemented from art::EDAnalyzer.

Definition at line 207 of file CTreeGeometry_module.cc.

208 {
209 }
void DUNE::CTreeGeometry::printGeometry ( )

Definition at line 213 of file CTreeGeometry_module.cc.

214 {
215  cout << "Detector Name: " << fGeom->DetectorName() << endl;
216  cout << "GDML file: " << fGeom->GDMLFile() << endl;
217  cout << "fNTPC: " << fNTPC << endl;
218  for (int i=0; i<fNTPC; i++) {
219  cout << "\tTPC " << i << ": " << fTPC_x[i] << ", " << fTPC_y[i] << ", " << fTPC_z[i] << endl;
220  }
221  cout << "TPC Locations: " << endl;
222  for (geo::TPCGeo const& TPC: fGeom->IterateTPCs()) {
223  // get center in world coordinates
224  double origin[3] = {0.};
225  double center[3] = {0.};
226  TPC.LocalToWorld(origin, center);
227  double tpcDim[3] = {TPC.HalfWidth(), TPC.HalfHeight(), 0.5*TPC.Length() };
228  double xmin = center[0] - tpcDim[0];
229  double xmax = center[0] + tpcDim[0];
230  double ymin = center[1] - tpcDim[1];
231  double ymax = center[1] + tpcDim[1];
232  double zmin = center[2] - tpcDim[2];
233  double zmax = center[2] + tpcDim[2];
234  cout << "\t[" << xmin << ", " << xmax << ", " << ymin << ", " << ymax
235  << ", " << zmin << ", " << zmax << "]" << endl;
236  } // for all TPC
237 
238  cout << "fNplanes: " << fNplanes << endl;
239  for (int i=0; i<fNplanes; i++) {
240  cout
241  << "\tplane " << i
242  << "( type: " << fPlane_type[i]
243  << ", view: " << fPlane_view[i]
244  << ", wirepitch: " << fPlane_wirepitch[i]
245  << ", wire angle: " << fPlane_wireangle[i]
246  << ", wires: " << fPlane_wires[i]
247  << ")" << endl;
248  }
249  cout << "fNchannels: " << fNchannels << endl;
250  cout << "fNOpDet: " << fGeom->NOpDets() << endl;
251  cout << "fAuxDetectors: " << fGeom->NAuxDets() << endl;
252  cout << endl;
253 }
Geometry information for a single TPC.
Definition: TPCGeo.h:38
vector< double > fPlane_wirepitch
std::string GDMLFile() const
Returns the full directory path to the GDML file source.
vector< double > fPlane_wireangle
std::string DetectorName() const
Returns a string with the name of the detector, as configured.
IteratorBox< TPC_iterator,&GeometryCore::begin_TPC,&GeometryCore::end_TPC > IterateTPCs() const
Enables ranged-for loops on all TPCs of the detector.
art::ServiceHandle< geo::Geometry > fGeom
unsigned int NOpDets() const
Number of OpDets in the whole detector.
def center(depos, point)
Definition: depos.py:117
constexpr Point origin()
Returns a origin position with a point of the specified type.
Definition: geo_vectors.h:227
QTextStream & endl(QTextStream &s)
unsigned int NAuxDets() const
Returns the number of auxiliary detectors.
void DUNE::CTreeGeometry::reconfigure ( fhicl::ParameterSet const &  pset)

Definition at line 130 of file CTreeGeometry_module.cc.

130  {
131  fSaveChannelWireMap = p.get< bool >("saveChannelWireMap");
132 }
p
Definition: test.py:223
void DUNE::CTreeGeometry::saveChannelWireMap ( )

Definition at line 172 of file CTreeGeometry_module.cc.

173 {
174  ofstream out;
175  out.open("ChannelWireGeometry.txt");
176  double xyzStart[3];
177  double xyzEnd[3];
178  out << "# channel\ttpc\tplane\twire\tsx\tsy\tsz\tex\tey\tez\n";
179  for (int i=0; i<fNchannels; i++) {
180  std::vector<geo::WireID> wireids = fGeom->ChannelToWire(i);
181  int nWires = wireids.size();
182  for (int j=0; j<nWires; j++) {
183  geo::WireID wid = wireids.at(j);
184  int cstat = wid.Cryostat;
185  int tpc = wid.TPC;
186  int plane = wid.Plane;
187  int wire = wid.Wire;
188 
189  fGeom->WireEndPoints(cstat, tpc, plane, wire, xyzStart, xyzEnd);
190 
191  out << i << "\t" << tpc << "\t" << plane << "\t" << wire << "\t";
192  for (int i=0; i<3; i++) {
193  out << xyzStart[i] << "\t";
194  }
195  for (int i=0; i<3; i++) {
196  out << xyzEnd[i] << "\t";
197  }
198  out << "\n";
199  }
200  }
201  out.close();
202 
203 }
std::vector< geo::WireID > ChannelToWire(raw::ChannelID_t const channel) const
Returns a list of wires connected to the specified TPC channel.
CryostatID_t Cryostat
Index of cryostat.
Definition: geo_types.h:208
WireID_t Wire
Index of the wire within its plane.
Definition: geo_types.h:576
art::ServiceHandle< geo::Geometry > fGeom
PlaneID_t Plane
Index of the plane within its TPC.
Definition: geo_types.h:489
void WireEndPoints(geo::WireID const &wireid, double *xyzStart, double *xyzEnd) const
Fills two arrays with the coordinates of the wire end points.
TPCID_t TPC
Index of the TPC within its cryostat.
Definition: geo_types.h:402

Member Data Documentation

art::ServiceHandle<geo::Geometry> DUNE::CTreeGeometry::fGeom
private

Definition at line 90 of file CTreeGeometry_module.cc.

int DUNE::CTreeGeometry::fNchannels
private

Definition at line 104 of file CTreeGeometry_module.cc.

int DUNE::CTreeGeometry::fNcryostats
private

Definition at line 93 of file CTreeGeometry_module.cc.

int DUNE::CTreeGeometry::fNplanes
private

Definition at line 98 of file CTreeGeometry_module.cc.

int DUNE::CTreeGeometry::fNTPC
private

Definition at line 94 of file CTreeGeometry_module.cc.

vector<int> DUNE::CTreeGeometry::fPlane_type
private

Definition at line 99 of file CTreeGeometry_module.cc.

vector<int> DUNE::CTreeGeometry::fPlane_view
private

Definition at line 100 of file CTreeGeometry_module.cc.

vector<double> DUNE::CTreeGeometry::fPlane_wireangle
private

Definition at line 102 of file CTreeGeometry_module.cc.

vector<double> DUNE::CTreeGeometry::fPlane_wirepitch
private

Definition at line 101 of file CTreeGeometry_module.cc.

vector<int> DUNE::CTreeGeometry::fPlane_wires
private

Definition at line 103 of file CTreeGeometry_module.cc.

bool DUNE::CTreeGeometry::fSaveChannelWireMap
private

Definition at line 88 of file CTreeGeometry_module.cc.

vector<float> DUNE::CTreeGeometry::fTPC_x
private

Definition at line 95 of file CTreeGeometry_module.cc.

vector<float> DUNE::CTreeGeometry::fTPC_y
private

Definition at line 96 of file CTreeGeometry_module.cc.

vector<float> DUNE::CTreeGeometry::fTPC_z
private

Definition at line 97 of file CTreeGeometry_module.cc.


The documentation for this class was generated from the following file: