diff --git a/NPLib/Detectors/Exogam/TExogamData.h b/NPLib/Detectors/Exogam/TExogamData.h index e29da96ce2d0a50799250b1f29ef8ba96f3d871a..3b22ef67a6814064367b6f867ae57d1ed6a32b67 100644 --- a/NPLib/Detectors/Exogam/TExogamData.h +++ b/NPLib/Detectors/Exogam/TExogamData.h @@ -39,23 +39,23 @@ class TExogamData : public TObject { public: std::vector<unsigned int> fExo_Crystal; - std::vector<unsigned int> fExo_E; - std::vector<unsigned int> fExo_E_HG; // High gain x20 + std::vector<float> fExo_E; + std::vector<float> fExo_E_HG; // High gain x20 std::vector<unsigned long long> fExo_TS; - std::vector<unsigned int> fExo_TDC; + std::vector<float> fExo_TDC; std::vector<unsigned int> fExo_BGO; std::vector<unsigned int> fExo_CsI; - std::vector<unsigned int> fExo_Outer1; - std::vector<unsigned int> fExo_Outer2; - std::vector<unsigned int> fExo_Outer3; - std::vector<unsigned int> fExo_Outer4; + std::vector<float> fExo_Outer1; + std::vector<float> fExo_Outer2; + std::vector<float> fExo_Outer3; + std::vector<float> fExo_Outer4; ///////////////////// SETTERS //////////////////////// - inline void SetExo(const unsigned int& Crystal,const unsigned int& Energy, - const unsigned int& Energy_HG,const unsigned long long& TS,const unsigned int& TDC, - const unsigned int& BGO,const unsigned int& CsI,const unsigned int& Outer1, - const unsigned int& Outer2,const unsigned int& Outer3,const unsigned int& Outer4) { + inline void SetExo(const unsigned int& Crystal,const float& Energy, + const float& Energy_HG,const unsigned long long& TS,const float& TDC, + const unsigned int& BGO,const unsigned int& CsI,const float& Outer1, + const float& Outer2,const float& Outer3,const float& Outer4) { fExo_Crystal.push_back(Crystal); fExo_E.push_back(Energy); fExo_E_HG.push_back(Energy_HG); @@ -71,16 +71,16 @@ class TExogamData : public TObject { ///////////////////// GETTERS //////////////////////// inline unsigned int GetExoMult() { return fExo_Crystal.size(); } inline unsigned int GetExoCrystal(const unsigned int& i) const { return fExo_Crystal[i]; } - inline unsigned int GetExoE(const unsigned int& i) const { return fExo_E[i]; } - inline unsigned int GetExoEHG(const unsigned int& i) const { return fExo_E_HG[i]; } + inline float GetExoE(const unsigned int& i) const { return fExo_E[i]; } + inline float GetExoEHG(const unsigned int& i) const { return fExo_E_HG[i]; } inline unsigned long long GetExoTS(const unsigned int& i) const { return fExo_TS[i]; } - inline unsigned int GetExoTDC(const unsigned int& i) const { return fExo_TDC[i]; } + inline float GetExoTDC(const unsigned int& i) const { return fExo_TDC[i]; } inline unsigned int GetExoBGO(const unsigned int& i) const { return fExo_BGO[i]; } inline unsigned int GetExoCsI(const unsigned int& i) const { return fExo_CsI[i]; } - inline unsigned int GetExoOuter1(const unsigned int& i) const { return fExo_Outer1[i]; } - inline unsigned int GetExoOuter2(const unsigned int& i) const { return fExo_Outer2[i]; } - inline unsigned int GetExoOuter3(const unsigned int& i) const { return fExo_Outer3[i]; } - inline unsigned int GetExoOuter4(const unsigned int& i) const { return fExo_Outer4[i]; } + inline float GetExoOuter1(const unsigned int& i) const { return fExo_Outer1[i]; } + inline float GetExoOuter2(const unsigned int& i) const { return fExo_Outer2[i]; } + inline float GetExoOuter3(const unsigned int& i) const { return fExo_Outer3[i]; } + inline float GetExoOuter4(const unsigned int& i) const { return fExo_Outer4[i]; } ClassDef(TExogamData, 1) // ExogamData structure }; diff --git a/NPLib/Detectors/Exogam/TExogamPhysics.cxx b/NPLib/Detectors/Exogam/TExogamPhysics.cxx index 9e60ecf7ab57fef17f811b6c7d130391e9fef09c..2c0ddad4a175186a0fce6a0f105eb3c644b6b0e5 100644 --- a/NPLib/Detectors/Exogam/TExogamPhysics.cxx +++ b/NPLib/Detectors/Exogam/TExogamPhysics.cxx @@ -39,24 +39,26 @@ using namespace EXOGAM_LOCAL; /////////////////////////////////////////////////////////////////////////// ClassImp(TExogamPhysics) - /////////////////////////////////////////////////////////////////////////// - TExogamPhysics::TExogamPhysics() { - m_Spectra = NULL; - m_EXO_E_RAW_Threshold = 0; - m_EXO_E_Threshold = 0; - m_EXO_EHG_RAW_Threshold = 0; - m_EXO_TDC_RAW_Threshold = 0; - m_ExoTDC_HighThreshold = 0; - m_ExoTDC_LowThreshold = 0; - m_EXO_OuterUp_RAW_Threshold = 1e5; - - m_PreTreatedData = new TExogamData; - m_EventData = new TExogamData; - m_EventPhysics = this; -} + /////////////////////////////////////////////////////////////////////////// + TExogamPhysics::TExogamPhysics() { + m_Spectra = NULL; + m_EXO_E_RAW_Threshold = 0; + m_EXO_E_Threshold = 0; + m_EXO_EHG_RAW_Threshold = 0; + m_EXO_TDC_RAW_Threshold = 0; + m_ExoTDC_HighThreshold = 1e6; + m_ExoTDC_LowThreshold = 0; + m_EXO_OuterUp_RAW_Threshold = 1e5; + + m_NumberOfClovers = 0; + m_PreTreatedData = new TExogamData; + m_EventData = new TExogamData; + m_EventPhysics = this; + } /////////////////////////////////////////////////////////////////////////// void TExogamPhysics::BuildSimplePhysicalEvent() { BuildPhysicalEvent(); } + /////////////////////////////////////////////////////////////////////////// void TExogamPhysics::PreTreat() { // Clearing PreTreat TExogamData @@ -66,47 +68,47 @@ void TExogamPhysics::PreTreat() { m_EXO_Mult = m_EventData->GetExoMult(); for (unsigned int i = 0; i < m_EXO_Mult; ++i) { - + ResetPreTreatVariable(); - + if (m_EventData->GetExoE(i) > m_EXO_E_RAW_Threshold) EXO_E = fEXO_E(m_EventData, i); if (m_EventData->GetExoEHG(i) > m_EXO_EHG_RAW_Threshold) EXO_EHG = fEXO_EHG(m_EventData, i); - + if (m_EventData->GetExoTDC(i) > m_EXO_TDC_RAW_Threshold) EXO_TDC = fEXO_T(m_EventData, i); - + if (m_EventData->GetExoOuter1(i) < m_EXO_OuterUp_RAW_Threshold) EXO_Outer1 = fEXO_Outer(m_EventData, i, 0); else EXO_Outer1 = 0; - + if (m_EventData->GetExoOuter2(i) < m_EXO_OuterUp_RAW_Threshold) EXO_Outer2 = fEXO_Outer(m_EventData, i, 1); else EXO_Outer2 = 0; - + if (m_EventData->GetExoOuter3(i) < m_EXO_OuterUp_RAW_Threshold) EXO_Outer3 = fEXO_Outer(m_EventData, i, 2); else EXO_Outer3 = 0; - + if (m_EventData->GetExoOuter4(i) < m_EXO_OuterUp_RAW_Threshold) EXO_Outer4 = fEXO_Outer(m_EventData, i, 3); else EXO_Outer4 = 0; - - // *1000 to convert MeV into keV + if(EXO_E > m_EXO_E_Threshold){ - m_PreTreatedData->SetExo(m_EventData->GetExoCrystal(i), EXO_E*1000, - EXO_EHG*1000, m_EventData->GetExoTS(i), EXO_TDC, - m_EventData->GetExoBGO(i), m_EventData->GetExoCsI(i), EXO_Outer1*1000, - EXO_Outer2*1000, EXO_Outer3*1000, EXO_Outer4*1000); + m_PreTreatedData->SetExo(m_EventData->GetExoCrystal(i), EXO_E, + EXO_EHG, m_EventData->GetExoTS(i), EXO_TDC, + m_EventData->GetExoBGO(i), m_EventData->GetExoCsI(i), EXO_Outer1, + EXO_Outer2, EXO_Outer3, EXO_Outer4); } } } + /////////////////////////////////////////////////////////////////////////// void TExogamPhysics::ResetPreTreatVariable(){ EXO_E = -1000; @@ -118,6 +120,7 @@ void TExogamPhysics::ResetPreTreatVariable(){ EXO_Outer4 = -1000; } +/////////////////////////////////////////////////////////////////////////// void TExogamPhysics::BuildPhysicalEvent() { if (NPOptionManager::getInstance()->IsReader() == true) { m_EventData = &(**r_ReaderEventData); @@ -131,10 +134,10 @@ void TExogamPhysics::BuildPhysicalEvent() { for(unsigned int i = 0; i < m_PreTreatedData->GetExoMult(); i++){ // Asking good TDC prompt if(TDCMatch(i)){ + // Doing flange and crystal matching flange_nbr = MapCrystalFlangeCLover[m_PreTreatedData->GetExoCrystal(i)].first; crystal_nbr = MapCrystalFlangeCLover[m_PreTreatedData->GetExoCrystal(i)].second; - E.push_back(m_PreTreatedData->GetExoE(i)); EHG.push_back(m_PreTreatedData->GetExoEHG(i)); Outer1.push_back(m_PreTreatedData->GetExoOuter1(i)); @@ -145,8 +148,7 @@ void TExogamPhysics::BuildPhysicalEvent() { TS.push_back(m_PreTreatedData->GetExoTS(i)); Flange.push_back(flange_nbr); Crystal.push_back(crystal_nbr); - - + HitsID[flange_nbr].push_back(i); } } @@ -167,7 +169,7 @@ void TExogamPhysics::BuildPhysicalEvent() { // Doing it again for this loop, it's a bit unhappy but didnt find a better way to do it yet flange_nbr = (*it).first; crystal_nbr = MapCrystalFlangeCLover[m_PreTreatedData->GetExoCrystal(Id_Max)].second; - + // Adding all AddBack (AB) related stuff E_AB.push_back(E_AddBack); Flange_AB.push_back(flange_nbr); @@ -179,11 +181,23 @@ void TExogamPhysics::BuildPhysicalEvent() { Crystal_AB.push_back(crystal_nbr); int MaxOuterId = GetMaxOuter(Id_Max); Outer_AB.push_back(GetMaxOuter(Id_Max)); - + if(MaxOuterId > -1){ - Exogam_struc = Ask_For_Angles(flange_nbr, ComputeMeanFreePath(E_AddBack)); - double Theta_seg = Exogam_struc.Theta_Crystal_Seg[crystal_nbr][MaxOuterId]; - double Phi_seg = Exogam_struc.Phi_Crystal_Seg[crystal_nbr][MaxOuterId]; + double Theta_seg; + double Phi_seg; + if(m_flange.size()>0){ + unsigned int index = MapFlangeToCloverNumber[flange_nbr]; + if(index>0){ + Theta_seg = m_pos_segment[crystal_nbr][MaxOuterId].at(index-1).Theta(); + Phi_seg = m_pos_segment[crystal_nbr][MaxOuterId].at(index-1).Phi(); + } + } + else{ + Exogam_struc = Ask_For_Angles(flange_nbr, ComputeMeanFreePath(E_AddBack)); + Theta_seg = Exogam_struc.Theta_Crystal_Seg[crystal_nbr][MaxOuterId]; + Phi_seg = Exogam_struc.Phi_Crystal_Seg[crystal_nbr][MaxOuterId]; + } + Theta.push_back(Theta_seg); Phi.push_back(Phi_seg); } @@ -194,10 +208,12 @@ void TExogamPhysics::BuildPhysicalEvent() { } } +/////////////////////////////////////////////////////////////////////////// bool TExogamPhysics::TDCMatch(unsigned int event){ return m_PreTreatedData->GetExoTDC(event) > m_ExoTDC_LowThreshold && m_PreTreatedData->GetExoTDC(event) < m_ExoTDC_HighThreshold; } +/////////////////////////////////////////////////////////////////////////// int TExogamPhysics::GetMaxOuter(unsigned int EventId){ // somehow starting at 50 to get something equivalent to a 50keV threshold double OuterMax = 50; @@ -221,6 +237,7 @@ int TExogamPhysics::GetMaxOuter(unsigned int EventId){ return OuterId; } +/////////////////////////////////////////////////////////////////////////// double TExogamPhysics::GetDoppler(double Energy, unsigned int Flange, unsigned int Crystal, unsigned int Outer){ Exogam_struc = Ask_For_Angles(Flange, ComputeMeanFreePath(Energy)); double Theta_seg = Exogam_struc.Theta_Crystal_Seg[Crystal][Outer]; @@ -228,6 +245,7 @@ double TExogamPhysics::GetDoppler(double Energy, unsigned int Flange, unsigned i return Doppler_Correction(Theta_seg,Phi_seg,0,0,Beta,Energy); } +/////////////////////////////////////////////////////////////////////////// double TExogamPhysics::ComputeMeanFreePath(double Energy){ auto b = Map_PhotonCS.lower_bound(Energy); auto a = prev(b); @@ -249,6 +267,7 @@ double TExogamPhysics::ComputeMeanFreePath(double Energy){ // } +/////////////////////////////////////////////////////////////////////////// double TExogamPhysics::DopplerCorrection(double E, double Theta) { double Pi = 3.141592654; TString filename = "configs/beta.txt"; @@ -269,7 +288,21 @@ double TExogamPhysics::DopplerCorrection(double E, double Theta) { } /////////////////////////////////////////////////////////////////////////// +// Routine of doppler correction +/////////////////////////////////////////////////////////////////////////// +double TExogamPhysics::CorrectionDoppler(double theta_gamma, double phi_gamma, double theta_part, double phi_part, double beta_part, double E){ //rad, v/c + double Ecorr,cosinusPSI; + + cosinusPSI =TMath::Sin(theta_part)*TMath::Cos(phi_part)*TMath::Sin(theta_gamma)*TMath::Cos(phi_gamma)+ + TMath::Sin(theta_part)*TMath::Sin(phi_part)*TMath::Sin(theta_gamma)*TMath::Sin(phi_gamma)+ + TMath::Cos(theta_part)*TMath::Cos(theta_gamma); + + Ecorr = E*(1.-beta_part*cosinusPSI)/sqrt(1.-beta_part*beta_part); + + return Ecorr; +} +/////////////////////////////////////////////////////////////////////////// void TExogamPhysics::Clear() { // Exogam_struc = {}; @@ -294,37 +327,46 @@ void TExogamPhysics::Clear() { TDC_AB.clear(); TS_AB.clear(); } -/////////////////////////////////////////////////////////////////////////// - -//// Innherited from VDetector Class //// +/////////////////////////////////////////////////////////////////////////// // Read stream at ConfigFile to pick-up parameters of detector (Position,...) using Token +/////////////////////////////////////////////////////////////////////////// void TExogamPhysics::ReadConfiguration(NPL::InputParser parser) { vector<NPL::InputBlock*> blocks = parser.GetAllBlocksWithToken("Exogam"); if (NPOptionManager::getInstance()->GetVerboseLevel()) cout << "//// " << blocks.size() << " Exogam clover found " << endl; - // FIXME ANGLE FILE??? NOT SURE I GET IT... - // For Doppler I guess... Something like that should be added later - // But maybe the more stand R,THETA,PHI or X,Y,Z - // vector<string> token = {"ANGLE_FILE"}; - vector<string> token = {"Board, Flange, Channel0, Channel1"}; - // FIXME To be implemented in the future - // vector<string> token = {"Board, Flange, Channel0, Channel1, R, THETA, PHI"}; - - //for (unsigned int i = 0; i < blocks.size(); i++) { - // if (blocks[i]->HasTokenList(token)) { - // int Board, Flange, Channel0, Channel1; // FIXME!!!! Should come from Data... - // AddClover(Board, Flange, Channel0, Channel1); - // } - // else { - // cout << "ERROR: check your input file formatting " << endl; - // exit(1); - // } - //} + for(unsigned int i=0; i<blocks.size(); i++){ + if(NPOptionManager::getInstance()->GetVerboseLevel()) + cout << endl << "//// EXOGAM Clover " << i+1 << endl; + + m_NumberOfClovers++; + int flange = blocks[i]->GetInt("FLANGE"); + m_flange.push_back(flange); + m_pos_segment[0][0].push_back(blocks[i]->GetTVector3("POS_CRYSTALA_SEG1","mm")); + m_pos_segment[0][1].push_back(blocks[i]->GetTVector3("POS_CRYSTALA_SEG2","mm")); + m_pos_segment[0][2].push_back(blocks[i]->GetTVector3("POS_CRYSTALA_SEG3","mm")); + m_pos_segment[0][3].push_back(blocks[i]->GetTVector3("POS_CRYSTALA_SEG4","mm")); + m_pos_segment[1][0].push_back(blocks[i]->GetTVector3("POS_CRYSTALB_SEG1","mm")); + m_pos_segment[1][1].push_back(blocks[i]->GetTVector3("POS_CRYSTALB_SEG2","mm")); + m_pos_segment[1][2].push_back(blocks[i]->GetTVector3("POS_CRYSTALB_SEG3","mm")); + m_pos_segment[1][3].push_back(blocks[i]->GetTVector3("POS_CRYSTALB_SEG4","mm")); + m_pos_segment[2][0].push_back(blocks[i]->GetTVector3("POS_CRYSTALC_SEG1","mm")); + m_pos_segment[2][1].push_back(blocks[i]->GetTVector3("POS_CRYSTALC_SEG2","mm")); + m_pos_segment[2][2].push_back(blocks[i]->GetTVector3("POS_CRYSTALC_SEG3","mm")); + m_pos_segment[2][3].push_back(blocks[i]->GetTVector3("POS_CRYSTALC_SEG4","mm")); + m_pos_segment[3][0].push_back(blocks[i]->GetTVector3("POS_CRYSTALD_SEG1","mm")); + m_pos_segment[3][1].push_back(blocks[i]->GetTVector3("POS_CRYSTALD_SEG2","mm")); + m_pos_segment[3][2].push_back(blocks[i]->GetTVector3("POS_CRYSTALD_SEG3","mm")); + m_pos_segment[3][3].push_back(blocks[i]->GetTVector3("POS_CRYSTALD_SEG4","mm")); + + MapFlangeToCloverNumber[flange] = m_NumberOfClovers; + } + ReadAnalysisConfig(); } +/////////////////////////////////////////////////////////////////////////// void TExogamPhysics::ReadAnalysisConfig() { bool ReadingStatus = false; @@ -335,10 +377,10 @@ void TExogamPhysics::ReadAnalysisConfig() { ifstream CSFile; CSFile.open(CSFilename.c_str()); - + if (!CSFile.is_open()) { cout << " No CS file found " - << CSFilename << endl; + << CSFilename << endl; return; } while(CSFile.good()){ @@ -359,12 +401,12 @@ void TExogamPhysics::ReadAnalysisConfig() { if (!AnalysisConfigFile.is_open()) { cout << " No ConfigExogam.dat found: Default parameters loaded for " - "Analysis " - << FileName << endl; + "Analysis " + << FileName << endl; return; } - - + + string DataBuffer, whatToDo; while (!AnalysisConfigFile.eof()) { // Pick-up next line @@ -393,17 +435,17 @@ void TExogamPhysics::ReadAnalysisConfig() { unsigned int CrystalNb; unsigned int Flange; unsigned int CrystalNb2; - + AnalysisConfigFile >> DataBuffer; CrystalNb = stoi(DataBuffer); - + AnalysisConfigFile >> DataBuffer; Flange = stoi(DataBuffer); - + AnalysisConfigFile >> DataBuffer; CrystalNb2 = stoi(DataBuffer); MapCrystalFlangeCLover[CrystalNb] = std::make_pair(Flange,CrystalNb2); - // cout << whatToDo << " " << atoi(DataBuffer.substr(0,1).c_str()) << " " << atoi(DataBuffer.substr(1,1).c_str()) << endl; + cout << whatToDo << " / " << "crystal= " << CrystalNb << " && flange= " << Flange << endl; } else if (whatToDo == "TDC_THRESHOLDS") { AnalysisConfigFile >> DataBuffer; @@ -502,29 +544,34 @@ void TExogamPhysics::AddClover(int Board, int Flange, int Channel0, int Channel1 // NumberOfClover++; // } +////////////////////////////////////////////////////////////////////////// // Add Parameter to the CalibrationManger +////////////////////////////////////////////////////////////////////////// void TExogamPhysics::AddParameterToCalibrationManager() { CalibrationManager* Cal = CalibrationManager::getInstance(); for (auto it = MapCrystalFlangeCLover.begin(); it != MapCrystalFlangeCLover.end(); it++) - { unsigned int i = it->first; - Cal->AddParameter("EXO", "E" + NPL::itoa(i), - "EXO_E" + NPL::itoa(i)); - Cal->AddParameter("EXO", "EHG" + NPL::itoa(i), - "EXO_EHG" + NPL::itoa(i)); - // Cal->AddParameter("EXOGAM", "Cl" + NPL::itoa(i) + "_Cr" + NPL::itoa(j) + "_T", - // "EXOGAM_Cl" + NPL::itoa(i) + "_Cr" + NPL::itoa(j) + "_T"); + { unsigned int i = it->first; + Cal->AddParameter("EXO", "E" + NPL::itoa(i), + "EXO_E" + NPL::itoa(i)); + Cal->AddParameter("EXO", "EHG" + NPL::itoa(i), + "EXO_EHG" + NPL::itoa(i)); + // Cal->AddParameter("EXOGAM", "Cl" + NPL::itoa(i) + "_Cr" + NPL::itoa(j) + "_T", + // "EXOGAM_Cl" + NPL::itoa(i) + "_Cr" + NPL::itoa(j) + "_T"); for (int j = 0; j < 4; j++) { Cal->AddParameter("EXO", "Outer" + NPL::itoa(i) + "_" + NPL::itoa(j), - "EXO_Outer" + NPL::itoa(i) + "_" + NPL::itoa(j)); + "EXO_Outer" + NPL::itoa(i) + "_" + NPL::itoa(j)); } } } + +////////////////////////////////////////////////////////////////////////// // Activated associated Branches and link it to the private member DetectorData address // In this method mother Branches (Detector) AND daughter leaf (fDetector_parameter) have to be activated +////////////////////////////////////////////////////////////////////////// void TExogamPhysics::InitializeRootInputRaw() { TChain* inputChain = RootInput::getInstance()->GetChain(); // Option to use the nptreereader anaysis @@ -534,18 +581,18 @@ void TExogamPhysics::InitializeRootInputRaw() { } // Option to use the standard npanalysis else{ - TChain* inputChain = RootInput::getInstance()->GetChain(); - inputChain->SetBranchStatus("Exogam", true); - inputChain->SetBranchStatus("fEXO_*", true); - inputChain->SetBranchAddress("Exogam", &m_EventData); - - /* - TList* outputList = RootOutput::getInstance()->GetList(); - clover_mult = new TH1F("clover_mult","clover_mult",20,0,20); - outputList->Add(clover_mult); - cristal_mult = new TH1F("cristal_mult","cristal_mult",20,0,20); - outputList->Add(cristal_mult); - */ + TChain* inputChain = RootInput::getInstance()->GetChain(); + inputChain->SetBranchStatus("Exogam", true); + inputChain->SetBranchStatus("fEXO_*", true); + inputChain->SetBranchAddress("Exogam", &m_EventData); + + /* + TList* outputList = RootOutput::getInstance()->GetList(); + clover_mult = new TH1F("clover_mult","clover_mult",20,0,20); + outputList->Add(clover_mult); + cristal_mult = new TH1F("cristal_mult","cristal_mult",20,0,20); + outputList->Add(cristal_mult); + */ } } @@ -561,53 +608,53 @@ void TExogamPhysics::InitializeRootInputPhysics() { } // Option to use the standard npanalysis else{ - TChain* inputChain = RootInput::getInstance()->GetChain(); - inputChain->SetBranchStatus("Exogam" , true ); - inputChain->SetBranchStatus("EventMultiplicty", true); - inputChain->SetBranchStatus("ECC_Multiplicity", true); - inputChain->SetBranchStatus("GOCCE_Multiplicity", true); - inputChain->SetBranchStatus("ECC_CloverNumber", true); - inputChain->SetBranchStatus("ECC_CristalNumber", true); - inputChain->SetBranchStatus("GOCCE_CloverNumber", true); - inputChain->SetBranchStatus("GOCCE_CristalNumber", true); - inputChain->SetBranchStatus("GOCCE_SegmentNumber", true); - inputChain->SetBranchStatus("ECC_E", true); - inputChain->SetBranchStatus("ECC_T", true); - inputChain->SetBranchStatus("GOCCE_E", true); - inputChain->SetBranchStatus("CristalNumber", true); - inputChain->SetBranchStatus("SegmentNumber", true); - inputChain->SetBranchStatus("CloverNumber", true); - inputChain->SetBranchStatus("CloverMult", true); - inputChain->SetBranchStatus("TotalEnergy_lab", true); - inputChain->SetBranchStatus("Time", true); - inputChain->SetBranchStatus("DopplerCorrectedEnergy", true); - inputChain->SetBranchStatus("Position", true); - inputChain->SetBranchStatus("Theta", true); - inputChain->SetBranchAddress("Exogam", &m_EventPhysics); + TChain* inputChain = RootInput::getInstance()->GetChain(); + inputChain->SetBranchStatus("Exogam" , true ); + inputChain->SetBranchStatus("EventMultiplicty", true); + inputChain->SetBranchStatus("ECC_Multiplicity", true); + inputChain->SetBranchStatus("GOCCE_Multiplicity", true); + inputChain->SetBranchStatus("ECC_CloverNumber", true); + inputChain->SetBranchStatus("ECC_CristalNumber", true); + inputChain->SetBranchStatus("GOCCE_CloverNumber", true); + inputChain->SetBranchStatus("GOCCE_CristalNumber", true); + inputChain->SetBranchStatus("GOCCE_SegmentNumber", true); + inputChain->SetBranchStatus("ECC_E", true); + inputChain->SetBranchStatus("ECC_T", true); + inputChain->SetBranchStatus("GOCCE_E", true); + inputChain->SetBranchStatus("CristalNumber", true); + inputChain->SetBranchStatus("SegmentNumber", true); + inputChain->SetBranchStatus("CloverNumber", true); + inputChain->SetBranchStatus("CloverMult", true); + inputChain->SetBranchStatus("TotalEnergy_lab", true); + inputChain->SetBranchStatus("Time", true); + inputChain->SetBranchStatus("DopplerCorrectedEnergy", true); + inputChain->SetBranchStatus("Position", true); + inputChain->SetBranchStatus("Theta", true); + inputChain->SetBranchAddress("Exogam", &m_EventPhysics); } } ///////////////////////////////////////////////////////////////////// - // Create associated branches and associated private member DetectorPhysics address +///////////////////////////////////////////////////////////////////// void TExogamPhysics::InitializeRootOutput() { TTree* outputTree = RootOutput::getInstance()->GetTree(); outputTree->Branch("Exogam", "TExogamPhysics", &m_EventPhysics); // control histograms if needed /* - TList* outputList = RootOutput::getInstance()->GetList(); - controle = new TH1F("controle","histo de controle",20,0,20); - outputList->Add(controle); - */ + TList* outputList = RootOutput::getInstance()->GetList(); + controle = new TH1F("controle","histo de controle",20,0,20); + outputList->Add(controle); + */ } +///////////////////////////////////////////////////////////////////// void TExogamPhysics::SetTreeReader(TTreeReader* TreeReader) { - TExogamPhysicsReader::r_SetTreeReader(TreeReader); - } + TExogamPhysicsReader::r_SetTreeReader(TreeReader); +} /////////////////////////////// DoCalibration Part //////////////////////////: - void TExogamPhysics::InitializeRootHistogramsCalib() { std::cout << "Initialize Exogam Histograms" << std::endl; map<int, bool>::iterator it; @@ -636,13 +683,15 @@ void TExogamPhysics::InitializeRootHistogramsCalib() { } } +///////////////////////////////////////////////////////////////////// void TExogamPhysics::FillHistogramsCalib() { if (NPOptionManager::getInstance()->IsReader()) m_EventData = &(**r_ReaderEventData); - + FillRootHistogramsCalib_F(); } +///////////////////////////////////////////////////////////////////// void TExogamPhysics::InitializeRootHistogramsE_F(unsigned int DetectorNumber) { auto TH1Map = RootHistogramsCalib::getInstance()->GetTH1Map(); @@ -651,6 +700,7 @@ void TExogamPhysics::InitializeRootHistogramsE_F(unsigned int DetectorNumber) { (*TH1Map)["Exogam"][hnameEXOE] = new TH1F(hnameEXOE, htitleEXOE, 65536, 0, 65536); } +///////////////////////////////////////////////////////////////////// void TExogamPhysics::InitializeRootHistogramsOuter_F(unsigned int DetectorNumber, unsigned int OuterNumber) { auto TH1Map = RootHistogramsCalib::getInstance()->GetTH1Map(); @@ -659,6 +709,7 @@ void TExogamPhysics::InitializeRootHistogramsOuter_F(unsigned int DetectorNumber (*TH1Map)["Exogam"][hnameEXOOuter] = new TH1F(hnameEXOOuter, htitleEXOOuter, 65536, 0, 65536); } +///////////////////////////////////////////////////////////////////// void TExogamPhysics::InitializeRootHistogramsEHG_F(unsigned int DetectorNumber) { auto TH1Map = RootHistogramsCalib::getInstance()->GetTH1Map(); @@ -667,10 +718,12 @@ void TExogamPhysics::InitializeRootHistogramsEHG_F(unsigned int DetectorNumber) (*TH1Map)["Exogam"][hnameEXOEHG] = new TH1F(hnameEXOEHG, htitleEXOEHG, 65536, 0, 65536); } + +///////////////////////////////////////////////////////////////////// void TExogamPhysics::FillRootHistogramsCalib_F(){ auto TH1Map = RootHistogramsCalib::getInstance()->GetTH1Map(); TString hname; - + for (UShort_t i = 0; i < m_EventData->GetExoMult(); i++) { unsigned int DetectorNbr = m_EventData->GetExoCrystal(i); @@ -701,12 +754,13 @@ void TExogamPhysics::FillRootHistogramsCalib_F(){ } } +///////////////////////////////////////////////////////////////////// void TExogamPhysics::DoCalibration() { std::cout << "Do Calibration Exogam" << std::endl; DefineCalibrationSource(Source_name); map<int, bool>::iterator it; map<int, map<int,bool>>::iterator it2; - + std::string Path = NPOptionManager::getInstance()->GetCalibrationOutputPath(); std::string OutputName = NPOptionManager::getInstance()->GetOutputFile(); if (OutputName.size() > 5) { @@ -715,12 +769,12 @@ void TExogamPhysics::DoCalibration() { } } std::string make_folder = "mkdir " + Path + OutputName; - + MakeInitialCalibFolder(make_folder); - + ofstream* calib_file = new ofstream; ofstream* dispersion_file = new ofstream; - + if(!DoCalibrationE.empty()){ MakeECalibFolders(make_folder); CreateCalibrationEFiles(calib_file, dispersion_file); @@ -744,7 +798,7 @@ void TExogamPhysics::DoCalibration() { } calib_file->close(); dispersion_file->close(); - + if(!DoCalibrationOuter.empty()){ MakeOuterCalibFolders(make_folder); CreateCalibrationOuterFiles(calib_file, dispersion_file); @@ -760,21 +814,27 @@ void TExogamPhysics::DoCalibration() { dispersion_file->close(); } +///////////////////////////////////////////////////////////////////// void TExogamPhysics::MakeInitialCalibFolder(std::string make_folder) { int sys = system(make_folder.c_str()); } +///////////////////////////////////////////////////////////////////// void TExogamPhysics::MakeECalibFolders(std::string make_folder) { int sys =system((make_folder+"/Exogam_E").c_str()); } +///////////////////////////////////////////////////////////////////// void TExogamPhysics::MakeEHGCalibFolders(std::string make_folder) { int sys =system((make_folder+"/Exogam_EHG").c_str()); } + +///////////////////////////////////////////////////////////////////// void TExogamPhysics::MakeOuterCalibFolders(std::string make_folder) { int sys =system((make_folder+"/Exogam_Outer").c_str()); } +///////////////////////////////////////////////////////////////////// void TExogamPhysics::DoCalibrationE_F(unsigned int DetectorNumber,std::string CalibType, ofstream* calib_file, ofstream* dispersion_file, unsigned int Threshold) { auto TH1Map = RootHistogramsCalib::getInstance()->GetTH1Map(); auto TGraphMap = RootHistogramsCalib::getInstance()->GetTGraphMap(); @@ -783,44 +843,44 @@ void TExogamPhysics::DoCalibrationE_F(unsigned int DetectorNumber,std::string Ca CubixEnergyCal->Reset(); std::string hnameEXOE = Form("EXO_%s%d",CalibType.c_str(), DetectorNumber); std::string htitleEXOE = Form("EXO_%s%d",CalibType.c_str(), DetectorNumber); - + auto hist = ((*TH1Map)["Exogam"][hnameEXOE]); CubixEnergyCal->SetDataFromHistTH1(hist,0); - + for (auto ie : Source_E) CubixEnergyCal->AddPeak(ie); - + CubixEnergyCal->SetGain(1.); CubixEnergyCal->SetVerbosityLevel(1); - + CubixEnergyCal->SetFitPlynomialOrder(FitPolOrder); CubixEnergyCal->SetNoOffset(false); CubixEnergyCal->UseLeftTail(true); CubixEnergyCal->UseRightTail(true); CubixEnergyCal->UseFirstDerivativeSearch(); - + CubixEnergyCal->SetGlobalChannelLimits(hist->GetXaxis()->GetBinLowEdge(1)+Threshold,hist->GetXaxis()->GetBinLowEdge(hist->GetXaxis()->GetNbins())); // limit the search to this range in channels CubixEnergyCal->SetGlobalPeaksLimits(15,5); // default fwhm and minmum amplitude for the peaksearch [15 5] CubixEnergyCal->StartCalib(); vector < Fitted > FitResults = CubixEnergyCal->GetFitResults(); - - - + + + std:: cout << calib_file << " " << (*calib_file).is_open() << std::endl; std:: cout << hnameEXOE << " "; (*calib_file) << hnameEXOE << " "; if(FitResults.size() > 1) - { + { for(unsigned int i = 0; i <= FitPolOrder; i++){ (*calib_file) << scientific << setprecision(6) << setw(14) << CubixEnergyCal->fCalibFunction->GetParameter(i) << " "; std::cout << scientific << setprecision(6) << setw(14) << CubixEnergyCal->fCalibFunction->GetParameter(i) << " "; } } else - { + { for(unsigned int i = 0; i <= FitPolOrder; i++){ (*calib_file) << scientific << setprecision(6) << setw(14) << 0. << " "; std::cout << scientific << setprecision(6) << setw(14) << 0. << " "; @@ -829,30 +889,30 @@ void TExogamPhysics::DoCalibrationE_F(unsigned int DetectorNumber,std::string Ca (*calib_file) << "\n"; std::cout << "\n"; - + if(FitResults.size()>1 && CubixEnergyCal->fCalibFunction) { - auto c = new TCanvas; - c->SetName("CalibrationResults"); - c->SetTitle("Calibration Results"); - c->Divide(1,2,0.0001,0.0001); - c->cd(1); - CubixEnergyCal->fCalibGraph->Draw("ap"); - CubixEnergyCal->fCalibFunction->Draw("same"); - c->cd(2); - CubixEnergyCal->fResidueGraph->Draw("ape"); - c->Update(); - c->Modified(); + auto c = new TCanvas; + c->SetName("CalibrationResults"); + c->SetTitle("Calibration Results"); + c->Divide(1,2,0.0001,0.0001); + c->cd(1); + CubixEnergyCal->fCalibGraph->Draw("ap"); + CubixEnergyCal->fCalibFunction->Draw("same"); + c->cd(2); + CubixEnergyCal->fResidueGraph->Draw("ape"); + c->Update(); + c->Modified(); } if(FitResults.size() > 1) { - (*TGraphMap)["Exogam"][Form("Calib_Graph_%s",hnameEXOE.c_str())] = (TGraphErrors*)(CubixEnergyCal->fCalibGraph->Clone()); - (*TGraphMap)["Exogam"][Form("Calib_Graph_%s",hnameEXOE.c_str())]->GetYaxis()->SetTitle("Energy (MeV)"); - (*TGraphMap)["Exogam"][Form("Calib_Graph_%s",hnameEXOE.c_str())]->SetTitle(Form("Calibration_Graph_%s",hnameEXOE.c_str())); - - (*TGraphMap)["Exogam"][Form("Residue_Graph_%s",hnameEXOE.c_str())] = (TGraphErrors*)(CubixEnergyCal->fResidueGraph->Clone()); - (*TGraphMap)["Exogam"][Form("Residue_Graph_%s",hnameEXOE.c_str())]->GetXaxis()->SetTitle("Energy (MeV)"); - (*TGraphMap)["Exogam"][Form("Residue_Graph_%s",hnameEXOE.c_str())]->GetYaxis()->SetTitle("Residue (MeV)"); - (*TGraphMap)["Exogam"][Form("Residue_Graph_%s",hnameEXOE.c_str())]->SetTitle(Form("Residue_Graph_%s",hnameEXOE.c_str())); + (*TGraphMap)["Exogam"][Form("Calib_Graph_%s",hnameEXOE.c_str())] = (TGraphErrors*)(CubixEnergyCal->fCalibGraph->Clone()); + (*TGraphMap)["Exogam"][Form("Calib_Graph_%s",hnameEXOE.c_str())]->GetYaxis()->SetTitle("Energy (MeV)"); + (*TGraphMap)["Exogam"][Form("Calib_Graph_%s",hnameEXOE.c_str())]->SetTitle(Form("Calibration_Graph_%s",hnameEXOE.c_str())); + + (*TGraphMap)["Exogam"][Form("Residue_Graph_%s",hnameEXOE.c_str())] = (TGraphErrors*)(CubixEnergyCal->fResidueGraph->Clone()); + (*TGraphMap)["Exogam"][Form("Residue_Graph_%s",hnameEXOE.c_str())]->GetXaxis()->SetTitle("Energy (MeV)"); + (*TGraphMap)["Exogam"][Form("Residue_Graph_%s",hnameEXOE.c_str())]->GetYaxis()->SetTitle("Residue (MeV)"); + (*TGraphMap)["Exogam"][Form("Residue_Graph_%s",hnameEXOE.c_str())]->SetTitle(Form("Residue_Graph_%s",hnameEXOE.c_str())); } #else std::cout << "Exogam calibration currently not supported without CUBIX. Download CUBIX and set -DCUBIX=1 to use EXOGAM calibration\n"; @@ -862,6 +922,7 @@ void TExogamPhysics::DoCalibrationE_F(unsigned int DetectorNumber,std::string Ca } +///////////////////////////////////////////////////////////////////// void TExogamPhysics::DefineCalibrationSource(std::string source) { // 239Pu if(source == "60Co"){ @@ -869,7 +930,7 @@ void TExogamPhysics::DefineCalibrationSource(std::string source) { Source_E.push_back(1.17322); Source_Sig.push_back(0.0001); Source_branching_ratio.push_back(99.85); - + Source_isotope.push_back("$^{60}$Co"); Source_E.push_back(1.33249); Source_Sig.push_back(0.0001); @@ -880,72 +941,72 @@ void TExogamPhysics::DefineCalibrationSource(std::string source) { Source_E.push_back(0.121782); Source_Sig.push_back(0.0001); Source_branching_ratio.push_back(28.58); - + Source_isotope.push_back("$^{152}$Eu"); Source_E.push_back(0.344279); Source_Sig.push_back(0.0001); Source_branching_ratio.push_back(26.5); - + Source_isotope.push_back("$^{152}$Eu"); Source_E.push_back(1.40801); Source_Sig.push_back(0.0001); Source_branching_ratio.push_back(21.0); - + Source_isotope.push_back("$^{152}$Eu"); Source_E.push_back(0.964079); Source_Sig.push_back(0.0001); Source_branching_ratio.push_back(14.6); - + Source_isotope.push_back("$^{152}$Eu"); Source_E.push_back(1.11207); Source_Sig.push_back(0.0001); Source_branching_ratio.push_back(13.64); - + Source_isotope.push_back("$^{152}$Eu"); Source_E.push_back(0.778904); Source_Sig.push_back(0.0001); Source_branching_ratio.push_back(12.94); - + Source_isotope.push_back("$^{152}$Eu"); Source_E.push_back(1.08587); Source_Sig.push_back(0.0001); Source_branching_ratio.push_back(10.21); - + Source_isotope.push_back("$^{152}$Eu"); Source_E.push_back(0.244698); Source_Sig.push_back(0.0001); Source_branching_ratio.push_back(7.58); - + Source_isotope.push_back("$^{152}$Eu"); Source_E.push_back(0.867378); Source_Sig.push_back(0.0001); Source_branching_ratio.push_back(4.25); - + Source_isotope.push_back("$^{152}$Eu"); Source_E.push_back(0.443965); Source_Sig.push_back(0.0001); Source_branching_ratio.push_back(2.82); - + Source_isotope.push_back("$^{152}$Eu"); Source_E.push_back(0.411116); Source_Sig.push_back(0.0001); Source_branching_ratio.push_back(2.23); - + Source_isotope.push_back("$^{152}$Eu"); Source_E.push_back(1.08974); Source_Sig.push_back(0.0001); Source_branching_ratio.push_back(1.73); - + Source_isotope.push_back("$^{152}$Eu"); Source_E.push_back(1.29914); Source_Sig.push_back(0.0001); Source_branching_ratio.push_back(1.62); - + Source_isotope.push_back("$^{152}$Eu"); Source_E.push_back(1.21295); Source_Sig.push_back(0.0001); Source_branching_ratio.push_back(1.42); - + } else{ std::cout << "Please enter a valid source for gamma ray calibration\nCurrently supported sources are 60Co and 152Eu\n"; @@ -954,9 +1015,11 @@ void TExogamPhysics::DefineCalibrationSource(std::string source) { } +///////////////////////////////////////////////////////////////////// // FIXME Probably could be done better, currently a but inelegant +///////////////////////////////////////////////////////////////////// void TExogamPhysics::CreateCalibrationEFiles(ofstream* calib_file, - ofstream* dispersion_file) { + ofstream* dispersion_file) { std::string Path = NPOptionManager::getInstance()->GetCalibrationOutputPath(); std::string OutputName = NPOptionManager::getInstance()->GetOutputFile(); if (OutputName.size() > 5) { @@ -970,7 +1033,7 @@ void TExogamPhysics::CreateCalibrationEFiles(ofstream* calib_file, } void TExogamPhysics::CreateCalibrationEHGFiles(ofstream* calib_file, - ofstream* dispersion_file) { + ofstream* dispersion_file) { std::string Path = NPOptionManager::getInstance()->GetCalibrationOutputPath(); std::string OutputName = NPOptionManager::getInstance()->GetOutputFile(); if (OutputName.size() > 5) { @@ -984,7 +1047,7 @@ void TExogamPhysics::CreateCalibrationEHGFiles(ofstream* calib_file, } void TExogamPhysics::CreateCalibrationOuterFiles(ofstream* calib_file, - ofstream* dispersion_file) { + ofstream* dispersion_file) { std::string Path = NPOptionManager::getInstance()->GetCalibrationOutputPath(); std::string OutputName = NPOptionManager::getInstance()->GetOutputFile(); if (OutputName.size() > 5) { @@ -1020,25 +1083,27 @@ void TExogamPhysics::ReadDoCalibration(NPL::InputParser parser) { DoCalibrationEHG[k] = true; for(unsigned int p = FirstOuter; p <= LastOuter; p++){ DoCalibrationOuter[k][p] = true; + } } } - } else { cout << "ERROR: Missing token for Exogam DoCalibration blocks, check your " - "input " - "file" - << endl; + "input " + "file" + << endl; exit(1); } } } +///////////////////////////////////////////////////////////////////// void TExogamPhysics::WriteHistogramsCalib() { std::cout << "Writing Exogam Histograms\n"; WriteHistogramsE(); RootHistogramsCalib::getInstance()->GetFile()->Close(); } +///////////////////////////////////////////////////////////////////// void TExogamPhysics::WriteHistogramsE() { auto File = RootHistogramsCalib::getInstance()->GetFile(); auto TH1Map = RootHistogramsCalib::getInstance()->GetTH1Map(); @@ -1055,11 +1120,11 @@ void TExogamPhysics::WriteHistogramsE() { for (it = DoCalibrationE.begin(); it != DoCalibrationE.end(); it++) { if (it->second) { hnameEXOE = Form("EXO_E%d", it->first); - + if (!gDirectory->GetDirectory(Form("EXO_Cr%d", it->first))) gDirectory->mkdir(Form("EXO_Cr%d", it->first)); gDirectory->cd(Form("EXO_Cr%d", it->first)); - + (*TH1Map)["Exogam"][hnameEXOE]->Write(); if((*TGraphMap)["Exogam"][Form("Calib_Graph_EXO_E%d",it->first)]!= nullptr) (*TGraphMap)["Exogam"][Form("Calib_Graph_EXO_E%d",it->first)]->Write(); @@ -1068,15 +1133,15 @@ void TExogamPhysics::WriteHistogramsE() { } File->cd("Exogam"); } - + for (it = DoCalibrationEHG.begin(); it != DoCalibrationEHG.end(); it++) { if (it->second) { hnameEXOE = Form("EXO_EHG%d", it->first); - + if (!gDirectory->GetDirectory(Form("EXO_Cr%d", it->first))) gDirectory->mkdir(Form("EXO_Cr%d", it->first)); gDirectory->cd(Form("EXO_Cr%d", it->first)); - + (*TH1Map)["Exogam"][hnameEXOE]->Write(); if((*TGraphMap)["Exogam"][Form("Calib_Graph_EXO_EHG%d",it->first)]!= nullptr) (*TGraphMap)["Exogam"][Form("Calib_Graph_EXO_EHG%d",it->first)]->Write(); @@ -1087,25 +1152,25 @@ void TExogamPhysics::WriteHistogramsE() { } for (it2 = DoCalibrationOuter.begin(); it2 != DoCalibrationOuter.end(); it2++) { for (it = (it2->second).begin(); it != (it2->second).end(); it++) { - if (it->second) { - hnameEXOE = Form("EXO_Outer%d_%d",it2->first,it->first); - - if (!gDirectory->GetDirectory(Form("EXO_Cr%d", it2->first))) - gDirectory->mkdir(Form("EXO_Cr%d", it2->first)); - gDirectory->cd(Form("EXO_Cr%d", it2->first)); - - if (!gDirectory->GetDirectory("Outers")) - gDirectory->mkdir("Outer"); - gDirectory->cd("Outer"); - - (*TH1Map)["Exogam"][hnameEXOE]->Write(); - if((*TGraphMap)["Exogam"][Form("Calib_Graph_%s",hnameEXOE.c_str())]!= nullptr) - (*TGraphMap)["Exogam"][Form("Calib_Graph_%s",hnameEXOE.c_str())]->Write(); - if((*TGraphMap)["Exogam"][Form("Residue_Graph_%s",hnameEXOE.c_str())]!= nullptr) - (*TGraphMap)["Exogam"][Form("Residue_Graph_%s",hnameEXOE.c_str())]->Write(); + if (it->second) { + hnameEXOE = Form("EXO_Outer%d_%d",it2->first,it->first); + + if (!gDirectory->GetDirectory(Form("EXO_Cr%d", it2->first))) + gDirectory->mkdir(Form("EXO_Cr%d", it2->first)); + gDirectory->cd(Form("EXO_Cr%d", it2->first)); + + if (!gDirectory->GetDirectory("Outers")) + gDirectory->mkdir("Outer"); + gDirectory->cd("Outer"); + + (*TH1Map)["Exogam"][hnameEXOE]->Write(); + if((*TGraphMap)["Exogam"][Form("Calib_Graph_%s",hnameEXOE.c_str())]!= nullptr) + (*TGraphMap)["Exogam"][Form("Calib_Graph_%s",hnameEXOE.c_str())]->Write(); + if((*TGraphMap)["Exogam"][Form("Residue_Graph_%s",hnameEXOE.c_str())]!= nullptr) + (*TGraphMap)["Exogam"][Form("Residue_Graph_%s",hnameEXOE.c_str())]->Write(); + } + File->cd("Exogam"); } - File->cd("Exogam"); - } } } /////////////////////////////////////////////////////////////////////////// @@ -1117,14 +1182,14 @@ namespace EXOGAM_LOCAL { name += NPL::itoa(m_EventData->GetExoCrystal(i)); return CalibrationManager::getInstance()->ApplyCalibration(name, m_EventData->GetExoE(i),1); } - + double fEXO_EHG(const TExogamData* m_EventData, const unsigned int& i) { static string name; name = "EXO/EHG"; name += NPL::itoa(m_EventData->GetExoCrystal(i)); return CalibrationManager::getInstance()->ApplyCalibration(name, m_EventData->GetExoEHG(i),1); } - + double fEXO_T(const TExogamData* m_EventData, const unsigned int& i) { static string name; name = "EXOGAM/Cr_"; @@ -1132,7 +1197,7 @@ namespace EXOGAM_LOCAL { name += "_TDC"; return CalibrationManager::getInstance()->ApplyCalibration(name, m_EventData->GetExoTDC(i),1); } - + double fEXO_Outer(const TExogamData* m_EventData, const unsigned int& i, const unsigned int OuterNumber) { static string name; name = "EXO/Outer"; @@ -1152,7 +1217,7 @@ namespace EXOGAM_LOCAL { return 0; }; } - + string itoa(int value) { std::ostringstream o; @@ -1175,14 +1240,14 @@ NPL::VTreeReader* TExogamPhysics::ConstructReader() { return (NPL::VTreeReader*) // Registering the construct method to the factory // //////////////////////////////////////////////////////////////////////////////// extern "C" { -class proxy_exogam { - public: - proxy_exogam() { - NPL::DetectorFactory::getInstance()->AddToken("Exogam", "Exogam"); - NPL::DetectorFactory::getInstance()->AddDetector("Exogam", TExogamPhysics::Construct); - NPL::DetectorFactory::getInstance()->AddDetectorReader("Exogam", TExogamPhysics::ConstructReader); - } -}; + class proxy_exogam { + public: + proxy_exogam() { + NPL::DetectorFactory::getInstance()->AddToken("Exogam", "Exogam"); + NPL::DetectorFactory::getInstance()->AddDetector("Exogam", TExogamPhysics::Construct); + NPL::DetectorFactory::getInstance()->AddDetectorReader("Exogam", TExogamPhysics::ConstructReader); + } + }; -proxy_exogam p; + proxy_exogam p; } diff --git a/NPLib/Detectors/Exogam/TExogamPhysics.h b/NPLib/Detectors/Exogam/TExogamPhysics.h index 15d9c550fd32046d97f1b955327e820121c168ae..d8103be07a8617fbebb161b425289dd52c149fe8 100644 --- a/NPLib/Detectors/Exogam/TExogamPhysics.h +++ b/NPLib/Detectors/Exogam/TExogamPhysics.h @@ -71,7 +71,7 @@ class TExogamPhysics : public TObject, public NPL::VDetector, public TExogamPhys std::vector<double> Outer4; std::vector<unsigned int> Flange; std::vector<unsigned int> Crystal; - std::vector<unsigned int> TDC; + std::vector<double> TDC; std::vector<unsigned long long> TS; // Previous treatment + Add_Back (size of vectors are not the same because of AB !) @@ -84,7 +84,7 @@ class TExogamPhysics : public TObject, public NPL::VDetector, public TExogamPhys // Crystal with highest E std::vector<unsigned int> Crystal_AB; // TDC AddBack - std::vector<unsigned int> TDC_AB; + std::vector<double> TDC_AB; // TS AddBack std::vector<unsigned long long> TS_AB; // Outer with highest E @@ -138,6 +138,9 @@ class TExogamPhysics : public TObject, public NPL::VDetector, public TExogamPhys double DopplerCorrection(double Energy, double Theta); //! + /// Routine for doppler correction + double CorrectionDoppler(double theta_gamma, double phi_gamma, double theta_part, double phi_part, double beta_part, double E); //! + bool TDCMatch(unsigned int event); //! // Those two method all to clear the Event Physics or Data @@ -244,8 +247,9 @@ class TExogamPhysics : public TObject, public NPL::VDetector, public TExogamPhys double m_EXO_E_Threshold;//! double m_EXO_EHG_RAW_Threshold;//! double m_EXO_TDC_RAW_Threshold;//! - int m_ExoTDC_LowThreshold;//! - int m_ExoTDC_HighThreshold;//! + double m_ExoTDC_LowThreshold;//! + double m_ExoTDC_HighThreshold;//! + int m_NumberOfClovers;//! double EXO_E;//! double EXO_EHG;//! double EXO_TDC;//! @@ -256,7 +260,9 @@ class TExogamPhysics : public TObject, public NPL::VDetector, public TExogamPhys unsigned int flange_nbr;//! unsigned int crystal_nbr;//! double Beta = 0.257;//! - + vector<TVector3> m_pos_segment[4][4];//! + vector<int> m_flange;//! + map<unsigned int, int> MapFlangeToCloverNumber;//! Clover_struc Exogam_struc;//! std::map<unsigned int,std::pair<unsigned int,unsigned int>> MapCrystalFlangeCLover;//! Map key is raw crystal nbr, pair associated is flange nbr and crystal nbr in the flange