Public Types | Public Member Functions | Static 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::ProducerBase art::Consumer art::EngineCreator art::ProductRegistryHelper

Public Types

using ModuleType = EDFilter
 
using WorkerType = WorkerT< EDFilter >
 
template<typename UserConfig >
using Table = ProducerBase::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 ()
 
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 ()
 

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
 
CurrentProcessingContext const * currentContext () const
 
void validateConsumedProduct (BranchType const bt, ProductInfo const &pi)
 
void prepareForJob (fhicl::ParameterSet const &pset)
 
void showMissingConsumes () const
 

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

using art::EDFilter::ModuleType = EDFilter
inherited

Definition at line 37 of file EDFilter.h.

template<typename UserConfig >
using art::EDFilter::Table = ProducerBase::Table<UserConfig>
inherited

Definition at line 46 of file EDFilter.h.

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

Definition at line 38 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  {
69  produces< std::vector<rb::Track> >();
70  produces< art::Assns<rb::Track, rb::Cluster> >();
71 
72  reconfigure(pset);
73 
74  for(int i = 0; i < 2; ++i) for(int j = 0; j < 2; ++j) fTable[i][j] = 0;
75  for(int i = 0; i < 2; ++i) for(int j = 0; j < 2; ++j) fFidTable[i][j] = 0;
76 
77  }
const double j
Definition: BetheBloch.cxx:29
void reconfigure(const fhicl::ParameterSet &pset)
calib::RockMuonStopperSelection::~RockMuonStopperSelection ( )

Definition at line 80 of file RockMuonStopperSelection_module.cc.

81  {
82  }

Member Function Documentation

void calib::RockMuonStopperSelection::beginJob ( )
virtual

Reimplemented from art::EDFilter.

Definition at line 94 of file RockMuonStopperSelection_module.cc.

95  {
96 
97  }
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::EDFilter::currentContext ( ) const
protectedinherited
void calib::RockMuonStopperSelection::endJob ( )
virtual

Reimplemented from art::EDFilter.

Definition at line 143 of file RockMuonStopperSelection_module.cc.

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

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

Implements art::EDFilter.

Definition at line 100 of file RockMuonStopperSelection_module.cc.

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

101  {
102 
103  std::unique_ptr<std::vector<rb::Track> > outTracks(new std::vector<rb::Track>);
104  std::unique_ptr<art::Assns<rb::Track, rb::Cluster> > assns(new art::Assns<rb::Track, rb::Cluster>);
106 
107  evt.getByLabel(fTrackLabel, tracks);
108  art::FindManyP<rb::Cluster> fmpslc(tracks, evt, fTrackLabel);
109 
110 
111  for(size_t trIdx = 0; trIdx < tracks->size(); ++trIdx){
112  const rb::Track* trk = &(tracks->at(trIdx));
113 
114  if (fVerbose) std::cout<<"In event "<<evt.event()<<":"<<std::endl;
115  const bool stopper = IsContainedStopper(trk);
116 
117  if(stopper){
118  outTracks->push_back(*trk);
119 
120  // Find the slice the original track was associated to
121  const std::vector<art::Ptr<rb::Cluster> > slices = fmpslc.at(trIdx);
122  assert(slices.size() == 1);
123  util::CreateAssn(*this, evt, *outTracks, slices[0], *assns);
124  }
125 
126 
127  if(!evt.isRealData()){
128  //printf("This is Montecarlo \n");
129  const bool trueStopper = IsTrulyContainedStopper(trk);
130  const bool inFidStopper = IsTrulyInFiducial(trk);
131  ++fTable[stopper][trueStopper];
132  ++fFidTable[stopper][inFidStopper];
133  }
134  } // end for meIdx
135 
136  const bool ret = !outTracks->empty();
137  evt.put(std::move(outTracks));
138  evt.put(std::move(assns));
139  if(fApplyFilter) return ret; else return true;
140  }
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.
bool IsTrulyInFiducial(const rb::Track *trk) const
A rb::Prong with full reconstructed trajectory.
Definition: Track.h:20
bool isRealData() const
Definition: Event.h:83
ProductID put(std::unique_ptr< PROD > &&product)
Definition: Event.h:102
Track finder for cosmic rays.
EventNumber_t event() const
Definition: Event.h:67
OStream cout
Definition: OStream.cxx:6
bool getByLabel(std::string const &label, std::string const &productInstanceName, Handle< PROD > &result) const
Definition: DataViewImpl.h:344
bool IsTrulyContainedStopper(const rb::Track *trk) const
assert(nhit_max >=nhit_nbins)
std::string fTrackLabel
Where to find Tracks to reconstruct.
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::EDFilter::getProductID ( std::string const &  instanceName = {}) const
inlineinherited

Definition at line 131 of file EDFilter.h.

References art::EDFilter::moduleDescription_.

Referenced by novaddt::HoughTrackMaker::create_associations().

132  {
133  return ProducerBase::getProductID<PROD, B>(moduleDescription_,
134  instanceName);
135  }
ModuleDescription moduleDescription_
Definition: EDFilter.h:124
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 calib::RockMuonStopperSelection::IsContainedStopper ( const rb::Track trk)
protected

Definition at line 173 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, stan::math::fabs(), 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().

174  {
175  // Start and end don't mean much, pick whichever is lowest in y.
176  const TVector3 v1 = trk->Start();
177  const TVector3 v2 = trk->Stop();
178  const TVector3 stop = (v1.Y() < v2.Y()) ? v1 : v2;
179 
180  //const double x1 = v1.X();
181  const double y1 = v1.Y();
182  const double z1 = v1.Z();
183  const double x2 = v2.X();
184  const double y2 = v2.Y();
185  const double z2 = v2.Z();
186 
187  const double len = trk->TotalLength();
188 
190 
191  int hitsperplane [geom->NPlanes()];
192  for (unsigned int k=0; k<geom->NPlanes(); k++) hitsperplane[k]=0;
193 
194  for(size_t i = 0; i < trk->NCell(); ++i){
195  art::Ptr<rb::CellHit> chit = trk->Cell(i);
196  hitsperplane[chit->Plane()]++;
197  }
198 
199  double planesperlength = 0;
200  int earlyhits = 0;
201 
202  for (unsigned int k=0; k<geom->NPlanes(); k++) if(hitsperplane[k]!=0) {
203  planesperlength += 1/len;
204  if (k<4) earlyhits ++;
205  }
206  double cellsperlength = trk->NCell() / len;
207 
208 
209  switch(geom->DetId()){
210  case novadaq::cnv::kNDOS:
211  // Fall through
213  if(len<225) {
214  if(fVerbose) std::cout<<"Track rejected (Track too short)"<<std::endl;
215  return false;
216  }
217  if(z1 > 25) {
218  if(fVerbose) std::cout<<"Track rejected (did not start in the first 25 cm of the detector)"<<std::endl;
219  return false;
220  }
221  numTot++;
222  if(earlyhits<3) {
223  if(fVerbose) std::cout<<"Track rejected (Two or less of the first 4 planes were hit)"<<std::endl;
224  earlyCells++;
225  return false;
226  }
227  if(y1 > geom->DetHalfHeight() - 30) {
228  if(fVerbose) std::cout<<"Track rejected (Ystart Fiducial)"<<std::endl;
229  y1Fiducial++;
230  return false;
231  }
232  if( (z2 < 25) || (z2 > 1250) ) {
233  if(fVerbose) std::cout<<"Track rejected (Zend Fiducial)"<<std::endl;
234  z2Fiducial++;
235  return false;
236  }
237  if(fabs(x2) > geom->DetHalfWidth() - 20) {
238  if(fVerbose) std::cout<<"Track rejected (Xend Fiducial)"<<std::endl;
239  x2Fiducial++;
240  return false; // Fiducial X
241  }
242  if(y2 < -geom->DetHalfHeight() + 30) {
243  if(fVerbose) std::cout<<"Track rejected (Yend Fiducial)"<<std::endl;
244  y2Fiducial++;
245  return false; // Fiducial Y
246  }
247 
248  if( (planesperlength < 0.12) || (planesperlength > 0.16) ) {
249  if(fVerbose) std::cout<<"Track rejected (Planes per unit length is "<<planesperlength<<")"<<std::endl;
250  ppL++;
251  return false;
252  }
253  if( (cellsperlength < 0.12) || (cellsperlength > 0.2) ) {
254  if(fVerbose) std::cout<<"Track rejected (Cells per unit length is "<<cellsperlength<<" )"<<std::endl;
255  cpL++;
256  return false;
257  }
258 
259  if(fVerbose) std::cout<<"Track passed cut"<<std::endl;
260  break;
261 
262  //the script allows the user to run it on the far detector
263  //however, users should be wary that these cuts were not tested on any FarDet data at all, and just mimick the neardet ones.
264  //furthermore, we expect close to no rock event to be present in FarDet at all.
266  if(len<225) {
267  if(fVerbose) std::cout<<"Track rejected (Track too short)"<<std::endl;
268  return false;
269  }
270  if(z1 > 25) {
271  if(fVerbose) std::cout<<"Track rejected (did not start in the first 25 cm of the detector)"<<std::endl;
272  return false;
273  }
274  numTot++;
275  if(earlyhits<3) {
276  if(fVerbose) std::cout<<"Track rejected (Two or less of the first 4 planes were hit)"<<std::endl;
277  earlyCells++;
278  return false;
279  }
280  if(y1 > geom->DetHalfHeight() - 30) {
281  if(fVerbose) std::cout<<"Track rejected (Ystart Fiducial)"<<std::endl;
282  y1Fiducial++;
283  return false;
284  }
285  if( (z2 < 25) || (z2 > geom->DetLength() - 25 ) ) {
286  if(fVerbose) std::cout<<"Track rejected (Zend Fiducial)"<<std::endl;
287  z2Fiducial++;
288  return false;
289  }
290  if(fabs(x2) > geom->DetHalfWidth() - 20) {
291  if(fVerbose) std::cout<<"Track rejected (Xend Fiducial)"<<std::endl;
292  x2Fiducial++;
293  return false; // Fiducial X
294  }
295  if(y2 < -geom->DetHalfHeight() + 30) {
296  if(fVerbose) std::cout<<"Track rejected (Yend Fiducial)"<<std::endl;
297  y2Fiducial++;
298  return false; // Fiducial Y
299  }
300 
301  if( (planesperlength < 0.12) || (planesperlength > 0.16) ) {
302  if(fVerbose) std::cout<<"Track rejected (Planes per unit length is "<<planesperlength<<")"<<std::endl;
303  ppL++;
304  return false;
305  }
306  if( (cellsperlength < 0.12) || (cellsperlength > 0.2) ) {
307  if(fVerbose) std::cout<<"Track rejected (Cells per unit length is "<<cellsperlength<<" )"<<std::endl;
308  cpL++;
309  return false;
310  }
311 
312  if(fVerbose) std::cout<<"Track passed cut"<<std::endl;
313  break;
314  default:
315  assert(0 && "Unknown detector");
316  }
317 
318  return true;
319  }
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
fvar< T > fabs(const fvar< T > &x)
Definition: fabs.hpp:15
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 323 of file RockMuonStopperSelection_module.cc.

References abs(), rb::Cluster::AllCells(), geo::GeometryBase::DetHalfHeight(), geo::GeometryBase::DetHalfWidth(), geo::GeometryBase::DetLength(), simb::MCParticle::EndPosition(), stan::math::fabs(), 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().

324  {
326 
327  std::vector<const sim::Particle*> parts = bt->HitsToParticle(trk->AllCells());
328  if(parts.empty()) return false;
329 
330  const sim::Particle* part = parts.front();
331 
332  const TVector3 stop = part->EndPosition().Vect();
333  const TVector3 start= part->Position().Vect();
335 
336  //x0 and y0 are the intercept of the start-stop trajectory with the front plane
337  //(i.e. the z=0 plane)
338 
339  double x0=(start.X()*stop.Z()-stop.X()*start.Z())/(stop.Z()-start.Z());
340  double y0=(start.Y()*stop.Z()-stop.Y()*start.Z())/(stop.Z()-start.Z());
341 
342  if(start.Z() > 0) return false;
343  if(fabs(x0) > geom->DetHalfWidth()) return false;
344  if(fabs(y0) > geom->DetHalfHeight()) return false;
345  if(fabs(stop.X()) > geom->DetHalfWidth()) return false;
346  if(fabs(stop.Y()) > geom->DetHalfHeight()) return false;
347  if(stop.Z() < 0) return false;
348  if(stop.Z() > geom->DetLength()) return false;
349  if(abs(part->PdgCode())!=13) return false;
350 
351  return true;
352  }
const TLorentzVector & Position(const int i=0) const
Definition: MCParticle.h:218
int PdgCode() const
Definition: MCParticle.h:211
fvar< T > fabs(const fvar< T > &x)
Definition: fabs.hpp:15
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 355 of file RockMuonStopperSelection_module.cc.

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

Referenced by filter(), and IsTrulyContainedStopper().

356  {
358 
359  std::vector<const sim::Particle*> parts = bt->HitsToParticle(trk->AllCells());
360  if(parts.empty()) return false;
361 
362  const sim::Particle* part = parts.front();
363 
364  const TVector3 stop = part->EndPosition().Vect();
365  const TVector3 start= part->Position().Vect();
367 
368  //x0 and y0 are the intercept of the start-stop trajectory with the front plane
369  //(i.e. the z=0 plane)
370 
371  double x0=(start.X()*stop.Z()-stop.X()*start.Z())/(stop.Z()-start.Z());
372  double y0=(start.Y()*stop.Z()-stop.Y()*start.Z())/(stop.Z()-start.Z());
373 
374  if(start.Z() > 25) return false;
375  if(fabs(x0) > geom->DetHalfWidth()) return false;
376  if(fabs(y0) > geom->DetHalfHeight()) return false;
377  if(fabs(stop.X()) > geom->DetHalfWidth()-20) return false;
378  if(fabs(stop.Y()-15) > geom->DetHalfHeight()-15) return false;
379  if(fabs(y0 + 15) > geom->DetHalfHeight()-15) return false;
380  if(stop.Z() < 0) return false;
381  if(stop.Z() > 1250) return false;
382  if(abs(part->PdgCode())!=13) return false;
383 
384  return true;
385  }
const TLorentzVector & Position(const int i=0) const
Definition: MCParticle.h:218
int PdgCode() const
Definition: MCParticle.h:211
fvar< T > fabs(const fvar< T > &x)
Definition: fabs.hpp:15
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 = 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 art::Consumer::prepareForJob ( fhicl::ParameterSet const &  pset)
protectedinherited
void calib::RockMuonStopperSelection::reconfigure ( const fhicl::ParameterSet pset)

Definition at line 85 of file RockMuonStopperSelection_module.cc.

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

Referenced by RockMuonStopperSelection().

86  {
87  fApplyFilter = pset.get<bool>("ApplyFilter");
88  fTrackLabel = pset.get<std::string>("TrackLabel");
89  fVerbose = pset.get<bool>("Verbose");
90 
91  }
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::Consumer::showMissingConsumes ( ) const
protectedinherited

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

void art::Consumer::validateConsumedProduct ( BranchType const  bt,
ProductInfo const &  pi 
)
protectedinherited

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::EDFilter::Fail {false}
staticinherited

Definition at line 33 of file EDFilter.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::EDFilter::Pass {true}
staticinherited

Definition at line 32 of file EDFilter.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: