Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-23 09:21:06

0001 //
0002 // ********************************************************************
0003 // * License and Disclaimer                                           *
0004 // *                                                                  *
0005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
0006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
0007 // * conditions of the Geant4 Software License,  included in the file *
0008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
0009 // * include a list of copyright holders.                             *
0010 // *                                                                  *
0011 // * Neither the authors of this software system, nor their employing *
0012 // * institutes,nor the agencies providing financial support for this *
0013 // * work  make  any representation or  warranty, express or implied, *
0014 // * regarding  this  software system or assume any liability for its *
0015 // * use.  Please see the license in the file  LICENSE  and URL above *
0016 // * for the full disclaimer and the limitation of liability.         *
0017 // *                                                                  *
0018 // * This  code  implementation is the result of  the  scientific and *
0019 // * technical work of the GEANT4 collaboration.                      *
0020 // * By using,  copying,  modifying or  distributing the software (or *
0021 // * any work based  on the software)  you  agree  to acknowledge its *
0022 // * use  in  resulting  scientific  publications,  and indicate your *
0023 // * acceptance of all terms of the Geant4 Software license.          *
0024 // ********************************************************************
0025 //
0026 /// \file eventgenerator/exgps/src/HistoManager.cc
0027 /// \brief Implementation of the HistoManager class
0028 //
0029 //
0030 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0031 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0032 
0033 #include "HistoManager.hh"
0034 
0035 #include "G4UnitsTable.hh"
0036 
0037 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0038 
0039 HistoManager::HistoManager() : fFileName("exgps")
0040 {
0041   Book();
0042 }
0043 
0044 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0045 
0046 HistoManager::~HistoManager() {}
0047 
0048 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0049 
0050 void HistoManager::Book()
0051 {
0052   // Create or get analysis manager
0053   // The choice of analysis technology is done via selection of a namespace
0054   // in HistoManager.hh
0055   //
0056   G4AnalysisManager* analysis = G4AnalysisManager::Instance();
0057 
0058   analysis->SetDefaultFileType("root");
0059   analysis->SetFileName(fFileName);
0060   analysis->SetVerboseLevel(1);
0061   analysis->SetActivation(true);  // enable inactivation of histos, nTuples
0062 
0063   // Default values (to be reset via /analysis/h1/set command)
0064   G4int nbins = 100;
0065   G4double vmin = 0.;
0066   G4double vmax = 100.;
0067 
0068   // Create all histograms as inactivated
0069   // as we have not yet set nbins, vmin, vmax
0070   //
0071   analysis->SetHistoDirectoryName("histo");
0072   analysis->SetFirstHistoId(1);
0073 
0074   G4int id = analysis->CreateH1("h1.1", "kinetic energy", nbins, vmin, vmax);
0075   analysis->SetH1Activation(id, false);
0076 
0077   id = analysis->CreateH1("h1.2", "vertex dist dN/dv = f(r)", nbins, vmin, vmax);
0078   analysis->SetH1Activation(id, false);
0079 
0080   id = analysis->CreateH1("h1.3", "direction: cos(theta)", nbins, vmin, vmax);
0081   analysis->SetH1Activation(id, false);
0082 
0083   id = analysis->CreateH1("h1.4", "direction: phi", nbins, vmin, vmax);
0084   analysis->SetH1Activation(id, false);
0085 
0086   // histos 2D
0087   //
0088   id = analysis->CreateH2("h2.1", "vertex: XY", nbins, vmin, vmax, nbins, vmin, vmax);
0089   analysis->SetH2Activation(id, false);
0090 
0091   id = analysis->CreateH2("h2.2", "vertex: YZ", nbins, vmin, vmax, nbins, vmin, vmax);
0092   analysis->SetH2Activation(id, false);
0093 
0094   id = analysis->CreateH2("h2.3", "vertex: ZX", nbins, vmin, vmax, nbins, vmin, vmax);
0095   analysis->SetH2Activation(id, false);
0096 
0097   id =
0098     analysis->CreateH2("h2.4", "direction: phi-cos(theta)", nbins, vmin, vmax, nbins, vmin, vmax);
0099   analysis->SetH2Activation(id, false);
0100 
0101   id = analysis->CreateH2("h2.5", "direction: phi-theta", nbins, vmin, vmax, nbins, vmin, vmax);
0102   analysis->SetH2Activation(id, false);
0103 
0104   // nTuples
0105   //
0106   analysis->SetNtupleDirectoryName("ntuple");
0107   analysis->SetFirstNtupleId(1);
0108   analysis->CreateNtuple("101", "Primary Particle Tuple");
0109   analysis->CreateNtupleIColumn("particleID");  // column 0
0110   analysis->CreateNtupleDColumn("Ekin");  // column 1
0111   analysis->CreateNtupleDColumn("posX");  // column 2
0112   analysis->CreateNtupleDColumn("posY");  // column 3
0113   analysis->CreateNtupleDColumn("posZ");  // column 4
0114   analysis->CreateNtupleDColumn("dirTheta");  // column 5
0115   analysis->CreateNtupleDColumn("dirPhi");  // column 6
0116   analysis->CreateNtupleDColumn("weight");  // column 7
0117   analysis->FinishNtuple();
0118 
0119   analysis->SetNtupleActivation(false);
0120 }
0121 
0122 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......