Classes | Public Member Functions | Private Attributes | List of all members
NoiseAdder Class Reference
Inheritance diagram for NoiseAdder:
art::EDProducer art::detail::Producer art::detail::LegacyModule art::Modifier art::ModuleBase art::ProductRegistryHelper

Classes

struct  ElectronicsAddress
 

Public Member Functions

 NoiseAdder (fhicl::ParameterSet const &p)
 
 NoiseAdder (NoiseAdder const &)=delete
 
 NoiseAdder (NoiseAdder &&)=delete
 
NoiseAdderoperator= (NoiseAdder const &)=delete
 
NoiseAdderoperator= (NoiseAdder &&)=delete
 
void produce (art::Event &e) override
 
- 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 Attributes

art::ServiceHandle< ChannelNoiseServicem_noiseService
 
std::map< int, ElectronicsAddressm_channelMap
 

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

Definition at line 37 of file NoiseAdder_module.cc.

Constructor & Destructor Documentation

NoiseAdder::NoiseAdder ( fhicl::ParameterSet const &  p)
explicit

Definition at line 73 of file NoiseAdder_module.cc.

73  : EDProducer{p}
74 
75 // Initialize member data here.
76 {
77  produces< std::vector<raw::RawDigit> >();
78 
79  // The ProtoDUNE channel map lives in dune_raw_data:
80  //
81  // https://cdcvs.fnal.gov/redmine/projects/dune-raw-data/repository/revisions/develop/entry/dune-raw-data/Services/ChannelMap/protoDUNETPCChannelMap_v3.txt
82  //
83  // It's created by:
84  //
85  // https://cdcvs.fnal.gov/redmine/projects/dune-raw-data/repository/revisions/develop/entry/dune-raw-data/Services/ChannelMap/mapmakers/MakePdspChannelMap_v3.C
86  cet::search_path sp("FW_SEARCH_PATH");
87  std::string channelMapFile=sp.find_file("protoDUNETPCChannelMap_v3.txt");
88  std::ifstream fin(channelMapFile.c_str());
89 
90  int crateNo, slotNo, fiberNo, FEMBChannel,
91  StreamChannel, slotID, fiberID,
92  chipNo, chipChannel, asicNo,
93  asicChannel, planeType, offlineChannel;
94 
95  while(fin >> crateNo >> slotNo >> fiberNo >> FEMBChannel
96  >> StreamChannel >> slotID >> fiberID
97  >> chipNo >> chipChannel >> asicNo
98  >> asicChannel >> planeType >> offlineChannel){
99  m_channelMap.emplace(std::make_pair(offlineChannel,
100  ElectronicsAddress(crateNo, slotNo, fiberNo, asicNo, asicChannel)));
101  }
102 }
std::string string
Definition: nybbler.cc:12
EDProducer(fhicl::ParameterSet const &pset)
Definition: EDProducer.h:20
std::map< int, ElectronicsAddress > m_channelMap
p
Definition: test.py:223
NoiseAdder::NoiseAdder ( NoiseAdder const &  )
delete
NoiseAdder::NoiseAdder ( NoiseAdder &&  )
delete

Member Function Documentation

NoiseAdder& NoiseAdder::operator= ( NoiseAdder const &  )
delete
NoiseAdder& NoiseAdder::operator= ( NoiseAdder &&  )
delete
void NoiseAdder::produce ( art::Event e)
overridevirtual

Implements art::EDProducer.

Definition at line 104 of file NoiseAdder_module.cc.

105 {
106  // Implementation of required member function here.
107  auto& digits_in =
108  *e.getValidHandle<std::vector<raw::RawDigit>>("daq");
109  std::unique_ptr<std::vector<raw::RawDigit>> digits_out(new std::vector<raw::RawDigit>);
110 
111  auto const clockData = art::ServiceHandle<detinfo::DetectorClocksService const>()->DataFor(e);
112  auto const detProp = art::ServiceHandle<detinfo::DetectorPropertiesService const>()->DataFor(e, clockData);
113 
114  for(auto&& digit: digits_in){
115  if(digit.Compression()!=0){
116  // TODO: throw or just uncompress the stream and carry on
117  std::cout << "Compression type " << digit.Compression() << std::endl;
118  }
119  std::vector<short> samples_out(digit.NADC(), 0);
120  std::vector<float> samples_work(digit.NADC(), 0);
121  for(size_t i=0; i<digit.NADC(); ++i){
122  samples_out[i]=m_noiseService->addNoise(clockData, detProp, digit.Channel(), samples_work);
123  }
124  digits_out->push_back(raw::RawDigit(digit.Channel(),
125  digit.Samples(),
126  std::move(samples_out),
127  raw::kNone));
128  } // end loop over digits (=?channels)
129 
130  e.put(std::move(digits_out));
131 }
Collection of charge vs time digitized from a single readout channel.
Definition: RawDigit.h:69
virtual int addNoise(detinfo::DetectorClocksData const &clockData, detinfo::DetectorPropertiesData const &detProp, Channel chan, AdcSignalVector &sigs) const =0
no compression
Definition: RawTypes.h:9
def move(depos, offset)
Definition: depos.py:107
ValidHandle< PROD > getValidHandle(InputTag const &tag) const
Definition: DataViewImpl.h:441
ProductID put(std::unique_ptr< PROD > &&edp, std::string const &instance={})
Definition: DataViewImpl.h:686
art::ServiceHandle< ChannelNoiseService > m_noiseService
QTextStream & endl(QTextStream &s)

Member Data Documentation

std::map<int, ElectronicsAddress> NoiseAdder::m_channelMap
private

Definition at line 69 of file NoiseAdder_module.cc.

art::ServiceHandle<ChannelNoiseService> NoiseAdder::m_noiseService
private

Definition at line 68 of file NoiseAdder_module.cc.


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