/*************************************************************************** * 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 "globals.hh" #include "G4ThreeVector.hh" // ROOT #include "TFile.h" #include "TTree.h" #include "TH1.h" #include "TH2.h" #include "TVectorD.h" // #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_t;}; G4double GetDecayTime() {return muDecayTime_t*microsecond;}; G4double GetTimeInTarget() {return muTargetTime_t*microsecond;}; // Setting variables common to the whole event: void SetRunID (G4int id) {runID_t = id;}; void SetEventID (G4int id) {eventID_t = id;}; void SetDecayDetectorID (std::string detectorName) {muDecayDetID_t = SensDetectorMapping[detectorName];}; void SetBField (G4double F[6]) {B_t[0]=F[0]/tesla; B_t[1]=F[1]/tesla; B_t[2]=F[2]/tesla; B_t[3]=F[3]/tesla; B_t[4]=F[4]/tesla; B_t[5]=F[5]/tesla;}; void SetDecayPolarisation (G4ThreeVector pol) {muDecayPolX_t=pol.x(); muDecayPolY_t=pol.y(); muDecayPolZ_t=pol.z();}; void SetDecayPosition (G4ThreeVector pos) {muDecayPosX_t=pos.x()/mm; muDecayPosY_t=pos.y()/mm; muDecayPosZ_t=pos.z()/mm;}; void SetEventWeight (G4double w) {weight_t *= 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 SetSaveDetectorInfo (G4int ID, G4int particleID, G4double ke, G4double x, G4double y, G4double z, G4double px, G4double py, G4double pz) ; void SetInitialMuonParameters(G4double x, G4double y, G4double z, G4double px, G4double py, G4double pz, G4double xpolaris, G4double ypolaris, G4double zpolaris, G4double particleTime) { muIniTime_t=particleTime/microsecond; muIniPosX_t=x; muIniPosY_t=y; muIniPosZ_t=z; muIniMomX_t=px; muIniMomY_t=py; muIniMomZ_t=pz; muIniPolX_t=xpolaris; muIniPolY_t=ypolaris; muIniPolZ_t=zpolaris; } void PrintInitialMuonParameters() { G4cout<<"musrRootOutput.hh: Initial muon parameters: x="< SensDetectorMapping; std::map ProcessIDMapping; }; #endif