Static Public Member Functions | List of all members
sim::SimListUtils Class Reference

#include <SimListUtils.h>

Static Public Member Functions

static sim::LArVoxelList GetLArVoxelList (const art::Event &evt, std::string moduleLabel)
 
static sim::SimPhotonsCollection GetSimPhotonsCollection (const art::Event &evt, std::string moduleLabel)
 

Detailed Description

Definition at line 19 of file SimListUtils.h.

Member Function Documentation

sim::LArVoxelList sim::SimListUtils::GetLArVoxelList ( const art::Event evt,
std::string  moduleLabel 
)
static

Definition at line 25 of file SimListUtils.cxx.

26  {
28  auto const clocks = art::ServiceHandle<detinfo::DetectorClocksService const>()->DataFor(evt);
29 
30  // get the sim::SimChannels
31  std::vector<const sim::SimChannel*> sccol;
32  evt.getView(moduleLabel, sccol);
33 
34  sim::LArVoxelList voxList;
35 
36  // loop over the voxels and put them into the list
37  for (auto itr = sccol.begin(); itr != sccol.end(); ++itr) {
38 
39  // get all sim::IDE associated with this channel
40  const auto& idemap = (*itr)->TDCIDEMap();
41 
42  // loop over all the sim::IDE values
43  for (auto mitr = idemap.begin(); mitr != idemap.end(); mitr++) {
44 
45  double time = (*mitr).first - trigger_offset(clocks);
46  time *= sampling_rate(clocks);
47 
48  // loop over the sim::IDE objects
49  const std::vector<sim::IDE>& ide = (*mitr).second;
50  for (size_t i = 0; i < ide.size(); ++i) {
51 
52  sim::LArVoxelID larVoxelID(ide[i].x, ide[i].y, ide[i].z, time);
53 
54  // if energy is unassigned the TrackId is sim::kNoParticleId
55  voxList.Add(larVoxelID, ide[i].numElectrons / lgp->GeVToElectrons(), ide[i].trackID);
56 
57  // set the voxel id for the just added LArVoxelData
58  (*voxList.find(larVoxelID)).second.SetVoxelID(larVoxelID);
59 
60  } // end loop over ide for this tdc
61  } // end loop over map
62  } // end loop over sim::SimChannels
63 
64  return voxList;
65  }
iterator find(const key_type &key)
Definition: LArVoxelList.h:145
int trigger_offset(DetectorClocksData const &data)
list x
Definition: train.py:276
void Add(const key_type &key, const double &energy)
Definition: LArVoxelList.h:94
std::size_t getView(std::string const &moduleLabel, std::string const &productInstanceName, std::string const &processName, std::vector< ELEMENT const * > &result) const
Definition: DataViewImpl.h:500
second_as<> second
Type of time stored in seconds, in double precision.
Definition: spacetime.h:85
double sampling_rate(DetectorClocksData const &data)
Returns the period of the TPC readout electronics clock.
double GeVToElectrons() const
sim::SimPhotonsCollection sim::SimListUtils::GetSimPhotonsCollection ( const art::Event evt,
std::string  moduleLabel 
)
static

get the voxels from the event handle

loop over the pmthits and put them into the list

make an entry in the list for this pmt id

add the photons to the entry

Definition at line 71 of file SimListUtils.cxx.

72  {
73  /// get the voxels from the event handle
75  evt.getByLabel(moduleLabel, pmtHandle);
76  const std::vector<sim::SimPhotons>& pmt(*pmtHandle);
77 
79  pmtList.clear();
80  // std::cout << "Building SimPhotonsCollection" << std::endl;
81 
82  /// loop over the pmthits and put them into the list
83  for (auto itr = pmt.begin(); itr != pmt.end(); ++itr) {
84 
85  int ch = (*itr).OpChannel();
86  /// make an entry in the list for this pmt id
87  if (pmtList.find(ch) == pmtList.end()) {
88  // Create new photon object
89  sim::SimPhotons new_photons;
90  new_photons.clear();
91  new_photons.SetChannel(ch);
92  new_photons.reserve((*itr).size());
93  pmtList.insert(std::pair<int, sim::SimPhotons>(ch, new_photons));
94  }
95 
96  /// add the photons to the entry
97  for (auto pitr = (*itr).begin(); pitr != (*itr).end(); ++pitr)
98  pmtList[ch].push_back(sim::OnePhoton((*pitr)));
99  }
100 
101  return pmtList;
102  // return std::move(pmtList);
103  }
All information of a photon entering the sensitive optical detector volume.
Definition: SimPhotons.h:64
void SetChannel(int ch)
Sets the optical detector channel number this object is associated to.
Definition: SimPhotons.h:256
bool getByLabel(std::string const &label, std::string const &instance, Handle< PROD > &result) const
Definition: DataViewImpl.h:633
fInnerVessel push_back(Point(-578.400000, 0.000000, 0.000000))
Collection of photons which recorded on one channel.
Definition: SimPhotons.h:136
Collection of sim::SimPhotons, indexed by channel number.
Definition: SimPhotons.h:192

The documentation for this class was generated from the following files: