diff --git a/Inputs/DetectorConfiguration/Riken_30mm.detector b/Inputs/DetectorConfiguration/Riken_30mm.detector index 241aed0721955b29df1c702f2390f483af8a32f4..8661159da643abececfe1e2295ace79e32afc8f5 100644 --- a/Inputs/DetectorConfiguration/Riken_30mm.detector +++ b/Inputs/DetectorConfiguration/Riken_30mm.detector @@ -27,14 +27,15 @@ CryoTarget Y= 0 Z= 0 + %%%%%%%%%%%%%%%%%%%%% MUST2Array %%%%%%% Telescope 1 %%%%%%% M2Telescope -X1_Y1= 10.85 105.03 162.16 -X1_Y128= 22.8 9.84 191.95 -X128_Y1= 104.09 105.03 124.76 -X128_Y128= 116.04 9.84 154.55 +X1_Y1= 10.85 105.03 146.16 +X1_Y128= 22.8 9.84 175.95 +X128_Y1= 104.09 105.03 108.76 +X128_Y128= 116.04 9.84 138.55 SI= 1 SILI= 0 CSI= 1 @@ -42,10 +43,10 @@ VIS= all %%%%%%% Telescope 2 %%%%%%% M2Telescope -X1_Y1= -116.04 9.84 154.55 -X1_Y128= -22.8 9.84 191.95 -X128_Y1= -104.09 105.03 124.76 -X128_Y128= -10.85 105.03 162.16 +X1_Y1= -116.04 9.84 138.55 +X1_Y128= -22.8 9.84 175.95 +X128_Y1= -104.09 105.03 108.76 +X128_Y128= -10.85 105.03 146.16 SI= 1 SILI= 0 CSI= 1 @@ -53,10 +54,10 @@ VIS= all %%%%%%% Telescope 3 %%%%%%% M2Telescope -X1_Y1= -10.85 -105.03 162.16 -X1_Y128= -22.8 -9.84 191.95 -X128_Y1= -104.09 -105.03 124.76 -X128_Y128= -116.04 -9.84 154.55 +X1_Y1= -10.85 -105.03 146.16 +X1_Y128= -22.8 -9.84 175.95 +X128_Y1= -104.09 -105.03 108.76 +X128_Y128= -116.04 -9.84 138.55 SI= 1 SILI= 0 CSI= 1 @@ -64,10 +65,10 @@ VIS= all %%%%%%% Telescope 4 %%%%%%% M2Telescope -X1_Y1= 116.04 -9.84 154.55 -X1_Y128= 22.8 -9.84 191.95 -X128_Y1= 104.09 -105.03 124.76 -X128_Y128= 10.85 -105.03 162.16 +X1_Y1= 116.04 -9.84 138.55 +X1_Y128= 22.8 -9.84 175.95 +X128_Y1= 104.09 -105.03 108.76 +X128_Y128= 10.85 -105.03 146.16 SI= 1 SILI= 0 CSI= 1 @@ -75,10 +76,10 @@ VIS= all %%%%%%% Telescope 5 %%%%%%% M2Telescope -X1_Y1= -50.23 -50.23 341 -X1_Y128= 50.23 -50.23 341 -X128_Y1= -50.23 50.23 341 -X128_Y128= 50.23 50.23 341 +X1_Y1= -50.23 -50.23 325 +X1_Y128= 50.23 -50.23 325 +X128_Y1= -50.23 50.23 325 +X128_Y128= 50.23 50.23 325 SI= 1 SILI= 0 CSI= 1 @@ -88,29 +89,29 @@ VIS= all AddThinSi %%%%%%%%% Det 1 %%%%%%%% ThinSi -A= 18.39 9.66 159.67 -B= 65.26 9.66 140.87 -C= 59.44 56.09 126.34 -D= 12.57 56.09 145.14 +A= 18.39 9.66 143.67 +B= 65.26 9.66 124.87 +C= 59.44 56.09 110.34 +D= 12.57 56.09 129.14 %%%%%%%%% Det 2 %%%%%%%% ThinSi -A= -12.57 56.09 145.14 -B= -59.44 56.09 126.34 -C= -65.26 9.66 140.87 -D= -18.39 9.66 159.67 +A= -12.57 56.09 129.14 +B= -59.44 56.09 110.34 +C= -65.26 9.66 124.87 +D= -18.39 9.66 143.67 %%%%%%%%% Det 3 %%%%%%%% ThinSi -A= -18.39 -9.66 159.67 -B= -65.26 -9.66 140.87 -C= -59.44 -56.09 126.34 -D= -12.57 -56.09 145.14 +A= -18.39 -9.66 143.67 +B= -65.26 -9.66 124.87 +C= -59.44 -56.09 110.34 +D= -12.57 -56.09 129.14 %%%%%%%%% Det 4 %%%%%%%% ThinSi -A= 12.57 -56.09 145.14 -B= 59.44 -56.09 126.34 -C= 65.26 -9.66 140.87 -D= 18.39 -9.66 159.67 +A= 12.57 -56.09 129.14 +B= 59.44 -56.09 110.34 +C= 65.26 -9.66 124.87 +D= 18.39 -9.66 143.67 diff --git a/Inputs/DetectorConfiguration/Riken_65mm.detector b/Inputs/DetectorConfiguration/Riken_65mm.detector index 580a324aeaf92b051ce42ed6aab3f01368500ad8..5470d39192c13ca49b9165d9977f853c7610314b 100644 --- a/Inputs/DetectorConfiguration/Riken_65mm.detector +++ b/Inputs/DetectorConfiguration/Riken_65mm.detector @@ -1,12 +1,42 @@ +%%%%%%%%%%%Target%%%%%%%%%%%%%%%%%%%1 +%Thickness in micrometer +%Radius in mm +%Temperature in K, Pressure in bar +%Material name according to the target library + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +GeneralTarget +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%Target + THICKNESS= 1 + RADIUS= 45 + MATERIAL= CD2 + X= 10 + Y= -10 + Z= 50 + +CryoTarget + THICKNESS= 3000 + RADIUS= 45 + TEMPERATURE= 26 + PRESSURE= 1 + MATERIAL= D2 + WINDOWSTHICKNESS= 15 + WINDOWSMATERIAL= Mylar + X= 0 + Y= 0 + Z= 0 + + %%%%%%%%%%%%%%%%%%%%% MUST2Array %%%%%%% Telescope 1 %%%%%%% M2Telescope -X1_Y1= 10.85 105.03 162.16 -X1_Y128= 22.8 9.84 191.95 -X128_Y1= 104.09 105.03 124.76 -X128_Y128= 116.04 9.84 154.55 +X1_Y1= 10.85 105.03 146.16 +X1_Y128= 22.8 9.84 175.95 +X128_Y1= 104.09 105.03 108.76 +X128_Y128= 116.04 9.84 138.55 SI= 1 SILI= 0 CSI= 1 @@ -14,10 +44,10 @@ VIS= all %%%%%%% Telescope 2 %%%%%%% M2Telescope -X1_Y1= -116.04 9.84 154.55 -X1_Y128= -22.8 9.84 191.95 -X128_Y1= -104.09 105.03 124.76 -X128_Y128= -10.85 105.03 162.16 +X1_Y1= -116.04 9.84 138.55 +X1_Y128= -22.8 9.84 175.95 +X128_Y1= -104.09 105.03 108.76 +X128_Y128= -10.85 105.03 146.16 SI= 1 SILI= 0 CSI= 1 @@ -25,10 +55,10 @@ VIS= all %%%%%%% Telescope 3 %%%%%%% M2Telescope -X1_Y1= -10.85 -105.03 162.16 -X1_Y128= -22.8 -9.84 191.95 -X128_Y1= -104.09 -105.03 124.76 -X128_Y128= -116.04 -9.84 154.55 +X1_Y1= -10.85 -105.03 146.16 +X1_Y128= -22.8 -9.84 175.95 +X128_Y1= -104.09 -105.03 108.76 +X128_Y128= -116.04 -9.84 138.55 SI= 1 SILI= 0 CSI= 1 @@ -36,10 +66,10 @@ VIS= all %%%%%%% Telescope 4 %%%%%%% M2Telescope -X1_Y1= 116.04 -9.84 154.55 -X1_Y128= 22.8 -9.84 191.95 -X128_Y1= 104.09 -105.03 124.76 -X128_Y128= 10.85 -105.03 162.16 +X1_Y1= 116.04 -9.84 138.55 +X1_Y128= 22.8 -9.84 175.95 +X128_Y1= 104.09 -105.03 108.76 +X128_Y128= 10.85 -105.03 146.16 SI= 1 SILI= 0 CSI= 1 @@ -47,10 +77,10 @@ VIS= all %%%%%%% Telescope 5 %%%%%%% M2Telescope -X1_Y1= -50.23 -50.23 341 -X1_Y128= 50.23 -50.23 341 -X128_Y1= -50.23 50.23 341 -X128_Y128= 50.23 50.23 341 +X1_Y1= -50.23 -50.23 325 +X1_Y128= 50.23 -50.23 325 +X128_Y1= -50.23 50.23 325 +X128_Y128= 50.23 50.23 325 SI= 1 SILI= 0 CSI= 1 @@ -60,30 +90,30 @@ VIS= all AddThinSi %%%%%%%%% Det 1 %%%%%%%% ThinSi -A= 17.61 9.85 120.11 -B= 64.48 9.85 101.31 -C= 58.66 56.29 86.79 -D= 11.79 56.29 105.59 +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 %%%%%%%% ThinSi -A= -116.04 9.84 154.55 -B= -22.8 9.84 191.95 -C= -104.09 105.03 124.76 -D= -10.85 105.03 162.16 +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 %%%%%%%% ThinSi -A= -11.79 56.29 105.59 -B= -58.66 56.29 86.79 -C= -64.48 9.85 101.31 -D= -17.61 9.85 120.11 +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 %%%%%%%% ThinSi -A= -10.85 -105.03 162.16 -B= -22.8 -9.84 191.95 -C= -104.09 -105.03 124.76 -D= -116.04 -9.84 154.55 +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 diff --git a/NPAnalysis/10He_Riken/Analysis b/NPAnalysis/10He_Riken/Analysis new file mode 100755 index 0000000000000000000000000000000000000000..e4e550e76ef53467904d0205641e15791e9579a0 Binary files /dev/null and b/NPAnalysis/10He_Riken/Analysis differ diff --git a/NPAnalysis/10He_Riken/Makefile b/NPAnalysis/10He_Riken/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..f5bfeb69ffd25b28c9ccb8a81eebb1b66664dfa2 --- /dev/null +++ b/NPAnalysis/10He_Riken/Makefile @@ -0,0 +1,6 @@ + +Analyse: + make -C ./src + +clean: + make clean -C ./src diff --git a/NPAnalysis/10He_Riken/RunToTreat.txt b/NPAnalysis/10He_Riken/RunToTreat.txt new file mode 100644 index 0000000000000000000000000000000000000000..008354fd1b9fa2d1c15477a463be1e2bf76a6b7e --- /dev/null +++ b/NPAnalysis/10He_Riken/RunToTreat.txt @@ -0,0 +1,4 @@ +TTreeName + SimulatedTree +RootFileName + ../../Outputs/Simulation/mySimul.root diff --git a/NPAnalysis/10He_Riken/include/DetectorManager.hh b/NPAnalysis/10He_Riken/include/DetectorManager.hh new file mode 100644 index 0000000000000000000000000000000000000000..eb49f01ef92509cd0531f4f12c7eace833047e61 --- /dev/null +++ b/NPAnalysis/10He_Riken/include/DetectorManager.hh @@ -0,0 +1,39 @@ +#ifndef DetectorManager_h +#define DetectorManager_h + +// NPL +#include "VDetector.h" + +// STL +#include <string> +#include <map> + +using namespace std ; +using namespace NPA ; + +// This class manage a map of virtual detector + +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 ; + + }; + +#endif diff --git a/NPAnalysis/10He_Riken/include/ObjectManager.hh b/NPAnalysis/10He_Riken/include/ObjectManager.hh new file mode 100644 index 0000000000000000000000000000000000000000..e0a66004be5b8c354e8e3f7175613fbd2c625d7a --- /dev/null +++ b/NPAnalysis/10He_Riken/include/ObjectManager.hh @@ -0,0 +1,117 @@ +// You can use this file to declare your spectra, file, energy loss , ... and whatever you want. +// This way you can remove all unnecessary declaration in the main programm. +// In order to help debugging and organizing we use Name Space. + +///////////////////////////////////////////////////////////////////////////////////////////////// +// -------------------------------------- VARIOUS INCLUDE --------------------------------------- + +// NPA +#include "DetectorManager.hh" +#include "Must2Array.h" + +// STL C++ +#include <iostream> +#include <fstream> +#include <sstream> +#include <string> +#include <cmath> +#include <cstdlib> + +// ROOT +#include <TROOT.h> +#include <TChain.h> +#include <TFile.h> +#include <TLeaf.h> +#include <TVector3.h> +#include <TRandom.h> + +// NPL +#include "TMust2Data.h" +#include "TMust2Physics.h" +#include "NPReaction.h" +#include "RootInput.h" +#include "RootOutput.h" + +// Use CLHEP System of unit and Physical Constant +#include "CLHEP/Units/GlobalSystemOfUnits.h" +#include "CLHEP/Units/PhysicalConstants.h" + + +// ---------------------------------------------------------------------------------------------- +double ThetaCalculation (TVector3 A , TVector3 B) ; +///////////////////////////////////////////////////////////////////////////////////////////////// +// ----------------------------------- DOUBLE, INT, BOOL AND MORE ------------------------------- +namespace VARIABLE + { + // Declare your Variable here: + + double X1,Y1,Z1 ; + int N1,N2 = 0 ; + bool check= false ; + + // A Usefull Simple Random Generator + TRandom Rand; + } + +using namespace VARIABLE ; +// ---------------------------------------------------------------------------------------------- + + + +///////////////////////////////////////////////////////////////////////////////////////////////// +// -----------------------------------GRAPH------------------------------------------------------ +#include <TObject.h> +#include <TH1.h> +#include <TH1F.h> +#include <TH2.h> +#include <TH2F.h> +#include <TGraph2D.h> + +namespace GRAPH + { + // Declare your Spectra here: + + TH1F *myHist1D = new TH1F("Hist1D","Histogramm 1D ; x ; count", 1000 , -5 , 5 ) ; + + TH2F *myHist2D = new TH2F("Hist2D","Histogramm 2D ; x ; y ", 128 , 1 , 128 , 128 , 1 , 128 ) ; + + } + +using namespace GRAPH ; +// -------------------------------------------------------------------------------------------- + + + +/////////////////////////////////////////////////////////////////////////////////////////////// +// -----------------------------------CUT------------------------------------------------------ +#include <TCutG.h> +namespace CUT + { + // Declare your Cut here: + + } + +using namespace CUT ; +// -------------------------------------------------------------------------------------------- + + + +//////////////////////////////////////////////////////////////////////////////////////////////// +// -----------------------------------ENERGY LOSS---------------------------------------------- +#include "NPEnergyLoss.h" +using namespace NPL ; +namespace ENERGYLOSS + { + + // Declare your Energy loss here : + /* EnergyLoss ProtonTarget = EnergyLoss ( "CD2.txt" , + 100 , + 1 ); + */ + } + +using namespace ENERGYLOSS ; +// ---------------------------------------------------------------------------------------------- +///////////////////////////////////////////////////////////////////////////////////////////////// + + diff --git a/NPAnalysis/Template/macro/CrossSection.c b/NPAnalysis/10He_Riken/macro/CrossSection.c similarity index 100% rename from NPAnalysis/Template/macro/CrossSection.c rename to NPAnalysis/10He_Riken/macro/CrossSection.c diff --git a/NPAnalysis/Template/macro/TimeOfFlight.c b/NPAnalysis/10He_Riken/macro/TimeOfFlight.c similarity index 100% rename from NPAnalysis/Template/macro/TimeOfFlight.c rename to NPAnalysis/10He_Riken/macro/TimeOfFlight.c diff --git a/NPAnalysis/Template/macro/affich.c b/NPAnalysis/10He_Riken/macro/affich.c similarity index 100% rename from NPAnalysis/Template/macro/affich.c rename to NPAnalysis/10He_Riken/macro/affich.c diff --git a/NPAnalysis/Template/macro/efficiency.c b/NPAnalysis/10He_Riken/macro/efficiency.c similarity index 100% rename from NPAnalysis/Template/macro/efficiency.c rename to NPAnalysis/10He_Riken/macro/efficiency.c diff --git a/NPAnalysis/Template/macro/hit.c b/NPAnalysis/10He_Riken/macro/hit.c similarity index 100% rename from NPAnalysis/Template/macro/hit.c rename to NPAnalysis/10He_Riken/macro/hit.c diff --git a/NPAnalysis/10He_Riken/src/Analysis.cc b/NPAnalysis/10He_Riken/src/Analysis.cc new file mode 100644 index 0000000000000000000000000000000000000000..a86e9e19e3bc3581e41e6a8bd98326ad45e49b69 --- /dev/null +++ b/NPAnalysis/10He_Riken/src/Analysis.cc @@ -0,0 +1,84 @@ +#include "ObjectManager.hh" + +using namespace std; + +int main(int argc,char** argv) +{ + + if(argc!=4) + { + cout << + "you need to specify both a Reaction file and a Detector file such as : Analysis myReaction.reaction myDetector.detector runToRead.run" + << endl; + return 0; + } + + string reactionfileName = argv[1] ; + string detectorfileName = argv[2] ; + string runToReadfileName = argv[3] ; + + // First of All instantiate RootInput and Output + // Detector will be attached later + RootInput:: getInstance(runToReadfileName) ; + RootOutput::getInstance("Analysis/10HeRiken_AnalyzedData", "AnalyzedTree") ; + + // Instantiate a Reaction + NPL::Reaction* myReaction = new Reaction ; + myReaction -> ReadConfigurationFile(reactionfileName) ; + + // Instantiate the detector using a file + DetectorManager* myDetector = new DetectorManager ; + myDetector -> ReadConfigurationFile(detectorfileName) ; + + // Attach more branch to the output + double Ex = 0 ; double EE = 0 ; double TT = 0 ; double X = 0 ; double Y = 0 ; int det ; + RootOutput::getInstance()->GetTree()->Branch("ExcitationEnergy",&Ex,"Ex/D") ; + RootOutput::getInstance()->GetTree()->Branch("E",&EE,"EE/D") ; + RootOutput::getInstance()->GetTree()->Branch("A",&TT,"TT/D") ; + RootOutput::getInstance()->GetTree()->Branch("X",&X,"X/D") ; + RootOutput::getInstance()->GetTree()->Branch("Y",&Y,"Y/D") ; + + // Open the ThinSi Branch + RootInput::getInstance() -> GetTree()->SetBranchStatus(ThinSi,true) ; + RootInput::getInstance() -> GetTree()->SetBranchAddress(ThinSiEnergy,true) ; + + // Get Must2 Pointer: + MUST2Array* M2 = (MUST2Array*) myDetector -> m_Detector["MUST2"] ; + // Get the formed Chained Tree and Treat it + TChain* Chain = RootInput:: getInstance() -> GetChain() ; + int i; + for ( i = 0 ; i < Chain -> GetEntries() ; i ++ ) + { + if( i%10000 == 0 && i!=0) cout << i << " Event annalysed " << endl ; + Chain -> GetEntry(i); + + myDetector -> ClearEventPhysics() ; + myDetector -> BuildPhysicalEvent() ; + + + double E = M2 -> GetEnergyDeposit(); + TVector3 A = M2 -> GetPositionOfInteraction(); + double Theta = ThetaCalculation ( A , TVector3(0,0,1) ) ; + if(E>-1000) Ex = myReaction -> ReconstructRelativistic( E , Theta ) ; + else Ex = -100 ; + EE = E ; TT = Theta/deg ; + if(E>-1000){ + X = A . X(); + Y = A . Y();} + else{X = -1000 ; Y = -1000;} + + RootOutput::getInstance()->GetTree()->Fill() ; + } + cout << "A total of " << i << " event has been annalysed " << endl ; + + RootOutput::getInstance()->Destroy(); + return 0 ; +} + + +double ThetaCalculation (TVector3 A , TVector3 B) + { + double Theta = acos( (A.Dot(B)) / (A.Mag()*B.Mag()) ) ; + return Theta ; + } + diff --git a/NPAnalysis/10He_Riken/src/DetectorManager.cc b/NPAnalysis/10He_Riken/src/DetectorManager.cc new file mode 100644 index 0000000000000000000000000000000000000000..000d61fe3827077359d77aa4c4f2af460364fbfd --- /dev/null +++ b/NPAnalysis/10He_Riken/src/DetectorManager.cc @@ -0,0 +1,228 @@ +#include "DetectorManager.hh" + +// STL +#include <iostream> +#include <fstream> +#include <cstdlib> + +// Detector +#include "Must2Array.h" + +///////////////////////////////////////////////////////////////////////////////////////////////// +// Default Constructor and Destructor +DetectorManager::DetectorManager() + {} + +///////////////////////////////////////////////////////////////////////////////////////////////// +DetectorManager::~DetectorManager() + {} + + +///////////////////////////////////////////////////////////////////////////////////////////////// +// Read stream at ConfigFile and pick-up Token declaration of Detector +void DetectorManager::ReadConfigurationFile(string Path) + { + ////////General Reading needs//////// + string LineBuffer; + string DataBuffer; + + /////////Boolean//////////////////// + bool MUST2 = false ; + bool AddThinSi = false ; + bool GeneralTarget = false ; + bool GPDTracker = false ; // Gaspard Tracker + ////////////////////////////////////////////////////////////////////////////////////////// + // added by Nicolas [07/05/09] + string GlobalPath = getenv("NPTOOL"); + Path = GlobalPath + "/Inputs/DetectorConfiguration/" + Path; + ifstream ConfigFile; + ConfigFile.open(Path.c_str()); + + if (ConfigFile.is_open()) + { + cout << "/////////////////////////////" << endl; + cout << " Configuration file " << Path << " loading " << endl; + } + + else + { + cout << " Error, no configuration file" << Path << " found" << endl; + return; + } + + + while (!ConfigFile.eof()) { + //Pick-up next line + getline(ConfigFile, LineBuffer); + //Search for comment Symbol: % + if (LineBuffer.compare(0, 1, "%") == 0) { /*Do Nothing*/ ;} + + /* //////////////////////////////////////////// + //////////// Search for Gaspard //////////// + //////////////////////////////////////////// + else if (LineBuffer.compare(0, 14, "GaspardTracker") == 0 && GPDTracker == false) { + GPDTracker = true ; + cout << "//////// Gaspard Tracker ////////" << endl ; + + // Instantiate the new array as a VDetector Object + VDetector* myDetector = new GaspardTracker() ; + + // Read Position of Telescope + ConfigFile.close() ; + myDetector->ReadConfiguration(Path) ; + ConfigFile.open(Path.c_str()) ; + + // Add array to the VDetector Vector + AddDetector(myDetector) ; + }*/ + + //////////////////////////////////////////// + //////// Search for MUST2 Array //////// + //////////////////////////////////////////// + else if (LineBuffer.compare(0, 10, "MUST2Array") == 0 && MUST2 == false) { + MUST2 = true ; + cout << "//////// MUST2 Array ////////" << endl << endl ; + + // Instantiate the new array as a VDetector Object + VDetector* myDetector = new MUST2Array() ; + + // Read Position of Telescope + ConfigFile.close() ; + myDetector->ReadConfiguration(Path) ; + ConfigFile.open(Path.c_str()) ; + + // Add array to the VDetector Vector + AddDetector("MUST2" , myDetector) ; + } + + /* //////////////////////////////////////////// + ////////// Search for Add.ThinSi /////////// + //////////////////////////////////////////// + else if (LineBuffer.compare(0, 9, "AddThinSi") == 0 && AddThinSi == false) { + AddThinSi = true ; + cout << "//////// Thin Si ////////" << endl << endl ; + + // Instantiate the new array as a VDetector Object + VDetector* myDetector = new ThinSi() ; + + // Read Position of Telescope + ConfigFile.close() ; + myDetector->ReadConfiguration(Path) ; + ConfigFile.open(Path.c_str()) ; + + // Add array to the VDetector Vector + AddDetector(myDetector) ; + } + + //////////////////////////////////////////// + //////////// Search for Target ///////////// + //////////////////////////////////////////// + + else if (LineBuffer.compare(0, 13, "GeneralTarget") == 0 && GeneralTarget == false) { + GeneralTarget = true ; + cout << "////////// Target ///////////" << endl << endl ; + + // Instantiate the new array as a VDetector Objects + VDetector* myDetector = new Target() ; + + // Read Position and target specification + ConfigFile.close() ; + myDetector->ReadConfiguration(Path) ; + ConfigFile.open(Path.c_str()) ; + + m_TargetThickness = ((Target*)myDetector)->GetTargetThickness() ; + m_TargetRadius = ((Target*)myDetector)->GetTargetRadius() ; + m_TargetX = ((Target*)myDetector)->GetTargetX() ; + m_TargetY = ((Target*)myDetector)->GetTargetY() ; + m_TargetZ = ((Target*)myDetector)->GetTargetZ() ; + + // Add target to the VDetector Vector + AddDetector(myDetector) ; + }*/ + + //Nothing understandable + //else ; + } + + ConfigFile.close(); + + InitializeRootInput(); + InitializeRootOutput(); + + return ; + } + +///////////////////////////////////////////////////////////////////////////////////////////////// + +void DetectorManager::BuildPhysicalEvent() + { + map<string,VDetector*>::iterator it ; + + for( it = m_Detector.begin() ; it != m_Detector.end() ; ++it) + { + it->second->BuildPhysicalEvent() ; + } + } +///////////////////////////////////////////////////////////////////////////////////////////////// + +void DetectorManager::BuildSimplePhysicalEvent() + { + map<string,VDetector*>::iterator it ; + + for( it = m_Detector.begin() ; it != m_Detector.end() ; ++it) + { + it->second->BuildSimplePhysicalEvent() ; + } + } +///////////////////////////////////////////////////////////////////////////////////////////////// + +void DetectorManager::InitializeRootInput() + { + map<string,VDetector*>::iterator it ; + + for( it = m_Detector.begin() ; it != m_Detector.end() ; ++it) + { + it->second->InitializeRootInput() ; + } + } +///////////////////////////////////////////////////////////////////////////////////////////////// + +void DetectorManager::InitializeRootOutput() + { + map<string,VDetector*>::iterator it ; + + for( it = m_Detector.begin() ; it != m_Detector.end() ; ++it) + { + it->second->InitializeRootOutput() ; + } + + } +///////////////////////////////////////////////////////////////////////////////////////////////// + +void DetectorManager::AddDetector(string DetectorName , VDetector* newDetector) + { + m_Detector["MUST2"] = newDetector ; + } +///////////////////////////////////////////////////////////////////////////////////////////////// +void DetectorManager::ClearEventPhysics() + { + map<string,VDetector*>::iterator it ; + + for( it = m_Detector.begin() ; it != m_Detector.end() ; ++it) + { + it->second->ClearEventPhysics() ; + } + + } +///////////////////////////////////////////////////////////////////////////////////////////////// +void DetectorManager::ClearEventData() + { + map<string,VDetector*>::iterator it ; + + for( it = m_Detector.begin() ; it != m_Detector.end() ; ++it) + { + it->second->ClearEventData() ; + } + + } + diff --git a/NPAnalysis/10He_Riken/src/GNUmakefile b/NPAnalysis/10He_Riken/src/GNUmakefile new file mode 100644 index 0000000000000000000000000000000000000000..742a90a491df079d882318b4948c91f27adfe056 --- /dev/null +++ b/NPAnalysis/10He_Riken/src/GNUmakefile @@ -0,0 +1,44 @@ +###Make file made by Adrien MATTA/ Institut de Physique Nucleaire d'Orsay IPNO### +# Made to compile the ROOT Analyser for MUST2 experiment + +CPP=g++ +EXEC=Analysis + +# local includes +NPAINCLUDES = ../include + +# ROOT includes +CXXFLAGS += `root-config --cflags` + +# CLHEP includes +CXXFLAGS += -I$(CLHEP_INCLUDE_DIR) +CXXFLAGS += -I$(NPAINCLUDES) +CXXFLAGS += -I$(NPLIB)/include + +LDFLAGS = `root-config --libs` -lMathMore +LDFLAGS+= -L$(NPLIB)/lib -lVDetector -lIORoot -lReaction -lEnergyLoss \ + -lMust2Data -lMust2Physics \ + -lAnnularS1Data -lGaspardData \ + -lInitialConditions -lInteractionCoordinates +LDFLAGS+= -L$(CLHEP_LIB_DIR) -l$(CLHEP_LIB) + +SRC= $(wildcard *.cc) +OBJ=$(SRC:.cc=.o) + +#all:$(EXEC) +# @$(CPP) -o $@ -c $< $(CXXFLAGS) + +Analysis:$(OBJ) + @$(CPP) $(CXXFLAGS) -o $@ $^ $(LDFLAGS) + mv Analysis ../Analysis + +%.o: %.cc + @$(CPP) $(CXXFLAGS) -o $@ -c $< + +.PHONY: clean mrproper + +clean: + rm -rf *.o + +mrproper: clean + rm -rf $(EXEC) diff --git a/NPAnalysis/Template/src/Analysis.cc b/NPAnalysis/Template/src/Analysis.cc index 8916b88b8c2447baad33dd9baf003f79a02bab90..a22fa769ce0dcb2e48fa16b4b59c6a1fa7c84c6e 100644 --- a/NPAnalysis/Template/src/Analysis.cc +++ b/NPAnalysis/Template/src/Analysis.cc @@ -30,16 +30,6 @@ int main(int argc,char** argv) DetectorManager* myDetector = new DetectorManager ; myDetector -> ReadConfigurationFile(detectorfileName) ; - // Attach more branch to the output - double Ex = 0 ; double EE = 0 ; double TT = 0 ; double X = 0 ; double Y = 0 ; int det ; - RootOutput::getInstance()->GetTree()->Branch("ExcitationEnergy",&Ex,"Ex/D") ; - RootOutput::getInstance()->GetTree()->Branch("E",&EE,"EE/D") ; - RootOutput::getInstance()->GetTree()->Branch("A",&TT,"TT/D") ; - RootOutput::getInstance()->GetTree()->Branch("X",&X,"X/D") ; - RootOutput::getInstance()->GetTree()->Branch("Y",&Y,"Y/D") ; - - // Get Must2 Pointer: - MUST2Array* M2 = (MUST2Array*) myDetector -> m_Detector["MUST2"] ; // Get the formed Chained Tree and Treat it TChain* Chain = RootInput:: getInstance() -> GetChain() ; int i; @@ -51,18 +41,11 @@ int main(int argc,char** argv) myDetector -> ClearEventPhysics() ; myDetector -> BuildPhysicalEvent() ; + /************************************************ + + Put your code here - double E = M2 -> GetEnergyDeposit(); - TVector3 A = M2 -> GetPositionOfInteraction(); - double Theta = ThetaCalculation ( A , TVector3(0,0,1) ) ; - if(E>-1000) Ex = myReaction -> ReconstructRelativistic( E , Theta ) ; - else Ex = -100 ; - EE = E ; TT = Theta/deg ; - if(E>-1000){ - X = A . X(); - Y = A . Y();} - else{X = -1000 ; Y = -1000;} - + ************************************************/ RootOutput::getInstance()->GetTree()->Fill() ; } cout << "A total of " << i << " event has been annalysed " << endl ; diff --git a/NPSimulation/include/ThinSi.hh b/NPSimulation/include/ThinSi.hh index 5b849992d1c7ea6f5f05c32e8b3cb87a287b74f9..da0c08ce3ebabd3c32c917956d4f7859838caa30 100644 --- a/NPSimulation/include/ThinSi.hh +++ b/NPSimulation/include/ThinSi.hh @@ -37,24 +37,21 @@ public: void AddTelescope(G4ThreeVector TL , G4ThreeVector BL , G4ThreeVector BR , - G4ThreeVector TR , - bool RightOrLeft); + G4ThreeVector TR ); // By Angle Method void AddTelescope(G4double R , G4double Theta , G4double Phi , G4double beta_u , G4double beta_v , - G4double beta_w , - bool RightOrLeft); + G4double beta_w ); // Effectively construct Volume // Avoid to have two time same code for Angle and Point definition void VolumeMaker(G4int DetectorNumber , G4ThreeVector MMpos , G4RotationMatrix* MMrot , - G4LogicalVolume* world , - bool RightOrLeft); + G4LogicalVolume* world ); //////////////////////////////////////////////////// @@ -90,8 +87,6 @@ private: private: // True if Define by Position, False is Define by angle vector<bool> m_DefinitionType ; - // True=Right False = Left - vector<bool> m_RightOrLeft ; // Used for "By Point Definition" vector<G4ThreeVector> m_TL ; // Top Left Corner Position Vector diff --git a/NPSimulation/src/ThinSi.cc b/NPSimulation/src/ThinSi.cc index 9cf44aa173c677970cb041f0ea806394867d2474..432792a656dd312a37724d483a5eaecf7cc7859f 100644 --- a/NPSimulation/src/ThinSi.cc +++ b/NPSimulation/src/ThinSi.cc @@ -41,21 +41,20 @@ namespace THINSI { // Energy and time Resolution const G4double ResoTime = 0 ; - const G4double ResoEnergy = 0.022 ;// = 52keV of Resolution // Unit is MeV/2.35 + const G4double ResoEnergy = 0.042 ;// = 100keV of Resolution // Unit is MeV/2.35 // Geometry - const G4double DetectorSize = 70*mm ; - const G4double SiliconThickness = 20*micrometer ; - const G4double SiliconSize = 50*mm ; + const G4double DetectorSize = 68*mm ; + const G4double SiliconThickness = 20*micrometer ; + const G4double FrameThickness = 1*mm ; + const G4double SiliconSize = 50*mm ; const G4double AluThickness = 0.4*micrometer ; - const G4int NumberOfStrip = 32 ; + const G4int NumberOfStrip = 32 ; - const G4double AluStripFront_PosZ = -0.5*SiliconThickness - 0.5*AluThickness ; - const G4double Si_PosZ = 0 ; - const G4double AluStripBack_PosZ = 0.5*SiliconThickness + 0.5*AluThickness ; + const G4double AluStripFront_PosZ = -0.5*SiliconThickness - 0.5*AluThickness ; + const G4double Si_PosZ = 0 ; + const G4double AluStripBack_PosZ = 0.5*SiliconThickness + 0.5*AluThickness ; - const G4double Si_PosX_Shift = 4*mm ; - const G4double Si_PosY_Shift = 2*mm ; } using namespace THINSI ; @@ -74,11 +73,9 @@ ThinSi::~ThinSi() void ThinSi::AddTelescope(G4ThreeVector TL , G4ThreeVector BL , G4ThreeVector BR , - G4ThreeVector TR , - bool RightOrLeft) + G4ThreeVector TR ) { m_DefinitionType.push_back(true) ; - m_RightOrLeft.push_back(RightOrLeft) ; m_TL.push_back(TL) ; m_BL.push_back(BL) ; @@ -98,13 +95,11 @@ void ThinSi::AddTelescope(G4double R , G4double Phi , G4double beta_u , G4double beta_v , - G4double beta_w , - bool RightOrLeft) + G4double beta_w ) { G4ThreeVector empty = G4ThreeVector(0, 0, 0) ; m_DefinitionType.push_back(false) ; - m_RightOrLeft.push_back(RightOrLeft); m_R.push_back(R) ; m_Theta.push_back(Theta) ; @@ -121,11 +116,10 @@ void ThinSi::AddTelescope(G4double R , } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -void ThinSi::VolumeMaker(G4int DetNumber , - G4ThreeVector Det_pos , - G4RotationMatrix* Det_rot , - G4LogicalVolume* world , - bool RightOrLeft) +void ThinSi::VolumeMaker( G4int DetNumber , + G4ThreeVector Det_pos , + G4RotationMatrix* Det_rot , + G4LogicalVolume* world ) { G4double NbrTelescopes = DetNumber ; G4String DetectorNumber ; @@ -164,21 +158,10 @@ void ThinSi::VolumeMaker(G4int DetNumber , // If don't you will have a Warning unused variable 'myPVP' G4PVPlacement* PVPBuffer ; - G4double Si_PosX = 0 ; - G4double Si_PosY = 0 ; - if (RightOrLeft) Si_PosX = -Si_PosX_Shift ; - else Si_PosX = Si_PosX_Shift ; - - if (Det_pos.y() > 0) Si_PosY = -Si_PosY_Shift ; - else Si_PosY = Si_PosY_Shift ; - - - G4ThreeVector Shift = G4ThreeVector(Si_PosX , Si_PosY , 0) ; - Det_pos = Det_pos + Shift ; /////// Starting Volume Definition /////// G4String Name = "ThinSi" + DetectorNumber; - G4Box* solidThinSi = new G4Box(Name, 0.5*DetectorSize, 0.5*DetectorSize, 0.5*3*mm); + G4Box* solidThinSi = new G4Box(Name, 0.5*DetectorSize, 0.5*DetectorSize, 0.5*FrameThickness*mm); G4LogicalVolume* logicThinSi = new G4LogicalVolume(solidThinSi, Vacuum, Name, 0, 0); @@ -192,8 +175,8 @@ void ThinSi::VolumeMaker(G4int DetNumber , 0); // Frame is made of 4 thick box (2 Horizontal and 2 Vertical) - G4Box* solidFrameHorizontal = new G4Box(Name + "Frame", 0.5*SiliconSize, 0.5*(DetectorSize - SiliconSize) / 2, 0.5*3*mm) ; - G4Box* solidFrameVertical = new G4Box(Name + "Frame", 0.5*(DetectorSize - SiliconSize) / 2, 0.5*DetectorSize, 0.5*3*mm) ; + G4Box* solidFrameHorizontal = new G4Box(Name + "Frame", 0.5*SiliconSize, 0.5*(DetectorSize - SiliconSize) / 2, 0.5*FrameThickness*mm) ; + G4Box* solidFrameVertical = new G4Box(Name + "Frame", 0.5*(DetectorSize - SiliconSize) / 2, 0.5*DetectorSize, 0.5*FrameThickness*mm) ; G4LogicalVolume* logicFrameHorizontal = new G4LogicalVolume(solidFrameHorizontal, Al, Name, 0, 0); @@ -306,7 +289,6 @@ void ThinSi::ReadConfiguration(string Path) G4double TLX , BLX , BRX , TRX , TLY , BLY , BRY , TRY , TLZ , BLZ , BRZ , TRZ ; G4ThreeVector TL , BL , BR , TR ; G4double Theta = 0 , Phi = 0 , R = 0 , beta_u = 0 , beta_v = 0 , beta_w = 0 ; - bool RightOrLeft = false ; bool check_A = false ; bool check_B = false ; bool check_C = false ; @@ -316,7 +298,6 @@ void ThinSi::ReadConfiguration(string Path) bool check_Phi = false ; bool check_R = false ; bool check_beta = false ; - bool check_side = false ; bool ReadingStatus = false ; while (!ConfigFile.eof()) @@ -456,14 +437,6 @@ void ThinSi::ReadConfiguration(string Path) beta_w = beta_w * deg ; G4cout << "Beta: " << beta_u / deg << " " << beta_v / deg << " " << beta_w / deg << G4endl ; } - - else if (DataBuffer.compare(0, 5, "SIDE=") == 0) { - check_side = true ; - ConfigFile >> DataBuffer ; - if (DataBuffer == "right") RightOrLeft = true ; - else RightOrLeft = false ; - G4cout << "Side: " << DataBuffer << G4endl << G4endl; - } /////////////////////////////////////////////////// // If no Detector Token and no comment, toggle out @@ -473,7 +446,7 @@ void ThinSi::ReadConfiguration(string Path) ///////////////////////////////////////////////// // If All necessary information there, toggle out - if ( (check_A && check_B && check_C && check_D) || (check_Theta && check_Phi && check_R && check_beta && check_side) ) + if ( (check_A && check_B && check_C && check_D) || (check_Theta && check_Phi && check_R && check_beta) ) { ReadingStatus = false; @@ -483,8 +456,7 @@ void ThinSi::ReadConfiguration(string Path) AddTelescope( TL , BL , BR , - TR , - false ); + TR ); } //with angle method @@ -494,13 +466,11 @@ void ThinSi::ReadConfiguration(string Path) Phi , beta_u , beta_v , - beta_w , - RightOrLeft ); + beta_w ); } // Reinitialisation of Check Boolean - RightOrLeft = false ; check_A = false ; check_B = false ; check_C = false ; @@ -510,7 +480,6 @@ void ThinSi::ReadConfiguration(string Path) check_Phi = false ; check_R = false ; check_beta = false ; - check_side = false ; ReadingStatus = false ; } @@ -599,7 +568,7 @@ void ThinSi::ConstructDetector(G4LogicalVolume* world) - VolumeMaker(i + 1 , Det_pos , Det_rot , world, m_RightOrLeft[i]); + VolumeMaker(i + 1 , Det_pos , Det_rot , world); } delete Det_rot ;