LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
filter::MuonFilter Class Reference
Inheritance diagram for filter::MuonFilter:
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

 MuonFilter (fhicl::ParameterSet const &)
 
virtual ~MuonFilter ()
 
bool filter (art::Event &evt)
 
void beginJob ()
 
void endJob ()
 
void reconfigure (fhicl::ParameterSet const &p)
 
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< T > consumes (InputTag const &)
 
template<typename T , art::BranchType BT>
art::ProductToken< T > consumes (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< T > consumesView (InputTag const &it)
 
template<typename T , BranchType = InEvent>
ProductToken< T > mayConsume (InputTag const &)
 
template<typename T , art::BranchType BT>
art::ProductToken< T > mayConsume (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< T > mayConsumeView (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

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 fClusterModuleLabel
 
std::string fLineModuleLabel
 
std::vector< double > fCuts
 
double fDCenter
 
double fDelay
 
double fTolerance
 
double fMaxIon
 
double fIonFactor
 
int fDeltaWire
 allowed differences in wire number between 2 planes More...
 

Detailed Description

Definition at line 53 of file MuonFilter_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

filter::MuonFilter::MuonFilter ( fhicl::ParameterSet const &  pset)
explicit

Definition at line 83 of file MuonFilter_module.cc.

References reconfigure().

84  {
85  this->reconfigure(pset);
86  }
void reconfigure(fhicl::ParameterSet const &p)
filter::MuonFilter::~MuonFilter ( )
virtual

Definition at line 89 of file MuonFilter_module.cc.

90  {
91  }

Member Function Documentation

void filter::MuonFilter::beginJob ( )
virtual

Reimplemented from art::EDFilter.

Definition at line 108 of file MuonFilter_module.cc.

109  {
110  }
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 147 of file Consumer.h.

References art::InputTag::instance(), art::InputTag::label(), and art::InputTag::process().

148 {
149  if (!moduleContext_)
150  return ProductToken<T>::invalid();
151 
152  consumables_[BT].emplace_back(ConsumableType::Product,
153  TypeID{typeid(T)},
154  it.label(),
155  it.instance(),
156  it.process());
157  return ProductToken<T>{it};
158 }
static ProductToken< T > invalid()
Definition: ProductToken.h:47
ConsumableProducts consumables_
Definition: Consumer.h:138
bool moduleContext_
Definition: Consumer.h:136
template<typename T , art::BranchType BT>
void art::Consumer::consumesMany ( )
inherited

Definition at line 162 of file Consumer.h.

163 {
164  if (!moduleContext_)
165  return;
166 
167  consumables_[BT].emplace_back(ConsumableType::Many, TypeID{typeid(T)});
168 }
ConsumableProducts consumables_
Definition: Consumer.h:138
bool moduleContext_
Definition: Consumer.h:136
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 172 of file Consumer.h.

References art::InputTag::instance(), art::InputTag::label(), and art::InputTag::process().

173 {
174  if (!moduleContext_)
175  return ViewToken<T>::invalid();
176 
177  consumables_[BT].emplace_back(ConsumableType::ViewElement,
178  TypeID{typeid(T)},
179  it.label(),
180  it.instance(),
181  it.process());
182  return ViewToken<T>{it};
183 }
static ViewToken< Element > invalid()
Definition: ProductToken.h:75
ConsumableProducts consumables_
Definition: Consumer.h:138
bool moduleContext_
Definition: Consumer.h:136
EngineCreator::base_engine_t & EngineCreator::createEngine ( seed_t  seed,
std::string const &  kind_of_engine_to_make 
)
inherited

Definition at line 32 of file EngineCreator.cc.

References art::EngineCreator::rng().

34 {
35  return rng()->createEngine(
36  placeholder_schedule_id(), seed, kind_of_engine_to_make);
37 }
long seed
Definition: chem4.cc:68
static art::ServiceHandle< art::RandomNumberGenerator > & rng()
EngineCreator::base_engine_t & EngineCreator::createEngine ( seed_t  seed,
std::string const &  kind_of_engine_to_make,
label_t const &  engine_label 
)
inherited

Definition at line 40 of file EngineCreator.cc.

References art::EngineCreator::rng().

43 {
44  return rng()->createEngine(
45  placeholder_schedule_id(), seed, kind_of_engine_to_make, engine_label);
46 }
long seed
Definition: chem4.cc:68
static art::ServiceHandle< art::RandomNumberGenerator > & rng()
CurrentProcessingContext const * art::EDFilter::currentContext ( ) const
protectedinherited

Definition at line 120 of file EDFilter.cc.

References art::EDFilter::current_context_.

121  {
122  return current_context_.get();
123  }
CPC_exempt_ptr current_context_
Definition: EDFilter.h:125
void filter::MuonFilter::endJob ( )
virtual

Reimplemented from art::EDFilter.

Definition at line 113 of file MuonFilter_module.cc.

114  {
115  }
bool filter::MuonFilter::filter ( art::Event evt)
virtual
Todo:
: the delta wire numbers seem a bit magic,
Todo:
: should also change to using Geometry::ChannelsIntersect method

Implements art::EDFilter.

Definition at line 118 of file MuonFilter_module.cc.

References a1, a2, DEFINE_ART_MODULE, recob::Cluster::EndTick(), recob::Cluster::EndWire(), fClusterModuleLabel, fCuts, fDCenter, fDelay, fDeltaWire, fIonFactor, fLineModuleLabel, fMaxIon, fTolerance, art::DataViewImpl::getByLabel(), hits(), geo::GeometryCore::IntersectionPoint(), geo::GeometryCore::Nplanes(), recob::Cluster::Plane(), geo::GeometryCore::Plane(), art::PtrVector< T >::push_back(), art::PtrVector< T >::reserve(), art::PtrVector< T >::size(), recob::Cluster::StartTick(), recob::Cluster::StartWire(), geo::PlaneGeo::View(), x1, x2, y1, and y2.

119  {
121  // art::ServiceHandle<detinfo::LArPropertiesService> larprop_s;
122  // art::ServiceHandle<detinfo::DetectorPropertiesService> detprop_s;
123  auto const * detprop = lar::providerFrom<detinfo::DetectorPropertiesService>();
124 
125  //Drift Velocity in cm/us Sampling rate in ns
126  double drift = detprop->DriftVelocity(detprop->Efield(), detprop->Temperature())*detprop->SamplingRate()/1000.0;
127 
128  //This code only works comparing 2 planes so for now these are the
129  // last induction plane and collection plane
130  int vPlane = geom->Nplanes() - 1;
131  geo::View_t vView = geom->Plane(vPlane).View();
132  int uPlane = vPlane-1;
133  geo::View_t uView = geom->Plane(uPlane).View();
135  evt.getByLabel(fClusterModuleLabel,clustHandle);
136 
137  art::FindManyP<recob::Hit> fmh(clustHandle, evt, fClusterModuleLabel);
138 
140  clusters.reserve(clustHandle->size());
141  for(unsigned int i = 0; i < clustHandle->size(); ++i) {
142  clusters.push_back(art::Ptr<recob::Cluster>(clustHandle,i));
143  }
144  double indIon(0),colIon(0);
145  std::map<int,int> indMap;
146  std::map<int,int> colMap;
147  std::vector<std::pair<int,int> > rLook;
148  int matchNum=1;
149  std::vector<std::vector<double> > tGoing;
150  std::vector<std::vector<double> > matched;
151  std::vector<double> pointTemp(6);
152  std::pair<int,int> pairTemp;
153  double ionSum(0.0);
154  for(size_t cluster = 0; cluster < clusters.size(); ++cluster) {
155  ionSum=0.0;
156  std::vector< art::Ptr<recob::Hit> > hits = fmh.at(cluster);
157  for(unsigned int hit = 0; hit < hits.size(); hit++) {
158  ionSum+=hits[hit]->PeakAmplitude();
159  }
160  if(clusters[cluster]->View() == uView) indIon+=ionSum;
161  else if(clusters[cluster]->View() == vView) colIon+=ionSum;
162  }
163  mf::LogInfo("MuonFilter") << "Ionizations: " << indIon << " " << colIon ;
165  art::PtrVector<recob::Cluster> inductionSegments, collectionSegments;
166  evt.getByLabel(fLineModuleLabel,lines);
168  lineVec.reserve(lines->size());
169  for(unsigned int i = 0; i < lines->size(); ++i) {
170  lineVec.push_back(art::Ptr<recob::Cluster>(lines,i));
171  }
172 
173  for(size_t cl = 0;cl < clusters.size(); cl++) {
174  std::vector< art::Ptr<recob::Hit> > hits = fmh.at(cl);
175  if (hits.size()>0 && clusters[cl]->View()==uView)
176  inductionSegments.push_back(clusters[cl]);
177  else if(hits.size()>0 && clusters[cl]->View() == vView) collectionSegments.push_back(clusters[cl]);
178  }
179 
180  art::FindManyP<recob::Hit> fmhi(inductionSegments, evt, fClusterModuleLabel);
181  art::FindManyP<recob::Hit> fmhc(collectionSegments, evt, fClusterModuleLabel);
182 
183  if(inductionSegments.size() == 0 || collectionSegments.size() == 0) {
184  mf::LogInfo("MuonFilter") << "At least one plane with no track";
185  }
186  else {
187 
188  for(unsigned int i = 0; i < inductionSegments.size(); i++) {
189  if(indMap[i]) continue;
190  for(unsigned int j = 0; j < collectionSegments.size(); j++) {
191  if(colMap[j]) continue;
192 
193  art::Ptr<recob::Cluster> indSeg = inductionSegments[i];
194  art::Ptr<recob::Cluster> colSeg = collectionSegments[j];
195 
196  std::vector< art::Ptr<recob::Hit> > indHits = fmhi.at(i);
197 
198  std::vector< art::Ptr<recob::Hit> > colHits = fmhc.at(j);
199 
200  double trk1Start = indSeg->StartTick()+fDelay;
201  double trk1End = indSeg->EndTick()+fDelay;
202  double trk2Start =colSeg->StartTick();
203  double trk2End =colSeg->EndTick();
204 
205  int uPos1 = indSeg->StartWire();
206  int uPos2 = indSeg->EndWire();
207  int const vPos1 = colSeg->StartWire();
208  int const vPos2 = colSeg->EndWire();
209  mf::LogInfo("MuonFilter") << "I J " << i <<" " << j ;
210  mf::LogInfo("MuonFilter") << "Start/end " << indSeg->StartWire()
211  <<" "<< colSeg->StartWire()
212  <<" "<< indSeg->EndWire()
213  <<" "<< colSeg->EndWire() ;
214  mf::LogInfo("MuonFilter")<<"U's "<< uPos1 <<" " << uPos2
215  <<"V's "<< vPos1 <<" " << vPos2
216  << " times " << trk1End <<" "<< trk2End
217  <<" "<< trk1Start <<" "<< trk2Start ;
218  //need to have the corresponding endpoints matched
219  //check if they match in this order else switch
220  //really should use the crossing function and then have limits
221  //on distance outide tpc, or some other way of dealing with
222  //imperfect matches
223  if((TMath::Abs(uPos1-vPos1)>fDeltaWire || TMath::Abs(uPos2-vPos2)>fDeltaWire) &&
224  (TMath::Abs(uPos1-vPos2)<=fDeltaWire && TMath::Abs(uPos2-vPos1)<=fDeltaWire)) {
225  mf::LogInfo("MuonFilter") << "Swapped1" ;
226  std::swap(uPos1,uPos2);
227  }
228  //check for time tolerance
229  if((TMath::Abs(trk1Start-trk2Start) > fTolerance && TMath::Abs(trk1End-trk2End) > fTolerance) &&
230  (TMath::Abs(trk1Start-trk2End) < fTolerance && TMath::Abs(trk1End-trk2Start) < fTolerance)) {
231  std::swap(trk1Start,trk1End);
232  std::swap(uPos1,uPos2);
233  mf::LogInfo("MuonFilter") << "Swapped2" ;
234  }
235  mf::LogInfo("MuonFilter") << "Times: " << trk1Start <<" "<< trk2Start <<" "<<trk1End <<" "<<trk2End;
236  //again needs to be fixed
239  if((TMath::Abs(trk1Start-trk2Start) < fTolerance && TMath::Abs(trk1End-trk2End) < fTolerance) &&
240  (TMath::Abs(uPos1-vPos1) <=fDeltaWire+2 && TMath::Abs(uPos2-vPos2) <= fDeltaWire+2))
241  {
242  geo::WireID u_wID1(indSeg->Plane(), uPos1);
243  geo::WireID u_wID2(indSeg->Plane(), uPos2);
244  geo::WireID v_wID1(colSeg->Plane(), vPos1);
245  geo::WireID v_wID2(colSeg->Plane(), vPos2);
246 
247  double y1, y2, z1, z2;
248  geom->IntersectionPoint(u_wID1, v_wID1, y1, z1);
249  geom->IntersectionPoint(u_wID2, v_wID2, y2, z2);
250 
251  double const x1 = (trk1Start+trk2Start)/2.0*drift-fDCenter;
252  double const x2 = (trk1End+trk2End)/2.0*drift-fDCenter;
253  mf::LogInfo("MuonFilter") <<"Match " << matchNum
254  <<" " << x1 << " " << y1 << " " << z1
255  <<" " << x2 << " " << y2 << " " << z2;
256  bool x1edge,x2edge,y1edge, y2edge,z1edge,z2edge;
257  indMap[i]=matchNum;
258  colMap[j]=matchNum;
259  matchNum++;
260  pointTemp[0]=x1;
261  pointTemp[1]=y1;
262  pointTemp[2]=z1;
263  pointTemp[3]=x2;
264  pointTemp[4]=y2;
265  pointTemp[5]=z2;
266  x1edge =(TMath::Abs(x1) -fCuts[0] > 0);
267  x2edge =(TMath::Abs(x2) -fCuts[0] > 0);
268  y1edge =(TMath::Abs(y1) -fCuts[1] > 0);
269  y2edge =(TMath::Abs(y2) -fCuts[1] > 0);
270  z1edge =(TMath::Abs(z1) -fCuts[2] > 0);
271  z2edge =(TMath::Abs(z2) -fCuts[2] > 0);
272  if((x1edge||y1edge||z1edge) && (x2edge||y2edge||z2edge)) {
273  tGoing.push_back(pointTemp);
274  mf::LogInfo("MuonFilter") << "outside Removed induction ion: ";
275 
276  for(size_t h = 0; h < indHits.size(); h++){
277  mf::LogInfo("MuonFilter") << indHits[h]->PeakAmplitude() << " ";
278  indIon -= indHits[h]->PeakAmplitude();
279  }
280  mf::LogInfo("MuonFilter") <<"Removed collection ion: ";
281 
282  for(size_t h = 0; h < colHits.size(); h++){
283  mf::LogInfo("MuonFilter") << colHits[h]->PeakAmplitude() << " ";
284  colIon -= colHits[h]->PeakAmplitude();
285  }
286  mf::LogInfo("MuonFilter")<<"Ionization outside track I/C: " << indIon << " "<<colIon;
287  }
288  else if((x1edge || y1edge || z1edge) &&
289  !(x2edge || y2edge || z2edge) &&
290  (z2-z1)>1.2){
291  tGoing.push_back(pointTemp);
292  mf::LogInfo("MuonFilter") << "stopping Removed induction ion: ";
293  for(size_t h = 0; h < indHits.size(); h++){
294  mf::LogInfo("MuonFilter") <<indHits[h]->PeakAmplitude() << " ";
295  indIon -= indHits[h]->PeakAmplitude();
296  }
297  mf::LogInfo("MuonFilter") <<"Removed collection ion: ";
298  for(size_t h = 0; h < colHits.size(); h++){
299  mf::LogInfo("MuonFilter") << colHits[h]->PeakAmplitude()<< " ";
300  colIon -= colHits[h]->PeakAmplitude();
301  }
302  mf::LogInfo("MuonFilter") <<"Ionization outside track I/C: " << indIon << " "<<colIon;
303  }
304  else {
305  pairTemp = std::make_pair(i,j);
306  mf::LogInfo("MuonFilter") << "rLook matchnum " <<matchNum << " "<<i << " "<<j ;
307  rLook.push_back(pairTemp);
308  matched.push_back(pointTemp);
309  }
310  break; //advances i, makes j=0;
311  }
312  }
313  }
314  }
315  //after all matches are made, remove deltas
316  double distance=0;
317  for(unsigned int i = 0; i < tGoing.size(); i++)
318  for(unsigned int j = 0; j < matched.size();j++){
319  mf::LogInfo("MuonFilter") << tGoing.size() <<" " << matched.size() << " " << i << " " << j;
320  //test if one is contained within the other in the z-direction
321  if((tGoing[i][2] <= matched[j][2]) &&
322  (tGoing[i][5] >= matched[j][5])) {
323  TVector3 a1(&tGoing[i][0]);
324  TVector3 a2(&tGoing[i][3]);
325  TVector3 b1(&matched[j][0]);
326  distance = TMath::Abs((((a1-a2).Cross((a1-a2).Cross(a1-b1))).Unit()).Dot(a1-b1));
327  mf::LogInfo("MuonFilter") <<"distance "<< distance;
328  if(distance < 6){
329  mf::LogInfo("MuonFilter") <<"Removing delta ion "<<rLook.size()<<" "<<rLook[j].first<<" "<<matchNum;
330  std::vector< art::Ptr<recob::Hit> > temp = fmhi.at(rLook[j].first);
331  for(unsigned int h = 0; h < temp.size();h++)
332  indIon -= temp[h]->PeakAmplitude();
333  temp = fmhc.at(rLook[j].second);
334  for(unsigned int h = 0; h < temp.size();h++)
335  colIon -= temp[h]->PeakAmplitude();
336  }
337  }
338  }
339  mf::LogInfo("MuonFilter") <<"indIon "<<indIon*fIonFactor <<" colIon " << colIon ;
340  if((indIon*fIonFactor > fMaxIon) && (colIon > fMaxIon))
341  return true;
342  else return false;
343  }
void reserve(size_type n)
Definition: PtrVector.h:343
PlaneGeo const & Plane(unsigned int const p, unsigned int const tpc=0, unsigned int const cstat=0) const
Returns the specified wire.
Float_t y1[n_points_granero]
Definition: compare.C:5
enum geo::_plane_proj View_t
Enumerate the possible plane projections.
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
Float_t x1[n_points_granero]
Definition: compare.C:5
std::string fLineModuleLabel
float StartWire() const
Returns the wire coordinate of the start of the cluster.
Definition: Cluster.h:286
float EndTick() const
Returns the tick coordinate of the end of the cluster.
Definition: Cluster.h:342
std::vector< double > fCuts
geo::PlaneID Plane() const
Returns the plane ID this cluster lies on.
Definition: Cluster.h:744
Cluster finding and building.
Float_t y2[n_points_geant4]
Definition: compare.C:26
#define a2
View_t View() const
Which coordinate does this plane measure.
Definition: PlaneGeo.h:171
unsigned int Nplanes(unsigned int tpc=0, unsigned int cstat=0) const
Returns the total number of wire planes in the specified TPC.
void hits()
Definition: readHits.C:15
std::string fClusterModuleLabel
void push_back(Ptr< U > const &p)
Definition: PtrVector.h:441
reference at(size_type n)
Definition: PtrVector.h:365
bool IntersectionPoint(geo::WireID const &wid1, geo::WireID const &wid2, double &y, double &z) const
Returns the intersection point of two wires.
int fDeltaWire
allowed differences in wire number between 2 planes
size_type size() const
Definition: PtrVector.h:308
Detector simulation of raw signals on wires.
void swap(art::HLTGlobalStatus &lhs, art::HLTGlobalStatus &rhs)
bool getByLabel(std::string const &label, std::string const &productInstanceName, Handle< PROD > &result) const
Definition: DataViewImpl.h:344
Float_t x2[n_points_geant4]
Definition: compare.C:26
float StartTick() const
Returns the tick coordinate of the start of the cluster.
Definition: Cluster.h:297
#define a1
float EndWire() const
Returns the wire coordinate of the end of the cluster.
Definition: Cluster.h:329
EngineCreator::seed_t EngineCreator::get_seed_value ( fhicl::ParameterSet const &  pset,
char const  key[] = "seed",
seed_t const  implicit_seed = -1 
)
inherited

Definition at line 49 of file EngineCreator.cc.

References fhicl::ParameterSet::get().

Referenced by art::MixFilter< T >::initEngine_().

52 {
53  auto const& explicit_seeds = pset.get<std::vector<int>>(key, {});
54  return explicit_seeds.empty() ? implicit_seed : explicit_seeds.front();
55 }
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_.

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 B, and 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  }
Int_t B
Definition: plot.C:25
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 190 of file Consumer.h.

References art::InputTag::instance(), art::InputTag::label(), and art::InputTag::process().

191 {
192  if (!moduleContext_)
193  return ProductToken<T>::invalid();
194 
195  consumables_[BT].emplace_back(ConsumableType::Product,
196  TypeID{typeid(T)},
197  it.label(),
198  it.instance(),
199  it.process());
200  return ProductToken<T>{it};
201 }
static ProductToken< T > invalid()
Definition: ProductToken.h:47
ConsumableProducts consumables_
Definition: Consumer.h:138
bool moduleContext_
Definition: Consumer.h:136
template<typename T , art::BranchType BT>
void art::Consumer::mayConsumeMany ( )
inherited

Definition at line 205 of file Consumer.h.

206 {
207  if (!moduleContext_)
208  return;
209 
210  consumables_[BT].emplace_back(ConsumableType::Many, TypeID{typeid(T)});
211 }
ConsumableProducts consumables_
Definition: Consumer.h:138
bool moduleContext_
Definition: Consumer.h:136
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 215 of file Consumer.h.

References art::InputTag::instance(), art::InputTag::label(), and art::InputTag::process().

216 {
217  if (!moduleContext_)
218  return ViewToken<T>::invalid();
219 
220  consumables_[BT].emplace_back(ConsumableType::ViewElement,
221  TypeID{typeid(T)},
222  it.label(),
223  it.instance(),
224  it.process());
225  return ViewToken<T>{it};
226 }
static ViewToken< Element > invalid()
Definition: ProductToken.h:75
ConsumableProducts consumables_
Definition: Consumer.h:138
bool moduleContext_
Definition: Consumer.h:136
bool art::ProducerBase::modifiesEvent ( ) const
inlineinherited

Definition at line 40 of file ProducerBase.h.

References art::ProducerBase::getProductID().

41  {
42  return true;
43  }
void art::Consumer::prepareForJob ( fhicl::ParameterSet const &  pset)
protectedinherited

Definition at line 89 of file Consumer.cc.

References fhicl::ParameterSet::get_if_present().

Referenced by art::EDProducer::doBeginJob(), art::EDFilter::doBeginJob(), and art::EDAnalyzer::doBeginJob().

90 {
91  if (!moduleContext_)
92  return;
93 
94  pset.get_if_present("errorOnMissingConsumes", requireConsumes_);
95  for (auto& consumablesPerBranch : consumables_) {
96  cet::sort_all(consumablesPerBranch);
97  }
98 }
bool requireConsumes_
Definition: Consumer.h:137
ConsumableProducts consumables_
Definition: Consumer.h:138
bool moduleContext_
Definition: Consumer.h:136
void filter::MuonFilter::reconfigure ( fhicl::ParameterSet const &  p)

Definition at line 94 of file MuonFilter_module.cc.

References fClusterModuleLabel, fCuts, fDCenter, fDelay, fDeltaWire, fIonFactor, fLineModuleLabel, fMaxIon, fTolerance, and fhicl::ParameterSet::get().

Referenced by MuonFilter().

95  {
96  fClusterModuleLabel = p.get< std::string >("ClusterModuleLabel");
97  fLineModuleLabel = p.get< std::string >("LineModuleLabel");
98  fTolerance = p.get< double >("Tolerance");
99  fDelay = p.get< double >("Delay");
100  fDCenter = p.get< double >("DCenter");
101  fMaxIon = p.get< double >("MaxIon");
102  fIonFactor = p.get< double >("IonFactor");
103  fCuts = p.get< std::vector<double> >("Cuts");
104  fDeltaWire = p.get< int >("DeltaWire");
105  }
std::string fLineModuleLabel
std::vector< double > fCuts
std::string fClusterModuleLabel
int fDeltaWire
allowed differences in wire number between 2 planes
void art::Consumer::showMissingConsumes ( ) const
protectedinherited

Definition at line 125 of file Consumer.cc.

Referenced by art::EDProducer::doEndJob(), art::EDFilter::doEndJob(), art::EDAnalyzer::doEndJob(), and art::RootOutput::endJob().

126 {
127  if (!moduleContext_)
128  return;
129 
130  // If none of the branches have missing consumes statements, exit early.
131  if (std::all_of(cbegin(missingConsumes_),
132  cend(missingConsumes_),
133  [](auto const& perBranch) { return perBranch.empty(); }))
134  return;
135 
136  constexpr cet::HorizontalRule rule{60};
137  mf::LogPrint log{"MTdiagnostics"};
138  log << '\n'
139  << rule('=') << '\n'
140  << "The following consumes (or mayConsume) statements are missing from\n"
141  << module_context(moduleDescription_) << '\n'
142  << rule('-') << '\n';
143 
144  cet::for_all_with_index(
145  missingConsumes_, [&log](std::size_t const i, auto const& perBranch) {
146  for (auto const& pi : perBranch) {
147  log << " "
148  << assemble_consumes_statement(static_cast<BranchType>(i), pi)
149  << '\n';
150  }
151  });
152  log << rule('=');
153 }
cet::exempt_ptr< ModuleDescription const > moduleDescription_
Definition: Consumer.h:140
constexpr T pi()
Returns the constant pi (up to 35 decimal digits of precision)
bool moduleContext_
Definition: Consumer.h:136
ConsumableProductSets missingConsumes_
Definition: Consumer.h:139
void art::Consumer::validateConsumedProduct ( BranchType const  bt,
ProductInfo const &  pi 
)
protectedinherited

Definition at line 101 of file Consumer.cc.

References art::errors::ProductRegistrationFailure.

103 {
104  // Early exits if consumes tracking has been disabled or if the
105  // consumed product is an allowed consumable.
106  if (!moduleContext_)
107  return;
108 
109  if (cet::binary_search_all(consumables_[bt], pi))
110  return;
111 
112  if (requireConsumes_) {
114  "Consumer: an error occurred during validation of a "
115  "retrieved product\n\n")
116  << "The following consumes (or mayConsume) statement is missing from\n"
117  << module_context(moduleDescription_) << ":\n\n"
118  << " " << assemble_consumes_statement(bt, pi) << "\n\n";
119  }
120 
121  missingConsumes_[bt].insert(pi);
122 }
cet::exempt_ptr< ModuleDescription const > moduleDescription_
Definition: Consumer.h:140
bool requireConsumes_
Definition: Consumer.h:137
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
constexpr T pi()
Returns the constant pi (up to 35 decimal digits of precision)
ConsumableProducts consumables_
Definition: Consumer.h:138
bool moduleContext_
Definition: Consumer.h:136
ConsumableProductSets missingConsumes_
Definition: Consumer.h:139

Member Data Documentation

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

Definition at line 33 of file EDFilter.h.

std::string filter::MuonFilter::fClusterModuleLabel
protected

Definition at line 70 of file MuonFilter_module.cc.

Referenced by filter(), and reconfigure().

std::vector<double> filter::MuonFilter::fCuts
protected

Definition at line 72 of file MuonFilter_module.cc.

Referenced by filter(), and reconfigure().

double filter::MuonFilter::fDCenter
protected

Definition at line 73 of file MuonFilter_module.cc.

Referenced by filter(), and reconfigure().

double filter::MuonFilter::fDelay
protected

Definition at line 74 of file MuonFilter_module.cc.

Referenced by filter(), and reconfigure().

int filter::MuonFilter::fDeltaWire
protected

allowed differences in wire number between 2 planes

Definition at line 78 of file MuonFilter_module.cc.

Referenced by filter(), and reconfigure().

double filter::MuonFilter::fIonFactor
protected

Definition at line 77 of file MuonFilter_module.cc.

Referenced by filter(), and reconfigure().

std::string filter::MuonFilter::fLineModuleLabel
protected

Definition at line 71 of file MuonFilter_module.cc.

Referenced by filter(), and reconfigure().

double filter::MuonFilter::fMaxIon
protected

Definition at line 76 of file MuonFilter_module.cc.

Referenced by filter(), and reconfigure().

double filter::MuonFilter::fTolerance
protected

Definition at line 75 of file MuonFilter_module.cc.

Referenced by filter(), and reconfigure().

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

Definition at line 32 of file EDFilter.h.


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