Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
align::AlignInspect Class Reference
Inheritance diagram for align::AlignInspect:
art::EDAnalyzer art::EventObserverBase art::Consumer art::EngineCreator

Public Types

using WorkerType = WorkerT< EDAnalyzer >
 
using ModuleType = EDAnalyzer
 

Public Member Functions

 AlignInspect (fhicl::ParameterSet const &pset)
 
virtual ~AlignInspect ()
 
void analyze (art::Event const &evt)
 
void reconfigure (const fhicl::ParameterSet &pset)
 
void beginJob ()
 
void endJob ()
 
std::string workerType () const
 
bool modifiesEvent () const
 
void registerProducts (MasterProductRegistry &, ProductDescriptions &, ModuleDescription const &)
 
std::string const & processName () const
 
bool wantAllEvents () const
 
bool wantEvent (Event const &e)
 
fhicl::ParameterSetID selectorConfig () const
 
art::Handle< art::TriggerResultsgetTriggerResults (Event const &e) 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 ()
 

Protected Member Functions

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

Private Member Functions

bool IsGoodTrack (art::Ptr< rb::Track > t, double x, double y, double z)
 yes/no is "track" entering within a buffer window More...
 

Private Attributes

std::string fCellHitsListLabel
 Where to find CellHit. More...
 
std::string fTrackLabel
 Where to find Tracks. More...
 
unsigned int fMuonNhit
 Required # hits on muon track. More...
 
unsigned int fMuonNhitX
 

required in x view

More...
 
unsigned int fMuonNhitY
 

required in y view

More...
 
double fDetEdgeBuffer
 Detector edge buffer zone for entering cosmic ray track decision [cm]. More...
 
unsigned int fNevents
 

Detailed Description

Definition at line 36 of file AlignInspect_module.cc.

Member Typedef Documentation

Definition at line 39 of file EDAnalyzer.h.

Definition at line 38 of file EDAnalyzer.h.

Constructor & Destructor Documentation

align::AlignInspect::AlignInspect ( fhicl::ParameterSet const &  pset)
explicit

Definition at line 69 of file AlignInspect_module.cc.

References reconfigure().

69  :
70  EDAnalyzer(pset),
71  fCellHitsListLabel(pset.get< std::string >("CellHitsListLabel")),
72  fTrackLabel (pset.get< std::string >("TrackLabel") ),
73  fMuonNhit (pset.get< unsigned int >("MuonNhit") ),
74  fMuonNhitX (pset.get< unsigned int >("MuonNhitX") ),
75  fMuonNhitY (pset.get< unsigned int >("MuonNhitY") ),
76  fDetEdgeBuffer (pset.get< double >("DetEdgeBuffer") ),
77  fNevents(0)
78  {
79  reconfigure(pset);
80  }
void reconfigure(const fhicl::ParameterSet &pset)
unsigned int fMuonNhitX
required in x view
unsigned int fMuonNhit
Required # hits on muon track.
EDAnalyzer(Table< Config > const &config)
Definition: EDAnalyzer.h:100
std::string fTrackLabel
Where to find Tracks.
double fDetEdgeBuffer
Detector edge buffer zone for entering cosmic ray track decision [cm].
unsigned int fMuonNhitY
required in y view
std::string fCellHitsListLabel
Where to find CellHit.
enum BeamMode string
align::AlignInspect::~AlignInspect ( )
virtual

Definition at line 83 of file AlignInspect_module.cc.

84  {
85  }

Member Function Documentation

void align::AlignInspect::analyze ( art::Event const &  evt)
virtual

Implements art::EDAnalyzer.

Definition at line 93 of file AlignInspect_module.cc.

References demo::app, ana::assert(), visualisationForPaperMasterPlot::cmap, daqchannelmap::DAQChannelMap::computeBlock(), daqchannelmap::DAQChannelMap::encodeLChan(), febshutoff_auto::end, allTimeWatchdog::endl, art::EventID::event(), rb::Cluster::ExtentPlane(), fMuonNhit, fMuonNhitX, fMuonNhitY, plot_validation_datamc::fname, fNevents, submit_syst::fout, fTrackLabel, geom(), art::DataViewImpl::getByLabel(), art::Event::id(), IsGoodTrack(), novadaq::cnv::kNDOS, LOG_DEBUG, cmap::dataprov::CMap::Map(), rb::Cluster::MaxTNS(), rb::Cluster::MinPlane(), rb::Cluster::MinTNS(), rb::Cluster::NCell(), rb::Cluster::NXCell(), rb::Cluster::NYCell(), febshutoff_auto::start, rb::Prong::Start(), rb::Track::Stop(), string, art::Event::subRun(), std::swap(), and track.

94  {
95  ++fNevents;
98 
99  // Get the tracks that were made by CosmicTrack
100  // and test that there are tracks in the event
102  evt.getByLabel(fTrackLabel,trks);
103  if (trks->size()==0) {
104  mf::LogWarning("AlignWarn") << "There are " << trks->size()
105  << " Tracks in this event, skip";
106  return;
107  }
108  LOG_DEBUG("AlignInspect") << "There are " << trks->size() << " Tracks in this event";
109 
110 
111  const unsigned int trkMax = trks->size();
112  //const unsigned int trkMax = 1;
113  if(trkMax < 2) return;
114  for(unsigned int trkIdx = 0; trkIdx < trkMax; ++trkIdx){
115  art::Ptr<rb::Track> track(trks, trkIdx);
116 
117  TVector3 start(track->Start());
118  TVector3 end(track->Stop());
119  if(end.Y() > start.Y()) std::swap(start, end);
120 
121  // Is this a good track?? i.e. entering and extends across at least 8 planes
122  if (this->IsGoodTrack(track,start.X(),start.Y(),start.Z()) == false) return;
123  assert(track->ExtentPlane() >= 8);
124 
125  const unsigned int hitMax = track->NCell(); // maximum number of CellHits on track
126  const unsigned int hitX = track->NXCell(); // maximum number of CellHits on track in XZ
127  const unsigned int hitY = track->NYCell(); // maximum number of CellHits on track in YZ
128 
129  // Do NOT select tracks if max number of hits or XZ- YZ-hits less than configurable values
130  if ( (hitMax < fMuonNhit) || (hitX < fMuonNhitX) || (hitY < fMuonNhitY) ) return;
131  assert(hitMax >= fMuonNhit);
132  const int detid = novadaq::cnv::kNDOS;
133  // Grab the block ID here from DAQChannelMap
134  daqchannelmap::lchan logchan = cmap->Map()->encodeLChan(detid, track->MinPlane(),1);
135  const int bID = cmap->Map()->computeBlock(logchan);
136  // std::cout << bID << ", plane: " << track->MinPlane() << ", det: " << detid << std::endl;
137  // write out track start/end positions and track index + event number, run number
138  // Note: hard-coded output directory an output names here!
139  std::ostringstream oss;
140  oss << "/nova/data/users/gsdavies/alignment/mc/inspect/blkshift10_" << evt.subRun() << ".txt";
141 
142  std::string fname(oss.str());
143  std::ofstream fout(fname.c_str(),std::ios::app);
144 
145  if(fout){
146  fout << evt.subRun() << " " << evt.id().event() << " " << trkIdx << " "
147  << bID << " " << start.X() << " " << start.Y() << " " << start.Z() << " "
148  << end.X() << " " << end.Y() << " " << end.Z() << " "
149  << track->MinTNS() << " " << track->MaxTNS() << std::endl;
150  }
151  fout.close();
152 
153  } // end for trkIdx
154 
155  return;
156  }
#define LOG_DEBUG(stream)
Definition: Messenger.h:149
Definition: event.h:19
unsigned int fMuonNhitX
required in x view
const daqchannelmap::DAQChannelMap * Map() const
Definition: CMap.h:57
lchan encodeLChan(int detId, plane_t plane, cell_t cell) const
void swap(art::HLTGlobalStatus &lhs, art::HLTGlobalStatus &rhs)
unsigned int fMuonNhit
Required # hits on muon track.
Prototype Near Detector on the surface at FNAL.
int evt
std::string fTrackLabel
Where to find Tracks.
bool IsGoodTrack(art::Ptr< rb::Track > t, double x, double y, double z)
yes/no is "track" entering within a buffer window
app
Definition: demo.py:189
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
void geom(int which=0)
Definition: geom.C:163
assert(nhit_max >=nhit_nbins)
virtual block_t computeBlock(lchan logicalchan) const =0
Which block is this lchan in?
Float_t track
Definition: plot.C:35
unsigned int fMuonNhitY
required in y view
enum BeamMode string
void align::AlignInspect::beginJob ( )
virtual

Reimplemented from art::EDAnalyzer.

Definition at line 88 of file AlignInspect_module.cc.

89  {
90  }
detail::CachedProducts& art::EventObserverBase::cachedProducts ( )
inlineprotectedinherited

Definition at line 79 of file EventObserverBase.h.

References art::EventObserverBase::selectors_.

80  {
81  return selectors_;
82  }
detail::CachedProducts selectors_
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::EDAnalyzer::currentContext ( ) const
protectedinherited
void align::AlignInspect::endJob ( )
virtual

Reimplemented from art::EDAnalyzer.

Definition at line 164 of file AlignInspect_module.cc.

165  {
166  }
seed_t art::EngineCreator::get_seed_value ( fhicl::ParameterSet const &  pset,
char const  key[] = "seed",
seed_t const  implicit_seed = -1 
)
inherited
art::Handle<art::TriggerResults> art::EventObserverBase::getTriggerResults ( Event const &  e) const
inlineinherited

Definition at line 61 of file EventObserverBase.h.

References art::detail::CachedProducts::getOneTriggerResults(), and art::EventObserverBase::selectors_.

62  {
64  }
detail::CachedProducts selectors_
art::Handle< art::TriggerResults > getOneTriggerResults(Event const &) const
Float_t e
Definition: plot.C:35
bool align::AlignInspect::IsGoodTrack ( art::Ptr< rb::Track t,
double  x,
double  y,
double  z 
)
private

yes/no is "track" entering within a buffer window

Definition at line 169 of file AlignInspect_module.cc.

References DEFINE_ART_MODULE(), geo::GeometryBase::DetHalfHeight(), geo::GeometryBase::DetHalfWidth(), geo::GeometryBase::DetLength(), rb::Cluster::ExtentPlane(), stan::math::fabs(), fDetEdgeBuffer, and geom().

Referenced by analyze().

170  {
172  if (t->ExtentPlane() >= 8) return true;
173  else return false;
174  if (y > geom->DetHalfHeight()-fDetEdgeBuffer) return true;
175  if (fabs(x) > geom->DetHalfWidth()-fDetEdgeBuffer) return true;
176  if (z < fDetEdgeBuffer) return true;
177  if (z > geom->DetLength()-fDetEdgeBuffer) return true;
178  return false;
179  }
fvar< T > fabs(const fvar< T > &x)
Definition: fabs.hpp:15
double DetLength() const
double DetHalfHeight() const
z
Definition: test.py:28
double DetHalfWidth() const
void geom(int which=0)
Definition: geom.C:163
unsigned int ExtentPlane(geo::View_t view=geo::kXorY) const
Definition: Cluster.h:250
double fDetEdgeBuffer
Detector edge buffer zone for entering cosmic ray track decision [cm].
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::EventObserverBase::modifiesEvent ( ) const
inlineinherited

Definition at line 25 of file EventObserverBase.h.

26  {
27  return false;
28  }
static cet::exempt_ptr<Consumer> art::Consumer::non_module_context ( )
staticinherited
void art::Consumer::prepareForJob ( fhicl::ParameterSet const &  pset)
protectedinherited
std::string const& art::EventObserverBase::processName ( ) const
inlineinherited
void align::AlignInspect::reconfigure ( const fhicl::ParameterSet pset)

Definition at line 159 of file AlignInspect_module.cc.

Referenced by AlignInspect().

160  {
161  }
void art::EventObserverBase::registerProducts ( MasterProductRegistry ,
ProductDescriptions ,
ModuleDescription const &   
)
inlineinherited

Definition at line 33 of file EventObserverBase.h.

References string.

36  {}
fhicl::ParameterSetID art::EventObserverBase::selectorConfig ( ) const
inlineinherited

Definition at line 56 of file EventObserverBase.h.

References art::EventObserverBase::selector_config_id_.

57  {
58  return selector_config_id_;
59  }
fhicl::ParameterSetID selector_config_id_
void art::Consumer::showMissingConsumes ( ) const
protectedinherited

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

void art::Consumer::validateConsumedProduct ( BranchType const  bt,
ProductInfo const &  pi 
)
protectedinherited
bool art::EventObserverBase::wantAllEvents ( ) const
inlineinherited

Definition at line 46 of file EventObserverBase.h.

References art::EventObserverBase::wantAllEvents_.

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

47  {
48  return wantAllEvents_;
49  }
bool art::EventObserverBase::wantEvent ( Event const &  e)
inlineinherited

Definition at line 51 of file EventObserverBase.h.

References art::EventObserverBase::selectors_, and art::detail::CachedProducts::wantEvent().

52  {
53  return selectors_.wantEvent(e);
54  }
detail::CachedProducts selectors_
Float_t e
Definition: plot.C:35
bool wantEvent(Event const &)
std::string art::EDAnalyzer::workerType ( ) const
inlineinherited

Definition at line 109 of file EDAnalyzer.h.

References art::EDAnalyzer::currentContext().

110  {
111  return "WorkerT<EDAnalyzer>";
112  }

Member Data Documentation

std::string align::AlignInspect::fCellHitsListLabel
private

Where to find CellHit.

Definition at line 54 of file AlignInspect_module.cc.

double align::AlignInspect::fDetEdgeBuffer
private

Detector edge buffer zone for entering cosmic ray track decision [cm].

Definition at line 60 of file AlignInspect_module.cc.

Referenced by IsGoodTrack().

unsigned int align::AlignInspect::fMuonNhit
private

Required # hits on muon track.

Definition at line 57 of file AlignInspect_module.cc.

Referenced by analyze().

unsigned int align::AlignInspect::fMuonNhitX
private

required in x view

Definition at line 58 of file AlignInspect_module.cc.

Referenced by analyze().

unsigned int align::AlignInspect::fMuonNhitY
private

required in y view

Definition at line 59 of file AlignInspect_module.cc.

Referenced by analyze().

unsigned int align::AlignInspect::fNevents
private

Definition at line 61 of file AlignInspect_module.cc.

Referenced by analyze().

std::string align::AlignInspect::fTrackLabel
private

Where to find Tracks.

Definition at line 55 of file AlignInspect_module.cc.

Referenced by analyze().


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