4 #include <evt/ShowerRecData.h>
5 #include <evt/ShowerSRecData.h>
6 #include <evt/ShowerSimData.h>
8 #include <sevt/SEvent.h>
9 #include <sevt/Station.h>
10 #include <sevt/PMTCalibData.h>
11 #include <sevt/PMTRecData.h>
12 #include <sevt/StationRecData.h>
13 #include <sevt/StationConstants.h>
15 #include <det/Detector.h>
17 #include <sdet/SDetector.h>
19 #include <utl/ErrorLogger.h>
20 #include <utl/MathConstants.h>
21 #include <utl/CoordinateSystemPtr.h>
22 #include <utl/AxialVector.h>
23 #include <utl/Vector.h>
24 #include <utl/Point.h>
25 #include <utl/AugerUnits.h>
26 #include <utl/PhysicalConstants.h>
27 #include <utl/Trace.h>
28 #include <utl/TraceAlgorithm.h>
30 #define max(a,b) ((a) > (b) ? (a) : (b))
31 #define max3(a,b,c) (max((a),max((b),(c))))
44 const double VEM_Threshold_DLE = 0.2;
51 const double a = 1.60484e-03;
52 const double a0 = 2.00000e-05;
53 const double a1 = 1.70001e-03;
54 const double a2 = -1.74851e-05;
55 const double a3 = -1.35945e-01;
56 const double a4 = 5.79209e+01;
57 const double B = a*theta + (a0 + a1*theta + a2*theta*theta)
58 / (1 + exp( a3 * (theta -a4)));
65 void DLECorrection::Direct_Light_Azim_Depen_PMT(
int pmtId,
double ang,
70 f =
b(ang)*cos((phi-30.+180.)*3.14159/180.);
72 f =
b(ang)*cos((phi-270.+180.)*3.14159/180.);
74 f =
b(ang)*cos((phi-150.+180.)*3.14159/180.);
76 for (
int j = 0; j < fTraceSize; j++){
77 if (times[j] > VEM_Threshold_DLE)
84 for (
int j = 0; j < fTraceSize; j++){
85 const double s1=t1[j];
86 const double s2=t2[j];
87 const double smean=(s1+s2)/2.;
88 const double sigma=
sqrt(((s1-smean)*(s1-smean)+(s2-smean)*(s2-smean))/2.);
90 (s1>s2) ? t1[j]=t2[j] : t2[j]=t1[j] ;
98 vector<unsigned int> workingPMTsIds;
100 pIt != station.
PMTsEnd(); ++pIt) {
101 if (!pIt->HasRecData())
103 if (!pIt->GetRecData().HasVEMTrace(source))
105 workingPMTsIds.push_back(pIt->GetId());
108 if (workingPMTsIds.size() !=2 ){
109 INFO(
"DLECorrection::Individual_Direct_Light_Corr"
110 " => Something is wrong, less than 2 PMTS ");
115 PMT2_Correction(times1,times2);
124 for (
int j = 0; j < fTraceSize; j++){
125 double s1 = times1[j];
126 double s2 = times2[j];
127 double s3 = times3[j];
128 double smean = (s1+s2+s3)/3;
129 double sigma =
sqrt(((s1-smean)*(s1-smean)+(s2-smean)*(s2-smean)+(s3-smean)*(s3-smean))/3);
131 double peak =
max3(s1,s2,s3);
134 times1[j] = (s2+s3)/2.;
136 times2[j] = (s1+s3)/2.;
138 times3[j] = (s1+s2)/2.;
146 INFO(
"DLECorrection::CorrectDLE()");
148 const det::Detector& detector = det::Detector::GetInstance();
167 det::Detector::GetInstance().GetSDetector().GetStation(station);
174 pIt != sIt->PMTsEnd(); ++pIt) {
175 if (!pIt->HasRecData())
177 if (pIt->GetRecData().HasVEMTrace(component))
182 pIt != sIt->PMTsEnd(); ++pIt) {
184 if (!pIt->HasRecData())
192 const int pmtId = pIt->GetId();
199 for (
int i =0 ; i < fTraceSize; ++i)
203 Direct_Light_Azim_Depen_PMT(pmtId,theta,phi,pmtRec.
GetVEMTrace(source));
209 Individual_Direct_Light_Corr(NumberOfPMTs,station,source);
219 DLECorrection::~DLECorrection(){
226 INFO(
"DLECorrection::Init()");
235 INFO(
"DLECorrection::Run()");
236 if (!(event.
HasSEvent() &&
event.HasRecShower() &&
237 event.GetRecShower().HasSRecShower()))
250 INFO(
"DLECorrection::Finish()");
StationIterator StationsEnd()
End of all stations.
utl::TraceD & GetVEMTrace(const StationConstants::SignalComponent source=StationConstants::eTotal)
Traces calibrated in VEM Peak.
double GetPhi(const CoordinateSystemPtr &coordinateSystem) const
azimuth (phi) angle in spherical and cylindrical coordinates
Detector description interface for Station-related data.
Report success to RunController.
void MakeVEMTrace(const StationConstants::SignalComponent source=StationConstants::eTotal)
Interface class to access to the SD Reconstruction of a Shower.
Interface class to access to the SD part of an event.
double GetTheta(const CoordinateSystemPtr &coordinateSystem) const
zenith (theta) angle in spherical coordinates
PMTIterator PMTsBegin(const sdet::PMTConstants::PMTType type=sdet::PMTConstants::eWaterCherenkovLarge)
begin PMT iterator for read/write
PMTRecData & GetRecData()
Get object containing PMT reconstructed data.
Skip remaining modules in the current loop and continue with next iteration of the loop...
#define INFO(message)
Macro for logging informational messages.
void Init()
Initialise the registry.
utl::CoordinateSystemPtr GetSiteCoordinateSystem() const
Get the coordinate system for the site.
boost::filter_iterator< PMTFilter, InternalPMTIterator > PMTIterator
Iterator over station for read/write.
bool IsCandidate() const
Check if the station is a candidate.
boost::shared_ptr< const CoordinateTransformer > CoordinateSystemPtr
Shared pointer for coordinate systems.
class to hold data at Station level
class to hold reconstructed data at PMT level
Top of the hierarchy of the detector description interface.
PMTIterator PMTsEnd(const sdet::PMTConstants::PMTType type=sdet::PMTConstants::eWaterCherenkovLarge)
end PMT iterator for read/write
signal after subtracting direct light (includes all particle sources).
const utl::Vector & GetAxis() const
bool IsLowGainSaturation() const
Check which gains are saturated.
ResultFlag
Flag returned by module methods to the RunController.
PMT & GetPMT(const unsigned int pmtId)
Retrive a PMT by Id.
void CorrectDLE(evt::Event &event, const sevt::StationConstants::SignalComponent component, const sevt::StationConstants::SignalComponent source)
StationIterator StationsBegin()
Beginning of all stations.
total (shower and background)
boost::indirect_iterator< InternalStationIterator, Station & > StationIterator
Iterator over all stations.
unsigned int GetFADCTraceLength() const
bool HasVEMTrace(const StationConstants::SignalComponent source=StationConstants::eTotal) const
const StationConstants::SignalComponent source1