diff --git a/NPLib/AnnularS1/TS1Data.h b/NPLib/AnnularS1/TS1Data.h index 934581f4f74de532b9e16f6a8dcf81926fbf6d93..4892cfe5a64c23921ffc3e3a39c478c33496d928 100644 --- a/NPLib/AnnularS1/TS1Data.h +++ b/NPLib/AnnularS1/TS1Data.h @@ -32,79 +32,77 @@ #include "TObject.h" - - class TS1Data : public TObject { private: // DSSD // Theta strips // ADC - vector<UShort_t> fS1_Theta_E_DetNbr; - vector<UShort_t> fS1_Theta_E_StripNbr; - vector<Double_t> fS1_Theta_E_Energy; + vector<UShort_t> fS1_Theta_E_DetNbr; + vector<UShort_t> fS1_Theta_E_StripNbr; + vector<Double_t> fS1_Theta_E_Energy; // TDC - vector<UShort_t> fS1_Theta_T_DetNbr; - vector<UShort_t> fS1_Theta_T_StripNbr; - vector<Double_t> fS1_Theta_T_Time; + vector<UShort_t> fS1_Theta_T_DetNbr; + vector<UShort_t> fS1_Theta_T_StripNbr; + vector<Double_t> fS1_Theta_T_Time; // Phi strips // ADC - vector<UShort_t> fS1_Phi_E_DetNbr; - vector<UShort_t> fS1_Phi_E_StripNbr; - vector<Double_t> fS1_Phi_E_Energy; + vector<UShort_t> fS1_Phi_E_DetNbr; + vector<UShort_t> fS1_Phi_E_StripNbr; + vector<Double_t> fS1_Phi_E_Energy; // TDC - vector<UShort_t> fS1_Phi_T_DetNbr; - vector<UShort_t> fS1_Phi_T_StripNbr; - vector<Double_t> fS1_Phi_T_Time; + vector<UShort_t> fS1_Phi_T_DetNbr; + vector<UShort_t> fS1_Phi_T_StripNbr; + vector<Double_t> fS1_Phi_T_Time; public: TS1Data(); virtual ~TS1Data(); - void Clear(); + void Clear(); void Clear(const Option_t*) {}; - void Dump() const; + void Dump() const; ///////////////////// GETTERS //////////////////////// // (Th,E) - UShort_t GetS1ThetaEMult() {return fS1_Theta_E_DetNbr.size();} - UShort_t GetS1ThetaEDetectorNbr(Int_t i) {return fS1_Theta_E_DetNbr.at(i);} - UShort_t GetS1ThetaEStripNbr(Int_t i) {return fS1_Theta_E_StripNbr.at(i);} - Double_t GetS1ThetaEEnergy(Int_t i) {return fS1_Theta_E_Energy.at(i);} + UShort_t GetS1ThetaEMult() {return fS1_Theta_E_DetNbr.size();} + UShort_t GetS1ThetaEDetectorNbr(Int_t i) {return fS1_Theta_E_DetNbr.at(i);} + UShort_t GetS1ThetaEStripNbr(Int_t i) {return fS1_Theta_E_StripNbr.at(i);} + Double_t GetS1ThetaEEnergy(Int_t i) {return fS1_Theta_E_Energy.at(i);} // (Th,T) - UShort_t GetS1ThetaTMult() {return fS1_Theta_T_DetNbr.size();} - UShort_t GetS1ThetaTDetectorNbr(Int_t i) {return fS1_Theta_T_DetNbr.at(i);} - UShort_t GetS1ThetaTStripNbr(Int_t i) {return fS1_Theta_T_StripNbr.at(i);} - Double_t GetS1ThetaTTime(Int_t i) {return fS1_Theta_T_Time.at(i);} + UShort_t GetS1ThetaTMult() {return fS1_Theta_T_DetNbr.size();} + UShort_t GetS1ThetaTDetectorNbr(Int_t i) {return fS1_Theta_T_DetNbr.at(i);} + UShort_t GetS1ThetaTStripNbr(Int_t i) {return fS1_Theta_T_StripNbr.at(i);} + Double_t GetS1ThetaTTime(Int_t i) {return fS1_Theta_T_Time.at(i);} // (Ph,E) - UShort_t GetS1PhiEMult() {return fS1_Phi_E_DetNbr.size();} - UShort_t GetS1PhiEDetectorNbr(Int_t i) {return fS1_Phi_E_DetNbr.at(i);} - UShort_t GetS1PhiEStripNbr(Int_t i) {return fS1_Phi_E_StripNbr.at(i);} - Double_t GetS1PhiEEnergy(Int_t i) {return fS1_Phi_E_Energy.at(i);} + UShort_t GetS1PhiEMult() {return fS1_Phi_E_DetNbr.size();} + UShort_t GetS1PhiEDetectorNbr(Int_t i) {return fS1_Phi_E_DetNbr.at(i);} + UShort_t GetS1PhiEStripNbr(Int_t i) {return fS1_Phi_E_StripNbr.at(i);} + Double_t GetS1PhiEEnergy(Int_t i) {return fS1_Phi_E_Energy.at(i);} // (Ph,T) - UShort_t GetS1PhiTMult() {return fS1_Phi_T_DetNbr.size();} - UShort_t GetS1PhiTDetectorNbr(Int_t i) {return fS1_Phi_T_DetNbr.at(i);} - UShort_t GetS1PhiTStripNbr(Int_t i) {return fS1_Phi_T_StripNbr.at(i);} - Double_t GetS1PhiTTime(Int_t i) {return fS1_Phi_T_Time.at(i);} + UShort_t GetS1PhiTMult() {return fS1_Phi_T_DetNbr.size();} + UShort_t GetS1PhiTDetectorNbr(Int_t i) {return fS1_Phi_T_DetNbr.at(i);} + UShort_t GetS1PhiTStripNbr(Int_t i) {return fS1_Phi_T_StripNbr.at(i);} + Double_t GetS1PhiTTime(Int_t i) {return fS1_Phi_T_Time.at(i);} ///////////////////// SETTERS //////////////////////// // (Th,E) - void SetS1ThetaEDetectorNbr(UShort_t det) {fS1_Theta_E_DetNbr.push_back(det);} - void SetS1ThetaEStripNbr(UShort_t Nr) {fS1_Theta_E_StripNbr.push_back(Nr);} - void SetS1ThetaEEnergy(Double_t E) {fS1_Theta_E_Energy.push_back(E);} + void SetS1ThetaEDetectorNbr(UShort_t det) {fS1_Theta_E_DetNbr.push_back(det);} + void SetS1ThetaEStripNbr(UShort_t Nr) {fS1_Theta_E_StripNbr.push_back(Nr);} + void SetS1ThetaEEnergy(Double_t E) {fS1_Theta_E_Energy.push_back(E);} // (Th,T) - void SetS1ThetaTDetectorNbr(UShort_t det) {fS1_Theta_T_DetNbr.push_back(det);} - void SetS1ThetaTStripNbr(UShort_t Nr) {fS1_Theta_T_StripNbr.push_back(Nr);} - void SetS1ThetaTTime(Double_t T) {fS1_Theta_T_Time.push_back(T);} + void SetS1ThetaTDetectorNbr(UShort_t det) {fS1_Theta_T_DetNbr.push_back(det);} + void SetS1ThetaTStripNbr(UShort_t Nr) {fS1_Theta_T_StripNbr.push_back(Nr);} + void SetS1ThetaTTime(Double_t T) {fS1_Theta_T_Time.push_back(T);} // (Ph,E) - void SetS1PhiEDetectorNbr(UShort_t det) {fS1_Phi_E_DetNbr.push_back(det);} - void SetS1PhiEStripNbr(UShort_t Nr) {fS1_Phi_E_StripNbr.push_back(Nr);} - void SetS1PhiEEnergy(Double_t E) {fS1_Phi_E_Energy.push_back(E);} + void SetS1PhiEDetectorNbr(UShort_t det) {fS1_Phi_E_DetNbr.push_back(det);} + void SetS1PhiEStripNbr(UShort_t Nr) {fS1_Phi_E_StripNbr.push_back(Nr);} + void SetS1PhiEEnergy(Double_t E) {fS1_Phi_E_Energy.push_back(E);} // (Ph,T) - void SetS1PhiTDetectorNbr(UShort_t det) {fS1_Phi_T_DetNbr.push_back(det);} - void SetS1PhiTStripNbr(UShort_t Nr) {fS1_Phi_T_StripNbr.push_back(Nr);} - void SetS1PhiTTime(Double_t T) {fS1_Phi_T_Time.push_back(T);} + void SetS1PhiTDetectorNbr(UShort_t det) {fS1_Phi_T_DetNbr.push_back(det);} + void SetS1PhiTStripNbr(UShort_t Nr) {fS1_Phi_T_StripNbr.push_back(Nr);} + void SetS1PhiTTime(Double_t T) {fS1_Phi_T_Time.push_back(T);} ClassDef(TS1Data,2) // S1Data structure }; diff --git a/NPLib/DummyDetector/TDUMMYDetectorData.cxx b/NPLib/DummyDetector/TDUMMYDetectorData.cxx index e1b58093152f087ab5427260393a7e89481f4045..066bd41be320c90b8611e50b1dbedf167f43ae6f 100644 --- a/NPLib/DummyDetector/TDUMMYDetectorData.cxx +++ b/NPLib/DummyDetector/TDUMMYDetectorData.cxx @@ -15,7 +15,7 @@ *---------------------------------------------------------------------------* * Decription: * * This class described the raw data of a very simple DUMMYDetector * - * Use it as a template for your own detector! * + * Use it as a template for your own detector! * * * *---------------------------------------------------------------------------* * Comment: * @@ -50,10 +50,10 @@ void TDUMMYDetectorData::Dump() const { cout << "XXXXXXXXXXXXXXXXXXXXXXXX New Event XXXXXXXXXXXXXXXXX" << endl; - for(unsigned short i = 0 ; i<fDUMMYDetector_Energy.size() ; i ++) - { - cout << "DUMMYDetector Number " << fDUMMYDetector_Number[i] << " Energy: " << fDUMMYDetector_Energy[i] << " Time: "<< fDUMMYDetector_Time[i] << endl; - - } + for(unsigned short i = 0 ; i<fDUMMYDetector_Energy.size() ; i ++) + { + cout << "DUMMYDetector Number " << fDUMMYDetector_Number[i] << " Energy: " << fDUMMYDetector_Energy[i] << " Time: "<< fDUMMYDetector_Time[i] << endl; + + } } diff --git a/NPLib/DummyDetector/TDUMMYDetectorData.h b/NPLib/DummyDetector/TDUMMYDetectorData.h index e340a207342c71299d248d65c604b1a8b3d9124c..c6c9743d4c3c9f5888fad677a4e190c87fbbda46 100644 --- a/NPLib/DummyDetector/TDUMMYDetectorData.h +++ b/NPLib/DummyDetector/TDUMMYDetectorData.h @@ -15,7 +15,7 @@ *---------------------------------------------------------------------------* * Decription: * * This class described the raw data of a very simple DUMMY detector * - * Use it as a template for your own detector! * + * Use it as a template for your own detector! * * * *---------------------------------------------------------------------------* * Comment: * @@ -27,43 +27,42 @@ #include "TObject.h" using namespace std ; - class TDUMMYDetectorData : public TObject { private: // ADC - vector<double> fDUMMYDetector_Energy ; - vector<double> fDUMMYDetector_Time ; - vector<short> fDUMMYDetector_Number ; + vector<double> fDUMMYDetector_Energy; + vector<double> fDUMMYDetector_Time; + vector<short> fDUMMYDetector_Number; public: TDUMMYDetectorData(); virtual ~TDUMMYDetectorData(); - void Clear(); - void Clear(const Option_t*) {}; - void Dump() const; + void Clear(); + void Clear(const Option_t*) {}; + void Dump() const; ///////////////////// GETTERS //////////////////////// // (E) - double GetEnergy(int i) {return fDUMMYDetector_Energy[i];} + double GetEnergy(int i) {return fDUMMYDetector_Energy[i];} // (T) - double GetTime(int i) {return fDUMMYDetector_Time[i];} + double GetTime(int i) {return fDUMMYDetector_Time[i];} // (N) - int GetDUMMYDetectorNumber(int i) {return fDUMMYDetector_Number[i];} + int GetDUMMYDetectorNumber(int i) {return fDUMMYDetector_Number[i];} - double GetEnergySize() {return fDUMMYDetector_Energy.size();} + double GetEnergySize() {return fDUMMYDetector_Energy.size();} // (T) - double GetTimeSize() {return fDUMMYDetector_Time.size();} + double GetTimeSize() {return fDUMMYDetector_Time.size();} // (N) - int GetDUMMYDetectorNumberSize() {return fDUMMYDetector_Number.size();} + int GetDUMMYDetectorNumberSize() {return fDUMMYDetector_Number.size();} ///////////////////// SETTERS //////////////////////// // (E) - void SetEnergy(double E) {fDUMMYDetector_Energy.push_back(E);} - void SetTime(double T) {fDUMMYDetector_Time.push_back(T);} - void SetDUMMYDetectorNumber(int N) {fDUMMYDetector_Number.push_back(N);} + void SetEnergy(double E) {fDUMMYDetector_Energy.push_back(E);} + void SetTime(double T) {fDUMMYDetector_Time.push_back(T);} + void SetDUMMYDetectorNumber(int N) {fDUMMYDetector_Number.push_back(N);} // ClassDef(TDUMMYDetectorData,1) // DUMMYDetectorData structure diff --git a/NPLib/GASPARD/GaspardTracker.cxx b/NPLib/GASPARD/GaspardTracker.cxx index 30ec36a68468bcaa7a773a67b928eeccbb099a34..af644c48569783d13a4c423b33e8029d80477928 100644 --- a/NPLib/GASPARD/GaspardTracker.cxx +++ b/NPLib/GASPARD/GaspardTracker.cxx @@ -26,7 +26,7 @@ #include "GaspardTracker.h" // C++ headers -#include <iostream> +#include <iostream> #include <fstream> #include <string> #include <cmath> @@ -45,16 +45,16 @@ #include "GaspardTrackerAnnular.h" #include "GaspardTrackerSquare.h" -using namespace std ; +using namespace std ; GaspardTracker::GaspardTracker() - : m_EventData (new TGaspardTrackerData()), - m_EventPhysics (new TGaspardTrackerPhysics()) + : m_EventData (new TGaspardTrackerData()), + m_EventPhysics (new TGaspardTrackerPhysics()) { -} +} @@ -62,7 +62,7 @@ GaspardTracker::~GaspardTracker() { delete m_EventData; delete m_EventPhysics; -} +} @@ -73,7 +73,7 @@ void GaspardTracker::Clear() // Read stream at ConfigFile to pick-up parameters of detector (Position,...) using Token -void GaspardTracker::ReadConfiguration(string Path) +void GaspardTracker::ReadConfiguration(string Path) { // open configuration file ifstream ConfigFile; @@ -149,9 +149,9 @@ void GaspardTracker::ReadConfiguration(string Path) // Read stream at Path and pick-up calibration parameter using Token // If argument is "Simulation" no change calibration is loaded -void GaspardTracker::ReadCalibrationFile(string Path) +void GaspardTracker::ReadCalibrationFile(string Path) { - Path.c_str(); // remove warning at compilation time + Path.c_str(); // remove warning at compilation time /* // Order of Polynom function used for calibration int Calibration_Si_E_Order; @@ -160,16 +160,16 @@ void GaspardTracker::ReadCalibrationFile(string Path) int Calibration_CsI_E_Order; // Calibration_Si_X_E[DetectorNumber][StripNumber][Order of Coeff] - vector< vector< vector< double > > > Calibration_Si_X_E ; - vector< vector< vector< double > > > Calibration_Si_X_T ; - vector< vector< vector< double > > > Calibration_Si_Y_E ; - vector< vector< vector< double > > > Calibration_Si_Y_T ; + vector< vector< vector< double > > > Calibration_Si_X_E ; + vector< vector< vector< double > > > Calibration_Si_X_T ; + vector< vector< vector< double > > > Calibration_Si_Y_E ; + vector< vector< vector< double > > > Calibration_Si_Y_T ; // Calibration_SiLi_E[DetectorNumber][PadNumber][Order of Coeff] - vector< vector< vector< double > > > Calibration_SiLi_E ; + vector< vector< vector< double > > > Calibration_SiLi_E ; // Calibration_SiLi_E[DetectorNumber][CrystalNumber][Order of Coeff] - vector< vector< vector< double > > > Calibration_CsI_E ; + vector< vector< vector< double > > > Calibration_CsI_E ; if (Path == "Simulation") { // Simulation case: data already calibrated Calibration_Si_E_Order = 1; @@ -178,30 +178,30 @@ void GaspardTracker::ReadCalibrationFile(string Path) Calibration_CsI_E_Order = 1; vector<double> Coef; - // Order 0 Order 1 - Coef.push_back(0) ; Coef.push_back(1) ; - - vector< vector<double> > StripLine ; - StripLine.resize( 128 , Coef) ; - - Calibration_Si_X_E.resize( m_NumberOfModule , StripLine) ; - Calibration_Si_X_T.resize( m_NumberOfModule , StripLine) ; - Calibration_Si_Y_E.resize( m_NumberOfModule , StripLine) ; - Calibration_Si_Y_T.resize( m_NumberOfModule , StripLine) ; - - Calibration_SiLi_E.resize( m_NumberOfModule , StripLine) ; - Calibration_CsI_E .resize( m_NumberOfModule , StripLine) ; + // Order 0 Order 1 + Coef.push_back(0) ; Coef.push_back(1) ; + + vector< vector<double> > StripLine ; + StripLine.resize( 128 , Coef) ; + + Calibration_Si_X_E.resize( m_NumberOfModule , StripLine) ; + Calibration_Si_X_T.resize( m_NumberOfModule , StripLine) ; + Calibration_Si_Y_E.resize( m_NumberOfModule , StripLine) ; + Calibration_Si_Y_T.resize( m_NumberOfModule , StripLine) ; + + Calibration_SiLi_E.resize( m_NumberOfModule , StripLine) ; + Calibration_CsI_E .resize( m_NumberOfModule , StripLine) ; } else { } */ -} +} - + // 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 GaspardTracker::InitializeRootInput() +void GaspardTracker::InitializeRootInput() { TChain* inputChain = RootInput::getInstance()->GetChain(); inputChain->SetBranchStatus("GASPARD", true); @@ -212,7 +212,7 @@ void GaspardTracker::InitializeRootInput() // Create associated branches and associated private member DetectorPhysics address -void GaspardTracker::InitializeRootOutput() +void GaspardTracker::InitializeRootOutput() { TTree* outputTree = RootOutput::getInstance()->GetTree(); outputTree->Branch("GASPARD", "TGaspardTrackerPhysics", &m_EventPhysics); @@ -221,7 +221,7 @@ void GaspardTracker::InitializeRootOutput() // This method is called at each event read from the Input Tree. Aime is to build treat Raw dat in order to extract physical parameter. -void GaspardTracker::BuildPhysicalEvent() +void GaspardTracker::BuildPhysicalEvent() { if (m_EventData->GetGPDTrkFirstStageFrontEMult() > 0) { for (UInt_t i = 0; i < m_EventData->GetGPDTrkFirstStageFrontEMult(); i++) { @@ -236,7 +236,7 @@ void GaspardTracker::BuildPhysicalEvent() // Same as above, but only the simplest event and/or simple method are used (low multiplicity, faster algorythm but less efficient ...). // This method aimed to be used for analysis performed during experiment, when speed is requiered. // NB: This method can eventually be the same as BuildPhysicalEvent. -void GaspardTracker::BuildSimplePhysicalEvent() +void GaspardTracker::BuildSimplePhysicalEvent() { BuildPhysicalEvent(); } @@ -272,7 +272,7 @@ void GaspardTracker::DumpStrippingScheme(int moduleNumber) -double GaspardTracker::GetEnergyDeposit() +double GaspardTracker::GetEnergyDeposit() { if (m_EventPhysics->GetEventMultiplicity() > 0) { return m_EventPhysics->GetTotalEnergy(0); diff --git a/NPLib/GASPARD/GaspardTracker.h b/NPLib/GASPARD/GaspardTracker.h index e6ef447677b9d4cee590a36369991b2fc7f1e96a..532de2ed64fb85cdb890d74e17eee604fcefde89 100644 --- a/NPLib/GASPARD/GaspardTracker.h +++ b/NPLib/GASPARD/GaspardTracker.h @@ -47,7 +47,7 @@ public: virtual ~GaspardTracker(); public: - void Clear() ; + void Clear(); void Clear(const Option_t*) {}; public: @@ -71,7 +71,7 @@ public: // This method is called at each event read from the Input Tree. // The aim is to build treat Raw dat in order to extract physical parameter. void BuildPhysicalEvent(); - + // Same as above, but only the simplest event and/or simple method are used (low multiplicity, faster algorythm but less efficient ...). // This method aimed to be used for analysis performed during experiment, when speed is requiered. // NB: This method can eventually be the same as BuildPhysicalEvent. @@ -87,24 +87,24 @@ public: void DumpStrippingScheme(int moduleNumber); private: - map<int, GaspardTrackerModule*> m_ModulesMap; + map<int, GaspardTrackerModule*> m_ModulesMap; public: // Get Root input and output objects - TGaspardTrackerData* GetEventData() {return m_EventData;} - TGaspardTrackerPhysics* GetEventPhysics() {return m_EventPhysics;} + TGaspardTrackerData* GetEventData() {return m_EventData;} + TGaspardTrackerPhysics* GetEventPhysics() {return m_EventPhysics;} // To be called after a build Physical Event - double GetEnergyDeposit(); - TVector3 GetPositionOfInteraction(); + double GetEnergyDeposit(); + TVector3 GetPositionOfInteraction(); private: //////////////////////////////////////// // Root Input and Output tree classes // //////////////////////////////////////// - TGaspardTrackerData* m_EventData; - TGaspardTrackerPhysics* m_EventPhysics; + TGaspardTrackerData* m_EventData; + TGaspardTrackerPhysics* m_EventPhysics; }; #endif diff --git a/NPLib/GASPARD/GaspardTrackerAnnular.cxx b/NPLib/GASPARD/GaspardTrackerAnnular.cxx index 8e3c428389eff4cdf56f03d7f3c30fc8488f2e5f..cb5c104e8650dfb304561771180db048a9d17717 100644 --- a/NPLib/GASPARD/GaspardTrackerAnnular.cxx +++ b/NPLib/GASPARD/GaspardTrackerAnnular.cxx @@ -16,11 +16,11 @@ using namespace std; GaspardTrackerAnnular::GaspardTrackerAnnular(map<int, GaspardTrackerModule*> &Module, TGaspardTrackerPhysics* &EventPhysics) - : m_ModuleTest(Module), - m_EventPhysics(EventPhysics), - m_EventData(0), - m_PreTreatData(new TGaspardTrackerData), - m_NumberOfModule(0), + : m_ModuleTest(Module), + m_EventPhysics(EventPhysics), + m_EventData(0), + m_PreTreatData(new TGaspardTrackerData), + m_NumberOfModule(0), m_NumberOfStripsTheta(16), m_NumberOfStripsPhi(16), m_NumberOfQuadrants(4) diff --git a/NPLib/GASPARD/GaspardTrackerDummyShape.cxx b/NPLib/GASPARD/GaspardTrackerDummyShape.cxx index 5b856f3b67e3da59871b831aba05b2b5817632f1..fcda4e2145909f8d8f8562a6ef75058ceb4b6087 100644 --- a/NPLib/GASPARD/GaspardTrackerDummyShape.cxx +++ b/NPLib/GASPARD/GaspardTrackerDummyShape.cxx @@ -12,14 +12,14 @@ #include "TGaspardTrackerPhysics.h" GaspardTrackerDummyShape::GaspardTrackerDummyShape(map<int, GaspardTrackerModule*> &Module, - TGaspardTrackerPhysics* &EventPhysics) - : m_ModuleTest(Module), - m_EventPhysics(EventPhysics), - m_EventData(0), - m_PreTreatData(new TGaspardTrackerData), - m_NumberOfModule(0), - m_FirstStageFace(50), // mm - m_NumberOfStrips(100) + TGaspardTrackerPhysics* &EventPhysics) + : m_ModuleTest(Module), + m_EventPhysics(EventPhysics), + m_EventData(0), + m_PreTreatData(new TGaspardTrackerData), + m_NumberOfModule(0), + m_FirstStageFace(50), // mm + m_NumberOfStrips(100) { m_StripPitch = m_FirstStageFace / (double)m_NumberOfStrips; } diff --git a/NPLib/GASPARD/GaspardTrackerDummyShape.h b/NPLib/GASPARD/GaspardTrackerDummyShape.h index 9c32fb403deb97189b7d4f1ff457ff707368322a..685ac4ddab88a3ac4365d493c59ac6600033d146 100644 --- a/NPLib/GASPARD/GaspardTrackerDummyShape.h +++ b/NPLib/GASPARD/GaspardTrackerDummyShape.h @@ -90,7 +90,7 @@ private: ////////////////////////////// // Geometry and stip number // ////////////////////////////// - double m_FirstStageFace; // mm + double m_FirstStageFace; // mm int m_NumberOfStrips; double m_StripPitch; }; diff --git a/NPLib/GASPARD/GaspardTrackerSquare.cxx b/NPLib/GASPARD/GaspardTrackerSquare.cxx index 0b9db4ad55b0c6de2b2ad7df381592f88f3e9d53..5634e2e0d061918145281683381e1ef067b36468 100644 --- a/NPLib/GASPARD/GaspardTrackerSquare.cxx +++ b/NPLib/GASPARD/GaspardTrackerSquare.cxx @@ -14,11 +14,11 @@ GaspardTrackerSquare::GaspardTrackerSquare(map<int, GaspardTrackerModule*> &Module, TGaspardTrackerPhysics* &EventPhysics) - : m_ModuleTest(Module), - m_EventPhysics(EventPhysics), - m_EventData(0), - m_PreTreatData(new TGaspardTrackerData), - m_NumberOfModule(0), + : m_ModuleTest(Module), + m_EventPhysics(EventPhysics), + m_EventData(0), + m_PreTreatData(new TGaspardTrackerData), + m_NumberOfModule(0), m_FirstStageFace(98), // mm m_NumberOfStrips(128) { diff --git a/NPLib/GASPARD/GaspardTrackerTrapezoid.cxx b/NPLib/GASPARD/GaspardTrackerTrapezoid.cxx index d2179f8ad63f8281f2d4252e1f5941d2c01ee277..a89c72b450c7c31e1810fdd351fe693e7dd34431 100644 --- a/NPLib/GASPARD/GaspardTrackerTrapezoid.cxx +++ b/NPLib/GASPARD/GaspardTrackerTrapezoid.cxx @@ -14,13 +14,13 @@ GaspardTrackerTrapezoid::GaspardTrackerTrapezoid(map<int, GaspardTrackerModule*> &Module, TGaspardTrackerPhysics* &EventPhysics) - : m_ModuleTest(Module), + : m_ModuleTest(Module), m_EventPhysics(EventPhysics), m_EventData(0), m_PreTreatData(new TGaspardTrackerData), m_NumberOfModule(0), - m_FirstStageBaseLarge(97.5), // mm - m_FirstStageHeight(113.5), // mm + m_FirstStageBaseLarge(97.5), // mm + m_FirstStageHeight(113.5), // mm m_NumberOfStripsX(128), m_NumberOfStripsY(128) { diff --git a/NPLib/GASPARD/GaspardTrackerTrapezoid.h b/NPLib/GASPARD/GaspardTrackerTrapezoid.h index 567c0c5343816fd3d6fee24334d0fbd37d8cfed8..a749a8fd5e79e87777e14f77f6ca1988d93340cd 100644 --- a/NPLib/GASPARD/GaspardTrackerTrapezoid.h +++ b/NPLib/GASPARD/GaspardTrackerTrapezoid.h @@ -42,8 +42,8 @@ public: void BuildSimplePhysicalEvent(); private: - map<int, GaspardTrackerModule*> &m_ModuleTest; - TGaspardTrackerPhysics* &m_EventPhysics; + map<int, GaspardTrackerModule*> &m_ModuleTest; + TGaspardTrackerPhysics* &m_EventPhysics; public: void SetGaspardDataPointer(TGaspardTrackerData* gaspardData) {m_EventData = gaspardData;}; @@ -90,12 +90,12 @@ private: ////////////////////////////// // Geometry and stip number // ////////////////////////////// - double m_FirstStageBaseLarge; // mm - double m_FirstStageHeight; // mm + double m_FirstStageBaseLarge; // mm + double m_FirstStageHeight; // mm int m_NumberOfStripsX; int m_NumberOfStripsY; - double m_StripPitchX; // mm - double m_StripPitchY; // mm + double m_StripPitchX; // mm + double m_StripPitchY; // mm }; #endif diff --git a/NPLib/GASPARD/TGaspardTrackerPhysics.h b/NPLib/GASPARD/TGaspardTrackerPhysics.h index 651730df308eed49c3265e5ff284564244b337e7..d0e14a11939f608e5081bd3d8a2eacea76107a70 100644 --- a/NPLib/GASPARD/TGaspardTrackerPhysics.h +++ b/NPLib/GASPARD/TGaspardTrackerPhysics.h @@ -45,31 +45,31 @@ public: ~TGaspardTrackerPhysics(); public: - void Clear(); + void Clear(); void Clear(const Option_t*) {}; private: - vector<Int_t> fEventType; - vector<Int_t> fModuleNumber; + vector<Int_t> fEventType; + vector<Int_t> fModuleNumber; // First stage - vector<Double_t> fFirstStage_Energy; - vector<Double_t> fFirstStage_Time; - vector<Int_t> fFirstStage_FrontPosition; - vector<Int_t> fFirstStage_BackPosition; + vector<Double_t> fFirstStage_Energy; + vector<Double_t> fFirstStage_Time; + vector<Int_t> fFirstStage_FrontPosition; + vector<Int_t> fFirstStage_BackPosition; // Second stage - vector<Double_t> fSecondStage_Energy; - vector<Double_t> fSecondStage_Time; - vector<Int_t> fSecondStage_Position; + vector<Double_t> fSecondStage_Energy; + vector<Double_t> fSecondStage_Time; + vector<Int_t> fSecondStage_Position; // Third stage - vector<Double_t> fThirdStage_Energy; - vector<Double_t> fThirdStage_Time; - vector<Int_t> fThirdStage_Position; + vector<Double_t> fThirdStage_Energy; + vector<Double_t> fThirdStage_Time; + vector<Int_t> fThirdStage_Position; - vector<Double_t> fTotalEnergy; + vector<Double_t> fTotalEnergy; public: @@ -77,50 +77,50 @@ public: // SETTERS // ///////////////////////////////////// // General - void SetEventType(Int_t evtType) {fEventType.push_back(evtType);} - void SetModuleNumber(Int_t moduleNbr) {fModuleNumber.push_back(moduleNbr);} - void SetTotalEnergy(Double_t ener) {fTotalEnergy.push_back(ener);} + void SetEventType(Int_t evtType) {fEventType.push_back(evtType);} + void SetModuleNumber(Int_t moduleNbr) {fModuleNumber.push_back(moduleNbr);} + void SetTotalEnergy(Double_t ener) {fTotalEnergy.push_back(ener);} // First stage - void SetFirstStageEnergy(Double_t ener) {fFirstStage_Energy.push_back(ener);} - void SetFirstStageTime(Double_t time) {fFirstStage_Time.push_back(time);} - void SetFirstStageFrontPosition(Int_t x) {fFirstStage_FrontPosition.push_back(x);} - void SetFirstStageBackPosition(Int_t y) {fFirstStage_BackPosition.push_back(y);} + void SetFirstStageEnergy(Double_t ener) {fFirstStage_Energy.push_back(ener);} + void SetFirstStageTime(Double_t time) {fFirstStage_Time.push_back(time);} + void SetFirstStageFrontPosition(Int_t x) {fFirstStage_FrontPosition.push_back(x);} + void SetFirstStageBackPosition(Int_t y) {fFirstStage_BackPosition.push_back(y);} // Second stage - void SetSecondStageEnergy(Double_t ener) {fSecondStage_Energy.push_back(ener);} - void SetSecondStageTime(Double_t time) {fSecondStage_Time.push_back(time);} - void SetSecondStagePosition(Int_t pos) {fSecondStage_Position.push_back(pos);} + void SetSecondStageEnergy(Double_t ener) {fSecondStage_Energy.push_back(ener);} + void SetSecondStageTime(Double_t time) {fSecondStage_Time.push_back(time);} + void SetSecondStagePosition(Int_t pos) {fSecondStage_Position.push_back(pos);} // Third stage - void SetThirdStageEnergy(Double_t ener) {fThirdStage_Energy.push_back(ener);} - void SetThirdStageTime(Double_t time) {fThirdStage_Time.push_back(time);} - void SetThirdStagePosition(Int_t pos) {fThirdStage_Position.push_back(pos);} + void SetThirdStageEnergy(Double_t ener) {fThirdStage_Energy.push_back(ener);} + void SetThirdStageTime(Double_t time) {fThirdStage_Time.push_back(time);} + void SetThirdStagePosition(Int_t pos) {fThirdStage_Position.push_back(pos);} ///////////////////////////////////// // GETTERS // ///////////////////////////////////// // General - Int_t GetEventMultiplicity() {return fTotalEnergy.size();} - Int_t GetEventType(Int_t i) {return fEventType.at(i);} - Int_t GetModuleNumber(Int_t i) {return fModuleNumber.at(i);} - Double_t GetTotalEnergy(Int_t i) {return fTotalEnergy.at(i);} + Int_t GetEventMultiplicity() {return fTotalEnergy.size();} + Int_t GetEventType(Int_t i) {return fEventType.at(i);} + Int_t GetModuleNumber(Int_t i) {return fModuleNumber.at(i);} + Double_t GetTotalEnergy(Int_t i) {return fTotalEnergy.at(i);} // First stage - Double_t GetFirstStageEnergy(Int_t i) {return fFirstStage_Energy.at(i);} - Double_t GetFirstStageTime(Int_t i) {return fFirstStage_Time.at(i);} - Int_t GetFirstStageFrontPosition(Int_t i) {return fFirstStage_FrontPosition.at(i);} - Int_t GetFirstStageBackPosition(Int_t i) {return fFirstStage_BackPosition.at(i);} + Double_t GetFirstStageEnergy(Int_t i) {return fFirstStage_Energy.at(i);} + Double_t GetFirstStageTime(Int_t i) {return fFirstStage_Time.at(i);} + Int_t GetFirstStageFrontPosition(Int_t i) {return fFirstStage_FrontPosition.at(i);} + Int_t GetFirstStageBackPosition(Int_t i) {return fFirstStage_BackPosition.at(i);} // Second stage - Double_t GetSecondStageEnergy(Int_t i) {return fSecondStage_Energy.at(i);} - Double_t GetSecondStageTime(Int_t i) {return fSecondStage_Time.at(i);} - Int_t GetSecondStagePosition(Int_t i) {return fSecondStage_Position.at(i);} + Double_t GetSecondStageEnergy(Int_t i) {return fSecondStage_Energy.at(i);} + Double_t GetSecondStageTime(Int_t i) {return fSecondStage_Time.at(i);} + Int_t GetSecondStagePosition(Int_t i) {return fSecondStage_Position.at(i);} // Third stage - Double_t GetThirdStageEnergy(Int_t i) {return fThirdStage_Energy.at(i);} - Double_t GetThirdStageTime(Int_t i) {return fThirdStage_Time.at(i);} - Int_t GetThirdStagePosition(Int_t i) {return fThirdStage_Position.at(i);} + Double_t GetThirdStageEnergy(Int_t i) {return fThirdStage_Energy.at(i);} + Double_t GetThirdStageTime(Int_t i) {return fThirdStage_Time.at(i);} + Int_t GetThirdStagePosition(Int_t i) {return fThirdStage_Position.at(i);} ClassDef(TGaspardTrackerPhysics,1) // TGaspardTrackerPhysics structure }; diff --git a/NPLib/HYDE/HydeTracker.cxx b/NPLib/HYDE/HydeTracker.cxx index b769adab8a756e6bf00f7c8d99cbfb7d566c4b10..841b23112af4bcffa5d3e863c68758c076429ef7 100644 --- a/NPLib/HYDE/HydeTracker.cxx +++ b/NPLib/HYDE/HydeTracker.cxx @@ -26,7 +26,7 @@ #include "HydeTracker.h" // C++ headers -#include <iostream> +#include <iostream> #include <fstream> #include <string> #include <cmath> @@ -39,16 +39,16 @@ // ROOT headers #include "TChain.h" -using namespace std ; - -// Default Constructor +using namespace std ; + +// Default Constructor HydeTracker::HydeTracker() { m_NumberOfModule = 0; m_EventData = new THydeTrackerData(); m_EventPhysics = new THydeTrackerPhysics(); -} +} @@ -57,17 +57,17 @@ HydeTracker::~HydeTracker() m_NumberOfModule = 0; delete m_EventData; delete m_EventPhysics; -} +} // Read stream at ConfigFile to pick-up parameters of detector (Position,...) using Token -void HydeTracker::ReadConfiguration(string Path) +void HydeTracker::ReadConfiguration(string Path) { - ifstream ConfigFile ; - ConfigFile.open(Path.c_str()) ; - string LineBuffer ; - string DataBuffer ; + ifstream ConfigFile ; + ConfigFile.open(Path.c_str()) ; + string LineBuffer ; + string DataBuffer ; // A:X1_Y1 --> X:1 Y:1 // B:X128_Y1 --> X:128 Y:1 @@ -117,8 +117,8 @@ void HydeTracker::ReadConfiguration(string Path) else ReadingStatus = false; // Reading Block - while (ReadingStatus) { - if (isSquare) { // square shape + while (ReadingStatus) { + if (isSquare) { // square shape ConfigFile >> DataBuffer ; // Comment Line if (DataBuffer.compare(0, 1, "%") == 0) { @@ -272,7 +272,7 @@ void HydeTracker::ReadConfiguration(string Path) } // end test for adding a module } // end test for Square shape - else if (isDummyShape) { // dummyshape shape + else if (isDummyShape) { // dummyshape shape ConfigFile >> DataBuffer ; // Comment Line if (DataBuffer.compare(0, 1, "%") == 0) { @@ -426,11 +426,11 @@ void HydeTracker::ReadConfiguration(string Path) } // end test for adding a module } // end test for DummyShape shape - else if (isTrapezoid) { // trapezoid shape + else if (isTrapezoid) { // trapezoid shape cout << "Trapezoid treatment not implemented yet!" << endl; } // end test for Trapezoid shape - else if (isAnnular) { // annular shape + else if (isAnnular) { // annular shape cout << "Annular treatment not implemented yet!" << endl; } // end test for Annular shape @@ -443,7 +443,7 @@ void HydeTracker::ReadConfiguration(string Path) // Read stream at Path and pick-up calibration parameter using Token // If argument is "Simulation" no change calibration is loaded -void HydeTracker::ReadCalibrationFile(string Path) +void HydeTracker::ReadCalibrationFile(string Path) { // Order of Polynom function used for calibration int Calibration_Si_E_Order; @@ -452,16 +452,16 @@ void HydeTracker::ReadCalibrationFile(string Path) int Calibration_CsI_E_Order; // Calibration_Si_X_E[DetectorNumber][StripNumber][Order of Coeff] - vector< vector< vector< double > > > Calibration_Si_X_E ; - vector< vector< vector< double > > > Calibration_Si_X_T ; - vector< vector< vector< double > > > Calibration_Si_Y_E ; - vector< vector< vector< double > > > Calibration_Si_Y_T ; + vector< vector< vector< double > > > Calibration_Si_X_E ; + vector< vector< vector< double > > > Calibration_Si_X_T ; + vector< vector< vector< double > > > Calibration_Si_Y_E ; + vector< vector< vector< double > > > Calibration_Si_Y_T ; // Calibration_SiLi_E[DetectorNumber][PadNumber][Order of Coeff] - vector< vector< vector< double > > > Calibration_SiLi_E ; + vector< vector< vector< double > > > Calibration_SiLi_E ; // Calibration_SiLi_E[DetectorNumber][CrystalNumber][Order of Coeff] - vector< vector< vector< double > > > Calibration_CsI_E ; + vector< vector< vector< double > > > Calibration_CsI_E ; if (Path == "Simulation") { // Simulation case: data already calibrated Calibration_Si_E_Order = 1; @@ -470,29 +470,29 @@ void HydeTracker::ReadCalibrationFile(string Path) Calibration_CsI_E_Order = 1; vector<double> Coef; - // Order 0 Order 1 - Coef.push_back(0) ; Coef.push_back(1) ; - - vector< vector<double> > StripLine ; - StripLine.resize( 128 , Coef) ; - - Calibration_Si_X_E.resize( m_NumberOfModule , StripLine) ; - Calibration_Si_X_T.resize( m_NumberOfModule , StripLine) ; - Calibration_Si_Y_E.resize( m_NumberOfModule , StripLine) ; - Calibration_Si_Y_T.resize( m_NumberOfModule , StripLine) ; - - Calibration_SiLi_E.resize( m_NumberOfModule , StripLine) ; - Calibration_CsI_E .resize( m_NumberOfModule , StripLine) ; + // Order 0 Order 1 + Coef.push_back(0) ; Coef.push_back(1) ; + + vector< vector<double> > StripLine ; + StripLine.resize( 128 , Coef) ; + + Calibration_Si_X_E.resize( m_NumberOfModule , StripLine) ; + Calibration_Si_X_T.resize( m_NumberOfModule , StripLine) ; + Calibration_Si_Y_E.resize( m_NumberOfModule , StripLine) ; + Calibration_Si_Y_T.resize( m_NumberOfModule , StripLine) ; + + Calibration_SiLi_E.resize( m_NumberOfModule , StripLine) ; + Calibration_CsI_E .resize( m_NumberOfModule , StripLine) ; } else { } -} +} - + // 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 HydeTracker::InitializeRootInput() +void HydeTracker::InitializeRootInput() { TChain* inputChain = RootInput::getInstance()->GetChain(); inputChain->SetBranchStatus("HYDE", true); @@ -503,7 +503,7 @@ void HydeTracker::InitializeRootInput() // Create associated branches and associated private member DetectorPhysics address -void HydeTracker::InitializeRootOutput() +void HydeTracker::InitializeRootOutput() { TTree* outputTree = RootOutput::getInstance()->GetTree(); outputTree->Branch("HYDE", "THydeTrackerPhysics", &m_EventPhysics); @@ -512,7 +512,7 @@ void HydeTracker::InitializeRootOutput() // This method is called at each event read from the Input Tree. Aime is to build treat Raw dat in order to extract physical parameter. -void HydeTracker::BuildPhysicalEvent() +void HydeTracker::BuildPhysicalEvent() { m_EventPhysics -> BuildPhysicalEvent(m_EventData); } @@ -522,7 +522,7 @@ void HydeTracker::BuildPhysicalEvent() // Same as above, but only the simplest event and/or simple method are used (low multiplicity, faster algorythm but less efficient ...). // This method aimed to be used for analysis performed during experiment, when speed is requiered. // NB: This method can eventually be the same as BuildPhysicalEvent. -void HydeTracker::BuildSimplePhysicalEvent() +void HydeTracker::BuildSimplePhysicalEvent() { m_EventPhysics -> BuildSimplePhysicalEvent(m_EventData); } @@ -553,7 +553,7 @@ void HydeTracker::AddModuleSquare(TVector3 C_X1_Y1, TVector3 Strip_1_1; // Geometry Parameter - double Face = 98; // mm + double Face = 98; // mm double NumberOfStrip = 16; double StripPitch = Face/NumberOfStrip; // mm @@ -562,9 +562,9 @@ void HydeTracker::AddModuleSquare(TVector3 C_X1_Y1, vector<double> lineY; vector<double> lineZ; - vector< vector< double > > OneModuleStripPositionX; - vector< vector< double > > OneModuleStripPositionY; - vector< vector< double > > OneModuleStripPositionZ; + vector< vector< double > > OneModuleStripPositionX; + vector< vector< double > > OneModuleStripPositionY; + vector< vector< double > > OneModuleStripPositionZ; // Moving StripCenter to 1.1 corner: Strip_1_1 = C_X1_Y1 + (U+V) * (StripPitch/2.); @@ -580,7 +580,7 @@ void HydeTracker::AddModuleSquare(TVector3 C_X1_Y1, lineX.push_back( StripCenter.X() ); lineY.push_back( StripCenter.Y() ); - lineZ.push_back( StripCenter.Z() ); + lineZ.push_back( StripCenter.Z() ); } OneModuleStripPositionX.push_back(lineX); @@ -610,7 +610,7 @@ void HydeTracker::AddModuleSquare(double theta, phi = phi * Pi/180. ; // Vector U on Module Face (paralelle to Y Strip) (NB: remember that Y strip are allong X axis) - TVector3 U ; + TVector3 U ; // Vector V on Module Face (parallele to X Strip) TVector3 V ; // Vector W normal to Module Face (pointing CsI) @@ -651,10 +651,10 @@ void HydeTracker::AddModuleSquare(double theta, vector<double> lineY; vector<double> lineZ; - vector< vector< double > > OneModuleStripPositionX; - vector< vector< double > > OneModuleStripPositionY; - vector< vector< double > > OneModuleStripPositionZ; - + vector< vector< double > > OneModuleStripPositionX; + vector< vector< double > > OneModuleStripPositionY; + vector< vector< double > > OneModuleStripPositionZ; + double X, Y, Z; // Moving C to the 1.1 corner: @@ -713,7 +713,7 @@ void HydeTracker::AddModuleDummyShape(TVector3 C_X1_Y1, TVector3 Strip_1_1; // Geometry Parameter - double Face = 50; // mm + double Face = 50; // mm double NumberOfStrip = 128; double StripPitch = Face/NumberOfStrip; // mm @@ -722,9 +722,9 @@ void HydeTracker::AddModuleDummyShape(TVector3 C_X1_Y1, vector<double> lineY; vector<double> lineZ; - vector< vector< double > > OneModuleStripPositionX; - vector< vector< double > > OneModuleStripPositionY; - vector< vector< double > > OneModuleStripPositionZ; + vector< vector< double > > OneModuleStripPositionX; + vector< vector< double > > OneModuleStripPositionY; + vector< vector< double > > OneModuleStripPositionZ; // Moving StripCenter to 1.1 corner: Strip_1_1 = C_X1_Y1 + (U+V) * (StripPitch/2.); @@ -740,7 +740,7 @@ void HydeTracker::AddModuleDummyShape(TVector3 C_X1_Y1, lineX.push_back( StripCenter.X() ); lineY.push_back( StripCenter.Y() ); - lineZ.push_back( StripCenter.Z() ); + lineZ.push_back( StripCenter.Z() ); } OneModuleStripPositionX.push_back(lineX); @@ -770,7 +770,7 @@ void HydeTracker::AddModuleDummyShape(double theta, phi = phi * Pi/180. ; // Vector U on Module Face (paralelle to Y Strip) (NB: remember that Y strip are allong X axis) - TVector3 U ; + TVector3 U ; // Vector V on Module Face (parallele to X Strip) TVector3 V ; // Vector W normal to Module Face (pointing CsI) @@ -811,10 +811,10 @@ void HydeTracker::AddModuleDummyShape(double theta, vector<double> lineY; vector<double> lineZ; - vector< vector< double > > OneModuleStripPositionX; - vector< vector< double > > OneModuleStripPositionY; - vector< vector< double > > OneModuleStripPositionZ; - + vector< vector< double > > OneModuleStripPositionX; + vector< vector< double > > OneModuleStripPositionY; + vector< vector< double > > OneModuleStripPositionZ; + double X, Y, Z; // Moving C to the 1.1 corner: @@ -849,7 +849,7 @@ void HydeTracker::AddModuleDummyShape(double theta, -double HydeTracker::GetEnergyDeposit() +double HydeTracker::GetEnergyDeposit() { if (m_EventPhysics->TotalEnergy.size() > 0) return m_EventPhysics->TotalEnergy[0]; diff --git a/NPLib/HYDE/HydeTracker.h b/NPLib/HYDE/HydeTracker.h index b9668e494354c72b274d843c7f61da883c1212aa..8c6eb3a882866d6a9e57ef8a1efa5ad87b212712 100644 --- a/NPLib/HYDE/HydeTracker.h +++ b/NPLib/HYDE/HydeTracker.h @@ -60,15 +60,15 @@ public: // This method is called at each event read from the Input Tree. // The aim is to build treat Raw dat in order to extract physical parameter. void BuildPhysicalEvent(); - + // Same as above, but only the simplest event and/or simple method are used (low multiplicity, faster algorythm but less efficient ...). // This method aimed to be used for analysis performed during experiment, when speed is requiered. // NB: This method can eventually be the same as BuildPhysicalEvent. void BuildSimplePhysicalEvent(); // Those two method all to clear the Event Physics or Data - void ClearEventPhysics() {m_EventPhysics->Clear();} - void ClearEventData() {m_EventData->Clear();} + void ClearEventPhysics() {m_EventPhysics->Clear();} + void ClearEventData() {m_EventData->Clear();} public: @@ -106,36 +106,36 @@ public: double beta_w); // Getters to retrieve the (X,Y,Z) coordinates of a pixel defined by strips (X,Y) - double GetStripPositionX(int N ,int X ,int Y) { return m_StripPositionX[N-1][X-1][Y-1]; } - double GetStripPositionY(int N ,int X ,int Y) { return m_StripPositionY[N-1][X-1][Y-1]; } - double GetStripPositionZ(int N ,int X ,int Y) { return m_StripPositionZ[N-1][X-1][Y-1]; } - double GetNumberOfModule() { return m_NumberOfModule; } + double GetStripPositionX(int N ,int X ,int Y) { return m_StripPositionX[N-1][X-1][Y-1]; } + double GetStripPositionY(int N ,int X ,int Y) { return m_StripPositionY[N-1][X-1][Y-1]; } + double GetStripPositionZ(int N ,int X ,int Y) { return m_StripPositionZ[N-1][X-1][Y-1]; } + double GetNumberOfModule() { return m_NumberOfModule; } // Get Root input and output objects - THydeTrackerData* GetEventData() {return m_EventData;} - THydeTrackerPhysics* GetEventPhysics() {return m_EventPhysics;} + THydeTrackerData* GetEventData() {return m_EventData;} + THydeTrackerPhysics* GetEventPhysics() {return m_EventPhysics;} // To be called after a build Physical Event - double GetEnergyDeposit(); - TVector3 GetPositionOfInteraction(); + double GetEnergyDeposit(); + TVector3 GetPositionOfInteraction(); - void Print(); + void Print(); private: //////////////////////////////////////// // Root Input and Output tree classes // //////////////////////////////////////// - THydeTrackerData* m_EventData; - THydeTrackerPhysics* m_EventPhysics; + THydeTrackerData* m_EventData; + THydeTrackerPhysics* m_EventPhysics; private: // Spatial Position of Strip Calculated on basis of detector position int m_NumberOfModule; - vector< vector < vector < double > > > m_StripPositionX; - vector< vector < vector < double > > > m_StripPositionY; - vector< vector < vector < double > > > m_StripPositionZ; + vector< vector < vector < double > > > m_StripPositionX; + vector< vector < vector < double > > > m_StripPositionY; + vector< vector < vector < double > > > m_StripPositionZ; }; #endif diff --git a/NPLib/HYDE/THydeTrackerData.cxx b/NPLib/HYDE/THydeTrackerData.cxx index cd0e27100df0b365eb0c268e3b60a999d4794b3c..dda3d68f024fc4eb0b77be187bf4890ddb5c87f1 100644 --- a/NPLib/HYDE/THydeTrackerData.cxx +++ b/NPLib/HYDE/THydeTrackerData.cxx @@ -51,20 +51,20 @@ void THydeTrackerData::Clear() // DSSD // (X,E) fHYDTrk_FirstStage_FrontE_DetectorNbr.clear(); - fHYDTrk_FirstStage_FrontE_StripNbr.clear() ; - fHYDTrk_FirstStage_FrontE_Energy.clear() ; + fHYDTrk_FirstStage_FrontE_StripNbr.clear() ; + fHYDTrk_FirstStage_FrontE_Energy.clear() ; // (X,T) - fHYDTrk_FirstStage_FrontT_DetectorNbr.clear() ; - fHYDTrk_FirstStage_FrontT_StripNbr.clear() ; - fHYDTrk_FirstStage_FrontT_Time.clear() ; + fHYDTrk_FirstStage_FrontT_DetectorNbr.clear(); + fHYDTrk_FirstStage_FrontT_StripNbr.clear() ; + fHYDTrk_FirstStage_FrontT_Time.clear() ; // (Y,E) - fHYDTrk_FirstStage_BackE_DetectorNbr.clear() ; - fHYDTrk_FirstStage_BackE_StripNbr.clear() ; - fHYDTrk_FirstStage_BackE_Energy.clear() ; + fHYDTrk_FirstStage_BackE_DetectorNbr.clear() ; + fHYDTrk_FirstStage_BackE_StripNbr.clear() ; + fHYDTrk_FirstStage_BackE_Energy.clear() ; // (Y,T) - fHYDTrk_FirstStage_BackT_DetectorNbr.clear() ; - fHYDTrk_FirstStage_BackT_StripNbr.clear() ; - fHYDTrk_FirstStage_BackT_Time.clear() ; + fHYDTrk_FirstStage_BackT_DetectorNbr.clear() ; + fHYDTrk_FirstStage_BackT_StripNbr.clear() ; + fHYDTrk_FirstStage_BackT_Time.clear() ; // Second Stage // E @@ -79,11 +79,11 @@ void THydeTrackerData::Clear() // Third Stage // E fHYDTrk_ThirdStage_E_DetectorNbr.clear() ; - fHYDTrk_ThirdStage_E_PadNbr.clear() ; + fHYDTrk_ThirdStage_E_PadNbr.clear() ; fHYDTrk_ThirdStage_E_Energy.clear() ; // T fHYDTrk_ThirdStage_T_DetectorNbr.clear() ; - fHYDTrk_ThirdStage_T_PadNbr.clear() ; + fHYDTrk_ThirdStage_T_PadNbr.clear() ; fHYDTrk_ThirdStage_T_Time.clear() ; } diff --git a/NPLib/HYDE/THydeTrackerPhysics.cxx b/NPLib/HYDE/THydeTrackerPhysics.cxx index 5fa21121aec4aa3d56efb28fee5858012fb10061..4d2a6437a6aff06c641fe06a395135d29f3a2efe 100644 --- a/NPLib/HYDE/THydeTrackerPhysics.cxx +++ b/NPLib/HYDE/THydeTrackerPhysics.cxx @@ -69,7 +69,7 @@ void THydeTrackerPhysics::BuildPhysicalEvent(THydeTrackerData* Data) double FirstStage_Front_E_Threshold = 0; double FirstStage_Front_T_Threshold = 0; double FirstStage_Back_E_Threshold = 0; double FirstStage_Back_T_Threshold = 0; double SecondStage_E_Threshold = 0; double SecondStage_T_Threshold = 0; - double ThirdStage_E_Threshold = 0; double ThirdStage_T_Threshold = 0; + double ThirdStage_E_Threshold = 0; double ThirdStage_T_Threshold = 0; */ // calculate multipicity in the first stage int multXE = Data->GetHYDTrkFirstStageFrontEMult(); @@ -200,7 +200,7 @@ void THydeTrackerPhysics::Clear() SecondStage_T.clear(); SecondStage_N.clear(); - // CsI + // CsI ThirdStage_E.clear(); ThirdStage_T.clear(); ThirdStage_N.clear(); diff --git a/NPLib/HYDE/THydeTrackerPhysics.h b/NPLib/HYDE/THydeTrackerPhysics.h index 37baa79b55bbe0c3a77014dd2e0584f0ce7ab1b3..8326f12fb866ea8323dbf6956ebc1be18645edf5 100644 --- a/NPLib/HYDE/THydeTrackerPhysics.h +++ b/NPLib/HYDE/THydeTrackerPhysics.h @@ -38,39 +38,39 @@ public: ~THydeTrackerPhysics(); public: - void Clear(); - void Clear(const Option_t*) {}; + void Clear(); + void Clear(const Option_t*) {}; void BuildPhysicalEvent(THydeTrackerData* Data); void BuildSimplePhysicalEvent(THydeTrackerData* Data); public: // Provide Physical Multiplicity - Int_t EventMultiplicity; + Int_t EventMultiplicity; // Provide a Classification of Event - vector<int> EventType; + vector<int> EventType; // Telescope - vector<int> ModuleNumber; + vector<int> ModuleNumber; - // FirstStage - vector<double> FirstStage_E; - vector<double> FirstStage_T; - vector<int> FirstStage_X; - vector<int> FirstStage_Y; + // FirstStage + vector<double> FirstStage_E; + vector<double> FirstStage_T; + vector<int> FirstStage_X; + vector<int> FirstStage_Y; - // SecondStage - vector<double> SecondStage_E; - vector<double> SecondStage_T; - vector<int> SecondStage_N; + // SecondStage + vector<double> SecondStage_E; + vector<double> SecondStage_T; + vector<int> SecondStage_N; - // ThirdStage - vector<double> ThirdStage_E; - vector<double> ThirdStage_T; - vector<int> ThirdStage_N; + // ThirdStage + vector<double> ThirdStage_E; + vector<double> ThirdStage_T; + vector<int> ThirdStage_N; // Physical Value - vector<double> TotalEnergy; + vector<double> TotalEnergy; ClassDef(THydeTrackerPhysics,1) // HydeTrackerPHysics structure }; diff --git a/NPLib/IORoot/RootInput.cxx b/NPLib/IORoot/RootInput.cxx index 3590f7c9445640b5b40f6aa3f6743b135deef94e..1e18c5f46392a79a0472eaa74156ebd4640336bb 100644 --- a/NPLib/IORoot/RootInput.cxx +++ b/NPLib/IORoot/RootInput.cxx @@ -68,7 +68,7 @@ RootInput::RootInput(string configFileName) // Open file ifstream inputConfigFile; inputConfigFile.open(configFileName.c_str()); - + pRootFile = NULL; pRootChain = new TChain(); @@ -83,7 +83,7 @@ RootInput::RootInput(string configFileName) else { while (!inputConfigFile.eof()) { getline(inputConfigFile, lineBuffer); - + // search for token giving the TTree name if (lineBuffer.compare(0, 9, "TTreeName") == 0) { inputConfigFile >> dataBuffer; @@ -113,7 +113,7 @@ RootInput::RootInput(string configFileName) } } } - + if (!CheckRootFileName || !CheckTreeName) cout << "WARNING: Token not found for InputTree Declaration : Input Tree may not be instantiate properly" << endl; } @@ -135,7 +135,7 @@ void RootInput::AddFriendChain(string RunToAdd) // Open file ifstream inputConfigFile; inputConfigFile.open(RunToAdd.c_str()); - + TChain* localChain = new TChain(); cout << "/////////////////////////////////" << endl; @@ -149,7 +149,7 @@ void RootInput::AddFriendChain(string RunToAdd) else { while (!inputConfigFile.eof()) { getline(inputConfigFile, lineBuffer); - + // search for token giving the TTree name if (lineBuffer.compare(0, 9, "TTreeName") == 0) { inputConfigFile >> dataBuffer; @@ -180,7 +180,7 @@ void RootInput::AddFriendChain(string RunToAdd) } } } - + if (!CheckRootFileName || !CheckTreeName) cout << "WARNING: Token not found for InputTree Declaration : Input Tree has not be Added to the current Chain" << endl; diff --git a/NPLib/IORoot/RootInput.h b/NPLib/IORoot/RootInput.h index 4572c2937b4d3ee4d303e9c450f271357c9fbad0..463411bb02d74350c7d76de11c7b0822d170c690 100644 --- a/NPLib/IORoot/RootInput.h +++ b/NPLib/IORoot/RootInput.h @@ -67,14 +67,14 @@ public: public: // Return the private chain and file - TChain* GetChain() {return pRootChain;} + TChain* GetChain() {return pRootChain;} TFile* GetFile() {return pRootFile;} // Add a Friend chain to the input chain void AddFriendChain(string RunToAdd); private: - TChain *pRootChain; + TChain *pRootChain; TFile *pRootFile; int NumberOfFriend; }; diff --git a/NPLib/IORoot/RootOutput.h b/NPLib/IORoot/RootOutput.h index 92d1d784c8e69bb8a78abe9f5df67f7da327b705..08e5449b96632c68666f54507e33c9dfb22c5f40 100644 --- a/NPLib/IORoot/RootOutput.h +++ b/NPLib/IORoot/RootOutput.h @@ -68,9 +68,9 @@ private: void InitAsciiFiles(); public: - TFile* GetFile() {return pRootFile;} - TTree* GetTree() {return pRootTree;} - TList* GetList() {return pRootList;} + TFile* GetFile() {return pRootFile;} + TTree* GetTree() {return pRootTree;} + TList* GetList() {return pRootList;} TAsciiFile* GetAsciiFileEventGenerator() {return pEventGenerator;} TAsciiFile* GetAsciiFileDetectorConfiguration() {return pDetectorConfiguration;} TAsciiFile* GetAsciiFileCalibration() {return pCalibrationFile;} diff --git a/NPLib/InitialConditions/TInitialConditions.h b/NPLib/InitialConditions/TInitialConditions.h index 67430e715990e4f61e8b006a8088f4c600e0f03a..3b11f4a1ec66537f5b82053857932c29b7a74168 100644 --- a/NPLib/InitialConditions/TInitialConditions.h +++ b/NPLib/InitialConditions/TInitialConditions.h @@ -36,28 +36,28 @@ class TInitialConditions : public TObject private: // Incident particle properties (before interactions in the target) // Vertex of interaction - vector<Double_t> fIC_Position_X; - vector<Double_t> fIC_Position_Y; - vector<Double_t> fIC_Position_Z; + vector<Double_t> fIC_Position_X; + vector<Double_t> fIC_Position_Y; + vector<Double_t> fIC_Position_Z; // Theta and Phi angles for the emittance - vector<Double_t> fIC_Incident_Emittance_Theta; - vector<Double_t> fIC_Incident_Emittance_Phi; + vector<Double_t> fIC_Incident_Emittance_Theta; + vector<Double_t> fIC_Incident_Emittance_Phi; // Incident particle angles - vector<Double_t> fIC_Incident_Angle_Theta; - vector<Double_t> fIC_Incident_Angle_Phi; + vector<Double_t> fIC_Incident_Angle_Theta; + vector<Double_t> fIC_Incident_Angle_Phi; // Incident particle energy - vector<Double_t> fIC_Incident_Energy; + vector<Double_t> fIC_Incident_Energy; // Emitted particle properties (after interactions in the target) - vector<Double_t> fIC_Emitted_Angle_ThetaCM; + vector<Double_t> fIC_Emitted_Angle_ThetaCM; // Emitted particle angles in the incident frame - vector<Double_t> fIC_Emitted_Angle_ThetaLab_IncidentFrame; - vector<Double_t> fIC_Emitted_Angle_Phi_IncidentFrame; + vector<Double_t> fIC_Emitted_Angle_ThetaLab_IncidentFrame; + vector<Double_t> fIC_Emitted_Angle_Phi_IncidentFrame; // Emitted particle angles in the world frame - vector<Double_t> fIC_Emitted_Angle_ThetaLab_WorldFrame; - vector<Double_t> fIC_Emitted_Angle_Phi_WorldFrame; + vector<Double_t> fIC_Emitted_Angle_ThetaLab_WorldFrame; + vector<Double_t> fIC_Emitted_Angle_Phi_WorldFrame; // Emittedparticle energy - vector<Double_t> fIC_Emitted_Energy; + vector<Double_t> fIC_Emitted_Energy; public: @@ -71,57 +71,57 @@ public: ///////////////////// SETTERS //////////////////////// // Incident particle properties (before interactions in the target) // Vertex of interaction - void SetICPositionX(Double_t PositionX) {fIC_Position_X.push_back(PositionX);} - void SetICPositionY(Double_t PositionY) {fIC_Position_Y.push_back(PositionY);} - void SetICPositionZ(Double_t PositionZ) {fIC_Position_Z.push_back(PositionZ);} + void SetICPositionX(Double_t PositionX) {fIC_Position_X.push_back(PositionX);} + void SetICPositionY(Double_t PositionY) {fIC_Position_Y.push_back(PositionY);} + void SetICPositionZ(Double_t PositionZ) {fIC_Position_Z.push_back(PositionZ);} // Theta and Phi angles for the emittance - void SetICIncidentEmittanceTheta(Double_t Theta) {fIC_Incident_Emittance_Theta.push_back(Theta);} - void SetICIncidentEmittancePhi(Double_t Phi) {fIC_Incident_Emittance_Phi.push_back(Phi);} + void SetICIncidentEmittanceTheta(Double_t Theta) {fIC_Incident_Emittance_Theta.push_back(Theta);} + void SetICIncidentEmittancePhi(Double_t Phi) {fIC_Incident_Emittance_Phi.push_back(Phi);} // Incident particle angles - void SetICIncidentAngleTheta(Double_t AngleTheta) {fIC_Incident_Angle_Theta.push_back(AngleTheta);} - void SetICIncidentAnglePhi(Double_t AnglePhi) {fIC_Incident_Angle_Phi.push_back(AnglePhi);} + void SetICIncidentAngleTheta(Double_t AngleTheta) {fIC_Incident_Angle_Theta.push_back(AngleTheta);} + void SetICIncidentAnglePhi(Double_t AnglePhi) {fIC_Incident_Angle_Phi.push_back(AnglePhi);} // Incident particle energy - void SetICIncidentEnergy(Double_t Energy) {fIC_Incident_Energy.push_back(Energy);} + void SetICIncidentEnergy(Double_t Energy) {fIC_Incident_Energy.push_back(Energy);} // Emitted particle angles // Center of mass - void SetICEmittedAngleThetaCM(Double_t AngleTheta) {fIC_Emitted_Angle_ThetaCM.push_back(AngleTheta);} + void SetICEmittedAngleThetaCM(Double_t AngleTheta) {fIC_Emitted_Angle_ThetaCM.push_back(AngleTheta);} // Angles in the incident frame - void SetICEmittedAngleThetaLabIncidentFrame(Double_t AngleTheta) {fIC_Emitted_Angle_ThetaLab_IncidentFrame.push_back(AngleTheta);} - void SetICEmittedAnglePhiIncidentFrame(Double_t AnglePhi) {fIC_Emitted_Angle_Phi_IncidentFrame.push_back(AnglePhi);} + void SetICEmittedAngleThetaLabIncidentFrame(Double_t AngleTheta) {fIC_Emitted_Angle_ThetaLab_IncidentFrame.push_back(AngleTheta);} + void SetICEmittedAnglePhiIncidentFrame(Double_t AnglePhi) {fIC_Emitted_Angle_Phi_IncidentFrame.push_back(AnglePhi);} // Angles in the world frame - void SetICEmittedAngleThetaLabWorldFrame(Double_t AngleTheta) {fIC_Emitted_Angle_ThetaLab_WorldFrame.push_back(AngleTheta);} - void SetICEmittedAnglePhiWorldFrame(Double_t AnglePhi) {fIC_Emitted_Angle_Phi_WorldFrame.push_back(AnglePhi);} + void SetICEmittedAngleThetaLabWorldFrame(Double_t AngleTheta) {fIC_Emitted_Angle_ThetaLab_WorldFrame.push_back(AngleTheta);} + void SetICEmittedAnglePhiWorldFrame(Double_t AnglePhi) {fIC_Emitted_Angle_Phi_WorldFrame.push_back(AnglePhi);} // Emitted particle energy - void SetICEmittedEnergy(Double_t Energy) {fIC_Emitted_Energy.push_back(Energy);} + void SetICEmittedEnergy(Double_t Energy) {fIC_Emitted_Energy.push_back(Energy);} ///////////////////// GETTERS //////////////////////// // Incident particle properties (before interactions in the target) // Vertex of interaction - Double_t GetICPositionX(Int_t i) {return fIC_Position_X.at(i);} - Double_t GetICPositionY(Int_t i) {return fIC_Position_Y.at(i);} - Double_t GetICPositionZ(Int_t i) {return fIC_Position_Z.at(i);} + Double_t GetICPositionX(Int_t i) {return fIC_Position_X.at(i);} + Double_t GetICPositionY(Int_t i) {return fIC_Position_Y.at(i);} + Double_t GetICPositionZ(Int_t i) {return fIC_Position_Z.at(i);} // Theta and Phi angles for the emittance - Double_t GetICIncidentEmittanceTheta(Int_t i) {return fIC_Incident_Emittance_Theta.at(i);} - Double_t GetICIncidentEmittancePhi(Int_t i) {return fIC_Incident_Emittance_Phi.at(i);} + Double_t GetICIncidentEmittanceTheta(Int_t i) {return fIC_Incident_Emittance_Theta.at(i);} + Double_t GetICIncidentEmittancePhi(Int_t i) {return fIC_Incident_Emittance_Phi.at(i);} // Incident particle angles - Double_t GetICIncidentAngleTheta(Int_t i) {return fIC_Incident_Angle_Theta.at(i);} - Double_t GetICIncidentAnglePhi(Int_t i) {return fIC_Incident_Angle_Phi.at(i);} + Double_t GetICIncidentAngleTheta(Int_t i) {return fIC_Incident_Angle_Theta.at(i);} + Double_t GetICIncidentAnglePhi(Int_t i) {return fIC_Incident_Angle_Phi.at(i);} // Incident particle energy - Double_t GetICIncidentEnergy(Int_t i) {return fIC_Incident_Energy.at(i);} + Double_t GetICIncidentEnergy(Int_t i) {return fIC_Incident_Energy.at(i);} // Emitted particle angles // Center of Mass - Double_t GetICEmittedAngleThetaCM(Int_t i) {return fIC_Emitted_Angle_ThetaCM.at(i);} + Double_t GetICEmittedAngleThetaCM(Int_t i) {return fIC_Emitted_Angle_ThetaCM.at(i);} // Angles in the incident frame - Double_t GetICEmittedAngleThetaLabIncidentFrame(Int_t i) {return fIC_Emitted_Angle_ThetaLab_IncidentFrame.at(i);} - Double_t GetICEmittedAnglePhiIncidentFrame(Int_t i) {return fIC_Emitted_Angle_Phi_IncidentFrame.at(i);} + Double_t GetICEmittedAngleThetaLabIncidentFrame(Int_t i) {return fIC_Emitted_Angle_ThetaLab_IncidentFrame.at(i);} + Double_t GetICEmittedAnglePhiIncidentFrame(Int_t i) {return fIC_Emitted_Angle_Phi_IncidentFrame.at(i);} // Angles in the world frame - Double_t GetICEmittedAngleThetaLabWorldFrame(Int_t i) {return fIC_Emitted_Angle_ThetaLab_WorldFrame.at(i);} - Double_t GetICEmittedAnglePhiWorldFrame(Int_t i) {return fIC_Emitted_Angle_Phi_WorldFrame.at(i);} + Double_t GetICEmittedAngleThetaLabWorldFrame(Int_t i) {return fIC_Emitted_Angle_ThetaLab_WorldFrame.at(i);} + Double_t GetICEmittedAnglePhiWorldFrame(Int_t i) {return fIC_Emitted_Angle_Phi_WorldFrame.at(i);} // Emitted particle energy - Double_t GetICEmittedEnergy(Int_t i) {return fIC_Emitted_Energy.at(i);} + Double_t GetICEmittedEnergy(Int_t i) {return fIC_Emitted_Energy.at(i);} ClassDef(TInitialConditions, 1) // InitialConditions structure }; diff --git a/NPLib/InteractionCoordinates/TInteractionCoordinates.h b/NPLib/InteractionCoordinates/TInteractionCoordinates.h index c3668039d9b5146942689c92086f95b0ff820aa6..2b9c9124cbe7209d260eb9e832b57672df196a54 100644 --- a/NPLib/InteractionCoordinates/TInteractionCoordinates.h +++ b/NPLib/InteractionCoordinates/TInteractionCoordinates.h @@ -35,12 +35,12 @@ class TInteractionCoordinates : public TObject private: // Detected particle properties (before interactions in the target) // Vertex of interaction - vector<Double_t> fDetected_Position_X; - vector<Double_t> fDetected_Position_Y; - vector<Double_t> fDetected_Position_Z; + vector<Double_t> fDetected_Position_X; + vector<Double_t> fDetected_Position_Y; + vector<Double_t> fDetected_Position_Z; // Particle angles - vector<Double_t> fDetected_Angle_Theta; - vector<Double_t> fDetected_Angle_Phi; + vector<Double_t> fDetected_Angle_Theta; + vector<Double_t> fDetected_Angle_Phi; public: @@ -57,24 +57,24 @@ public: ///////////////////// SETTERS //////////////////////// // Incident particle properties (before interactions in the target) // Vertex of interaction - void SetDetectedPositionX(Double_t PositionX) {fDetected_Position_X.push_back(PositionX);} - void SetDetectedPositionY(Double_t PositionY) {fDetected_Position_Y.push_back(PositionY);} - void SetDetectedPositionZ(Double_t PositionZ) {fDetected_Position_Z.push_back(PositionZ);} + void SetDetectedPositionX(Double_t PositionX) {fDetected_Position_X.push_back(PositionX);} + void SetDetectedPositionY(Double_t PositionY) {fDetected_Position_Y.push_back(PositionY);} + void SetDetectedPositionZ(Double_t PositionZ) {fDetected_Position_Z.push_back(PositionZ);} // Incident particle angles - void SetDetectedAngleTheta(Double_t AngleTheta) {fDetected_Angle_Theta.push_back(AngleTheta);} - void SetDetectedAnglePhi(Double_t AnglePhi) {fDetected_Angle_Phi.push_back(AnglePhi);} + void SetDetectedAngleTheta(Double_t AngleTheta) {fDetected_Angle_Theta.push_back(AngleTheta);} + void SetDetectedAnglePhi(Double_t AnglePhi) {fDetected_Angle_Phi.push_back(AnglePhi);} ///////////////////// GETTERS //////////////////////// // Number of interactions (multiplicity) - Int_t GetDetectedMultiplicity() {return fDetected_Position_X.size();} + Int_t GetDetectedMultiplicity() {return fDetected_Position_X.size();} // Incident particle properties (before interactions in the target) // Vertex of interaction - Double_t GetDetectedPositionX(Int_t i) {return fDetected_Position_X.at(i);} - Double_t GetDetectedPositionY(Int_t i) {return fDetected_Position_Y.at(i);} - Double_t GetDetectedPositionZ(Int_t i) {return fDetected_Position_Z.at(i);} + Double_t GetDetectedPositionX(Int_t i) {return fDetected_Position_X.at(i);} + Double_t GetDetectedPositionY(Int_t i) {return fDetected_Position_Y.at(i);} + Double_t GetDetectedPositionZ(Int_t i) {return fDetected_Position_Z.at(i);} // Incident particle angles - Double_t GetDetectedAngleTheta(Int_t i) {return fDetected_Angle_Theta.at(i);} - Double_t GetDetectedAnglePhi(Int_t i) {return fDetected_Angle_Phi.at(i);} + Double_t GetDetectedAngleTheta(Int_t i) {return fDetected_Angle_Theta.at(i);} + Double_t GetDetectedAnglePhi(Int_t i) {return fDetected_Angle_Phi.at(i);} ClassDef(TInteractionCoordinates, 1) // InteractionCoordinates structure }; diff --git a/NPLib/MUST2/TMust2Data.cxx b/NPLib/MUST2/TMust2Data.cxx index 50fc48303522d333d30489dff7fe3db2cade995d..bc84ca952fab6b4df7bb507497f642831836f721 100644 --- a/NPLib/MUST2/TMust2Data.cxx +++ b/NPLib/MUST2/TMust2Data.cxx @@ -28,43 +28,43 @@ ClassImp(TMust2Data) TMust2Data::TMust2Data() { - // Default constructor - - // DSSD - // (X,E) - fMM_StripXE_DetectorNbr.clear() ; - fMM_StripXE_StripNbr.clear() ; - fMM_StripXE_Energy.clear() ; - // (X,T) - fMM_StripXT_DetectorNbr.clear() ; - fMM_StripXT_StripNbr.clear() ; - fMM_StripXT_Time.clear() ; - // (Y,E) - fMM_StripYE_DetectorNbr.clear() ; - fMM_StripYE_StripNbr.clear() ; - fMM_StripYE_Energy.clear() ; - // (Y,T) - fMM_StripYT_DetectorNbr.clear() ; - fMM_StripYT_StripNbr.clear() ; - fMM_StripYT_Time.clear() ; - - // SiLi E - fMM_SiLiE_DetectorNbr.clear() ; - fMM_SiLiE_PadNbr.clear() ; - fMM_SiLiE_Energy.clear() ; - // SiLi T - fMM_SiLiT_DetectorNbr.clear() ; - fMM_SiLiT_PadNbr.clear() ; - fMM_SiLiT_Time.clear() ; - - // CsI E - fMM_CsIE_DetectorNbr.clear() ; - fMM_CsIE_CristalNbr.clear() ; - fMM_CsIE_Energy.clear() ; - // CsI T - fMM_CsIT_DetectorNbr.clear() ; - fMM_CsIT_CristalNbr.clear() ; - fMM_CsIT_Time.clear() ; + // Default constructor + + // DSSD + // (X,E) + fMM_StripXE_DetectorNbr.clear(); + fMM_StripXE_StripNbr.clear(); + fMM_StripXE_Energy.clear(); + // (X,T) + fMM_StripXT_DetectorNbr.clear(); + fMM_StripXT_StripNbr.clear(); + fMM_StripXT_Time.clear(); + // (Y,E) + fMM_StripYE_DetectorNbr.clear(); + fMM_StripYE_StripNbr.clear(); + fMM_StripYE_Energy.clear(); + // (Y,T) + fMM_StripYT_DetectorNbr.clear(); + fMM_StripYT_StripNbr.clear(); + fMM_StripYT_Time.clear(); + + // SiLi E + fMM_SiLiE_DetectorNbr.clear(); + fMM_SiLiE_PadNbr.clear(); + fMM_SiLiE_Energy.clear(); + // SiLi T + fMM_SiLiT_DetectorNbr.clear(); + fMM_SiLiT_PadNbr.clear(); + fMM_SiLiT_Time.clear(); + + // CsI E + fMM_CsIE_DetectorNbr.clear(); + fMM_CsIE_CristalNbr.clear() ; + fMM_CsIE_Energy.clear(); + // CsI T + fMM_CsIT_DetectorNbr.clear(); + fMM_CsIT_CristalNbr.clear(); + fMM_CsIT_Time.clear(); } TMust2Data::~TMust2Data() @@ -72,41 +72,41 @@ TMust2Data::~TMust2Data() void TMust2Data::Clear() { - // DSSD - // (X,E) - fMM_StripXE_DetectorNbr.clear() ; - fMM_StripXE_StripNbr.clear() ; - fMM_StripXE_Energy.clear() ; - // (X,T) - fMM_StripXT_DetectorNbr.clear() ; - fMM_StripXT_StripNbr.clear() ; - fMM_StripXT_Time.clear() ; - // (Y,E) - fMM_StripYE_DetectorNbr.clear() ; - fMM_StripYE_StripNbr.clear() ; - fMM_StripYE_Energy.clear() ; - // (Y,T) - fMM_StripYT_DetectorNbr.clear() ; - fMM_StripYT_StripNbr.clear() ; - fMM_StripYT_Time.clear() ; - - // SiLi E - fMM_SiLiE_DetectorNbr.clear() ; - fMM_SiLiE_PadNbr.clear() ; - fMM_SiLiE_Energy.clear() ; - // SiLi T - fMM_SiLiT_DetectorNbr.clear() ; - fMM_SiLiT_PadNbr.clear() ; - fMM_SiLiT_Time.clear() ; - - // CsI E - fMM_CsIE_DetectorNbr.clear() ; - fMM_CsIE_CristalNbr.clear() ; - fMM_CsIE_Energy.clear() ; - // CsI T - fMM_CsIT_DetectorNbr.clear() ; - fMM_CsIT_CristalNbr.clear() ; - fMM_CsIT_Time.clear() ; + // DSSD + // (X,E) + fMM_StripXE_DetectorNbr.clear(); + fMM_StripXE_StripNbr.clear(); + fMM_StripXE_Energy.clear(); + // (X,T) + fMM_StripXT_DetectorNbr.clear(); + fMM_StripXT_StripNbr.clear(); + fMM_StripXT_Time.clear(); + // (Y,E) + fMM_StripYE_DetectorNbr.clear(); + fMM_StripYE_StripNbr.clear(); + fMM_StripYE_Energy.clear(); + // (Y,T) + fMM_StripYT_DetectorNbr.clear(); + fMM_StripYT_StripNbr.clear(); + fMM_StripYT_Time.clear(); + + // SiLi E + fMM_SiLiE_DetectorNbr.clear(); + fMM_SiLiE_PadNbr.clear(); + fMM_SiLiE_Energy.clear(); + // SiLi T + fMM_SiLiT_DetectorNbr.clear(); + fMM_SiLiT_PadNbr.clear(); + fMM_SiLiT_Time.clear(); + + // CsI E + fMM_CsIE_DetectorNbr.clear(); + fMM_CsIE_CristalNbr.clear(); + fMM_CsIE_Energy.clear(); + // CsI T + fMM_CsIT_DetectorNbr.clear(); + fMM_CsIT_CristalNbr.clear(); + fMM_CsIT_Time.clear(); } diff --git a/NPLib/MUST2/TMust2Data.h b/NPLib/MUST2/TMust2Data.h index 1ee17b69a86bb78ea83684188097ba0eb2e353c0..2bdac82baf2e31d853ee556315564c168e6cef12 100644 --- a/NPLib/MUST2/TMust2Data.h +++ b/NPLib/MUST2/TMust2Data.h @@ -26,142 +26,142 @@ using namespace std ; class TMust2Data : public TObject { - private: - // DSSD - // X strips - // Energy - vector<UShort_t> fMM_StripXE_DetectorNbr; - vector<UShort_t> fMM_StripXE_StripNbr; - vector<Double_t> fMM_StripXE_Energy; - // Time - vector<UShort_t> fMM_StripXT_DetectorNbr; - vector<UShort_t> fMM_StripXT_StripNbr; - vector<Double_t> fMM_StripXT_Time; - // Y strips - // Energy - vector<UShort_t> fMM_StripYE_DetectorNbr; - vector<UShort_t> fMM_StripYE_StripNbr; - vector<Double_t> fMM_StripYE_Energy; - // Time - vector<UShort_t> fMM_StripYT_DetectorNbr; - vector<UShort_t> fMM_StripYT_StripNbr; - vector<Double_t> fMM_StripYT_Time; + private: + // DSSD + // X strips + // Energy + vector<UShort_t> fMM_StripXE_DetectorNbr; + vector<UShort_t> fMM_StripXE_StripNbr; + vector<Double_t> fMM_StripXE_Energy; + // Time + vector<UShort_t> fMM_StripXT_DetectorNbr; + vector<UShort_t> fMM_StripXT_StripNbr; + vector<Double_t> fMM_StripXT_Time; + // Y strips + // Energy + vector<UShort_t> fMM_StripYE_DetectorNbr; + vector<UShort_t> fMM_StripYE_StripNbr; + vector<Double_t> fMM_StripYE_Energy; + // Time + vector<UShort_t> fMM_StripYT_DetectorNbr; + vector<UShort_t> fMM_StripYT_StripNbr; + vector<Double_t> fMM_StripYT_Time; - // SiLi - // Energy - vector<UShort_t> fMM_SiLiE_DetectorNbr; - vector<UShort_t> fMM_SiLiE_PadNbr; - vector<Double_t> fMM_SiLiE_Energy; - // Time - vector<UShort_t> fMM_SiLiT_DetectorNbr; - vector<UShort_t> fMM_SiLiT_PadNbr; - vector<Double_t> fMM_SiLiT_Time; + // SiLi + // Energy + vector<UShort_t> fMM_SiLiE_DetectorNbr; + vector<UShort_t> fMM_SiLiE_PadNbr; + vector<Double_t> fMM_SiLiE_Energy; + // Time + vector<UShort_t> fMM_SiLiT_DetectorNbr; + vector<UShort_t> fMM_SiLiT_PadNbr; + vector<Double_t> fMM_SiLiT_Time; - // CsI - // Energy - vector<UShort_t> fMM_CsIE_DetectorNbr; - vector<UShort_t> fMM_CsIE_CristalNbr; - vector<Double_t> fMM_CsIE_Energy; - // Time - vector<UShort_t> fMM_CsIT_DetectorNbr; - vector<UShort_t> fMM_CsIT_CristalNbr; - vector<Double_t> fMM_CsIT_Time; + // CsI + // Energy + vector<UShort_t> fMM_CsIE_DetectorNbr; + vector<UShort_t> fMM_CsIE_CristalNbr; + vector<Double_t> fMM_CsIE_Energy; + // Time + vector<UShort_t> fMM_CsIT_DetectorNbr; + vector<UShort_t> fMM_CsIT_CristalNbr; + vector<Double_t> fMM_CsIT_Time; - public: - TMust2Data(); - virtual ~TMust2Data(); + public: + TMust2Data(); + virtual ~TMust2Data(); - void Clear(); + void Clear(); void Clear(const Option_t*) {}; - void Dump() const; + void Dump() const; - ///////////////////// SETTERS //////////////////////// - // DSSD - // (X,E) - void SetMMStripXEDetectorNbr(const UShort_t DetNbr) {fMM_StripXE_DetectorNbr.push_back(DetNbr);} - void SetMMStripXEStripNbr(const UShort_t StripNbr) {fMM_StripXE_StripNbr.push_back(StripNbr);} - void SetMMStripXEEnergy(const Double_t Energy) {fMM_StripXE_Energy.push_back(Energy);} - // (X,T) - void SetMMStripXTDetectorNbr(const UShort_t DetNbr) {fMM_StripXT_DetectorNbr.push_back(DetNbr);} - void SetMMStripXTStripNbr(const UShort_t StripNbr) {fMM_StripXT_StripNbr.push_back(StripNbr);} - void SetMMStripXTTime(const Double_t Time) {fMM_StripXT_Time.push_back(Time);} - // (Y,E) - void SetMMStripYEDetectorNbr(const UShort_t DetNbr) {fMM_StripYE_DetectorNbr.push_back(DetNbr);} - void SetMMStripYEStripNbr(const UShort_t StripNbr) {fMM_StripYE_StripNbr.push_back(StripNbr);} - void SetMMStripYEEnergy(const Double_t Energy) {fMM_StripYE_Energy.push_back(Energy);} - // (Y,T) - void SetMMStripYTDetectorNbr(const UShort_t DetNbr) {fMM_StripYT_DetectorNbr.push_back(DetNbr);} - void SetMMStripYTStripNbr(const UShort_t StripNbr) {fMM_StripYT_StripNbr.push_back(StripNbr);} - void SetMMStripYTTime(const Double_t Time) {fMM_StripYT_Time.push_back(Time);} + ///////////////////// SETTERS //////////////////////// + // DSSD + // (X,E) + void SetMMStripXEDetectorNbr(const UShort_t DetNbr) {fMM_StripXE_DetectorNbr.push_back(DetNbr);} + void SetMMStripXEStripNbr(const UShort_t StripNbr) {fMM_StripXE_StripNbr.push_back(StripNbr);} + void SetMMStripXEEnergy(const Double_t Energy) {fMM_StripXE_Energy.push_back(Energy);} + // (X,T) + void SetMMStripXTDetectorNbr(const UShort_t DetNbr) {fMM_StripXT_DetectorNbr.push_back(DetNbr);} + void SetMMStripXTStripNbr(const UShort_t StripNbr) {fMM_StripXT_StripNbr.push_back(StripNbr);} + void SetMMStripXTTime(const Double_t Time) {fMM_StripXT_Time.push_back(Time);} + // (Y,E) + void SetMMStripYEDetectorNbr(const UShort_t DetNbr) {fMM_StripYE_DetectorNbr.push_back(DetNbr);} + void SetMMStripYEStripNbr(const UShort_t StripNbr) {fMM_StripYE_StripNbr.push_back(StripNbr);} + void SetMMStripYEEnergy(const Double_t Energy) {fMM_StripYE_Energy.push_back(Energy);} + // (Y,T) + void SetMMStripYTDetectorNbr(const UShort_t DetNbr) {fMM_StripYT_DetectorNbr.push_back(DetNbr);} + void SetMMStripYTStripNbr(const UShort_t StripNbr) {fMM_StripYT_StripNbr.push_back(StripNbr);} + void SetMMStripYTTime(const Double_t Time) {fMM_StripYT_Time.push_back(Time);} - // SiLi - //(E) - void SetMMSiLiEDetectorNbr(const Short_t DetNbr) {fMM_SiLiE_DetectorNbr.push_back(DetNbr);} - void SetMMSiLiEPadNbr(const UShort_t PadNbr) {fMM_SiLiE_PadNbr.push_back(PadNbr);} - void SetMMSiLiEEnergy(const Double_t Energy) {fMM_SiLiE_Energy.push_back(Energy);} - //(T) - void SetMMSiLiTDetectorNbr(const UShort_t DetNbr) {fMM_SiLiT_DetectorNbr.push_back(DetNbr);} - void SetMMSiLiTPadNbr(const UShort_t PadNbr) {fMM_SiLiT_PadNbr.push_back(PadNbr);} - void SetMMSiLiTTime(const Double_t Time) {fMM_SiLiT_Time.push_back(Time);} + // SiLi + //(E) + void SetMMSiLiEDetectorNbr(const Short_t DetNbr) {fMM_SiLiE_DetectorNbr.push_back(DetNbr);} + void SetMMSiLiEPadNbr(const UShort_t PadNbr) {fMM_SiLiE_PadNbr.push_back(PadNbr);} + void SetMMSiLiEEnergy(const Double_t Energy) {fMM_SiLiE_Energy.push_back(Energy);} + //(T) + void SetMMSiLiTDetectorNbr(const UShort_t DetNbr) {fMM_SiLiT_DetectorNbr.push_back(DetNbr);} + void SetMMSiLiTPadNbr(const UShort_t PadNbr) {fMM_SiLiT_PadNbr.push_back(PadNbr);} + void SetMMSiLiTTime(const Double_t Time) {fMM_SiLiT_Time.push_back(Time);} - // CsI - // (E) - void SetMMCsIEDetectorNbr(const UShort_t DetNbr) {fMM_CsIE_DetectorNbr.push_back(DetNbr);} - void SetMMCsIECristalNbr(const UShort_t CristalNbr) {fMM_CsIE_CristalNbr.push_back(CristalNbr);} - void SetMMCsIEEnergy(const Double_t Energy) {fMM_CsIE_Energy.push_back(Energy);} - // (T) - void SetMMCsITDetectorNbr(const UShort_t DetNbr) {fMM_CsIT_DetectorNbr.push_back(DetNbr);} - void SetMMCsITCristalNbr(const UShort_t CristalNbr) {fMM_CsIT_CristalNbr.push_back(CristalNbr);} - void SetMMCsITTime(const Double_t Time) {fMM_CsIT_Time.push_back(Time);} + // CsI + // (E) + void SetMMCsIEDetectorNbr(const UShort_t DetNbr) {fMM_CsIE_DetectorNbr.push_back(DetNbr);} + void SetMMCsIECristalNbr(const UShort_t CristalNbr) {fMM_CsIE_CristalNbr.push_back(CristalNbr);} + void SetMMCsIEEnergy(const Double_t Energy) {fMM_CsIE_Energy.push_back(Energy);} + // (T) + void SetMMCsITDetectorNbr(const UShort_t DetNbr) {fMM_CsIT_DetectorNbr.push_back(DetNbr);} + void SetMMCsITCristalNbr(const UShort_t CristalNbr) {fMM_CsIT_CristalNbr.push_back(CristalNbr);} + void SetMMCsITTime(const Double_t Time) {fMM_CsIT_Time.push_back(Time);} - ///////////////////// GETTERS //////////////////////// - // DSSD - // (X,E) - UShort_t GetMMStripXEMult() const {return fMM_StripXE_DetectorNbr.size();} - UShort_t GetMMStripXEDetectorNbr(const Int_t i) const {return fMM_StripXE_DetectorNbr[i];} - UShort_t GetMMStripXEStripNbr(const Int_t i) const {return fMM_StripXE_StripNbr[i];} - Double_t GetMMStripXEEnergy(const Int_t i) const {return fMM_StripXE_Energy[i];} - // (X,T) - UShort_t GetMMStripXTMult() const {return fMM_StripXT_DetectorNbr.size();} - UShort_t GetMMStripXTDetectorNbr(const Int_t i) const {return fMM_StripXT_DetectorNbr[i];} - UShort_t GetMMStripXTStripNbr(const Int_t i) const {return fMM_StripXT_StripNbr[i];} - Double_t GetMMStripXTTime(const Int_t i) const {return fMM_StripXT_Time[i];} - // (Y,E) - UShort_t GetMMStripYEMult() const {return fMM_StripYE_DetectorNbr.size();} - UShort_t GetMMStripYEDetectorNbr(const Int_t i) const {return fMM_StripYE_DetectorNbr[i];} - UShort_t GetMMStripYEStripNbr(const Int_t i) const {return fMM_StripYE_StripNbr[i];} - Double_t GetMMStripYEEnergy(const Int_t i) const {return fMM_StripYE_Energy[i];} - // (Y,T) - UShort_t GetMMStripYTMult() const {return fMM_StripYT_DetectorNbr.size();} - UShort_t GetMMStripYTDetectorNbr(const Int_t i) const {return fMM_StripYT_DetectorNbr[i];} - UShort_t GetMMStripYTStripNbr(const Int_t i) const {return fMM_StripYT_StripNbr[i];} - Double_t GetMMStripYTTime(const Int_t i) const {return fMM_StripYT_Time[i];} + ///////////////////// GETTERS //////////////////////// + // DSSD + // (X,E) + UShort_t GetMMStripXEMult() const {return fMM_StripXE_DetectorNbr.size();} + UShort_t GetMMStripXEDetectorNbr(const Int_t i) const {return fMM_StripXE_DetectorNbr[i];} + UShort_t GetMMStripXEStripNbr(const Int_t i) const {return fMM_StripXE_StripNbr[i];} + Double_t GetMMStripXEEnergy(const Int_t i) const {return fMM_StripXE_Energy[i];} + // (X,T) + UShort_t GetMMStripXTMult() const {return fMM_StripXT_DetectorNbr.size();} + UShort_t GetMMStripXTDetectorNbr(const Int_t i) const {return fMM_StripXT_DetectorNbr[i];} + UShort_t GetMMStripXTStripNbr(const Int_t i) const {return fMM_StripXT_StripNbr[i];} + Double_t GetMMStripXTTime(const Int_t i) const {return fMM_StripXT_Time[i];} + // (Y,E) + UShort_t GetMMStripYEMult() const {return fMM_StripYE_DetectorNbr.size();} + UShort_t GetMMStripYEDetectorNbr(const Int_t i) const {return fMM_StripYE_DetectorNbr[i];} + UShort_t GetMMStripYEStripNbr(const Int_t i) const {return fMM_StripYE_StripNbr[i];} + Double_t GetMMStripYEEnergy(const Int_t i) const {return fMM_StripYE_Energy[i];} + // (Y,T) + UShort_t GetMMStripYTMult() const {return fMM_StripYT_DetectorNbr.size();} + UShort_t GetMMStripYTDetectorNbr(const Int_t i) const {return fMM_StripYT_DetectorNbr[i];} + UShort_t GetMMStripYTStripNbr(const Int_t i) const {return fMM_StripYT_StripNbr[i];} + Double_t GetMMStripYTTime(const Int_t i) const {return fMM_StripYT_Time[i];} - // SiLi - //(E) - UShort_t GetMMSiLiEMult() const {return fMM_SiLiE_DetectorNbr.size();} - UShort_t GetMMSiLiEDetectorNbr(const Int_t i) const {return fMM_SiLiE_DetectorNbr[i];} - UShort_t GetMMSiLiEPadNbr(const Int_t i) const {return fMM_SiLiE_PadNbr[i];} - Double_t GetMMSiLiEEnergy(const Int_t i) const {return fMM_SiLiE_Energy[i];} - //(T) - UShort_t GetMMSiLiTMult() const {return fMM_SiLiT_DetectorNbr.size();} - UShort_t GetMMSiLiTDetectorNbr(const Int_t i) const {return fMM_SiLiT_DetectorNbr[i];} - UShort_t GetMMSiLiTPadNbr(const Int_t i) const {return fMM_SiLiT_PadNbr[i];} - Double_t GetMMSiLiTTime(const Int_t i) const {return fMM_SiLiT_Time[i];} + // SiLi + //(E) + UShort_t GetMMSiLiEMult() const {return fMM_SiLiE_DetectorNbr.size();} + UShort_t GetMMSiLiEDetectorNbr(const Int_t i) const {return fMM_SiLiE_DetectorNbr[i];} + UShort_t GetMMSiLiEPadNbr(const Int_t i) const {return fMM_SiLiE_PadNbr[i];} + Double_t GetMMSiLiEEnergy(const Int_t i) const {return fMM_SiLiE_Energy[i];} + //(T) + UShort_t GetMMSiLiTMult() const {return fMM_SiLiT_DetectorNbr.size();} + UShort_t GetMMSiLiTDetectorNbr(const Int_t i) const {return fMM_SiLiT_DetectorNbr[i];} + UShort_t GetMMSiLiTPadNbr(const Int_t i) const {return fMM_SiLiT_PadNbr[i];} + Double_t GetMMSiLiTTime(const Int_t i) const {return fMM_SiLiT_Time[i];} - // CsI - //(E) - UShort_t GetMMCsIEMult() const {return fMM_CsIE_DetectorNbr.size();} - UShort_t GetMMCsIEDetectorNbr(const Int_t i) const {return fMM_CsIE_DetectorNbr[i];} - UShort_t GetMMCsIECristalNbr(const Int_t i) const {return fMM_CsIE_CristalNbr[i];} - Double_t GetMMCsIEEnergy(const Int_t i) const {return fMM_CsIE_Energy[i];} - //(T) - UShort_t GetMMCsITMult() const {return fMM_CsIT_DetectorNbr.size();} - UShort_t GetMMCsITDetectorNbr(const Int_t i) const {return fMM_CsIT_DetectorNbr[i];} - UShort_t GetMMCsITCristalNbr(const Int_t i) const {return fMM_CsIT_CristalNbr[i];} - Double_t GetMMCsITTime(const Int_t i) const {return fMM_CsIT_Time[i];} + // CsI + //(E) + UShort_t GetMMCsIEMult() const {return fMM_CsIE_DetectorNbr.size();} + UShort_t GetMMCsIEDetectorNbr(const Int_t i) const {return fMM_CsIE_DetectorNbr[i];} + UShort_t GetMMCsIECristalNbr(const Int_t i) const {return fMM_CsIE_CristalNbr[i];} + Double_t GetMMCsIEEnergy(const Int_t i) const {return fMM_CsIE_Energy[i];} + //(T) + UShort_t GetMMCsITMult() const {return fMM_CsIT_DetectorNbr.size();} + UShort_t GetMMCsITDetectorNbr(const Int_t i) const {return fMM_CsIT_DetectorNbr[i];} + UShort_t GetMMCsITCristalNbr(const Int_t i) const {return fMM_CsIT_CristalNbr[i];} + Double_t GetMMCsITTime(const Int_t i) const {return fMM_CsIT_Time[i];} - ClassDef(TMust2Data,2) // Must2Data structure + ClassDef(TMust2Data,2) // Must2Data structure }; #endif diff --git a/NPLib/MUST2/TMust2Physics.cxx b/NPLib/MUST2/TMust2Physics.cxx index 9742a6e26fe404ad1b43f17c0c652ca490b69f45..cd4ad87f31f64e14beb97f9e4b70c599f1270fbc 100644 --- a/NPLib/MUST2/TMust2Physics.cxx +++ b/NPLib/MUST2/TMust2Physics.cxx @@ -20,523 +20,521 @@ *****************************************************************************/ #include "TMust2Physics.h" using namespace MUST2_LOCAL; - -// STL + +// STL #include <sstream> #include <iostream> #include <cmath> #include <stdlib.h> #include <limits> -// NPL +// NPL #include "RootInput.h" #include "RootOutput.h" #include "TAsciiFile.h" -// ROOT +// ROOT #include "TChain.h" /////////////////////////////////////////////////////////////////////////// ClassImp(TMust2Physics) /////////////////////////////////////////////////////////////////////////// TMust2Physics::TMust2Physics() - { - EventMultiplicity = 0 ; - m_EventData = new TMust2Data ; - m_PreTreatedData = new TMust2Data ; - m_EventPhysics = this ; - m_NumberOfTelescope = 0 ; - m_MaximumStripMultiplicityAllowed = 10; - m_StripEnergyMatchingSigma = 0.020 ; - m_StripEnergyMatchingNumberOfSigma = 3; + { + EventMultiplicity = 0 ; + m_EventData = new TMust2Data ; + m_PreTreatedData = new TMust2Data ; + m_EventPhysics = this ; + m_NumberOfTelescope = 0 ; + m_MaximumStripMultiplicityAllowed = 10; + m_StripEnergyMatchingSigma = 0.020 ; + m_StripEnergyMatchingNumberOfSigma = 3; // Raw Threshold - m_Si_X_E_RAW_Threshold = 8200 ; - m_Si_Y_E_RAW_Threshold = 8200 ; - m_SiLi_E_RAW_Threshold = 8200 ; - m_CsI_E_RAW_Threshold = 8200 ; - // Calibrated Threshold - m_Si_X_E_Threshold = 0 ; - m_Si_Y_E_Threshold = 0 ; - m_SiLi_E_Threshold = 0 ; - m_CsI_E_Threshold = 0 ; + m_Si_X_E_RAW_Threshold = 8200 ; + m_Si_Y_E_RAW_Threshold = 8200 ; + m_SiLi_E_RAW_Threshold = 8200 ; + m_CsI_E_RAW_Threshold = 8200 ; + // Calibrated Threshold + m_Si_X_E_Threshold = 0 ; + m_Si_Y_E_Threshold = 0 ; + m_SiLi_E_Threshold = 0 ; + m_CsI_E_Threshold = 0; - m_Ignore_not_matching_SiLi = false ; - m_Ignore_not_matching_CsI = false ; - - m_Take_E_Y=false; - m_Take_T_Y=true; - - m_SiLi_Size=32; - m_SiLi_MatchingX.resize(16,0); - m_SiLi_MatchingY.resize(16,0); - - for(int i = 0 ; i < 16 ; ++i) - { - m_SiLi_MatchingX[0]=112; - m_SiLi_MatchingY[0]=112; - - m_SiLi_MatchingX[1]=112; - m_SiLi_MatchingY[1]=80; - - m_SiLi_MatchingX[2]=80; - m_SiLi_MatchingY[2]=112; - - m_SiLi_MatchingX[3]=80; - m_SiLi_MatchingY[3]=80; - // - m_SiLi_MatchingX[4]=48; - m_SiLi_MatchingY[4]=80; - - m_SiLi_MatchingX[5]=48; - m_SiLi_MatchingY[5]=112; - - m_SiLi_MatchingX[6]=16; - m_SiLi_MatchingY[6]=80; - - m_SiLi_MatchingX[7]=16; - m_SiLi_MatchingY[7]=112; - // - m_SiLi_MatchingX[8]=112; - m_SiLi_MatchingY[8]=16; - - m_SiLi_MatchingX[9]=112; - m_SiLi_MatchingY[9]=48; - - m_SiLi_MatchingX[10]=80; - m_SiLi_MatchingY[10]=16; - - m_SiLi_MatchingX[11]=80; - m_SiLi_MatchingY[11]=48; - // - m_SiLi_MatchingX[12]=48; - m_SiLi_MatchingY[12]=48; - - m_SiLi_MatchingX[13]=48; - m_SiLi_MatchingY[13]=16; - - m_SiLi_MatchingX[14]=16; - m_SiLi_MatchingY[14]=48; - - m_SiLi_MatchingX[15]=16; - m_SiLi_MatchingY[15]=16; + m_Ignore_not_matching_SiLi = false ; + m_Ignore_not_matching_CsI = false ; + + m_Take_E_Y=false; + m_Take_T_Y=true; + + m_SiLi_Size=32; + m_SiLi_MatchingX.resize(16,0); + m_SiLi_MatchingY.resize(16,0); + + for(int i = 0 ; i < 16 ; ++i) + { + m_SiLi_MatchingX[0]=112; + m_SiLi_MatchingY[0]=112; + + m_SiLi_MatchingX[1]=112; + m_SiLi_MatchingY[1]=80; + + m_SiLi_MatchingX[2]=80; + m_SiLi_MatchingY[2]=112; + + m_SiLi_MatchingX[3]=80; + m_SiLi_MatchingY[3]=80; + // + m_SiLi_MatchingX[4]=48; + m_SiLi_MatchingY[4]=80; + + m_SiLi_MatchingX[5]=48; + m_SiLi_MatchingY[5]=112; + + m_SiLi_MatchingX[6]=16; + m_SiLi_MatchingY[6]=80; + + m_SiLi_MatchingX[7]=16; + m_SiLi_MatchingY[7]=112; + // + m_SiLi_MatchingX[8]=112; + m_SiLi_MatchingY[8]=16; + + m_SiLi_MatchingX[9]=112; + m_SiLi_MatchingY[9]=48; + + m_SiLi_MatchingX[10]=80; + m_SiLi_MatchingY[10]=16; + + m_SiLi_MatchingX[11]=80; + m_SiLi_MatchingY[11]=48; + // + m_SiLi_MatchingX[12]=48; + m_SiLi_MatchingY[12]=48; + + m_SiLi_MatchingX[13]=48; + m_SiLi_MatchingY[13]=16; + + m_SiLi_MatchingX[14]=16; + m_SiLi_MatchingY[14]=48; + + m_SiLi_MatchingX[15]=16; + m_SiLi_MatchingY[15]=16; } - m_CsI_Size=32; - m_CsI_MatchingX.resize(16,0); - m_CsI_MatchingY.resize(16,0); - for(int i = 0 ; i < 16 ; ++i) - { - m_CsI_MatchingX[0]=112; - m_CsI_MatchingY[0]=112; - - m_CsI_MatchingX[1]=112; - m_CsI_MatchingY[1]=80; - - m_CsI_MatchingX[2]=112; - m_CsI_MatchingY[2]=48; - - m_CsI_MatchingX[3]=112; - m_CsI_MatchingY[3]=16; - // - m_CsI_MatchingX[4]=80; - m_CsI_MatchingY[4]=16; - - m_CsI_MatchingX[5]=80; - m_CsI_MatchingY[5]=48; - - m_CsI_MatchingX[6]=80; - m_CsI_MatchingY[6]=80; - - m_CsI_MatchingX[7]=80; - m_CsI_MatchingY[7]=112; - // - m_CsI_MatchingX[8]=48; - m_CsI_MatchingY[8]=16; - - m_CsI_MatchingX[9]=48; - m_CsI_MatchingY[9]=48; - - m_CsI_MatchingX[10]=48; - m_CsI_MatchingY[10]=80; - - m_CsI_MatchingX[11]=48; - m_CsI_MatchingY[11]=112; - // - m_CsI_MatchingX[12]=16; - m_CsI_MatchingY[12]=16; - - m_CsI_MatchingX[13]=16; - m_CsI_MatchingY[13]=48; - - m_CsI_MatchingX[14]=16; - m_CsI_MatchingY[14]=80; - - m_CsI_MatchingX[15]=16; - m_CsI_MatchingY[15]=112; + m_CsI_Size=32; + m_CsI_MatchingX.resize(16,0); + m_CsI_MatchingY.resize(16,0); + for(int i = 0 ; i < 16 ; ++i) + { + m_CsI_MatchingX[0]=112; + m_CsI_MatchingY[0]=112; + + m_CsI_MatchingX[1]=112; + m_CsI_MatchingY[1]=80; + + m_CsI_MatchingX[2]=112; + m_CsI_MatchingY[2]=48; + + m_CsI_MatchingX[3]=112; + m_CsI_MatchingY[3]=16; + // + m_CsI_MatchingX[4]=80; + m_CsI_MatchingY[4]=16; + + m_CsI_MatchingX[5]=80; + m_CsI_MatchingY[5]=48; + + m_CsI_MatchingX[6]=80; + m_CsI_MatchingY[6]=80; + + m_CsI_MatchingX[7]=80; + m_CsI_MatchingY[7]=112; + // + m_CsI_MatchingX[8]=48; + m_CsI_MatchingY[8]=16; + + m_CsI_MatchingX[9]=48; + m_CsI_MatchingY[9]=48; + + m_CsI_MatchingX[10]=48; + m_CsI_MatchingY[10]=80; + + m_CsI_MatchingX[11]=48; + m_CsI_MatchingY[11]=112; + // + m_CsI_MatchingX[12]=16; + m_CsI_MatchingY[12]=16; + + m_CsI_MatchingX[13]=16; + m_CsI_MatchingY[13]=48; + + m_CsI_MatchingX[14]=16; + m_CsI_MatchingY[14]=80; + + m_CsI_MatchingX[15]=16; + m_CsI_MatchingY[15]=112; } - - } - + + } + /////////////////////////////////////////////////////////////////////////// void TMust2Physics::BuildSimplePhysicalEvent() - { - BuildPhysicalEvent(); - } - + { + BuildPhysicalEvent(); + } + /////////////////////////////////////////////////////////////////////////// - + void TMust2Physics::BuildPhysicalEvent() - { - PreTreat(); - - bool check_SILI = false ; - bool check_CSI = false ; - - if( CheckEvent() == 1 ) - { - vector< TVector2 > couple = Match_X_Y() ; - EventMultiplicity = couple.size(); - for(unsigned int i = 0 ; i < couple.size() ; ++i) - { - check_SILI = false ; - check_CSI = false ; - - int N = m_PreTreatedData->GetMMStripXEDetectorNbr(couple[i].X()) ; - - int X = m_PreTreatedData->GetMMStripXEStripNbr(couple[i].X()) ; - int Y = m_PreTreatedData->GetMMStripYEStripNbr(couple[i].Y()) ; - - double Si_X_E = m_PreTreatedData->GetMMStripXEEnergy( couple[i].X() ) ; - double Si_Y_E = m_PreTreatedData->GetMMStripYEEnergy( couple[i].Y() ) ; - - - // Search for associate Time - double Si_X_T = -1000 ; - for(unsigned int t = 0 ; t < m_PreTreatedData->GetMMStripXTMult() ; ++t ) - { - if( m_PreTreatedData->GetMMStripXTStripNbr( couple[i].X() ) == m_PreTreatedData->GetMMStripXTStripNbr(t) - ||m_PreTreatedData->GetMMStripXTDetectorNbr( couple[i].X() ) == m_PreTreatedData->GetMMStripXTDetectorNbr(t)) - Si_X_T = m_PreTreatedData->GetMMStripXTTime(t); - } - - double Si_Y_T = -1000 ; - for(unsigned int t = 0 ; t < m_PreTreatedData->GetMMStripYTMult() ; ++t ) - { - if( m_PreTreatedData->GetMMStripYTStripNbr( couple[i].Y() ) == m_PreTreatedData->GetMMStripYTStripNbr(t) - ||m_PreTreatedData->GetMMStripYTDetectorNbr( couple[i].Y() ) == m_PreTreatedData->GetMMStripYTDetectorNbr(t)) - Si_Y_T = m_PreTreatedData->GetMMStripYTTime(t); - } - - Si_X.push_back(X) ; Si_Y.push_back(Y) ; TelescopeNumber.push_back(N) ; - - if(m_Take_E_Y) Si_E.push_back(Si_Y_E); - else Si_E.push_back(Si_X_E); - - if(m_Take_T_Y) Si_T.push_back(Si_Y_T) ; - else Si_T.push_back(Si_X_T) ; - - // Store the other value for checking purpose - Si_EX.push_back(Si_X_E); ; - Si_TX.push_back(Si_X_T); ; - - Si_EY.push_back(Si_Y_E); ; - Si_TY.push_back(Si_Y_T); ; - - for(unsigned int j = 0 ; j < m_PreTreatedData->GetMMSiLiEMult() ; ++j) - { - if(m_PreTreatedData->GetMMSiLiEDetectorNbr(j)==N) - { - // pad vs strip number match - if( Match_Si_SiLi( X, Y , m_PreTreatedData->GetMMSiLiEPadNbr(j) ) ) - { - SiLi_N.push_back(m_PreTreatedData->GetMMSiLiEPadNbr(j)) ; - SiLi_E.push_back(m_PreTreatedData->GetMMSiLiEEnergy(j)) ; - - // Look for associate time - // Note: in case of use of SiLi "Orsay" time is not coded. - for(int k =0 ; k < m_PreTreatedData->GetMMSiLiTMult() ; ++k) - { - // Same Pad, same Detector - if( m_PreTreatedData->GetMMSiLiEPadNbr(j)==m_PreTreatedData->GetMMSiLiTPadNbr(k) && m_PreTreatedData->GetMMSiLiEDetectorNbr(j)==m_PreTreatedData->GetMMSiLiTDetectorNbr(k) ) - { SiLi_T.push_back( m_PreTreatedData->GetMMSiLiTTime(k) ) ; break ;} - } - - check_SILI = true ; - - } - - } - } - - for( int j = 0 ; j < m_PreTreatedData->GetMMCsIEMult() ; ++j) - { - - if(m_PreTreatedData->GetMMCsIEDetectorNbr(j)==N) - { - if(Match_Si_CsI( X, Y , m_PreTreatedData->GetMMCsIECristalNbr(j) ) ) - { - CsI_N.push_back( m_PreTreatedData->GetMMCsIECristalNbr(j) ) ; - CsI_E.push_back( m_PreTreatedData->GetMMCsIEEnergy(j) ) ; - - // Look for associate Time - for(int k =0 ; k < m_PreTreatedData->GetMMCsITMult() ; ++k) - { - // Same Cristal; Same Detector - if( m_PreTreatedData->GetMMCsIECristalNbr(j)==m_PreTreatedData->GetMMCsITCristalNbr(k) && m_PreTreatedData->GetMMCsIEDetectorNbr(j)==m_PreTreatedData->GetMMCsITDetectorNbr(k) ) - { CsI_T.push_back( m_PreTreatedData->GetMMCsITTime(j) ) ; break ;} - } - - check_CSI = true ; - } - - } - } - - - if(!check_SILI) - { - SiLi_N.push_back(0) ; - SiLi_E.push_back(-1000) ; - SiLi_T.push_back(-1000) ; - } - - if(!check_CSI) - { - CsI_N.push_back(0) ; - CsI_E.push_back(-1000) ; - CsI_T.push_back(-1000) ; - } - - } - } - - return; - - } + { + PreTreat(); + + bool check_SILI = false ; + bool check_CSI = false ; + + if( CheckEvent() == 1 ) + { + vector< TVector2 > couple = Match_X_Y() ; + EventMultiplicity = couple.size(); + for(unsigned int i = 0 ; i < couple.size() ; ++i) + { + check_SILI = false ; + check_CSI = false ; + + int N = m_PreTreatedData->GetMMStripXEDetectorNbr(couple[i].X()) ; + + int X = m_PreTreatedData->GetMMStripXEStripNbr(couple[i].X()) ; + int Y = m_PreTreatedData->GetMMStripYEStripNbr(couple[i].Y()) ; + + double Si_X_E = m_PreTreatedData->GetMMStripXEEnergy( couple[i].X() ) ; + double Si_Y_E = m_PreTreatedData->GetMMStripYEEnergy( couple[i].Y() ) ; + + // Search for associate Time + double Si_X_T = -1000 ; + for(unsigned int t = 0 ; t < m_PreTreatedData->GetMMStripXTMult() ; ++t ) + { + if( m_PreTreatedData->GetMMStripXTStripNbr( couple[i].X() ) == m_PreTreatedData->GetMMStripXTStripNbr(t) + ||m_PreTreatedData->GetMMStripXTDetectorNbr( couple[i].X() ) == m_PreTreatedData->GetMMStripXTDetectorNbr(t)) + Si_X_T = m_PreTreatedData->GetMMStripXTTime(t); + } + + double Si_Y_T = -1000 ; + for(unsigned int t = 0 ; t < m_PreTreatedData->GetMMStripYTMult() ; ++t ) + { + if( m_PreTreatedData->GetMMStripYTStripNbr( couple[i].Y() ) == m_PreTreatedData->GetMMStripYTStripNbr(t) + ||m_PreTreatedData->GetMMStripYTDetectorNbr( couple[i].Y() ) == m_PreTreatedData->GetMMStripYTDetectorNbr(t)) + Si_Y_T = m_PreTreatedData->GetMMStripYTTime(t); + } + + Si_X.push_back(X) ; Si_Y.push_back(Y) ; TelescopeNumber.push_back(N) ; + + if(m_Take_E_Y) Si_E.push_back(Si_Y_E); + else Si_E.push_back(Si_X_E); + + if(m_Take_T_Y) Si_T.push_back(Si_Y_T); + else Si_T.push_back(Si_X_T); + + // Store the other value for checking purpose + Si_EX.push_back(Si_X_E); ; + Si_TX.push_back(Si_X_T); ; + + Si_EY.push_back(Si_Y_E); ; + Si_TY.push_back(Si_Y_T); ; + + for(unsigned int j = 0 ; j < m_PreTreatedData->GetMMSiLiEMult() ; ++j) + { + if(m_PreTreatedData->GetMMSiLiEDetectorNbr(j)==N) + { + // pad vs strip number match + if( Match_Si_SiLi( X, Y , m_PreTreatedData->GetMMSiLiEPadNbr(j) ) ) + { + SiLi_N.push_back(m_PreTreatedData->GetMMSiLiEPadNbr(j)) ; + SiLi_E.push_back(m_PreTreatedData->GetMMSiLiEEnergy(j)) ; + + // Look for associate time + // Note: in case of use of SiLi "Orsay" time is not coded. + for(int k =0 ; k < m_PreTreatedData->GetMMSiLiTMult() ; ++k) + { + // Same Pad, same Detector + if( m_PreTreatedData->GetMMSiLiEPadNbr(j)==m_PreTreatedData->GetMMSiLiTPadNbr(k) && m_PreTreatedData->GetMMSiLiEDetectorNbr(j)==m_PreTreatedData->GetMMSiLiTDetectorNbr(k) ) + { SiLi_T.push_back( m_PreTreatedData->GetMMSiLiTTime(k) ) ; break ;} + } + + check_SILI = true ; + + } + + } + } + + for( int j = 0 ; j < m_PreTreatedData->GetMMCsIEMult() ; ++j) + { + + if(m_PreTreatedData->GetMMCsIEDetectorNbr(j)==N) + { + if(Match_Si_CsI( X, Y , m_PreTreatedData->GetMMCsIECristalNbr(j) ) ) + { + CsI_N.push_back( m_PreTreatedData->GetMMCsIECristalNbr(j) ) ; + CsI_E.push_back( m_PreTreatedData->GetMMCsIEEnergy(j) ) ; + + // Look for associate Time + for(int k =0 ; k < m_PreTreatedData->GetMMCsITMult() ; ++k) + { + // Same Cristal; Same Detector + if( m_PreTreatedData->GetMMCsIECristalNbr(j)==m_PreTreatedData->GetMMCsITCristalNbr(k) && m_PreTreatedData->GetMMCsIEDetectorNbr(j)==m_PreTreatedData->GetMMCsITDetectorNbr(k) ) + { CsI_T.push_back( m_PreTreatedData->GetMMCsITTime(j) ) ; break ;} + } + + check_CSI = true ; + } + + } + } + + + if(!check_SILI) + { + SiLi_N.push_back(0) ; + SiLi_E.push_back(-1000) ; + SiLi_T.push_back(-1000) ; + } + + if(!check_CSI) + { + CsI_N.push_back(0) ; + CsI_E.push_back(-1000) ; + CsI_T.push_back(-1000) ; + } + + } + } + + return; + + } /////////////////////////////////////////////////////////////////////////// void TMust2Physics::PreTreat() - { - ClearPreTreatedData(); - - // X - // E - for(int i = 0 ; i < m_EventData->GetMMStripXEMult() ; ++i) - { - if( m_EventData->GetMMStripXEEnergy(i)>m_Si_X_E_RAW_Threshold && IsValidChannel("X", m_EventData->GetMMStripXEDetectorNbr(i), m_EventData->GetMMStripXEStripNbr(i)) ) - { - double EX = fSi_X_E(m_EventData , i); - if( EX > m_Si_X_E_Threshold ) - { - m_PreTreatedData->SetMMStripXEDetectorNbr( m_EventData->GetMMStripXEDetectorNbr(i) ) ; - m_PreTreatedData->SetMMStripXEStripNbr( m_EventData->GetMMStripXEStripNbr(i) ) ; - m_PreTreatedData->SetMMStripXEEnergy( EX ) ; - } - - } - } - - // T - for(int i = 0 ; i < m_EventData->GetMMStripXTMult() ; ++i) - { - if(IsValidChannel("X", m_EventData->GetMMStripXTDetectorNbr(i), m_EventData->GetMMStripXTStripNbr(i))) - { - m_PreTreatedData->SetMMStripXTDetectorNbr( m_EventData->GetMMStripXTDetectorNbr(i) ) ; - m_PreTreatedData->SetMMStripXTStripNbr( m_EventData->GetMMStripXTStripNbr(i) ) ; - m_PreTreatedData->SetMMStripXTTime( fSi_X_T(m_EventData , i) ) ; - } - } - - - // Y - // E - for(int i = 0 ; i < m_EventData->GetMMStripYEMult() ; ++i) - { - if( m_EventData->GetMMStripYEEnergy(i)<m_Si_Y_E_RAW_Threshold && IsValidChannel("Y", m_EventData->GetMMStripYEDetectorNbr(i), m_EventData->GetMMStripYEStripNbr(i))) - { - double EY = fSi_Y_E(m_EventData , i); - if( EY >m_Si_Y_E_Threshold ) - { - m_PreTreatedData->SetMMStripYEDetectorNbr( m_EventData->GetMMStripYEDetectorNbr(i) ) ; - m_PreTreatedData->SetMMStripYEStripNbr( m_EventData->GetMMStripYEStripNbr(i) ) ; - m_PreTreatedData->SetMMStripYEEnergy( EY ) ; - } - } - } - - // T - for(int i = 0 ; i < m_EventData->GetMMStripYTMult() ; ++i) - { - if(IsValidChannel("Y", m_EventData->GetMMStripYTDetectorNbr(i), m_EventData->GetMMStripYTStripNbr(i))) - { - m_PreTreatedData->SetMMStripYTDetectorNbr( m_EventData->GetMMStripYTDetectorNbr(i) ) ; - m_PreTreatedData->SetMMStripYTStripNbr( m_EventData->GetMMStripYTStripNbr(i) ) ; - m_PreTreatedData->SetMMStripYTTime( fSi_Y_T(m_EventData , i) ) ; - } - } - - - // CsI - // E - for(int i = 0 ; i < m_EventData->GetMMCsIEMult() ; ++i) - { - - if( m_EventData->GetMMCsIEEnergy(i)>m_CsI_E_RAW_Threshold && IsValidChannel("CsI", m_EventData->GetMMCsIEDetectorNbr(i), m_EventData->GetMMCsIECristalNbr(i))) - { - double ECsI = fCsI_E(m_EventData , i); - if( ECsI > m_CsI_E_Threshold ) - { - m_PreTreatedData->SetMMCsIEDetectorNbr( m_EventData->GetMMCsIEDetectorNbr(i) ) ; - m_PreTreatedData->SetMMCsIECristalNbr( m_EventData->GetMMCsIECristalNbr(i) ) ; - m_PreTreatedData->SetMMCsIEEnergy( ECsI ) ; - } - } - } - - // T - for(int i = 0 ; i < m_EventData->GetMMCsITMult() ; ++i) - { - if(IsValidChannel("CsI", m_EventData->GetMMCsITDetectorNbr(i), m_EventData->GetMMCsITCristalNbr(i))) - { - m_PreTreatedData->SetMMCsITDetectorNbr( m_EventData->GetMMCsITDetectorNbr(i) ) ; - m_PreTreatedData->SetMMCsITCristalNbr( m_EventData->GetMMCsITCristalNbr(i) ) ; - m_PreTreatedData->SetMMCsITTime( fCsI_T(m_EventData , i) ) ; - } - } - - - // SiLi - // E - for(int i = 0 ; i < m_EventData->GetMMSiLiEMult() ; ++i) - { - if( m_EventData->GetMMSiLiEEnergy(i)>m_SiLi_E_RAW_Threshold && IsValidChannel("SiLi", m_EventData->GetMMSiLiEDetectorNbr(i), m_EventData->GetMMSiLiEPadNbr(i))) - { - double ESiLi = fSiLi_E(m_EventData , i); - if( ESiLi > m_SiLi_E_Threshold ) - { - m_PreTreatedData->SetMMSiLiEDetectorNbr( m_EventData->GetMMSiLiEDetectorNbr(i) ) ; - m_PreTreatedData->SetMMSiLiEPadNbr( m_EventData->GetMMSiLiEPadNbr(i) ) ; - m_PreTreatedData->SetMMSiLiEEnergy( ESiLi ) ; - } - } - } - - // T - for(int i = 0 ; i < m_EventData->GetMMSiLiTMult() ; ++i) - { - if(IsValidChannel("SiLi", m_EventData->GetMMSiLiTDetectorNbr(i), m_EventData->GetMMSiLiTPadNbr(i))) - { - m_PreTreatedData->SetMMSiLiTDetectorNbr( m_EventData->GetMMSiLiTDetectorNbr(i) ) ; - m_PreTreatedData->SetMMSiLiTPadNbr( m_EventData->GetMMSiLiTPadNbr(i) ) ; - m_PreTreatedData->SetMMSiLiTTime( fSiLi_T(m_EventData , i) ) ; - } - } - - return; - } + { + ClearPreTreatedData(); + + // X + // E + for(int i = 0 ; i < m_EventData->GetMMStripXEMult() ; ++i) + { + if( m_EventData->GetMMStripXEEnergy(i)>m_Si_X_E_RAW_Threshold && IsValidChannel("X", m_EventData->GetMMStripXEDetectorNbr(i), m_EventData->GetMMStripXEStripNbr(i)) ) + { + double EX = fSi_X_E(m_EventData , i); + if( EX > m_Si_X_E_Threshold ) + { + m_PreTreatedData->SetMMStripXEDetectorNbr( m_EventData->GetMMStripXEDetectorNbr(i) ); + m_PreTreatedData->SetMMStripXEStripNbr( m_EventData->GetMMStripXEStripNbr(i) ); + m_PreTreatedData->SetMMStripXEEnergy( EX ); + } + + } + } + + // T + for(int i = 0 ; i < m_EventData->GetMMStripXTMult() ; ++i) + { + if(IsValidChannel("X", m_EventData->GetMMStripXTDetectorNbr(i), m_EventData->GetMMStripXTStripNbr(i))) + { + m_PreTreatedData->SetMMStripXTDetectorNbr( m_EventData->GetMMStripXTDetectorNbr(i) ); + m_PreTreatedData->SetMMStripXTStripNbr( m_EventData->GetMMStripXTStripNbr(i) ); + m_PreTreatedData->SetMMStripXTTime( fSi_X_T(m_EventData , i) ); + } + } + + + // Y + // E + for(int i = 0 ; i < m_EventData->GetMMStripYEMult() ; ++i) + { + if( m_EventData->GetMMStripYEEnergy(i)<m_Si_Y_E_RAW_Threshold && IsValidChannel("Y", m_EventData->GetMMStripYEDetectorNbr(i), m_EventData->GetMMStripYEStripNbr(i))) + { + double EY = fSi_Y_E(m_EventData , i); + if( EY >m_Si_Y_E_Threshold ) + { + m_PreTreatedData->SetMMStripYEDetectorNbr( m_EventData->GetMMStripYEDetectorNbr(i) ); + m_PreTreatedData->SetMMStripYEStripNbr( m_EventData->GetMMStripYEStripNbr(i) ); + m_PreTreatedData->SetMMStripYEEnergy( EY ); + } + } + } + + // T + for(int i = 0 ; i < m_EventData->GetMMStripYTMult() ; ++i) + { + if(IsValidChannel("Y", m_EventData->GetMMStripYTDetectorNbr(i), m_EventData->GetMMStripYTStripNbr(i))) + { + m_PreTreatedData->SetMMStripYTDetectorNbr( m_EventData->GetMMStripYTDetectorNbr(i) ); + m_PreTreatedData->SetMMStripYTStripNbr( m_EventData->GetMMStripYTStripNbr(i) ); + m_PreTreatedData->SetMMStripYTTime( fSi_Y_T(m_EventData , i) ); + } + } + + + // CsI + // E + for(int i = 0 ; i < m_EventData->GetMMCsIEMult() ; ++i) + { + + if( m_EventData->GetMMCsIEEnergy(i)>m_CsI_E_RAW_Threshold && IsValidChannel("CsI", m_EventData->GetMMCsIEDetectorNbr(i), m_EventData->GetMMCsIECristalNbr(i))) + { + double ECsI = fCsI_E(m_EventData , i); + if( ECsI > m_CsI_E_Threshold ) + { + m_PreTreatedData->SetMMCsIEDetectorNbr( m_EventData->GetMMCsIEDetectorNbr(i) ); + m_PreTreatedData->SetMMCsIECristalNbr( m_EventData->GetMMCsIECristalNbr(i) ); + m_PreTreatedData->SetMMCsIEEnergy( ECsI ); + } + } + } + + // T + for(int i = 0 ; i < m_EventData->GetMMCsITMult() ; ++i) + { + if(IsValidChannel("CsI", m_EventData->GetMMCsITDetectorNbr(i), m_EventData->GetMMCsITCristalNbr(i))) + { + m_PreTreatedData->SetMMCsITDetectorNbr( m_EventData->GetMMCsITDetectorNbr(i) ); + m_PreTreatedData->SetMMCsITCristalNbr( m_EventData->GetMMCsITCristalNbr(i) ); + m_PreTreatedData->SetMMCsITTime( fCsI_T(m_EventData , i) ); + } + } + + + // SiLi + // E + for(int i = 0 ; i < m_EventData->GetMMSiLiEMult() ; ++i) + { + if( m_EventData->GetMMSiLiEEnergy(i)>m_SiLi_E_RAW_Threshold && IsValidChannel("SiLi", m_EventData->GetMMSiLiEDetectorNbr(i), m_EventData->GetMMSiLiEPadNbr(i))) + { + double ESiLi = fSiLi_E(m_EventData , i); + if( ESiLi > m_SiLi_E_Threshold ) + { + m_PreTreatedData->SetMMSiLiEDetectorNbr( m_EventData->GetMMSiLiEDetectorNbr(i) ); + m_PreTreatedData->SetMMSiLiEPadNbr( m_EventData->GetMMSiLiEPadNbr(i) ); + m_PreTreatedData->SetMMSiLiEEnergy( ESiLi ); + } + } + } + + // T + for(int i = 0 ; i < m_EventData->GetMMSiLiTMult() ; ++i) + { + if(IsValidChannel("SiLi", m_EventData->GetMMSiLiTDetectorNbr(i), m_EventData->GetMMSiLiTPadNbr(i))) + { + m_PreTreatedData->SetMMSiLiTDetectorNbr( m_EventData->GetMMSiLiTDetectorNbr(i) ); + m_PreTreatedData->SetMMSiLiTPadNbr( m_EventData->GetMMSiLiTPadNbr(i) ); + m_PreTreatedData->SetMMSiLiTTime( fSiLi_T(m_EventData , i) ); + } + } + + return; + } /////////////////////////////////////////////////////////////////////////// int TMust2Physics :: CheckEvent() - { - // Check the size of the different elements - if( m_PreTreatedData->GetMMStripXEMult() == m_PreTreatedData->GetMMStripYEMult() /*&& m_PreTreatedData->GetMMStripYEMult() == m_PreTreatedData->GetMMStripXTMult() && m_PreTreatedData->GetMMStripXTMult() == m_PreTreatedData->GetMMStripYTMult()*/ ) - - return 1 ; // Regular Event - - else if( m_PreTreatedData->GetMMStripXEMult() == m_PreTreatedData->GetMMStripYEMult()+1 || m_PreTreatedData->GetMMStripXEMult() == m_PreTreatedData->GetMMStripYEMult()-1 ) - - return 2 ; // Pseudo Event, potentially interstrip - - else return -1 ; // Rejected Event - - } + { + // Check the size of the different elements + if( m_PreTreatedData->GetMMStripXEMult() == m_PreTreatedData->GetMMStripYEMult() /*&& m_PreTreatedData->GetMMStripYEMult() == m_PreTreatedData->GetMMStripXTMult() && m_PreTreatedData->GetMMStripXTMult() == m_PreTreatedData->GetMMStripYTMult()*/ ) + return 1 ; // Regular Event + + else if( m_PreTreatedData->GetMMStripXEMult() == m_PreTreatedData->GetMMStripYEMult()+1 || m_PreTreatedData->GetMMStripXEMult() == m_PreTreatedData->GetMMStripYEMult()-1 ) + return 2 ; // Pseudo Event, potentially interstrip + + else + return -1 ; // Rejected Event + + } /////////////////////////////////////////////////////////////////////////// bool TMust2Physics :: ResolvePseudoEvent() - { - return false; - } + { + return false; + } /////////////////////////////////////////////////////////////////////////// vector < TVector2 > TMust2Physics :: Match_X_Y() - { - vector < TVector2 > ArrayOfGoodCouple ; - - // Prevent code from treating very high multiplicity Event - // Those event are not physical anyway and that improve speed. - if( m_PreTreatedData->GetMMStripXEMult() > m_MaximumStripMultiplicityAllowed || m_PreTreatedData->GetMMStripYEMult() > m_MaximumStripMultiplicityAllowed ) - return ArrayOfGoodCouple; - - for(int i = 0 ; i < m_PreTreatedData->GetMMStripXEMult(); ++i) - { - for(int j = 0 ; j < m_PreTreatedData->GetMMStripYEMult(); j++) - { - // if same detector check energy - if ( m_PreTreatedData->GetMMStripXEDetectorNbr(i) == m_PreTreatedData->GetMMStripYEDetectorNbr(j) ) - { - // Look if energy match - if( abs( (m_PreTreatedData->GetMMStripXEEnergy(i)-m_PreTreatedData->GetMMStripYEEnergy(j))/2. ) < m_StripEnergyMatchingNumberOfSigma*m_StripEnergyMatchingSigma ) - { - // Special Option, if the event is between two CsI cristal, it is rejected. - if(m_Ignore_not_matching_CsI) - { - bool check_validity=false; - for (int hh = 0 ; hh<16 ; ++hh ) - { - if( Match_Si_CsI(m_PreTreatedData->GetMMStripXEStripNbr(i), m_PreTreatedData->GetMMStripYEStripNbr(j) , hh+1) ) - check_validity=true; - } - - if(check_validity) - ArrayOfGoodCouple . push_back ( TVector2(i,j) ) ; - } - - // Special Option, if the event is between two SiLi pad , it is rejected. - if(m_Ignore_not_matching_SiLi) - { - bool check_validity=false; - for (int hh = 0 ; hh<16 ; ++hh ) - { - if( Match_Si_SiLi(m_PreTreatedData->GetMMStripXEStripNbr(i), m_PreTreatedData->GetMMStripYEStripNbr(j) , hh+1) ) - check_validity=true; - } - - if(check_validity) - ArrayOfGoodCouple . push_back ( TVector2(i,j) ) ; - } - - // Regular case, keep the event - else ArrayOfGoodCouple . push_back ( TVector2(i,j) ) ; - } - } - } - } - - // Prevent to treat event with ambiguous matchin beetween X and Y - if( ArrayOfGoodCouple.size() > m_PreTreatedData->GetMMStripXEMult() ) ArrayOfGoodCouple.clear() ; - - return ArrayOfGoodCouple; - } - - + { + vector < TVector2 > ArrayOfGoodCouple ; + + // Prevent code from treating very high multiplicity Event + // Those event are not physical anyway and that improve speed. + if( m_PreTreatedData->GetMMStripXEMult() > m_MaximumStripMultiplicityAllowed || m_PreTreatedData->GetMMStripYEMult() > m_MaximumStripMultiplicityAllowed ) + return ArrayOfGoodCouple; + + for(int i = 0 ; i < m_PreTreatedData->GetMMStripXEMult(); ++i) + { + for(int j = 0 ; j < m_PreTreatedData->GetMMStripYEMult(); j++) + { + // if same detector check energy + if ( m_PreTreatedData->GetMMStripXEDetectorNbr(i) == m_PreTreatedData->GetMMStripYEDetectorNbr(j) ) + { + // Look if energy match + if( abs( (m_PreTreatedData->GetMMStripXEEnergy(i)-m_PreTreatedData->GetMMStripYEEnergy(j))/2. ) < m_StripEnergyMatchingNumberOfSigma*m_StripEnergyMatchingSigma ) + { + // Special Option, if the event is between two CsI cristal, it is rejected. + if(m_Ignore_not_matching_CsI) + { + bool check_validity=false; + for (int hh = 0 ; hh<16 ; ++hh ) + { + if( Match_Si_CsI(m_PreTreatedData->GetMMStripXEStripNbr(i), m_PreTreatedData->GetMMStripYEStripNbr(j) , hh+1) ) + check_validity=true; + } + + if(check_validity) + ArrayOfGoodCouple . push_back ( TVector2(i,j) ) ; + } + + // Special Option, if the event is between two SiLi pad , it is rejected. + if(m_Ignore_not_matching_SiLi) + { + bool check_validity=false; + for (int hh = 0 ; hh<16 ; ++hh ) + { + if( Match_Si_SiLi(m_PreTreatedData->GetMMStripXEStripNbr(i), m_PreTreatedData->GetMMStripYEStripNbr(j) , hh+1) ) + check_validity=true; + } + + if(check_validity) + ArrayOfGoodCouple . push_back ( TVector2(i,j) ) ; + } + + // Regular case, keep the event + else ArrayOfGoodCouple . push_back ( TVector2(i,j) ) ; + } + } + } + } + + // Prevent to treat event with ambiguous matchin beetween X and Y + if( ArrayOfGoodCouple.size() > m_PreTreatedData->GetMMStripXEMult() ) ArrayOfGoodCouple.clear() ; + + return ArrayOfGoodCouple; + } + + //////////////////////////////////////////////////////////////////////////// bool TMust2Physics :: IsValidChannel(const string DetectorType, const int telescope , const int channel) - { - if(DetectorType == "CsI") - return *(m_CsIChannelStatus[telescope-1].begin()+channel-1); - - else if(DetectorType == "SiLi") - return *(m_SiLiChannelStatus[telescope-1].begin()+channel-1); - - else if(DetectorType == "X") - return *(m_XChannelStatus[telescope-1].begin()+channel-1); - - else if(DetectorType == "Y") - return *(m_YChannelStatus[telescope-1].begin()+channel-1); - - else return false; - } - + { + if(DetectorType == "CsI") + return *(m_CsIChannelStatus[telescope-1].begin()+channel-1); + + else if(DetectorType == "SiLi") + return *(m_SiLiChannelStatus[telescope-1].begin()+channel-1); + + else if(DetectorType == "X") + return *(m_XChannelStatus[telescope-1].begin()+channel-1); + + else if(DetectorType == "Y") + return *(m_YChannelStatus[telescope-1].begin()+channel-1); + + else return false; + } + /////////////////////////////////////////////////////////////////////////// void TMust2Physics::ReadAnalysisConfig() { @@ -738,719 +736,710 @@ void TMust2Physics::ReadAnalysisConfig() } } -} - +} + /////////////////////////////////////////////////////////////////////////// bool TMust2Physics :: Match_Si_SiLi(int X, int Y , int PadNbr) - { - - //remove the central part and surrounding + { + + //remove the central part and surrounding if( // Outter Part X < 8 || X > 120 //|| Y < 0 || Y > 128 // Central Part || (Y < 68 && Y > 60) ) - { - return false; - } - + { + return false; + } + if( abs(m_SiLi_MatchingX[PadNbr-1] - X) < m_SiLi_Size/2.&& abs(m_SiLi_MatchingY[PadNbr-1] - Y) < m_SiLi_Size/2.) return true ; else return false; - - } + + } /////////////////////////////////////////////////////////////////////////// bool TMust2Physics :: Match_Si_CsI(int X, int Y , int CristalNbr) - { - - if( abs(m_CsI_MatchingX[CristalNbr-1] - X) < m_CsI_Size/2.&& - abs(m_CsI_MatchingY[CristalNbr-1] - Y) < m_CsI_Size/2.) - - return true ; - - else return false; - - } + { + + if( abs(m_CsI_MatchingX[CristalNbr-1] - X) < m_CsI_Size/2.&& + abs(m_CsI_MatchingY[CristalNbr-1] - Y) < m_CsI_Size/2.) + + return true ; + + else return false; + + } /////////////////////////////////////////////////////////////////////////// void TMust2Physics::Clear() - { - EventMultiplicity= 0 ; - - TelescopeNumber .clear() ; - EventType .clear() ; - TotalEnergy .clear() ; - - // Si X - Si_E.clear() ; - Si_T.clear() ; - Si_X.clear() ; - Si_Y.clear() ; - - // Si(Li) - SiLi_E.clear() ; - SiLi_T.clear() ; - SiLi_N.clear() ; - - // CsI - CsI_E.clear() ; - CsI_T.clear() ; - CsI_N.clear() ; - - Si_EX.clear() ; - Si_TX.clear() ; - Si_EY.clear() ; - Si_TY.clear() ; - TelescopeNumber_X.clear() ; - TelescopeNumber_Y.clear() ; - } + { + EventMultiplicity= 0 ; + + TelescopeNumber.clear(); + EventType.clear(); + TotalEnergy.clear(); + + // Si X + Si_E.clear(); + Si_T.clear(); + Si_X.clear(); + Si_Y.clear(); + + // Si(Li) + SiLi_E.clear(); + SiLi_T.clear(); + SiLi_N.clear(); + + // CsI + CsI_E.clear(); + CsI_T.clear(); + CsI_N.clear(); + + Si_EX.clear(); + Si_TX.clear(); + Si_EY.clear(); + Si_TY.clear(); + TelescopeNumber_X.clear(); + TelescopeNumber_Y.clear(); + } /////////////////////////////////////////////////////////////////////////// void TMust2Physics::ReadCalibrationRun() - { - // X - // E - for(int i = 0 ; i < m_EventData->GetMMStripXEMult();++i) - { - TelescopeNumber_X.push_back(m_EventData->GetMMStripXEDetectorNbr(i)); - Si_EX.push_back( fSi_X_E( m_EventData , i) ) ; - Si_X.push_back(m_EventData->GetMMStripXEStripNbr(i)); - - } - // T - for(int i = 0 ; i < m_EventData->GetMMStripXTMult();++i) - { - TelescopeNumber_X.push_back(m_EventData->GetMMStripXTDetectorNbr(i)); - Si_TX.push_back( fSi_X_T( m_EventData , i) ) ; - Si_X.push_back(m_EventData->GetMMStripXTStripNbr(i)); - - } - - // Y - // E - for(int i = 0 ; i < m_EventData->GetMMStripYEMult();++i) - { - TelescopeNumber_Y.push_back(m_EventData->GetMMStripYEDetectorNbr(i)); - Si_EY.push_back( fSi_Y_E( m_EventData , i) ) ; - Si_Y.push_back(m_EventData->GetMMStripYEStripNbr(i)); - - - } - - // T - for(int i = 0 ; i < m_EventData->GetMMStripYTMult();++i) - { - TelescopeNumber_Y.push_back(m_EventData->GetMMStripYTDetectorNbr(i)); - Si_TY.push_back( fSi_Y_T( m_EventData , i) ) ; - Si_Y.push_back(m_EventData->GetMMStripYTStripNbr(i)); - - } - - //CsI Energy - for( int j = 0 ; j < m_EventData->GetMMCsIEMult() ; ++j) - { - CsI_N.push_back(m_EventData->GetMMCsIECristalNbr(j)) ; - CsI_E.push_back(fCsI_E(m_EventData , j)) ; - - } - - //CsI Time - for( int j = 0 ; j < m_EventData->GetMMCsITMult() ; ++j) - { - //CsI_N.push_back(m_EventData->GetMMCsITCristalNbr(j)) ; - CsI_T.push_back(fCsI_T(m_EventData , j)) ; - - } - - } - -//// Innherited from VDetector Class //// - -// Read stream at ConfigFile to pick-up parameters of detector (Position,...) using Token -void TMust2Physics::ReadConfiguration(string Path) + { + // X + // E + for(int i = 0 ; i < m_EventData->GetMMStripXEMult();++i) + { + TelescopeNumber_X.push_back(m_EventData->GetMMStripXEDetectorNbr(i)); + Si_EX.push_back( fSi_X_E( m_EventData , i) ); + Si_X.push_back(m_EventData->GetMMStripXEStripNbr(i)); + + } + // T + for(int i = 0 ; i < m_EventData->GetMMStripXTMult();++i) + { + TelescopeNumber_X.push_back(m_EventData->GetMMStripXTDetectorNbr(i)); + Si_TX.push_back( fSi_X_T( m_EventData , i) ); + Si_X.push_back(m_EventData->GetMMStripXTStripNbr(i)); + + } + + // Y + // E + for(int i = 0 ; i < m_EventData->GetMMStripYEMult();++i) + { + TelescopeNumber_Y.push_back(m_EventData->GetMMStripYEDetectorNbr(i)); + Si_EY.push_back( fSi_Y_E( m_EventData , i) ); + Si_Y.push_back(m_EventData->GetMMStripYEStripNbr(i)); + } + + // T + for(int i = 0 ; i < m_EventData->GetMMStripYTMult();++i) + { + TelescopeNumber_Y.push_back(m_EventData->GetMMStripYTDetectorNbr(i)); + Si_TY.push_back( fSi_Y_T( m_EventData , i) ); + Si_Y.push_back(m_EventData->GetMMStripYTStripNbr(i)); + } + + //CsI Energy + for( int j = 0 ; j < m_EventData->GetMMCsIEMult() ; ++j) + { + CsI_N.push_back(m_EventData->GetMMCsIECristalNbr(j)) ; + CsI_E.push_back(fCsI_E(m_EventData , j)) ; + } + + //CsI Time + for( int j = 0 ; j < m_EventData->GetMMCsITMult() ; ++j) + { + CsI_T.push_back(fCsI_T(m_EventData , j)) ; + } + + } + +//// Innherited from VDetector Class //// + +// Read stream at ConfigFile to pick-up parameters of detector (Position,...) using Token +void TMust2Physics::ReadConfiguration(string Path) { - ifstream ConfigFile ; - ConfigFile.open(Path.c_str()) ; - string LineBuffer ; - string DataBuffer ; + ifstream ConfigFile ; + ConfigFile.open(Path.c_str()) ; + string LineBuffer ; + string DataBuffer ; // A:X1_Y1 --> X:1 Y:1 // B:X128_Y1 --> X:128 Y:1 // C:X1_Y128 --> X:1 Y:128 // D:X128_Y128 --> X:128 Y:128 - double Ax , Bx , Cx , Dx , Ay , By , Cy , Dy , Az , Bz , Cz , Dz ; - TVector3 A , B , C , D ; - double Theta = 0 , Phi = 0 , R = 0 , beta_u = 0 , beta_v = 0 , beta_w = 0 ; + double Ax , Bx , Cx , Dx , Ay , By , Cy , Dy , Az , Bz , Cz , Dz; + TVector3 A , B , C , D; + double Theta = 0 , Phi = 0 , R = 0 , beta_u = 0 , beta_v = 0 , beta_w = 0; - bool check_A = false ; - bool check_C = false ; - bool check_B = false ; - bool check_D = false ; + bool check_A = false ; + bool check_C = false ; + bool check_B = false ; + bool check_D = false ; bool check_Theta = false ; - bool check_Phi = false ; + bool check_Phi = false ; bool check_R = false ; - bool check_beta = false ; + bool check_beta = false ; bool ReadingStatus = false ; - + while (!ConfigFile.eof()) - { + { + + getline(ConfigFile, LineBuffer); + + // If line is a Start Up Must2 bloc, Reading toggle to true + if (LineBuffer.compare(0, 11, "M2Telescope")==0) + { + cout << "///" << endl ; + cout << "Telescope found: " << endl ; + ReadingStatus = true ; + + } + + // Else don't toggle to Reading Block Status + else ReadingStatus = false ; - getline(ConfigFile, LineBuffer); - - // If line is a Start Up Must2 bloc, Reading toggle to true - if (LineBuffer.compare(0, 11, "M2Telescope")==0) - { - cout << "///" << endl ; - cout << "Telescope found: " << endl ; - ReadingStatus = true ; - - } - - // Else don't toggle to Reading Block Status - else ReadingStatus = false ; - - // Reading Block - while(ReadingStatus) - { - - ConfigFile >> DataBuffer ; - // Comment Line - if(DataBuffer.compare(0, 1, "%") == 0) { - ConfigFile.ignore ( std::numeric_limits<std::streamsize>::max(), '\n' ); - - } - - // Finding another telescope (safety), toggle out - else if (DataBuffer=="M2Telescope") { - cout << "WARNING: Another Telescope is find before standard sequence of Token, Error may occured in Telecope definition" << endl ; - ReadingStatus = false ; - } - - // Position method - - else if (DataBuffer=="X1_Y1=") { - check_A = true; - ConfigFile >> DataBuffer ; - Ax = atof(DataBuffer.c_str()) ; - Ax = Ax ; - ConfigFile >> DataBuffer ; - Ay = atof(DataBuffer.c_str()) ; - Ay = Ay ; - ConfigFile >> DataBuffer ; - Az = atof(DataBuffer.c_str()) ; - Az = Az ; - - A = TVector3(Ax, Ay, Az); - cout << "X1 Y1 corner position : (" << A.X() << ";" << A.Y() << ";" << A.Z() << ")" << endl; - - } - - - else if (DataBuffer=="X128_Y1=") { - check_B = true; - ConfigFile >> DataBuffer ; - Bx = atof(DataBuffer.c_str()) ; - Bx = Bx ; - ConfigFile >> DataBuffer ; - By = atof(DataBuffer.c_str()) ; - By = By ; - ConfigFile >> DataBuffer ; - Bz = atof(DataBuffer.c_str()) ; - Bz = Bz ; - - B = TVector3(Bx, By, Bz); - cout << "X128 Y1 corner position : (" << B.X() << ";" << B.Y() << ";" << B.Z() << ")" << endl; - - } - - - else if (DataBuffer=="X1_Y128=") { - check_C = true; - ConfigFile >> DataBuffer ; - Cx = atof(DataBuffer.c_str()) ; - Cx = Cx ; - ConfigFile >> DataBuffer ; - Cy = atof(DataBuffer.c_str()) ; - Cy = Cy ; - ConfigFile >> DataBuffer ; - Cz = atof(DataBuffer.c_str()) ; - Cz = Cz ; - - C = TVector3(Cx, Cy, Cz); - cout << "X1 Y128 corner position : (" << C.X() << ";" << C.Y() << ";" << C.Z() << ")" << endl; - - } - - else if (DataBuffer=="X128_Y128=") { - check_D = true; - ConfigFile >> DataBuffer ; - Dx = atof(DataBuffer.c_str()) ; - Dx = Dx ; - ConfigFile >> DataBuffer ; - Dy = atof(DataBuffer.c_str()) ; - Dy = Dy ; - ConfigFile >> DataBuffer ; - Dz = atof(DataBuffer.c_str()) ; - Dz = Dz ; - - D = TVector3(Dx, Dy, Dz); - cout << "X128 Y128 corner position : (" << D.X() << ";" << D.Y() << ";" << D.Z() << ")" << endl; - - } - - // End Position Method - - // Angle method - else if (DataBuffer=="THETA=") { - check_Theta = true; - ConfigFile >> DataBuffer ; - Theta = atof(DataBuffer.c_str()) ; - Theta = Theta ; - cout << "Theta: " << Theta << endl; - - } - - //Angle method - else if (DataBuffer=="PHI=") { - check_Phi = true; - ConfigFile >> DataBuffer ; - Phi = atof(DataBuffer.c_str()) ; - Phi = Phi ; - cout << "Phi: " << Phi << endl; - - } - - //Angle method - else if (DataBuffer=="R=") { - check_R = true; - ConfigFile >> DataBuffer ; - R = atof(DataBuffer.c_str()) ; - R = R ; - cout << "R: " << R << endl; - - } - - //Angle method - else if (DataBuffer=="BETA=") { - check_beta = true; - ConfigFile >> DataBuffer ; - beta_u = atof(DataBuffer.c_str()) ; - beta_u = beta_u ; - ConfigFile >> DataBuffer ; - beta_v = atof(DataBuffer.c_str()) ; - beta_v = beta_v ; - ConfigFile >> DataBuffer ; - beta_w = atof(DataBuffer.c_str()) ; - beta_w = beta_w ; - cout << "Beta: " << beta_u << " " << beta_v << " " << beta_w << endl ; - - } - - ///////////////////////////////////////////////// - // If All necessary information there, toggle out - if ( (check_A && check_B && check_C && check_D) || (check_Theta && check_Phi && check_R && check_beta) ) - { - ReadingStatus = false; - - ///Add The previously define telescope - //With position method - if ( check_A && check_B && check_C && check_D ) - { - AddTelescope( A , - B , - C , - D ) ; - } - - //with angle method - else if ( check_Theta && check_Phi && check_R && check_beta ) - { - AddTelescope( Theta , - Phi , - R , - beta_u , - beta_v , - beta_w ); - } - - check_A = false ; - check_B = false ; - check_C = false ; - check_D = false ; - - check_Theta = false ; - check_Phi = false ; - check_R = false ; - check_beta = false ; - - } - - } - } - InitializeStandardParameter(); - ReadAnalysisConfig(); - - cout << endl << "/////////////////////////////" << endl << endl; + // Reading Block + while(ReadingStatus) + { + + ConfigFile >> DataBuffer ; + // Comment Line + if(DataBuffer.compare(0, 1, "%") == 0) { + ConfigFile.ignore ( std::numeric_limits<std::streamsize>::max(), '\n' ); + + } + + // Finding another telescope (safety), toggle out + else if (DataBuffer=="M2Telescope") { + cout << "WARNING: Another Telescope is find before standard sequence of Token, Error may occured in Telecope definition" << endl ; + ReadingStatus = false ; + } + + // Position method + + else if (DataBuffer=="X1_Y1=") { + check_A = true; + ConfigFile >> DataBuffer ; + Ax = atof(DataBuffer.c_str()) ; + Ax = Ax ; + ConfigFile >> DataBuffer ; + Ay = atof(DataBuffer.c_str()) ; + Ay = Ay ; + ConfigFile >> DataBuffer ; + Az = atof(DataBuffer.c_str()) ; + Az = Az ; + + A = TVector3(Ax, Ay, Az); + cout << "X1 Y1 corner position : (" << A.X() << ";" << A.Y() << ";" << A.Z() << ")" << endl; + + } + + + else if (DataBuffer=="X128_Y1=") { + check_B = true; + ConfigFile >> DataBuffer ; + Bx = atof(DataBuffer.c_str()) ; + Bx = Bx ; + ConfigFile >> DataBuffer ; + By = atof(DataBuffer.c_str()) ; + By = By ; + ConfigFile >> DataBuffer ; + Bz = atof(DataBuffer.c_str()) ; + Bz = Bz ; + + B = TVector3(Bx, By, Bz); + cout << "X128 Y1 corner position : (" << B.X() << ";" << B.Y() << ";" << B.Z() << ")" << endl; + + } + + + else if (DataBuffer=="X1_Y128=") { + check_C = true; + ConfigFile >> DataBuffer ; + Cx = atof(DataBuffer.c_str()) ; + Cx = Cx ; + ConfigFile >> DataBuffer ; + Cy = atof(DataBuffer.c_str()) ; + Cy = Cy ; + ConfigFile >> DataBuffer ; + Cz = atof(DataBuffer.c_str()) ; + Cz = Cz ; + + C = TVector3(Cx, Cy, Cz); + cout << "X1 Y128 corner position : (" << C.X() << ";" << C.Y() << ";" << C.Z() << ")" << endl; + + } + + else if (DataBuffer=="X128_Y128=") { + check_D = true; + ConfigFile >> DataBuffer ; + Dx = atof(DataBuffer.c_str()) ; + Dx = Dx ; + ConfigFile >> DataBuffer ; + Dy = atof(DataBuffer.c_str()) ; + Dy = Dy ; + ConfigFile >> DataBuffer ; + Dz = atof(DataBuffer.c_str()) ; + Dz = Dz ; + + D = TVector3(Dx, Dy, Dz); + cout << "X128 Y128 corner position : (" << D.X() << ";" << D.Y() << ";" << D.Z() << ")" << endl; + + } + + // End Position Method + + // Angle method + else if (DataBuffer=="THETA=") { + check_Theta = true; + ConfigFile >> DataBuffer ; + Theta = atof(DataBuffer.c_str()) ; + Theta = Theta ; + cout << "Theta: " << Theta << endl; + + } + + //Angle method + else if (DataBuffer=="PHI=") { + check_Phi = true; + ConfigFile >> DataBuffer ; + Phi = atof(DataBuffer.c_str()) ; + Phi = Phi ; + cout << "Phi: " << Phi << endl; + + } + + //Angle method + else if (DataBuffer=="R=") { + check_R = true; + ConfigFile >> DataBuffer ; + R = atof(DataBuffer.c_str()) ; + R = R ; + cout << "R: " << R << endl; + + } + + //Angle method + else if (DataBuffer=="BETA=") { + check_beta = true; + ConfigFile >> DataBuffer ; + beta_u = atof(DataBuffer.c_str()) ; + beta_u = beta_u ; + ConfigFile >> DataBuffer ; + beta_v = atof(DataBuffer.c_str()) ; + beta_v = beta_v ; + ConfigFile >> DataBuffer ; + beta_w = atof(DataBuffer.c_str()) ; + beta_w = beta_w ; + cout << "Beta: " << beta_u << " " << beta_v << " " << beta_w << endl ; + + } + + ///////////////////////////////////////////////// + // If All necessary information there, toggle out + if ( (check_A && check_B && check_C && check_D) || (check_Theta && check_Phi && check_R && check_beta) ) + { + ReadingStatus = false; + + ///Add The previously define telescope + //With position method + if ( check_A && check_B && check_C && check_D ) + { + AddTelescope( A, + B, + C, + D) ; + } + + //with angle method + else if ( check_Theta && check_Phi && check_R && check_beta ) + { + AddTelescope( Theta, + Phi, + R, + beta_u, + beta_v, + beta_w); + } + + check_A = false ; + check_B = false ; + check_C = false ; + check_D = false ; + + check_Theta = false ; + check_Phi = false ; + check_R = false ; + check_beta = false ; + } + } + } + + InitializeStandardParameter(); + ReadAnalysisConfig(); + + cout << endl << "/////////////////////////////" << endl << endl; } -// Add Parameter to the CalibrationManger -void TMust2Physics::AddParameterToCalibrationManager() - { - CalibrationManager* Cal = CalibrationManager::getInstance(); - - for(int i = 0 ; i < m_NumberOfTelescope ; ++i) - { - - for( int j = 0 ; j < 128 ; ++j) - { - Cal->AddParameter("MUST2", "T"+itoa(i+1)+"_Si_X"+itoa(j+1)+"_E","MUST2_T"+itoa(i+1)+"_Si_X"+itoa(j+1)+"_E") ; - Cal->AddParameter("MUST2", "T"+itoa(i+1)+"_Si_Y"+itoa(j+1)+"_E","MUST2_T"+itoa(i+1)+"_Si_Y"+itoa(j+1)+"_E") ; - Cal->AddParameter("MUST2", "T"+itoa(i+1)+"_Si_X"+itoa(j+1)+"_T","MUST2_T"+itoa(i+1)+"_Si_X"+itoa(j+1)+"_T") ; - Cal->AddParameter("MUST2", "T"+itoa(i+1)+"_Si_Y"+itoa(j+1)+"_T","MUST2_T"+itoa(i+1)+"_Si_Y"+itoa(j+1)+"_T") ; - } - - for( int j = 0 ; j < 16 ; ++j) - { - Cal->AddParameter("MUST2", "T"+itoa(i+1)+"_SiLi"+itoa(j+1)+"_E","MUST2_T"+itoa(i+1)+"_SiLi"+itoa(j+1)+"_E") ; - Cal->AddParameter("MUST2", "T"+itoa(i+1)+"_SiLi"+itoa(j+1)+"_T","MUST2_T"+itoa(i+1)+"_SiLi"+itoa(j+1)+"_T") ; - } - - for( int j = 0 ; j < 16 ; ++j) - { - Cal->AddParameter("MUST2", "T"+itoa(i+1)+"_CsI"+itoa(j+1)+"_E","MUST2_T"+itoa(i+1)+"_CsI"+itoa(j+1)+"_E") ; - Cal->AddParameter("MUST2", "T"+itoa(i+1)+"_CsI"+itoa(j+1)+"_T","MUST2_T"+itoa(i+1)+"_CsI"+itoa(j+1)+"_T") ; - } - } - - return; - - } - -// 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 TMust2Physics::InitializeRootInput() - { - TChain* inputChain = RootInput::getInstance()->GetChain() ; - inputChain->SetBranchStatus( "MUST2" , true ) ; - inputChain->SetBranchStatus( "fMM_*" , true ) ; - inputChain->SetBranchAddress( "MUST2" , &m_EventData ) ; - } - - -// Create associated branches and associated private member DetectorPhysics address -void TMust2Physics::InitializeRootOutput() - { - TTree* outputTree = RootOutput::getInstance()->GetTree() ; - outputTree->Branch( "MUST2" , "TMust2Physics" , &m_EventPhysics ) ; - } - - -///// Specific to MUST2Array //// - -void TMust2Physics::AddTelescope( TVector3 C_X1_Y1 , - TVector3 C_X128_Y1 , - TVector3 C_X1_Y128 , - TVector3 C_X128_Y128 ) - { - // To avoid warning - C_X128_Y128 *= 1; - - m_NumberOfTelescope++; - - // Vector U on Telescope Face (paralelle to Y Strip) (NB: remember that Y strip are allong X axis) - TVector3 U = C_X128_Y1 - C_X1_Y1 ; - double Ushift = (U.Mag()-98)/2. ; - U = U.Unit() ; - // Vector V on Telescope Face (parallele to X Strip) - TVector3 V = C_X1_Y128 - C_X1_Y1 ; - double Vshift = (V.Mag() -98)/2. ; - V = V.Unit() ; - - // Position Vector of Strip Center - TVector3 StripCenter = TVector3(0,0,0) ; - // Position Vector of X=1 Y=1 Strip - TVector3 Strip_1_1 ; - - // Geometry Parameter - double Face = 98 ; //mm - double NumberOfStrip = 128 ; - double StripPitch = Face/NumberOfStrip ; //mm - // Buffer object to fill Position Array - vector<double> lineX ; vector<double> lineY ; vector<double> lineZ ; - - vector< vector< double > > OneTelescopeStripPositionX ; - vector< vector< double > > OneTelescopeStripPositionY ; - vector< vector< double > > OneTelescopeStripPositionZ ; - - // Moving StripCenter to 1.1 corner: - Strip_1_1 = C_X1_Y1 + (U+V) * (StripPitch/2.) ; +// Add Parameter to the CalibrationManger +void TMust2Physics::AddParameterToCalibrationManager() + { + CalibrationManager* Cal = CalibrationManager::getInstance(); + + for(int i = 0 ; i < m_NumberOfTelescope ; ++i) + { + + for( int j = 0 ; j < 128 ; ++j) + { + Cal->AddParameter("MUST2", "T"+itoa(i+1)+"_Si_X"+itoa(j+1)+"_E","MUST2_T"+itoa(i+1)+"_Si_X"+itoa(j+1)+"_E") ; + Cal->AddParameter("MUST2", "T"+itoa(i+1)+"_Si_Y"+itoa(j+1)+"_E","MUST2_T"+itoa(i+1)+"_Si_Y"+itoa(j+1)+"_E") ; + Cal->AddParameter("MUST2", "T"+itoa(i+1)+"_Si_X"+itoa(j+1)+"_T","MUST2_T"+itoa(i+1)+"_Si_X"+itoa(j+1)+"_T") ; + Cal->AddParameter("MUST2", "T"+itoa(i+1)+"_Si_Y"+itoa(j+1)+"_T","MUST2_T"+itoa(i+1)+"_Si_Y"+itoa(j+1)+"_T") ; + } + + for( int j = 0 ; j < 16 ; ++j) + { + Cal->AddParameter("MUST2", "T"+itoa(i+1)+"_SiLi"+itoa(j+1)+"_E","MUST2_T"+itoa(i+1)+"_SiLi"+itoa(j+1)+"_E") ; + Cal->AddParameter("MUST2", "T"+itoa(i+1)+"_SiLi"+itoa(j+1)+"_T","MUST2_T"+itoa(i+1)+"_SiLi"+itoa(j+1)+"_T") ; + } + + for( int j = 0 ; j < 16 ; ++j) + { + Cal->AddParameter("MUST2", "T"+itoa(i+1)+"_CsI"+itoa(j+1)+"_E","MUST2_T"+itoa(i+1)+"_CsI"+itoa(j+1)+"_E") ; + Cal->AddParameter("MUST2", "T"+itoa(i+1)+"_CsI"+itoa(j+1)+"_T","MUST2_T"+itoa(i+1)+"_CsI"+itoa(j+1)+"_T") ; + } + } + + return; + + } + +// 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 TMust2Physics::InitializeRootInput() + { + TChain* inputChain = RootInput::getInstance()->GetChain() ; + inputChain->SetBranchStatus( "MUST2" , true ) ; + inputChain->SetBranchStatus( "fMM_*" , true ) ; + inputChain->SetBranchAddress( "MUST2" , &m_EventData ) ; + } + + +// Create associated branches and associated private member DetectorPhysics address +void TMust2Physics::InitializeRootOutput() + { + TTree* outputTree = RootOutput::getInstance()->GetTree(); + outputTree->Branch( "MUST2" , "TMust2Physics" , &m_EventPhysics ); + } + + +///// Specific to MUST2Array //// + +void TMust2Physics::AddTelescope( TVector3 C_X1_Y1, + TVector3 C_X128_Y1, + TVector3 C_X1_Y128, + TVector3 C_X128_Y128) + { + // To avoid warning + C_X128_Y128 *= 1; + + m_NumberOfTelescope++; + + // Vector U on Telescope Face (paralelle to Y Strip) (NB: remember that Y strip are allong X axis) + TVector3 U = C_X128_Y1 - C_X1_Y1 ; + double Ushift = (U.Mag()-98)/2.; + U = U.Unit(); + // Vector V on Telescope Face (parallele to X Strip) + TVector3 V = C_X1_Y128 - C_X1_Y1 ; + double Vshift = (V.Mag() -98)/2. ; + V = V.Unit() ; + + // Position Vector of Strip Center + TVector3 StripCenter = TVector3(0,0,0); + // Position Vector of X=1 Y=1 Strip + TVector3 Strip_1_1; + + // Geometry Parameter + double Face = 98; //mm + double NumberOfStrip = 128; + double StripPitch = Face/NumberOfStrip ; //mm + // Buffer object to fill Position Array + vector<double> lineX ; vector<double> lineY ; vector<double> lineZ ; + + vector< vector< double > > OneTelescopeStripPositionX ; + vector< vector< double > > OneTelescopeStripPositionY ; + vector< vector< double > > OneTelescopeStripPositionZ ; + + // Moving StripCenter to 1.1 corner: + Strip_1_1 = C_X1_Y1 + (U+V) * (StripPitch/2.) ; Strip_1_1+= U*Ushift+V*Vshift ; - for( int i = 0 ; i < 128 ; ++i ) - { - lineX.clear() ; - lineY.clear() ; - lineZ.clear() ; - - for( int j = 0 ; j < 128 ; ++j ) - { - StripCenter = Strip_1_1 + StripPitch*( i*U + j*V ) ; - //StripCenter += -TargetPosition ; - lineX.push_back( StripCenter.X() ) ; - lineY.push_back( StripCenter.Y() ) ; - lineZ.push_back( StripCenter.Z() ) ; - } - - OneTelescopeStripPositionX.push_back(lineX) ; - OneTelescopeStripPositionY.push_back(lineY) ; - OneTelescopeStripPositionZ.push_back(lineZ) ; - - } - m_StripPositionX.push_back( OneTelescopeStripPositionX ) ; - m_StripPositionY.push_back( OneTelescopeStripPositionY ) ; - m_StripPositionZ.push_back( OneTelescopeStripPositionZ ) ; - - } - - + for( int i = 0 ; i < 128 ; ++i ) + { + lineX.clear() ; + lineY.clear() ; + lineZ.clear() ; + + for( int j = 0 ; j < 128 ; ++j ) + { + StripCenter = Strip_1_1 + StripPitch*( i*U + j*V ); + lineX.push_back( StripCenter.X() ); + lineY.push_back( StripCenter.Y() ); + lineZ.push_back( StripCenter.Z() ); + } + + OneTelescopeStripPositionX.push_back(lineX); + OneTelescopeStripPositionY.push_back(lineY); + OneTelescopeStripPositionZ.push_back(lineZ); + + } + m_StripPositionX.push_back( OneTelescopeStripPositionX ) ; + m_StripPositionY.push_back( OneTelescopeStripPositionY ) ; + m_StripPositionZ.push_back( OneTelescopeStripPositionZ ) ; + + } + + void TMust2Physics::InitializeStandardParameter() - { - // Enable all channel - vector< bool > ChannelStatus; - m_XChannelStatus.clear() ; - m_YChannelStatus.clear() ; - m_SiLiChannelStatus.clear() ; - m_CsIChannelStatus.clear() ; + { + // Enable all channel + vector< bool > ChannelStatus; + m_XChannelStatus.clear() ; + m_YChannelStatus.clear() ; + m_SiLiChannelStatus.clear() ; + m_CsIChannelStatus.clear() ; - ChannelStatus.resize(128,true); - for(int i = 0 ; i < m_NumberOfTelescope ; ++i) - { - m_XChannelStatus[i] = ChannelStatus; - m_YChannelStatus[i] = ChannelStatus; - } - - ChannelStatus.resize(16,true); - for(int i = 0 ; i < m_NumberOfTelescope ; ++i) - { - m_SiLiChannelStatus[i] = ChannelStatus; - m_CsIChannelStatus[i] = ChannelStatus; - } - - - m_MaximumStripMultiplicityAllowed = m_NumberOfTelescope ; - - return; - } - -void TMust2Physics::AddTelescope( double theta , - double phi , - double distance , - double beta_u , - double beta_v , - double beta_w ) - { - - m_NumberOfTelescope++; - - double Pi = 3.141592654 ; - - // convert from degree to radian: - theta = theta * Pi/180. ; - phi = phi * Pi/180. ; - - //Vector U on Telescope Face (paralelle to Y Strip) (NB: remember that Y strip are allong X axis) - TVector3 U ; - //Vector V on Telescope Face (parallele to X Strip) - TVector3 V ; - //Vector W normal to Telescope Face (pointing CsI) - TVector3 W ; - //Vector position of Telescope Face center - TVector3 C ; - - C = TVector3 ( distance * sin(theta) * cos(phi) , - distance * sin(theta) * sin(phi) , - distance * cos(theta) ); - - TVector3 P = TVector3( cos(theta ) * cos(phi) , - cos(theta ) * sin(phi) , - -sin(theta) ); - - W = C.Unit() ; - U = W .Cross ( P ) ; - V = W .Cross ( U ); - - U = U.Unit(); - V = V.Unit(); - - U.Rotate( beta_u * Pi/180. , U ) ; - V.Rotate( beta_u * Pi/180. , U ) ; - - U.Rotate( beta_v * Pi/180. , V ) ; - V.Rotate( beta_v * Pi/180. , V ) ; - - U.Rotate( beta_w * Pi/180. , W ) ; - V.Rotate( beta_w * Pi/180. , W ) ; - - double Face = 98 ; //mm - double NumberOfStrip = 128 ; - double StripPitch = Face/NumberOfStrip ; //mm - - vector<double> lineX ; vector<double> lineY ; vector<double> lineZ ; - - vector< vector< double > > OneTelescopeStripPositionX ; - vector< vector< double > > OneTelescopeStripPositionY ; - vector< vector< double > > OneTelescopeStripPositionZ ; - - double X , Y , Z ; - - //Moving C to the 1.1 corner: - C.SetX( C.X() - ( Face/2 - StripPitch/2 ) * ( V.X() + U.X() ) ) ; - C.SetY( C.Y() - ( Face/2 - StripPitch/2 ) * ( V.Y() + U.Y() ) ) ; - C.SetZ( C.Z() - ( Face/2 - StripPitch/2 ) * ( V.Z() + U.Z() ) ) ; - - for( int i = 0 ; i < 128 ; ++i ) - { - - lineX.clear() ; - lineY.clear() ; - lineZ.clear() ; - - for( int j = 0 ; j < 128 ; ++j ) - { - X = C.X() + StripPitch * ( U.X()*i + V.X()*j ) ; - Y = C.Y() + StripPitch * ( U.Y()*i + V.Y()*j ) ; - Z = C.Z() + StripPitch * ( U.Z()*i + V.Z()*j ) ; - - lineX.push_back(X) ; - lineY.push_back(Y) ; - lineZ.push_back(Z) ; - - } - - OneTelescopeStripPositionX.push_back(lineX) ; - OneTelescopeStripPositionY.push_back(lineY) ; - OneTelescopeStripPositionZ.push_back(lineZ) ; - - } - m_StripPositionX.push_back( OneTelescopeStripPositionX ) ; - m_StripPositionY.push_back( OneTelescopeStripPositionY ) ; - m_StripPositionZ.push_back( OneTelescopeStripPositionZ ) ; - } - - + ChannelStatus.resize(128,true); + for(int i = 0 ; i < m_NumberOfTelescope ; ++i) + { + m_XChannelStatus[i] = ChannelStatus; + m_YChannelStatus[i] = ChannelStatus; + } + + ChannelStatus.resize(16,true); + for(int i = 0 ; i < m_NumberOfTelescope ; ++i) + { + m_SiLiChannelStatus[i] = ChannelStatus; + m_CsIChannelStatus[i] = ChannelStatus; + } + + + m_MaximumStripMultiplicityAllowed = m_NumberOfTelescope ; + + return; + } + +void TMust2Physics::AddTelescope( double theta, + double phi, + double distance, + double beta_u, + double beta_v, + double beta_w) + { + + m_NumberOfTelescope++; + + double Pi = 3.141592654 ; + + // convert from degree to radian: + theta = theta * Pi/180. ; + phi = phi * Pi/180. ; + + //Vector U on Telescope Face (paralelle to Y Strip) (NB: remember that Y strip are allong X axis) + TVector3 U ; + //Vector V on Telescope Face (parallele to X Strip) + TVector3 V ; + //Vector W normal to Telescope Face (pointing CsI) + TVector3 W ; + //Vector position of Telescope Face center + TVector3 C ; + + C = TVector3 ( distance * sin(theta) * cos(phi) , + distance * sin(theta) * sin(phi) , + distance * cos(theta) ); + + TVector3 P = TVector3( cos(theta ) * cos(phi) , + cos(theta ) * sin(phi) , + -sin(theta) ); + + W = C.Unit() ; + U = W .Cross ( P ) ; + V = W .Cross ( U ); + + U = U.Unit(); + V = V.Unit(); + + U.Rotate( beta_u * Pi/180. , U ) ; + V.Rotate( beta_u * Pi/180. , U ) ; + + U.Rotate( beta_v * Pi/180. , V ) ; + V.Rotate( beta_v * Pi/180. , V ) ; + + U.Rotate( beta_w * Pi/180. , W ) ; + V.Rotate( beta_w * Pi/180. , W ) ; + + double Face = 98 ; //mm + double NumberOfStrip = 128 ; + double StripPitch = Face/NumberOfStrip ; //mm + + vector<double> lineX ; vector<double> lineY ; vector<double> lineZ ; + + vector< vector< double > > OneTelescopeStripPositionX ; + vector< vector< double > > OneTelescopeStripPositionY ; + vector< vector< double > > OneTelescopeStripPositionZ ; + + double X , Y , Z ; + + //Moving C to the 1.1 corner: + C.SetX( C.X() - ( Face/2 - StripPitch/2 ) * ( V.X() + U.X() ) ) ; + C.SetY( C.Y() - ( Face/2 - StripPitch/2 ) * ( V.Y() + U.Y() ) ) ; + C.SetZ( C.Z() - ( Face/2 - StripPitch/2 ) * ( V.Z() + U.Z() ) ) ; + + for( int i = 0 ; i < 128 ; ++i ) + { + + lineX.clear() ; + lineY.clear() ; + lineZ.clear() ; + + for( int j = 0 ; j < 128 ; ++j ) + { + X = C.X() + StripPitch * ( U.X()*i + V.X()*j ) ; + Y = C.Y() + StripPitch * ( U.Y()*i + V.Y()*j ) ; + Z = C.Z() + StripPitch * ( U.Z()*i + V.Z()*j ) ; + + lineX.push_back(X) ; + lineY.push_back(Y) ; + lineZ.push_back(Z) ; + + } + + OneTelescopeStripPositionX.push_back(lineX) ; + OneTelescopeStripPositionY.push_back(lineY) ; + OneTelescopeStripPositionZ.push_back(lineZ) ; + + } + m_StripPositionX.push_back( OneTelescopeStripPositionX ) ; + m_StripPositionY.push_back( OneTelescopeStripPositionY ) ; + m_StripPositionZ.push_back( OneTelescopeStripPositionZ ) ; + } + + TVector3 TMust2Physics::GetPositionOfInteraction(const int i) const - { - TVector3 Position = TVector3 ( GetStripPositionX( TelescopeNumber[i] , Si_X[i] , Si_Y[i] ) , - GetStripPositionY( TelescopeNumber[i] , Si_X[i] , Si_Y[i] ) , - GetStripPositionZ( TelescopeNumber[i] , Si_X[i] , Si_Y[i] ) ) ; - - return(Position) ; - - } - + { + TVector3 Position = TVector3 ( GetStripPositionX( TelescopeNumber[i] , Si_X[i] , Si_Y[i] ) , + GetStripPositionY( TelescopeNumber[i] , Si_X[i] , Si_Y[i] ) , + GetStripPositionZ( TelescopeNumber[i] , Si_X[i] , Si_Y[i] ) ) ; + + return(Position) ; + + } + TVector3 TMust2Physics::GetTelescopeNormal( const int i) const - { - TVector3 U = TVector3 ( GetStripPositionX( TelescopeNumber[i] , 128 , 1 ) , - GetStripPositionY( TelescopeNumber[i] , 128 , 1 ) , - GetStripPositionZ( TelescopeNumber[i] , 128 , 1 ) ) - - - TVector3 ( GetStripPositionX( TelescopeNumber[i] , 1 , 1 ) , - GetStripPositionY( TelescopeNumber[i] , 1 , 1 ) , - GetStripPositionZ( TelescopeNumber[i] , 1 , 1 ) ); - - TVector3 V = TVector3 ( GetStripPositionX( TelescopeNumber[i] , 128 , 128 ) , - GetStripPositionY( TelescopeNumber[i] , 128 , 128 ) , - GetStripPositionZ( TelescopeNumber[i] , 128 , 128 ) ) - - - TVector3 ( GetStripPositionX( TelescopeNumber[i] , 128 , 1 ) , - GetStripPositionY( TelescopeNumber[i] , 128 , 1 ) , - GetStripPositionZ( TelescopeNumber[i] , 128 , 1 ) ); - - TVector3 Normal = U.Cross(V); - - return(Normal.Unit()) ; - - } + { + TVector3 U = TVector3 ( GetStripPositionX( TelescopeNumber[i] , 128 , 1 ) , + GetStripPositionY( TelescopeNumber[i] , 128 , 1 ) , + GetStripPositionZ( TelescopeNumber[i] , 128 , 1 ) ) + + -TVector3 ( GetStripPositionX( TelescopeNumber[i] , 1 , 1 ) , + GetStripPositionY( TelescopeNumber[i] , 1 , 1 ) , + GetStripPositionZ( TelescopeNumber[i] , 1 , 1 ) ); + + TVector3 V = TVector3 ( GetStripPositionX( TelescopeNumber[i] , 128 , 128 ) , + GetStripPositionY( TelescopeNumber[i] , 128 , 128 ) , + GetStripPositionZ( TelescopeNumber[i] , 128 , 128 ) ) + + -TVector3 ( GetStripPositionX( TelescopeNumber[i] , 128 , 1 ) , + GetStripPositionY( TelescopeNumber[i] , 128 , 1 ) , + GetStripPositionZ( TelescopeNumber[i] , 128 , 1 ) ); + + TVector3 Normal = U.Cross(V); + + return(Normal.Unit()) ; + } /////////////////////////////////////////////////////////////////////////// namespace MUST2_LOCAL - { - - // tranform an integer to a string - string itoa(int value) - { - std::ostringstream o; - - if (!(o << value)) - return "" ; - - return o.str(); - } - - // DSSD - // X - double fSi_X_E(const TMust2Data* m_EventData , const int i) - { - return CalibrationManager::getInstance()->ApplyCalibration( "MUST2/T" + itoa( m_EventData->GetMMStripXEDetectorNbr(i) ) + "_Si_X" + itoa( m_EventData->GetMMStripXEStripNbr(i) ) + "_E", - m_EventData->GetMMStripXEEnergy(i) ); - } - - double fSi_X_T(const TMust2Data* m_EventData , const int i) - { - return CalibrationManager::getInstance()->ApplyCalibration( "MUST2/T" + itoa( m_EventData->GetMMStripXTDetectorNbr(i) ) + "_Si_X" + itoa( m_EventData->GetMMStripXTStripNbr(i) ) +"_T", - m_EventData->GetMMStripXTTime(i) ); - } - - // Y - double fSi_Y_E(const TMust2Data* m_EventData , const int i) - { - return CalibrationManager::getInstance()->ApplyCalibration( "MUST2/T" + itoa( m_EventData->GetMMStripYEDetectorNbr(i) ) + "_Si_Y" + itoa( m_EventData->GetMMStripYEStripNbr(i) ) +"_E", - m_EventData->GetMMStripYEEnergy(i) ); - } - - double fSi_Y_T(const TMust2Data* m_EventData , const int i) - { - return CalibrationManager::getInstance()->ApplyCalibration( "MUST2/T" + itoa( m_EventData->GetMMStripYTDetectorNbr(i) ) + "_Si_Y" + itoa( m_EventData->GetMMStripYTStripNbr(i) ) +"_T", - m_EventData->GetMMStripYTTime(i) ); - } - - - // SiLi - double fSiLi_E(const TMust2Data* m_EventData , const int i) - { - return CalibrationManager::getInstance()->ApplyCalibration( "MUST2/T" + itoa( m_EventData->GetMMSiLiEDetectorNbr(i) ) + "_SiLi" + itoa( m_EventData->GetMMSiLiEPadNbr(i) ) +"_E", - m_EventData->GetMMSiLiEEnergy(i) ); - } - - double fSiLi_T(const TMust2Data* m_EventData , const int i) - { - return CalibrationManager::getInstance()->ApplyCalibration( "MUST2/T" + itoa( m_EventData->GetMMSiLiTDetectorNbr(i) ) + "_SiLi" + itoa( m_EventData->GetMMSiLiTPadNbr(i) )+"_T", - m_EventData->GetMMSiLiTTime(i) ); - } - - // CsI - double fCsI_E(const TMust2Data* m_EventData , const int i) - { - return CalibrationManager::getInstance()->ApplyCalibration( "MUST2/T" + itoa( m_EventData->GetMMCsIEDetectorNbr(i) ) + "_CsI" + itoa( m_EventData->GetMMCsIECristalNbr(i) ) +"_E", - m_EventData->GetMMCsIEEnergy(i) ); - } - - double fCsI_T(const TMust2Data* m_EventData , const int i) - { - return CalibrationManager::getInstance()->ApplyCalibration( "MUST2/T" + itoa( m_EventData->GetMMCsITDetectorNbr(i) ) + "_CsI" + itoa( m_EventData->GetMMCsITCristalNbr(i) ) +"_T", - m_EventData->GetMMCsITTime(i) ); - } - - } + { + + // tranform an integer to a string + string itoa(int value) + { + std::ostringstream o; + + if (!(o << value)) + return "" ; + + return o.str(); + } + + // DSSD + // X + double fSi_X_E(const TMust2Data* m_EventData , const int i) + { + return CalibrationManager::getInstance()->ApplyCalibration( "MUST2/T" + itoa( m_EventData->GetMMStripXEDetectorNbr(i) ) + "_Si_X" + itoa( m_EventData->GetMMStripXEStripNbr(i) ) + "_E", + m_EventData->GetMMStripXEEnergy(i) ); + } + + double fSi_X_T(const TMust2Data* m_EventData , const int i) + { + return CalibrationManager::getInstance()->ApplyCalibration( "MUST2/T" + itoa( m_EventData->GetMMStripXTDetectorNbr(i) ) + "_Si_X" + itoa( m_EventData->GetMMStripXTStripNbr(i) ) +"_T", + m_EventData->GetMMStripXTTime(i) ); + } + + // Y + double fSi_Y_E(const TMust2Data* m_EventData , const int i) + { + return CalibrationManager::getInstance()->ApplyCalibration( "MUST2/T" + itoa( m_EventData->GetMMStripYEDetectorNbr(i) ) + "_Si_Y" + itoa( m_EventData->GetMMStripYEStripNbr(i) ) +"_E", + m_EventData->GetMMStripYEEnergy(i) ); + } + + double fSi_Y_T(const TMust2Data* m_EventData , const int i) + { + return CalibrationManager::getInstance()->ApplyCalibration( "MUST2/T" + itoa( m_EventData->GetMMStripYTDetectorNbr(i) ) + "_Si_Y" + itoa( m_EventData->GetMMStripYTStripNbr(i) ) +"_T", + m_EventData->GetMMStripYTTime(i) ); + } + + + // SiLi + double fSiLi_E(const TMust2Data* m_EventData , const int i) + { + return CalibrationManager::getInstance()->ApplyCalibration( "MUST2/T" + itoa( m_EventData->GetMMSiLiEDetectorNbr(i) ) + "_SiLi" + itoa( m_EventData->GetMMSiLiEPadNbr(i) ) +"_E", + m_EventData->GetMMSiLiEEnergy(i) ); + } + + double fSiLi_T(const TMust2Data* m_EventData , const int i) + { + return CalibrationManager::getInstance()->ApplyCalibration( "MUST2/T" + itoa( m_EventData->GetMMSiLiTDetectorNbr(i) ) + "_SiLi" + itoa( m_EventData->GetMMSiLiTPadNbr(i) )+"_T", + m_EventData->GetMMSiLiTTime(i) ); + } + + // CsI + double fCsI_E(const TMust2Data* m_EventData , const int i) + { + return CalibrationManager::getInstance()->ApplyCalibration( "MUST2/T" + itoa( m_EventData->GetMMCsIEDetectorNbr(i) ) + "_CsI" + itoa( m_EventData->GetMMCsIECristalNbr(i) ) +"_E", + m_EventData->GetMMCsIEEnergy(i) ); + } + + double fCsI_T(const TMust2Data* m_EventData , const int i) + { + return CalibrationManager::getInstance()->ApplyCalibration( "MUST2/T" + itoa( m_EventData->GetMMCsITDetectorNbr(i) ) + "_CsI" + itoa( m_EventData->GetMMCsITCristalNbr(i) ) +"_T", + m_EventData->GetMMCsITTime(i) ); + } + + } diff --git a/NPLib/MUST2/TMust2Physics.h b/NPLib/MUST2/TMust2Physics.h index 9f9569b4448967e14009e7efb135be8bd4767040..2392d71cd77895a5f7c4c2e9df9f3127b9ff2b13 100644 --- a/NPLib/MUST2/TMust2Physics.h +++ b/NPLib/MUST2/TMust2Physics.h @@ -2,25 +2,25 @@ #define TMUST2PHYSICS_H /***************************************************************************** * Copyright (C) 2009-2010 this file is part of the NPTool Project * - * * + * * * For the licensing terms see $NPTOOL/Licence/NPTool_Licence * * For the list of contributors see $NPTOOL/Licence/Contributors * *****************************************************************************/ /***************************************************************************** * Original Author: Adrien MATTA contact address: matta@ipno.in2p3.fr * - * * - * Creation Date : febuary 2009 * - * Last update : * + * * + * Creation Date : febuary 2009 * + * Last update : * *---------------------------------------------------------------------------* - * Decription: * - * This class hold must2 treated data * - * * + * Decription: * + * This class hold must2 treated data * + * * *---------------------------------------------------------------------------* - * Comment: * - * * - * * - * * + * Comment: * + * * + * * + * * *****************************************************************************/ // STL #include <vector> @@ -38,233 +38,233 @@ using namespace std ; class TMust2Physics : public TObject, public NPA::VDetector { - public: - TMust2Physics() ; - ~TMust2Physics() {}; + public: + TMust2Physics(); + ~TMust2Physics() {}; - public: - void Clear() ; - void Clear(const Option_t*) {}; + public: + void Clear(); + void Clear(const Option_t*) {}; - public: - vector < TVector2 > Match_X_Y() ; - bool Match_Si_CsI(int X, int Y , int CristalNbr); - bool Match_Si_SiLi(int X, int Y , int PadNbr); - bool ResolvePseudoEvent(); - int CheckEvent(); - - public: - - // Provide Physical Multiplicity - Int_t EventMultiplicity ; - - // Provide a Classification of Event - vector<int> EventType ; - - // Telescope - vector<int> TelescopeNumber ; - - // Si - vector<double> Si_E ; - vector<double> Si_T ; - vector<int> Si_X ; - vector<int> Si_Y ; + public: + vector < TVector2 > Match_X_Y() ; + bool Match_Si_CsI(int X, int Y , int CristalNbr); + bool Match_Si_SiLi(int X, int Y , int PadNbr); + bool ResolvePseudoEvent(); + int CheckEvent(); + + public: + + // Provide Physical Multiplicity + Int_t EventMultiplicity; + + // Provide a Classification of Event + vector<int> EventType ; + + // Telescope + vector<int> TelescopeNumber ; + + // Si + vector<double> Si_E ; + vector<double> Si_T ; + vector<int> Si_X ; + vector<int> Si_Y ; - // Use for checking purpose - vector<double> Si_EX ; - vector<double> Si_TX ; - vector<double> Si_EY ; - vector<double> Si_TY ; - vector<int> TelescopeNumber_X ; - vector<int> TelescopeNumber_Y ; - // Si(Li) - vector<double> SiLi_E ; - vector<double> SiLi_T ; - vector<int> SiLi_N ; - - // CsI - vector<double> CsI_E ; - vector<double> CsI_T ; - vector<int> CsI_N ; - - // Physical Value - vector<double> TotalEnergy ; - - - public: // Innherited from VDetector Class - - // Read stream at ConfigFile to pick-up parameters of detector (Position,...) using Token - void ReadConfiguration(string) ; - + // Use for checking purpose + vector<double> Si_EX ; + vector<double> Si_TX ; + vector<double> Si_EY ; + vector<double> Si_TY ; + vector<int> TelescopeNumber_X ; + vector<int> TelescopeNumber_Y ; + // Si(Li) + vector<double> SiLi_E ; + vector<double> SiLi_T ; + vector<int> SiLi_N ; + + // CsI + vector<double> CsI_E ; + vector<double> CsI_T ; + vector<int> CsI_N ; + + // Physical Value + vector<double> TotalEnergy ; + + + public: // Innherited from VDetector Class + + // Read stream at ConfigFile to pick-up parameters of detector (Position,...) using Token + void ReadConfiguration(string) ; + - // Add Parameter to the CalibrationManger - void AddParameterToCalibrationManager() ; - - - // 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 InitializeRootInput() ; + // Add Parameter to the CalibrationManger + void AddParameterToCalibrationManager() ; + + + // 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 InitializeRootInput() ; - // Create associated branches and associated private member DetectorPhysics address - void InitializeRootOutput() ; - - - // This method is called at each event read from the Input Tree. Aime is to build treat Raw dat in order to extract physical parameter. - void BuildPhysicalEvent() ; - - // Same as above, but only the simplest event and/or simple method are used (low multiplicity, faster algorythm but less efficient ...). - // This method aimed to be used for analysis performed during experiment, when speed is requiered. - // NB: This method can eventually be the same as BuildPhysicalEvent. - void BuildSimplePhysicalEvent() ; + // Create associated branches and associated private member DetectorPhysics address + void InitializeRootOutput() ; + + + // This method is called at each event read from the Input Tree. Aime is to build treat Raw dat in order to extract physical parameter. + void BuildPhysicalEvent() ; + + // Same as above, but only the simplest event and/or simple method are used (low multiplicity, faster algorythm but less efficient ...). + // This method aimed to be used for analysis performed during experiment, when speed is requiered. + // NB: This method can eventually be the same as BuildPhysicalEvent. + void BuildSimplePhysicalEvent() ; - // Those two method all to clear the Event Physics or Data - void ClearEventPhysics() {Clear();} - void ClearEventData() {m_EventData->Clear();} - - public: // Specific to MUST2 Array - - // Clear The PreTeated object - void ClearPreTreatedData() {m_PreTreatedData->Clear();} - - // Remove bad channel, calibrate the data and apply threshold - void PreTreat(); - - // Return false if the channel is disabled by user - // Frist argument is either "X","Y","SiLi","CsI" - bool IsValidChannel(const string DetectorType, const int telescope , const int channel); - - // Initialize the standard parameter for analysis - // ie: all channel enable, maximum multiplicity for strip = number of telescope - void InitializeStandardParameter(); - - // Read the user configuration file; if no file found, load standard one - void ReadAnalysisConfig(); - - // Add a Telescope using Corner Coordinate information - void AddTelescope( TVector3 C_X1_Y1 , - TVector3 C_X128_Y1 , - TVector3 C_X1_Y128 , - TVector3 C_X128_Y128 ); - - // Add a Telescope using R Theta Phi of Si center information - void AddTelescope( double theta , - double phi , - double distance , - double beta_u , - double beta_v , - double beta_w ); - - // Use for reading Calibration Run, very simple methods; only apply calibration, no condition - void ReadCalibrationRun(); - - // Use to access the strip position - double GetStripPositionX( const int N , const int X , const int Y ) const{ return m_StripPositionX[N-1][X-1][Y-1] ; } ; - double GetStripPositionY( const int N , const int X , const int Y ) const{ return m_StripPositionY[N-1][X-1][Y-1] ; } ; - double GetStripPositionZ( const int N , const int X , const int Y ) const{ return m_StripPositionZ[N-1][X-1][Y-1] ; } ; + // Those two method all to clear the Event Physics or Data + void ClearEventPhysics() {Clear();} + void ClearEventData() {m_EventData->Clear();} + + public: // Specific to MUST2 Array + + // Clear The PreTeated object + void ClearPreTreatedData() {m_PreTreatedData->Clear();} + + // Remove bad channel, calibrate the data and apply threshold + void PreTreat(); + + // Return false if the channel is disabled by user + // Frist argument is either "X","Y","SiLi","CsI" + bool IsValidChannel(const string DetectorType, const int telescope , const int channel); + + // Initialize the standard parameter for analysis + // ie: all channel enable, maximum multiplicity for strip = number of telescope + void InitializeStandardParameter(); + + // Read the user configuration file; if no file found, load standard one + void ReadAnalysisConfig(); + + // Add a Telescope using Corner Coordinate information + void AddTelescope( TVector3 C_X1_Y1, + TVector3 C_X128_Y1, + TVector3 C_X1_Y128, + TVector3 C_X128_Y128); + + // Add a Telescope using R Theta Phi of Si center information + void AddTelescope( double theta, + double phi, + double distance, + double beta_u, + double beta_v, + double beta_w); + + // Use for reading Calibration Run, very simple methods; only apply calibration, no condition + void ReadCalibrationRun(); + + // Use to access the strip position + double GetStripPositionX( const int N , const int X , const int Y ) const{ return m_StripPositionX[N-1][X-1][Y-1] ; } ; + double GetStripPositionY( const int N , const int X , const int Y ) const{ return m_StripPositionY[N-1][X-1][Y-1] ; } ; + double GetStripPositionZ( const int N , const int X , const int Y ) const{ return m_StripPositionZ[N-1][X-1][Y-1] ; } ; - double GetNumberOfTelescope() const { return m_NumberOfTelescope ; } ; + double GetNumberOfTelescope() const { return m_NumberOfTelescope ; }; - // To be called after a build Physical Event - int GetEventMultiplicity() const { return EventMultiplicity; } ; - - double GetEnergyDeposit(const int i) const{ return TotalEnergy[i] ;} ; - - TVector3 GetPositionOfInteraction(const int i) const ; - TVector3 GetTelescopeNormal(const int i) const ; + // To be called after a build Physical Event + int GetEventMultiplicity() const { return EventMultiplicity; }; + + double GetEnergyDeposit(const int i) const{ return TotalEnergy[i] ;}; + + TVector3 GetPositionOfInteraction(const int i) const; + TVector3 GetTelescopeNormal(const int i) const; - private: // Parameter used in the analysis - - // By default take EX and TY. - bool m_Take_E_Y;//! - bool m_Take_T_Y;//! - - - // Event over this value after pre-treatment are not treated / avoid long treatment time on spurious event - int m_MaximumStripMultiplicityAllowed ;//! - // Give the allowance in percent of the difference in energy between X and Y - double m_StripEnergyMatchingSigma ; //! - double m_StripEnergyMatchingNumberOfSigma ; //! - - // Raw Threshold - int m_Si_X_E_RAW_Threshold ;//! - int m_Si_Y_E_RAW_Threshold ;//! - int m_SiLi_E_RAW_Threshold ;//! - int m_CsI_E_RAW_Threshold ;//! - - // Calibrated Threshold - double m_Si_X_E_Threshold ;//! - double m_Si_Y_E_Threshold ;//! - double m_SiLi_E_Threshold ;//! - double m_CsI_E_Threshold ;//! - - // Geometric Matching - // size in strip of a pad - int m_SiLi_Size;//! - // center position of the pad on X - vector< int > m_SiLi_MatchingX;//! - // center position of the pad on Y - vector< int > m_SiLi_MatchingY;//! - // size in strip of a cristal - int m_CsI_Size;//! - // center position of the cristal on X - vector< int > m_CsI_MatchingX;//! - // center position of the cristal on X - vector< int > m_CsI_MatchingY;//! - - // If set to true, all event that do not come in front of a cristal will be ignore all time (crossing or not), - // Warning, this option reduce statistic, however it help eliminating unrealevent event that cross the DSSD - // And go between pad or cristal. - bool m_Ignore_not_matching_SiLi;//! - bool m_Ignore_not_matching_CsI;//! - - private: // Root Input and Output tree classes - - TMust2Data* m_EventData ;//! - TMust2Data* m_PreTreatedData ;//! - TMust2Physics* m_EventPhysics ;//! + private: // Parameter used in the analysis + + // By default take EX and TY. + bool m_Take_E_Y;//! + bool m_Take_T_Y;//! + + + // Event over this value after pre-treatment are not treated / avoid long treatment time on spurious event + int m_MaximumStripMultiplicityAllowed ;//! + // Give the allowance in percent of the difference in energy between X and Y + double m_StripEnergyMatchingSigma ; //! + double m_StripEnergyMatchingNumberOfSigma ; //! + + // Raw Threshold + int m_Si_X_E_RAW_Threshold ;//! + int m_Si_Y_E_RAW_Threshold ;//! + int m_SiLi_E_RAW_Threshold ;//! + int m_CsI_E_RAW_Threshold ;//! + + // Calibrated Threshold + double m_Si_X_E_Threshold ;//! + double m_Si_Y_E_Threshold ;//! + double m_SiLi_E_Threshold ;//! + double m_CsI_E_Threshold ;//! + + // Geometric Matching + // size in strip of a pad + int m_SiLi_Size;//! + // center position of the pad on X + vector< int > m_SiLi_MatchingX;//! + // center position of the pad on Y + vector< int > m_SiLi_MatchingY;//! + // size in strip of a cristal + int m_CsI_Size;//! + // center position of the cristal on X + vector< int > m_CsI_MatchingX;//! + // center position of the cristal on X + vector< int > m_CsI_MatchingY;//! + + // If set to true, all event that do not come in front of a cristal will be ignore all time (crossing or not), + // Warning, this option reduce statistic, however it help eliminating unrealevent event that cross the DSSD + // And go between pad or cristal. + bool m_Ignore_not_matching_SiLi;//! + bool m_Ignore_not_matching_CsI;//! + + private: // Root Input and Output tree classes + + TMust2Data* m_EventData;//! + TMust2Data* m_PreTreatedData;//! + TMust2Physics* m_EventPhysics;//! - private: // Map of activated channel - map< int, vector<bool> > m_XChannelStatus ;//! - map< int, vector<bool> > m_YChannelStatus ;//! - map< int, vector<bool> > m_SiLiChannelStatus ;//! - map< int, vector<bool> > m_CsIChannelStatus ;//! + private: // Map of activated channel + map< int, vector<bool> > m_XChannelStatus;//! + map< int, vector<bool> > m_YChannelStatus;//! + map< int, vector<bool> > m_SiLiChannelStatus;//! + map< int, vector<bool> > m_CsIChannelStatus;//! - private: // Spatial Position of Strip Calculated on bases of detector position - - int m_NumberOfTelescope ;//! - - vector< vector < vector < double > > > m_StripPositionX ;//! - vector< vector < vector < double > > > m_StripPositionY ;//! - vector< vector < vector < double > > > m_StripPositionZ ;//! - - ClassDef(TMust2Physics,1) // Must2Physics structure + private: // Spatial Position of Strip Calculated on bases of detector position + + int m_NumberOfTelescope;//! + + vector< vector < vector < double > > > m_StripPositionX;//! + vector< vector < vector < double > > > m_StripPositionY;//! + vector< vector < vector < double > > > m_StripPositionZ;//! + + ClassDef(TMust2Physics,1) // Must2Physics structure }; namespace MUST2_LOCAL - { + { - // tranform an integer to a string - string itoa(int value); - // DSSD - // X - double fSi_X_E(const TMust2Data* Data, const int i); - double fSi_X_T(const TMust2Data* Data, const int i); - - // Y - double fSi_Y_E(const TMust2Data* Data, const int i); - double fSi_Y_T(const TMust2Data* Data, const int i); - - // SiLi - double fSiLi_E(const TMust2Data* Data, const int i); - double fSiLi_T(const TMust2Data* Data, const int i); - - // CsI - double fCsI_E(const TMust2Data* Data, const int i); - double fCsI_T(const TMust2Data* Data, const int i); - - } + // tranform an integer to a string + string itoa(int value); + // DSSD + // X + double fSi_X_E(const TMust2Data* Data, const int i); + double fSi_X_T(const TMust2Data* Data, const int i); + + // Y + double fSi_Y_E(const TMust2Data* Data, const int i); + double fSi_Y_T(const TMust2Data* Data, const int i); + + // SiLi + double fSiLi_E(const TMust2Data* Data, const int i); + double fSiLi_T(const TMust2Data* Data, const int i); + + // CsI + double fCsI_E(const TMust2Data* Data, const int i); + double fCsI_T(const TMust2Data* Data, const int i); + + } #endif diff --git a/NPLib/Paris/Paris.cxx b/NPLib/Paris/Paris.cxx index 8e0ab39149fbe822514af47f0f472f5db902b8b9..1e7256424da3886cfd03a70df01c56a26d0796e6 100644 --- a/NPLib/Paris/Paris.cxx +++ b/NPLib/Paris/Paris.cxx @@ -22,7 +22,7 @@ #include "Paris.h" // C++ headers -#include <iostream> +#include <iostream> #include <fstream> #include <string> #include <cmath> @@ -35,16 +35,16 @@ // ROOT headers #include "TChain.h" -using namespace std ; - -// Default Constructor +using namespace std ; + +// Default Constructor Paris::Paris() { m_NumberOfModule = 0; m_EventData = new TParisData(); m_EventPhysics = new TParisPhysics(); -} +} @@ -53,17 +53,17 @@ Paris::~Paris() m_NumberOfModule = 0; delete m_EventData; delete m_EventPhysics; -} +} // Read stream at ConfigFile to pick-up parameters of detector (Position,...) using Token -void Paris::ReadConfiguration(string Path) +void Paris::ReadConfiguration(string Path) { - ifstream ConfigFile ; - ConfigFile.open(Path.c_str()) ; - string LineBuffer ; - string DataBuffer ; + ifstream ConfigFile ; + ConfigFile.open(Path.c_str()) ; + string LineBuffer ; + string DataBuffer ; // A:X1_Y1 --> X:1 Y:1 // B:X128_Y1 --> X:128 Y:1 @@ -107,8 +107,8 @@ void Paris::ReadConfiguration(string Path) else ReadingStatus = false; // Reading Block - while (ReadingStatus) { - if (isCluster) { // square shape + while (ReadingStatus) { + if (isCluster) { // square shape ConfigFile >> DataBuffer ; // Comment Line if (DataBuffer.compare(0, 1, "%") == 0) { @@ -260,7 +260,7 @@ void Paris::ReadConfiguration(string Path) } // end test for adding a module } // end test for ParisCluster shape - else if (isPhoswich) { // ParisPhoswich shape + else if (isPhoswich) { // ParisPhoswich shape ConfigFile >> DataBuffer ; // Comment Line if (DataBuffer.compare(0, 1, "%") == 0) { @@ -422,7 +422,7 @@ void Paris::ReadConfiguration(string Path) // Read stream at Path and pick-up calibration parameter using Token // If argument is "Simulation" no change calibration is loaded -void Paris::ReadCalibrationFile(string Path) +void Paris::ReadCalibrationFile(string Path) { // Order of Polynom function used for calibration int Calibration_Si_E_Order; @@ -431,16 +431,16 @@ void Paris::ReadCalibrationFile(string Path) int Calibration_CsI_E_Order; // Calibration_Si_X_E[DetectorNumber][StripNumber][Order of Coeff] - vector< vector< vector< double > > > Calibration_Si_X_E ; - vector< vector< vector< double > > > Calibration_Si_X_T ; - vector< vector< vector< double > > > Calibration_Si_Y_E ; - vector< vector< vector< double > > > Calibration_Si_Y_T ; + vector< vector< vector< double > > > Calibration_Si_X_E ; + vector< vector< vector< double > > > Calibration_Si_X_T ; + vector< vector< vector< double > > > Calibration_Si_Y_E ; + vector< vector< vector< double > > > Calibration_Si_Y_T ; // Calibration_SiLi_E[DetectorNumber][PadNumber][Order of Coeff] - vector< vector< vector< double > > > Calibration_SiLi_E ; + vector< vector< vector< double > > > Calibration_SiLi_E ; // Calibration_SiLi_E[DetectorNumber][CrystalNumber][Order of Coeff] - vector< vector< vector< double > > > Calibration_CsI_E ; + vector< vector< vector< double > > > Calibration_CsI_E ; if (Path == "Simulation") { // Simulation case: data already calibrated Calibration_Si_E_Order = 1; @@ -449,29 +449,29 @@ void Paris::ReadCalibrationFile(string Path) Calibration_CsI_E_Order = 1; vector<double> Coef; - // Order 0 Order 1 - Coef.push_back(0) ; Coef.push_back(1) ; - - vector< vector<double> > StripLine ; - StripLine.resize( 128 , Coef) ; - - Calibration_Si_X_E.resize( m_NumberOfModule , StripLine) ; - Calibration_Si_X_T.resize( m_NumberOfModule , StripLine) ; - Calibration_Si_Y_E.resize( m_NumberOfModule , StripLine) ; - Calibration_Si_Y_T.resize( m_NumberOfModule , StripLine) ; - - Calibration_SiLi_E.resize( m_NumberOfModule , StripLine) ; - Calibration_CsI_E .resize( m_NumberOfModule , StripLine) ; + // Order 0 Order 1 + Coef.push_back(0) ; Coef.push_back(1) ; + + vector< vector<double> > StripLine ; + StripLine.resize( 128 , Coef) ; + + Calibration_Si_X_E.resize( m_NumberOfModule , StripLine) ; + Calibration_Si_X_T.resize( m_NumberOfModule , StripLine) ; + Calibration_Si_Y_E.resize( m_NumberOfModule , StripLine) ; + Calibration_Si_Y_T.resize( m_NumberOfModule , StripLine) ; + + Calibration_SiLi_E.resize( m_NumberOfModule , StripLine) ; + Calibration_CsI_E .resize( m_NumberOfModule , StripLine) ; } else { } -} +} - + // 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 Paris::InitializeRootInput() +void Paris::InitializeRootInput() { TChain* inputChain = RootInput::getInstance()->GetChain(); inputChain->SetBranchStatus("PARIS", true); @@ -482,7 +482,7 @@ void Paris::InitializeRootInput() // Create associated branches and associated private member DetectorPhysics address -void Paris::InitializeRootOutput() +void Paris::InitializeRootOutput() { TTree* outputTree = RootOutput::getInstance()->GetTree(); outputTree->Branch("PARIS", "TParisPhysics", &m_EventPhysics); @@ -491,7 +491,7 @@ void Paris::InitializeRootOutput() // This method is called at each event read from the Input Tree. Aime is to build treat Raw dat in order to extract physical parameter. -void Paris::BuildPhysicalEvent() +void Paris::BuildPhysicalEvent() { m_EventPhysics -> BuildPhysicalEvent(m_EventData); } @@ -501,7 +501,7 @@ void Paris::BuildPhysicalEvent() // Same as above, but only the simplest event and/or simple method are used (low multiplicity, faster algorythm but less efficient ...). // This method aimed to be used for analysis performed during experiment, when speed is requiered. // NB: This method can eventually be the same as BuildPhysicalEvent. -void Paris::BuildSimplePhysicalEvent() +void Paris::BuildSimplePhysicalEvent() { m_EventPhysics -> BuildSimplePhysicalEvent(m_EventData); } @@ -532,7 +532,7 @@ void Paris::AddModuleSquare(TVector3 C_X1_Y1, TVector3 Strip_1_1; // Geometry Parameter - double Face = 98; // mm + double Face = 98; // mm double NumberOfStrip = 128; double StripPitch = Face/NumberOfStrip; // mm @@ -541,9 +541,9 @@ void Paris::AddModuleSquare(TVector3 C_X1_Y1, vector<double> lineY; vector<double> lineZ; - vector< vector< double > > OneModuleStripPositionX; - vector< vector< double > > OneModuleStripPositionY; - vector< vector< double > > OneModuleStripPositionZ; + vector< vector< double > > OneModuleStripPositionX; + vector< vector< double > > OneModuleStripPositionY; + vector< vector< double > > OneModuleStripPositionZ; // Moving StripCenter to 1.1 corner: Strip_1_1 = C_X1_Y1 + (U+V) * (StripPitch/2.); @@ -559,7 +559,7 @@ void Paris::AddModuleSquare(TVector3 C_X1_Y1, lineX.push_back( StripCenter.X() ); lineY.push_back( StripCenter.Y() ); - lineZ.push_back( StripCenter.Z() ); + lineZ.push_back( StripCenter.Z() ); } OneModuleStripPositionX.push_back(lineX); @@ -589,7 +589,7 @@ void Paris::AddModuleSquare(double theta, phi = phi * Pi/180. ; // Vector U on Module Face (paralelle to Y Strip) (NB: remember that Y strip are allong X axis) - TVector3 U ; + TVector3 U ; // Vector V on Module Face (parallele to X Strip) TVector3 V ; // Vector W normal to Module Face (pointing CsI) @@ -629,10 +629,10 @@ void Paris::AddModuleSquare(double theta, vector<double> lineY; vector<double> lineZ; - vector< vector< double > > OneModuleStripPositionX; - vector< vector< double > > OneModuleStripPositionY; - vector< vector< double > > OneModuleStripPositionZ; - + vector< vector< double > > OneModuleStripPositionX; + vector< vector< double > > OneModuleStripPositionY; + vector< vector< double > > OneModuleStripPositionZ; + double X, Y, Z; // Moving C to the 1.1 corner: @@ -691,7 +691,7 @@ void Paris::AddModuleDummyShape(TVector3 C_X1_Y1, TVector3 Strip_1_1; // Geometry Parameter - double Face = 50; // mm + double Face = 50; // mm double NumberOfStrip = 128; double StripPitch = Face/NumberOfStrip; // mm @@ -700,9 +700,9 @@ void Paris::AddModuleDummyShape(TVector3 C_X1_Y1, vector<double> lineY; vector<double> lineZ; - vector< vector< double > > OneModuleStripPositionX; - vector< vector< double > > OneModuleStripPositionY; - vector< vector< double > > OneModuleStripPositionZ; + vector< vector< double > > OneModuleStripPositionX; + vector< vector< double > > OneModuleStripPositionY; + vector< vector< double > > OneModuleStripPositionZ; // Moving StripCenter to 1.1 corner: Strip_1_1 = C_X1_Y1 + (U+V) * (StripPitch/2.); @@ -718,7 +718,7 @@ void Paris::AddModuleDummyShape(TVector3 C_X1_Y1, lineX.push_back( StripCenter.X() ); lineY.push_back( StripCenter.Y() ); - lineZ.push_back( StripCenter.Z() ); + lineZ.push_back( StripCenter.Z() ); } OneModuleStripPositionX.push_back(lineX); @@ -748,7 +748,7 @@ void Paris::AddModuleDummyShape(double theta, phi = phi * Pi/180. ; // Vector U on Module Face (paralelle to Y Strip) (NB: remember that Y strip are allong X axis) - TVector3 U ; + TVector3 U ; // Vector V on Module Face (parallele to X Strip) TVector3 V ; // Vector W normal to Module Face (pointing CsI) @@ -788,10 +788,10 @@ void Paris::AddModuleDummyShape(double theta, vector<double> lineY; vector<double> lineZ; - vector< vector< double > > OneModuleStripPositionX; - vector< vector< double > > OneModuleStripPositionY; - vector< vector< double > > OneModuleStripPositionZ; - + vector< vector< double > > OneModuleStripPositionX; + vector< vector< double > > OneModuleStripPositionY; + vector< vector< double > > OneModuleStripPositionZ; + double X, Y, Z; // Moving C to the 1.1 corner: @@ -826,7 +826,7 @@ void Paris::AddModuleDummyShape(double theta, -double Paris::GetEnergyDeposit() +double Paris::GetEnergyDeposit() { if (m_EventPhysics->ParisTotalEnergy.size() > 0) return m_EventPhysics->ParisTotalEnergy[0]; @@ -834,7 +834,7 @@ double Paris::GetEnergyDeposit() return -1000; } -double Paris::GetEnergyInDeposit() // inner Layer +double Paris::GetEnergyInDeposit() // inner Layer { if (m_EventPhysics->ParisInTotalEnergy.size() > 0) return m_EventPhysics->ParisInTotalEnergy[0]; @@ -842,7 +842,7 @@ double Paris::GetEnergyInDeposit() // inner Layer return -1000; } -double Paris::GetEnergyOutDeposit() // Outer Layer +double Paris::GetEnergyOutDeposit() // Outer Layer { if (m_EventPhysics->ParisOutTotalEnergy.size() > 0) return m_EventPhysics->ParisOutTotalEnergy[0]; diff --git a/NPLib/Paris/Paris.h b/NPLib/Paris/Paris.h index cae59358bd5bfdb93d16caaea612475ce72a9ef4..090913088f93cad8124ba95070238651c2735ff2 100644 --- a/NPLib/Paris/Paris.h +++ b/NPLib/Paris/Paris.h @@ -56,15 +56,15 @@ public: // This method is called at each event read from the Input Tree. // The aim is to build treat Raw dat in order to extract physical parameter. void BuildPhysicalEvent(); - + // Same as above, but only the simplest event and/or simple method are used (low multiplicity, faster algorythm but less efficient ...). // This method aimed to be used for analysis performed during experiment, when speed is requiered. // NB: This method can eventually be the same as BuildPhysicalEvent. void BuildSimplePhysicalEvent(); // Those two method all to clear the Event Physics or Data - void ClearEventPhysics() {m_EventPhysics->Clear();} - void ClearEventData() {m_EventData->Clear();} + void ClearEventPhysics() {m_EventPhysics->Clear();} + void ClearEventData() {m_EventData->Clear();} public: @@ -102,38 +102,38 @@ public: double beta_w); // Getters to retrieve the (X,Y,Z) coordinates of a pixel defined by strips (X,Y) - double GetStripPositionX(int N ,int X ,int Y) { return m_StripPositionX[N-1][X-1][Y-1]; } - double GetStripPositionY(int N ,int X ,int Y) { return m_StripPositionY[N-1][X-1][Y-1]; } - double GetStripPositionZ(int N ,int X ,int Y) { return m_StripPositionZ[N-1][X-1][Y-1]; } - double GetNumberOfModule() { return m_NumberOfModule; } + double GetStripPositionX(int N ,int X ,int Y) { return m_StripPositionX[N-1][X-1][Y-1]; } + double GetStripPositionY(int N ,int X ,int Y) { return m_StripPositionY[N-1][X-1][Y-1]; } + double GetStripPositionZ(int N ,int X ,int Y) { return m_StripPositionZ[N-1][X-1][Y-1]; } + double GetNumberOfModule() { return m_NumberOfModule; } // Get Root input and output objects - TParisData* GetEventData() {return m_EventData;} - TParisPhysics* GetEventPhysics() {return m_EventPhysics;} + TParisData* GetEventData() {return m_EventData;} + TParisPhysics* GetEventPhysics() {return m_EventPhysics;} // To be called after a build Physical Event - double GetEnergyDeposit(); - double GetEnergyInDeposit(); - double GetEnergyOutDeposit(); - TVector3 GetPositionOfInteraction(); + double GetEnergyDeposit(); + double GetEnergyInDeposit(); + double GetEnergyOutDeposit(); + TVector3 GetPositionOfInteraction(); - void Print(); + void Print(); private: //////////////////////////////////////// // Root Input and Output tree classes // //////////////////////////////////////// - TParisData* m_EventData; - TParisPhysics* m_EventPhysics; + TParisData* m_EventData; + TParisPhysics* m_EventPhysics; private: // Spatial Position of Strip Calculated on basis of detector position int m_NumberOfModule; - vector< vector < vector < double > > > m_StripPositionX; - vector< vector < vector < double > > > m_StripPositionY; - vector< vector < vector < double > > > m_StripPositionZ; + vector< vector < vector < double > > > m_StripPositionX; + vector< vector < vector < double > > > m_StripPositionY; + vector< vector < vector < double > > > m_StripPositionZ; }; #endif diff --git a/NPLib/Paris/TParisData.h b/NPLib/Paris/TParisData.h index 4d43088ec6c1feb1cc081b86101a439ec8fda3ab..57419e5f0faf98c9f8755c3408e09181606cbd4a 100644 --- a/NPLib/Paris/TParisData.h +++ b/NPLib/Paris/TParisData.h @@ -57,18 +57,18 @@ class TParisData : public TObject { /* private: - vector<double> fParis_Energy; - vector<double> fParis_Time; - vector<short> fParis_Number; + vector<double> fParis_Energy; + vector<double> fParis_Time; + vector<short> fParis_Number; */ public: TParisData(); virtual ~TParisData(); - void Clear(); - void Clear(const Option_t*) {}; - void Dump() const; + void Clear(); + void Clear(const Option_t*) {}; + void Dump() const; ///////////////////// GETTERS //////////////////////// @@ -143,16 +143,16 @@ class TParisData : public TObject { /* // (E) - //double GetEnergy(int i) {return fParis_Energy[i];} + //double GetEnergy(int i) {return fParis_Energy[i];} // (T) - //double GetTime(int i) {return fParis_Time[i];} + //double GetTime(int i) {return fParis_Time[i];} // (N) - int GetParisNumber(int i) {return fParis_Number[i];} - double GetEnergySize() {return fParis_Energy.size();} + int GetParisNumber(int i) {return fParis_Number[i];} + double GetEnergySize() {return fParis_Energy.size();} // (T) - double GetTimeSize() {return fParis_Time.size();} + double GetTimeSize() {return fParis_Time.size();} // (N) - int GetParisNumberSize() {return fParis_Number.size();} + int GetParisNumberSize() {return fParis_Number.size();} */ ///////////////////// SETTERS //////////////////////// @@ -218,9 +218,9 @@ class TParisData : public TObject { /* // (E) - void SetEnergy(double E) {fParis_Energy.push_back(E);} - void SetTime(double T) {fParis_Time.push_back(T);} - void SetParisNumber(int N) {fParis_Number.push_back(N);} + void SetEnergy(double E) {fParis_Energy.push_back(E);} + void SetTime(double T) {fParis_Time.push_back(T);} + void SetParisNumber(int N) {fParis_Number.push_back(N);} */ ClassDef(TParisData,1) // ParisData structure }; diff --git a/NPLib/Paris/TParisPhysics.cxx b/NPLib/Paris/TParisPhysics.cxx index 8fb3b62e5148b5d034f714dd49f1b6c1ede910dd..c6e1baf55fbbd94c8eb0dd794a811aeb66cf330c 100644 --- a/NPLib/Paris/TParisPhysics.cxx +++ b/NPLib/Paris/TParisPhysics.cxx @@ -70,41 +70,41 @@ void TParisPhysics::BuildPhysicalEvent(TParisData* Data) double EnergyTot=0.; if(multLaBrE>=1){ - //cout << "cava1b" <<endl; - //cout << Data->GetPARISLaBr3StageEEnergy(0) <<endl; - //cout << "cava1b" <<endl; + //cout << "cava1b" <<endl; + //cout << Data->GetPARISLaBr3StageEEnergy(0) <<endl; + //cout << "cava1b" <<endl; double EnergyStripFront; - double EnergyStrip; + double EnergyStrip; - for(int j=0;j<multLaBrE;j++) - { - EnergyStripFront= Data->GetPARISLaBr3StageEEnergy(j); + for(int j=0;j<multLaBrE;j++) + { + EnergyStripFront= Data->GetPARISLaBr3StageEEnergy(j); EnergyStrip = EnergyStripFront; ParisLaBr_E.push_back(EnergyStrip); EnergyTot += EnergyStrip; - //cout << "Energytot LaBr=" << EnergyTot << endl; - } + //cout << "Energytot LaBr=" << EnergyTot << endl; + } // Fill total energy in inner shell ParisInTotalEnergy.push_back(EnergyTot); } if(multCsIE>=1){ - double EnergySecond; - double EnergyTotSecond; - for(int j=0;j<multCsIE;j++) - { - EnergySecond = Data->GetPARISCsIStageEEnergy(j); - ParisCsI_E.push_back(EnergySecond); - EnergyTotSecond +=EnergySecond; - - EnergyTot += EnergySecond; - //cout << "Energy CsI=" << EnergySecond << endl; - //cout << "Energytot CsI=" << EnergyTot << endl; - } + double EnergySecond; + double EnergyTotSecond; + for(int j=0;j<multCsIE;j++) + { + EnergySecond = Data->GetPARISCsIStageEEnergy(j); + ParisCsI_E.push_back(EnergySecond); + EnergyTotSecond +=EnergySecond; + + EnergyTot += EnergySecond; + //cout << "Energy CsI=" << EnergySecond << endl; + //cout << "Energytot CsI=" << EnergyTot << endl; + } // Fill total energy in outter shell ParisOutTotalEnergy.push_back(EnergyTotSecond); @@ -140,7 +140,7 @@ void TParisPhysics::Clear() //SecondStage_N.clear(); /* - // CsI + // CsI ThirdStage_E.clear(); ThirdStage_T.clear(); ThirdStage_N.clear(); diff --git a/NPLib/Paris/TParisPhysics.h b/NPLib/Paris/TParisPhysics.h index 9a7159949404bbbea9f133909e5d7b805441284f..566a9980b77c10de97b00d533272b8f27a90b9c3 100644 --- a/NPLib/Paris/TParisPhysics.h +++ b/NPLib/Paris/TParisPhysics.h @@ -38,43 +38,43 @@ public: ~TParisPhysics(); public: - void Clear(); - void Clear(const Option_t*) {}; + void Clear(); + void Clear(const Option_t*) {}; void BuildPhysicalEvent(TParisData* Data); void BuildSimplePhysicalEvent(TParisData* Data); public: // Provide Physical Multiplicity - Int_t ParisEventMult; + Int_t ParisEventMult; // Provide a Classification of Event - //vector<int> EventType; + //vector<int> EventType; // Telescope - //vector<int> ModuleNumber; + //vector<int> ModuleNumber; - // FirstStage - vector<double> ParisLaBr_E; - //vector<double> FirstStage_T; - //vector<int> FirstStage_X; - //vector<int> FirstStage_Y; + // FirstStage + vector<double> ParisLaBr_E; + //vector<double> FirstStage_T; + //vector<int> FirstStage_X; + //vector<int> FirstStage_Y; - // SecondStage - vector<double> ParisCsI_E; - //vector<double> SecondStage_T; - //vector<int> SecondStage_N; + // SecondStage + vector<double> ParisCsI_E; + //vector<double> SecondStage_T; + //vector<int> SecondStage_N; /* - // ThirdStage - vector<double> ThirdStage_E; - vector<double> ThirdStage_T; - vector<int> ThirdStage_N; + // ThirdStage + vector<double> ThirdStage_E; + vector<double> ThirdStage_T; + vector<int> ThirdStage_N; */ // Physical Value - vector<double> ParisTotalEnergy; - vector<double> ParisInTotalEnergy; - vector<double> ParisOutTotalEnergy; + vector<double> ParisTotalEnergy; + vector<double> ParisInTotalEnergy; + vector<double> ParisOutTotalEnergy; ClassDef(TParisPhysics,1) // GaspardTrackerPHysics structure }; diff --git a/NPLib/Physics/NPEnergyLoss.cxx b/NPLib/Physics/NPEnergyLoss.cxx index 3bd1c02ad9c346b2cecb058ba25a8b6f2847c0f0..778a712b7b4b81edcb8b159979b9eef9cfb2d932 100644 --- a/NPLib/Physics/NPEnergyLoss.cxx +++ b/NPLib/Physics/NPEnergyLoss.cxx @@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2009 this file is part of the NPTool Project * + * Copyright (C) 2009 this file is part of the NPTool Project * * * * For the licensing terms see $NPTOOL/Licence/NPTool_Licence * * For the list of contributors see $NPTOOL/Licence/Contributors * @@ -43,263 +43,263 @@ using namespace std; #include "TSpline.h" #include "TAxis.h" -// NPL +// NPL using namespace NPL; //ClassImp(EnergyLoss) //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... EnergyLoss::EnergyLoss() - {fInter = NULL ;} + {fInter = NULL ;} //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... EnergyLoss::~EnergyLoss() - {} + {} //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... EnergyLoss::EnergyLoss(string Path , string Source, int NumberOfSlice=100 , int LiseColumn , int NumberOfMass) - { - - fNumberOfSlice = NumberOfSlice ; - fNumberOfMass = NumberOfMass ; - - string globalPath = getenv("NPTOOL"); - string StandardPath = globalPath + "/Inputs/EnergyLoss/" + Path; - + { + + fNumberOfSlice = NumberOfSlice ; + fNumberOfMass = NumberOfMass ; + + string globalPath = getenv("NPTOOL"); + string StandardPath = globalPath + "/Inputs/EnergyLoss/" + Path; + cout << endl; - cout << "/////////// Energy loss ///////////" << endl ; - cout << "Initializing an EnergyLoss object " << endl ; - - ifstream TableFile ; - TableFile.open(StandardPath.c_str()) ; - - // Opening dE/dX file - if(TableFile.is_open()) cout << "Reading Energy Loss File: " << Path << endl ; - // In case the file is not found in the standard path, the programm try to interpret the file name as an absolute or relative file path. - else - { - TableFile.open( Path.c_str() ); - if(TableFile.is_open()) { cout << "Reading Energy Loss File: " << Path << endl ;} - - else { cout << "ERROR: TABLE FILE NOT FOUND" << endl; return; } - } - - - if (Source == "G4Table") - { - // Reading Data - double energy, total; - string dummy; - //skipped first line - getline(TableFile,dummy); - while ( TableFile >> energy) - { - fEnergy.push_back ( energy*MeV ) ; - TableFile >> total; - fdEdX_Total.push_back ( total*MeV/micrometer ) ; - } - - // Close File - TableFile.close(); - - } - - else if (Source == "SRIM") - { - // Reading Data - double energy, nuclear, electronic; - string unit, dummy; - - while ( TableFile >> energy >> unit - >> electronic >> nuclear - >> dummy >> dummy >> dummy - >> dummy >> dummy >> dummy ) - { - if ( unit == "keV" ) energy = energy*keV ; - if ( unit == "MeV" ) energy = energy*MeV ; - if ( unit == "GeV" ) energy = energy*GeV ; - fEnergy .push_back ( energy ) ; - fdEdX_Nuclear .push_back ( nuclear ) ; - fdEdX_Electronic .push_back ( electronic ) ; - fdEdX_Total .push_back ( nuclear + electronic ) ; - } - - // Close File - TableFile.close(); - } - - else if(Source == "LISE") - { - cout << "Reading Energy Loss File: " << Path << endl ; - // Reading Data - double energy=0, energyloss=0; - string dummy; - // skipping comment first line - getline(TableFile,dummy); - - while ( TableFile >> energy ) - { - for (int k = 0 ; k < 11 ; k++ ) - { - TableFile >> dummy ; - if (k+1==LiseColumn) energyloss = atof(dummy.c_str()) ; - } - fEnergy.push_back (energy*MeV) ; - fdEdX_Total.push_back(energyloss*MeV/micrometer); - } - - // Close File - TableFile.close(); - } - - else - { - cout << "ERROR : Wrong Source Type" << endl ; - } - - fInter = new Interpolator( fEnergy , fdEdX_Total ) ; - } + cout << "/////////// Energy loss ///////////" << endl ; + cout << "Initializing an EnergyLoss object " << endl ; + + ifstream TableFile ; + TableFile.open(StandardPath.c_str()) ; + + // Opening dE/dX file + if(TableFile.is_open()) cout << "Reading Energy Loss File: " << Path << endl ; + // In case the file is not found in the standard path, the programm try to interpret the file name as an absolute or relative file path. + else + { + TableFile.open( Path.c_str() ); + if(TableFile.is_open()) { cout << "Reading Energy Loss File: " << Path << endl ;} + + else { cout << "ERROR: TABLE FILE NOT FOUND" << endl; return; } + } + + + if (Source == "G4Table") + { + // Reading Data + double energy, total; + string dummy; + //skipped first line + getline(TableFile,dummy); + while ( TableFile >> energy) + { + fEnergy.push_back ( energy*MeV ); + TableFile >> total; + fdEdX_Total.push_back ( total*MeV/micrometer ); + } + + // Close File + TableFile.close(); + + } + + else if (Source == "SRIM") + { + // Reading Data + double energy, nuclear, electronic; + string unit, dummy; + + while ( TableFile >> energy >> unit + >> electronic >> nuclear + >> dummy >> dummy >> dummy + >> dummy >> dummy >> dummy ) + { + if ( unit == "keV" ) energy = energy*keV; + if ( unit == "MeV" ) energy = energy*MeV; + if ( unit == "GeV" ) energy = energy*GeV; + fEnergy .push_back ( energy ); + fdEdX_Nuclear .push_back ( nuclear ); + fdEdX_Electronic .push_back ( electronic ); + fdEdX_Total .push_back ( nuclear + electronic ); + } + + // Close File + TableFile.close(); + } + + else if(Source == "LISE") + { + cout << "Reading Energy Loss File: " << Path << endl ; + // Reading Data + double energy=0, energyloss=0; + string dummy; + // skipping comment first line + getline(TableFile,dummy); + + while ( TableFile >> energy ) + { + for (int k = 0 ; k < 11 ; k++ ) + { + TableFile >> dummy ; + if (k+1==LiseColumn) energyloss = atof(dummy.c_str()) ; + } + fEnergy.push_back (energy*MeV) ; + fdEdX_Total.push_back(energyloss*MeV/micrometer); + } + + // Close File + TableFile.close(); + } + + else + { + cout << "ERROR : Wrong Source Type" << endl ; + } + + fInter = new Interpolator( fEnergy , fdEdX_Total ) ; + } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... void EnergyLoss::Draw() const - { - /*TGraph *gr = new TGraph(fDim, fEnergy, fDedx_Tot); - gr->Draw("A*"); - gr->GetXaxis()->SetTitle("E (MeV)"); - gr->GetYaxis()->SetTitle("dE/dx (MeV / (mg/cm^{2})"); - gr->Draw("A"); - - // use a cubic spline to smooth the graph - TSpline3 *s = new TSpline3("grs",gr) ; - s->SetLineColor(kRed) ; - s->Draw("same") ;*/ - } + { + /*TGraph *gr = new TGraph(fDim, fEnergy, fDedx_Tot); + gr->Draw("A*"); + gr->GetXaxis()->SetTitle("E (MeV)"); + gr->GetYaxis()->SetTitle("dE/dx (MeV / (mg/cm^{2})"); + gr->Draw("A"); + + // use a cubic spline to smooth the graph + TSpline3 *s = new TSpline3("grs",gr) ; + s->SetLineColor(kRed) ; + s->Draw("same") ;*/ + } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... double EnergyLoss::EvaluateNuclearLoss(double Energy) const - { - if (fEnergy.size()==0 || fdEdX_Nuclear.size()==0) - { - cout << "No Nuclear table for this Energy loss" ; - return -1000; - } - - Interpolator* s = new Interpolator( fEnergy , fdEdX_Nuclear ); - double val = s->Eval(Energy); - - delete s ; - return val ; - } + { + if (fEnergy.size()==0 || fdEdX_Nuclear.size()==0) + { + cout << "No Nuclear table for this Energy loss" ; + return -1000; + } + + Interpolator* s = new Interpolator( fEnergy , fdEdX_Nuclear ); + double val = s->Eval(Energy); + + delete s ; + return val ; + } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... double EnergyLoss::EvaluateElectronicLoss(double Energy) const - { - if (fEnergy.size()==0 || fdEdX_Electronic.size()==0) - { - cout << "No Electronic table for this Energy loss" ; - return -1000; - } - - - Interpolator* s = new Interpolator( fEnergy , fdEdX_Electronic ); - double val = s->Eval(Energy); - - delete s ; - return val ; - } + { + if (fEnergy.size()==0 || fdEdX_Electronic.size()==0) + { + cout << "No Electronic table for this Energy loss" ; + return -1000; + } + + + Interpolator* s = new Interpolator( fEnergy , fdEdX_Electronic ); + double val = s->Eval(Energy); + + delete s ; + return val ; + } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... double EnergyLoss::EvaluateTotalLoss(double Energy) const - { - if (fEnergy.size()==0 || fdEdX_Total.size()==0) - { - cout << "No Total table for this Energy loss" ; - return -1000; - } - - double val = fInter->Eval(Energy) ; - - return val ; - } + { + if (fEnergy.size()==0 || fdEdX_Total.size()==0) + { + cout << "No Total table for this Energy loss" ; + return -1000; + } + + double val = fInter->Eval(Energy) ; + + return val ; + } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... void EnergyLoss::Print() const - { - cout << "Total Energy Loss : " << endl; - int size = fdEdX_Total.size() ; - for( int i = 0 ; i < size ; i++) - cout << fEnergy[i]/MeV << " MeV " << fdEdX_Total[i]/MeV*micrometer << " MeV/um " << endl; - - } + { + cout << "Total Energy Loss : " << endl; + int size = fdEdX_Total.size() ; + for( int i = 0 ; i < size ; i++) + cout << fEnergy[i]/MeV << " MeV " << fdEdX_Total[i]/MeV*micrometer << " MeV/um " << endl; + + } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -double EnergyLoss::EnergyLossCalulation( double Energy , // Energy of the detected particle - double TargetThickness , // Target Thickness at 0 degree - double Angle ) // Particle Angle - const - { +double EnergyLoss::EnergyLossCalulation( double Energy , // Energy of the detected particle + double TargetThickness , // Target Thickness at 0 degree + double Angle ) // Particle Angle + const + { return(Energy - Slow(Energy,TargetThickness,Angle) ) ; - } + } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -double EnergyLoss::Slow( double Energy , // Energy of the detected particle - double TargetThickness , // Target Thickness at 0 degree - double Angle ) // Particle Angle - const - { - // Lise file are given in MeV/u - // For SRIM and geant4 file fNumberOfMass = 1 whatever is the nucleus, file are given in MeV - Energy = Energy / (double) fNumberOfMass ; - - if (Angle > halfpi) Angle = pi-Angle ; - TargetThickness = TargetThickness / ( cos(Angle) ) ; - - double SliceThickness = TargetThickness / (double)fNumberOfSlice ; - - for (int i = 0; i < fNumberOfSlice ; i++) - { - double de = fInter->Eval(Energy) * SliceThickness ; - Energy -= de/fNumberOfMass ; - - if(Energy<0) {Energy=0;break;} - } - - return (Energy*fNumberOfMass) ; - - } +double EnergyLoss::Slow( double Energy , // Energy of the detected particle + double TargetThickness , // Target Thickness at 0 degree + double Angle ) // Particle Angle + const + { + // Lise file are given in MeV/u + // For SRIM and geant4 file fNumberOfMass = 1 whatever is the nucleus, file are given in MeV + Energy = Energy / (double) fNumberOfMass ; + + if (Angle > halfpi) Angle = pi-Angle; + TargetThickness = TargetThickness / ( cos(Angle) ); + + double SliceThickness = TargetThickness / (double)fNumberOfSlice; + + for (int i = 0; i < fNumberOfSlice ; i++) + { + double de = fInter->Eval(Energy) * SliceThickness; + Energy -= de/fNumberOfMass; + + if(Energy<0) {Energy=0;break;} + } + + return (Energy*fNumberOfMass) ; + + } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -double EnergyLoss::EvaluateInitialEnergy( double Energy , // Energy of the detected particle - double TargetThickness , // Target Thickness at 0 degree - double Angle ) // Particle Angle - const - { - - // Lise file are given in MeV/u - // For SRIM and geant4 file fNumberOfMass = 1 whatever is the nucleus, file are given in MeV - Energy = Energy / (double) fNumberOfMass ; - - if (Angle > halfpi) Angle = pi-Angle ; - TargetThickness = TargetThickness / ( cos(Angle) ) ; - - double SliceThickness = TargetThickness / (double)fNumberOfSlice ; - - for (int i = 0; i < fNumberOfSlice ; i++) - { - double de = fInter->Eval(Energy) * SliceThickness ; - Energy += de/fNumberOfMass ; - } - - return (Energy*fNumberOfMass) ; - } +double EnergyLoss::EvaluateInitialEnergy( double Energy , // Energy of the detected particle + double TargetThickness , // Target Thickness at 0 degree + double Angle ) // Particle Angle + const + { + + // Lise file are given in MeV/u + // For SRIM and geant4 file fNumberOfMass = 1 whatever is the nucleus, file are given in MeV + Energy = Energy / (double) fNumberOfMass ; + + if (Angle > halfpi) Angle = pi-Angle; + TargetThickness = TargetThickness / ( cos(Angle) ); + + double SliceThickness = TargetThickness / (double)fNumberOfSlice; + + for (int i = 0; i < fNumberOfSlice ; i++) + { + double de = fInter->Eval(Energy) * SliceThickness ; + Energy += de/fNumberOfMass ; + } + + return (Energy*fNumberOfMass) ; + } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -double EnergyLoss::EvaluateMaterialThickness( double InitialEnergy , // Energy of the detected particle - double FinalEnergy , - double ThicknessLimit, - double ThicknessStep) // Target Thickness at 0 degree - const +double EnergyLoss::EvaluateMaterialThickness( double InitialEnergy , // Energy of the detected particle + double FinalEnergy , + double ThicknessLimit , + double ThicknessStep ) // Target Thickness at 0 degree + const { double Thickness = ThicknessStep ; double Energy = InitialEnergy; diff --git a/NPLib/Physics/NPEnergyLoss.h b/NPLib/Physics/NPEnergyLoss.h index 200cfdef9aac92243b669953b41fad587d2021e5..a19d6bc57c97a3fbe17c88abc059b0e640ff6f58 100644 --- a/NPLib/Physics/NPEnergyLoss.h +++ b/NPLib/Physics/NPEnergyLoss.h @@ -1,7 +1,7 @@ #ifndef __EnergyLoss__ #define __EnergyLoss__ /***************************************************************************** - * Copyright (C) 2009 this file is part of the NPTool Project * + * Copyright (C) 2009 this file is part of the NPTool Project * * * * For the licensing terms see $NPTOOL/Licence/NPTool_Licence * * For the list of contributors see $NPTOOL/Licence/Contributors * @@ -36,7 +36,7 @@ #include <vector> using namespace std ; -// ROOT +// ROOT //#include "TObject.h" // Use CLHEP System of unit and Physical Constant @@ -50,68 +50,68 @@ using namespace CLHEP ; using namespace ROOT::Math; namespace NPL - { - class EnergyLoss { - - public : // Constructor - EnergyLoss(); - EnergyLoss( string Path , // Path of dE/dX table file - string Source , // Type of file : Geant4,Lise,SRIM - int NumberOfSlice , // Low number = Faster, High Number = more accurate / typical: 100 to 1000 - int LiseColumns=0 , // Indicate which model to read in a lise File, set to 0 (Default value) for a SRIM / Geant4 file - int NumberOfMass=1 );// Number of mass A of the nucleus (used only for Lise file) - ~EnergyLoss(); - - private : // dE/dX, slice parameter - int fNumberOfSlice ; // Number Of Slice used to evaluate energy loss - int fNumberOfMass ; // Number of mass A of the nucleus (used only for Lise file) - vector<double> fEnergy ; // Energy - vector<double> fdEdX_Nuclear ; // Nuclear Stopping Power - vector<double> fdEdX_Electronic ; // Electronic Stopping Power - vector<double> fdEdX_Total ; // Total Stopping Power - Interpolator* fInter ; // Interpolator Used to evaluate Energy loss at given energy - - public : // General Function on dE/dX table - double EvaluateNuclearLoss (double ener) const; - double EvaluateElectronicLoss (double ener) const; - double EvaluateTotalLoss (double ener) const; - - public : // Function to Slow down particle or reconstruct their initial energy - - // Calculate Energy of a particle after crossing material - double Slow( double Energy , // Energy of the detected particle - double TargetThickness , // Target Thickness at 0 degree - double Angle ) // Particle Angle - const; - - // Calculate Energy Loss of a particle inside a material - double EnergyLossCalulation( double Energy , // Energy of the detected particle - double TargetThickness , // Target Thickness at 0 degree - double Angle ) // Particle Angle - const; - - // Evaluate Initial Energy of particle before crossing material knowing Angle, final Energy - // and Target Thickness. - double EvaluateInitialEnergy( double energy , // Energy of the detected particle - double TargetThickness , // Target Thickness at 0 degree - double Angle ) // Particle Angle - const ; - - // Evaluate the thickness the particle has been through using the energy loss and initial energy - // usefull for thickness measurement using particle sources - double EvaluateMaterialThickness( double InitialEnergy , // Energy of the detected particle - double FinalEnergy , - double ThicknessLimit , - double ThicknessStep = 0.1*micrometer) // Target Thickness at 0 degree - const ; - - public : // Usefull function - // Display parameter - void Print() const; - // Draw (CERN ROOT) - void Draw() const; + { + class EnergyLoss { + + public : // Constructor + EnergyLoss(); + EnergyLoss( string Path , // Path of dE/dX table file + string Source , // Type of file : Geant4,Lise,SRIM + int NumberOfSlice , // Low number = Faster, High Number = more accurate / typical: 100 to 1000 + int LiseColumns=0 , // Indicate which model to read in a lise File, set to 0 (Default value) for a SRIM / Geant4 file + int NumberOfMass=1 );// Number of mass A of the nucleus (used only for Lise file) + ~EnergyLoss(); + + private : // dE/dX, slice parameter + int fNumberOfSlice ; // Number Of Slice used to evaluate energy loss + int fNumberOfMass ; // Number of mass A of the nucleus (used only for Lise file) + vector<double> fEnergy ; // Energy + vector<double> fdEdX_Nuclear ; // Nuclear Stopping Power + vector<double> fdEdX_Electronic ; // Electronic Stopping Power + vector<double> fdEdX_Total ; // Total Stopping Power + Interpolator* fInter ; // Interpolator Used to evaluate Energy loss at given energy + + public : // General Function on dE/dX table + double EvaluateNuclearLoss (double ener) const; + double EvaluateElectronicLoss (double ener) const; + double EvaluateTotalLoss (double ener) const; + + public : // Function to Slow down particle or reconstruct their initial energy + + // Calculate Energy of a particle after crossing material + double Slow( double Energy , // Energy of the detected particle + double TargetThickness , // Target Thickness at 0 degree + double Angle ) // Particle Angle + const; + + // Calculate Energy Loss of a particle inside a material + double EnergyLossCalulation( double Energy , // Energy of the detected particle + double TargetThickness , // Target Thickness at 0 degree + double Angle ) // Particle Angle + const; + + // Evaluate Initial Energy of particle before crossing material knowing Angle, final Energy + // and Target Thickness. + double EvaluateInitialEnergy( double energy , // Energy of the detected particle + double TargetThickness , // Target Thickness at 0 degree + double Angle ) // Particle Angle + const ; + + // Evaluate the thickness the particle has been through using the energy loss and initial energy + // usefull for thickness measurement using particle sources + double EvaluateMaterialThickness( double InitialEnergy, // Energy of the detected particle + double FinalEnergy, + double ThicknessLimit , + double ThicknessStep = 0.1*micrometer) // Target Thickness at 0 degree + const ; + + public : // Usefull function + // Display parameter + void Print() const; + // Draw (CERN ROOT) + void Draw() const; - }; - } + }; + } #endif diff --git a/NPLib/Physics/NPNucleus.cxx b/NPLib/Physics/NPNucleus.cxx index dde3bc218c6ee2c64a0206cb0e9e7e3f3b894041..0115cc0edfee8e08b25079039d2fc015e0bf3168 100644 --- a/NPLib/Physics/NPNucleus.cxx +++ b/NPLib/Physics/NPNucleus.cxx @@ -35,13 +35,13 @@ using namespace NPL; Nucleus::Nucleus() { //----------- Default Constructor ---------- - fName = "XX DEFAULT XX"; - fCharge = 0; - fAtomicWeight = 0; - fMassExcess = 0; - fSpinParity = ""; - fSpin = 0; - fParity = ""; + fName= "XX DEFAULT XX"; + fCharge= 0; + fAtomicWeight= 0; + fMassExcess= 0; + fSpinParity= ""; + fSpin= 0; + fParity= ""; } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... @@ -64,11 +64,11 @@ Nucleus::Nucleus(string isotope) while (!inFile.eof()) { getline(inFile,line); - s_name = line.substr(11,7); - space = s_name.find_first_of(" "); - s_name.resize(space); + s_name = line.substr(11,7); + space = s_name.find_first_of(" "); + s_name.resize(space); - if (s_name.find(Isotope) != string::npos && s_name.length() == isotope.length()) break; + if (s_name.find(Isotope) != string::npos && s_name.length() == isotope.length()) break; } Extract(line.data()); } @@ -93,11 +93,11 @@ Nucleus::Nucleus(int Z, int A) if (inFile.is_open()) { while (!inFile.eof()) { getline(inFile,line); - s_mass = line.substr(0,3); - s_charge = line.substr(4,4); - charge = atoi(s_charge.data()); - mass = atoi(s_mass.data()); - if (mass == A && charge == Z*10) break; + s_mass = line.substr(0,3); + s_charge = line.substr(4,4); + charge = atoi(s_charge.data()); + mass = atoi(s_mass.data()); + if (mass == A && charge == Z*10) break; } Extract(line.data()); } @@ -143,28 +143,28 @@ void Nucleus::Extract(const char* line) if (found_p != string::npos) fParity = "+"; if (found_m != string::npos) fParity = "-"; // spin - if (s_spinparity.find("0") != string::npos) fSpin = 0 ; - if (s_spinparity.find("1") != string::npos) fSpin = 1 ; - if (s_spinparity.find("2") != string::npos) fSpin = 2 ; - if (s_spinparity.find("3") != string::npos) fSpin = 3 ; - if (s_spinparity.find("4") != string::npos) fSpin = 4 ; - if (s_spinparity.find("5") != string::npos) fSpin = 5 ; - if (s_spinparity.find("6") != string::npos) fSpin = 6 ; - if (s_spinparity.find("7") != string::npos) fSpin = 7 ; - if (s_spinparity.find("8") != string::npos) fSpin = 8 ; - if (s_spinparity.find("9") != string::npos) fSpin = 9 ; - if (s_spinparity.find("10") != string::npos) fSpin = 10 ; - if (s_spinparity.find("1/2") != string::npos) fSpin = 0.5 ; - if (s_spinparity.find("3/2") != string::npos) fSpin = 1.5 ; - if (s_spinparity.find("5/2") != string::npos) fSpin = 2.5 ; - if (s_spinparity.find("7/2") != string::npos) fSpin = 3.5 ; - if (s_spinparity.find("9/2") != string::npos) fSpin = 4.5 ; - if (s_spinparity.find("11/2") != string::npos) fSpin = 5.5 ; - if (s_spinparity.find("13/2") != string::npos) fSpin = 6.5 ; - if (s_spinparity.find("15/2") != string::npos) fSpin = 7.5 ; - if (s_spinparity.find("17/2") != string::npos) fSpin = 8.5 ; - if (s_spinparity.find("19/2") != string::npos) fSpin = 9.5 ; - if (s_spinparity.find("21/2") != string::npos) fSpin = 10.5 ; + if (s_spinparity.find("0") != string::npos) fSpin = 0 ; + if (s_spinparity.find("1") != string::npos) fSpin = 1 ; + if (s_spinparity.find("2") != string::npos) fSpin = 2 ; + if (s_spinparity.find("3") != string::npos) fSpin = 3 ; + if (s_spinparity.find("4") != string::npos) fSpin = 4 ; + if (s_spinparity.find("5") != string::npos) fSpin = 5 ; + if (s_spinparity.find("6") != string::npos) fSpin = 6 ; + if (s_spinparity.find("7") != string::npos) fSpin = 7 ; + if (s_spinparity.find("8") != string::npos) fSpin = 8 ; + if (s_spinparity.find("9") != string::npos) fSpin = 9 ; + if (s_spinparity.find("10") != string::npos) fSpin = 10 ; + if (s_spinparity.find("1/2") != string::npos) fSpin = 0.5 ; + if (s_spinparity.find("3/2") != string::npos) fSpin = 1.5 ; + if (s_spinparity.find("5/2") != string::npos) fSpin = 2.5 ; + if (s_spinparity.find("7/2") != string::npos) fSpin = 3.5 ; + if (s_spinparity.find("9/2") != string::npos) fSpin = 4.5 ; + if (s_spinparity.find("11/2") != string::npos) fSpin = 5.5 ; + if (s_spinparity.find("13/2") != string::npos) fSpin = 6.5 ; + if (s_spinparity.find("15/2") != string::npos) fSpin = 7.5 ; + if (s_spinparity.find("17/2") != string::npos) fSpin = 8.5 ; + if (s_spinparity.find("19/2") != string::npos) fSpin = 9.5 ; + if (s_spinparity.find("21/2") != string::npos) fSpin = 10.5 ; } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... diff --git a/NPLib/Physics/NPNucleus.h b/NPLib/Physics/NPNucleus.h index 79142544abe6e77ad0d78e706f35e762d72541fe..a8e5f0001a222c4586f1148065b8d4c06555f950 100644 --- a/NPLib/Physics/NPNucleus.h +++ b/NPLib/Physics/NPNucleus.h @@ -24,57 +24,49 @@ *****************************************************************************/ #define uma 931.49432 #include <string> - using namespace std; - namespace NPL - { - class Nucleus { - - public: - Nucleus(); - Nucleus(string isotope); - Nucleus(int Z, int A); - ~Nucleus(); - - - - private : - const char* fName; // Nucleus name - int fCharge; // Nucleus charge - int fAtomicWeight; // Nucleus atomic weight - double fMassExcess; // Nucleus mass excess in keV - const char* fSpinParity; // Nucleus spin and parity - double fSpin; // Nucleus spin - const char* fParity; // Nucleus parity - - protected : - void Extract(const char* line); - - public : - string GetName() const ; - int GetZ() const {return fCharge;} - int GetA() const {return fAtomicWeight;} - double GetMassExcess() const {return fMassExcess;} - const char* GetSpinParity() const {return fSpinParity;} - double GetSpin() const {return fSpin;} - const char* GetParity() const {return fParity;} - void SetName(const char* name) {fName = name;} - void SetZ(int charge) {fCharge = charge;} - void SetA(int mass) {fAtomicWeight = mass;} - void SetMassExcess(double massexcess) {fMassExcess = massexcess;} - void SetSpinParity(const char* spinparity) {fSpinParity = spinparity;} - void SetSpin(double spin) {fSpin = spin;} - void SetParity(const char* parity) {fParity = parity;} - - // Nuclear mass in MeV - double Mass() const {return (fAtomicWeight*uma + fMassExcess/1000.);} - void Print() const ; - }; + { + class Nucleus { + public: + Nucleus(); + Nucleus(string isotope); + Nucleus(int Z, int A); + ~Nucleus(); - } + private : + const char* fName; // Nucleus name + int fCharge; // Nucleus charge + int fAtomicWeight; // Nucleus atomic weight + double fMassExcess; // Nucleus mass excess in keV + const char* fSpinParity; // Nucleus spin and parity + double fSpin; // Nucleus spin + const char* fParity; // Nucleus parity + + protected : + void Extract(const char* line); + public : + string GetName() const; + int GetZ() const {return fCharge;} + int GetA() const {return fAtomicWeight;} + double GetMassExcess() const {return fMassExcess;} + const char* GetSpinParity() const {return fSpinParity;} + double GetSpin() const {return fSpin;} + const char* GetParity() const {return fParity;} + void SetName(const char* name) {fName = name;} + void SetZ(int charge) {fCharge = charge;} + void SetA(int mass) {fAtomicWeight = mass;} + void SetMassExcess(double massexcess) {fMassExcess = massexcess;} + void SetSpinParity(const char* spinparity) {fSpinParity = spinparity;} + void SetSpin(double spin) {fSpin = spin;} + void SetParity(const char* parity) {fParity = parity;} + // Nuclear mass in MeV + double Mass() const {return (fAtomicWeight*uma + fMassExcess/1000.);} + void Print() const ; + }; + } #endif diff --git a/NPLib/Physics/NPReaction.cxx b/NPLib/Physics/NPReaction.cxx index cb3f6a9cf213c9310ef1310f131dedbf8ca1958e..805317b20de9e3ef0f3e8f6abde9c39519089d51 100644 --- a/NPLib/Physics/NPReaction.cxx +++ b/NPLib/Physics/NPReaction.cxx @@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2009-2010 this file is part of the NPTool Project * + * Copyright (C) 2009-2010 this file is part of the NPTool Project * * * * For the licensing terms see $NPTOOL/Licence/NPTool_Licence * * For the list of contributors see $NPTOOL/Licence/Contributors * @@ -13,18 +13,18 @@ * Last update : January 2011 * *---------------------------------------------------------------------------* * Decription: * - * This class deal with Two Body transfert Reaction * - * Physical parameter (Nuclei mass) are loaded from the nubtab03.asc file * - * (2003 nuclear table of isotopes mass). * - * * - * KineRelativistic: Used in NPSimulation * - * A relativistic calculation is made to compute Light and Heavy nuclei * - * angle given the Theta CM angle. * - * * - * ReconstructRelativistic: Used in NPAnalysis * - * A relativistic calculation is made to compute Excitation energy given the* - * light angle and energy in Lab frame. * - * * + * This class deal with Two Body transfert Reaction * + * Physical parameter (Nuclei mass) are loaded from the nubtab03.asc file * + * (2003 nuclear table of isotopes mass). * + * * + * KineRelativistic: Used in NPSimulation * + * A relativistic calculation is made to compute Light and Heavy nuclei * + * angle given the Theta CM angle. * + * * + * ReconstructRelativistic: Used in NPAnalysis * + * A relativistic calculation is made to compute Excitation energy given the* + * light angle and energy in Lab frame. * + * * *---------------------------------------------------------------------------* * Comment: * * + 20/01/2011: Add support for excitation energy for light ejectile * @@ -56,16 +56,16 @@ Reaction::Reaction() { //------------- Default Constructor ------------- - fNuclei1 = new Nucleus() ; - fNuclei2 = new Nucleus() ; - fNuclei3 = new Nucleus() ; - fNuclei4 = new Nucleus() ; - fBeamEnergy = 0 ; - fThetaCM = 0 ; - fExcitationLight = 0 ; - fExcitationHeavy = 0 ; - fQValue = 0 ; - initializePrecomputeVariable() ; + fNuclei1 = new Nucleus() ; + fNuclei2 = new Nucleus() ; + fNuclei3 = new Nucleus() ; + fNuclei4 = new Nucleus() ; + fBeamEnergy = 0 ; + fThetaCM = 0 ; + fExcitationLight = 0 ; + fExcitationHeavy = 0 ; + fQValue = 0 ; + initializePrecomputeVariable() ; } @@ -73,7 +73,7 @@ Reaction::Reaction() //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... Reaction::Reaction(string name1, string name2, string name3, string name4, double BeamEnergy, double ExcitationEnergyLight, double ExcitationEnergyHeavy ,string Path) { - SetEveryThing( name1, name2, name3, name4, BeamEnergy, ExcitationEnergyLight, ExcitationEnergyHeavy, Path) ; + SetEveryThing( name1, name2, name3, name4, BeamEnergy, ExcitationEnergyLight, ExcitationEnergyHeavy, Path) ; } @@ -92,7 +92,7 @@ void Reaction::SetEveryThing(string name1, string name2, string name3, string na fExcitationLight = ExcitationEnergyLight; fExcitationHeavy = ExcitationEnergyHeavy; fQValue = ( fNuclei1->GetMassExcess() + fNuclei2->GetMassExcess() - - fNuclei3->GetMassExcess() - fNuclei4->GetMassExcess()) / 1000; + - fNuclei3->GetMassExcess() - fNuclei4->GetMassExcess()) / 1000; int masse = fNuclei1->GetA() + fNuclei2->GetA() - fNuclei3->GetA() - fNuclei4->GetA(); int charge = fNuclei1->GetZ() + fNuclei2->GetZ() - fNuclei3->GetZ() - fNuclei4->GetZ(); @@ -115,9 +115,9 @@ void Reaction::SetEveryThing(string name1, string name2, string name3, string na else {cout << "Cross Section File " << Path << " not found" << endl;return;} } - double CSBuffer,AngleBuffer; - vector<double> CrossSectionBuffer ; - + double CSBuffer,AngleBuffer; + vector<double> CrossSectionBuffer ; + while(!CSFile.eof()) { CSFile >> AngleBuffer; @@ -129,7 +129,7 @@ void Reaction::SetEveryThing(string name1, string name2, string name3, string na CSFile.close(); CrossSectionSize = CrossSectionBuffer.size(); CrossSection = new double[CrossSectionSize] ; - for(int i = 0 ; i <CrossSectionSize ; i++ ) CrossSection[i] = CrossSectionBuffer[i]; + for(int i = 0 ; i <CrossSectionSize ; i++ ) CrossSection[i] = CrossSectionBuffer[i]; initializePrecomputeVariable(); } @@ -149,8 +149,8 @@ Reaction::~Reaction() //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... bool Reaction::CheckKinematic() { - // Check if kinematics is allowed - + // Check if kinematics is allowed + // case of inverse kinematics double theta = fThetaCM; if (m1 > m2) theta = M_PI - fThetaCM; @@ -169,7 +169,7 @@ bool Reaction::CheckKinematic() //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... void Reaction::KineRelativistic(double &ThetaLab3, double &EnergieLab3, - double &ThetaLab4, double &EnergieLab4) const + double &ThetaLab4, double &EnergieLab4) const { // 2-body relativistic kinematics: direct + inverse // EnergieLab3,4 : lab energy in MeV of the 2 ejectiles @@ -210,85 +210,85 @@ double Reaction::ReconstructRelativistic(double EnergyLab, double ThetaLab) cons double E4 = fBeamEnergy+m1+m2-(EnergyLab+m3); double m4e = sqrt((E4*E4)-(P4*P4)); double Eex= m4e-fNuclei4->Mass(); - + return Eex; } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -//Return ThetaCM +//Return ThetaCM double Reaction::EnergyLabToThetaCM( double EnergyLab , double ExcitationEnergy ) const - { - if(ExcitationEnergy == -500) ExcitationEnergy = fExcitationHeavy; - - double E1 = (fBeamEnergy+m1) ; - double E3 = (EnergyLab+m3) ; - - // Compute Mandelstan variable - double s = 2*m2*E1 + m1*m1 + m2*m2 ; - double u = -2*m2*E3 + m2*m2 + m3*m3 ; - // Compute CM impulsion: - //before reaction - double P2CM = ( sqrt( ( s-(m1-m2)*(m1-m2) )*( s-(m1+m2)*(m1+m2) ) ) ) / (2*sqrt(s)) ; - // after reaction - double P3CM = ( sqrt( ( s-(m3-m4)*(m3-m4) )*( s-(m3+m4)*(m3+m4) ) ) ) / (2*sqrt(s)) ; - - // Compute CM Energy - double E2CM = (s + m2*m2 -m1*m1)/(2*sqrt(s)) ; - double E3CM = (s + m3*m3 -m4*m4)/(2*sqrt(s)) ; - - double u0 = m2*m2 + m3*m3 - 2*(E2CM*E3CM + P2CM*P3CM) ; - - double Pi = 3.141592654 ; - double ThetaCM = Pi - acos ( 1-(u-u0)/(2*P2CM*P3CM) ) ; - - return(ThetaCM); - } + { + if(ExcitationEnergy == -500) ExcitationEnergy = fExcitationHeavy; + + double E1 = (fBeamEnergy+m1) ; + double E3 = (EnergyLab+m3) ; + + // Compute Mandelstan variable + double s = 2*m2*E1 + m1*m1 + m2*m2 ; + double u = -2*m2*E3 + m2*m2 + m3*m3 ; + // Compute CM impulsion: + //before reaction + double P2CM = ( sqrt( ( s-(m1-m2)*(m1-m2) )*( s-(m1+m2)*(m1+m2) ) ) ) / (2*sqrt(s)) ; + // after reaction + double P3CM = ( sqrt( ( s-(m3-m4)*(m3-m4) )*( s-(m3+m4)*(m3+m4) ) ) ) / (2*sqrt(s)) ; + + // Compute CM Energy + double E2CM = (s + m2*m2 -m1*m1)/(2*sqrt(s)) ; + double E3CM = (s + m3*m3 -m4*m4)/(2*sqrt(s)) ; + + double u0 = m2*m2 + m3*m3 - 2*(E2CM*E3CM + P2CM*P3CM) ; + + double Pi = 3.141592654 ; + double ThetaCM = Pi - acos ( 1-(u-u0)/(2*P2CM*P3CM) ) ; + + return(ThetaCM); + } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... void Reaction::Print() const - { - // Print informations concerning the reaction - - cout << "Reaction : " << fNuclei2->GetName() << "(" << fNuclei1->GetName() - << "," << fNuclei3->GetName() << ")" << fNuclei4->GetName() << " @ " - << fBeamEnergy << " MeV" - << endl ; - - cout << "Exc Light = " << fExcitationLight << " MeV" << endl; - cout << "Exc Heavy = " << fExcitationHeavy << " MeV" << endl; - cout << "Qgg = " << fQValue << " MeV" << endl; - } - - + { + // Print informations concerning the reaction + + cout << "Reaction : " << fNuclei2->GetName() << "(" << fNuclei1->GetName() + << "," << fNuclei3->GetName() << ")" << fNuclei4->GetName() << " @ " + << fBeamEnergy << " MeV" + << endl ; + + cout << "Exc Light = " << fExcitationLight << " MeV" << endl; + cout << "Exc Heavy = " << fExcitationHeavy << " MeV" << endl; + cout << "Qgg = " << fQValue << " MeV" << endl; + } + + void Reaction::ReadConfigurationFile(string Path) - { - ////////General Reading needs//////// - string LineBuffer; - string DataBuffer; - - ////////Reaction Setting needs/////// - string Beam, Target, Heavy, Light, CrossSectionPath ; - double BeamEnergy = 0 , ExcitationEnergyLight = 0, ExcitationEnergyHeavy = 0; - bool ReadingStatus = false ; - bool check_Beam = false ; - bool check_Target = false ; - bool check_Light = false ; - bool check_Heavy = false ; - bool check_ExcitationEnergyLight = false ; - bool check_ExcitationEnergyHeavy = false ; - bool check_BeamEnergy = false ; - bool check_CrossSectionPath = false ; - - - ////////////////////////////////////////////////////////////////////////////////////////// - ifstream ReactionFile; - string GlobalPath = getenv("NPTOOL"); - string StandardPath = GlobalPath + "/Inputs/EventGenerator/" + Path; - ReactionFile.open(StandardPath.c_str()); - - if (ReactionFile.is_open()) {cout << "Reading Reaction File " << Path << endl ;} + { + ////////General Reading needs//////// + string LineBuffer; + string DataBuffer; + + ////////Reaction Setting needs/////// + string Beam, Target, Heavy, Light, CrossSectionPath ; + double BeamEnergy = 0 , ExcitationEnergyLight = 0, ExcitationEnergyHeavy = 0; + bool ReadingStatus = false ; + bool check_Beam = false ; + bool check_Target = false ; + bool check_Light = false ; + bool check_Heavy = false ; + bool check_ExcitationEnergyLight = false ; + bool check_ExcitationEnergyHeavy = false ; + bool check_BeamEnergy = false ; + bool check_CrossSectionPath = false ; + + + ////////////////////////////////////////////////////////////////////////////////////////// + ifstream ReactionFile; + string GlobalPath = getenv("NPTOOL"); + string StandardPath = GlobalPath + "/Inputs/EventGenerator/" + Path; + ReactionFile.open(StandardPath.c_str()); + + if (ReactionFile.is_open()) {cout << "Reading Reaction File " << Path << endl ;} // In case the file is not found in the standard path, the programm try to interpret the file name as an absolute or relative file path. else @@ -299,121 +299,121 @@ void Reaction::ReadConfigurationFile(string Path) else {cout << "Reaction File " << Path << " not found" << endl;return;} } - while (!ReactionFile.eof()) { - //Pick-up next line - getline(ReactionFile, LineBuffer); - - - - if (LineBuffer.compare(0, 9, "Transfert") == 0) { ReadingStatus = true ;} - - - while(ReadingStatus){ - - ReactionFile >> DataBuffer; - - //Search for comment Symbol % - if (LineBuffer.compare(0, 1, "%") == 0) {/* Do Nothing */;} - - else if (DataBuffer=="Beam=") { - check_Beam = true ; - ReactionFile >> DataBuffer; - Beam = DataBuffer; - cout << "Beam " << Beam << endl; - } - - else if (DataBuffer=="Target=") { - check_Target = true ; - ReactionFile >> DataBuffer; - Target = DataBuffer; - cout << "Target " << Target << endl; - } - - else if (DataBuffer=="Light=") { - check_Light = true ; - ReactionFile >> DataBuffer; - Light = DataBuffer; - cout << "Light " << Light << endl; - } - - else if (DataBuffer== "Heavy=") { - check_Heavy = true ; - ReactionFile >> DataBuffer; - Heavy = DataBuffer; - cout << "Heavy " << Heavy << endl; - } - - else if (DataBuffer=="ExcitationEnergyLight=") { - check_ExcitationEnergyLight = true ; - ReactionFile >> DataBuffer; - ExcitationEnergyLight = atof(DataBuffer.c_str()) * MeV; - cout << "Excitation Energy Light" << ExcitationEnergyLight / MeV << " MeV" << endl; - } - - else if (DataBuffer=="ExcitationEnergyHeavy=") { - check_ExcitationEnergyHeavy = true ; - ReactionFile >> DataBuffer; - ExcitationEnergyHeavy = atof(DataBuffer.c_str()) * MeV; - cout << "Excitation Energy Heavy" << ExcitationEnergyHeavy / MeV << " MeV" << endl; - } - - else if (DataBuffer=="BeamEnergy=") { - check_BeamEnergy = true ; - ReactionFile >> DataBuffer; - BeamEnergy = atof(DataBuffer.c_str()) * MeV; - cout << "Beam Energy " << BeamEnergy / MeV << " MeV" << endl; - } - - else if (DataBuffer== "CrossSectionPath=") { - check_CrossSectionPath = true ; - ReactionFile >> CrossSectionPath; - cout << "Cross Section File: " << CrossSectionPath << endl ; - } - - - /////////////////////////////////////////////////// - // If no Transfert Token and no comment, toggle out - else - {/*Ignore Token used by G4*/} - - /////////////////////////////////////////////////// - // If all Token found toggle out - if (check_Beam && check_Target && check_Light && check_Heavy && check_ExcitationEnergyLight - && check_ExcitationEnergyHeavy && check_BeamEnergy && check_CrossSectionPath) - ReadingStatus = false; - } - } - - SetEveryThing(Beam, Target, Light, Heavy,BeamEnergy,ExcitationEnergyLight, ExcitationEnergyHeavy,CrossSectionPath); + while (!ReactionFile.eof()) { + //Pick-up next line + getline(ReactionFile, LineBuffer); + + + + if (LineBuffer.compare(0, 9, "Transfert") == 0) { ReadingStatus = true ;} + + + while(ReadingStatus){ + + ReactionFile >> DataBuffer; + + //Search for comment Symbol % + if (LineBuffer.compare(0, 1, "%") == 0) {/* Do Nothing */;} + + else if (DataBuffer=="Beam=") { + check_Beam = true ; + ReactionFile >> DataBuffer; + Beam = DataBuffer; + cout << "Beam " << Beam << endl; + } + + else if (DataBuffer=="Target=") { + check_Target = true ; + ReactionFile >> DataBuffer; + Target = DataBuffer; + cout << "Target " << Target << endl; + } + + else if (DataBuffer=="Light=") { + check_Light = true ; + ReactionFile >> DataBuffer; + Light = DataBuffer; + cout << "Light " << Light << endl; + } + + else if (DataBuffer== "Heavy=") { + check_Heavy = true ; + ReactionFile >> DataBuffer; + Heavy = DataBuffer; + cout << "Heavy " << Heavy << endl; + } + + else if (DataBuffer=="ExcitationEnergyLight=") { + check_ExcitationEnergyLight = true ; + ReactionFile >> DataBuffer; + ExcitationEnergyLight = atof(DataBuffer.c_str()) * MeV; + cout << "Excitation Energy Light" << ExcitationEnergyLight / MeV << " MeV" << endl; + } + + else if (DataBuffer=="ExcitationEnergyHeavy=") { + check_ExcitationEnergyHeavy = true ; + ReactionFile >> DataBuffer; + ExcitationEnergyHeavy = atof(DataBuffer.c_str()) * MeV; + cout << "Excitation Energy Heavy" << ExcitationEnergyHeavy / MeV << " MeV" << endl; + } + + else if (DataBuffer=="BeamEnergy=") { + check_BeamEnergy = true ; + ReactionFile >> DataBuffer; + BeamEnergy = atof(DataBuffer.c_str()) * MeV; + cout << "Beam Energy " << BeamEnergy / MeV << " MeV" << endl; + } + + else if (DataBuffer== "CrossSectionPath=") { + check_CrossSectionPath = true ; + ReactionFile >> CrossSectionPath; + cout << "Cross Section File: " << CrossSectionPath << endl ; + } + + + /////////////////////////////////////////////////// + // If no Transfert Token and no comment, toggle out + else + {/*Ignore Token used by G4*/} + + /////////////////////////////////////////////////// + // If all Token found toggle out + if (check_Beam && check_Target && check_Light && check_Heavy && check_ExcitationEnergyLight + && check_ExcitationEnergyHeavy && check_BeamEnergy && check_CrossSectionPath) + ReadingStatus = false; + } + } + + SetEveryThing(Beam, Target, Light, Heavy,BeamEnergy,ExcitationEnergyLight, ExcitationEnergyHeavy,CrossSectionPath); ReactionFile.close(); - } - - + } + + void Reaction::initializePrecomputeVariable() - { - m1 = fNuclei1->Mass(); - m2 = fNuclei2->Mass(); - m3 = fNuclei3->Mass() + fExcitationLight; - m4 = fNuclei4->Mass() + fExcitationHeavy; - - // center-of-mass velocity - WtotLab = (fBeamEnergy + m1) + m2; - P1 = sqrt(pow(fBeamEnergy,2) + 2*m1*fBeamEnergy); - B = P1 / WtotLab; - G = 1 / sqrt(1 - pow(B,2)); - - // total energy of the ejectiles in the center-of-mass - W3cm = (pow(WtotLab,2) + pow(G,2)*(pow(m3,2) - pow(m4,2))) - / (2 * G * WtotLab); - W4cm = (pow(WtotLab,2) + pow(G,2)*(pow(m4,2) - pow(m3,2))) - / (2 * G * WtotLab); - - // velocity of the ejectiles in the center-of-mass - beta3cm = sqrt(1 - pow(m3,2)/pow(W3cm,2)); - beta4cm = sqrt(1 - pow(m4,2)/pow(W4cm,2)); - - // Constants of the kinematics - K3 = B / beta3cm; - K4 = B / beta4cm; - } + { + m1 = fNuclei1->Mass(); + m2 = fNuclei2->Mass(); + m3 = fNuclei3->Mass() + fExcitationLight; + m4 = fNuclei4->Mass() + fExcitationHeavy; + + // center-of-mass velocity + WtotLab = (fBeamEnergy + m1) + m2; + P1 = sqrt(pow(fBeamEnergy,2) + 2*m1*fBeamEnergy); + B = P1 / WtotLab; + G = 1 / sqrt(1 - pow(B,2)); + + // total energy of the ejectiles in the center-of-mass + W3cm = (pow(WtotLab,2) + pow(G,2)*(pow(m3,2) - pow(m4,2))) + / (2 * G * WtotLab); + W4cm = (pow(WtotLab,2) + pow(G,2)*(pow(m4,2) - pow(m3,2))) + / (2 * G * WtotLab); + + // velocity of the ejectiles in the center-of-mass + beta3cm = sqrt(1 - pow(m3,2)/pow(W3cm,2)); + beta4cm = sqrt(1 - pow(m4,2)/pow(W4cm,2)); + + // Constants of the kinematics + K3 = B / beta3cm; + K4 = B / beta4cm; + } diff --git a/NPLib/Plastic/TPlasticData.cxx b/NPLib/Plastic/TPlasticData.cxx index f7d677090215f65d3d7c578849f53d9ee9b5703d..c3f1263c5aa9178bd102d39febbee63a106ae056 100644 --- a/NPLib/Plastic/TPlasticData.cxx +++ b/NPLib/Plastic/TPlasticData.cxx @@ -29,10 +29,10 @@ void TPlasticData::Dump() const { cout << "XXXXXXXXXXXXXXXXXXXXXXXX New Event XXXXXXXXXXXXXXXXX" << endl; - for(unsigned short i = 0 ; i<fPlastic_Energy.size() ; i ++) - { - cout << "Plastic Number " << fPlastic_Number[i] << " Energy: " << fPlastic_Energy[i] << " Time: "<< fPlastic_Time[i] << endl; - - } + for(unsigned short i = 0 ; i<fPlastic_Energy.size() ; i ++) + { + cout << "Plastic Number " << fPlastic_Number[i] << " Energy: " << fPlastic_Energy[i] << " Time: "<< fPlastic_Time[i] << endl; + + } } diff --git a/NPLib/Plastic/TPlasticData.h b/NPLib/Plastic/TPlasticData.h index ebd2eb3f79c1ca83b7710a75c8f26ac949d7bb1e..df564bebf2c9f282cbafee6aae902979569fa7d7 100644 --- a/NPLib/Plastic/TPlasticData.h +++ b/NPLib/Plastic/TPlasticData.h @@ -10,40 +10,39 @@ using namespace std ; class TPlasticData : public TObject { private: // ADC - vector<double> fPlastic_Energy ; - vector<double> fPlastic_Time ; - vector<short> fPlastic_Number ; + vector<double> fPlastic_Energy; + vector<double> fPlastic_Time ; + vector<short> fPlastic_Number ; public: TPlasticData(); virtual ~TPlasticData(); - void Clear(); - void Clear(const Option_t*) {}; - void Dump() const; + void Clear(); + void Clear(const Option_t*) {}; + void Dump() const; ///////////////////// GETTERS //////////////////////// // (E) - double GetEnergy(int i) { return fPlastic_Energy[i] ;} + double GetEnergy(int i) { return fPlastic_Energy[i] ;} // (T) - double GetTime(int i) { return fPlastic_Time[i] ;} + double GetTime(int i) { return fPlastic_Time[i] ;} // (N) - int GetPlasticNumber(int i) { return fPlastic_Number[i] ;} + int GetPlasticNumber(int i) { return fPlastic_Number[i] ;} //Mult // E - double GetEnergyMult() { return fPlastic_Energy.size() ;} + double GetEnergyMult() { return fPlastic_Energy.size() ;} // (T) - double GetTimeMult() { return fPlastic_Time.size() ;} + double GetTimeMult() { return fPlastic_Time.size() ;} // (N) - int GetPlasticNumberMult() { return fPlastic_Number.size() ;} + int GetPlasticNumberMult() { return fPlastic_Number.size() ;} ///////////////////// SETTERS //////////////////////// // (E) - void SetEnergy(double E) { fPlastic_Energy.push_back(E) ;} - void SetTime(double T) { fPlastic_Time.push_back(T) ;} - void SetPlasticNumber(int N) { fPlastic_Number.push_back(N) ;} - + void SetEnergy(double E) { fPlastic_Energy.push_back(E) ;} + void SetTime(double T) { fPlastic_Time.push_back(T) ;} + void SetPlasticNumber(int N) { fPlastic_Number.push_back(N) ;} // ClassDef(TPlasticData,1) // PlasticData structure }; diff --git a/NPLib/Plastic/TPlasticPhysics.cxx b/NPLib/Plastic/TPlasticPhysics.cxx index bfc3c1fb2d251a1b5c9a9d4851cd41432b05ef8c..f84eb48e9df7675c27936da56f1aea7c6e51973d 100644 --- a/NPLib/Plastic/TPlasticPhysics.cxx +++ b/NPLib/Plastic/TPlasticPhysics.cxx @@ -20,12 +20,12 @@ * * *****************************************************************************/ -// NPL +// NPL #include "TPlasticPhysics.h" #include "../include/RootOutput.h" #include "../include/RootInput.h" -// STL +// STL #include <iostream> #include <sstream> #include <fstream> @@ -33,272 +33,260 @@ #include <stdlib.h> using namespace std; -// ROOT +// ROOT #include "TChain.h" -// tranform an integer to a string - string itoa(int value) - { - std::ostringstream o; - - if (!(o << value)) - return "" ; - - return o.str(); - } +// tranform an integer to a string + string itoa(int value) + { + std::ostringstream o; + + if (!(o << value)) + return "" ; + + return o.str(); + } ClassImp(TPlasticPhysics) /////////////////////////////////////////////////////////////////////////// TPlasticPhysics::TPlasticPhysics() - { - NumberOfDetector = 0 ; - EventData = new TPlasticData ; - EventPhysics = this ; - } - + { + NumberOfDetector = 0 ; + EventData = new TPlasticData ; + EventPhysics = this ; + } + /////////////////////////////////////////////////////////////////////////// TPlasticPhysics::~TPlasticPhysics() - {} - + {} + /////////////////////////////////////////////////////////////////////////// void TPlasticPhysics::Clear() - { - DetectorNumber .clear() ; - Energy .clear() ; - Time .clear() ; - } - + { + DetectorNumber.clear() ; + Energy.clear() ; + Time.clear() ; + } + /////////////////////////////////////////////////////////////////////////// void TPlasticPhysics::ReadConfiguration(string Path) - { - ifstream ConfigFile ; - ConfigFile.open(Path.c_str()) ; - string LineBuffer ; - string DataBuffer ; + { + ifstream ConfigFile ; + ConfigFile.open(Path.c_str()) ; + string LineBuffer ; + string DataBuffer ; - bool check_Theta = false ; - bool check_Phi = false ; - bool check_R = false ; - bool check_Thickness = false ; - bool check_Radius = false ; - bool check_LeadThickness = false ; - bool check_Scintillator = false ; - bool check_Height = false ; - bool check_Width = false ; - bool check_Shape = false ; - bool check_X = false ; - bool check_Y = false ; - bool check_Z = false ; - bool ReadingStatus = false ; + bool check_Theta = false ; + bool check_Phi = false ; + bool check_R = false ; + bool check_Thickness = false ; + bool check_Radius = false ; + bool check_LeadThickness = false ; + bool check_Scintillator = false ; + bool check_Height = false ; + bool check_Width = false ; + bool check_Shape = false ; + bool check_X = false ; + bool check_Y = false ; + bool check_Z = false ; + bool ReadingStatus = false ; - while (!ConfigFile.eof()) - { - - getline(ConfigFile, LineBuffer); + while (!ConfigFile.eof()) + { + + getline(ConfigFile, LineBuffer); - // If line is a Start Up Plastic bloc, Reading toggle to true - if (LineBuffer.compare(0, 7, "Plastic") == 0) - { - cout << "///" << endl ; - cout << "Platic found: " << endl ; - ReadingStatus = true ; - - } - - // Else don't toggle to Reading Block Status - else ReadingStatus = false ; - - // Reading Block - while(ReadingStatus) - { - // Pickup Next Word - ConfigFile >> DataBuffer ; + // If line is a Start Up Plastic bloc, Reading toggle to true + if (LineBuffer.compare(0, 7, "Plastic") == 0) + { + cout << "///" << endl ; + cout << "Platic found: " << endl ; + ReadingStatus = true ; + } + + // Else don't toggle to Reading Block Status + else ReadingStatus = false ; + + // Reading Block + while(ReadingStatus) + { + // Pickup Next Word + ConfigFile >> DataBuffer ; - // Comment Line - if (DataBuffer.compare(0, 1, "%") == 0) { ConfigFile.ignore ( std::numeric_limits<std::streamsize>::max(), '\n' );} + // Comment Line + if (DataBuffer.compare(0, 1, "%") == 0) { ConfigFile.ignore ( std::numeric_limits<std::streamsize>::max(), '\n' );} - // Finding another telescope (safety), toggle out - else if (DataBuffer.compare(0, 6, "Plastic") == 0) { - cout << "WARNING: Another Detector is find before standard sequence of Token, Error may occured in Telecope definition" << endl ; - ReadingStatus = false ; - } - - //Angle method - else if (DataBuffer=="THETA=") { - check_Theta = true; - ConfigFile >> DataBuffer ; - cout << "Theta: " << atof(DataBuffer.c_str()) << "deg" << endl; - } + // Finding another telescope (safety), toggle out + else if (DataBuffer.compare(0, 6, "Plastic") == 0) { + cout << "WARNING: Another Detector is find before standard sequence of Token, Error may occured in Telecope definition" << endl ; + ReadingStatus = false ; + } + + //Angle method + else if (DataBuffer=="THETA=") { + check_Theta = true; + ConfigFile >> DataBuffer ; + cout << "Theta: " << atof(DataBuffer.c_str()) << "deg" << endl; + } - else if (DataBuffer=="PHI=") { - check_Phi = true; - ConfigFile >> DataBuffer ; - cout << "Phi: " << atof( DataBuffer.c_str() ) << "deg" << endl; - } + else if (DataBuffer=="PHI=") { + check_Phi = true; + ConfigFile >> DataBuffer ; + cout << "Phi: " << atof( DataBuffer.c_str() ) << "deg" << endl; + } - else if (DataBuffer=="R=") { - check_R = true; - ConfigFile >> DataBuffer ; - cout << "R: " << atof( DataBuffer.c_str() ) << "mm" << endl; - } - - //Position method - else if (DataBuffer=="X=") { - check_X = true; - ConfigFile >> DataBuffer ; - cout << "X: " << atof( DataBuffer.c_str() ) << "mm" << endl; - } + else if (DataBuffer=="R=") { + check_R = true; + ConfigFile >> DataBuffer ; + cout << "R: " << atof( DataBuffer.c_str() ) << "mm" << endl; + } + + //Position method + else if (DataBuffer=="X=") { + check_X = true; + ConfigFile >> DataBuffer ; + cout << "X: " << atof( DataBuffer.c_str() ) << "mm" << endl; + } - else if (DataBuffer=="Y=") { - check_Y = true; - ConfigFile >> DataBuffer ; - cout << "Y: " << atof( DataBuffer.c_str() ) << "mm"<< endl; - } - - else if (DataBuffer=="Z=") { - check_Z = true; - ConfigFile >> DataBuffer ; - cout << "Z: " << atof( DataBuffer.c_str() ) << "mm" << endl; - } - - - //General - else if (DataBuffer=="Shape=") { - check_Shape = true; - ConfigFile >> DataBuffer ; - cout << "Shape: " << DataBuffer << endl; - } - - // Cylindrical shape - else if (DataBuffer== "Radius=") { - check_Radius = true; - ConfigFile >> DataBuffer ; - cout << "Plastic Radius: " << atof( DataBuffer.c_str() ) << "mm" << endl; - } - - // Squared shape - else if (DataBuffer=="Width=") { - check_Width = true; - ConfigFile >> DataBuffer ; - cout << "Plastic Width: " <<atof( DataBuffer.c_str() ) << "mm" << endl; - } - - else if (DataBuffer== "Height=") { - check_Height = true; - ConfigFile >> DataBuffer ; - cout << "Plastic Height: " << atof( DataBuffer.c_str() ) << "mm" << endl; - } - - // Common - else if (DataBuffer=="Thickness=") { - check_Thickness = true; - ConfigFile >> DataBuffer ; - cout << "Plastic Thickness: " << atof( DataBuffer.c_str() ) << "mm" << endl; - } - - else if (DataBuffer== "Scintillator=") { - check_Scintillator = true ; - ConfigFile >> DataBuffer ; - cout << "Plastic Scintillator type: " << DataBuffer << endl; - } - - else if (DataBuffer=="LeadThickness=") { - check_LeadThickness = true; - ConfigFile >> DataBuffer ; - cout << "Lead Thickness : " << atof( DataBuffer.c_str() ) << "mm" << endl; - } - - /////////////////////////////////////////////////// - // If no Detector Token and no comment, toggle out - else - {ReadingStatus = false; cout << "Wrong Token Sequence: Getting out " << DataBuffer << endl ;} - - ///////////////////////////////////////////////// - // If All necessary information there, toggle out - - if ( check_Theta && check_Phi && check_R && check_Thickness && check_Radius && check_LeadThickness && check_Scintillator && check_Height && check_Width && check_Shape && check_X && check_Y && check_Z ) - { - NumberOfDetector++; - - // Reinitialisation of Check Boolean - check_Theta = false ; - check_Phi = false ; - check_R = false ; - check_Thickness = false ; - check_Radius = false ; - check_LeadThickness = false ; - check_Scintillator = false ; - check_Height = false ; - check_Width = false ; - check_Shape = false ; - check_X = false ; - check_Y = false ; - check_Z = false ; - ReadingStatus = false ; - cout << "///"<< endl ; - } - - } - } - } + else if (DataBuffer=="Y=") { + check_Y = true; + ConfigFile >> DataBuffer ; + cout << "Y: " << atof( DataBuffer.c_str() ) << "mm"<< endl; + } + else if (DataBuffer=="Z=") { + check_Z = true; + ConfigFile >> DataBuffer ; + cout << "Z: " << atof( DataBuffer.c_str() ) << "mm" << endl; + } + + + //General + else if (DataBuffer=="Shape=") { + check_Shape = true; + ConfigFile >> DataBuffer ; + cout << "Shape: " << DataBuffer << endl; + } + + // Cylindrical shape + else if (DataBuffer== "Radius=") { + check_Radius = true; + ConfigFile >> DataBuffer ; + cout << "Plastic Radius: " << atof( DataBuffer.c_str() ) << "mm" << endl; + } + + // Squared shape + else if (DataBuffer=="Width=") { + check_Width = true; + ConfigFile >> DataBuffer ; + cout << "Plastic Width: " <<atof( DataBuffer.c_str() ) << "mm" << endl; + } + + else if (DataBuffer== "Height=") { + check_Height = true; + ConfigFile >> DataBuffer ; + cout << "Plastic Height: " << atof( DataBuffer.c_str() ) << "mm" << endl; + } + + // Common + else if (DataBuffer=="Thickness=") { + check_Thickness = true; + ConfigFile >> DataBuffer ; + cout << "Plastic Thickness: " << atof( DataBuffer.c_str() ) << "mm" << endl; + } + + else if (DataBuffer== "Scintillator=") { + check_Scintillator = true ; + ConfigFile >> DataBuffer ; + cout << "Plastic Scintillator type: " << DataBuffer << endl; + } + + else if (DataBuffer=="LeadThickness=") { + check_LeadThickness = true; + ConfigFile >> DataBuffer ; + cout << "Lead Thickness : " << atof( DataBuffer.c_str() ) << "mm" << endl; + } + + /////////////////////////////////////////////////// + // If no Detector Token and no comment, toggle out + else + {ReadingStatus = false; cout << "Wrong Token Sequence: Getting out " << DataBuffer << endl ;} + + ///////////////////////////////////////////////// + // If All necessary information there, toggle out + + if ( check_Theta && check_Phi && check_R && check_Thickness && check_Radius && check_LeadThickness && check_Scintillator && check_Height && check_Width && check_Shape && check_X && check_Y && check_Z ) + { + NumberOfDetector++; + + // Reinitialisation of Check Boolean + check_Theta = false ; + check_Phi = false ; + check_R = false ; + check_Thickness = false ; + check_Radius = false ; + check_LeadThickness = false ; + check_Scintillator = false ; + check_Height = false ; + check_Width = false ; + check_Shape = false ; + check_X = false ; + check_Y = false ; + check_Z = false ; + ReadingStatus = false ; + cout << "///"<< endl ; + } + } + } + } /////////////////////////////////////////////////////////////////////////// void TPlasticPhysics::AddParameterToCalibrationManager() - { - CalibrationManager* Cal = CalibrationManager::getInstance(); - - for(int i = 0 ; i < NumberOfDetector ; i++) - { - for( int j = 0 ; j < 16 ; j++) - { - Cal->AddParameter("Plastic", "Detector"+itoa(i+1)+"_E","Plastic_Detector"+itoa(i+1)+"_E") ; - Cal->AddParameter("Plastic", "Detector"+itoa(i+1)+"_T","Plastic_Detector"+itoa(i+1)+"_T") ; - } - - } - } - + { + CalibrationManager* Cal = CalibrationManager::getInstance(); + + for(int i = 0 ; i < NumberOfDetector ; i++) + { + for( int j = 0 ; j < 16 ; j++) + { + Cal->AddParameter("Plastic", "Detector"+itoa(i+1)+"_E","Plastic_Detector"+itoa(i+1)+"_E") ; + Cal->AddParameter("Plastic", "Detector"+itoa(i+1)+"_T","Plastic_Detector"+itoa(i+1)+"_T") ; + } + + } + } + /////////////////////////////////////////////////////////////////////////// void TPlasticPhysics::InitializeRootInput() - { - TChain* inputChain = RootInput::getInstance()->GetChain() ; - inputChain->SetBranchStatus ( "Plastic" , true ) ; - inputChain->SetBranchStatus ( "fPlastic_*" , true ) ; - inputChain->SetBranchAddress( "Plastic" , &EventData ) ; - } + { + TChain* inputChain = RootInput::getInstance()->GetChain() ; + inputChain->SetBranchStatus ( "Plastic" , true ) ; + inputChain->SetBranchStatus ( "fPlastic_*" , true ) ; + inputChain->SetBranchAddress( "Plastic" , &EventData ) ; + } /////////////////////////////////////////////////////////////////////////// void TPlasticPhysics::InitializeRootOutput() - { - TTree* outputTree = RootOutput::getInstance()->GetTree() ; - outputTree->Branch( "Plastic" , "TPlasticPhysics" , &EventPhysics ) ; - } + { + TTree* outputTree = RootOutput::getInstance()->GetTree() ; + outputTree->Branch( "Plastic" , "TPlasticPhysics" , &EventPhysics ) ; + } /////////////////////////////////////////////////////////////////////////// void TPlasticPhysics::BuildPhysicalEvent() - { - BuildSimplePhysicalEvent() ; - } + { + BuildSimplePhysicalEvent() ; + } /////////////////////////////////////////////////////////////////////////// void TPlasticPhysics::BuildSimplePhysicalEvent() - { - for(unsigned int i = 0 ; i < EventData->GetEnergyMult() ; i++) - { - - DetectorNumber .push_back( EventData->GetPlasticNumber(i) ) ; - - Energy .push_back( - CalibrationManager::getInstance()->ApplyCalibration( "Plastic/Detector" + itoa( EventData->GetPlasticNumber(i) ) +"_E", - EventData->GetEnergy(i) ) - ) ; - - Time .push_back( - CalibrationManager::getInstance()->ApplyCalibration( "Plastic/Detector" + itoa( EventData->GetPlasticNumber(i) ) +"_T", - EventData->GetTime(i) ) - ) ; - } + { + for(unsigned int i = 0 ; i < EventData->GetEnergyMult() ; i++) + { + DetectorNumber.push_back( EventData->GetPlasticNumber(i) ) ; + Energy.push_back( CalibrationManager::getInstance()->ApplyCalibration("Plastic/Detector" + itoa( EventData->GetPlasticNumber(i) ) +"_E",EventData->GetEnergy(i) ) ); + Time.push_back( CalibrationManager::getInstance()->ApplyCalibration( "Plastic/Detector" + itoa( EventData->GetPlasticNumber(i) ) +"_T",EventData->GetTime(i) ) ); + } - } + } diff --git a/NPLib/Plastic/TPlasticPhysics.h b/NPLib/Plastic/TPlasticPhysics.h index 9bf4f9af0a4a093ca78c4284e44a84b352f1a2ca..6e4114a8e39333a22e71d3db3794bdc40a27cef4 100644 --- a/NPLib/Plastic/TPlasticPhysics.h +++ b/NPLib/Plastic/TPlasticPhysics.h @@ -22,70 +22,70 @@ * * *****************************************************************************/ -// STL +// STL #include <vector> using namespace std ; -// ROOT +// ROOT #include "TObject.h" -// NPL +// NPL #include "TPlasticData.h" #include "../include/VDetector.h" #include "../include/CalibrationManager.h" class TPlasticPhysics : public TObject, public NPA::VDetector { - public: // Constructor and Destructor - TPlasticPhysics(); - ~TPlasticPhysics(); + public: // Constructor and Destructor + TPlasticPhysics(); + ~TPlasticPhysics(); - public: // Calibrated Data + public: // Calibrated Data - vector<UShort_t> DetectorNumber ; - vector<Double_t> Energy ; - vector<Double_t> Time ; + vector<UShort_t> DetectorNumber ; + vector<Double_t> Energy; + vector<Double_t> Time; - public: // inherrited from VDetector - // Read stream at ConfigFile to pick-up parameters of detector (Position,...) using Token - void ReadConfiguration(string) ; - + public: // inherrited from VDetector + // Read stream at ConfigFile to pick-up parameters of detector (Position,...) using Token + void ReadConfiguration(string); + - // Add Parameter to the CalibrationManger - void AddParameterToCalibrationManager() ; - - - // 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 InitializeRootInput() ; + // Add Parameter to the CalibrationManger + void AddParameterToCalibrationManager(); + + + // 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 InitializeRootInput(); - // Create associated branches and associated private member DetectorPhysics address - void InitializeRootOutput() ; - - - // This method is called at each event read from the Input Tree. Aime is to build treat Raw dat in order to extract physical parameter. - void BuildPhysicalEvent() ; - - - // Same as above, but only the simplest event and/or simple method are used (low multiplicity, faster algorythm but less efficient ...). - // This method aimed to be used for analysis performed during experiment, when speed is requiered. - // NB: This method can eventually be the same as BuildPhysicalEvent. - void BuildSimplePhysicalEvent() ; + // Create associated branches and associated private member DetectorPhysics address + void InitializeRootOutput(); + + + // This method is called at each event read from the Input Tree. Aime is to build treat Raw dat in order to extract physical parameter. + void BuildPhysicalEvent(); + + + // Same as above, but only the simplest event and/or simple method are used (low multiplicity, faster algorythm but less efficient ...). + // This method aimed to be used for analysis performed during experiment, when speed is requiered. + // NB: This method can eventually be the same as BuildPhysicalEvent. + void BuildSimplePhysicalEvent(); - // Those two method all to clear the Event Physics or Data - void ClearEventPhysics() {Clear();} - void ClearEventData() {EventData->Clear();} + // Those two method all to clear the Event Physics or Data + void ClearEventPhysics() {Clear();} + void ClearEventData() {EventData->Clear();} - private: // Data not writted in the tree - int NumberOfDetector ;//! - TPlasticData* EventData ;//! - TPlasticPhysics* EventPhysics ;//! + private: // Data not writted in the tree + int NumberOfDetector ;//! + TPlasticData* EventData ;//! + TPlasticPhysics* EventPhysics ;//! - void Clear(); - void Clear(const Option_t*) {}; - - ClassDef(TPlasticPhysics,1) // PlasticPhysics structure + void Clear(); + void Clear(const Option_t*) {}; + + ClassDef(TPlasticPhysics,1) // PlasticPhysics structure }; #endif diff --git a/NPLib/SSSD/TSSSDData.cxx b/NPLib/SSSD/TSSSDData.cxx index f672bae35865888cdc0de6885006fd4ae62e91dd..9efd57db1fb296ee4eb1835417b582b316a4621a 100644 --- a/NPLib/SSSD/TSSSDData.cxx +++ b/NPLib/SSSD/TSSSDData.cxx @@ -28,17 +28,17 @@ ClassImp(TSSSDData) TSSSDData::TSSSDData() { - // Default constructor + // Default constructor - // SSSD - // Energy - fSSSD_StripE_DetectorNbr.clear() ; - fSSSD_StripE_StripNbr.clear() ; - fSSSD_StripE_Energy.clear() ; - // Time - fSSSD_StripT_DetectorNbr.clear() ; - fSSSD_StripT_StripNbr.clear() ; - fSSSD_StripT_Time.clear() ; + // SSSD + // Energy + fSSSD_StripE_DetectorNbr.clear(); + fSSSD_StripE_StripNbr.clear(); + fSSSD_StripE_Energy.clear(); + // Time + fSSSD_StripT_DetectorNbr.clear(); + fSSSD_StripT_StripNbr.clear(); + fSSSD_StripT_Time.clear(); } @@ -47,15 +47,15 @@ TSSSDData::~TSSSDData() void TSSSDData::Clear() { - // DSSD - // Energy - fSSSD_StripE_DetectorNbr.clear() ; - fSSSD_StripE_StripNbr.clear() ; - fSSSD_StripE_Energy.clear() ; - // Time - fSSSD_StripT_DetectorNbr.clear() ; - fSSSD_StripT_StripNbr.clear() ; - fSSSD_StripT_Time.clear() ; + // DSSD + // Energy + fSSSD_StripE_DetectorNbr.clear(); + fSSSD_StripE_StripNbr.clear(); + fSSSD_StripE_Energy.clear(); + // Time + fSSSD_StripT_DetectorNbr.clear(); + fSSSD_StripT_StripNbr.clear(); + fSSSD_StripT_Time.clear(); } diff --git a/NPLib/SSSD/TSSSDData.h b/NPLib/SSSD/TSSSDData.h index e647c50209e27af1281cf92adbb505ba35704f7f..ae60ec953deb07afb6b461b845d9a35ff76c1498 100644 --- a/NPLib/SSSD/TSSSDData.h +++ b/NPLib/SSSD/TSSSDData.h @@ -26,51 +26,51 @@ using namespace std ; class TSSSDData : public TObject { - private: - // SSSD - // Energy - vector<UShort_t> fSSSD_StripE_DetectorNbr; - vector<UShort_t> fSSSD_StripE_StripNbr; - vector<Double_t> fSSSD_StripE_Energy; - // Time - vector<UShort_t> fSSSD_StripT_DetectorNbr; - vector<UShort_t> fSSSD_StripT_StripNbr; - vector<Double_t> fSSSD_StripT_Time; + private: + // SSSD + // Energy + vector<UShort_t> fSSSD_StripE_DetectorNbr; + vector<UShort_t> fSSSD_StripE_StripNbr; + vector<Double_t> fSSSD_StripE_Energy; + // Time + vector<UShort_t> fSSSD_StripT_DetectorNbr; + vector<UShort_t> fSSSD_StripT_StripNbr; + vector<Double_t> fSSSD_StripT_Time; - public: - TSSSDData(); - virtual ~TSSSDData(); + public: + TSSSDData(); + virtual ~TSSSDData(); - void Clear(); + void Clear(); void Clear(const Option_t*) {}; - void Dump() const; + void Dump() const; - ///////////////////// SETTERS //////////////////////// - // DSSD - // (X,E) - void SetEnergyDetectorNbr (const UShort_t DetNbr) { fSSSD_StripE_DetectorNbr.push_back(DetNbr) ;} - void SetEnergyStripNbr (const UShort_t StripNbr) { fSSSD_StripE_StripNbr.push_back(StripNbr) ;} - void SetEnergy (const Double_t Energy) { fSSSD_StripE_Energy.push_back(Energy) ;} - // (X,T) - void SetTimeDetectorNbr (const UShort_t DetNbr) { fSSSD_StripT_DetectorNbr.push_back(DetNbr) ;} - void SetTimeStripNbr (const UShort_t StripNbr) { fSSSD_StripT_StripNbr.push_back(StripNbr) ;} - void SetTime (const Double_t Time) { fSSSD_StripT_Time.push_back(Time) ;} + ///////////////////// SETTERS //////////////////////// + // DSSD + // (X,E) + void SetEnergyDetectorNbr (const UShort_t DetNbr) { fSSSD_StripE_DetectorNbr.push_back(DetNbr) ;} + void SetEnergyStripNbr (const UShort_t StripNbr) { fSSSD_StripE_StripNbr.push_back(StripNbr) ;} + void SetEnergy (const Double_t Energy) { fSSSD_StripE_Energy.push_back(Energy) ;} + // (X,T) + void SetTimeDetectorNbr (const UShort_t DetNbr) { fSSSD_StripT_DetectorNbr.push_back(DetNbr) ;} + void SetTimeStripNbr (const UShort_t StripNbr) { fSSSD_StripT_StripNbr.push_back(StripNbr) ;} + void SetTime (const Double_t Time) { fSSSD_StripT_Time.push_back(Time) ;} - ///////////////////// GETTERS //////////////////////// - // DSSD - // (X,E) - UShort_t GetEnergyMult () const { return fSSSD_StripE_DetectorNbr.size() ;} - UShort_t GetEnergyDetectorNbr (const Int_t i) const { return fSSSD_StripE_DetectorNbr[i] ;} - UShort_t GetEnergyStripNbr (const Int_t i) const { return fSSSD_StripE_StripNbr[i] ;} - Double_t GetEnergy (const Int_t i) const { return fSSSD_StripE_Energy[i] ;} - // (X,T) - UShort_t GetTimeMult () const { return fSSSD_StripT_DetectorNbr.size() ;} - UShort_t GetTimeDetectorNbr (const Int_t i) const { return fSSSD_StripT_DetectorNbr[i] ;} - UShort_t GetTimeStripNbr (const Int_t i) const { return fSSSD_StripT_StripNbr[i] ;} - Double_t GetTime (const Int_t i) const { return fSSSD_StripT_Time[i] ;} - - ClassDef(TSSSDData,1) // SSSDData structure + ///////////////////// GETTERS //////////////////////// + // DSSD + // (X,E) + UShort_t GetEnergyMult () const { return fSSSD_StripE_DetectorNbr.size() ;} + UShort_t GetEnergyDetectorNbr (const Int_t i) const { return fSSSD_StripE_DetectorNbr[i] ;} + UShort_t GetEnergyStripNbr (const Int_t i) const { return fSSSD_StripE_StripNbr[i] ;} + Double_t GetEnergy (const Int_t i) const { return fSSSD_StripE_Energy[i] ;} + // (X,T) + UShort_t GetTimeMult () const { return fSSSD_StripT_DetectorNbr.size() ;} + UShort_t GetTimeDetectorNbr (const Int_t i) const { return fSSSD_StripT_DetectorNbr[i] ;} + UShort_t GetTimeStripNbr (const Int_t i) const { return fSSSD_StripT_StripNbr[i] ;} + Double_t GetTime (const Int_t i) const { return fSSSD_StripT_Time[i] ;} + + ClassDef(TSSSDData,1) // SSSDData structure }; #endif diff --git a/NPLib/SSSD/TSSSDPhysics.cxx b/NPLib/SSSD/TSSSDPhysics.cxx index f7af8c0515a8985d36e774e953382b7d930d0886..fab51df17807ae324d04528d826f4572595b6599 100644 --- a/NPLib/SSSD/TSSSDPhysics.cxx +++ b/NPLib/SSSD/TSSSDPhysics.cxx @@ -36,26 +36,26 @@ using namespace SSSD_LOCAL; #include "TChain.h" // tranform an integer to a string - string itoa(int value) - { - std::ostringstream o; - - if (!(o << value)) - return "" ; - - return o.str(); - } +string itoa(int value) +{ + std::ostringstream o; + + if (!(o << value)) + return "" ; + + return o.str(); +} ClassImp(TSSSDPhysics) /////////////////////////////////////////////////////////////////////////// TSSSDPhysics::TSSSDPhysics() { - NumberOfDetector = 0 ; - EventData = new TSSSDData ; - PreTreatedData = new TSSSDData ; - EventPhysics = this ; - m_E_Threshold = 0 ; - m_Pedestal_Threshold = 0 ; + NumberOfDetector = 0; + EventData = new TSSSDData; + PreTreatedData = new TSSSDData; + EventPhysics = this; + m_E_Threshold = 0; + m_Pedestal_Threshold = 0; } /////////////////////////////////////////////////////////////////////////// TSSSDPhysics::~TSSSDPhysics() @@ -63,30 +63,30 @@ TSSSDPhysics::~TSSSDPhysics() /////////////////////////////////////////////////////////////////////////// void TSSSDPhysics::Clear() { - DetectorNumber .clear() ; - StripNumber .clear() ; - Energy .clear() ; - Time .clear() ; + DetectorNumber .clear() ; + StripNumber .clear() ; + Energy .clear() ; + Time .clear() ; } /////////////////////////////////////////////////////////////////////////// void TSSSDPhysics::ReadConfiguration(string Path) { ifstream ConfigFile ; ConfigFile.open(Path.c_str()) ; - string LineBuffer ; - string DataBuffer ; + string LineBuffer ; + string DataBuffer ; double TLX , BLX , BRX , TRX , TLY , BLY , BRY , TRY , TLZ , BLZ , BRZ , TRZ ; double Theta = 0 , Phi = 0 , R = 0 , beta_u = 0 , beta_v = 0 , beta_w = 0 ; - bool check_A = false ; + bool check_A = false ; bool check_B = false ; - bool check_C = false ; + bool check_C = false ; bool check_D = false ; bool check_Theta = false ; - bool check_Phi = false ; + bool check_Phi = false ; bool check_R = false ; - bool check_beta = false ; + bool check_beta = false ; bool ReadingStatus = false ; while (!ConfigFile.eof()) @@ -226,15 +226,15 @@ void TSSSDPhysics::ReadConfiguration(string Path) // Reinitialisation of Check Boolean - check_A = false ; + check_A = false ; check_B = false ; - check_C = false ; + check_C = false ; check_D = false ; - check_Theta = false ; - check_Phi = false ; - check_R = false ; - check_beta = false ; + check_Theta = false ; + check_Phi = false ; + check_R = false ; + check_beta = false ; ReadingStatus = false ; } @@ -317,37 +317,37 @@ void TSSSDPhysics::PreTreat() { if(EventData->GetEnergy(i) > m_Pedestal_Threshold && ChannelStatus[EventData->GetEnergyDetectorNbr(i)][EventData->GetEnergyStripNbr(i)]) { - double E = fSi_E(EventData , i); - if( E > m_E_Threshold ) - { - PreTreatedData->SetEnergyDetectorNbr( EventData->GetEnergyDetectorNbr(i) ) ; - PreTreatedData->SetEnergyStripNbr( EventData->GetEnergyStripNbr(i) ) ; - PreTreatedData->SetEnergy( E ) ; - } - } - } - - // T - for(int i = 0 ; i < EventData->GetTimeMult() ; ++i) - { - if(ChannelStatus[EventData->GetEnergyDetectorNbr(i)][EventData->GetEnergyStripNbr(i)]) - { - PreTreatedData->SetTimeDetectorNbr( EventData->GetTimeDetectorNbr(i) ) ; - PreTreatedData->SetTimeStripNbr( EventData->GetTimeStripNbr(i) ) ; - PreTreatedData->SetTime( fSi_T(EventData , i) ) ; - } - } + double E = fSi_E(EventData , i); + if( E > m_E_Threshold ) + { + PreTreatedData->SetEnergyDetectorNbr( EventData->GetEnergyDetectorNbr(i) ) ; + PreTreatedData->SetEnergyStripNbr( EventData->GetEnergyStripNbr(i) ) ; + PreTreatedData->SetEnergy( E ) ; + } + } + } + + // T + for(int i = 0 ; i < EventData->GetTimeMult() ; ++i) + { + if(ChannelStatus[EventData->GetEnergyDetectorNbr(i)][EventData->GetEnergyStripNbr(i)]) + { + PreTreatedData->SetTimeDetectorNbr( EventData->GetTimeDetectorNbr(i) ) ; + PreTreatedData->SetTimeStripNbr( EventData->GetTimeStripNbr(i) ) ; + PreTreatedData->SetTime( fSi_T(EventData , i) ) ; + } + } } /////////////////////////////////////////////////////////////////////////// void TSSSDPhysics::InitializeStandardParameter() { - // Enable all channel - vector<bool> TempChannelStatus; + // Enable all channel + vector<bool> TempChannelStatus; ChannelStatus.clear(); - TempChannelStatus.resize(16,true); - for(int i = 0 ; i < NumberOfDetector ; ++i) - ChannelStatus[i+1] = TempChannelStatus; + TempChannelStatus.resize(16,true); + for(int i = 0 ; i < NumberOfDetector ; ++i) + ChannelStatus[i+1] = TempChannelStatus; } /////////////////////////////////////////////////////////////////////////// void TSSSDPhysics::ReadAnalysisConfig() @@ -430,23 +430,23 @@ void TSSSDPhysics::ReadAnalysisConfig() } } } -} - - - - /////////////////////////////////////////////////////////////////////////// - double SSSD_LOCAL::fSi_E( const TSSSDData* EventData , const int i ) - { - return CalibrationManager::getInstance()->ApplyCalibration( "SSSD/Detector" + itoa( EventData->GetEnergyDetectorNbr(i) ) + "_Strip" + itoa( EventData->GetEnergyStripNbr(i) ) +"_E", - EventData->GetEnergy(i) ); - } - - - double SSSD_LOCAL::fSi_T( const TSSSDData* EventData , const int i ) - { - return CalibrationManager::getInstance()->ApplyCalibration( "SSSD/Detector" + itoa( EventData->GetEnergyDetectorNbr(i) ) + "_Strip" + itoa( EventData->GetEnergyStripNbr(i) ) +"_T", - EventData->GetTime(i) ); - } - - - +} + + + + /////////////////////////////////////////////////////////////////////////// + double SSSD_LOCAL::fSi_E( const TSSSDData* EventData , const int i ) + { + return CalibrationManager::getInstance()->ApplyCalibration( "SSSD/Detector" + itoa( EventData->GetEnergyDetectorNbr(i) ) + "_Strip" + itoa( EventData->GetEnergyStripNbr(i) ) +"_E", + EventData->GetEnergy(i) ); + } + + + double SSSD_LOCAL::fSi_T( const TSSSDData* EventData , const int i ) + { + return CalibrationManager::getInstance()->ApplyCalibration( "SSSD/Detector" + itoa( EventData->GetEnergyDetectorNbr(i) ) + "_Strip" + itoa( EventData->GetEnergyStripNbr(i) ) +"_T", + EventData->GetTime(i) ); + } + + + diff --git a/NPLib/SSSD/TSSSDPhysics.h b/NPLib/SSSD/TSSSDPhysics.h index 64e74ac0e0358cca383cdeb54cf8fe31a67be29c..1814e0f0b8b0fa0c277f9749da26675b1015a54d 100644 --- a/NPLib/SSSD/TSSSDPhysics.h +++ b/NPLib/SSSD/TSSSDPhysics.h @@ -21,14 +21,14 @@ * * * * *****************************************************************************/ -// STL +// STL #include <vector> using namespace std ; -// ROOT +// ROOT #include "TObject.h" -// NPL +// NPL #include "TSSSDData.h" #include "../include/VDetector.h" #include "../include/CalibrationManager.h" @@ -36,24 +36,24 @@ using namespace std ; class TSSSDPhysics : public TObject, public NPA::VDetector { - public: // Constructor and Destructor + public: // Constructor and Destructor TSSSDPhysics(); ~TSSSDPhysics(); - public: // Calibrated Data - vector<UShort_t> DetectorNumber; - vector<UShort_t> StripNumber; - vector<Double_t> Energy; - vector<Double_t> Time; + public: // Calibrated Data + vector<UShort_t> DetectorNumber; + vector<UShort_t> StripNumber; + vector<Double_t> Energy; + vector<Double_t> Time; - public: // inherrited from VDetector + public: // inherrited from VDetector // Read stream at ConfigFile to pick-up parameters of detector (Position,...) using Token void ReadConfiguration(string); - + // Add Parameter to the CalibrationManger - void AddParameterToCalibrationManager(); - - + void AddParameterToCalibrationManager(); + + // 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 InitializeRootInput(); @@ -63,22 +63,22 @@ class TSSSDPhysics : public TObject, public NPA::VDetector // This method is called at each event read from the Input Tree. Aime is to build treat Raw dat in order to extract physical parameter. void BuildPhysicalEvent(); - - + + // Same as above, but only the simplest event and/or simple method are used (low multiplicity, faster algorythm but less efficient ...). // This method aimed to be used for analysis performed during experiment, when speed is requiered. // NB: This method can eventually be the same as BuildPhysicalEvent. void BuildSimplePhysicalEvent(); // Those two method all to clear the Event Physics or Data - void ClearEventPhysics() {Clear();} - void ClearEventData() {EventData->Clear();} + void ClearEventPhysics() {Clear();} + void ClearEventData() {EventData->Clear();} - public: // Specific to SSSD + public: // Specific to SSSD // Clear The PreTeated object - void ClearPreTreatedData() {PreTreatedData->Clear();} - + void ClearPreTreatedData() {PreTreatedData->Clear();} + // Remove bad channel, calibrate the data and apply threshold void PreTreat(); @@ -86,19 +86,19 @@ class TSSSDPhysics : public TObject, public NPA::VDetector // ie: all channel enable, maximum multiplicity for strip = number of telescope void InitializeStandardParameter(); - // Read the user configuration file; if no file found, load standard one - void ReadAnalysisConfig(); + // Read the user configuration file; if no file found, load standard one + void ReadAnalysisConfig(); - private: // Data not written in the tree - int NumberOfDetector; //! - TSSSDData* EventData; //! - TSSSDData* PreTreatedData; //! - TSSSDPhysics* EventPhysics; //! + private: // Data not written in the tree + int NumberOfDetector;//! + TSSSDData* EventData;//! + TSSSDData* PreTreatedData;//! + TSSSDPhysics* EventPhysics;//! - double m_E_Threshold; //! - double m_Pedestal_Threshold; //! - + double m_E_Threshold;//! + double m_Pedestal_Threshold;//! + private: // Map of activated Channel map< int, vector<bool> > ChannelStatus;//! @@ -106,9 +106,9 @@ class TSSSDPhysics : public TObject, public NPA::VDetector public: // Return True if the channel is activated // bool IsValidChannel(int DetectorNbr, int StripNbr) ; - void Clear(); + void Clear(); void Clear(const Option_t*) {}; - + ClassDef(TSSSDPhysics,1) // SSSDPhysics structure }; diff --git a/NPLib/Shield/Shield.cxx b/NPLib/Shield/Shield.cxx index 56c9a8ef1f906acde74600ce4846cd0aa6c96847..9fffc340bdc3971879196668355307186dd5f3fa 100644 --- a/NPLib/Shield/Shield.cxx +++ b/NPLib/Shield/Shield.cxx @@ -22,7 +22,7 @@ #include "Shield.h" // C++ headers -#include <iostream> +#include <iostream> #include <fstream> #include <string> #include <cmath> @@ -35,16 +35,16 @@ // ROOT headers #include "TChain.h" -using namespace std ; - -// Default Constructor +using namespace std ; + +// Default Constructor Shield::Shield() { m_NumberOfModule = 0; m_EventData = new TShieldData(); m_EventPhysics = new TShieldPhysics(); -} +} @@ -53,17 +53,17 @@ Shield::~Shield() m_NumberOfModule = 0; delete m_EventData; delete m_EventPhysics; -} +} // Read stream at ConfigFile to pick-up parameters of detector (Position,...) using Token -void Shield::ReadConfiguration(string Path) +void Shield::ReadConfiguration(string Path) { - ifstream ConfigFile ; - ConfigFile.open(Path.c_str()) ; - string LineBuffer ; - string DataBuffer ; + ifstream ConfigFile ; + ConfigFile.open(Path.c_str()) ; + string LineBuffer ; + string DataBuffer ; // A:X1_Y1 --> X:1 Y:1 // B:X128_Y1 --> X:128 Y:1 @@ -107,8 +107,8 @@ void Shield::ReadConfiguration(string Path) else ReadingStatus = false; // Reading Block - while (ReadingStatus) { - if (isCluster) { // square shape + while (ReadingStatus) { + if (isCluster) { // square shape ConfigFile >> DataBuffer ; // Comment Line if (DataBuffer.compare(0, 1, "%") == 0) { @@ -260,7 +260,7 @@ void Shield::ReadConfiguration(string Path) } // end test for adding a module } // end test for ShieldCluster shape - else if (isPhoswich) { // ShieldPhoswich shape + else if (isPhoswich) { // ShieldPhoswich shape ConfigFile >> DataBuffer ; // Comment Line if (DataBuffer.compare(0, 1, "%") == 0) { @@ -422,7 +422,7 @@ void Shield::ReadConfiguration(string Path) // Read stream at Path and pick-up calibration parameter using Token // If argument is "Simulation" no change calibration is loaded -void Shield::ReadCalibrationFile(string Path) +void Shield::ReadCalibrationFile(string Path) { // Order of Polynom function used for calibration int Calibration_Si_E_Order; @@ -431,16 +431,16 @@ void Shield::ReadCalibrationFile(string Path) int Calibration_CsI_E_Order; // Calibration_Si_X_E[DetectorNumber][StripNumber][Order of Coeff] - vector< vector< vector< double > > > Calibration_Si_X_E ; - vector< vector< vector< double > > > Calibration_Si_X_T ; - vector< vector< vector< double > > > Calibration_Si_Y_E ; - vector< vector< vector< double > > > Calibration_Si_Y_T ; + vector< vector< vector< double > > > Calibration_Si_X_E ; + vector< vector< vector< double > > > Calibration_Si_X_T ; + vector< vector< vector< double > > > Calibration_Si_Y_E ; + vector< vector< vector< double > > > Calibration_Si_Y_T ; // Calibration_SiLi_E[DetectorNumber][PadNumber][Order of Coeff] - vector< vector< vector< double > > > Calibration_SiLi_E ; + vector< vector< vector< double > > > Calibration_SiLi_E ; // Calibration_SiLi_E[DetectorNumber][CrystalNumber][Order of Coeff] - vector< vector< vector< double > > > Calibration_CsI_E ; + vector< vector< vector< double > > > Calibration_CsI_E ; if (Path == "Simulation") { // Simulation case: data already calibrated Calibration_Si_E_Order = 1; @@ -449,29 +449,29 @@ void Shield::ReadCalibrationFile(string Path) Calibration_CsI_E_Order = 1; vector<double> Coef; - // Order 0 Order 1 - Coef.push_back(0) ; Coef.push_back(1) ; - - vector< vector<double> > StripLine ; - StripLine.resize( 128 , Coef) ; - - Calibration_Si_X_E.resize( m_NumberOfModule , StripLine) ; - Calibration_Si_X_T.resize( m_NumberOfModule , StripLine) ; - Calibration_Si_Y_E.resize( m_NumberOfModule , StripLine) ; - Calibration_Si_Y_T.resize( m_NumberOfModule , StripLine) ; - - Calibration_SiLi_E.resize( m_NumberOfModule , StripLine) ; - Calibration_CsI_E .resize( m_NumberOfModule , StripLine) ; + // Order 0 Order 1 + Coef.push_back(0) ; Coef.push_back(1) ; + + vector< vector<double> > StripLine ; + StripLine.resize( 128 , Coef) ; + + Calibration_Si_X_E.resize( m_NumberOfModule , StripLine) ; + Calibration_Si_X_T.resize( m_NumberOfModule , StripLine) ; + Calibration_Si_Y_E.resize( m_NumberOfModule , StripLine) ; + Calibration_Si_Y_T.resize( m_NumberOfModule , StripLine) ; + + Calibration_SiLi_E.resize( m_NumberOfModule , StripLine) ; + Calibration_CsI_E .resize( m_NumberOfModule , StripLine) ; } else { } -} +} - + // 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 Shield::InitializeRootInput() +void Shield::InitializeRootInput() { TChain* inputChain = RootInput::getInstance()->GetChain(); inputChain->SetBranchStatus("SHIELD", true); @@ -482,7 +482,7 @@ void Shield::InitializeRootInput() // Create associated branches and associated private member DetectorPhysics address -void Shield::InitializeRootOutput() +void Shield::InitializeRootOutput() { TTree* outputTree = RootOutput::getInstance()->GetTree(); outputTree->Branch("SHIELD", "TShieldPhysics", &m_EventPhysics); @@ -491,7 +491,7 @@ void Shield::InitializeRootOutput() // This method is called at each event read from the Input Tree. Aime is to build treat Raw dat in order to extract physical parameter. -void Shield::BuildPhysicalEvent() +void Shield::BuildPhysicalEvent() { m_EventPhysics -> BuildPhysicalEvent(m_EventData); } @@ -501,7 +501,7 @@ void Shield::BuildPhysicalEvent() // Same as above, but only the simplest event and/or simple method are used (low multiplicity, faster algorythm but less efficient ...). // This method aimed to be used for analysis performed during experiment, when speed is requiered. // NB: This method can eventually be the same as BuildPhysicalEvent. -void Shield::BuildSimplePhysicalEvent() +void Shield::BuildSimplePhysicalEvent() { m_EventPhysics -> BuildSimplePhysicalEvent(m_EventData); } @@ -532,7 +532,7 @@ void Shield::AddModuleSquare(TVector3 C_X1_Y1, TVector3 Strip_1_1; // Geometry Parameter - double Face = 98; // mm + double Face = 98; // mm double NumberOfStrip = 128; double StripPitch = Face/NumberOfStrip; // mm @@ -541,9 +541,9 @@ void Shield::AddModuleSquare(TVector3 C_X1_Y1, vector<double> lineY; vector<double> lineZ; - vector< vector< double > > OneModuleStripPositionX; - vector< vector< double > > OneModuleStripPositionY; - vector< vector< double > > OneModuleStripPositionZ; + vector< vector< double > > OneModuleStripPositionX; + vector< vector< double > > OneModuleStripPositionY; + vector< vector< double > > OneModuleStripPositionZ; // Moving StripCenter to 1.1 corner: Strip_1_1 = C_X1_Y1 + (U+V) * (StripPitch/2.); @@ -559,7 +559,7 @@ void Shield::AddModuleSquare(TVector3 C_X1_Y1, lineX.push_back( StripCenter.X() ); lineY.push_back( StripCenter.Y() ); - lineZ.push_back( StripCenter.Z() ); + lineZ.push_back( StripCenter.Z() ); } OneModuleStripPositionX.push_back(lineX); @@ -589,7 +589,7 @@ void Shield::AddModuleSquare(double theta, phi = phi * Pi/180. ; // Vector U on Module Face (paralelle to Y Strip) (NB: remember that Y strip are allong X axis) - TVector3 U ; + TVector3 U ; // Vector V on Module Face (parallele to X Strip) TVector3 V ; // Vector W normal to Module Face (pointing CsI) @@ -629,10 +629,10 @@ void Shield::AddModuleSquare(double theta, vector<double> lineY; vector<double> lineZ; - vector< vector< double > > OneModuleStripPositionX; - vector< vector< double > > OneModuleStripPositionY; - vector< vector< double > > OneModuleStripPositionZ; - + vector< vector< double > > OneModuleStripPositionX; + vector< vector< double > > OneModuleStripPositionY; + vector< vector< double > > OneModuleStripPositionZ; + double X, Y, Z; // Moving C to the 1.1 corner: @@ -691,7 +691,7 @@ void Shield::AddModuleDummyShape(TVector3 C_X1_Y1, TVector3 Strip_1_1; // Geometry Parameter - double Face = 50; // mm + double Face = 50; // mm double NumberOfStrip = 128; double StripPitch = Face/NumberOfStrip; // mm @@ -700,9 +700,9 @@ void Shield::AddModuleDummyShape(TVector3 C_X1_Y1, vector<double> lineY; vector<double> lineZ; - vector< vector< double > > OneModuleStripPositionX; - vector< vector< double > > OneModuleStripPositionY; - vector< vector< double > > OneModuleStripPositionZ; + vector< vector< double > > OneModuleStripPositionX; + vector< vector< double > > OneModuleStripPositionY; + vector< vector< double > > OneModuleStripPositionZ; // Moving StripCenter to 1.1 corner: Strip_1_1 = C_X1_Y1 + (U+V) * (StripPitch/2.); @@ -718,7 +718,7 @@ void Shield::AddModuleDummyShape(TVector3 C_X1_Y1, lineX.push_back( StripCenter.X() ); lineY.push_back( StripCenter.Y() ); - lineZ.push_back( StripCenter.Z() ); + lineZ.push_back( StripCenter.Z() ); } OneModuleStripPositionX.push_back(lineX); @@ -748,7 +748,7 @@ void Shield::AddModuleDummyShape(double theta, phi = phi * Pi/180. ; // Vector U on Module Face (paralelle to Y Strip) (NB: remember that Y strip are allong X axis) - TVector3 U ; + TVector3 U ; // Vector V on Module Face (parallele to X Strip) TVector3 V ; // Vector W normal to Module Face (pointing CsI) @@ -788,10 +788,10 @@ void Shield::AddModuleDummyShape(double theta, vector<double> lineY; vector<double> lineZ; - vector< vector< double > > OneModuleStripPositionX; - vector< vector< double > > OneModuleStripPositionY; - vector< vector< double > > OneModuleStripPositionZ; - + vector< vector< double > > OneModuleStripPositionX; + vector< vector< double > > OneModuleStripPositionY; + vector< vector< double > > OneModuleStripPositionZ; + double X, Y, Z; // Moving C to the 1.1 corner: @@ -826,7 +826,7 @@ void Shield::AddModuleDummyShape(double theta, -double Shield::GetEnergyDeposit() +double Shield::GetEnergyDeposit() { if (m_EventPhysics->ShieldTotalEnergy.size() > 0) return m_EventPhysics->ShieldTotalEnergy[0]; diff --git a/NPLib/Shield/Shield.h b/NPLib/Shield/Shield.h index cea85f802b346942c2ba89a37ac41681c7e1aa43..eb99c5a69e21f5e1ab5cc27cbb41cc008ae5bbe7 100644 --- a/NPLib/Shield/Shield.h +++ b/NPLib/Shield/Shield.h @@ -57,15 +57,15 @@ public: // This method is called at each event read from the Input Tree. // The aim is to build treat Raw dat in order to extract physical parameter. void BuildPhysicalEvent(); - + // Same as above, but only the simplest event and/or simple method are used (low multiplicity, faster algorythm but less efficient ...). // This method aimed to be used for analysis performed during experiment, when speed is requiered. // NB: This method can eventually be the same as BuildPhysicalEvent. void BuildSimplePhysicalEvent(); // Those two method all to clear the Event Physics or Data - void ClearEventPhysics() {m_EventPhysics->Clear();} - void ClearEventData() {m_EventData->Clear();} + void ClearEventPhysics() {m_EventPhysics->Clear();} + void ClearEventData() {m_EventData->Clear();} public: @@ -103,36 +103,36 @@ public: double beta_w); // Getters to retrieve the (X,Y,Z) coordinates of a pixel defined by strips (X,Y) - double GetStripPositionX(int N ,int X ,int Y) { return m_StripPositionX[N-1][X-1][Y-1]; } - double GetStripPositionY(int N ,int X ,int Y) { return m_StripPositionY[N-1][X-1][Y-1]; } - double GetStripPositionZ(int N ,int X ,int Y) { return m_StripPositionZ[N-1][X-1][Y-1]; } - double GetNumberOfModule() { return m_NumberOfModule; } + double GetStripPositionX(int N ,int X ,int Y) { return m_StripPositionX[N-1][X-1][Y-1]; } + double GetStripPositionY(int N ,int X ,int Y) { return m_StripPositionY[N-1][X-1][Y-1]; } + double GetStripPositionZ(int N ,int X ,int Y) { return m_StripPositionZ[N-1][X-1][Y-1]; } + double GetNumberOfModule() { return m_NumberOfModule; } // Get Root input and output objects - TShieldData* GetEventData() {return m_EventData;} - TShieldPhysics* GetEventPhysics() {return m_EventPhysics;} + TShieldData* GetEventData() {return m_EventData;} + TShieldPhysics* GetEventPhysics() {return m_EventPhysics;} // To be called after a build Physical Event - double GetEnergyDeposit(); - TVector3 GetPositionOfInteraction(); + double GetEnergyDeposit(); + TVector3 GetPositionOfInteraction(); - void Print(); + void Print(); private: //////////////////////////////////////// // Root Input and Output tree classes // //////////////////////////////////////// - TShieldData* m_EventData; - TShieldPhysics* m_EventPhysics; + TShieldData* m_EventData; + TShieldPhysics* m_EventPhysics; private: // Spatial Position of Strip Calculated on basis of detector position int m_NumberOfModule; - vector< vector < vector < double > > > m_StripPositionX; - vector< vector < vector < double > > > m_StripPositionY; - vector< vector < vector < double > > > m_StripPositionZ; + vector< vector < vector < double > > > m_StripPositionX; + vector< vector < vector < double > > > m_StripPositionY; + vector< vector < vector < double > > > m_StripPositionZ; }; #endif diff --git a/NPLib/Shield/TShieldData.h b/NPLib/Shield/TShieldData.h index 7ad37cfb69f672d5757d546fc570ff1bc1ce5186..604c28e8af788cd3bdc66d540a10a33b4ecb13ce 100644 --- a/NPLib/Shield/TShieldData.h +++ b/NPLib/Shield/TShieldData.h @@ -45,18 +45,18 @@ class TShieldData : public TObject { /* private: - vector<double> fParis_Energy; - vector<double> fParis_Time; - vector<short> fParis_Number; + vector<double> fParis_Energy; + vector<double> fParis_Time; + vector<short> fParis_Number; */ public: TShieldData(); virtual ~TShieldData(); - void Clear(); - void Clear(const Option_t*) {}; - void Dump() const; + void Clear(); + void Clear(const Option_t*) {}; + void Dump() const; ///////////////////// GETTERS //////////////////////// @@ -98,16 +98,16 @@ class TShieldData : public TObject { /* // (E) - //double GetEnergy(int i) {return fParis_Energy[i];} + //double GetEnergy(int i) {return fParis_Energy[i];} // (T) - //double GetTime(int i) {return fParis_Time[i];} + //double GetTime(int i) {return fParis_Time[i];} // (N) - int GetParisNumber(int i) {return fParis_Number[i];} - double GetEnergySize() {return fParis_Energy.size();} + int GetParisNumber(int i) {return fParis_Number[i];} + double GetEnergySize() {return fParis_Energy.size();} // (T) - double GetTimeSize() {return fParis_Time.size();} + double GetTimeSize() {return fParis_Time.size();} // (N) - int GetParisNumberSize() {return fParis_Number.size();} + int GetParisNumberSize() {return fParis_Number.size();} */ ///////////////////// SETTERS //////////////////////// @@ -145,9 +145,9 @@ class TShieldData : public TObject { /* // (E) - void SetEnergy(double E) {fParis_Energy.push_back(E);} - void SetTime(double T) {fParis_Time.push_back(T);} - void SetParisNumber(int N) {fParis_Number.push_back(N);} + void SetEnergy(double E) {fParis_Energy.push_back(E);} + void SetTime(double T) {fParis_Time.push_back(T);} + void SetParisNumber(int N) {fParis_Number.push_back(N);} */ ClassDef(TShieldData,1) // ParisData structure }; diff --git a/NPLib/Shield/TShieldPhysics.cxx b/NPLib/Shield/TShieldPhysics.cxx index 524a5b6cdde574899065c08c6b578f55b50918ef..5f517e55dc14965d414410b6bade2626a39bd546 100644 --- a/NPLib/Shield/TShieldPhysics.cxx +++ b/NPLib/Shield/TShieldPhysics.cxx @@ -74,12 +74,12 @@ void TShieldPhysics::BuildPhysicalEvent(TShieldData* Data) for(int j=0;j<multE;j++) { - EnergyStripFront= Data->GetPARISCsIShieldEEnergy(j); - - EnergyStrip = EnergyStripFront; - ShieldCsI_E.push_back(EnergyStrip); + EnergyStripFront= Data->GetPARISCsIShieldEEnergy(j); + + EnergyStrip = EnergyStripFront; + ShieldCsI_E.push_back(EnergyStrip); - EnergyTot += EnergyStrip; // addback between CsIShield + EnergyTot += EnergyStrip; // addback between CsIShield } // Fill total energy diff --git a/NPLib/Shield/TShieldPhysics.h b/NPLib/Shield/TShieldPhysics.h index d820214f3c4709121d138cf7a13511a2dc31d707..3f2535f113f004ac95402bcc897f8f7e8059cd70 100644 --- a/NPLib/Shield/TShieldPhysics.h +++ b/NPLib/Shield/TShieldPhysics.h @@ -38,42 +38,42 @@ public: ~TShieldPhysics(); public: - void Clear(); - void Clear(const Option_t*) {}; + void Clear(); + void Clear(const Option_t*) {}; void BuildPhysicalEvent(TShieldData* Data); void BuildSimplePhysicalEvent(TShieldData* Data); public: // Provide Physical Multiplicity - Int_t ShieldEventMult; + Int_t ShieldEventMult; // Provide a Classification of Event - //vector<int> EventType; + //vector<int> EventType; // Telescope - //vector<int> ModuleNumber; + //vector<int> ModuleNumber; - // FirstStage - vector<double> ShieldCsI_E; - //vector<double> FirstStage_T; - //vector<int> FirstStage_X; - //vector<int> FirstStage_Y; + // FirstStage + vector<double> ShieldCsI_E; + //vector<double> FirstStage_T; + //vector<int> FirstStage_X; + //vector<int> FirstStage_Y; /* - // SecondStage - vector<double> SecondStage_E; - //vector<double> SecondStage_T; - //vector<int> SecondStage_N; + // SecondStage + vector<double> SecondStage_E; + //vector<double> SecondStage_T; + //vector<int> SecondStage_N; - // ThirdStage - vector<double> ThirdStage_E; - vector<double> ThirdStage_T; - vector<int> ThirdStage_N; + // ThirdStage + vector<double> ThirdStage_E; + vector<double> ThirdStage_T; + vector<int> ThirdStage_N; */ // Physical Value - vector<double> ShieldTotalEnergy; + vector<double> ShieldTotalEnergy; ClassDef(TShieldPhysics,1) // ShieldPhysics structure }; diff --git a/NPLib/Tools/CalibrationManager.cxx b/NPLib/Tools/CalibrationManager.cxx index 33217f8feb2dbe286268d5359cb928f74fb66aff..b232fa85f1a4100fcd898c7eae1dc01cc0670ef2 100644 --- a/NPLib/Tools/CalibrationManager.cxx +++ b/NPLib/Tools/CalibrationManager.cxx @@ -23,7 +23,7 @@ #include "TAsciiFile.h" #include "RootOutput.h" -// STL +// STL #include <cstdlib> #include <limits> #include <cmath> @@ -33,26 +33,26 @@ CalibrationManager* CalibrationManager::instance = 0; CalibrationManager* CalibrationManager::getInstance(string configFileName) - { - // A new instance of CalibrationManager is created if it does not exist: - if (instance == 0) { - instance = new CalibrationManager(configFileName); - } + { + // A new instance of CalibrationManager is created if it does not exist: + if (instance == 0) { + instance = new CalibrationManager(configFileName); + } - // The instance of CalibrationManager is returned: - return instance; - } - + // The instance of CalibrationManager is returned: + return instance; + } + ////////////////////////////////////////////////////////////////// CalibrationManager::CalibrationManager(string configFileName) - { + { // Read configuration file Buffer string lineBuffer, dataBuffer; // Open file ifstream inputConfigFile; inputConfigFile.open(configFileName.c_str()); - + cout << endl; cout << "/////////// Calibration Information ///////////" << endl; cout << "Getting list of Calibration File" << endl; @@ -63,16 +63,16 @@ CalibrationManager::CalibrationManager(string configFileName) } else - { - cout << "Reading list of file from :" << configFileName << endl; + { + cout << "Reading list of file from :" << configFileName << endl; while (!inputConfigFile.eof()) { getline(inputConfigFile, lineBuffer); - + // search for token giving the list of Root files to treat if ( lineBuffer.compare(0, 19, "CalibrationFilePath") == 0 ) { while (!inputConfigFile.eof()) { inputConfigFile >> dataBuffer; - + // ignore comment Line if (dataBuffer.compare(0, 1, "%") == 0) { inputConfigFile.ignore(std::numeric_limits<std::streamsize>::max(), '\n'); @@ -82,133 +82,133 @@ CalibrationManager::CalibrationManager(string configFileName) AddFile(dataBuffer); cout << "Adding file " << dataBuffer << " to Calibration" << endl; } - } - } - } - } - cout << "/////////////////////////////////" << endl; + } + } + } + } + cout << "/////////////////////////////////" << endl; } - + ////////////////////////////////////////////////////////////////// CalibrationManager::~CalibrationManager() - {} - + {} + ////////////////////////////////////////////////////////////////// bool CalibrationManager::AddParameter(string DetectorName , string ParameterName , string Token ) - { - string ParameterPath = DetectorName + "/" + ParameterName ; - fToken[Token] = ParameterPath ; - return true; - } + { + string ParameterPath = DetectorName + "/" + ParameterName ; + fToken[Token] = ParameterPath ; + return true; + } ////////////////////////////////////////////////////////////////// void CalibrationManager::LoadParameterFromFile() - { - ifstream CalibFile ; - string DataBuffer ; - string LineBuffer ; - - // Get pointer to the TAsciifile CalibrationFile in RootOuput - TAsciiFile* AcsiiCalibration = RootOutput::getInstance()->GetAsciiFileCalibration(); - - - for(unsigned int i = 0 ; i < fFileList.size() ; i++) - { - CalibFile.open( fFileList[i].c_str() ); - map<string,string>::iterator it ; - - if(!CalibFile) - { - cout << "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX " << endl ; - cout << " WARNING: FILE " << fFileList[i] << " IS MISSING " << endl ; - cout << "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX " << endl ; - } - - else - { - // Append the Calibration File to the RootOuput for Back-up - string comment = "%%% From File " + fFileList[i] + "%%%"; - AcsiiCalibration->AppendLine(comment.c_str()); - AcsiiCalibration->Append(fFileList[i].c_str()); - - - while( !CalibFile.eof() ) - { - // Read the file Line by line - getline(CalibFile, LineBuffer); - - // Create a istringstream to manipulate the line easely - istringstream theLine (LineBuffer,istringstream::in); - theLine >> DataBuffer ; - - // Comment support, comment symbole is % - if(DataBuffer.compare(0, 1, "%") == 0) { - CalibFile.ignore ( std::numeric_limits<std::streamsize>::max(), '\n' );} - - // Search word in the token list - it=fToken.find(DataBuffer); - - // if the word is find, values are read - if( it!=fToken.end() ) - { - vector<double> Coeff ; - while( !theLine.eof() ) - { - theLine >> DataBuffer ; Coeff.push_back( atof(DataBuffer.c_str()) ) ; - } - - // Check this parameter is not already define - if( fCalibrationCoeff.find(it->second) != fCalibrationCoeff.end() ) - cout << "WARNING: Parameter " << it->second << " Already found. It will be rewritted " << endl; - - // Add the list of Coeff to the Coeff map using Parameter Path as index - fCalibrationCoeff[ it->second ] = Coeff ; - } - - } - - } - - - CalibFile.close() ; - } - } + { + ifstream CalibFile ; + string DataBuffer ; + string LineBuffer ; + + // Get pointer to the TAsciifile CalibrationFile in RootOuput + TAsciiFile* AcsiiCalibration = RootOutput::getInstance()->GetAsciiFileCalibration(); + + + for(unsigned int i = 0 ; i < fFileList.size() ; i++) + { + CalibFile.open( fFileList[i].c_str() ); + map<string,string>::iterator it ; + + if(!CalibFile) + { + cout << "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX " << endl ; + cout << " WARNING: FILE " << fFileList[i] << " IS MISSING " << endl ; + cout << "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX " << endl ; + } + + else + { + // Append the Calibration File to the RootOuput for Back-up + string comment = "%%% From File " + fFileList[i] + "%%%"; + AcsiiCalibration->AppendLine(comment.c_str()); + AcsiiCalibration->Append(fFileList[i].c_str()); + + + while( !CalibFile.eof() ) + { + // Read the file Line by line + getline(CalibFile, LineBuffer); + + // Create a istringstream to manipulate the line easely + istringstream theLine (LineBuffer,istringstream::in); + theLine >> DataBuffer ; + + // Comment support, comment symbole is % + if(DataBuffer.compare(0, 1, "%") == 0) { + CalibFile.ignore ( std::numeric_limits<std::streamsize>::max(), '\n' );} + + // Search word in the token list + it=fToken.find(DataBuffer); + + // if the word is find, values are read + if( it!=fToken.end() ) + { + vector<double> Coeff ; + while( !theLine.eof() ) + { + theLine >> DataBuffer ; Coeff.push_back( atof(DataBuffer.c_str()) ) ; + } + + // Check this parameter is not already define + if( fCalibrationCoeff.find(it->second) != fCalibrationCoeff.end() ) + cout << "WARNING: Parameter " << it->second << " Already found. It will be rewritted " << endl; + + // Add the list of Coeff to the Coeff map using Parameter Path as index + fCalibrationCoeff[ it->second ] = Coeff ; + } + + } + + } + + + CalibFile.close() ; + } + } ////////////////////////////////////////////////////////////////// double CalibrationManager::ApplyCalibration(const string& ParameterPath , const double& RawValue) - { - map< string , vector<double> >::iterator it ; - - // Find the good parameter in the Map - // Using Find method of stl is the fastest way - it = fCalibrationCoeff.find(ParameterPath) ; - - // If the find methods return the end iterator it's mean the parameter was not found - if(it == fCalibrationCoeff.end() ) - { - /* cout << "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX " << endl ; - cout << " ERROR: PARAMETER " << ParameterPath << " IS NOT FOUND IN THE CALIBRATION DATA BASE " << endl ; - cout << "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX " << endl ;*/ - - return RawValue ; - } - - // Else we take the second part of the element (first is index, ie: parameter path) - // Second is the vector of Coeff - vector<double> Coeff = it->second ; - - // The vector size give the degree of calibration - // We just apply the coeff and returned the calibrated value - - double CalibratedValue = 0 ; - for(unsigned int i = 0 ; i < Coeff.size() ; i++) - { - CalibratedValue += Coeff[i]*pow(RawValue, (double)i); - } - - return CalibratedValue ; - - } + { + map< string , vector<double> >::iterator it ; + + // Find the good parameter in the Map + // Using Find method of stl is the fastest way + it = fCalibrationCoeff.find(ParameterPath) ; + + // If the find methods return the end iterator it's mean the parameter was not found + if(it == fCalibrationCoeff.end() ) + { + /* cout << "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX " << endl ; + cout << " ERROR: PARAMETER " << ParameterPath << " IS NOT FOUND IN THE CALIBRATION DATA BASE " << endl ; + cout << "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX " << endl ;*/ + + return RawValue ; + } + + // Else we take the second part of the element (first is index, ie: parameter path) + // Second is the vector of Coeff + vector<double> Coeff = it->second ; + + // The vector size give the degree of calibration + // We just apply the coeff and returned the calibrated value + + double CalibratedValue = 0 ; + for(unsigned int i = 0 ; i < Coeff.size() ; i++) + { + CalibratedValue += Coeff[i]*pow(RawValue, (double)i); + } + + return CalibratedValue ; + + } ////////////////////////////////////////////////////////////////// diff --git a/NPLib/Tools/CalibrationManager.h b/NPLib/Tools/CalibrationManager.h index deb2c3c397cabaccc3a0b7856c12f4fca95dd44e..f319facec6ae8d6b08bf5f648259ef8eff4cd758 100644 --- a/NPLib/Tools/CalibrationManager.h +++ b/NPLib/Tools/CalibrationManager.h @@ -21,7 +21,7 @@ * This class is a singleton * * * *****************************************************************************/ -// STL +// STL #include<fstream> #include<iostream> #include<string> @@ -31,51 +31,51 @@ using namespace std ; class CalibrationManager - { - - protected: // Constructor and Destructor are protected because the class is a singleton - CalibrationManager(string configFileName); - ~CalibrationManager(); - - public: // Accessor - // return a pointer to the calibration manager instance. - // if the instance does not exist it is created. - static CalibrationManager* getInstance(string configFileName="XXX"); - - private: // the instance - // Hold a pointer on itself - static CalibrationManager* instance ; - - public: // File Management - inline void AddFile(string Path) { fFileList.push_back(Path) ;} ; - - - public: // Calibration Parameter Related - - // call like : myCalibrationManager->AddParameter( "MUST2" ,"Telescope5_Si_X38_E", "T5_Si_X38_E" ) - // return false if the token is not found in the file list - bool AddParameter(string DetectorName , string ParameterName , string Token) ; - - // call like : myCalibrationManager->ApplyCalibration( "MUST2/Telescope5_Si_X38_E" , RawEnergy ) - // return the Calibrated value - double ApplyCalibration(const string& ParameterPath , const double& RawValue); - - - public: // To be called after initialisation - // Loop over the file list and catch the file used for calibration - void LoadParameterFromFile(); - - - private: - // This map hold a vector of the calibration coefficient. Index is the Parameter path, like "MUST2/Telescope5_Si_X38_E" - map< string , vector<double> > fCalibrationCoeff ; - - // Hold the path of all the registered file of coeff - vector<string> fFileList ; - - // Hold The list of Token. Index is the Token, value the parameter path. - map< string , string > fToken ; - - }; - + { + + protected: // Constructor and Destructor are protected because the class is a singleton + CalibrationManager(string configFileName); + ~CalibrationManager(); + + public: // Accessor + // return a pointer to the calibration manager instance. + // if the instance does not exist it is created. + static CalibrationManager* getInstance(string configFileName="XXX"); + + private: // the instance + // Hold a pointer on itself + static CalibrationManager* instance ; + + public: // File Management + inline void AddFile(string Path) { fFileList.push_back(Path) ;} ; + + + public: // Calibration Parameter Related + + // call like : myCalibrationManager->AddParameter( "MUST2" ,"Telescope5_Si_X38_E", "T5_Si_X38_E" ) + // return false if the token is not found in the file list + bool AddParameter(string DetectorName , string ParameterName , string Token) ; + + // call like : myCalibrationManager->ApplyCalibration( "MUST2/Telescope5_Si_X38_E" , RawEnergy ) + // return the Calibrated value + double ApplyCalibration(const string& ParameterPath , const double& RawValue); + + + public: // To be called after initialisation + // Loop over the file list and catch the file used for calibration + void LoadParameterFromFile(); + + + private: + // This map hold a vector of the calibration coefficient. Index is the Parameter path, like "MUST2/Telescope5_Si_X38_E" + map< string , vector<double> > fCalibrationCoeff ; + + // Hold the path of all the registered file of coeff + vector<string> fFileList ; + + // Hold The list of Token. Index is the Token, value the parameter path. + map< string , string > fToken ; + + }; + #endif diff --git a/NPLib/Tools/NPTagManager.cxx b/NPLib/Tools/NPTagManager.cxx index 51be7299bfb19d5ddd119e73dcb1233dce37884a..65424df9667acf9d0449c6de8806a0225aca31f6 100644 --- a/NPLib/Tools/NPTagManager.cxx +++ b/NPLib/Tools/NPTagManager.cxx @@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (C) 2009 this file is part of the NPTool Project * + * Copyright (C) 2009 this file is part of the NPTool Project * * * * For the licensing terms see $NPTOOL/Licence/NPTool_Licence * * For the list of contributors see $NPTOOL/Licence/Contributors * @@ -13,11 +13,11 @@ * Last update : * *---------------------------------------------------------------------------* * Decription: * - * This class will held a set of string, that can be used as a TAG manager * + * This class will held a set of string, that can be used as a TAG manager * * Users can write macro and add different TAG to that object based on users * * condition. Then the TAG branch can be open and close alone to select event* * without loading the whole tree. * - * * + * * *---------------------------------------------------------------------------* * Comment: * * * @@ -35,20 +35,20 @@ NPTagManager::~NPTagManager(){} //////////////////////////////////////////// bool NPTagManager::Is(string condition) - { - // return True is the element is find, false other wise + { + // return True is the element is find, false other wise return !( fTAG.find(condition)==fTAG.end() ); } //////////////////////////////////////////// void NPTagManager::AddCondition(string condition) - { + { fTAG.insert(condition); - } + } //////////////////////////////////////////// void NPTagManager::PrintCondition() - { - set<string>::iterator it ; + { + set<string>::iterator it ; cout << "------------------ Event Condition ------------------" << endl ; @@ -59,11 +59,11 @@ void NPTagManager::PrintCondition() cout << "-------------------------------------------------------" << endl ; - } + } //////////////////////////////////////////// void NPTagManager::PrintConditionToFile(string filename) - { + { ofstream file; file.open(filename.c_str()); @@ -72,7 +72,7 @@ void NPTagManager::PrintConditionToFile(string filename) else { - set<string>::iterator it ; + set<string>::iterator it ; file << "------------------ Event Condition ------------------" << endl ; @@ -85,6 +85,6 @@ void NPTagManager::PrintConditionToFile(string filename) } - } + } diff --git a/NPLib/Tools/NPTagManager.h b/NPLib/Tools/NPTagManager.h index 982822c281651ba0b47ffd5bba53faf05d9b362c..cec5783a4b3cb0bcdbb5306beae9570700a3157a 100644 --- a/NPLib/Tools/NPTagManager.h +++ b/NPLib/Tools/NPTagManager.h @@ -1,7 +1,7 @@ #ifndef _TAG_ #define _TAG_ /***************************************************************************** - * Copyright (C) 2009 this file is part of the NPTool Project * + * Copyright (C) 2009 this file is part of the NPTool Project * * * * For the licensing terms see $NPTOOL/Licence/NPTool_Licence * * For the list of contributors see $NPTOOL/Licence/Contributors * @@ -15,11 +15,11 @@ * Last update : * *---------------------------------------------------------------------------* * Decription: * - * This class will held a set of string, that can be used as a TAG manager * + * This class will held a set of string, that can be used as a TAG manager * * Users can write macro and add different TAG to that object based on users * * condition. Then the TAG branch can be open and close alone to select event* * without loading the whole tree. * - * * + * * *---------------------------------------------------------------------------* * Comment: * * * diff --git a/NPLib/Tools/TAsciiFile.h b/NPLib/Tools/TAsciiFile.h index df9f63f34dde35c64ba9122df97851651d97b111..dab22eed971342530e4d8fc7b4366e8afc171a53 100644 --- a/NPLib/Tools/TAsciiFile.h +++ b/NPLib/Tools/TAsciiFile.h @@ -33,7 +33,7 @@ using namespace std; class TAsciiFile : public TNamed { private : - vector<string> fLines; + vector<string> fLines; protected : void ReadFile(const char* inputAsciiFile); @@ -52,7 +52,7 @@ class TAsciiFile : public TNamed { void Print(UInt_t begin, UInt_t end) const; bool IsEmpty() const; - ClassDef(TAsciiFile, 1); // Class TAsciiFile for storing ascii text + ClassDef(TAsciiFile, 1); // Class TAsciiFile for storing ascii text }; #endif diff --git a/NPLib/VDetector/DetectorManager.cxx b/NPLib/VDetector/DetectorManager.cxx index 4b62e2a520f96d75d6149d5eb80f20f4d44255c2..5749c8e56f5363fd36d304ed6ae91e62c52175a9 100644 --- a/NPLib/VDetector/DetectorManager.cxx +++ b/NPLib/VDetector/DetectorManager.cxx @@ -1,11 +1,11 @@ #include "DetectorManager.h" -// STL +// STL #include <iostream> #include <fstream> #include <cstdlib> -// Detector +// Detector #include "TMust2Physics.h" #include "TSSSDPhysics.h" #include "TPlasticPhysics.h" @@ -17,15 +17,15 @@ #include "NPOptionManager.h" #include "RootInput.h" ///////////////////////////////////////////////////////////////////////////////////////////////// -// Default Constructor -DetectorManager::DetectorManager() +// Default Constructor +DetectorManager::DetectorManager() { } -///////////////////////////////////////////////////////////////////////////////////////////////// -// Default Desstructor +///////////////////////////////////////////////////////////////////////////////////////////////// +// Default Desstructor DetectorManager::~DetectorManager() { } @@ -33,8 +33,8 @@ DetectorManager::~DetectorManager() ///////////////////////////////////////////////////////////////////////////////////////////////// -// Read stream at ConfigFile and pick-up Token declaration of Detector -void DetectorManager::ReadConfigurationFile(string Path) +// Read stream at ConfigFile and pick-up Token declaration of Detector +void DetectorManager::ReadConfigurationFile(string Path) { ////////General Reading needs//////// string LineBuffer; @@ -339,8 +339,8 @@ void DetectorManager::ReadConfigurationFile(string Path) -///////////////////////////////////////////////////////////////////////////////////////////////// -void DetectorManager::BuildPhysicalEvent() +///////////////////////////////////////////////////////////////////////////////////////////////// +void DetectorManager::BuildPhysicalEvent() { map<string,VDetector*>::iterator it; @@ -364,7 +364,7 @@ void DetectorManager::BuildSimplePhysicalEvent() ///////////////////////////////////////////////////////////////////////////////////////////////// -void DetectorManager::InitializeRootInput() +void DetectorManager::InitializeRootInput() { if( NPOptionManager::getInstance()->GetDisableAllBranchOption() ) @@ -379,8 +379,8 @@ void DetectorManager::InitializeRootInput() -///////////////////////////////////////////////////////////////////////////////////////////////// -void DetectorManager::InitializeRootOutput() +///////////////////////////////////////////////////////////////////////////////////////////////// +void DetectorManager::InitializeRootOutput() { map<string,VDetector*>::iterator it; @@ -421,4 +421,4 @@ void DetectorManager::ClearEventData() it->second->ClearEventData(); } } - + diff --git a/NPLib/VDetector/DetectorManager.h b/NPLib/VDetector/DetectorManager.h index 8f39b6d50c689eaa20858fa5e119ece0e4c59851..3b272c9915788426e7fa5d5e3df89c9a1142a8e4 100644 --- a/NPLib/VDetector/DetectorManager.h +++ b/NPLib/VDetector/DetectorManager.h @@ -1,10 +1,10 @@ #ifndef DetectorManager_h #define DetectorManager_h -// NPL +// NPL #include "VDetector.h" -// STL +// STL #include <string> #include <map> @@ -13,50 +13,50 @@ using namespace NPA ; // This class manage a map of virtual detector namespace NPA - { - class DetectorManager - { - public: - DetectorManager(); - ~DetectorManager(); - - public: - // Read stream at Path and pick-up Token declaration of Detector - void ReadConfigurationFile(string Path); - void BuildPhysicalEvent(); - void BuildSimplePhysicalEvent(); - void InitializeRootInput(); - void InitializeRootOutput(); - void AddDetector(string,VDetector*); - void ClearEventPhysics(); - void ClearEventData(); - - public: - // The map containning all detectors - // Using a Map one can access to any detector using its name - map<string,VDetector*> m_Detector; - - // Special treatment for the target for the moment - // If necessary we should change it to treat it as - // a full "detector" - private: - double m_TargetThickness; - double m_TargetAngle; - double m_TargetRadius; - string m_TargetMaterial; - double m_TargetX; - double m_TargetY; - double m_TargetZ; - - public: - double GetTargetThickness() {return m_TargetThickness;} - string GetTargetMaterial() {return m_TargetMaterial;} - double GetTargetRadius() {return m_TargetRadius;} - double GetTargetAngle() {return m_TargetAngle;} - double GetTargetX() {return m_TargetX;} - double GetTargetY() {return m_TargetY;} - double GetTargetZ() {return m_TargetZ;} - }; - } + { + class DetectorManager + { + public: + DetectorManager(); + ~DetectorManager(); + + public: + // Read stream at Path and pick-up Token declaration of Detector + void ReadConfigurationFile(string Path); + void BuildPhysicalEvent(); + void BuildSimplePhysicalEvent(); + void InitializeRootInput(); + void InitializeRootOutput(); + void AddDetector(string,VDetector*); + void ClearEventPhysics(); + void ClearEventData(); + + public: + // The map containning all detectors + // Using a Map one can access to any detector using its name + map<string,VDetector*> m_Detector; + + // Special treatment for the target for the moment + // If necessary we should change it to treat it as + // a full "detector" + private: + double m_TargetThickness; + double m_TargetAngle; + double m_TargetRadius; + string m_TargetMaterial; + double m_TargetX; + double m_TargetY; + double m_TargetZ; + + public: + double GetTargetThickness() {return m_TargetThickness;} + string GetTargetMaterial() {return m_TargetMaterial;} + double GetTargetRadius() {return m_TargetRadius;} + double GetTargetAngle() {return m_TargetAngle;} + double GetTargetX() {return m_TargetX;} + double GetTargetY() {return m_TargetY;} + double GetTargetZ() {return m_TargetZ;} + }; + } #endif diff --git a/NPLib/VDetector/VDetector.cxx b/NPLib/VDetector/VDetector.cxx index 877bb38e373022ae6bca8dd8bbea14ad2c3a6699..60fa250bd60cbacf4755e3b2824b7e12fca7c8e0 100644 --- a/NPLib/VDetector/VDetector.cxx +++ b/NPLib/VDetector/VDetector.cxx @@ -1,6 +1,6 @@ /***************************************************************************** - * Copyright (C) 2009 this file is part of the NPTool Project * - * * + * Copyright (C) 2009 this file is part of the NPTool Project * + * * * For the licensing terms see $NPTOOL/Licence/NPTool_Licence * * For the list of contributors see $NPTOOL/Licence/Contributors * *****************************************************************************/ @@ -16,7 +16,7 @@ * All detector class used in NPAnalysis should derived from this virtual * * class. Those VDetector daughter will deal with geometry, calibration and * * basic data treatment. * - * * + * * *---------------------------------------------------------------------------* * Comment: * * See MUST2 array for exemple of VDetector derived class * diff --git a/NPLib/VDetector/VDetector.h b/NPLib/VDetector/VDetector.h index ee2a631eacbc6d792e6a37c750b92f9849acd0b9..e0cfc532b4632758d1daa8ef7a7511fc0cef89c7 100644 --- a/NPLib/VDetector/VDetector.h +++ b/NPLib/VDetector/VDetector.h @@ -1,8 +1,8 @@ #ifndef VDectector_H #define VDectector_H /***************************************************************************** - * Copyright (C) 2009 this file is part of the NPTool Project * - * * + * Copyright (C) 2009 this file is part of the NPTool Project * + * * * For the licensing terms see $NPTOOL/Licence/NPTool_Licence * * For the list of contributors see $NPTOOL/Licence/Contributors * *****************************************************************************/ @@ -18,78 +18,78 @@ * All detector class used in NPAnalysis should derived from this virtual * * class. Those VDetector daughter will deal with geometry, calibration and * * basic data treatment. * - * * + * * *---------------------------------------------------------------------------* * Comment: * * See MUST2 array for exemple of VDetector derived class * * * *****************************************************************************/ -// STL header +// STL header #include <string> using namespace std; namespace NPA - { - - class VDetector - { - public: + { + + class VDetector + { + public: - // Default Constructor and destructor - VDetector() ; - virtual ~VDetector() ; - - // Read stream at ConfigFile to pick-up parameters of detector (Position,...) using Token - virtual void ReadConfiguration(string) {} ; - - // Add Parameter to the CalibrationManger - virtual void AddParameterToCalibrationManager() {} ; + // Default Constructor and destructor + VDetector() ; + virtual ~VDetector() ; + + // Read stream at ConfigFile to pick-up parameters of detector (Position,...) using Token + virtual void ReadConfiguration(string) {} ; + + // Add Parameter to the CalibrationManger + virtual void AddParameterToCalibrationManager() {} ; - // 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 - virtual void InitializeRootInput() {} ; + // 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 + virtual void InitializeRootInput() {} ; - // Create associated branches and associated private member DetectorPhysics address - virtual void InitializeRootOutput() {} ; - - // This method is called at each event read from the Input Tree. Aime is to build treat Raw dat in order to extract physical parameter. - virtual void BuildPhysicalEvent() {} ; - - // Same as above, but only the simplest event and/or simple method are used (low multiplicity, faster algorythm but less efficient ...). - // This method aimed to be used for analysis performed during experiment, when speed is requiered. - // NB: This method can eventually be the same as BuildPhysicalEvent. - virtual void BuildSimplePhysicalEvent() {} ; - - // Those two method all to clear the Event Physics or Data - virtual void ClearEventPhysics() {} ; - virtual void ClearEventData() {} ; - - private: // The list below is here to help you building your own detector - /* - // GRU and Simulated Tree output are made of Data Object wich contain all the RAW parameter output by Detectors during an experiment. - // You need to add a pointer to those kind of object in order to received data from the Tree at each getEntry call. Just replace Detector - // by your Detector name, like Must2Data for Must2 - - DetectorData* EventData ; - - // Aime of analysis is to treat those raw data and output some physical data, during this process, Raw data will be calibrated, threshold applied, - // and whatever you need to do. Those Physical data are output in a DetectorPhysics object, attached in the output Tree - - DetectorPhysics* EventPhysics ; - - // Position of detector: An array which held geometric information of detector, such as Strip position,... - // Dimension must be suited for your need + // Create associated branches and associated private member DetectorPhysics address + virtual void InitializeRootOutput() {} ; + + // This method is called at each event read from the Input Tree. Aime is to build treat Raw dat in order to extract physical parameter. + virtual void BuildPhysicalEvent() {} ; + + // Same as above, but only the simplest event and/or simple method are used (low multiplicity, faster algorythm but less efficient ...). + // This method aimed to be used for analysis performed during experiment, when speed is requiered. + // NB: This method can eventually be the same as BuildPhysicalEvent. + virtual void BuildSimplePhysicalEvent() {} ; + + // Those two method all to clear the Event Physics or Data + virtual void ClearEventPhysics() {} ; + virtual void ClearEventData() {} ; + + private: // The list below is here to help you building your own detector + /* + // GRU and Simulated Tree output are made of Data Object wich contain all the RAW parameter output by Detectors during an experiment. + // You need to add a pointer to those kind of object in order to received data from the Tree at each getEntry call. Just replace Detector + // by your Detector name, like Must2Data for Must2 + + DetectorData* EventData ; + + // Aime of analysis is to treat those raw data and output some physical data, during this process, Raw data will be calibrated, threshold applied, + // and whatever you need to do. Those Physical data are output in a DetectorPhysics object, attached in the output Tree + + DetectorPhysics* EventPhysics ; + + // Position of detector: An array which held geometric information of detector, such as Strip position,... + // Dimension must be suited for your need - vector< vector <double > > DetectorPosition ; - - // Calibration are passed to the EventPhysics Object, so you don't need to store them here - - nothing noCalibration ; - - */ - - }; + vector< vector <double > > DetectorPosition ; + + // Calibration are passed to the EventPhysics Object, so you don't need to store them here + + nothing noCalibration ; + + */ + + }; - } + } #endif diff --git a/NPLib/W1/TW1Physics.cxx b/NPLib/W1/TW1Physics.cxx index d9b407e2a3b59a615dad5bbbd3f023155925868e..de11d61cc6552311b66e5b55a099794ca28a3672 100644 --- a/NPLib/W1/TW1Physics.cxx +++ b/NPLib/W1/TW1Physics.cxx @@ -570,7 +570,7 @@ void TW1Physics::PreTreat() if (IsValidChannel("Front", m_EventData->GetW1FrontEDetectorNbr(i), m_EventData->GetW1FrontEStripNbr(i)) && m_EventData->GetW1FrontEEnergy(i) > m_FrontE_Raw_Threshold) { double E = fW1_Front_E(m_EventData , i); - if (E > m_FrontE_Calib_Threshold) { + if (E > m_FrontE_Calib_Threshold) { m_PreTreatedData->SetW1FrontEDetectorNbr(m_EventData->GetW1FrontEDetectorNbr(i)); m_PreTreatedData->SetW1FrontEStripNbr(m_EventData->GetW1FrontEStripNbr(i)); m_PreTreatedData->SetW1FrontEEnergy(E); @@ -821,7 +821,7 @@ void TW1Physics::ReadAnalysisConfig() } } } -} +} diff --git a/NPLib/W1/TW1Physics.h b/NPLib/W1/TW1Physics.h index 988a7b4aa4c2915e33ffa4cd0a768f755827faf3..c7fbd2f7b7ec408554306c5a0269d9bb19ae0536 100644 --- a/NPLib/W1/TW1Physics.h +++ b/NPLib/W1/TW1Physics.h @@ -21,16 +21,16 @@ * * * * *****************************************************************************/ -// STL +// STL #include <vector> using namespace std ; -// ROOT +// ROOT #include "TObject.h" #include "TVector2.h" #include "TVector3.h" -// NPL +// NPL #include "TW1Data.h" #include "../include/VDetector.h" #include "../include/CalibrationManager.h" @@ -38,14 +38,14 @@ using namespace std ; class TW1Physics : public TObject, public NPA::VDetector { - public: // Constructor and Destructor + public: // Constructor and Destructor TW1Physics(); ~TW1Physics(); public: void Clear(); void Clear(const Option_t*) {}; - + private: // data obtained after BuildPhysicalEvent() and stored in ROOT output file vector<Int_t> fEventType; @@ -76,13 +76,13 @@ class TW1Physics : public TObject, public NPA::VDetector Int_t GetBackStrip(Int_t i) {return fBackStrip.at(i);} - public: // inherrited from VDetector + public: // inherrited from VDetector // Read stream at ConfigFile to pick-up parameters of detector (Position,...) using Token void ReadConfiguration(string); - + // Add Parameter to the CalibrationManger - void AddParameterToCalibrationManager(); - + void AddParameterToCalibrationManager(); + // 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 InitializeRootInput(); @@ -92,7 +92,7 @@ class TW1Physics : public TObject, public NPA::VDetector // This method is called at each event read from the Input Tree. Aime is to build treat Raw dat in order to extract physical parameter. void BuildPhysicalEvent(); - + // Same as above, but only the simplest event and/or simple method are used (low multiplicity, faster algorythm but less efficient ...). // This method aimed to be used for analysis performed during experiment, when speed is requiered. // NB: This method can eventually be the same as BuildPhysicalEvent. @@ -103,13 +103,13 @@ class TW1Physics : public TObject, public NPA::VDetector void ClearEventData() {m_EventData->Clear();} - public: // Specific to W1 + public: // Specific to W1 // Remove bad channel, calibrate the data and apply threshold void PreTreat(); // Clear The PreTeated object - void ClearPreTreatedData() {m_PreTreatedData->Clear();} - + void ClearPreTreatedData() {m_PreTreatedData->Clear();} + // Return false if the channel is disabled by user // Frist argument is either "Front" or "Back" bool IsValidChannel(string Type, int detector, int channel); @@ -118,7 +118,7 @@ class TW1Physics : public TObject, public NPA::VDetector // ie: all channel enable, maximum multiplicity for strip = number of telescope void InitializeStandardParameter(); - // Read the user configuration file; if no file found, load standard one + // Read the user configuration file; if no file found, load standard one void ReadAnalysisConfig(); // Add detector using cartesian coordiantes