Public Member Functions | Private Member Functions | Private Attributes | List of all members
gar::rosim::SiPMReadout Class Reference

Runs simulation including smearing of energy and SiPM saturation for the ECAL readout. More...

Inheritance diagram for gar::rosim::SiPMReadout:
art::EDProducer art::detail::Producer art::detail::LegacyModule art::Modifier art::ModuleBase art::ProductRegistryHelper

Public Member Functions

 SiPMReadout (fhicl::ParameterSet const &pset)
 Standard constructor and destructor for an FMWK module. More...
 
virtual ~SiPMReadout ()
 
 SiPMReadout (SiPMReadout const &)=delete
 
 SiPMReadout (SiPMReadout &&)=delete
 
SiPMReadoutoperator= (SiPMReadout const &)=delete
 
SiPMReadoutoperator= (SiPMReadout &&)=delete
 
void produce (::art::Event &evt) override
 
void reconfigure (fhicl::ParameterSet const &pset)
 
- Public Member Functions inherited from art::EDProducer
 EDProducer (fhicl::ParameterSet const &pset)
 
template<typename Config >
 EDProducer (Table< Config > const &config)
 
std::string workerType () const
 
- Public Member Functions inherited from art::detail::Producer
virtual ~Producer () noexcept
 
 Producer (fhicl::ParameterSet const &)
 
 Producer (Producer const &)=delete
 
 Producer (Producer &&)=delete
 
Produceroperator= (Producer const &)=delete
 
Produceroperator= (Producer &&)=delete
 
void doBeginJob (SharedResources const &resources)
 
void doEndJob ()
 
void doRespondToOpenInputFile (FileBlock const &fb)
 
void doRespondToCloseInputFile (FileBlock const &fb)
 
void doRespondToOpenOutputFiles (FileBlock const &fb)
 
void doRespondToCloseOutputFiles (FileBlock const &fb)
 
bool doBeginRun (RunPrincipal &rp, ModuleContext const &mc)
 
bool doEndRun (RunPrincipal &rp, ModuleContext const &mc)
 
bool doBeginSubRun (SubRunPrincipal &srp, ModuleContext const &mc)
 
bool doEndSubRun (SubRunPrincipal &srp, ModuleContext const &mc)
 
bool doEvent (EventPrincipal &ep, ModuleContext const &mc, std::atomic< std::size_t > &counts_run, std::atomic< std::size_t > &counts_passed, std::atomic< std::size_t > &counts_failed)
 
- Public Member Functions inherited from art::Modifier
 ~Modifier () noexcept
 
 Modifier ()
 
 Modifier (Modifier const &)=delete
 
 Modifier (Modifier &&)=delete
 
Modifieroperator= (Modifier const &)=delete
 
Modifieroperator= (Modifier &&)=delete
 
- Public Member Functions inherited from art::ModuleBase
virtual ~ModuleBase () noexcept
 
 ModuleBase ()
 
ModuleDescription const & moduleDescription () const
 
void setModuleDescription (ModuleDescription const &)
 
std::array< std::vector< ProductInfo >, NumBranchTypes > const & getConsumables () const
 
void sortConsumables (std::string const &current_process_name)
 
template<typename T , BranchType BT>
ViewToken< T > consumesView (InputTag const &tag)
 
template<typename T , BranchType BT>
ViewToken< T > mayConsumeView (InputTag const &tag)
 

Private Member Functions

void CollectHits (const art::Event &evt, const std::string &label, const std::string &instance, std::vector< art::Ptr< sdp::CaloDeposit > > &hitVector)
 
std::map< raw::CellID_t, std::vector< art::Ptr< sdp::CaloDeposit > > > MakeCellIDMapArtPtr (std::vector< art::Ptr< sdp::CaloDeposit > > &hitVector)
 

Private Attributes

std::string fG4Label
 label of G4 module More...
 
std::string fInstanceLabelName
 product instance name More...
 
const gar::geo::GeometryCorefGeo
 geometry information More...
 
std::unique_ptr< SiPMReadoutSimAlgfROSimAlg
 algorithm to simulate the electronics More...
 
CLHEP::HepRandomEngine & fEngine
 random engine More...
 

Additional Inherited Members

- Public Types inherited from art::EDProducer
using ModuleType = EDProducer
 
using WorkerType = WorkerT< EDProducer >
 
- Public Types inherited from art::detail::Producer
template<typename UserConfig , typename KeysToIgnore = void>
using Table = Modifier::Table< UserConfig, KeysToIgnore >
 
- Public Types inherited from art::Modifier
template<typename UserConfig , typename UserKeysToIgnore = void>
using Table = ProducerTable< UserConfig, detail::ModuleConfig, UserKeysToIgnore >
 
- Static Public Member Functions inherited from art::EDProducer
static void commitEvent (EventPrincipal &ep, Event &e)
 
- Protected Member Functions inherited from art::ModuleBase
ConsumesCollectorconsumesCollector ()
 
template<typename T , BranchType = InEvent>
ProductToken< T > consumes (InputTag const &)
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > consumesView (InputTag const &)
 
template<typename T , BranchType = InEvent>
void consumesMany ()
 
template<typename T , BranchType = InEvent>
ProductToken< T > mayConsume (InputTag const &)
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > mayConsumeView (InputTag const &)
 
template<typename T , BranchType = InEvent>
void mayConsumeMany ()
 

Detailed Description

Runs simulation including smearing of energy and SiPM saturation for the ECAL readout.

Randomness

The random number generators used by this process are:

Definition at line 59 of file SiPMReadout_module.cc.

Constructor & Destructor Documentation

gar::rosim::SiPMReadout::SiPMReadout ( fhicl::ParameterSet const &  pset)
explicit

Standard constructor and destructor for an FMWK module.

Definition at line 97 of file SiPMReadout_module.cc.

98  : art::EDProducer{pset},
100  {
101  fGeo = gar::providerFrom<geo::GeometryGAr>();
102 
103  this->reconfigure(pset);
104 
106  consumes< std::vector<sdp::CaloDeposit> >(tag);
107  produces< std::vector<raw::CaloRawDigit> >(fInstanceLabelName);
108  produces< art::Assns<raw::CaloRawDigit, sdp::CaloDeposit> >(fInstanceLabelName);
109 
110  return;
111  }
base_engine_t & createEngine(seed_t seed)
std::string fG4Label
label of G4 module
CLHEP::HepRandomEngine & fEngine
random engine
const gar::geo::GeometryCore * fGeo
geometry information
std::string fInstanceLabelName
product instance name
void reconfigure(fhicl::ParameterSet const &pset)
gar::rosim::SiPMReadout::~SiPMReadout ( )
virtual

Definition at line 115 of file SiPMReadout_module.cc.

116  {
117  }
gar::rosim::SiPMReadout::SiPMReadout ( SiPMReadout const &  )
delete
gar::rosim::SiPMReadout::SiPMReadout ( SiPMReadout &&  )
delete

Member Function Documentation

void gar::rosim::SiPMReadout::CollectHits ( const art::Event evt,
const std::string label,
const std::string instance,
std::vector< art::Ptr< sdp::CaloDeposit > > &  hitVector 
)
private

Definition at line 188 of file SiPMReadout_module.cc.

189  {
191  auto theHits = evt.getHandle< std::vector<sdp::CaloDeposit> >(itag);
192  if (!theHits)
193  return;
194 
195  for (unsigned int i = 0; i < theHits->size(); ++i)
196  {
197  const art::Ptr<sdp::CaloDeposit> hit(theHits, i);
198  hitVector.push_back(hit);
199  }
200  }
Handle< PROD > getHandle(SelectorBase const &) const
Definition: DataViewImpl.h:382
const std::string instance
Detector simulation of raw signals on wires.
Definition: fwd.h:31
std::map< raw::CellID_t, std::vector< art::Ptr< sdp::CaloDeposit > > > gar::rosim::SiPMReadout::MakeCellIDMapArtPtr ( std::vector< art::Ptr< sdp::CaloDeposit > > &  hitVector)
private

Definition at line 203 of file SiPMReadout_module.cc.

204  {
205  std::map<raw::CellID_t, std::vector< art::Ptr<sdp::CaloDeposit> > > cIDMapArtPtrVec;
206 
207  for (std::vector< art::Ptr<sdp::CaloDeposit> >::const_iterator iter = hitVector.begin(), iterEnd = hitVector.end(); iter != iterEnd; ++iter)
208  {
209  art::Ptr<sdp::CaloDeposit> hitPtr = *iter;
210  const sdp::CaloDeposit *hit = hitPtr.get();
211 
212  if( cIDMapArtPtrVec.count(hit->CellID()) == 0 )
213  {
214  std::vector< art::Ptr<sdp::CaloDeposit> > vecArtPtr;
215  vecArtPtr.push_back(hitPtr);
216  cIDMapArtPtrVec.insert( std::make_pair(hit->CellID(), vecArtPtr) );
217  }
218  else
219  {
220  cIDMapArtPtrVec[hit->CellID()].push_back(hitPtr);
221  }
222  }
223 
224  return cIDMapArtPtrVec;
225  }
struct vector vector
Detector simulation of raw signals on wires.
T const * get() const
Definition: Ptr.h:149
Definition: fwd.h:31
SiPMReadout& gar::rosim::SiPMReadout::operator= ( SiPMReadout const &  )
delete
SiPMReadout& gar::rosim::SiPMReadout::operator= ( SiPMReadout &&  )
delete
void gar::rosim::SiPMReadout::produce ( ::art::Event evt)
override

Definition at line 145 of file SiPMReadout_module.cc.

146  {
147  MF_LOG_DEBUG("SiPMReadout") << "produce()";
148 
149  //Collect the hits to be passed to the algo
150  std::vector< art::Ptr<sdp::CaloDeposit> > artHits;
151  this->CollectHits(evt, fG4Label, fInstanceLabelName, artHits);
152 
153  //Get contributions per cellID for association to digi hit
154  std::map<raw::CellID_t, std::vector< art::Ptr<sdp::CaloDeposit> > > m_cIDMapArtPtrVec = this->MakeCellIDMapArtPtr(artHits);
155 
156  //Pass the sim hits to the algo
157  fROSimAlg->PrepareAlgo(artHits);
158 
159  //Perform the digitization
160  fROSimAlg->DoDigitization();
161 
162  //Get the digitized hits
163  std::vector< raw::CaloRawDigit* > digiVec = fROSimAlg->GetDigitizedHits();
164 
165  // loop over the lists and put the particles and voxels into the event as collections
166  std::unique_ptr< std::vector<raw::CaloRawDigit> > digitCol (new std::vector<raw::CaloRawDigit>);
167  std::unique_ptr< art::Assns<raw::CaloRawDigit, sdp::CaloDeposit> > DigiSimHitsAssns(new art::Assns<raw::CaloRawDigit, sdp::CaloDeposit>);
168 
170 
171  for(auto const &it : digiVec)
172  {
173  digitCol->emplace_back(*it);
174  art::Ptr<raw::CaloRawDigit> digiPtr = makeDigiPtr(digitCol->size() - 1);
175  //get the associated vector of art ptr based on cellID
176  std::vector< art::Ptr<sdp::CaloDeposit> > simPtrVec = m_cIDMapArtPtrVec[it->CellID()];
177  for(auto hitpointer : simPtrVec)
178  DigiSimHitsAssns->addSingle(digiPtr, hitpointer);
179  }
180 
181  evt.put(std::move(digitCol), fInstanceLabelName);
182  evt.put(std::move(DigiSimHitsAssns), fInstanceLabelName);
183 
184  return;
185  } // CaloReadout::produce()
std::string fG4Label
label of G4 module
std::map< raw::CellID_t, std::vector< art::Ptr< sdp::CaloDeposit > > > MakeCellIDMapArtPtr(std::vector< art::Ptr< sdp::CaloDeposit > > &hitVector)
void CollectHits(const art::Event &evt, const std::string &label, const std::string &instance, std::vector< art::Ptr< sdp::CaloDeposit > > &hitVector)
def move(depos, offset)
Definition: depos.py:107
ProductID put(std::unique_ptr< PROD > &&edp, std::string const &instance={})
Definition: DataViewImpl.h:686
std::string fInstanceLabelName
product instance name
std::unique_ptr< SiPMReadoutSimAlg > fROSimAlg
algorithm to simulate the electronics
#define MF_LOG_DEBUG(id)
Definition: fwd.h:31
void gar::rosim::SiPMReadout::reconfigure ( fhicl::ParameterSet const &  pset)

Definition at line 120 of file SiPMReadout_module.cc.

121  {
122  MF_LOG_DEBUG("SiPMReadout") << "Debug: SiPMReadout()";
123 
124  fG4Label = pset.get<std::string >("G4ModuleLabel", "geant");
125  fInstanceLabelName = pset.get<std::string >("InstanceLabelName", "");
126 
127  auto ROAlgPars = pset.get<fhicl::ParameterSet>("ReadoutSimAlgPars");
128  auto ROAlgName = ROAlgPars.get<std::string>("ReadoutSimType");
129 
130  if(ROAlgName.compare("Standard_ECAL") == 0) {
131  fROSimAlg = std::make_unique<gar::rosim::ECALReadoutSimStandardAlg>(fEngine, ROAlgPars);
132  }
133  else if(ROAlgName.compare("Standard_MuID") == 0) {
134  fROSimAlg = std::make_unique<gar::rosim::MuIDReadoutSimStandardAlg>(fEngine, ROAlgPars);
135  }
136  else {
137  throw cet::exception("SiPMReadout")
138  << "Unable to determine which readout simulation algorithm to use, bail";
139  }
140 
141  return;
142  }
std::string fG4Label
label of G4 module
std::string string
Definition: nybbler.cc:12
CLHEP::HepRandomEngine & fEngine
random engine
T get(std::string const &key) const
Definition: ParameterSet.h:271
std::string fInstanceLabelName
product instance name
std::unique_ptr< SiPMReadoutSimAlg > fROSimAlg
algorithm to simulate the electronics
#define MF_LOG_DEBUG(id)
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33

Member Data Documentation

CLHEP::HepRandomEngine& gar::rosim::SiPMReadout::fEngine
private

random engine

Definition at line 88 of file SiPMReadout_module.cc.

std::string gar::rosim::SiPMReadout::fG4Label
private

label of G4 module

Definition at line 82 of file SiPMReadout_module.cc.

const gar::geo::GeometryCore* gar::rosim::SiPMReadout::fGeo
private

geometry information

Definition at line 85 of file SiPMReadout_module.cc.

std::string gar::rosim::SiPMReadout::fInstanceLabelName
private

product instance name

Definition at line 83 of file SiPMReadout_module.cc.

std::unique_ptr<SiPMReadoutSimAlg> gar::rosim::SiPMReadout::fROSimAlg
private

algorithm to simulate the electronics

Definition at line 86 of file SiPMReadout_module.cc.


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