Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
zcl::FmmTriggerEvd Class Reference
Inheritance diagram for zcl::FmmTriggerEvd:
art::EDProducer art::ProducerBase art::Consumer art::EngineCreator art::ProductRegistryHelper

Public Types

using ModuleType = EDProducer
 
using WorkerType = WorkerT< EDProducer >
 
template<typename UserConfig , typename KeysToIgnore = void>
using Table = ProducerBase::Table< UserConfig, KeysToIgnore >
 

Public Member Functions

 FmmTriggerEvd (fhicl::ParameterSet const &pset)
 
virtual ~FmmTriggerEvd ()
 
void produce (art::Event &evt)
 
template<typename PROD , BranchType B = InEvent>
ProductID getProductID (std::string const &instanceName={}) const
 
template<typename PROD , BranchType B>
ProductID getProductID (ModuleDescription const &moduleDescription, std::string const &instanceName) const
 
bool modifiesEvent () 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
 
void validateConsumedProduct (BranchType const bt, ProductInfo const &pi)
 
void prepareForJob (fhicl::ParameterSet const &pset)
 
void showMissingConsumes () const
 

Private Member Functions

double RMS (std::vector< double > &v, double &mean)
 
bool IsSurfaceHit (int plane, int cell) const
 
void NumberOfCellsPerLength (rb::Cluster const &slice, double tracklength_of_xview, double tracklength_of_yview, double &number_of_cells_per_length_xview, double &number_of_cells_per_length_yview) const
 
void StdevCellsPerPlane (rb::Cluster const &slice, double &stdev_cells_per_plane_xview, double &stdev_cells_per_plane_yview) const
 
double NumberOfHitsInOverlapPlanesCut (rb::Cluster const &slice, float PX_min, float PX_max, float PY_min, float PY_max) const
 

Private Attributes

std::string fClusterInput
 Input folder from cluster reco. More...
 
int evtID
 
int subRunID
 
int RunID
 
int _Nslices
 
bool _penetrated
 
int _nxHits
 
int _nyHits
 
int PX_max
 
int PY_max
 
int PX_min
 
int PY_min
 
int CX_min
 
int CX_max
 
int CY_min
 
int CY_max
 
double _dpx
 
double _dpy
 
double _dcx
 
double _dcy
 
double _dp
 
double _rmsADC
 
double _meanADC
 
double _cx
 
double _cy
 
double _cz
 
double _cxW
 
double _cyW
 
double _czW
 
double _number_of_surface_hits
 
double _number_of_hits_per_length
 
double _number_of_cells_per_length_xview
 
double _number_of_cells_per_length_yview
 
double _stdev_cells_per_plane_xview
 
double _stdev_cells_per_plane_yview
 
double _weighted_off_center_xx
 
double _weighted_off_center_xz
 
double _weighted_off_center_yy
 
double _weighted_off_center_yz
 
double _cxz
 
double _cyz
 
double _cxzW
 
double _cyzW
 
double _percent_of_hits_in_overlap_planes
 
double _tmin
 
double _tmax
 
const int _xMax = 383
 
const int _yMax = 383
 
const int _zMax = 895
 
const int _xdelt = 35
 
const int _ydelt = 35
 
const int _zdelt = 15
 

Detailed Description

Definition at line 50 of file FmmTriggerEvd_module.cc.

Member Typedef Documentation

using art::EDProducer::ModuleType = EDProducer
inherited

Definition at line 34 of file EDProducer.h.

template<typename UserConfig , typename KeysToIgnore = void>
using art::EDProducer::Table = ProducerBase::Table<UserConfig, KeysToIgnore>
inherited

Definition at line 43 of file EDProducer.h.

using art::EDProducer::WorkerType = WorkerT<EDProducer>
inherited

Definition at line 35 of file EDProducer.h.

Constructor & Destructor Documentation

zcl::FmmTriggerEvd::FmmTriggerEvd ( fhicl::ParameterSet const &  pset)
explicit

Definition at line 99 of file FmmTriggerEvd_module.cc.

99  :
100  fClusterInput (pset.get< std::string > ("ClusterInput") )
101 {
102  produces< std::vector<rb::Cluster> >();
103 }
std::string fClusterInput
Input folder from cluster reco.
enum BeamMode string
zcl::FmmTriggerEvd::~FmmTriggerEvd ( )
virtual

Definition at line 105 of file FmmTriggerEvd_module.cc.

106 {
107  // Clean up dynamic memory and other resources here.
108 }

Member Function Documentation

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::EDProducer::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
template<typename PROD , BranchType B>
ProductID art::EDProducer::getProductID ( std::string const &  instanceName = {}) const
inlineinherited

Definition at line 123 of file EDProducer.h.

References art::EDProducer::moduleDescription_.

Referenced by skim::NueSkimmer::CopyMichelSlice(), and skim::NueSkimmer::CopyMichelTrack().

124  {
125  return ProducerBase::getProductID<PROD, B>(moduleDescription_,
126  instanceName);
127  }
ModuleDescription moduleDescription_
Definition: EDProducer.h:115
template<typename PROD , BranchType B>
ProductID art::ProducerBase::getProductID ( ModuleDescription const &  moduleDescription,
std::string const &  instanceName 
) const
inherited

Definition at line 56 of file ProducerBase.h.

References art::ModuleDescription::moduleLabel().

Referenced by art::ProducerBase::modifiesEvent().

58  {
59  auto const& pd =
60  get_ProductDescription<PROD>(B, md.moduleLabel(), instanceName);
61  return pd.productID();
62  }
bool zcl::FmmTriggerEvd::IsSurfaceHit ( int  plane,
int  cell 
) const
private

Definition at line 369 of file FmmTriggerEvd_module.cc.

References _xdelt, _xMax, _zdelt, and _zMax.

Referenced by produce().

369  {
370  if (plane<_zdelt) return true;
371  if (plane>_zMax-_zdelt)return true;
372  if (cell<_xdelt) return true;
373  if (cell>_xMax-_xdelt) return true;
374  return false;
375 }
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::ProducerBase::modifiesEvent ( ) const
inlineinherited

Definition at line 40 of file ProducerBase.h.

References art::ProducerBase::getProductID(), and string.

41  {
42  return true;
43  }
static cet::exempt_ptr<Consumer> art::Consumer::non_module_context ( )
staticinherited
void zcl::FmmTriggerEvd::NumberOfCellsPerLength ( rb::Cluster const &  slice,
double  tracklength_of_xview,
double  tracklength_of_yview,
double &  number_of_cells_per_length_xview,
double &  number_of_cells_per_length_yview 
) const
private

Definition at line 378 of file FmmTriggerEvd_module.cc.

References plot_validation_datamc::c, rb::CellHit::Cell(), rb::Cluster::Cell(), distance(), febshutoff_auto::end, MECModelEnuComparisons::i, it, geo::kX, rb::Cluster::NCell(), rb::CellHit::Plane(), PX_max, PX_min, PY_max, PY_min, and rb::CellHit::View().

Referenced by produce().

378  {
379  std::vector<std::vector<int>> x_hits_plane(PX_max-PX_min+1,std::vector<int>(0));
380  std::vector<std::vector<int>> y_hits_plane(PY_max-PY_min+1,std::vector<int>(0));
381  for (unsigned i = 0; i != slice.NCell(); ++i) {
382  const art::Ptr<rb::CellHit> chit = slice.Cell(i);
383  int c = chit->Cell();
384  int p = chit->Plane();
385  if (chit->View()==geo::kX) {
386  x_hits_plane[p-PX_min].push_back(c);
387  }
388  else {
389  y_hits_plane[p-PY_min].push_back(c);
390  }
391  }
392  //following is to get unique number of cells hit per plane
393  std::vector<int> x_cells_plane(PX_max-PX_min+1,0);
394  std::vector<int> y_cells_plane(PY_max-PY_min+1,0);
395  for (size_t i=0;i!=x_hits_plane.size();i++){
396  std::sort(x_hits_plane[i].begin(),x_hits_plane[i].end());
397  std::vector<int>::iterator it;
398  it = std::unique (x_hits_plane[i].begin(),x_hits_plane[i].end());
399  x_hits_plane[i].resize(std::distance(x_hits_plane[i].begin(),it));
400  x_cells_plane[i]=x_hits_plane[i].size();
401  }
402  for (size_t i=0;i!=y_hits_plane.size();i++){
403  std::sort(y_hits_plane[i].begin(),y_hits_plane[i].end());
404  std::vector<int>::iterator it;
405  it = std::unique (y_hits_plane[i].begin(),y_hits_plane[i].end());
406  y_hits_plane[i].resize(std::distance(y_hits_plane[i].begin(),it));
407  y_cells_plane[i]=y_hits_plane[i].size();
408  }
409  //following is to get number of cells per track length in x view and y view
410  int sum_of_cells=0;
411  for (size_t i=0;i!=x_cells_plane.size();i++){
412  sum_of_cells+=x_cells_plane[i];
413  }
414  number_of_cells_per_length_xview=sum_of_cells/tracklength_of_xview;
415  sum_of_cells=0;
416  for (size_t i=0;i!=y_cells_plane.size();i++){
417  sum_of_cells+=y_cells_plane[i];
418  }
419  number_of_cells_per_length_yview=sum_of_cells/tracklength_of_yview;
420 }
set< int >::iterator it
unsigned short Plane() const
Definition: CellHit.h:39
geo::View_t View() const
Definition: CellHit.h:41
const char * p
Definition: xmltok.h:285
Vertical planes which measure X.
Definition: PlaneGeo.h:28
unsigned distance(const T &t1, const T &t2)
unsigned short Cell() const
Definition: CellHit.h:40
double zcl::FmmTriggerEvd::NumberOfHitsInOverlapPlanesCut ( rb::Cluster const &  slice,
float  PX_min,
float  PX_max,
float  PY_min,
float  PY_max 
) const
private

Definition at line 469 of file FmmTriggerEvd_module.cc.

References rb::Cluster::Cell(), DEFINE_ART_MODULE(), MECModelEnuComparisons::i, cet::sqlite::max(), std::max(), min(), std::min(), rb::Cluster::NCell(), and rb::CellHit::Plane().

Referenced by produce().

469  {
470  int max=std::min(PX_max,PY_max);
471  int min=std::max(PX_min,PY_min);
472  double number_hits_in_overlap_planes=0;
473  for (unsigned i = 0; i != slice.NCell(); ++i) {
474  const art::Ptr<rb::CellHit> chit = slice.Cell(i);
475  if(chit->Plane()<=max && chit->Plane()>=min) number_hits_in_overlap_planes++;
476  }
477  return number_hits_in_overlap_planes/slice.NCell();
478 }
T max(const caf::Proxy< T > &a, T b)
unsigned short Plane() const
Definition: CellHit.h:39
static float min(const float a, const float b, const float c)
Definition: absgeo.cxx:45
T min(const caf::Proxy< T > &a, T b)
T max(sqlite3 *const db, std::string const &table_name, std::string const &column_name)
Definition: statistics.h:68
void art::Consumer::prepareForJob ( fhicl::ParameterSet const &  pset)
protectedinherited
void zcl::FmmTriggerEvd::produce ( art::Event evt)
virtual

Implements art::EDProducer.

Definition at line 110 of file FmmTriggerEvd_module.cc.

References _cx, _cxW, _cxz, _cxzW, _cy, _cyW, _cyz, _cyzW, _cz, _czW, _dcx, _dcy, _dp, _dpx, _dpy, _meanADC, _Nslices, _number_of_cells_per_length_xview, _number_of_cells_per_length_yview, _number_of_hits_per_length, _number_of_surface_hits, _nxHits, _nyHits, _penetrated, _percent_of_hits_in_overlap_planes, _rmsADC, _stdev_cells_per_plane_xview, _stdev_cells_per_plane_yview, _tmax, _tmin, _weighted_off_center_xx, _weighted_off_center_xz, _weighted_off_center_yy, _weighted_off_center_yz, _xdelt, _xMax, _ydelt, _yMax, _zdelt, _zMax, std::abs(), rawdata::RawDigit::ADC(), plot_validation_datamc::c, rb::CellHit::Cell(), rb::Cluster::Cell(), om::cout, CX_max, CX_min, CY_max, CY_min, allTimeWatchdog::endl, art::EventID::event(), evtID, fClusterInput, geom(), art::DataViewImpl::getByLabel(), MECModelEnuComparisons::i, art::Event::id(), IsSurfaceHit(), geo::kX, std::max(), std::min(), rb::Cluster::NCell(), NumberOfCellsPerLength(), NumberOfHitsInOverlapPlanesCut(), rb::CellHit::Plane(), art::Event::put(), PX_max, PX_min, PY_max, PY_min, RMS(), art::Event::run(), RunID, std::sqrt(), StdevCellsPerPlane(), art::Event::subRun(), subRunID, rb::CellHit::TNS(), and rb::CellHit::View().

111 {
112  evtID = evt.id().event();
113  subRunID = evt.subRun();
114  RunID = evt.run();
115 
117  // art::ServiceHandle<calib::Calibrator> calib;
118 
119  //=====================================================================================
120  //Now, start pseudo trigger:
121 
122  double TX_max, TY_max, TX_min, TY_min;
123 
125  evt.getByLabel(fClusterInput, slices);
126 
127  std::unique_ptr< std::vector<rb::Cluster> > clustercol(new std::vector<rb::Cluster>);
128 
129  _Nslices = slices->size();
130  std::cout<<"number of slices: "<<_Nslices<<std::endl;
131 
132  //Instead of splitting the hits into 2 views, just directly take the entire 3D slice:
133  for (unsigned sliceIdx = 0; sliceIdx != slices->size(); ++sliceIdx) {
134  std::cout<<"slice ID: "<<sliceIdx<<std::endl;
135  const rb::Cluster& slice = (*slices)[sliceIdx];
136  std::vector<art::Ptr<rb::CellHit> > Xhitlist, Yhitlist;
137  CX_min = 400;
138  CX_max = 0;
139  CY_min = 400;
140  CY_max = 0;
141  PX_max = 0;
142  PY_max = 0;
143  PX_min = 999;
144  PY_min = 999;
145  TX_max = -9e7;
146  TY_max = -9e7;
147  TX_min = 9e9;
148  TY_min = 9e9;
149 
150  _penetrated = false;
151  _nxHits = 0;
152  _nyHits = 0;
153  _meanADC = 0;
154  _rmsADC = 0;
155  _cx = 0;
156  _cy = 0;
157  _cz = 0;
158  _cxW = 0;
159  _cyW = 0;
160  _czW = 0;
161 
162  //added by enhao
173  _cxz=0;_cyz=0;
174  _cxzW=0;_cyzW=0;
176 
177  bool Intrusion = false;
178  int entry_id = -1;
179  std::vector<double> adcList;
180  double ADCx = 0.;
181  double ADCy = 0.;
182 
183  for (unsigned i = 0; i != slice.NCell(); ++i) {
184  const art::Ptr<rb::CellHit> chit = slice.Cell(i);
185 
186  double tns = chit->TNS();
187  int c = chit->Cell();
188  int p = chit->Plane();
189  adcList.emplace_back(chit->ADC());
190 
191  if(IsSurfaceHit(p,c)==true) _number_of_surface_hits++;
192  _meanADC += chit->ADC();
193  _cz += p;
194  _czW += p * (chit->ADC());
195 
196  if (chit->View()==geo::kX) { //X view
197  Xhitlist.emplace_back(chit);
198  ADCx += chit->ADC();
199  ++_nxHits;
200  _cx += c;
201  _cxW += c*(chit->ADC());
202  _cxz+=p;
203  _cxzW+=p*(chit->ADC());
204 
205  if (PX_max < p) PX_max = p;
206  if (PX_min > p) PX_min = p;
207  if (CX_min > c) CX_min = c;
208  if (CX_max < c) CX_max = c;
209  if (TX_max < tns) TX_max = tns;
210  if (TX_min > tns) TX_min = tns;
211 
212  if (!Intrusion) {
213  if (c < _xdelt){
214  entry_id = 1;
215  Intrusion = true;
216  }
217  else if (c > _xMax - _xdelt){
218  entry_id = 2;
219  Intrusion = true;
220  }
221  }
222  else if (!_penetrated) {
223  if (c < _xdelt && entry_id!=1) _penetrated = true;
224  else if (c > _xMax-_xdelt && entry_id!=2) _penetrated = true;
225  }
226  }
227 
228  else { //Y view
229  Yhitlist.emplace_back(chit);
230  ADCy += chit->ADC();
231  ++_nyHits;
232  _cy += c;
233  _cyW += c*(chit->ADC());
234  _cyz+=p;
235  _cyzW+=p*(chit->ADC());
236 
237  if (PY_max < p) PY_max = p;
238  if (PY_min > p) PY_min = p;
239  if (CY_min > c) CY_min = c;
240  if (CY_max < c) CY_max = c;
241  if (TY_max < tns) TY_max = tns;
242  if (TY_min > tns) TY_min = tns;
243 
244  if (!Intrusion) {
245  if (chit->Cell() < _ydelt) {
246  entry_id = 3;
247  Intrusion = true;
248  }
249  else if (chit->Cell() > _yMax - _ydelt) {
250  entry_id = 4;
251  Intrusion = true;
252  }
253  }
254 
255  else if (!_penetrated) {
256  if (chit->Cell() < _ydelt && entry_id!=3) _penetrated = true;
257  else if (chit->Cell() > _yMax-_ydelt && entry_id!=4) _penetrated = true;
258  }
259  }
260 
261  if (!Intrusion) {
262  if (chit->Plane() < _zdelt) {
263  entry_id = 5;
264  Intrusion = true;
265  }
266  else if (chit->Plane() > _zMax - _zdelt) {
267  entry_id = 6;
268  Intrusion = true;
269  }
270  }
271  else if (!_penetrated) { //intrusion happened but not through yet
272  if (chit->Plane() < _zdelt && entry_id!=5) _penetrated=true;
273  else if (chit->Plane() > _zMax-_zdelt && entry_id!=6) _penetrated=true;
274  }
275  }
276  //print out slice information:
277  std::cout<<"X view Plane range: "<<PX_min<<" "<<PX_max<<std::endl;
278  std::cout<<"X view Cell range: "<<CX_min<<" "<<CX_max<<std::endl;
279  std::cout<<"X view time range: "<<TX_min<<" "<<TX_max<<std::endl;
280 
281  std::cout<<"Y view Plane range: "<<PY_min<<" "<<PY_max<<std::endl;
282  std::cout<<"Y view Cell range: "<<CY_min<<" "<<CY_max<<std::endl;
283  std::cout<<"Y view time range: "<<TY_min<<" "<<TY_max<<std::endl;
284 
285 
286  //Record the info
287  double nhits = _nxHits+_nyHits+0.;
288  _cx /= (_nxHits+0.);
289  _cxW /= ADCx;
290  _cy /= (_nyHits+0.);
291  _cyW /= ADCy;
292  _cz /= nhits;
293  _czW /= _meanADC;
294 
295 
296  // _meanADC = _meanADC/nhits;
297  _rmsADC = RMS(adcList, _meanADC);
298 
299  _dpx = PX_max-PX_min;
300  _dpy = PY_max-PY_min;
301  _dcx = CX_max-CX_min;
302  _dcy = CY_max-CY_min;
303  _dp =std::max(_dpx,_dpy);
304  _tmin = std::min(TX_min,TY_min);
305  _tmax = std::max(TX_max,TY_max);
306 
307  //preselection: if failed these, don't record.
308  std::cout<<"nxHits: "<<_nxHits<<" nyHits: "<<_nyHits<<" penetration: "<<_penetrated<<std::endl;
309  if(_nxHits<3||_nyHits<3||(!_penetrated)||(std::min(PX_max,PY_max) < std::max(PX_min,PY_min)+1)||(std::min(TX_max,TY_max)+62 < std::max(TX_min,TY_min) )) continue;
310 
311 
312  //added by enhao
313  _cxz /= (_nxHits+0.0);
314  _cxzW/=ADCx;
315  _cyz /= (_nyHits+0.0);
316  _cyzW/=ADCy;
317  std::cout<<"number of surface hits: "<<_number_of_surface_hits<<std::endl;
318  if(_number_of_surface_hits<22) continue;
319  double _diagonal_length=std::sqrt(2.82072025*_dp*_dp+_dcx*_dcx+_dcy*_dcy);
320  std::cout<<"slice diagonal length: "<<_diagonal_length<<std::endl;
321  if(_diagonal_length<79) continue;
323  std::cout<<"number of hits divided by slice diagonal length"<<_number_of_hits_per_length<<std::endl;
324  if(_number_of_hits_per_length<0.43) continue;
325  double tracklength_of_xview=std::sqrt(2.82072025*_dpx*_dpx+_dcx*_dcx);
326  double tracklength_of_yview=std::sqrt(2.82072025*_dpy*_dpy+_dcy*_dcy);
327  NumberOfCellsPerLength(slice,tracklength_of_xview,tracklength_of_yview,_number_of_cells_per_length_xview,_number_of_cells_per_length_yview);
328  std::cout<<"number of cells per length xview: "<<_number_of_cells_per_length_xview<<" yview: "<<_number_of_cells_per_length_yview<<std::endl;
331  std::cout<<"stdev cells per plane xview: "<<_stdev_cells_per_plane_xview<<" yview: "<<_stdev_cells_per_plane_yview<<std::endl;
335  _weighted_off_center_yy=std::abs((_cyW-0.5*(CY_max+CY_min))/_dcy);
338 
339 
340  std::cout<<"percent of hits in overlap planes: "<<_percent_of_hits_in_overlap_planes<<std::endl;
341  std::cout<<"weighted off center xz: "<<_weighted_off_center_xz<<" yz: "<<_weighted_off_center_yz<<std::endl;
343  std::cout<<"trigger!!!!!!!!!!!!!"<<std::endl;
344  std::cout<<"trigger slice diagonal length: "<<std::sqrt(2.82072025*_dp*_dp+_dcx*_dcx+_dcy*_dcy)<<std::endl;
345  std::cout<<"evt id: "<<evtID<<std::endl;
346  clustercol->push_back(slice);
347  }
348  }
349  evt.put(std::move(clustercol));
350 
351 } //end analyzing
float TNS() const
Definition: CellHit.h:46
T max(const caf::Proxy< T > &a, T b)
double NumberOfHitsInOverlapPlanesCut(rb::Cluster const &slice, float PX_min, float PX_max, float PY_min, float PY_max) const
SubRunNumber_t subRun() const
Definition: Event.h:72
unsigned int NCell(geo::View_t view) const
Number of cells in view view.
Definition: Cluster.cxx:134
unsigned short Plane() const
Definition: CellHit.h:39
geo::View_t View() const
Definition: CellHit.h:41
const char * p
Definition: xmltok.h:285
T sqrt(T number)
Definition: d0nt_math.hpp:156
Vertical planes which measure X.
Definition: PlaneGeo.h:28
A collection of associated CellHits.
Definition: Cluster.h:47
float abs(float number)
Definition: d0nt_math.hpp:39
ProductID put(std::unique_ptr< PROD > &&product)
Definition: Event.h:102
unsigned short Cell() const
Definition: CellHit.h:40
void StdevCellsPerPlane(rb::Cluster const &slice, double &stdev_cells_per_plane_xview, double &stdev_cells_per_plane_yview) const
void NumberOfCellsPerLength(rb::Cluster const &slice, double tracklength_of_xview, double tracklength_of_yview, double &number_of_cells_per_length_xview, double &number_of_cells_per_length_yview) const
double RMS(std::vector< double > &v, double &mean)
OStream cout
Definition: OStream.cxx:6
bool IsSurfaceHit(int plane, int cell) const
EventNumber_t event() const
Definition: EventID.h:116
art::Ptr< rb::CellHit > Cell(geo::View_t view, unsigned int viewIdx) const
Get the ith cell from view view.
Definition: Cluster.cxx:145
int16_t ADC(uint32_t i) const
Definition: RawDigit.cxx:58
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
T min(const caf::Proxy< T > &a, T b)
RunNumber_t run() const
Definition: Event.h:77
std::string fClusterInput
Input folder from cluster reco.
EventID id() const
Definition: Event.h:56
double zcl::FmmTriggerEvd::RMS ( std::vector< double > &  v,
double &  mean 
)
private

Definition at line 353 of file FmmTriggerEvd_module.cc.

References MECModelEnuComparisons::i, extractScale::mean, extractScale::rms, and std::sqrt().

Referenced by produce().

353  {
354  double rms = 0;
355  mean = 0;
356 
357  for (unsigned i = 0; i!= v.size(); ++i) {
358  mean += v[i];
359  }
360  mean /= double(v.size());
361  for (unsigned i = 0; i!= v.size(); ++i) {
362  rms += (v[i]-mean)*(v[i]-mean);
363  }
364  rms /= double(v.size());
365  rms = sqrt(rms);
366  return rms;
367 }
T sqrt(T number)
Definition: d0nt_math.hpp:156
void art::Consumer::showMissingConsumes ( ) const
protectedinherited

Referenced by art::RootOutput::endJob().

void zcl::FmmTriggerEvd::StdevCellsPerPlane ( rb::Cluster const &  slice,
double &  stdev_cells_per_plane_xview,
double &  stdev_cells_per_plane_yview 
) const
private

Definition at line 421 of file FmmTriggerEvd_module.cc.

References plot_validation_datamc::c, rb::CellHit::Cell(), rb::Cluster::Cell(), distance(), febshutoff_auto::end, MECModelEnuComparisons::i, it, geo::kX, extractScale::mean, rb::Cluster::NCell(), rb::CellHit::Plane(), PX_max, PX_min, PY_max, PY_min, std::sqrt(), HandyFuncs::stdev(), sum, and rb::CellHit::View().

Referenced by produce().

421  {
422  //fluctuation of number of cells of each plane check by Enhao
423  //I need to use cells not hits, because there might be many hits in same cell, for example sag effect, and the cosmic shower has many different cells hits
424  std::vector<std::vector<int>> x_hits_plane(PX_max-PX_min+1,std::vector<int>(0));
425  std::vector<std::vector<int>> y_hits_plane(PY_max-PY_min+1,std::vector<int>(0));
426  for (unsigned i = 0; i != slice.NCell(); ++i) {
427  const art::Ptr<rb::CellHit> chit = slice.Cell(i);
428  int c = chit->Cell();
429  int p = chit->Plane();
430  if (chit->View()==geo::kX) {
431  x_hits_plane[p-PX_min].push_back(c);
432  }
433  else {
434  y_hits_plane[p-PY_min].push_back(c);
435  }
436  }
437  double sum =0;
438  double mean = 0;
439  double sq_sum = 0;
440  double stdev = 0;
441  //following is to get unique number of cells hit per plane
442  std::vector<int> x_cells_plane(PX_max-PX_min+1,0);
443  std::vector<int> y_cells_plane(PY_max-PY_min+1,0);
444  for (size_t i=0;i!=x_hits_plane.size();i++){
445  std::sort(x_hits_plane[i].begin(),x_hits_plane[i].end());
446  std::vector<int>::iterator it;
447  it = std::unique (x_hits_plane[i].begin(),x_hits_plane[i].end());
448  x_hits_plane[i].resize(std::distance(x_hits_plane[i].begin(),it));
449  x_cells_plane[i]=x_hits_plane[i].size();
450  }
451  for (size_t i=0;i!=y_hits_plane.size();i++){
452  std::sort(y_hits_plane[i].begin(),y_hits_plane[i].end());
453  std::vector<int>::iterator it;
454  it = std::unique (y_hits_plane[i].begin(),y_hits_plane[i].end());
455  y_hits_plane[i].resize(std::distance(y_hits_plane[i].begin(),it));
456  y_cells_plane[i]=y_hits_plane[i].size();
457  }
458  sum = std::accumulate(x_cells_plane.begin(),x_cells_plane.end(),0.0);
459  mean = sum / x_cells_plane.size();
460  sq_sum = std::inner_product(x_cells_plane.begin(),x_cells_plane.end(),x_cells_plane.begin(),0.0);
461  stdev = std::sqrt(sq_sum / x_cells_plane.size()-mean * mean);
462  stdev_cells_per_plane_xview=stdev/mean;
463  sum = std::accumulate(y_cells_plane.begin(),y_cells_plane.end(),0.0);
464  mean = sum / y_cells_plane.size();
465  sq_sum = std::inner_product(y_cells_plane.begin(),y_cells_plane.end(),y_cells_plane.begin(),0.0);
466  stdev = std::sqrt(sq_sum / y_cells_plane.size()-mean * mean);
467  stdev_cells_per_plane_yview=stdev/mean;
468 }
def stdev(lst)
Definition: HandyFuncs.py:286
set< int >::iterator it
unsigned short Plane() const
Definition: CellHit.h:39
geo::View_t View() const
Definition: CellHit.h:41
const char * p
Definition: xmltok.h:285
T sqrt(T number)
Definition: d0nt_math.hpp:156
Vertical planes which measure X.
Definition: PlaneGeo.h:28
unsigned distance(const T &t1, const T &t2)
unsigned short Cell() const
Definition: CellHit.h:40
Double_t sum
Definition: plot.C:31
void art::Consumer::validateConsumedProduct ( BranchType const  bt,
ProductInfo const &  pi 
)
protectedinherited

Member Data Documentation

double zcl::FmmTriggerEvd::_cx
private

Definition at line 69 of file FmmTriggerEvd_module.cc.

Referenced by produce().

double zcl::FmmTriggerEvd::_cxW
private

Definition at line 70 of file FmmTriggerEvd_module.cc.

Referenced by produce().

double zcl::FmmTriggerEvd::_cxz
private

Definition at line 78 of file FmmTriggerEvd_module.cc.

Referenced by produce().

double zcl::FmmTriggerEvd::_cxzW
private

Definition at line 79 of file FmmTriggerEvd_module.cc.

Referenced by produce().

double zcl::FmmTriggerEvd::_cy
private

Definition at line 69 of file FmmTriggerEvd_module.cc.

Referenced by produce().

double zcl::FmmTriggerEvd::_cyW
private

Definition at line 70 of file FmmTriggerEvd_module.cc.

Referenced by produce().

double zcl::FmmTriggerEvd::_cyz
private

Definition at line 78 of file FmmTriggerEvd_module.cc.

Referenced by produce().

double zcl::FmmTriggerEvd::_cyzW
private

Definition at line 79 of file FmmTriggerEvd_module.cc.

Referenced by produce().

double zcl::FmmTriggerEvd::_cz
private

Definition at line 69 of file FmmTriggerEvd_module.cc.

Referenced by produce().

double zcl::FmmTriggerEvd::_czW
private

Definition at line 70 of file FmmTriggerEvd_module.cc.

Referenced by produce().

double zcl::FmmTriggerEvd::_dcx
private

Definition at line 67 of file FmmTriggerEvd_module.cc.

Referenced by produce().

double zcl::FmmTriggerEvd::_dcy
private

Definition at line 67 of file FmmTriggerEvd_module.cc.

Referenced by produce().

double zcl::FmmTriggerEvd::_dp
private

Definition at line 67 of file FmmTriggerEvd_module.cc.

Referenced by produce().

double zcl::FmmTriggerEvd::_dpx
private

Definition at line 67 of file FmmTriggerEvd_module.cc.

Referenced by produce().

double zcl::FmmTriggerEvd::_dpy
private

Definition at line 67 of file FmmTriggerEvd_module.cc.

Referenced by produce().

double zcl::FmmTriggerEvd::_meanADC
private

Definition at line 68 of file FmmTriggerEvd_module.cc.

Referenced by produce().

int zcl::FmmTriggerEvd::_Nslices
private

Definition at line 63 of file FmmTriggerEvd_module.cc.

Referenced by produce().

double zcl::FmmTriggerEvd::_number_of_cells_per_length_xview
private

Definition at line 75 of file FmmTriggerEvd_module.cc.

Referenced by produce().

double zcl::FmmTriggerEvd::_number_of_cells_per_length_yview
private

Definition at line 75 of file FmmTriggerEvd_module.cc.

Referenced by produce().

double zcl::FmmTriggerEvd::_number_of_hits_per_length
private

Definition at line 74 of file FmmTriggerEvd_module.cc.

Referenced by produce().

double zcl::FmmTriggerEvd::_number_of_surface_hits
private

Definition at line 73 of file FmmTriggerEvd_module.cc.

Referenced by produce().

int zcl::FmmTriggerEvd::_nxHits
private

Definition at line 65 of file FmmTriggerEvd_module.cc.

Referenced by produce().

int zcl::FmmTriggerEvd::_nyHits
private

Definition at line 65 of file FmmTriggerEvd_module.cc.

Referenced by produce().

bool zcl::FmmTriggerEvd::_penetrated
private

Definition at line 64 of file FmmTriggerEvd_module.cc.

Referenced by produce().

double zcl::FmmTriggerEvd::_percent_of_hits_in_overlap_planes
private

Definition at line 80 of file FmmTriggerEvd_module.cc.

Referenced by produce().

double zcl::FmmTriggerEvd::_rmsADC
private

Definition at line 68 of file FmmTriggerEvd_module.cc.

Referenced by produce().

double zcl::FmmTriggerEvd::_stdev_cells_per_plane_xview
private

Definition at line 76 of file FmmTriggerEvd_module.cc.

Referenced by produce().

double zcl::FmmTriggerEvd::_stdev_cells_per_plane_yview
private

Definition at line 76 of file FmmTriggerEvd_module.cc.

Referenced by produce().

double zcl::FmmTriggerEvd::_tmax
private

Definition at line 83 of file FmmTriggerEvd_module.cc.

Referenced by produce().

double zcl::FmmTriggerEvd::_tmin
private

Definition at line 83 of file FmmTriggerEvd_module.cc.

Referenced by produce().

double zcl::FmmTriggerEvd::_weighted_off_center_xx
private

Definition at line 77 of file FmmTriggerEvd_module.cc.

Referenced by produce().

double zcl::FmmTriggerEvd::_weighted_off_center_xz
private

Definition at line 77 of file FmmTriggerEvd_module.cc.

Referenced by produce().

double zcl::FmmTriggerEvd::_weighted_off_center_yy
private

Definition at line 77 of file FmmTriggerEvd_module.cc.

Referenced by produce().

double zcl::FmmTriggerEvd::_weighted_off_center_yz
private

Definition at line 77 of file FmmTriggerEvd_module.cc.

Referenced by produce().

const int zcl::FmmTriggerEvd::_xdelt = 35
private

Definition at line 88 of file FmmTriggerEvd_module.cc.

Referenced by IsSurfaceHit(), and produce().

const int zcl::FmmTriggerEvd::_xMax = 383
private

Definition at line 85 of file FmmTriggerEvd_module.cc.

Referenced by IsSurfaceHit(), and produce().

const int zcl::FmmTriggerEvd::_ydelt = 35
private

Definition at line 89 of file FmmTriggerEvd_module.cc.

Referenced by produce().

const int zcl::FmmTriggerEvd::_yMax = 383
private

Definition at line 86 of file FmmTriggerEvd_module.cc.

Referenced by produce().

const int zcl::FmmTriggerEvd::_zdelt = 15
private

Definition at line 90 of file FmmTriggerEvd_module.cc.

Referenced by IsSurfaceHit(), and produce().

const int zcl::FmmTriggerEvd::_zMax = 895
private

Definition at line 87 of file FmmTriggerEvd_module.cc.

Referenced by IsSurfaceHit(), and produce().

int zcl::FmmTriggerEvd::CX_max
private

Definition at line 66 of file FmmTriggerEvd_module.cc.

Referenced by produce().

int zcl::FmmTriggerEvd::CX_min
private

Definition at line 66 of file FmmTriggerEvd_module.cc.

Referenced by produce().

int zcl::FmmTriggerEvd::CY_max
private

Definition at line 66 of file FmmTriggerEvd_module.cc.

Referenced by produce().

int zcl::FmmTriggerEvd::CY_min
private

Definition at line 66 of file FmmTriggerEvd_module.cc.

Referenced by produce().

int zcl::FmmTriggerEvd::evtID
private

Definition at line 61 of file FmmTriggerEvd_module.cc.

Referenced by produce().

std::string zcl::FmmTriggerEvd::fClusterInput
private

Input folder from cluster reco.

Definition at line 58 of file FmmTriggerEvd_module.cc.

Referenced by produce().

int zcl::FmmTriggerEvd::PX_max
private

Definition at line 66 of file FmmTriggerEvd_module.cc.

Referenced by NumberOfCellsPerLength(), produce(), and StdevCellsPerPlane().

int zcl::FmmTriggerEvd::PX_min
private

Definition at line 66 of file FmmTriggerEvd_module.cc.

Referenced by NumberOfCellsPerLength(), produce(), and StdevCellsPerPlane().

int zcl::FmmTriggerEvd::PY_max
private

Definition at line 66 of file FmmTriggerEvd_module.cc.

Referenced by NumberOfCellsPerLength(), produce(), and StdevCellsPerPlane().

int zcl::FmmTriggerEvd::PY_min
private

Definition at line 66 of file FmmTriggerEvd_module.cc.

Referenced by NumberOfCellsPerLength(), produce(), and StdevCellsPerPlane().

int zcl::FmmTriggerEvd::RunID
private

Definition at line 61 of file FmmTriggerEvd_module.cc.

Referenced by produce().

int zcl::FmmTriggerEvd::subRunID
private

Definition at line 61 of file FmmTriggerEvd_module.cc.

Referenced by produce().


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