[Brahms-dev-l] issue with proof

From: Johnson, Erik B <ebj@ku.edu>
Date: Fri Jan 13 2006 - 02:07:11 EST
Brahms,
   Can someone help me out here?  I don't know if Eun-Joo solved her problem, but I have the same exact issue.  No histograms are stored.  My best guess is that there is some problem between fOutput and the output file.  Here is my code, if anyone knows what the problem is
 
#define ResCor_Selector_cxx
// The class definition in ResCor_Selector.h has been generated automatically
// by the ROOT utility TTree::MakeSelector(). This class is derived
// from the ROOT class TSelector. For more information on the TSelector
// framework see $ROOTSYS/README/README.SELECTOR or the ROOT User Manual.
// The following methods are defined in this file:
//    Begin():        called everytime a loop on the tree starts,
//                    a convenient place to create your histograms.
//    SlaveBegin():   called after Begin(), when on PROOF called only on the
//                    slave servers.
//    Process():      called for each event, in this function you decide what
//                    to read and fill your histograms.
//    SlaveTerminate: called at the end of the loop on the tree, when on PROOF
//                    called only on the slave servers.
//    Terminate():    called at the end of the loop on the tree,
//                    a convenient place to draw/fit your histograms.
//
// To use this file, try the following session on your Tree T:
//
// Root > T->Process("ResCor_Selector.C")
// Root > T->Process("ResCor_Selector.C","some options")
// Root > T->Process("ResCor_Selector.C+")
//
#include "ResCor_Selector.h"
#include <TH2.h>
#include <TStyle.h>
#include <TFile.h>
#include <TTree.h>
#include <TH2D.h>
#include <TH1D.h>
#include <TMath.h>
#ifndef __IOSTREAM__
#include <iostream>
#endif
#ifndef __IOMANIP__
#include <iomanip>
#endif
using std::cout;
using std::endl;
using std::setw;
using std::ios;
 
#ifndef __FSTREAM__
#include <fstream>
#endif
 
#include <limits.h>
#include <float.h>

void ResCor_Selector::Begin(TTree *tree)
{
   // The Begin() function is called at the start of the query.
   // When running with PROOF Begin() is only called on the client.
   // The tree argument is deprecated (on PROOF 0 is passed).
   TString option = GetOption();
   outputFile = new TFile("/direct/brahms+u/ebj/Analysis/ResCor/ResCorHistos.root","RECREATE");
}
void ResCor_Selector::SlaveBegin(TTree *tree)
{
   // The SlaveBegin() function is called after the Begin() function.
   // When running with PROOF SlaveBegin() is called on each slave server.
   // The tree argument is deprecated (on PROOF 0 is passed).
   Init(tree);
   TString option = GetOption();
   hvzvcent = new TH2D("hvzvcent","Vz vs Cent",500,-50,50,200,0,100);
   hvzvcenttma = new TH2D("hvzvcenttma","Vz vs Cent TMA",500,-50,50,200,0,100);
   hcenttmavcent = new TH1D("hcenttmavcent","Cent TMA - Cent",400,-100,100);
}
Bool_t ResCor_Selector::Process(Long64_t entry)
{
   // The Process() function is called for each entry in the tree (or possibly
   // keyed object in the case of PROOF) to be processed. The entry argument
   // specifies which entry in the currently loaded tree is to be processed.
   // It can be passed to either TTree::GetEntry() or TBranch::GetEntry()
   // to read either all or the required parts of the data. When processing
   // keyed objects with PROOF, the object is already loaded and is available
   // via the fObject pointer.
   //
   // This function should contain the "body" of the analysis. It can contain
   // simple or elaborate selection criteria, run algorithms on the data
   // of the event and typically fill histograms.
   // WARNING when a selector is used with a TChain, you must use
   //  the pointer to the current TTree to call GetEntry(entry).
   //  The entry is always the local entry number in the current tree.
   //  Assuming that fChain is the pointer to the TChain being processed,
   //  use fChain->GetTree()->GetEntry(entry).

  fChain->GetTree()->GetEntry(entry);
  Float_t vz = -1111;
  if ( TMath::Abs(G_fZdcVtxZ[0]) < 100 ) { vz = G_fZdcVtxZ[0]; }
  if ( TMath::Abs(G_fZdcCfdVtxZ[0]) < 100 ) { vz = G_fZdcCfdVtxZ[0]; }
  if ( TMath::Abs(G_fBbVtxZ[0]) < 100 ) { vz = G_fBbVtxZ[0]; }
  if ( TMath::Abs(G_fTrackProjVtxZ[0]) < 100  ) { vz = G_fTrackProjVtxZ[0]; }
  hvzvcent->Fill(vz,G_fCent[0]);
  hvzvcenttma->Fill(vz,G_fTMACent[0]);
  hcenttmavcent->Fill(G_fTMACent[0]-G_fCent[0]);
   return kTRUE;
}
void ResCor_Selector::SlaveTerminate()
{
   // The SlaveTerminate() function is called after all entries or objects
   // have been processed. When running with PROOF SlaveTerminate() is called
   // on each slave server.
  fOutput->Add(hvzvcent);
  fOutput->Add(hvzvcenttma);
  fOutput->Add(hcenttmavcent);
}
void ResCor_Selector::Terminate()
{
   // The Terminate() function is the last function to be called during
   // a query. It always runs on the client, it can be used to present
   // the results graphically or save the results to file.
  outputFile->Write();
}

_______________________________________________
Brahms-dev-l mailing list
Brahms-dev-l@lists.bnl.gov
http://lists.bnl.gov/mailman/listinfo/brahms-dev-l
Received on Fri Jan 13 02:07:38 2006

This archive was generated by hypermail 2.1.8 : Fri Jan 13 2006 - 02:07:51 EST