5 #ifndef CTreeGeometry_module
6 #define CTreeGeometry_module
33 #include "art/Framework/Core/EDAnalyzer.h"
34 #include "art/Framework/Principal/Event.h"
35 #include "art/Framework/Principal/Handle.h"
36 #include "art/Framework/Principal/Run.h"
37 #include "art/Framework/Principal/SubRun.h"
38 #include "art/Framework/Services/Registry/ServiceHandle.h"
40 #include "canvas/Utilities/InputTag.h"
41 #include "art/Framework/Core/ModuleMacros.h"
42 #include "canvas/Persistency/Common/FindManyP.h"
43 #include "canvas/Persistency/Common/PtrVector.h"
44 #include "messagefacility/MessageLogger/MessageLogger.h"
45 #include "fhiclcpp/ParameterSet.h"
68 class CTreeGeometry :
public art::EDAnalyzer {
71 explicit CTreeGeometry(fhicl::ParameterSet
const& pset);
72 virtual ~CTreeGeometry();
79 void saveChannelWireMap();
86 bool fSaveChannelWireMap;
88 art::ServiceHandle<geo::Geometry>
fGeom;
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;
116 CTreeGeometry::CTreeGeometry(fhicl::ParameterSet
const& parameterSet)
117 : EDAnalyzer(parameterSet)
124 CTreeGeometry::~CTreeGeometry()
131 fSaveChannelWireMap = p.get<
bool >(
"saveChannelWireMap");
136 void CTreeGeometry::beginJob()
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;
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;
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;
303 DEFINE_ART_MODULE(CTreeGeometry)
307 #endif // CTreeGeometry_module
process_name opflashCryo1 flashfilter analyze
double std(const std::vector< short > &wf, const double ped_mean, size_t start, size_t nsample)
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.
std::size_t size(FixedBins< T, C > const &) noexcept
WireID_t Wire
Index of the wire within its plane.
process_name pandoraGausCryo1 vertexChargeCryo1 vertexStubCryo1 xmin
Collect all the RawData header files together.
PlaneID_t Plane
Index of the plane within its TPC.
Declaration of cluster object.
Definition of data types for geometry description.
Provides recob::Track data product.
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
BEGIN_PROLOG could also be cout
constexpr Point origin()
Returns a origin position with a point of the specified type.