/*************************************************************************** * 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 musrRootOutput_h #define musrRootOutput_h 1 //#include "G4UserRunAction.hh" #include #include "globals.hh" #include "G4ThreeVector.hh" // ROOT #include "TFile.h" #include "TTree.h" #include "TH1.h" #include "TH2.h" #include "TVectorD.h" // #include #include "G4ios.hh" #include #include #include //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... class musrRootOutput { public: musrRootOutput(); ~musrRootOutput(); static musrRootOutput* GetRootInstance(); public: void BeginOfRunAction(); void EndOfRunAction(); void FillEvent(); void ClearAllRootVariables(); void SetVolumeIDMapping(std::string logivol, int volumeID); G4int ConvertVolumeToID(std::string logivol); G4int ConvertProcessToID(std::string processName); void SetSpecialSaveVolumeDefined() {boolIsAnySpecialSaveVolumeDefined=true;}; // Getting variables (just for debugging) G4double GetDecayPositionZ() {return muDecayPosZ;}; G4double GetDecayTime() {return muDecayTime*CLHEP::microsecond;}; G4double GetTimeInTarget() {return muTargetTime*CLHEP::microsecond;}; // Setting variables common to the whole event: void SetRunID (G4int id) {runID = id;}; void SetEventID (G4int id) {eventID = id;}; void SetTimeToNextEvent(G4double deltaT) {timeToNextEvent = deltaT/CLHEP::microsecond;} void SetDecayDetectorID (std::string detectorName) {muDecayDetID = SensDetectorMapping[detectorName];}; Int_t GetDecayDetectorID() {return muDecayDetID;}; void SetBField (G4double F[6]) {B_t[0]=F[0]/CLHEP::tesla; B_t[1]=F[1]/CLHEP::tesla; B_t[2]=F[2]/CLHEP::tesla; B_t[3]=F[3]/CLHEP::tesla; B_t[4]=F[4]/CLHEP::tesla; B_t[5]=F[5]/CLHEP::tesla;}; void SetDecayPolarisation (G4ThreeVector pol) {muDecayPolX=pol.x(); muDecayPolY=pol.y(); muDecayPolZ=pol.z();}; void SetDecayPosition (G4ThreeVector pos) {muDecayPosX=pos.x()/CLHEP::mm; muDecayPosY=pos.y()/CLHEP::mm; muDecayPosZ=pos.z()/CLHEP::mm;}; void SetEventWeight (G4double w) {weight *= w;} void SetDetectorInfo (G4int nDetectors, G4int ID, G4int particleID, G4double edep, G4double edep_el, G4double edep_pos, G4double edep_gam, G4double edep_mup,G4int nsteps, G4double length, G4double t1, G4double t2, G4double x, G4double y, G4double z, G4double ek, G4double ekVertex, G4double xVertex, G4double yVertex, G4double zVertex, G4int idVolVertex, G4int idProcVertex, G4int idTrackVertex) ; void SetDetectorInfoVvv (G4int nDetectors, G4double ekVertex, G4double xVertex, G4double yVertex, G4double zVertex, G4int idVolVertex, G4int idProcVertex, G4int idTrackVertex, G4int particleID) ; void SetOPSAinfo (G4int nDetectors, G4int ID, G4int nPhot, G4int nPhotPrim, G4double timeFirst, G4double timeSecond, G4double timeThird, G4double timeA, G4double timeB, G4double timeC, G4double timeD, G4double timeMean, G4double timeLast, G4double timeCFD, G4double amplCFD); void SetCFDSpecialInfo (G4int n, G4double time); void SetTimeC1SpecialInfo (G4double* time); void SetSaveDetectorInfo (G4int ID, G4int particleID, G4double ke, G4double x, G4double y, G4double z, G4double time, G4double px, G4double py, G4double pz, G4double polx, G4double poly, G4double polz) ; void SetInitialMuonParameters(G4double x, G4double y, G4double z, G4double px, G4double py, G4double pz, G4double xpolaris, G4double ypolaris, G4double zpolaris, G4double particleTime) { muIniTime=particleTime/CLHEP::microsecond; muIniPosX=x; muIniPosY=y; muIniPosZ=z; muIniMomX=px; muIniMomY=py; muIniMomZ=pz; muIniPolX=xpolaris; muIniPolY=ypolaris; muIniPolZ=zpolaris; } void PrintInitialMuonParameters() { G4cout<<"musrRootOutput.hh: Initial muon parameters: x="< SensDetectorMapping; std::map ProcessIDMapping; }; #endif