LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
cosmic::CosmicTrackTagger Class Reference
Inheritance diagram for cosmic::CosmicTrackTagger:
art::EDProducer art::ProducerBase art::Consumer art::EngineCreator art::ProductRegistryHelper

Public Types

using ModuleType = EDProducer
 
using WorkerType = WorkerT< EDProducer >
 
template<typename UserConfig , typename KeysToIgnore = void>
using Table = ProducerBase::Table< UserConfig, KeysToIgnore >
 

Public Member Functions

 CosmicTrackTagger (fhicl::ParameterSet const &p)
 
virtual ~CosmicTrackTagger ()
 
void produce (art::Event &e) override
 
void beginJob () override
 
void reconfigure (fhicl::ParameterSet const &p)
 
void endJob () override
 
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 ()
 

Protected Member Functions

CurrentProcessingContext const * currentContext () const
 
void validateConsumedProduct (BranchType const bt, ProductInfo const &pi)
 
void prepareForJob (fhicl::ParameterSet const &pset)
 
void showMissingConsumes () const
 

Private Member Functions

double length (art::Ptr< recob::Track > track)
 

Private Attributes

std::string fTrackModuleLabel
 
int fEndTickPadding
 
int fDetectorWidthTicks
 
float fTPCXBoundary
 
float fTPCYBoundary
 
float fTPCZBoundary
 
float fDetHalfHeight
 
float fDetWidth
 
float fDetLength
 
int fMinTickDrift
 
int fMaxTickDrift
 

Detailed Description

Definition at line 60 of file CosmicTrackTagger_module.cc.

Member Typedef Documentation

using art::EDProducer::ModuleType = EDProducer
inherited

Definition at line 34 of file EDProducer.h.

template<typename UserConfig , typename KeysToIgnore = void>
using art::EDProducer::Table = ProducerBase::Table<UserConfig, KeysToIgnore>
inherited

Definition at line 43 of file EDProducer.h.

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

Definition at line 35 of file EDProducer.h.

Constructor & Destructor Documentation

cosmic::CosmicTrackTagger::CosmicTrackTagger ( fhicl::ParameterSet const &  p)
explicit

Definition at line 96 of file CosmicTrackTagger_module.cc.

References reconfigure().

99 {
100  this->reconfigure(p);
101 
102  // Call appropriate Produces<>() functions here.
103  produces< std::vector<anab::CosmicTag> >();
104  produces< art::Assns<recob::Track, anab::CosmicTag> >();
105 }
void reconfigure(fhicl::ParameterSet const &p)
cosmic::CosmicTrackTagger::~CosmicTrackTagger ( )
virtual

Definition at line 107 of file CosmicTrackTagger_module.cc.

107  {
108  // Clean up dynamic memory and other resources here.
109 }

Member Function Documentation

void cosmic::CosmicTrackTagger::beginJob ( )
overridevirtual

Reimplemented from art::EDProducer.

Definition at line 372 of file CosmicTrackTagger_module.cc.

372  {
373 }
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::EDProducer::currentContext ( ) const
protectedinherited

Definition at line 120 of file EDProducer.cc.

References art::EDProducer::current_context_.

121  {
122  return current_context_.get();
123  }
CPC_exempt_ptr current_context_
Definition: EDProducer.h:116
void cosmic::CosmicTrackTagger::endJob ( )
overridevirtual

Reimplemented from art::EDProducer.

Definition at line 405 of file CosmicTrackTagger_module.cc.

References DEFINE_ART_MODULE.

405  {
406  // Implementation of optional member function here.
407 }
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::EDProducer::getProductID ( std::string const &  instanceName = {}) const
inlineinherited

Definition at line 123 of file EDProducer.h.

References art::EDProducer::moduleDescription_.

124  {
125  return ProducerBase::getProductID<PROD, B>(moduleDescription_,
126  instanceName);
127  }
ModuleDescription moduleDescription_
Definition: EDProducer.h:115
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
double cosmic::CosmicTrackTagger::length ( art::Ptr< recob::Track track)
private

Definition at line 367 of file CosmicTrackTagger_module.cc.

References recob::Track::Length().

Referenced by produce().

367  {
368  return track->Length();
369 }
double Length(size_t p=0) const
Access to various track properties.
Definition: Track.h:170
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 cosmic::CosmicTrackTagger::produce ( art::Event e)
overridevirtual

Implements art::EDProducer.

Definition at line 111 of file CosmicTrackTagger_module.cc.

References util::CreateAssn(), recob::Track::End(), fDetHalfHeight, fDetLength, fDetWidth, art::fill_ptr_vector(), fMaxTickDrift, fTPCXBoundary, fTPCYBoundary, fTPCZBoundary, fTrackModuleLabel, art::DataViewImpl::getByLabel(), art::detail::getType(), recob::Track::ID(), art::Ptr< T >::key(), anab::kGeometry_XX, anab::kGeometry_Y, anab::kGeometry_YY, anab::kGeometry_YZ, anab::kGeometry_Z, anab::kGeometry_ZZ, anab::kNotTagged, anab::kOutsideDrift_Partial, length(), recob::Track::Length(), recob::Track::NumberTrajectoryPoints(), art::Event::put(), and recob::Track::Vertex().

111  {
112  // Implementation of required member function here.
113 
114  std::unique_ptr< std::vector< anab::CosmicTag > > cosmicTagTrackVector( new std::vector<anab::CosmicTag> );
115  std::unique_ptr< art::Assns<recob::Track, anab::CosmicTag > > assnOutCosmicTagTrack( new art::Assns<recob::Track, anab::CosmicTag>);
116 
117  TStopwatch ts;
118 
120  e.getByLabel( fTrackModuleLabel, Trk_h );
121  std::vector<art::Ptr<recob::Track> > TrkVec;
122  art::fill_ptr_vector(TrkVec, Trk_h);
123 
125  // LOOPING OVER INSPILL TRACKS
127 
128  art::FindManyP<recob::Hit> hitsSpill (Trk_h, e, fTrackModuleLabel);
129  // art::FindManyP<recob::Cluster> ClusterSpill(Trk_h, e, fTrackModuleLabel);
130 
131  for( unsigned int iTrack=0; iTrack<Trk_h->size(); iTrack++ ) {
132 
133  int isCosmic = 0;
135 
136  art::Ptr<recob::Track> tTrack = TrkVec.at(iTrack);
137  std::vector<art::Ptr<recob::Hit> > HitVec = hitsSpill.at(iTrack);
138 
139  if (iTrack != tTrack.key())
140  {
141  std::cout << "Mismatch in track index/key" << std::endl;
142  }
143 
144  // A BETTER WAY OF FINDING END POINTS:
145  auto tVector1 = tTrack->Vertex();
146  auto tVector2 = tTrack->End();
147 
148  float trackEndPt1_X = tVector1.X();
149  float trackEndPt1_Y = tVector1.Y();
150  float trackEndPt1_Z = tVector1.Z();
151  float trackEndPt2_X = tVector2.X();
152  float trackEndPt2_Y = tVector2.Y();
153  float trackEndPt2_Z = tVector2.Z();
154 
155 
156  if( trackEndPt1_X != trackEndPt1_X ||
157  trackEndPt1_Y != trackEndPt1_Y ||
158  trackEndPt1_Z != trackEndPt1_Z ||
159  trackEndPt2_X != trackEndPt2_X ||
160  trackEndPt2_Y != trackEndPt2_Y ||
161  trackEndPt2_Z != trackEndPt2_Z ) {
162  std::cerr << "!!! FOUND A PROBLEM... the length is: " << tTrack->Length() <<
163  " np: " << tTrack->NumberTrajectoryPoints() << " id: " << tTrack->ID() << " " << tTrack << std::endl;
164  //for( size_t hh=0; hh<tTrack->NumberTrajectoryPoints(); hh++) {
165  // std::cerr << hh << " " << tTrack->LocationAtPoint(hh)[0] << ", " <<
166  // tTrack->LocationAtPoint(hh)[1] << ", " <<
167  // tTrack->LocationAtPoint(hh)[2] << std::endl;
168  //}
169  std::vector<float> tempPt1, tempPt2;
170  tempPt1.push_back(-999);
171  tempPt1.push_back(-999);
172  tempPt1.push_back(-999);
173  tempPt2.push_back(-999);
174  tempPt2.push_back(-999);
175  tempPt2.push_back(-999);
176  cosmicTagTrackVector->emplace_back( tempPt1, tempPt2, -999, tag_id);
177  util::CreateAssn(*this, e, *cosmicTagTrackVector, tTrack, *assnOutCosmicTagTrack );
178  continue; // I don't want to deal with these "tracks"
179  }
180 
181 
182 
184  // Getting first and last ticks
186  float tick1 = 9999;
187  float tick2 = -9999;
188  bool dumpMe(false);
189 
190  for ( unsigned int p = 0; p < HitVec.size(); p++) {
191  if (dumpMe)
192  {
193  std::cout << "###>> Hit key: " << HitVec[p].key() << ", peak - RMS: " << HitVec[p]->PeakTimeMinusRMS() << ", peak + RMS: " << HitVec[p]->PeakTimePlusRMS() << std::endl;
194  }
195  if( HitVec[p]->PeakTimeMinusRMS() < tick1 ) tick1 = HitVec[p]->PeakTimeMinusRMS();
196  if( HitVec[p]->PeakTimePlusRMS() > tick2 ) tick2 = HitVec[p]->PeakTimePlusRMS();
197  }
198 
199 
201  // Are any of the ticks outside of the ReadOutWindow ?
203  //if(tick1 < fDetectorWidthTicks || tick2 > 2*fDetectorWidthTicks ) {
204  if(tick1 < fMinTickDrift || tick2 > fMaxTickDrift ) {
205  isCosmic = 1;
207  }
208 
209 
210 
212  // Now check Y & Z boundaries:
214  int nBdY = 0, nBdZ=0;
215  if( isCosmic == 0 ) {
216 
217  // Checking lower side of TPC
218  if( fabs( fDetHalfHeight + trackEndPt1_Y ) < fTPCYBoundary ||
219  fabs( fDetHalfHeight + trackEndPt2_Y ) < fTPCYBoundary ||
220  trackEndPt1_Y < -fDetHalfHeight ||
221  trackEndPt2_Y < -fDetHalfHeight ) nBdY++;
222 
223  // Checking upper side of TPC
224  if( fabs( fDetHalfHeight - trackEndPt1_Y ) < fTPCYBoundary ||
225  fabs( fDetHalfHeight - trackEndPt2_Y ) < fTPCYBoundary ||
226  trackEndPt1_Y > fDetHalfHeight ||
227  trackEndPt2_Y > fDetHalfHeight ) nBdY++;
228 
229  if(fabs(trackEndPt1_Z - fDetLength)<fTPCZBoundary || fabs(trackEndPt2_Z - fDetLength) < fTPCZBoundary ) nBdZ++;
230  if(fabs(trackEndPt1_Z )< fTPCZBoundary || fabs(trackEndPt2_Z )< fTPCZBoundary ) nBdZ++;
231  if( (nBdY+nBdZ)>1 ) {
232  isCosmic = 2;
233  if(nBdY>1) tag_id = anab::CosmicTagID_t::kGeometry_YY;
234  else if(nBdZ>1) tag_id = anab::CosmicTagID_t::kGeometry_ZZ;
235  else tag_id = anab::CosmicTagID_t::kGeometry_YZ;
236  }
237  else if( (nBdY+nBdZ)==1) {
238  isCosmic = 3 ;
239  if(nBdY==1) tag_id = anab::CosmicTagID_t::kGeometry_Y;
240  else if(nBdZ==1) tag_id = anab::CosmicTagID_t::kGeometry_Z;
241  }
242  }
243 
244  std::vector<float> endPt1;
245  std::vector<float> endPt2;
246  endPt1.push_back( trackEndPt1_X );
247  endPt1.push_back( trackEndPt1_Y );
248  endPt1.push_back( trackEndPt1_Z );
249  endPt2.push_back( trackEndPt2_X );
250  endPt2.push_back( trackEndPt2_Y );
251  endPt2.push_back( trackEndPt2_Z );
252 
253  float cosmicScore = isCosmic > 0 ? 1 : 0;
254  if( isCosmic==3 ) cosmicScore = 0.5;
255 
256 
258  // Doing a very basic check on X boundaries
259  // this gets the types of tracks that go through both X boundaries of the detector
260  if( fabs( trackEndPt1_X - trackEndPt2_X ) > fDetWidth-fTPCXBoundary ) {
261  cosmicScore = 1 ;
262  isCosmic = 4;
264  }
265 
266  /*
268  // Now check for X boundary
270  if( isCosmic==0 ) {
271  //anab::CosmicTag cctt = anab::CosmicTag(endPt1, endPt2, tag_id, isCosmic );
272  int nBdX =0;
273  float xBnd1 = -9999; //cctt.getXInteraction(endPt1[0], 2.0*fDetWidth, fReadOutWindowSize, trackTime, std::floor(tick1) );
274  float xBnd2 = -9999; //cctt.getXInteraction(endPt1[0], 2.0*fDetWidth, fReadOutWindowSize, trackTime, std::floor(tick2) );
275  if(xBnd1 < fTPCXBoundary || xBnd2 < fTPCXBoundary) nBdX++;
276  if( ( fDetWidth - xBnd1 < fTPCXBoundary ) || ( fDetWidth - xBnd1 < fTPCXBoundary ) ) nBdX++;
277  if( nBdX+nBdY+nBdZ>1 && 0 ) isCosmic = 3; // THIS ISN'T SETUP YET -- NEED A HANDLE TO TIME INFO
278  if( nBd >0 ) {isCosmic=3; cosmicScore = 0.5;}
279  }
280  */
281 
282  cosmicTagTrackVector->emplace_back( endPt1,
283  endPt2,
284  cosmicScore,
285  tag_id);
286 
287 // std::cerr << "The IsCosmic value is "<< isCosmic << " end pts "
288 // << trackEndPt1_X<<","<< trackEndPt1_Y << "," << trackEndPt1_Z<< " | | "
289 // << trackEndPt2_X<< ","<< trackEndPt2_Y <<"," << trackEndPt2_Z << std::endl;
290 
291  //outTracksForTags->push_back( *tTrack );
292 
293  util::CreateAssn(*this, e, *cosmicTagTrackVector, tTrack, *assnOutCosmicTagTrack );
294  //util::CreateAssn(*this, e, *cosmicTagTrackVector, HitVec, *assnOutCosmicTagHit);
295  }
296  // END OF LOOPING OVER INSPILL TRACKS
297 
298 
302  float dE=0, dS=0, temp=0, IScore=0;
303  unsigned int IndexE = 0, iTrk1=0, iTrk=0;
305 
306  for(iTrk=0; iTrk<Trk_h->size(); iTrk++ ){
307  art::Ptr<recob::Track> tTrk = TrkVec.at(iTrk);
308  if ((*cosmicTagTrackVector)[iTrk].CosmicScore()==0){
309  auto tStart = tTrk->Vertex();
310  auto tEnd = tTrk->End();
311  unsigned int l=0;
312  for(iTrk1=0; iTrk1<Trk_h->size(); iTrk1++ ){
313  art::Ptr<recob::Track> tTrk1 = TrkVec.at(iTrk1);
314  float getScore = (*cosmicTagTrackVector)[iTrk1].CosmicScore();
315  if (getScore == 1 || getScore == 0.5){
316  anab::CosmicTagID_t getType = (*cosmicTagTrackVector)[iTrk1].CosmicType();
317  auto tStart1 = tTrk1->Vertex();
318  auto tEnd1 = tTrk1->End();
319  auto NumE = (tEnd-tStart1).Cross(tEnd-tEnd1);
320  auto DenE = tEnd1-tStart1;
321  dE = NumE.R()/DenE.R();
322  if (l==0){
323  temp = dE;
324  IndexE = iTrk1;
325  IScore = getScore;
326  IType = getType;
327  }
328  if (dE<temp){
329  temp = dE;
330  IndexE = iTrk1;
331  IScore = getScore;
332  IType = getType;
333  }
334  l++;
335  }
336  }//End Trk1 loop
337  art::Ptr<recob::Track> tTrkI = TrkVec.at(IndexE);
338  auto tStartI = tTrkI->Vertex();
339  auto tEndI = tTrkI->End();
340  auto NumS = (tStart-tStartI).Cross(tStart-tEndI);
341  auto DenS = tEndI-tStartI;
342  dS = NumS.R()/DenS.R();
343  if (((dS<5 && temp<5) || (dS<temp && dS<5)) && (length(tTrk)<60)){
344  (*cosmicTagTrackVector)[iTrk].CosmicScore() = IScore-0.05;
345  (*cosmicTagTrackVector)[iTrk].CosmicType() = IType;
346  //util::CreateAssn(*this, e, *cosmicTagTrackVector, tTrk, *assnOutCosmicTagTrack, iTrk);
347  }
348  }//end cosmicScore==0 loop
349  }//end iTrk loop
350 
351  /*std::cout<<"\n"<<Trk_h->size()<<"\t"<<(*cosmicTagTrackVector).size();
352  for(unsigned int f=0;f<Trk_h->size();f++){
353  std::cout<<"\n\t"<<f<<"\t"<<(*cosmicTagTrackVector)[f].CosmicScore()<<"\t"<<(*cosmicTagTrackVector)[f].CosmicType();
354  }*/
355 
356  // e.put( std::move(outTracksForTags) );
357  e.put( std::move(cosmicTagTrackVector) );
358  e.put( std::move(assnOutCosmicTagTrack) );
359 
360  TrkVec.clear();
361 
362 } // end of produce
key_type key() const
Definition: Ptr.h:356
std::string getType(cet::LibraryManager const &, std::string const &)
double length(art::Ptr< recob::Track > track)
enum anab::cosmic_tag_id CosmicTagID_t
size_t NumberTrajectoryPoints() const
Various functions related to the presence and the number of (valid) points.
Definition: Track.h:105
ProductID put(std::unique_ptr< PROD > &&product)
Definition: Event.h:102
double Length(size_t p=0) const
Access to various track properties.
Definition: Track.h:170
Point_t const & Vertex() const
Access to track position at different points.
Definition: Track.h:127
bool CreateAssn(PRODUCER const &prod, art::Event &evt, std::vector< T > const &a, art::Ptr< U > const &b, art::Assns< U, T > &assn, std::string a_instance, size_t indx=UINT_MAX)
Creates a single one-to-one association.
int ID() const
Definition: Track.h:201
bool getByLabel(std::string const &label, std::string const &productInstanceName, Handle< PROD > &result) const
Definition: DataViewImpl.h:344
Point_t const & End() const
Access to track position at different points.
Definition: Track.h:128
void fill_ptr_vector(std::vector< Ptr< T >> &ptrs, H const &h)
Definition: Ptr.h:464
void cosmic::CosmicTrackTagger::reconfigure ( fhicl::ParameterSet const &  p)

Definition at line 376 of file CosmicTrackTagger_module.cc.

References fDetectorWidthTicks, fDetHalfHeight, fDetLength, fDetWidth, fEndTickPadding, fMaxTickDrift, fMinTickDrift, fTPCXBoundary, fTPCYBoundary, fTPCZBoundary, fTrackModuleLabel, and fhicl::ParameterSet::get().

Referenced by CosmicTrackTagger().

376  {
377  // Implementation of optional member function here.
378 
380  auto const* detp = lar::providerFrom<detinfo::DetectorPropertiesService>();
381  auto const* geo = lar::providerFrom<geo::Geometry>();
382  auto const* ts = lar::providerFrom<detinfo::DetectorClocksService>();
383 
384  fDetHalfHeight = geo->DetHalfHeight();
385  fDetWidth = 2.*geo->DetHalfWidth();
386  fDetLength = geo->DetLength();
387 
388  float fSamplingRate = detp->SamplingRate();
389 
390  fTrackModuleLabel = p.get< std::string >("TrackModuleLabel", "track");
391  fEndTickPadding = p.get< int >("EndTickPadding", 50);
392 
393  fTPCXBoundary = p.get< float >("TPCXBoundary", 5);
394  fTPCYBoundary = p.get< float >("TPCYBoundary", 5);
395  fTPCZBoundary = p.get< float >("TPCZBoundary", 5);
396 
397  const double driftVelocity = detp->DriftVelocity( detp->Efield(), detp->Temperature() ); // cm/us
398 
399  //std::cerr << "Drift velocity is " << driftVelocity << " cm/us. Sampling rate is: "<< fSamplingRate << " detector width: " << 2*geo->DetHalfWidth() << std::endl;
400  fDetectorWidthTicks = 2*geo->DetHalfWidth()/(driftVelocity*fSamplingRate/1000); // ~3200 for uB
401  fMinTickDrift = ts->Time2Tick(ts->TriggerTime());
403 }
Namespace collecting geometry-related classes utilities.
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

int cosmic::CosmicTrackTagger::fDetectorWidthTicks
private

Definition at line 89 of file CosmicTrackTagger_module.cc.

Referenced by reconfigure().

float cosmic::CosmicTrackTagger::fDetHalfHeight
private

Definition at line 91 of file CosmicTrackTagger_module.cc.

Referenced by produce(), and reconfigure().

float cosmic::CosmicTrackTagger::fDetLength
private

Definition at line 91 of file CosmicTrackTagger_module.cc.

Referenced by produce(), and reconfigure().

float cosmic::CosmicTrackTagger::fDetWidth
private

Definition at line 91 of file CosmicTrackTagger_module.cc.

Referenced by produce(), and reconfigure().

int cosmic::CosmicTrackTagger::fEndTickPadding
private

Definition at line 88 of file CosmicTrackTagger_module.cc.

Referenced by reconfigure().

int cosmic::CosmicTrackTagger::fMaxTickDrift
private

Definition at line 92 of file CosmicTrackTagger_module.cc.

Referenced by produce(), and reconfigure().

int cosmic::CosmicTrackTagger::fMinTickDrift
private

Definition at line 92 of file CosmicTrackTagger_module.cc.

Referenced by reconfigure().

float cosmic::CosmicTrackTagger::fTPCXBoundary
private

Definition at line 90 of file CosmicTrackTagger_module.cc.

Referenced by produce(), and reconfigure().

float cosmic::CosmicTrackTagger::fTPCYBoundary
private

Definition at line 90 of file CosmicTrackTagger_module.cc.

Referenced by produce(), and reconfigure().

float cosmic::CosmicTrackTagger::fTPCZBoundary
private

Definition at line 90 of file CosmicTrackTagger_module.cc.

Referenced by produce(), and reconfigure().

std::string cosmic::CosmicTrackTagger::fTrackModuleLabel
private

Definition at line 82 of file CosmicTrackTagger_module.cc.

Referenced by produce(), and reconfigure().


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