Commit 71be0854 authored by Simon Spannagel's avatar Simon Spannagel
Browse files

Merge remote-tracking branch 'daniel/master'

parents 988c46a6 ef33f246
Pipeline #229265 passed with stage
in 2 minutes and 28 seconds
#!/bin/bash
# Check that only one argument was given
ARGS=1
if [ $# -ne "$ARGS" ]
then
echo "Please enter the new algorithm name"
exit
fi
# Ask for the name of the new algorithm
read -p "Name of the new algorithm: " NEWALGORITHM
# Copy the GenericAlgorithm and replace the name with the new algorithm name
NEWALGORITHM=$1
cp ../algorithms/GenericAlgorithm.C ../algorithms/${NEWALGORITHM}.C
cp ../algorithms/GenericAlgorithm.h ../algorithms/${NEWALGORITHM}.h
# If running on mac, use this sed command
sed -i "" s/"GenericAlgorithm"/"${NEWALGORITHM}"/g ../algorithms/${NEWALGORITHM}.C
sed -i "" s/"GenericAlgorithm"/"${NEWALGORITHM}"/g ../algorithms/${NEWALGORITHM}.h
# If running on linux, use this command
#sed -i s/"GenericAlgorithm"/"${NEWALGORITHM}"/g ../algorithms/${NEWALGORITHM}.C
#sed -i s/"GenericAlgorithm"/"${NEWALGORITHM}"/g ../algorithms/${NEWALGORITHM}.C
echo "Creating ${NEWALGORITHM}.cpp"
cp ../src/algorithms/GenericAlgorithm.cpp ../src/algorithms/${NEWALGORITHM}.cpp
echo "Creating ${NEWALGORITHM}.h"
cp ../src/algorithms/GenericAlgorithm.h ../src/algorithms/${NEWALGORITHM}.h
# Check mac or linux platform
platform=`uname`
if [ "$platform" == "Darwin" ]
then
sed -i "" s/"GenericAlgorithm"/"${NEWALGORITHM}"/g ../src/algorithms/${NEWALGORITHM}.cpp
sed -i "" s/"GenericAlgorithm"/"${NEWALGORITHM}"/g ../src/algorithms/${NEWALGORITHM}.h
else
sed -i s/"GenericAlgorithm"/"${NEWALGORITHM}"/g ../src/algorithms/${NEWALGORITHM}.cpp
sed -i s/"GenericAlgorithm"/"${NEWALGORITHM}"/g ../src/algorithms/${NEWALGORITHM}.h
fi
......@@ -32,8 +32,20 @@ void BasicTracking::initialise() {
continue;
string name = "residualsX_" + detectorID;
residualsX[detectorID] = new TH1F(name.c_str(), name.c_str(), 100, -0.02, 0.02);
name = "residualsXwidth1_" + detectorID;
residualsXwidth1[detectorID] = new TH1F(name.c_str(), name.c_str(), 100, -0.02, 0.02);
name = "residualsXwidth2_" + detectorID;
residualsXwidth2[detectorID] = new TH1F(name.c_str(), name.c_str(), 100, -0.02, 0.02);
name = "residualsXwidth3_" + detectorID;
residualsXwidth3[detectorID] = new TH1F(name.c_str(), name.c_str(), 100, -0.02, 0.02);
name = "residualsY_" + detectorID;
residualsY[detectorID] = new TH1F(name.c_str(), name.c_str(), 100, -0.02, 0.02);
name = "residualsYwidth1_" + detectorID;
residualsYwidth1[detectorID] = new TH1F(name.c_str(), name.c_str(), 100, -0.02, 0.02);
name = "residualsYwidth2_" + detectorID;
residualsYwidth2[detectorID] = new TH1F(name.c_str(), name.c_str(), 100, -0.02, 0.02);
name = "residualsYwidth3_" + detectorID;
residualsYwidth3[detectorID] = new TH1F(name.c_str(), name.c_str(), 100, -0.02, 0.02);
}
}
......@@ -43,7 +55,7 @@ StatusCode BasicTracking::run(Clipboard* clipboard) {
// Container for all clusters, and detectors in tracking
map<string, KDTree*> trees;
vector<string> detectors;
Clusters* referenceClusters;
Clusters* referenceClusters = nullptr;
Clusters dutClusters;
// Output track container
......@@ -66,11 +78,12 @@ StatusCode BasicTracking::run(Clipboard* clipboard) {
} else {
// Store them
LOG(DEBUG) << "Picked up " << tempClusters->size() << " clusters from " << detectorID;
if(firstDetector) {
if(firstDetector && detectorID != m_config.get<std::string>("DUT")) {
referenceClusters = tempClusters;
seedPlane = detector->name();
seedPlane = detector->name();
LOG(DEBUG) << "Seed plane is "<<seedPlane;
firstDetector = false;
}
firstDetector = false;
if(tempClusters->size() == 0)
continue;
KDTree* clusterTree = new KDTree();
......@@ -85,6 +98,7 @@ StatusCode BasicTracking::run(Clipboard* clipboard) {
return Success;
// Loop over all clusters
if(referenceClusters == nullptr) return Success;
int nSeedClusters = referenceClusters->size();
map<Cluster*, bool> used;
for(auto& cluster : (*referenceClusters)) {
......@@ -185,7 +199,13 @@ StatusCode BasicTracking::run(Clipboard* clipboard) {
string detectorID = trackCluster->detectorID();
ROOT::Math::XYZPoint intercept = track->intercept(trackCluster->globalZ());
residualsX[detectorID]->Fill(intercept.X() - trackCluster->globalX());
if(trackCluster->columnWidth() == 1) residualsXwidth1[detectorID]->Fill(intercept.X() - trackCluster->globalX());
if(trackCluster->columnWidth() == 2) residualsXwidth2[detectorID]->Fill(intercept.X() - trackCluster->globalX());
if(trackCluster->columnWidth() == 3) residualsXwidth3[detectorID]->Fill(intercept.X() - trackCluster->globalX());
residualsY[detectorID]->Fill(intercept.Y() - trackCluster->globalY());
if(trackCluster->rowWidth() == 1) residualsYwidth1[detectorID]->Fill(intercept.Y() - trackCluster->globalY());
if(trackCluster->rowWidth() == 2) residualsYwidth2[detectorID]->Fill(intercept.Y() - trackCluster->globalY());
if(trackCluster->rowWidth() == 3) residualsYwidth3[detectorID]->Fill(intercept.Y() - trackCluster->globalY());
}
// Add potential associated clusters from the DUT:
......
......@@ -36,7 +36,13 @@ namespace corryvreckan {
TH1F* trackAngleX;
TH1F* trackAngleY;
std::map<std::string, TH1F*> residualsX;
std::map<std::string, TH1F*> residualsXwidth1;
std::map<std::string, TH1F*> residualsXwidth2;
std::map<std::string, TH1F*> residualsXwidth3;
std::map<std::string, TH1F*> residualsY;
std::map<std::string, TH1F*> residualsYwidth1;
std::map<std::string, TH1F*> residualsYwidth2;
std::map<std::string, TH1F*> residualsYwidth3;
// Cuts for tracking
double timingCut;
......
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