5 #include <det/Detector.h>
6 #include <sdet/SDetector.h>
7 #include <fdet/FDetector.h>
9 #include <fdet/Telescope.h>
10 #include <fdet/Pixel.h>
11 #include <atm/OverallQualityDB.h>
12 #include <atm/ProfileResult.h>
13 #include <atm/MolecularDB.h>
14 #include <atm/GOESDB.h>
15 #include <atm/MolecularZone.h>
16 #include <atm/Atmosphere.h>
17 #include <atm/LidarDB.h>
18 #include <atm/LidarZone.h>
20 #include <fwk/CoordinateSystemRegistry.h>
22 #include <evt/Event.h>
23 #include <sevt/SEvent.h>
25 #include <fevt/Telescope.h>
26 #include <fevt/Pixel.h>
27 #include <fevt/FEvent.h>
29 #include <utl/CoordinateSystemPtr.h>
30 #include <utl/ErrorLogger.h>
31 #include <utl/Point.h>
32 #include <utl/PhysicalConstants.h>
34 #include <adst/Detector.h>
35 #include <adst/RecEvent.h>
36 #include <adst/FdLidarData.h>
37 #include <adst/FdCloudCameraData.h>
38 #include <adst/FdAerosols.h>
45 #include <mdet/MDetector.h>
46 #include <mevt/MEvent.h>
85 const Atmosphere& atm = det::Detector::GetInstance().GetAtmosphere();
94 WARNING(augerException.GetExceptionName() +
", " +
96 detector.ClearCloudMap();
104 const det::Detector& detector = det::Detector::GetInstance();
108 TBits stationBits(1600);
120 const int sId = sIt->GetId();
124 theDet.SetDenseStation(sId, p.X(), p.Y(), p.Z());
131 stationBits.SetBitNumber(sId,
true);
141 const mdet::MDetector& mDet = det::Detector::GetInstance().GetMDetector();
142 const CoordinateSystemPtr cs = det::Detector::GetInstance().GetReferenceCoordinateSystem();
147 const int cId = mIt->GetId();
151 theDet.SetDenseStation(cId, p.X(), p.Y(), p.Z());
158 stationBits.SetBitNumber(cId,
true);
165 TBits eyeBits = TBits(10);
167 const bool hasFdConfig =
171 const Atmosphere& theAtm = det::Detector::GetInstance().GetAtmosphere();
181 const unsigned int thisEyeId = iEye->GetId();
184 theDet.SetVAODAtReferenceHeight(
192 INFO(
"VAOD at reference not set!!!");
196 if (
GetConfig().AerosolAttenuationLengthSampling() > 0)
199 eyeBits.SetBitNumber(thisEyeId,
true);
204 theDet.SetFDSDTimeOffset (thisEyeId, sd_offset);
212 const unsigned int thisTelId = (
unsigned int)iTel->GetId();
213 daqBits.SetBitNumber(thisTelId,
true);
219 iPix != iTel->PixelsEnd(ComponentSelector::eExists); ++iPix) {
221 const unsigned int pixelId = iPix->
GetId();
224 theDet.AddMismatchedPixel(thisEyeId, thisTelId, pixelId);
226 if (iPix->GetStatus() == ComponentSelector::eDeSelected ||
227 iPix->GetStatus() == ComponentSelector::eBadCalibration)
228 theDet.AddBadPixel(thisEyeId, thisTelId, pixelId);
233 theDet.SetMirrorsInDAQ(thisEyeId, daqBits);
238 stationBits.Compact();
239 theDet.SetActiveStations(stationBits);
240 theDet.SetActiveEyes(eyeBits);
242 const fdet::FDetector& fdDet = det::Detector::GetInstance().GetFDetector();
248 teliter != eyeiter->TelescopesEnd(); ++teliter) {
249 if (teliter->HasCorrectorRing())
250 corrBits.SetBitNumber(teliter->GetId(),
true);
252 theDet.SetPointingId(eyeiter->GetId(), teliter->GetId(), teliter->GetTelescopePointingId());
255 theDet.SetCorrectorRingStatus(eyeiter->GetId(),corrBits);
259 int lastEventGPSSecond = 0;
264 const Atmosphere& theAtm = det::Detector::GetInstance().GetAtmosphere();
266 const int kTimeInterval = 30*60;
267 if (
abs(lastEventGPSSecond - newTime) >= kTimeInterval) {
269 theDet.SetTemperaturePressureGPSSeconds(lastEventGPSSecond);
272 zIt != molWeather.
ZonesEnd(); ++zIt) {
274 lIt != zIt->LayersEnd(); ++lIt) {
275 if (lIt->GetTemperature()) {
276 theDet.SetPressure(lIt->GetPressure()/
bar);
277 theDet.SetTemperature(lIt->GetTemperature());
278 theDet.SetHasWeatherStationData();
284 if (theDet.HasWeatherStationData())
288 if (!theDet.HasWeatherStationData()) {
291 theDet.SetTemperature(temp.
Y(1412*
meter));
292 theDet.SetPressure(pressure.
Y(1412*
meter)/
bar);
309 det::Detector::GetInstance().GetAtmosphere().EvaluateDepthVsHeight();
310 double maxHeight = depthProfile.
MaxX();
311 double minHeight = depthProfile.
MinX();
313 theDet.SetHasOverallQualityDatabase();
314 theDet.SetQDBHorizontalUniformity(qDBHorizonalUniformity);
315 theDet.SetQDBCloudCoverage(qDBCloudCoverage);
316 const double h = qDBMinCloudBase*
m;
317 theDet.SetQDBMinCloudBaseHeight(h);
319 theDet.SetQDBMinCloudBaseDepth(depthProfile.
Y(maxHeight)/
g*
cm2);
320 else if (h <= minHeight)
321 theDet.SetQDBMinCloudBaseDepth(depthProfile.
Y(minHeight)/
g*
cm2);
323 theDet.SetQDBMinCloudBaseDepth(depthProfile.
Y(h)/
g*
cm2);
325 WARNING(augerException.GetExceptionName() +
", " +
327 theDet.SetQDBMinCloudBaseHeight(-1);
328 theDet.SetQDBMinCloudBaseDepth(-1);
329 theDet.SetQDBHorizontalUniformity(-1);
330 theDet.SetQDBCloudCoverage(-1);
333 theDet.SetQDBMinCloudBaseHeight(-1);
334 theDet.SetQDBMinCloudBaseDepth(-1);
335 theDet.SetQDBHorizontalUniformity(-1);
336 theDet.SetQDBCloudCoverage(-1);
344 const Atmosphere& theAtm = det::Detector::GetInstance().GetAtmosphere();
350 const string lidarZoneName = zIt->GetName();
351 const double lidarCloudCoverage = zIt->GetCloudCoverage();
352 double lidarCloudHeight = zIt->GetLowestCloudHeight();
353 double lidarCloudThickness = zIt->GetLowestCloudThickness();
354 double lidarCloudVAOD = zIt->GetLowestCloudVAOD();
356 const double lidarRange = -1;
359 double cosZenith = -1;
360 double lidarCloudDepth = -1;
361 double lidarCloudSlantThickness = -1;
363 int hottestEye = theRecEvent.GetHottestEyeId();
364 if (hottestEye && theRecEvent.GetEye(hottestEye).GetRecLevel() > eHasAxis)
365 cosZenith = theRecEvent.GetEye(hottestEye).GetFdRecShower().GetCosZenith();
367 if (theRecEvent.GetSDEvent().HasAxis())
368 cosZenith = theRecEvent.GetSDEvent().GetSdRecShower().GetCosZenith();
373 det::Detector::GetInstance().GetAtmosphere().EvaluateDepthVsHeight();
374 double maxHeight = depthProfile.
MaxX();
375 double minHeight = depthProfile.
MinX();
377 if (!lidarCloudCoverage) {
379 lidarCloudHeight = maxHeight;
380 lidarCloudThickness = 0;
384 double lidarCloudMax = lidarCloudHeight+lidarCloudThickness;
385 double lidarCloudSlantMax = -1.;
387 if (lidarCloudHeight >= maxHeight)
388 lidarCloudDepth = depthProfile.
Y(maxHeight)/
g*
cm2;
389 else if (lidarCloudHeight<= minHeight)
390 lidarCloudDepth = depthProfile.
Y(minHeight)/
g*
cm2;
392 lidarCloudDepth = depthProfile.
Y(lidarCloudHeight)/
g*
cm2;
394 if (lidarCloudMax >= maxHeight)
395 lidarCloudSlantMax = depthProfile.
Y(maxHeight)/
g*
cm2;
396 else if (lidarCloudMax <= minHeight)
397 lidarCloudSlantMax = depthProfile.
Y(minHeight)/
g*
cm2;
399 lidarCloudSlantMax = depthProfile.
Y(lidarCloudMax)/
g*
cm2;
402 double CloudDepthSlant = lidarCloudDepth/cosZenith;
403 lidarCloudSlantMax /= cosZenith;
404 if (lidarCloudSlantMax < CloudDepthSlant)
405 lidarCloudSlantThickness = CloudDepthSlant - lidarCloudSlantMax;
409 if (lidarZoneName ==
"Los Leones")
411 else if (lidarZoneName ==
"Los Morados")
413 else if (lidarZoneName ==
"Loma Amarilla")
415 else if (lidarZoneName ==
"Coihueco")
418 FdLidarData thisLidarData(lidarCloudCoverage, lidarCloudHeight,
419 lidarCloudDepth, lidarCloudThickness,
420 lidarCloudSlantThickness, lidarCloudVAOD,
422 theRecEvent.GetDetector().SetLidarData(lidarZoneID, thisLidarData);
427 WARNING(
"Exception retrieving lidar info.");
434 Detector& adstDetector)
436 const FDetector& theFDet = det::Detector::GetInstance().GetFDetector();
443 iEye != theEvent.
GetFEvent().
EyesEnd(ComponentSelector::eHasData); ++iEye) {
445 const unsigned int thisEyeId = iEye->GetId();
446 FdCloudCameraData thisCloudCameraData;
450 iTel != iEye->TelescopesEnd(ComponentSelector::eHasData); ++iTel) {
452 const unsigned int thisTelId = iTel->GetId();
465 thisCloudCameraData.SetCloudFraction(thisTelId, pixelId, cloudFraction);
468 if (!thisCloudCameraData.IsEmpty())
469 adstDetector.SetCloudCameraData(thisEyeId, thisCloudCameraData);
487 const double maxHeightRelEye = 20000*
meter - eyeHeight;
492 vector<double> heights;
493 vector<double> attenuationLengths;
494 double heightRelEye = 0;
495 while (heightRelEye < maxHeightRelEye) {
496 const Point samplePoint(0, 0, heightRelEye, eyeCS);
498 const double attLength =
501 heights.push_back(heightRelEye + eyeHeight);
502 attenuationLengths.push_back(attLength);
504 heightRelEye += stepSize;
507 FdAerosols aerosolData;
508 aerosolData.SetMieAttenuationLength(attenuationLengths);
509 aerosolData.SetMieAttenuationHeight(heights);
511 theDet.SetAerosolData(thisEyeId, aerosolData);
bool UseWeatherStations() const
boost::transform_iterator< InternalZoneFunctor, InternalZoneIterator, const LidarZone & > ZoneIterator
ZoneIterator returns a pointer to an LidarZone.
Top of the interface to Atmosphere information.
InternalCounterCollection::ComponentConstIterator CounterConstIterator
StationIterator StationsEnd()
End of all stations.
CounterConstIterator CountersBegin() const
boost::transform_iterator< InternalZoneFunctor, InternalZoneIterator, const MolecularZone & > ZoneIterator
ZoneIterator returns a pointer to a MolecularZone.
mevt::MEvent & GetMEvent()
Base class for all exceptions used in the auger offline code.
evt::Header & GetHeader()
Detector description interface for GOES cloud data.
boost::filter_iterator< ComponentSelector, ConstAllEyeIterator > ConstEyeIterator
unsigned int GetFirstPixelId() const
Interface class to access to the SD part of an event.
const OverallQualityDB & GetOverallQualityDB() const
low-level interface to portion of the database summarizing overall quality
const atm::ProfileResult & EvaluatePressureVsHeight() const
Tabulated function giving Y=air pressure as a function of X=height.
bool HasCloudFraction() const
void Convert(const evt::Event &event, RecEvent &recEvent)
EyeIterator EyesEnd(const ComponentSelector::Status status)
ZoneIterator ZonesEnd() const
End of the collection of valid Zones.
ZoneIterator ZonesEnd() const
End of the collection of valid Zones.
double LaserWavelength() const
#define INFO(message)
Macro for logging informational messages.
Detector description interface for data in the Atm_Molecular database.
utl::Point GetPosition() const
const Eye & GetEye(const unsigned int eyeId) const
Find eye by numerical Id.
EyeIterator EyesBegin(const FDetComponentSelector::Type type=FDetComponentSelector::ePhysical) const
iterator pointing to first eye of given type (ePhysical, eVirtual, eAll)
Detector description interface for Eye-related data.
void FillGOESData(Detector &det)
Detector associated to muon detector hierarchy.
Detector description interface for FDetector-related data.
void FillAerosols(const unsigned int thisEyeId, Detector &det)
double Y(const double x) const
Get the Y value (coordinate) for given X (ordinate)
utl::Point GetPosition() const
Tank position.
const Pixel & GetPixel(const unsigned int pixelId) const
Get Pixel by id, throw utl::NonExistentComponentException if n.a.
const atm::Atmosphere & GetAtmosphere() const
boost::shared_ptr< const CoordinateTransformer > CoordinateSystemPtr
Shared pointer for coordinate systems.
unsigned int GetLastPixelId() const
Reference ellipsoids for UTM transformations.
double GetCloudProbability(const unsigned int pixelId) const
Get cloud probability from the pixel id.
boost::filter_iterator< FDetComponentSelector, AllEyeIterator > EyeIterator
unsigned int GetChannelId() const
const GOESDB & GetGOESDB() const
low-level interface to the cloud information from the GOES database
utl::CoordinateSystemPtr GetEyeCoordinateSystem() const
Returns the Eye Coordinate system.
Class describing the Atmospheric profile.
double abs(const SVector< n, T > &v)
Converts an Offline event to ADST.
const Telescope & GetTelescope(const unsigned int telescopeId) const
Find Telescope by numerical Id.
Top of the hierarchy of the detector description interface.
const sdet::SDetector & GetSDetector() const
EyeIterator EyesBegin(const ComponentSelector::Status status)
Triple PointToLatitudeLongitudeHeight(const Point &thePoint) const
Convert Point to Lat/Long/Height.
const MolecularDB & GetMolecularDB(const MolecularIds::ProfileId &id) const
Low-level interface to portion of the database with molecular information.
double GetMieAttenuationLength(const utl::Point &xA, const double wLength) const
boost::filter_iterator< ComponentSelector, ConstAllPixelIterator > ConstPixelIterator
const fdet::FDetector & GetFDetector() const
unsigned int GetNumberOfPixels() const
void FillCloudCameraData(const evt::Event &event, Detector &det)
#define WARNING(message)
Macro for logging warning messages.
double GetMinCloudBase() const
Top of Fluorescence Detector event hierarchy.
double GetInterval() const
Get the time interval as a double (in Auger base units)
double AerosolAttenuationLengthSampling() const
ZoneIterator ZonesBegin() const
Beginning of the collection of valid Zones.
boost::filter_iterator< TelIsCommissioned, InternalConstTelescopeIterator > TelescopeIterator
An iterator over telescopes.
fevt::FEvent & GetFEvent()
bool StoreLidarData() const
const utl::TimeInterval & GetSDTimeOffset() const
Time Offset of this eye with respect to SD.
float GetCloudFraction() const
how much of pixel is obscured by clouds
Detector description interface for Telescope-related data.
double MinX() const
Return the minimum value for X (ordinate) stored in the profile.
boost::indirect_iterator< InternalLayerIterator, const MolecularLayer & > LayerIterator
Layer iterator returns a pointer to the molecular data slice for this zone.
unsigned long GetGPSSecond() const
GPS second.
int StoreGOESData() const
Detector description interface for LidarDB-realted data.
StationIterator StationsBegin()
Beginning of all stations.
void FillDetector(const evt::Event &theEvent, Detector &det)
utl::CoordinateSystemPtr GetReferenceCoordinateSystem() const
Get the reference coordinate system used for analysis (usually PampaAmarilla for Auger) ...
bool IsDense() const
Tells whether the station belongs to set of hypothetical "dense" stations.
Detector description interface for SDetector-related data.
double GetVerticalAerosolOpticalDepth(const unsigned int eyeId, const double altitude=4.5 *utl::km) const
Retrieve vertical optical depth at some location and altitude.
const Config & GetConfig() const
CounterConstIterator CountersEnd() const
double GetCloudCoverage() const
utl::CoordinateSystemPtr Get(const std::string &id)
Get a well-known Coordinate System.
bool HasData(const unsigned int pixelId) const
Check if cloud probability data exists for a given pixel at the current time.
Access to database describing overall atmospheric quality.
TVector3 ToTVector3(const T &v, const utl::CoordinateSystemPtr &cs, const double unit=1)
int StoreCloudCameraData() const
const Station & GetStation(const int stationId) const
Get station by Station Id.
const Counter & GetCounter(int id) const
Retrieve Counter by id.
boost::indirect_iterator< InternalConstStationIterator, const Station & > ConstStationIterator
#define ERROR(message)
Macro for logging error messages.
sevt::SEvent & GetSEvent()
Root of the Muon event hierarchy.
void FillLidarData(RecEvent &recEvent)
unsigned int GetId() const
boost::filter_iterator< ComponentSelector, ConstAllTelescopeIterator > ConstTelescopeIterator
const std::string & GetMessage() const
Retrieve the message from the exception.
utl::Point GetPosition() const
Eye position.
const atm::ProfileResult & EvaluateTemperatureVsHeight() const
Tabulated function giving Y=temperature as a function of X=height.
const LidarDB & GetLidarDB() const
low-level interface to portion of the database with cloud data from lidar analysis ...
double MaxX() const
Return the maximum value for X (ordinate) stored in the profile.
double GetHorizontalUniformity() const
ZoneIterator ZonesBegin() const
Beginning of the collection of valid Zones.
EyeIterator EyesEnd(const FDetComponentSelector::Type type=FDetComponentSelector::ePhysical) const
iterator pointing to end of available eyes of given type (ePhysical, eVirtual, eAll) ...