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

Public Types

using WorkerType = WorkerT< EDAnalyzer >
 
using ModuleType = EDAnalyzer
 

Public Member Functions

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

Private Attributes

std::string fClusterInput
 
TTree * Rock_MC
 
TTree * Rock_Cheater
 
int nu_pdg
 
float vx
 
float vy
 
float vz
 
float px
 
float py
 
float pz
 
float Enu
 
float mcPE
 
float cx
 
float cy
 
float cz
 
float ct
 
int cview
 

Detailed Description

Definition at line 41 of file RockAna_module.cc.

Member Typedef Documentation

Definition at line 39 of file EDAnalyzer.h.

Definition at line 38 of file EDAnalyzer.h.

Constructor & Destructor Documentation

mcchk::RockAna::RockAna ( fhicl::ParameterSet const &  pset)
explicit

Definition at line 73 of file RockAna_module.cc.

References reconfigure().

74  : EDAnalyzer(pset)
75  {
76  reconfigure(pset);
77  }
void reconfigure(fhicl::ParameterSet const &pset)
EDAnalyzer(Table< Config > const &config)
Definition: EDAnalyzer.h:100
mcchk::RockAna::~RockAna ( )
virtual

Definition at line 89 of file RockAna_module.cc.

89 {}

Member Function Documentation

void mcchk::RockAna::analyze ( const art::Event evt)

Definition at line 119 of file RockAna_module.cc.

References getBrightness::cell, rb::CellHit::Cell(), geo::PlaneGeo::Cell(), rb::Cluster::Cell(), om::cout, ct, cview, cx, cy, cz, DEFINE_ART_MODULE(), allTimeWatchdog::endl, Enu, fClusterInput, geom(), art::DataViewImpl::getByLabel(), geo::CellGeo::GetCenter(), simb::MCTruth::GetNeutrino(), cheat::BackTracker::HitToPhotonSignal(), MECModelEnuComparisons::i, compare_h5_caf::idx, cheat::BackTracker::IsNoise(), geo::kX, mc, mcPE, rb::Cluster::NCell(), simb::MCNeutrino::Nu(), nu_pdg, simb::MCParticle::P(), simb::MCParticle::PdgCode(), rb::CellHit::Plane(), geo::GeometryBase::Plane(), NDAPDHVSetting::plane, px, simb::MCParticle::Px(), py, simb::MCParticle::Py(), pz, simb::MCParticle::Pz(), Rock_Cheater, Rock_MC, gen_flatrecord::size, rb::CellHit::View(), vx, simb::MCParticle::Vx(), vy, simb::MCParticle::Vy(), vz, and simb::MCParticle::Vz().

120  {
121 
123 
124 
125  //Now, get the vertex position and energy of neutrino
127  try{ evt.getByLabel("generator",mcTruths); }
128  catch(...){ std::cout<<"couldn't get the mcTruths"<<std::endl; return;}
129 
130  for (unsigned idx =0; idx!=mcTruths->size();++idx) {
131  art::Ptr<simb::MCTruth> mc (mcTruths,idx);
132 
133  const simb::MCNeutrino& mc_neutrino = mc->GetNeutrino();
134  const simb::MCParticle& nu = mc_neutrino.Nu();
135  nu_pdg = nu.PdgCode();
136  vx = nu.Vx();
137  vy = nu.Vy();
138  vz = nu.Vz();
139  px = nu.Px();
140  py = nu.Py();
141  pz = nu.Pz();
142  Enu = nu.P();
143 
144  Rock_MC->Fill();
145  }
146 
147  //make a backtracker
149  // const sim::ParticleNavigator& pnav = bt->ParticleNavigator();
150 
151 
152  // now we collect all hits from the slice
154  try{ evt.getByLabel(fClusterInput, slices);}
155  catch(...){ std::cout<<"couldn't get slices"<<std::endl; return;}
156  const int sliceMax = slices->size();
157 
158  for(int sliceIdx = 0; sliceIdx < sliceMax; ++sliceIdx){
159  const rb::Cluster& slice = (*slices)[sliceIdx];
160  const int hitMax = slice.NCell();
161 
162  for (int hitIdx=0; hitIdx<hitMax; ++hitIdx)
163  {
164  const art::Ptr<rb::CellHit> chit = slice.Cell(hitIdx);
165 
166  unsigned short plane = chit->Plane();
167  unsigned short cell = chit->Cell();
168  if (chit->View() == geo::kX) cview = 0;
169  else cview =1;
170  try {
171  if (!(bt->IsNoise(chit))){
172  //Get the center position of each hit
173  double xyz[3];
174  geom->Plane(plane)->Cell(cell)->GetCenter(xyz);
175 
176  cx = xyz[0];
177  cy = xyz[1];
178  cz = xyz[2];
179 
180  mcPE=0;
181  ct =0;
182  for (unsigned int i=0; i!=(bt->HitToPhotonSignal(chit)).size();++i){
183  mcPE += (bt->HitToPhotonSignal(chit))[i].NPhoton();
184  ct += (bt->HitToPhotonSignal(chit))[i].TimeMean();
185  }
186  ct = ct/((bt->HitToPhotonSignal(chit)).size()+0.0);
187 
188 
189  Rock_Cheater->Fill();
190 
191  }
192 
193 
194  }
195 
196 
197  catch (...) {
198  continue;
199  }
200 
201 
202  }
203 
204 
205  }
206 
207 
208 
209 
210  return;
211  }
std::string fClusterInput
int PdgCode() const
Definition: MCParticle.h:211
unsigned int NCell(geo::View_t view) const
Number of cells in view view.
Definition: Cluster.cxx:134
void GetCenter(double *xyz, double localz=0.0) const
Definition: CellGeo.cxx:159
double Py(const int i=0) const
Definition: MCParticle.h:230
unsigned short Plane() const
Definition: CellHit.h:39
geo::View_t View() const
Definition: CellHit.h:41
const CellGeo * Cell(int icell) const
Definition: PlaneGeo.h:48
const simb::MCParticle & Nu() const
Definition: MCNeutrino.h:146
Vertical planes which measure X.
Definition: PlaneGeo.h:28
double Px(const int i=0) const
Definition: MCParticle.h:229
A collection of associated CellHits.
Definition: Cluster.h:47
const PlaneGeo * Plane(unsigned int i) const
bool IsNoise(const art::Ptr< rb::CellHit > &hit) const
Is this hit not associated with any particles?
unsigned short Cell() const
Definition: CellHit.h:40
double P(const int i=0) const
Definition: MCParticle.h:233
OStream cout
Definition: OStream.cxx:6
art::Ptr< rb::CellHit > Cell(geo::View_t view, unsigned int viewIdx) const
Get the ith cell from view view.
Definition: Cluster.cxx:145
double Vx(const int i=0) const
Definition: MCParticle.h:220
const std::vector< sim::PhotonSignal > HitToPhotonSignal(const art::Ptr< rb::CellHit > &hit) const
Returns the PhotonSignals contributing the signal in the specified hit.
bool getByLabel(std::string const &label, std::string const &productInstanceName, Handle< PROD > &result) const
Definition: DataViewImpl.h:344
void geom(int which=0)
Definition: geom.C:163
double Pz(const int i=0) const
Definition: MCParticle.h:231
TTree * Rock_Cheater
double Vz(const int i=0) const
Definition: MCParticle.h:222
Event generator information.
Definition: MCNeutrino.h:18
double Vy(const int i=0) const
Definition: MCParticle.h:221
void mcchk::RockAna::beginJob ( )
virtual

Reimplemented from art::EDAnalyzer.

Definition at line 94 of file RockAna_module.cc.

References ct, cview, cx, cy, cz, Enu, art::TFileDirectory::make(), mcPE, nu_pdg, px, py, pz, Rock_Cheater, Rock_MC, vx, vy, and vz.

95  {
96 
98 
99  Rock_MC = tfs->make<TTree>("Rock_MC","Neutrino Info");
100  Rock_MC -> Branch("pdg",&nu_pdg,"pdg/I");
101  Rock_MC -> Branch("vx",&vx,"vx/F");
102  Rock_MC -> Branch("vy",&vy,"vy/F");
103  Rock_MC -> Branch("vz",&vz,"vz/F");
104  Rock_MC -> Branch("px",&px,"px/F");
105  Rock_MC -> Branch("py",&py,"py/F");
106  Rock_MC -> Branch("pz",&pz,"pz/F");
107  Rock_MC -> Branch("E", &Enu,"E/F");
108 
109  Rock_Cheater = tfs->make<TTree>("Rock_Cheater","all hits");
110  Rock_Cheater -> Branch("PE",&mcPE,"PE/F");
111  Rock_Cheater -> Branch("x",&cx,"x/F");
112  Rock_Cheater -> Branch("y",&cy,"y/F");
113  Rock_Cheater -> Branch("z",&cz,"z/F");
114  Rock_Cheater -> Branch("t",&ct,"t/F");
115  Rock_Cheater -> Branch("view",&cview,"view/I");
116 
117  }
T * make(ARGS...args) const
TTree * Rock_Cheater
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 mcchk::RockAna::reconfigure ( fhicl::ParameterSet const &  pset)

Definition at line 79 of file RockAna_module.cc.

References fClusterInput, fhicl::ParameterSet::get(), and string.

Referenced by RockAna().

81  {
82  fClusterInput = pset.get< std::string >("ClusterInput") ;
83  }
std::string fClusterInput
enum BeamMode string
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

float mcchk::RockAna::ct
private

Definition at line 61 of file RockAna_module.cc.

Referenced by analyze(), and beginJob().

int mcchk::RockAna::cview
private

Definition at line 62 of file RockAna_module.cc.

Referenced by analyze(), and beginJob().

float mcchk::RockAna::cx
private

Definition at line 61 of file RockAna_module.cc.

Referenced by analyze(), and beginJob().

float mcchk::RockAna::cy
private

Definition at line 61 of file RockAna_module.cc.

Referenced by analyze(), and beginJob().

float mcchk::RockAna::cz
private

Definition at line 61 of file RockAna_module.cc.

Referenced by analyze(), and beginJob().

float mcchk::RockAna::Enu
private

Definition at line 59 of file RockAna_module.cc.

Referenced by analyze(), and beginJob().

std::string mcchk::RockAna::fClusterInput
private

Definition at line 53 of file RockAna_module.cc.

Referenced by analyze(), and reconfigure().

float mcchk::RockAna::mcPE
private

Definition at line 61 of file RockAna_module.cc.

Referenced by analyze(), and beginJob().

int mcchk::RockAna::nu_pdg
private

Definition at line 58 of file RockAna_module.cc.

Referenced by analyze(), and beginJob().

float mcchk::RockAna::px
private

Definition at line 59 of file RockAna_module.cc.

Referenced by mcscore.MCParticle::__init__(), analyze(), and beginJob().

float mcchk::RockAna::py
private

Definition at line 59 of file RockAna_module.cc.

Referenced by mcscore.MCParticle::__init__(), analyze(), and beginJob().

float mcchk::RockAna::pz
private

Definition at line 59 of file RockAna_module.cc.

Referenced by mcscore.MCParticle::__init__(), analyze(), and beginJob().

TTree* mcchk::RockAna::Rock_Cheater
private

Definition at line 56 of file RockAna_module.cc.

Referenced by analyze(), and beginJob().

TTree* mcchk::RockAna::Rock_MC
private

Definition at line 55 of file RockAna_module.cc.

Referenced by analyze(), and beginJob().

float mcchk::RockAna::vx
private

Definition at line 59 of file RockAna_module.cc.

Referenced by analyze(), and beginJob().

float mcchk::RockAna::vy
private

Definition at line 59 of file RockAna_module.cc.

Referenced by analyze(), and beginJob().

float mcchk::RockAna::vz
private

Definition at line 59 of file RockAna_module.cc.

Referenced by analyze(), and beginJob().


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