From b583191f9f4b3436973879a951b83875ed65accc Mon Sep 17 00:00:00 2001 From: Hugo Jacob <hugojacob57@gmail.com> Date: Mon, 24 Jul 2023 11:38:10 +0200 Subject: [PATCH] Modified TAC class to avoid compilation Errors --- NPLib/Detectors/TAC/TTACPhysics.cxx | 144 +--------------------------- 1 file changed, 2 insertions(+), 142 deletions(-) diff --git a/NPLib/Detectors/TAC/TTACPhysics.cxx b/NPLib/Detectors/TAC/TTACPhysics.cxx index f477dbb9a..3c4edafd5 100644 --- a/NPLib/Detectors/TAC/TTACPhysics.cxx +++ b/NPLib/Detectors/TAC/TTACPhysics.cxx @@ -52,22 +52,14 @@ TTACPhysics::TTACPhysics() m_E_Threshold(0), // MeV m_NumberOfDetectors(0) { } -/* + /////////////////////////////////////////////////////////////////////////// /// A usefull method to bundle all operation to add a detector void TTACPhysics::AddDetector(TVector3 , string ){ - // In That simple case nothing is done - // Typically for more complex detector one would calculate the relevant - // positions (stripped silicon) or angles (gamma array) - m_NumberOfDetectors++; } /////////////////////////////////////////////////////////////////////////// void TTACPhysics::AddDetector(double R, double Theta, double Phi, string shape){ - // Compute the TVector3 corresponding - TVector3 Pos(R*sin(Theta)*cos(Phi),R*sin(Theta)*sin(Phi),R*cos(Theta)); - // Call the cartesian method - AddDetector(Pos,shape); } /////////////////////////////////////////////////////////////////////////// @@ -82,178 +74,46 @@ void TTACPhysics::BuildPhysicalEvent() { // apply thresholds and calibration PreTreat(); - // match energy and time together - unsigned int mysizeE = m_PreTreatedData->GetMultEnergy(); - unsigned int mysizeT = m_PreTreatedData->GetMultTime(); - for (UShort_t e = 0; e < mysizeE ; e++) { - for (UShort_t t = 0; t < mysizeT ; t++) { - if (m_PreTreatedData->GetE_DetectorNbr(e) == m_PreTreatedData->GetT_DetectorNbr(t)) { - DetectorNumber.push_back(m_PreTreatedData->GetE_DetectorNbr(e)); - Energy.push_back(m_PreTreatedData->Get_Energy(e)); - Time.push_back(m_PreTreatedData->Get_Time(t)); - } - } - } } /////////////////////////////////////////////////////////////////////////// void TTACPhysics::PreTreat() { - // This method typically applies thresholds and calibrations - // Might test for disabled channels for more complex detector - - // clear pre-treated object ClearPreTreatedData(); - // instantiate CalibrationManager - static CalibrationManager* Cal = CalibrationManager::getInstance(); - - // Energy - unsigned int mysize = m_EventData->GetMultEnergy(); - for (UShort_t i = 0; i < mysize ; ++i) { - if (m_EventData->Get_Energy(i) > m_E_RAW_Threshold) { - Double_t Energy = Cal->ApplyCalibration("TAC/ENERGY"+NPL::itoa(m_EventData->GetE_DetectorNbr(i)),m_EventData->Get_Energy(i)); - if (Energy > m_E_Threshold) { - m_PreTreatedData->SetEnergy(m_EventData->GetE_DetectorNbr(i), Energy); - } - } - } - - // Time - mysize = m_EventData->GetMultTime(); - for (UShort_t i = 0; i < mysize; ++i) { - Double_t Time= Cal->ApplyCalibration("TAC/TIME"+NPL::itoa(m_EventData->GetT_DetectorNbr(i)),m_EventData->Get_Time(i)); - m_PreTreatedData->SetTime(m_EventData->GetT_DetectorNbr(i), Time); - } } /////////////////////////////////////////////////////////////////////////// void TTACPhysics::ReadAnalysisConfig() { - bool ReadingStatus = false; - - // path to file - string FileName = "./configs/ConfigTAC.dat"; - - // open analysis config file - ifstream AnalysisConfigFile; - AnalysisConfigFile.open(FileName.c_str()); - - if (!AnalysisConfigFile.is_open()) { - cout << " No ConfigTAC.dat found: Default parameter loaded for Analayis " << FileName << endl; - return; - } - cout << " Loading user parameter for Analysis from ConfigTAC.dat " << endl; - - // Save it in a TAsciiFile - TAsciiFile* asciiConfig = RootOutput::getInstance()->GetAsciiFileAnalysisConfig(); - asciiConfig->AppendLine("%%% ConfigTAC.dat %%%"); - asciiConfig->Append(FileName.c_str()); - asciiConfig->AppendLine(""); - // read analysis config file - string LineBuffer,DataBuffer,whatToDo; - while (!AnalysisConfigFile.eof()) { - // Pick-up next line - getline(AnalysisConfigFile, LineBuffer); - - // search for "header" - string name = "ConfigTAC"; - if (LineBuffer.compare(0, name.length(), name) == 0) - ReadingStatus = true; - - // loop on tokens and data - while (ReadingStatus ) { - whatToDo=""; - AnalysisConfigFile >> whatToDo; - - // Search for comment symbol (%) - if (whatToDo.compare(0, 1, "%") == 0) { - AnalysisConfigFile.ignore(numeric_limits<streamsize>::max(), '\n' ); - } - - else if (whatToDo=="E_RAW_THRESHOLD") { - AnalysisConfigFile >> DataBuffer; - m_E_RAW_Threshold = atof(DataBuffer.c_str()); - cout << whatToDo << " " << m_E_RAW_Threshold << endl; - } - - else if (whatToDo=="E_THRESHOLD") { - AnalysisConfigFile >> DataBuffer; - m_E_Threshold = atof(DataBuffer.c_str()); - cout << whatToDo << " " << m_E_Threshold << endl; - } - - else { - ReadingStatus = false; - } - } - } } /////////////////////////////////////////////////////////////////////////// void TTACPhysics::Clear() { - DetectorNumber.clear(); - Energy.clear(); - Time.clear(); } /////////////////////////////////////////////////////////////////////////// void TTACPhysics::ReadConfiguration(NPL::InputParser parser) { - vector<NPL::InputBlock*> blocks = parser.GetAllBlocksWithToken("TAC"); - if(NPOptionManager::getInstance()->GetVerboseLevel()) - cout << "//// " << blocks.size() << " detectors found " << endl; - - vector<string> cart = {"POS","Shape"}; - vector<string> sphe = {"R","Theta","Phi","Shape"}; - - for(unsigned int i = 0 ; i < blocks.size() ; i++){ - if(blocks[i]->HasTokenList(cart)){ - if(NPOptionManager::getInstance()->GetVerboseLevel()) - cout << endl << "//// TAC " << i+1 << endl; - - TVector3 Pos = blocks[i]->GetTVector3("POS","mm"); - string Shape = blocks[i]->GetString("Shape"); - AddDetector(Pos,Shape); - } - else if(blocks[i]->HasTokenList(sphe)){ - if(NPOptionManager::getInstance()->GetVerboseLevel()) - cout << endl << "//// TAC " << i+1 << endl; - double R = blocks[i]->GetDouble("R","mm"); - double Theta = blocks[i]->GetDouble("Theta","deg"); - double Phi = blocks[i]->GetDouble("Phi","deg"); - string Shape = blocks[i]->GetString("Shape"); - AddDetector(R,Theta,Phi,Shape); - } - else{ - cout << "ERROR: check your input file formatting " << endl; - exit(1); - } - } } /////////////////////////////////////////////////////////////////////////// void TTACPhysics::InitSpectra() { - m_Spectra = new TTACSpectra(m_NumberOfDetectors); } /////////////////////////////////////////////////////////////////////////// void TTACPhysics::FillSpectra() { - m_Spectra -> FillRawSpectra(m_EventData); - m_Spectra -> FillPreTreatedSpectra(m_PreTreatedData); - m_Spectra -> FillPhysicsSpectra(m_EventPhysics); } /////////////////////////////////////////////////////////////////////////// void TTACPhysics::CheckSpectra() { - m_Spectra->CheckSpectra(); } @@ -315,7 +175,7 @@ void TTACPhysics::InitializeRootOutput() { TTree* outputTree = RootOutput::getInstance()->GetTree(); outputTree->Branch("TAC", "TTACPhysics", &m_EventPhysics); } -*/ + //////////////////////////////////////////////////////////////////////////////// -- GitLab