Commit c6777935 authored by Emilio Depero's avatar Emilio Depero
Browse files

added functionality to add angle

parent a550dcef
#!/bin/bash
export rotangle="0"
if [ $# -eq 1 ]
then
rotangle=$1
fi
#daq parameters
export DAQEXE="" #to be set
export DAQDIR=""
......@@ -24,7 +30,7 @@ do
export analfileout=$DAQOUTDIR/"analysed/Analysed_"$(basename $file)
#run the reco
echo "running reco for $file"
$ANALEXE $file $analfileout
$ANALEXE $file $analfileout $rotangle
done
......
......@@ -58,6 +58,19 @@ struct hitInfo
hitInfo():EventID(-1),x(0),y(0),t(-1),qmax(0) { }
};
double Xrot(const double X, const double Y, const double& thisangle)
{
const double Kx = cos(thisangle);
const double Ky = sin(thisangle);
return -Kx * X - Ky * Y;
}
double Yrot(const double X, const double Y, const double& thisangle)
{
const double Kx = cos(thisangle);
const double Ky = sin(thisangle);
return Ky * X - Kx * Y;
}
// the format to store the sources
......@@ -106,17 +119,32 @@ void Analyze(int argc, char *argv[])
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// define variables to extract data from the g4bl ntuples
Float_t x,y,t,EventID, qmax;
Float_t x,y,t,EventID, qmax, rotangle;
if (argc<3)
if (argc < 3 || argc>4)
{
std::cout << "Usage: ./executable [inputFileName] [outpuFileName]." << std::endl;
std::cout << "Usage: ./executable [inputFileName] [outpuFileName] [rotangle (optional, in degree)]." << std::endl;
return;
}
// get parameters from command line arguments
std::string inputFileName = argv[1];
std::string outputFileName = argv[2];
TString inputFileName(argv[1]);
TString outputFileName(argv[2]);
int degreeangle;
if(argc > 3)
{
degreeangle = atoi(argv[3]);
rotangle = degreeangle/180.*TMath::Pi(); //radiant convertion
outputFileName += TString::Format("-rotation%i.root", degreeangle);
}
else
{
degreeangle = 0;
rotangle = 0;
}
std::cout << "PERFORMING ANALYSIS WITH ROTATION ANGLE: " << degreeangle <<" degrees \n";
std::vector<std::string> MM_Names;
MM_Names.push_back("MM1");
......@@ -141,7 +169,7 @@ void Analyze(int argc, char *argv[])
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// BG file has two additional ntuples
TFile* inFile = new TFile(TString(inputFileName));
TFile* inFile = new TFile(inputFileName);
std::cout << " position 1.1\n";
......@@ -159,7 +187,7 @@ void Analyze(int argc, char *argv[])
std::cout << " position 2 after reading in\n";
TFile* newFile = new TFile(TString(outputFileName),"RECREATE");
TFile* newFile = new TFile(outputFileName,"RECREATE");
// prepare a canvas for the plots
TCanvas* c1 = new TCanvas;
......@@ -247,8 +275,8 @@ void Analyze(int argc, char *argv[])
{
theMMtuples[0]->GetEntry(n);
hitsVector_MM1[int(EventID)].EventID = EventID;
hitsVector_MM1[int(EventID)].x = x;
hitsVector_MM1[int(EventID)].y = y;
hitsVector_MM1[int(EventID)].x = Xrot(x, y, rotangle);
hitsVector_MM1[int(EventID)].y = Yrot(x, y, rotangle);
hitsVector_MM1[int(EventID)].t = t;
hitsVector_MM1[int(EventID)].qmax = qmax;
}
......@@ -257,8 +285,8 @@ void Analyze(int argc, char *argv[])
{
theMMtuples[1]->GetEntry(n);
hitsVector_MM2[int(EventID)].EventID = EventID;
hitsVector_MM2[int(EventID)].x = x;
hitsVector_MM2[int(EventID)].y = y;
hitsVector_MM2[int(EventID)].x = Xrot(x, y, rotangle);
hitsVector_MM2[int(EventID)].y = Yrot(x, y, rotangle);
hitsVector_MM2[int(EventID)].t = t;
hitsVector_MM2[int(EventID)].qmax = qmax;
}
......
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