Skip to content
Snippets Groups Projects
Commit feb1fdcf authored by adrien-matta's avatar adrien-matta
Browse files

* Fixing Physics and Spectra class in Detector Skeleton

parent a39273f6
No related branches found
No related tags found
No related merge requests found
......@@ -193,11 +193,6 @@ void TDETECTORNAMEPhysics::ReadConfiguration(string Path) {
bool check_Theta = false ;
bool check_Phi = false ;
bool check_R = false ;
bool check_Thickness = false ;
bool check_Radius = false ;
bool check_Scintillator = false ;
bool check_Height = false ;
bool check_Width = false ;
bool check_Shape = false ;
bool check_X = false ;
bool check_Y = false ;
......@@ -229,7 +224,7 @@ void TDETECTORNAMEPhysics::ReadConfiguration(string Path) {
// Finding another telescope (safety), toggle out
else if (DataBuffer.compare(0, name.length(), name) == 0) {
cout << "WARNING: Another Detector is find before standard sequence of Token, Error may occured in Telecope definition" << endl ;
cout << "\033[1;311mWARNING: Another detector is find before standard sequence of Token, Error may occured in detector definition\033[0m" << endl ;
ReadingStatus = false ;
}
......@@ -279,60 +274,22 @@ void TDETECTORNAMEPhysics::ReadConfiguration(string Path) {
cout << "Shape: " << DataBuffer << endl;
}
// Cylindrical shape
else if (DataBuffer== "Radius=") {
check_Radius = true;
ConfigFile >> DataBuffer ;
cout << "DETECTORNAME Radius: " << atof( DataBuffer.c_str() ) << "mm" << endl;
}
// Squared shape
else if (DataBuffer=="Width=") {
check_Width = true;
ConfigFile >> DataBuffer ;
cout << "DETECTORNAME Width: " <<atof( DataBuffer.c_str() ) << "mm" << endl;
}
else if (DataBuffer== "Height=") {
check_Height = true;
ConfigFile >> DataBuffer ;
cout << "DETECTORNAME Height: " << atof( DataBuffer.c_str() ) << "mm" << endl;
}
// Common
else if (DataBuffer=="Thickness=") {
check_Thickness = true;
ConfigFile >> DataBuffer ;
cout << "DETECTORNAME Thickness: " << atof( DataBuffer.c_str() ) << "mm" << endl;
}
else if (DataBuffer== "Scintillator=") {
check_Scintillator = true ;
ConfigFile >> DataBuffer ;
cout << "DETECTORNAME Scintillator type: " << DataBuffer << endl;
}
///////////////////////////////////////////////////
// If no Detector Token and no comment, toggle out
else
{ReadingStatus = false; cout << "Wrong Token Sequence: Getting out " << DataBuffer << endl ;}
else{
ReadingStatus = false; cout << "Wrong Token Sequence: Getting out " << DataBuffer << endl ;
}
/////////////////////////////////////////////////
// If All necessary information there, toggle out
if ( ((check_Theta && check_Phi && check_R) ||( check_X && check_Y && check_Z) )&& check_Thickness && check_Scintillator && (check_Radius || (check_Height && check_Width)) && check_Shape )
{
if ( ((check_Theta && check_Phi && check_R) ||( check_X && check_Y && check_Z) ) && check_Shape ){
m_NumberOfDetectors++;
// Reinitialisation of Check Boolean
check_Theta = false ;
check_Phi = false ;
check_R = false ;
check_Thickness = false ;
check_Radius = false ;
check_Scintillator = false ;
check_Height = false ;
check_Width = false ;
check_Shape = false ;
check_X = false ;
check_Y = false ;
......
......@@ -68,10 +68,14 @@ TDETECTORNAMESpectra::~TDETECTORNAMESpectra() {
void TDETECTORNAMESpectra::InitRawSpectra() {
static string name;
for (unsigned int i = 0; i < fNumberOfDetectors; i++) { // loop on number of detectors
name = "DETECTORNAMERaw"+NPL::itoa(i+1);
// STR_FRONT_E_RAW
// Energy
name = "DETECTORNAME"+NPL::itoa(i+1)+"_ENERGY_RAW";
AddHisto1D(name, name, 4096, 0, 16384, "DETECTORNAME/RAW");
// Time
name = "DETECTORNAME"+NPL::itoa(i+1)+"_TIME_RAW";
AddHisto1D(name, name, 4096, 0, 16384, "DETECTORNAME/RAW");
} // end loop on number of detectors
}
......@@ -81,9 +85,14 @@ void TDETECTORNAMESpectra::InitRawSpectra() {
void TDETECTORNAMESpectra::InitPreTreatedSpectra() {
static string name;
for (unsigned int i = 0; i < fNumberOfDetectors; i++) { // loop on number of detectors
// STR_FRONT_E_CAL
// Energy
name = "DETECTORNAME"+NPL::itoa(i+1)+"_ENERGY_CAL";
AddHisto1D(name, name, 500, 0, 25, "DETECTORNAME/CAL");
// Time
name = "DETECTORNAME"+NPL::itoa(i+1)+"_TIME_CAL";
AddHisto1D(name, name, 500, 0, 25, "DETECTORNAME/CAL");
} // end loop on number of detectors
}
......@@ -135,7 +144,7 @@ void TDETECTORNAMESpectra::FillPreTreatedSpectra(TDETECTORNAMEData* PreTreatedDa
// Energy
unsigned int sizeE = PreTreatedData->GetMultEnergy();
for (unsigned int i = 0; i < sizeE; i++) {
name = "DETECTORNAME"+NPL::itoa(PreTreatedData->GetE_DetectorNbr(i))+"_ENERGY_RAW";
name = "DETECTORNAME"+NPL::itoa(PreTreatedData->GetE_DetectorNbr(i))+"_ENERGY_CAL";
family = "DETECTORNAME/CAL";
GetHisto(family,name) -> Fill(PreTreatedData->GetE_DetectorNbr(i),
......@@ -145,7 +154,7 @@ void TDETECTORNAMESpectra::FillPreTreatedSpectra(TDETECTORNAMEData* PreTreatedDa
// Time
unsigned int sizeT = PreTreatedData->GetMultTime();
for (unsigned int i = 0; i < sizeT; i++) {
name = "DETECTORNAME"+NPL::itoa(PreTreatedData->GetT_DetectorNbr(i))+"_TIME_RAW";
name = "DETECTORNAME"+NPL::itoa(PreTreatedData->GetT_DetectorNbr(i))+"_TIME_CAL";
family = "DETECTORNAME/CAL";
GetHisto(family,name) -> Fill(PreTreatedData->GetT_DetectorNbr(i),
......
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