107 art::ServiceHandle<cheat::BackTrackerService> backtracker;
109 auto const clock_data = art::ServiceHandle<detinfo::DetectorClocksService const>()->DataFor(ev);
112 const std::vector<simb::MCParticle> &mcparticle_list = *ev.getValidHandle<std::vector<simb::MCParticle>>(
"largeant");
114 art::Handle<std::vector<recob::Hit>> hit_handle;
116 std::vector<art::Ptr<recob::Hit>> hits;
117 art::fill_ptr_vector(hits, hit_handle);
119 const simb::MCParticle *
muon = NULL;
122 for (
unsigned i = 0; i < mcparticle_list.size(); i++) {
123 if (mcparticle_list[i].PdgCode() == 13 && mcparticle_list[i].Process() ==
"primary") {
124 assert(muon == NULL);
125 muon = &mcparticle_list[i];
130 assert(muon != NULL);
132 std::cout <<
"Muon Momentum Theta: " << muon->Momentum().Theta() << std::endl;
133 std::cout <<
"Muon Momentum Phi: " << muon->Momentum().Phi() << std::endl;
137 if (
abs(muon->Momentum().Theta()) < 0.2) angle_bin = 0;
138 else if (muon->Momentum().Phi() < 0.) angle_bin = 1;
148 std::vector<art::Ptr<recob::Hit>> muon_hits = backtracker->TrackIdToHits_Ps(clock_data, muon->TrackId(), hits);
152 std::map<raw::ChannelID_t, float> amplitude_map;
154 for (art::Ptr<recob::Hit>
hit: muon_hits) {
155 if (!amplitude_map.count(
hit->Channel()) || amplitude_map.at(
hit->Channel()) <
hit->PeakAmplitude()) {
156 amplitude_map[
hit->Channel()] =
hit->PeakAmplitude();
161 for (
auto const &pair: amplitude_map) {
162 fSignal[angle_bin][geo->
View(pair.first)]->Fill(pair.second);
168 std::vector<raw::ChannelID_t> allChannels = geo->
ChannelsInTPCs();
170 std::set<raw::ChannelID_t> channelSet;
177 float length = wireGeo.
Length();
184 art::Handle<std::vector<sim::SimChannel>> simChannels;
185 ev.getByLabel(
"largeant", simChannels);
187 if (c.TDCIDEMap().size()) {
188 channelSet.erase(c.Channel());
193 art::Handle<std::vector<recob::Wire>> wires;
197 if (!channelSet.count(wire.Channel()))
continue;
203 for (
float v: range) {
208 float noise = sqrt(rms_sum / ncount);
210 fNoise[geo->
View(wire.Channel())]->Fill(noise);
Geometry description of a TPC wireThe wire is a single straight segment on a wire plane...
Energy deposited on a readout channel by simulated tracks.
double Length() const
Returns the wire length in centimeters.
std::vector< geo::WireID > ChannelToWire(raw::ChannelID_t const channel) const
Returns a list of wires connected to the specified TPC channel.
const range_list_t & get_ranges() const
Returns the internal list of non-void ranges.
SigType_t SignalType(geo::PlaneID const &pid) const
Returns the type of signal on the channels of specified TPC plane.
std::vector< std::array< TH1D *, 3 > > fSignal
Signal from induction planes.
Description of geometry of one entire detector.
View_t View(geo::PlaneID const &pid) const
Returns the view (wire orientation) on the channels of specified TPC plane.
WireGeo const & Wire(geo::WireID const &wireid) const
Returns the specified wire.
process_name can override from command line with o or output muon
std::array< TH1D *, 3 > fNoise
Class holding the regions of interest of signal from a channel.
Range class, with range and data.
unsigned int ChannelID_t
Type representing the ID of a readout channel.
BEGIN_PROLOG could also be cout
std::vector< raw::ChannelID_t > ChannelsInTPCs() const
Returns an std::vector<ChannelID_t> in all TPCs in a TPCSet.