BRAT 2.4.5
Class index
Full class index
brahmlib
BRAHMS
ROOT page
//____________________________________________________________________
// 
// Module to copy BRAG header to output.  Histograms of the primary
// vertexs Z-coordinate and of the impact parameter is also
// generated. 
// 

//____________________________________________________________________
//
// $Id: BrBragHeaderModule.cxx,v 1.2 2001/08/24 18:45:07 cholm Exp $
// $Author: cholm $
// $Date: 2001/08/24 18:45:07 $
// $Copyright: (C) 2001 BRAHMS Collaboration <brahmlib@rhic.bnl.gov>
//
#ifndef BRAT_BrBragHeaderModule
#include "BrBragHeaderModule.h"
#endif
#ifndef ROOT_TDirectory
#include "TDirectory.h"
#endif
#ifndef WIN32
#include <iostream>
#else
#include <iostream.h>
#endif
#ifndef BRAT_BrGeantHeader
#include "BrGeantHeader.h"
#endif

//____________________________________________________________________
ClassImp(BrBragHeaderModule);

//____________________________________________________________________
 BrBragHeaderModule::BrBragHeaderModule()
{
  // Default constructor. DO NOT USE
  SetState(kSetup);
}
//____________________________________________________________________
 BrBragHeaderModule::BrBragHeaderModule(const Char_t* name, const Char_t* title)
  : BrModule(name, title)
{
  // Named Constructor
  SetState(kSetup);
}

//____________________________________________________________________
 void BrBragHeaderModule::DefineHistograms()
{
  // Define histograms. They are:
  // <fill in here>

  if (GetState() != kInit) {
    Stop("DefineHistograms", "Must be called after Init"); 
    return;  
  }

  TDirectory* saveDir = gDirectory; 
  TDirectory* histDir = gDirectory->mkdir(GetName()); 
  histDir->cd();

  // Make histograms here 
  fVertexHist = new TH1F("vertexHist", "Vertex distribution", 
			 100, -100, 100); 
  fVertexHist->SetXTitle("V_{z} [cm]");
  fVertexHist->SetYTitle("#frac{dN}{dV_{z}}");
  fBHist      = new TH1F("bHist", "Impact parameter distribution", 
			 20, 0, 20); 
  fBHist->SetXTitle("b [fm]"); 
  fBHist->SetYTitle("#frac{dN}{db}"); 

  gDirectory = saveDir;
}

//____________________________________________________________________
 void BrBragHeaderModule::Event(BrEventNode* inNode, BrEventNode* outNode)
{
  // Per event method
  // Copy the BrGeantHeader from the input to the output BrEventNode 
  SetState(kEvent);
  BrGeantHeader* inHeader = 
    (BrGeantHeader*)inNode->GetObject("GeantHeader");
  if (!inHeader) {
    Stop("Event", "no header from BRAG found");
    return;
  }

  BrGeantHeader* outHeader = 
    new BrGeantHeader("GeantHeader", "Header from BRAG");
  outHeader->SetVertex(inHeader->GetVertex());
  outHeader->SetImpactParameter(inHeader->GetImpactParameter());
  outNode->AddObject(outHeader);

  if (HistOn()) {
    fVertexHist->Fill(inHeader->GetVertex());
    fBHist->Fill(inHeader->GetImpactParameter());
  }
}

//____________________________________________________________________
 void BrBragHeaderModule::Print(Option_t* option) const
{
  // Print module information
  // See BrModule::Print for options.
  // In addition this module defines the Option:
  // <fill in here>

  TString opt(option);
  opt.ToLower(); 
  
  BrModule::Print(option); 
  if (opt.Contains("d")) 
   cout << endl 
         << "  Original author: Christian Holm Christensen" << endl
         << "  Last Modifications: " << endl 
         << "    $Author: cholm $" << endl  
         << "    $Date: 2001/08/24 18:45:07 $"   << endl 
         << "    $Revision: 1.2 $ " << endl  
         << endl 
         << "-------------------------------------------------" << endl;
}

//____________________________________________________________________
//
// $Log: BrBragHeaderModule.cxx,v $
// Revision 1.2  2001/08/24 18:45:07  cholm
// Fixed.
//
// Revision 1.1  2001/08/10 14:30:27  cholm
// Added module to copy BRAG header to output.  Histograms of the primary
// vertexs Z-coordinate and of the impact parameter is also
// generated.
//
//

This page automatically generated by script docBrat by Christian Holm

Copyright ; 2002 BRAHMS Collaboration <brahmlib@rcf.rhic.bnl.gov>
Last Update on by

Validate HTML
Validate CSS