Public Types | 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::detail::Producer art::detail::LegacyModule art::Modifier art::ModuleBase art::ProductRegistryHelper

Public Types

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

Public Member Functions

 FmmTriggerEvd (fhicl::ParameterSet const &pset)
 
virtual ~FmmTriggerEvd ()
 
void produce (art::Event &evt)
 
std::string workerType () const
 
void doBeginJob ()
 
void doEndJob ()
 
void doRespondToOpenInputFile (FileBlock const &fb)
 
void doRespondToCloseInputFile (FileBlock const &fb)
 
void doRespondToOpenOutputFiles (FileBlock const &fb)
 
void doRespondToCloseOutputFiles (FileBlock const &fb)
 
bool doBeginRun (RunPrincipal &rp, ModuleContext const &mc)
 
bool doEndRun (RunPrincipal &rp, ModuleContext const &mc)
 
bool doBeginSubRun (SubRunPrincipal &srp, ModuleContext const &mc)
 
bool doEndSubRun (SubRunPrincipal &srp, ModuleContext const &mc)
 
bool doEvent (EventPrincipal &ep, ModuleContext const &mc, std::atomic< std::size_t > &counts_run, std::atomic< std::size_t > &counts_passed, std::atomic< std::size_t > &counts_failed)
 
ModuleDescription const & moduleDescription () const
 
void setModuleDescription (ModuleDescription const &)
 
std::array< std::vector< ProductInfo >, NumBranchTypes > const & getConsumables () const
 
void sortConsumables (std::string const &current_process_name)
 
template<typename T , BranchType BT>
ViewToken< TconsumesView (InputTag const &tag)
 
template<typename T , BranchType BT>
ViewToken< TmayConsumeView (InputTag const &tag)
 

Protected Member Functions

ConsumesCollector & consumesCollector ()
 
template<typename T , BranchType = InEvent>
ProductToken< Tconsumes (InputTag const &)
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > consumesView (InputTag const &)
 
template<typename T , BranchType = InEvent>
void consumesMany ()
 
template<typename T , BranchType = InEvent>
ProductToken< TmayConsume (InputTag const &)
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > mayConsumeView (InputTag const &)
 
template<typename T , BranchType = InEvent>
void mayConsumeMany ()
 

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

Definition at line 17 of file EDProducer.h.

template<typename UserConfig , typename KeysToIgnore = void>
using art::detail::Producer::Table = Modifier::Table<UserConfig, KeysToIgnore>
inherited

Definition at line 25 of file Producer.h.

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

Definition at line 18 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  EDProducer(pset),
101  fClusterInput (pset.get< std::string > ("ClusterInput") )
102 {
103  produces< std::vector<rb::Cluster> >();
104 }
EDProducer(fhicl::ParameterSet const &pset)
Definition: EDProducer.h:20
std::string fClusterInput
Input folder from cluster reco.
enum BeamMode string
zcl::FmmTriggerEvd::~FmmTriggerEvd ( )
virtual

Definition at line 106 of file FmmTriggerEvd_module.cc.

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

Member Function Documentation

template<typename T , BranchType BT>
ProductToken< T > art::ModuleBase::consumes ( InputTag const &  tag)
protectedinherited

Definition at line 55 of file ModuleBase.h.

References art::ModuleBase::collector_, art::ConsumesCollector::consumes(), T, and getGoodRuns4SAM::tag.

56  {
57  return collector_.consumes<T, BT>(tag);
58  }
ConsumesCollector collector_
Definition: ModuleBase.h:50
ProductToken< T > consumes(InputTag const &)
double T
Definition: Xdiff_gwt.C:5
ConsumesCollector& art::ModuleBase::consumesCollector ( )
protectedinherited
template<typename T , BranchType BT>
void art::ModuleBase::consumesMany ( )
protectedinherited

Definition at line 69 of file ModuleBase.h.

References art::ModuleBase::collector_, art::ConsumesCollector::consumesMany(), and T.

70  {
71  collector_.consumesMany<T, BT>();
72  }
ConsumesCollector collector_
Definition: ModuleBase.h:50
double T
Definition: Xdiff_gwt.C:5
template<typename Element , BranchType = InEvent>
ViewToken<Element> art::ModuleBase::consumesView ( InputTag const &  )
protectedinherited
template<typename T , BranchType BT>
ViewToken<T> art::ModuleBase::consumesView ( InputTag const &  tag)
inherited

Definition at line 62 of file ModuleBase.h.

References art::ModuleBase::collector_, art::ConsumesCollector::consumesView(), T, and getGoodRuns4SAM::tag.

63  {
64  return collector_.consumesView<T, BT>(tag);
65  }
ConsumesCollector collector_
Definition: ModuleBase.h:50
ViewToken< Element > consumesView(InputTag const &)
double T
Definition: Xdiff_gwt.C:5
void art::detail::Producer::doBeginJob ( )
inherited
bool art::detail::Producer::doBeginRun ( RunPrincipal rp,
ModuleContext const &  mc 
)
inherited
bool art::detail::Producer::doBeginSubRun ( SubRunPrincipal srp,
ModuleContext const &  mc 
)
inherited
void art::detail::Producer::doEndJob ( )
inherited
bool art::detail::Producer::doEndRun ( RunPrincipal rp,
ModuleContext const &  mc 
)
inherited
bool art::detail::Producer::doEndSubRun ( SubRunPrincipal srp,
ModuleContext const &  mc 
)
inherited
bool art::detail::Producer::doEvent ( EventPrincipal ep,
ModuleContext const &  mc,
std::atomic< std::size_t > &  counts_run,
std::atomic< std::size_t > &  counts_passed,
std::atomic< std::size_t > &  counts_failed 
)
inherited
void art::detail::Producer::doRespondToCloseInputFile ( FileBlock const &  fb)
inherited
void art::detail::Producer::doRespondToCloseOutputFiles ( FileBlock const &  fb)
inherited
void art::detail::Producer::doRespondToOpenInputFile ( FileBlock const &  fb)
inherited
void art::detail::Producer::doRespondToOpenOutputFiles ( FileBlock const &  fb)
inherited
std::array<std::vector<ProductInfo>, NumBranchTypes> const& art::ModuleBase::getConsumables ( ) const
inherited
bool zcl::FmmTriggerEvd::IsSurfaceHit ( int  plane,
int  cell 
) const
private

Definition at line 370 of file FmmTriggerEvd_module.cc.

References _xdelt, _xMax, _zdelt, and _zMax.

Referenced by produce().

370  {
371  if (plane<_zdelt) return true;
372  if (plane>_zMax-_zdelt)return true;
373  if (cell<_xdelt) return true;
374  if (cell>_xMax-_xdelt) return true;
375  return false;
376 }
template<typename T , BranchType BT>
ProductToken< T > art::ModuleBase::mayConsume ( InputTag const &  tag)
protectedinherited

Definition at line 76 of file ModuleBase.h.

References art::ModuleBase::collector_, art::ConsumesCollector::mayConsume(), T, and getGoodRuns4SAM::tag.

77  {
78  return collector_.mayConsume<T, BT>(tag);
79  }
ProductToken< T > mayConsume(InputTag const &)
ConsumesCollector collector_
Definition: ModuleBase.h:50
double T
Definition: Xdiff_gwt.C:5
template<typename T , BranchType BT>
void art::ModuleBase::mayConsumeMany ( )
protectedinherited

Definition at line 90 of file ModuleBase.h.

References art::ModuleBase::collector_, art::ConsumesCollector::mayConsumeMany(), and T.

91  {
93  }
ConsumesCollector collector_
Definition: ModuleBase.h:50
double T
Definition: Xdiff_gwt.C:5
template<typename Element , BranchType = InEvent>
ViewToken<Element> art::ModuleBase::mayConsumeView ( InputTag const &  )
protectedinherited
template<typename T , BranchType BT>
ViewToken<T> art::ModuleBase::mayConsumeView ( InputTag const &  tag)
inherited

Definition at line 83 of file ModuleBase.h.

References art::ModuleBase::collector_, art::ConsumesCollector::mayConsumeView(), T, and getGoodRuns4SAM::tag.

84  {
85  return collector_.mayConsumeView<T, BT>(tag);
86  }
ConsumesCollector collector_
Definition: ModuleBase.h:50
ViewToken< Element > mayConsumeView(InputTag const &)
double T
Definition: Xdiff_gwt.C:5
ModuleDescription const& art::ModuleBase::moduleDescription ( ) const
inherited
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 379 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().

379  {
380  std::vector<std::vector<int>> x_hits_plane(PX_max-PX_min+1,std::vector<int>(0));
381  std::vector<std::vector<int>> y_hits_plane(PY_max-PY_min+1,std::vector<int>(0));
382  for (unsigned i = 0; i != slice.NCell(); ++i) {
383  const art::Ptr<rb::CellHit> chit = slice.Cell(i);
384  int c = chit->Cell();
385  int p = chit->Plane();
386  if (chit->View()==geo::kX) {
387  x_hits_plane[p-PX_min].push_back(c);
388  }
389  else {
390  y_hits_plane[p-PY_min].push_back(c);
391  }
392  }
393  //following is to get unique number of cells hit per plane
394  std::vector<int> x_cells_plane(PX_max-PX_min+1,0);
395  std::vector<int> y_cells_plane(PY_max-PY_min+1,0);
396  for (size_t i=0;i!=x_hits_plane.size();i++){
397  std::sort(x_hits_plane[i].begin(),x_hits_plane[i].end());
398  std::vector<int>::iterator it;
399  it = std::unique (x_hits_plane[i].begin(),x_hits_plane[i].end());
400  x_hits_plane[i].resize(std::distance(x_hits_plane[i].begin(),it));
401  x_cells_plane[i]=x_hits_plane[i].size();
402  }
403  for (size_t i=0;i!=y_hits_plane.size();i++){
404  std::sort(y_hits_plane[i].begin(),y_hits_plane[i].end());
405  std::vector<int>::iterator it;
406  it = std::unique (y_hits_plane[i].begin(),y_hits_plane[i].end());
407  y_hits_plane[i].resize(std::distance(y_hits_plane[i].begin(),it));
408  y_cells_plane[i]=y_hits_plane[i].size();
409  }
410  //following is to get number of cells per track length in x view and y view
411  int sum_of_cells=0;
412  for (size_t i=0;i!=x_cells_plane.size();i++){
413  sum_of_cells+=x_cells_plane[i];
414  }
415  number_of_cells_per_length_xview=sum_of_cells/tracklength_of_xview;
416  sum_of_cells=0;
417  for (size_t i=0;i!=y_cells_plane.size();i++){
418  sum_of_cells+=y_cells_plane[i];
419  }
420  number_of_cells_per_length_yview=sum_of_cells/tracklength_of_yview;
421 }
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 470 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().

470  {
471  int max=std::min(PX_max,PY_max);
472  int min=std::max(PX_min,PY_min);
473  double number_hits_in_overlap_planes=0;
474  for (unsigned i = 0; i != slice.NCell(); ++i) {
475  const art::Ptr<rb::CellHit> chit = slice.Cell(i);
476  if(chit->Plane()<=max && chit->Plane()>=min) number_hits_in_overlap_planes++;
477  }
478  return number_hits_in_overlap_planes/slice.NCell();
479 }
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:66
void zcl::FmmTriggerEvd::produce ( art::Event evt)
virtual

Implements art::EDProducer.

Definition at line 111 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::DataViewImpl::put(), PX_max, PX_min, PY_max, PY_min, RMS(), art::DataViewImpl::run(), RunID, std::sqrt(), StdevCellsPerPlane(), art::DataViewImpl::subRun(), subRunID, rb::CellHit::TNS(), and rb::CellHit::View().

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

Definition at line 354 of file FmmTriggerEvd_module.cc.

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

Referenced by produce().

354  {
355  double rms = 0;
356  mean = 0;
357 
358  for (unsigned i = 0; i!= v.size(); ++i) {
359  mean += v[i];
360  }
361  mean /= double(v.size());
362  for (unsigned i = 0; i!= v.size(); ++i) {
363  rms += (v[i]-mean)*(v[i]-mean);
364  }
365  rms /= double(v.size());
366  rms = sqrt(rms);
367  return rms;
368 }
T sqrt(T number)
Definition: d0nt_math.hpp:156
void art::ModuleBase::setModuleDescription ( ModuleDescription const &  )
inherited
void art::ModuleBase::sortConsumables ( std::string const &  current_process_name)
inherited
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 422 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().

422  {
423  //fluctuation of number of cells of each plane check by Enhao
424  //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
425  std::vector<std::vector<int>> x_hits_plane(PX_max-PX_min+1,std::vector<int>(0));
426  std::vector<std::vector<int>> y_hits_plane(PY_max-PY_min+1,std::vector<int>(0));
427  for (unsigned i = 0; i != slice.NCell(); ++i) {
428  const art::Ptr<rb::CellHit> chit = slice.Cell(i);
429  int c = chit->Cell();
430  int p = chit->Plane();
431  if (chit->View()==geo::kX) {
432  x_hits_plane[p-PX_min].push_back(c);
433  }
434  else {
435  y_hits_plane[p-PY_min].push_back(c);
436  }
437  }
438  double sum =0;
439  double mean = 0;
440  double sq_sum = 0;
441  double stdev = 0;
442  //following is to get unique number of cells hit per plane
443  std::vector<int> x_cells_plane(PX_max-PX_min+1,0);
444  std::vector<int> y_cells_plane(PY_max-PY_min+1,0);
445  for (size_t i=0;i!=x_hits_plane.size();i++){
446  std::sort(x_hits_plane[i].begin(),x_hits_plane[i].end());
447  std::vector<int>::iterator it;
448  it = std::unique (x_hits_plane[i].begin(),x_hits_plane[i].end());
449  x_hits_plane[i].resize(std::distance(x_hits_plane[i].begin(),it));
450  x_cells_plane[i]=x_hits_plane[i].size();
451  }
452  for (size_t i=0;i!=y_hits_plane.size();i++){
453  std::sort(y_hits_plane[i].begin(),y_hits_plane[i].end());
454  std::vector<int>::iterator it;
455  it = std::unique (y_hits_plane[i].begin(),y_hits_plane[i].end());
456  y_hits_plane[i].resize(std::distance(y_hits_plane[i].begin(),it));
457  y_cells_plane[i]=y_hits_plane[i].size();
458  }
459  sum = std::accumulate(x_cells_plane.begin(),x_cells_plane.end(),0.0);
460  mean = sum / x_cells_plane.size();
461  sq_sum = std::inner_product(x_cells_plane.begin(),x_cells_plane.end(),x_cells_plane.begin(),0.0);
462  stdev = std::sqrt(sq_sum / x_cells_plane.size()-mean * mean);
463  stdev_cells_per_plane_xview=stdev/mean;
464  sum = std::accumulate(y_cells_plane.begin(),y_cells_plane.end(),0.0);
465  mean = sum / y_cells_plane.size();
466  sq_sum = std::inner_product(y_cells_plane.begin(),y_cells_plane.end(),y_cells_plane.begin(),0.0);
467  stdev = std::sqrt(sq_sum / y_cells_plane.size()-mean * mean);
468  stdev_cells_per_plane_yview=stdev/mean;
469 }
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
std::string art::EDProducer::workerType ( ) const
inherited

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: