From bb2b13b879db5fa60cdb283caec85bc679424a91 Mon Sep 17 00:00:00 2001 From: matta <matta@npt> Date: Thu, 17 Feb 2011 18:58:00 +0000 Subject: [PATCH] * Changing the NPL::VDetector - Now Detector have two method to initialize the root input, one for the Raw data and one for physical data - An option ca be given in NPA to specified the input is of physical type * Identify and correct some bug on the SSSD --- .../DetectorConfiguration/Riken_65mm.detector | 24 +- NPAnalysis/MakePhysicalTree/Analysis.cxx | 3 +- NPLib/CATS/TCATSPhysics.cxx | 32 ++- NPLib/CATS/TCATSPhysics.h | 255 +++++++++--------- NPLib/MUST2/TMust2Physics.cxx | 40 ++- NPLib/MUST2/TMust2Physics.h | 11 +- NPLib/Plastic/TPlasticPhysics.cxx | 15 +- NPLib/Plastic/TPlasticPhysics.h | 9 +- NPLib/SSSD/TSSSDPhysics.cxx | 29 +- NPLib/SSSD/TSSSDPhysics.h | 13 +- NPLib/Tools/NPOptionManager.cxx | 15 +- NPLib/Tools/NPOptionManager.h | 16 +- NPLib/VDetector/DetectorManager.cxx | 16 +- NPLib/VDetector/VDetector.h | 8 +- NPLib/W1/TW1Physics.cxx | 19 +- NPLib/W1/TW1Physics.h | 12 +- NPSimulation/src/DetectorConstruction.cc | 26 +- NPSimulation/src/ThinSi.cc | 6 +- 18 files changed, 331 insertions(+), 218 deletions(-) diff --git a/Inputs/DetectorConfiguration/Riken_65mm.detector b/Inputs/DetectorConfiguration/Riken_65mm.detector index e835d16d5..c2adce82c 100644 --- a/Inputs/DetectorConfiguration/Riken_65mm.detector +++ b/Inputs/DetectorConfiguration/Riken_65mm.detector @@ -31,7 +31,7 @@ Target %%%%%%%%%%%%%%%%%%%%% MUST2Array %%%%%%% Telescope 1 %%%%%%% -M2Telescope +M2Telescope X1_Y1= 10.85 105.03 146.16 X1_Y128= 22.8 9.84 175.95 X128_Y1= 104.09 105.03 108.76 @@ -42,7 +42,7 @@ CSI= 1 VIS= all %%%%%%% Telescope 2 %%%%%%% -M2Telescope +M2Telescope X1_Y1= -116.04 9.84 138.55 X1_Y128= -22.8 9.84 175.95 X128_Y1= -104.09 105.03 108.76 @@ -53,7 +53,7 @@ CSI= 1 VIS= all %%%%%%% Telescope 3 %%%%%%% -M2Telescope +M2Telescope X1_Y1= -10.85 -105.03 146.16 X1_Y128= -22.8 -9.84 175.95 X128_Y1= -104.09 -105.03 108.76 @@ -64,7 +64,7 @@ CSI= 1 VIS= all %%%%%%% Telescope 4 %%%%%%% -M2Telescope +M2Telescope X1_Y1= 116.04 -9.84 138.55 X1_Y128= 22.8 -9.84 175.95 X128_Y1= 104.09 -105.03 108.76 @@ -75,7 +75,7 @@ CSI= 1 VIS= all %%%%%%% Telescope 5 %%%%%%% -M2Telescope +M2Telescope X1_Y1= -50.23 -50.23 365 X1_Y128= 50.23 -50.23 365 X128_Y1= -50.23 50.23 365 @@ -85,7 +85,7 @@ SILI= 0 CSI= 1 VIS= all %%%%%%% Telescope 6 %%%%%%% -M2Telescope +M2Telescope X1_Y1= 155.77 50.23 8.18 X1_Y128= 155.77 -50.23 8.18 X128_Y1= 133.17 50.23 -89.7 @@ -105,7 +105,7 @@ VIS= all % CSI= 0 % VIS= all %%%%%%% Telescope 7 %%%%%%% -M2Telescope +M2Telescope X1_Y1= 27.07 50.23 -154.49 X1_Y128= 116.58 50.23 -108.88 X128_Y1= 27.07 -50.23 -154.49 @@ -128,30 +128,30 @@ VIS= all %%%%%%%%%%%%%%%%%%%%% -SSSDArray +SSSDArray %%%%%%%%%% Det 1 %%%%%%%% -SSSD +SSSD A= 17.61 9.85 104.11 B= 64.48 9.85 85.31 C= 58.66 56.29 70.79 D= 11.79 56.29 89.69 % %%%%%%%%%% Det 2 %%%%%%%% -SSSD +SSSD A= -11.79 56.29 89.59 B= -58.66 56.29 70.79 C= -64.48 9.85 85.31 D= -17.61 9.85 104.11 % %%%%%%%%%% Det 3 %%%%%%%% -SSSD +SSSD A= -17.61 -9.85 104.11 B= -64.48 -9.85 85.31 C= -58.66 -56.29 70.79 D= -11.79 -56.29 89.59 % %%%%%%%%%% Det 4 %%%%%%%% -SSSD +SSSD A= 11.79 -56.29 89.59 B= 58.66 -56.29 70.79 C= 64.48 -9.85 85.31 diff --git a/NPAnalysis/MakePhysicalTree/Analysis.cxx b/NPAnalysis/MakePhysicalTree/Analysis.cxx index b5b590d36..85494f36d 100644 --- a/NPAnalysis/MakePhysicalTree/Analysis.cxx +++ b/NPAnalysis/MakePhysicalTree/Analysis.cxx @@ -38,7 +38,8 @@ int main(int argc, char** argv) clock_t end = begin; // main loop on entries - for (int i = 0; i < nentries; i++) { +// for (int i = 0; i < nentries; i++) { + for (int i = 0; i < 10000; i++) { if (i%10000 == 0 && i!=0) { cout.precision(5); end = clock(); diff --git a/NPLib/CATS/TCATSPhysics.cxx b/NPLib/CATS/TCATSPhysics.cxx index 90e8e20a2..74e1fc9a1 100644 --- a/NPLib/CATS/TCATSPhysics.cxx +++ b/NPLib/CATS/TCATSPhysics.cxx @@ -221,13 +221,43 @@ void TCATSPhysics::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 TCATSPhysics::InitializeRootInput() +void TCATSPhysics::InitializeRootInputRaw() { TChain* inputChain = RootInput::getInstance()->GetChain() ; inputChain->SetBranchStatus( "CATS" , true ) ; inputChain->SetBranchStatus( "fCATS_*" , true ) ; inputChain->SetBranchAddress( "CATS" , &EventData ) ; } +// Activated associated Branches and link it to the private member DetectorPhysics address +// In this method mother Branches (Detector) AND daughter leaf (parameter) have to be activated +void TCATSPhysics::InitializeRootInputPhysics() +{ + TChain* inputChain = RootInput::getInstance()->GetChain(); + inputChain->SetBranchStatus( "CATS" , true ); + inputChain->SetBranchStatus( "ff" , true ); + inputChain->SetBranchStatus( "DetNumberX" , true ); + inputChain->SetBranchStatus( "StripX" , true ); + inputChain->SetBranchStatus( "ChargeX" , true ); + inputChain->SetBranchStatus( "ChargeSumX" , true ); + inputChain->SetBranchStatus( "MultOverThreshX" , true ); + inputChain->SetBranchStatus( "StripMaxX" , true ); + inputChain->SetBranchStatus( "DetNumberY" , true ); + inputChain->SetBranchStatus( "StripY" , true ); + inputChain->SetBranchStatus( "ChargeY" , true ); + inputChain->SetBranchStatus( "ChargeSumY" , true ); + inputChain->SetBranchStatus( "MultOverThreshY" , true ); + inputChain->SetBranchStatus( "StripMaxY" , true ); + inputChain->SetBranchStatus( "DetNumberX_Position" , true ); + inputChain->SetBranchStatus( "DetNumberY_Position" , true ); + inputChain->SetBranchStatus( "DetNumberZ_Position" , true ); + inputChain->SetBranchStatus( "PositionX" , true ); + inputChain->SetBranchStatus( "PositionY" , true ); + inputChain->SetBranchStatus( "PositionZ" , true ); + inputChain->SetBranchStatus( "PositionOnTargetX" , true ); + inputChain->SetBranchStatus( "PositionOnTargetY" , true ); + inputChain->SetBranchAddress( "CATS" , &EventPhysics ); + +} // Create associated branches and associated private member DetectorPhysics address void TCATSPhysics::InitializeRootOutput() diff --git a/NPLib/CATS/TCATSPhysics.h b/NPLib/CATS/TCATSPhysics.h index b1fd2dbab..883c40245 100644 --- a/NPLib/CATS/TCATSPhysics.h +++ b/NPLib/CATS/TCATSPhysics.h @@ -21,14 +21,14 @@ * * *****************************************************************************/ -// STL +// STL #include <vector> -// ROOT +// ROOT #include "TObject.h" #include "TVector3.h" -// NPLib +// NPLib #include "TCATSData.h" #include "../include/VDetector.h" #include "../include/CalibrationManager.h" @@ -54,139 +54,138 @@ enum correction{NOcor,cor}; class TCATSPhysics : public TObject, public NPA::VDetector { - public: // Constructor and Destructor + public: // Constructor and Destructor TCATSPhysics(); ~TCATSPhysics(); - - public: // Output data of interest + + public: // Output data of interest //for a CATS // marker of the cats used int ff ; - // Vector of dim = multiplicity of event on all detector - vector<int> DetNumberX ; - vector<int> StripX ; - vector<double> ChargeX ; - - // Vector of dim = number of CATS - vector<double> ChargeSumX ; - vector<int> MultOverThreshX ; - vector<int> StripMaxX ; - - - // Vector of dim = multiplicity of event on all detector - vector<int> DetNumberY ; - vector<int> StripY ; - vector<double> ChargeY ; - // vector<double> ChargeY_test ; - - // Vector of dim = number of CATS - vector<double> ChargeSumY ; - vector<int> MultOverThreshY ; - vector<int> StripMaxY ; - // vector<int> StripMaxY_test; - - // Calculate - vector<int> DetNumberX_Position ; - vector<int> DetNumberY_Position ; - vector<int> DetNumberZ_Position ; - vector<double> PositionX ; - vector<double> PositionY ; - vector<double> PositionZ ; - double PositionOnTargetX ; - double PositionOnTargetY ; - - TVector3 BeamDirection ; //! + // Vector of dim = multiplicity of event on all detector + vector<int> DetNumberX; + vector<int> StripX; + vector<double> ChargeX; + + // Vector of dim = number of CATS + vector<double> ChargeSumX; + vector<int> MultOverThreshX; + vector<int> StripMaxX; + + + // Vector of dim = multiplicity of event on all detector + vector<int> DetNumberY; + vector<int> StripY; + vector<double> ChargeY; + // vector<double> ChargeY_test ; + + // Vector of dim = number of CATS + vector<double> ChargeSumY; + vector<int> MultOverThreshY; + vector<int> StripMaxY; + // vector<int> StripMaxY_test; + + // Calculate + vector<int> DetNumberX_Position; + vector<int> DetNumberY_Position; + vector<int> DetNumberZ_Position; + vector<double> PositionX; + vector<double> PositionY; + vector<double> PositionZ; + double PositionOnTargetX; + double PositionOnTargetY; + + TVector3 BeamDirection ; //! double Chargex[28]; //! double Chargey[28]; //! - + int HitX; //! int HitY; //! - vector<reconstruction> ReconstructionMethodX; - vector<reconstruction> ReconstructionMethodY; + vector<reconstruction> ReconstructionMethodX; + vector<reconstruction> ReconstructionMethodY; - + // vector<reconstruction> FailedReconstructionX; - vector<reconstruction> FailedReconstructionY; - - private: // Root Input and Output tree classes - - TCATSData* EventData ;//! - TCATSPhysics* EventPhysics ;//! - - 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() ; - - // Create associated branches and associated private member DetectorPhysics address - void InitializeRootOutput() ; - - // This method is called at each event read from the Input Tree. 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() {Clear();} - void ClearEventData() {EventData->Clear();} - - + vector<reconstruction> FailedReconstructionY; + + private: // Root Input and Output tree classes + + TCATSData* EventData;//! + TCATSPhysics* EventPhysics;//! + + 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 InitializeRootInputRaw() ; + + // Activated associated Branches and link it to the private member DetectorPhysics address + // In this method mother Branches (Detector) AND daughter leaf (parameter) have to be activated + void InitializeRootInputPhysics() ; + + // Create associated branches and associated private member DetectorPhysics address + void InitializeRootOutput() ; + + // This method is called at each event read from the Input Tree. 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() {Clear();} + void ClearEventData() {EventData->Clear();} + + private : // redundant information : could be optimized in the future - vector< vector< vector<double> > > StripPositionX ; //! - vector< vector< vector<double> > > StripPositionY ; //! - vector<double> StripPositionZ ; //! - - int NumberOfCATS ; //! - - vector< vector <double> > Pedestal_X ; //! - vector< vector <double> > Pedestal_Y ; //! - - vector< vector <double> > Threshold_X ; //! - vector< vector <double> > Threshold_Y ; //! - - - public : // Specific to CATS - - void Clear(); - void Dump(); - + vector< vector< vector<double> > > StripPositionX;//! + vector< vector< vector<double> > > StripPositionY;//! + vector<double> StripPositionZ;//! + int NumberOfCATS;//! + + vector< vector <double> > Pedestal_X;//! + vector< vector <double> > Pedestal_Y;//! + + vector< vector <double> > Threshold_X;//! + vector< vector <double> > Threshold_Y;//! + + + public : // Specific to CATS + + void Clear(); + void Dump(); + void AddCATS(TVector3 C_X1_Y1, TVector3 C_X28_Y1, TVector3 C_X1_Y28, TVector3 C_X28_Y28); void ReadPedestal(string PedestalPath); - double AnalyseX(int ff, - int NumberOfDetector); + double AnalyseX(int ff,int NumberOfDetector); - double AnalyseY(int ff, - int NumberOfDetector); + double AnalyseY(int ff,int NumberOfDetector); - double CalculatePositionX( double CalculatedStripX, - correction method); + double CalculatePositionX( double CalculatedStripX, correction method); - double CalculatePositionY( double CalculatedStripY, - correction method); + double CalculatePositionY( double CalculatedStripY, correction method); reconstruction ChooseReconstruction(TString type); - // Calculate Strip touch using an array of Charge on Strip and Strip with Maximum Charge - + // Calculate Strip touch using an array of Charge on Strip and Strip with Maximum Charge + double HyperbolicSequentMethodX(); double GaussianMethodX(); double Barycentric5MethodX(); @@ -195,29 +194,29 @@ class TCATSPhysics : public TObject, public NPA::VDetector double HyperbolicSequentMethodY(); double GaussianMethodY(); - + double Barycentric5MethodY(); double Barycentric4MethodY(); double Barycentric3MethodY(); - - + + double CorrectedPositionX3(double Position, double a) ; double CorrectedPositionY3(double Position, double a) ; double CorrectedPositionX4(double Position, double b); double CorrectedPositionY4(double Position, double b); - + // X - // Vector of dim = multiplicity of event on all detector - int GetCATSDetNumberX(int i) {return DetNumberX.at(i);} - int GetCATSStripX(int i) {return StripX.at(i);} + // Vector of dim = multiplicity of event on all detector + int GetCATSDetNumberX(int i) {return DetNumberX.at(i);} + int GetCATSStripX(int i) {return StripX.at(i);} double GetCATSChargeX(int i) {return ChargeX.at(i);} - - int GetCATSMultX() {return DetNumberX.size();} - - // Vector of dim = number of CATS + + int GetCATSMultX() {return DetNumberX.size();} + + // Vector of dim = number of CATS double GetCATSChargeSumX(int i) ; - int GetCATSMultOverThreshX(int i) ; + int GetCATSMultOverThreshX(int i) ; int GetCATSStripMaxX(int i) ; // int GetCATSDetNumberX_Position(int i) ; double GetCATSPositionX(int i) ; @@ -226,20 +225,20 @@ class TCATSPhysics : public TObject, public NPA::VDetector // Y - // Vector of dim = multiplicity of event on all detector - int GetCATSDetNumberY(int i) {return DetNumberY.at(i);} - int GetCATSStripY(int i) {return StripY.at(i);} + // Vector of dim = multiplicity of event on all detector + int GetCATSDetNumberY(int i) {return DetNumberY.at(i);} + int GetCATSStripY(int i) {return StripY.at(i);} double GetCATSChargeY(int i) {return ChargeY.at(i);} - int GetCATSMultY() {return DetNumberY.size();} - - // Vector of dim = number of CATS + int GetCATSMultY() {return DetNumberY.size();} + + // Vector of dim = number of CATS double GetCATSChargeSumY(int i) ; - int GetCATSMultOverThreshY(int i) ; + int GetCATSMultOverThreshY(int i) ; int GetCATSStripMaxY(int i) ; // int GetCATSDetNumberY_Position(int i); double GetCATSPositionY(int i) ; - + double GetPositionOnTargetY() {return PositionOnTargetY;} int GetCATSMult() {return PositionX.size();} @@ -256,7 +255,7 @@ class TCATSPhysics : public TObject, public NPA::VDetector namespace LOCAL_CATS { - // tranform an integer to a string + // tranform an integer to a string string itoa(int value); } diff --git a/NPLib/MUST2/TMust2Physics.cxx b/NPLib/MUST2/TMust2Physics.cxx index a79d166b8..a6b0ca16d 100644 --- a/NPLib/MUST2/TMust2Physics.cxx +++ b/NPLib/MUST2/TMust2Physics.cxx @@ -862,7 +862,7 @@ void TMust2Physics::ReadCalibrationRun() //// Innherited from VDetector Class //// -// Read stream at ConfigFile to pick-up parameters of detector (Position,...) using Token +/////////////////////////////////////////////////////////////////////////// void TMust2Physics::ReadConfiguration(string Path) { ifstream ConfigFile ; @@ -1093,7 +1093,7 @@ void TMust2Physics::ReadConfiguration(string Path) } -// Add Parameter to the CalibrationManger +/////////////////////////////////////////////////////////////////////////// void TMust2Physics::AddParameterToCalibrationManager() { CalibrationManager* Cal = CalibrationManager::getInstance(); @@ -1126,18 +1126,44 @@ void TMust2Physics::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 TMust2Physics::InitializeRootInput() +/////////////////////////////////////////////////////////////////////////// +void TMust2Physics::InitializeRootInputRaw() { TChain* inputChain = RootInput::getInstance()->GetChain() ; inputChain->SetBranchStatus( "MUST2" , true ) ; inputChain->SetBranchStatus( "fMM_*" , true ) ; inputChain->SetBranchAddress( "MUST2" , &m_EventData ) ; } + +/////////////////////////////////////////////////////////////////////////// +void TMust2Physics::InitializeRootInputPhysics() + { + TChain* inputChain = RootInput::getInstance()->GetChain(); + inputChain->SetBranchStatus( "MUST2" , true ); + inputChain->SetBranchStatus( "EventMultiplicity" , true ); + inputChain->SetBranchStatus( "EventType" , true ); + inputChain->SetBranchStatus( "TelescopeNumber" , true ); + inputChain->SetBranchStatus( "Si_E" , true ); + inputChain->SetBranchStatus( "Si_T" , true ); + inputChain->SetBranchStatus( "Si_X" , true ); + inputChain->SetBranchStatus( "Si_Y" , true ); + inputChain->SetBranchStatus( "Si_EX" , true ); + inputChain->SetBranchStatus( "Si_TX" , true ); + inputChain->SetBranchStatus( "Si_EY" , true ); + inputChain->SetBranchStatus( "Si_TY" , true ); + inputChain->SetBranchStatus( "TelescopeNumber_X" , true ); + inputChain->SetBranchStatus( "TelescopeNumber_Y" , true ); + inputChain->SetBranchStatus( "SiLi_E" , true ); + inputChain->SetBranchStatus( "SiLi_T" , true ); + inputChain->SetBranchStatus( "SiLi_N" , true ); + inputChain->SetBranchStatus( "CsI_E" , true ); + inputChain->SetBranchStatus( "CsI_T" , true ); + inputChain->SetBranchStatus( "CsI_N" , true ); + inputChain->SetBranchStatus( "TotalEnergy" , true ); + inputChain->SetBranchAddress( "MUST2" , &m_EventPhysics); + } - -// Create associated branches and associated private member DetectorPhysics address +/////////////////////////////////////////////////////////////////////////// void TMust2Physics::InitializeRootOutput() { TTree* outputTree = RootOutput::getInstance()->GetTree(); diff --git a/NPLib/MUST2/TMust2Physics.h b/NPLib/MUST2/TMust2Physics.h index 2392d71cd..717d00cb5 100644 --- a/NPLib/MUST2/TMust2Physics.h +++ b/NPLib/MUST2/TMust2Physics.h @@ -99,17 +99,18 @@ class TMust2Physics : public TObject, public NPA::VDetector // 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() ; - + void InitializeRootInputRaw() ; + + // Activated associated Branches and link it to the private member DetectorPhysics address + // In this method mother Branches (Detector) AND daughter leaf (parameter) have to be activated + void InitializeRootInputPhysics() ; // 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() ; diff --git a/NPLib/Plastic/TPlasticPhysics.cxx b/NPLib/Plastic/TPlasticPhysics.cxx index f84eb48e9..aea90e2ec 100644 --- a/NPLib/Plastic/TPlasticPhysics.cxx +++ b/NPLib/Plastic/TPlasticPhysics.cxx @@ -257,14 +257,23 @@ void TPlasticPhysics::AddParameterToCalibrationManager() } /////////////////////////////////////////////////////////////////////////// -void TPlasticPhysics::InitializeRootInput() +void TPlasticPhysics::InitializeRootInputRaw() { TChain* inputChain = RootInput::getInstance()->GetChain() ; inputChain->SetBranchStatus ( "Plastic" , true ) ; inputChain->SetBranchStatus ( "fPlastic_*" , true ) ; inputChain->SetBranchAddress( "Plastic" , &EventData ) ; - } - + } +/////////////////////////////////////////////////////////////////////////// +void TPlasticPhysics::InitializeRootInputPhysics() + { + TChain* inputChain = RootInput::getInstance()->GetChain(); + inputChain->SetBranchStatus ( "Plastic", true ); + inputChain->SetBranchStatus ( "DetectorNumber", true ); + inputChain->SetBranchStatus ( "Energy", true ); + inputChain->SetBranchStatus ( "Time", true ); + inputChain->SetBranchAddress( "Plastic", &EventPhysics ); + } /////////////////////////////////////////////////////////////////////////// void TPlasticPhysics::InitializeRootOutput() { diff --git a/NPLib/Plastic/TPlasticPhysics.h b/NPLib/Plastic/TPlasticPhysics.h index 6e4114a8e..07f61f6e3 100644 --- a/NPLib/Plastic/TPlasticPhysics.h +++ b/NPLib/Plastic/TPlasticPhysics.h @@ -53,11 +53,14 @@ class TPlasticPhysics : public TObject, public NPA::VDetector // 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(); + void InitializeRootInputRaw() ; + + // Activated associated Branches and link it to the private member DetectorPhysics address + // In this method mother Branches (Detector) AND daughter leaf (parameter) have to be activated + void InitializeRootInputPhysics() ; // Create associated branches and associated private member DetectorPhysics address diff --git a/NPLib/SSSD/TSSSDPhysics.cxx b/NPLib/SSSD/TSSSDPhysics.cxx index a79aff3d0..af8b71ccb 100644 --- a/NPLib/SSSD/TSSSDPhysics.cxx +++ b/NPLib/SSSD/TSSSDPhysics.cxx @@ -95,7 +95,7 @@ void TSSSDPhysics::ReadConfiguration(string Path) getline(ConfigFile, LineBuffer); // If line is a Start Up SSSD bloc, Reading toggle to true - if (LineBuffer.compare(0, 4, "SSSD") == 0) + if (LineBuffer.compare(0, 4, "SSSD") == 0 &&LineBuffer.compare(0, 5, "SSSDA") != 0) { cout << "SSSD found: " << endl ; ReadingStatus = true ; @@ -114,8 +114,8 @@ void TSSSDPhysics::ReadConfiguration(string Path) 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, 4, "SSSD") == 0) { - cout << "WARNING: Another Telescope is find before standard sequence of Token, Error may occured in Telecope definition" << endl ; + else if (DataBuffer=="SSSD") { + cout << "WARNING: Another Telescope is founnd before standard sequence of Token, Error may occured in detector definition" << endl ; ReadingStatus = false ; } @@ -265,14 +265,25 @@ void TSSSDPhysics::AddParameterToCalibrationManager() } /////////////////////////////////////////////////////////////////////////// -void TSSSDPhysics::InitializeRootInput() +void TSSSDPhysics::InitializeRootInputRaw() { - TChain* inputChain = RootInput::getInstance()->GetChain() ; - inputChain->SetBranchStatus ( "SSSD" , true ) ; - inputChain->SetBranchStatus ( "fSSSD_*" , true ) ; - inputChain->SetBranchAddress( "SSSD" , &EventData ) ; - } + TChain* inputChain = RootInput::getInstance()->GetChain(); + inputChain->SetBranchStatus ( "SSSD" , true ); + inputChain->SetBranchStatus ( "fSSSD_*" , true ); + inputChain->SetBranchAddress( "SSSD" , &EventData ); + } +/////////////////////////////////////////////////////////////////////////// +void TSSSDPhysics::InitializeRootInputPhysics() + { + TChain* inputChain = RootInput::getInstance()->GetChain(); + inputChain->SetBranchStatus ( "SSSD" , true ); + inputChain->SetBranchStatus ( "DetectorNumber", true ); + inputChain->SetBranchStatus ( "StripNumber" , true ); + inputChain->SetBranchStatus ( "Energy" , true ); + inputChain->SetBranchStatus ( "Time" , true ); + inputChain->SetBranchAddress( "SSSD" , &EventPhysics ); + } /////////////////////////////////////////////////////////////////////////// void TSSSDPhysics::InitializeRootOutput() { diff --git a/NPLib/SSSD/TSSSDPhysics.h b/NPLib/SSSD/TSSSDPhysics.h index a584a970e..4617901d5 100644 --- a/NPLib/SSSD/TSSSDPhysics.h +++ b/NPLib/SSSD/TSSSDPhysics.h @@ -52,11 +52,14 @@ class TSSSDPhysics : public TObject, public NPA::VDetector // 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(); + + // 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 InitializeRootInputRaw() ; + + // Activated associated Branches and link it to the private member DetectorPhysics address + // In this method mother Branches (Detector) AND daughter leaf (parameter) have to be activated + void InitializeRootInputPhysics() ; // Create associated branches and associated private member DetectorPhysics address void InitializeRootOutput(); diff --git a/NPLib/Tools/NPOptionManager.cxx b/NPLib/Tools/NPOptionManager.cxx index 82fd97a46..9ffec525f 100644 --- a/NPLib/Tools/NPOptionManager.cxx +++ b/NPLib/Tools/NPOptionManager.cxx @@ -52,7 +52,8 @@ NPOptionManager::NPOptionManager(int argc, char** argv) fRunToReadFileName = fDefaultRunToReadFileName; fCalibrationFileName = fDefaultCalibrationFileName; fDisableAllBranchOption = false; - + fInputPhysicalTreeOption = false; + for (int i = 0; i < argc; i++) { string argument = argv[i]; @@ -79,6 +80,10 @@ NPOptionManager::NPOptionManager(int argc, char** argv) else if (argument == "-C" && argc >= i + 1) fCalibrationFileName = argv[i+1] ; else if (argument == "--disable-branch") fDisableAllBranchOption = true ; + + else if (argument == "--input-physical") fInputPhysicalTreeOption = true ; + + else if (argument == "-IP") fInputPhysicalTreeOption = true ; else ; } @@ -220,15 +225,17 @@ void NPOptionManager::SendErrorAndExit(const char* type) const void NPOptionManager::DisplayHelp() { - cout << "----NPOptionManager Help----" << endl ; + cout << endl << "----NPOptionManager Help----" << endl << endl ; cout << "List of Option " << endl ; + cout << "\t --help -H -h\t \t \t \t \t \t \t Display this help message" << endl ; cout << "\t --detector -D <arg>\t \t \t \t \t \t Set arg as the detector configuration file" << endl ; cout << "\t --event-generator -E <arg>\t \t \t \t \t Set arg as the event generator file" << endl ; - cout << "\t --cal -C <arg>\t \t \t \t \t \t \t Set arg as the calibration file list" << endl ; - cout << "\t --help -H -h\t \t \t \t \t \t \t Display this help message" << endl ; cout << "\t --output -O <arg>\t \t \t \t \t \t Set arg as the Output File Name (output tree)" << endl ; + cout << endl << "NPAnalysis only:"<<endl; cout << "\t --run -R <arg>\t \t \t \t \t \t \t Set arg as the run to read file list" << endl ; + cout << "\t --cal -C <arg>\t \t \t \t \t \t \t Set arg as the calibration file list" << endl ; cout << "\t --disable-branch\t \t \t \t \t \t Disable of branch of Input tree except the one of the detector (faster)" << endl ; + cout << "\t --input-physical -IP\t \t \t \t \t \t Consider the Input file is containing Physics Class instead of Data Class. Output branches associate to the detector are not activated" << endl ; cout << endl << endl ; // exit current program diff --git a/NPLib/Tools/NPOptionManager.h b/NPLib/Tools/NPOptionManager.h index ad55564b5..410ffd87d 100644 --- a/NPLib/Tools/NPOptionManager.h +++ b/NPLib/Tools/NPOptionManager.h @@ -77,13 +77,14 @@ class NPOptionManager string GetDefaultCalibrationFile() {return fDefaultCalibrationFileName;} string GetDefaultOutputFile() {return fDefaultOutputFileName;} // assigned values - string GetReactionFile() {return fReactionFileName;} - string GetDetectorFile() {return fDetectorFileName;} - string GetRunToReadFile() {return fRunToReadFileName;} - string GetCalibrationFile() {return fCalibrationFileName;} - string GetOutputFile() {return fOutputFileName;} - bool GetDisableAllBranchOption() {return fDisableAllBranchOption;} - + string GetReactionFile() {return fReactionFileName;} + string GetDetectorFile() {return fDetectorFileName;} + string GetRunToReadFile() {return fRunToReadFileName;} + string GetCalibrationFile() {return fCalibrationFileName;} + string GetOutputFile() {return fOutputFileName;} + bool GetDisableAllBranchOption() {return fDisableAllBranchOption;} + bool GetInputPhysicalTreeOption() {return fInputPhysicalTreeOption;} + // Setters void SetReactionFile(string name) {fReactionFileName = name;} void SetDetectorFile(string name) {fDetectorFileName = name;} @@ -103,6 +104,7 @@ class NPOptionManager string fCalibrationFileName; string fOutputFileName; bool fDisableAllBranchOption; + bool fInputPhysicalTreeOption; }; #endif diff --git a/NPLib/VDetector/DetectorManager.cxx b/NPLib/VDetector/DetectorManager.cxx index f9cfad7ee..ec5406ac0 100644 --- a/NPLib/VDetector/DetectorManager.cxx +++ b/NPLib/VDetector/DetectorManager.cxx @@ -402,9 +402,13 @@ void DetectorManager::InitializeRootInput() map<string,VDetector*>::iterator it; - for (it = m_Detector.begin(); it != m_Detector.end(); ++it) { - it->second->InitializeRootInput(); - } + if(NPOptionManager::getInstance()->GetInputPhysicalTreeOption()) + for (it = m_Detector.begin(); it != m_Detector.end(); ++it) + it->second->InitializeRootInputPhysics(); + + else // Default Case + for (it = m_Detector.begin(); it != m_Detector.end(); ++it) + it->second->InitializeRootInputRaw(); } @@ -414,9 +418,9 @@ void DetectorManager::InitializeRootOutput() { map<string,VDetector*>::iterator it; - for (it = m_Detector.begin(); it != m_Detector.end(); ++it) { - it->second->InitializeRootOutput(); - } + if(!NPOptionManager::getInstance()->GetInputPhysicalTreeOption()) + for (it = m_Detector.begin(); it != m_Detector.end(); ++it) + it->second->InitializeRootOutput(); } diff --git a/NPLib/VDetector/VDetector.h b/NPLib/VDetector/VDetector.h index e0cfc532b..6fff66f45 100644 --- a/NPLib/VDetector/VDetector.h +++ b/NPLib/VDetector/VDetector.h @@ -44,10 +44,14 @@ namespace NPA // 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() {} ; + virtual void InitializeRootInputRaw() {} ; + + // Activated associated Branches and link it to the private member DetectorPhysics address + // In this method mother Branches (Detector) AND daughter leaf (parameter) have to be activated + virtual void InitializeRootInputPhysics() {} ; // Create associated branches and associated private member DetectorPhysics address virtual void InitializeRootOutput() {} ; diff --git a/NPLib/W1/TW1Physics.cxx b/NPLib/W1/TW1Physics.cxx index de11d61cc..74df99781 100644 --- a/NPLib/W1/TW1Physics.cxx +++ b/NPLib/W1/TW1Physics.cxx @@ -286,18 +286,27 @@ void TW1Physics::AddParameterToCalibrationManager() } - /////////////////////////////////////////////////////////////////////////// -void TW1Physics::InitializeRootInput() +void TW1Physics::InitializeRootInputRaw() { TChain* inputChain = RootInput::getInstance()->GetChain(); inputChain->SetBranchStatus("W1" , true); inputChain->SetBranchStatus("fW1_*", true); inputChain->SetBranchAddress("W1" , &m_EventData); } - - - +/////////////////////////////////////////////////////////////////////////// +void TW1Physics::InitializeRootInputPhysics() +{ + TChain* inputChain = RootInput::getInstance()->GetChain(); + inputChain->SetBranchStatus("W1" , true); + inputChain->SetBranchStatus("fEventType", true); + inputChain->SetBranchStatus("fDetectorNumber", true); + inputChain->SetBranchStatus("fEnergy", true); + inputChain->SetBranchStatus("fTime", true); + inputChain->SetBranchStatus("fFrontStrip", true); + inputChain->SetBranchStatus("fBackStrip", true); + inputChain->SetBranchAddress("W1" , &m_EventPhysics); +} /////////////////////////////////////////////////////////////////////////// void TW1Physics::InitializeRootOutput() { diff --git a/NPLib/W1/TW1Physics.h b/NPLib/W1/TW1Physics.h index c7fbd2f7b..945eddc2f 100644 --- a/NPLib/W1/TW1Physics.h +++ b/NPLib/W1/TW1Physics.h @@ -82,10 +82,14 @@ class TW1Physics : public TObject, public NPA::VDetector // 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(); + + // 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 InitializeRootInputRaw() ; + + // Activated associated Branches and link it to the private member DetectorPhysics address + // In this method mother Branches (Detector) AND daughter leaf (parameter) have to be activated + void InitializeRootInputPhysics() ; // Create associated branches and associated private member DetectorPhysics address void InitializeRootOutput(); diff --git a/NPSimulation/src/DetectorConstruction.cc b/NPSimulation/src/DetectorConstruction.cc index 031fe2d8d..43dccfde9 100644 --- a/NPSimulation/src/DetectorConstruction.cc +++ b/NPSimulation/src/DetectorConstruction.cc @@ -193,7 +193,7 @@ void DetectorConstruction::ReadConfigurationFile(string Path) //////////////////////////////////////////// else if (LineBuffer.compare(0, 16, "TheDUMMYDetector") == 0 && cDummy == false) { cDummy = true ; - G4cout << "//////// DUMMY DETECTOR ////////" << G4endl << G4endl ; + G4cout << G4endl << "//////// DUMMY DETECTOR ////////" << G4endl << G4endl ; // Instantiate the new array as a VDetector Object VDetector* myDetector = new DUMMYDetector() ; @@ -213,7 +213,7 @@ void DetectorConstruction::ReadConfigurationFile(string Path) //////////////////////////////////////////// else if (LineBuffer.compare(0, 14, "GaspardTracker") == 0 && cGPDTracker == false) { cGPDTracker = true ; - G4cout << "//////// Gaspard Tracker ////////" << G4endl ; + G4cout << G4endl << "//////// Gaspard Tracker ////////" << G4endl ; // Instantiate the new array as a VDetector Object VDetector* myDetector = new GaspardTracker() ; @@ -233,7 +233,7 @@ void DetectorConstruction::ReadConfigurationFile(string Path) //////////////////////////////////////////// else if (LineBuffer.compare(0, 11, "HydeTracker") == 0 && cHYDTracker == false) { cHYDTracker = true ; - G4cout << "//////// Hyde Tracker ////////" << G4endl ; + G4cout << G4endl << "//////// Hyde Tracker ////////" << G4endl ; // Instantiate the new array as a VDetector Object VDetector* myDetector = new HydeTracker() ; @@ -253,7 +253,7 @@ void DetectorConstruction::ReadConfigurationFile(string Path) //////////////////////////////////////////// else if (LineBuffer.compare(0, 5, "Paris") == 0 && cParis == false) { cParis = true ; - G4cout << "//////// Paris ////////" << G4endl ; + G4cout << G4endl << "//////// Paris ////////" << G4endl ; // Instantiate the new array as a VDetector Object VDetector* myDetector = new Paris() ; @@ -272,7 +272,7 @@ void DetectorConstruction::ReadConfigurationFile(string Path) //////////////////////////////////////////// else if (LineBuffer.compare(0, 6, "Shield") == 0 && cShield == false) { cShield = true ; - G4cout << "//////// Shield ////////" << G4endl ; + G4cout << G4endl << "//////// Shield ////////" << G4endl ; // Instantiate the new array as a VDetector Object VDetector* myDetector = new Shield() ; @@ -291,7 +291,7 @@ void DetectorConstruction::ReadConfigurationFile(string Path) //////////////////////////////////////////// else if (LineBuffer.compare(0, 9, "AnnularS1") == 0 && cS1 == false) { cS1 = true ; - G4cout << "//////// S1 Annular detector ////////" << G4endl << G4endl ; + G4cout << G4endl << "//////// S1 Annular detector ////////" << G4endl << G4endl ; // Instantiate the new array as a VDetector Object VDetector* myDetector = new AnnularS1() ; @@ -310,7 +310,7 @@ void DetectorConstruction::ReadConfigurationFile(string Path) //////////////////////////////////////////// else if (LineBuffer.compare(0, 2, "W1") == 0 && cW1 == false) { cW1 = true ; - G4cout << "//////// W1 Square detector ////////" << G4endl << G4endl; + G4cout << G4endl << "//////// W1 Square detector ////////" << G4endl << G4endl; // Instantiate the new array as a VDetector Object VDetector* myDetector = new W1(); @@ -329,7 +329,7 @@ void DetectorConstruction::ReadConfigurationFile(string Path) //////////////////////////////////////////// else if (LineBuffer.compare(0, 10, "MUST2Array") == 0 && cMUST2 == false) { cMUST2 = true ; - G4cout << "//////// MUST2 Array ////////" << G4endl << G4endl ; + G4cout << G4endl << "//////// MUST2 Array ////////" << G4endl << G4endl ; // Instantiate the new array as a VDetector Object VDetector* myDetector = new MUST2Array() ; @@ -346,9 +346,9 @@ void DetectorConstruction::ReadConfigurationFile(string Path) //////////////////////////////////////////// ////////// Search for ThinSi /////////// //////////////////////////////////////////// - else if (LineBuffer.compare(0, 9, "AddThinSi") == 0 && cAddThinSi == false) { + else if (LineBuffer.compare(0, 9, "SSSDArray") == 0 && cAddThinSi == false) { cAddThinSi = true ; - G4cout << "//////// Thin Si ////////" << G4endl << G4endl ; + G4cout << G4endl << "//////// SSSD ////////" << G4endl << G4endl ; // Instantiate the new array as a VDetector Object VDetector* myDetector = new ThinSi() ; @@ -367,7 +367,7 @@ void DetectorConstruction::ReadConfigurationFile(string Path) //////////////////////////////////////////// else if (LineBuffer.compare(0, 19, "ScintillatorPlastic") == 0 && cPlastic == false) { cPlastic = true ; - G4cout << "//////// Plastic ////////" << G4endl << G4endl ; + G4cout << G4endl << "//////// Plastic ////////" << G4endl << G4endl ; // Instantiate the new array as a VDetector Object VDetector* myDetector = new Plastic() ; @@ -387,7 +387,7 @@ void DetectorConstruction::ReadConfigurationFile(string Path) else if (LineBuffer.compare(0, 13, "GeneralTarget") == 0 && cGeneralTarget == false) { cGeneralTarget = true ; - G4cout << "////////// Target ///////////" << G4endl << G4endl ; + G4cout << G4endl << "////////// Target ///////////" << G4endl << G4endl ; // Instantiate the new array as a VDetector Objects VDetector* myDetector = new Target(); @@ -409,7 +409,7 @@ void DetectorConstruction::ReadConfigurationFile(string Path) else if (LineBuffer.compare(0, 14, "GeneralChamber") == 0 && cGeneralChamber == false) { cGeneralChamber = true ; - G4cout << "////////// Chamber ///////////" << G4endl << G4endl ; + G4cout << G4endl << "////////// Chamber ///////////" << G4endl << G4endl ; // Instantiate the new array as a VDetector Objects VDetector* myDetector = new Chamber(); diff --git a/NPSimulation/src/ThinSi.cc b/NPSimulation/src/ThinSi.cc index aaaee54e7..cc94b60f9 100644 --- a/NPSimulation/src/ThinSi.cc +++ b/NPSimulation/src/ThinSi.cc @@ -268,7 +268,7 @@ void ThinSi::ReadConfiguration(string Path) getline(ConfigFile, LineBuffer); // If line is a Start Up ThinSi bloc, Reading toggle to true - if (LineBuffer.compare(0, 6, "ThinSi") == 0) + if (LineBuffer.compare(0, 4, "SSSD") == 0 && LineBuffer.compare(0, 5, "SSSDA") != 0) { G4cout << "///" << G4endl ; G4cout << "Detector found: " << G4endl ; @@ -289,8 +289,8 @@ void ThinSi::ReadConfiguration(string Path) 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, "ThinSi") == 0) { - cout << "WARNING: Another Telescope is find before standard sequence of Token, Error may occured in Telecope definition" << endl ; + else if (DataBuffer=="SSSD") { + cout << "WARNING: Another Telescope is found before standard sequence of Token, Error may occured in detector definition" << endl ; ReadingStatus = false ; } -- GitLab