diff --git a/Examples/Example1/Analysis.cxx b/Examples/Example1/Analysis.cxx index b2690b0818df161750fe820eb0cdc5cb68f9c3df..a316f6be2d3d4a1e1ea3f7bea1ffea7993ffc52d 100644 --- a/Examples/Example1/Analysis.cxx +++ b/Examples/Example1/Analysis.cxx @@ -63,7 +63,7 @@ void Analysis::Init(){ He3CD2 = EnergyLoss("Example/He3_CD2.G4table","G4Table",100 ); He3Al = EnergyLoss("Example/He3_Al.G4table","G4Table",10); He3Si = EnergyLoss("Example/He3_Si.G4table","G4Table",10); - //Li11CD2 = EnergyLoss("ExampleLi11_CD2.G4table","G4Table",100); + Li11CD2 = EnergyLoss("Example/Li11_CD2.G4table","G4Table",100); } //////////////////////////////////////////////////////////////////////////////// @@ -79,7 +79,7 @@ void Analysis::TreatEvent(){ TVector3 BeamDirection = Initial->GetBeamDirection(); // Beam energy is measured using F3 and F2 plastic TOF double BeamEnergy = Rand.Gaus(Initial->GetIncidentInitialKineticEnergy(),4.5); - //BeamEnergy = Li11CD2.Slow(BeamEnergy,TargetThickness/2.,0); + BeamEnergy = Li11CD2.Slow(BeamEnergy,TargetThickness/2.,0); He10Reaction->SetBeamEnergy(BeamEnergy); //////////////////////////// LOOP on MUST2 + SSSD Hit ////////////////// diff --git a/Examples/Example1/ShowResults.C b/Examples/Example1/ShowResults.C index 9168863302ea8510128edcb2b9a27ed53e3affe8..5e3ba7044980261e77cd56cce35e6eaa8e705341 100644 --- a/Examples/Example1/ShowResults.C +++ b/Examples/Example1/ShowResults.C @@ -32,11 +32,14 @@ void ShowResults(){ // E-DE c1->cd(1); chain->Draw("SSSD.Energy:MUST2.Si_E>>hIDE(1000,0,35,1000,0,5)","MUST2.CsI_E<0 && MUST2.TelescopeNumber<5","colz"); + EDE->Draw("same"); // E-TOF c1->cd(2); - chain->Draw("-MUST2.Si_T:SSSD.Energy+MUST2.Si_E>>hIDT(1000,0,35,1000,-15,0)","MUST2.CsI_E<0 && MUST2.TelescopeNumber<5","colz"); + chain->Draw("-MUST2.Si_T:SSSD.Energy+MUST2.Si_E>>hIDT(1000,0,35,1000,-30,0)","MUST2.CsI_E<0 && MUST2.TelescopeNumber<5","colz"); + + ETOF->Draw("same"); // Kinematical Line // diff --git a/Examples/Example1/cuts/ETOF.root b/Examples/Example1/cuts/ETOF.root index 462bead6ba3db3a5e7e68426a892a94f0aa23d75..067d548e7c6f2d4adc224047d2a23700cc380032 100644 Binary files a/Examples/Example1/cuts/ETOF.root and b/Examples/Example1/cuts/ETOF.root differ diff --git a/Inputs/EventGenerator/alpha.source b/Inputs/EventGenerator/alpha.source index 2f871a6b62f1646ac4dca1715f4a8f6fa5289520..b01a3a158a752d5b5f14d9fe656ae699f063b5ae 100644 --- a/Inputs/EventGenerator/alpha.source +++ b/Inputs/EventGenerator/alpha.source @@ -10,7 +10,7 @@ Isotropic HalfOpenAngleMax= 180 deg x0= 0 mm y0= 0 mm - z0= -110 mm + z0= 0 mm Particle= alpha ExcitationEnergy= 0 MeV diff --git a/NPLib/Detectors/Plastic/TPlasticData.h b/NPLib/Detectors/Plastic/TPlasticData.h index 7de7f9c816d4947ccad99779ac804d7831678d82..ff9b235cea1a2e6001cc44b83468d62cd01e6a01 100644 --- a/NPLib/Detectors/Plastic/TPlasticData.h +++ b/NPLib/Detectors/Plastic/TPlasticData.h @@ -51,17 +51,14 @@ class TPlasticData : public TObject { //Mult // E - inline double GetEnergyMult() const { return fPlastic_Energy.size() ;} - // (T) - inline double GetTimeMult() const { return fPlastic_Time.size() ;} - // (N) - inline int GetPlasticNumberMult() const { return fPlastic_Number.size() ;} + inline double GetMult() const { return fPlastic_Energy.size() ;} ///////////////////// SETTERS //////////////////////// // (E) - inline void SetEnergy(const double& E) { fPlastic_Energy.push_back(E) ;} - inline void SetTime(const double& T) { fPlastic_Time.push_back(T) ;} - inline void SetPlasticNumber(const int& N) { fPlastic_Number.push_back(N) ;} + inline void SetEnergyAndTime(const int& N, const double& E, const double& T) + { fPlastic_Energy.push_back(E); + fPlastic_Time.push_back(T) ; + fPlastic_Number.push_back(N); } // ClassDef(TPlasticData,1) // PlasticData structure }; diff --git a/NPLib/Detectors/Plastic/TPlasticPhysics.cxx b/NPLib/Detectors/Plastic/TPlasticPhysics.cxx index dd6894114e730a324c3c4e0334bdafb1cd613f89..26fb3d7119dd4b4d55ebc11b9553d4d3f87d481e 100644 --- a/NPLib/Detectors/Plastic/TPlasticPhysics.cxx +++ b/NPLib/Detectors/Plastic/TPlasticPhysics.cxx @@ -139,14 +139,11 @@ void TPlasticPhysics::ReadConfiguration(NPL::InputParser parser) { } /////////////////////////////////////////////////////////////////////////// -void TPlasticPhysics::AddParameterToCalibrationManager() -{ +void TPlasticPhysics::AddParameterToCalibrationManager(){ CalibrationManager* Cal = CalibrationManager::getInstance(); - for(int i = 0 ; i < NumberOfDetector ; i++) - { - for( int j = 0 ; j < 16 ; j++) - { + for(int i = 0 ; i < NumberOfDetector ; i++){ + for( int j = 0 ; j < 16 ; j++){ Cal->AddParameter("Plastic", "Detector"+ NPL::itoa(i+1)+"_E","Plastic_Detector"+ NPL::itoa(i+1)+"_E") ; Cal->AddParameter("Plastic", "Detector"+ NPL::itoa(i+1)+"_T","Plastic_Detector"+ NPL::itoa(i+1)+"_T") ; } @@ -155,16 +152,14 @@ void TPlasticPhysics::AddParameterToCalibrationManager() } /////////////////////////////////////////////////////////////////////////// -void TPlasticPhysics::InitializeRootInputRaw() -{ - TChain* inputChain = RootInput::getInstance()->GetChain() ; - inputChain->SetBranchStatus ( "Plastic" , true ) ; - inputChain->SetBranchStatus ( "fPlastic_*" , true ) ; - inputChain->SetBranchAddress( "Plastic" , &EventData ) ; +void TPlasticPhysics::InitializeRootInputRaw() { + TChain* inputChain = RootInput::getInstance()->GetChain(); + inputChain->SetBranchStatus ( "Plastic" , true ); + inputChain->SetBranchStatus ( "fPlastic_*", true ); + inputChain->SetBranchAddress( "Plastic" , &EventData ); } /////////////////////////////////////////////////////////////////////////// -void TPlasticPhysics::InitializeRootInputPhysics() -{ +void TPlasticPhysics::InitializeRootInputPhysics(){ TChain* inputChain = RootInput::getInstance()->GetChain(); inputChain->SetBranchStatus ( "Plastic", true ); inputChain->SetBranchStatus ( "DetectorNumber", true ); @@ -173,31 +168,27 @@ void TPlasticPhysics::InitializeRootInputPhysics() inputChain->SetBranchAddress( "Plastic", &EventPhysics ); } /////////////////////////////////////////////////////////////////////////// -void TPlasticPhysics::InitializeRootOutput() -{ - TTree* outputTree = RootOutput::getInstance()->GetTree() ; +void TPlasticPhysics::InitializeRootOutput(){ + TTree* outputTree = RootOutput::getInstance()->GetTree(); outputTree->Branch( "Plastic" , "TPlasticPhysics" , &EventPhysics ) ; } /////////////////////////////////////////////////////////////////////////// -void TPlasticPhysics::BuildPhysicalEvent() -{ - BuildSimplePhysicalEvent() ; +void TPlasticPhysics::BuildPhysicalEvent(){ + BuildSimplePhysicalEvent(); } /////////////////////////////////////////////////////////////////////////// -void TPlasticPhysics::BuildSimplePhysicalEvent() -{ - for(unsigned int i = 0 ; i < EventData->GetEnergyMult() ; i++) - { - DetectorNumber.push_back( EventData->GetPlasticNumber(i) ) ; +void TPlasticPhysics::BuildSimplePhysicalEvent(){ + unsigned int size = EventData->GetMult(); + for(unsigned int i = 0 ; i < size ; i++){ + DetectorNumber.push_back(EventData->GetPlasticNumber(i)); static string str; - str = "Plastic/Detector" + NPL::itoa( EventData->GetPlasticNumber(i) ) +"_E"; - Energy.push_back(CalibrationManager::getInstance()->ApplyCalibration(str ,EventData->GetEnergy(i) ) ); - str = "Plastic/Detector" + NPL::itoa( EventData->GetPlasticNumber(i) ) +"_T"; - Time.push_back(CalibrationManager::getInstance()->ApplyCalibration(str ,EventData->GetTime(i) ) ); - } - + str = "Plastic/Detector" + NPL::itoa(EventData->GetPlasticNumber(i)) +"_E"; + Energy.push_back(CalibrationManager::getInstance()->ApplyCalibration(str ,EventData->GetEnergy(i))); + str = "Plastic/Detector" + NPL::itoa(EventData->GetPlasticNumber(i)) +"_T"; + Time.push_back(CalibrationManager::getInstance()->ApplyCalibration(str ,EventData->GetTime(i))); + } } //////////////////////////////////////////////////////////////////////////////// diff --git a/NPSimulation/Detectors/Plastic/Plastic.cc b/NPSimulation/Detectors/Plastic/Plastic.cc index ec9b2c7d063fb9e9c10fd00abdc46eae5f6f300e..1eeb8c92be4cc0f59a1da55e15a5732586d07ff2 100644 --- a/NPSimulation/Detectors/Plastic/Plastic.cc +++ b/NPSimulation/Detectors/Plastic/Plastic.cc @@ -404,22 +404,25 @@ void Plastic::ReadSensitive(const G4Event* event){ G4int sizeN = DetectorNumberHitMap->entries() ; G4int sizeE = EnergyHitMap->entries() ; G4int sizeT = TimeHitMap->entries() ; + vector<double> energy; + vector<double> time; + vector<int> det; + + // Loop on Plastic Number for (G4int l = 0 ; l < sizeN ; l++) { G4int N = *(DetectorNumber_itr->second) ; G4int NTrackID = DetectorNumber_itr->first - N ; - - - if (N > 0) { - m_Event->SetPlasticNumber(N) ; + if (N > 0) { + det.push_back(N); // Energy Energy_itr = EnergyHitMap->GetMap()->begin(); for (G4int h = 0 ; h < sizeE ; h++) { G4int ETrackID = Energy_itr->first - N ; G4double E = *(Energy_itr->second) ; if (ETrackID == NTrackID) { - m_Event->SetEnergy(RandGauss::shoot(E, E*ResoEnergy/100./2.35)) ; + energy.push_back(RandGauss::shoot(E, E*ResoEnergy/100./2.35)) ; } Energy_itr++; } @@ -431,7 +434,7 @@ void Plastic::ReadSensitive(const G4Event* event){ G4int TTrackID = Time_itr->first - N ; G4double T = *(Time_itr->second) ; if (TTrackID == NTrackID) { - m_Event->SetTime(RandGauss::shoot(T, ResoTime)) ; + time.push_back(RandGauss::shoot(T, ResoTime)) ; } Time_itr++; } @@ -481,9 +484,13 @@ void Plastic::ReadSensitive(const G4Event* event){ } } - DetectorNumber_itr++; } + unsigned int size=energy.size(); + for(unsigned int i = 0 ; i < size ; i++){ + m_Event->SetEnergyAndTime(det[i],energy[i],time[i]); + } + // clear map for next event TimeHitMap->clear() ; diff --git a/NPSimulation/Process/BeamReaction.cc b/NPSimulation/Process/BeamReaction.cc index a55b2b36d852d2ab867d8588cf249c742707ab6d..2a089a8c069b552faefeab9872a5d7bad8dc5c92 100644 --- a/NPSimulation/Process/BeamReaction.cc +++ b/NPSimulation/Process/BeamReaction.cc @@ -152,14 +152,8 @@ void NPS::BeamReaction::DoIt(const G4FastTrack& fastTrack,G4FastStep& fastStep) m_Reaction.ShootRandomExcitationEnergy(); // Use to clean up the IonTable in case of the Ex changing at every event - static G4ParticleDefinition* previousHeavy=0; - if(previousHeavy) - delete previousHeavy; - // IonTable->Remove(previousHeavy); - G4ParticleDefinition* HeavyName = IonTable->GetIon(HeavyZ, HeavyA, m_Reaction.GetExcitation4()*MeV); - //cout << IonTable->Entries()<< endl; // Set the Energy of the reaction m_Reaction.SetBeamEnergy(energy); @@ -225,8 +219,4 @@ void NPS::BeamReaction::DoIt(const G4FastTrack& fastTrack,G4FastStep& fastStep) // Reinit for next event m_PreviousEnergy=0 ; m_PreviousLength=0 ; - //previousHeavy=HeavyName; - //IonTable->fIonList->begin()->second->Mass(); - //IonTable->fIonList->erase(IonTable->fIonList->begin()); - } diff --git a/NPSimulation/Scorers/ObsoleteGeneralScorers.cc b/NPSimulation/Scorers/ObsoleteGeneralScorers.cc index 558119d59bbd821dd22ed7ac4e72b83f97a8e87d..6bfbc2d8c0ebbf3573b668732397d567565b20fb 100644 --- a/NPSimulation/Scorers/ObsoleteGeneralScorers.cc +++ b/NPSimulation/Scorers/ObsoleteGeneralScorers.cc @@ -200,10 +200,10 @@ G4bool PSTOF::ProcessHits(G4Step* aStep, G4TouchableHistory*) int DetNumber = PickUpDetectorNumber(aStep, m_VolumeName); G4double TOF = aStep->GetPreStepPoint()->GetGlobalTime(); - G4double de = aStep->GetTotalEnergyDeposit(); + // G4double de = aStep->GetTotalEnergyDeposit(); G4int index = aStep->GetTrack()->GetTrackID(); - if(de < TriggerThreshold) - return FALSE; + // if(de < TriggerThreshold) + // return FALSE; EvtMap->set(index+DetNumber, TOF); return TRUE; }