Offline2ADST.cc
Go to the documentation of this file.
1 #include <utl/config.h>
2 
3 #include "Offline2ADST.h"
4 #include "ConversionUtil.h"
5 
6 #include <adst/RecEvent.h>
7 #include <adst/DetectorGeometry.h>
8 #include <adst/FileInfo.h>
9 #include <adst/GenShower.h>
10 #include <adst/GenParticle.h>
11 
12 #include <det/Detector.h> // DON'T USE NAMESPACE det !!!!!!
13 
14 #include <sdet/SDetector.h>
15 
16 #include <fdet/FDetector.h>
17 #include <fdet/Pixel.h>
18 #include <fdet/Eye.h>
19 #include <fdet/Camera.h>
20 #include <fdet/Telescope.h>
21 
22 #include <atm/Atmosphere.h>
23 #include <atm/InclinedAtmosphericProfile.h>
24 #include <atm/ProfileResult.h>
25 #include <atm/GOESDB.h>
26 
27 #include <evt/Event.h>
28 #include <evt/ShowerSimData.h>
29 #include <evt/GenParticle.h>
30 #include <evt/RadioSimulation.h>
31 #include <fevt/FEvent.h>
32 #include <fevt/Eye.h>
33 #include <fevt/Telescope.h>
34 
35 #include <fwk/CentralConfig.h>
36 #include <fwk/CoordinateSystemRegistry.h>
37 
38 #include <utl/Branch.h>
39 #include <utl/ErrorLogger.h>
40 #include <utl/UTCDateTime.h>
41 #include <utl/TimeStamp.h>
42 #include <utl/ModifiedJulianDate.h>
43 #include <utl/MathConstants.h>
44 #include <utl/ReferenceEllipsoid.h>
45 #include <utl/AugerUnits.h>
46 #include <utl/Point.h>
47 #include <utl/Vector.h>
48 #include <utl/UTMPoint.h>
49 #include <utl/Transformation.h>
50 #include <utl/Trace.h>
51 #include <utl/AugerUnits.h>
52 #include <utl/MathConstants.h>
53 #include <utl/PhysicalConstants.h>
54 #include <utl/PhysicalFunctions.h>
55 #include <evt/VGaisserHillasParameter.h>
56 #include <utl/config.h>
57 #include <utl/Particle.h>
58 #include <utl/CoordinateSystemPtr.h>
59 
60 #include <iostream>
61 #include <string>
62 #include <limits>
63 #include <unistd.h>
64 
65 #include "SD2ADST.h"
66 #include "FD2ADST.h"
67 #include "Detector2ADST.h"
68 #include "ErrorPropagation.h"
69 
70 #include <mdet/MDetector.h>
71 #include <mdet/Counter.h>
72 #include "MD2ADST.h"
73 
74 #include <adst/RdEvent.h>
75 #include <adst/RdTrace.h>
76 #include <evt/ShowerRecData.h>
77 #include "RdFiller.h"
78 
79 using namespace std;
80 using namespace otoa;
81 using namespace utl;
82 
83 
84 Offline2ADST::Offline2ADST(const otoa::Config& cfg) :
85  fConfig(cfg)
86 { }
87 
88 
89 bool
90 Offline2ADST::Convert(const evt::Event& event, RecEvent& recEvent)
91 {
92  const auto& fDet = det::Detector::GetInstance().GetFDetector();
93  const bool hasFdConfig = (fDet.EyesBegin() != fDet.EyesEnd());
94 
95  recEvent = RecEvent(); // Clear
96  fStatus = otoa::Status(event); // reset conversion status
98 
99  FillGlobalInfo(event, recEvent);
100 
101  if (fConfig.WriteSD() && event.HasSEvent()) {
102  INFO("Convert SD");
103  SD2ADST(Config()).Convert(event, recEvent);
104  }
105 
106  if (fConfig.WriteFD() && event.HasFEvent() && hasFdConfig) {
107  INFO("Convert FD");
108  FD2ADST(*this, fStatus).Convert(event, recEvent);
109  }
110 
111  if (event.HasMEvent()) {
112  INFO("Convert MD");
113  MD2ADST(Config()).Convert(event, recEvent);
114  }
115 
116  if (event.HasSimShower()) {
117  bool saveProfiles = true;
119  saveProfiles = recEvent.GetNEyes() > 0 || recEvent.GetSDEvent().GetRecLevel() > 0;
120  FillSim(event, recEvent.GetGenShower(), saveProfiles);
121  }
122 
123  if (!Config().DropUntriggeredDetector() ||
124  recEvent.GetNEyes() > 0 ||
125  recEvent.GetSDEvent().GetRecLevel() > 0) {
126  INFO("Convert Detector");
127  Detector2ADST(Config()).Convert(event, recEvent);
128  }
129 
130  FillRadio(event, recEvent);
131 
133 
134  return true;
135 }
136 
137 
138 void
139 Offline2ADST::FillRadio(const evt::Event& event, RecEvent& recEvent)
140 {
141  if (!event.HasREvent())
142  return;
143 
144  const int storeRadioLevel = fConfig.StoreRadioLevel();
145  if (storeRadioLevel < 0)
146  return;
147 
148  INFO("Convert RD");
149 
150  const bool storeStationTraces = storeRadioLevel >= 1;
151  const bool storeChannelTraces = storeRadioLevel >= 2;
152  const bool storeExcludedStations = fConfig.StoreExcludedRdStations();
153 
154  const auto& rev = event.GetREvent();
155 
156  RdFiller rfiller;
157  rfiller.AddRadioDetector(det::Detector::GetInstance(), recEvent.GetDetector());
158  rfiller.FillRadioEventInfo(rev);
159  if (event.HasRecShower() && event.GetRecShower().HasRRecShower())
160  rfiller.FillRadioShower(event);
161  rfiller.FillRadioStations(event, storeStationTraces, storeExcludedStations);
162  rfiller.FillSimRadioStations(event);
163  rfiller.FillRadioChannels(rev, storeChannelTraces, storeExcludedStations);
164 
165  recEvent.GetRdEvent() = rfiller.GetRdEvent();
166 }
167 
168 
169 void
171 {
172  // Fill the FileInfo
173  FileInfo& info = GetFileInfo();
174 
175  switch (fConfig.StoreSDTraces()) {
176  case 2:
177  info.SetHasSdAllTraces();
178  // fall through
179  case 1:
180  info.SetHasVEMTraces();
181  break;
182  default:
183  break;
184  };
185 
186  // above code does not work if SdHorizontalReconstruction is used
187  info.SetLDFType(eTabulated);
188 
189  if (fStatus.IsMCEvent()) // FIXME this should be done once per event
190  info.SetHasMC();
191 
192  switch (fConfig.StoreFDTraces()) {
193  case 2:
194  info.SetHasFdSpotRecTraces();
195  // fall through
196  case 1:
197  info.SetHasFdTraces();
198  break;
199  default:
200  break;
201  };
202 
203  const unsigned int hostLen = 80;
204  char host[hostLen+1] = { '\0' }; // +1 = ensure zero termination when hostname is long/truncated
205  gethostname(host, hostLen);
206 
207  info.SetOfflineVersion(OFFLINE_PACKAGE_VERSION); // from Offline utl/config.h
208  info.SetHost(host);
209  //info.SetHost(getenv("HOSTNAME"));
210  info.SetUser(getenv("USER") ? getenv("USER") : "unknown");
211 
213  info.SetOfflineConfiguration(cc->GetConfig());
214 
215  ostringstream recEventVersion;
216  recEventVersion << RecEvent::GetReleaseName() << ' ' << RecEvent::GetVersion()
217  << " (SVN: " << RecEvent::GetSVNVersion() << " rev "<< RecEvent::GetSVNRevision() << ')';
218  info.SetRecEventVersion(recEventVersion.str());
219 
221 
222  const CoordinateSystemPtr referenceCS = det::Detector::GetInstance().GetReferenceCoordinateSystem();
223 
224  const sdet::SDetector& sdDetector = det::Detector::GetInstance().GetSDetector();
225  const DetectorGeometry::StationPosMap& adstStations = fDetectorGeometry.GetStations();
226 
227  for (const auto& station : sdDetector.AllStationsRange()) {
228 
229  if (station.IsDense())
230  continue;
231 
232  const int id = station.GetId();
233 
234  // Fill only new stations
235  // Note: It may be more reasonable to prefer newer information over older,
236  // but an attempt to implement that was thwarted by an "overwriting" warning
237  // in the DetectorGeometry.
238  if (adstStations.find(id) != adstStations.end())
239  continue;
240 
241  TVector3 pos;
242 
243  try {
244  pos = ToTVector3(station.GetPosition(), referenceCS, meter);
246  WARNING("Station position information cannot be read from SDetector. "
247  "Probably this station is handled by the EventStationPositionsManager"
248  "that is already shut down at this stage ... "
249  "Station position will be set to 0,0,0.");
250  }
251  int gridType = 0;
252  const int partners = station.GetNumberOfPartners();
253  if (station.IsInGrid(sdet::SDetectorConstants::eInfill750))
254  gridType |= eInfill;
255  if (station.IsInGrid())
256  gridType |= eRegularArray;
257  if (partners == 1)
258  gridType |= eDoublet;
259  if (partners == 2)
260  gridType |= eTriplet;
261 
262  fDetectorGeometry.SetStation(id, pos.X()/m, pos.Y()/m, pos.Z()/m, gridType);
263 
264  TString name = "unknown";
265  try {
266  name = station.GetName();
268  WARNING("Station name information cannot be read from SDetector. "
269  "Probably this station is handled by the EventStationPositionsManager"
270  "that is already shut down at this stage ... "
271  "Station name will be set to \"unknown\".");
272  }
273  fDetectorGeometry.SetStationName(id, name);
274  }
275 
276  if (fConfig.StoreRadioLevel() >= 0)
277  RdFiller::AddRadioDetectorGeometry(det::Detector::GetInstance(), &fDetectorGeometry);
278 }
279 
280 
281 void
282 Offline2ADST::FillGlobalInfo(const evt::Event& event, RecEvent& recEvent)
283 {
284  recEvent.SetEventId(event.GetHeader().GetId());
285  const auto& ts = event.GetHeader().GetTime();
286  const int yymmdd = otoa::TimeStamp2YYMMDD(ts);
287  const int hhmmss = otoa::TimeStamp2HHMMSS(ts);
288  recEvent.SetYYMMDD(yymmdd);
289  recEvent.SetHHMMSS(hhmmss);
290  recEvent.SetMJD(ModifiedJulianDate(ts));
291 }
292 
293 
294 void
296 {
297  const auto referenceCS = det::Detector::GetInstance().GetReferenceCoordinateSystem();
298  const auto& fdDetector = det::Detector::GetInstance().GetFDetector();
299 
300  for (auto eyeiter = fdDetector.EyesBegin(fdet::FDetComponentSelector::eAll),
301  end = fdDetector.EyesEnd(fdet::FDetComponentSelector::eAll); eyeiter != end; ++eyeiter) {
302 
303  const auto& eyeCS = eyeiter->GetEyeCoordinateSystem();
304  const auto eyeId = eyeiter->GetId();
305 
306  if (!fDetectorGeometry.HasEye(eyeId)) {
307  const auto pos = ToTVector3(eyeiter->GetPosition(), referenceCS, meter);
308  const Vector vertEye(0,0,1, eyeCS);
309  const double phiEye = vertEye.GetPhi(referenceCS);
310  const double thetaEye = vertEye.GetTheta(referenceCS);
311  const Vector backVec(1,0,0, eyeCS);
312  double backwallAngle = atan2(backVec.GetY(referenceCS), backVec.GetX(referenceCS));
313  if (backwallAngle > kTwoPi)
314  backwallAngle -= kTwoPi;
315  if (backwallAngle < 0)
316  backwallAngle += kTwoPi;
317 
318  fDetectorGeometry.SetEye(eyeId,
319  pos.X()/m, pos.Y()/m, pos.Z()/m,
320  backwallAngle,
321  phiEye, thetaEye,
322  eyeiter->GetName(),
323  eyeiter->GetNameAbbr());
324  }
325 
326  auto& eyeGeo = fDetectorGeometry.GetEye(eyeId);
327  for (auto teliter = eyeiter->TelescopesBegin(), end = eyeiter->TelescopesEnd();
328  teliter != end; ++teliter) {
329  const int telId = teliter->GetId();
330 
331  if (!eyeGeo.HasTelescope(telId)) {
332  // Add empty containers by default, waiting for the incremental filling
333  map<TString, Double_t> adstTelPPhi;
334  map<TString, Double_t> adstTelPElevation;
335  map<TString, TelescopeGeometry::PixelList_t> pixelPhi;
336  map<TString, TelescopeGeometry::PixelList_t> pixelOmega;
337  fDetectorGeometry.SetTelescope(eyeId, telId,
338  adstTelPPhi, adstTelPElevation,
339  teliter->GetCamera().GetFADCTraceLength(),
340  teliter->GetCamera().GetFADCBinSize(),
341  pixelPhi, pixelOmega);
342  }
343 
344  const unsigned int firstpixelid = teliter->GetFirstPixelId();
345  const unsigned int lastpixelid = teliter->GetLastPixelId();
346 
347  const TString curPointingId = TString(teliter->GetTelescopePointingId());
348  auto& telGeo = eyeGeo.GetTelescope(telId);
349  auto& solidAngles = telGeo.GetSolidAngles();
350  if (solidAngles.empty())
351  for (unsigned int i = firstpixelid; i <= lastpixelid; ++i)
352  solidAngles.push_back(teliter->GetPixel(i).GetSolidAngle());
353 
354  if (!telGeo.HasPointing(curPointingId)) {
355  // Get the telescope pointing
356  const Double_t elevation = kPi/2 - teliter->GetAxis().GetTheta(eyeCS);
357  const Double_t azimuth = teliter->GetAxis().GetPhi(eyeCS);
358  TelescopeGeometry::PixelList_t pixelPhi(lastpixelid - firstpixelid + 1);
359  TelescopeGeometry::PixelList_t pixelOmega(lastpixelid - firstpixelid + 1);
360  for (unsigned int i = firstpixelid; i <= lastpixelid; ++i) {
361  const auto& detpixel = teliter->GetPixel(i);
362  const auto& dir = detpixel.GetDirection();
363  const double theta = dir.GetTheta(eyeCS) / utl::degree;
364  double phi = dir.GetPhi(eyeCS) / utl::degree;
365  if (phi < -60)
366  phi += 360;
367 
368  pixelPhi[i-1] = phi;
369  pixelOmega[i-1] = 90 - theta;
370  }
371 
372  telGeo.AddPointing(curPointingId, azimuth, elevation, pixelPhi, pixelOmega);
373  }
374 
375  }
376 
377  }
378 
379  // Now incrementally fill stations
380  if (Verbosity() > 0)
381  INFO("Updating SD stations");
382 
383  const auto& sdDetector = det::Detector::GetInstance().GetSDetector();
384 
385  const auto& adstStations = fDetectorGeometry.GetStations();
386 
387  for (const auto& station : sdDetector.AllStationsRange()) {
388 
389  if (station.IsDense())
390  continue;
391 
392  const int id = station.GetId();
393 
394  // Fill only new stations
395  // Note: It may be more reasonable to prefer newer information over older,
396  // but an attempt to implement that was thwarted by an "overwriting" warning
397  // in the DetectorGeometry.
398  if (adstStations.find(id) != adstStations.end())
399  continue;
400 
401  try {
402 
403  const auto pos = ToTVector3(station.GetPosition(), referenceCS, meter);
404  int gridType = 0;
405  const int partners = station.GetNumberOfPartners();
406  if (station.IsInGrid(sdet::SDetectorConstants::eInfill750))
407  gridType |= eInfill;
408  if (station.IsInGrid())
409  gridType |= eRegularArray;
410  if (partners == 1)
411  gridType |= eDoublet;
412  if (partners == 2)
413  gridType |= eTriplet;
414 
415  fDetectorGeometry.SetStation(id, pos.X()/m, pos.Y()/m, pos.Z()/m, gridType);
416 
417  } catch (NonExistentComponentException& e) {
418  WARNING("Station position information cannot be read from SDetector.");
419  }
420 
421  try {
422  const auto name = station.GetName();
423  fDetectorGeometry.SetStationName(id, name);
424  } catch (NonExistentComponentException& e) {
425  WARNING("Station name information cannot be read from SDetector.");
426  }
427 
428  try {
429  const double gpsSecond = station.GetCommissionTime().GetGPSSecond();
430  fDetectorGeometry.SetStationCommissionTime(id, gpsSecond);
431  } catch (NonExistentComponentException& e) {
432  WARNING("Station commission time information cannot be read from SDetector.");
433  }
434 
435  }
436 
437  // fill cloud on array pixelization if not yet done
438  auto& cloudPixCenters = fDetectorGeometry.GetCloudPixelCenters();
439  if (cloudPixCenters.empty()) {
440  try {
441  const auto& atm = det::Detector::GetInstance().GetAtmosphere();
442  const auto& goesDB = atm.GetGOESDB();
443  fDetectorGeometry.SetCloudPixelDimensions(goesDB.GetPixelWidthEasting(),
444  goesDB.GetPixelWidthNorthing());
445  for (unsigned int iPix = 0; iPix < goesDB.GetNumberOfPixels(); ++iPix) {
446  const auto center = ToTVector3(goesDB.GetPixelCenter(iPix).GetPoint(referenceCS), referenceCS);
447  cloudPixCenters.push_back(center);
448  }
449  } catch (utl::AugerException& augerException) {
450  WARNING(augerException.GetExceptionName() + ", " + augerException.GetMessage());
451  }
452  }
453 }
454 
455 
456 void
457 Offline2ADST::FillSim(const evt::Event& event, GenShower& gen, const bool saveProfiles)
458 {
459  if (!event.HasSimShower())
460  return;
461 
462  const auto& simEvent= event.GetSimShower();
463  const auto& referenceCS = det::Detector::GetInstance().GetReferenceCoordinateSystem();
464 
465  gen.SetEnergy(simEvent.GetEnergy()/eV);
466  gen.SetMuonNumber(simEvent.GetMuonNumber());
467  gen.SetMuonWeightScale(simEvent.GetMuonWeightScale());
468  gen.SetCalorimetricEnergy(simEvent.GetCalorimetricEnergy() / eV);
469  gen.SetElectromagneticEnergy(simEvent.GetElectromagneticEnergy() / eV);
470  gen.SetNmu(simEvent.GetNmu());
471  gen.SetXmaxMu(simEvent.GetXmaxMu() / (g/cm2));
472 
473  // Fill (radio) radiation energy
474  if (simEvent.HasRadioSimulation()) {
475  const auto& radiosim = simEvent.GetRadioSimulation();
476  gen.SetRadiationEnergy(radiosim.GetRadiationEnergy());
477  }
478 
479  if (simEvent.HasGeometry()) {
480  const auto& core = simEvent.GetPosition();
481  gen.SetCoreSiteCS(ToTVector3(core, referenceCS, meter));
482 
483  double northing = 0;
484  double easting = 0;
485  double altitude = 0;
486  try {
487  const utl::UTMPoint utm(core, ReferenceEllipsoid::GetWGS84());
488  northing = utm.GetNorthing();
489  easting = utm.GetEasting();
490  altitude = utm.GetHeight();
491  } catch (UTMPoint::UTMZoneException& zone_e) {
492  ERROR("UTMZoneException: sd rec shower invalid");
493  return;
494  } catch (UTMPoint::UTMException& e) {
495  ERROR("UTMException: sd rec shower invalid");
496  return;
497  }
498  gen.SetCoreUTMCS(TVector3(easting, northing, altitude));
499 
500  if (simEvent.HasGeometry()) {
501 
502  const auto& axis = -simEvent.GetDirection();
503  const auto& localCS = simEvent.GetLocalCoordinateSystem();
504  gen.SetAxisCoreCS(ToTVector3(axis, localCS));
505  gen.SetAxisSiteCS(ToTVector3(axis, referenceCS));
506 
507  gen.SetPrimary(simEvent.GetPrimaryParticle());
508 
509  gen.SetCoreTime(simEvent.GetTimeStamp().GetGPSSecond(),
510  simEvent.GetTimeStamp().GetGPSNanoSecond());
511 
512  // ------- angles
514 
515  const auto& coreTime = simEvent.GetTimeStamp();
516  const vector<double> inp({
517  ModifiedJulianDate(coreTime) + 2400000.5,
518  TimeStamp2GMST(coreTime),
519  easting, // x
520  northing, // y
521  altitude, // z
522  axis.GetTheta(localCS),
523  axis.GetPhi(localCS)
524  });
525 
526  const auto equOut = equCalc(inp);
527  gen.SetRightAscension(equOut[0]);
528  gen.SetDeclination(equOut[1]);
529 
531 
532  const auto galOut = galCalc(inp);
533  gen.SetGalacticLongitude(galOut[0]);
534  gen.SetGalacticLatitude(galOut[1]);
535  }
536  }
537 
538  // fill the profile MC info
539  if (!simEvent.HasLongitudinalProfile())
540  return;
541 
542  const TabulatedFunction& electronTrace = simEvent.GetLongitudinalProfile();
543 
544  if (!simEvent.HasdEdX())
545  return;
546  const TabulatedFunction& dEdXTrace = simEvent.GetdEdX();
547 
548  unsigned int size = electronTrace.GetNPoints();
549  vector<double> depth(size);
550  vector<double> electrons(size);
551  vector<double> dEdX(size);
552 
553  for (unsigned int i = 0; i < size; ++i) {
554  depth[i] = dEdXTrace[i].X() / (g/cm2);
555  dEdX[i] = dEdXTrace[i].Y() / (PeV/(g/cm2));
556  electrons[i] = electronTrace[i].Y();
557  }
558 
559  // set distance to shower maximum
560  const double distanceOfShowerMaximum = simEvent.GetDistanceOfShowerMaximum();
561  // cm, sic!, this is a bug, but we keep it for backward compatibility -- DO NOT CHANGE
562  // In GenShower::GetGeometricalDistanceToShowerMaximum() the value is converted to meter!
563  gen.SetDistanceOfShowerMaximum(distanceOfShowerMaximum / cm);
564 
565  gen.SetMagneticFieldStrength(simEvent.GetMagneticFieldStrength());
566  gen.SetMagneticFieldInclination(simEvent.GetMagneticFieldInclination());
567  gen.SetMagneticFieldDeclination(simEvent.GetMagneticFieldDeclination());
568 
569  // maximum from generator
570  if (simEvent.HasGHParameters()) {
571  gen.SetXmaxGaisserHillas(simEvent.GetGHParameters().GetXMax() / (g/cm2));
572  gen.SetNmaxGaisserHillas(simEvent.GetGHParameters().GetNMax() / (g/cm2));
573  }
574 
575  // maximum from interpolation
576  double xMaxConex = 0;
577  double xMaxConexdEdX = 0;
578  if (QuadraticMaximumInterpolation(depth, dEdX, xMaxConex, xMaxConexdEdX)) {
579  gen.SetXmaxInterpolated(xMaxConex);
580  gen.SetdEdXmaxInterpolated(xMaxConexdEdX);
581  }
582 
583  // Get depths and distances to injection/first interaction
584  const double X1 = simEvent.GetXFirst();
585  gen.SetX1(X1 / (g/cm2));
586  const double X0 = simEvent.GetXInject();
587  gen.SetX0(X0 / (g/cm2));
588 
589  if (simEvent.HasGeometry()) {
590  try {
591  const double depthStepSize = 5*g/cm2;
592  const auto& atmo = det::Detector::GetInstance().GetAtmosphere();
593  atmo.InitSlantProfileModel(simEvent.GetPosition(), -simEvent.GetDirection(), depthStepSize);
594  const atm::ProfileResult distanceVsSlantDepth = atmo.EvaluateDistanceVsSlantDepth();
595  gen.SetD1(distanceVsSlantDepth.Y(X1));
596  gen.SetD0(distanceVsSlantDepth.Y(X0));
597  } catch (NonExistentComponentException& e) {
598  WARNING("Can't load profile model. Core-to-depth distances not filled.");
599  }
600  }
601 
602  if (!saveProfiles)
603  return;
604 
605  gen.SetDepth(depth);
606  gen.SetElectrons(electrons);
607  gen.SetEnergyDeposit(dEdX);
608 
609  // Fill information about leading particles
610  auto& adstGenP = gen.GetParticleTree();
611  const auto& partTree = simEvent.GetParticleTree();
612  ConvertGenParticle(adstGenP, partTree);
613 }
614 
615 
616 void
617 Offline2ADST::ConvertGenParticle(GenParticle& adstGP, const evt::GenParticle& evtGP)
618 {
619  adstGP.SetParentId(evtGP.GetParentId());
620  adstGP.SetParentEnergy(evtGP.GetParentEnergy());
621  adstGP.SetEnergyCM(evtGP.GetEnergyCM());
622  adstGP.SetKinel(evtGP.GetKinel());
623  adstGP.SetMultiplicity(evtGP.GetMultiplicity());
624  adstGP.SetTargetMass(evtGP.GetTargetMass());
625  adstGP.SetDepth(evtGP.GetDepth());
626  adstGP.SetHeight(evtGP.GetHeight());
627 
628  unsigned int numberOfDaughterParticles = evtGP.GetDaughterParticles().size();
629  adstGP.AddNDaughters(numberOfDaughterParticles);
630  for (unsigned i = 0; i < numberOfDaughterParticles; ++i) {
631  ConvertGenParticle(adstGP.GetDaughterParticles()[i], evtGP.GetDaughterParticles()[i]);
632  }
633 }
const double eV
Definition: GalacticUnits.h:35
double ModifiedJulianDate(const time_t unixSecond)
unsigned int GetNPoints() const
void FillGlobalInfo(const evt::Event &event, RecEvent &recEvent)
DetectorGeometry fDetectorGeometry
Definition: Offline2ADST.h:79
bool AddRadioDetector(const det::Detector &offlineDet, Detector &adstDet)
Definition: RdFiller.cc:495
int StoreRadioLevel() const
Definition: Config.h:103
double GetHeight() const
Definition: GenParticle.h:22
const double PeV
bool HasMEvent() const
void SetIsMCEvent(bool ismc)
Definition: Status.h:25
Base class for all exceptions used in the auger offline code.
evt::Header & GetHeader()
bool FillRadioChannels(const revt::REvent &therev, const bool saveTrace=false, const bool storeExcludedStations=true)
Definition: RdFiller.cc:370
Converts an Offline event to ADST FDEvent.
Definition: FD2ADST.h:49
void FinishDetectorAndFileInfo()
void FillRadio(const evt::Event &event, RecEvent &recEvent)
Fills the per-event radio part of the event, EventInfo, and DetectorGeometry.
bool HasRecShower() const
bool FillRadioEventInfo(const revt::REvent &therev)
Definition: RdFiller.cc:484
Class to hold and convert a point in geodetic coordinates.
Definition: UTMPoint.h:40
Class to hold collection (x,y) points and provide interpolation between them.
void Convert(const evt::Event &event, RecEvent &recEvent)
bool HasSimShower() const
std::string GetConfig()
Get configuration in a string.
bool DropUntriggeredMCProfiles() const
Definition: Config.h:67
const double meter
Definition: GalacticUnits.h:29
#define INFO(message)
Macro for logging informational messages.
Definition: ErrorLogger.h:161
Base class for exceptions trying to access non-existing components.
bool IsMCEvent() const
Remember whether the current event is a MC.
Definition: Status.h:24
unsigned int TimeStamp2HHMMSS(const utl::TimeStamp &timest)
Convert a TimeStamp into an integer representing the time as HHMMSS.
void Convert(const evt::Event &event, RecEvent &recEvent) const
Definition: SD2ADST.cc:116
bool HasREvent() const
double GetNorthing() const
Get the northing.
Definition: UTMPoint.h:206
Report attempts to use invalid UTM zone.
Definition: UTMPoint.h:300
void FillSim(const evt::Event &event, GenShower &gen, bool saveProfiles)
double Y(const double x) const
Get the Y value (coordinate) for given X (ordinate)
otoa::Config fConfig
Definition: Offline2ADST.h:75
int GetParentId() const
Definition: GenParticle.h:15
boost::shared_ptr< const CoordinateTransformer > CoordinateSystemPtr
Shared pointer for coordinate systems.
bool FillRadioShower(const evt::Event &theev)
Definition: RdFiller.cc:261
Status
Return code for seek operation.
Definition: IoCodes.h:24
double GetHeight() const
Get the height.
Definition: UTMPoint.h:212
double GetX(const CoordinateSystemPtr &coordinateSystem) const
Definition: BasicVector.h:206
Class describing the Atmospheric profile.
Definition: ProfileResult.h:25
double GetDepth() const
Definition: GenParticle.h:21
constexpr double kPi
Definition: MathConstants.h:24
bool DropUntriggeredDetector() const
Definition: Config.h:73
const otoa::Config & Config() const
Fetch the converter configuration.
Definition: Offline2ADST.h:52
bool Convert(const evt::Event &event, RecEvent &recEvent)
Definition: Offline2ADST.cc:90
Converts an Offline event to ADST.
Definition: Config.h:19
constexpr double kTwoPi
Definition: MathConstants.h:27
double GetEasting() const
Get the easting.
Definition: UTMPoint.h:209
constexpr double degree
constexpr double g
Definition: AugerUnits.h:200
void Convert(const evt::Event &inEvent, RecEvent &outEvent) const
Definition: MD2ADST.cc:62
unsigned int TimeStamp2YYMMDD(const utl::TimeStamp &timest)
Convert a TimeStamp into an integer representing the date as YYMMDD.
double GetParentEnergy() const
Definition: GenParticle.h:16
#define WARNING(message)
Macro for logging warning messages.
Definition: ErrorLogger.h:163
void FillDetectorGeometryIncremental()
int StoreSDTraces() const
Definition: Config.h:82
std::vector< GenParticle > & GetDaughterParticles()
Definition: GenParticle.h:24
double GetEnergyCM() const
Definition: GenParticle.h:17
bool FillSimRadioStations(const evt::Event &theev)
Definition: RdFiller.cc:205
bool StoreExcludedRdStations() const
Definition: Config.h:106
const std::string & GetId() const
Get the event identifier.
Definition: Event/Header.h:31
double GetY(const CoordinateSystemPtr &coordinateSystem) const
Definition: BasicVector.h:209
static bool AddRadioDetectorGeometry(const det::Detector &offlineDet, DetectorGeometry *const adstGeo)
Definition: RdFiller.cc:523
bool WriteSD() const
Definition: Config.h:28
void ConvertGenParticle(GenParticle &adstGP, const evt::GenParticle &evtGP)
Converts an Offline event to ADST SDEvent.
Definition: SD2ADST.h:24
Report problems in UTM handling.
Definition: UTMPoint.h:288
static CentralConfig * GetInstance()
Use this the first time you get an instance of central configuration.
double TimeStamp2GMST(const utl::TimeStamp &ts)
Convert a TimeStamp to GMST.
constexpr double cm
Definition: AugerUnits.h:117
bool WriteFD() const
Definition: Config.h:26
Vector object.
Definition: Vector.h:30
Detector description interface for SDetector-related data.
Definition: SDetector.h:42
Main configuration utility.
Definition: CentralConfig.h:51
void Convert(const evt::Event &event, RecEvent &recEvent)
Definition: FD2ADST.cc:106
TVector3 ToTVector3(const T &v, const utl::CoordinateSystemPtr &cs, const double unit=1)
double Y(const double x) const
Get or interpolate the Y value that corresponds to parameter x.
otoa::Status fStatus
Definition: Offline2ADST.h:76
int GetTargetMass() const
Definition: GenParticle.h:20
#define ERROR(message)
Macro for logging error messages.
Definition: ErrorLogger.h:165
constexpr double m
Definition: AugerUnits.h:121
double GetKinel() const
Definition: GenParticle.h:18
bool FillRadioStations(const evt::Event &theev, const bool saveTrace=true, const bool storeExcludedStations=true)
Definition: RdFiller.cc:61
int StoreFDTraces() const
Definition: Config.h:49
const std::string & GetMessage() const
Retrieve the message from the exception.
const FileInfo & GetFileInfo() const
Definition: Offline2ADST.h:47
static bool AddRadioInfo(FileInfo *const info, const int radioSaveLevel)
Definition: RdFiller.cc:512
bool QuadraticMaximumInterpolation(const std::vector< double > &x, const std::vector< double > &y, double &xMax, double &yMax)
constexpr double cm2
Definition: AugerUnits.h:118
int GetMultiplicity() const
Definition: GenParticle.h:19
RdEvent & GetRdEvent()
Definition: RdFiller.h:63

, generated on Tue Sep 26 2023.