Commit 42e4ee9d authored by Lennart Huth's avatar Lennart Huth
Browse files

adding more plots

parent e32fec07
Pipeline #2775954 failed with stages
in 20 minutes and 20 seconds
......@@ -278,10 +278,11 @@ void AnalysisEfficiency::initialize() {
prev_hit_ts.assign(nCols, v_row); // use vector v_row to construct matrix
// pivot study:
pivot_vs_delta_t = new TH2D("pivot_vs_delta_t", "piv vs time in event: pivot; delta_t", 577, 0, 577, 350, 0, 350);
TDirectory* directory = getROOTDirectory();
TDirectory* local_directory = directory->mkdir("pivot_study");
local_directory->cd();
for(uint piv = 0; piv < 57; ++piv) {
for(uint piv = 0; piv < 58; ++piv) {
std::string pivstring = std::to_string(piv) + "_eTotalEfficiency";
auto _eTotalEfficiency = new TEfficiency(pivstring.c_str(), "totalEfficiency;;#epsilon", 1, 0, 1);
......@@ -300,11 +301,13 @@ void AnalysisEfficiency::initialize() {
pivstring = std::to_string(piv) + "_efficiencyVsTime";
auto _efficiencyVsTime =
new TEfficiency(pivstring.c_str(), "Efficiency vs. time; time [s]; #epsilon", 3000, 0, 3000);
pivstring = std::to_string(piv) + "_timepix3time";
auto delta_t = new TH1D(pivstring.c_str(), "TPX3 time relativ to event start; delta t / #mus;", 350, 0, 350);
pivot_eTotalEfficiency[int(piv)] = _eTotalEfficiency;
pivot_efficiencyColumns[int(piv)] = _efficiencyColumns;
pivot_efficiencyRows[int(piv)] = _efficiencyRows;
pivot_efficiencyVsTime[int(piv)] = _efficiencyVsTime;
pivot_tpx3_event[int(piv)] = delta_t;
}
}
......@@ -461,6 +464,12 @@ StatusCode AnalysisEfficiency::run(const std::shared_ptr<Clipboard>& clipboard)
efficiencyRows->Fill(has_associated_cluster, m_detector->getRow(localIntercept));
efficiencyVsTime->Fill(has_associated_cluster, track->timestamp() / 1e9); // convert nanoseconds to seconds
int piv = track.get()->getClusters().front()->getSeedPixel()->raw() / 10;
auto start = clipboard->getEvent()->start();
if(has_associated_cluster) {
pivot_tpx3_event.at(piv)->Fill(Units::convert(associated_clusters.front()->timestamp() - start, "us"));
pivot_vs_delta_t->Fill(track.get()->getClusters().front()->getSeedPixel()->raw(),
Units::convert(associated_clusters.front()->timestamp() - start, "us"));
}
pivot_eTotalEfficiency.at(piv)->Fill(has_associated_cluster, 0); // use 0th bin for total efficiency
pivot_efficiencyColumns.at(piv)->Fill(has_associated_cluster, m_detector->getColumn(localIntercept));
pivot_efficiencyVsTime.at(piv)->Fill(has_associated_cluster,
......
......@@ -73,6 +73,8 @@ namespace corryvreckan {
std::map<int, TEfficiency*> pivot_efficiencyColumns;
std::map<int, TEfficiency*> pivot_efficiencyRows;
std::map<int, TEfficiency*> pivot_efficiencyVsTime;
std::map<int, TH1D*> pivot_tpx3_event;
TH2D* pivot_vs_delta_t;
TH1D* hDistanceCluster;
TH1D* hTimeDiffPrevTrack_assocCluster;
......
......@@ -78,7 +78,7 @@ void EventDefinitionM26::initialize() {
timebetweenTLUEvents_ =
new TH1F("htimebetweenTrigger", "time between two triggers frames; time /us; #entries", 1000, -0.5, 995.5);
eventDuration_ =
new TH1F("durationCorryEvent", "Event duration as defined on clipboard; time [#mus]; #entries", 1000, 115.2, 230.4);
new TH1F("durationCorryEvent", "Event duration as defined on clipboard; time [#mus]; #entries", 240, 115.2, 360.4);
timeBeforeTrigger_ = new TH1F("timeBeforeTrigger", "time in frame before trigger; time /us; #entries", 2320, -231, 1);
timeAfterTrigger_ = new TH1F("timeAfterTrigger", "time in frame after trigger; time /us; #entries", 2320, -1, 231);
......@@ -105,6 +105,26 @@ void EventDefinitionM26::initialize() {
<< " '. Please verify that the path and file name are correct.";
throw InvalidValueError(config_, "file_path", "Parsing error!");
}
// pivot pixel etc plots
title = "pivot vs next time; pivot; start(i+1) - end(i) / #mus";
_pivot_vs_next_event = new TH2F("pivotVsdistToNextEVENT", title.c_str(), 576, 0, 576, 1010, -10, 1000);
title = "pivot vs privious time; pivot; start(i) - end(i-1) / #mus";
_pivot_vs_priv_event = new TH2F("pivotVsdistToPreviousEVENT", title.c_str(), 576, 0, 576, 1010, -10, 1000);
title = "pivot vs next time; pivot; trig(i+1) - trig (i) #mus";
_pivot_vs_next_dtrigger = new TH2F("pivotVsdistToNextTRIGGER", title.c_str(), 576, 0, 576, 1000, -10, 1000);
title = "pivot vs privious time; pivot; trig(i) - trig (i-1) #mus";
_pivot_vs_priv_dtrigger = new TH2F("pivotVsdistToPreviousTRIGGER", title.c_str(), 576, 0, 576, 1010, -10, 1000);
}
void EventDefinitionM26::finalize(const std::shared_ptr<ReadonlyClipboard>& clipboard) {
for(uint i = 1; i < _pivots.size() - 1; ++i) {
_pivot_vs_next_event->Fill(_pivots.at(i), Units::convert(_starts.at(i + 1) - _ends.at(i), "us"));
_pivot_vs_priv_event->Fill(_pivots.at(i), Units::convert(_starts.at(i) - _ends.at(i - 1), "us"));
_pivot_vs_next_dtrigger->Fill(_pivots.at(i), Units::convert(_triggers.at(i + 1) - _triggers.at(i), "us"));
_pivot_vs_priv_dtrigger->Fill(_pivots.at(i), Units::convert(_triggers.at(i) - _triggers.at(i - 1), "us"));
}
}
unsigned EventDefinitionM26::get_next_event_with_det(const eudaq::FileReaderUP& filereader,
......@@ -144,13 +164,14 @@ unsigned EventDefinitionM26::get_next_event_with_det(const eudaq::FileReaderUP&
LOG(DEBUG) << "Skipping mimosa event with pivot " << piv;
continue;
}
_pivotCurrent = piv;
pivotPixel_->Fill(piv);
begin = Units::get(piv * (115.2 / 576), "us") + timeshift_ + add_begin_;
// begin = Units::get((576 - piv) * (115.2 / 576), "us") + timeshift_;
begin = /*Units::get(229,"us");//*/ Units::get(piv * (115.2 / 576), "us") + timeshift_ + add_begin_;
// never shift more than a full frame
if(begin > Units::get(115.2, "us"))
begin -= Units::get(115.2, "us");
// begin = Units::get((576 - piv) * (115.2 / 576), "us") + timeshift_;
// end should be after second frame, sharp (variable durationn, not variable end)
end = Units::get(230.4, "us") - begin + add_begin_ + add_end_;
......@@ -249,16 +270,30 @@ StatusCode EventDefinitionM26::run(const std::shared_ptr<Clipboard>& clipboard)
LOG(DEBUG) << "evtStart/evtEnd/duration = " << Units::display(evtStart, "us") << ", "
<< Units::display(evtEnd, "us") << ", " << Units::display(evtEnd - evtStart, "us");
auto event = std::make_shared<Event>(evtStart, evtEnd);
clipboard->putEvent(event);
LOG(DEBUG) << "Defining Corryvreckan event: " << Units::display(evtStart, {"us", "ns"}) << " - "
<< Units::display(evtEnd, {"us", "ns"}) << ", length "
<< Units::display(evtEnd - evtStart, {"us", "ns"});
eventDuration_->Fill(static_cast<double>(Units::convert(event->duration(), "us")));
hClipboardEventStart->Fill(static_cast<double>(Units::convert(evtStart, "ms")));
hClipboardEventStart_long->Fill(static_cast<double>(Units::convert(evtStart, "s")));
_starts.push_back(evtStart);
_ends.push_back(evtEnd);
_pivots.push_back(_pivotCurrent);
_triggers.push_back(time_trig);
// make the event longer if possible - requires a buffering of 1 event
if(_oldEvent.first != 0) {
//_oldEvent.second = (Units::convert(evtStart-_oldEvent.second,"us")>=115.2) ?
//_oldEvent.second+115.2*1000 : _oldEvent.second;
auto event = std::make_shared<Event>(_oldEvent.first, _oldEvent.second);
clipboard->putEvent(event);
LOG(DEBUG) << "Defining Corryvreckan event: " << Units::display(evtStart, {"us", "ns"}) << " - "
<< Units::display(evtEnd, {"us", "ns"}) << ", length "
<< Units::display(_oldEvent.second - _oldEvent.first, {"us", "ns"});
eventDuration_->Fill(static_cast<double>(Units::convert(event->duration(), "us")));
hClipboardEventStart->Fill(static_cast<double>(Units::convert(evtStart, "ms")));
hClipboardEventStart_long->Fill(static_cast<double>(Units::convert(evtStart, "s")));
} else {
triggerTLU_--;
}
_oldEvent = std::make_pair(evtStart, evtEnd);
} else {
LOG(WARNING) << "Current trigger time smaller than previous: " << time_trig << " vs " << time_prev_;
LOG(ERROR) << "Current trigger time smaller than previous: " << time_trig << " vs " << time_prev_;
}
} else if(triggerTLU_ > triggerM26_) {
......
......@@ -42,6 +42,7 @@ namespace corryvreckan {
* @brief [Initialise this module]
*/
void initialize() override;
void finalize(const std::shared_ptr<ReadonlyClipboard>& clipboard) override;
/**
* @brief [Run the function of this module]
......@@ -49,6 +50,11 @@ namespace corryvreckan {
StatusCode run(const std::shared_ptr<Clipboard>& clipboard) override;
private:
std::vector<long double> _starts{};
std::vector<long double> _ends{};
std::vector<long double> _pivots{};
std::vector<long double> _triggers{};
long double _pivotCurrent;
std::vector<uint32_t> triggerIDs_{};
long double timeshift_{};
int shift_triggers_{};
......@@ -67,6 +73,13 @@ namespace corryvreckan {
// input data files
std::string timestamp_, duration_;
std::pair<long double, long double> _oldEvent{};
// HIER WEITER MIT DEN PLOTS, FUELLEN UND RANGES DEFINIEREN
TH2F* _pivot_vs_next_dtrigger;
TH2F* _pivot_vs_priv_dtrigger;
TH2F* _pivot_vs_next_event;
TH2F* _pivot_vs_priv_event;
TH1F* timebetweenMimosaEvents_;
TH1F* timebetweenTLUEvents_;
TH1F* eventDuration_;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment