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

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

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

Public Types

using WorkerType = WorkerT< EDAnalyzer >
 
using ModuleType = EDAnalyzer
 

Public Member Functions

 TestParticleCorrections (const fhicl::ParameterSet &pset)
 
virtual ~TestParticleCorrections ()
 
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 * fE
 
TH1 * fMu
 
TH1 * fProt
 
TH1 * fPi
 
TH1 * fEPre
 
TH1 * fMuPre
 
TH1 * fProtPre
 
TH1 * fPiPre
 
TH1 * fCell
 
TGraph * fGE
 
TGraph * fGMu
 
TGraph * fGProt
 
TGraph * fGPi
 

Detailed Description

Make plots of threshold effect from PCHits files.

Definition at line 36 of file TestParticleCorrections_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::TestParticleCorrections::TestParticleCorrections ( const fhicl::ParameterSet pset)
explicit

Definition at line 58 of file TestParticleCorrections_module.cc.

References reconfigure().

59  : EDAnalyzer(pset)
60  {
61  reconfigure(pset);
62  }
virtual void reconfigure(const fhicl::ParameterSet &pset)
EDAnalyzer(Table< Config > const &config)
Definition: EDAnalyzer.h:100
calib::TestParticleCorrections::~TestParticleCorrections ( )
virtual

Definition at line 65 of file TestParticleCorrections_module.cc.

66  {
67  }

Member Function Documentation

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

Definition at line 123 of file TestParticleCorrections_module.cc.

References rb::Cluster::AllCells(), rb::Cluster::Cell(), calib::corr(), DEFINE_ART_MODULE(), APDHVSetting::dummy, MakeMiniprodValidationCuts::f, fCell, fE, fEPre, fGE, fGMu, fGPi, fGProt, fMu, fMuPre, fPi, fPiPre, fProt, fProtPre, art::DataViewImpl::getByLabel(), calib::Calibrator::GetPE(), rb::RecoHit::GeV(), cheat::BackTracker::HitsToParticle(), cheat::BackTracker::HitToFLSHit(), rb::Cluster::IsNoise(), geo::kX, calib::Calibrator::MakeRecoHit(), rb::Cluster::MeanX(), rb::Cluster::MinCell(), rb::Cluster::MinPlane(), rb::Cluster::NCell(), part, submit_concat_project::parts, simb::MCParticle::PdgCode(), rb::Cluster::RecoHit(), rawdata::RawDigit::SetADC(), rb::CellHit::SetCell(), rawdata::RawDigit::SetMC(), rb::CellHit::SetPE(), rb::CellHit::SetPlane(), and rb::Cluster::TotalGeV().

124  {
125  const double hack = 4095/2170.; // why?
126 
129 
131  evt.getByLabel("slicer", slices);
132 
133  for(unsigned int sliceIdx = 0; sliceIdx < slices->size(); ++sliceIdx){
134  const art::Ptr<rb::Cluster> slice(slices, sliceIdx);
135  if(slice->IsNoise()) continue;
136 
137  for(unsigned int iCell = 0; iCell < slice->NCell(); ++iCell){
138  const double reco = slice->RecoHit( iCell).GeV()*hack;
139  const std::vector<sim::FLSHit> flss = bt->HitToFLSHit(slice->Cell(iCell));
140  double truth = 0;
141  for(auto f: flss) truth += f.GetEdep();
142 
143  fCell->Fill(reco/truth);
144  }
145 
146  const double est = slice->TotalGeV();
147 
148  const std::vector<const sim::Particle*> parts = bt->HitsToParticle(slice->AllCells());
149 
150  if(parts.empty()) continue;
151  const sim::Particle* part = parts[0];
152 
154  dummy.SetPlane(slice->MinPlane());
155  dummy.SetCell(slice->MinCell(geo::kX));
156  dummy.SetADC(0, 25);
157  dummy.SetPE(cal->GetPE(&dummy));
158 
159  dummy.SetMC();
160 
161  const rb::RecoHit rhit = cal->MakeRecoHit(dummy, slice->MeanX()); // symmetric
162 
163  // Crash when not calibrated. Always should be in MC
164  const double thresh = rhit.GeV()*1000; // MeV
165  // std::cout << thresh << std::endl;
166 
167  // From gdml, correct to total density of soup
168  const double dead = (.85*.859+.15*1.49)/(.85*.859);
169 
170  switch(part->PdgCode()){
171  case -11:
172  case +11:
173  fE->Fill(est*corr(fGE, thresh)*dead*hack);
174  fEPre->Fill(est*hack);
175  break;
176  case -13:
177  case +13:
178  fMu->Fill(est*corr(fGMu, thresh)*dead*hack);
179  fMuPre->Fill(est*hack);
180  break;
181  case 2212:
182  fProt->Fill(est*corr(fGProt, thresh)*dead*hack);
183  fProtPre->Fill(est*hack);
184  break;
185  case -211:
186  case +211:
187  fPi->Fill(est*corr(fGPi, thresh)*dead*hack);
188  fPiPre->Fill(est*hack);
189  break;
190  }
191  }
192  }
int PdgCode() const
Definition: MCParticle.h:211
Vertical planes which measure X.
Definition: PlaneGeo.h:28
rb::RecoHit MakeRecoHit(rb::CellHit const &cellhit, double w)
double corr(TGraph *g, double thresh)
Calibrated quantities relying on position in the orthogonal view. To generate a rb::CellHit from a rb...
Definition: RecoHit.h:19
void SetPlane(unsigned short plane)
Definition: CellHit.h:53
void SetCell(unsigned short cell)
Definition: CellHit.h:52
void SetADC(uint32_t i, int16_t iADC)
Definition: RawDigit.cxx:108
TString part[npart]
Definition: Style.C:32
void SetPE(float pe)
Definition: CellHit.h:55
std::vector< sim::FLSHit > HitToFLSHit(const rb::CellHit &hit) const
All the FLSHits that contributed to this hit, sorted from most to least light.
void SetMC(bool isMC=true)
Definition: RawDigit.h:106
A rawdata::RawDigit with channel information decoded.
Definition: CellHit.h:27
float GeV() const
Definition: RecoHit.cxx:69
bool getByLabel(std::string const &label, std::string const &productInstanceName, Handle< PROD > &result) const
Definition: DataViewImpl.h:344
float GetPE(rb::CellHit const &)
std::vector< const sim::Particle * > HitsToParticle(const std::vector< const rb::CellHit * > &hits) const
Returns vector of sim::Particle objects contributing to the given collection of hits.
void calib::TestParticleCorrections::beginJob ( )
overridevirtual

Reimplemented from art::EDAnalyzer.

Definition at line 75 of file TestParticleCorrections_module.cc.

References MakeMiniprodValidationCuts::f, fCell, fE, fEPre, fGE, fGMu, fGPi, fGProt, fMu, fMuPre, fPi, fPiPre, fProt, fProtPre, kBlue, kRed, and art::TFileDirectory::make().

76  {
78 
79  fE = tfs->make<TH1F>("e", "True e^{#pm};Energy estimate (GeV);Slices", 400, 0, 4);
80  fMu = tfs->make<TH1F>("mu", "True #mu^{#pm};Energy estimate (GeV);Slices", 400, 0, 4);
81  fProt = tfs->make<TH1F>("prot", "True p;Energy estimate (GeV);Slices", 400, 0, 4);
82  fPi = tfs->make<TH1F>("pi", "True #pi^{#pm};Energy estimate (GeV);Slices", 400, 0, 4);
83 
84 
85  fEPre = tfs->make<TH1F>("e_pre", "True e^{#pm};Energy estimate (GeV);Slices", 400, 0, 4);
86  fMuPre = tfs->make<TH1F>("mu_pre", "True #mu^{#pm};Energy estimate (GeV);Slices", 400, 0, 4);
87  fProtPre = tfs->make<TH1F>("prot_pre", "True p;Energy estimate (GeV);Slices", 400, 0, 4);
88  fPiPre = tfs->make<TH1F>("pi_pre", "True #pi^{#pm};Energy estimate (GeV);Slices", 400, 0, 4);
89 
90  fE->SetLineColor(kRed);
91  fMu->SetLineColor(kBlue);
92  fProt->SetLineColor(kBlack);
93  fPi->SetLineColor(kMagenta);
94 
95  fEPre->SetLineColor(kRed);
96  fMuPre->SetLineColor(kBlue);
97  fProtPre->SetLineColor(kBlack);
98  fPiPre->SetLineColor(kMagenta);
99 
100  fCell = tfs->make<TH1F>("cell", ";Cell reco/true", 100, 0, 2);
101 
102  TFile* f = new TFile("pcorr_curves.root");
103  fGE = (TGraph*)f->Get("e");
104  fGMu = (TGraph*)f->Get("mu");
105  fGProt = (TGraph*)f->Get("p");
106  fGPi = (TGraph*)f->Get("pi");
107  }
enum BeamMode kRed
T * make(ARGS...args) const
enum BeamMode kBlue
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::TestParticleCorrections::reconfigure ( const fhicl::ParameterSet pset)
virtual

Definition at line 70 of file TestParticleCorrections_module.cc.

Referenced by TestParticleCorrections().

71  {
72  }
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::TestParticleCorrections::fCell
protected

Definition at line 52 of file TestParticleCorrections_module.cc.

Referenced by analyze(), and beginJob().

TH1* calib::TestParticleCorrections::fE
protected

Definition at line 49 of file TestParticleCorrections_module.cc.

Referenced by analyze(), and beginJob().

TH1* calib::TestParticleCorrections::fEPre
protected

Definition at line 50 of file TestParticleCorrections_module.cc.

Referenced by analyze(), and beginJob().

TGraph* calib::TestParticleCorrections::fGE
protected

Definition at line 54 of file TestParticleCorrections_module.cc.

Referenced by analyze(), and beginJob().

TGraph * calib::TestParticleCorrections::fGMu
protected

Definition at line 54 of file TestParticleCorrections_module.cc.

Referenced by analyze(), and beginJob().

TGraph * calib::TestParticleCorrections::fGPi
protected

Definition at line 54 of file TestParticleCorrections_module.cc.

Referenced by analyze(), and beginJob().

TGraph * calib::TestParticleCorrections::fGProt
protected

Definition at line 54 of file TestParticleCorrections_module.cc.

Referenced by analyze(), and beginJob().

TH1 * calib::TestParticleCorrections::fMu
protected

Definition at line 49 of file TestParticleCorrections_module.cc.

Referenced by analyze(), and beginJob().

TH1 * calib::TestParticleCorrections::fMuPre
protected

Definition at line 50 of file TestParticleCorrections_module.cc.

Referenced by analyze(), and beginJob().

TH1 * calib::TestParticleCorrections::fPi
protected

Definition at line 49 of file TestParticleCorrections_module.cc.

Referenced by analyze(), and beginJob().

TH1 * calib::TestParticleCorrections::fPiPre
protected

Definition at line 50 of file TestParticleCorrections_module.cc.

Referenced by analyze(), and beginJob().

TH1 * calib::TestParticleCorrections::fProt
protected

Definition at line 49 of file TestParticleCorrections_module.cc.

Referenced by analyze(), and beginJob().

TH1 * calib::TestParticleCorrections::fProtPre
protected

Definition at line 50 of file TestParticleCorrections_module.cc.

Referenced by analyze(), and beginJob().


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