ReadCloudLL.cc
Go to the documentation of this file.
1 #include <iomanip>
2 #include <sstream>
3 using namespace std;
4 
5 #include <evt/Event.h>
6 using namespace evt;
7 
8 #include <det/Detector.h>
9 using namespace det;
10 
11 #include <fdet/FDetector.h>
12 #include <fdet/Eye.h>
13 #include <fdet/Telescope.h>
14 #include <fdet/Pixel.h>
15 using namespace fdet;
16 
17 #include <utl/ErrorLogger.h>
18 #include <utl/TimeStamp.h>
19 using namespace utl;
20 
21 #include "ReadCloudLL.h"
22 using namespace ReadCloudLLNS;
23 using namespace fwk;
24 
25 
26 ReadCloudLL::ReadCloudLL()
27 {
28 }
29 
30 
31 ReadCloudLL::~ReadCloudLL()
32 {
33 }
34 
35 
38 {
39  INFO("ReadCloudLL::Init()");
40  return eSuccess;
41 }
42 
43 
45 ReadCloudLL::Run(evt::Event& /*event*/)
46 {
47  INFO("ReadCloudLL::Run()");
48 
49  // Set detector time to something .
50  Detector& det = Detector::GetInstance();
51  TimeStamp time(881911814);
52  det.Update(time);
53 
54  try {
55  // Get an fdet::Pixel and output its coverage (same syntax for fevt::Pixel).
56  const Eye& eye = det.GetFDetector().GetEye(1);
57  const Pixel& pixel = eye.GetTelescope(1).GetPixel(2);
58 
59  if ( ! pixel.HasCloudFraction() ) {
60  ostringstream err;
61  err << " no cloud fraction for pixel "
62  << pixel.GetId()
63  << " eye: " << pixel.GetEyeId()
64  << " tel:" << pixel.GetTelescopeId();
65  ERROR(err.str());
66  return eFailure;
67  }
68 
69  float coverage = pixel.GetCloudFraction();
70  cout << "\nCLOUD FRACTION = " << coverage << "%"
71  << " for Pixel " << pixel.GetId()
72  << " in Eye " << pixel.GetEyeId()
73  << ", Telescope " << pixel.GetTelescopeId()
74  << endl;
75 
76  // Output the coverage data for a full site.
77  int eyeId = eye.GetId();
78  cout << "\nEYE: " << eyeId << endl;
79 
80  for (unsigned int telId = eye.GetFirstTelescopeId(); telId <=
81  eye.GetLastTelescopeId(); ++telId) {
82 
83  const Telescope& telescope = eye.GetTelescope(telId);
84  cout << "\nTELESCOPE: " << telId << endl;
85 
86  for (unsigned int pixId = telescope.GetFirstPixelId();
87  pixId <= telescope.GetLastPixelId(); ++pixId) {
88 
89  const Pixel& detPixel = telescope.GetPixel(pixId);
90  if ( detPixel.HasCloudFraction() ) {
91 
92  coverage = detPixel.GetCloudFraction();
93 
94  cout << setw(3) << coverage;
95  if (pixId % 20 == 0)
96  cout << endl;
97 
98  }
99  }
100  }
101  }
102  catch (const AugerException& e) {
103  ERROR(e.GetMessage());
104  }
105 
106  return eSuccess;
107 }
108 
109 
111 ReadCloudLL::Finish()
112 {
113  INFO("ReadCloudLL::Finish()");
114  return eSuccess;
115 }
116 
unsigned int GetId() const
By default from 1..440.
void Update(const utl::TimeStamp &time, const bool invData=true, const bool invComp=true, const bool forceRadio=false)
Update detector: deletes currently constructed stations and sets new time.
Definition: Detector.cc:179
unsigned int GetTelescopeId() const
1..6 for normal FD, 1..3 for HEAT
Base class for all exceptions used in the auger offline code.
unsigned int GetFirstPixelId() const
bool HasCloudFraction() const
#define INFO(message)
Macro for logging informational messages.
Definition: ErrorLogger.h:161
void Init()
Initialise the registry.
const Eye & GetEye(const unsigned int eyeId) const
Find eye by numerical Id.
Definition: FDetector.cc:68
Detector description interface for Eye-related data.
Definition: FDetector/Eye.h:45
unsigned int GetFirstTelescopeId() const
First telescope id in the eye.
A TimeStamp holds GPS second and nanosecond for some event.
Definition: TimeStamp.h:110
const Pixel & GetPixel(const unsigned int pixelId) const
Get Pixel by id, throw utl::NonExistentComponentException if n.a.
unsigned int GetLastPixelId() const
const Telescope & GetTelescope(const unsigned int telescopeId) const
Find Telescope by numerical Id.
Top of the hierarchy of the detector description interface.
Definition: Detector.h:81
unsigned int GetId() const
Eye numerical Id.
const fdet::FDetector & GetFDetector() const
Definition: Detector.cc:131
float GetCloudFraction() const
how much of pixel is obscured by clouds
Detector description interface for Telescope-related data.
ResultFlag
Flag returned by module methods to the RunController.
Definition: VModule.h:60
Description of a pixel.
unsigned int GetLastTelescopeId() const
Last telescope id in the eye.
#define ERROR(message)
Macro for logging error messages.
Definition: ErrorLogger.h:165
const std::string & GetMessage() const
Retrieve the message from the exception.
unsigned int GetEyeId() const
1..5 (4x normal FD, 1x HEAT)

, generated on Tue Sep 26 2023.