ROOT logo
#define esdAna_cxx
// The class definition in esdAna.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("esdAna.C")
// Root > T->Process("esdAna.C","some options")
// Root > T->Process("esdAna.C+")
//

#include "esdAna.h"
#include <TH1.h>

void esdAna::Begin(TTree *)
{
   // 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).
  
   h1 = new TH1F("hRealVertex","Primary vertex",100,-20,20);
   h3 = new TH1F("hT0vertex","T0vertex",100,-20,20);
   h2 = new TH1F("hT0start","T0 start time",100,12400,12600);
 TString option = GetOption();   
}

void esdAna::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();

}

Bool_t esdAna::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);
  b_ESD_fEventNumber->GetEvent(entry);
  b_ESD_fPrimaryVertex_fPosition->GetEntry(entry);
  b_ESD_fT0zVertex->GetEntry(entry);
   b_ESD_fT0timeStart->GetEntry(entry);
   printf("Processing Entry %lld %d  %f %f %f \n",entry,fEventNumber,fT0zVertex,fPrimaryVertex_fPosition[2], fT0timeStart );

   h2->Fill(fT0timeStart);
   h1->Fill(fPrimaryVertex_fPosition[2]);
   h3->Fill(fT0zVertex/2.);
   

   return kTRUE;
}

void esdAna::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(h1) ;
   fOutput->Add(h2) ;
   fOutput->Add(h3) ;
}

void esdAna::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.
  Float_t mean = h2->GetMean();
  printf ("mean time T0 ps %f ",mean);
  if (mean >  12600 || mean <12400 ) 
    printf (" !!!!!!!!!!-----events sample is WRONG - T0 unreal -------");  
   hfile = TFile::Open("esdAna.root","RECREATE");
   TFile * file = TFile::Open("esdAna.root", "RECREATE");
   h1->Write();
   h2->Write();
   h3->Write();
   file->Close();
}
 esdAna.C:1
 esdAna.C:2
 esdAna.C:3
 esdAna.C:4
 esdAna.C:5
 esdAna.C:6
 esdAna.C:7
 esdAna.C:8
 esdAna.C:9
 esdAna.C:10
 esdAna.C:11
 esdAna.C:12
 esdAna.C:13
 esdAna.C:14
 esdAna.C:15
 esdAna.C:16
 esdAna.C:17
 esdAna.C:18
 esdAna.C:19
 esdAna.C:20
 esdAna.C:21
 esdAna.C:22
 esdAna.C:23
 esdAna.C:24
 esdAna.C:25
 esdAna.C:26
 esdAna.C:27
 esdAna.C:28
 esdAna.C:29
 esdAna.C:30
 esdAna.C:31
 esdAna.C:32
 esdAna.C:33
 esdAna.C:34
 esdAna.C:35
 esdAna.C:36
 esdAna.C:37
 esdAna.C:38
 esdAna.C:39
 esdAna.C:40
 esdAna.C:41
 esdAna.C:42
 esdAna.C:43
 esdAna.C:44
 esdAna.C:45
 esdAna.C:46
 esdAna.C:47
 esdAna.C:48
 esdAna.C:49
 esdAna.C:50
 esdAna.C:51
 esdAna.C:52
 esdAna.C:53
 esdAna.C:54
 esdAna.C:55
 esdAna.C:56
 esdAna.C:57
 esdAna.C:58
 esdAna.C:59
 esdAna.C:60
 esdAna.C:61
 esdAna.C:62
 esdAna.C:63
 esdAna.C:64
 esdAna.C:65
 esdAna.C:66
 esdAna.C:67
 esdAna.C:68
 esdAna.C:69
 esdAna.C:70
 esdAna.C:71
 esdAna.C:72
 esdAna.C:73
 esdAna.C:74
 esdAna.C:75
 esdAna.C:76
 esdAna.C:77
 esdAna.C:78
 esdAna.C:79
 esdAna.C:80
 esdAna.C:81
 esdAna.C:82
 esdAna.C:83
 esdAna.C:84
 esdAna.C:85
 esdAna.C:86
 esdAna.C:87
 esdAna.C:88
 esdAna.C:89
 esdAna.C:90
 esdAna.C:91
 esdAna.C:92
 esdAna.C:93
 esdAna.C:94
 esdAna.C:95
 esdAna.C:96
 esdAna.C:97
 esdAna.C:98
 esdAna.C:99
 esdAna.C:100
 esdAna.C:101
 esdAna.C:102
 esdAna.C:103
 esdAna.C:104
 esdAna.C:105
 esdAna.C:106
 esdAna.C:107
 esdAna.C:108
 esdAna.C:109
 esdAna.C:110
 esdAna.C:111
 esdAna.C:112
 esdAna.C:113
 esdAna.C:114
 esdAna.C:115