/*************************************************************************** * musrSim - the program for the simulation of (mainly) muSR instruments. * * More info on http://lmu.web.psi.ch/simulation/index.html . * * musrSim is based od Geant4 (http://geant4.web.cern.ch/geant4/) * * * * Copyright (C) 2009 by Paul Scherrer Institut, 5232 Villigen PSI, * * Switzerland * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the Free Software * * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * ***************************************************************************/ #ifndef musrScintSD_h #define musrScintSD_h 1 #include "G4VSensitiveDetector.hh" #include "musrScintHit.hh" #include "musrRootOutput.hh" class G4Step; class G4HCofThisEvent; class signalInfo { public: signalInfo(G4int id, G4int nP, G4double tFirst, G4double tA, G4double tB, G4double tC, G4double tD, G4double tE, G4double tLast, G4double tCFD, G4double aCFD) { detID=id; nPhot=nP; timeFirst=tFirst; timeA=tA; timeB=tB; timeC=tC; timeD=tD; timeE=tE; timeLast=tLast; timeCFD=tCFD; amplCFD=aCFD;} ~signalInfo() {} void transferDataToRoot(musrRootOutput* myRootOut, G4int nn) { myRootOut->SetOPSAinfo(nn,detID,nPhot,timeFirst,timeA,timeB,timeC,timeD,timeE,timeLast,timeCFD,amplCFD); } private: G4int detID; G4int nPhot; G4int nPhot_abs; G4int nPhot_refl; G4int nPhot_other; G4double timeFirst; G4double timeA; G4double timeB; G4double timeC; G4double timeD; G4double timeE; G4double timeLast; G4double timeCFD; G4double amplCFD; }; //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... class musrScintSD : public G4VSensitiveDetector { public: static musrScintSD* GetInstance(); musrScintSD(G4String); ~musrScintSD(); void Initialize(G4HCofThisEvent*); G4bool ProcessHits(G4Step*, G4TouchableHistory*); void EndOfEvent(G4HCofThisEvent*); void EndOfRun(); // Optical Photon Signal Analysis (OPSA) void Set_OPSA_minNrOfDetectedPhotons(G4int val) {OPSA_minNrOfDetectedPhotons=val;} void Set_OPSA_SignalSeparationTime(G4double val) {OPSA_signalSeparationTime=val;} void Set_OPSA_variables(G4double a, G4double b, G4double c, G4double d) {OPSA_fracA=a; OPSA_fracB=b; OPSA_C_threshold=c; OPSA_D_threshold=d;} void Set_OPSA_CFD(G4double a1, G4double delay, G4double timeShiftOffset) {OPSA_CFD_a1=a1; OPSA_CFD_delay=delay; OPSA_CFD_timeShiftOffset = timeShiftOffset;} void AddEventIDToMultimapOfEventIDsForOPSAhistos (G4int ev_ID, G4int detector_ID) { bool_multimapOfEventIDsForOPSAhistosEXISTS=true; if (ev_ID==-1) bool_StoreThisOPSAhistSUMMED = true; if (ev_ID==-2) bool_StoreThisOPSAhistALL = true; multimapOfEventIDsForOPSAhistos.insert(std::pair(ev_ID,detector_ID)); } void SetOPSAhistoBinning(Int_t nBins, Double_t min, Double_t max) { OPSAhistoNbin=nBins; OPSAhistoMin=min; OPSAhistoMax=max; OPSAhistoBinWidth=(max-min)/nBins; OPSAhistoBinWidth1000=OPSAhistoBinWidth*1000; } void ProcessOpticalPhoton(G4Step*); void EndOfEvent_OptiacalPhotons(); void ReadInPulseShapeArray(const char* filename); private: static musrScintSD* pointer; musrScintHitsCollection* scintCollection; G4bool myStoreOnlyEventsWithHits; G4int myStoreOnlyEventsWithHitInDetID; G4double mySignalSeparationTime; G4bool myStoreOnlyTheFirstTimeHit; G4bool boolIsVvvInfoRequested; musrRootOutput* myRootOutput; // for optical photon counting typedef std::multimap optHitDetectorMapType; typedef std::map optHitMapType; optHitMapType optHitMap; // for optical photon signal analysis (OPSA) G4int OPSA_minNrOfDetectedPhotons; G4double OPSA_signalSeparationTime; G4double OPSA_fracA; G4double OPSA_fracB; G4double OPSA_C_threshold; G4double OPSA_D_threshold; typedef std::multimap OPSA_signal_MapType; OPSA_signal_MapType OPSA_signal_Map; G4bool bool_multimapOfEventIDsForOPSAhistosEXISTS; G4bool bool_StoreThisOPSAhistSUMMED; G4bool bool_StoreThisOPSAhistALL; typedef std::multimap multimapOfEventIDsForOPSAhistos_Type; multimapOfEventIDsForOPSAhistos_Type multimapOfEventIDsForOPSAhistos; TH1D* OPSAhisto; Int_t OPSAhistoNbin; Double_t OPSAhistoMin, OPSAhistoMax, OPSAhistoBinWidth, OPSAhistoBinWidth1000; typedef std::map mapOfOPSAsumHistograms_Type; mapOfOPSAsumHistograms_Type mapOfOPSAsumHistograms; mapOfOPSAsumHistograms_Type mapOfOPSAsum0Histograms; TH1D* OPSAhistoSUM; TH1D* OPSAhistoSUM0; TH1D* OPSAshape; G4bool bool_pulseShapeExists; G4int iPSmax; G4double pulseShapeArray[10001]; TH1D* OPSA_CFD; G4double OPSA_CFD_a1,OPSA_CFD_delay, OPSA_CFD_timeShiftOffset; }; //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... #endif