Commit d32dd260 authored by Adrien Matta's avatar Adrien Matta
Browse files

* attempt to fix compilation error on gitlab

parent 36697bd5
Pipeline #119559 passed with stages
in 9 minutes and 21 seconds
......@@ -74,10 +74,15 @@ void NPOptionManager::ReadProjectConfigFile(){
// else use the standard config
else{
std::cout << "///// No Project Configuration: " << std::endl;
std::string Path = getenv("NPTOOL");
m_AnalysisOutputPath=Path+"/Outputs/Analysis/";
m_SimulationOutputPath=Path+"/Outputs/Simulation/";
m_EnergyLossPath=Path+"/Inputs/EnergyLoss/";
std::cout << "AnalysisOutput= " << m_AnalysisOutputPath << std::endl;
std::cout << "SimulationOutput= " << m_SimulationOutputPath << std::endl;
std::cout << "EnergyLoss= " << m_EnergyLossPath << std::endl;
}
}
......
......@@ -68,7 +68,7 @@ RootOutput::RootOutput(std::string fileNameBase, std::string treeNameBase,bool s
if(NPOptionManager::getInstance()->IsAnalysis()){
analysis = true;
}
else if(NPOptionManager::getInstance()->IsAnalysis()){
else if(NPOptionManager::getInstance()->IsSimulation()){
simulation= true;
}
......@@ -112,7 +112,7 @@ RootOutput::RootOutput(std::string fileNameBase, std::string treeNameBase,bool s
path+="/.last_sim_file";
ofstream last_sim_file(path.c_str());
last_sim_file << "Tree "<< pTreeName <<endl
<< " " << pBaseName<<endl;
<< " " << pBaseName <<endl;
last_sim_file.close();
}
......
......@@ -110,7 +110,7 @@ void TMinosPhysics::PreTreat() {
double z_mm = (T*m_TimeBin+cal->GetValue(cal_o,0))*cal->GetValue(cal_v,0);
TVector3 Pos=TVector3(x_mm+m_Position.X(),y_mm+m_Position.Y(),z_mm+m_Position.Z())
TVector3 Pos=TVector3(x_mm+m_Position.X(),y_mm+m_Position.Y(),z_mm+m_Position.Z());
Pos.RotateZ(m_ZRotation);
// Calibrate the Pad:
X_Pad.push_back(Pos.X());
......
......@@ -402,6 +402,7 @@ bool TMugastPhysics::IsValidChannel(const int& Type,
///////////////////////////////////////////////////////////////////////////
void TMugastPhysics::ReadAnalysisConfig() {
NPL::InputParser parser("./configs/ConfigMugast.dat");
vector<NPL::InputBlock*> blocks = parser.GetAllBlocksWithToken("ConfigMugast");
......
......@@ -61,7 +61,15 @@ void TSamuraiBDCPhysics::BuildSimplePhysicalEvent(){
///////////////////////////////////////////////////////////////////////////
void TSamuraiBDCPhysics::BuildPhysicalEvent(){
PreTreat();
// RemoveNoise();
/*
static unsigned int det,layer,wire,size;
for(auto it = Layer.begin(); it!=Layer.end(); it++){
det = it->first;
size = it->second.size();
}
// RemoveNoise();
// Map[plane angle, vector of spatial information]
static map<double, vector<double> > X ;
......@@ -109,11 +117,11 @@ void TSamuraiBDCPhysics::BuildPhysicalEvent(){
#endif
// for Debug, write a file of
/* { std::ofstream f("distance.txt", std::ios::app);
f<< D[it->first] << endl;
f.close();
}
*/
// { std::ofstream f("distance.txt", std::ios::app);
// f<< D[it->first] << endl;
// f.close();
// }
// very large a means track perpendicular to the chamber, what happen when there is pile up
if(abs(a)>5000)
PileUp++;
......@@ -206,7 +214,7 @@ void TSamuraiBDCPhysics::BuildPhysicalEvent(){
PhiY=(PosY100-PosY)/100.;
Dir=TVector3(PosX100-PosX,PosY100-PosY,100).Unit();
}
*/
return;
}
///////////////////////////////////////////////////////////////////////////
......@@ -214,10 +222,6 @@ void TSamuraiBDCPhysics::PreTreat(){
ClearPreTreatedData();
static CalibrationManager* Cal = CalibrationManager::getInstance();
static string channel;
// one map per detector
map<unsigned int, vector<double> > X ;
map<unsigned int, vector<double> > Z ;
map<unsigned int, vector<double> > R ;
unsigned int size = m_EventData->Mult();
for(unsigned int i = 0 ; i < size ; i++){
......@@ -247,13 +251,12 @@ void TSamuraiBDCPhysics::PreTreat(){
}
// a valid wire must have an edge
if(etime && time && etime-time>ToTThreshold_L && etime-time<ToTThreshold_H){
Detector.push_back(det);
Layer.push_back(layer);
Wire.push_back(wire);
Time.push_back(time);
ToT.push_back(etime-time);
channel="SamuraiBDC/L" + NPL::itoa(layer);
DriftLength.push_back(2.5-Cal->ApplySigmoid(channel,etime));
Layer[det].push_back(layer);
Wire[det].push_back(wire);
Time[det].push_back(time);
ToT[det].push_back(etime-time);
channel="SamuraiBDC"+NPL::itoa(det)+"/L" + NPL::itoa(layer);
DriftLength[det].push_back(2.5-Cal->ApplySigmoid(channel,etime));
}
}
......@@ -261,61 +264,26 @@ void TSamuraiBDCPhysics::PreTreat(){
return;
}
///////////////////////////////////////////////////////////////////////////
void TSamuraiBDCPhysics::RemoveNoise(){
// Remove the noise by looking if a matching wire exist in the adjacent layer
// this done by looking at the closest plane with the same orientation
unsigned int size = Detector.size();
for(unsigned int i = 0 ; i < size ; i++){
bool match=false;
int det = Detector[i];
int layer = Layer[i];
int wire = Wire[i];
// look for matching adjacent wire
for(unsigned int j = 0 ; j < size ; j++){
int adet = Detector[j];
int alayer = Layer[j];
int awire = Wire[j];
bool blayer = false;
if(layer%2==0){
if(layer+1==alayer)
blayer=true;
}
else{
if(layer-1==alayer)
blayer=true;
}
if(det==adet && blayer && abs(wire-awire)<=1){
match=true;
break;
}
}
if(match)
Matched.push_back(true);
else
Matched.push_back(false);
}
return;
}
///////////////////////////////////////////////////////////////////////////
void TSamuraiBDCPhysics::Clear(){
MultMean=0;
PileUp=0;
Mult=0;
PosX=PosY=-10000;
devX=devY=-10000;
DriftLength.clear();
Detector.clear();
Layer.clear();
Wire.clear();
Time.clear();
ToT.clear();
ParticleDirection.clear();
MiddlePosition.clear();
Matched.clear();
DriftLength.clear();
Detector.clear();
Layer.clear();
Wire.clear();
Time.clear();
ToT.clear();
// Computed variable
ParticleDirection.clear();
MiddlePosition.clear();
PosX.clear();
PosY.clear();
ThetaX.clear();
PhiY.clear();
devX.clear();
devY.clear();
Dir.clear();
PileUp.clear();
}
///////////////////////////////////////////////////////////////////////////
......@@ -334,7 +302,7 @@ void TSamuraiBDCPhysics::ReadConfiguration(NPL::InputParser parser){
string xmlpath = blocks[i]->GetString("XML");
NPL::XmlParser xml;
xml.LoadFile(xmlpath);
AddDC("SAMURAIBDC",xml);
AddDC(std::atoi(blocks[i]->GetMainValue().c_str()),xml);
}
#if __cplusplus > 199711L && NPMULTITHREADING
......@@ -348,11 +316,9 @@ void TSamuraiBDCPhysics::ReadConfiguration(NPL::InputParser parser){
}
///////////////////////////////////////////////////////////////////////////
void TSamuraiBDCPhysics::AddDC(string name, NPL::XmlParser& xml){
void TSamuraiBDCPhysics::AddDC(int det, NPL::XmlParser& xml){
std::string name = "SAMURAIBC"+NPL::itoa(det);
std::vector<NPL::XML::block*> b = xml.GetAllBlocksWithName(name);
// BDC case
if(name=="SAMURAIBDC"){
unsigned int det=0;
unsigned int sizeB = b.size();
for(unsigned int i = 0 ; i < sizeB ; i++){
unsigned int layer = b[i]->AsInt("layer");
......@@ -378,7 +344,6 @@ void TSamuraiBDCPhysics::AddDC(string name, NPL::XmlParser& xml){
Wire_Z[idx]=Z;
Wire_Angle[idx]=T;
}
}
}
///////////////////////////////////////////////////////////////////////////
......@@ -421,9 +386,12 @@ void TSamuraiBDCPhysics::WriteSpectra(){
void TSamuraiBDCPhysics::AddParameterToCalibrationManager(){
CalibrationManager* Cal = CalibrationManager::getInstance();
// for each det
for( int d = 1 ; d < 3 ; ++d){
// each layer
for( int l = 0 ; l < 8 ; ++l){
Cal->AddParameter("SamuraiBDC", "L"+ NPL::itoa(l),"BDC_L"+ NPL::itoa(l));
Cal->AddParameter("SamuraiBDC"+NPL::itoa(d), "L"+ NPL::itoa(l),"BDC"+NPL::itoa(d)+"_L"+ NPL::itoa(l));
}
}
}
......@@ -435,8 +403,8 @@ void TSamuraiBDCPhysics::InitializeRootInputRaw(){
// The following line is necessary only for system were the tree is splitted
// (older root version). The found argument silenced the Branches not found
// warning for non splitted tree.
if(inputChain->FindBranch("fDC_*"))
inputChain->SetBranchStatus( "fDC_*",true);
if(inputChain->FindBranch("fBDC_*"))
inputChain->SetBranchStatus( "fBDC_*",true);
inputChain->SetBranchAddress( "SamuraiBDC" , &m_EventData );
}
......
......@@ -60,34 +60,33 @@ class TSamuraiBDCPhysics : public TObject, public NPL::VDetector{
void Clear(const Option_t*) {};
public:
// Provide Physical Multiplicity
std::vector<double> DriftLength;
std::vector<int> Detector;
std::vector<int> Layer;
std::vector<int> Wire;
std::vector<double> Time;
std::vector<double> ToT;
std::vector<bool> Matched;
// map of [bdc number, vector of info]
std::map<unsigned int,std::vector<double>> DriftLength;
std::map<unsigned int,std::vector<int>> Layer;
std::map<unsigned int,std::vector<int>> Wire;
std::map<unsigned int,std::vector<double>> Time;
std::map<unsigned int,std::vector<double>> ToT;
// Computed variable
std::vector<TVector3> ParticleDirection;
std::vector<TVector3> MiddlePosition;
double PosX;
double PosY;
double ThetaX;
double PhiY;
double devX,devY;
TVector3 Dir;
int Mult;
int MultMean;
int PileUp;
std::map<unsigned int, std::vector<TVector3> > ParticleDirection;
std::map<unsigned int, std::vector<TVector3> > MiddlePosition;
std::vector<double> PosX;
std::vector<double> PosY;
std::vector<double> ThetaX;
std::vector<double> PhiY;
std::vector<double> devX;
std::vector<double> devY;
std::vector<unsigned int> Detector;
std::vector<TVector3> Dir;
std::vector<int> PileUp;
public:
// Projected position at given Z plan
TVector3 ProjectedPosition(double Z);
private: // Charateristic of the DC
void AddDC(std::string name, NPL::XmlParser&);//! take the XML file and fill in Wire_X and Layer_Angle
void AddDC(int det, NPL::XmlParser&);//! take the XML file and fill in Wire_X and Layer_Angle
std::map<SamuraiDCIndex,double> Wire_X;//! X position of the wires
std::map<SamuraiDCIndex,double> Wire_Z;//! Z position of the wires
std::map<SamuraiDCIndex,double> Wire_Angle;//! Wire Angle (0 for X, 90 for Y, U and V are typically at +/-30)
......@@ -99,7 +98,6 @@ class TSamuraiBDCPhysics : public TObject, public NPL::VDetector{
double DriftLowThreshold;//! Minimum Drift length to keep the hit
double DriftUpThreshold;//! Maximum Drift length to keep the hit
double PowerThreshold;//! Maximum P2 minimisation value to keep the track
void RemoveNoise();
// Construct the 2D track and ref position at Z=0 and Z=100 based on X,Z and Radius provided
// Object use to perform the DC reconstruction
......@@ -168,13 +166,13 @@ class TSamuraiBDCPhysics : public TObject, public NPL::VDetector{
TSamuraiBDCData* GetRawData() const {return m_EventData;}
TSamuraiBDCData* GetPreTreatedData() const {return m_PreTreatedData;}
double GetPosX(){return PosX;}
double GetPosY(){return PosY;}
double GetThetaX(){return ThetaX;}
double GetPhiY(){return PhiY;}
double GetDevX(){return devX;}
double GetDevY(){return devY;}
int GetPileUp(){return PileUp;}
double GetPosX(unsigned int det) {return PosX[det];}
double GetPosY(unsigned int det) {return PosY[det];}
double GetThetaX(unsigned int det){return ThetaX[det];}
double GetPhiY(unsigned int det) {return PhiY[det];}
double GetDevX(unsigned int det) {return devX[det];}
double GetDevY(unsigned int det) {return devY[det];}
int GetPileUp(unsigned int det){return PileUp[det];}
private: // Root Input and Output tree classes
TSamuraiBDCData* m_EventData;//!
......
CalibrationFilePath
Calibration/BDC1_Calib.txt
Calibration/FDC2_Calib.txt
Calibration/FDC0_Calib.txt
Calibration/CalibVDrift/CalibVDrift.txt
......@@ -5,3 +5,5 @@ db/MINOS.xml
db/SAMURAIFDC2.xml
db/SAMURAIFDC0_20200109.xml
db/SAMURAIHOD_s034_all40mV_s037_20170702.xml
db/SAMURAIBDC1.xml
db/SAMURAIBDC2.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