Skip to content
Snippets Groups Projects
Commit 71178058 authored by de Séréville Nicolas's avatar de Séréville Nicolas
Browse files

+ Update Physics classes for ComptonTelescope analysis

parent d62350cd
No related branches found
No related tags found
No related merge requests found
...@@ -60,7 +60,6 @@ TComptonTelescopePhysics::TComptonTelescopePhysics() ...@@ -60,7 +60,6 @@ TComptonTelescopePhysics::TComptonTelescopePhysics()
m_StripBack_E_RAW_Threshold = 0; m_StripBack_E_RAW_Threshold = 0;
m_StripBack_E_Threshold = 0; m_StripBack_E_Threshold = 0;
m_Take_E_Front = true; // p-side m_Take_E_Front = true; // p-side
m_Take_T_Back = false; // n-side
} }
...@@ -159,186 +158,177 @@ int TComptonTelescopePhysics::CheckEvent() ...@@ -159,186 +158,177 @@ int TComptonTelescopePhysics::CheckEvent()
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
vector < TVector2 > TComptonTelescopePhysics :: Match_Front_Back(){ vector < TVector2 > TComptonTelescopePhysics::Match_Front_Back()
vector < TVector2 > ArrayOfGoodCouple ; {
vector < TVector2 > ArrayOfGoodCouple ;
// Prevent code from treating very high multiplicity Event
// Those event are not physical anyway and that improve speed. // Prevent code from treating very high multiplicity Event
if( m_PreTreatedData->GetCTTrackerFrontEMult() > m_MaximumStripMultiplicityAllowed || m_PreTreatedData->GetCTTrackerBackEMult() > m_MaximumStripMultiplicityAllowed ) // Those event are not physical anyway and that improve speed.
return ArrayOfGoodCouple; if (m_PreTreatedData->GetCTTrackerFrontEMult() > m_MaximumStripMultiplicityAllowed || m_PreTreatedData->GetCTTrackerBackEMult() > m_MaximumStripMultiplicityAllowed)
return ArrayOfGoodCouple;
for(unsigned int i = 0 ; i < m_PreTreatedData->GetCTTrackerFrontEMult(); i++) {
for(unsigned int j = 0 ; j < m_PreTreatedData->GetCTTrackerBackEMult(); j++){ for (unsigned int i = 0; i < m_PreTreatedData->GetCTTrackerFrontEMult(); i++) {
// if same detector check energy for (unsigned int j = 0; j < m_PreTreatedData->GetCTTrackerBackEMult(); j++) {
if ( m_PreTreatedData->GetCTTrackerFrontEDetectorNbr(i) == m_PreTreatedData->GetCTTrackerBackEDetectorNbr(j) ){ // if same detector check energy
// Look if energy match if (m_PreTreatedData->GetCTTrackerFrontEDetectorNbr(i) == m_PreTreatedData->GetCTTrackerBackEDetectorNbr(j)) {
if( abs( (m_PreTreatedData->GetCTTrackerFrontEEnergy(i)-m_PreTreatedData->GetCTTrackerBackEEnergy(j))/2. ) < m_StripEnergyMatchingNumberOfSigma*m_StripEnergyMatchingSigma ) // Look if energy match
ArrayOfGoodCouple . push_back ( TVector2(i,j) ) ; if (abs((m_PreTreatedData->GetCTTrackerFrontEEnergy(i) - m_PreTreatedData->GetCTTrackerBackEEnergy(j))/2.) < m_StripEnergyMatchingNumberOfSigma*m_StripEnergyMatchingSigma)
ArrayOfGoodCouple.push_back(TVector2(i,j));
}
} }
} }
}
// Prevent to treat event with ambiguous matchin beetween X and Y
// Prevent to treat event with ambiguous matchin beetween X and Y if (ArrayOfGoodCouple.size() > m_PreTreatedData->GetCTTrackerFrontEMult()) ArrayOfGoodCouple.clear();
if( ArrayOfGoodCouple.size() > m_PreTreatedData->GetCTTrackerFrontEMult() ) ArrayOfGoodCouple.clear() ; return ArrayOfGoodCouple;
return ArrayOfGoodCouple;
} }
//////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////
bool TComptonTelescopePhysics :: IsValidChannel(const string DetectorType, const int telescope , const int channel){ bool TComptonTelescopePhysics::IsValidChannel(const string DetectorType, const int telescope, const int channel)
{
if(DetectorType == "Front") if (DetectorType == "Front")
return *(m_FrontChannelStatus[telescope-1].begin()+channel-1); return *(m_FrontChannelStatus[telescope-1].begin()+channel-1);
else if(DetectorType == "Back") else if (DetectorType == "Back")
return *(m_BackChannelStatus[telescope-1].begin()+channel-1); return *(m_BackChannelStatus[telescope-1].begin()+channel-1);
else return false; else return false;
} }
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
void TComptonTelescopePhysics::ReadAnalysisConfig(){ void TComptonTelescopePhysics::ReadAnalysisConfig()
bool ReadingStatus = false; {
bool ReadingStatus = false;
// path to file
string FileName = "./configs/ConfigComptonTelescope.dat"; // path to file
string FileName = "./configs/ConfigComptonTelescope.dat";
// open analysis config file
ifstream AnalysisConfigFile; // open analysis config file
AnalysisConfigFile.open(FileName.c_str()); ifstream AnalysisConfigFile;
AnalysisConfigFile.open(FileName.c_str());
if (!AnalysisConfigFile.is_open()) {
cout << " No ConfigComptonTelescope.dat found: Default parameter loaded for Analayis " << FileName << endl; if (!AnalysisConfigFile.is_open()) {
return; cout << " No ConfigComptonTelescope.dat found: Default parameter loaded for Analayis " << FileName << endl;
} return;
cout << " Loading user parameter for Analysis from ConfigComptonTelescope.dat " << endl; }
cout << " Loading user parameter for Analysis from ConfigComptonTelescope.dat " << endl;
// Save it in a TAsciiFile
TAsciiFile* asciiConfig = RootOutput::getInstance()->GetAsciiFileAnalysisConfig(); // Save it in a TAsciiFile
asciiConfig->AppendLine("%%% ConfigComptonTelescope.dat %%%"); TAsciiFile* asciiConfig = RootOutput::getInstance()->GetAsciiFileAnalysisConfig();
asciiConfig->Append(FileName.c_str()); asciiConfig->AppendLine("%%% ConfigComptonTelescope.dat %%%");
asciiConfig->AppendLine(""); asciiConfig->Append(FileName.c_str());
// read analysis config file asciiConfig->AppendLine("");
string LineBuffer,DataBuffer,whatToDo; // read analysis config file
while (!AnalysisConfigFile.eof()) { string LineBuffer,DataBuffer,whatToDo;
// Pick-up next line while (!AnalysisConfigFile.eof()) {
getline(AnalysisConfigFile, LineBuffer); // Pick-up next line
getline(AnalysisConfigFile, LineBuffer);
// search for "header"
if (LineBuffer.compare(0, 22, "ConfigComptonTelescope") == 0) ReadingStatus = true; // search for "header"
if (LineBuffer.compare(0, 22, "ConfigComptonTelescope") == 0) ReadingStatus = true;
// loop on tokens and data
while (ReadingStatus ) { // loop on tokens and data
while (ReadingStatus ) {
whatToDo="";
AnalysisConfigFile >> whatToDo; whatToDo="";
AnalysisConfigFile >> whatToDo;
// Search for comment symbol (%)
if (whatToDo.compare(0, 1, "%") == 0) { // Search for comment symbol (%)
AnalysisConfigFile.ignore(numeric_limits<streamsize>::max(), '\n' ); if (whatToDo.compare(0, 1, "%") == 0) {
} AnalysisConfigFile.ignore(numeric_limits<streamsize>::max(), '\n' );
}
else if (whatToDo=="MAX_STRIP_MULTIPLICITY") {
AnalysisConfigFile >> DataBuffer; else if (whatToDo=="MAX_STRIP_MULTIPLICITY") {
m_MaximumStripMultiplicityAllowed = atoi(DataBuffer.c_str() ); AnalysisConfigFile >> DataBuffer;
cout << "MAXIMUN STRIP MULTIPLICITY " << m_MaximumStripMultiplicityAllowed << endl; m_MaximumStripMultiplicityAllowed = atoi(DataBuffer.c_str() );
} cout << "MAXIMUN STRIP MULTIPLICITY " << m_MaximumStripMultiplicityAllowed << endl;
}
else if (whatToDo=="STRIP_ENERGY_MATCHING_SIGMA") {
AnalysisConfigFile >> DataBuffer; else if (whatToDo=="STRIP_ENERGY_MATCHING_SIGMA") {
m_StripEnergyMatchingSigma = atof(DataBuffer.c_str() ); AnalysisConfigFile >> DataBuffer;
cout << "STRIP ENERGY MATCHING SIGMA " << m_StripEnergyMatchingSigma <<endl; m_StripEnergyMatchingSigma = atof(DataBuffer.c_str() );
} cout << "STRIP ENERGY MATCHING SIGMA " << m_StripEnergyMatchingSigma <<endl;
}
else if (whatToDo=="STRIP_ENERGY_MATCHING_NUMBER_OF_SIGMA") {
AnalysisConfigFile >> DataBuffer; else if (whatToDo=="STRIP_ENERGY_MATCHING_NUMBER_OF_SIGMA") {
m_StripEnergyMatchingNumberOfSigma = atoi(DataBuffer.c_str() ); AnalysisConfigFile >> DataBuffer;
cout << "STRIP ENERGY MATCHING NUMBER OF SIGMA " << m_StripEnergyMatchingNumberOfSigma << endl; m_StripEnergyMatchingNumberOfSigma = atoi(DataBuffer.c_str() );
} cout << "STRIP ENERGY MATCHING NUMBER OF SIGMA " << m_StripEnergyMatchingNumberOfSigma << endl;
}
else if (whatToDo== "DISABLE_ALL") {
AnalysisConfigFile >> DataBuffer; else if (whatToDo== "DISABLE_ALL") {
cout << whatToDo << " " << DataBuffer << endl; AnalysisConfigFile >> DataBuffer;
int Detector = atoi(DataBuffer.substr(2,1).c_str()); cout << whatToDo << " " << DataBuffer << endl;
vector< bool > ChannelStatus; int Detector = atoi(DataBuffer.substr(2,1).c_str());
ChannelStatus.resize(24,false); vector< bool > ChannelStatus;
m_FrontChannelStatus[Detector-1] = ChannelStatus; ChannelStatus.resize(24,false);
ChannelStatus.resize(48,false); m_FrontChannelStatus[Detector-1] = ChannelStatus;
m_BackChannelStatus[Detector-1] = ChannelStatus; ChannelStatus.resize(48,false);
ChannelStatus.resize(1,false); m_BackChannelStatus[Detector-1] = ChannelStatus;
m_PADChannelStatus[Detector-1] = ChannelStatus; ChannelStatus.resize(1,false);
} m_PADChannelStatus[Detector-1] = ChannelStatus;
}
else if (whatToDo == "DISABLE_CHANNEL") {
AnalysisConfigFile >> DataBuffer; else if (whatToDo == "DISABLE_CHANNEL") {
cout << whatToDo << " " << DataBuffer << endl; AnalysisConfigFile >> DataBuffer;
int Detector = atoi(DataBuffer.substr(2,1).c_str()); cout << whatToDo << " " << DataBuffer << endl;
int channel = -1; int Detector = atoi(DataBuffer.substr(2,1).c_str());
if (DataBuffer.compare(3,4,"STRF") == 0) { int channel = -1;
channel = atoi(DataBuffer.substr(7).c_str()); if (DataBuffer.compare(3,4,"STRF") == 0) {
*(m_FrontChannelStatus[Detector-1].begin()+channel-1) = false; channel = atoi(DataBuffer.substr(7).c_str());
} *(m_FrontChannelStatus[Detector-1].begin()+channel-1) = false;
}
else if (DataBuffer.compare(3,4,"STRB") == 0) {
channel = atoi(DataBuffer.substr(7).c_str()); else if (DataBuffer.compare(3,4,"STRB") == 0) {
*(m_BackChannelStatus[Detector-1].begin()+channel-1) = false; channel = atoi(DataBuffer.substr(7).c_str());
} *(m_BackChannelStatus[Detector-1].begin()+channel-1) = false;
}
else cout << "Warning: detector type for ComptonTelescope unknown!" << endl;
else cout << "Warning: detector type for ComptonTelescope unknown!" << endl;
}
}
else if (whatToDo=="TAKE_E_FRONT") {
m_Take_E_Front = true; else if (whatToDo=="TAKE_E_FRONT") {
cout << whatToDo << endl; m_Take_E_Front = true;
} cout << whatToDo << endl;
}
else if (whatToDo=="TAKE_E_BACK") {
m_Take_E_Front = false; else if (whatToDo=="TAKE_E_BACK") {
cout << whatToDo << endl; m_Take_E_Front = false;
} cout << whatToDo << endl;
}
else if (whatToDo=="TAKE_T_FRONT") {
m_Take_T_Back = false; else if (whatToDo=="STRIP_FRONT_E_RAW_THRESHOLD") {
cout << whatToDo << endl; AnalysisConfigFile >> DataBuffer;
} m_StripFront_E_RAW_Threshold = atoi(DataBuffer.c_str());
cout << whatToDo << " " << m_StripFront_E_RAW_Threshold << endl;
else if (whatToDo=="TAKE_T_BACK") { }
m_Take_T_Back = true;
cout << whatToDo << endl; else if (whatToDo=="STRIP_BACK_E_RAW_THRESHOLD") {
} AnalysisConfigFile >> DataBuffer;
m_StripBack_E_RAW_Threshold = atoi(DataBuffer.c_str());
else if (whatToDo=="STRIP_FRONT_E_RAW_THRESHOLD") { cout << whatToDo << " " << m_StripBack_E_RAW_Threshold << endl;
AnalysisConfigFile >> DataBuffer; }
m_StripFront_E_RAW_Threshold = atoi(DataBuffer.c_str());
cout << whatToDo << " " << m_StripFront_E_RAW_Threshold << endl; else if (whatToDo=="STRIP_FRONT_E_THRESHOLD") {
} AnalysisConfigFile >> DataBuffer;
m_StripFront_E_Threshold = atoi(DataBuffer.c_str());
else if (whatToDo=="STRIP_BACK_E_RAW_THRESHOLD") { cout << whatToDo << " " << m_StripFront_E_Threshold << endl;
AnalysisConfigFile >> DataBuffer; }
m_StripBack_E_RAW_Threshold = atoi(DataBuffer.c_str());
cout << whatToDo << " " << m_StripBack_E_RAW_Threshold << endl; else if (whatToDo=="STRIP_BACK_THRESHOLD") {
} AnalysisConfigFile >> DataBuffer;
m_StripBack_E_Threshold = atoi(DataBuffer.c_str());
else if (whatToDo=="STRIP_FRONT_E_THRESHOLD") { cout << whatToDo << " " << m_StripBack_E_Threshold << endl;
AnalysisConfigFile >> DataBuffer; }
m_StripFront_E_Threshold = atoi(DataBuffer.c_str());
cout << whatToDo << " " << m_StripFront_E_Threshold << endl; else {
} ReadingStatus = false;
}
else if (whatToDo=="STRIP_BACK_THRESHOLD") {
AnalysisConfigFile >> DataBuffer;
m_StripBack_E_Threshold = atoi(DataBuffer.c_str());
cout << whatToDo << " " << m_StripBack_E_Threshold << endl;
}
else {
ReadingStatus = false;
} }
}
}
}
} }
......
...@@ -152,7 +152,6 @@ class TComptonTelescopePhysics : public TObject, public NPA::VDetector ...@@ -152,7 +152,6 @@ class TComptonTelescopePhysics : public TObject, public NPA::VDetector
// By default take EX and TY. // By default take EX and TY.
bool m_Take_E_Front;//! bool m_Take_E_Front;//!
bool m_Take_T_Back;//!
// Event over this value after pre-treatment are not treated / avoid long treatment time on spurious event // Event over this value after pre-treatment are not treated / avoid long treatment time on spurious event
......
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