Fork me on GitHub

Changes between Version 1 and Version 2 of WorkBook/LibraryInterface


Ignore:
Timestamp:
Jun 20, 2012, 12:43:31 PM (12 years ago)
Author:
Pavel Demin
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • WorkBook/LibraryInterface

    v1 v2  
    11{{{
     2#include "TROOT.h"
     3#include "TApplication.h"
     4
     5#include "TObjArray.h"
     6#include "TLorentzVector.h"
     7
     8#include "ExRootAnalysis/ExRootFactory.h"
     9#include "ExRootAnalysis/ExRootAnalysis.h"
     10#include "ExRootAnalysis/ExRootCandidate.h"
     11
     12void ConvertEvent(ExRootFactory *factory, TObjArray *outputArray);
     13
     14int main()
     15{
    216  // Declaration of variables
    317  ExRootConfReader *confReader;
     
    519  ExRootFactory *factory;
    620  TObjArray *outputArray;
     21
     22  gROOT->SetBatch();
     23
     24  int appargc = 1;
     25  char *appargv[] = {appName};
     26  TApplication app(appName, &appargc, appargv);
    727
    828  try
     
    4060    return 1;
    4161  }
     62}
     63
     64
     65void ConvertEvent(ExRootFactory *factory, TObjArray *outputArray)
     66{
     67  ExRootCandidate *candidate;
     68  TLorentzVector candidateMomentum, candidatePosition;
     69  Int_t pid, status;
     70  Double_t px, py, pz, e, m; 
     71  Double_t x, y, z, t; 
     72 
     73  while(ReadParticle())
     74  {
     75    if(status == 1)
     76    {
     77      candidate = factory->NewCandidate();
     78     
     79      candidate->SetType(pid);
     80
     81      candidateMomentum.SetPxPyPzE(px, py, pz, e);
     82      candidate->SetMomentum(candidateMomentum);
     83     
     84      candidatePosition.SetXYZT(x, y, z, t);
     85      candidate->SetPosition(candidatePosition);
     86     
     87      outputArray->Add(candidate);
     88    }
     89  }
     90}
    4291}}}