5 #include <det/Detector.h>
7 #include <fdet/FDetector.h>
8 #include <fdet/Telescope.h>
11 #include <utl/ErrorLogger.h>
12 #include <utl/TimeStamp.h>
13 #include <utl/TimeInterval.h>
14 #include <utl/TabulatedFunction.h>
15 #include <utl/MultiTabulatedFunction.h>
16 #include <utl/Photon.h>
17 #include <utl/AugerUnits.h>
18 #include <utl/MathConstants.h>
19 #include <utl/PhysicalConstants.h>
20 #include <utl/RandomEngine.h>
21 #include <utl/Trace.h>
22 #include <utl/TraceAlgorithm.h>
23 #include <utl/Reader.h>
25 #include <evt/Event.h>
26 #include <evt/ShowerSimData.h>
28 #include <fevt/FEvent.h>
30 #include <fevt/TelescopeSimData.h>
31 #include <fevt/Telescope.h>
32 #include <fevt/PixelSimData.h>
33 #include <fevt/Pixel.h>
34 #include <fevt/ChannelSimData.h>
35 #include <fevt/Channel.h>
37 #include <fwk/CentralConfig.h>
40 #include <TObjArray.h>
42 #include <TGraphErrors.h>
43 #include <TMultiGraph.h>
53 #include <TPaveText.h>
56 #include <TPolyLine.h>
58 #include <CLHEP/Random/Randomize.h>
71 fLongitudinalProfileCanvas(0),
72 fEnergyDepositCanvas(0),
77 fCherMieFluxCanvas(0),
78 fCherRaylFluxCanvas(0),
79 fCherDirFluxCanvas(0),
80 fLightOnCameraCanvas(0),
120 INFO(
"UserModule::Init()");
128 ERROR(
"Could not find branch eye");
135 ERROR(
"Could not find branch telescope");
140 fOutputFile =
new TFile(
"OfflineOutput.root",
"recreate");
142 "LongitudinalProfileC");
162 fCameraCanvas =
new TCanvas(
"Camera",
"Camera",60,60,600,600);
177 INFO(
"UserModule::Run()");
186 ERROR(
"Event does not contain a simulated shower.\n"
187 "Going to the next event.");
195 INFO(
"UserModule::Finish()");
257 for (
unsigned int i = 0; i < size; ++i) {
258 x[i] = profile[i].X()/(
g/
cm2);
259 y[i] = profile[i].
Y();
264 TGraph*
const graph =
new TGraph(size, x, y);
265 graph->SetMarkerStyle(8);
267 graph->SetTitle(
"Longitudinal Charge Profile");
270 graph->GetXaxis()->SetTitle(
"slant depth (g/cm²)");
271 graph->GetYaxis()->SetTitle(
"#Particles");
275 s =
"LongitudinalProfileC_";
293 for (
unsigned int i = 0; i < size; ++i) {
294 x[i] = edep[i].X()/(
g/(
cm*
cm));
297 y[i] = edep[i].
Y()/(
eV/(
g/
cm2));
302 TGraph*
const graph =
new TGraph(size, x, y);
303 graph->SetMarkerStyle(8);
305 graph->SetTitle(
"EnergyDeposit");
308 graph->GetXaxis()->SetTitle(
"slant depth (g/cm^{2})");
309 graph->GetYaxis()->SetTitle(
"dE/dX (eV/(g/cm^{2}))");
313 s =
"EnergyDepositC_";
324 Detector& theDetector = Detector::GetInstance();
326 const std::vector<double>& waves =
329 const unsigned int nWaves = waves.size();
334 for (
unsigned int i = 0; i < size; ++i) {
338 for (
unsigned int iwl = 0; iwl < nWaves; ++iwl) {
340 for (
unsigned int i = 0; i < size; ++i) {
342 x[i] = part[i].X()/(
g/
cm2);
349 TGraph*
const graph =
new TGraph(size, x, y);
350 graph->SetMarkerStyle(8);
352 graph->SetTitle(
"Fluorescence light");
355 graph->GetXaxis()->SetTitle(
"slant depth (g/cm^{2})");
356 graph->GetYaxis()->SetTitle(
"#Photons");
371 Detector& theDetector = Detector::GetInstance();
373 const std::vector<double>& waves =
376 const unsigned int nWaves = waves.size();
382 for (
unsigned int i = 0; i < size; ++i) {
384 x[i] = ph[i].X()/(
g/
cm2);
388 for (
unsigned int iwl = 0; iwl < nWaves; ++iwl) {
392 for (
unsigned int i = 0; i < size; ++i) {
399 TGraph*
const graph =
new TGraph(size, x, y);
400 graph->SetMarkerStyle(8);
402 graph->SetTitle(
"Cherenkov beam");
405 graph->GetXaxis()->SetTitle(
"slant depth (g/cm^{2})");
406 graph->GetYaxis()->SetTitle(
"#Photons");
410 s =
"CherenkovBeamC_";
454 const int size = int(bin*fluorTrace.
GetSize()/100.0);
462 for (
int i = 0; i < size; ++i) {
472 for (
unsigned int i = fluorTrace.
GetStart(); i < fluorTrace.
GetStop(); ++i) {
474 yf[j] += fluorTrace[i];
475 ycd[j] += cherDirTrace[i];
476 ycr[j] += cherRaylTrace[i];
477 ycm[j] += cherMieTrace[i];
479 if (!(i %
int(100/bin)))
489 for (
int i = 0; i < size; ++i) {
490 yt[i] = yf[i] + ycm[i] + ycr[i] + ycd[i];
495 TGraph*
const gt =
new TGraph(size, x, yt);
498 gt->SetTitle(
"Light flux");
499 gt->GetXaxis()->SetTitle(
"bin [100 ns]");
500 gt->GetXaxis()->SetRange(0,size);
501 gt->GetYaxis()->SetTitle(
"#Photons");
503 TGraph*
const gf =
new TGraph(size, x, yf);
507 TGraph*
const gcm =
new TGraph(size, x, ycm);
508 gcm->SetLineColor(6);
511 TGraph*
const gcr =
new TGraph(size, x, ycr);
512 gcr->SetLineColor(4);
515 TGraph*
const gcd =
new TGraph(size, x, ycd);
516 gcd->SetLineColor(2);
541 const int size = int(bin*fluorTrace.
GetSize()/100.0);
545 for (
int i = 0; i < size; ++i) {
551 for (
unsigned int i = fluorTrace.
GetStart(); i < fluorTrace.
GetStop(); ++i) {
553 y[j] += fluorTrace[i];
554 if (i%(
int(100/bin)) == 0)
563 TGraph*
const gt =
new TGraph(size, x, y);
566 gt->SetTitle(
"Fluorescence light flux");
567 gt->GetXaxis()->SetTitle(
"bin [100 ns]");
568 gt->GetXaxis()->SetRange(0,size);
569 gt->GetYaxis()->SetTitle(
"#Photons");
593 const int size = int(bin*trace.
GetSize()/100.0);
597 for (
int i = 0; i < size; ++i) {
606 if (i%(
int(100/bin)) == 0)
615 TGraph*
const gt =
new TGraph(size, x, y);
618 gt->SetTitle(
"Cherenkov Mie-scattered light flux");
619 gt->GetXaxis()->SetTitle(
"bin [100 ns]");
620 gt->GetXaxis()->SetRange(0,size);
621 gt->GetYaxis()->SetTitle(
"#Photons");
645 const int size = int(bin*trace.
GetSize()/100.0);
649 for (
int i = 0; i < size; ++i) {
658 if (i%(
int(100/bin)) == 0)
667 TGraph*
const gt =
new TGraph(size, x, y);
670 gt->SetTitle(
"Cherenkov Rayleigh-scattered light flux");
671 gt->GetXaxis()->SetTitle(
"bin [100 ns]");
672 gt->GetXaxis()->SetRange(0,size);
673 gt->GetYaxis()->SetTitle(
"#Photons");
677 s =
"CherRayleighFluxC_";
697 const int size = int(bin*trace.
GetSize()/100.0);
700 for (
int i = 0; i < size; ++i) {
708 if (i%(
int(100/bin)) == 0)
717 TGraph*
const gt =
new TGraph(size, x, y);
720 gt->SetTitle(
"Cherenkov direct light flux");
721 gt->GetXaxis()->SetTitle(
"bin [100 ns]");
722 gt->GetXaxis()->SetRange(0,size);
723 gt->GetYaxis()->SetTitle(
"#Photons");
727 s =
"CherDirectFluxC_";
760 cout <<
" graph plot at dia 0 " << endl;
762 cout <<
" graph plot at dia 1 " << endl;
764 cout <<
" problem!" << endl;
767 cout <<
" graph plot at dia 2 " << endl;
770 cout <<
" graph plot at dia 3 " << endl;
772 const int size2 = int(totalTrace.
GetSize());
777 for (
int i = 0; i < size2; ++i) {
779 y[i] = totalTrace[i];
807 cout <<
" graph plot at dia 4 " << endl;
810 const double diaphragmArea =
811 Detector::GetInstance().GetFDetector().GetEye(tel.
GetEyeId()).GetTelescope(tel.
GetId()).GetDiaphragmArea();
813 cout <<
" graph plot at dia 5 " << endl;
814 TGraph*
const graph =
new TGraph(size2, x, y);
816 graph->SetMarkerStyle(8);
819 s1 =
"Light At Diaphragm - area";
827 graph->SetTitle(s1.Data());
830 graph->GetXaxis()->SetTitle(
"trace bin");
831 graph->GetYaxis()->SetTitle(
"photons/m2");
847 const int size = 440;
851 for (
int i = 0; i < size; ++i) {
868 const int size2 = int(trace.
GetSize());
871 for (
int i = 0; i < size2; ++i) {
888 TGraph*
const gt =
new TGraph(j, x, y);
891 gt->SetTitle(
"Photons(370nm) on camera");
892 gt->GetXaxis()->SetTitle(
"bin [100 ns]");
893 gt->GetXaxis()->SetRange(0,j);
894 gt->GetYaxis()->SetTitle(
"#Photons");
898 s =
"LightOnCameraC_";
914 const int size = 440;
920 double integral[size];
923 for (
int i = 0; i < size; ++i){
934 for (
int i=0; i<size; ++i) {
944 bool firstTrace=
true;
1005 integral[i] = TraceAlgorithm::Sum(trace, 0, size-1);
1008 minint = integral[i];
1012 if (integral[i] > maxint)
1013 maxint = integral[i];
1015 if (integral[i] < minint)
1016 minint = integral[i];
1020 int nx = int(i/22.0);
1033 double deltacolor = (maxint - minint)/50;
1037 for (
int i = 0; i < size; ++i) {
1039 int nx = int(i/22.0);
1045 x[i] = 1 + nx + 0.5;
1051 TGraph*
const graph =
new TGraph(size, x, y);
1052 graph->SetMarkerStyle(4);
1054 graph->SetTitle(
"Pixels with photons");
1055 graph->GetXaxis()->SetNdivisions(0);
1056 graph->GetYaxis()->SetNdivisions(0);
1063 gStyle->SetPalette(1);
1065 float yy[] = { 0.5, 0.25, -0.25 , -0.5, -0.25, 0.25, 0.5 };
1066 float xx[] = { 0, 0.433, 0.433, 0, -0.433, -0.433, 0 };
1068 for (
int i = 0; i < size; ++i) {
1071 for (
int l = 0; l < 7; ++l) {
1072 yyaux[l] = 1 + yy[l] + ys[i];
1073 xxaux[l] = 1 + xx[l] + xs[i];
1076 TPolyLine*
const pline =
new TPolyLine(7, xxaux, yyaux);
1077 int cl = 51 + int(ceil((integral[i]-minint)/deltacolor));
1080 pline->SetFillColor(cl);
1081 pline->SetLineColor(1);
1082 pline->SetLineWidth(1);
1084 pline->SetLineColor(2);
1085 pline->SetLineWidth(2);
1105 pixiter!= tel.
PixelsEnd(ComponentSelector::eHasData); ++pixiter) {
1114 const int size = trace.
GetSize();
1116 for (
int i = 0; i < size; ++i)
1120 std::copy(trace.
Begin(), trace.
End(),y);
1123 TGraph*
const graph =
new TGraph(500,x,y);
1124 ostringstream title;
1126 <<
" Pix "<< pixel.
GetId();
1128 graph->SetName(title.str().c_str());
1129 graph->SetTitle(title.str().c_str());
1140 string s =
"Pixels_";
1142 folder.SetName(s.c_str());
1170 const int size = trace.
GetSize();
1172 for (
int i=0; i<size; ++i)
1176 std::copy(trace.
Begin(), trace.
End(),y);
1179 TGraph* graph =
new TGraph(500,x,y);
1180 ostringstream title;
1182 <<
" Channel "<< channel.
GetId();
1184 graph->SetName(title.str().c_str());
1185 graph->SetTitle(title.str().c_str());
1196 string s =
"Channels_";
1198 folder.SetName(s.c_str());
Telescope & GetTelescope(const unsigned int telescopeId, const ComponentSelector::Status status=ComponentSelector::eHasData)
Retrieve Telescope by Id, throw exception if not existent.
ChannelIterator ChannelsBegin()
void PlotEnergyDeposit(const evt::ShowerSimData &shower)
Plot the shower energy deposit.
unsigned int GetNPoints() const
const utl::TabulatedFunction & GetdEdX() const
Get the energy deposit of the shower.
TCanvas * fCherRaylFluxCanvas
void PlotLightOnCamera(const fevt::Telescope &tel)
Plot light on the camera.
bool HasPhotonTrace(const fevt::FdConstants::LightSource source, const int wl) const
Check that light trace for source /par source is present for the given wavelength bin...
const std::vector< double > & GetWavelengths(const EmissionMode mode=eFluorescence) const
void PlotCamera(const fevt::Telescope &tel)
Plot the camera.
SizeType GetStop() const
Get valid data stop bin.
void PlotLightAtDia(const fevt::Telescope &tel)
Plot light at diaphragm.
Skip remaining modules in the current loop and continue with next iteration of the loop...
Class to hold collection (x,y) points and provide interpolation between them.
TObjArray * fPhotonGraphs
unsigned int GetId() const
bool HasSimShower() const
const utl::TabulatedFunction & GetFluorescencePhotons(const int wavelength) const
Get the fluorescence photons generated along the shower axis.
double GetBinning() const
size of one slot
unsigned int GetEyeId() const
ChannelIterator ChannelsEnd()
#define INFO(message)
Macro for logging informational messages.
PixelSimData & GetSimData()
bool HasFADCTrace(const FdConstants::LightSource source) const
Check that source /par source is present.
void PlotTotalCherBeam(const evt::ShowerSimData &shower)
Plot total Cerenkov light generated along the shower axis.
void PlotLightFlux(const fevt::TelescopeSimData &sim)
Plot the light flux at the diaphragm.
void Init()
Initialise the registry.
Base class for exceptions trying to access non-existing components.
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.
Fluorescence Detector Channel Simulated Data Event.
void AnalyzeCamera(const fevt::FEvent &fevent)
ChannelSimData & GetSimData()
PixelIterator PixelsEnd()
iterator pointing to end of available pixels of status eHasData (DEPRECATED)
fwk::VModule::ResultFlag Run(evt::Event &event)
Run: invoked once per event.
Interface class to access Shower Simulated parameters.
const atm::Atmosphere & GetAtmosphere() const
const utl::TabulatedFunction & GetCherenkovPhotons(const int wavelength) const
Get the Cherenkov photon production along the shower axis.
unsigned int GetId() const
bool HasPixel(const unsigned int pixelId, const ComponentSelector::Status status=ComponentSelector::eHasData) const
Check if the pixel is in the event.
fevt::TelescopeSimData & GetSimData()
Description of simulated data for one Telescope.
Class representing a document branch.
TCanvas * fLightFluxCanvas
Fluorescence Detector Pixel event.
void PlotFADCTraces(const fevt::Telescope &tel)
create graphs with the traces
std::vector< double >::size_type SizeType
TCanvas * fCherDirFluxCanvas
Top of the hierarchy of the detector description interface.
void PlotTotalFluorLight(const evt::ShowerSimData &shower)
Plot the total fluorecence light generated along the shower axis.
utl::TraceD & GetPhotonTrace(const fevt::FdConstants::LightSource source, const int wl)
Photon trace at diaphragm.
unsigned int GetTelescopeId() const
boost::filter_iterator< ComponentSelector, ConstAllPixelIterator > ConstPixelIterator
void PlotCherRaylFlux(const fevt::TelescopeSimData &sim)
Plot the Rayleigh-scattered Cherenkov light flux at the diaphragm.
utl::TraceI & GetFADCTrace(const FdConstants::LightSource source=FdConstants::eTotal)
Fluorescence Detector Channel Event.
void PlotCherMieFlux(const fevt::TelescopeSimData &sim)
Plot the Mie-scattered Cherenkov light flux at the diaphragm.
void GetData(bool &b) const
Overloads of the GetData member template function.
void AnalyzeShower(const evt::ShowerSimData &shower)
Top of Fluorescence Detector event hierarchy.
Eye & GetEye(const unsigned int eyeId, const ComponentSelector::Status status=ComponentSelector::eHasData)
return Eye by id
fwk::VModule::ResultFlag Finish()
Finish: invoked at end of the run (NOT end of the event)
bool HasdEdX() const
Check initialization of the energy deposit.
unsigned int GetTelescopeId() const
fevt::FEvent & GetFEvent()
Pixel & GetPixel(const unsigned int pixelId, const ComponentSelector::Status status=ComponentSelector::eHasData)
Retrieve Pixel by Id, throw exception if not existent.
void PlotLongitudinalProfile(const evt::ShowerSimData &shower)
Plot the shower longitudinal charge profile.
bool HasEye(const unsigned int eyeId, const ComponentSelector::Status status=ComponentSelector::eHasData) const
TCanvas * fLightAtDiaCanvas
TCanvas * fEnergyDepositCanvas
ResultFlag
Flag returned by module methods to the RunController.
TCanvas * fCherMieFluxCanvas
unsigned int GetId() const
void PlotPhotonTraces(const fevt::Telescope &tel)
create graphs with the traces
SizeType GetStart() const
Get valid data start bin.
bool HasTelescope(const unsigned int telescopeId, const ComponentSelector::Status status=ComponentSelector::eHasData) const
Check if the telescope is in the event.
boost::indirect_iterator< InternalConstChannelIterator, const Channel & > ConstChannelIterator
An iterator over available channles for read.
utl::TraceD & GetPhotonTrace(const FdConstants::LightSource source=FdConstants::eTotal)
Simulated Photon Trace.
TCanvas * fFluorLightCanvas
Main configuration utility.
void AnalyzeLightAtDiaphragm(const fevt::FEvent &fevent)
Fluorescence Detector Telescope Event.
TCanvas * fLongitudinalProfileCanvas
PixelIterator PixelsBegin()
iterator pointing to first available pixel of status eHasData (DEPRECATED)
double Y(const double x) const
Get or interpolate the Y value that corresponds to parameter x.
void PlotCherDirFlux(const fevt::TelescopeSimData &sim)
Plot the Direct Cherenkov light flux at the diaphragm.
#define ERROR(message)
Macro for logging error messages.
TCanvas * fCherBeamCanvas
utl::Branch GetTopBranch(const std::string &id)
Get top branch for moduleConfigLink with given id (XML files)
Fluorescence Detector Pixel Simulated Data.
const utl::TabulatedFunction & GetLongitudinalProfile(const ProfileType type=eCharged) const
Get the longitudinal charge profile of the shower.
TCanvas * fFluorFluxCanvas
void PlotFluorFlux(const fevt::TelescopeSimData &sim)
Plot the fluorescence light flux at the diaphragm.
TCanvas * fLightOnCameraCanvas