5 #include "TClonesArray.h" 
    6 #include "TLorentzVector.h" 
    9 #include "TGeoManager.h" 
   19                  Char_t OutputFile[]=
"output.root")
 
   21         TFile *
f=
new TFile(InputSimFile);
 
   22         TGeoManager *fGeoManager = (TGeoManager *) f->Get(
"FAIRGeom");
 
   24         TChain *
c=
new TChain(
"pndsim");
 
   28         TClonesArray* 
track_array=
new TClonesArray(
"PndMCTrack");
 
   29         c->SetBranchAddress(
"MCTrack",&track_array);
 
   31         TClonesArray* 
cluster_array=
new TClonesArray(
"PndEmcCluster");
 
   32         TClonesArray* wf_array=
new TClonesArray(
"PndEmcWaveform");
 
   33         c->SetBranchAddress(
"EmcCluster",&cluster_array);
 
   34         c->SetBranchAddress(
"EmcWaveform",&wf_array);
 
   36         TClonesArray* 
digi_array=
new TClonesArray(
"PndEmcDigi");
 
   37         c->SetBranchAddress(
"EmcDigi",&digi_array);
 
   39         TClonesArray* 
hit_array=
new TClonesArray(
"PndEmcHit");
 
   40         c->SetBranchAddress(
"EmcHit",&hit_array);
 
   42         TFile *fs=
new TFile(OutputFile,
"recreate");
 
   43         TNtuple *
n = 
new TNtuple(
"myntup",
"My Ntuple",
"et:tht:pht:ec:thc:phc:nc:sc:edbar:edfw:edbw:eh:ecc:thd:phd");
 
   45         cout << 
"<I> Number of entries " << c->GetEntries() << endl;
 
   49         Double_t tot_digi_energy_barrel,tot_digi_energy_fwendcap,tot_digi_energy_bwendcap;
 
   57         for (Int_t j=0; j< c->GetEntries(); j++)
 
   61               printf(
".%i.",j);fflush(stdout);
 
   79                 tot_digi_energy_barrel=0;
 
   80                 tot_digi_energy_fwendcap=0;
 
   81                 tot_digi_energy_bwendcap=0;
 
   83                 for (Int_t 
i=0; 
i<digi_array->GetEntriesFast(); 
i++)
 
  103                 for (Int_t 
i=0; 
i<hit_array->GetEntriesFast(); 
i++)
 
  110                 if (cluster_array->GetEntriesFast()>0)
 
  112                     Int_t    idWithHighestEnergy = 0;
 
  117                     for (Int_t 
i=0; 
i<cluster_array->GetEntriesFast(); 
i++)
 
  120                         cluster_energy=cluster->
energy();
 
  121                         if (cluster_energy>highestEnergy)
 
  123                             idWithHighestEnergy = 
i;
 
  161                     TVector3 cluster_pos=cluster->
where();
 
  162                     cluster_theta=cluster_pos.Theta();
 
  163                     cluster_phi=cluster_pos.Phi();
 
  164                     cluster_energy=cluster->
energy();
 
  175                     n->Fill((Float_t) p4mom.E()-p4mom.M(),
 
  176                             (Float_t) (180./
TMath::Pi())*p4mom.Theta(),
 
  177                             (Float_t) (180./
TMath::Pi())*p4mom.Phi(),
 
  178                             (Float_t) cluster_energy,
 
  179                             (Float_t) cluster_theta*(180/
TMath::Pi()),
 
  181                             (Float_t) cluster_array->GetEntriesFast(),
 
  183                             (Float_t) tot_digi_energy_barrel,
 
  184                             (Float_t) tot_digi_energy_fwendcap,
 
  185                             (Float_t) tot_digi_energy_bwendcap,
 
  186                             (Float_t) tot_hit_energy,
 
  187                             (Float_t) cluster_energy_check,
 
printf("RealTime=%f seconds, CpuTime=%f seconds\n", rtime, ctime)
virtual Double_t GetEnergy() const 
represents the reconstructed hit of one emc crystal 
Int_t GetDetectorId() const 
TClonesArray * digi_array
TLorentzVector Get4Momentum() const 
TClonesArray * cluster_array
virtual Double_t GetEnergy() const 
a cluster (group of neighboring crystals) of hit emc crystals 
represents the deposited energy of one emc crystal from simulation 
int hit(Int_t nEvents=0, TString inFile="sim.root", TString parFile="par.root", TString inDigi="digi.root", TString outFile="hit.root", Int_t timeBased=0)
virtual Double_t energy() const 
TClonesArray * track_array