/*************************************************************************** * 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) { detID=id; nPhot=nP; timeFirst=tFirst; timeA=tA; timeB=tB; timeC=tC; timeD=tD; timeE=tE; timeLast=tLast;} ~signalInfo() {} void transferDataToRoot(musrRootOutput* myRootOut, G4int nn) { myRootOut->SetOPSAinfo(nn,detID,nPhot,timeFirst,timeA,timeB,timeC,timeD,timeE,timeLast); } 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; }; //....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*); // 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_frac(G4double a, G4double b, G4double c, G4double d, G4double e) {OPSA_fracA=a; OPSA_fracB=b; OPSA_fracC=c; OPSA_fracD=d; OPSA_fracE=e;} void AddEventIDToMultimapOfEventIDsForOPSAhistos (G4int ev_ID, G4int detector_ID) {bool_multimapOfEventIDsForOPSAhistosEXISTS=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;} void ProcessOpticalPhoton(G4Step*); void EndOfEvent_OptiacalPhotons(); 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_fracC; G4double OPSA_fracD; G4double OPSA_fracE; typedef std::multimap OPSA_signal_MapType; OPSA_signal_MapType OPSA_signal_Map; G4bool bool_multimapOfEventIDsForOPSAhistosEXISTS; typedef std::multimap multimapOfEventIDsForOPSAhistos_Type; multimapOfEventIDsForOPSAhistos_Type multimapOfEventIDsForOPSAhistos; TH1D* OPSAhisto; Int_t OPSAhistoNbin; Double_t OPSAhistoMin, OPSAhistoMax; }; //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... #endif