#include <string>
#include <iostream>
#include "TROOT.h"
#include "TFile.h"
#include "TH1D.h"
#include "TProfile.h"
#include "evt/Head.hh"
#include "evt/Evt.hh"
#include "JAAnet/JHead.hh"
#include "JAAnet/JAAnetToolkit.hh"
#include "JDAQ/JDAQEvent.hh"
#include "JAstronomy/JAstronomy.hh"
#include "JAstronomy/JAstronomyToolkit.hh"
#include "JSupport/JTriggeredFileScanner.hh"
#include "JSupport/JMonteCarloFileSupportkit.hh"
#include "JSupport/JSupport.hh"
#include "Jeep/JPrint.hh"
#include "Jeep/JParser.hh"
#include "Jeep/JMessage.hh"
 
Go to the source code of this file.
 | 
| int  | main (int argc, char **argv) | 
|   | 
Example program to plot event rates using JASTRONOMY::JStarTrek. 
- Author
 - mdejong 
 
Definition in file JRate.cc.
 
◆ main()
      
        
          | int main  | 
          ( | 
          int  | 
          argc,  | 
        
        
           | 
           | 
          char **  | 
          argv  | 
        
        
           | 
          ) | 
           |  | 
        
      
 
Definition at line 53 of file JRate.cc.
   59   JTriggeredFileScanner<> inputFile;
 
   63   double         numberOfBlocks;
 
   69     JParser<> zap(
"Example program to plot event rates using JASTRONOMY::JStarTrek.");
 
   73     zap[
'n'] = 
make_field(numberOfEvents)      = JLimit::max();
 
   81   catch(
const exception &error) {
 
   82     FATAL(error.what() << endl);
 
   87   const double radius = 1.0;                                   
 
   88   const double omega  = 2*
PI * (1.0 - cos(radius*
PI/180));     
 
   98   catch(
const JException& error) {
 
  103   double Wall = numberOfBlocks;
 
  108     if (!
is_valid(buffer.genvol) || buffer.genvol.numberOfEvents == 0) {
 
  109       FATAL(
"No generated events." << endl);
 
  112     Wall /= buffer.genvol.numberOfEvents;
 
  114     STATUS(
"Generation: " << buffer.genvol.numberOfEvents << endl);
 
  117       STATUS(
"Solid angle: " << 2 * (buffer.cut_nu.cosTmax - buffer.cut_nu.cosTmin) << 
"pi" << endl);
 
  130   TH1D hc(
"ct [live time]", NULL, 1000, -1.0, +1.0);
 
  132   for (
int i = 1; i != hc.GetNbinsX(); ++i) {
 
  134     const double x = hc.GetBinCenter(i);
 
  135     const double y = startrek(x);
 
  137     hc.SetBinContent(i, y);
 
  140   TH1D h0(
"h0 [background]", NULL, 20, +1.0, +6.0);
 
  141   TH1D h1(
"h1 [signal]",     NULL, 20, +1.0, +6.0);
 
  143   TH1D*  
H[] = { &h0, &h1 };
 
  144   double W[] = { 0.0, 0.0 };
 
  146   for (
int i = 0; i != 
sizeof(
H)/
sizeof(
H[0]); ++i) {
 
  151   while (inputFile.hasNext()) {
 
  153     STATUS(
"event: " << setw(10) << inputFile.getCounter() << 
'\r'); 
DEBUG(endl);
 
  155     JTriggeredFileScanner<>::multi_pointer_type ps = inputFile.next();
 
  158     const Evt*       
event = ps;
 
  164       const double E  = neutrino.E;         
 
  165       const double dz = neutrino.dir.z;     
 
  166       const double P  = 1.0;                
 
  167       const double W2 = 
event->w[1];        
 
  168       const double W3 = 
event->w[2];        
 
  172       const double x   = log10(E);
 
  173       const double y[] = { P * W3 * omega      * startrek(dz),
 
  174                            P * W2 * rxj1713(E) * startrek(dz) };
 
  177         for (
int i = 0; i != 
sizeof(
H)/
sizeof(
H[0]); ++i) {
 
  178           H[i]->Fill(x, y[i] * Wall);   
 
  186   for (
int i = 0; i != 
sizeof(W)/
sizeof(W[0]); ++i) {
 
  187     NOTICE(
"W[" << i << 
"] = " << 
FIXED(9,2) << W[i] << endl);
 
 
 
 
 
static const JSourceLocation RXJ1713(getRadians(-39, -46, 0.0), getHourAngle(17, 13, 7))