diff --git a/NPLib/Calibration/NPSiliconCalibrator.cxx b/NPLib/Calibration/NPSiliconCalibrator.cxx index cbd560560eb0a5a1495a9bbdc59e22022ad5b654..14c714550243103c99b34801544a826866b7c604 100644 --- a/NPLib/Calibration/NPSiliconCalibrator.cxx +++ b/NPLib/Calibration/NPSiliconCalibrator.cxx @@ -8,6 +8,13 @@ using namespace std; #include "TSpectrum.h" #include "TH1.h" +namespace { +#if ROOT_VERSION_CODE > ROOT_VERSION(6,0,0) + typedef Double_t* TSpectrumPosition_t; +#else + typedef Float_t* TSpectrumPosition_t; +#endif +} NPL::SiliconCalibrator::SiliconCalibrator(){ } @@ -210,10 +217,10 @@ TGraphErrors* NPL::SiliconCalibrator::FitSpectrum(TH1* histo, double rmin, doubl // apply range for peak search histo->GetXaxis()->SetRangeUser(rmin, rmax); // Perform a peak search to get a hint of where are the peaks - TSpectrum* sp = new TSpectrum(4,1); + TSpectrum sp(4,1); // nfound = sp->Search(histo,3,"",0.25); - Int_t nfound = sp->Search(histo,3,"",0.5); - Float_t* xpeaks =(Float_t*) sp->GetPositionX(); + Int_t nfound = sp.Search(histo,3,"",0.5); + TSpectrumPosition_t xpeaks = sp.GetPositionX(); // order list of peaks sort(xpeaks, xpeaks+nfound); diff --git a/NPLib/Core/NPOptionManager.cxx b/NPLib/Core/NPOptionManager.cxx index 55f18653826b6a2da65c5f29ef3433c2d55533e7..8ec2720fc387a08a3c3141755a62cc1bceb2f59f 100644 --- a/NPLib/Core/NPOptionManager.cxx +++ b/NPLib/Core/NPOptionManager.cxx @@ -200,6 +200,7 @@ NPOptionManager::NPOptionManager(string arg){ void NPOptionManager::CheckArguments(){ CheckEventGenerator(); CheckDetectorConfiguration(); + CheckG4Macro(); } //////////////////////////////////////////////////////////////////////////////// @@ -263,6 +264,21 @@ void NPOptionManager::CheckDetectorConfiguration(){ } +//////////////////////////////////////////////////////////////////////////////// +void NPOptionManager::CheckG4Macro(){ + if(IsDefault("G4MacroPath")) + return ; + + // ifstream to configfile + ifstream MacroFile( fG4MacroPath ); + + if (!MacroFile.is_open()) { + SendErrorAndExit("G4MacroPath"); + } + +} + + //////////////////////////////////////////////////////////////////////////////// // This method tests if the input files are the default ones @@ -324,6 +340,15 @@ void NPOptionManager::SendErrorAndExit(const char* type) const{ } else if (stype == "RunToTreat") { } + else if (stype == "G4MacroPath") { + cout << endl; + cout << "*********************************** Error ***********************************" << endl; + cout << "* No Geant4 macro file found in the provided path *" << endl; + cout << "*****************************************************************************************" << endl; + cout << endl; + exit(1); + } + else { cout << "NPOptionManager::SendErrorAndExit() unkwown keyword" << endl; } diff --git a/NPLib/Core/NPOptionManager.h b/NPLib/Core/NPOptionManager.h index b6b6308ddd4aef4c1b07ef590a4c780a18f7b2e5..dc9941ceb5713793ee615f1a02f4ef7179de8e82 100644 --- a/NPLib/Core/NPOptionManager.h +++ b/NPLib/Core/NPOptionManager.h @@ -71,6 +71,7 @@ class NPOptionManager{ void CheckArguments(); void CheckEventGenerator(); void CheckDetectorConfiguration(); + void CheckG4Macro(); public: bool IsDefault(const char* type) const; diff --git a/NPSimulation/Core/SiliconScorers.hh b/NPSimulation/Core/SiliconScorers.hh index 64fa254b15293515f360f4d39adc5b39db2a3daf..68127d0a06492da74642ba69d52d244e30b870c6 100644 --- a/NPSimulation/Core/SiliconScorers.hh +++ b/NPSimulation/Core/SiliconScorers.hh @@ -32,13 +32,27 @@ using namespace std; using namespace CLHEP; namespace SILICONSCORERS { -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... +//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... + + struct RectangularOutput { + G4double totalEnergy; + G4double globalTime; + G4double x; + G4double y; + G4double z; + G4double theta; + G4double phi; + G4double detectorNumber; + G4double stripLengthNumber; + G4double stripWidthNumber; + }; + class PS_Silicon_Rectangle : public G4VPrimitiveScorer{ public: // with description PS_Silicon_Rectangle(G4String name, G4int Level, G4double StripPlaneLength, G4double StripPlaneWidth, G4int NumberOfStripLength,G4int NumberOfStripWidth,G4int depth=0,G4String axis="xy"); ~PS_Silicon_Rectangle(); - + protected: // with description G4bool ProcessHits(G4Step*, G4TouchableHistory*); @@ -74,6 +88,21 @@ namespace SILICONSCORERS { }; //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... + + struct AnnularOutput { + G4double totalEnergy; + G4double globalTime; + G4double x; + G4double y; + G4double z; + G4double theta; + G4double phi; + G4double detectorNumber; + G4double stripRingNumber; + G4double stripSectorNumber; + G4double stripQuadrantNumber; + }; + class PS_Silicon_Annular : public G4VPrimitiveScorer{ public: // with description @@ -120,6 +149,19 @@ namespace SILICONSCORERS { }; //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... + struct ResistiveOutput { + G4double upstreamEnergy; + G4double downstreamEnergy; + G4double globalTime; + G4double detectorNumber; + G4double stripWidthNumber; + G4double x; + G4double y; + G4double z; + G4double theta; + G4double phi; + }; + class PS_Silicon_Resistive : public G4VPrimitiveScorer{ public: // with description