From d1be32337c20fb39f5018b88796aa01ba9b1ee47 Mon Sep 17 00:00:00 2001 From: Nicolas de Sereville <deserevi@ipno.in2p3.fr> Date: Thu, 5 Dec 2013 16:30:36 +0100 Subject: [PATCH] + Add support for histo for CATS (TCATSSpectra) + Fix bugs in size of a few histos from Hyball --- NPLib/CATS/Makefile | 3 ++- NPLib/CATS/TCATSPhysics.cxx | 34 +++++++++++++++++++++--- NPLib/CATS/TCATSPhysics.h | 29 +++++++++++++++++---- NPLib/Tiara/TTiaraHyballSpectra.cxx | 40 ++++++++++++++--------------- 4 files changed, 76 insertions(+), 30 deletions(-) diff --git a/NPLib/CATS/Makefile b/NPLib/CATS/Makefile index 7ed4129a7..7dc7ccc1e 100644 --- a/NPLib/CATS/Makefile +++ b/NPLib/CATS/Makefile @@ -8,7 +8,7 @@ all: $(SHARELIB) ############### Detector ############## ## CATS ## -libCATS.so: TCATSData.o TCATSDataDict.o TCATSPhysics.o TCATSPhysicsDict.o +libCATS.so: TCATSData.o TCATSDataDict.o TCATSPhysics.o TCATSPhysicsDict.o TCATSSpectra.o $(LD) $(SOFLAGS) $^ $(OutPutOpt) $@ TCATSDataDict.cxx: TCATSData.h @@ -22,6 +22,7 @@ TCATSData.o: TCATSData.cxx TCATSData.h TCATSDataDict.o: TCATSData.cxx TCATSData.h TCATSPhysicsDict.o: TCATSPhysics.cxx TCATSPhysics.h TCATSPhysics.o: TCATSPhysics.cxx TCATSPhysics.h +TCATSSpectra.o: TCATSSpectra.cxx TCATSSpectra.h ####################################### ############# Clean and More ########## diff --git a/NPLib/CATS/TCATSPhysics.cxx b/NPLib/CATS/TCATSPhysics.cxx index 834b50732..1b3cd1014 100644 --- a/NPLib/CATS/TCATSPhysics.cxx +++ b/NPLib/CATS/TCATSPhysics.cxx @@ -43,9 +43,10 @@ ClassImp(TCATSPhysics) TCATSPhysics::TCATSPhysics() { m_EventData = new TCATSData ; - m_PreTreatedData = new TCATSData ; + m_PreTreatedData = new TCATSData ; m_EventPhysics = this ; - m_NumberOfCATS = 0 ; + m_Spectra = 0; + m_NumberOfCATS = 0 ; } /////////////////////////////////////////////////////////////////////////// @@ -776,12 +777,37 @@ void TCATSPhysics::ReadAnalysisConfig() } } + +/////////////////////////////////////////////////////////////////////////// +void TCATSPhysics::InitSpectra(){ + m_Spectra = new TCATSSpectra(m_NumberOfCATS); +} + +/////////////////////////////////////////////////////////////////////////// +void TCATSPhysics::FillSpectra(){ + m_Spectra -> FillRawSpectra(m_EventData); + m_Spectra -> FillPreTreatedSpectra(m_PreTreatedData); + m_Spectra -> FillPhysicsSpectra(m_EventPhysics); +} +/////////////////////////////////////////////////////////////////////////// +void TCATSPhysics::CheckSpectra(){ + // To be done +} +/////////////////////////////////////////////////////////////////////////// +void TCATSPhysics::ClearSpectra(){ + // To be done +} +/////////////////////////////////////////////////////////////////////////// +map< vector<TString> , TH1*> TCATSPhysics::GetSpectra() { + return m_Spectra->GetMapHisto(); +} + ///////////////////////////////////////////////////////////////////// // Add Parameter to the CalibrationManger void TCATSPhysics::AddParameterToCalibrationManager() { - CalibrationManager* Cal = CalibrationManager::getInstance(); - for(int i = 0 ; i < m_NumberOfCATS ; i++) + CalibrationManager* Cal = CalibrationManager::getInstance(); + for(int i = 0 ; i < m_NumberOfCATS ; i++) { for( int j = 0 ; j < 28 ; j++) diff --git a/NPLib/CATS/TCATSPhysics.h b/NPLib/CATS/TCATSPhysics.h index 9d135fce2..69d485687 100644 --- a/NPLib/CATS/TCATSPhysics.h +++ b/NPLib/CATS/TCATSPhysics.h @@ -31,6 +31,7 @@ #include <TRandom3.h> // NPLib #include "TCATSData.h" +#include "TCATSSpectra.h" #include "../include/VDetector.h" #include "../include/CalibrationManager.h" #include "../include/DetectorManager.h" @@ -38,6 +39,8 @@ #define NBDETECTOR 2 #define NBSTRIPS 28 +// forward declaration +class TCATSSpectra; using namespace std ; enum reconstruction{NO,SECHS,GAUSS,BAR3,BAR4,BAR5}; @@ -51,10 +54,9 @@ class TCATSPhysics : public TObject, public NPA::VDetector ~TCATSPhysics(); private: // Root Input and Output tree classes - - TCATSData* m_EventData;//! - TCATSData* m_PreTreatedData;//! - TCATSPhysics* m_EventPhysics;//! + TCATSData* m_EventData;//! + TCATSData* m_PreTreatedData;//! + TCATSPhysics* m_EventPhysics;//! public : // marker of the cats used @@ -170,6 +172,16 @@ class TCATSPhysics : public TObject, public NPA::VDetector void ClearEventPhysics() {Clear();} void ClearEventData() {m_EventData->Clear();} + // Method related to the TSpectra classes, aimed at providing a framework for online applications + // Instantiate the Spectra class and the histogramm throught it + void InitSpectra(); + // Fill the spectra hold by the spectra class + void FillSpectra(); + // Used for Online mainly, perform check on the histo and for example change their color if issues are found + void CheckSpectra(); + // Used for Online only, clear all the spectra hold by the Spectra class + void ClearSpectra(); + void Clear(); void Clear(const Option_t*) {}; @@ -231,7 +243,14 @@ class TCATSPhysics : public TObject, public NPA::VDetector double GetPositionOnTargetX() {return PositionOnTargetX;} double GetPositionOnTargetY() {return PositionOnTargetY;} - ClassDef(TCATSPhysics,1) // CATSPhysics structure + private: // Spectra Class + TCATSSpectra* m_Spectra;//! + + public: // Spectra Getter + map< vector<TString> , TH1*> GetSpectra(); + + + ClassDef(TCATSPhysics,1) // CATSPhysics structure }; diff --git a/NPLib/Tiara/TTiaraHyballSpectra.cxx b/NPLib/Tiara/TTiaraHyballSpectra.cxx index 8150b36e4..5f623c229 100644 --- a/NPLib/Tiara/TTiaraHyballSpectra.cxx +++ b/NPLib/Tiara/TTiaraHyballSpectra.cxx @@ -71,19 +71,19 @@ void TTiaraHyballSpectra::InitRawSpectra() // HIT_RING_RAW name = "HYB_HIT_RING_RAW"; - AddHisto1D(name, name, fWedgesNumber*fRingsNumber, 0, fWedgesNumber*fRingsNumber, "TIARA/HYBALL/RAW/HIT"); + AddHisto1D(name, name, fWedgesNumber*fRingsNumber, 1, fWedgesNumber*fRingsNumber+1, "TIARA/HYBALL/RAW/HIT"); // HIT_SECTOR_RAW name = "HYB_HIT_SECT_RAW"; - AddHisto1D(name, name, fWedgesNumber*fRingsNumber, 0, fWedgesNumber*fSectorsNumber, "TIARA/HYBALL/RAW/HIT"); + AddHisto1D(name, name, fWedgesNumber*fSectorsNumber, 1, fWedgesNumber*fSectorsNumber+1, "TIARA/HYBALL/RAW/HIT"); // RING_E_RAW name = "HYB_RING_E_RAW"; - AddHisto2D(name, name, fWedgesNumber*fRingsNumber, 0, fWedgesNumber*fRingsNumber, 512, 0, 8192, "TIARA/HYBALL/RAW/ENERGY"); + AddHisto2D(name, name, fWedgesNumber*fRingsNumber, 1, fWedgesNumber*fRingsNumber+1, 512, 0, 16384, "TIARA/HYBALL/RAW/ENERGY"); // SECTOR_E_RAW name = "HYB_SECT_E_RAW"; - AddHisto2D(name, name, fWedgesNumber*fSectorsNumber, 0, fWedgesNumber*fSectorsNumber, 512, 0, 8192, "TIARA/HYBALL/RAW/ENERGY"); + AddHisto2D(name, name, fWedgesNumber*fSectorsNumber, 1, fWedgesNumber*fSectorsNumber+1, 512, 0, 16384, "TIARA/HYBALL/RAW/ENERGY"); // MULT for (unsigned int i = 0; i < fWedgesNumber; ++i) { // loop on number of wedges @@ -106,19 +106,19 @@ void TTiaraHyballSpectra::InitPreTreatedSpectra() // HIT_RING_CAL name = "HYB_HIT_RING_CAL"; - AddHisto1D(name, name, fWedgesNumber*fRingsNumber, 0, fWedgesNumber*fRingsNumber, "TIARA/HYBALL/CAL/HIT"); + AddHisto1D(name, name, fWedgesNumber*fRingsNumber, 1, fWedgesNumber*fRingsNumber+1, "TIARA/HYBALL/CAL/HIT"); // HIT_SECTOR_CAL name = "HYB_HIT_SECT_CAL"; - AddHisto1D(name, name, fWedgesNumber*fRingsNumber, 0, fWedgesNumber*fSectorsNumber, "TIARA/HYBALL/CAL/HIT"); + AddHisto1D(name, name, fWedgesNumber*fSectorsNumber, 1, fWedgesNumber*fSectorsNumber+1, "TIARA/HYBALL/CAL/HIT"); // RING_E_CAL name = "HYB_RING_E_CAL"; - AddHisto2D(name, name, fWedgesNumber*fRingsNumber, 0, fWedgesNumber*fRingsNumber, 500, 0, 50, "TIARA/HYBALL/CAL/ENERGY"); + AddHisto2D(name, name, fWedgesNumber*fRingsNumber, 1, fWedgesNumber*fRingsNumber+1, 500, 0, 50, "TIARA/HYBALL/CAL/ENERGY"); // SECTOR_E_CAL name = "HYB_SECT_E_CAL"; - AddHisto2D(name, name, fWedgesNumber*fSectorsNumber, 0, fWedgesNumber*fSectorsNumber, 500, 0, 50, "TIARA/HYBALL/CAL/ENERGY"); + AddHisto2D(name, name, fWedgesNumber*fSectorsNumber, 1, fWedgesNumber*fSectorsNumber+1, 500, 0, 50, "TIARA/HYBALL/CAL/ENERGY"); // MULT for (unsigned int i = 0; i < fWedgesNumber; ++i) { // loop on number of wedges @@ -163,7 +163,7 @@ void TTiaraHyballSpectra::FillRawSpectra(TTiaraHyballData* RawData) family = "TIARA/HYBALL/RAW/HIT"; name = "HYB_HIT_RING_RAW"; for (unsigned int i = 0; i < RawData->GetRingEMult(); i++) { - unsigned short channel = RawData->GetRingEDetectorNbr(i) * fRingsNumber + RawData->GetRingEStripNbr(i); + unsigned short channel = (RawData->GetRingEDetectorNbr(i)-1) * fRingsNumber + RawData->GetRingEStripNbr(i); GetHisto(family, name) -> Fill(channel); } @@ -171,7 +171,7 @@ void TTiaraHyballSpectra::FillRawSpectra(TTiaraHyballData* RawData) family = "TIARA/HYBALL/RAW/HIT"; name = "HYB_HIT_SECT_RAW"; for (unsigned int i = 0; i < RawData->GetSectorEMult(); i++) { - unsigned short channel = RawData->GetSectorEDetectorNbr(i) * fSectorsNumber + RawData->GetSectorEStripNbr(i); + unsigned short channel = (RawData->GetSectorEDetectorNbr(i)-1) * fSectorsNumber + RawData->GetSectorEStripNbr(i); GetHisto(family, name) -> Fill(channel); } @@ -179,7 +179,7 @@ void TTiaraHyballSpectra::FillRawSpectra(TTiaraHyballData* RawData) family = "TIARA/HYBALL/RAW/ENERGY"; name = "HYB_RING_E_RAW"; for (unsigned int i = 0; i < RawData->GetRingEMult(); i++) { - unsigned short channel = RawData->GetRingEDetectorNbr(i) * fRingsNumber + RawData->GetRingEStripNbr(i); + unsigned short channel = (RawData->GetRingEDetectorNbr(i)-1) * fRingsNumber + RawData->GetRingEStripNbr(i); GetHisto(family, name) -> Fill(channel, RawData->GetRingEEnergy(i)); } @@ -187,14 +187,14 @@ void TTiaraHyballSpectra::FillRawSpectra(TTiaraHyballData* RawData) family = "TIARA/HYBALL/RAW/ENERGY"; name = "HYB_SECT_E_RAW"; for (unsigned int i = 0; i < RawData->GetRingEMult(); i++) { - unsigned short channel = RawData->GetRingEDetectorNbr(i) * fSectorsNumber + RawData->GetSectorEStripNbr(i); + unsigned short channel = (RawData->GetRingEDetectorNbr(i)-1) * fSectorsNumber + RawData->GetSectorEStripNbr(i); GetHisto(family, name) -> Fill(channel, RawData->GetRingEEnergy(i)); } // RING_RAW_MULT int myMULT[fWedgesNumber]; for (unsigned int i = 0; i < fWedgesNumber; i++) myMULT[i] = 0; - for (unsigned int i = 0; i < RawData->GetRingEMult(); i++) myMULT[RawData->GetRingEDetectorNbr(i)] += 1; + for (unsigned int i = 0; i < RawData->GetRingEMult(); i++) myMULT[(RawData->GetRingEDetectorNbr(i)-1)] += 1; for (unsigned int i = 0; i < fWedgesNumber; i++) { name = Form("HYB_W%d_RING_E_RAW_MULT", i); @@ -204,7 +204,7 @@ void TTiaraHyballSpectra::FillRawSpectra(TTiaraHyballData* RawData) // RING_RAW_MULT for (unsigned int i = 0; i < fWedgesNumber; i++) myMULT[i] = 0; - for (unsigned int i = 0; i < RawData->GetSectorEMult(); i++) myMULT[RawData->GetSectorEDetectorNbr(i)] += 1; + for (unsigned int i = 0; i < RawData->GetSectorEMult(); i++) myMULT[(RawData->GetSectorEDetectorNbr(i)-1)] += 1; for (unsigned int i = 0; i < fWedgesNumber; i++) { name = Form("HYB_W%d_SECT_E_RAW_MULT", i); @@ -225,7 +225,7 @@ void TTiaraHyballSpectra::FillPreTreatedSpectra(TTiaraHyballData* PreTreatedData family = "TIARA/HYBALL/CAL/HIT"; name = "HYB_HIT_RING_CAL"; for (unsigned int i = 0; i < PreTreatedData->GetRingEMult(); i++) { - unsigned short channel = PreTreatedData->GetRingEDetectorNbr(i) * fRingsNumber + PreTreatedData->GetRingEStripNbr(i); + unsigned short channel = (PreTreatedData->GetRingEDetectorNbr(i)-1) * fRingsNumber + PreTreatedData->GetRingEStripNbr(i); GetHisto(family, name) -> Fill(channel); } @@ -233,7 +233,7 @@ void TTiaraHyballSpectra::FillPreTreatedSpectra(TTiaraHyballData* PreTreatedData family = "TIARA/HYBALL/CAL/HIT"; name = "HYB_HIT_SECT_CAL"; for (unsigned int i = 0; i < PreTreatedData->GetSectorEMult(); i++) { - unsigned short channel = PreTreatedData->GetSectorEDetectorNbr(i) * fSectorsNumber + PreTreatedData->GetSectorEStripNbr(i); + unsigned short channel = (PreTreatedData->GetSectorEDetectorNbr(i)-1) * fSectorsNumber + PreTreatedData->GetSectorEStripNbr(i); GetHisto(family, name) -> Fill(channel); } @@ -241,7 +241,7 @@ void TTiaraHyballSpectra::FillPreTreatedSpectra(TTiaraHyballData* PreTreatedData family = "TIARA/HYBALL/CAL/ENERGY"; name = "HYB_RING_E_CAL"; for (unsigned int i = 0; i < PreTreatedData->GetRingEMult(); i++) { - unsigned short channel = PreTreatedData->GetRingEDetectorNbr(i) * fRingsNumber + PreTreatedData->GetRingEStripNbr(i); + unsigned short channel = (PreTreatedData->GetRingEDetectorNbr(i)-1) * fRingsNumber + PreTreatedData->GetRingEStripNbr(i); GetHisto(family, name) -> Fill(channel, PreTreatedData->GetRingEEnergy(i)); } @@ -249,14 +249,14 @@ void TTiaraHyballSpectra::FillPreTreatedSpectra(TTiaraHyballData* PreTreatedData family = "TIARA/HYBALL/CAL/ENERGY"; name = "HYB_SECT_E_CAL"; for (unsigned int i = 0; i < PreTreatedData->GetRingEMult(); i++) { - unsigned short channel = PreTreatedData->GetRingEDetectorNbr(i) * fSectorsNumber + PreTreatedData->GetSectorEStripNbr(i); + unsigned short channel = (PreTreatedData->GetRingEDetectorNbr(i)-1) * fSectorsNumber + PreTreatedData->GetSectorEStripNbr(i); GetHisto(family, name) -> Fill(channel, PreTreatedData->GetRingEEnergy(i)); } // RING_CAL_MULT int myMULT[fWedgesNumber]; for (unsigned int i = 0; i < fWedgesNumber; i++) myMULT[i] = 0; - for (unsigned int i = 0; i < PreTreatedData->GetRingEMult(); i++) myMULT[PreTreatedData->GetRingEDetectorNbr(i)] += 1; + for (unsigned int i = 0; i < PreTreatedData->GetRingEMult(); i++) myMULT[(PreTreatedData->GetRingEDetectorNbr(i)-1)] += 1; for (unsigned int i = 0; i < fWedgesNumber; i++) { name = Form("HYB_W%d_RING_E_CAL_MULT", i); @@ -266,7 +266,7 @@ void TTiaraHyballSpectra::FillPreTreatedSpectra(TTiaraHyballData* PreTreatedData // RING_CAL_MULT for (unsigned int i = 0; i < fWedgesNumber; i++) myMULT[i] = 0; - for (unsigned int i = 0; i < PreTreatedData->GetSectorEMult(); i++) myMULT[PreTreatedData->GetSectorEDetectorNbr(i)] += 1; + for (unsigned int i = 0; i < PreTreatedData->GetSectorEMult(); i++) myMULT[(PreTreatedData->GetSectorEDetectorNbr(i)-1)] += 1; for (unsigned int i = 0; i < fWedgesNumber; i++) { name = Form("HYB_W%d_SECT_E_CAL_MULT", i); -- GitLab