Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-10-30 07:59:51

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->SetNtupleMerging(true);
0060   analysis->SetFileName(fFileName);
0061   analysis->SetVerboseLevel(1);
0062   analysis->SetActivation(true);  // enable inactivation of histos, nTuples
0063 
0064   // Default values (to be reset via /analysis/h1/set command)
0065   G4int nbins = 100;
0066   G4double vmin = 0.;
0067   G4double vmax = 100.;
0068 
0069   // Create all histograms as inactivated
0070   // as we have not yet set nbins, vmin, vmax
0071   //
0072   analysis->SetHistoDirectoryName("histo");
0073   analysis->SetFirstHistoId(1);
0074 
0075   G4int id = analysis->CreateH1("h1.1", "kinetic energy", nbins, vmin, vmax);
0076   analysis->SetH1Activation(id, false);
0077 
0078   id = analysis->CreateH1("h1.2", "vertex dist dN/dv = f(r)", nbins, vmin, vmax);
0079   analysis->SetH1Activation(id, false);
0080 
0081   id = analysis->CreateH1("h1.3", "direction: cos(theta)", nbins, vmin, vmax);
0082   analysis->SetH1Activation(id, false);
0083 
0084   id = analysis->CreateH1("h1.4", "direction: phi", nbins, vmin, vmax);
0085   analysis->SetH1Activation(id, false);
0086 
0087   // histos 2D
0088   //
0089   id = analysis->CreateH2("h2.1", "vertex: XY", nbins, vmin, vmax, nbins, vmin, vmax);
0090   analysis->SetH2Activation(id, false);
0091 
0092   id = analysis->CreateH2("h2.2", "vertex: YZ", nbins, vmin, vmax, nbins, vmin, vmax);
0093   analysis->SetH2Activation(id, false);
0094 
0095   id = analysis->CreateH2("h2.3", "vertex: ZX", nbins, vmin, vmax, nbins, vmin, vmax);
0096   analysis->SetH2Activation(id, false);
0097 
0098   id =
0099     analysis->CreateH2("h2.4", "direction: phi-cos(theta)", nbins, vmin, vmax, nbins, vmin, vmax);
0100   analysis->SetH2Activation(id, false);
0101 
0102   id = analysis->CreateH2("h2.5", "direction: phi-theta", nbins, vmin, vmax, nbins, vmin, vmax);
0103   analysis->SetH2Activation(id, false);
0104 
0105   // nTuples
0106   //
0107   analysis->SetNtupleDirectoryName("ntuple");
0108   analysis->SetFirstNtupleId(1);
0109   analysis->CreateNtuple("101", "Primary Particle Tuple");
0110   analysis->CreateNtupleIColumn("particleID");  // column 0
0111   analysis->CreateNtupleDColumn("Ekin");  // column 1
0112   analysis->CreateNtupleDColumn("posX");  // column 2
0113   analysis->CreateNtupleDColumn("posY");  // column 3
0114   analysis->CreateNtupleDColumn("posZ");  // column 4
0115   analysis->CreateNtupleDColumn("dirTheta");  // column 5
0116   analysis->CreateNtupleDColumn("dirPhi");  // column 6
0117   analysis->CreateNtupleDColumn("weight");  // column 7
0118   analysis->FinishNtuple();
0119 
0120   analysis->SetNtupleActivation(false);
0121 }
0122 
0123 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......