Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
novaddt::SNAna Class Reference
Inheritance diagram for novaddt::SNAna:
art::EDAnalyzer art::EventObserverBase art::Consumer art::EngineCreator

Public Types

using WorkerType = WorkerT< EDAnalyzer >
 
using ModuleType = EDAnalyzer
 

Public Member Functions

 SNAna (fhicl::ParameterSet const &p)
 
 SNAna (SNAna const &)=delete
 
 SNAna (SNAna &&)=delete
 
SNAnaoperator= (SNAna const &)=delete
 
SNAnaoperator= (SNAna &&)=delete
 
void analyze (art::Event const &e) override
 
void beginJob () override
 
void endJob () override
 
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 Types

typedef std::tuple< unsigned, double, double > Binning
 

Private Member Functions

void make_histo (std::string const name, std::string const title, Binning const &bin)
 

Private Attributes

std::string slice_label_
 
std::string slice_instance_
 
int fMaxPlaneSep
 
int fMaxTDCSep
 
uint fMinSliceSize
 
uint fMaxSliceSize
 
std::map< std::string, TH1 * > h_
 
std::map< std::string, TH2 * > h2_
 
art::ServiceHandle< art::TFileServicetfs_
 

Detailed Description

Definition at line 35 of file SNAna_module.cc.

Member Typedef Documentation

typedef std::tuple<unsigned, double, double> novaddt::SNAna::Binning
private

Definition at line 57 of file SNAna_module.cc.

Definition at line 39 of file EDAnalyzer.h.

Definition at line 38 of file EDAnalyzer.h.

Constructor & Destructor Documentation

novaddt::SNAna::SNAna ( fhicl::ParameterSet const &  p)
explicit

Definition at line 75 of file SNAna_module.cc.

References om::cout, allTimeWatchdog::endl, fMaxPlaneSep, fMaxSliceSize, fMaxTDCSep, fMinSliceSize, slice_instance_, and slice_label_.

76  :
77  EDAnalyzer(p),
78  // More initializers here.
79  slice_label_ (p.get<std::string >("slice_label")),
80  slice_instance_ (p.get<std::string >("slice_instance")),
81  fMaxPlaneSep (p.get< int >("MaxPlaneSep" )),
82  fMaxTDCSep (p.get< int >("MaxTDCSep" )),
83  fMinSliceSize (p.get< int >("MinSliceSize" )),
84  fMaxSliceSize (p.get< int >("MaxSliceSize" ))
85 {
86  std::cout << "--- novaddt::SNAna begin" << std::endl;
87  std::cout << "\t Input slices label: " << slice_label_ << std::endl;
88  std::cout << "\t Input slices instance: " << slice_instance_<< std::endl;
89  std::cout << "\t Max Z separation: " << fMaxPlaneSep << std::endl;
90  std::cout << "\t Max time separation: " << fMaxTDCSep << std::endl;
91  std::cout << "\t Min slice size: " << fMinSliceSize << std::endl;
92  std::cout << "\t Max slice size: " << fMaxSliceSize << std::endl;
93 }
std::string slice_instance_
Definition: SNAna_module.cc:62
const char * p
Definition: xmltok.h:285
std::string slice_label_
Definition: SNAna_module.cc:62
EDAnalyzer(Table< Config > const &config)
Definition: EDAnalyzer.h:100
OStream cout
Definition: OStream.cxx:6
enum BeamMode string
novaddt::SNAna::SNAna ( SNAna const &  )
delete
novaddt::SNAna::SNAna ( SNAna &&  )
delete

Member Function Documentation

void novaddt::SNAna::analyze ( art::Event const &  e)
overridevirtual

Implements art::EDAnalyzer.

Definition at line 95 of file SNAna_module.cc.

References abs(), fMaxPlaneSep, fMaxSliceSize, fMaxTDCSep, fMinSliceSize, art::DataViewImpl::getByLabel(), h_, makeTrainCVSamples::int, slice_instance_, and slice_label_.

96 {
97  // THis Ana module digests slices in the form of vectors of hitlists
98  // probably generated by HitSlicers/Multiplet
100  e.getByLabel(slice_label_, slice_instance_, slices);
101 
102  // record number of events (we're simulating 200)
103  h_["counter"]->Fill(0);
104  h_["counter_precut"]->Fill(0);
105 
106  for (auto const& slice : *slices)
107  {
108  // skip noise slice, the last one
109  if (slice == slices->back()) continue;
110  // record initial number of slices
111  h_["counter_precut"]->Fill(1);
112  // int llasttdc = 0;
113  // int llastplane = 0;
114  // for (auto const& hit : slice) {
115  // if (slice.size()>=40) {
116  // if (llasttdc!=0) {
117  // int tdcdelta = abs((int)hit.TDC().val-llasttdc);
118  // std::cout << "next hit: tdc delta:"<< tdcdelta;
119  // int planedelta = abs((int)hit.Plane().val-llastplane);
120  // std::cout << " plane delta:" << planedelta<< std::endl;
121  // }
122  // // record the last values of things we're differencing
123  // llasttdc = (int)hit.TDC().val;
124  // llastplane = (int)hit.Plane().val;
125  // }
126  // }
127  double adc_sum = 0.0;
128 
129  int lasttdc = 0;
130  int lastplane = 0;
131  unsigned int slicehits = 0;
132  unsigned int slicehits_precut = 0;
133 
134  // loop over hits in slice, decide to keep it or not
135  bool keepit = true;
136  for (auto const& hit : slice) {
137  // record all-hits stats
138  auto adc = hit.ADC().val;
139  h_["adc_all_hits"]->Fill(adc);
140  adc_sum += adc;
141  slicehits_precut++;
142  h_["counter_precut"]->Fill(2);
143  h_["plane_all_hits"]->Fill(hit.Plane().val);
144  h_["cell_all_hits"]->Fill(hit.Cell().val);
145 
146  // if this isn't the first hit in a slice, do stuff
147  if (lasttdc !=0 ) {
148  int tdcdelta = abs((int)hit.TDC().val-lasttdc);
149  // std::cout << "next hit: tdc delta:"<< tdcdelta;
150  int planedelta = abs((int)hit.Plane().val-lastplane);
151  // std::cout << " plane delta:" << planedelta<< std::endl;
152  h_["plane_delta_precut"]->Fill((double)planedelta);
153  h_["tdc_delta_precut"]->Fill((double)tdcdelta);
154  if ((planedelta <= fMaxPlaneSep) && (tdcdelta <= fMaxTDCSep))
155  slicehits++;
156  else
157  keepit = false;; // to big a gap in this slice, bail
158  }// else std::cout << "first hit"<<std::endl;
159 
160  // record the last values of things we're differencing
161  lasttdc = (int)hit.TDC().val;
162  lastplane = (int)hit.Plane().val;
163  }
164  // plus-1 because we only started counting on hit 2, to get deltas
165  if (keepit
166  && (((slicehits+1)>=fMinSliceSize) && ((slicehits+1)<=fMaxSliceSize)))
167  h_["counter"]->Fill(1); // record we're keeping a slice
168  else
169  keepit = false;
170 
171  // now go do some stats on the slice if we're keeping it
172  slicehits = 0;
173  lasttdc = 0;
174  lastplane = 0;
175  if (keepit) {
176  for (auto const& hit : slice) {
177  slicehits++;
178  h_["counter"]->Fill(2);
179 
180  // if this isn't the first hit in a slice, do stuff
181  if (lasttdc !=0 ) {
182  int tdcdelta = abs((int)hit.TDC().val-lasttdc);
183  // std::cout << "next hit: tdc delta:"<< tdcdelta;
184  int planedelta = abs((int)hit.Plane().val-lastplane);
185  // std::cout << " plane delta:" << planedelta<< std::endl;
186  h_["plane_delta"]->Fill((double)planedelta);
187  h_["tdc_delta"]->Fill((double)tdcdelta);
188  }// else std::cout << "first hit"<<std::endl;
189 
190  // record the last values of things we're differencing
191  lasttdc = (int)hit.TDC().val;
192  lastplane = (int)hit.Plane().val;
193  }
194  h_["n_hits_per_slice"]->Fill(double(slicehits));
195  }
196 
197  double adc_mean;
198 
199  if (slice.size() > 0)
200  {
201  adc_mean = adc_sum / double(slice.size());
202  } else {
203  adc_mean = 0.0;
204  }
205 
206  h_["adc_mean"]->Fill(adc_mean);
207  h_["adc_sum"]->Fill(adc_sum);
208 
209  h_["n_hits_per_slice_precut"]->Fill(double(slicehits_precut));
210  }
211 }
std::string slice_instance_
Definition: SNAna_module.cc:62
void abs(TH1 *hist)
std::string slice_label_
Definition: SNAna_module.cc:62
std::map< std::string, TH1 * > h_
Definition: SNAna_module.cc:68
Definition: structs.h:12
Float_t e
Definition: plot.C:35
void novaddt::SNAna::beginJob ( )
overridevirtual

Reimplemented from art::EDAnalyzer.

Definition at line 213 of file SNAna_module.cc.

References make_histo().

214 {
215  // Implementation of optional member function here.
216  Binning adc_bin(4096, 0.0, 4096.0);
217  Binning nbin(101, 0.0, 100.0);
218  Binning plane_bin(1000, 0.0, 1000.0);
219  Binning cell_bin(400, -0.0, 400.0);
220 
221  make_histo("counter_precut", "Counter (0 = Event, 1 = Slice, 2 = Hit)",
222  Binning (3,0.0,3.0));
223  make_histo("counter", "Counter (0 = Event, 1 = Slice, 2 = Hit)",
224  Binning (3,0.0,3.0));
225 
226  make_histo("adc_all_hits", "ADC Distribution of All Hits", adc_bin);
227  make_histo("adc_mean", "Mean ADC per Slice", adc_bin);
228  make_histo("adc_sum", "Summed ADC per Slice", adc_bin);
229 
230  make_histo("n_hits_per_slice_precut", "Number of Hits per Slice", nbin);
231  make_histo("n_hits_per_slice", "Number of Hits per Slice", nbin);
232 
233  make_histo("plane_all_hits", "Plane of All Hits", plane_bin);
234  make_histo("cell_all_hits", "Cell of All Hits", cell_bin);
235 
236  make_histo("tdc_delta_precut","TDC Difference Between Hits", nbin);
237  make_histo("plane_delta_precut","Plane Difference Between Hits", nbin);
238  make_histo("tdc_delta","TDC Difference Between Hits", nbin);
239  make_histo("plane_delta","Plane Difference Between Hits", nbin);
240 }
void make_histo(std::string const name, std::string const title, Binning const &bin)
std::tuple< unsigned, double, double > Binning
Definition: SNAna_module.cc:57
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 novaddt::SNAna::endJob ( )
overridevirtual

Reimplemented from art::EDAnalyzer.

Definition at line 250 of file SNAna_module.cc.

References om::cout, DEFINE_ART_MODULE(), allTimeWatchdog::endl, and h_.

251 {
252  // Implementation of optional member function here.
253 
254  // hmm - we want to write out those histos, yes?
255 
256  // blurt out stats
257  std::cout << h_["counter_precut"]->GetBinContent(1) << " Pre-cut Events "
258  << h_["counter_precut"]->GetBinContent(2) << " Slices "
259  << h_["counter_precut"]->GetBinContent(3) << " Hits"
260  << std::endl;
261  std::cout << h_["counter"]->GetBinContent(1) << " Events "
262  << h_["counter"]->GetBinContent(2) << " Slices "
263  << h_["counter"]->GetBinContent(3) << " Hits"
264  << std::endl;
265 }
std::map< std::string, TH1 * > h_
Definition: SNAna_module.cc:68
OStream cout
Definition: OStream.cxx:6
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
void novaddt::SNAna::make_histo ( std::string const  name,
std::string const  title,
Binning const &  bin 
)
private

Definition at line 243 of file SNAna_module.cc.

References bin, h_, art::TFileDirectory::make(), and tfs_.

Referenced by beginJob().

244 {
245  h_[name] = tfs_->make<TH1F>
246  (name.c_str(), title.c_str(),
247  std::get<0>(bin), std::get<1>(bin), std::get<2>(bin));
248 }
const XML_Char * name
Definition: expat.h:151
art::ServiceHandle< art::TFileService > tfs_
Definition: SNAna_module.cc:70
std::map< std::string, TH1 * > h_
Definition: SNAna_module.cc:68
float bin[41]
Definition: plottest35.C:14
T * make(ARGS...args) const
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
SNAna& novaddt::SNAna::operator= ( SNAna const &  )
delete
SNAna& novaddt::SNAna::operator= ( SNAna &&  )
delete
void art::Consumer::prepareForJob ( fhicl::ParameterSet const &  pset)
protectedinherited
std::string const& art::EventObserverBase::processName ( ) const
inlineinherited
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

int novaddt::SNAna::fMaxPlaneSep
private

Definition at line 63 of file SNAna_module.cc.

Referenced by analyze(), and SNAna().

uint novaddt::SNAna::fMaxSliceSize
private

Definition at line 66 of file SNAna_module.cc.

Referenced by analyze(), and SNAna().

int novaddt::SNAna::fMaxTDCSep
private

Definition at line 64 of file SNAna_module.cc.

Referenced by analyze(), and SNAna().

uint novaddt::SNAna::fMinSliceSize
private

Definition at line 65 of file SNAna_module.cc.

Referenced by analyze(), and SNAna().

std::map<std::string, TH2*> novaddt::SNAna::h2_
private

Definition at line 69 of file SNAna_module.cc.

std::map<std::string, TH1*> novaddt::SNAna::h_
private

Definition at line 68 of file SNAna_module.cc.

Referenced by analyze(), endJob(), and make_histo().

std::string novaddt::SNAna::slice_instance_
private

Definition at line 62 of file SNAna_module.cc.

Referenced by analyze(), and SNAna().

std::string novaddt::SNAna::slice_label_
private

Definition at line 62 of file SNAna_module.cc.

Referenced by analyze(), and SNAna().

art::ServiceHandle<art::TFileService> novaddt::SNAna::tfs_
private

Definition at line 70 of file SNAna_module.cc.

Referenced by make_histo().


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