25 #include "cetlib_except/exception.h" 59 std::vector<recob::Hit>&
hits,
115 std::map<raw::ChannelID_t, art::Ptr<recob::Wire>> wireMap;
117 for(
size_t wc = 0;
wc < wHandle->size(); ++
wc){
119 wireMap[wire->
Channel()] = wire;
123 std::vector<const sim::SimChannel*> sccol;
128 std::vector<recob::Hit> hits_on_channel;
134 if (wire.
isNonnull()) rawdigits = WireToRawDigits.at(wire.
key());
144 LOG_DEBUG(
"HitCheater") <<
"putting " << hits.
size() <<
" hits into the event";
152 std::vector<recob::Hit>&
hits,
165 std::vector<geo::WireID> wireids = geo->
ChannelToWire(channel);
167 std::map<geo::WireID, std::map< unsigned int, double> > wireIDSignals;
171 for(
auto const& mapitr : idemap){
172 unsigned short tdc = mapitr.first;
183 for(
auto const& ideitr : mapitr.second){
185 const float edep = ideitr.numElectrons;
187 std::array<double, 3> pos;
195 << pos[0] <<
" ; " << pos[1] <<
" ; " << pos[2] <<
" )" 196 <<
" in no TPC; move on to the next sim::IDE";
199 const unsigned int tpc = tpcID.
TPC;
200 const unsigned int cstat = tpcID.
Cryostat;
202 for(
auto const& wid : wireids){
203 if(wid.TPC == tpc && wid.Cryostat == cstat){
207 if(wid.Wire == geo->
NearestWire(pos.data(), wid.Plane, wid.TPC, wid.Cryostat))
208 wireIDSignals[wid][tdc] +=
edep;
215 for(
auto const& widitr : wireIDSignals){
218 unsigned short prev = widitr.second.begin()->first;
219 unsigned short startTime = prev;
220 double totCharge = 0.;
221 double maxCharge = -1.;
222 double peakTime = 0.;
223 int multiplicity = 1 ;
227 for(
auto tdcitr : widitr.second){
228 unsigned short tdc = tdcitr.first;
231 <<
"SimChannel TDCs going backward!";
247 std::sqrt(maxCharge),
250 std::sqrt(totCharge),
260 LOG_DEBUG(
"HitCheater") <<
"new hit is " << hits.back();
279 time.
add(tdc - startTime, adc);
300 std::sqrt(maxCharge),
303 std::sqrt(totCharge),
313 LOG_DEBUG(
"HitCheater") <<
"last hit is " << hits.back();
343 size_t pos = fWireModuleLabel.find(
":");
344 if( pos!=std::string::npos ) {
346 fWireModuleLabel = fWireModuleLabel.substr( 0, pos );
Store parameters for running LArG4.
int fTriggerOffset
from detinfo::DetectorPropertiesService
double fSamplingRate
from detinfo::DetectorPropertiesService
std::string fWireModuleLabel
label name for module making recob::Wires
Energy deposited on a readout channel by simulated tracks.
int fNumberTimeSamples
Number of total time samples (N*readoutwindowsize)
int fNewHitTDCGap
gap allowed in tdcs without charge before making a new hit
enum geo::_plane_proj View_t
Enumerate the possible plane projections.
void FindHitsOnChannel(const sim::SimChannel *sc, std::vector< recob::Hit > &hits, int spill)
Declaration of signal hit object.
bool isValid
Whether this ID points to a valid element.
std::vector< geo::WireID > ChannelToWire(raw::ChannelID_t const channel) const
Returns a list of wires connected to the specified TPC channel.
CryostatID_t Cryostat
Index of cryostat.
Definition of basic raw digits.
SigType_t SignalType(geo::PlaneID const &pid) const
Returns the type of signal on the channels of specified TPC plane.
std::string fCalDataProductInstanceName
label name for module making recob::Wires
static void declare_products(ModuleType &producer, std::string instance_name="", bool doWireAssns=true, bool doRawDigitAssns=true)
Declares the hit products we are going to fill.
Classes gathering simple statistics.
Weight_t RMS() const
Returns the root mean square.
double fMinCharge
Minimum charge required to make a hit.
int TDCtick_t
Type representing a TDC tick.
geo::TPCID FindTPCAtPosition(double const worldLoc[3]) const
Returns the ID of the TPC at specified location.
std::size_t getView(std::string const &moduleLabel, std::string const &productInstanceName, std::vector< ELEMENT const * > &result) const
Helper functions to create a hit.
A class handling a collection of hits and its associations.
#define DEFINE_ART_MODULE(klass)
std::string fG4ModuleLabel
label name for module making sim::SimChannels
raw::ChannelID_t Channel() const
Returns the ID of the channel (or InvalidChannelID)
enum geo::_plane_sigtype SigType_t
Enumerate the possible plane projections.
T get(std::string const &key) const
geo::WireID::WireID_t NearestWire(geo::Point_t const &point, geo::PlaneID const &planeid) const
Returns the index of wire closest to position in the specified TPC.
void emplace_back(recob::Hit &&hit, art::Ptr< recob::Wire > const &wire=art::Ptr< recob::Wire >(), art::Ptr< raw::RawDigit > const &digits=art::Ptr< raw::RawDigit >())
Adds the specified hit to the data collection.
The data type to uniquely identify a TPC.
virtual void reconfigure(fhicl::ParameterSet const &p)
View_t View(geo::PlaneID const &pid) const
Returns the view (wire orientation) on the channels of specified TPC plane.
Definition of data types for geometry description.
void put_into(art::Event &)
Moves the data into an event.
Detector simulation of raw signals on wires.
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
raw::ChannelID_t Channel() const
Returns the readout channel this object describes.
size_t size() const
Returns the number of hits currently in the collection.
Encapsulate the construction of a single detector plane.
int fReadOutWindowSize
Number of samples in a readout window; NOT total samples.
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
object containing MC truth information necessary for making RawDigits and doing back tracking ...
HitCheater(fhicl::ParameterSet const &p)
Declaration of basic channel signal object.
virtual void produce(art::Event &e)
TDCIDEs_t const & TDCIDEMap() const
Returns all the deposited energy information as stored.
2D representation of charge deposited in the TDC/wire plane
unsigned int ChannelID_t
Type representing the ID of a readout channel.
ValidHandle< PROD > getValidHandle(InputTag const &tag) const
double fElectronsToADC
Conversion factor of electrons to ADC counts.
TPCID_t TPC
Index of the TPC within its cryostat.
void clear()
Clears all the statistics.
Namespace collecting geometry-related classes utilities.
Collects statistics on a single quantity (weighted)
art framework interface to geometry description
Encapsulate the construction of a single detector plane.
void add(Data_t value, Weight_t weight=Weight_t(1.0))
Adds one entry with specified value and weight.