5 #ifndef CTreeGeometry_module 6 #define CTreeGeometry_module 42 #include "canvas/Persistency/Common/FindManyP.h" 72 virtual ~CTreeGeometry();
79 void saveChannelWireMap();
86 bool fSaveChannelWireMap;
97 vector<int> fPlane_type;
98 vector<int> fPlane_view;
99 vector<double> fPlane_wirepitch;
100 vector<double> fPlane_wireangle;
101 vector<int> fPlane_wires;
103 vector<int> channel_starts;
104 vector<int> channel_ends;
117 : EDAnalyzer(parameterSet)
124 CTreeGeometry::~CTreeGeometry()
131 fSaveChannelWireMap = p.
get<
bool >(
"saveChannelWireMap");
139 fNcryostats = fGeom->Ncryostats();
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));
159 fNchannels = fGeom->Nchannels();
163 if (fSaveChannelWireMap) {
164 saveChannelWireMap();
174 void CTreeGeometry::saveChannelWireMap()
177 out.open(
"ChannelWireGeometry.txt");
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++) {
192 int plane = wid.
Plane;
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);
202 channel_ends[channel_ends.size()-1] = i;
205 fGeom->WireEndPoints(cstat, tpc, plane, wire, xyzStart, xyzEnd);
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";
211 for (
int i=0; i<3; i++) {
212 out << xyzEnd[i] <<
"\t";
223 void CTreeGeometry::endJob()
229 void CTreeGeometry::printGeometry()
231 cout <<
"Detector Name: " << fGeom->DetectorName() <<
endl;
232 cout <<
"GDML file: " << fGeom->GDMLFile() <<
endl;
237 cout <<
"TPC (Active) Locations: " <<
endl;
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;
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] <<
", ";
260 size = channel_ends.size();
261 cout << size <<
" planes: last channels: ";
262 for (
int i=0; i<
size ; i++) {
263 cout << channel_ends[i] <<
", ";
285 cout <<
"fNchannels: " << fGeom->Nchannels() <<
endl;
286 cout <<
"fNOpDet: " << fGeom->NOpDets() <<
endl;
287 cout <<
"fAuxDetectors: " << fGeom->NAuxDets() <<
endl;
307 #endif // CTreeGeometry_module def analyze(root, level, gtrees, gbranches, doprint)
Encapsulate the construction of a single cyostat.
Geometry information for a single TPC.
CryostatID_t Cryostat
Index of cryostat.
WireID_t Wire
Index of the wire within its plane.
art framework interface to geometry description
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
#define DEFINE_ART_MODULE(klass)
virtual void reconfigure(fhicl::ParameterSet const &pset)
T get(std::string const &key) const
PlaneID_t Plane
Index of the plane within its TPC.
Definition of data types for geometry description.
Encapsulate the geometry of an optical detector.
Declaration of signal hit object.
Encapsulate the construction of a single detector plane.
Provides recob::Track data product.
Declaration of basic channel signal object.
TPCID_t TPC
Index of the TPC within its cryostat.
constexpr Point origin()
Returns a origin position with a point of the specified type.
QTextStream & endl(QTextStream &s)
Event finding and building.