27 #include <utl/config.h>
28 #include <utl/Reader.h>
29 #include <utl/ErrorLogger.h>
30 #include <utl/AugerUnits.h>
31 #include <utl/MathConstants.h>
32 #include <utl/PhysicalConstants.h>
33 #include <utl/TabulatedFunction.h>
34 #include <utl/TabulatedFunctionErrors.h>
35 #include <utl/Trace.h>
36 #include <utl/MultiTabulatedFunction.h>
37 #include <utl/Point.h>
38 #include <utl/UTMPoint.h>
39 #include <utl/TimeStamp.h>
40 #include <utl/TimeInterval.h>
41 #include <utl/UTCDateTime.h>
42 #include <utl/AugerException.h>
44 #include <fwk/CentralConfig.h>
45 #include <fwk/RunController.h>
46 #include <fwk/LocalCoordinateSystem.h>
48 #include <det/Detector.h>
49 #include <fdet/FDetector.h>
51 #include <fdet/Camera.h>
52 #include <fdet/Channel.h>
53 #include <fdet/Pixel.h>
54 #include <fdet/Telescope.h>
56 #include <evt/Event.h>
57 #include <evt/ShowerSimData.h>
58 #include <fevt/FEvent.h>
60 #include <fevt/EyeHeader.h>
61 #include <fevt/EyeTriggerData.h>
62 #include <fevt/Telescope.h>
63 #include <fevt/TelescopeSimData.h>
64 #include <fevt/TelescopeTriggerData.h>
65 #include <fevt/SLTData.h>
66 #include <fevt/PixelSimData.h>
67 #include <fevt/PixelTriggerData.h>
68 #include <fevt/Pixel.h>
69 #include <fevt/ChannelSimData.h>
70 #include <fevt/Channel.h>
73 #include <AugerEvent.h>
76 #include <FDEventLibVersion.hh>
78 #include <MiEventHeader.hh>
80 #include <EyeEvent.hh>
82 #include <FdNumbering.hh>
84 #ifdef FDLIB_V3R3 // FDEventLib above v3r3
86 #include <EyeEventClassifier.hh>
88 #include <PrototypeTltProcessor.hh>
90 #ifdef FDLIB_V3R5 // FDEventLib above v3r5
91 #include <MStcCutTlt.hh>
92 #endif // IF FDEventLib above v3r5
94 #endif // IF FDEventLib above v3r3
101 using namespace FdUtil;
102 using namespace FdTriggerSimulatorOG;
108 using namespace fevt;
113 #define EVENTCLASSIFIER_PARAMETERS_STD { \
114 "Standard parameter set", \
123 #define EVENTCLASSIFIER_PARAMETERS_OLD { \
124 "Old parameter set", \
136 #define EVENTCLASSIFIER_PARAMETERS_HEAT_2 { \
137 "Parameter set 2 for HEAT", \
147 FdTriggerSimulator::FdTriggerSimulator()
168 if (topB.
GetChild(
"StartMultiplicityTLT"))
177 if (levelStr==
"T3") {
178 fMinRequiredTriggerLevel = eT3;
179 }
else if (levelStr==
"TLT") {
180 fMinRequiredTriggerLevel = eTLT;
181 }
else if (levelStr==
"SLT") {
182 fMinRequiredTriggerLevel = eSLT;
183 }
else if (levelStr==
"FLT") {
184 fMinRequiredTriggerLevel = eFLT;
185 }
else if (levelStr==
"all") {
189 err <<
" unkown enumeration value: \"" << levelStr <<
190 "\" used. Check your xml/xsd files!";
195 fMaxSimTriggerLevel = eT3;
196 if (!topB.
GetChild(
"maximumSimulatedTriggerLevel")==0) {
199 if (levelStr==
"T3") {
200 fMaxSimTriggerLevel = eT3;
201 }
else if (levelStr==
"TLT") {
202 fMaxSimTriggerLevel = eTLT;
203 }
else if (levelStr==
"SLT") {
204 fMaxSimTriggerLevel = eSLT;
205 }
else if (levelStr==
"FLT") {
206 fMaxSimTriggerLevel = eFLT;
207 }
else if (levelStr==
"all") {
211 err <<
" unkown enumeration value: \"" << levelStr <<
212 "\" used. Check your xml/xsd files!";
220 if (fMinRequiredTriggerLevel<eSLT) {
221 ERROR(
"Without FDEventLib >=v3r3 there is no support for FD TLT/T3 simulations! You need to upgrade! ");
229 << GetVersionInfo(VModule::eRevisionNumber) <<
"\n"
231 " verbosity: " << fVerbosity <<
"\n"
232 " add. columns readout: " << fColRO <<
"\n"
233 " add. rows readout: " << fRowRO <<
"\n"
234 "multiplicityTLT after: " << fStartMultiplicityTLT <<
"\n"
235 " TLT printlevel: " << fTLTPrintLevel <<
"\n"
236 " min trigger level: ";
237 switch (fMinRequiredTriggerLevel) {
238 case eT3: info <<
"T3\n";
break;
239 case eTLT: info <<
"TLT\n";
break;
240 case eSLT: info <<
"SLT\n";
break;
241 case eFLT: info <<
"FLT\n";
break;
242 case eNoTrigger: info <<
"no trigger\n";
break;
243 default: info <<
"UNKOWN \n";
break;
245 info <<
"max sim.trigger level: ";
246 switch (fMaxSimTriggerLevel) {
247 case eT3: info <<
"T3\n";
break;
248 case eTLT: info <<
"TLT\n";
break;
249 case eSLT: info <<
"SLT\n";
break;
250 case eFLT: info <<
"FLT\n";
break;
251 case eNoTrigger: info <<
"no trigger\n";
break;
252 default: info <<
"UNKOWN\n";
break;
257 fTltLogFile = fopen(
"Tlt.log",
"w");
260 WARNING(
"\n For TLT and T3 simulations you need FDEventLib >= v3r3 \n");
271 ERROR(
"Event has no FEvent.");
274 FEvent& fEvent =
event.GetFEvent();
277 if (fVerbosity >= 1) {
278 cout <<
"****************************************"
279 <<
"***************************************"<<endl;
281 cout <<
"Timestamp " <<
event.GetHeader().GetTime()<< endl;
282 cout <<
"****************************************"
283 <<
"***************************************"<<endl;
290 if (fMaxSimTriggerLevel <= eTLT) {
293 ostringstream TLTinfo;
295 if (!dynamic_cast<PrototypeTltProcessor*>(fTltProcessor)) {
296 delete fTltProcessor;
297 fTltProcessor =
nullptr;
298 TLTinfo <<
"Initializing Prototype-TLT processor ("
300 <<
" is before switch-time " <<
UTCDateTime(fStartMultiplicityTLT) <<
")";
301 fTltProcessor =
new PrototypeTltProcessor();
306 if (!dynamic_cast<MStcCutTlt*>(fTltProcessor)) {
307 delete fTltProcessor;
308 fTltProcessor =
nullptr;
309 TLTinfo <<
"Initializing Multiplicity-TLT processor ("
311 <<
" is after switch-time " <<
UTCDateTime(fStartMultiplicityTLT) <<
")";
312 MiReadout::MStcCutTltParametersRec tlt_parrec = MSTC_TLT_DEFAULT_PARAMETERS;
313 fTltProcessor =
new MStcCutTlt(&tlt_parrec);
317 if (!dynamic_cast<PrototypeTltProcessor*>(fTltProcessor)) {
318 delete fTltProcessor;
319 fTltProcessor =
nullptr;
320 WARNING(
"\n For multiplicity TLT simulations you need FDEventLib >= v3r5 (switching to prototype TLT!)\n");
321 fTltProcessor =
new PrototypeTltProcessor();
329 fTltProcessor->SetLogfile(fTltLogFile);
331 fTltProcessor->SetPrintLevel(fTLTPrintLevel);
350 ofstream gTltOut(
"Tlt.out");
351 fTltProcessor->PrintSettings(gTltOut);
355 if (fMaxSimTriggerLevel <= eT3) {
358 INFO(
"Initializing T3 processor");
359 # if FDEVENTLIB_VERSION_CODE >= ModuleVersionCode (4, 0, 6)
360 fT3 = &EyeEventClassifier::GetInstance();
361 EyeEventClassifier::GetInstance().SetLogLevel(2);
363 fT3 =
new EyeEventClassifier();
371 WARNING(
"\n For TLT and T3 simulations you need FDEventLib >= v3r3 \n");
375 const fdet::FDetector& theFDet = Detector::GetInstance().GetFDetector();
377 bool eventWithTrigger =
false;
380 iEye != fEvent.
EyesEnd(ComponentSelector::eInDAQ); ++iEye) {
388 bool eyeWithTrigger =
false;
391 #if FDEVENTLIB_VERSION_CODE >= ModuleVersionCode(4,0,0)
392 TEyeGeometryData*
const geoData = eyeEvent.GetGeometryData();
396 iTel != iEye->TelescopesEnd(ComponentSelector::eInDAQ); ++iTel) {
398 #if FDEVENTLIB_VERSION_CODE >= ModuleVersionCode(4,0,0)
406 geoData->SetAxisDirection(iTel->GetId(),
411 if (!iTel->HasSimData())
414 const bool foundFLT = FLTSim(*iTel);
416 if (foundFLT || fMinRequiredTriggerLevel >=
eNoTrigger) {
418 const int timeT2_1000 = SLTSim(*iTel);
420 if (timeT2_1000 || fMinRequiredTriggerLevel >= eFLT) {
422 ++RunController::GetInstance().GetRunData().GetNamedCounters()[
"FdTriggerSimulator/SLT"];
424 const int timeShift_100 = ShiftEventToSLT(*iTel, timeT2_1000);
425 TMirrorEvent*
const mirrorEvent = MakeMirrorEvent(*iTel, event, offsetFdSd, timeShift_100);
426 bool foundTLT = TLTSim(mirrorEvent, *iTel);
428 if (foundTLT || fMinRequiredTriggerLevel >= eSLT) {
430 ++RunController::GetInstance().GetRunData().GetNamedCounters()[
"FdTriggerSimulator/TLT"];
432 eyeEvent.AddEvent(mirrorEvent);
433 eyeWithTrigger =
true;
442 if (eyeWithTrigger) {
445 cout <<endl<<
"**************** Event with SLTrigger on Eye "
446 <<(*iEye).GetId()<<
" ************************" << endl << endl;
448 const bool foundT3 = T3Sim(eyeEvent, *iEye);
453 const bool hasSimShower =
event.HasSimShower();
454 const TimeStamp& coreTime = (hasSimShower ?
event.GetSimShower().GetTimeStamp() :
event.GetHeader().GetTime());
455 const Point& eyePos = Detector::GetInstance().GetFDetector().GetEye(*iEye).GetPosition();
456 const Point& corePos = (hasSimShower ?
event.GetSimShower().GetPosition() : eyePos);
458 iEye->GetTriggerData().SetT3Time(t3Time);
461 if (foundT3 || fMinRequiredTriggerLevel >= eTLT) {
463 eventWithTrigger =
true;
464 INFO(
"\n\n**************** Event with triggered eye ! ****************\n\n");
465 AddEyeEvent(*iEye, event, eyeEvent);
467 ++RunController::GetInstance().GetRunData().GetNamedCounters()[
"FdTriggerSimulator/T3"];
473 if (eventWithTrigger)
474 ++RunController::GetInstance().GetRunData().GetNamedCounters()[
"FdTriggerSimulator/triggeredEvents"];
484 FdTriggerSimulator::Finish()
487 if (fMaxSimTriggerLevel <= eTLT && fTltLogFile) {
499 const fdet::Telescope& detTel = Detector::GetInstance().GetFDetector().GetTelescope(tel);
503 const unsigned int telId = tel.
GetId();
504 const unsigned int eyeId = tel.
GetEyeId();
507 fChannelReadOutList.clear();
510 fMultiplicity.clear();
512 unsigned int nPixShower = 0;
513 unsigned int nPixFLT = 0;
514 unsigned int nPixFLTShower = 0;
515 unsigned int nPixFLTBg = 0;
517 bool haspixel =
false;
520 for (
unsigned int channelId = 1; channelId <= detTel.
GetLastPixelId(); ++channelId) {
523 unsigned int pixelId = detChannel.
GetPixelId();
541 if (pixel.
GetStatus() == ComponentSelector::eDeSelected)
549 if (fVerbosity >= 1 && !haspixel) {
550 cout << endl <<
">============== FIRST LEVEL TRIGGER on Mirror/Eye "
551 << telId <<
"/" << eyeId <<
" ===============< "<< endl;
559 if (hasShowerPhotons)
565 if (hasShowerPhotons) {
567 if (fVerbosity >= 2) {
568 unsigned int duration = 0;
569 unsigned int t0_ph = 0;
570 for (
unsigned int t = 0; t < phTrace.
GetSize(); ++t) {
571 if (phTrace[t] > 0) {
580 <<
" photons: pixel ID = " << pixelId
581 <<
" signal duration : " << t0_ph <<
" -> " << t0_ph+duration-1
583 for (
unsigned int t = t0_ph; t < t0_ph + duration; ++t) {
584 cout <<
"[" << setw(3)<<t <<
"] signal = " << setw(10)<<phTrace[t]
585 <<
" --> ADC = " << setw(4) << fadc_trace[t]
594 if (T1Trigger(channelId, threshold, nBox, fadc_trace, sim, detChannel)) {
597 if (hasShowerPhotons) {
611 if (fVerbosity > 0) {
613 msg <<
"FLT simulation for eye=" << eyeId <<
" telescope=" << telId
614 <<
" number of FLT pixels=" << nPixFLT;
625 if (fMaxSimTriggerLevel > eSLT) {
626 if (fVerbosity > 1) {
627 INFO(
"skipping SLT simulation");
632 const unsigned int telId = tel.
GetId();
635 if (fVerbosity >= 1) {
636 cout << endl<<
">============== SECOND LEVEL TRIGGER on Mirror/Eye "
637 <<telId <<
"/"<<eyeId<<
" ==============< "<< endl;
643 const fdet::Telescope& detTel = Detector::GetInstance().GetFDetector().GetTelescope(tel);
648 int timeT2_1000 = T2Trigger(detTel, lastFLTbin);
652 if (fVerbosity > 0) {
654 msg <<
"SLT simulation for eye=" << eyeId <<
" telescope=" << telId;
656 msg <<
" SLT trigger time=" << timeT2_1000*10 <<
" [100ns]";
670 const fdet::Camera& detCamera = Detector::GetInstance().GetFDetector().GetTelescope(tel).GetCamera();
674 int timeT2_100 = timeT2_1000*10;
678 if (fMinRequiredTriggerLevel >= eFLT &&
684 if (timeT2_100 < 0) {
685 ERROR(
"No valid SLT trigger time is available for this event!");
690 int timeShift_1000 = int(
double(timeT2_100 - SLTbin)/10);
691 int timeShift_100 = 10 * timeShift_1000;
694 if (timeT2_100 < SLTbin) {
696 err <<
" >>>>> Warning T2 = " << timeT2_100
697 <<
" too low. SLTbin=" << SLTbin <<
". Resetting Time Offset (was "
698 << timeShift_100 <<
")";
709 numSimT1Bin += adcTraceLength;
711 numSimT1Bin = 2*adcTraceLength;
714 if (timeT2_100 + adcTraceLength-SLTbin > numSimT1Bin) {
718 err <<
" >>>>> Warning timeT2_100 = " << timeT2_100
719 <<
" too high: resetting Time Offset (was " << timeShift_100 <<
")"
720 <<
" adcTraceLength=" << adcTraceLength
721 <<
" SLTbin="<< SLTbin <<
" numSimT1Bin=" << numSimT1Bin;
725 timeShift_1000 = int( (-adcTraceLength+numSimT1Bin) * sltBinsPerFltBin) / 10;
726 timeShift_100 = timeShift_1000 * 10;
727 timeT2_1000 = (timeShift_100 + SLTbin) / 10;
728 timeT2_100 = timeT2_1000 * 10;
732 if (fVerbosity >= 1) {
733 cout <<
" >>>>> Shifting traces to SLT trigger time: Time Offset is " << timeShift_100
735 " ( = " << timeT2_100 <<
" - " << SLTbin <<
" )"
736 " <<<<<" << endl << endl;
743 DoPixelList(timeShift_100, detTel);
748 return timeShift_100;
757 if (fMaxSimTriggerLevel > eTLT) {
758 if (fVerbosity > 1) {
759 INFO(
"skipping TLT simulation");
764 const unsigned int telId = tel->GetEventHeader()->GetMirrorNo();
765 const unsigned int eyeId = tel->GetEventHeader()->GetEyeNo();
768 if (fVerbosity >= 1) {
770 info << endl <<
" >============== THIRD LEVEL TRIGGER on mirror "
771 << telId <<
" eye " << eyeId <<
" ==============< "<< endl << endl;
776 fTltProcessor->Clear();
777 fTltProcessor->Decide(tel);
779 bool result = fTltProcessor->IsEventAccepted();
780 TMirrorEventHeader::EMiEventLabel tltLabel = fTltProcessor->GetEventLabel();
783 tel->GetEventHeader()->SetEventLabel(tltLabel);
788 telTrigger.
SetTLTLabel(tel->GetEventHeader()->GetVerboseEventLabel(tltLabel));
790 ostringstream thisT3info;
791 thisT3info<<
" +++++++++++++++++++++ "
793 << (result ?
"accepted" :
"rejected")
795 <<
" label = " << tel->GetEventHeader()->GetVerboseEventLabel(tltLabel)
800 #else // if not using FDLIB_V3R3
807 FdTriggerSimulator::T3Sim(TEyeEvent& eye,
fevt::Eye& evtEye)
818 if (fMaxSimTriggerLevel > eT3) {
819 if (fVerbosity > 1) {
820 INFO(
"skipping T3 simulation");
825 const unsigned int eyeId = eye.GetEventHeader()->GetEyeNo();
828 if (fVerbosity >= 1) {
830 info << endl <<
" >============== T3 LEVEL TRIGGER on eye "
831 << eyeId <<
" ==============< "<< endl << endl;
851 TEyeEventHeader::EEventClass t3class = eye.GetEventHeader()->GetEventClass();
853 ostringstream thisT3info;
855 if (t3class != TEyeEventHeader::kLargeEvent &&
856 t3class != TEyeEventHeader::kRejected &&
857 t3class != TEyeEventHeader::kIsMuon &&
858 t3class != TEyeEventHeader::kNoise) {
866 static string t3config_last =
"none";
869 if (t3config_last !=
string(
"old")) {
870 fT3->SetParameters(t3config_OLD,
true);
871 t3config_last = string(
"old");
874 if (t3config_last !=
string(
"std")) {
875 fT3->SetParameters(t3config_STD,
true);
876 t3config_last = string(
"std");
880 if (T3time <
UTCDateTime(2012,2,15).GetTimeStamp()) {
881 if (t3config_last !=
string(
"std")) {
882 fT3->SetParameters(t3config_STD,
true);
883 t3config_last = string(
"std");
886 if (t3config_last !=
string(
"he2")) {
887 fT3->SetParameters(t3config_HE2,
true);
888 t3config_last = string(
"he2");
892 fT3->DoClassification (&eye);
894 t3class = fT3->GetEventClass();
895 eye.GetEventHeader()->SetEventClass(t3class);
897 float t3Azimuth = fT3->GetAzimuthAtGround();
900 int timeAtGround = fT3->GetTimeAtGround();
902 int nPix = fT3->GetNPixels();
904 float sdpTheta = fT3->GetSDPTheta();
906 float sdpPhi = fT3->GetSDPPhi();
908 float t3TotalSignal = fT3->GetTotalSignal();
912 eye.GetT3Data()->SetNPixels(nPix);
913 eye.GetT3Data()->SetSDPTheta(sdpTheta);
914 eye.GetT3Data()->SetSDPPhi(sdpPhi);
915 eye.GetT3Data()->SetAzimuthAtGround(t3Azimuth);
916 eye.GetT3Data()->SetTimeAtGround(timeAtGround);
917 eye.GetT3Data()->SetTotalSignal(t3TotalSignal);
922 eyeTrig.
SetT3SDP(sdpTheta, sdpPhi, t3Azimuth);
924 eyeTrig.
SetT3Class(eye.GetEventHeader()->GetVerboseEventClass(t3class));
926 thisT3info <<
" +++++++++++ T3 resulting eventClass = "
927 << eye.GetEventHeader()->GetVerboseEventClass(t3class)
928 <<
" +++++++++++++++";
932 thisT3info <<
" +++++++++++ T3 not used due to eventClass = "
933 << eye.GetEventHeader()->GetVerboseEventClass(t3class)
934 <<
" +++++++++++++++";
942 case TEyeEventHeader::kCloseShower:
943 case TEyeEventHeader::kShowerCandidate:
944 case TEyeEventHeader::kHorizontalShower:
945 case TEyeEventHeader::kIsShower:
947 thisT3info <<
" ++++++++++++ T3: accepted ";
961 thisT3info <<
" ++++++++++++ T3: rejected ";
967 #else // if not using FDLIB_V3R3
975 FdTriggerSimulator::DoPixelList(
int sltTimeShift,
978 vector<int> survivingFLT;
979 vector<int> timeOfStart;
980 vector<int> rejectedFLT;
981 vector<unsigned int> neighbourPixels;
987 const int sltTimeShiftInFltBins = int(sltTimeShift / fltBinsPer100ns);
990 for (list<int>::iterator iChannelFLT = fChannelFLT.begin();
991 iChannelFLT != fChannelFLT.end(); ) {
993 int channelId = *iChannelFLT;
998 cout <<
" DoPixelList test pixel with FLT channelId=" << channelId;
1002 bool fltInShiftedWindow =
false;
1003 if (fFLT.count(channelId)) {
1006 for (FltTrace::const_iterator bin = fFLT[channelId].begin();
1007 bin != fFLT[channelId].end(); ++bin) {
1010 const int tbin = bin->first;
1011 const int shiftBin = tbin - sltTimeShiftInFltBins;
1015 timeOfStart.push_back(tbin);
1016 survivingFLT.push_back(channelId);
1017 fltInShiftedWindow =
true;
1022 if (fltInShiftedWindow) {
1025 if (fVerbosity >= 4)
1026 cout <<
" : readout " << endl;
1030 fChannelReadOutList.push_back(channelId);
1036 if (fVerbosity >= 4)
1037 cout <<
" : has no FLT in trace (REMOVE FLT)!" << endl;
1040 rejectedFLT.push_back(channelId);
1041 iChannelFLT = fChannelFLT.erase(iChannelFLT);
1044 if (fVerbosity >= 2)
1045 cout <<
" &&&& Pixel " << channelId <<
" is out of time (REMOVE FLT)!" << endl;
1054 if (fVerbosity >= 4)
1055 cout <<
" : ERROR fFLT not filled !" << endl;
1063 for (list<int>::const_iterator iChannelFLT = fChannelFLT.begin();
1064 iChannelFLT != fChannelFLT.end(); ++iChannelFLT) {
1066 int channelId = *iChannelFLT;
1069 int col = ((channelId-1)/22) + 1;
1070 int row = ((channelId-1)%22) + 1;
1072 for (
int c_neigh = -fColRO; c_neigh <= fColRO; ++c_neigh) {
1073 for (
int r_neigh = -fRowRO; r_neigh <= fRowRO; ++r_neigh) {
1075 int c = col + c_neigh;
1076 int r = row + r_neigh;
1077 if (c >= 1 && c <= 20 && r >= 1 && r <= 22) {
1079 int neigh_channel = 22 * (c - 1) + r;
1082 if (find(fChannelReadOutList.begin(), fChannelReadOutList.end(), neigh_channel) ==
1083 fChannelReadOutList.end()) {
1084 fChannelReadOutList.push_back(neigh_channel);
1085 neighbourPixels.push_back(neigh_channel);
1093 for (list<int>::const_iterator iReadOutChannel = fChannelReadOutList.begin();
1094 iReadOutChannel != fChannelReadOutList.end(); ++iReadOutChannel) {
1096 unsigned int channelId = *iReadOutChannel;
1104 if (find(fChannelReadOutList.begin(), fChannelReadOutList.end(), virtual_channel) ==
1105 fChannelReadOutList.end()) {
1106 fChannelReadOutList.push_back(virtual_channel);
1114 if (fVerbosity >= 1) {
1116 int tstartmin = 9999999;
1117 int tstartmax =-9999999;
1123 for (
unsigned int k = 0; k < timeOfStart.size(); ++k) {
1125 int t_bin = timeOfStart[k];
1128 if (fMultiplicity.count(t_bin)) {
1129 mult = fMultiplicity[t_bin];
1132 if (fVerbosity >= 4) {
1133 cout <<
" surviving FLT in pixelId=" << setw(2) << survivingFLT[k]
1134 <<
" time of start " << setw(4) << timeOfStart[k]
1135 <<
" FLT multiplicity at bin " << setw(3) << mult
1137 }
else if (fVerbosity >= 2) {
1138 cout <<
"flt pixel no " << setw(2) << k
1139 <<
" time of start " << setw(4) << timeOfStart[k]
1140 <<
" multiplicity " << setw(3) << mult
1146 tstartmin = timeOfStart[k];
1147 tstartmax = timeOfStart[k];
1149 t_maxmult = timeOfStart[k];
1151 if (timeOfStart[k] < tstartmin)
1152 tstartmin = timeOfStart[k];
1153 if (timeOfStart[k] > tstartmax)
1154 tstartmax = timeOfStart[k];
1155 if (mult > maxmult) {
1157 t_maxmult = timeOfStart[k];
1162 if (fVerbosity >= 4) {
1163 for (
unsigned int k = 0; k < rejectedFLT.size(); ++k) {
1164 int channelId = rejectedFLT[k];
1165 cout <<
" rejected FLT in channelId=" << setw(2) << channelId;
1166 if (fVerbosity >= 5) {
1167 cout <<
" FLTtrace: ";
1168 if (fFLT.count(channelId)) {
1169 bool firstInTrace =
true;
1170 int previous = -100;
1171 for (FltTrace::const_iterator bin = fFLT[channelId].begin();
1172 bin != fFLT[channelId].end(); ++bin) {
1173 if (previous != (bin->first-1)) {
1175 firstInTrace =
false;
1178 cout <<
"-" << previous <<
", " << bin->first;
1181 previous = bin->first;
1183 if (!firstInTrace) {
1193 <<
" NpixON=" << nPixON
1194 <<
", NpixRO=" << fChannelReadOutList.size()
1195 <<
", Max mult= " << maxmult
1196 <<
" @ t = " << t_maxmult
1197 <<
", time of start: min " << tstartmin
1198 <<
", max " << tstartmax
1201 if (fVerbosity >= 2) {
1202 cout << endl <<
" *** List of Read Out pixels ***" << endl;
1205 for (list<int>::const_iterator iReadOutPixel = fChannelReadOutList.begin();
1206 iReadOutPixel!=fChannelReadOutList.end(); ++iReadOutPixel) {
1209 unsigned int p = int(*iReadOutPixel);
1213 int col = ((p-1) / 22) + 1;
1214 int row = ((p-1) % 22) + 1;
1217 if (find(neighbourPixels.begin(), neighbourPixels.end(),
p) == neighbourPixels.end()) {
1219 cout << setw(4) << n
1220 <<
" pixel " << setw(3) << p
1221 <<
" col " << setw(3) << col
1222 <<
" row " << setw(3) << row
1227 cout << setw(4) << n
1228 <<
" pixel " << setw(3) << p
1229 <<
" col " << setw(3) << col
1230 <<
" row " << setw(3) << row
1231 <<
" --> neighbour "
1236 int virt = (p-1)%2 + 1;
1238 cout << setw(4) << n
1239 <<
" pixel " << setw(3) << p
1240 <<
" col " << setw(3) << col
1241 <<
" virt " << setw(3) << virt
1254 FdTriggerSimulator::T1Trigger(
unsigned int channelId,
1255 unsigned int pixelthresh,
1263 unsigned int tstart = 0;
1264 unsigned int tend = 0;
1265 unsigned int prolongationCounter = 0;
1267 bool hasFLT =
false;
1269 unsigned int maxBoxcarSum = 0;
1270 double meanBoxcarSum = 0;
1271 double rmsBoxcarSum = 0;
1272 unsigned int ntslots = 0;
1273 double squareBoxcarSum = 0;
1275 vector<int> boxcar(nSamp, 0);
1277 for (
unsigned int iBin = 0; iBin < trace.
GetSize(); ++iBin) {
1280 for (
unsigned int i = 0; i < nSamp-1; ++i)
1281 boxcar[i] = boxcar[i+1];
1282 boxcar[nSamp-1] = trace [iBin];
1285 unsigned int boxcarsum = 0;
1286 for(
unsigned int l = 0; l < nSamp; ++l) {
1287 boxcarsum += boxcar[l];
1291 if (iBin > nSamp-1) {
1293 meanBoxcarSum += boxcarsum;
1294 squareBoxcarSum += boxcarsum*boxcarsum;
1297 if (boxcarsum > maxBoxcarSum)
1298 maxBoxcarSum = boxcarsum;
1301 bool bin_above_threshold = (boxcarsum > pixelthresh);
1302 if (bin_above_threshold) {
1305 prolongationCounter = 0;
1313 if (fVerbosity >= 1) {
1314 cout <<
"##### FLT start " << setw(5) << iBin
1315 <<
" pixel " << setw(3) << channelId
1316 <<
"; sum(" << nSamp <<
") = " << setw(5) << boxcarsum
1317 <<
" threshold = " << pixelthresh
1325 if (fVerbosity >= 2) {
1326 int col = ((channelId - 1) / 22) + 1;
1327 int row = ((channelId - 1) % 22) + 1;
1328 cout <<
" > FLT Pixel # " << channelId <<
" col " << col <<
" row " << row
1329 <<
" ==> OVER threshold @ time " << iBin
1330 <<
" sum: " << boxcarsum <<
", thres: " << pixelthresh
1340 prolongationCounter = 0;
1347 if (hasFLT && prolongationCounter < FLTprolongation) {
1349 if (bin_above_threshold) {
1351 if (!fMultiplicity.count(iBin)) {
1352 fMultiplicity[iBin] = 0;
1354 ++fMultiplicity[iBin];
1356 fFLT[channelId][iBin] = 1;
1360 fFLT[channelId][iBin] = 2;
1366 ++prolongationCounter;
1371 if (fVerbosity >= 4 && hasFLT) {
1372 cout <<
"##### FLT summary channelId=" << channelId <<
" start=" << tstart <<
" length=" << tend-tstart+1
1374 <<
" FLTtrace(start-1|end+1): ";
1376 for (i = tstart-1; i <= tend+1; ++i) {
1377 if (fFLT[channelId].count(i))
1382 for (i = tend; i < trace.
GetSize(); ++i) {
1383 if (!fFLT[channelId].count(i))
1386 cout <<
" first_0_bin=" << i
1388 }
else if (fVerbosity >= 2 && hasFLT) {
1389 cout <<
"##### FLT start = " << tstart <<
" length = " << tend-tstart+1
1390 <<
", end time = " << tend
1396 meanBoxcarSum /= ntslots;
1397 rmsBoxcarSum =
std::sqrt(
double(squareBoxcarSum - ntslots * meanBoxcarSum * meanBoxcarSum)/(ntslots-1));
1402 fChannelFLT.push_back(channelId);
1428 const int pebit = 0;
1429 const int triggerbit = 0;
1430 const int sparebit = 1;
1433 map<int, int> sltMultiplicity;
1434 vector<int> usedSltPixels;
1440 int numT2bins = int(lastFLTbin * fltBinsPer50ns);
1443 for (
int tt2 = 0; tt2 < numT2bins; ++tt2) {
1445 int tt2_100 = tt2/2;
1446 int flt_index = int(tt2/fltBinsPer50ns);
1447 int tt2_1000 = tt2/20;
1448 int tt2_1000_comp = tt2_1000;
1451 const int sltWindow = 5;
1452 int col_cycle_load = (tt2%20) + 1;
1453 int col_cycle_compare_low = col_cycle_load - sltWindow + 1;
1454 if (col_cycle_compare_low < 1)
1455 col_cycle_compare_low += 20;
1456 int col_cycle_compare_up = col_cycle_compare_low + sltWindow - 1;
1459 if (col_cycle_compare_up > 20) {
1460 col_cycle_compare_up = 20;
1462 if (tt2_1000_comp < 0)
1474 for (map<int, FltTrace>::const_iterator iFltTrace = fFLT.begin();
1475 iFltTrace != fFLT.end(); ++iFltTrace) {
1476 const FltTrace& fltTrace = iFltTrace->second;
1477 if (fltTrace.count(flt_index))
1484 if (fVerbosity >= 3) {
1485 cout <<
" SLT 50ns bin: " << setw(4) << tt2
1486 <<
", /2: " << setw(4) << tt2_100
1487 <<
", /20: " << setw(3) << tt2_1000
1488 <<
", loadCol: " << setw(2) << col_cycle_load
1489 <<
", compCol: " << setw(2) << col_cycle_compare_low
1490 <<
" - " << setw(2) << col_cycle_compare_up
1491 <<
" compBin1000: " << setw(3) << tt2_1000_comp
1492 <<
" nFLT: " << setw(3) << npixtot
1495 if (fVerbosity >= 4) {
1496 cout <<
"0000000000000000000000.";
1498 cout <<
"0000000000000000000000";
1508 for (
int row = 1; row <= 22; ++row) {
1510 int channelMask = (1<<(row-1));
1511 int channelId = 22*(col_cycle_load-1) + row;
1513 if (fFLT.count(channelId) &&
1514 fFLT[channelId].count(flt_index)) {
1515 rowMask |= channelMask;
1519 if (fVerbosity >= 3) {
1520 if (fFLT.count(channelId) &&
1521 fFLT[channelId].count(flt_index)) {
1522 if ((fVerbosity >= 4) &&
1523 (fFLT[channelId][flt_index]==2))
1536 if (!fSLT.count(tt2_1000)) {
1540 fSLT[tt2_1000].
SetRowMask(col_cycle_load, rowMask);
1541 fSLT[tt2_1000].SetParityError(col_cycle_load, pebit);
1542 fSLT[tt2_1000].SetTrigger(col_cycle_load, triggerbit);
1543 fSLT[tt2_1000].SetSpare(col_cycle_load, sparebit);
1547 set<int> pixInCycle;
1548 for (
int col = col_cycle_compare_low; col <= col_cycle_compare_up; ++col) {
1549 for (
int row = 1; row <= 22; ++row) {
1551 int channelId = 22*(col-1) + row;
1553 if (fSLT.count(tt2_1000_comp) &&
1554 fSLT[tt2_1000_comp].HasPixel(channelId)) {
1556 pixInCycle.insert(channelId);
1560 if (fVerbosity == 2 && npixtot > 0)
1561 cout << setw(2) << pixInCycle.size()-1
1562 <<
". pixel " << setw(3) << channelId
1563 <<
" col " << setw(3) << col <<
" row " << setw(3) << row << endl;
1571 if (fVerbosity >= 3)
1572 cout <<
", nPixCycle: " << setw(3) << pixInCycle.size() << endl;
1573 if (fVerbosity >= 2 && npixtot > 0)
1574 cout <<
" @ SLT time " << setw(3) << tt2 <<
" col [" << setw(2) << col_cycle_compare_low
1575 <<
"-" << setw(2) << col_cycle_compare_up <<
"] -> there are " << setw(2)
1576 << npixtot <<
" pixels of which " << setw(2) << pixInCycle.size() <<
" within cycle" << endl;
1577 if (fVerbosity >= 200) {
1578 cout <<
" pixincycle list: ";
1579 for (set<int>::iterator cyclePixel = pixInCycle.begin();
1580 cyclePixel!=pixInCycle.end(); ++cyclePixel) {
1581 cout << *cyclePixel <<
" ";
1588 unsigned int pattern = 0;
1589 int multipattern = 0;
1593 for (set<int>::iterator cyclePixel = pixInCycle.begin();
1594 cyclePixel != pixInCycle.end(); ++cyclePixel) {
1596 int channelId = *cyclePixel;
1597 int col = (channelId-1)/22 + 1;
1598 int row = (channelId-1)%22 + 1;;
1605 if (col != col_cycle_compare_low)
1609 unsigned int SLTpattern = TestPattern(pixInCycle, col, row,
1613 pattern = SLTpattern;
1619 timeT2 = tt2-(sltWindow-1);
1621 if (fSLT.count(tt2_1000_comp)) {
1622 fSLT[tt2_1000_comp].SetSLTPattern(col, pattern);
1637 if (fVerbosity >= 1 && fVerbosity < 3 && pattern > 0 && pixInCycle.size() > 3)
1638 cout <<
"=-=-=-=-> SecondLevelTrigger at time " << setw(4) << tt2
1639 <<
" col " << setw(2) << col_cycle_compare_low <<
" with pattern " << setw(3) << pattern << endl;
1643 if (fVerbosity >= 2 && pattern > 0 && pixInCycle.size() > 3) {
1644 for (
int col = col_cycle_compare_low; col <= col_cycle_compare_up; ++col) {
1645 cout <<
" ==> col " << setw(2) << col <<
" pixel bits: ";
1646 for (
int b = 0;
b < 22; ++
b) {
1647 unsigned int mask = (1 <<
b);
1648 if (fSLT[tt2_1000_comp].GetRowMask(col) & mask)
1653 if (col == col_cycle_compare_low) {
1654 cout <<
" -+-+-+- pattern: " << setw(3) << pattern <<
" = ";
1655 for (
int b = 23;
b < 30; ++
b) {
1656 unsigned int mask = (1 <<
b);
1657 if (fSLT[tt2_1000_comp].GetSLTDataWord(col) & mask)
1673 if (col_cycle_load == 1)
1674 usedSltPixels.clear();
1675 else if (col_cycle_load == 20)
1676 sltMultiplicity[tt2_1000] = usedSltPixels.size();
1682 int timeT2_1000 = timeT2/20;
1683 int timeT2_100 = timeT2_1000*10;
1684 timeT2 = timeT2_1000*20;
1688 for (
int tr_col = 1; tr_col <= 20; ++tr_col) {
1689 if (fSLT.count(timeT2_1000)) {
1690 SLT_T2[tr_col-1] = fSLT[timeT2_1000].GetSLTDataWord(tr_col);
1693 if (fVerbosity >= 1 && timeT2_100 > 0) {
1695 " **** SLT T2 time (units of 100 ns) is: " << timeT2_100
1696 <<
" (50ns: " << timeT2 <<
", 1000ns: " << timeT2_1000 <<
")"
1697 " first SLT pattern was: "
1699 " ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ "
1701 for (
int col = 1; col <= 20; ++col) {
1702 cout <<
" ==> col " << setw(2) << col <<
" pixel bits: ";
1703 for (
int b = 0;
b < 22; ++
b){
1704 unsigned int mask = (1 <<
b);
1705 if (SLT_T2[col-1] & mask)
1710 unsigned int pattern = SLT_T2[col-1] & 0x03f800000;
1711 pattern = pattern >> 23;
1712 cout <<
" -+-+-+- pattern: " << setw(3) << pattern << endl;
1715 "-+-+- SLT multiplicity at each 1 mus ===>" << endl;
1716 for (
int t = 0; t < numT2bins/20; ++t) {
1718 if (sltMultiplicity.count(t) > 0)
1719 sltM = sltMultiplicity[t];
1720 cout << setw(4) << sltM <<
", ";
1733 FdTriggerSimulator::TestPattern(
const set<int>& pixInCycle,
int col,
int row,
1735 vector<int>& usedInSlt)
1737 if (pixInCycle.size() <= 3) {
1743 unsigned int pattnum = 0;
1748 p[0] = 22*(col-1) + row;
1749 c[0] = ((p[0] - 1) / 22) + 1;
1750 r[0] = ((p[0] - 1) % 22) + 1;
1754 for (
unsigned int patt = 1; patt < 109; ++patt) {
1759 for (
int m = 1;
m < 4; ++
m ) {
1769 c[
m] = ((p[
m] - 1) / 22 ) + 1;
1770 r[
m] = ((p[
m] - 1) % 22 ) + 1;
1772 if (
abs(r[0] - r[
m]) > 4)
1775 if (pixInCycle.find(pixelnumber)!=pixInCycle.end()) {
1785 for (
int m = 0;
m < 4; ++
m) {
1786 if (find(usedInSlt.begin(), usedInSlt.end(), p[
m]) == usedInSlt.end())
1787 usedInSlt.push_back(p[
m]);
1791 if (fVerbosity >= 6) {
1792 cout <<
"\n ### FOUND PATTERN no. " << setw(3) << patt
1794 for (
int dbgM = 1; dbgM < 4; ++dbgM) {
1802 cout <<
"] = {" << p[0] <<
", " << p[1] <<
", " << p[2] <<
", " << p[3] <<
"}"
1803 <<
" from col " << c[0] <<
" row " << r[0] <<
" - mult = " << multipattern
1805 }
else if (fVerbosity >= 2) {
1806 cout <<
" ### FOUND PATTERN n." << setw(3) << patt
1807 <<
" = ["<< setw(3) << p[0] <<
"," << setw(3)<< p[1] <<
","
1808 << setw(3)<< p[2] <<
"," << setw(3)<< p[3] <<
"]"
1809 <<
" from col " << setw(2)<< c[0] <<
" row "
1810 << setw(2)<< r[0] <<
" - mult = " << multipattern << endl;
1812 if (fVerbosity >= 7) {
1813 for (
int testCol = 0; testCol < 4; ++testCol) {
1814 cout <<
" col=" << col+testCol <<
" ";
1815 for (
int testRow = 1; testRow <= 22; ++testRow) {
1816 int testPxlId = (col+testCol-1)*22 + testRow;
1817 if (pixInCycle.find(testPxlId) == pixInCycle.end())
1820 bool testIsPat =
false;
1821 for (
int testM = 1; testM < 4; ++testM) {
1822 int testPxlIdSLT = 0;
1826 testPxlIdSLT = p[0] +
kSltDiffOdd[patt-1][testM-1];
1828 if (testPxlId == testPxlIdSLT)
1831 if (testIsPat || (col+testCol == col && testRow == row))
1846 if (multipattern > 1) {
1858 const int sltTimeShift)
1860 const fdet::Telescope& detTel = Detector::GetInstance().GetFDetector().GetTelescope(tel);
1870 const int telId = tel.
GetId();
1876 TMirrorEvent*
const MirrorEvent =
new TMirrorEvent();
1879 TMirrorEventHeader*
const header = MirrorEvent->GetEventHeader();
1880 TMirrorPixelData*
const pixelData = MirrorEvent->GetPixelData();
1881 TMirrorPixelList*
const pixelList = MirrorEvent->GetPixelList();
1882 TMirrorFADCData*
const fadcData = MirrorEvent->GetFADCData();
1885 header->SetEventLabel(TMirrorEventHeader::kUnlabelled);
1888 header->SetEventType(TMirrorEventHeader::kSimulatedEvent);
1889 #if FDEVENTLIB_VERSION_CODE < ModuleVersionCode(4,0,0)
1890 header->SetTriggerNum(3000);
1892 header->SetTriggerNo(3000);
1898 const int onePage = 1000;
1900 const int nextPageDelay = onePage - SLTbin;
1908 const double eventStart = (sltTimeShift + (onePage-SLTbin)) * 100.*
ns;
1910 timeEvent -= offsetFdSd;
1913 info <<
"Creating mirror event";
1914 info <<
" eye=" << eyeId <<
" tel=" << telId
1916 <<
" tStart=" << eventStart/
ns <<
" ns";
1922 header->SetNextPageNanoTime(nextPageNanoTime);
1923 header->SetNextPageTime(nextPageSec);
1924 header->SetTriggerSource(TMirrorEventHeader::kInternalTrigger);
1925 header->SetTimeCorrectionParameters(100.0, 0.0);
1927 header->SetEyeNo(eyeId);
1928 header->SetMirrorNo(telId);
1929 header->SetNextPageDelay(nextPageDelay);
1932 header->SetRunNo(1);
1934 header->SetT3Id(4097);
1935 header->SetTimeStampHigh(header->GetGPSTime());
1936 header->SetTimeStampLow(0);
1943 pixelList->SetNumPixels(0);
1945 Fd::PixelNumberRec pixelObj;
1946 Fd::PixelNumber pixel = &pixelObj;
1947 Fd::SetEyeNo(pixel, eyeId);
1948 Fd::SetMirrorNo(pixel, telId);
1950 for (list<int>::iterator iReadOutChannel = fChannelReadOutList.begin();
1951 iReadOutChannel != fChannelReadOutList.end(); ++iReadOutChannel) {
1953 const unsigned int channelId = *iReadOutChannel;
1955 if (fVerbosity >= 11)
1956 cout <<
" adding trace eyeId=" << eyeId
1957 <<
" telId=" << telId
1958 <<
" pixelId=" << channelId
1959 <<
" (eyePixId=" << Fd::GetEyePixelNo( pixel ) <<
")";
1964 const unsigned int pixelId = detChannel.
GetPixelId();
1968 if (fVerbosity >= 11) {
1969 cout <<
" pixel is eDeSelected, status=";
1973 cout <<
"doesn't exist";
1981 Fd::SetPixelNo(pixel, channelId);
1982 pixelList->AddPixel(pixel);
1989 TFADCData*
const data = fadcData->GetPixelFADCData(pixel);
1991 TFADCData::FADCDataWord word = data->GetFADCTrace();
1992 data->SetPixelNumber(pixel);
1999 data->SetTraceStartBin(0);
2000 data->SetTraceEndBin(tracelength-1);
2001 if (tracelength == 1000)
2002 data->SetTraceResolution(TFADCData::kFADC_RESOLUTION_1000_BINS);
2003 else if (tracelength == 2000)
2004 data->SetTraceResolution(TFADCData::kFADC_RESOLUTION_2000_BINS);
2009 ostringstream errMsg;
2010 errMsg <<
"FADC trace length of " << tracelength
2011 <<
" has no correspondance in FDEventLib";
2017 unsigned int Mean = 0;
2018 unsigned int RMS = 0;
2019 unsigned int actualThr = 0;
2025 Mean = int(ceil(pxsimdata.
GetMean()));
2026 RMS = int(ceil(pxsimdata.
GetRMS()));
2031 data->SetVariance(RMS*RMS);
2032 data->SetMean(Mean);
2033 data->GetPixelMonitorData()->fActualThreshold = actualThr;
2036 if (fVerbosity >= 11)
2037 cout <<
" rms=" << RMS
2039 <<
" threshold=" << actualThr;
2045 err <<
" Channel/pixel with id=" << channelId <<
" was listed for FADC readout, "
2046 <<
" but there is no object like this available!"
2055 const int nFADCbins = fadc_trace.
GetSize();
2058 if (fVerbosity >= 11)
2059 cout <<
" simTraceSize=" << nFADCbins <<
" trace:" << endl;
2063 const int fltTimeShift = int(sltTimeShift / sltBinsPerFltBin);
2072 FADCDataWordSetWord(&word[k], 0);
2074 const int tbin = k + fltTimeShift;
2076 unsigned short int value = 0;
2077 if (tbin >= nFADCbins) {
2079 err <<
"Bin=" << tbin <<
" out of simulated FADC trace min=" << 0
2080 <<
" max=" << nFADCbins-1 <<
" THIS SHOULD NEVER HAPPEN!"
2084 value = fadc_trace[tbin];
2087 if (fVerbosity >= 12)
2088 cout <<
" trace bin: " << setw(4) << k
2089 <<
" shifted " << setw(4) << tbin
2090 <<
" value=" << setw(5) << value;
2093 if (fFLT.count(channelId) &&
2094 fFLT[channelId].count(tbin)) {
2096 if (fFLT[channelId][tbin] == 1) {
2102 if (fVerbosity >= 12)
2103 cout <<
" FLT bit set";
2106 }
else if (fFLT[channelId][tbin] == 2) {
2108 if (fVerbosity >= 12)
2109 cout <<
" (FLT prolongated)";
2116 FADCDataWordSetWord( &(word[k]), value );
2119 if (fVerbosity >= 12)
2133 vector<fevt::SLTData> sltData;
2135 for (
unsigned int t2bin = 0; t2bin < nSltBins; ++t2bin ) {
2137 const int t2binShift = t2bin + sltTimeShift/10;
2139 if (fVerbosity > 101) {
2140 cout <<
" add slt t2bin=" << t2bin <<
" t2binShift=" << t2binShift <<
" \n";
2144 for (
unsigned int col = 1; col <= 20; ++col) {
2145 TMirrorPixelData::PixelDataWord pword = pixelData->GetPixelData(col, t2bin);
2147 if (fSLT.count(t2binShift)) {
2148 slt_word = fSLT[t2binShift].GetSLTDataWord(col);
2150 PixelDataSetWord(pword, slt_word);
2153 sltData.push_back(sltDataCol);
2159 const double multiplicityBinsPerFltBin = (100.*
ns) / detCamera.
GetFADCBinSize();
2162 TMirrorPixelData::MultiplicityDataWord multiplicityData = pixelData->GetMultiplicityData();
2163 for (
unsigned int tbin = 0; tbin < 1000; ++tbin) {
2166 const int tbinShift = (tbin + sltTimeShift) * multiplicityBinsPerFltBin;
2168 int multiplicity = 0;
2170 if (fMultiplicity.count(tbinShift))
2171 multiplicity = fMultiplicity[tbinShift];
2173 multiplicityData[tbin] = multiplicity;
2174 multiplicityTrace[tbin] = multiplicity;
2183 TEyeEvent& EyeEvent)
2194 const int eyeId = eye.
GetId();
2196 const int runId = 1;
2198 TEyeEventHeader*
const eyeheader = EyeEvent.GetEventHeader();
2200 eyeheader->SetEventNo(eventId);
2201 eyeheader->SetRunNo(runId);
2202 eyeheader->SetTimeCorrectionParameters(100, 0);
2217 eyeheader->SetEyeNo(eyeId);
2221 INFO (
"Making raw event for the current event");
2222 event.MakeRawEvent();
2226 AugerEvent& rawEvent =
event.GetRawEvent();
2227 rawEvent.PushEvent(EyeEvent);
2228 rawEvent.EventId = eventId;
2231 unsigned int sec = eyeheader->GetTimeStamp()->GetGPSSec();
2232 unsigned int nsec = eyeheader->GetTimeStamp()->GetNanoSec();
2237 int eclass = eyeheader->GetEventClass();
2238 int etype = eyeheader->GetEventType();
2242 std::string previous_str = evtHeader.
GetId();
2244 previous_time > tstamp) {
2245 event.GetHeader().SetTime(tstamp);
2265 headerEye.
SetEventType(static_cast<fevt::EyeHeader::EventType>(etype));
2266 headerEye.
SetEventClass(static_cast<fevt::EyeHeader::EventClass>(eclass));
2271 eyeheader->SetMirrorPresent(iTel->GetId());
2274 const fdet::FDetector& detFD = Detector::GetInstance().GetFDetector();
2281 if (eyeheader->IsMirrorDataPresent(iMirror)) {
2283 if (!eye.
HasTelescope(iMirror, ComponentSelector::eInDAQ))
2287 telescope.
SetTimeOffset(eyeheader->GetMirrorTimeOffset(iMirror));
Telescope & GetTelescope(const unsigned int telescopeId, const ComponentSelector::Status status=ComponentSelector::eHasData)
Retrieve Telescope by Id, throw exception if not existent.
unsigned int GetId() const
Trigger data for an fevt::Eye.
ComponentSelector::Status GetStatus() const
double GetFADCBinSize() const
Description of trigger data for one Telescope.
Description of the electronic channel for the 480 channels of the crate.
double GetPhi(const CoordinateSystemPtr &coordinateSystem) const
azimuth (phi) angle in spherical and cylindrical coordinates
fevt::EyeHeader & GetHeader()
Header for this Eye Event.
int GetNumberOfPhotonBins() const
Fluorescence Detector Eye Event.
evt::Header & GetHeader()
void SetRmsBoxcarsum(double v)
void SetNumberOfReadOutPixels(const int n)
void SetStatus(const ComponentSelector::Status status)
double GetTheta(const CoordinateSystemPtr &coordinateSystem) const
zenith (theta) angle in spherical coordinates
int GetThreshold() const
Get the simulated trigger threshold of the pixel.
void SetT3Accepted(bool is)
void SetTimeOffset(const unsigned int toffset)
void SetT3SDP(double theta, double phi, double azimuthAtGround)
EyeIterator EyesEnd(const ComponentSelector::Status status)
unsigned int GetEyeId() const
utl::Vector GetAxis() const
const Channel & GetChannel(const unsigned int channelId) const
Get Channel by id, throw utl::NonExistentComponentException if n.a.
#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 Init()
Initialise the registry.
const Eye & GetEye(const unsigned int eyeId) const
Find eye by numerical Id.
Detector description interface for Eye-related data.
boost::filter_iterator< ComponentSelector, AllEyeIterator > EyeIterator
selective Eye iterators
utl::TimeStamp GetPhotonsStartTime() const
Start Time of the photons trace.
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.
unsigned int GetFirstTelescopeId() const
First telescope id in the eye.
void MakeTelescope(const unsigned int telescopeId, const ComponentSelector::Status status=ComponentSelector::eHasData)
Make Telescope telescopeId.
void SetT3NPixels(unsigned int n)
ChannelSimData & GetSimData()
void SetStatus(const ComponentSelector::Status status)
const Camera & GetCamera() const
Get the Camera object that belongs to the telescope.
void SetT3Time(const utl::TimeStamp &time)
Detector description interface for FDetector-related data.
A TimeStamp holds GPS second and nanosecond for some event.
utl::TraceI & GetMultiplicity()
Exception for reporting variable out of valid range.
void SetNumberOfFltPixelsFromBackground(const int n)
boost::shared_ptr< const CoordinateTransformer > CoordinateSystemPtr
Shared pointer for coordinate systems.
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.
const short kSltDiffOdd[][3]
void SetMeanBoxcarsum(double v)
unsigned int GetLastPixelId() const
Channel & GetChannel(const unsigned int channelId)
void MakeMultiplicity(const unsigned int size=0, const double binSize=0)
Fluorescence Detector Pixel event.
TelescopeIterator TelescopesEnd()
first available tel of status eHasData (DEPRECATED)
double abs(const SVector< n, T > &v)
const Telescope & GetTelescope(const unsigned int telescopeId) const
Find Telescope by numerical Id.
EyeIterator EyesBegin(const ComponentSelector::Status status)
int GetFADCTraceLength() const
#define EVENTCLASSIFIER_PARAMETERS_HEAT_2
void SetNumberOfFltPixels(const int n)
utl::TraceI & GetFADCTrace(const FdConstants::LightSource source=FdConstants::eTotal)
#define EVENTCLASSIFIER_PARAMETERS_OLD
boost::filter_iterator< ComponentSelector, AllTelescopeIterator > TelescopeIterator
selective Telescope iterators
void SetT3Class(const std::string &label)
#define WARNING(message)
Macro for logging warning messages.
Fluorescence Detector Channel Event.
void GetData(bool &b) const
Overloads of the GetData member template function.
Top of Fluorescence Detector event hierarchy.
TelescopeIterator TelescopesBegin()
first available tel of status eHasData (DEPRECATED)
double GetRMS() const
Get the ADC variance.
void SetSltTimeShift(const int n)
void SetNumberOfPixelsWithShowerPhotons(const int n)
Pixel & GetPixel(const unsigned int pixelId, const ComponentSelector::Status status=ComponentSelector::eHasData)
Retrieve Pixel by Id, throw exception if not existent.
int GetNumSamples() const
Get the no. of samples for running sums.
int GetFLTProlongation() const
const utl::TimeInterval & GetSDTimeOffset() const
Time Offset of this eye with respect to SD.
constexpr double kSpeedOfLight
void SetTLTAccepted(const bool is)
Detector description interface for Telescope-related data.
A TimeInterval is used to represent time elapsed between two events.
ResultFlag
Flag returned by module methods to the RunController.
bool HasChannel(const unsigned int channelId) const
const Telescope & GetTelescope(const fevt::Telescope &eventTel) const
Get fdet::Telescope from fevt::Telescope.
int GetSLTTraceLength() const
unsigned long GetGPSSecond() const
GPS second.
void SetNumberOfFltPixelsFromShower(const int n)
double GetFADCBinSize() const
double GetGPSNanoSecond() const
GPS nanosecond.
unsigned int GetId() const
void SetSLTDataWord(unsigned int col, const unsigned int sltDataWord)
const short kSltDiffEven[][3]
double GetMean() const
Get the ADC baseline.
bool HasTelescope(const unsigned int telescopeId, const ComponentSelector::Status status=ComponentSelector::eHasData) const
Check if the telescope is in the event.
unsigned int GetVirtualChannelId() const
utl::Point GetPosition() const
utl::TraceD & GetPhotonTrace(const FdConstants::LightSource source=FdConstants::eTotal)
Simulated Photon Trace.
unsigned int GetLastTelescopeId() const
Last telescope id in the eye.
Main configuration utility.
void SetSLTData(const std::vector< fevt::SLTData > &s)
fevt::EyeTriggerData & GetTriggerData()
Trigger data for this eye.
unsigned int GetLastColumn() const
Fluorescence Detector Telescope Event.
double Mean(const std::vector< double > &v)
void SetTLTLabel(const std::string &label)
Description of trigger data for one Telescope.
std::map< int, int > FltTrace
static Policy::type Create(const utl::Point &theOrigin)
Create the standard local coordinate system for a Point.
void SetRowMask(unsigned int col, const int mask)
#define ERROR(message)
Macro for logging error messages.
fevt::TelescopeTriggerData & GetTriggerData()
TimeStamp GetTimeStamp() const
boost::filter_iterator< ComponentSelector, ConstAllTelescopeIterator > ConstTelescopeIterator
int GetFADCTraceLength() const
utl::Branch GetTopBranch(const std::string &id)
Get top branch for moduleConfigLink with given id (XML files)
void SetFltDuration(int v)
int GetSLTTriggerBin() const
#define EVENTCLASSIFIER_PARAMETERS_STD
void SetSltTriggerTime(const int n)
Fluorescence Detector Pixel Simulated Data.
void SetMaxBoxcarsum(int v)
unsigned int GetPixelId() const