diff --git a/Inputs/DetectorConfiguration/hira.detector b/Inputs/DetectorConfiguration/hira.detector index 0dd0386567121029abaa54aa058270fc3a440bb7..ef402bf2140f3ac7a6d3726e8160afb6a924b444 100755 --- a/Inputs/DetectorConfiguration/hira.detector +++ b/Inputs/DetectorConfiguration/hira.detector @@ -7,10 +7,10 @@ GeneralTarget % Radius in mm % Temperature in K, Pressure in bar Target - THICKNESS= 0.2 - ANGLE= 0 + THICKNESS= 11 + ANGLE= 0 RADIUS= 5 - MATERIAL= CD2 + MATERIAL= CH2 X= 0 Y= 0 Z= 0 diff --git a/Inputs/EventGenerator/proton.source b/Inputs/EventGenerator/proton.source index b7d724c24fef83566afc92f0ad163081e6e1be04..6ad7d6b9ab381ecddb16dc446eb828093a30eeb4 100644 --- a/Inputs/EventGenerator/proton.source +++ b/Inputs/EventGenerator/proton.source @@ -4,8 +4,8 @@ % Energy are given in MeV , Position in mm % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Isotropic - EnergyLow= 0 - EnergyHigh= 201 + EnergyLow= 80 + EnergyHigh= 80 HalfOpenAngleMin= 0 HalfOpenAngleMax= 90 x0= 0 diff --git a/NPAnalysis/MakePhysicalTree/Analysis.cxx b/NPAnalysis/MakePhysicalTree/Analysis.cxx index f9c15e965e9005777e855e8af8ec2e70543c954f..875164ab8669f8021fa22d825b85310fdf6d318c 100644 --- a/NPAnalysis/MakePhysicalTree/Analysis.cxx +++ b/NPAnalysis/MakePhysicalTree/Analysis.cxx @@ -25,7 +25,7 @@ int main(int argc, char** argv) RootOutput::getInstance("Analysis/"+OutputfileName, "AnalysedTree"); // Instantiate the detector using a file - NPA::DetectorManager* myDetector = new DetectorManager(); + NPL::DetectorManager* myDetector = new DetectorManager(); myDetector->ReadConfigurationFile(detectorfileName); // Get the formed Chained Tree and Treat it diff --git a/NPAnalysis/MakePhysicalTree/Analysis.h b/NPAnalysis/MakePhysicalTree/Analysis.h index d5ca8c305a8f3b7d788651234860e30edb569327..087f8f74c12c601c8455efcc5b206dddd75fee7b 100644 --- a/NPAnalysis/MakePhysicalTree/Analysis.h +++ b/NPAnalysis/MakePhysicalTree/Analysis.h @@ -6,7 +6,7 @@ // -------------------------------------- VARIOUS INCLUDE --------------------------------------- // NPA -#include "DetectorManager.h" +#include "NPDetectorManager.h" #include "NPOptionManager.h" // STL C++ @@ -30,13 +30,9 @@ #include "RootOutput.h" #include "NPReaction.h" #include "TInitialConditions.h" -#include "TPlasticData.h" -#include "TMust2Data.h" -#include "TMust2Physics.h" -#include "TExogamPhysics.h" -#include "TSSSDPhysics.h" -#include "TPlasticPhysics.h" -#include "GaspardTracker.h" +#include "THiraData.h" +#include "THiraPhysics.h" + // Use CLHEP System of unit and Physical Constant #include "NPGlobalSystemOfUnits.h" diff --git a/NPAnalysis/MakePhysicalTree/RunToTreat.txt b/NPAnalysis/MakePhysicalTree/RunToTreat.txt index 6643bcf68f7eed6405f0cccc5d7e9b65db1eab6a..f98dbfca5b1ba7fafe5ef2f8705a58a6d79aca39 100644 --- a/NPAnalysis/MakePhysicalTree/RunToTreat.txt +++ b/NPAnalysis/MakePhysicalTree/RunToTreat.txt @@ -1,14 +1,8 @@ TTreeName - AutoTree -RootFileName - /Users/pierremorfouace/Desktop/NPDoc/cats/run_2003.root -% /data/e628X/e628/acquisition/run_root/run_1352.1.root -% /data/e628X/e628/acquisition/run_root/run_1353.0.root -% /data/e628X/e628/acquisition/run_root/run_1354.0.root -% /data/e628X/e628/acquisition/run_root/run_1354.1.root -% /data/e628X/e628/acquisition/run_root/run_1355.0.root -% /data/e628X/e628/acquisition/run_root/run_1356.0.root -% /data/e628X/e628/acquisition/run_root/run_1357.0.root -% /data/e628X/e628/acquisition/run_root/run_1357.1.root -% /data/e628X/e628/acquisition/run_root/run_1358.0.root -% /data/e628X/e628/acquisition/run_root/run_1358.1.root + SimulatedTree +RootFileName + /Users/pierremorfouace/Physics/NPTool/nptool/Outputs/Simulation/simu.root + + + + diff --git a/NPLib/Core/RootInput.cxx b/NPLib/Core/RootInput.cxx index 3e2de07837a8000cdf8c3d6a5c399526f28ea484..e694478ccd0d20ea7d963c3a199de7f95a95d148 100644 --- a/NPLib/Core/RootInput.cxx +++ b/NPLib/Core/RootInput.cxx @@ -105,14 +105,14 @@ RootInput::RootInput(string configFileName){ std::string SHARED_LIB_EXTENSION = ".dylib"; #endif - string path = getenv("NPTOOL"); + string path = getenv("NPTOOL"); path+="/NPLib/lib/"; - string libName="libNPInteractionCoordinates"+SHARED_LIB_EXTENSION; - libName=path+libName; - dlopen(libName.c_str(),RTLD_NOW); - libName="libNPInitialConditions"+SHARED_LIB_EXTENSION; - libName=path+libName; - dlopen(libName.c_str(),RTLD_NOW); + string libName="libNPInteractionCoordinates"+SHARED_LIB_EXTENSION; + libName=path+libName; + dlopen(libName.c_str(),RTLD_NOW); + libName="libNPInitialConditions"+SHARED_LIB_EXTENSION; + libName=path+libName; + dlopen(libName.c_str(),RTLD_NOW); } } @@ -170,7 +170,7 @@ void RootInput::AddFriendChain(string RunToAdd){ TChain* localChain = new TChain(); cout << "/////////////////////////////////" << endl; - cout << "Adding frien to current TChain" << endl; + cout << "Adding friend to current TChain" << endl; if (!inputConfigFile) { cout << "Run to Add file :" << RunToAdd << " not found " << endl; diff --git a/NPLib/Hira/THiraData.h b/NPLib/Hira/THiraData.h index 839a289c7739cedecc01fdba335353df30125764..cc84e80f2dc6704244c3e3f89d0e27792f515710 100644 --- a/NPLib/Hira/THiraData.h +++ b/NPLib/Hira/THiraData.h @@ -116,6 +116,17 @@ class THiraData : public TObject { void SetHiraCsITTime(const Double_t Time) {fHiRA_CsIT_Time.push_back(Time);} ///////////////////// GETTERS //////////////////////// + // SSSD + // (X,E) + UShort_t GetHiraThinSiEMult() const {return fHiRA_ThickSi_StripXE_DetectorNbr.size();} + UShort_t GetHiraThinSiStripEDetectorNbr(const Int_t i) const {return fHiRA_ThinSi_StripE_DetectorNbr[i];} + UShort_t GetHiraThinSiStripEStripNbr(const Int_t i) const {return fHiRA_ThinSi_StripE_StripNbr[i];} + Double_t GetHiraThinSiStripEEnergy(const Int_t i) const {return fHiRA_ThinSi_StripE_Energy[i];} + // (X,T) + UShort_t GetHiraThinSiStripTDetectorNbr(const Int_t i) const {return fHiRA_ThinSi_StripT_DetectorNbr[i];} + UShort_t GetHiraThinSiStripTStripNbr(const Int_t i) const {return fHiRA_ThinSi_StripT_StripNbr[i];} + Double_t GetHiraThinSiStripTTime(const Int_t i) const {return fHiRA_ThinSi_StripT_Time[i];} + // DSSD // (X,E) UShort_t GetHiraStripXEMult() const {return fHiRA_ThickSi_StripXE_DetectorNbr.size();} diff --git a/NPLib/Hira/THiraPhysics.cxx b/NPLib/Hira/THiraPhysics.cxx index 818acd40c337da6ae00f76e6e1da8a657b255dc6..c8d97e28a9c127bb6d5bafb98f9de927980d2df1 100644 --- a/NPLib/Hira/THiraPhysics.cxx +++ b/NPLib/Hira/THiraPhysics.cxx @@ -49,10 +49,12 @@ string itoa(int value) ClassImp(THiraPhysics) /////////////////////////////////////////////////////////////////////////// THiraPhysics::THiraPhysics() - { - NumberOfDetector = 0 ; - EventData = new THiraData ; - EventPhysics = this ; + { + //EventMultiplicity = 0 ; + m_NumberOfTelescope = 0 ; + m_EventData = new THiraData ; + m_PreTreatedData = new THiraData; + m_EventPhysics = this ; } /////////////////////////////////////////////////////////////////////////// @@ -60,189 +62,292 @@ THiraPhysics::~THiraPhysics() {} /////////////////////////////////////////////////////////////////////////// -void THiraPhysics::Clear() - { +void THiraPhysics::Clear(){ + TelescopeNumber.clear(); + + // Thin Si + ThinSi_E.clear(); + ThinSi_T.clear(); + ThinSi_StripNumber.clear(); + + //Thick Si + ThickSi_E.clear(); + ThickSi_T.clear(); + ThickSi_EX.clear(); + ThickSi_EY.clear(); + ThickSi_StripNumberX.clear(); + ThickSi_StripNumberY.clear(); + + // CsI + CsI_E.clear(); + CsI_CrystalNumber.clear(); + + +} - } - /////////////////////////////////////////////////////////////////////////// -void THiraPhysics::ReadConfiguration(string Path) - { - 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 ; - - while (!ConfigFile.eof()) - { - - getline(ConfigFile, LineBuffer); +void THiraPhysics::ReadConfiguration(string Path){ + 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 ; - // If line is a Start Up Hira bloc, Reading toggle to true - if (LineBuffer.compare(0, 3, "Hira") == 0) - { - cout << "///" << endl ; - cout << "Platic found: " << endl ; - ReadingStatus = true ; + + bool ReadingStatus = 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_R = false ;*/ + + + + while (!ConfigFile.eof()) { + getline(ConfigFile, LineBuffer); + if (LineBuffer.compare(0, 13, "HiraTelescope") == 0) { + cout << "///" << endl ; + cout << "Hira element found: " << endl ; + ReadingStatus = true ; + } + + while(ReadingStatus){ + + ConfigFile >> DataBuffer; + // Comment Line + if (DataBuffer.compare(0, 1, "%") == 0) {/*do nothing */;} + + // Position method + else if (DataBuffer.compare(0, 2, "A=") == 0) { + 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 << "A corner position : " << A.X() << ";" << A.Y() << ";" << A.Z() << endl; } - // 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' );} + else if (DataBuffer.compare(0, 2, "B=") == 0) { + 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 << "B corner position : " << B.X() << ";" << B.Y() << ";" << B.Z() << endl; + } + + else if (DataBuffer.compare(0, 2, "C=") == 0) { + 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 << "C corner position : " << C.X() << ";" << C.Y() << ";" << C.Z() << endl; + } + + else if (DataBuffer.compare(0, 2, "D=") == 0) { + 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 << "D corner position : " << D.X() << ";" << D.Y() << ";" << D.Z() << endl; + } + + + // Angle method + /* else if (DataBuffer.compare(0, 6, "THETA=") == 0) { + check_Theta = true; + ConfigFile >> DataBuffer ; + Theta = atof(DataBuffer.c_str()) ; + Theta = Theta * deg; + cout << "Theta: " << Theta / deg << endl; + } + + else if (DataBuffer.compare(0, 4, "PHI=") == 0) { + check_Phi = true; + ConfigFile >> DataBuffer ; + Phi = atof(DataBuffer.c_str()) ; + Phi = Phi * deg; + cout << "Phi: " << Phi / deg << endl; + } + + else if (DataBuffer.compare(0, 2, "R=") == 0) { + check_R = true; + ConfigFile >> DataBuffer ; + R = atof(DataBuffer.c_str()) ; + R = R * mm; + cout << "R: " << R / mm << endl; + } + + else if (DataBuffer.compare(0, 5, "BETA=") == 0) { + ConfigFile >> DataBuffer ; + beta_u = atof(DataBuffer.c_str()) ; + beta_u = beta_u * deg ; + ConfigFile >> DataBuffer ; + beta_v = atof(DataBuffer.c_str()) ; + beta_v = beta_v * deg ; + ConfigFile >> DataBuffer ; + beta_w = atof(DataBuffer.c_str()) ; + beta_w = beta_w * deg ; + cout << "Beta: " << beta_u / deg << " " << beta_v / deg << " " << beta_w / deg << endl ; + }*/ + + + else cout << "WARNING: Wrong Token, GaspardTrackerRectangle: Rectangle Element not added" << endl; + + //Add The previously define telescope + //With position method + if (check_A && check_B && check_C && check_D) { + + ReadingStatus = false ; + check_A = false ; + check_C = false ; + check_B = false ; + check_D = false ; + + AddTelescope(A , + B , + C , + D); + } + + //with angle method + /*if ((check_Theta && check_Phi && check_R && check_FirstStage && check_SecondStage && check_ThirdStage && checkVis) && !(check_A && check_B && check_C && check_D)) { + ReadingStatus = false ; + check_Theta = false ; + check_Phi = false ; + check_R = false ; + check_FirstStage = false ; + check_SecondStage = false ; + check_ThirdStage = false ; + checkVis = false ; + + AddModule(R , + Theta , + Phi , + beta_u , + beta_v , + beta_w , + FIRSTSTAGE == 1 , + SECONDSTAGE == 1 , + THIRDSTAGE == 1); + }*/ + + + } + } +} - // Finding another telescope (safety), toggle out - else if (DataBuffer.compare(0, 6, "Hira") == 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; - } +//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... +void THiraPhysics::AddTelescope(TVector3 Pos1, TVector3 Pos2, TVector3 Pos3, TVector3 Pos4){ + m_NumberOfTelescope++; + TVector3 Pos= 0.25*(Pos1+Pos2+Pos3+Pos4);//centroid of the telescope + TVector3 u = Pos4-Pos2;//Horizontal Vector->EF + TVector3 w = Pos.Unit();//Telescope normal + TVector3 v = w.Cross(u);//Vertical Vector->EB + u = u.Unit(); v = v.Unit(); w = w.Unit(); + + // Geometry Parameter + double Face = 64.; //mm + double NumberOfStrip = 32; + double StripPitch = Face/NumberOfStrip ; //mm + double offset = 0.5874*25.4; //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; - else if (DataBuffer=="PHI=") { - check_Phi = true; - ConfigFile >> DataBuffer ; - cout << "Phi: " << atof( DataBuffer.c_str() ) << "deg" << endl; - } + // Position Vector of Strip Center + TVector3 StripCenter = TVector3(0,0,0); + // Position Vector of X=1 Y=1 Strip + TVector3 Strip_1_1; + + // Moving StripCenter to 1.1 corner: + Strip_1_1 = Pos + offset*w - (NumberOfStrip/2-0.5)*StripPitch*(u+v); + + for( int i = 0 ; i < 32 ; ++i ){ + lineX.clear(); + lineY.clear(); + lineZ.clear(); + + for( int j = 0 ; j < 32 ; ++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 ) ; - 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 << "Hira Radius: " << atof( DataBuffer.c_str() ) << "mm" << endl; - } - - // Squared shape - else if (DataBuffer=="Width=") { - check_Width = true; - ConfigFile >> DataBuffer ; - cout << "Hira Width: " <<atof( DataBuffer.c_str() ) << "mm" << endl; - } - - else if (DataBuffer== "Height=") { - check_Height = true; - ConfigFile >> DataBuffer ; - cout << "Hira Height: " << atof( DataBuffer.c_str() ) << "mm" << endl; - } - - // Common - else if (DataBuffer=="Thickness=") { - check_Thickness = true; - ConfigFile >> DataBuffer ; - cout << "Hira Thickness: " << atof( DataBuffer.c_str() ) << "mm" << endl; - } - - else if (DataBuffer== "Scintillator=") { - check_Scintillator = true ; - ConfigFile >> DataBuffer ; - cout << "Hira 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 ; - } - } - } - } +/////////////////////////////////////////////////////////////////////////// +TVector3 THiraPhysics::GetPositionOfInteraction(const int i) const{ + TVector3 Position = TVector3 ( GetStripPositionX( TelescopeNumber[i] , ThickSi_StripNumberX[i] , ThickSi_StripNumberY[i] ), + GetStripPositionY( TelescopeNumber[i] , ThickSi_StripNumberX[i] , ThickSi_StripNumberY[i] ), + GetStripPositionZ( TelescopeNumber[i] , ThickSi_StripNumberX[i] , ThickSi_StripNumberY[i] )) ; + + return(Position) ; + +} /////////////////////////////////////////////////////////////////////////// void THiraPhysics::AddParameterToCalibrationManager() { CalibrationManager* Cal = CalibrationManager::getInstance(); - for(int i = 0 ; i < NumberOfDetector ; i++) + for(int i = 0 ; i < m_NumberOfTelescope ; i++) { for( int j = 0 ; j < 16 ; j++) { @@ -259,36 +364,111 @@ void THiraPhysics::InitializeRootInputRaw() TChain* inputChain = RootInput::getInstance()->GetChain() ; inputChain->SetBranchStatus ( "Hira" , true ) ; inputChain->SetBranchStatus ( "fHira_*" , true ) ; - inputChain->SetBranchAddress( "Hira" , &EventData ) ; + inputChain->SetBranchAddress( "Hira" , &m_EventData ) ; } /////////////////////////////////////////////////////////////////////////// void THiraPhysics::InitializeRootInputPhysics() { - /*TChain* inputChain = RootInput::getInstance()->GetChain(); + TChain* inputChain = RootInput::getInstance()->GetChain(); inputChain->SetBranchStatus ( "Hira", true ); inputChain->SetBranchStatus ( "DetectorNumber", true ); inputChain->SetBranchStatus ( "Energy", true ); inputChain->SetBranchStatus ( "Time", true ); - inputChain->SetBranchAddress( "Hira", &EventPhysics );*/ + inputChain->SetBranchAddress( "Hira", &m_EventPhysics ); } /////////////////////////////////////////////////////////////////////////// void THiraPhysics::InitializeRootOutput() { TTree* outputTree = RootOutput::getInstance()->GetTree() ; - outputTree->Branch( "Hira" , "THiraPhysics" , &EventPhysics ) ; + outputTree->Branch( "Hira" , "THiraPhysics" , &m_EventPhysics ) ; } /////////////////////////////////////////////////////////////////////////// -void THiraPhysics::BuildPhysicalEvent() - { - BuildSimplePhysicalEvent() ; - } +void THiraPhysics::BuildPhysicalEvent(){ + BuildSimplePhysicalEvent() ; +} /////////////////////////////////////////////////////////////////////////// -void THiraPhysics::BuildSimplePhysicalEvent() - { - - } +void THiraPhysics::BuildSimplePhysicalEvent(){ + PreTreat(); + m_ThinSi_EMult = m_PreTreatedData->GetHiraThinSiEMult(); + m_ThickSi_EXMult = m_PreTreatedData->GetHiraStripXEMult(); + m_ThickSi_EYMult = m_PreTreatedData->GetHiraStripYEMult(); + m_CsI_EMult = m_PreTreatedData->GetHiraCsIEMult(); + + + for(unsigned int i = 0 ; i < m_ThinSi_EMult ; ++i){ + TelescopeNumber.push_back(m_PreTreatedData->GetHiraThinSiStripEDetectorNbr(i)); + ThinSi_StripNumber.push_back(m_PreTreatedData->GetHiraThinSiStripEStripNbr(i)); + ThinSi_E.push_back(m_PreTreatedData->GetHiraThinSiStripEEnergy(i)); + ThinSi_T.push_back(m_PreTreatedData->GetHiraThinSiStripTTime(i)); + } + + for(unsigned int i = 0 ; i < m_ThickSi_EXMult ; ++i){ + ThickSi_StripNumberX.push_back(m_PreTreatedData->GetHiraStripXEStripNbr(i)); + ThickSi_EX.push_back(m_PreTreatedData->GetHiraStripXEEnergy(i)); + ThickSi_T.push_back(m_EventData->GetHiraStripXTTime(i)); + ThickSi_E.push_back(m_PreTreatedData->GetHiraStripXEEnergy(i)); + } + + for(unsigned int i = 0 ; i < m_ThickSi_EXMult ; ++i){ + ThickSi_StripNumberY.push_back(m_PreTreatedData->GetHiraStripYEStripNbr(i)); + ThickSi_EY.push_back(m_PreTreatedData->GetHiraStripYEEnergy(i)); + } + + for(unsigned int i = 0 ; i < m_CsI_EMult ; ++i){ + CsI_CrystalNumber.push_back(m_PreTreatedData->GetHiraCsIECristalNbr(i)); + CsI_E.push_back(m_PreTreatedData->GetHiraCsIEEnergy(i)); + } + + return; +} + +/////////////////////////////////////////////////////////////////////////// +void THiraPhysics::PreTreat(){ + ClearPreTreatedData(); + m_ThinSi_EMult = m_EventData->GetHiraThinSiEMult(); + m_ThickSi_EXMult = m_EventData->GetHiraStripXEMult(); + m_ThickSi_EYMult = m_EventData->GetHiraStripYEMult(); + m_CsI_EMult = m_EventData->GetHiraCsIEMult(); + + + // Thin Si + for(unsigned int i = 0 ; i < m_ThinSi_EMult ; ++i){ + m_PreTreatedData->SetHiraThinSiStripEDetectorNbr( m_EventData->GetHiraThinSiStripEDetectorNbr(i) ); + m_PreTreatedData->SetHiraThinSiStripEStripNbr( m_EventData->GetHiraThinSiStripEStripNbr(i) ); + m_PreTreatedData->SetHiraThinSiStripEEnergy( m_EventData->GetHiraThinSiStripEEnergy(i) ); + m_PreTreatedData->SetHiraThinSiStripTTime( m_EventData->GetHiraThinSiStripTTime(i)); + } + + // Thick Si + // X + for(unsigned int i = 0 ; i < m_ThickSi_EXMult ; ++i){ + m_PreTreatedData->SetHiraThickSiStripXEDetectorNbr( m_EventData->GetHiraStripXEDetectorNbr(i) ); + m_PreTreatedData->SetHiraThickSiStripXEStripNbr( m_EventData->GetHiraStripXEStripNbr(i) ); + m_PreTreatedData->SetHiraThickSiStripXEEnergy( m_EventData->GetHiraStripXEEnergy(i) ); + m_PreTreatedData->SetHiraThickSiStripXTTime( m_EventData->GetHiraStripXTTime(i) ); + } + // Y + for(unsigned int i = 0 ; i < m_ThickSi_EYMult ; ++i){ + m_PreTreatedData->SetHiraThickSiStripYEDetectorNbr( m_EventData->GetHiraStripYEDetectorNbr(i) ); + m_PreTreatedData->SetHiraThickSiStripYEStripNbr( m_EventData->GetHiraStripYEStripNbr(i) ); + m_PreTreatedData->SetHiraThickSiStripYEEnergy( m_EventData->GetHiraStripYEEnergy(i) ); + m_PreTreatedData->SetHiraThickSiStripYTTime( m_EventData->GetHiraStripYTTime(i) ); + } + + // CsI + for(unsigned int i = 0 ; i < m_CsI_EMult ; ++i){ + m_PreTreatedData->SetHiraCsIEDetectorNbr( m_EventData->GetHiraCsIEDetectorNbr(i) ); + m_PreTreatedData->SetHiraCsIECristalNbr( m_EventData->GetHiraCsIECristalNbr(i) ); + m_PreTreatedData->SetHiraCsIEEnergy( m_EventData->GetHiraCsIEEnergy(i) ); + } + + + + return; +} + //////////////////////////////////////////////////////////////////////////////// // Construct Method to be pass to the DetectorFactory // diff --git a/NPLib/Hira/THiraPhysics.h b/NPLib/Hira/THiraPhysics.h index d73396ffe8d3fa920c5f090fe6c338bb54d91648..d50c8b057fe14050836b6e23631de21e572877e1 100644 --- a/NPLib/Hira/THiraPhysics.h +++ b/NPLib/Hira/THiraPhysics.h @@ -28,12 +28,14 @@ using namespace std ; // ROOT #include "TObject.h" +#include "TVector3.h" + // NPL #include "THiraData.h" #include "NPVDetector.h" +#include "NPCalibrationManager.h" -//#include "../include/CalibrationManager.h" class THiraPhysics : public TObject, public NPL::VDetector { @@ -46,51 +48,94 @@ class THiraPhysics : public TObject, public NPL::VDetector void Clear(const Option_t*) {}; public: // Calibrated Data - vector<UShort_t> DetectorNumber ; - vector<Double_t> Energy; - vector<Double_t> Time; + // Telescope + vector<int> TelescopeNumber ; + + // Thin Si + vector<double> ThinSi_E; + vector<double> ThinSi_T; + vector<int> ThinSi_StripNumber; + + // Thick Si + vector<double> ThickSi_E; + vector<double> ThickSi_EX; + vector<double> ThickSi_EY; + vector<double> ThickSi_T; + vector<int> ThickSi_StripNumberX; + vector<int> ThickSi_StripNumberY; + + // CsI + vector<double> CsI_E; + vector<double> CsI_CrystalNumber; public: // inherrited from VDetector - // Read stream at ConfigFile to pick-up parameters of detector (Position,...) using Token - void ReadConfiguration(string); + // Read stream at ConfigFile to pick-up parameters of detector (Position,...) using Token + void ReadConfiguration(string); - // Add Parameter to the CalibrationManger - void AddParameterToCalibrationManager(); + // 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 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() ; + // 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(); + // 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(); + // 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(); - - // Same as above but for online analysis - void BuildOnlinePhysicalEvent() {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(); + + // Same as above but for online analysis + void BuildOnlinePhysicalEvent() {BuildPhysicalEvent();}; + + // Add a Telescope using Corner Coordinate information + void AddTelescope(TVector3 A, TVector3 B, TVector3 C, TVector3 D); + + // Clear The PreTeated object + void ClearPreTreatedData() {m_PreTreatedData->Clear();} + + // Remove bad channel, calibrate the data and apply threshold + void PreTreat(); + + // 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] ; } ; + + TVector3 GetPositionOfInteraction(const int i) const; + + unsigned int m_ThinSi_EMult;//! + unsigned int m_ThickSi_EXMult;//! + unsigned int m_ThickSi_EYMult;//! + unsigned int m_CsI_EMult;//! + // Give and external THiraData object to THiraPhysics. Needed for online analysis for example. - void SetRawDataPointer(THiraData* rawDataPointer) {EventData = rawDataPointer;} + void SetRawDataPointer(THiraData* rawDataPointer) {m_EventData = rawDataPointer;} // Those two method all to clear the Event Physics or Data void ClearEventPhysics() {Clear();} - void ClearEventData() {EventData->Clear();} + void ClearEventData() {m_EventData->Clear();} private: // Data not writted in the tree - int NumberOfDetector ;//! - THiraData* EventData ;//! - THiraPhysics* EventPhysics ;//! + int m_NumberOfTelescope ;//! + THiraData* m_EventData ;//! + THiraData* m_PreTreatedData ;//! + THiraPhysics* m_EventPhysics ;//! + + vector< vector < vector < double > > > m_StripPositionX;//! + vector< vector < vector < double > > > m_StripPositionY;//! + vector< vector < vector < double > > > m_StripPositionZ;//! public:// Static constructor to be passed to the Detector Factory static NPL::VDetector* Construct(); diff --git a/NPLib/MUST2/TMust2Physics.cxx b/NPLib/MUST2/TMust2Physics.cxx index 05293a3701de69e9d559c1f9da057b33b10ca016..a52eef92fefc18809d1f7bdb17d5ce1c58aacd08 100644 --- a/NPLib/MUST2/TMust2Physics.cxx +++ b/NPLib/MUST2/TMust2Physics.cxx @@ -1165,9 +1165,9 @@ void TMust2Physics::AddTelescope( TVector3 C_X1_Y1, Strip_1_1+= U*Ushift+V*Vshift ; for( int i = 0 ; i < 128 ; ++i ){ - lineX.clear() ; - lineY.clear() ; - lineZ.clear() ; + lineX.clear(); + lineY.clear(); + lineZ.clear(); for( int j = 0 ; j < 128 ; ++j ){ StripCenter = Strip_1_1 + StripPitch*( i*U + j*V ); diff --git a/NPSimulation/CMakeLists.txt b/NPSimulation/CMakeLists.txt old mode 100644 new mode 100755 diff --git a/NPSimulation/Hira/Hira.cc b/NPSimulation/Hira/Hira.cc index 9a1a16c80bb75459d2bec03526d9239d438eb8f3..b01a6c7294bede52d28d51532082848ad7299b9b 100644 --- a/NPSimulation/Hira/Hira.cc +++ b/NPSimulation/Hira/Hira.cc @@ -327,13 +327,13 @@ void Hira::ReadSensitive(const G4Event* event){ double E_ThinSi = RandGauss::shoot(Info[0],ResoThinSi); if(E_ThinSi>EnergyThreshold){ - m_EventHira->SetHiraThinSiStripEEnergy(E_ThinSi); + m_EventHira->SetHiraThinSiStripEEnergy(E_ThinSi); m_EventHira->SetHiraThinSiStripEDetectorNbr(Info[7]); - m_EventHira->SetHiraThinSiStripEStripNbr(Info[8]); + m_EventHira->SetHiraThinSiStripEStripNbr(Info[8]); - m_EventHira->SetHiraThinSiStripTTime(Info[1]); - m_EventHira->SetHiraThinSiStripTDetectorNbr(Info[7]); - m_EventHira->SetHiraThinSiStripTStripNbr(Info[8]); + m_EventHira->SetHiraThinSiStripTTime(Info[1]); + m_EventHira->SetHiraThinSiStripTDetectorNbr(Info[7]); + m_EventHira->SetHiraThinSiStripTStripNbr(Info[8]); } } @@ -351,21 +351,28 @@ void Hira::ReadSensitive(const G4Event* event){ G4double* Info = *(ThickSi_itr->second); double E_ThickSi = RandGauss::shoot(Info[0],ResoThickSi); if(E_ThickSi>EnergyThreshold){ - m_EventHira->SetHiraThickSiStripXEEnergy(E_ThickSi); - m_EventHira->SetHiraThickSiStripXEDetectorNbr(Info[7]); - m_EventHira->SetHiraThickSiStripXEStripNbr(Info[8]); + m_EventHira->SetHiraThickSiStripXEEnergy(E_ThickSi); + m_EventHira->SetHiraThickSiStripXEDetectorNbr(Info[7]); + m_EventHira->SetHiraThickSiStripXEStripNbr(Info[8]); - m_EventHira->SetHiraThickSiStripXTTime(Info[1]); - m_EventHira->SetHiraThickSiStripXTDetectorNbr(Info[7]); - m_EventHira->SetHiraThickSiStripXTStripNbr(Info[8]); + m_EventHira->SetHiraThickSiStripXTTime(Info[1]); + m_EventHira->SetHiraThickSiStripXTDetectorNbr(Info[7]); + m_EventHira->SetHiraThickSiStripXTStripNbr(Info[8]); - m_EventHira->SetHiraThickSiStripYEEnergy(E_ThickSi); - m_EventHira->SetHiraThickSiStripYEDetectorNbr(Info[7]); - m_EventHira->SetHiraThickSiStripYEStripNbr(Info[9]); + m_EventHira->SetHiraThickSiStripYEEnergy(E_ThickSi); + m_EventHira->SetHiraThickSiStripYEDetectorNbr(Info[7]); + m_EventHira->SetHiraThickSiStripYEStripNbr(Info[9]); - m_EventHira->SetHiraThickSiStripYTTime(Info[1]); - m_EventHira->SetHiraThickSiStripYTDetectorNbr(Info[7]); - m_EventHira->SetHiraThickSiStripYTStripNbr(Info[9]); + m_EventHira->SetHiraThickSiStripYTTime(Info[1]); + m_EventHira->SetHiraThickSiStripYTDetectorNbr(Info[7]); + m_EventHira->SetHiraThickSiStripYTStripNbr(Info[9]); + + // Interraction Coordinates + ms_InterCoord->SetDetectedPositionX(Info[2]) ; + ms_InterCoord->SetDetectedPositionY(Info[3]) ; + ms_InterCoord->SetDetectedPositionZ(Info[4]) ; + ms_InterCoord->SetDetectedAngleTheta(Info[5]/deg) ; + ms_InterCoord->SetDetectedAnglePhi(Info[6]/deg) ; } } // Clear Map for next event @@ -389,7 +396,7 @@ void Hira::ReadSensitive(const G4Event* event){ } // Clear Map for next event CsIHitMap->clear(); - + } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... diff --git a/NPSimulation/Hira/Hira.hh b/NPSimulation/Hira/Hira.hh index 155c9338b62d1c80fb2d95b65d2b0a6b10ec85b9..e7b0d4ebacca217f690f0cb5d748ea035830a1b3 100644 --- a/NPSimulation/Hira/Hira.hh +++ b/NPSimulation/Hira/Hira.hh @@ -52,7 +52,7 @@ namespace HIRA const G4double ResoThickSi = 0.022 ;// = 52keV of Resolution // Unit is MeV/2.35 const G4double ResoThinSi = 0.064 ;// = 150keV of Resolution // Unit is MeV/2.35 - const G4double EnergyThreshold = 100*keV; + const G4double EnergyThreshold = 0.;//100*keV; const G4double FaceFront = 7.*cm ; const G4double FaceBack = 7*cm ; diff --git a/NPSimulation/MUST2/MUST2Array.cc b/NPSimulation/MUST2/MUST2Array.cc index 3595472084638e0da0c1763f26536b5c2060d5ed..3150e73019c171b8860f30ac55e84eed60b4b5b3 100644 --- a/NPSimulation/MUST2/MUST2Array.cc +++ b/NPSimulation/MUST2/MUST2Array.cc @@ -1289,7 +1289,8 @@ void MUST2Array::InitializeScorers() { G4VPrimitiveScorer* InteractionCoordinatesX = new OBSOLETEGENERALSCORERS::PSInteractionCoordinatesX("InterCoordX","MUST2Telescope", 0); G4VPrimitiveScorer* InteractionCoordinatesY = new OBSOLETEGENERALSCORERS::PSInteractionCoordinatesY("InterCoordY","MUST2Telescope", 0); - G4VPrimitiveScorer* InteractionCoordinatesZ = new OBSOLETEGENERALSCORERS::PSInteractionCoordinatesZ("InterCoordZ","MUST2Telescope", 0); + G4VPrimitiveScorer* InteractionCoordinatesZ = new OBSOLETEGENERALSCORERS::PSInteractionCoordinatesZ("InterCoordZ","MUST2Telescope", 0); + G4VPrimitiveScorer* InteractionCoordinatesAngleTheta = new OBSOLETEGENERALSCORERS::PSInteractionCoordinatesAngleTheta("InterCoordAngTheta","MUST2Telescope", 0); G4VPrimitiveScorer* InteractionCoordinatesAnglePhi = new OBSOLETEGENERALSCORERS::PSInteractionCoordinatesAnglePhi("InterCoordAngPhi","MUST2Telescope", 0) ;