Message: Re: How to obtain a root file with info from Verbose? Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

None Re: How to obtain a root file with info from Verbose? 

Forum: Event and Track Management
Re: Question How to obtain a root file with info from Verbose? (Carlos Uribe)
Date: 09 Jun, 2013
From: Carlos Ayerbe Gayoso <Carlos Ayerbe Gayoso>

I'm pretty sure that there are is not a unique way to do it... but I'll try to show mine, without many details.

I have a class that I called Analysis (I know, nothing original). First of all create a root file

rootfile = CreateSaveFile("ECalFile");

In other method I define the branches

 hittree = new TTree("hittree","module hits");
  hittree->Branch("hit",&hit.EventID, "EventID/I:Module/I:EDepMod/D:Layer/I:EDepLay/D:EDep/D");

  eventtree = new TTree("eventtree","Calorimeter Summary");
  eventtree->Branch("event",&event.EventID, "EventID/I:EDepTot/D:PosCal[3]/D");

  settree = new TTree("settree","Calorimeter Settings");
  settree->Branch("set",&set.runID, "runID/I:noCol/I:noRow/I");

You can see that in every branch I have many variables to be stored with its declaration (integer, double...)

Then you fill the leafs as, for excample my event branch

    event.EventID = evtNb;
    event.EDepTot = EnergyTemp;


and fill the branch


remember to close the rootfile.

This method need more things (at least in my code) that implies to define a structure.

In the header of this class

    TTree *eventtree;
    TTree *hittree;
    TTree *settree;
    UTEvent event; 
    UThit hit; 
    UTSet set; 

And other file with the structure:

#ifndef ECalStruct_H
#define ECalStruct_H 1

typedef struct {
    G4int EventID;
    G4int Module; //module or unit of the calorimeter
    G4double EDepMod; //Deposited energy of the Gap (Scintillator) of the module
    G4int Layer; //layer corresponding to the module
    G4double EDepLay; //Deposited energy of the Gap (Scintillator) of the layer for a given module
    G4double EDep;
} UThit;

typedef struct {
    G4int EventID;
    G4double EDepTot;
    G4double PosCal[3];
} UTEvent;

typedef struct {
    G4int runID;
    G4int noCol;
    G4int noRow;
} UTSet;

I'm pretty sure that should be a more simple way, this code is inherited from somebody else, so it works for me... Check the root manual to cross check

Good luck


 Add Message Add Message
to: "Re: How to obtain a root file with info from Verbose?"

 Subscribe Subscribe

This site runs SLAC HyperNews version 1.11-slac-98, derived from the original HyperNews

[ Geant 4 Home | Geant 4 HyperNews | Search | Request New Forum | Feedback ]