Functions
generate_sk_flux_histograms.C File Reference
#include <cassert>
#include <iostream>
#include <sstream>
#include <string>
#include <TFile.h>
#include <TChain.h>
#include <TH1D.h>
#include <TMath.h>

Go to the source code of this file.

Functions

void generate_sk_flux_histograms (string flux_dir="./", string file_prefix="nu.sk_flukain.", string file_suffix=".root", int min_run=0, int max_run=499, double Emin=0., double Emax=30., double Ebinsz=0.05)
 

Function Documentation

void generate_sk_flux_histograms ( string  flux_dir = "./",
string  file_prefix = "nu.sk_flukain.",
string  file_suffix = ".root",
int  min_run = 0,
int  max_run = 499,
double  Emin = 0.,
double  Emax = 30.,
double  Ebinsz = 0.05 
)

Definition at line 23 of file generate_sk_flux_histograms.C.

34 {
35  //
36  // chain
37  //
38  TChain chain("h2000", "JNUBEAM SuperK flux ntuples");
39  for(int irun = min_run; irun <= max_run; irun++) {
40  ostringstream file;
41  file << flux_dir << "/" << file_prefix << irun << file_suffix;
42  cout << "Adding file..... : " << file.str() << endl;
43  chain.AddFile(file.str().c_str());
44  }
45 
46  //
47  // book histograms
48  //
49  assert ( Emin<Emax );
50  assert ( Emin>=0. );
51  assert ( Ebinsz>0. );
52  int nbins = TMath::FloorNint((Emax-Emin)/Ebinsz);
53  TH1D * numu_flux = new TH1D("numu_flux", "numu flux at SuperK", nbins, Emin, Emax);
54  TH1D * numubar_flux = new TH1D("numubar_flux", "numubar flux at SuperK", nbins, Emin, Emax);
55  TH1D * nue_flux = new TH1D("nue_flux", "nue flux at SuperK", nbins, Emin, Emax);
56  TH1D * nuebar_flux = new TH1D("nuebar_flux", "nuebar flux at SuperK", nbins, Emin, Emax);
57 
58  //
59  // fill histograms
60  //
61  chain.Draw("Enu>>numu_flux", "norm*(mode>=11 && mode<=19)", "goff");
62  chain.Draw("Enu>>numubar_flux", "norm*(mode>=21 && mode<=29)", "goff");
63  chain.Draw("Enu>>nue_flux", "norm*(mode>=31 && mode<=39)", "goff");
64  chain.Draw("Enu>>nuebar_flux", "norm*(mode>=41 && mode<=49)", "goff");
65 
66  //
67  // save histograms
68  //
69  TFile f("./sk_flux_histograms.root", "recreate");
70  numu_flux -> Write ("numu_flux" );
71  numubar_flux -> Write ("numubar_flux");
72  nue_flux -> Write ("nue_flux" );
73  nuebar_flux -> Write ("nuebar_flux" );
74  f.Close();
75 }
FILE * f
Definition: loadlibs.C:26
the ParameterSet object passed in for the configuration of a destination should be the only source that can affect the behavior of that destination This is to eliminate the dependencies of configuring a destination from multiple mostly from the defaults It suppresses possible glitches about changing the configuration file somewhere outside of a destination segament might still affect the behavior of that destination In the previous configuration for a specific the value of a certain e may come from following and have been suppressed It the configuring ParameterSet object for each destination will be required to carry a parameter list as complete as possible If a parameter still cannot be found in the ParameterSet the configuration code will go look for a hardwired default directly The model is a great simplicity comparing with the previous especially when looking for default values Another great advantage is most of the parameters now have very limited places that allows to appear Usually they can only appear at one certain level in a configuration file For in the old configuring model or in a default ParameterSet object inside of a or in a category or in a severity object This layout of multiple sources for a single parameter brings great confusion in both writing a configuration and in processing the configuration file Under the new the only allowed place for the parameter limit to appear is inside of a category which is inside of a destination object Other improvements simplify the meaning of a destination name In the old a destination name has multiple folds of meanings the e cout and cerr have the special meaning of logging messages to standard output or standard error the name also serves as the output filename if the destination is a file these names are also references to look up for detailed configurations in configuring the MessageFacility The multi purpose of the destination name might cause some unwanted behavior in either writing or parsing the configuration file To amend in the new model the destination name is now merely a name for a which might represent the literal purpose of this or just an id All other meanings of the destinations names now go into the destination ParameterSet as individual such as the type parameter and filename parameter Following is the deatiled rule for the new configuring Everything that is related with MessageFacility configuration must be wrapped in a single ParameterSet object with the name MessageFacility The MessageFacility ParameterSet object contains a series of top level parameters These parameters can be chosen a vector of string listing the name of debug enabled models Or use *to enable debug messages in all modules a vector of string a vector of string a vector of string a ParameterSet object containing the list of all destinations The destinations ParameterSet object is a combination of ParameterSet objects for individual destinations There are two types of destinations that you can insert in the destinations ParameterSet ordinary including cout
double Emax
< separator(=)> module_type Type Source location< separator(-)> DummyAnalyzer analyzer< path > DummyAnalyzer_module cc DummyFilter filter< path > DummyFilter_module cc *DummyProducer producer< path > DummyProducer_module cc *DummyProducer producer< path > DummyProducer_module cc< separator(=)> The modules marked *above are degenerate i e specifying the short module_type value leads to an ambiguity In order to use a degenerate in your configuration file
gm Write()