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

Public Types

using WorkerType = WorkerT< EDAnalyzer >
 
using ModuleType = EDAnalyzer
 

Public Member Functions

 ClusterAna (fhicl::ParameterSet const &p)
 
virtual ~ClusterAna ()
 
void analyze (art::Event const &e) override
 
void beginJob () override
 
void endJob () override
 
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

TH1F * fNClustersHist
 
TH1F * fNHitsPerClusterHist
 
TH1F * fExtentPlanesHist
 
TH1F * fClusterEnergyHist
 
TH1F * fWidthXHist
 
TH1F * fWidthYHist
 
TH1F * fClusterEnDenHist
 
TH1F * fXViewTrackGood
 
TH1F * fYViewTrackGood
 
TH1F * fCombViewTrackGood
 
std::string fClusterModule
 

Detailed Description

Definition at line 35 of file ClusterAna_module.cc.

Member Typedef Documentation

Definition at line 39 of file EDAnalyzer.h.

Definition at line 38 of file EDAnalyzer.h.

Constructor & Destructor Documentation

novaddt::ClusterAna::ClusterAna ( fhicl::ParameterSet const &  p)
explicit

Definition at line 63 of file ClusterAna_module.cc.

63  :
64  EDAnalyzer(p),
65  fClusterModule(p.get<std::string>("ClusterModule"))
66 {
67 }
const char * p
Definition: xmltok.h:285
EDAnalyzer(Table< Config > const &config)
Definition: EDAnalyzer.h:100
enum BeamMode string
novaddt::ClusterAna::~ClusterAna ( )
virtual

Definition at line 69 of file ClusterAna_module.cc.

70 {
71  // Clean up dynamic memory and other resources here.
72 }

Member Function Documentation

void novaddt::ClusterAna::analyze ( art::Event const &  e)
overridevirtual

Implements art::EDAnalyzer.

Definition at line 74 of file ClusterAna_module.cc.

References fClusterEnDenHist, fClusterEnergyHist, fClusterModule, fCombViewTrackGood, fExtentPlanesHist, fNClustersHist, fNHitsPerClusterHist, fWidthXHist, fWidthYHist, fXViewTrackGood, fYViewTrackGood, art::DataViewImpl::getByLabel(), MECModelEnuComparisons::i, it, util::LinFitUnweighted(), parsePQSLOutput::partition, plot_validation_datamc::pred, util::sqr(), and std::sqrt().

75 {
77  e.getByLabel(fClusterModule, clusters);
78 
79  // put in a mf::LogWarning why this statement returns if true
80  if(clusters->empty()){
81  mf::LogWarning ("No Clusters")<<"No Clusters in the input file";
82  return;
83  }
84 
85  // Fill Number of Clusters in Event Histogram
86  fNClustersHist->Fill(clusters->size());
87 
88  // Grab the Hitlists associated with the clusters
90 
91  //std::cout<< "Sanity check, there are: "<<clusters->size()<<" clusters and " <<hls.size()<<" hitlists."<<std::endl;
92 
93  unsigned int i(0);
94  for(auto const& clust: *clusters){
95  fExtentPlanesHist->Fill(clust.Extent());
96  fWidthXHist->Fill(clust.WidthX());
97  fWidthYHist->Fill(clust.WidthY());
98  fClusterEnergyHist->Fill(clust.TotalADC());
99  fClusterEnDenHist->Fill(clust.TotalADC()/(1.0*clust.Volume()));
100 
101  art::Ptr<novaddt::HitList> hl_ptr(hls.at(i));
102  ++i;
103 
104  novaddt::HitList hlist(*hl_ptr);
105 
106  fNHitsPerClusterHist->Fill(hl_ptr->size());
107  //std::cout<<"Hits in cluster: "<<hlist.size()<<std::endl;
108 
109  // Split the hits in x and y to do 2D fitting
110  auto bound = std::partition(hlist.begin(),hlist.end(),CompareDAQHit<View>());
111  //std::cout<<"Boundary is at: "<<bound-hlist.begin()<<std::endl;
112 
113  unsigned int xsize = bound-hlist.begin();
114  unsigned int ysize = hlist.end()-bound;
115 
116  //std::cout<<"X Size: "<<xsize<<", Y size: "<<ysize<<std::endl;
117 
118  // Smarter way of vector managment
119 
120  std::vector<double> XXpoints;
121  std::vector<double> XZpoints;
122  std::vector<double> YYpoints;
123  std::vector<double> YZpoints;
124 
125  XXpoints.reserve(xsize);
126  XZpoints.reserve(xsize);
127  YYpoints.reserve(ysize);
128  YZpoints.reserve(ysize);
129 
130  {
131  auto it = hlist.begin();
132  for(it=hlist.begin();it!=bound;++it){
133  XXpoints.emplace_back((*it).Cell().val);
134  XZpoints.emplace_back((*it).Plane().val);
135  }
136 
137  for(it=bound;it!=hlist.end();++it){
138  YYpoints.emplace_back((*it).Cell().val);
139  YZpoints.emplace_back((*it).Plane().val);
140  }
141  }
142 
143  // Fit to a straight line
144  double xslope;
145  double xint;
146  unsigned int xdof = xsize-1;
147  double xsigm=0.0;
148  double pred;
149 
150  if(xsize > 1){
151  util::LinFitUnweighted(XXpoints, XZpoints, xslope, xint);
152  //std::cout<<"XView fit done: y = "<<xslope<<"*x + "<<xint<<std::endl;
153 
154  // Evaluate goodness of fit
155  for(unsigned int xi=0;xi<xsize;++xi){
156  pred = xslope*XXpoints[xi] + xint;
157  xsigm += sqrt(util::sqr(XZpoints[xi]-pred));
158  }
159 
160  fXViewTrackGood->Fill(xsigm/xdof);
161  }
162 
163  else{
164  fXViewTrackGood->Fill(0.0);
165  xdof = 1;
166  }
167  //std::cout<<"Goodness of XView fit: "<<xsigm/xdof<<std::endl;
168 
169  double yslope;
170  double yint;
171  unsigned int ydof = ysize-1;
172  double ysigm=0.0;
173 
174  if(ysize > 1){
175  util::LinFitUnweighted(YYpoints, YZpoints, yslope, yint);
176  //std::cout<<"YView fit done: y = "<<yslope<<"*x + "<<yint<<std::endl;
177 
178  for(unsigned int yi=0;yi<ysize;++yi){
179  pred = yslope*YYpoints[yi] + yint;
180  ysigm += sqrt(util::sqr(YZpoints[yi]-pred));
181  }
182 
183  fYViewTrackGood->Fill(ysigm/ydof);
184  }
185 
186  else{
187  fYViewTrackGood->Fill(0.0);
188  ydof = 1;
189  }
190  //std::cout<<"Goodness of YView fit: "<<ysigm/ydof<<std::endl;
191 
192  fCombViewTrackGood->Fill(sqrt(util::sqr(xsigm/xdof)+util::sqr(ysigm/ydof)));
193 
194  //std::cout<<"Analysis of Cluster finished\n\n";
195 
196  } // end of cluster
197 
198 } // end of analyze function
set< int >::iterator it
std::vector< DAQHit > HitList
Definition: HitList.h:15
T sqrt(T number)
Definition: d0nt_math.hpp:156
T sqr(T x)
More efficient square function than pow(x,2)
Definition: MathUtil.h:23
void LinFitUnweighted(const std::vector< double > &x, const std::vector< double > &y, double &m, double &c)
Simplified version of LinFit.
Definition: MathUtil.cxx:8
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
Float_t e
Definition: plot.C:35
Definition: fwd.h:28
void novaddt::ClusterAna::beginJob ( )
overridevirtual

Reimplemented from art::EDAnalyzer.

Definition at line 200 of file ClusterAna_module.cc.

References MakeMiniprodValidationCuts::f, fClusterEnDenHist, fClusterEnergyHist, fCombViewTrackGood, fExtentPlanesHist, fNClustersHist, fNHitsPerClusterHist, fWidthXHist, fWidthYHist, fXViewTrackGood, fYViewTrackGood, and art::TFileDirectory::make().

201 {
203 
204  fNClustersHist = f->make<TH1F>("fNClusters",";NClusters;Events",100,0.,100.);
205  fNHitsPerClusterHist = f->make<TH1F>("fNHitsPerCluster",";NHits;Clusters",100,0.,100.);
206  fExtentPlanesHist = f->make<TH1F>("fExtentPlanes",";NPlanes;Clusters",896,0.,896.);
207  fWidthXHist = f->make<TH1F>("fWidthX",";NCells;Clusters",384,0.,384.);
208  fWidthYHist = f->make<TH1F>("fWidthY",";NCells;Clusters",384,0.,384.);
209  fClusterEnergyHist = f->make<TH1F>("fClusterEnergy",";TotADC;Clusters",1000,0.,100000.);
210  fClusterEnDenHist = f->make<TH1F>("fClusterEnergyDensity",";ADC per plane*cell^2;Clusters",10000,0.,0.5);
211  fXViewTrackGood = f->make<TH1F>("fXViewTrackGood",";Goodness of Lin Fit;Tracks",1000,0.,100.);
212  fYViewTrackGood = f->make<TH1F>("fYViewTrackGood",";Goodness of Lin Fit;Tracks",1000,0.,100.);
213  fCombViewTrackGood = f->make<TH1F>("fCombViewTrackGood",";Goodness of Lin Fit;Tracks",1000,0.,100.);
214 
215 }
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
void novaddt::ClusterAna::endJob ( )
overridevirtual

Reimplemented from art::EDAnalyzer.

Definition at line 217 of file ClusterAna_module.cc.

References DEFINE_ART_MODULE().

218 {
219  // Implementation of optional member function here.
220 }
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

TH1F* novaddt::ClusterAna::fClusterEnDenHist
private

Definition at line 53 of file ClusterAna_module.cc.

Referenced by analyze(), and beginJob().

TH1F* novaddt::ClusterAna::fClusterEnergyHist
private

Definition at line 50 of file ClusterAna_module.cc.

Referenced by analyze(), and beginJob().

std::string novaddt::ClusterAna::fClusterModule
private

Definition at line 58 of file ClusterAna_module.cc.

Referenced by analyze().

TH1F* novaddt::ClusterAna::fCombViewTrackGood
private

Definition at line 56 of file ClusterAna_module.cc.

Referenced by analyze(), and beginJob().

TH1F* novaddt::ClusterAna::fExtentPlanesHist
private

Definition at line 49 of file ClusterAna_module.cc.

Referenced by analyze(), and beginJob().

TH1F* novaddt::ClusterAna::fNClustersHist
private

Definition at line 47 of file ClusterAna_module.cc.

Referenced by analyze(), and beginJob().

TH1F* novaddt::ClusterAna::fNHitsPerClusterHist
private

Definition at line 48 of file ClusterAna_module.cc.

Referenced by analyze(), and beginJob().

TH1F* novaddt::ClusterAna::fWidthXHist
private

Definition at line 51 of file ClusterAna_module.cc.

Referenced by analyze(), and beginJob().

TH1F* novaddt::ClusterAna::fWidthYHist
private

Definition at line 52 of file ClusterAna_module.cc.

Referenced by analyze(), and beginJob().

TH1F* novaddt::ClusterAna::fXViewTrackGood
private

Definition at line 54 of file ClusterAna_module.cc.

Referenced by analyze(), and beginJob().

TH1F* novaddt::ClusterAna::fYViewTrackGood
private

Definition at line 55 of file ClusterAna_module.cc.

Referenced by analyze(), and beginJob().


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