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

Public Types

using WorkerType = WorkerT< EDAnalyzer >
 
using ModuleType = EDAnalyzer
 

Public Member Functions

 TOFTriggerAna (fhicl::ParameterSet const &p)
 
void analyze (art::Event const &e) override
 
void beginJob () override
 
void beginRun (art::Run const &r) override
 
void beginSubRun (art::SubRun const &sr) override
 
void endJob () override
 
void endRun (art::Run const &r) override
 
void endSubRun (art::SubRun const &sr) override
 
void decimal2binary (unsigned int decimalNumber, unsigned int *binaryNumber)
 
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

art::InputTag _TriggerInputTag
 
art::InputTag _RecoToFLabel
 
std::string TriggerBitName [16]
 
TH1D * hTOF_Promt
 
TH1D * hTOF_Slow
 
TH1D * hTOF_WCHDWR
 
TH1D * hTOF_Any
 
TH1D * hTOF_All
 

Detailed Description

Definition at line 52 of file TOFTriggerAna_module.cc.

Member Typedef Documentation

Definition at line 39 of file EDAnalyzer.h.

Definition at line 38 of file EDAnalyzer.h.

Constructor & Destructor Documentation

novatb::TOFTriggerAna::TOFTriggerAna ( fhicl::ParameterSet const &  p)
explicit

Definition at line 98 of file TOFTriggerAna_module.cc.

99  : EDAnalyzer(p) // ,
100  // More initializers here.
101 {}
const char * p
Definition: xmltok.h:285
EDAnalyzer(Table< Config > const &config)
Definition: EDAnalyzer.h:100

Member Function Documentation

void novatb::TOFTriggerAna::analyze ( art::Event const &  e)
overridevirtual

Implements art::EDAnalyzer.

Definition at line 122 of file TOFTriggerAna_module.cc.

References _RecoToFLabel, _TriggerInputTag, decimal2binary(), art::fill_ptr_vector(), art::DataViewImpl::getByLabel(), hTOF_All, hTOF_Any, hTOF_Promt, hTOF_Slow, hTOF_WCHDWR, and submit_syst::pattern.

122  {
124  std::vector<art::Ptr<rawdata::RawBeamlineTrigger> > Triggers;
125  if (e.getByLabel(_TriggerInputTag, TriggerHandle))
126  art::fill_ptr_vector(Triggers, TriggerHandle);
127 
128  bool isTOFPromptTrig = false;
129  bool isTOFSlowTrig = false;
130  bool isWCHDWRTrig = false;
131 
132  if (Triggers.size() != 1) return;
133 
134  for (auto trigItr = Triggers.begin(); trigItr != Triggers.end(); trigItr++) {
135  unsigned int pattern = (*trigItr)->Pattern();
136  unsigned int binaryNumber[32];
137  decimal2binary(pattern, &binaryNumber[0]);
138  isTOFSlowTrig = binaryNumber[15] == 1 ? true : false;
139  isTOFPromptTrig = binaryNumber[14] == 1 ? true : false;
140  isWCHDWRTrig = binaryNumber[12] == 1 ? true : false;
141  // bool foundTriggerBit = false;
142  // for (unsigned int i = 0; i < 16; i++) {
143  // if (binaryNumber[i] == 1 && foundTriggerBit) {
144  // std::cout << " + " << TriggerBitName[i].c_str();
145  // }
146  // if (binaryNumber[i] == 1 && !foundTriggerBit) {
147  // std::cout << TriggerBitName[i].c_str();
148  // foundTriggerBit = true;
149  // }
150  // }
151  // std::cout << std::endl;
152  }
153 
155  std::vector<art::Ptr<brb::ToF>> tofs;
156  if (e.getByLabel(_RecoToFLabel, tofHandle)) art::fill_ptr_vector(tofs, tofHandle);
157 
158  for (auto tof : tofs) {
159  // cut
160  if (tof.get()->Time() < 0) continue;
161 
162  // fill
163  if (isTOFPromptTrig) hTOF_Promt->Fill(tof.get()->Time());
164  if (isTOFSlowTrig) hTOF_Slow->Fill(tof.get()->Time());
165  if (isWCHDWRTrig) hTOF_WCHDWR->Fill(tof.get()->Time());
166  if (isTOFPromptTrig && isTOFSlowTrig && isWCHDWRTrig) hTOF_All->Fill(tof.get()->Time());
167  if (isTOFPromptTrig || isTOFSlowTrig || isWCHDWRTrig) hTOF_Any->Fill(tof.get()->Time());
168  }
169 }
void decimal2binary(unsigned int decimalNumber, unsigned int *binaryNumber)
void fill_ptr_vector(std::vector< Ptr< T >> &ptrs, H const &h)
Definition: Ptr.h:464
Float_t e
Definition: plot.C:35
void novatb::TOFTriggerAna::beginJob ( )
overridevirtual

Reimplemented from art::EDAnalyzer.

Definition at line 103 of file TOFTriggerAna_module.cc.

References _RecoToFLabel, _TriggerInputTag, hTOF_All, hTOF_Any, hTOF_Promt, hTOF_Slow, and hTOF_WCHDWR.

103  {
104  _RecoToFLabel = "tofreco";
105  _TriggerInputTag = "daq:Trigger";
106 
107  hTOF_Promt = new TH1D("hTOF_Promt" , ";TOF (ns);", 400, 0, 200);
108  hTOF_Slow = new TH1D("hTOF_Slow" , ";TOF (ns);", 400, 0, 200);
109  hTOF_WCHDWR = new TH1D("hTOF_WCHDWR", ";TOF (ns);", 400, 0, 200);
110  hTOF_Any = new TH1D("hTOF_Any" , ";TOF (ns);", 400, 0, 200);
111  hTOF_All = new TH1D("hTOF_All" , ";TOF (ns);", 400, 0, 200);
112 }
void novatb::TOFTriggerAna::beginRun ( art::Run const &  r)
overridevirtual

Reimplemented from art::EDAnalyzer.

Definition at line 114 of file TOFTriggerAna_module.cc.

114  {
115  // Implementation of optional member function here.
116 }
void novatb::TOFTriggerAna::beginSubRun ( art::SubRun const &  sr)
overridevirtual

Reimplemented from art::EDAnalyzer.

Definition at line 118 of file TOFTriggerAna_module.cc.

118  {
119  // Implementation of optional member function here.
120 }
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 novatb::TOFTriggerAna::decimal2binary ( unsigned int  decimalNumber,
unsigned int binaryNumber 
)

Definition at line 85 of file TOFTriggerAna_module.cc.

References allTimeWatchdog::index.

Referenced by analyze().

86  {
87  for (int index = 31; index >= 0; index--) {
88  unsigned int reference = TMath::Power(2, (int)index);
89  if (decimalNumber >= reference) {
90  *(binaryNumber + index) = 1;
91  decimalNumber = decimalNumber - reference;
92  } else {
93  *(binaryNumber + index) = 0;
94  }
95  }
96 }
void novatb::TOFTriggerAna::endJob ( )
overridevirtual

Reimplemented from art::EDAnalyzer.

Definition at line 171 of file TOFTriggerAna_module.cc.

References plot_validation_datamc::c, hTOF_All, hTOF_Any, hTOF_Promt, hTOF_Slow, hTOF_WCHDWR, kBlue, kGreen, kRed, and MECModelEnuComparisons::leg.

171  {
172  gStyle->SetOptStat(0);
173 
174  hTOF_Promt->SetLineColor(kRed);
175  hTOF_Slow->SetLineColor(kGreen);
176  hTOF_WCHDWR->SetLineColor(kBlue);
177  hTOF_Any->SetLineColor(kCyan);
178  hTOF_All->SetLineColor(kBlack);
179 
180  double lineWidth = 1;
181  hTOF_Promt->SetLineWidth(lineWidth);
182  hTOF_Slow->SetLineWidth(lineWidth);
183  hTOF_WCHDWR->SetLineWidth(lineWidth);
184  hTOF_Any->SetLineWidth(lineWidth);
185  hTOF_All->SetLineWidth(lineWidth);
186 
187  TCanvas* c = new TCanvas("c", "c", 2400, 1200);
188  c->SetLogy();
189  hTOF_Any->GetXaxis()->CenterTitle();
190  hTOF_Any->Draw();
191  hTOF_Promt->Draw("SAME");
192  hTOF_Slow->Draw("SAME");
193  hTOF_WCHDWR->Draw("SAME");
194  hTOF_All->Draw("SAME");
195 
196  TLegend* leg = new TLegend(0.85, 0.75, 0.95, 0.95);
197  leg->AddEntry(hTOF_Any, "Any trigger", "l");
198  leg->AddEntry(hTOF_All, "All triggers", "l");
199  leg->AddEntry(hTOF_Promt, "TOF promt", "l");
200  leg->AddEntry(hTOF_Slow, "TOF slow", "l");
201  leg->AddEntry(hTOF_WCHDWR, "WC trigger", "l");
202  leg->Draw();
203 
204  c->SaveAs("TOF_vs_Trigger.pdf");
205 }
enum BeamMode kRed
enum BeamMode kGreen
enum BeamMode kBlue
void novatb::TOFTriggerAna::endRun ( art::Run const &  r)
overridevirtual

Reimplemented from art::EDAnalyzer.

Definition at line 207 of file TOFTriggerAna_module.cc.

207  {
208  // Implementation of optional member function here.
209 }
void novatb::TOFTriggerAna::endSubRun ( art::SubRun const &  sr)
overridevirtual

Reimplemented from art::EDAnalyzer.

Definition at line 211 of file TOFTriggerAna_module.cc.

References DEFINE_ART_MODULE().

211  {
212  // Implementation of optional member function here.
213 }
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 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

art::InputTag novatb::TOFTriggerAna::_RecoToFLabel
private

Definition at line 71 of file TOFTriggerAna_module.cc.

Referenced by analyze(), and beginJob().

art::InputTag novatb::TOFTriggerAna::_TriggerInputTag
private

Definition at line 70 of file TOFTriggerAna_module.cc.

Referenced by analyze(), and beginJob().

TH1D* novatb::TOFTriggerAna::hTOF_All
private

Definition at line 82 of file TOFTriggerAna_module.cc.

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

TH1D* novatb::TOFTriggerAna::hTOF_Any
private

Definition at line 81 of file TOFTriggerAna_module.cc.

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

TH1D* novatb::TOFTriggerAna::hTOF_Promt
private

Definition at line 78 of file TOFTriggerAna_module.cc.

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

TH1D* novatb::TOFTriggerAna::hTOF_Slow
private

Definition at line 79 of file TOFTriggerAna_module.cc.

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

TH1D* novatb::TOFTriggerAna::hTOF_WCHDWR
private

Definition at line 80 of file TOFTriggerAna_module.cc.

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

std::string novatb::TOFTriggerAna::TriggerBitName[16]
private
Initial value:
= {"WC1IGNOREME", "WC2IGNOREME", "WC3IGNOREME", "WCCOINC",
"PAD1" , "PAD2" , "PAD3" , "PAD4" ,
"TOFUS" , "SWYDGATE" , "MWPCOFF" , "DIGBUSY",
"WCHDWR" , "TOFDS" , "TOFPrompt" , "TOFSlow"}

Definition at line 73 of file TOFTriggerAna_module.cc.


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