Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
calib::ADCShapeFitAna Class Reference

TODO. More...

Inheritance diagram for calib::ADCShapeFitAna:
art::EDAnalyzer art::EventObserverBase art::Consumer art::EngineCreator

Public Types

using WorkerType = WorkerT< EDAnalyzer >
 
using ModuleType = EDAnalyzer
 

Public Member Functions

 ADCShapeFitAna (fhicl::ParameterSet const &pset)
 
 ~ADCShapeFitAna ()
 
virtual void analyze (art::Event const &evt)
 
void reconfigure (fhicl::ParameterSet const &pset)
 
virtual void beginJob ()
 
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
 

Protected Attributes

calib::ADCShapeFitTablefShapeFit
 
TH2 * fAvg
 
int fNCanvs
 

Detailed Description

TODO.

Definition at line 25 of file ADCShapeFitAna_module.cc.

Member Typedef Documentation

Definition at line 39 of file EDAnalyzer.h.

Definition at line 38 of file EDAnalyzer.h.

Constructor & Destructor Documentation

calib::ADCShapeFitAna::ADCShapeFitAna ( fhicl::ParameterSet const &  pset)
explicit

Definition at line 44 of file ADCShapeFitAna_module.cc.

References reconfigure().

45  : EDAnalyzer(pset)
46  , fShapeFit(0)
47  , fAvg(0)
48  , fNCanvs(0)
49  {
50  reconfigure(pset);
51  }
void reconfigure(fhicl::ParameterSet const &pset)
calib::ADCShapeFitTable * fShapeFit
EDAnalyzer(Table< Config > const &config)
Definition: EDAnalyzer.h:100
calib::ADCShapeFitAna::~ADCShapeFitAna ( )

Definition at line 54 of file ADCShapeFitAna_module.cc.

55  {
56  }

Member Function Documentation

void calib::ADCShapeFitAna::analyze ( art::Event const &  evt)
virtual

Implements art::EDAnalyzer.

Definition at line 70 of file ADCShapeFitAna_module.cc.

References rawdata::RawDigit::ADC(), ana::assert(), file_size_ana::axes, plot_validation_datamc::c, DEFINE_ART_MODULE(), geo::GeometryBase::DetId(), stan::math::exp(), fAvg, cet::search_path::find_file(), plot_validation_datamc::fname, fNCanvs, genie::utils::style::Format(), fShapeFit, MECModelEnuComparisons::g, geom(), art::DataViewImpl::getByLabel(), MECModelEnuComparisons::i, art::Event::isRealData(), novadaq::cnv::kNEARDET, kRed, art::TFileDirectory::make(), rawdata::RawDigit::NADC(), cet::pow(), string, confusionMatrixTree::t, and calib::ADCShapeFitTable::TNS().

71  {
73 
74  const bool isND = geom->DetId() == novadaq::cnv::kNEARDET;
75 
76  if(!fShapeFit){
78  cet::search_path sp("FW_SEARCH_PATH");
79 
80  if(isND){
81  sp.find_file("Calibrator/adc_shape_fit_table_nd_140_4500.root", fname);
82  }
83  else{
84  sp.find_file("Calibrator/adc_shape_fit_table_fd_380_7000.root", fname);
85  }
86  assert(!fname.empty());
87 
88  // TODO add proper configuration of the mode parameter here, and the table files above
89  fShapeFit = new ADCShapeFitTable(fname, isND, !evt.isRealData(),0);
90  }
91 
92  const double sampleTime = isND ? 125 : 500; // ns
93  double riseTime = (isND ? 140 : 380); // ns
94  const double fallTime = (isND ? 4500 : 7000); // ns
95 
96  // ND data and MC are different, the ND data seems to have a ~140ns rise
97  // time rather than 80ns. This solution isn't very scaleable, but it'll do
98  // for now.
99  if(isND && evt.isRealData()) riseTime = 140;
100 
101  static const double peak =
102  pow(riseTime/(riseTime+fallTime), riseTime/fallTime)-
103  pow(riseTime/(riseTime+fallTime), 1+riseTime/fallTime);
104 
105 
106  if(!fAvg){
108  fAvg = tfs->make<TH2F>("avg", ";TNS", 64*9, -sampleTime, 8*sampleTime, 140, -.2, 1.2);
109 
110  TGraph* nominal = tfs->make<TGraph>();
111 
112  nominal->SetPoint(0, -sampleTime, 0);
113  for(double t = 0; t < 8.1*sampleTime; t += 10){
114  nominal->SetPoint(nominal->GetN(), t, exp(-t/fallTime)*(1-exp(-t/riseTime)));
115  }
116  nominal->SetLineWidth(2);
117  nominal->SetLineColor(kRed);
118 
119  nominal->Write("nominal");
120  }
121 
123  evt.getByLabel("daq", digcol);
124 
125  for(unsigned int digIdx = 0; digIdx < digcol->size(); ++digIdx){
126  const art::Ptr<rawdata::RawDigit> dig(digcol, digIdx);
127 
128  if(dig->NADC() == 1) continue;
129 
130  double adcpeak, base;
131  bool goodTime;
132  const double tns = fShapeFit->TNS(0,
133  dig->ADC(1) - dig->ADC(0),
134  dig->ADC(2) - dig->ADC(0),
135  dig->ADC(3) - dig->ADC(0),
136  adcpeak, goodTime, base);
137 
138  base += dig->ADC(0);
139 
140  if(!goodTime) continue;
141 
142  for(unsigned int i = 0; i < dig->NADC(); ++i){
143  fAvg->Fill(sampleTime*i-tns, (dig->ADC(i)-base)/adcpeak*peak);
144  }
145 
146  if(fNCanvs < 100){
147  ++fNCanvs;
148 
150  TCanvas* c = tfs->make<TCanvas>(TString::Format("trace%d", fNCanvs),
151  TString::Format("trace%d", fNCanvs));
152  c->cd();
153 
154  TH2* axes = new TH2F("", ";TNS;ADC",
155  100, -sampleTime, sampleTime*dig->NADC(),
156  100, dig->ADC(0)-.2*adcpeak, dig->ADC(3)+.2*adcpeak);
157  axes->Draw();
158 
159  TGraph* g = new TGraph;
160  for(unsigned int i = 0; i < dig->NADC(); ++i){
161  g->SetPoint(i, i*sampleTime, dig->ADC(i));
162  }
163 
164  g->SetMarkerStyle(kFullCircle);
165  g->Draw("p same");
166 
167  TGraph* fit = new TGraph;
168 
169  fit->SetPoint(0, -sampleTime, base);
170 
171  for(double t = tns; t < dig->NADC()*sampleTime; t += 10){
172  fit->SetPoint(fit->GetN(), t, base+adcpeak/peak*exp(-(t-tns)/fallTime)*(1-exp(-(t-tns)/riseTime)));
173  }
174 
175  fit->SetLineWidth(2);
176  fit->SetLineColor(kRed);
177  fit->Draw("l same");
178 
179  c->Write();
180  }
181  } // end for digIdx
182  }
enum BeamMode kRed
constexpr T pow(T x)
Definition: pow.h:75
const XML_Char int const XML_Char int const XML_Char * base
Definition: expat.h:331
novadaq::cnv::DetId DetId() const
Prefer ds::DetectorService::DetId() instead.
Definition: GeometryBase.h:243
fvar< T > exp(const fvar< T > &x)
Definition: exp.hpp:10
int evt
Near Detector in the NuMI cavern.
calib::ADCShapeFitTable * fShapeFit
T * make(ARGS...args) const
void geom(int which=0)
Definition: geom.C:163
assert(nhit_max >=nhit_nbins)
void Format(TGraph *gr, int lcol, int lsty, int lwid, int mcol, int msty, double msiz)
Definition: Style.cxx:154
Definition: fwd.h:28
enum BeamMode string
void calib::ADCShapeFitAna::beginJob ( )
virtual

Reimplemented from art::EDAnalyzer.

Definition at line 65 of file ADCShapeFitAna_module.cc.

66  {
67  }
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
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 calib::ADCShapeFitAna::reconfigure ( fhicl::ParameterSet const &  pset)

Definition at line 60 of file ADCShapeFitAna_module.cc.

Referenced by ADCShapeFitAna().

61  {
62  }
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

TH2* calib::ADCShapeFitAna::fAvg
protected

Definition at line 38 of file ADCShapeFitAna_module.cc.

Referenced by analyze().

int calib::ADCShapeFitAna::fNCanvs
protected

Definition at line 40 of file ADCShapeFitAna_module.cc.

Referenced by analyze().

calib::ADCShapeFitTable* calib::ADCShapeFitAna::fShapeFit
protected

Definition at line 37 of file ADCShapeFitAna_module.cc.

Referenced by analyze().


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