19 #include "art_root_io/TFileService.h" 37 #include "nug4/MagneticFieldServices/MagneticFieldService.h" 109 auto const* MagField = MagFieldHandle->provider();
110 double Efield = detProp.Efield();
111 double Temperature = detProp.Temperature();
112 double DriftVelocity = detProp.DriftVelocity(Efield, Temperature) / 1000.;
117 fDirCosY = -DriftVelocity * MagField->FieldAtPoint().z() / Efield;
118 fDirCosZ = +DriftVelocity * MagField->FieldAtPoint().y() / Efield;
130 double zScale =
std::max(fDirCosZ / 2.0, 4
e-4);
134 tfs->make<TH1D>(
"hChargeXpos",
"MC X charge depositions; X (cm); Events", 101, 0.0, width);
136 "hChargeYpos",
"MC Y charge depositions; Y (cm); Events", 101, -halfHeight, halfHeight);
138 tfs->make<TH1D>(
"hChargeZpos",
"MC Z charge depositions; Z (cm); Events", 101, 0.0, length);
139 fHitZpos = tfs->make<TH1D>(
"hHitZpos",
"Z charge collection; Z (cm); Events", 101, 0.0, length);
142 "Z drift of charge; delta Z (cm); Events",
147 "hDeltaZoverX",
"Z drift of charge; delta Z/X; Events", 51, -10 * zScale, 10 * zScale);
149 "delta Z vs X; X (cm); delta Z (cm), Events",
159 "Z drift of charge (long drift); delta Z (cm); Events",
164 "Z drift of charge (long drift); delta Z/X; Events",
177 l->SetLineColor(kRed);
178 l->SetLineStyle(kDotted);
186 l->SetLineColor(kRed);
187 l->SetLineStyle(kDotted);
196 throw cet::exception(
"MagDriftAna: ") <<
"Not for use on Data yet...\n";
213 std::vector<art::Ptr<recob::Hit>> hits;
221 for (
auto itr : hits) {
223 hitWireID = itr->
WireID();
231 double w0pos[3] = {0.};
234 double Charge = itr->Integral();
238 std::vector<double> xyz = bt_serv->
HitToXYZ(clockData, itr);
241 double ChargeZpos = xyz[2];
248 double DeltaZ = HitZpos - ChargeZpos;
255 if (xyz[0] > (
fChargeYpos->GetXaxis()->GetXmax() * 0.80)) {
void analyze(const art::Event &evt) override
WireGeo const & Wire(unsigned int iwire) const
std::string fLArG4ModuleLabel
std::string fFFTHitFinderModuleLabel
WireID_t Wire
Index of the wire within its plane.
std::vector< double > HitToXYZ(detinfo::DetectorClocksData const &clockData, const recob::Hit &hit) const
EDAnalyzer(fhicl::ParameterSet const &pset)
art framework interface to geometry description
double Length() const
Length is associated with z coordinate [cm].
Base class for creation of raw signals on wires.
bool getByLabel(std::string const &label, std::string const &instance, Handle< PROD > &result) const
unsigned int Nplanes(unsigned int tpc=0, unsigned int cstat=0) const
Returns the total number of wire planes in the specified TPC.
#define DEFINE_ART_MODULE(klass)
T get(std::string const &key) const
double WirePitch(unsigned plane=0) const
static int max(int a, int b)
PlaneID_t Plane
Index of the plane within its TPC.
MagDriftAna(fhicl::ParameterSet const &pset)
Detector simulation of raw signals on wires.
Encapsulate the geometry of a wire.
double HalfHeight() const
Height is associated with y coordinate [cm].
void ensureHists(art::Event const &evt, detinfo::DetectorClocksData const &clockData)
Declaration of signal hit object.
Encapsulate the construction of a single detector plane.
Contains all timing reference information for the detector.
#define MF_LOG_VERBATIM(category)
constexpr WireID()=default
Default constructor: an invalid TPC ID.
TPCGeo const & TPC(unsigned int const tpc=0, unsigned int const cstat=0) const
Returns the specified TPC.
PlaneGeo const & Plane(geo::View_t view) const
Return the plane in the tpc with View_t view.
void GetCenter(double *xyz, double localz=0.0) const
Fills the world coordinate of a point on the wire.
void fill_ptr_vector(std::vector< Ptr< T >> &ptrs, H const &h)
TPCID_t TPC
Index of the TPC within its cryostat.
double HalfWidth() const
Width is associated with x coordinate [cm].
cet::coded_exception< error, detail::translate > exception
Encapsulate the construction of a single detector plane.