37 void saveChannelWireMap();
41 bool fSaveChannelWireMap;
51 vector<int> channel_starts;
52 vector<int> channel_ends;
58 : EDAnalyzer(pset), fSaveChannelWireMap{pset.
get<
bool>(
"saveChannelWireMap")}
64 fNchannels = fWireReadoutGeom->Nchannels();
67 if (fSaveChannelWireMap) { saveChannelWireMap(); }
73 void CTreeGeometry::saveChannelWireMap()
76 out.open(
"ChannelWireGeometry.txt");
79 out <<
"# " << fGeom->GDMLFile() <<
"\n";
80 out <<
"# channel\ttpc\tplane\twire\tsx\tsy\tsz\tex\tey\tez\n";
81 int current_plane = 0;
82 channel_starts.push_back(0);
83 channel_ends.push_back(0);
84 for (
int i = 0; i < fNchannels; i++) {
85 std::vector<geo::WireID> wireids = fWireReadoutGeom->ChannelToWire(i);
86 int nWires = wireids.size();
87 for (
int j = 0; j < nWires; j++) {
91 int plane = wid.
Plane;
94 int plane_id = plane + tpc * 10 + cstat * 100;
95 if (plane_id != current_plane) {
96 current_plane = plane_id;
97 channel_starts.push_back(i);
98 channel_ends.push_back(i);
101 channel_ends[channel_ends.size() - 1] = i;
104 fWireReadoutGeom->WireEndPoints(wid, xyzStart, xyzEnd);
106 out << i <<
"\t" << cstat * 2 + tpc <<
"\t" << plane <<
"\t" << wire <<
"\t";
107 for (
int i = 0; i < 3; i++) {
108 out << xyzStart[i] <<
"\t";
110 for (
int i = 0; i < 3; i++) {
111 out << xyzEnd[i] <<
"\t";
120 void CTreeGeometry::printGeometry()
122 cout <<
"Detector Name: " << fGeom->DetectorName() << endl;
123 cout <<
"GDML file: " << fGeom->GDMLFile() << endl;
124 cout <<
"TPC (Active) Locations: " << endl;
127 auto const center = TPC.GetCenter();
128 double tpcDim[3] = {TPC.ActiveHalfWidth(), TPC.ActiveHalfHeight(), 0.5 * TPC.ActiveLength()};
129 double xmin = center.X() - tpcDim[0];
130 double xmax = center.X() + tpcDim[0];
131 double ymin = center.Y() - tpcDim[1];
132 double ymax = center.Y() + tpcDim[1];
133 double zmin = center.Z() - tpcDim[2];
134 double zmax = center.Z() + tpcDim[2];
135 cout <<
"\t[" << xmin <<
", " << xmax <<
", " << ymin <<
", " << ymax <<
", " << zmin <<
", " 136 << zmax <<
"]" << endl;
139 int size = channel_starts.size();
140 cout << size <<
" planes: first channels: ";
141 for (
int i = 0; i <
size; i++) {
142 cout << channel_starts[i] <<
", ";
145 size = channel_ends.size();
146 cout << size <<
" planes: last channels: ";
147 for (
int i = 0; i <
size; i++) {
148 cout << channel_ends[i] <<
", ";
152 cout <<
"fNchannels: " << fNchannels << endl;
153 cout <<
"fNOpDet: " << fGeom->NOpDets() << endl;
154 cout <<
"fAuxDetectors: " << fAuxDetGeom->NAuxDets() << endl;
159 void CTreeGeometry::analyze(
const art::Event&) {}
Geometry information for a single TPC.
CryostatID_t Cryostat
Index of cryostat.
cout<< "Opened file "<< fin<< " ixs= "<< ixs<< endl;if(ixs==0) hhh=(TH1F *) fff-> Get("h1")
WireID_t Wire
Index of the wire within its plane.
Description of physical geometry of one set of auxiliary detectors.
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
#define DEFINE_ART_MODULE(klass)
Interface for a class providing readout channel mapping to geometry.
T get(std::string const &key) const
art framework interface to geometry description for auxiliary detectors
PlaneID_t Plane
Index of the plane within its TPC.
Definition of data types for geometry description.
TPCID_t TPC
Index of the TPC within its cryostat.
art framework interface to geometry description
Encapsulate the construction of a single detector plane .