14 #include <utl/Reader.h>
15 #include <utl/ErrorLogger.h>
16 #include <utl/AugerUnits.h>
17 #include <utl/MathConstants.h>
18 #include <utl/PhysicalConstants.h>
19 #include <utl/TabulatedFunction.h>
20 #include <utl/TabulatedFunctionErrors.h>
21 #include <utl/Trace.h>
22 #include <utl/MultiTabulatedFunction.h>
23 #include <utl/Point.h>
24 #include <utl/UTMPoint.h>
25 #include <utl/TimeInterval.h>
27 #include <fwk/CentralConfig.h>
29 #include <det/Detector.h>
30 #include <fdet/FDetector.h>
32 #include <fdet/Channel.h>
33 #include <fdet/Pixel.h>
35 #include <evt/Event.h>
36 #include <evt/ShowerSimData.h>
37 #include <fevt/FEvent.h>
39 #include <fevt/EyeHeader.h>
40 #include <fevt/EyeTriggerData.h>
41 #include <fevt/Telescope.h>
42 #include <fevt/TelescopeSimData.h>
43 #include <fevt/TelescopeTriggerData.h>
44 #include <fevt/PixelSimData.h>
45 #include <fevt/Pixel.h>
46 #include <fevt/ChannelSimData.h>
47 #include <fevt/Channel.h>
51 #include <evt/LaserData.h>
58 #include <TDirectory.h>
61 #include <io/FDasToOfflineEventConverter.h>
65 #include <AugerEvent.h>
69 #include <MiEventHeader.hh>
71 #include <EyeEvent.hh>
73 #include <FdNumbering.hh>
74 using namespace FdUtil;
77 using namespace FdEventLoggerGS;
89 FdEventLogger::FdEventLogger() {}
90 FdEventLogger::~FdEventLogger() {}
95 INFO (
"FdEventLogger::Init()");
104 TDirectory *
const save = gDirectory;
105 fRootLogFile =
new TFile(fFileName.c_str(),
"RECREATE");
107 fRootLogFile->SetCompressionLevel(comp);
122 INFO(
"FdEventLogger::Run");
125 ERROR (
"Event has no FEvent.");
126 return eContinueLoop;
129 FEvent& fevent =
event.GetFEvent();
132 bool drumCalibMode = !
event.HasSimShower();
135 INFO (
"Drum calibration mode!");
148 laser_wavelength = 0;
149 laser_polarization_angle = 0;
151 if (!drumCalibMode) {
159 if (LaserProcessing ==
true) {
160 cout<<endl<<
"...PROCESSING LASER EVENT..."<<endl;
164 laser_polarization_angle = 0;
166 laser_polarization_angle = 0;
175 if (LaserProcessing==
false) {
196 const UTMPoint utm(core, ReferenceEllipsoid::eWGS84);
212 iEye != fevent.
EyesEnd(ComponentSelector::eHasData);
215 int eyeId = iEye->GetId();
218 if (iEye->HasTriggerData()) {
219 fIsT3 = iEye->GetTriggerData().IsT3Accepted();
223 iTel != iEye->TelescopesEnd(ComponentSelector::eHasData);
226 int telId = iTel->GetId();
227 evtmir = 1000 * eventId + (eyeId - 1) * 6 + telId;
229 if (!iTel->HasSimData()) {
230 INFO(
"Skipping telescope with no sim data");
243 if (iTel->HasTriggerData()) {
244 fIsTLT = iTel->GetTriggerData().IsTLTAccepted();
245 tslot = iTel->GetTriggerData().GetSLTData().size();
246 for(
int i=0; i<tslot; i++) {
248 for(
int col=0; col<ncol; col++) {
249 fSLTWord[i+ncol*col] = iTel->GetTriggerData().GetSLTData()[i].GetSLTDataWord(col+1);
260 iPixel != iTel->PixelsEnd(ComponentSelector::eHasData);
263 int pixelId = iPixel->GetId();
265 if (!iPixel->HasSimData()) {
266 INFO(
"Skip pixel with no sim data");
303 TDirectory*
const save = gDirectory;
305 INFO(
"Closing Analysis output Tree");
310 fRootLogFile->Close();
320 void FdEventLogger::InitTree() {
323 TDirectory*
const save = gDirectory;
326 fTtrig =
new TTree(
"pix",
"FirstLevelTrigger");
327 fTtrig->Branch(
"pixel",&pixel,
"pixel/I");
328 fTtrig->Branch(
"evtmir",&evtmir,
"evtmir/I");
329 fTtrig->Branch(
"thresh",&thresh,
"thresh/I");
330 fTtrig->Branch(
"mean",&mean,
"mean/F");
331 fTtrig->Branch(
"rms",&rms,
"rms/F");
332 fTtrig->Branch(
"summax",&summax,
"summax/I");
333 fTtrig->Branch(
"T1",&T1,
"T1/I");
334 fTtrig->Branch(
"T1_delta",&T1_delta,
"T1_delta/I");
335 fTtrig->Branch(
"FDSpix",&FDSpix,
"FDSpix/b");
338 fT2trig =
new TTree(
"SLT",
"SecondLevelTrigger");
340 fT2trig->Branch(
"evtmir",&evtmir,
"evtmir/I");
341 fT2trig->Branch(
"energy",&energy,
"energy/D");
342 fT2trig->Branch(
"primary",&primary,
"primary/I");
343 fT2trig->Branch(
"XMax",&XMax,
"XMax/D");
344 fT2trig->Branch(
"azimuth",&azimuth,
"azimuth/D");
345 fT2trig->Branch(
"zenith",&zenith,
"zenith/D");
346 fT2trig->Branch(
"XG",&XG,
"XG/D");
347 fT2trig->Branch(
"YG",&YG,
"YG/D");
348 fT2trig->Branch(
"PixOn",&PixOn,
"PixOn/I");
349 fT2trig->Branch(
"PixOnFD",&PixOnFD,
"PixOnFD/I");
350 fT2trig->Branch(
"PixOnBg",&PixOnBg,
"PixOnBg/I");
351 fT2trig->Branch(
"PixFromFD",&PixFromFD,
"PixFromFD/I");
352 fT2trig->Branch(
"PixRO",&PixRO,
"PixRO/I");
353 fT2trig->Branch(
"T2time",&T2time,
"T2time/I");
354 fT2trig->Branch(
"T_offset",&fTimeOffset,
"T_offset/I");
355 fT2trig->Branch(
"tslot",&tslot,
"tslot/I");
356 fT2trig->Branch(
"SLTdataword",&fSLTWord,
"SLTdataword[tslot]/i");
359 fT2trig->Branch(
"LaserWavelength",&laser_wavelength,
"LaserWavelength/D");
360 fT2trig->Branch(
"LaserPolarizationAngle",&laser_polarization_angle,
"LaserPolarizationAngle/D");
362 fT2trig->Branch(
"isTLT", &fIsTLT,
"isTLT/I");
363 fT2trig->Branch(
"isT3", &fIsT3,
"isT3/I");
bool HasDirection() const
Check initialization of shower geometry.
utl::CoordinateSystemPtr GetLocalCoordinateSystem() const
Get the Auger coordinate system associated to the shower core position.
int GetPrimaryParticle() const
Get the type of the shower primary particle.
LaserData & GetLaserData()
Get the laser data.
bool HasLaserData() const
Check initialization of the LaserData.
double GetLaserWavelength() const
boost::filter_iterator< ComponentSelector, ConstAllEyeIterator > ConstEyeIterator
const evt::VGaisserHillasParameter & GetGHParameters() const
Get the Gaisser-Hillas parameters of the shower.
int GetThreshold() const
Get the simulated trigger threshold of the pixel.
Class to hold and convert a point in geodetic coordinates.
int GetNumberOfFltPixelsFromBackground() const
EyeIterator EyesEnd(const ComponentSelector::Status status)
#define INFO(message)
Macro for logging informational messages.
void Init()
Initialise the registry.
Branch GetChild(const std::string &childName) const
Get child of this Branch by child name.
bool HasPhotonTrace(const FdConstants::LightSource source) const
Check that trace for source /par source is present.
double GetNorthing() const
Get the northing.
int GetNumberOfFltPixels() const
int GetSltTriggerTime() const
bool HasPosition() const
Check initialization of shower geometry.
Interface class to access Shower Simulated parameters.
int GetMaxBoxcarsum() const
boost::shared_ptr< const CoordinateTransformer > CoordinateSystemPtr
Shared pointer for coordinate systems.
Description of simulated data for one Telescope.
Class representing a document branch.
const utl::Vector & GetDirection() const
Get the direction of the shower axis. This is the true direction of shower movement.
const utl::Point & GetPosition() const
Get the position of the shower core.
EyeIterator EyesBegin(const ComponentSelector::Status status)
boost::filter_iterator< ComponentSelector, ConstAllPixelIterator > ConstPixelIterator
double GetEasting() const
Get the easting.
double GetEnergy() const
Get the energy of the shower primary particle.
int GetNumberOfPixelsWithShowerPhotons() const
void GetData(bool &b) const
Overloads of the GetData member template function.
Top of Fluorescence Detector event hierarchy.
int GetSltTimeShift() const
double GetMeanBoxcarsum() const
int GetNumberOfReadOutPixels() const
ResultFlag
Flag returned by module methods to the RunController.
Interface class for access to the Gaisser-Hillas parameters.
double GetRmsBoxcarsum() const
int GetNumberOfFltPixelsFromShower() const
Main configuration utility.
#define ERROR(message)
Macro for logging error messages.
boost::filter_iterator< ComponentSelector, ConstAllTelescopeIterator > ConstTelescopeIterator
utl::Branch GetTopBranch(const std::string &id)
Get top branch for moduleConfigLink with given id (XML files)
Fluorescence Detector Pixel Simulated Data.
int GetFltDuration() const