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

Selects throughgoing cosmics. More...

Inheritance diagram for calib::ThroughgoingSelection:
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

 ThroughgoingSelection (const fhicl::ParameterSet &pset)
 
 ~ThroughgoingSelection ()
 
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 IsUncontained (const rb::Track &trk) const
 
bool IsTrulyUncontained (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

int fTable [2][2]
 

Detailed Description

Selects throughgoing cosmics.

Definition at line 25 of file ThroughgoingSelection_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::ThroughgoingSelection::ThroughgoingSelection ( const fhicl::ParameterSet pset)
explicit

Definition at line 47 of file ThroughgoingSelection_module.cc.

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

48  {
49  produces< std::vector<rb::Track> >();
50 
51  reconfigure(pset);
52 
53  for(int i = 0; i < 2; ++i) for(int j = 0; j < 2; ++j) fTable[i][j] = 0;
54  }
const double j
Definition: BetheBloch.cxx:29
void reconfigure(const fhicl::ParameterSet &pset)
calib::ThroughgoingSelection::~ThroughgoingSelection ( )

Definition at line 57 of file ThroughgoingSelection_module.cc.

58  {
59  }

Member Function Documentation

void calib::ThroughgoingSelection::beginJob ( )
virtual

Reimplemented from art::EDFilter.

Definition at line 67 of file ThroughgoingSelection_module.cc.

68  {
69  }
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::ThroughgoingSelection::endJob ( )
virtual

Reimplemented from art::EDFilter.

Definition at line 103 of file ThroughgoingSelection_module.cc.

References om::cout, allTimeWatchdog::endl, and fTable.

104  {
105  if(fTable[0][0]+fTable[1][0] == 0 || fTable[0][1]+fTable[1][1] == 0) return;
106  std::cout << "Throughgoing efficiency table. x-axis selection, y-axis truth:" << std::endl;
107  std::cout << fTable[0][0] << "\t" << fTable[1][0] << "\t" << .1*(1000*fTable[0][0]/(fTable[0][0]+fTable[1][0])) << "%" << std::endl;
108  std::cout << fTable[0][1] << "\t" << fTable[1][1] << "\t" << .1*(1000*fTable[1][1]/(fTable[0][1]+fTable[1][1])) << "%" << std::endl;
109  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;
110  std::cout << "Purity = " << .1*(1000*fTable[1][1]/(fTable[1][0]+fTable[1][1])) << "%" << std::endl;
111  std::cout << "Efficiency = " << .1*(1000*fTable[1][1]/(fTable[0][1]+fTable[1][1])) << "%" << std::endl;
112  }
OStream cout
Definition: OStream.cxx:6
bool calib::ThroughgoingSelection::filter ( art::Event evt)
virtual

Implements art::EDFilter.

Definition at line 72 of file ThroughgoingSelection_module.cc.

References fTable, art::DataViewImpl::getByLabel(), art::Event::isRealData(), IsTrulyUncontained(), IsUncontained(), art::Event::put(), and runNovaSAM::ret.

73  {
74  std::unique_ptr<std::vector<rb::Track> > outTracks(new std::vector<rb::Track>);
75 
77  evt.getByLabel("cosmictrack", tracks);
78 
79  art::FindManyP<me::TrkME> fmp(tracks, evt, "mefinder");
80 
81  for(size_t trIdx = 0; trIdx < tracks->size(); ++trIdx){
82  // If there's any Michel associated, don't take this track
83  if(!fmp.at(trIdx).empty()) continue;
84 
85  const rb::Track& track = (*tracks)[trIdx];
86 
87  const bool thru = IsUncontained(track);
88 
89  if(thru) outTracks->push_back(track);
90 
91  if(!evt.isRealData()){
92  const bool trueThru = IsTrulyUncontained(track);
93  ++fTable[thru][trueThru];
94  }
95  } // end for trIdx
96 
97  const bool ret = !outTracks->empty();
98  evt.put(std::move(outTracks));
99  return ret;
100  }
bool IsTrulyUncontained(const rb::Track &trk) const
Definition: event.h:19
A rb::Prong with full reconstructed trajectory.
Definition: Track.h:20
bool isRealData() const
Definition: Event.h:83
bool IsUncontained(const rb::Track &trk) const
ProductID put(std::unique_ptr< PROD > &&product)
Definition: Event.h:102
bool getByLabel(std::string const &label, std::string const &productInstanceName, Handle< PROD > &result) const
Definition: DataViewImpl.h:344
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::ThroughgoingSelection::IsTrulyUncontained ( const rb::Track trk) const
protected

Definition at line 140 of file ThroughgoingSelection_module.cc.

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

Referenced by filter(), and IsUncontained().

141  {
143 
144  std::vector<const sim::Particle*> parts = bt->HitsToParticle(trk.AllCells());
145  if(parts.empty()) return false;
146 
147  const sim::Particle* part = parts.front();
148  if(abs(part->PdgCode()) != 13) return false;
149 
150  const TVector3 stop = part->EndPosition().Vect();
151 
153 
154  if(fabs(stop.X()) > geom->DetHalfWidth()) return true;
155  if(fabs(stop.Y()) > geom->DetHalfHeight()) return true;
156  if(stop.Z() < 0) return true;
157  if(stop.Z() > geom->DetLength()) return true;
158 
159  return false;
160  }
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::ThroughgoingSelection::IsUncontained ( const rb::Track trk) const
protected

Definition at line 115 of file ThroughgoingSelection_module.cc.

References geo::GeometryBase::DetHalfHeight(), geo::GeometryBase::DetHalfWidth(), geo::GeometryBase::DetLength(), stan::math::fabs(), geom(), IsTrulyUncontained(), rb::Prong::Start(), rb::Track::Stop(), submit_syst::x, submit_syst::y, and test::z.

Referenced by filter().

116  {
117  // Start and end don't mean much, pick whichever is lowest in y.
118  const TVector3 v1 = trk.Start();
119  const TVector3 v2 = trk.Stop();
120  const TVector3 stop = (v1.Y() < v2.Y()) ? v1 : v2;
121 
122  if(v1.X() == v2.X() ||
123  v1.Y() == v2.Y()) return false; // dx or dy = 0 means bad fit
124 
125  const double x = stop.X();
126  const double y = stop.Y();
127  const double z = stop.Z();
128 
130 
131  if(fabs(x) > geom->DetHalfWidth()-20) return true;
132  if(fabs(y) > geom->DetHalfHeight()-20) return true;
133  if(z < 20 || z > geom->DetLength()-20) return true;
134 
135  return false;
136  }
fvar< T > fabs(const fvar< T > &x)
Definition: fabs.hpp:15
double DetLength() const
virtual TVector3 Start() const
Definition: Prong.h:73
double DetHalfHeight() const
z
Definition: test.py:28
double DetHalfWidth() const
void geom(int which=0)
Definition: geom.C:163
TVector3 Stop() const
Position of the final trajectory point.
Definition: Track.cxx:186
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::ThroughgoingSelection::reconfigure ( const fhicl::ParameterSet pset)

Definition at line 62 of file ThroughgoingSelection_module.cc.

Referenced by ThroughgoingSelection().

63  {
64  }
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

constexpr bool art::EDFilter::Fail {false}
staticinherited

Definition at line 33 of file EDFilter.h.

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

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

Definition at line 42 of file ThroughgoingSelection_module.cc.

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

constexpr bool art::EDFilter::Pass {true}
staticinherited

Definition at line 32 of file EDFilter.h.

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


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