Public Member Functions | Private Attributes | List of all members
ICARUS::CTreeGeometry Class Reference
Inheritance diagram for ICARUS::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
 
vector< int > fPlane_type
 
vector< int > fPlane_view
 
vector< double > fPlane_wirepitch
 
vector< double > fPlane_wireangle
 
vector< int > fPlane_wires
 
int fNchannels
 
vector< int > channel_starts
 
vector< int > channel_ends
 

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 68 of file CTreeGeometry_module.cc.

Constructor & Destructor Documentation

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

Definition at line 116 of file CTreeGeometry_module.cc.

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

Definition at line 124 of file CTreeGeometry_module.cc.

125 {
126 }

Member Function Documentation

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

Definition at line 292 of file CTreeGeometry_module.cc.

293 {
294 
295  // fEvent = event.id().event();
296  // fRun = event.run();
297  // fSubRun = event.subRun();
298 
299  // printEvent();
300 
301 }
void ICARUS::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  // cout << "#planes: " << fNplanes << endl;
150  // for (int i=0; i<fNplanes; i++) {
151  // fPlane_type.push_back(fGeom->SignalType(geo::PlaneID(0, 0, i)));
152  // fPlane_view.push_back(fGeom->Plane(i).View());
153  // // fPlane_wirepitch[i] = fGeom->WirePitch(fPlane_view[i]); // this doesn't seem to return the correct value!
154  // fPlane_wirepitch.push_back(fGeom->WirePitch(fPlane_view[i], 1, 0)); // this doesn't seem to return the correct value);
155  // fPlane_wireangle.push_back(fGeom->WireAngleToVertical(fGeom->Plane(i).View()));
156  // fPlane_wires.push_back(fGeom->Nwires(i));
157  // }
158 
160  // cout << "#channel: " << fNchannels << endl;
161 
162  // Save Channel Map to text file.
163  if (fSaveChannelWireMap) {
165  }
166 
167  printGeometry();
168 
169 
170 }
geo::Length_t DetHalfWidth(geo::TPCID const &tpcid) const
Returns the half width of the active volume of the specified TPC.
unsigned int Ncryostats() const
Returns the number of cryostats in the detector.
unsigned int Nchannels() const
Returns the number of TPC readout channels in the detector.
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.
void ICARUS::CTreeGeometry::endJob ( )
virtual

Reimplemented from art::EDAnalyzer.

Definition at line 223 of file CTreeGeometry_module.cc.

224 {
225 }
void ICARUS::CTreeGeometry::printGeometry ( )

Definition at line 229 of file CTreeGeometry_module.cc.

230 {
231  cout << "Detector Name: " << fGeom->DetectorName() << endl;
232  cout << "GDML file: " << fGeom->GDMLFile() << endl;
233  // cout << "fNTPC: " << fNTPC << endl;
234  // for (int i=0; i<fNTPC; i++) {
235  // cout << "\tTPC " << i << ": " << fTPC_x[i] << ", " << fTPC_y[i] << ", " << fTPC_z[i] << endl;
236  // }
237  cout << "TPC (Active) Locations: " << endl;
238  for (geo::TPCGeo const& TPC: fGeom->IterateTPCs()) {
239  // get center in world coordinates
240  double origin[3] = {0.};
241  double center[3] = {0.};
242  TPC.LocalToWorld(origin, center);
243  double tpcDim[3] = {TPC.ActiveHalfWidth(), TPC.ActiveHalfHeight(), 0.5*TPC.ActiveLength() };
244  double xmin = center[0] - tpcDim[0];
245  double xmax = center[0] + tpcDim[0];
246  double ymin = center[1] - tpcDim[1];
247  double ymax = center[1] + tpcDim[1];
248  double zmin = center[2] - tpcDim[2];
249  double zmax = center[2] + tpcDim[2];
250  cout << "\t[" << xmin << ", " << xmax << ", " << ymin << ", " << ymax
251  << ", " << zmin << ", " << zmax << "]" << endl;
252  } // for all TPC
253 
254  int size = channel_starts.size();
255  cout << size << " planes: first channels: ";
256  for (int i=0; i<size ; i++) {
257  cout << channel_starts[i] << ", ";
258  }
259  cout << endl;
260  size = channel_ends.size();
261  cout << size << " planes: last channels: ";
262  for (int i=0; i<size ; i++) {
263  cout << channel_ends[i] << ", ";
264  }
265  cout << endl;
266  // for (geo::TPCGeo const& TPC: fGeom->IterateTPCs()) {
267  // for (geo::PlaneGeo const& plane: TPC.IteratePlanes()) {
268  // cout << plane.ID() <<
269  // " channels: " fGeom->PlaneWireToChannel(plane.FirstWire().node())<< endl;
270  // }
271 
272  // }
273 
274  // cout << "fNplanes: " << fNplanes << endl;
275  // for (int i=0; i<fNplanes; i++) {
276  // cout
277  // << "\tplane " << i
278  // << "( type: " << fPlane_type[i]
279  // << ", view: " << fPlane_view[i]
280  // << ", wirepitch: " << fPlane_wirepitch[i]
281  // << ", wire angle: " << fPlane_wireangle[i]
282  // << ", wires: " << fPlane_wires[i]
283  // << ")" << endl;
284  // }
285  cout << "fNchannels: " << fGeom->Nchannels() << endl;
286  cout << "fNOpDet: " << fGeom->NOpDets() << endl;
287  cout << "fAuxDetectors: " << fGeom->NAuxDets() << endl;
288  cout << endl;
289 }
Geometry information for a single TPC.
Definition: TPCGeo.h:38
unsigned int Nchannels() const
Returns the number of TPC readout channels in the detector.
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
Definition: StdUtils.h:92
std::string GDMLFile() const
Returns the full directory path to the GDML file source.
art::ServiceHandle< geo::Geometry > fGeom
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.
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 ICARUS::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 ICARUS::CTreeGeometry::saveChannelWireMap ( )

Definition at line 174 of file CTreeGeometry_module.cc.

175 {
176  ofstream out;
177  out.open("ChannelWireGeometry.txt");
178  double xyzStart[3];
179  double xyzEnd[3];
180  out << "# " << fGeom->GDMLFile() << "\n";
181  out << "# channel\ttpc\tplane\twire\tsx\tsy\tsz\tex\tey\tez\n";
182  int current_plane = 0;
183  channel_starts.push_back(0);
184  channel_ends.push_back(0);
185  for (int i=0; i<fNchannels; i++) {
186  std::vector<geo::WireID> wireids = fGeom->ChannelToWire(i);
187  int nWires = wireids.size();
188  for (int j=0; j<nWires; j++) {
189  geo::WireID wid = wireids.at(j);
190  int cstat = wid.Cryostat;
191  int tpc = wid.TPC;
192  int plane = wid.Plane;
193  int wire = wid.Wire;
194 
195  int plane_id = plane + tpc*10 + cstat*100;
196  if (plane_id != current_plane) {
197  current_plane = plane_id;
198  channel_starts.push_back(i);
199  channel_ends.push_back(i);
200  }
201  else {
202  channel_ends[channel_ends.size()-1] = i;
203  }
204 
205  fGeom->WireEndPoints(cstat, tpc, plane, wire, xyzStart, xyzEnd);
206 
207  out << i << "\t" << cstat*2+tpc << "\t" << plane << "\t" << wire << "\t";
208  for (int i=0; i<3; i++) {
209  out << xyzStart[i] << "\t";
210  }
211  for (int i=0; i<3; i++) {
212  out << xyzEnd[i] << "\t";
213  }
214  out << "\n";
215  }
216  }
217  out.close();
218 
219 }
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:212
WireID_t Wire
Index of the wire within its plane.
Definition: geo_types.h:580
std::string GDMLFile() const
Returns the full directory path to the GDML file source.
art::ServiceHandle< geo::Geometry > fGeom
PlaneID_t Plane
Index of the plane within its TPC.
Definition: geo_types.h:493
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:406

Member Data Documentation

vector<int> ICARUS::CTreeGeometry::channel_ends
private

Definition at line 104 of file CTreeGeometry_module.cc.

vector<int> ICARUS::CTreeGeometry::channel_starts
private

Definition at line 103 of file CTreeGeometry_module.cc.

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

Definition at line 88 of file CTreeGeometry_module.cc.

int ICARUS::CTreeGeometry::fNchannels
private

Definition at line 102 of file CTreeGeometry_module.cc.

int ICARUS::CTreeGeometry::fNcryostats
private

Definition at line 91 of file CTreeGeometry_module.cc.

int ICARUS::CTreeGeometry::fNTPC
private

Definition at line 92 of file CTreeGeometry_module.cc.

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

Definition at line 97 of file CTreeGeometry_module.cc.

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

Definition at line 98 of file CTreeGeometry_module.cc.

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

Definition at line 100 of file CTreeGeometry_module.cc.

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

Definition at line 99 of file CTreeGeometry_module.cc.

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

Definition at line 101 of file CTreeGeometry_module.cc.

bool ICARUS::CTreeGeometry::fSaveChannelWireMap
private

Definition at line 86 of file CTreeGeometry_module.cc.

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

Definition at line 93 of file CTreeGeometry_module.cc.

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

Definition at line 94 of file CTreeGeometry_module.cc.

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

Definition at line 95 of file CTreeGeometry_module.cc.


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