Public Types | Public Member Functions | Protected Member Functions | Private Attributes | List of all members
ddt::SlicerEva Class Reference
Inheritance diagram for ddt::SlicerEva:
art::EDAnalyzer art::detail::Analyzer art::detail::LegacyModule art::Observer art::ModuleBase

Public Types

using WorkerType = WorkerT< EDAnalyzer >
 
using ModuleType = EDAnalyzer
 

Public Member Functions

 SlicerEva (fhicl::ParameterSet const &pset)
 
virtual ~SlicerEva ()
 
void analyze (const art::Event &evt)
 
void beginJob ()
 
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)
 
void registerProducts (ProductDescriptions &, ModuleDescription const &)
 
void fillDescriptions (ModuleDescription const &)
 
std::string const & processName () const
 
bool wantAllEvents () const
 
bool wantEvent (Event const &e)
 
fhicl::ParameterSetID selectorConfig () const
 
Handle< TriggerResults > getTriggerResults (Event const &e) const
 
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

detail::ProcessAndEventSelectors & processAndEventSelectors ()
 
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 Attributes

std::string _slicelabel
 
std::string _sliceinstance
 
int _ADCthr
 
int _xMin
 
int _xMax
 
int _yMin
 
int _yMax
 
int _zMin
 
int _zMax
 
int _deltx
 
int _delty
 
int _deltz
 
TTree * _slicetree
 
float ADC_mean
 
unsigned long long TDC_min
 
unsigned long long TDC_max
 
int X_min
 
int X_max
 
int Y_min
 
int Y_max
 
int P_min
 
int P_max
 
int N_hits
 
int N_sh
 
bool PassThrough
 
bool contain
 
bool wayoff
 
bool isMon
 
int eventID
 
double beta
 

Detailed Description

Definition at line 51 of file SlicerEva_module.cc.

Member Typedef Documentation

Definition at line 25 of file EDAnalyzer.h.

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

Definition at line 24 of file EDAnalyzer.h.

Constructor & Destructor Documentation

ddt::SlicerEva::SlicerEva ( fhicl::ParameterSet const &  pset)
explicit

Definition at line 90 of file SlicerEva_module.cc.

91  : EDAnalyzer(p),
92  _slicelabel(p.get<std::string>("slice_label")),
93  _sliceinstance(p.get<std::string>("slice_instance")),
94  _ADCthr(p.get<float>("ADC_thr")),
95  _xMin(p.get<float>("x_min")),
96  _xMax(p.get<float>("x_max")),
97  _yMin(p.get<float>("y_min")),
98  _yMax(p.get<float>("y_max")),
99  _deltx(p.get<float>("x_delt")),
100  _delty(p.get<float>("y_delt"))
101 {
102 }
const char * p
Definition: xmltok.h:285
EDAnalyzer(fhicl::ParameterSet const &pset)
Definition: EDAnalyzer.h:27
std::string _sliceinstance
std::string _slicelabel
enum BeamMode string
ddt::SlicerEva::~SlicerEva ( )
virtual

Definition at line 105 of file SlicerEva_module.cc.

105 {}

Member Function Documentation

void ddt::SlicerEva::analyze ( const art::Event evt)

Definition at line 133 of file SlicerEva_module.cc.

References _ADCthr, _deltx, _delty, _deltz, _sliceinstance, _slicelabel, _slicetree, _xMax, _xMin, _yMax, _yMin, _zMax, _zMin, ADC_mean, sim::ParticleNavigator::begin(), beta, contain, DEFINE_ART_MODULE(), sim::ParticleNavigator::end(), art::EventID::event(), eventID, Fill(), art::DataViewImpl::getByLabel(), make_syst_table_plots::h, hits(), MECModelEnuComparisons::i, art::Event::id(), isMon, N_hits, N_sh, simb::MCParticle::P(), P_max, P_min, cheat::BackTracker::ParticleNavigator(), cheat::BackTracker::ParticleToFLSHit(), PassThrough, simb::MCParticle::PdgCode(), std::sqrt(), TDC_max, TDC_min, simb::MCParticle::TrackId(), wayoff, X_max, X_min, daqchannelmap::X_VIEW, Y_max, and Y_min.

134 {
135  // contain = false;
136  //Get Truth Info: veto this event if no fast monopole
138  const sim::ParticleNavigator& pnav = bt->ParticleNavigator();
139  double t0_MC = 0, t1_MC;
140  bool mon_found = false;
141  std::vector<int> plane_th,cell_th;
142  std::vector<double> time_th;
143 
144  float e_dep = 0;
145 
146  for (sim::ParticleNavigator::const_iterator i = pnav.begin(); i != pnav.end(); ++i){
147  const sim::Particle *p = (*i).second;
148  if (p->PdgCode() == 42) {
149  beta = sqrt((p->P())*(p->P())/((p->P())*(p->P())+ 1.e32) );
150  // if (beta<0.01) return;
151  const std::vector<sim::FLSHit>& flshits = bt->ParticleToFLSHit(p->TrackId());
152  if (flshits.empty()) return;
153  int nFLShits = flshits.size();
154  int starth=0;
155  for (int i =0; i!=nFLShits; ++i) {
156  if (flshits[i].GetPDG()==42) {
157  t0_MC = flshits[i].GetExitT();
158  t1_MC = flshits[i].GetEntryT();
159  starth=i+1;
160  e_dep += flshits[i].GetEdep();
161  plane_th.push_back(flshits[i].GetPlaneID());
162  cell_th.push_back(flshits[i].GetCellID());
163  time_th.push_back(t1_MC);
164 
165  break;
166  }
167 
168  if (starth==nFLShits || starth) return;
169  }
170  for (int h =starth; h!= nFLShits; ++h) {
171  if (flshits[h].GetPDG()!=42) continue;
172  plane_th.push_back(flshits[h].GetPlaneID());
173  cell_th.push_back(flshits[h].GetCellID());
174  time_th.push_back(flshits[h].GetEntryT());
175  e_dep += flshits[h].GetEdep();
176  if (flshits[h].GetExitT()<t0_MC) t0_MC = flshits[h].GetExitT();
177  else if (flshits[h].GetEntryT()>t1_MC) t1_MC = flshits[h].GetEntryT();
178  }
179  }
180  }
181  t0_MC /= 15.625;
182  t1_MC /= 15.625;
183 
184  eventID = e.id().event();
185 
186  //Get the Slice Info:
188  e.getByLabel(_slicelabel, _sliceinstance, slices);
189  int n_found =0;
190 
191  for (unsigned i = 0; i!= slices->size(); ++i) {
192  isMon = false;
193  novaddt::HitList const &hits = slices->at(i);
194  TDC_min = hits.begin()->TDC().val;
195  TDC_max = TDC_min;
196  P_min = 9999;
197  P_max = -99;
198  X_min = 9999;
199  X_max = -99;
200  Y_min = 9999;
201  Y_max = -99;
202 
203  int ADC_sum = 0;
204  N_hits = hits.size();
205  N_sh = 0;
206 
207  for (auto const hit: hits) {
208  if (TDC_min > hit.TDC().val ) TDC_min = hit.TDC().val;
209  if (TDC_max < hit.TDC().val ) TDC_max = hit.TDC().val;
210  if (P_min > hit.Plane().val) P_min = hit.Plane().val;
211  if (P_max < hit.Plane().val) P_max = hit.Plane().val;
212  if (hit.View().val == daqchannelmap::X_VIEW) {
213  if (X_max < hit.Cell().val) X_max = hit.Cell().val;
214  if (X_min > hit.Cell().val) X_min = hit.Cell().val;
215  }
216  else {
217  if (Y_max < hit.Cell().val) Y_max = hit.Cell().val;
218  if (Y_min > hit.Cell().val) Y_min = hit.Cell().val;
219  }
220 
221  if (hit.ADC().val > _ADCthr) ++N_sh;
222  ADC_sum += hit.ADC().val;
223 
224  if (!mon_found) {
225  for (unsigned hit_th =0 ; hit_th!= plane_th.size(); ++hit_th) {
226  if (hit.Plane().val==plane_th[hit_th] && hit.Cell().val==cell_th[hit_th]) {
227  if (hit.TDC().val< time_th[hit_th]/15.625+500 && hit.TDC().val> time_th[hit_th]/15.625-500)
228  ++n_found;
229  }
230  }
231  if (n_found>0.9*plane_th.size()) {
232  mon_found = true;
233  isMon = true;
234  }
235  }
236  }
237  ADC_mean = ADC_sum/(N_hits+0.);
238  //Decide whether this is contained:
239  if (TDC_min < t0_MC+100 && TDC_max > t1_MC-100) {
240  contain = true;
241  wayoff = false;
242  }
243  else contain = false;
244  if (TDC_min>t1_MC+100) wayoff = true;
245  else wayoff= false;
246  int number =0;
247  if (X_min<_xMin+_deltx) ++number;
248  if (X_max>_xMax-_deltx) ++number;
249  if (Y_min<_yMin+_delty) ++number;
250  if (Y_max>_yMax-_delty) ++number;
251  if (P_min<_zMin+_deltz) ++number;
252  if (P_max>_zMax-_deltz) ++number;
253 
254  if (number>1) PassThrough = true;
255  else PassThrough = false;
256  _slicetree -> Fill();
257  }
258 
259  /*
260  //Here we are implementing some debugging out put file:
261  std::ofstream ofs;
262  ofs.open ("missingMM.dat", std::ofstream::out | std::ofstream::app);
263 
264  if (!mon_found) ofs << plane_th.size() <<" "<<beta<<" "<<e_dep<<std::endl;
265  */
266 
267  return;
268 }
int PdgCode() const
Definition: MCParticle.h:211
const sim::ParticleNavigator & ParticleNavigator() const
Get a reference to the ParticleNavigator.
Definition: BackTracker.h:748
std::vector< DAQHit > HitList
Definition: HitList.h:15
const char * p
Definition: xmltok.h:285
T sqrt(T number)
Definition: d0nt_math.hpp:156
std::vector< sim::FLSHit > ParticleToFLSHit(const int &trackID) const
All the FLSHits that were created by the track id trackID, sorted from most to least light...
list_type::const_iterator const_iterator
int TrackId() const
Definition: MCParticle.h:209
unsigned long long TDC_max
unsigned long long TDC_min
void hits()
Definition: readHits.C:15
std::string _sliceinstance
correl_yv Fill(-(dy[iP-1][iC-1]), hyv->GetBinContent(iP, iC))
double P(const int i=0) const
Definition: MCParticle.h:233
Identifier for the X measuring view of the detector (top)
Definition: structs.h:12
std::string _slicelabel
Float_t e
Definition: plot.C:35
void ddt::SlicerEva::beginJob ( )
virtual

Reimplemented from art::EDAnalyzer.

Definition at line 109 of file SlicerEva_module.cc.

References _slicetree, ADC_mean, beta, contain, eventID, isMon, N_hits, N_sh, P_max, P_min, PassThrough, TDC_max, TDC_min, wayoff, X_max, X_min, Y_max, and Y_min.

110 {
112  _slicetree = tfs->make<TTree>("slicetree","hit information");
113  _slicetree -> Branch("ADC_mean",&ADC_mean,"ADC_mean/F");
114  _slicetree -> Branch("TDC_min",&TDC_min,"TDC_min/l");
115  _slicetree -> Branch("TDC_max",&TDC_max,"TDC_max/l");
116  _slicetree -> Branch("isMon", &isMon, "isMon/O");
117  _slicetree -> Branch("X_min",&X_min,"X_min/I");
118  _slicetree -> Branch("X_max",&X_max,"X_max/I");
119  _slicetree -> Branch("Y_min",&Y_min,"Y_min/I");
120  _slicetree -> Branch("Y_max",&Y_max,"Y_max/I");
121  _slicetree -> Branch("P_min",&P_min,"P_min/I");
122  _slicetree -> Branch("P_max",&P_max,"P_max/I");
123  _slicetree -> Branch("N_hits",&N_hits,"N_hits/I"); //Number of hits in the slice
124  _slicetree -> Branch("N_sh",&N_sh,"N_sh/I");
125  _slicetree -> Branch("though",&PassThrough,"through/O");
126  _slicetree -> Branch("Event",&eventID,"Event/I");
127  _slicetree -> Branch("beta",&beta,"beta/D");
128  _slicetree -> Branch("contain",&contain,"contain/O");
129  _slicetree -> Branch("wayoff",&wayoff,"wayoff/O");
130  return;
131 }
unsigned long long TDC_max
unsigned long long TDC_min
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::Analyzer::doBeginJob ( )
inherited
bool art::detail::Analyzer::doBeginRun ( RunPrincipal rp,
ModuleContext const &  mc 
)
inherited
bool art::detail::Analyzer::doBeginSubRun ( SubRunPrincipal srp,
ModuleContext const &  mc 
)
inherited
void art::detail::Analyzer::doEndJob ( )
inherited
bool art::detail::Analyzer::doEndRun ( RunPrincipal rp,
ModuleContext const &  mc 
)
inherited
bool art::detail::Analyzer::doEndSubRun ( SubRunPrincipal srp,
ModuleContext const &  mc 
)
inherited
bool art::detail::Analyzer::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::Analyzer::doRespondToCloseInputFile ( FileBlock const &  fb)
inherited
void art::detail::Analyzer::doRespondToCloseOutputFiles ( FileBlock const &  fb)
inherited
void art::detail::Analyzer::doRespondToOpenInputFile ( FileBlock const &  fb)
inherited
void art::detail::Analyzer::doRespondToOpenOutputFiles ( FileBlock const &  fb)
inherited
void art::Observer::fillDescriptions ( ModuleDescription const &  )
inherited
std::array<std::vector<ProductInfo>, NumBranchTypes> const& art::ModuleBase::getConsumables ( ) const
inherited
Handle<TriggerResults> art::Observer::getTriggerResults ( Event const &  e) const
inherited
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
detail::ProcessAndEventSelectors& art::Observer::processAndEventSelectors ( )
protectedinherited
std::string const& art::Observer::processName ( ) const
inherited
void art::Observer::registerProducts ( ProductDescriptions ,
ModuleDescription const &   
)
inherited
fhicl::ParameterSetID art::Observer::selectorConfig ( ) const
inherited
void art::ModuleBase::setModuleDescription ( ModuleDescription const &  )
inherited
void art::ModuleBase::sortConsumables ( std::string const &  current_process_name)
inherited
bool art::Observer::wantAllEvents ( ) const
inherited
bool art::Observer::wantEvent ( Event const &  e)
inherited
std::string art::EDAnalyzer::workerType ( ) const
inherited

Member Data Documentation

int ddt::SlicerEva::_ADCthr
private

Definition at line 64 of file SlicerEva_module.cc.

Referenced by analyze().

int ddt::SlicerEva::_deltx
private

Definition at line 71 of file SlicerEva_module.cc.

Referenced by analyze().

int ddt::SlicerEva::_delty
private

Definition at line 72 of file SlicerEva_module.cc.

Referenced by analyze().

int ddt::SlicerEva::_deltz
private

Definition at line 73 of file SlicerEva_module.cc.

Referenced by analyze().

std::string ddt::SlicerEva::_sliceinstance
private

Definition at line 63 of file SlicerEva_module.cc.

Referenced by analyze().

std::string ddt::SlicerEva::_slicelabel
private

Definition at line 62 of file SlicerEva_module.cc.

Referenced by analyze().

TTree* ddt::SlicerEva::_slicetree
private

Definition at line 75 of file SlicerEva_module.cc.

Referenced by analyze(), and beginJob().

int ddt::SlicerEva::_xMax
private

Definition at line 66 of file SlicerEva_module.cc.

Referenced by analyze().

int ddt::SlicerEva::_xMin
private

Definition at line 65 of file SlicerEva_module.cc.

Referenced by analyze().

int ddt::SlicerEva::_yMax
private

Definition at line 68 of file SlicerEva_module.cc.

Referenced by analyze().

int ddt::SlicerEva::_yMin
private

Definition at line 67 of file SlicerEva_module.cc.

Referenced by analyze().

int ddt::SlicerEva::_zMax
private

Definition at line 70 of file SlicerEva_module.cc.

Referenced by analyze().

int ddt::SlicerEva::_zMin
private

Definition at line 69 of file SlicerEva_module.cc.

Referenced by analyze().

float ddt::SlicerEva::ADC_mean
private

Definition at line 77 of file SlicerEva_module.cc.

Referenced by analyze(), and beginJob().

double ddt::SlicerEva::beta
private

Definition at line 85 of file SlicerEva_module.cc.

Referenced by analyze(), and beginJob().

bool ddt::SlicerEva::contain
private

Definition at line 83 of file SlicerEva_module.cc.

Referenced by analyze(), and beginJob().

int ddt::SlicerEva::eventID
private

Definition at line 84 of file SlicerEva_module.cc.

Referenced by analyze(), and beginJob().

bool ddt::SlicerEva::isMon
private

Definition at line 83 of file SlicerEva_module.cc.

Referenced by analyze(), and beginJob().

int ddt::SlicerEva::N_hits
private

Definition at line 82 of file SlicerEva_module.cc.

Referenced by analyze(), and beginJob().

int ddt::SlicerEva::N_sh
private

Definition at line 82 of file SlicerEva_module.cc.

Referenced by analyze(), and beginJob().

int ddt::SlicerEva::P_max
private

Definition at line 81 of file SlicerEva_module.cc.

Referenced by analyze(), and beginJob().

int ddt::SlicerEva::P_min
private

Definition at line 81 of file SlicerEva_module.cc.

Referenced by analyze(), and beginJob().

bool ddt::SlicerEva::PassThrough
private

Definition at line 83 of file SlicerEva_module.cc.

Referenced by analyze(), and beginJob().

unsigned long long ddt::SlicerEva::TDC_max
private

Definition at line 78 of file SlicerEva_module.cc.

Referenced by analyze(), and beginJob().

unsigned long long ddt::SlicerEva::TDC_min
private

Definition at line 78 of file SlicerEva_module.cc.

Referenced by analyze(), and beginJob().

bool ddt::SlicerEva::wayoff
private

Definition at line 83 of file SlicerEva_module.cc.

Referenced by analyze(), and beginJob().

int ddt::SlicerEva::X_max
private

Definition at line 79 of file SlicerEva_module.cc.

Referenced by analyze(), and beginJob().

int ddt::SlicerEva::X_min
private

Definition at line 79 of file SlicerEva_module.cc.

Referenced by analyze(), and beginJob().

int ddt::SlicerEva::Y_max
private

Definition at line 80 of file SlicerEva_module.cc.

Referenced by analyze(), and beginJob().

int ddt::SlicerEva::Y_min
private

Definition at line 80 of file SlicerEva_module.cc.

Referenced by analyze(), and beginJob().


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