Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Attributes | List of all members
murem::MergeDigits Class Reference
Inheritance diagram for murem::MergeDigits:
art::EDProducer art::ProducerBase art::Consumer art::EngineCreator art::ProductRegistryHelper

Public Types

using Parameters = art::EDProducer::Table< MergeDigitsParams >
 
using ModuleType = EDProducer
 
using WorkerType = WorkerT< EDProducer >
 
template<typename UserConfig , typename KeysToIgnore = void>
using Table = ProducerBase::Table< UserConfig, KeysToIgnore >
 

Public Member Functions

 MergeDigits (const Parameters &params)
 
 ~MergeDigits ()
 
void produce (art::Event &evt)
 
template<typename PROD , BranchType B = InEvent>
ProductID getProductID (std::string const &instanceName={}) const
 
template<typename PROD , BranchType B>
ProductID getProductID (ModuleDescription const &moduleDescription, std::string const &instanceName) const
 
bool modifiesEvent () const
 
template<typename T , BranchType = InEvent>
ProductToken< Tconsumes (InputTag const &)
 
template<typename T , art::BranchType BT>
art::ProductToken< Tconsumes (InputTag const &it)
 
template<typename T , BranchType = InEvent>
void consumesMany ()
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > consumesView (InputTag const &)
 
template<typename T , art::BranchType BT>
art::ViewToken< TconsumesView (InputTag const &it)
 
template<typename T , BranchType = InEvent>
ProductToken< TmayConsume (InputTag const &)
 
template<typename T , art::BranchType BT>
art::ProductToken< TmayConsume (InputTag const &it)
 
template<typename T , BranchType = InEvent>
void mayConsumeMany ()
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > mayConsumeView (InputTag const &)
 
template<typename T , art::BranchType BT>
art::ViewToken< TmayConsumeView (InputTag const &it)
 
base_engine_tcreateEngine (seed_t seed)
 
base_engine_tcreateEngine (seed_t seed, std::string const &kind_of_engine_to_make)
 
base_engine_tcreateEngine (seed_t seed, std::string const &kind_of_engine_to_make, label_t const &engine_label)
 
seed_t get_seed_value (fhicl::ParameterSet const &pset, char const key[]="seed", seed_t const implicit_seed=-1)
 

Static Public Member Functions

static cet::exempt_ptr< Consumernon_module_context ()
 

Protected Member Functions

CurrentProcessingContext const * currentContext () const
 
void validateConsumedProduct (BranchType const bt, ProductInfo const &pi)
 
void prepareForJob (fhicl::ParameterSet const &pset)
 
void showMissingConsumes () const
 

Private Attributes

MergeDigitsParams fParams
 

Detailed Description

Definition at line 58 of file MergeDigits_module.cc.

Member Typedef Documentation

using art::EDProducer::ModuleType = EDProducer
inherited

Definition at line 34 of file EDProducer.h.

Definition at line 62 of file MergeDigits_module.cc.

template<typename UserConfig , typename KeysToIgnore = void>
using art::EDProducer::Table = ProducerBase::Table<UserConfig, KeysToIgnore>
inherited

Definition at line 43 of file EDProducer.h.

using art::EDProducer::WorkerType = WorkerT<EDProducer>
inherited

Definition at line 35 of file EDProducer.h.

Constructor & Destructor Documentation

murem::MergeDigits::MergeDigits ( const Parameters params)
explicit

Definition at line 82 of file MergeDigits_module.cc.

83  :fParams(params())
84  {
85 
86  produces< std::vector <rawdata::RawDigit> >();
87 
88  mf::LogInfo("MergeDigits") <<"MergeDigits::MergeDigits()\n";
89 
90  }
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
MergeDigitsParams fParams
murem::MergeDigits::~MergeDigits ( )

Definition at line 95 of file MergeDigits_module.cc.

96  {
97 
98  }

Member Function Documentation

template<typename T , BranchType = InEvent>
ProductToken<T> art::Consumer::consumes ( InputTag const &  )
inherited
template<typename T , art::BranchType BT>
art::ProductToken<T> art::Consumer::consumes ( InputTag const &  it)
inherited

Definition at line 146 of file Consumer.h.

References art::InputTag::instance(), PandAna.reco_validation.prod5_pid_validation::invalid, art::InputTag::label(), art::InputTag::process(), and T.

147 {
148  if (!moduleContext_)
149  return ProductToken<T>::invalid();
150 
151  consumables_[BT].emplace_back(ConsumableType::Product,
152  TypeID{typeid(T)},
153  it.label(),
154  it.instance(),
155  it.process());
156  return ProductToken<T>{it};
157 }
set< int >::iterator it
static ProductToken< T > invalid()
Definition: ProductToken.h:47
ConsumableProducts consumables_
Definition: Consumer.h:137
double T
Definition: Xdiff_gwt.C:5
bool moduleContext_
Definition: Consumer.h:135
template<typename T , art::BranchType BT>
void art::Consumer::consumesMany ( )
inherited

Definition at line 161 of file Consumer.h.

References T.

162 {
163  if (!moduleContext_)
164  return;
165 
166  consumables_[BT].emplace_back(ConsumableType::Many, TypeID{typeid(T)});
167 }
ConsumableProducts consumables_
Definition: Consumer.h:137
double T
Definition: Xdiff_gwt.C:5
bool moduleContext_
Definition: Consumer.h:135
template<typename Element , BranchType = InEvent>
ViewToken<Element> art::Consumer::consumesView ( InputTag const &  )
inherited
template<typename T , art::BranchType BT>
art::ViewToken<T> art::Consumer::consumesView ( InputTag const &  it)
inherited

Definition at line 171 of file Consumer.h.

References art::InputTag::instance(), PandAna.reco_validation.prod5_pid_validation::invalid, art::InputTag::label(), art::InputTag::process(), and T.

172 {
173  if (!moduleContext_)
174  return ViewToken<T>::invalid();
175 
176  consumables_[BT].emplace_back(ConsumableType::ViewElement,
177  TypeID{typeid(T)},
178  it.label(),
179  it.instance(),
180  it.process());
181  return ViewToken<T>{it};
182 }
set< int >::iterator it
static ViewToken< Element > invalid()
Definition: ProductToken.h:75
ConsumableProducts consumables_
Definition: Consumer.h:137
double T
Definition: Xdiff_gwt.C:5
bool moduleContext_
Definition: Consumer.h:135
base_engine_t& art::EngineCreator::createEngine ( seed_t  seed)
inherited
base_engine_t& art::EngineCreator::createEngine ( seed_t  seed,
std::string const &  kind_of_engine_to_make 
)
inherited
base_engine_t& art::EngineCreator::createEngine ( seed_t  seed,
std::string const &  kind_of_engine_to_make,
label_t const &  engine_label 
)
inherited
CurrentProcessingContext const* art::EDProducer::currentContext ( ) const
protectedinherited
seed_t art::EngineCreator::get_seed_value ( fhicl::ParameterSet const &  pset,
char const  key[] = "seed",
seed_t const  implicit_seed = -1 
)
inherited
template<typename PROD , BranchType B>
ProductID art::EDProducer::getProductID ( std::string const &  instanceName = {}) const
inlineinherited

Definition at line 123 of file EDProducer.h.

References art::EDProducer::moduleDescription_.

Referenced by skim::NueSkimmer::CopyMichelSlice(), and skim::NueSkimmer::CopyMichelTrack().

124  {
125  return ProducerBase::getProductID<PROD, B>(moduleDescription_,
126  instanceName);
127  }
ModuleDescription moduleDescription_
Definition: EDProducer.h:115
template<typename PROD , BranchType B>
ProductID art::ProducerBase::getProductID ( ModuleDescription const &  moduleDescription,
std::string const &  instanceName 
) const
inherited

Definition at line 56 of file ProducerBase.h.

References art::ModuleDescription::moduleLabel().

Referenced by art::ProducerBase::modifiesEvent().

58  {
59  auto const& pd =
60  get_ProductDescription<PROD>(B, md.moduleLabel(), instanceName);
61  return pd.productID();
62  }
template<typename T , BranchType = InEvent>
ProductToken<T> art::Consumer::mayConsume ( InputTag const &  )
inherited
template<typename T , art::BranchType BT>
art::ProductToken<T> art::Consumer::mayConsume ( InputTag const &  it)
inherited

Definition at line 189 of file Consumer.h.

References art::InputTag::instance(), PandAna.reco_validation.prod5_pid_validation::invalid, art::InputTag::label(), art::InputTag::process(), and T.

190 {
191  if (!moduleContext_)
192  return ProductToken<T>::invalid();
193 
194  consumables_[BT].emplace_back(ConsumableType::Product,
195  TypeID{typeid(T)},
196  it.label(),
197  it.instance(),
198  it.process());
199  return ProductToken<T>{it};
200 }
set< int >::iterator it
static ProductToken< T > invalid()
Definition: ProductToken.h:47
ConsumableProducts consumables_
Definition: Consumer.h:137
double T
Definition: Xdiff_gwt.C:5
bool moduleContext_
Definition: Consumer.h:135
template<typename T , art::BranchType BT>
void art::Consumer::mayConsumeMany ( )
inherited

Definition at line 204 of file Consumer.h.

References T.

205 {
206  if (!moduleContext_)
207  return;
208 
209  consumables_[BT].emplace_back(ConsumableType::Many, TypeID{typeid(T)});
210 }
ConsumableProducts consumables_
Definition: Consumer.h:137
double T
Definition: Xdiff_gwt.C:5
bool moduleContext_
Definition: Consumer.h:135
template<typename Element , BranchType = InEvent>
ViewToken<Element> art::Consumer::mayConsumeView ( InputTag const &  )
inherited
template<typename T , art::BranchType BT>
art::ViewToken<T> art::Consumer::mayConsumeView ( InputTag const &  it)
inherited

Definition at line 214 of file Consumer.h.

References art::InputTag::instance(), PandAna.reco_validation.prod5_pid_validation::invalid, art::InputTag::label(), art::InputTag::process(), and T.

215 {
216  if (!moduleContext_)
217  return ViewToken<T>::invalid();
218 
219  consumables_[BT].emplace_back(ConsumableType::ViewElement,
220  TypeID{typeid(T)},
221  it.label(),
222  it.instance(),
223  it.process());
224  return ViewToken<T>{it};
225 }
set< int >::iterator it
static ViewToken< Element > invalid()
Definition: ProductToken.h:75
ConsumableProducts consumables_
Definition: Consumer.h:137
double T
Definition: Xdiff_gwt.C:5
bool moduleContext_
Definition: Consumer.h:135
bool art::ProducerBase::modifiesEvent ( ) const
inlineinherited

Definition at line 40 of file ProducerBase.h.

References art::ProducerBase::getProductID(), and string.

41  {
42  return true;
43  }
static cet::exempt_ptr<Consumer> art::Consumer::non_module_context ( )
staticinherited
void art::Consumer::prepareForJob ( fhicl::ParameterSet const &  pset)
protectedinherited
void murem::MergeDigits::produce ( art::Event evt)
virtual

Get digits for the election without noise

Get digits for the election with noise

Implements art::EDProducer.

Definition at line 103 of file MergeDigits_module.cc.

References rawdata::RawDigit::ADC(), rawdata::RawDigit::Channel(), hadd_many_files::counter, om::cout, DEFINE_ART_MODULE(), allTimeWatchdog::endl, exit(), fParams, art::DataViewImpl::getByLabel(), MECModelEnuComparisons::i, art::Event::isRealData(), rawdata::RawDigit::NADC(), art::PtrVector< T >::push_back(), art::Event::put(), rawdata::RawDigit::SetADC(), rawdata::RawDigit::SetMC(), art::PtrVector< T >::size(), and rawdata::RawDigit::Version().

104  {
105  bool isMC = !evt.isRealData();
106 
107  std::unique_ptr< std::vector<rawdata::RawDigit> > origDigits(new std::vector<rawdata::RawDigit>);
108  std::vector< rawdata::RawDigit> newDigits;
109 
110  // Get the original set of raw digits in the event
111 
113  evt.getByLabel(fParams.rawDigitModule(), digitcol);
115 
116  for(unsigned int i = 0; i < digitcol->size(); ++i){
117  art::Ptr<rawdata::RawDigit> dig(digitcol, i);
118  digits.push_back(dig);
119  }
120  /// Get digits for the election without noise
122  evt.getByLabel(fParams.electronRawDigitModule(), edigitcol);
124 
125  for(unsigned int i = 0; i < edigitcol->size(); ++i){
126  art::Ptr<rawdata::RawDigit> edig(edigitcol, i);
127  edigits.push_back(edig);
128  }
129  /// Get digits for the election with noise
131  evt.getByLabel(fParams.electronwnoiseRawDigitModule(), ewndigitcol);
133 
134  for(unsigned int i = 0; i < ewndigitcol->size(); ++i){
135  art::Ptr<rawdata::RawDigit> ewndig(ewndigitcol, i);
136  ewndigits.push_back(ewndig);
137  }
138 
139  int nDigs = digits.size();
140  int nEDigs = edigits.size();
141  int nEWNDigs = ewndigits.size();
142  std::cout<<"Number of digits: mrcc "<<nDigs<<" elec w/o noise "<<nEDigs<<" elec with noise "<<nEWNDigs<<std::endl;
143 
144  //Inserting electron with physics noise cells (if they don't overlap with mrcc)
145  for(int kDig = 0; kDig < nEWNDigs; kDig++){
146  rawdata::RawDigit ewndig = *ewndigits[kDig];
147  bool samecell = false;
148  // check that electron and mrcc don't share the cell
149  for(int jDig = 0; jDig < nDigs; jDig++){
150  if (ewndig.Channel() == digits[jDig]->Channel() ) samecell = true;
151  }
152  if (!samecell){
153  ewndig.SetMC(isMC);
154  newDigits.push_back(ewndig);
155  }
156  }
157  std::cout<<"Merging electron digits outside mrcc: "<<newDigits.size()<<std::endl;
158  int counter = 0;
159  // now merge mrcc and mrcc with electrons in overlaped cells
160  for(int jDig = 0; jDig < nDigs; jDig++){
161  rawdata::RawDigit rd = *digits[jDig];
162  unsigned int pureADC = 0;
163  // merging case when mrcc and electron share the same cell
164  for(int iDig = 0; iDig < nEDigs; iDig++){
165  if (rd.Version() != edigits[iDig]->Version()) {std::cout<<"Issie with mrcc and electron Version()"<<std::endl; exit(1);}
166  if (rd.Channel() == edigits[iDig]->Channel()){
167  // leave pedestal as it is in order to avoid double counting
168  if (rd.Version() > 0){ // Do this only for multipoint era
169  for (unsigned int i = 1; i<rd.NADC(); i++){
170  // count pure signal above adc0 and add it to the mrcc adc1-3
171  pureADC = edigits[iDig]->ADC(i) - edigits[iDig]->ADC(0);
172  rd.SetADC(i, rd.ADC(i) + pureADC);
173  }
174  }
175  if (rd.Version() == 0) { // just sum amplitudes in case of signle-point
176  rd.SetADC(0, rd.ADC(0) + edigits[iDig]->ADC(0));
177  std::cout<<"NB: single-point "<<std::endl;
178  }
179  counter++; // use it to count overlapped cells
180  }
181  }//end loop over pure electron digits
182  rd.SetMC(isMC);
183  newDigits.push_back(rd);
184  }// end loop over digits
185 
186  std::cout<<"Overlapped region digits: "<<counter<<std::endl;
187  std::cout<<"NEW DIG SIZE "<<newDigits.size()<<std::endl;
188 
189  for(unsigned int digs = 0; digs<newDigits.size(); digs++ ){
190  origDigits->push_back( newDigits[digs] );
191  }
192  evt.put(std::move(origDigits));
193 
194  return;
195 
196  } // End of producer
bool isRealData() const
Definition: Event.h:83
ProductID put(std::unique_ptr< PROD > &&product)
Definition: Event.h:102
void SetADC(uint32_t i, int16_t iADC)
Definition: RawDigit.cxx:108
void push_back(Ptr< U > const &p)
Definition: PtrVector.h:441
uint8_t Version() const
Definition: RawDigit.h:87
size_type size() const
Definition: PtrVector.h:308
OStream cout
Definition: OStream.cxx:6
void SetMC(bool isMC=true)
Definition: RawDigit.h:106
int16_t ADC(uint32_t i) const
Definition: RawDigit.cxx:58
uint32_t NADC() const
Definition: RawDigit.h:81
bool getByLabel(std::string const &label, std::string const &productInstanceName, Handle< PROD > &result) const
Definition: DataViewImpl.h:344
exit(0)
uint32_t Channel() const
Definition: RawDigit.h:84
MergeDigitsParams fParams
Definition: fwd.h:28
void art::Consumer::showMissingConsumes ( ) const
protectedinherited

Referenced by art::RootOutput::endJob().

void art::Consumer::validateConsumedProduct ( BranchType const  bt,
ProductInfo const &  pi 
)
protectedinherited

Member Data Documentation

MergeDigitsParams murem::MergeDigits::fParams
private

Definition at line 71 of file MergeDigits_module.cc.

Referenced by produce().


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