Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-03-30 07:50:13

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 HistoManager.cc
0027 /// \brief Implementation of the HistoManager class
0028 
0029 #include "HistoManager.hh"
0030 
0031 #include "G4UnitsTable.hh"
0032 
0033 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0034 
0035 HistoManager::HistoManager() : fFileName("exgps")
0036 {
0037   Book();
0038 }
0039 
0040 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0041 
0042 HistoManager::~HistoManager() {}
0043 
0044 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0045 
0046 void HistoManager::Book()
0047 {
0048   // Create or get analysis manager
0049   //
0050   G4AnalysisManager* analysis = G4AnalysisManager::Instance();
0051 
0052   analysis->SetDefaultFileType("root");
0053   analysis->SetNtupleMerging(true);
0054   analysis->SetFileName(fFileName);
0055   analysis->SetVerboseLevel(1);
0056   analysis->SetActivation(true);  // enable inactivation of histos, nTuples
0057 
0058   // Default values (to be reset via /analysis/h1/set command)
0059   G4int nbins = 100;
0060   G4double vmin = 0.;
0061   G4double vmax = 100.;
0062 
0063   // Create all histograms as inactivated
0064   // as we have not yet set nbins, vmin, vmax
0065   //
0066   analysis->SetHistoDirectoryName("histo");
0067   analysis->SetFirstHistoId(1);
0068 
0069   G4int id = analysis->CreateH1("h1.1", "kinetic energy", nbins, vmin, vmax);
0070   analysis->SetH1Activation(id, false);
0071 
0072   id = analysis->CreateH1("h1.2", "vertex dist dN/dv = f(r)", nbins, vmin, vmax);
0073   analysis->SetH1Activation(id, false);
0074 
0075   id = analysis->CreateH1("h1.3", "direction: cos(theta)", nbins, vmin, vmax);
0076   analysis->SetH1Activation(id, false);
0077 
0078   id = analysis->CreateH1("h1.4", "direction: phi", nbins, vmin, vmax);
0079   analysis->SetH1Activation(id, false);
0080 
0081   // histos 2D
0082   //
0083   id = analysis->CreateH2("h2.1", "vertex: XY", nbins, vmin, vmax, nbins, vmin, vmax);
0084   analysis->SetH2Activation(id, false);
0085 
0086   id = analysis->CreateH2("h2.2", "vertex: YZ", nbins, vmin, vmax, nbins, vmin, vmax);
0087   analysis->SetH2Activation(id, false);
0088 
0089   id = analysis->CreateH2("h2.3", "vertex: ZX", nbins, vmin, vmax, nbins, vmin, vmax);
0090   analysis->SetH2Activation(id, false);
0091 
0092   id =
0093     analysis->CreateH2("h2.4", "direction: phi-cos(theta)", nbins, vmin, vmax, nbins, vmin, vmax);
0094   analysis->SetH2Activation(id, false);
0095 
0096   id = analysis->CreateH2("h2.5", "direction: phi-theta", nbins, vmin, vmax, nbins, vmin, vmax);
0097   analysis->SetH2Activation(id, false);
0098 
0099   // nTuples
0100   //
0101   analysis->SetNtupleDirectoryName("ntuple");
0102   analysis->SetFirstNtupleId(1);
0103   analysis->CreateNtuple("101", "Primary Particle Tuple");
0104   analysis->CreateNtupleIColumn("particleID");  // column 0
0105   analysis->CreateNtupleDColumn("Ekin");  // column 1
0106   analysis->CreateNtupleDColumn("posX");  // column 2
0107   analysis->CreateNtupleDColumn("posY");  // column 3
0108   analysis->CreateNtupleDColumn("posZ");  // column 4
0109   analysis->CreateNtupleDColumn("dirTheta");  // column 5
0110   analysis->CreateNtupleDColumn("dirPhi");  // column 6
0111   analysis->CreateNtupleDColumn("weight");  // column 7
0112   analysis->FinishNtuple();
0113 
0114   analysis->SetNtupleActivation(false);
0115 }
0116 
0117 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......