Commit 80bae02b authored by Daniel Hynds's avatar Daniel Hynds
Browse files

new formatting

parent 94229c5b
#include "DUTAnalysis.h"
#include "objects/Cluster.h"
#include "objects/Pixel.h"
#include "objects/MCParticle.h"
#include "objects/Pixel.h"
#include "objects/SpidrSignal.h"
#include "objects/Track.h"
......@@ -42,10 +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);
}
if(m_useMCtruth) {
residualsXMCtruth = new TH1F("residualsXMCtruth", "residualsXMCtruth", 400, -0.2, 0.2);
}
// Initialise member variables
m_eventNumber = 0;
m_nAlignmentClusters = 0;
......@@ -128,10 +128,10 @@ StatusCode DUTAnalysis::run(Clipboard* 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";
}
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;
......@@ -251,23 +251,26 @@ StatusCode DUTAnalysis::run(Clipboard* clipboard) {
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());
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());
}
residualsXMCtruth->Fill(cluster->localX() - particlePosition.X());
}
// Fill power pulsing response
if((m_shutterOpenTime != 0 && m_shutterCloseTime == 0) ||
(m_shutterOpenTime != 0 &&
......
......@@ -34,7 +34,7 @@ namespace corryvreckan {
TH2F* clusterToTVersusTime;
TH2F* residualsTimeVsTime;
TH1F* residualsXMCtruth;
TH1F* residualsXMCtruth;
TH2F* hAssociatedTracksGlobalPosition;
TH2F* hUnassociatedTracksGlobalPosition;
......
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