Commit 598e4a5d authored by Adrien Matta's avatar Adrien Matta
Browse files

* Adding token for XYZ offset and inversion XY in BDC

parent 62ab2dc7
Pipeline #120163 passed with stages
in 14 minutes and 13 seconds
......@@ -76,13 +76,14 @@ void TSamuraiBDCPhysics::BuildPhysicalEvent(){
static vector<TVector3> C ;
static vector<double > W ; // weight based on D
static double PosX100,PosY100,norm;
unsigned int count = 0 ;
int count = 0 ;
for(auto it = m_DCHit.begin(); it!=m_DCHit.end(); it++){
// Each entry in the map is a detector
det = it->first;
Detector.push_back(det);
PosX.push_back(0);
PosY.push_back(0);
PosZ.push_back(0);
ThetaX.push_back(0);
PhiY.push_back(0);
devX.push_back(0);
......@@ -194,7 +195,7 @@ void TSamuraiBDCPhysics::BuildPhysicalEvent(){
// Mean position at Z=100
PosX100/=norm;
PosY100/=norm;
for(unsigned int i = 0 ; i < size ; i++){
devX[count]+=W[i]*(C[i].X()-PosX[count])*(C[i].X()-PosX[count]);
devY[count]+=W[i]*(C[i].Y()-PosY[count])*(C[i].Y()-PosY[count]);
......@@ -210,14 +211,25 @@ void TSamuraiBDCPhysics::BuildPhysicalEvent(){
// the Z axis
PhiY[count]=(PosY100-PosY[count])/100.;
Dir[count]=TVector3(PosX100-PosX[count],PosY100-PosY[count],100).Unit();
if(m_invertX[det])
PosX[count]*=-1;
if(m_invertY[det])
PosY[count]*=-1;
PosX[count]+=m_offset[det].X();
PosY[count]+=m_offset[det].Y();
PosZ[count]=m_offset[det].Z();
}
}
if(PosX[count]==0){
PosX[count]=-10000;
PosY[count]=-10000;
ThetaX[count]=-10000;
PhiY[count]=-10000;
if(PosX[count]==0&&PosY[count]==0){
PosX.erase(PosX.begin()+count);
PosY.erase(PosY.begin()+count);
PosZ.erase(PosZ.begin()+count);
ThetaX.erase(ThetaX.begin()+count);
PhiY.erase(PhiY.begin()+count);
Detector.erase(Detector.begin()+count);
count--;
}
count++;
......@@ -272,6 +284,7 @@ void TSamuraiBDCPhysics::Clear(){
// Computed variable
PosX.clear();
PosY.clear();
PosZ.clear();
ThetaX.clear();
PhiY.clear();
devX.clear();
......@@ -290,14 +303,23 @@ void TSamuraiBDCPhysics::ReadConfiguration(NPL::InputParser parser){
if(NPOptionManager::getInstance()->GetVerboseLevel())
cout << "//// " << blocks.size() << " detector(s) found " << endl;
vector<string> token= {"XML"};
vector<string> token= {"XML","Offset","InvertX","InvertY"};
for(unsigned int i = 0 ; i < blocks.size() ; i++){
cout << endl << "//// Samurai BDC (" << i+1 << ")" << endl;
string xmlpath = blocks[i]->GetString("XML");
NPL::XmlParser xml;
xml.LoadFile(xmlpath);
AddDC(std::atoi(blocks[i]->GetMainValue().c_str()),xml);
if(blocks[i]->HasTokenList(token)){
cout << endl << "//// Samurai BDC (" << i+1 << ")" << endl;
unsigned int det = std::atoi(blocks[i]->GetMainValue().c_str());
string xmlpath = blocks[i]->GetString("XML");
NPL::XmlParser xml;
xml.LoadFile(xmlpath);
AddDC(det,xml);
TVector3 offset = blocks[i]->GetTVector3("Offset","mm");
bool invertX = blocks[i]->GetInt("InvertX");
bool invertY = blocks[i]->GetInt("InvertY");
m_offset[det] = offset;
m_invertX[det] = invertX;
m_invertY[det] = invertY;
}
}
#if __cplusplus > 199711L && NPMULTITHREADING
......
......@@ -88,6 +88,7 @@ class TSamuraiBDCPhysics : public TObject, public NPL::VDetector{
// Computed variable
std::vector<double> PosX;
std::vector<double> PosY;
std::vector<double> PosZ;
std::vector<double> ThetaX;
std::vector<double> PhiY;
std::vector<double> devX;
......@@ -194,6 +195,10 @@ class TSamuraiBDCPhysics : public TObject, public NPL::VDetector{
TSamuraiBDCData* m_PreTreatedData;//!
TSamuraiBDCPhysics* m_EventPhysics;//!
private: // offset and inversion
std::map<unsigned int, TVector3> m_offset;//!
std::map<unsigned int, bool> m_invertX;//!
std::map<unsigned int, bool> m_invertY;//!
private: // Spectra Class
// TSamuraiBDCSpectra* m_Spectra; // !
......
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Target
Thickness= 18 micrometer
Radius= 30 mm
Material= CD2
Angle= 0 deg
X= 0 mm
Y= 0 mm
Z= 0 mm
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SAMURAIBDC 1
XML= db/SAMURAIBDC1.xml
Offset= 0 0 0 mm
InvertX= 0
InvertY= 0
%%%%%%%%%%%%
SAMURAIBDC 2
XML= db/SAMURAIBDC2.xml
Offset= 0 0 0 mm
InvertX= 0
InvertY= 0
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Minos
Position= 0 0 0 mm
ZRotation= 35 deg
TargetLength= 152.76 mm
TargetMaterial= LH2
CellMaterial= Mylar
TPCOnly= 0
TimeBin= 30 ns
ShapingTime= 333.9 ns
BaseLine= 250
Sampling= 10
XML= db/MINOS.xml
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SAMURAIFDC2
XML= db/SAMURAIFDC2.xml
......@@ -21,16 +34,4 @@ SAMURAIFDC0
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SAMURAIHOD
XML= db/SAMURAIHOD_s034_all40mV_s037_20170702.xml
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Minos
% Position= 0 0 0 mm
% ZRotation= 35 deg
% TargetLength= 152.76 mm
% TargetMaterial= LH2
% CellMaterial= Mylar
% TPCOnly= 0
% TimeBin= 30 ns
% ShapingTime= 333.9 ns
% BaseLine= 250
% Sampling= 10
% XML= db/MINOS.xml
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