Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
calhit::RemoveBadChannels Class Reference

Create CellHits from RawDigits. More...

Inheritance diagram for calhit::RemoveBadChannels:
art::EDProducer art::ProducerBase art::Consumer art::EngineCreator art::ProductRegistryHelper

Public Types

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

Public Member Functions

 RemoveBadChannels (const Parameters &params)
 
virtual ~RemoveBadChannels ()
 
virtual void beginRun (art::Run &run)
 
virtual void beginSubRun (art::SubRun &subrun)
 
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
 

Protected Attributes

const RemoveBadChannelsParams fParams
 
const art::ProductToken< std::vector< rb::CellHit > > fCellHitToken
 

Detailed Description

Create CellHits from RawDigits.

Definition at line 48 of file RemoveBadChannels_module.cc.

Member Typedef Documentation

using art::EDProducer::ModuleType = EDProducer
inherited

Definition at line 34 of file EDProducer.h.

Definition at line 52 of file RemoveBadChannels_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

calhit::RemoveBadChannels::RemoveBadChannels ( const Parameters params)
explicit

Definition at line 67 of file RemoveBadChannels_module.cc.

68  : fParams(params()),
69  fCellHitToken(consumes<std::vector<rb::CellHit>>(fParams.cellHitLabel()))
70  {
71  produces<std::vector<rb::CellHit>>();
72  produces<int, art::InRun>();
73  produces<int, art::InSubRun>();
74  }
const art::ProductToken< std::vector< rb::CellHit > > fCellHitToken
const RemoveBadChannelsParams fParams
ProductToken< T > consumes(InputTag const &)
calhit::RemoveBadChannels::~RemoveBadChannels ( )
virtual

Definition at line 77 of file RemoveBadChannels_module.cc.

78  {
79  }

Member Function Documentation

void calhit::RemoveBadChannels::beginRun ( art::Run run)
virtual

Reimplemented from art::EDProducer.

Definition at line 82 of file RemoveBadChannels_module.cc.

References om::cout, allTimeWatchdog::endl, nova::dbi::RunHistory::GetDiBlockMaskFromCondb(), nova::dbi::RunHistory::GoodDiBlockMask(), lem_server::mask, art::Run::put(), and rh.

83  {
85  // if use subrun-level dB masks, don't do this
86  if (! rh->GetDiBlockMaskFromCondb()) {
87  std::unique_ptr<int> mask(new int(rh->GoodDiBlockMask(0,true)));
88  std::cout << __PRETTY_FUNCTION__ << " writing run diblock mask " << std::hex << *mask << std::dec << " to run." << std::endl;
89  run.put(std::move(mask));
90  }
91  }
TH2 * rh
Definition: drawXsec.C:5
art::ProductID put(std::unique_ptr< PROD > &&)
Definition: Run.h:149
OStream cout
Definition: OStream.cxx:6
bool GetDiBlockMaskFromCondb() const
Definition: RunHistory.h:368
int GoodDiBlockMask(int subrun=-1, bool reload=false)
void calhit::RemoveBadChannels::beginSubRun ( art::SubRun subrun)
virtual

Reimplemented from art::EDProducer.

Definition at line 94 of file RemoveBadChannels_module.cc.

References allTimeWatchdog::endl, nova::dbi::RunHistory::GetDiBlockMaskFromCondb(), nova::dbi::RunHistory::GoodDiBlockMask(), LOG_DEBUG, lem_server::mask, art::SubRun::put(), rh, sr, and art::SubRun::subRun().

95  {
97  // do this if we are using subrun-level dB masks
98  if (rh->GetDiBlockMaskFromCondb()) {
99  int sr = subrun.subRun();
100  int tmask = rh->GoodDiBlockMask(sr,false);
101  std::unique_ptr<int> mask(new int(tmask));
102  LOG_DEBUG("RemoveBadChannels") << __PRETTY_FUNCTION__ << " writing subrun diblock mask " << std::hex << tmask << std::dec << " to subrun." << std::endl;
103  subrun.put(std::move(mask));
104  }
105  }
#define LOG_DEBUG(stream)
Definition: Messenger.h:149
TH2 * rh
Definition: drawXsec.C:5
SubRunNumber_t subRun() const
Definition: SubRun.h:44
caf::StandardRecord * sr
ProductID put(std::unique_ptr< PROD > &&)
bool GetDiBlockMaskFromCondb() const
Definition: RunHistory.h:368
int GoodDiBlockMask(int subrun=-1, bool reload=false)
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 calhit::RemoveBadChannels::produce ( art::Event evt)
virtual

Implements art::EDProducer.

Definition at line 108 of file RemoveBadChannels_module.cc.

References visualisationForPaperMasterPlot::cmap, DEFINE_ART_MODULE(), fCellHitToken, fParams, art::DataViewImpl::getByToken(), chaninfo::BadChanList::IsBad(), art::Handle< T >::isValid(), and art::Event::put().

109  {
110  // get the CellHit list
112  evt.getByToken(fCellHitToken, hitcol);
113  if (!hitcol.isValid()) {
114  mf::LogError("RemoveBadChannels") << "Cannot find " << fParams.cellHitLabel() << ". Perhaps you want RemoveBadChannelsFilter instead?";
115  abort();
116  }
117 
118  // define the unique_ptr holding the collection of rb::CellHits to be made
119  auto cellhitcol = std::make_unique<std::vector<rb::CellHit>>();
120 
121  // No valid handle --
122  if (!hitcol.isValid()) {
123  mf::LogError("RemoveBadChannels") << "Cannot find " << fParams.cellHitLabel() << ". Bailing.";
124  abort();
125  }
126 
127 
128  // Expect most of the cells to be good. Don't want to waste time resizing
129  // the array
130  cellhitcol->reserve(hitcol->size());
131 
132  // Make a CellHit for every (non-bad) RawDigit and write it out
133 
134  // Make the hits and write them out
135  if(fParams.removeBadChans()){
138 
139  for(const rb::CellHit& hit: *hitcol){
140  if(!bcl->IsBad(hit.Plane(),
141  hit.Cell())){
142  cellhitcol->push_back(hit);
143  }
144  }
145  }
146  else{
147  for(const rb::CellHit hit: *hitcol){
148  cellhitcol->push_back(hit);
149  }
150  }
151 
152  evt.put(std::move(cellhitcol));
153  }
const art::ProductToken< std::vector< rb::CellHit > > fCellHitToken
const RemoveBadChannelsParams fParams
MaybeLogger_< ELseverityLevel::ELsev_error, false > LogError
ProductID put(std::unique_ptr< PROD > &&product)
Definition: Event.h:102
bool isValid() const
Definition: Handle.h:189
A rawdata::RawDigit with channel information decoded.
Definition: CellHit.h:27
Definition: structs.h:12
bool getByToken(ProductToken< PROD > const &token, Handle< PROD > &result) const
Definition: DataViewImpl.h:387
bool IsBad(int plane, int cell)
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

const art::ProductToken<std::vector<rb::CellHit> > calhit::RemoveBadChannels::fCellHitToken
protected

Definition at line 63 of file RemoveBadChannels_module.cc.

Referenced by produce().

const RemoveBadChannelsParams calhit::RemoveBadChannels::fParams
protected

Definition at line 62 of file RemoveBadChannels_module.cc.

Referenced by produce().


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