5 #ifndef CTreeGeometry_module 6 #define CTreeGeometry_module 69 virtual ~CTreeGeometry();
76 void saveChannelWireMap();
81 bool fSaveChannelWireMap;
92 vector<int> fPlane_type;
93 vector<int> fPlane_view;
94 vector<double> fPlane_wirepitch;
95 vector<double> fPlane_wireangle;
96 vector<int> fPlane_wires;
98 vector<int> channel_starts;
99 vector<int> channel_ends;
110 CTreeGeometry::CTreeGeometry(
fhicl::ParameterSet const& parameterSet) : EDAnalyzer(parameterSet)
112 reconfigure(parameterSet);
116 CTreeGeometry::~CTreeGeometry() {}
121 fSaveChannelWireMap = p.
get<
bool>(
"saveChannelWireMap");
128 fNcryostats = fGeom->Ncryostats();
130 fNTPC = fGeom->NTPC();
131 for (
auto const& tpc : fGeom->Iterate<
geo::TPCGeo>()) {
132 fTPC_x.push_back(tpc.HalfWidth() * 2);
133 fTPC_y.push_back(tpc.HalfHeight() * 2);
134 fTPC_z.push_back(tpc.Length());
148 fNchannels = fGeom->Nchannels();
152 if (fSaveChannelWireMap) { saveChannelWireMap(); }
158 void CTreeGeometry::saveChannelWireMap()
161 out.open(
"ChannelWireGeometry.txt");
164 out <<
"# " << fGeom->GDMLFile() <<
"\n";
165 out <<
"# channel\ttpc\tplane\twire\tsx\tsy\tsz\tex\tey\tez\n";
166 int current_plane = 0;
167 channel_starts.push_back(0);
168 channel_ends.push_back(0);
169 for (
int i = 0; i < fNchannels; i++) {
170 std::vector<geo::WireID> wireids = fGeom->ChannelToWire(i);
171 int nWires = wireids.size();
172 for (
int j = 0; j < nWires; j++) {
176 int plane = wid.
Plane;
179 int plane_id = plane + tpc * 10 + cstat * 100;
180 if (plane_id != current_plane) {
181 current_plane = plane_id;
182 channel_starts.push_back(i);
183 channel_ends.push_back(i);
186 channel_ends[channel_ends.size() - 1] = i;
189 fGeom->WireEndPoints(wid, xyzStart, xyzEnd);
191 out << i <<
"\t" << cstat * 2 + tpc <<
"\t" << plane <<
"\t" << wire <<
"\t";
192 for (
int i = 0; i < 3; i++) {
193 out << xyzStart[i] <<
"\t";
195 for (
int i = 0; i < 3; i++) {
196 out << xyzEnd[i] <<
"\t";
205 void CTreeGeometry::endJob() {}
208 void CTreeGeometry::printGeometry()
210 cout <<
"Detector Name: " << fGeom->DetectorName() << endl;
211 cout <<
"GDML file: " << fGeom->GDMLFile() << endl;
216 cout <<
"TPC (Active) Locations: " << endl;
219 auto const center = TPC.GetCenter();
220 double tpcDim[3] = {TPC.ActiveHalfWidth(), TPC.ActiveHalfHeight(), 0.5 * TPC.ActiveLength()};
221 double xmin = center.X() - tpcDim[0];
222 double xmax = center.X() + tpcDim[0];
223 double ymin = center.Y() - tpcDim[1];
224 double ymax = center.Y() + tpcDim[1];
225 double zmin = center.Z() - tpcDim[2];
226 double zmax = center.Z() + tpcDim[2];
227 cout <<
"\t[" << xmin <<
", " << xmax <<
", " << ymin <<
", " << ymax <<
", " << zmin <<
", " 228 << zmax <<
"]" << endl;
231 int size = channel_starts.size();
232 cout << size <<
" planes: first channels: ";
233 for (
int i = 0; i <
size; i++) {
234 cout << channel_starts[i] <<
", ";
237 size = channel_ends.size();
238 cout << size <<
" planes: last channels: ";
239 for (
int i = 0; i <
size; i++) {
240 cout << channel_ends[i] <<
", ";
262 cout <<
"fNchannels: " << fGeom->Nchannels() << endl;
263 cout <<
"fNOpDet: " << fGeom->NOpDets() << endl;
264 cout <<
"fAuxDetectors: " << fGeom->NAuxDets() << endl;
283 #endif // CTreeGeometry_module
Encapsulate the construction of a single cyostat.
Declaration of signal hit object.
Geometry information for a single TPC.
CryostatID_t Cryostat
Index of cryostat.
Definition of basic raw digits.
WireID_t Wire
Index of the wire within its plane.
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
#define DEFINE_ART_MODULE(klass)
Collect all the RawData header files together.
T get(std::string const &key) const
Provides recob::Track data product.
PlaneID_t Plane
Index of the plane within its TPC.
Declaration of cluster object.
Definition of data types for geometry description.
Encapsulate the geometry of an optical detector.
Encapsulate the construction of a single detector plane.
object containing MC truth information necessary for making RawDigits and doing back tracking ...
Declaration of basic channel signal object.
TPCID_t TPC
Index of the TPC within its cryostat.
art framework interface to geometry description
Event finding and building.