Commit 5b093f50 authored by Simon Spannagel's avatar Simon Spannagel
Browse files

Merge branch 'master' into 'master'

formatting and misc

See merge request !9
parents 5bec5161 f05ba499
Pipeline #240158 passed with stages
in 4 minutes and 58 seconds
......@@ -44,5 +44,5 @@ namespace corryvreckan {
TH1F* hPixelToT;
TH1F* hPixelsPerFrame;
};
}
} // namespace corryvreckan
#endif // ATLASpixEventLoader_H
......@@ -41,5 +41,5 @@ namespace corryvreckan {
std::map<std::string, TGraph*> align_correction_rotY;
std::map<std::string, TGraph*> align_correction_rotZ;
};
}
} // namespace corryvreckan
#endif // ALIGNMENT_H
......@@ -50,5 +50,5 @@ namespace corryvreckan {
int minHitsOnTrack;
bool excludeDUT;
};
}
} // namespace corryvreckan
#endif // BASICTRACKING_H
......@@ -37,5 +37,5 @@ namespace corryvreckan {
TH1F* hShutterLength;
TH1F* hPixelsPerFrame;
};
}
} // namespace corryvreckan
#endif // CLICpixEventLoader_H
......@@ -35,5 +35,5 @@ namespace corryvreckan {
std::map<std::string, TH1F*> hTrackDiffX;
std::map<std::string, TH1F*> hTrackDiffY;
};
}
} // namespace corryvreckan
#endif // Clicpix2Correlator_H
......@@ -43,5 +43,5 @@ namespace corryvreckan {
TH1F* hPixelToT;
TH1F* hPixelsPerFrame;
};
}
} // namespace corryvreckan
#endif // Clicpix2EventLoader_H
......@@ -126,5 +126,5 @@ namespace corryvreckan {
double m_lostHits;
bool timepix3Telescope;
};
}
} // namespace corryvreckan
#endif // ClicpixAnalysis_H
#include "DUTAnalysis.h"
#include "objects/Cluster.h"
#include "objects/MCParticle.h"
#include "objects/Pixel.h"
#include "objects/SpidrSignal.h"
#include "objects/Track.h"
......@@ -10,6 +11,7 @@ DUTAnalysis::DUTAnalysis(Configuration config, std::vector<Detector*> detectors)
: Algorithm(std::move(config), std::move(detectors)) {
m_digitalPowerPulsing = m_config.get<bool>("digitalPowerPulsing", false);
m_DUT = m_config.get<std::string>("DUT");
m_useMCtruth = m_config.get<bool>("useMCtruth", false);
}
void DUTAnalysis::initialise() {
......@@ -40,6 +42,10 @@ void DUTAnalysis::initialise() {
hUnassociatedTracksGlobalPosition =
new TH2F("hUnassociatedTracksGlobalPosition", "hUnassociatedTracksGlobalPosition", 200, -10, 10, 200, -10, 10);
if(m_useMCtruth) {
residualsXMCtruth = new TH1F("residualsXMCtruth", "residualsXMCtruth", 400, -0.2, 0.2);
}
// Initialise member variables
m_eventNumber = 0;
m_nAlignmentClusters = 0;
......@@ -121,6 +127,12 @@ StatusCode DUTAnalysis::run(Clipboard* clipboard) {
LOG(DEBUG) << "No DUT clusters on the clipboard";
}
// Get the MC particles from the clipboard
MCParticles* mcParticles = (MCParticles*)clipboard->get(m_DUT, "mcparticles");
if(mcParticles == NULL) {
LOG(DEBUG) << "No DUT MC particles on the clipboard";
}
// Loop over all tracks
bool first_track = true;
for(auto& track : (*tracks)) {
......@@ -238,6 +250,27 @@ StatusCode DUTAnalysis::run(Clipboard* clipboard) {
m_nAlignmentClusters++;
hAssociatedTracksGlobalPosition->Fill(globalIntercept.X(), globalIntercept.Y());
// Get associated MC particle info and plot
if(m_useMCtruth) {
if(mcParticles == nullptr)
continue;
// Find the closest MC particle
double smallestDistance(DBL_MAX);
ROOT::Math::XYZPoint particlePosition;
for(auto& particle : (*mcParticles)) {
ROOT::Math::XYZPoint entry = particle->getLocalStart();
ROOT::Math::XYZPoint exit = particle->getLocalEnd();
ROOT::Math::XYZPoint centre(
(entry.X() + exit.X()) / 2., (entry.Y() + exit.Y()) / 2., (entry.Z() + exit.Z()) / 2.);
double distance = sqrt((centre.X() - cluster->localX()) * (centre.X() - cluster->localX()) +
(centre.Y() - cluster->localY()) * (centre.Y() - cluster->localY()));
if(distance < smallestDistance) {
particlePosition.SetXYZ(centre.X(), centre.Y(), centre.Z());
}
}
residualsXMCtruth->Fill(cluster->localX() - particlePosition.X());
}
// Fill power pulsing response
if((m_shutterOpenTime != 0 && m_shutterCloseTime == 0) ||
(m_shutterOpenTime != 0 &&
......
......@@ -34,6 +34,8 @@ namespace corryvreckan {
TH2F* clusterToTVersusTime;
TH2F* residualsTimeVsTime;
TH1F* residualsXMCtruth;
TH2F* hAssociatedTracksGlobalPosition;
TH2F* hUnassociatedTracksGlobalPosition;
......@@ -44,11 +46,12 @@ namespace corryvreckan {
std::string m_DUT;
int m_eventNumber;
int m_nAlignmentClusters;
bool m_useMCtruth;
long long int m_powerOnTime;
long long int m_powerOffTime;
long long int m_shutterOpenTime;
long long int m_shutterCloseTime;
bool m_digitalPowerPulsing;
};
}
} // namespace corryvreckan
#endif // DUTAnalysis_H
......@@ -31,5 +31,5 @@ namespace corryvreckan {
int m_eventNumber;
std::string m_detector;
};
}
} // namespace corryvreckan
#endif // DataDump_H
# Define module and return the generated name as ALGORITHM_NAME
CORRYVRECKAN_ALGORITHM(ALGORITHM_NAME)
# Add source files to library
CORRYVRECKAN_ALGORITHM_SOURCES(${ALGORITHM_NAME}
EtaCorrection.cpp
# ADD SOURCE FILES HERE...
)
# Provide standard install target
CORRYVRECKAN_ALGORITHM_INSTALL(${ALGORITHM_NAME})
#include "EtaCorrection.h"
using namespace corryvreckan;
using namespace std;
EtaCorrection::EtaCorrection(Configuration config, std::vector<Detector*> detectors)
: Algorithm(std::move(config), std::move(detectors)) {}
void EtaCorrection::initialise() {
// Initialise histograms per device
for(auto& detector : get_detectors()) {
// Check if they are a Timepix3
if(detector->type() != "Timepix3")
continue;
// Simple histogram per device
string name = "plotForDevice_" + detector->name();
plotPerDevice[detector->name()] = new TH2F(name.c_str(), name.c_str(), 256, 0, 256, 256, 0, 256);
}
// Initialise single histograms
string name = "singlePlot";
singlePlot = new TH1F(name.c_str(), name.c_str(), 1000, 0, 1000);
// Initialise member variables
m_eventNumber = 0;
}
StatusCode EtaCorrection::run(Clipboard* clipboard) {
// Loop over all Timepix3 and make plots
for(auto& detector : get_detectors()) {
// Check if they are a Timepix3
if(detector->type() != "Timepix3")
continue;
// Get the pixels
Pixels* pixels = (Pixels*)clipboard->get(detector->name(), "pixels");
if(pixels == NULL) {
LOG(DEBUG) << "Detector " << detector->name() << " does not have any pixels on the clipboard";
continue;
}
// Get the clusters
Clusters* clusters = (Clusters*)clipboard->get(detector->name(), "clusters");
if(clusters == NULL) {
LOG(DEBUG) << "Detector " << detector->name() << " does not have any clusters on the clipboard";
continue;
}
// Loop over all pixels and make hitmaps
for(auto& pixel : (*pixels)) {
// Fill the plots for this device
plotPerDevice[detector->name()]->Fill(pixel->m_column, pixel->m_row);
}
}
// Fill single histogram
singlePlot->Fill(m_eventNumber);
// Increment event counter
m_eventNumber++;
// Return value telling analysis to keep running
return Success;
}
void EtaCorrection::finalise() {
LOG(DEBUG) << "Analysed " << m_eventNumber << " events";
}
#ifndef EtaCorrection_H
#define EtaCorrection_H 1
#include <iostream>
#include "TCanvas.h"
#include "TH1F.h"
#include "TH2F.h"
#include "core/algorithm/Algorithm.h"
#include "objects/Cluster.h"
#include "objects/Pixel.h"
#include "objects/Track.h"
namespace corryvreckan {
class EtaCorrection : public Algorithm {
public:
// Constructors and destructors
EtaCorrection(Configuration config, std::vector<Detector*> detectors);
~EtaCorrection() {}
// Functions
void initialise();
StatusCode run(Clipboard* clipboard);
void finalise();
// Histograms for several devices
std::map<std::string, TH2F*> plotPerDevice;
// Single histograms
TH1F* singlePlot;
// Member variables
int m_eventNumber;
};
} // namespace corryvreckan
#endif // EtaCorrection_H
......@@ -47,5 +47,5 @@ namespace corryvreckan {
std::map<std::string, long long int> m_currentPosition;
double m_timeWindow;
};
}
} // namespace corryvreckan
#endif // FileReader_H
......@@ -41,5 +41,5 @@ namespace corryvreckan {
// List of objects to write out
std::vector<std::string> m_objectList;
};
}
} // namespace corryvreckan
#endif // FileWriter_H
......@@ -44,5 +44,5 @@ namespace corryvreckan {
int eventNumber;
int updateNumber;
};
}
} // namespace corryvreckan
#endif // GUI_H
......@@ -32,5 +32,5 @@ namespace corryvreckan {
// Member variables
int m_eventNumber;
};
}
} // namespace corryvreckan
#endif // GenericAlgorithm_H
......@@ -47,5 +47,5 @@ namespace corryvreckan {
int eventNumber;
int updateNumber;
};
}
} // namespace corryvreckan
#endif // OnlineMonitor_H
......@@ -34,5 +34,5 @@ namespace corryvreckan {
double max_correlation_rms;
double damping_factor;
};
}
} // namespace corryvreckan
#endif // PREALIGNMENT_H
......@@ -26,5 +26,5 @@ namespace corryvreckan {
// Member variables
int m_eventNumber;
};
}
} // namespace corryvreckan
#endif // SpatialClustering_H
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