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

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...
 
double fG4RefTime
 
CRTHitRecoAlg hitAlg
 

Detailed Description

Definition at line 71 of file sbndcode/sbndcode/CRT/CRTSimHitProducer_module.cc.

Constructor & Destructor Documentation

sbnd::CRTSimHitProducer::CRTSimHitProducer ( fhicl::ParameterSet const &  p)
explicit

Definition at line 107 of file sbndcode/sbndcode/CRT/CRTSimHitProducer_module.cc.

108  : EDProducer(p)
109  , fG4RefTime(art::ServiceHandle<detinfo::DetectorClocksService const>()->DataForJob().G4ToElecTime(0)) // us
110  , hitAlg(p.get<fhicl::ParameterSet>("HitAlg"), fG4RefTime)
111  // Initialize member data here, if know don't want to reconfigure on the fly
112  {
113 
114  // Call appropriate produces<>() functions here.
115  produces< std::vector<sbn::crt::CRTHit> >();
116  produces< art::Assns<sbn::crt::CRTHit , sbnd::crt::CRTData> >();
117 
118  reconfigure(p);
119 
120  } // CRTSimHitProducer()
pdgs p
Definition: selectors.fcl:22
sbnd::CRTSimHitProducer::CRTSimHitProducer ( CRTSimHitProducer const &  )
delete
sbnd::CRTSimHitProducer::CRTSimHitProducer ( CRTSimHitProducer &&  )
delete

Member Function Documentation

void sbnd::CRTSimHitProducer::beginJob ( )
override

Definition at line 131 of file sbndcode/sbndcode/CRT/CRTSimHitProducer_module.cc.

132  {
133 
134  } // CRTSimHitProducer::beginJob()
void sbnd::CRTSimHitProducer::endJob ( )
override

Definition at line 182 of file sbndcode/sbndcode/CRT/CRTSimHitProducer_module.cc.

183  {
184 
185  } // CRTSimHitProducer::endJob()
CRTSimHitProducer& sbnd::CRTSimHitProducer::operator= ( CRTSimHitProducer const &  )
delete
CRTSimHitProducer& sbnd::CRTSimHitProducer::operator= ( CRTSimHitProducer &&  )
delete
void sbnd::CRTSimHitProducer::produce ( art::Event &  e)
override

Definition at line 137 of file sbndcode/sbndcode/CRT/CRTSimHitProducer_module.cc.

138  {
139 
140  std::unique_ptr< std::vector<sbn::crt::CRTHit> > CRTHitcol( new std::vector<sbn::crt::CRTHit>);
141  std::unique_ptr< art::Assns<sbn::crt::CRTHit, sbnd::crt::CRTData> > Hitassn( new art::Assns<sbn::crt::CRTHit, sbnd::crt::CRTData>);
142  art::PtrMaker<sbn::crt::CRTHit> makeHitPtr(event);
143 
144  int nHits = 0;
145 
146  // Retrieve list of CRT hits
147  art::Handle< std::vector<sbnd::crt::CRTData>> crtListHandle;
148  std::vector<art::Ptr<sbnd::crt::CRTData> > crtList;
149  if (event.getByLabel(fCrtModuleLabel, crtListHandle))
150  art::fill_ptr_vector(crtList, crtListHandle);
151 
152  auto const clockData = art::ServiceHandle<detinfo::DetectorClocksService const>()->DataFor(event);
153  auto const detProp = art::ServiceHandle<detinfo::DetectorPropertiesService const>()->DataFor(event, clockData);
154  // Fill a vector of pairs of time and width direction for each CRT plane
155  // The y crossing point of z planes and z crossing point of y planes would be constant
156  std::map<std::pair<std::string, unsigned>, std::vector<CRTStrip>> taggerStrips = hitAlg.CreateTaggerStrips(clockData, detProp, crtList);
157 
158  mf::LogInfo("CRTSimHitProducer")
159  <<"Number of SiPM hits = "<<crtList.size();
160 
161  std::vector<std::pair<sbn::crt::CRTHit, std::vector<int>>> crtHitPairs = hitAlg.CreateCRTHits(taggerStrips);
162 
163  for(auto const& crtHitPair : crtHitPairs){
164  CRTHitcol->push_back(crtHitPair.first);
165  art::Ptr<sbn::crt::CRTHit> hitPtr = makeHitPtr(CRTHitcol->size()-1);
166  nHits++;
167  for(auto const& data_i : crtHitPair.second){
168  Hitassn->addSingle(hitPtr, crtList[data_i]);
169  }
170  }
171 
172 
173  event.put(std::move(CRTHitcol));
174  event.put(std::move(Hitassn));
175 
176  mf::LogInfo("CRTSimHitProducer")
177  <<"Number of CRT hits produced = "<<nHits;
178 
179  } // CRTSimHitProducer::produce()
std::map< std::pair< std::string, unsigned >, std::vector< CRTStrip > > CreateTaggerStrips(detinfo::DetectorClocksData const &clockData, detinfo::DetectorPropertiesData const &detProp, std::vector< art::Ptr< sbnd::crt::CRTData >> data)
std::vector< std::pair< sbn::crt::CRTHit, std::vector< int > > > CreateCRTHits(std::map< std::pair< std::string, unsigned >, std::vector< CRTStrip >> taggerStrips)
art::InputTag fCrtModuleLabel
name of crt producer
auto const detProp
void sbnd::CRTSimHitProducer::reconfigure ( fhicl::ParameterSet const &  p)

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

124  {
125 
126  fCrtModuleLabel = (p.get<art::InputTag> ("CrtModuleLabel"));
127 
128  } // CRTSimHitProducer::reconfigure()
pdgs p
Definition: selectors.fcl:22
art::InputTag fCrtModuleLabel
name of crt producer

Member Data Documentation

art::InputTag sbnd::CRTSimHitProducer::fCrtModuleLabel
private

name of crt producer

Definition at line 98 of file sbndcode/sbndcode/CRT/CRTSimHitProducer_module.cc.

double sbnd::CRTSimHitProducer::fG4RefTime
private
CRTHitRecoAlg sbnd::CRTSimHitProducer::hitAlg
private

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