Public Types | Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | List of all members
calib::RockMuonStopperSelection Class Reference

Selects stopping cosmics. More...

Inheritance diagram for calib::RockMuonStopperSelection:
art::EDFilter art::detail::Filter art::detail::LegacyModule art::Modifier art::ModuleBase art::ProductRegistryHelper

Public Types

using ModuleType = EDFilter
 
using WorkerType = WorkerT< EDFilter >
 
template<typename UserConfig >
using Table = Modifier::Table< UserConfig >
 

Public Member Functions

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

Static Public Attributes

static constexpr bool Pass {true}
 
static constexpr bool Fail {false}
 

Protected Member Functions

bool IsContainedStopper (const rb::Track *trk)
 
bool IsTrulyContainedStopper (const rb::Track *trk) const
 
bool IsTrulyInFiducial (const rb::Track *trk) const
 
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 ()
 

Protected Attributes

std::string fTrackLabel
 Where to find Tracks to reconstruct. More...
 
bool fApplyFilter
 
bool fVerbose
 
std::string fTracklabel
 
int fTable [2][2]
 
int fFidTable [2][2]
 
int x2Fiducial = 0
 
int z1Fiducial = 0
 
int z2Fiducial = 0
 
int y1Fiducial = 0
 
int y2Fiducial = 0
 
int cpL = 0
 
int ppL = 0
 
int earlyCells = 0
 
int numTot = 0
 

Detailed Description

Selects stopping cosmics.

Definition at line 26 of file RockMuonStopperSelection_module.cc.

Member Typedef Documentation

Definition at line 19 of file EDFilter.h.

template<typename UserConfig >
using art::detail::Filter::Table = Modifier::Table<UserConfig>
inherited

Definition at line 29 of file Filter.h.

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

Definition at line 20 of file EDFilter.h.

Constructor & Destructor Documentation

calib::RockMuonStopperSelection::RockMuonStopperSelection ( const fhicl::ParameterSet pset)
explicit

Definition at line 67 of file RockMuonStopperSelection_module.cc.

References fFidTable, fTable, MECModelEnuComparisons::i, calib::j, and reconfigure().

68  : EDFilter(pset)
69  {
70  produces< std::vector<rb::Track> >();
71  produces< art::Assns<rb::Track, rb::Cluster> >();
72 
73  reconfigure(pset);
74 
75  for(int i = 0; i < 2; ++i) for(int j = 0; j < 2; ++j) fTable[i][j] = 0;
76  for(int i = 0; i < 2; ++i) for(int j = 0; j < 2; ++j) fFidTable[i][j] = 0;
77 
78  }
const double j
Definition: BetheBloch.cxx:29
void reconfigure(const fhicl::ParameterSet &pset)
EDFilter(fhicl::ParameterSet const &pset)
Definition: EDFilter.h:22
calib::RockMuonStopperSelection::~RockMuonStopperSelection ( )

Definition at line 81 of file RockMuonStopperSelection_module.cc.

82  {
83  }

Member Function Documentation

void calib::RockMuonStopperSelection::beginJob ( )
virtual

Reimplemented from art::EDFilter.

Definition at line 95 of file RockMuonStopperSelection_module.cc.

96  {
97 
98  }
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::Filter::doBeginJob ( )
inherited
bool art::detail::Filter::doBeginRun ( RunPrincipal rp,
ModuleContext const &   
)
inherited
bool art::detail::Filter::doBeginSubRun ( SubRunPrincipal srp,
ModuleContext const &  mc 
)
inherited
void art::detail::Filter::doEndJob ( )
inherited
bool art::detail::Filter::doEndRun ( RunPrincipal rp,
ModuleContext const &  mc 
)
inherited
bool art::detail::Filter::doEndSubRun ( SubRunPrincipal srp,
ModuleContext const &  mc 
)
inherited
bool art::detail::Filter::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::Filter::doRespondToCloseInputFile ( FileBlock const &  fb)
inherited
void art::detail::Filter::doRespondToCloseOutputFiles ( FileBlock const &  fb)
inherited
void art::detail::Filter::doRespondToOpenInputFile ( FileBlock const &  fb)
inherited
void art::detail::Filter::doRespondToOpenOutputFiles ( FileBlock const &  fb)
inherited
void calib::RockMuonStopperSelection::endJob ( )
virtual

Reimplemented from art::EDFilter.

Definition at line 144 of file RockMuonStopperSelection_module.cc.

References om::cout, cpL, earlyCells, allTimeWatchdog::endl, fFidTable, fTable, IsContainedStopper(), numTot, ppL, x2Fiducial, y1Fiducial, y2Fiducial, and z2Fiducial.

145  {
146  std::cout << "There were "<<numTot<<" reasonable tracks in this file"<<std::endl;
147  std::cout << earlyCells << " (" << .1*(1000*earlyCells/numTot) << " %) did not have enough hits in the first 4 planes. " << (numTot - earlyCells) << " remain."<<std::endl;
148  std::cout << y1Fiducial << " (" << .1*(1000*y1Fiducial/numTot) << " %) failed the y1 fiducial cut. " << (numTot - earlyCells - y1Fiducial) << " remain."<<std::endl;
149  std::cout << z2Fiducial << " (" << .1*(1000*z2Fiducial/numTot) << " %) failed the z2 fiducial cut. " << (numTot - earlyCells - y1Fiducial - z2Fiducial) << " remain."<<std::endl;
150  std::cout << x2Fiducial << " (" << .1*(1000*x2Fiducial/numTot) << " %) failed the x2 fiducial cut. " << (numTot - earlyCells - y1Fiducial - z2Fiducial - x2Fiducial) << " remain."<<std::endl;
151  std::cout << y2Fiducial << " (" << .1*(1000*y2Fiducial/numTot) << " %) failed the y2 fiducial cut. " << (numTot - earlyCells - y1Fiducial - z2Fiducial - x2Fiducial - y2Fiducial) << " remain."<<std::endl;
152  std::cout << (ppL + cpL) << " (" << .1*(1000*(ppL+cpL)/numTot) << " %) failed the y2 fiducial cut. " << (numTot - earlyCells - y1Fiducial - z2Fiducial - x2Fiducial - y2Fiducial - ppL - cpL) << " remain."<<std::endl;
153 
154  if(fTable[0][0]+fTable[1][0] == 0 || fTable[0][1]+fTable[1][1] == 0) return;
155  std::cout << "Stopper efficiency table. x-axis selection, y-axis truth:" << std::endl;
156  std::cout << fTable[0][0] << "\t" << fTable[1][0] << "\t" << .1*(1000*fTable[0][0]/(fTable[0][0]+fTable[1][0])) << "%" << std::endl;
157  std::cout << fTable[0][1] << "\t" << fTable[1][1] << "\t" << .1*(1000*fTable[1][1]/(fTable[0][1]+fTable[1][1])) << "%" << std::endl;
158  std::cout << .1*(1000*fTable[0][0]/(fTable[0][0]+fTable[0][1])) << "%\t" << .1*(1000*fTable[1][1]/(fTable[1][0]+fTable[1][1])) << "%" << std::endl;
159  std::cout << "Purity = " << .1*(1000*fTable[1][1]/(fTable[1][0]+fTable[1][1])) << "%" << std::endl;
160  std::cout << "Efficiency = " << .1*(1000*fTable[1][1]/(fTable[0][1]+fTable[1][1])) << "%" << std::endl;
161 
162  if(fFidTable[0][0]+fFidTable[1][0] == 0 || fFidTable[0][1]+fFidTable[1][1] == 0) return;
163  std::cout << "Stopper efficiency table (considering tracks stopping in the fiducial volume). x-axis selection, y-axis truth:" << std::endl;
164  std::cout << fFidTable[0][0] << "\t" << fFidTable[1][0] << "\t" << .1*(1000*fFidTable[0][0]/(fFidTable[0][0]+fFidTable[1][0])) << "%" << std::endl;
165  std::cout << fFidTable[0][1] << "\t" << fFidTable[1][1] << "\t" << .1*(1000*fFidTable[1][1]/(fFidTable[0][1]+fFidTable[1][1])) << "%" << std::endl;
166  std::cout << .1*(1000*fFidTable[0][0]/(fFidTable[0][0]+fFidTable[0][1])) << "%\t" << .1*(1000*fFidTable[1][1]/(fFidTable[1][0]+fFidTable[1][1])) << "%" << std::endl;
167  std::cout << "Purity = " << .1*(1000*fFidTable[1][1]/(fFidTable[1][0]+fFidTable[1][1])) << "%" << std::endl;
168  std::cout << "Efficiency = " << .1*(1000*fFidTable[1][1]/(fFidTable[0][1]+fFidTable[1][1])) << "%" << std::endl;
169 
170  }
OStream cout
Definition: OStream.cxx:6
bool calib::RockMuonStopperSelection::filter ( art::Event evt)
virtual

Implements art::EDFilter.

Definition at line 101 of file RockMuonStopperSelection_module.cc.

References ana::assert(), om::cout, util::CreateAssn(), allTimeWatchdog::endl, art::DataViewImpl::event(), fApplyFilter, fFidTable, fTable, fTrackLabel, fVerbose, art::DataViewImpl::getByLabel(), IsContainedStopper(), art::DataViewImpl::isRealData(), IsTrulyContainedStopper(), IsTrulyInFiducial(), art::DataViewImpl::put(), and runNovaSAM::ret.

102  {
103 
104  std::unique_ptr<std::vector<rb::Track> > outTracks(new std::vector<rb::Track>);
105  std::unique_ptr<art::Assns<rb::Track, rb::Cluster> > assns(new art::Assns<rb::Track, rb::Cluster>);
107 
108  evt.getByLabel(fTrackLabel, tracks);
109  art::FindManyP<rb::Cluster> fmpslc(tracks, evt, fTrackLabel);
110 
111 
112  for(size_t trIdx = 0; trIdx < tracks->size(); ++trIdx){
113  const rb::Track* trk = &(tracks->at(trIdx));
114 
115  if (fVerbose) std::cout<<"In event "<<evt.event()<<":"<<std::endl;
116  const bool stopper = IsContainedStopper(trk);
117 
118  if(stopper){
119  outTracks->push_back(*trk);
120 
121  // Find the slice the original track was associated to
122  const std::vector<art::Ptr<rb::Cluster> > slices = fmpslc.at(trIdx);
123  assert(slices.size() == 1);
124  util::CreateAssn(evt, *outTracks, slices[0], *assns);
125  }
126 
127 
128  if(!evt.isRealData()){
129  //printf("This is Montecarlo \n");
130  const bool trueStopper = IsTrulyContainedStopper(trk);
131  const bool inFidStopper = IsTrulyInFiducial(trk);
132  ++fTable[stopper][trueStopper];
133  ++fFidTable[stopper][inFidStopper];
134  }
135  } // end for meIdx
136 
137  const bool ret = !outTracks->empty();
138  evt.put(std::move(outTracks));
139  evt.put(std::move(assns));
140  if(fApplyFilter) return ret; else return true;
141  }
static bool CreateAssn(art::EDProducer const &prod, art::Event &evt, std::vector< T > &a, art::Ptr< U > b, art::Assns< T, U > &assn, size_t indx=UINT_MAX, std::string const &instance=std::string())
Create a 1 to 1 association between a new product and one already in the event.
EventNumber_t event() const
bool IsTrulyInFiducial(const rb::Track *trk) const
A rb::Prong with full reconstructed trajectory.
Definition: Track.h:20
Track finder for cosmic rays.
bool isRealData() const
bool getByLabel(std::string const &label, std::string const &instance, Handle< PROD > &result) const
Definition: DataViewImpl.h:446
OStream cout
Definition: OStream.cxx:6
bool IsTrulyContainedStopper(const rb::Track *trk) const
assert(nhit_max >=nhit_nbins)
ProductID put(std::unique_ptr< PROD > &&edp, FullSemantic< Level::Run > const semantic)
Definition: DataViewImpl.h:730
std::string fTrackLabel
Where to find Tracks to reconstruct.
std::array<std::vector<ProductInfo>, NumBranchTypes> const& art::ModuleBase::getConsumables ( ) const
inherited
bool calib::RockMuonStopperSelection::IsContainedStopper ( const rb::Track trk)
protected

Definition at line 174 of file RockMuonStopperSelection_module.cc.

References ana::assert(), rb::Cluster::Cell(), om::cout, cpL, geo::GeometryBase::DetHalfHeight(), geo::GeometryBase::DetHalfWidth(), geo::GeometryBase::DetId(), geo::GeometryBase::DetLength(), earlyCells, allTimeWatchdog::endl, fVerbose, geom(), MECModelEnuComparisons::i, IsTrulyContainedStopper(), novadaq::cnv::kFARDET, novadaq::cnv::kNDOS, novadaq::cnv::kNEARDET, rb::Cluster::NCell(), geo::GeometryBase::NPlanes(), numTot, rb::CellHit::Plane(), ppL, rb::Prong::Start(), rb::Track::Stop(), rb::Track::TotalLength(), submit_syst::x2, x2Fiducial, y1, y1Fiducial, submit_syst::y2, y2Fiducial, and z2Fiducial.

Referenced by endJob(), and filter().

175  {
176  // Start and end don't mean much, pick whichever is lowest in y.
177  const TVector3 v1 = trk->Start();
178  const TVector3 v2 = trk->Stop();
179  const TVector3 stop = (v1.Y() < v2.Y()) ? v1 : v2;
180 
181  //const double x1 = v1.X();
182  const double y1 = v1.Y();
183  const double z1 = v1.Z();
184  const double x2 = v2.X();
185  const double y2 = v2.Y();
186  const double z2 = v2.Z();
187 
188  const double len = trk->TotalLength();
189 
191 
192  int hitsperplane [geom->NPlanes()];
193  for (unsigned int k=0; k<geom->NPlanes(); k++) hitsperplane[k]=0;
194 
195  for(size_t i = 0; i < trk->NCell(); ++i){
196  art::Ptr<rb::CellHit> chit = trk->Cell(i);
197  hitsperplane[chit->Plane()]++;
198  }
199 
200  double planesperlength = 0;
201  int earlyhits = 0;
202 
203  for (unsigned int k=0; k<geom->NPlanes(); k++) if(hitsperplane[k]!=0) {
204  planesperlength += 1/len;
205  if (k<4) earlyhits ++;
206  }
207  double cellsperlength = trk->NCell() / len;
208 
209 
210  switch(geom->DetId()){
211  case novadaq::cnv::kNDOS:
212  // Fall through
214  if(len<225) {
215  if(fVerbose) std::cout<<"Track rejected (Track too short)"<<std::endl;
216  return false;
217  }
218  if(z1 > 25) {
219  if(fVerbose) std::cout<<"Track rejected (did not start in the first 25 cm of the detector)"<<std::endl;
220  return false;
221  }
222  numTot++;
223  if(earlyhits<3) {
224  if(fVerbose) std::cout<<"Track rejected (Two or less of the first 4 planes were hit)"<<std::endl;
225  earlyCells++;
226  return false;
227  }
228  if(y1 > geom->DetHalfHeight() - 30) {
229  if(fVerbose) std::cout<<"Track rejected (Ystart Fiducial)"<<std::endl;
230  y1Fiducial++;
231  return false;
232  }
233  if( (z2 < 25) || (z2 > 1250) ) {
234  if(fVerbose) std::cout<<"Track rejected (Zend Fiducial)"<<std::endl;
235  z2Fiducial++;
236  return false;
237  }
238  if(fabs(x2) > geom->DetHalfWidth() - 20) {
239  if(fVerbose) std::cout<<"Track rejected (Xend Fiducial)"<<std::endl;
240  x2Fiducial++;
241  return false; // Fiducial X
242  }
243  if(y2 < -geom->DetHalfHeight() + 30) {
244  if(fVerbose) std::cout<<"Track rejected (Yend Fiducial)"<<std::endl;
245  y2Fiducial++;
246  return false; // Fiducial Y
247  }
248 
249  if( (planesperlength < 0.12) || (planesperlength > 0.16) ) {
250  if(fVerbose) std::cout<<"Track rejected (Planes per unit length is "<<planesperlength<<")"<<std::endl;
251  ppL++;
252  return false;
253  }
254  if( (cellsperlength < 0.12) || (cellsperlength > 0.2) ) {
255  if(fVerbose) std::cout<<"Track rejected (Cells per unit length is "<<cellsperlength<<" )"<<std::endl;
256  cpL++;
257  return false;
258  }
259 
260  if(fVerbose) std::cout<<"Track passed cut"<<std::endl;
261  break;
262 
263  //the script allows the user to run it on the far detector
264  //however, users should be wary that these cuts were not tested on any FarDet data at all, and just mimick the neardet ones.
265  //furthermore, we expect close to no rock event to be present in FarDet at all.
267  if(len<225) {
268  if(fVerbose) std::cout<<"Track rejected (Track too short)"<<std::endl;
269  return false;
270  }
271  if(z1 > 25) {
272  if(fVerbose) std::cout<<"Track rejected (did not start in the first 25 cm of the detector)"<<std::endl;
273  return false;
274  }
275  numTot++;
276  if(earlyhits<3) {
277  if(fVerbose) std::cout<<"Track rejected (Two or less of the first 4 planes were hit)"<<std::endl;
278  earlyCells++;
279  return false;
280  }
281  if(y1 > geom->DetHalfHeight() - 30) {
282  if(fVerbose) std::cout<<"Track rejected (Ystart Fiducial)"<<std::endl;
283  y1Fiducial++;
284  return false;
285  }
286  if( (z2 < 25) || (z2 > geom->DetLength() - 25 ) ) {
287  if(fVerbose) std::cout<<"Track rejected (Zend Fiducial)"<<std::endl;
288  z2Fiducial++;
289  return false;
290  }
291  if(fabs(x2) > geom->DetHalfWidth() - 20) {
292  if(fVerbose) std::cout<<"Track rejected (Xend Fiducial)"<<std::endl;
293  x2Fiducial++;
294  return false; // Fiducial X
295  }
296  if(y2 < -geom->DetHalfHeight() + 30) {
297  if(fVerbose) std::cout<<"Track rejected (Yend Fiducial)"<<std::endl;
298  y2Fiducial++;
299  return false; // Fiducial Y
300  }
301 
302  if( (planesperlength < 0.12) || (planesperlength > 0.16) ) {
303  if(fVerbose) std::cout<<"Track rejected (Planes per unit length is "<<planesperlength<<")"<<std::endl;
304  ppL++;
305  return false;
306  }
307  if( (cellsperlength < 0.12) || (cellsperlength > 0.2) ) {
308  if(fVerbose) std::cout<<"Track rejected (Cells per unit length is "<<cellsperlength<<" )"<<std::endl;
309  cpL++;
310  return false;
311  }
312 
313  if(fVerbose) std::cout<<"Track passed cut"<<std::endl;
314  break;
315  default:
316  assert(0 && "Unknown detector");
317  }
318 
319  return true;
320  }
const XML_Char int len
Definition: expat.h:262
unsigned int NCell(geo::View_t view) const
Number of cells in view view.
Definition: Cluster.cxx:134
Float_t y1[n_points_granero]
Definition: compare.C:5
unsigned short Plane() const
Definition: CellHit.h:39
double DetLength() const
virtual TVector3 Start() const
Definition: Prong.h:73
virtual double TotalLength() const
Length (cm) of all the track segments.
Definition: Track.cxx:213
Far Detector at Ash River, MN.
Prototype Near Detector on the surface at FNAL.
novadaq::cnv::DetId DetId() const
Prefer ds::DetectorService::DetId() instead.
Definition: GeometryBase.h:243
Near Detector in the NuMI cavern.
double DetHalfHeight() const
OStream cout
Definition: OStream.cxx:6
art::Ptr< rb::CellHit > Cell(geo::View_t view, unsigned int viewIdx) const
Get the ith cell from view view.
Definition: Cluster.cxx:145
double DetHalfWidth() const
void geom(int which=0)
Definition: geom.C:163
assert(nhit_max >=nhit_nbins)
unsigned int NPlanes() const
TVector3 Stop() const
Position of the final trajectory point.
Definition: Track.cxx:186
bool calib::RockMuonStopperSelection::IsTrulyContainedStopper ( const rb::Track trk) const
protected

Definition at line 324 of file RockMuonStopperSelection_module.cc.

References abs(), rb::Cluster::AllCells(), geo::GeometryBase::DetHalfHeight(), geo::GeometryBase::DetHalfWidth(), geo::GeometryBase::DetLength(), simb::MCParticle::EndPosition(), geom(), cheat::BackTracker::HitsToParticle(), IsTrulyInFiducial(), part, submit_concat_project::parts, simb::MCParticle::PdgCode(), simb::MCParticle::Position(), and febshutoff_auto::start.

Referenced by filter(), and IsContainedStopper().

325  {
327 
328  std::vector<const sim::Particle*> parts = bt->HitsToParticle(trk->AllCells());
329  if(parts.empty()) return false;
330 
331  const sim::Particle* part = parts.front();
332 
333  const TVector3 stop = part->EndPosition().Vect();
334  const TVector3 start= part->Position().Vect();
336 
337  //x0 and y0 are the intercept of the start-stop trajectory with the front plane
338  //(i.e. the z=0 plane)
339 
340  double x0=(start.X()*stop.Z()-stop.X()*start.Z())/(stop.Z()-start.Z());
341  double y0=(start.Y()*stop.Z()-stop.Y()*start.Z())/(stop.Z()-start.Z());
342 
343  if(start.Z() > 0) return false;
344  if(fabs(x0) > geom->DetHalfWidth()) return false;
345  if(fabs(y0) > geom->DetHalfHeight()) return false;
346  if(fabs(stop.X()) > geom->DetHalfWidth()) return false;
347  if(fabs(stop.Y()) > geom->DetHalfHeight()) return false;
348  if(stop.Z() < 0) return false;
349  if(stop.Z() > geom->DetLength()) return false;
350  if(abs(part->PdgCode())!=13) return false;
351 
352  return true;
353  }
const TLorentzVector & Position(const int i=0) const
Definition: MCParticle.h:218
int PdgCode() const
Definition: MCParticle.h:211
const TLorentzVector & EndPosition() const
Definition: MCParticle.h:224
double DetLength() const
void abs(TH1 *hist)
art::PtrVector< rb::CellHit > AllCells() const
Get all cells from both views.
Definition: Cluster.cxx:180
TString part[npart]
Definition: Style.C:32
double DetHalfHeight() const
double DetHalfWidth() const
void geom(int which=0)
Definition: geom.C:163
std::vector< const sim::Particle * > HitsToParticle(const std::vector< const rb::CellHit * > &hits) const
Returns vector of sim::Particle objects contributing to the given collection of hits.
bool calib::RockMuonStopperSelection::IsTrulyInFiducial ( const rb::Track trk) const
protected

Definition at line 356 of file RockMuonStopperSelection_module.cc.

References abs(), rb::Cluster::AllCells(), DEFINE_ART_MODULE(), geo::GeometryBase::DetHalfHeight(), geo::GeometryBase::DetHalfWidth(), simb::MCParticle::EndPosition(), geom(), cheat::BackTracker::HitsToParticle(), part, submit_concat_project::parts, simb::MCParticle::PdgCode(), simb::MCParticle::Position(), and febshutoff_auto::start.

Referenced by filter(), and IsTrulyContainedStopper().

357  {
359 
360  std::vector<const sim::Particle*> parts = bt->HitsToParticle(trk->AllCells());
361  if(parts.empty()) return false;
362 
363  const sim::Particle* part = parts.front();
364 
365  const TVector3 stop = part->EndPosition().Vect();
366  const TVector3 start= part->Position().Vect();
368 
369  //x0 and y0 are the intercept of the start-stop trajectory with the front plane
370  //(i.e. the z=0 plane)
371 
372  double x0=(start.X()*stop.Z()-stop.X()*start.Z())/(stop.Z()-start.Z());
373  double y0=(start.Y()*stop.Z()-stop.Y()*start.Z())/(stop.Z()-start.Z());
374 
375  if(start.Z() > 25) return false;
376  if(fabs(x0) > geom->DetHalfWidth()) return false;
377  if(fabs(y0) > geom->DetHalfHeight()) return false;
378  if(fabs(stop.X()) > geom->DetHalfWidth()-20) return false;
379  if(fabs(stop.Y()-15) > geom->DetHalfHeight()-15) return false;
380  if(fabs(y0 + 15) > geom->DetHalfHeight()-15) return false;
381  if(stop.Z() < 0) return false;
382  if(stop.Z() > 1250) return false;
383  if(abs(part->PdgCode())!=13) return false;
384 
385  return true;
386  }
const TLorentzVector & Position(const int i=0) const
Definition: MCParticle.h:218
int PdgCode() const
Definition: MCParticle.h:211
const TLorentzVector & EndPosition() const
Definition: MCParticle.h:224
void abs(TH1 *hist)
art::PtrVector< rb::CellHit > AllCells() const
Get all cells from both views.
Definition: Cluster.cxx:180
TString part[npart]
Definition: Style.C:32
double DetHalfHeight() const
double DetHalfWidth() const
void geom(int which=0)
Definition: geom.C:163
std::vector< const sim::Particle * > HitsToParticle(const std::vector< const rb::CellHit * > &hits) const
Returns vector of sim::Particle objects contributing to the given collection of hits.
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 calib::RockMuonStopperSelection::reconfigure ( const fhicl::ParameterSet pset)

Definition at line 86 of file RockMuonStopperSelection_module.cc.

References fApplyFilter, fTrackLabel, fVerbose, fhicl::ParameterSet::get(), and string.

Referenced by RockMuonStopperSelection().

87  {
88  fApplyFilter = pset.get<bool>("ApplyFilter");
89  fTrackLabel = pset.get<std::string>("TrackLabel");
90  fVerbose = pset.get<bool>("Verbose");
91 
92  }
T get(std::string const &key) const
Definition: ParameterSet.h:231
std::string fTrackLabel
Where to find Tracks to reconstruct.
enum BeamMode string
void art::ModuleBase::setModuleDescription ( ModuleDescription const &  )
inherited
void art::ModuleBase::sortConsumables ( std::string const &  current_process_name)
inherited
std::string art::EDFilter::workerType ( ) const
inherited

Referenced by art::EDFilter::EDFilter().

Member Data Documentation

int calib::RockMuonStopperSelection::cpL = 0
protected

Definition at line 60 of file RockMuonStopperSelection_module.cc.

Referenced by endJob(), and IsContainedStopper().

int calib::RockMuonStopperSelection::earlyCells = 0
protected

Definition at line 62 of file RockMuonStopperSelection_module.cc.

Referenced by endJob(), and IsContainedStopper().

constexpr bool art::detail::Filter::Fail {false}
staticinherited

Definition at line 26 of file Filter.h.

Referenced by evgen::GENIEFilter::filter().

bool calib::RockMuonStopperSelection::fApplyFilter
protected

Definition at line 46 of file RockMuonStopperSelection_module.cc.

Referenced by filter(), and reconfigure().

int calib::RockMuonStopperSelection::fFidTable[2][2]
protected

Definition at line 53 of file RockMuonStopperSelection_module.cc.

Referenced by endJob(), filter(), and RockMuonStopperSelection().

int calib::RockMuonStopperSelection::fTable[2][2]
protected

Definition at line 52 of file RockMuonStopperSelection_module.cc.

Referenced by endJob(), filter(), and RockMuonStopperSelection().

std::string calib::RockMuonStopperSelection::fTrackLabel
protected

Where to find Tracks to reconstruct.

Definition at line 44 of file RockMuonStopperSelection_module.cc.

Referenced by filter(), and reconfigure().

std::string calib::RockMuonStopperSelection::fTracklabel
protected

Definition at line 50 of file RockMuonStopperSelection_module.cc.

bool calib::RockMuonStopperSelection::fVerbose
protected

Definition at line 48 of file RockMuonStopperSelection_module.cc.

Referenced by filter(), IsContainedStopper(), and reconfigure().

int calib::RockMuonStopperSelection::numTot = 0
protected

Definition at line 63 of file RockMuonStopperSelection_module.cc.

Referenced by endJob(), and IsContainedStopper().

constexpr bool art::detail::Filter::Pass {true}
staticinherited

Definition at line 25 of file Filter.h.

Referenced by evgen::GENIEFilter::filter().

int calib::RockMuonStopperSelection::ppL = 0
protected

Definition at line 61 of file RockMuonStopperSelection_module.cc.

Referenced by endJob(), and IsContainedStopper().

int calib::RockMuonStopperSelection::x2Fiducial = 0
protected

Definition at line 55 of file RockMuonStopperSelection_module.cc.

Referenced by endJob(), and IsContainedStopper().

int calib::RockMuonStopperSelection::y1Fiducial = 0
protected

Definition at line 58 of file RockMuonStopperSelection_module.cc.

Referenced by endJob(), and IsContainedStopper().

int calib::RockMuonStopperSelection::y2Fiducial = 0
protected

Definition at line 59 of file RockMuonStopperSelection_module.cc.

Referenced by endJob(), and IsContainedStopper().

int calib::RockMuonStopperSelection::z1Fiducial = 0
protected

Definition at line 56 of file RockMuonStopperSelection_module.cc.

int calib::RockMuonStopperSelection::z2Fiducial = 0
protected

Definition at line 57 of file RockMuonStopperSelection_module.cc.

Referenced by endJob(), and IsContainedStopper().


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