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

Public Types

using WorkerType = WorkerT< EDAnalyzer >
 
using ModuleType = EDAnalyzer
 

Public Member Functions

 MoonShadowAna (fhicl::ParameterSet const &p)
 
virtual ~MoonShadowAna ()
 
void analyze (art::Event const &e) override
 
void beginJob () override
 
TVector3 vec (double zen, double azi)
 
double GetDot (double zen1, double azi1, double zen2, double azi2) const
 
TVector3 AnglesToVector (double zen, double azi) const
 
void InitLookupTable ()
 
double GetAngularPrescale (double zen1, double azi1, double zen2, double azi2)
 
bool GetAngularPrescaleDecision (double zen1, double azi1, double zen2, double azi2)
 
double GetRate (double zen, double azi)
 
double GetSmartPrescale (double zen1, double azi1, double zen2, double azi2)
 
double GetSmartPrescale (double zen, double azi)
 
bool GetSmartPrescaleDecision (double prescale)
 
void GetHisto (std::string filename, int xmax, int ymax, TH2D *hist)
 
std::string FindSmartPrescaleLookup () const
 
void WriteEventInfo (const art::Event &event)
 
void WriteTrackInfo (const rb::Track &track, long timeStart)
 
void WriteHitListInfo (const art::PtrVector< rb::CellHit > hlist, long timeStart, TVector3 start, TVector3 end)
 
int GetX (art::Ptr< rb::CellHit > h, TVector3 start, TVector3 end)
 
int GetY (art::Ptr< rb::CellHit > h, TVector3 start, TVector3 end)
 
TVector3 GetDetVec (TVector3 vec) const
 
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 Attributes

TNtuple * fNtuple
 
std::string fTrackModuleLabel
 
art::ServiceHandle< locator::CelestialLocatorloc
 
TH2D * rate_collected_angular
 
int bin_size
 
const double fDotCut = cos(5*M_PI/180)
 
double max_rate
 
double angular_stdev
 
std::string fLookupFile
 
std::ofstream fOutputEvd
 
bool init
 

Detailed Description

Definition at line 75 of file MoonShadowAna_module.cc.

Member Typedef Documentation

Definition at line 39 of file EDAnalyzer.h.

Definition at line 38 of file EDAnalyzer.h.

Constructor & Destructor Documentation

moonshadowana::MoonShadowAna::MoonShadowAna ( fhicl::ParameterSet const &  p)
explicit

Definition at line 126 of file MoonShadowAna_module.cc.

References bin_size, init, and InitLookupTable().

127  : EDAnalyzer (p)
128  , fTrackModuleLabel (p.get<std::string>("TrackModuleLabel")),
129  max_rate(p.get<double>("AvgRate")),
130  angular_stdev(p.get<double>("AngularSuppression")),
132 {
133  InitLookupTable();
134  bin_size = 1;
135 
136  init = false;
137 
138  //fOutputEvd.open("OFFEvd_Data.txt");
139 }
const char * p
Definition: xmltok.h:285
EDAnalyzer(Table< Config > const &config)
Definition: EDAnalyzer.h:100
std::string FindSmartPrescaleLookup() const
enum BeamMode string
moonshadowana::MoonShadowAna::~MoonShadowAna ( )
virtual

Definition at line 141 of file MoonShadowAna_module.cc.

References fOutputEvd.

142 {
143 fOutputEvd.close();
144 }

Member Function Documentation

void moonshadowana::MoonShadowAna::analyze ( art::Event const &  e)
overridevirtual

Implements art::EDAnalyzer.

Definition at line 260 of file MoonShadowAna_module.cc.

References std::acos(), std::atan2(), dir, febshutoff_auto::end, art::Event::event(), fNtuple, fTrackModuleLabel, GetAngularPrescale(), art::DataViewImpl::getByLabel(), locator::CelestialLocator::GetMoonPosition_FD(), GetSmartPrescale(), locator::CelestialLocator::GetSunPosition_FD(), rb::Cluster::Is2D(), loc, M_PI, rb::Cluster::NCell(), febshutoff_auto::start, rb::Prong::Start(), rb::Track::Stop(), std::swap(), art::Event::time(), art::Timestamp::timeHigh(), rb::Track::TotalLength(), Unit(), vars, vec(), void(), and WriteEventInfo().

260  {
261 
262  if(e.event() == 486130)
263  WriteEventInfo(e);
264 
265  //fOutputEvd << "E " << e.event() << std::endl;
266  art::Timestamp ts = e.time();
267  time_t timeSec = ts.timeHigh();
268  // std::cout<<"timeSec "<<timeSec<<std::endl;
269 
270  double zen_moon, azi_moon, zen_sun, azi_sun;
271  loc->GetMoonPosition_FD(timeSec,zen_moon, azi_moon);
272  loc->GetSunPosition_FD(timeSec,zen_sun, azi_sun);
273 
275  e.getByLabel(fTrackModuleLabel, "", tracks);
276 
277  // float vars[10];
278  float vars[9];
279  vars[0] = zen_moon; // zen_moon
280  vars[1] = azi_moon; // azi_moon
281 
282  double smartPrescale = GetSmartPrescale(zen_moon, azi_moon, zen_sun, azi_sun);
283 
284  double zen_trk, azi_trk, cos_trk_moon, cos_trk_sun;
285  for(unsigned int trkIdx = 0; trkIdx < tracks->size(); ++trkIdx){
286  const rb::Track& trk = (*tracks)[trkIdx];
287  if(trk.Is2D())continue;
288 
289  //const TVector3 dir = (trk.Start().Y() > trk.Stop().Y()) ? -trk.Dir() : trk.StopDir();
290 
291  TVector3 start = trk.Start();
292  TVector3 end = trk.Stop();
293  if(start.Y() < end.Y()) std::swap(start, end);
294  const TVector3 dir = (start-end).Unit();
295 
296  // test print out params of the track
297  //std::cout << "Track #" << trkIdx << std::endl;
298  //std::cout << start.X() << "," << start.Y() << "," << start.Z() << " || ";
299  //std::cout << end.X() << "," << end.Y() << "," << end.Z() << std::endl;
300 
301  zen_trk = acos(dir.Y()) * 180 / M_PI;
302  azi_trk = atan2(-dir.X(), dir.Z()) * 180 / M_PI + 332.066111;
303  if(azi_trk < 0) azi_trk += 360;
304  if(azi_trk > 360) azi_trk -= 360;
305 
306  cos_trk_moon = vec(zen_moon, azi_moon).Dot(vec(zen_trk,azi_trk));
307  cos_trk_sun = vec(zen_sun, azi_sun).Dot(vec(zen_trk,azi_trk));
308  (void)cos_trk_sun; // Suppress unused variable warning
309 
310  vars[2] = zen_trk; // zen_trk
311  vars[3] = azi_trk; // azi_trk
312  vars[4] = trk.NCell(); // nhit
313  vars[5] = trk.TotalLength(); // len
314  vars[6] = cos_trk_moon; // cosine angle trk and moon
315 
316  double angularPrescale = GetAngularPrescale(zen_moon, azi_moon, zen_trk, azi_trk);
317 
318  vars[7] = smartPrescale;
319  vars[8] = angularPrescale;
320 
321  /*if(true)//cos_trk_moon > cos(5*3.14159/180))
322  {
323  fOutputEvd << "T " << "(" << start.X() << "," << start.Y() << "," << start.Z() << ") ";
324  fOutputEvd << "(" << end.X() << "," << end.Y() << "," << end.Z() << ") ";
325  fOutputEvd << std::endl;
326  }*/
327 
328  fNtuple->Fill(vars);
329  }
330 
331 }
unsigned int NCell(geo::View_t view) const
Number of cells in view view.
Definition: Cluster.cxx:134
bool Is2D() const
Definition: Cluster.h:96
void GetMoonPosition_FD(time_t time, double &zen, double &azi)
constexpr std::uint32_t timeHigh() const
Definition: Timestamp.h:35
A rb::Prong with full reconstructed trajectory.
Definition: Track.h:20
virtual TVector3 Start() const
Definition: Prong.h:73
void WriteEventInfo(const art::Event &event)
T acos(T number)
Definition: d0nt_math.hpp:54
#define M_PI
Definition: SbMath.h:34
void swap(art::HLTGlobalStatus &lhs, art::HLTGlobalStatus &rhs)
virtual double TotalLength() const
Length (cm) of all the track segments.
Definition: Track.cxx:213
Track finder for cosmic rays.
art::ServiceHandle< locator::CelestialLocator > loc
const std::map< std::pair< std::string, std::string >, Variable > vars
void GetSunPosition_FD(time_t time, double &zen, double &azi)
TVector3 Unit() const
double GetSmartPrescale(double zen1, double azi1, double zen2, double azi2)
TDirectory * dir
Definition: macro.C:5
TVector3 vec(double zen, double azi)
TVector3 Stop() const
Position of the final trajectory point.
Definition: Track.cxx:186
Float_t e
Definition: plot.C:35
typedef void(XMLCALL *XML_ElementDeclHandler)(void *userData
T atan2(T number)
Definition: d0nt_math.hpp:72
double GetAngularPrescale(double zen1, double azi1, double zen2, double azi2)
TVector3 moonshadowana::MoonShadowAna::AnglesToVector ( double  zen,
double  azi 
) const
void moonshadowana::MoonShadowAna::beginJob ( )
overridevirtual

Reimplemented from art::EDAnalyzer.

Definition at line 146 of file MoonShadowAna_module.cc.

References fNtuple, and art::TFileDirectory::make().

147 {
149  fNtuple = tfs->make<TNtuple>("moon_ntuple", "Moon Shadow Ntuple", "zen_moon:azi_moon:zen_trk:azi_trk:nhit:len:dot:smart_pre:ang_pre");
150 }
T * make(ARGS...args) const
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
std::string moonshadowana::MoonShadowAna::FindSmartPrescaleLookup ( ) const

Definition at line 439 of file MoonShadowAna_module.cc.

References ana::assert(), DEFINE_ART_MODULE(), cet::search_path::find_file(), and string.

440 {
441  cet::search_path sp("FW_SEARCH_PATH");
442  std::string lookupFname;
443  sp.find_file(("Eval/PrescaleLookup.txt"), lookupFname);
444  assert(!lookupFname.empty());
445  return lookupFname;
446 }
assert(nhit_max >=nhit_nbins)
enum BeamMode string
seed_t art::EngineCreator::get_seed_value ( fhicl::ParameterSet const &  pset,
char const  key[] = "seed",
seed_t const  implicit_seed = -1 
)
inherited
double moonshadowana::MoonShadowAna::GetAngularPrescale ( double  zen1,
double  azi1,
double  zen2,
double  azi2 
)

Definition at line 351 of file MoonShadowAna_module.cc.

References std::acos(), angular_stdev, stan::math::exp(), GetDot(), and M_PI.

Referenced by analyze(), and GetAngularPrescaleDecision().

352  {
353  double dTheta = acos(GetDot(zen1, azi1, zen2, azi2)) * 180 / M_PI;
354  return exp(-dTheta*dTheta/(angular_stdev*angular_stdev));
355  }
T acos(T number)
Definition: d0nt_math.hpp:54
#define M_PI
Definition: SbMath.h:34
double GetDot(double zen1, double azi1, double zen2, double azi2) const
fvar< T > exp(const fvar< T > &x)
Definition: exp.hpp:10
bool moonshadowana::MoonShadowAna::GetAngularPrescaleDecision ( double  zen1,
double  azi1,
double  zen2,
double  azi2 
)

Definition at line 356 of file MoonShadowAna_module.cc.

References GetAngularPrescale(), r(), and central_limit::rand.

357  {
358  double prescale = GetAngularPrescale(zen1, azi1, zen2, azi2);
359 
360  double r = (double)rand() / (double)RAND_MAX;
361 
362  return r < prescale;
363  }
TRandom3 r(0)
double GetAngularPrescale(double zen1, double azi1, double zen2, double azi2)
TVector3 moonshadowana::MoonShadowAna::GetDetVec ( TVector3  vec) const

Definition at line 251 of file MoonShadowAna_module.cc.

References moonshadowana::CELL_WIDTH, makeTrainCVSamples::int, moonshadowana::N_CELLS, moonshadowana::PLANE_WIDTH, submit_syst::x, submit_syst::y, and test::z.

Referenced by WriteTrackInfo().

252 {
253  int x = int((vec.X() + CELL_WIDTH * N_CELLS /2) / CELL_WIDTH);
254  int y = int((vec.Y() + CELL_WIDTH * N_CELLS /2) / CELL_WIDTH);
255  int z = int(vec.Z() / PLANE_WIDTH);
256 
257  return TVector3(x,y,z);
258 }
const double CELL_WIDTH
const unsigned N_CELLS
const double PLANE_WIDTH
Eigen::VectorXd vec
z
Definition: test.py:28
double moonshadowana::MoonShadowAna::GetDot ( double  zen1,
double  azi1,
double  zen2,
double  azi2 
) const

Definition at line 424 of file MoonShadowAna_module.cc.

References std::cos(), stan::math::dot(), M_PI, and std::sin().

Referenced by GetAngularPrescale().

425  {
426  if(zen1 == zen2 && azi1 == azi2)
427  return 1;
428 
429  zen1 *= M_PI / 180;
430  zen2 *= M_PI / 180;
431  azi1 *= M_PI / 180;
432  azi2 *= M_PI / 180;
433  double dot = sin(zen1)*cos(azi1)*sin(zen2)*cos(azi2) + sin(zen1)*sin(azi1)*sin(zen2)*sin(azi2) + cos(zen1)*cos(zen2);
434 
435  return dot;
436  }
#define M_PI
Definition: SbMath.h:34
double dot(const std::vector< double > &x, const std::vector< double > &y)
Definition: dot.hpp:10
T sin(T number)
Definition: d0nt_math.hpp:132
T cos(T number)
Definition: d0nt_math.hpp:78
void moonshadowana::MoonShadowAna::GetHisto ( std::string  filename,
int  xmax,
int  ymax,
TH2D *  hist 
)

Definition at line 377 of file MoonShadowAna_module.cc.

References MECModelEnuComparisons::i, calib::j, art::TFileDirectory::make(), febshutoff_auto::val, xmax, and ymax.

Referenced by InitLookupTable().

378 {
379  std::ifstream data;
380  data.open(filename.c_str());
381  for(int j=0; j<ymax;j++)
382  {
383  for(int i=0; i<xmax; i++)
384  {
385  double val;
386  data >> val;
387  hist->SetBinContent(i,j, val);
388  }
389  }
391  TH2D* htmp = tfs->make<TH2D>("LookupPrescale_stored", "", 360, 0, 360, 90, 0, 90);
392  htmp = (TH2D*)hist->Clone();
393  htmp->Write();
394  data.close();
395 }
std::map< std::string, double > xmax
string filename
Definition: shutoffs.py:106
const XML_Char const XML_Char * data
Definition: expat.h:268
Double_t ymax
Definition: plot.C:25
const double j
Definition: BetheBloch.cxx:29
T * make(ARGS...args) const
double moonshadowana::MoonShadowAna::GetRate ( double  zen,
double  azi 
)

Definition at line 339 of file MoonShadowAna_module.cc.

References bin_size, rate_collected_angular, and stan::math::round().

Referenced by GetSmartPrescale().

340  {
341  if(zen > 90)
342  return 0;
343  // Smart prescale is ratio of maximal rate to expected rate divided by angular prescale factor for given position
344  int bin_azi = round(azi/bin_size);
345  int bin_zen = round(zen/bin_size);
346 
347  //return 0;
348  return rate_collected_angular->GetBinContent(bin_azi, bin_zen);
349  }
fvar< T > round(const fvar< T > &x)
Definition: round.hpp:23
double moonshadowana::MoonShadowAna::GetSmartPrescale ( double  zen1,
double  azi1,
double  zen2,
double  azi2 
)

Definition at line 397 of file MoonShadowAna_module.cc.

References GetRate(), and max_rate.

Referenced by analyze().

398  {
399  double rate1 = GetRate(zen1, azi1);
400  double rate2 = GetRate(zen2, azi2);
401 
402  if(rate1 == 0 && rate2 == 0)
403  return 0;
404 
405  return max_rate / (rate1 + rate2);
406  }
double GetRate(double zen, double azi)
double moonshadowana::MoonShadowAna::GetSmartPrescale ( double  zen,
double  azi 
)

Definition at line 407 of file MoonShadowAna_module.cc.

References GetRate(), and max_rate.

408  {
409  double rate = GetRate(zen, azi);
410 
411  if(rate == 0)
412  return 0;
413 
414  return max_rate / rate;
415  }
double GetRate(double zen, double azi)
bool moonshadowana::MoonShadowAna::GetSmartPrescaleDecision ( double  prescale)

Definition at line 417 of file MoonShadowAna_module.cc.

References r(), and central_limit::rand.

418  {
419  // Is it good enough for small prescale factors ~1/100?
420  double r = (double)rand() / (double)RAND_MAX;
421  return r < prescale;
422  }
TRandom3 r(0)
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
int moonshadowana::MoonShadowAna::GetX ( art::Ptr< rb::CellHit h,
TVector3  start,
TVector3  end 
)

Definition at line 224 of file MoonShadowAna_module.cc.

References rb::CellHit::Plane(), stan::math::round(), submit_syst::x, and test::z.

Referenced by WriteHitListInfo().

225 {
226  int z = h->Plane();
227 
228  double xSpread = end.X() - start.X();
229  double zSpread = end.Z() - start.Z();
230 
231  double zSpreadLoc = z - start.Z();
232 
233  double x = start.X() + xSpread * zSpreadLoc/zSpread;
234 
235  return round(x);
236 }
unsigned short Plane() const
Definition: CellHit.h:39
fvar< T > round(const fvar< T > &x)
Definition: round.hpp:23
z
Definition: test.py:28
int moonshadowana::MoonShadowAna::GetY ( art::Ptr< rb::CellHit h,
TVector3  start,
TVector3  end 
)

Definition at line 237 of file MoonShadowAna_module.cc.

References rb::CellHit::Plane(), stan::math::round(), submit_syst::y, and test::z.

Referenced by WriteHitListInfo().

238 {
239  int z = h->Plane();
240 
241  double ySpread = end.Y() - start.Y();
242  double zSpread = end.Z() - start.Z();
243 
244  double zSpreadLoc = z - start.Z();
245 
246  double y = start.Y() + ySpread * zSpreadLoc/zSpread;
247 
248  return round(y);
249 }
unsigned short Plane() const
Definition: CellHit.h:39
fvar< T > round(const fvar< T > &x)
Definition: round.hpp:23
z
Definition: test.py:28
void moonshadowana::MoonShadowAna::InitLookupTable ( )

Definition at line 365 of file MoonShadowAna_module.cc.

References fLookupFile, GetHisto(), and rate_collected_angular.

Referenced by MoonShadowAna().

366  {
367  // Init lookup table and make 2d hist with expected rate
368  // Get histogram with full rates in 2degx2deg bins
369  int azi_max = 360;
370  int zen_max = 90;
371 
372  rate_collected_angular = new TH2D("LookupPrescale", "", azi_max, 0, 360, zen_max, 0, 90);
373 
374  GetHisto(fLookupFile, azi_max, zen_max, rate_collected_angular);
375  }
void GetHisto(std::string filename, int xmax, int ymax, TH2D *hist)
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 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
TVector3 moonshadowana::MoonShadowAna::vec ( double  zen,
double  azi 
)

Definition at line 333 of file MoonShadowAna_module.cc.

References std::cos(), M_PI, and std::sin().

Referenced by analyze().

333  {
334  zen *= M_PI / 180;
335  azi *= M_PI / 180;
336  return TVector3(sin(zen)*cos(azi), sin(zen)*sin(azi), cos(zen));
337 }
#define M_PI
Definition: SbMath.h:34
T sin(T number)
Definition: d0nt_math.hpp:132
T cos(T number)
Definition: d0nt_math.hpp:78
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  }
void moonshadowana::MoonShadowAna::WriteEventInfo ( const art::Event event)

Definition at line 153 of file MoonShadowAna_module.cc.

References allTimeWatchdog::endl, fOutputEvd, fTrackModuleLabel, init, rb::Cluster::Is2D(), art::Event::run(), string, art::Event::subRun(), art::Event::time(), art::Timestamp::timeHigh(), art::to_string(), and WriteTrackInfo().

Referenced by analyze().

154 {
155  if(!init)
156  {
157  fOutputEvd.open(std::string("OFFEvd_Data_") + std::string(std::to_string(event.run())) + std::string("_") + std::string(std::to_string(event.subRun())) + std::string(".txt"));
158  init = true;
159  }
160 
161  // Event info
162  fOutputEvd << "E " << event.event() << " ";
163  fOutputEvd << event.time().timeHigh() << std::endl;
164 
165  // Tracks
167  event.getByLabel(fTrackModuleLabel, "", tracks);
168 
169  for(unsigned int trkIdx = 0; trkIdx < tracks->size(); ++trkIdx)
170  {
171  const rb::Track& trk = (*tracks)[trkIdx];
172  if(trk.Is2D())continue;
173 
174 
175 
176  WriteTrackInfo(trk, event.time().timeHigh());
177  }
178 }
SubRunNumber_t subRun() const
Definition: Event.h:72
bool Is2D() const
Definition: Cluster.h:96
constexpr std::uint32_t timeHigh() const
Definition: Timestamp.h:35
A rb::Prong with full reconstructed trajectory.
Definition: Track.h:20
Track finder for cosmic rays.
Timestamp time() const
Definition: Event.h:61
std::string to_string(ModuleType mt)
Definition: ModuleType.h:32
RunNumber_t run() const
Definition: Event.h:77
void WriteTrackInfo(const rb::Track &track, long timeStart)
enum BeamMode string
void moonshadowana::MoonShadowAna::WriteHitListInfo ( const art::PtrVector< rb::CellHit hlist,
long  timeStart,
TVector3  start,
TVector3  end 
)

Definition at line 206 of file MoonShadowAna_module.cc.

References art::PtrVector< T >::at(), rb::CellHit::Cell(), allTimeWatchdog::endl, fOutputEvd, GetX(), GetY(), make_syst_table_plots::h, makeTrainCVSamples::int, calib::j, rb::CellHit::Plane(), art::PtrVector< T >::size(), rawdata::RawDigit::TDC(), POTSpillRate::view, and rb::CellHit::View().

Referenced by WriteTrackInfo().

207 {
208  for (size_t j=0; j < hlist.size(); ++j) {
209  art::Ptr<rb::CellHit> h = hlist.at(j);
210 
211  if(j != 0)
212  fOutputEvd << ",";
213 
214  int view = (int)h->View();
215  fOutputEvd << ((long)h->TDC())/64 << "/";
216  fOutputEvd << (view == 0 ? (int)h->Cell() : GetX(h, start, end)) << "/";
217  fOutputEvd << (view == 1 ? (int)h->Cell() : GetY(h, start, end)) << "/";
218  fOutputEvd << (int)h->Plane() << "/";
219  fOutputEvd << view + 1;
220  }
221 
223 }
int GetX(art::Ptr< rb::CellHit > h, TVector3 start, TVector3 end)
int GetY(art::Ptr< rb::CellHit > h, TVector3 start, TVector3 end)
int32_t TDC() const
The time of the last baseline sample.
Definition: RawDigit.h:94
unsigned short Plane() const
Definition: CellHit.h:39
geo::View_t View() const
Definition: CellHit.h:41
unsigned short Cell() const
Definition: CellHit.h:40
const double j
Definition: BetheBloch.cxx:29
reference at(size_type n)
Definition: PtrVector.h:365
size_type size() const
Definition: PtrVector.h:308
void moonshadowana::MoonShadowAna::WriteTrackInfo ( const rb::Track track,
long  timeStart 
)

Definition at line 180 of file MoonShadowAna_module.cc.

References rb::Cluster::AllCells(), febshutoff_auto::end, allTimeWatchdog::endl, fOutputEvd, GetDetVec(), febshutoff_auto::start, rb::Prong::Start(), rb::Track::Stop(), std::swap(), and WriteHitListInfo().

Referenced by WriteEventInfo().

181 {
182  TVector3 start = GetDetVec(track.Start());
183  TVector3 end = GetDetVec(track.Stop());
184  if(start.Y() < end.Y()) std::swap(start, end); // all tracks are down-going
185 
186  //Check whether 3D track vector makes sense
187  if(
188  (start.X() == 0 && end.X() == 0) ||
189  (start.Y() == 0 && end.Y() == 0) ||
190  (start.Z() == 0 && end.Z() == 0))
191  {
192  return;
193  }
194 
195  // Track info
196  fOutputEvd << "T ";
197  fOutputEvd << "(" << start.X() << "," << start.Y() << "," << start.Z() << ") ";
198  fOutputEvd << "(" << end.X() << "," << end.Y() << "," << end.Z() << ")";
200 
201  art::PtrVector<rb::CellHit> hlist = track.AllCells();
202 
203  WriteHitListInfo(hlist, timeStart, start, end);
204 
205 }
virtual TVector3 Start() const
Definition: Prong.h:73
art::PtrVector< rb::CellHit > AllCells() const
Get all cells from both views.
Definition: Cluster.cxx:180
void swap(art::HLTGlobalStatus &lhs, art::HLTGlobalStatus &rhs)
TVector3 GetDetVec(TVector3 vec) const
TVector3 Stop() const
Position of the final trajectory point.
Definition: Track.cxx:186
void WriteHitListInfo(const art::PtrVector< rb::CellHit > hlist, long timeStart, TVector3 start, TVector3 end)

Member Data Documentation

double moonshadowana::MoonShadowAna::angular_stdev
private

Definition at line 117 of file MoonShadowAna_module.cc.

Referenced by GetAngularPrescale().

int moonshadowana::MoonShadowAna::bin_size
private

Definition at line 110 of file MoonShadowAna_module.cc.

Referenced by GetRate(), and MoonShadowAna().

const double moonshadowana::MoonShadowAna::fDotCut = cos(5*M_PI/180)
private

Definition at line 113 of file MoonShadowAna_module.cc.

std::string moonshadowana::MoonShadowAna::fLookupFile
private

Definition at line 119 of file MoonShadowAna_module.cc.

Referenced by InitLookupTable().

TNtuple* moonshadowana::MoonShadowAna::fNtuple
private

Definition at line 105 of file MoonShadowAna_module.cc.

Referenced by analyze(), and beginJob().

std::ofstream moonshadowana::MoonShadowAna::fOutputEvd
private
std::string moonshadowana::MoonShadowAna::fTrackModuleLabel
private

Definition at line 106 of file MoonShadowAna_module.cc.

Referenced by analyze(), and WriteEventInfo().

bool moonshadowana::MoonShadowAna::init
private
art::ServiceHandle<locator::CelestialLocator> moonshadowana::MoonShadowAna::loc
private

Definition at line 107 of file MoonShadowAna_module.cc.

Referenced by analyze().

double moonshadowana::MoonShadowAna::max_rate
private

Definition at line 115 of file MoonShadowAna_module.cc.

Referenced by GetSmartPrescale().

TH2D* moonshadowana::MoonShadowAna::rate_collected_angular
private

Definition at line 109 of file MoonShadowAna_module.cc.

Referenced by GetRate(), and InitLookupTable().


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