Commit 1b18fd89 authored by Klaas Padeken's avatar Klaas Padeken
Browse files

Corrected that I pushed a debug version

parent 3b22aa87
......@@ -367,10 +367,6 @@ void AnalysisDUT::initialize() {
200,
-10,
10);
raw_fpga_vs_chip = new TH2F("raw_fpga_vs_chip","fpga vs chip clock;chip clock;fpga clock", 1024,0,1023,2048,0,2047);
raw_fpga_vs_chip_up = new TH2F("raw_fpga_vs_chip_up","fpga vs chip clock;chip clock;fpga clock", 1024,0,1023,2048,0,2047);
raw_fpga_vs_chip_down = new TH2F("raw_fpga_vs_chip_down","fpga vs chip clock;chip clock;fpga clock", 1024,0,1023,2048,0,2047);
raw_fpga_vs_chip_norm = new TH2F("raw_fpga_vs_chip_norm","fpga vs chip clock;chip clock;fpga clock", 1024,0,1023,2048,0,2047);
}
StatusCode AnalysisDUT::run(const std::shared_ptr<Clipboard>& clipboard) {
......@@ -538,22 +534,6 @@ StatusCode AnalysisDUT::run(const std::shared_ptr<Clipboard>& clipboard) {
// Time residuals
residualsTime->Fill(tdistance);
for(auto& pixel : assoc_cluster->pixels()) {
int fpga_part=(pixel->raw()>>12)&0x3FF;
int chip_part=pixel->raw()&0x3FF;
raw_fpga_vs_chip->Fill(chip_part,(pixel->raw()>>12)&0x7FF);
if(track->timestamp()-pixel->timestamp()>7000){
raw_fpga_vs_chip_up->Fill(chip_part,(pixel->raw()>>12)&0x7FF);
LOG(DEBUG)<<"up time "<<std::hex<<fpga_part<<" "<< chip_part<<std::dec<<" "<<fpga_part-chip_part;
}else if(track->timestamp()-pixel->timestamp()<-7000){
raw_fpga_vs_chip_down->Fill(chip_part,(pixel->raw()>>12)&0x7FF);
LOG(DEBUG)<<"down time "<<std::hex<<fpga_part<<" "<< chip_part<<std::dec<<" "<<fpga_part-chip_part;
}else{
raw_fpga_vs_chip_norm->Fill(chip_part,(pixel->raw()>>12)&0x7FF);
LOG(DEBUG)<<"in time "<<std::hex<<fpga_part<<" "<< chip_part<<std::dec<<" "<<fpga_part-chip_part;
}
}
residualsTimeVsTime->Fill(tdistance, track->timestamp());
residualsTimeVsTot->Fill(tdistance, assoc_cluster->getSeedPixel()->raw());
residualsTimeVsSignal->Fill(tdistance, cluster_charge);
......
......@@ -76,11 +76,6 @@ namespace corryvreckan {
TH2F* residualsTimeVsTot;
TH2F* residualsTimeVsTime;
TH2F* residualsTimeVsSignal;
TH2F* raw_fpga_vs_chip;
TH2F* raw_fpga_vs_chip_norm;
TH2F* raw_fpga_vs_chip_up;
TH2F* raw_fpga_vs_chip_down;
TH2F* hAssociatedTracksGlobalPosition;
TH2F* hAssociatedTracksLocalPosition;
TH2F* hUnassociatedTracksGlobalPosition;
......
......@@ -142,6 +142,8 @@ StatusCode EventLoaderMuPixTelescope::read_sorted(const std::shared_ptr<Clipboar
StatusCode EventLoaderMuPixTelescope::read_unsorted(const std::shared_ptr<Clipboard>& clipboard) {
if(!eof_)
fillBuffer();
else
return StatusCode::EndRun;
while(true) {
if(pixelbuffer_.size() == 0)
break;
......@@ -177,7 +179,7 @@ StatusCode EventLoaderMuPixTelescope::read_unsorted(const std::shared_ptr<Clipbo
fillBuffer();
// Return value telling analysis to keep running
if(pixelbuffer_.size() == 0)
return StatusCode::EndRun;
return StatusCode::NoData;
prev_event_end_ = clipboard->getEvent()->end();
return StatusCode::Success;
}
......@@ -212,19 +214,17 @@ void EventLoaderMuPixTelescope::fillBuffer() {
raw_fpga_vs_chip->Fill(raw_time, static_cast<double>(temp_fpga_time & 0x7FF));
chip_delay->Fill(static_cast<double>((temp_fpga_time & 0x3FF) - raw_time));
// if the chip timestamp is smaller than the fpga we have a bit flip on the 11th bit
// if((temp_fpga_time&0x3FF)<raw_time){
// temp_fpga_time-=1024;
//}
if((temp_fpga_time & 0x3FF) < raw_time) {
temp_fpga_time -= 1024;
}
raw_fpga_vs_chip_corrected->Fill(raw_time, static_cast<double>(temp_fpga_time & 0x7FF));
// convert timestamp to ns - i'd like to do this already on the mupix8_DAQ side, but have not found the time
// yet, assuming 10bit ts
double px_timestamp = 8 * static_cast<double>((temp_fpga_time & 0xFFFFFFFFFFC00) + raw_time) - timeOffset_;
LOG(TRACE) << "Pixel timestamp " << px_timestamp;
overlap_fpga = (overlap_fpga << 12) + raw_time;
// setting tot and charge to zero here - needs to be improved
pixelbuffer_.push(
std::make_shared<Pixel>(detector_->getName(), h.column(), h.row(), overlap_fpga, 0, px_timestamp));
pixelbuffer_.push(std::make_shared<Pixel>(detector_->getName(), h.column(), h.row(), 0, 0, px_timestamp));
}
} else {
eof_ = true;
......
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