From 25c736748c5b0feb20550cb84947f14f3ec9ccd5 Mon Sep 17 00:00:00 2001 From: adrien-matta <a.matta@surrey.ac.uk> Date: Fri, 21 Feb 2014 19:39:13 +0000 Subject: [PATCH] * Adding support for DetectorManager in GRU * Solving issue in case the histo are not generated but the m_Spectra * member is requested --- NPLib/CATS/TCATSPhysics.cxx | 8 +- NPLib/CATS/TCATSSpectra.cxx | 2 +- NPLib/Charissa/TCharissaPhysics.cxx | 7 +- NPLib/Exogam/TExogamPhysics.cxx | 7 +- NPLib/MUST2/TMust2Physics.cxx | 7 +- NPLib/Tiara/TTiaraBarrelData.h | 2 +- NPLib/Tiara/TTiaraBarrelPhysics.cxx | 164 +++++++++++++++------------- NPLib/Tiara/TTiaraBarrelPhysics.h | 8 +- NPLib/Tiara/TTiaraBarrelSpectra.cxx | 65 +++++++---- NPLib/Tiara/TTiaraHyballPhysics.cxx | 29 +++-- NPLib/Tiara/TTiaraHyballPhysics.h | 4 +- NPLib/VDetector/DetectorManager.cxx | 12 ++ NPLib/VDetector/DetectorManager.h | 2 +- 13 files changed, 191 insertions(+), 126 deletions(-) diff --git a/NPLib/CATS/TCATSPhysics.cxx b/NPLib/CATS/TCATSPhysics.cxx index 7b803cc26..764040c35 100644 --- a/NPLib/CATS/TCATSPhysics.cxx +++ b/NPLib/CATS/TCATSPhysics.cxx @@ -691,7 +691,13 @@ void TCATSPhysics::ClearSpectra(){ } /////////////////////////////////////////////////////////////////////////// map< vector<string> , TH1*> TCATSPhysics::GetSpectra() { - return m_Spectra->GetMapHisto(); + if(m_Spectra) + return m_Spectra->GetMapHisto(); + + else{ + map< vector<string> , TH1*> empty; + return empty; + } } ///////////////////////////////////////////////////////////////////// diff --git a/NPLib/CATS/TCATSSpectra.cxx b/NPLib/CATS/TCATSSpectra.cxx index 8d95440b7..68879b7da 100644 --- a/NPLib/CATS/TCATSSpectra.cxx +++ b/NPLib/CATS/TCATSSpectra.cxx @@ -268,7 +268,7 @@ void TCATSSpectra::FillPhysicsSpectra(TCATSPhysics* Physics){ fEventLoopQSum[i]+=Physics->QsumX[i]/1000000.; name = "CATS"+CATS_LOCAL::itoa(i+1)+"_QMEAN_TIME"; - GetHisto(family,name) ->SetBinContent(fEventLoopIndex/fEventLoopStep,fEventLoopQSum[i]/fEventLoopStep); + GetHisto(family,name) ->SetBinContent(fEventLoopIndex/fEventLoopIndex,fEventLoopQSum[i]/fEventLoopIndex); } } diff --git a/NPLib/Charissa/TCharissaPhysics.cxx b/NPLib/Charissa/TCharissaPhysics.cxx index 485045d3f..46d3f3c14 100755 --- a/NPLib/Charissa/TCharissaPhysics.cxx +++ b/NPLib/Charissa/TCharissaPhysics.cxx @@ -974,7 +974,12 @@ void TCharissaPhysics::ClearSpectra(){ } /////////////////////////////////////////////////////////////////////////// map< vector<string> , TH1*> TCharissaPhysics::GetSpectra() { - return m_Spectra->GetMapHisto(); + if(m_Spectra) + return m_Spectra->GetMapHisto(); + else{ + map< vector<string> , TH1*> empty; + return empty; + } } /////////////////////////////////////////////////////////////////////////// void TCharissaPhysics::AddParameterToCalibrationManager() diff --git a/NPLib/Exogam/TExogamPhysics.cxx b/NPLib/Exogam/TExogamPhysics.cxx index ccfdf00f2..ad8cd36e7 100644 --- a/NPLib/Exogam/TExogamPhysics.cxx +++ b/NPLib/Exogam/TExogamPhysics.cxx @@ -552,7 +552,12 @@ void TExogamPhysics::ClearSpectra(){ } /////////////////////////////////////////////////////////////////////////// map< vector<string> , TH1*> TExogamPhysics::GetSpectra() { -return m_Spectra->GetMapHisto(); + if(m_Spectra) + return m_Spectra->GetMapHisto(); + else{ + map< vector<string> , TH1*> empty; + return empty; + } } void TExogamPhysics::AddClover(string AngleFile) diff --git a/NPLib/MUST2/TMust2Physics.cxx b/NPLib/MUST2/TMust2Physics.cxx index 074a9bfc9..9ff701a2b 100644 --- a/NPLib/MUST2/TMust2Physics.cxx +++ b/NPLib/MUST2/TMust2Physics.cxx @@ -1061,7 +1061,12 @@ void TMust2Physics::ClearSpectra(){ } /////////////////////////////////////////////////////////////////////////// map< vector<string> , TH1*> TMust2Physics::GetSpectra() { -return m_Spectra->GetMapHisto(); + if(m_Spectra) + return m_Spectra->GetMapHisto(); + else{ + map< vector<string> , TH1*> empty; + return empty; + } } /////////////////////////////////////////////////////////////////////////// void TMust2Physics::AddParameterToCalibrationManager() diff --git a/NPLib/Tiara/TTiaraBarrelData.h b/NPLib/Tiara/TTiaraBarrelData.h index f2e5e0b1b..3b4f06631 100644 --- a/NPLib/Tiara/TTiaraBarrelData.h +++ b/NPLib/Tiara/TTiaraBarrelData.h @@ -101,7 +101,7 @@ class TTiaraBarrelData : public TNamed { } // T - inline unsigned int GetFrontBackTMult(){ + inline unsigned int GetBackTMult(){ return fTiaraBarrel_BackT_DetectorNbr.size(); } diff --git a/NPLib/Tiara/TTiaraBarrelPhysics.cxx b/NPLib/Tiara/TTiaraBarrelPhysics.cxx index 7daece791..89efc950d 100644 --- a/NPLib/Tiara/TTiaraBarrelPhysics.cxx +++ b/NPLib/Tiara/TTiaraBarrelPhysics.cxx @@ -50,12 +50,12 @@ ClassImp(TTiaraBarrelPhysics) m_PreTreatedData = new TTiaraBarrelData ; m_EventPhysics = this ; m_NumberOfDetector = 0 ; - + m_Take_E_Strip= true; m_Take_T_Back=true; - m_Strip_E_Threshold=0.4 ; - m_Back_E_Threshold =0; - m_OuterStrip_E_RAW_Threshold =0; + m_Strip_E_Threshold = 400 ; + m_Back_E_Threshold = 400 ; + m_Maximum_FrontBack_Difference = 0.4; m_OuterBack_E_Threshold =0; } @@ -68,84 +68,79 @@ void TTiaraBarrelPhysics::BuildSimplePhysicalEvent(){ void TTiaraBarrelPhysics::BuildPhysicalEvent(){ PreTreat(); - - -} - -/////////////////////////////////////////////////////////////////////////// -void TTiaraBarrelPhysics::PreTreat(){ - ClearPreTreatedData(); - // Gain Calibration - // The cal function first call the MatchStick one - unsigned int sizeU = m_EventData-> GetFrontUpstreamEMult(); - unsigned int sizeD = m_EventData-> GetFrontDownstreamEMult(); - + unsigned int sizeU = m_PreTreatedData->GetFrontUpstreamEMult(); + unsigned int sizeD = m_PreTreatedData->GetFrontDownstreamEMult(); + unsigned int sizeB = m_EventData->GetBackEMult(); + + for(unsigned int k = 0 ; k < sizeB ; k++){ for(unsigned int i = 0 ; i < sizeU ; i++){ - double EU = Cal_Strip_Upstream_E(i) ; - m_PreTreatedData->SetFrontUpstreamE(m_EventData-> GetFrontUpstreamEDetectorNbr(i), - m_EventData-> GetFrontUpstreamEStripNbr(i), - EU); - + if(m_PreTreatedData->GetFrontUpstreamEDetectorNbr(i) == m_PreTreatedData->GetBackEDetectorNbr(k)) for(unsigned int j = 0 ; j < sizeD ; j++){ - double ED = Cal_Strip_Downstream_E(j) ; - m_PreTreatedData->SetFrontDownstreamE(m_EventData-> GetFrontDownstreamEDetectorNbr(i), - m_EventData-> GetFrontDownstreamEStripNbr(i), - ED); - if(EU>0 && ED>0 && EU+ED > m_Strip_E_Threshold){ - if( m_EventData->GetFrontUpstreamEDetectorNbr(i) - == m_EventData->GetFrontDownstreamEDetectorNbr(j) - && m_EventData->GetFrontUpstreamEStripNbr(i) - == m_EventData->GetFrontDownstreamEStripNbr(j)){ + // same detector, same strip + if( m_PreTreatedData->GetFrontUpstreamEDetectorNbr(i) + == m_PreTreatedData->GetFrontDownstreamEDetectorNbr(j) + && m_PreTreatedData->GetFrontUpstreamEStripNbr(i) + == m_PreTreatedData->GetFrontDownstreamEStripNbr(j)){ - - double POS = - CalibrationManager::getInstance()->ApplyResistivePositionCalibration("TIARABARREL/B"+itoa(m_EventData->GetFrontUpstreamEDetectorNbr(i))+"_STRIP"+itoa(m_EventData->GetFrontUpstreamEStripNbr(i))+"_POS",(ED-EU)/(EU+ED)); - Strip_Pos.push_back(POS); - Strip_N.push_back(m_EventData->GetFrontUpstreamEStripNbr(i)); - DetectorNumber.push_back(m_EventData->GetFrontUpstreamEDetectorNbr(i)); - double E =(EU+ED) / CalibrationManager::getInstance() - ->ApplyCalibration("TIARABARREL/BALLISTIC_B" - + itoa(m_EventData->GetFrontDownstreamEDetectorNbr(i)) - + "_STRIP" - + itoa(m_EventData->GetFrontDownstreamEStripNbr(i)), - POS); - - - DetectorNumber.push_back(m_EventData->GetFrontDownstreamEDetectorNbr(i)); - Strip_N.push_back(m_EventData->GetFrontDownstreamEStripNbr(i)); - Strip_Pos.push_back(POS); - Strip_E.push_back(E); + double EU = m_PreTreatedData->GetFrontUpstreamEEnergy(i) ; + double ED = m_PreTreatedData->GetFrontDownstreamEEnergy(j); + + // Front back Energy match + if(abs(m_PreTreatedData->GetBackEEnergy(k)-(EU+ED)) < m_Maximum_FrontBack_Difference){ + double POS = + CalibrationManager::getInstance() + ->ApplyResistivePositionCalibration("TIARABARREL/B" + +itoa(m_EventData->GetFrontUpstreamEDetectorNbr(i)) + +"_STRIP"+itoa(m_EventData->GetFrontUpstreamEStripNbr(i)) + +"_POS",(ED-EU)/(EU+ED)); + + Strip_Pos.push_back(POS); + Strip_N.push_back(m_EventData->GetFrontUpstreamEStripNbr(i)); + DetectorNumber.push_back(m_EventData->GetFrontUpstreamEDetectorNbr(i)); + double E = (EU+ED) / CalibrationManager::getInstance() + ->ApplyCalibration("TIARABARREL/BALLISTIC_B" + + itoa(m_EventData->GetFrontDownstreamEDetectorNbr(i)) + + "_STRIP" + + itoa(m_EventData->GetFrontDownstreamEStripNbr(i)), + POS); + Strip_E.push_back(E); + } } } } } - - // Ballistic Deficit correction } /////////////////////////////////////////////////////////////////////////// -vector < TVector2 > TTiaraBarrelPhysics :: Match_Upstream_Downstream(){ - vector < TVector2 > ArrayOfGoodCouple ; - /* - // Prevent code from treating very high multiplicity Event - // Those event are not physical anyway and that improve speed. - if( m_PreTreatedData->GetRingEMult() > m_MaximumStripMultiplicityAllowed || m_PreTreatedData->GetSectorEMult() > m_MaximumStripMultiplicityAllowed ) - return ArrayOfGoodCouple; - - for(unsigned int i = 0 ; i < m_PreTreatedData->GetRingEMult(); i++) { - for(unsigned int j = 0 ; j < m_PreTreatedData->GetSectorEMult(); j++){ - // if same detector check energy - if ( m_PreTreatedData->GetRingEDetectorNbr(i) == m_PreTreatedData->GetSectorEDetectorNbr(j) ){ - // Look if energy match - if( abs( (m_PreTreatedData->GetRingEEnergy(i)-m_PreTreatedData->GetSectorEEnergy(j))/2. ) < m_StripEnergyMatchingNumberOfSigma*m_StripEnergyMatchingSigma ) - ArrayOfGoodCouple . push_back ( TVector2(i,j) ) ; - } +void TTiaraBarrelPhysics::PreTreat(){ + ClearPreTreatedData(); + // Gain Calibration + // The cal function first call the MatchStick one + unsigned int sizeU = m_EventData->GetFrontUpstreamEMult(); + unsigned int sizeD = m_EventData->GetFrontDownstreamEMult(); + unsigned int sizeB = m_EventData->GetBackEMult(); + + for(unsigned int i = 0 ; i < sizeU ; i++){ + double EU = Cal_Strip_Upstream_E(i) ; + if(EU > m_Strip_E_Threshold) + m_PreTreatedData->SetFrontUpstreamE(m_EventData->GetFrontUpstreamEDetectorNbr(i), + m_EventData->GetFrontUpstreamEStripNbr(i), + EU); } + + for(unsigned int j = 0 ; j < sizeD ; j++){ + double ED = Cal_Strip_Downstream_E(j) ; + if(ED>m_Strip_E_Threshold) + m_PreTreatedData->SetFrontDownstreamE(m_EventData->GetFrontDownstreamEDetectorNbr(j), + m_EventData->GetFrontDownstreamEStripNbr(j), + ED); } - */ - // Prevent to treat event with ambiguous matchin beetween X and Y - // if( ArrayOfGoodCouple.size() > m_PreTreatedData->GetRingEMult() ) ArrayOfGoodCouple.clear() ; - return ArrayOfGoodCouple; + + for(unsigned int k = 0 ; k < sizeB ; k++){ + double EB = Cal_Back_E(k) ; + if(EB > m_Back_E_Threshold) + m_PreTreatedData->SetBackE(m_EventData->GetBackEDetectorNbr(k),EB); + } } //////////////////////////////////////////////////////////////////////////// @@ -439,7 +434,13 @@ void TTiaraBarrelPhysics::ClearSpectra(){ } /////////////////////////////////////////////////////////////////////////// map< vector<string>,TH1* > TTiaraBarrelPhysics::GetSpectra() { - return m_Spectra->GetMapHisto(); + if(m_Spectra) + return m_Spectra->GetMapHisto(); + else{ + map< vector<string>,TH1* > empty; + return empty; + } + } /////////////////////////////////////////////////////////////////////////// void TTiaraBarrelPhysics::AddParameterToCalibrationManager(){ @@ -455,7 +456,11 @@ void TTiaraBarrelPhysics::AddParameterToCalibrationManager(){ Cal->AddParameter("TIARABARREL","BALLISTIC_B"+itoa(i+1)+"_STRIP"+itoa(j+1),"TIARABARREL_BALLISTIC_B"+itoa(i+1)+"_STRIP"+itoa(j+1)) ; Cal->AddParameter("TIARABARREL","B"+itoa(i+1)+"_STRIP"+itoa(j+1)+"_POS","TIARABARREL_B"+itoa(i+1)+"_STRIP"+itoa(j+1)+"_POS") ; + } + + Cal->AddParameter("TIARABARREL","TIARABARREL/B" + itoa( i+1 ) + "_BACK_E","TIARABARREL_B" + itoa( i+1 ) + "_BACK_E"); + } return; @@ -552,7 +557,7 @@ TVector3 TTiaraBarrelPhysics::GetDetectorNormal( const int i) const{ } /////////////////////////////////////////////////////////////////////////////// TVector3 TTiaraBarrelPhysics::GetPositionOfInteraction(const int i) const{ - // All in mm + // All in mm double INNERBARREL_PCB_Width = 27.76; double INNERBARREL_ActiveWafer_Length = 94.80; double INNERBARREL_ActiveWafer_Width = 24.0; @@ -592,11 +597,11 @@ void TTiaraBarrelPhysics::InitializeStandardParameter(){ /////////////////////////////////////////////////////////////////////////////// // transform an integer to a string namespace TiaraBarrel_LOCAL{ -string itoa(unsigned int value){ - char buffer [33]; - sprintf(buffer,"%d",value); - return buffer; -} + string itoa(unsigned int value){ + char buffer [33]; + sprintf(buffer,"%d",value); + return buffer; + } } /////////////////////////////////////////////////////////////////////////////// double TTiaraBarrelPhysics::Cal_Strip_Upstream_E(const int i){ @@ -618,3 +623,8 @@ double TTiaraBarrelPhysics::Match_Strip_Downstream_E(const int i){ return CalibrationManager::getInstance()->ApplyCalibration("TIARABARREL/MATCHSTICK_B" + itoa( m_EventData->GetFrontDownstreamEDetectorNbr(i) ) + "_DOWNSTREAM" + itoa( m_EventData->GetFrontDownstreamEStripNbr(i) ) + "_E", m_EventData->GetFrontDownstreamEEnergy(i) ); } +/////////////////////////////////////////////////////////////////////////////// +double TTiaraBarrelPhysics::Cal_Back_E(const int i){ + return CalibrationManager::getInstance()->ApplyCalibration("TIARABARREL/B" + itoa( m_EventData->GetBackEDetectorNbr(i) ) + "_BACK_E", m_EventData->GetBackEEnergy(i)); +} + diff --git a/NPLib/Tiara/TTiaraBarrelPhysics.h b/NPLib/Tiara/TTiaraBarrelPhysics.h index 5b92281a0..192890320 100644 --- a/NPLib/Tiara/TTiaraBarrelPhysics.h +++ b/NPLib/Tiara/TTiaraBarrelPhysics.h @@ -50,9 +50,6 @@ class TTiaraBarrelPhysics : public TObject, public NPA::VDetector{ void Clear(); void Clear(const Option_t*) {}; - public: - vector < TVector2 > Match_Upstream_Downstream() ; - public: // Provide Physical Multiplicity Int_t EventMultiplicity; @@ -167,12 +164,10 @@ class TTiaraBarrelPhysics : public TObject, public NPA::VDetector{ bool m_Take_T_Back;//! // Threshold - double m_Strip_E_RAW_Threshold ;//! double m_Strip_E_Threshold ;//! double m_Back_E_Threshold ;//! - double m_OuterStrip_E_RAW_Threshold ;//! double m_OuterBack_E_Threshold ;//! - + double m_Maximum_FrontBack_Difference ;//! private: // Root Input and Output tree classes TTiaraBarrelData* m_EventData;//! TTiaraBarrelData* m_PreTreatedData;//! @@ -201,6 +196,7 @@ class TTiaraBarrelPhysics : public TObject, public NPA::VDetector{ // Calibrate data double Cal_Strip_Upstream_E(const int i); double Cal_Strip_Downstream_E(const int i); + double Cal_Back_E(const int i); double Match_Strip_Upstream_E(const int i); double Match_Strip_Downstream_E(const int i); diff --git a/NPLib/Tiara/TTiaraBarrelSpectra.cxx b/NPLib/Tiara/TTiaraBarrelSpectra.cxx index 68f668e96..becfe19a0 100644 --- a/NPLib/Tiara/TTiaraBarrelSpectra.cxx +++ b/NPLib/Tiara/TTiaraBarrelSpectra.cxx @@ -114,7 +114,7 @@ void TTiaraBarrelSpectra::InitRawSpectra(){ for(unsigned int i = 0 ; i < fNumberOfDetector ; i++){ for(unsigned int j = 0 ; j < fInnerBarrelStrip;j++){ name = "IB"+TiaraBarrel_LOCAL::itoa(i+1)+"_VS"+TiaraBarrel_LOCAL::itoa(j+1)+"_RAW"; - AddHisto2D(name, name,1024,0,16384,1024,0,16384,BaseFamily+"VS"); + AddHisto2D(name, name,1024,0,0,1024,0,0,BaseFamily+"VS"); } } } @@ -128,8 +128,10 @@ void TTiaraBarrelSpectra::InitPreTreatedSpectra(){ for(unsigned int i = 0 ; i < fNumberOfDetector ; i++){ for(unsigned int j = 0 ; j < fInnerBarrelStrip;j++){ name = "IB"+TiaraBarrel_LOCAL::itoa(i+1)+"_VS"+TiaraBarrel_LOCAL::itoa(j+1)+"_CAL"; - AddHisto2D(name,name,2048,-1,30,2048,-1,30,BaseFamily+"VS"); + AddHisto2D(name,name,2048,0,0,2048,0,0,BaseFamily+"VS"); } + name = "IB"+TiaraBarrel_LOCAL::itoa(i+1)+"_VS_BACK_CAL"; + AddHisto2D(name,name,2048,0,0,2048,0,0,BaseFamily+"VS"); } } @@ -251,17 +253,32 @@ string BaseFamily = "TIARA/BARREL/CAL/"; // INNER_BARREL_VS_CAL string family = BaseFamily+"VS"; string name ; - for (unsigned int i = 0; i < PreTreatedData->GetFrontUpstreamEMult(); i++) { + + unsigned int sizeU = PreTreatedData->GetFrontUpstreamEMult(); + unsigned int sizeD = PreTreatedData->GetFrontDownstreamEMult(); + unsigned int sizeB = PreTreatedData->GetBackEMult(); + + for (unsigned int i = 0; i < sizeU ; i++) { int UpStreamDetNbr = PreTreatedData->GetFrontUpstreamEDetectorNbr(i); int UpStreamStrNbr = PreTreatedData->GetFrontUpstreamEStripNbr(i); - for (unsigned int j = 0; j < PreTreatedData->GetFrontDownstreamEMult(); j++) { + for (unsigned int j = 0; j < sizeD ; j++) { int DoStreamDetNbr = PreTreatedData->GetFrontDownstreamEDetectorNbr(j); int DoStreamStrNbr = PreTreatedData->GetFrontDownstreamEStripNbr(j); if(UpStreamDetNbr==DoStreamDetNbr && UpStreamStrNbr==DoStreamStrNbr){ - name = "IB"+TiaraBarrel_LOCAL::itoa(UpStreamDetNbr)+"_VS"+TiaraBarrel_LOCAL::itoa(UpStreamStrNbr)+"_CAL"; + name = "IB"+TiaraBarrel_LOCAL::itoa(UpStreamDetNbr)+"_VS"+TiaraBarrel_LOCAL::itoa(UpStreamStrNbr)+"_CAL"; GetHisto(family,name) - ->Fill(PreTreatedData->GetFrontUpstreamEEnergy(i),PreTreatedData->GetFrontDownstreamEEnergy(j)); + ->Fill(PreTreatedData->GetFrontUpstreamEEnergy(i),PreTreatedData->GetFrontDownstreamEEnergy(j)); + + for (unsigned int k = 0; k < sizeB; k++) { + if(UpStreamDetNbr == PreTreatedData->GetBackEDetectorNbr(k)){ + name = "IB"+TiaraBarrel_LOCAL::itoa(UpStreamDetNbr)+"_VS_BACK_CAL"; + GetHisto(family,name) + ->Fill(PreTreatedData->GetFrontUpstreamEEnergy(i) + +PreTreatedData->GetFrontDownstreamEEnergy(j), + PreTreatedData->GetBackEEnergy(k)); + } + } } } } @@ -269,26 +286,26 @@ string BaseFamily = "TIARA/BARREL/CAL/"; //////////////////////////////////////////////////////////////////////////////// void TTiaraBarrelSpectra::FillPhysicsSpectra(TTiaraBarrelPhysics* Physics){ -string family = "TIARA/BARREL/PHY"; -string name ; + string family = "TIARA/BARREL/PHY"; + string name ; //// E POS //// // Inner Barrel unsigned int size = Physics->Strip_E.size(); for(unsigned int i = 0 ; i < Physics->Strip_E.size() ; i++){ - name ="IB"+TiaraBarrel_LOCAL::itoa(Physics->DetectorNumber[i])+"_EPOS"+TiaraBarrel_LOCAL::itoa(Physics->Strip_N[i])+"_CAL"; - GetHisto(family,name) - ->Fill(Physics->Strip_Pos[i],Physics->Strip_E[i]); - - name = "IB"+TiaraBarrel_LOCAL::itoa(Physics->DetectorNumber[i])+"_ETHETA"+TiaraBarrel_LOCAL::itoa(Physics->Strip_N[i])+"_CAL"; - double Theta = Physics->GetPositionOfInteraction(i).Angle(TVector3(0,0,1)); + name ="IB"+TiaraBarrel_LOCAL::itoa(Physics->DetectorNumber[i])+"_EPOS"+TiaraBarrel_LOCAL::itoa(Physics->Strip_N[i])+"_CAL"; + GetHisto(family,name) + ->Fill(Physics->Strip_Pos[i],Physics->Strip_E[i]); - GetHisto(family,name) - ->Fill(Theta*rad/deg,Physics->Strip_E[i]); - - name = "IB_ETHETA_CAL"; - GetHisto(family,name) - ->Fill(Theta*rad/deg,Physics->Strip_E[i]); - } + name = "IB"+TiaraBarrel_LOCAL::itoa(Physics->DetectorNumber[i])+"_ETHETA"+TiaraBarrel_LOCAL::itoa(Physics->Strip_N[i])+"_CAL"; + double Theta = Physics->GetPositionOfInteraction(i).Angle(TVector3(0,0,1)); + + GetHisto(family,name) + ->Fill(Theta*rad/deg,Physics->Strip_E[i]); + + name = "IB_ETHETA_CAL"; + GetHisto(family,name) + ->Fill(Theta*rad/deg,Physics->Strip_E[i]); + } } //////////////////////////////////////////////////////////////////////////////// @@ -328,14 +345,14 @@ TH1* TTiaraBarrelSpectra::GetHisto(string& family, string& name){ index.push_back(family); index.push_back(name); TH1* histo ; - + try{ histo = fMapHisto.at(index); } catch(const std::out_of_range& oor){ - cout << "ERROR : the folowing Histo has been requested by TTiaraBarrelSpectra and does not exist: family:" << family << " name: " << name << endl ; - exit(1); + cout << "ERROR : the folowing Histo has been requested by TTiaraBarrelSpectra and does not exist: family:" << family << " name: " << name << endl ; + exit(1); } return histo; diff --git a/NPLib/Tiara/TTiaraHyballPhysics.cxx b/NPLib/Tiara/TTiaraHyballPhysics.cxx index 6edca91cf..fd790053b 100644 --- a/NPLib/Tiara/TTiaraHyballPhysics.cxx +++ b/NPLib/Tiara/TTiaraHyballPhysics.cxx @@ -53,15 +53,15 @@ ClassImp(TTiaraHyballPhysics) m_EventPhysics = this ; m_NumberOfDetector = 0 ; m_MaximumStripMultiplicityAllowed = 10; - m_StripEnergyMatchingSigma = 0.060 ; + m_StripEnergyMatchingSigma = 0.10 ; m_StripEnergyMatchingNumberOfSigma = 3; // Threshold m_StripRing_E_RAW_Threshold = 0 ; - m_StripRing_E_Threshold = 0.4 ; + m_StripRing_E_Threshold = 0.0 ; m_StripSector_E_RAW_Threshold = 0 ; - m_StripSector_E_Threshold = 0.4 ; + m_StripSector_E_Threshold = 0.0 ; m_Take_E_Ring=false; m_Take_T_Sector=true; @@ -204,9 +204,11 @@ vector < TVector2 > TTiaraHyballPhysics :: Match_Ring_Sector(){ // Those event are not physical anyway and that improve speed. if( m_PreTreatedData->GetRingEMult() > m_MaximumStripMultiplicityAllowed || m_PreTreatedData->GetSectorEMult() > m_MaximumStripMultiplicityAllowed ) return ArrayOfGoodCouple; - - for(unsigned int i = 0 ; i < m_PreTreatedData->GetRingEMult(); i++) { - for(unsigned int j = 0 ; j < m_PreTreatedData->GetSectorEMult(); j++){ + + unsigned int sizeR = m_PreTreatedData->GetRingEMult(); + unsigned int sizeS = m_PreTreatedData->GetSectorEMult(); + for(unsigned int i = 0 ; i < sizeR ; i++) { + for(unsigned int j = 0 ; j < sizeS ; j++){ // if same detector check energy if ( m_PreTreatedData->GetRingEDetectorNbr(i) == m_PreTreatedData->GetSectorEDetectorNbr(j) ){ // Look if energy match @@ -215,9 +217,10 @@ vector < TVector2 > TTiaraHyballPhysics :: Match_Ring_Sector(){ } } } - + // Prevent to treat event with ambiguous matchin beetween X and Y if( ArrayOfGoodCouple.size() > m_PreTreatedData->GetRingEMult() ) ArrayOfGoodCouple.clear() ; + return ArrayOfGoodCouple; } @@ -518,7 +521,13 @@ void TTiaraHyballPhysics::ClearSpectra(){ } /////////////////////////////////////////////////////////////////////////// map< vector<string>,TH1* > TTiaraHyballPhysics::GetSpectra() { -return m_Spectra->GetMapHisto(); + if(m_Spectra) + return m_Spectra->GetMapHisto(); + else{ + map< vector<string>,TH1* > empty; + return empty ; + } + } /////////////////////////////////////////////////////////////////////////// void TTiaraHyballPhysics::AddParameterToCalibrationManager(){ @@ -676,7 +685,7 @@ namespace TiaraHyball_LOCAL{ // Ring double fStrip_Ring_E(const TTiaraHyballData* m_EventData , const int i){ return CalibrationManager::getInstance()->ApplyCalibration( "TIARAHYBALL/D" + itoa( m_EventData->GetRingEDetectorNbr(i) ) + "_STRIP_RING" + itoa( m_EventData->GetRingEStripNbr(i) ) + "_E", - m_EventData->GetRingEEnergy(i) ); + fStrip_Ring_Matchstick(m_EventData,i) ); } double fStrip_Ring_Matchstick(const TTiaraHyballData* m_EventData , const int i){ return CalibrationManager::getInstance()->ApplyCalibration( "TIARAHYBALL/D" + itoa( m_EventData->GetRingEDetectorNbr(i) ) + "_STRIP_RING" + itoa( m_EventData->GetRingEStripNbr(i) ) + "_MATCHSTICK", @@ -691,7 +700,7 @@ namespace TiaraHyball_LOCAL{ // Sector double fStrip_Sector_E(const TTiaraHyballData* m_EventData , const int i){ return CalibrationManager::getInstance()->ApplyCalibration( "TIARAHYBALL/D" + itoa( m_EventData->GetSectorTDetectorNbr(i) ) + "_STRIP_SECTOR" + itoa( m_EventData->GetSectorTStripNbr(i) ) +"_E", - m_EventData->GetSectorEEnergy(i) ); + fStrip_Sector_Matchstick(m_EventData,i) ); } double fStrip_Sector_Matchstick(const TTiaraHyballData* m_EventData , const int i){ diff --git a/NPLib/Tiara/TTiaraHyballPhysics.h b/NPLib/Tiara/TTiaraHyballPhysics.h index cd9923a5b..384b53a95 100644 --- a/NPLib/Tiara/TTiaraHyballPhysics.h +++ b/NPLib/Tiara/TTiaraHyballPhysics.h @@ -175,7 +175,7 @@ class TTiaraHyballPhysics : public TObject, public NPA::VDetector{ double m_StripRing_E_Threshold ;//! double m_StripSector_E_RAW_Threshold ;//! double m_StripSector_E_Threshold ;//! - + double m_Maximum_FrontBack_Difference;//! private: // Root Input and Output tree classes TTiaraHyballData* m_EventData;//! TTiaraHyballData* m_PreTreatedData;//! @@ -211,7 +211,7 @@ namespace TiaraHyball_LOCAL{ // Sector double fStrip_Sector_E(const TTiaraHyballData* Data, const int i); - double fStrip_Sector_MatchStick(const TTiaraHyballData* Data, const int i); + double fStrip_Sector_Matchstick(const TTiaraHyballData* Data, const int i); double fStrip_Sector_T(const TTiaraHyballData* Data, const int i); } diff --git a/NPLib/VDetector/DetectorManager.cxx b/NPLib/VDetector/DetectorManager.cxx index 37328ba38..1b8870786 100644 --- a/NPLib/VDetector/DetectorManager.cxx +++ b/NPLib/VDetector/DetectorManager.cxx @@ -792,3 +792,15 @@ vector< map< vector<string>, TH1* > > DetectorManager::GetSpectra() return myVector; } + +///////////////////////////////////////////////////////////////////////////////////////////////// +vector<string> DetectorManager::GetDetectorList(){ + map<string,VDetector*>::iterator it; + vector<string> DetectorList; + for (it = m_Detector.begin(); it != m_Detector.end(); ++it) { + DetectorList.push_back(it->first); + } + + return DetectorList; +} + diff --git a/NPLib/VDetector/DetectorManager.h b/NPLib/VDetector/DetectorManager.h index 15599b169..aceafc83a 100644 --- a/NPLib/VDetector/DetectorManager.h +++ b/NPLib/VDetector/DetectorManager.h @@ -53,7 +53,7 @@ namespace NPA{ void ClearEventData(); void InitSpectra(); vector< map< vector<string>, TH1* > > GetSpectra(); - + vector<string> GetDetectorList(); private: // The map containning all detectors // Using a Map one can access to any detector using its name -- GitLab