Skip to content
Snippets Groups Projects
Commit 598e4a5d authored by Adrien Matta's avatar Adrien Matta :skull_crossbones:
Browse files

* Adding token for XYZ offset and inversion XY in BDC

parent 62ab2dc7
No related branches found
No related tags found
No related merge requests found
Pipeline #120163 passed
...@@ -76,13 +76,14 @@ void TSamuraiBDCPhysics::BuildPhysicalEvent(){ ...@@ -76,13 +76,14 @@ void TSamuraiBDCPhysics::BuildPhysicalEvent(){
static vector<TVector3> C ; static vector<TVector3> C ;
static vector<double > W ; // weight based on D static vector<double > W ; // weight based on D
static double PosX100,PosY100,norm; static double PosX100,PosY100,norm;
unsigned int count = 0 ; int count = 0 ;
for(auto it = m_DCHit.begin(); it!=m_DCHit.end(); it++){ for(auto it = m_DCHit.begin(); it!=m_DCHit.end(); it++){
// Each entry in the map is a detector // Each entry in the map is a detector
det = it->first; det = it->first;
Detector.push_back(det); Detector.push_back(det);
PosX.push_back(0); PosX.push_back(0);
PosY.push_back(0); PosY.push_back(0);
PosZ.push_back(0);
ThetaX.push_back(0); ThetaX.push_back(0);
PhiY.push_back(0); PhiY.push_back(0);
devX.push_back(0); devX.push_back(0);
...@@ -194,7 +195,7 @@ void TSamuraiBDCPhysics::BuildPhysicalEvent(){ ...@@ -194,7 +195,7 @@ void TSamuraiBDCPhysics::BuildPhysicalEvent(){
// Mean position at Z=100 // Mean position at Z=100
PosX100/=norm; PosX100/=norm;
PosY100/=norm; PosY100/=norm;
for(unsigned int i = 0 ; i < size ; i++){ for(unsigned int i = 0 ; i < size ; i++){
devX[count]+=W[i]*(C[i].X()-PosX[count])*(C[i].X()-PosX[count]); 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]); devY[count]+=W[i]*(C[i].Y()-PosY[count])*(C[i].Y()-PosY[count]);
...@@ -210,14 +211,25 @@ void TSamuraiBDCPhysics::BuildPhysicalEvent(){ ...@@ -210,14 +211,25 @@ void TSamuraiBDCPhysics::BuildPhysicalEvent(){
// the Z axis // the Z axis
PhiY[count]=(PosY100-PosY[count])/100.; PhiY[count]=(PosY100-PosY[count])/100.;
Dir[count]=TVector3(PosX100-PosX[count],PosY100-PosY[count],100).Unit(); 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){ if(PosX[count]==0&&PosY[count]==0){
PosX[count]=-10000; PosX.erase(PosX.begin()+count);
PosY[count]=-10000; PosY.erase(PosY.begin()+count);
ThetaX[count]=-10000; PosZ.erase(PosZ.begin()+count);
PhiY[count]=-10000; ThetaX.erase(ThetaX.begin()+count);
PhiY.erase(PhiY.begin()+count);
Detector.erase(Detector.begin()+count);
count--;
} }
count++; count++;
...@@ -272,6 +284,7 @@ void TSamuraiBDCPhysics::Clear(){ ...@@ -272,6 +284,7 @@ void TSamuraiBDCPhysics::Clear(){
// Computed variable // Computed variable
PosX.clear(); PosX.clear();
PosY.clear(); PosY.clear();
PosZ.clear();
ThetaX.clear(); ThetaX.clear();
PhiY.clear(); PhiY.clear();
devX.clear(); devX.clear();
...@@ -290,14 +303,23 @@ void TSamuraiBDCPhysics::ReadConfiguration(NPL::InputParser parser){ ...@@ -290,14 +303,23 @@ void TSamuraiBDCPhysics::ReadConfiguration(NPL::InputParser parser){
if(NPOptionManager::getInstance()->GetVerboseLevel()) if(NPOptionManager::getInstance()->GetVerboseLevel())
cout << "//// " << blocks.size() << " detector(s) found " << endl; 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++){ for(unsigned int i = 0 ; i < blocks.size() ; i++){
cout << endl << "//// Samurai BDC (" << i+1 << ")" << endl; if(blocks[i]->HasTokenList(token)){
string xmlpath = blocks[i]->GetString("XML"); cout << endl << "//// Samurai BDC (" << i+1 << ")" << endl;
NPL::XmlParser xml; unsigned int det = std::atoi(blocks[i]->GetMainValue().c_str());
xml.LoadFile(xmlpath); string xmlpath = blocks[i]->GetString("XML");
AddDC(std::atoi(blocks[i]->GetMainValue().c_str()),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 #if __cplusplus > 199711L && NPMULTITHREADING
......
...@@ -88,6 +88,7 @@ class TSamuraiBDCPhysics : public TObject, public NPL::VDetector{ ...@@ -88,6 +88,7 @@ class TSamuraiBDCPhysics : public TObject, public NPL::VDetector{
// Computed variable // Computed variable
std::vector<double> PosX; std::vector<double> PosX;
std::vector<double> PosY; std::vector<double> PosY;
std::vector<double> PosZ;
std::vector<double> ThetaX; std::vector<double> ThetaX;
std::vector<double> PhiY; std::vector<double> PhiY;
std::vector<double> devX; std::vector<double> devX;
...@@ -194,6 +195,10 @@ class TSamuraiBDCPhysics : public TObject, public NPL::VDetector{ ...@@ -194,6 +195,10 @@ class TSamuraiBDCPhysics : public TObject, public NPL::VDetector{
TSamuraiBDCData* m_PreTreatedData;//! TSamuraiBDCData* m_PreTreatedData;//!
TSamuraiBDCPhysics* m_EventPhysics;//! 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 private: // Spectra Class
// TSamuraiBDCSpectra* m_Spectra; // ! // 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 SAMURAIBDC 1
XML= db/SAMURAIBDC1.xml XML= db/SAMURAIBDC1.xml
Offset= 0 0 0 mm
InvertX= 0
InvertY= 0
%%%%%%%%%%%%
SAMURAIBDC 2 SAMURAIBDC 2
XML= db/SAMURAIBDC2.xml 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 SAMURAIFDC2
XML= db/SAMURAIFDC2.xml XML= db/SAMURAIFDC2.xml
...@@ -21,16 +34,4 @@ SAMURAIFDC0 ...@@ -21,16 +34,4 @@ SAMURAIFDC0
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SAMURAIHOD SAMURAIHOD
XML= db/SAMURAIHOD_s034_all40mV_s037_20170702.xml 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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment