Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Attributes | Static Private Attributes | List of all members
comi::ChanOcc Class Reference

Module to produce ntuples of channel occupancies. More...

Inheritance diagram for comi::ChanOcc:
art::EDAnalyzer art::EventObserverBase art::Consumer art::EngineCreator

Public Types

using WorkerType = WorkerT< EDAnalyzer >
 
using ModuleType = EDAnalyzer
 

Public Member Functions

 ChanOcc (fhicl::ParameterSet const &pset)
 
virtual ~ChanOcc ()
 
void beginJob ()
 
void endSubRun (art::SubRun const &sr)
 
void analyze (art::Event const &evt)
 
void reconfigure (const fhicl::ParameterSet &p)
 
std::string workerType () const
 
bool modifiesEvent () const
 
void registerProducts (MasterProductRegistry &, ProductDescriptions &, ModuleDescription const &)
 
std::string const & processName () const
 
bool wantAllEvents () const
 
bool wantEvent (Event const &e)
 
fhicl::ParameterSetID selectorConfig () const
 
art::Handle< art::TriggerResultsgetTriggerResults (Event const &e) 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
 
detail::CachedProducts & cachedProducts ()
 
void validateConsumedProduct (BranchType const bt, ProductInfo const &pi)
 
void prepareForJob (fhicl::ParameterSet const &pset)
 
void showMissingConsumes () const
 

Private Attributes

double fNhit [kPLANE_MAX][kCELL_MAX]
 Number of hits by plane/cell. More...
 
double fNevt
 Number of events seen. More...
 
TNtuple * fNt
 Ntuple summarizing channel occupancies. More...
 
float fADCThresh
 Filter hits below this ADC threshold. More...
 

Static Private Attributes

static const int kPLANE_MAX = 2048
 
static const int kCELL_MAX = 512
 

Detailed Description

Module to produce ntuples of channel occupancies.

Definition at line 25 of file ChanOcc_module.cc.

Member Typedef Documentation

Definition at line 39 of file EDAnalyzer.h.

Definition at line 38 of file EDAnalyzer.h.

Constructor & Destructor Documentation

comi::ChanOcc::ChanOcc ( fhicl::ParameterSet const &  pset)
explicit

Definition at line 49 of file ChanOcc_module.cc.

References fNhit, kCELL_MAX, kPLANE_MAX, and reconfigure().

50  : EDAnalyzer(p)
51  {
52  memset(fNhit, 0, kPLANE_MAX*kCELL_MAX*sizeof(float));
53  this->reconfigure(p);
54  }
void reconfigure(const fhicl::ParameterSet &p)
const char * p
Definition: xmltok.h:285
static const int kCELL_MAX
double fNhit[kPLANE_MAX][kCELL_MAX]
Number of hits by plane/cell.
EDAnalyzer(Table< Config > const &config)
Definition: EDAnalyzer.h:100
static const int kPLANE_MAX
comi::ChanOcc::~ChanOcc ( )
virtual

Definition at line 68 of file ChanOcc_module.cc.

68 { }

Member Function Documentation

void comi::ChanOcc::analyze ( art::Event const &  evt)
virtual

Implements art::EDAnalyzer.

Definition at line 72 of file ChanOcc_module.cc.

References plot_validation_datamc::c, visualisationForPaperMasterPlot::cmap, fADCThresh, fNevt, fNhit, art::DataViewImpl::getByLabel(), cmap::dataprov::CMap::GetCell(), cmap::dataprov::CMap::GetPlane(), MECModelEnuComparisons::i, and kCELL_MAX.

73  {
74  unsigned int i;
75 
76  fNevt += 1.0;
77 
78  //
79  // Pull out the raw digits from the event
80  //
82  evt.getByLabel("daq",digidummy);
83 
84  //
85  // Shuffle the data into a vector we can manipulate
86  //
87  std::vector< art::Ptr<rawdata::RawDigit> > digi;
88  for (i=0; i<digidummy->size(); ++i) {
89  digi.push_back(art::Ptr<rawdata::RawDigit>(digidummy, i));
90  }
91 
92  //
93  // Record the number of hits
94  //
96  for (i=0; i<digi.size(); ++i) {
97  if (digi[i].get()->ADC()<fADCThresh) continue;
98 
99  int p = cmap->GetPlane(digi[i].get());
100  int c = cmap->GetCell(digi[i].get());
101 
102  if (p>=0 && p<kPLANE_MAX && c>=0 && c<kCELL_MAX) {
103  fNhit[p][c] += 1.0;
104  }
105  else abort();
106  }
107  }
float fADCThresh
Filter hits below this ADC threshold.
const char * p
Definition: xmltok.h:285
static const int kCELL_MAX
double fNhit[kPLANE_MAX][kCELL_MAX]
Number of hits by plane/cell.
int evt
unsigned short GetPlane(const rawdata::RawDigit *dig)
Definition: CMap.cxx:285
double fNevt
Number of events seen.
unsigned short GetCell(const rawdata::RawDigit *dig)
Definition: CMap.cxx:327
Definition: fwd.h:28
void comi::ChanOcc::beginJob ( )
virtual

Reimplemented from art::EDAnalyzer.

Definition at line 58 of file ChanOcc_module.cc.

References MakeMiniprodValidationCuts::f, fNt, and art::TFileDirectory::make().

59  {
61  fNt = f->make<TNtuple>("occ",
62  "Channel Occupancies",
63  "run:subrun:view:ip:ic:occ");
64  }
T * make(ARGS...args) const
TNtuple * fNt
Ntuple summarizing channel occupancies.
detail::CachedProducts& art::EventObserverBase::cachedProducts ( )
inlineprotectedinherited

Definition at line 79 of file EventObserverBase.h.

References art::EventObserverBase::selectors_.

80  {
81  return selectors_;
82  }
detail::CachedProducts selectors_
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::EDAnalyzer::currentContext ( ) const
protectedinherited
void comi::ChanOcc::endSubRun ( art::SubRun const &  sr)
virtual

Reimplemented from art::EDAnalyzer.

Definition at line 111 of file ChanOcc_module.cc.

References fNevt, fNhit, fNt, geom(), MECModelEnuComparisons::i, calib::j, kCELL_MAX, kPLANE_MAX, geo::PlaneGeo::Ncells(), geo::GeometryBase::NPlanes(), geo::GeometryBase::Plane(), art::SubRun::run(), art::SubRun::subRun(), getGoodRuns4SAM::subrun, POTSpillRate::view, and geo::PlaneGeo::View().

112  {
113  if (fNevt<=10000) return;
114 
115  int run = sr.run();
116  int subrun = sr.subRun();
117 
119  unsigned int i, j;
120  for (i=0; i<geom->NPlanes(); ++i) {
121  int view = geom->Plane(i)->View();
122  for (j=0; j<geom->Plane(i)->Ncells(); ++j) {
123  fNt->Fill(run, subrun, view, i, j, fNhit[i][j]/fNevt);
124  }
125  }
126  memset(fNhit, 0, kPLANE_MAX*kCELL_MAX*sizeof(float));
127  fNevt = 0;
128  }
unsigned int Ncells() const
Number of cells in this plane.
Definition: PlaneGeo.h:43
const PlaneGeo * Plane(unsigned int i) const
static const int kCELL_MAX
View_t View() const
Which coordinate does this plane measure.
Definition: PlaneGeo.h:53
double fNhit[kPLANE_MAX][kCELL_MAX]
Number of hits by plane/cell.
caf::StandardRecord * sr
const double j
Definition: BetheBloch.cxx:29
Definition: run.py:1
void geom(int which=0)
Definition: geom.C:163
static const int kPLANE_MAX
double fNevt
Number of events seen.
unsigned int NPlanes() const
TNtuple * fNt
Ntuple summarizing channel occupancies.
seed_t art::EngineCreator::get_seed_value ( fhicl::ParameterSet const &  pset,
char const  key[] = "seed",
seed_t const  implicit_seed = -1 
)
inherited
art::Handle<art::TriggerResults> art::EventObserverBase::getTriggerResults ( Event const &  e) const
inlineinherited

Definition at line 61 of file EventObserverBase.h.

References art::detail::CachedProducts::getOneTriggerResults(), and art::EventObserverBase::selectors_.

62  {
64  }
detail::CachedProducts selectors_
art::Handle< art::TriggerResults > getOneTriggerResults(Event const &) const
Float_t e
Definition: plot.C:35
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::EventObserverBase::modifiesEvent ( ) const
inlineinherited

Definition at line 25 of file EventObserverBase.h.

26  {
27  return false;
28  }
static cet::exempt_ptr<Consumer> art::Consumer::non_module_context ( )
staticinherited
void art::Consumer::prepareForJob ( fhicl::ParameterSet const &  pset)
protectedinherited
std::string const& art::EventObserverBase::processName ( ) const
inlineinherited
void comi::ChanOcc::reconfigure ( const fhicl::ParameterSet p)

Definition at line 132 of file ChanOcc_module.cc.

References DEFINE_ART_MODULE(), fADCThresh, and fhicl::ParameterSet::get().

Referenced by ChanOcc().

133  {
134  fADCThresh = p.get<float>("ADCThresh");
135  }
float fADCThresh
Filter hits below this ADC threshold.
T get(std::string const &key) const
Definition: ParameterSet.h:231
void art::EventObserverBase::registerProducts ( MasterProductRegistry ,
ProductDescriptions ,
ModuleDescription const &   
)
inlineinherited

Definition at line 33 of file EventObserverBase.h.

References string.

36  {}
fhicl::ParameterSetID art::EventObserverBase::selectorConfig ( ) const
inlineinherited

Definition at line 56 of file EventObserverBase.h.

References art::EventObserverBase::selector_config_id_.

57  {
58  return selector_config_id_;
59  }
fhicl::ParameterSetID selector_config_id_
void art::Consumer::showMissingConsumes ( ) const
protectedinherited

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

void art::Consumer::validateConsumedProduct ( BranchType const  bt,
ProductInfo const &  pi 
)
protectedinherited
bool art::EventObserverBase::wantAllEvents ( ) const
inlineinherited

Definition at line 46 of file EventObserverBase.h.

References art::EventObserverBase::wantAllEvents_.

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

47  {
48  return wantAllEvents_;
49  }
bool art::EventObserverBase::wantEvent ( Event const &  e)
inlineinherited

Definition at line 51 of file EventObserverBase.h.

References art::EventObserverBase::selectors_, and art::detail::CachedProducts::wantEvent().

52  {
53  return selectors_.wantEvent(e);
54  }
detail::CachedProducts selectors_
Float_t e
Definition: plot.C:35
bool wantEvent(Event const &)
std::string art::EDAnalyzer::workerType ( ) const
inlineinherited

Definition at line 109 of file EDAnalyzer.h.

References art::EDAnalyzer::currentContext().

110  {
111  return "WorkerT<EDAnalyzer>";
112  }

Member Data Documentation

float comi::ChanOcc::fADCThresh
private

Filter hits below this ADC threshold.

Definition at line 44 of file ChanOcc_module.cc.

Referenced by analyze(), and reconfigure().

double comi::ChanOcc::fNevt
private

Number of events seen.

Definition at line 40 of file ChanOcc_module.cc.

Referenced by analyze(), and endSubRun().

double comi::ChanOcc::fNhit[kPLANE_MAX][kCELL_MAX]
private

Number of hits by plane/cell.

Definition at line 39 of file ChanOcc_module.cc.

Referenced by analyze(), ChanOcc(), and endSubRun().

TNtuple* comi::ChanOcc::fNt
private

Ntuple summarizing channel occupancies.

Definition at line 42 of file ChanOcc_module.cc.

Referenced by beginJob(), and endSubRun().

const int comi::ChanOcc::kCELL_MAX = 512
staticprivate

Definition at line 38 of file ChanOcc_module.cc.

Referenced by analyze(), ChanOcc(), and endSubRun().

const int comi::ChanOcc::kPLANE_MAX = 2048
staticprivate

Definition at line 37 of file ChanOcc_module.cc.

Referenced by ChanOcc(), and endSubRun().


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