Commit 779ae8c9 authored by Lennart Huth's avatar Lennart Huth
Browse files

further work on understanding the pivot

parent 0dd6689f
......@@ -278,10 +278,10 @@ void AnalysisEfficiency::initialize() {
prev_hit_ts.assign(nCols, v_row); // use vector v_row to construct matrix
// pivot study:
pivot_vs_delta_t_frame =
new TH2D("pivot_vs_delta_t_frame", "piv vs time in event: pivot; delta_t", 577, 0, 577, 350, 0, 350);
pivot_vs_delta_t_frame = new TH2D(
"pivot_vs_delta_t_frame", "piv vs time in event; pivot; hit - start of frame / #mus", 577, 0, 577, 350, 0, 350);
pivot_vs_delta_t_trig =
new TH2D("pivot_vs_delta_t_trige", "piv vs time in event: pivot; delta_t", 577, 0, 577, 700, -350, 350);
new TH2D("pivot_vs_delta_t_trige", "piv vs time in event; pivot; hit - trigger / #mus", 577, 0, 577, 700, -350, 350);
TDirectory* directory = getROOTDirectory();
TDirectory* local_directory = directory->mkdir("pivot_study");
local_directory->cd();
......@@ -474,7 +474,7 @@ StatusCode AnalysisEfficiency::run(const std::shared_ptr<Clipboard>& clipboard)
Units::convert(associated_clusters.front()->timestamp() - start, "us"));
for(auto t : event->triggerList()) {
pivot_vs_delta_t_trig->Fill(track.get()->getClusters().front()->getSeedPixel()->raw(),
Units::convert(t.second - associated_clusters.front()->timestamp(), "us"));
Units::convert(associated_clusters.front()->timestamp() - t.second, "us"));
}
}
pivot_eTotalEfficiency.at(piv)->Fill(has_associated_cluster, 0); // use 0th bin for total efficiency
......
......@@ -111,6 +111,7 @@ StatusCode DUTAssociation::run(const std::shared_ptr<Clipboard>& clipboard) {
// Loop over all tracks
for(auto& track : tracks) {
total_tracks_++;
LOG(TRACE) << "Processing track with model " << track->getType() << ", chi2 of " << track->getChi2();
int assoc_cls_per_track = 0;
auto min_distance = std::numeric_limits<double>::max();
......@@ -121,10 +122,10 @@ StatusCode DUTAssociation::run(const std::shared_ptr<Clipboard>& clipboard) {
continue;
}
// Check distance between track and cluster
auto interceptLocal = m_detector->getLocalIntercept(track.get());
// Loop over all DUT clusters
for(auto& cluster : clusters) {
// Check distance between track and cluster
auto interceptLocal = m_detector->getLocalIntercept(track.get());
// distance of track to cluster centre
double xdistance_centre = std::abs(interceptLocal.X() - cluster->local().x());
......@@ -222,6 +223,7 @@ void DUTAssociation::finalize(const std::shared_ptr<ReadonlyClipboard>&) {
hCutHisto->Scale(1 / double(num_cluster));
LOG(STATUS) << "In total, " << assoc_cluster_counter << " clusters are associated to " << track_w_assoc_cls
<< " tracks.";
LOG(INFO) << "Number of tracks with at least one associated cluster: " << track_w_assoc_cls;
LOG(INFO) << "Number of tracks with at least one associated cluster: " << track_w_assoc_cls
<< " vs total number of tracks: " << total_tracks_;
return;
}
......@@ -46,7 +46,7 @@ namespace corryvreckan {
int num_cluster = 0;
int assoc_cluster_counter = 0;
int track_w_assoc_cls = 0;
int total_tracks_ = 0;
TH1F* hNoAssocCls;
TH1D* hDistX;
TH1D* hDistY;
......
......@@ -126,6 +126,7 @@ void EventDefinitionM26::finalize(const std::shared_ptr<ReadonlyClipboard>& clip
_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"));
}
LOG(INFO) << "We have to skip " << skipped_events_ << "events due to time cut criteria ";
}
unsigned EventDefinitionM26::get_next_event_with_det(const eudaq::FileReaderUP& filereader,
......@@ -157,6 +158,9 @@ unsigned EventDefinitionM26::get_next_event_with_det(const eudaq::FileReaderUP&
LOG(DEBUG) << "det = " << det << ", detector = " << detector;
if(det == detector) {
// MIMOSA
begin = Units::get(static_cast<double>(stdevt->GetTimeBegin()), "ps");
end = Units::get(static_cast<double>(stdevt->GetTimeEnd()), "ps");
if(det == "mimosa26") {
// pivot magic - see readme
double piv = stdevt->GetPlane(0).PivotPixel() / 16.;
......@@ -168,8 +172,8 @@ unsigned EventDefinitionM26::get_next_event_with_det(const eudaq::FileReaderUP&
_pivotCurrent = piv;
pivotPixel_->Fill(piv);
// 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_ +*/ Units::get(115.2, "us");
begin = /*Units::get(229,"us");//*/
Units::get(piv * (115.2 / 576), "us") + timeshift_ + add_begin_; // Units::get(115.2, "us");
// never shift more than a full frame
// if(begin > Units::get(115.2, "us"))
......@@ -184,10 +188,9 @@ unsigned EventDefinitionM26::get_next_event_with_det(const eudaq::FileReaderUP&
LOG(TRACE) << "Event time below skip time: " << Units::display(begin, {"ns", "us", "ms", "s"}) << "vs. "
<< Units::display(skip_time_, {"ns", "us", "ms", "s"});
continue;
} else {
begin = Units::get(static_cast<double>(stdevt->GetTimeBegin()), "ps");
end = Units::get(static_cast<double>(stdevt->GetTimeEnd()), "ps");
LOG(DEBUG) << "Set begin/end, begin: " << Units::display(begin, {"ns", "us"})
<< ", end: " << Units::display(end, {"ns", "us"});
......@@ -242,22 +245,24 @@ StatusCode EventDefinitionM26::run(const std::shared_ptr<Clipboard>& clipboard)
if(time_trig - time_prev_ > 0) {
// M26 frames need to have a distance of at least one frame length!
if(time_trig - time_prev_ < 115200 && (!add_trigger_)) {
if(time_trig - time_prev_ < 115200 /* && (!add_trigger_)*/) {
LOG(ERROR) << "M26 triggers too close together to fit M26 frame, dt = " +
Units::display(time_trig - time_prev_, "us")
<< std::endl
<< "Check if a shift of trigger IDs is required.";
}
// If we stretch the event over three frames and add a trigger, we need a larger distance
if((time_trig - time_prev_ < 345600) && add_trigger_) {
triggerTLU_--;
LOG(DEBUG)
<< "Skipping event that would overlap previous event, since bool add_triggers_ is set to true";
continue;
}
// if((time_trig - time_prev_ < 230400) && add_trigger_) {
// triggerTLU_--;
// skipped_events_++;
// LOG(DEBUG)
// << "Skipping event that would overlap previous event, since bool add_triggers_ is
// set to true";
// continue;
// }
if(add_trigger_) {
time_before_ = Units::get(115.2, "us");
time_after_ = Units::get(230.4, "us");
time_after_ = Units::get(115.2, "us");
}
timebetweenMimosaEvents_->Fill(static_cast<double>(Units::convert(time_trig - time_prev_, "us")));
timeBeforeTrigger_->Fill(static_cast<double>(Units::convert(-1.0 * time_before_, "us")));
......@@ -281,6 +286,13 @@ 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");
if(_ends.size() && evtStart < _ends.back()) {
LOG(DEBUG) << "Overlapping event - will be skipped. prev end " << _ends.back() << " vs current start "
<< evtStart;
triggerTLU_--;
skipped_events_++;
continue;
}
_starts.push_back(evtStart);
_ends.push_back(evtEnd);
_pivots.push_back(_pivotCurrent);
......
......@@ -54,6 +54,7 @@ namespace corryvreckan {
std::vector<long double> _ends{};
std::vector<long double> _pivots{};
std::vector<long double> _triggers{};
int skipped_events_{};
long double _pivotCurrent;
std::vector<uint32_t> triggerIDs_{};
......
......@@ -105,6 +105,9 @@ void EventLoaderEUDAQ2::initialize() {
title = " # events per corry event; number of events from " + detector_->getName() + " per corry event;# entries";
hEudaqeventsPerCorry = new TH1D("hEudaqeventsPerCorryEvent", title.c_str(), 50, -.5, 49.5);
title = " col vs pivot; pivot ; col";
ColVsPivot = new TH2D("hColVSPIVOT", title.c_str(), 580, 0, 580, 580, 0, 580);
title = "number of hits in corry frame vs number of eudaq frames;eudaq frames;# hits";
hHitsVersusEUDAQ2Frames = new TH2D("hHitsVersusEUDAQ2Frames", title.c_str(), 15, -.5, 14.5, 200, -0.5, 199.5);
// Create the following histograms only when detector is not auxiliary:
......@@ -425,6 +428,7 @@ PixelVector EventLoaderEUDAQ2::get_pixel_data(std::shared_ptr<eudaq::StandardEve
auto col = static_cast<int>(plane.GetX(i));
auto row = static_cast<int>(plane.GetY(i));
ColVsPivot->Fill(plane.PivotPixel() / 16., row);
auto raw = static_cast<int>(plane.GetPixel(i)); // generic pixel raw value (could be ToT, ADC, ...)
double ts;
......
......@@ -170,6 +170,7 @@ namespace corryvreckan {
TH1D* hTriggersPerEvent;
TH1D* hEudaqeventsPerCorry;
TH2D* hHitsVersusEUDAQ2Frames;
TH2D* ColVsPivot;
std::map<std::string, TH1D*> tagHist;
std::map<std::string, TProfile*> tagProfile;
......
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