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

Public Types

using CRTHit = sbn::crt::CRTHit
 

Public Member Functions

 CRTSimHitProducer (fhicl::ParameterSet const &p)
 
 CRTSimHitProducer (CRTSimHitProducer const &)=delete
 
 CRTSimHitProducer (CRTSimHitProducer &&)=delete
 
CRTSimHitProduceroperator= (CRTSimHitProducer const &)=delete
 
CRTSimHitProduceroperator= (CRTSimHitProducer &&)=delete
 
void produce (art::Event &e) override
 
void beginJob () override
 
void endJob () override
 
void reconfigure (fhicl::ParameterSet const &p)
 

Private Attributes

art::InputTag fCrtModuleLabel
 name of crt producer More...
 
art::InputTag fTriggerLabel
 name of trigger producer More...
 
CRTHitRecoAlg hitAlg
 
uint64_t m_trigger_timestamp
 

Detailed Description

Definition at line 62 of file icaruscode/icaruscode/CRT/CRTSimHitProducer_module.cc.

Member Typedef Documentation

Constructor & Destructor Documentation

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

Definition at line 99 of file icaruscode/icaruscode/CRT/CRTSimHitProducer_module.cc.

100  : EDProducer{p}, hitAlg(p.get<fhicl::ParameterSet>("HitAlg"))
101  // Initialize member data here, if know don't want to reconfigure on the fly
102  {
103 
104  // Call appropriate produces<>() functions here.
105  produces< vector<CRTHit> >();
106  produces< art::Assns<CRTHit, CRTData> >();
107 
108  reconfigure(p);
109 
110  } // CRTSimHitProducer()
pdgs p
Definition: selectors.fcl:22
icarus::crt::CRTSimHitProducer::CRTSimHitProducer ( CRTSimHitProducer const &  )
delete
icarus::crt::CRTSimHitProducer::CRTSimHitProducer ( CRTSimHitProducer &&  )
delete

Member Function Documentation

void icarus::crt::CRTSimHitProducer::beginJob ( )
override

Definition at line 118 of file icaruscode/icaruscode/CRT/CRTSimHitProducer_module.cc.

119  {
120 
121  } // CRTSimHitProducer::beginJob()
void icarus::crt::CRTSimHitProducer::endJob ( )
override

Definition at line 187 of file icaruscode/icaruscode/CRT/CRTSimHitProducer_module.cc.

188  {
189 
190  } // CRTSimHitProducer::endJob()
CRTSimHitProducer& icarus::crt::CRTSimHitProducer::operator= ( CRTSimHitProducer const &  )
delete
CRTSimHitProducer& icarus::crt::CRTSimHitProducer::operator= ( CRTSimHitProducer &&  )
delete
void icarus::crt::CRTSimHitProducer::produce ( art::Event &  e)
override

Definition at line 123 of file icaruscode/icaruscode/CRT/CRTSimHitProducer_module.cc.

124  {
125 
126  std::unique_ptr< vector<CRTHit> > CRTHitcol( new vector<CRTHit>);
127  std::unique_ptr< art::Assns<CRTHit, CRTData> > Hitassn( new art::Assns<CRTHit, CRTData>);
128  art::PtrMaker<sbn::crt::CRTHit> makeHitPtr(event);
129 
130  int nHits = 0;
131 
132  // Retrieve list of CRT hits
133  art::Handle< std::vector<CRTData>> crtListHandle;
134  vector<art::Ptr<CRTData> > crtList;
135 
136  if (event.getByLabel(fCrtModuleLabel, crtListHandle))
137  art::fill_ptr_vector(crtList, crtListHandle);
138 
139  //add trigger info
140  if( !fTriggerLabel.empty() ) {
141 
142  art::Handle<sbn::ExtraTriggerInfo> trigger_handle;
143  event.getByLabel( fTriggerLabel, trigger_handle );
144  if( trigger_handle.isValid() )
145  m_trigger_timestamp = trigger_handle->triggerTimestamp;
146  else
147  mf::LogError("CRTSimHitProducer") << "No raw::Trigger associated to label: " << fTriggerLabel.label() << "\n" ;
148  } else{
149  std::cout << "Trigger Data product " << fTriggerLabel.label() << " not found!\n" ;
150  }
151 
152  mf::LogInfo("CRTSimHitProducer")
153  <<"Number of SiPM hits = "<<crtList.size();
154  //m_trigger_timestamp = event.getProduct<sbn::ExtraTriggerInfo>(fTriggerLabel).triggerTimestamp;
155 
156  mf::LogInfo("CRTSimHitProducer")
157  <<"Number of SiPM hits = "<<crtList.size();
158 
159  vector<art::Ptr<CRTData>> crtData = hitAlg.PreselectCRTData(crtList, m_trigger_timestamp);
160 
161  vector<std::pair<CRTHit, vector<int>>> crtHitPairs = hitAlg.CreateCRTHits(crtData, m_trigger_timestamp);
162  //vector<std::pair<CRTHit, vector<int>>> crtHitPairs = hitAlg.CreateCRTHits(crtList);
163 
164  mf::LogInfo("CRTSimHitProducer")
165  << "Number of CRTHit,data indices pairs = " << crtHitPairs.size();
166 
167  for(auto const& crtHitPair : crtHitPairs){
168 
169  CRTHitcol->push_back(crtHitPair.first);
170  art::Ptr<CRTHit> hitPtr = makeHitPtr(CRTHitcol->size()-1);
171  nHits++;
172 
173  for(auto const& data_i : crtHitPair.second){
174 
175  Hitassn->addSingle(hitPtr, crtList[data_i]);
176  }
177  }
178 
179  event.put(std::move(CRTHitcol));
180  event.put(std::move(Hitassn));
181 
182  mf::LogInfo("CRTSimHitProducer")
183  <<"Number of CRT hits produced = "<<nHits;
184 
185  } // CRTSimHitProducer::produce()
vector< art::Ptr< CRTData > > PreselectCRTData(const vector< art::Ptr< CRTData >> &crtList, uint64_t trigger_timestamp)
BEGIN_PROLOG could also be cout
vector< pair< CRTHit, vector< int > > > CreateCRTHits(vector< art::Ptr< CRTData >> crtList, uint64_t trigger_timestamp)
void icarus::crt::CRTSimHitProducer::reconfigure ( fhicl::ParameterSet const &  p)

Definition at line 112 of file icaruscode/icaruscode/CRT/CRTSimHitProducer_module.cc.

113  {
114  fCrtModuleLabel = (p.get<art::InputTag> ("CrtModuleLabel"));
115  fTriggerLabel = (p.get<art::InputTag> ("TriggerLabel"));
116  } // CRTSimHitProducer::reconfigure()
pdgs p
Definition: selectors.fcl:22

Member Data Documentation

art::InputTag icarus::crt::CRTSimHitProducer::fCrtModuleLabel
private

name of crt producer

Definition at line 91 of file icaruscode/icaruscode/CRT/CRTSimHitProducer_module.cc.

art::InputTag icarus::crt::CRTSimHitProducer::fTriggerLabel
private

name of trigger producer

Definition at line 92 of file icaruscode/icaruscode/CRT/CRTSimHitProducer_module.cc.

CRTHitRecoAlg icarus::crt::CRTSimHitProducer::hitAlg
private
uint64_t icarus::crt::CRTSimHitProducer::m_trigger_timestamp
private

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