diff --git a/NPLib/Detectors/FPDTamu/TFPDTamuPhysics.cxx b/NPLib/Detectors/FPDTamu/TFPDTamuPhysics.cxx index 676c04cf46ad38985c9f2e3aaa4397cabe3a1c07..712661d96a2b8bf7f054ab6cc8ad2a524a52d397 100644 --- a/NPLib/Detectors/FPDTamu/TFPDTamuPhysics.cxx +++ b/NPLib/Detectors/FPDTamu/TFPDTamuPhysics.cxx @@ -802,15 +802,18 @@ void TFPDTamuPhysics::AddParameterToCalibrationManager() { "Delta_R"+ NPL::itoa(i+1)+"_C1_T"); } - for (int i = 0; i < m_NumberOfMicro; ++i) { // in case there's 2 micromega add up the rows - //by Shuya 170414. - //for (int iRow = 0; iRow < 4; ++iRow) { - for (int iRow = 0; iRow < 6; ++iRow) { - for (int iCol = 0; iCol < 7; ++iCol) { - Cal->AddParameter("FPDTamu", "Micro_R"+ NPL::itoa((4*i)+iRow+1)+"_C"+ NPL::itoa(iCol+1)+"_E", - "Micro_R"+ NPL::itoa((4*i)+iRow+1)+"_C"+ NPL::itoa(iCol+1)+"_E"); - Cal->AddParameter("FPDTamu", "Micro_R"+ NPL::itoa((4*i)+iRow+1)+"_C"+ NPL::itoa(iCol+1)+"_T", - "Micro_R"+ NPL::itoa((4*i)+iRow+1)+"_C"+ NPL::itoa(iCol+1)+"_T"); + for (int iDet = 0; iDet < m_NumberOfMicro; ++iDet) { // in case there's 2 micromega add up the rows + for (int iRow = 0; iRow < 4; ++iRow) { // 4 rows + for (int iCol = 0; iCol < 7; ++iCol) { // 7 columns + int det = iDet+1; + int row = iRow+1; + int col = iCol+1; + Cal->AddParameter("FPDTamu", + "Micro"+NPL::itoa(det)+"_R"+ NPL::itoa(row)+"_C"+ NPL::itoa(col)+"_E", + "Micro"+NPL::itoa(det)+"_R"+ NPL::itoa(row)+"_C"+ NPL::itoa(col)+"_E"); + Cal->AddParameter("FPDTamu", + "Micro"+NPL::itoa(det)+"_R"+ NPL::itoa(row)+"_C"+ NPL::itoa(col)+"_T", + "Micro"+NPL::itoa(det)+"_R"+ NPL::itoa(row)+"_C"+ NPL::itoa(col)+"_T"); } } } diff --git a/NPLib/Detectors/GeTAMU/TGeTAMUPhysics.cxx b/NPLib/Detectors/GeTAMU/TGeTAMUPhysics.cxx index dca25a0143e04180555e81ce0d8b516510f7e91d..9022d51b51b50d9af4d853ebcab4e69418814e29 100644 --- a/NPLib/Detectors/GeTAMU/TGeTAMUPhysics.cxx +++ b/NPLib/Detectors/GeTAMU/TGeTAMUPhysics.cxx @@ -25,10 +25,8 @@ #include <limits> using namespace std; -#include "TGeTAMUPhysics.h" -#include "TRandom.h" - // NPL +#include "TGeTAMUPhysics.h" #include "RootInput.h" #include "NPDetectorFactory.h" #include "RootOutput.h" @@ -41,7 +39,7 @@ using namespace NPUNITS; #include "TChain.h" #include "TRandom3.h" -TRandom *Random = new TRandom3(); +TRandom3 *Random = new TRandom3(); /////////////////////////////////////////////////////////////////////////// ClassImp(TGeTAMUPhysics) @@ -67,8 +65,9 @@ ClassImp(TGeTAMUPhysics) void TGeTAMUPhysics::InitializeStandardParameter(){ - //Set high gain as default - m_LowGainIsSet = false; +//Set high gain as default + m_LowGainCryIsSet = false; + m_LowGainSegIsSet = false; m_CryChannelStatus.clear() ; m_SegChannelStatus.clear() ; @@ -127,9 +126,14 @@ void TGeTAMUPhysics::ReadAnalysisConfig(){ AnalysisConfigFile.ignore(numeric_limits<streamsize>::max(), '\n' ); } - else if (whatToDo== "LOW_GAIN_ENERGY") { - m_LowGainIsSet = true ; - cout << whatToDo << " " << m_LowGainIsSet << endl; // e.g. DataBuffer = CLOVER03 + else if (whatToDo== "LOW_GAIN_ENERGY_CRY") { + m_LowGainCryIsSet = true ; + cout << whatToDo << " " << m_LowGainCryIsSet << endl; // e.g. DataBuffer = CLOVER03 + } + + else if (whatToDo== "LOW_GAIN_ENERGY_SEG") { + m_LowGainSegIsSet = true ; + cout << whatToDo << " " << m_LowGainSegIsSet << endl; // e.g. DataBuffer = CLOVER03 } else if (whatToDo== "DISABLE_ALL") { @@ -199,6 +203,12 @@ void TGeTAMUPhysics::ReadAnalysisConfig(){ cout << whatToDo << " " << m_Seg_E_Threshold << endl; } + else if (whatToDo== "ADC_RANDOM_BIN") { + AnalysisConfigFile >> DataBuffer; + m_ADCRandomBinIsSet = true ; + cout << whatToDo << " " << m_ADCRandomBinIsSet << endl; + } + else { ReadingStatus = false; } @@ -338,101 +348,110 @@ void TGeTAMUPhysics::BuildPhysicalEvent(){ ///////////////////////////////////////////////// void TGeTAMUPhysics::PreTreat(){ - ClearPreTreatedData(); - - static CalibrationManager* cal = CalibrationManager::getInstance(); - static string name; - unsigned int mysizeE ; - unsigned int mysizeT ; - double Eraw,Energy; - double Traw,Time; - int clover, crystal, segment; - - if(m_LowGainIsSet) - mysizeE = m_EventData->GetMultiplicityCoreELowGain(); - else - mysizeE = m_EventData->GetMultiplicityCoreE(); - - for(unsigned int i = 0 ; i < mysizeE ; i++){ - if(m_LowGainIsSet){ - clover = m_EventData->GetCoreCloverNbrELowGain(i); - crystal = m_EventData->GetCoreCrystalNbrELowGain(i); - Eraw = m_EventData->GetCoreEnergyLowGain(i); +ClearPreTreatedData(); + +static CalibrationManager* cal = CalibrationManager::getInstance(); +static string name; +unsigned int mysizeE ; +unsigned int mysizeT ; +double Eraw,Energy; +double Traw,Time; +int clover, crystal, segment; + +//Crystal energy +if(m_LowGainCryIsSet) + mysizeE = m_EventData->GetMultiplicityCoreELowGain(); +else + mysizeE = m_EventData->GetMultiplicityCoreE(); +for(unsigned int i = 0 ; i < mysizeE ; i++){ + if(m_LowGainCryIsSet){ + clover = m_EventData->GetCoreCloverNbrELowGain(i); + crystal = m_EventData->GetCoreCrystalNbrELowGain(i); + Eraw = m_EventData->GetCoreEnergyLowGain(i); + } + else{ + clover = m_EventData->GetCoreCloverNbrE(i); + crystal = m_EventData->GetCoreCrystalNbrE(i); + Eraw = m_EventData->GetCoreEnergy(i); + } + if(Eraw>=m_Cry_E_Raw_Threshold && IsValidChannel(0, clover, crystal)){ + name = "GETAMU/D"+ NPL::itoa(clover)+"_CRY"+ NPL::itoa(crystal); + if(m_ADCRandomBinIsSet) + Eraw += Random->Rndm(); + Energy = cal->ApplyCalibration(name+"_E", Eraw); + if(Energy>=m_Cry_E_Threshold){ + Singles_CloverMap_CryEN[clover].push_back(crystal); + Singles_CloverMap_CryE[clover].push_back(Energy); + m_PreTreatedData->SetCoreE(clover,crystal,Energy); } - else{ - clover = m_EventData->GetCoreCloverNbrE(i); - crystal = m_EventData->GetCoreCrystalNbrE(i); - Eraw = m_EventData->GetCoreEnergy(i); - - if(Eraw>=m_Cry_E_Raw_Threshold && IsValidChannel(0, clover, crystal)){ - name = "GETAMU/D"+ NPL::itoa(clover)+"_CRY"+ NPL::itoa(crystal); - Energy = cal->ApplyCalibration(name+"_E", Eraw+Random->Rndm()); - if(Energy>=m_Cry_E_Threshold){ - Singles_CloverMap_CryEN[clover].push_back(crystal); - Singles_CloverMap_CryE[clover].push_back(Energy); - m_PreTreatedData->SetCoreE(clover,crystal,Energy); - } - } - - mysizeT = m_EventData->GetMultiplicityCoreT(); - for(unsigned int i = 0 ; i < mysizeT ; i++){ - Traw = m_EventData->GetCoreTime(i); - if(Traw>0){ - clover = m_EventData->GetCoreCloverNbrT(i); - crystal = m_EventData->GetCoreCrystalNbrT(i); - name = "GETAMU/D"+ NPL::itoa(clover)+"_CRY"+ NPL::itoa(crystal); - Time = cal->ApplyCalibration(name+"_T", Traw+Random->Rndm()); - Singles_CloverMap_CryTN[clover].push_back(crystal); - Singles_CloverMap_CryT[clover].push_back(Time); - m_PreTreatedData->SetCoreT(clover,crystal,Time); - } - } - - if(m_LowGainIsSet) - mysizeE = m_EventData->GetMultiplicitySegmentELowGain(); - else - mysizeE = m_EventData->GetMultiplicitySegmentE(); - for(unsigned int i = 0 ; i < mysizeE ; i++){ - - if(m_LowGainIsSet){ - clover = m_EventData->GetSegmentCloverNbrELowGain(i); - segment = m_EventData->GetSegmentSegmentNbrELowGain(i); - Eraw = m_EventData->GetSegmentEnergyLowGain(i); - } - else{ - clover = m_EventData->GetSegmentCloverNbrE(i); - segment = m_EventData->GetSegmentSegmentNbrE(i); - Eraw = m_EventData->GetSegmentEnergy(i); - } - - if(Eraw>=m_Seg_E_Raw_Threshold && IsValidChannel(1, clover, segment)){ - name = "GETAMU/D"+ NPL::itoa(clover)+"_SEG"+ NPL::itoa(segment); - Energy = cal->ApplyCalibration(name+"_E", Eraw+Random->Rndm()); - if(Energy>=m_Seg_E_Threshold){ - Singles_CloverMap_SegEN[clover].push_back(segment); - Singles_CloverMap_SegE[clover].push_back(Energy); - m_PreTreatedData->SetSegmentE(clover,segment,Energy); - } - } - } + } +} - mysizeT = m_EventData->GetMultiplicitySegmentT(); - for(unsigned int i = 0 ; i < mysizeT ; i++){ - Traw = m_EventData->GetSegmentTime(i); - if(Traw>0){ - clover = m_EventData->GetSegmentCloverNbrT(i); - segment = m_EventData->GetSegmentSegmentNbrT(i); - name = "GETAMU/D"+ NPL::itoa(clover)+"_SEG"+ NPL::itoa(segment); - Time = cal->ApplyCalibration(name+"_T", Traw+Random->Rndm()); - Singles_CloverMap_CryTN[clover].push_back(segment); - Singles_CloverMap_CryT[clover].push_back(Time); - m_PreTreatedData->SetSegmentT(clover,segment,Time); - } - } +//Crystal time + mysizeT = m_EventData->GetMultiplicityCoreT(); + for(unsigned int i = 0 ; i < mysizeT ; i++){ + Traw = m_EventData->GetCoreTime(i); + if(Traw>0){ + clover = m_EventData->GetCoreCloverNbrT(i); + crystal = m_EventData->GetCoreCrystalNbrT(i); + name = "GETAMU/D"+ NPL::itoa(clover)+"_CRY"+ NPL::itoa(crystal); + if(m_ADCRandomBinIsSet) + Traw += Random->Rndm(); + Time = cal->ApplyCalibration(name+"_T", Traw); + Singles_CloverMap_CryTN[clover].push_back(crystal); + Singles_CloverMap_CryT[clover].push_back(Time); + m_PreTreatedData->SetCoreT(clover,crystal,Time); + } + } +//Segment Energy +if(m_LowGainSegIsSet) + mysizeE = m_EventData->GetMultiplicitySegmentELowGain(); +else + mysizeE = m_EventData->GetMultiplicitySegmentE(); + +for(unsigned int i = 0 ; i < mysizeE ; i++){ + if(m_LowGainSegIsSet){ + clover = m_EventData->GetSegmentCloverNbrELowGain(i); + segment = m_EventData->GetSegmentSegmentNbrELowGain(i); + Eraw = m_EventData->GetSegmentEnergyLowGain(i); + } + else{ + clover = m_EventData->GetSegmentCloverNbrE(i); + segment = m_EventData->GetSegmentSegmentNbrE(i); + Eraw = m_EventData->GetSegmentEnergy(i); + } + if(Eraw>=m_Seg_E_Raw_Threshold && IsValidChannel(1, clover, segment)){ + name = "GETAMU/D"+ NPL::itoa(clover)+"_SEG"+ NPL::itoa(segment); + if(m_ADCRandomBinIsSet) + Eraw += Random->Rndm(); + Energy = cal->ApplyCalibration(name+"_E", Eraw); + if(Energy>=m_Seg_E_Threshold){ + Singles_CloverMap_SegEN[clover].push_back(segment); + Singles_CloverMap_SegE[clover].push_back(Energy); + m_PreTreatedData->SetSegmentE(clover,segment,Energy); } } } +//Segment time + mysizeT = m_EventData->GetMultiplicitySegmentT(); + for(unsigned int i = 0 ; i < mysizeT ; i++){ + Traw = m_EventData->GetSegmentTime(i); + if(Traw>0){ + clover = m_EventData->GetSegmentCloverNbrT(i); + segment = m_EventData->GetSegmentSegmentNbrT(i); + name = "GETAMU/D"+ NPL::itoa(clover)+"_SEG"+ NPL::itoa(segment); + if(m_ADCRandomBinIsSet) + Traw += Random->Rndm(); + Time = cal->ApplyCalibration(name+"_T", Traw); + Singles_CloverMap_CryTN[clover].push_back(segment); + Singles_CloverMap_CryT[clover].push_back(Time); + m_PreTreatedData->SetSegmentT(clover,segment,Time); + } + } + +} + ///////////////////////////////////////////////// TVector3 TGeTAMUPhysics::GetPositionOfInteraction(unsigned int& i){ @@ -770,7 +789,9 @@ void TGeTAMUPhysics::AddParameterToCalibrationManager(){ for(int cry = 0 ; cry < 4 ; cry++){ // 4 crystals Cal->AddParameter("GETAMU", "D"+ NPL::itoa(det+1)+"_CRY"+NPL::itoa(cry+1)+"_E","GETAMU_D"+ NPL::itoa(det+1)+"_CRY"+NPL::itoa(cry+1)+"_E"); - Cal->AddParameter("GETAMU", "D"+ NPL::itoa(det+1)+"_CRY"+NPL::itoa(cry+1)+"_E","GETAMU_D"+ NPL::itoa(det+1)+"_CRY"+NPL::itoa(cry+1)+"_T"); + //by Shuya 170509 + //Cal->AddParameter("GETAMU", "D"+ NPL::itoa(det+1)+"_CRY"+NPL::itoa(cry+1)+"_E","GETAMU_D"+ NPL::itoa(det+1)+"_CRY"+NPL::itoa(cry+1)+"_T"); + Cal->AddParameter("GETAMU", "D"+ NPL::itoa(det+1)+"_CRY"+NPL::itoa(cry+1)+"_T","GETAMU_D"+ NPL::itoa(det+1)+"_CRY"+NPL::itoa(cry+1)+"_T"); } for( int seg = 0 ; seg < 3 ; seg++){ // 3 segments Cal->AddParameter("GETAMU", "D"+ NPL::itoa(det+1)+"_SEG"+ NPL::itoa(seg+1)+"_E","GETAMU_D"+ NPL::itoa(det+1)+"_SEG"+NPL::itoa(seg+1)+"_E"); diff --git a/NPLib/Detectors/GeTAMU/TGeTAMUPhysics.h b/NPLib/Detectors/GeTAMU/TGeTAMUPhysics.h index 483bb64eea3236efa5375cfb518f597ce70f3d56..4608cbf999ddf0f2ac55f570c4baccb7420de52d 100644 --- a/NPLib/Detectors/GeTAMU/TGeTAMUPhysics.h +++ b/NPLib/Detectors/GeTAMU/TGeTAMUPhysics.h @@ -67,10 +67,6 @@ class TGeTAMUPhysics : public TObject, public NPL::VDetector{ // First argument is either 0 for Cry,1 Seg bool IsValidChannel(const int& DetectorType, const int& detector , const int& channel) ; - // Return true if the energy is read from low gain channel - // First argument is either 0 for Cry,1 Seg - bool IsLowGainChannel(const int& DetectorType, const int& detector , const int& channel) ; - // Initialize the standard parameter for analysis // ie: all channel enable, maximum multiplicity for strip = number of telescope void InitializeStandardParameter(); @@ -144,8 +140,10 @@ class TGeTAMUPhysics : public TObject, public NPL::VDetector{ double m_Seg_E_Threshold; int m_Cry_E_Raw_Threshold; int m_Seg_E_Raw_Threshold; - int m_AddBackMode; - bool m_LowGainIsSet; + int m_AddBackMode; + bool m_LowGainCryIsSet; + bool m_LowGainSegIsSet; + bool m_ADCRandomBinIsSet; //Randomise the raw energy in the Raw data within a bin private: // use for anlysis TLorentzVector m_GammaLV; //! diff --git a/Projects/T40/configs/ConfigGeTamu.dat b/Projects/T40/configs/ConfigGeTamu.dat index 92086c035ef2c005a373879107754bf53aa62d0f..92af5961028f1ec912f17ab76f931fe709a197cb 100644 --- a/Projects/T40/configs/ConfigGeTamu.dat +++ b/Projects/T40/configs/ConfigGeTamu.dat @@ -1,6 +1,7 @@ ConfigGeTamu %%%%%%%% Default is high energy - %LOW_GAIN_ENERGY + %LOW_GAIN_ENERGY_CRY + %LOW_GAIN_ENERGY_SEG %%%%%%%% Defective channels %DISABLE_ALL CLOVER04 %DISABLE_CHANNEL CLOVER01_SEG01 @@ -13,3 +14,5 @@ ConfigGeTamu ADD_BACK_CLOVER %ADD_BACK_ARRAY %ADD_BACK_FACING + %%%%%%%% Randomise raw energy within ADC bin + %ADC_RANDOM_BIN