Commit 9cb210e1 authored by Simon Spannagel's avatar Simon Spannagel
Browse files

TestAlgorithm: remove Parameters

parent f87d8fbf
......@@ -9,59 +9,56 @@ TestAlgorithm::TestAlgorithm(Configuration config, std::vector<Detector*> detect
LOG(DEBUG) << "Setting makeCorrelations to: " << makeCorrelations;
}
void TestAlgorithm::initialise(Parameters* par) {
void TestAlgorithm::initialise(Parameters*) {
parameters = par;
// Make histograms for each Timepix3
for(int det = 0; det < parameters->nDetectors; det++) {
for(auto& detector : m_detectors) {
// Check if they are a Timepix3
string detectorID = parameters->detectors[det];
if(parameters->detector[detectorID]->type() != "Timepix3")
if(detector->type() != "Timepix3")
continue;
// Simple hit map
string name = "hitmap_" + detectorID;
hitmap[detectorID] = new TH2F(name.c_str(), name.c_str(), 256, 0, 256, 256, 0, 256);
string name = "hitmap_" + detector->name();
hitmap[detector->name()] = new TH2F(name.c_str(), name.c_str(), 256, 0, 256, 256, 0, 256);
// Cluster plots
name = "clusterSize_" + detectorID;
clusterSize[detectorID] = new TH1F(name.c_str(), name.c_str(), 25, 0, 25);
name = "clusterTot_" + detectorID;
clusterTot[detectorID] = new TH1F(name.c_str(), name.c_str(), 200, 0, 1000);
name = "clusterPositionGlobal_" + detectorID;
clusterPositionGlobal[detectorID] = new TH2F(name.c_str(), name.c_str(), 400, -10., 10., 400, -10., 10.);
name = "clusterSize_" + detector->name();
clusterSize[detector->name()] = new TH1F(name.c_str(), name.c_str(), 25, 0, 25);
name = "clusterTot_" + detector->name();
clusterTot[detector->name()] = new TH1F(name.c_str(), name.c_str(), 200, 0, 1000);
name = "clusterPositionGlobal_" + detector->name();
clusterPositionGlobal[detector->name()] = new TH2F(name.c_str(), name.c_str(), 400, -10., 10., 400, -10., 10.);
// Correlation plots
name = "correlationX_" + detectorID;
correlationX[detectorID] = new TH1F(name.c_str(), name.c_str(), 1000, -10., 10.);
name = "correlationY_" + detectorID;
correlationY[detectorID] = new TH1F(name.c_str(), name.c_str(), 1000, -10., 10.);
name = "correlationTime_" + detectorID;
correlationTime[detectorID] = new TH1F(name.c_str(), name.c_str(), 2000000, -0.5, 0.5);
name = "correlationTimeInt_" + detectorID;
correlationTimeInt[detectorID] = new TH1F(name.c_str(), name.c_str(), 8000, -40000, 40000);
name = "correlationX_" + detector->name();
correlationX[detector->name()] = new TH1F(name.c_str(), name.c_str(), 1000, -10., 10.);
name = "correlationY_" + detector->name();
correlationY[detector->name()] = new TH1F(name.c_str(), name.c_str(), 1000, -10., 10.);
name = "correlationTime_" + detector->name();
correlationTime[detector->name()] = new TH1F(name.c_str(), name.c_str(), 2000000, -0.5, 0.5);
name = "correlationTimeInt_" + detector->name();
correlationTimeInt[detector->name()] = new TH1F(name.c_str(), name.c_str(), 8000, -40000, 40000);
// Timing plots
name = "eventTimes_" + detectorID;
eventTimes[detectorID] = new TH1F(name.c_str(), name.c_str(), 3000000, 0, 300);
name = "eventTimes_" + detector->name();
eventTimes[detector->name()] = new TH1F(name.c_str(), name.c_str(), 3000000, 0, 300);
}
}
StatusCode TestAlgorithm::run(Clipboard* clipboard) {
// Loop over all Timepix3 and make plots
for(int det = 0; det < parameters->nDetectors; det++) {
for(auto& detector : m_detectors) {
// Check if they are a Timepix3
string detectorID = parameters->detectors[det];
if(parameters->detector[detectorID]->type() != "Timepix3")
if(detector->type() != "Timepix3")
continue;
// Get the pixels
Pixels* pixels = (Pixels*)clipboard->get(detectorID, "pixels");
Pixels* pixels = (Pixels*)clipboard->get(detector->name(), "pixels");
if(pixels == NULL) {
LOG(DEBUG) << "Detector " << detectorID << " does not have any pixels on the clipboard";
LOG(DEBUG) << "Detector " << detector->name() << " does not have any pixels on the clipboard";
continue;
}
......@@ -72,16 +69,16 @@ StatusCode TestAlgorithm::run(Clipboard* clipboard) {
Pixel* pixel = (*pixels)[iP];
// Hitmap
hitmap[detectorID]->Fill(pixel->m_column, pixel->m_row);
hitmap[detector->name()]->Fill(pixel->m_column, pixel->m_row);
// Timing plots
eventTimes[detectorID]->Fill((double)pixel->m_timestamp / (4096. * 40000000.));
eventTimes[detector->name()]->Fill((double)pixel->m_timestamp / (4096. * 40000000.));
}
// Get the clusters
Clusters* clusters = (Clusters*)clipboard->get(detectorID, "clusters");
Clusters* clusters = (Clusters*)clipboard->get(detector->name(), "clusters");
if(clusters == NULL) {
LOG(DEBUG) << "Detector " << detectorID << " does not have any clusters on the clipboard";
LOG(DEBUG) << "Detector " << detector->name() << " does not have any clusters on the clipboard";
continue;
}
......@@ -99,9 +96,9 @@ StatusCode TestAlgorithm::run(Clipboard* clipboard) {
Cluster* cluster = (*clusters)[iCluster];
// Fill cluster histograms
clusterSize[detectorID]->Fill(cluster->size());
clusterTot[detectorID]->Fill(cluster->tot());
clusterPositionGlobal[detectorID]->Fill(cluster->globalX(), cluster->globalY());
clusterSize[detector->name()]->Fill(cluster->size());
clusterTot[detector->name()]->Fill(cluster->tot());
clusterPositionGlobal[detector->name()]->Fill(cluster->globalX(), cluster->globalY());
// Loop over reference plane pixels to make correlation plots
if(!makeCorrelations)
......@@ -117,11 +114,11 @@ StatusCode TestAlgorithm::run(Clipboard* clipboard) {
// Correlation plots
if(abs(timeDifference) < 0.000001)
correlationX[detectorID]->Fill(refCluster->globalX() - cluster->globalX());
correlationX[detector->name()]->Fill(refCluster->globalX() - cluster->globalX());
if(abs(timeDifference) < 0.000001)
correlationY[detectorID]->Fill(refCluster->globalY() - cluster->globalY());
correlationTime[detectorID]->Fill(timeDifference);
correlationTimeInt[detectorID]->Fill(timeDifferenceInt);
correlationY[detector->name()]->Fill(refCluster->globalY() - cluster->globalY());
correlationTime[detector->name()]->Fill(timeDifference);
correlationTimeInt[detector->name()]->Fill(timeDifferenceInt);
} //*/
}
}
......
Supports Markdown
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