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

Make plots of threshold effect from PCHits files. More...

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

Public Types

using WorkerType = WorkerT< EDAnalyzer >
 
using ModuleType = EDAnalyzer
 

Public Member Functions

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

TH1 * fDepE
 
TH1 * fDepPos
 
TH1 * fDepMum
 
TH1 * fDepMup
 
TH1 * fDepProt
 
TH1 * fDepPip
 
TH1 * fDepPim
 
TH1 * fDepE2
 
TH1 * fDepPos2
 
TH1 * fDepMum2
 
TH1 * fDepMup2
 
TH1 * fDepProt2
 
TH1 * fDepPip2
 
TH1 * fDepPim2
 
TH1 * fT
 

Detailed Description

Make plots of threshold effect from PCHits files.

Definition at line 32 of file ParticleCorrections_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::ParticleCorrections::ParticleCorrections ( const fhicl::ParameterSet pset)
explicit

Definition at line 52 of file ParticleCorrections_module.cc.

References reconfigure().

53  : EDAnalyzer(pset)
54  {
55  reconfigure(pset);
56  }
virtual void reconfigure(const fhicl::ParameterSet &pset)
EDAnalyzer(Table< Config > const &config)
Definition: EDAnalyzer.h:100
calib::ParticleCorrections::~ParticleCorrections ( )
virtual

Definition at line 59 of file ParticleCorrections_module.cc.

60  {
61  }

Member Function Documentation

void calib::ParticleCorrections::analyze ( const art::Event evt)
overridevirtual

Definition at line 93 of file ParticleCorrections_module.cc.

References ana::assert(), om::cout, DEFINE_ART_MODULE(), allTimeWatchdog::endl, sim::ParticleNavigator::EveId(), fDepE, fDepE2, fDepMum, fDepMum2, fDepMup, fDepMup2, fDepPim, fDepPim2, fDepPip, fDepPip2, fDepPos, fDepPos2, fDepProt, fDepProt2, fT, art::DataViewImpl::getByLabel(), it, part, cheat::BackTracker::ParticleNavigator(), simb::MCParticle::PdgCode(), simb::MCParticle::Process(), and cheat::BackTracker::TrackIDToParticle().

94  {
96  const sim::ParticleNavigator& pnav = bt->ParticleNavigator();
97 
99  evt.getByLabel("geantgen", flsls);
100 
101  assert(flsls->size() == 1);
102 
103  const std::vector<sim::FLSHit>& flss = (*flsls)[0].fHits;
104 
105  std::map<int, std::map<geo::OfflineChan, double>> deps;
106 
107  for(const sim::FLSHit& fls: flss){
108  // Worried about Michels and pion decay
109  /*
110  if(!pnav.IsPrimary(fls.GetTrackID())){
111  std::cout << "Rejecting non-primary " << fls.GetTrackID() << " " << fls.GetPDG() << std::endl;
112  continue;
113  }
114  */
115 
116  const sim::Particle* part = bt->TrackIDToParticle(fls.GetTrackID());
117  // Only want the main particle
118  if(part->Process() == "Decay") continue;
119 
120  if(!part){
121  std::cout << "No particle" << std::endl;
122  continue;
123  }
124  // if(part->PdgCode() != fls.GetPDG()) continue;
125 
126  const int evePdg = bt->TrackIDToParticle(pnav.EveId(fls.GetTrackID()))->PdgCode();
127 
128  // Don't worry about Birks for now
129  deps[evePdg/*fls.GetPDG()*/][geo::OfflineChan(fls.GetPlaneID(),
130  fls.GetCellID())] += fls.GetEdep();
131 
132  // Make sure we don't have Michels etc
133  if(evePdg/*fls.GetPDG()*/ == 11) fT->Fill(fls.GetEntryT());
134  }
135 
136  for(auto it: deps[ +11]) fDepE ->Fill(it.second);
137  for(auto it: deps[ -11]) fDepPos ->Fill(it.second);
138  for(auto it: deps[ +13]) fDepMum ->Fill(it.second);
139  for(auto it: deps[ -13]) fDepMup ->Fill(it.second);
140  for(auto it: deps[2212]) fDepProt->Fill(it.second);
141  for(auto it: deps[+211]) fDepPip ->Fill(it.second);
142  for(auto it: deps[-211]) fDepPim ->Fill(it.second);
143 
144  for(auto it: deps[ +11]) fDepE2 ->Fill(it.second, it.second);
145  for(auto it: deps[ -11]) fDepPos2 ->Fill(it.second, it.second);
146  for(auto it: deps[ +13]) fDepMum2 ->Fill(it.second, it.second);
147  for(auto it: deps[ -13]) fDepMup2 ->Fill(it.second, it.second);
148  for(auto it: deps[2212]) fDepProt2->Fill(it.second, it.second);
149  for(auto it: deps[+211]) fDepPip2 ->Fill(it.second, it.second);
150  for(auto it: deps[-211]) fDepPim2 ->Fill(it.second, it.second);
151  }
int PdgCode() const
Definition: MCParticle.h:211
set< int >::iterator it
const sim::ParticleNavigator & ParticleNavigator() const
Get a reference to the ParticleNavigator.
Definition: BackTracker.h:744
A single unit of energy deposition in the liquid scintillator.
Definition: FLSHit.h:19
std::string Process() const
Definition: MCParticle.h:214
TString part[npart]
Definition: Style.C:32
const sim::Particle * TrackIDToParticle(int const &id) const
Returns a pointer to the sim::Particle object corresponding to the given TrackID. ...
OStream cout
Definition: OStream.cxx:6
bool getByLabel(std::string const &label, std::string const &productInstanceName, Handle< PROD > &result) const
Definition: DataViewImpl.h:344
A (plane, cell) pair.
Definition: OfflineChan.h:17
assert(nhit_max >=nhit_nbins)
int EveId(const int trackID) const
void calib::ParticleCorrections::beginJob ( )
overridevirtual

Reimplemented from art::EDAnalyzer.

Definition at line 69 of file ParticleCorrections_module.cc.

References fDepE, fDepE2, fDepMum, fDepMum2, fDepMup, fDepMup2, fDepPim, fDepPim2, fDepPip, fDepPip2, fDepPos, fDepPos2, fDepProt, fDepProt2, fT, and art::TFileDirectory::make().

70  {
72 
73  fDepE = tfs->make<TH1F>("depe", "True e^{-};True energy deposit (GeV);Cells", 1000, 0, .1);
74  fDepPos = tfs->make<TH1F>("deppos", "True e^{+};True energy deposit (GeV);Cells", 1000, 0, .1);
75  fDepMum = tfs->make<TH1F>("depmum", "True #mu^{-};True energy deposit (GeV);Cells", 1000, 0, .1);
76  fDepMup = tfs->make<TH1F>("depmup", "True #mu^{+};True energy deposit (GeV);Cells", 1000, 0, .1);
77  fDepProt = tfs->make<TH1F>("depprot", "True p;True energy deposit (GeV);Cells", 1000, 0, .1);
78  fDepPip = tfs->make<TH1F>("deppip", "True #pi^{+};True energy deposit (GeV);Cells", 1000, 0, .1);
79  fDepPim = tfs->make<TH1F>("deppim", "True #pi^{-};True energy deposit (GeV);Cells", 1000, 0, .1);
80 
81  fDepE2 = tfs->make<TH1F>("depe2", "True e^{-};True energy deposit (GeV);Cells", 1000, 0, .1);
82  fDepPos2 = tfs->make<TH1F>("deppos2", "True e^{+};True energy deposit (GeV);Cells", 1000, 0, .1);
83  fDepMum2 = tfs->make<TH1F>("depmum2", "True #mu^{-};True energy deposit (GeV);Cells", 1000, 0, .1);
84  fDepMup2 = tfs->make<TH1F>("depmup2", "True #mu^{+};True energy deposit (GeV);Cells", 1000, 0, .1);
85  fDepProt2 = tfs->make<TH1F>("depprot2", "True p;True energy deposit (GeV);Cells", 1000, 0, .1);
86  fDepPip2 = tfs->make<TH1F>("deppip2", "True #pi^{+};True energy deposit (GeV);Cells", 1000, 0, .1);
87  fDepPim2 = tfs->make<TH1F>("deppim2", "True #pi^{-};True energy deposit (GeV);Cells", 1000, 0, .1);
88 
89  fT = tfs->make<TH1F>("t", "", 500, 0, 500e3);
90  }
T * make(ARGS...args) const
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::ParticleCorrections::reconfigure ( const fhicl::ParameterSet pset)
virtual

Definition at line 64 of file ParticleCorrections_module.cc.

Referenced by ParticleCorrections().

65  {
66  }
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

TH1* calib::ParticleCorrections::fDepE
protected

Definition at line 45 of file ParticleCorrections_module.cc.

Referenced by analyze(), and beginJob().

TH1* calib::ParticleCorrections::fDepE2
protected

Definition at line 46 of file ParticleCorrections_module.cc.

Referenced by analyze(), and beginJob().

TH1 * calib::ParticleCorrections::fDepMum
protected

Definition at line 45 of file ParticleCorrections_module.cc.

Referenced by analyze(), and beginJob().

TH1 * calib::ParticleCorrections::fDepMum2
protected

Definition at line 46 of file ParticleCorrections_module.cc.

Referenced by analyze(), and beginJob().

TH1 * calib::ParticleCorrections::fDepMup
protected

Definition at line 45 of file ParticleCorrections_module.cc.

Referenced by analyze(), and beginJob().

TH1 * calib::ParticleCorrections::fDepMup2
protected

Definition at line 46 of file ParticleCorrections_module.cc.

Referenced by analyze(), and beginJob().

TH1 * calib::ParticleCorrections::fDepPim
protected

Definition at line 45 of file ParticleCorrections_module.cc.

Referenced by analyze(), and beginJob().

TH1 * calib::ParticleCorrections::fDepPim2
protected

Definition at line 46 of file ParticleCorrections_module.cc.

Referenced by analyze(), and beginJob().

TH1 * calib::ParticleCorrections::fDepPip
protected

Definition at line 45 of file ParticleCorrections_module.cc.

Referenced by analyze(), and beginJob().

TH1 * calib::ParticleCorrections::fDepPip2
protected

Definition at line 46 of file ParticleCorrections_module.cc.

Referenced by analyze(), and beginJob().

TH1 * calib::ParticleCorrections::fDepPos
protected

Definition at line 45 of file ParticleCorrections_module.cc.

Referenced by analyze(), and beginJob().

TH1 * calib::ParticleCorrections::fDepPos2
protected

Definition at line 46 of file ParticleCorrections_module.cc.

Referenced by analyze(), and beginJob().

TH1 * calib::ParticleCorrections::fDepProt
protected

Definition at line 45 of file ParticleCorrections_module.cc.

Referenced by analyze(), and beginJob().

TH1 * calib::ParticleCorrections::fDepProt2
protected

Definition at line 46 of file ParticleCorrections_module.cc.

Referenced by analyze(), and beginJob().

TH1* calib::ParticleCorrections::fT
protected

Definition at line 48 of file ParticleCorrections_module.cc.

Referenced by analyze(), and beginJob().


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