|
Updates and Results
Talks and Posters
Advice
Ideas
Important Figures
Write-Ups
Outreach
How-To
Funding Opportunities
GENETIS
|
| Place to document instructions for how to do things |
 |
|
|
Message ID: 33
Entry time: Mon Feb 11 21:58:26 2019
|
| Author: |
Brian Clark |
| Subject: |
Get a quick start with icemc on OSC |
| Project: |
Software |
|
|
Follow the instructions in the attached "getting_started_with_anita.pdf" file to download icemc, compile it, generate results, and plot those results. |
|
|
# .bashrc
source bashrc_anita.sh
# we also want to set two more environment variables that ANITA needs
# you should update ICEMC_SRC_DIR and ICEMC_BUILD_DIR to wherever you
# downloaded icemc too
export ICEMC_SRC_DIR=/path/to/icemc #change this line!
export ICEMC_BUILD_DIR=/path/to/icemc #change this line!
export DYLD_LIBRARY_PATH=${ICEMC_SRC_DIR}:${ICEMC_BUILD_DIR}:${DYLD_LIBRARY_PATH}
|
|
//C++ includes
#include <iostream>
//ROOT includes
#include "TCanvas.h"
#include "TStyle.h"
#include "TH1D.h"
#include "TFile.h"
#include "TTree.h"
using namespace std;
int main(int argc, char *argv[])
{
if(argc<2)
{
cout << "Not enough arguments! Stop run. " << endl;
return -1;
}
/*
we're going to make a histogram, and set some parameters about it's X and Y axes
*/
TH1D *nuflavorint_hist = new TH1D("nuflavorint", "",3,1,4);
nuflavorint_hist->SetTitle("Neutrino Flavors");
nuflavorint_hist->GetXaxis()->SetTitle("Neutrino Flavors (1=e, 2=muon, 3=tau)");
nuflavorint_hist->GetYaxis()->SetTitle("Weigthed Fraction of Total Detected Events");
nuflavorint_hist->GetXaxis()->SetTitleOffset(1.2);
nuflavorint_hist->GetYaxis()->SetTitleOffset(1.2);
nuflavorint_hist->GetXaxis()->CenterTitle();
nuflavorint_hist->GetYaxis()->CenterTitle();
for(int i=1; i < argc; i++)
{ // loop over the input files
//now we are going to load the icefinal.root file and draw in the "passing_events" tree, which stores info
string readfile = string(argv[i]);
TFile *AnitaFile = new TFile(( readfile ).c_str());
cout << "AnitaFile" << endl;
TTree *passing_events = (TTree*)AnitaFile->Get("passing_events");
cout << "Reading AnitaFile..." << endl;
//declare three variables we are going to use later
int num_pass; // number of entries (ultra-neutrinos);
double weight; // weight of neutrino counts;
int nuflavorint; // neutrino flavors;
num_pass = passing_events->GetEntries();
cout << "num_pass is " << num_pass << endl;
/*PRIMARIES VARIABLES*/
//set the "branch" of the tree which stores specific pieces of information
passing_events->SetBranchAddress("weight", &weight);
passing_events->SetBranchAddress("nuflavor", &nuflavorint);
//loop over all the events in the tree
for (int k=0; k <=num_pass; k++)
{
passing_events->GetEvent(k);
nuflavorint_hist->Fill(nuflavorint, weight); //fill the histogram with this value and this weight
} // CLOSE FOR LOOP OVER NUMBER OF EVENTS
} // CLOSE FOR LOOP OVER NUMBER OF INPUT FILES
//set up some parameters to make things loo pretty
gStyle->SetHistFillColor(0);
gStyle->SetHistFillStyle(1);
gStyle->SetHistLineColor(1);
gStyle->SetHistLineStyle(0);
gStyle->SetHistLineWidth(2.5); //Setup plot Style
//make a "canvas" to draw on
TCanvas *c4 = new TCanvas("c4", "nuflavorint", 1100,850);
gStyle->SetOptTitle(1);
gStyle->SetStatX(0.33);
gStyle->SetStatY(0.87);
nuflavorint_hist->Draw("HIST"); //draw on it
//Save Plots
//make the line thicker and then save the result
gStyle->SetHistLineWidth(9);
c4->SaveAs("nuflavorint.png");
gStyle->SetHistLineWidth(2);
c4->SaveAs("nuflavorint.pdf");
delete c4; //clean up
return 0; //return successfully
}
|
|
# .bashrc
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
module load cmake/3.11.4
module load gnu/7.3.0
export CC=`which gcc`
export CXX=`which g++`
export BOOST_ROOT=/fs/project/PAS0654/shared_software/anita/owens_pitzer/build/boost_build
export LD_LIBRARY_PATH=${BOOST_ROOT}/stage/lib:$LD_LIBRARY_PATH
export BOOST_LIB=$BOOST_ROOT/stage/lib
export LD_LIBRARY_PATH=$BOOST_LIB:$LD_LIBRARY_PATH
export ROOTSYS=/fs/project/PAS0654/shared_software/anita/owens_pitzer/build/root
eval 'source /fs/project/PAS0654/shared_software/anita/owens_pitzer/build/root/bin/thisroot.sh'
|
|
|
|