All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Public Attributes | Private Attributes | List of all members
icarus::crt::CRTDetSim Class Reference
Inheritance diagram for icarus::crt::CRTDetSim:

Public Member Functions

 CRTDetSim (fhicl::ParameterSet const &p)
 
 CRTDetSim (CRTDetSim const &)=delete
 
 CRTDetSim (CRTDetSim &&)=delete
 
CRTDetSimoperator= (CRTDetSim const &)=delete
 
CRTDetSimoperator= (CRTDetSim &&)=delete
 
void reconfigure (fhicl::ParameterSet const &p)
 
void produce (art::Event &e) override
 

Public Attributes

string fG4ModuleLabel
 

Private Attributes

CLHEP::HepRandomEngine & fRandEngine
 
CRTDetSimAlg detAlg
 

Detailed Description

Definition at line 109 of file icaruscode/icaruscode/CRT/CRTDetSim_module.cc.

Constructor & Destructor Documentation

icarus::crt::CRTDetSim::CRTDetSim ( fhicl::ParameterSet const &  p)
explicit

Definition at line 136 of file icaruscode/icaruscode/CRT/CRTDetSim_module.cc.

136  : EDProducer{p},
137  fRandEngine(art::ServiceHandle<rndm::NuRandomService>()->createEngine(*this, "HepJamesRandom", "crt", p, "Seed")),
138  detAlg(p.get<fhicl::ParameterSet>("DetSimAlg"),fRandEngine)
139 {
140  this->reconfigure(p);
141 
142  produces< vector<CRTData> >();
143  produces< vector<sim::AuxDetIDE> >();
144  produces< art::Assns<CRTData, sim::AuxDetIDE> >();
145 }
pdgs p
Definition: selectors.fcl:22
void reconfigure(fhicl::ParameterSet const &p)
icarus::crt::CRTDetSim::CRTDetSim ( CRTDetSim const &  )
delete
icarus::crt::CRTDetSim::CRTDetSim ( CRTDetSim &&  )
delete

Member Function Documentation

CRTDetSim& icarus::crt::CRTDetSim::operator= ( CRTDetSim const &  )
delete
CRTDetSim& icarus::crt::CRTDetSim::operator= ( CRTDetSim &&  )
delete
void icarus::crt::CRTDetSim::produce ( art::Event &  e)
override

Definition at line 148 of file icaruscode/icaruscode/CRT/CRTDetSim_module.cc.

148  {
149 
150  //pointer to vector of CRT data products to be pushed to event
151  std::unique_ptr< vector<CRTData> > triggeredCRTHits (
152  new vector<CRTData>);
153  //pointer to vector of AuxDetIDE products to be pushed to event
154  std::unique_ptr< vector<sim::AuxDetIDE> > ides (
155  new vector<sim::AuxDetIDE>);
156  //pointer associations between CRT data products and AuxDetIDEs to be pushed to event
157  std::unique_ptr< art::Assns<CRTData,sim::AuxDetIDE> > dataAssn (
158  new art::Assns<CRTData,sim::AuxDetIDE> );
159  art::PtrMaker<CRTData> makeDataPtr(event);
160  art::PtrMaker<sim::AuxDetIDE> makeIDEPtr(event);
161 
162  //clear detAlg member data
164 
165  // Handle for (truth) AuxDetSimChannels
166  art::Handle< vector<sim::AuxDetSimChannel> > adChanHandle;;
167  vector< art::Ptr<sim::AuxDetSimChannel> > adChanList;
168  if (event.getByLabel(fG4ModuleLabel, adChanHandle) )
169  art::fill_ptr_vector(adChanList, adChanHandle);
170 
171  mf::LogInfo("CRTDetSimProducer")
172  <<"Number of AuxDetChannels = " << adChanList.size();
173 
174  int nide=0;
175  auto const clockData = art::ServiceHandle<detinfo::DetectorClocksService>()->DataFor(event);
176  for(auto const& adsc : adChanList) {
177 
178  auto const& auxDetIDEs = adsc->AuxDetIDEs();
179  if(auxDetIDEs.size()>0) {
180  nide++;
181  detAlg.FillTaggers(clockData, adsc->AuxDetID(), adsc->AuxDetSensitiveID(), auxDetIDEs);
182  }
183 
184  }//loop over AuxDetSimChannels
185 
186  //generate CRTData products, associates from filled detAlg member data
187  int nData = 0;
188  if(nide>0) {
189  vector<std::pair<CRTData,vector<sim::AuxDetIDE>>> data = detAlg.CreateData();
190  //time sort CRT data (ascending)
191  std::sort(data.begin(),data.end(),
192  [](const std::pair<CRTData,vector<sim::AuxDetIDE>>& d1,
193  const std::pair<CRTData,vector<sim::AuxDetIDE>>& d2) {
194  return d1.first.fTs0 < d2.first.fTs0;
195  });
196 
197  for(auto const& dataPair : data){
198 
199  triggeredCRTHits->push_back(dataPair.first);
200  art::Ptr<CRTData> dataPtr = makeDataPtr(triggeredCRTHits->size()-1);
201  nData++;
202 
203  for(auto const& ide : dataPair.second){
204  ides->push_back(ide);
205  art::Ptr<sim::AuxDetIDE> idePtr = makeIDEPtr(ides->size()-1);
206  dataAssn->addSingle(dataPtr, idePtr);
207  }
208  }
209 
210  }
211 
212  if(nData==0)
213  mf::LogWarning("CRTDetSimProducer")
214  << "0 CRTData produced (expected for most neutrino events, never for cosmics)";
215 
216  //push products to event
217  event.put(std::move(triggeredCRTHits));
218  event.put(std::move(ides));
219  event.put(std::move(dataAssn));
220 
221  mf::LogInfo("CRTDetSimProducer")
222  << "Number of CRT data produced = "<< nData << '\n'
223  << " from " << nide << " AuxDetIDEs";
224 }
vector< pair< CRTData, vector< AuxDetIDE > > > CreateData()
Definition: CRTDetSimAlg.cc:77
void FillTaggers(detinfo::DetectorClocksData const &clockData, const uint32_t adid, const uint32_t adsid, const vector< AuxDetIDE > &ides)
void icarus::crt::CRTDetSim::reconfigure ( fhicl::ParameterSet const &  p)

Definition at line 131 of file icaruscode/icaruscode/CRT/CRTDetSim_module.cc.

131  {
132  fG4ModuleLabel = p.get<std::string>("G4ModuleLabel");
133 }//CRTDetSim::reconfigure()
pdgs p
Definition: selectors.fcl:22

Member Data Documentation

CRTDetSimAlg icarus::crt::CRTDetSim::detAlg
private
string icarus::crt::CRTDetSim::fG4ModuleLabel
CLHEP::HepRandomEngine& icarus::crt::CRTDetSim::fRandEngine
private

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