Index: /esaf_lal/branches/camille/camille_work/KIT_phase1_study/macros/Analysis.C
===================================================================
--- /esaf_lal/branches/camille/camille_work/KIT_phase1_study/macros/Analysis.C	(revision 168)
+++ /esaf_lal/branches/camille/camille_work/KIT_phase1_study/macros/Analysis.C	(revision 168)
@@ -0,0 +1,183 @@
+//
+//  Analysis.C
+//
+//
+//  Created by moretto on 29/05/13.
+//
+//
+
+Int_t nb_entries = 0;
+
+const char* inputfile="/Users/moretto/Documents/thesis/ESAF/Code/esaf_lal/esaf/camille_work/KIT_phase1_study/30_ns_TimeResolution__100_event/simu.root";
+const char* inputfile2="/Users/moretto/Documents/thesis/ESAF/Code/esaf_lal/esaf/camille_work/KIT_phase1_study/10_ns_TimeResolution__100_event/simu.root";
+const char* inputfile3="/Users/moretto/Documents/thesis/ESAF/Code/esaf_lal/esaf/camille_work/KIT_phase1_study/5_ns_TimeResolution__100_event/simu.root";
+
+EEvent*          ev = 0;
+EDetector*       gDetector = NULL;
+EDetPhoton*      gDetPhoton = NULL;
+EBunchPhotons*   gBunchPhotons = NULL;
+
+void gettree();
+void init();
+void process_profile();
+Bool_t loadevent(Int_t i=0);
+
+//______________________________________________________________________________
+void Analysis()
+{
+    TProfile *hprof_multi[2];
+    
+    //Initialisation & process
+    init(inputfile);
+    process_profile();
+    hprof_multi[1] = hprof;
+    
+    init(inputfile3);
+    process_profile();
+    hprof_multi[2] = hprof;
+    
+    TCanvas *c4 = new TCanvas("c4", "Efficiency vs GTU");
+    TProfile *hprof_efficiency = new TProfile("hprof_efficiency", "Efficiency vs GTU", 128, 0, 128);
+    
+    for (Int_t i=1; i<128; i++)
+    {
+        Float_t bin1 = hprof_multi[1]->GetBinContent(i);
+        Float_t bin2 = hprof_multi[2]->GetBinContent(i);
+        
+        if (bin2 == 0)
+        {
+            hprof_efficiency->Fill(i, 0); //Il faut entrer des entiers dedans sinon Ã§a ne marchera pas!!!!
+        }
+        
+        else
+        {
+            hprof_efficiency->Fill(i, bin1/bin2); //Il faut entrer des entiers dedans sinon Ã§a ne marchera pas!!!!
+        }
+    }
+    
+    hprof_efficiency->Draw();
+}
+
+//______________________________________________________________________________
+void process_profile ()
+{
+    //DÃ©claration des histogrammes et autres
+    TH1F *histo_total = new TH1F("histo_total", "Histogram of photons read by the electronics for 100 showers", 128, 0, 128);
+    TH1F *histo_multi[100];
+    TProfile *hprof = new TProfile("hprof", "Average number of photons per GTU", 128, 0, 128);
+    
+    //Boucle sur l'ensemble des Ã©vÃ©nements pour crÃ©er une distribution totale
+    for (Int_t  i=0; i<nb_entries ; i++)
+    {
+        loadevent(i);
+        
+        Int_t nb_photon = gDetector->GetNumPhotons();
+        
+        for (Int_t j=0; j<nb_photon; j++)
+        {
+            Int_t macrocell_status = gDetector->GetPhoton(j)->GetMacroCell();
+            Int_t photon_type = gDetector->GetPhoton(j)->GetType();
+            
+            if (macrocell_status == 1 & photon_type != 2) //on ne sÃ©lectionne que les photons Ã©tant dÃ©tectÃ©s par l'Ã©lectronique & autre que les Cerenkov
+            {
+                Float_t gtu = gDetector->GetPhoton(j)->GetGtu();
+                histo_total->Fill(gtu);
+            }
+            
+        }
+        
+    }
+
+    TCanvas *c1 = new TCanvas("c1", "Distribution totale");
+    histo_total->GetXaxis()->SetTitle("GTU");
+    histo_total->Draw();
+    
+    //Boucle sur l'ensemble des Ã©vÃ©nements pour tracer sÃ©parÃ©ment les histogrammes
+    TCanvas *c2 = new TCanvas("c2", "Collection of GTU histograms for 100 events");
+    c2->Divide(10,10);
+    
+    for (Int_t i=0; i<nb_entries; i++)
+        histo_multi[i] = new TH1F("histo_multi", "Single shower histograms", 128, 0, 128);
+    
+    for (Int_t  i=0; i<100 ; i++)
+    {
+        loadevent(i);
+        
+        nb_photon = gDetector->GetNumPhotons();
+        
+        for (Int_t j=0; j<nb_photon; j++)
+        {
+            macrocell_status = gDetector->GetPhoton(j)->GetMacroCell();
+            photon_type = gDetector->GetPhoton(j)->GetType();
+            
+            if (macrocell_status == 1 & photon_type != 2) //on ne sÃ©lectionne que les photons Ã©tant dÃ©tectÃ©s par l'Ã©lectronique & autre que les Cerenkov
+            {
+                gtu = gDetector->GetPhoton(j)->GetGtu();
+                histo_multi[i]->Fill(gtu);
+            }
+        }
+        
+        c2->cd(i+1);
+        histo_multi[i]->Draw();
+        
+    }
+    
+    //Boucle sur le tableau d'histogrammes prÃ©cÃ©dent afin de rÃ©aliser un TProfile
+    for (Int_t j=0; j<nb_entries; j++)
+    {
+        for (Int_t i=1; i<=128; i++)
+        {
+            hprof->Fill(i, histo_multi[j]->GetBinContent(i));
+        }
+        
+    }
+    
+    TCanvas *c3 = new TCanvas("c3", "TProfile of the GTU distribution for 100 events");
+    hprof->Draw();
+
+}
+
+//______________________________________________________________________________
+void init( const char* fname)
+{
+    TFile *f = new TFile(fname);
+    gettree();
+}
+
+//______________________________________________________________________________
+void gettree()
+{
+    TTree *etree = (TTree*)gDirectory->Get("etree");
+    if ( etree )
+    {
+        nb_entries = etree->GetEntries();
+        Printf("etree found with %d events stored.", nb_entries);
+    }
+}
+
+//______________________________________________________________________________
+Bool_t loadevent( Int_t i)
+{
+    TTree *etree = (TTree*)gDirectory->Get("etree");
+    
+    if ( !etree )
+    {
+        Printf("init(): unable to retrieve etree from TFile. Exiting");
+        return kFALSE;
+    }
+    
+    // associate the tree and the event
+    if ( !ev )
+    {
+        ev = new EEvent();
+        ev->SetBranches(etree);
+    }
+    
+    etree->GetEntry(i);
+    
+    EDetector *detector = ev->GetDetector();
+    
+    gDetector = ev->GetDetector();
+    
+    return kTRUE;
+}
Index: af_lal/branches/camille/camille_work/KIT_phase1_study/macros/Phase1_1_MakeAnalysis.C
===================================================================
--- /esaf_lal/branches/camille/camille_work/KIT_phase1_study/macros/Phase1_1_MakeAnalysis.C	(revision 167)
+++ 	(revision )
@@ -1,8 +1,0 @@
-void Phase1_1_MakeAnalysis()
-{
-    //Ouverture du tree
-    TFile f("/Users/moretto/Documents/thesis/ESAF/Code/esaf_lal/esaf/camille_work/KIT_phase1_study/30_ns_TimeResolution__100_event/simu.root");
-    
-    //Fabrication d'un squeleton pour faire un analyse
-    etree->MakeCode("/Users/moretto/Documents/thesis/ESAF/Code/esaf_lal/esaf/camille_work/KIT_phase1_study/macros/Phase1_1_MyAnalysis.C");
-}
Index: af_lal/branches/camille/camille_work/KIT_phase1_study/macros/Phase1_1_MyAnalysis.C
===================================================================
--- /esaf_lal/branches/camille/camille_work/KIT_phase1_study/macros/Phase1_1_MyAnalysis.C	(revision 167)
+++ 	(revision )
@@ -1,804 +1,0 @@
-{
-    //////////////////////////////////////////////////////////
-    //   This file has been automatically generated
-    //     (Tue May 28 09:45:10 2013 by ROOT version5.34/02)
-    //   from TTree etree/Events Tree
-    //   found on file: /Users/moretto/Documents/thesis/ESAF/Code/esaf_lal/esaf/camille_work/KIT_phase1_study/30_ns_TimeResolution__100_event/simu.root
-    //////////////////////////////////////////////////////////
-    
-    
-    //Reset ROOT and connect tree file
-    gROOT->Reset();
-    TFile *f = (TFile*)gROOT->GetListOfFiles()->FindObject("/Users/moretto/Documents/thesis/ESAF/Code/esaf_lal/esaf/camille_work/KIT_phase1_study/30_ns_TimeResolution__100_event/simu.root");
-    if (!f) {
-        f = new TFile("/Users/moretto/Documents/thesis/ESAF/Code/esaf_lal/esaf/camille_work/KIT_phase1_study/30_ns_TimeResolution__100_event/simu.root");
-    }
-    f->GetObject("etree",etree);
-        
-    //Declaration of leaves types
-    UInt_t          fUniqueID;
-    UInt_t          fBits;
-    Int_t           fNum;
-    Int_t           fRun;
-    TString         fRunName;
-    TRandom*        fRandom;
-    UInt_t          fStatus;
-    TString         fStatusMsg;
-    UInt_t          fUniqueID;
-    UInt_t          fBits;
-    Float_t         fTrueEnergy;
-    Float_t         fTrueTheta;
-    Float_t         fTruePhi;
-    TString         fTrueParticleName;
-    Int_t           fTrueParticleCode;
-    Float_t         fTrueInitPosX;
-    Float_t         fTrueInitPosY;
-    Float_t         fTrueInitPosZ;
-    Float_t         fTrueX1;
-    Float_t         fTrueEarthImpactX;
-    Float_t         fTrueEarthImpactY;
-    Float_t         fTrueEarthImpactZ;
-    Float_t         fTrueTOAImpactX;
-    Float_t         fTrueTOAImpactY;
-    Float_t         fTrueTOAImpactZ;
-    Float_t         fTrueEarthAge;
-    Float_t         fTrueShowerMaxPosX;
-    Float_t         fTrueShowerMaxPosY;
-    Float_t         fTrueShowerMaxPosZ;
-    Float_t         fTrueShowerXMax;
-    Float_t         fTrueHclouds;
-    Float_t         fTrueCloudsthick;
-    Float_t         fTrueCloudsOD;
-    Float_t         fTrueLatitude;
-    Float_t         fTrueLongitude;
-    Float_t         fTrueDate;
-    Float_t         fTrueHGround;
-    Float_t         fTrueGroundAlbedo;
-    Float_t         fTrueGroundSpecular;
-    Float_t         fFoV;
-    Float_t         fRadius;
-    Float_t         fOpticsRadius;
-    Float_t         fPosX;
-    Float_t         fPosY;
-    Float_t         fPosZ;
-    UInt_t          fRotation_fUniqueID;
-    UInt_t          fRotation_fBits;
-    Double_t        fRotation_fxx;
-    Double_t        fRotation_fxy;
-    Double_t        fRotation_fxz;
-    Double_t        fRotation_fyx;
-    Double_t        fRotation_fyy;
-    Double_t        fRotation_fyz;
-    Double_t        fRotation_fzx;
-    Double_t        fRotation_fzy;
-    Double_t        fRotation_fzz;
-    UInt_t          fUniqueID;
-    UInt_t          fBits;
-    Float_t         fEnergy;
-    Float_t         fTheta;
-    Float_t         fPhi;
-    Float_t         fX1;
-    Float_t         fElectrEthres;
-    Float_t         fDirX;
-    Float_t         fDirY;
-    Float_t         fDirZ;
-    Float_t         fInitPosX;
-    Float_t         fInitPosY;
-    Float_t         fInitPosZ;
-    Bool_t          fHitGround;
-    Int_t           fNumSteps;
-    UInt_t          fSteps_fUniqueID[150];
-    UInt_t          fSteps_fBits[150];
-    Float_t         fSteps_fXi[150];
-    Float_t         fSteps_fXf[150];
-    Float_t         fSteps_fPosiX[150];
-    Float_t         fSteps_fPosiY[150];
-    Float_t         fSteps_fPosiZ[150];
-    Float_t         fSteps_fPosfX[150];
-    Float_t         fSteps_fPosfY[150];
-    Float_t         fSteps_fPosfZ[150];
-    Float_t         fSteps_fTimei[150];
-    Float_t         fSteps_fTimef[150];
-    Float_t         fSteps_fAgei[150];
-    Float_t         fSteps_fAgef[150];
-    Float_t         fSteps_fNumElectrons[150];
-    Float_t         fSteps_fNumCharged[150];
-    Float_t         fSteps_fEnergyLoss[150];
-    Float_t         fSteps_fNumCherenkov[150];
-    TH2F*           fSteps_fEnergyAngle[150];
-    TH2F*           fSteps_fRadPhiElectrons[150];
-    TH2F*           fSteps_fRadDTimeElectrons[150];
-    TH2F*           fSteps_fRadPhiEnergyLoss[150];
-    TH1F*           fSteps_fAngleCherenkov[150];
-    Bool_t          fCopy;
-    UInt_t          fUniqueID;
-    UInt_t          fBits;
-    Int_t           fNumBunches;
-    Int_t           fNumSingles;
-    Int_t           fMaxScatOrder;
-    UInt_t          fBunches_fUniqueID[300];
-    UInt_t          fBunches_fBits[300];
-    UChar_t         fBunches_fType[300];
-    UInt_t          fBunches_fId[300];
-    Float_t         fBunches_fWeight[300];
-    Float_t         fBunches_fDatei[300];
-    Float_t         fBunches_fDatef[300];
-    Float_t         fBunches_fShowerAge[300];
-    Float_t         fBunches_fShowerPosiX[300];
-    Float_t         fBunches_fShowerPosiY[300];
-    Float_t         fBunches_fShowerPosiZ[300];
-    Float_t         fBunches_fShowerPosfX[300];
-    Float_t         fBunches_fShowerPosfY[300];
-    Float_t         fBunches_fShowerPosfZ[300];
-    Float_t         fBunches_fFinalPosX[300];
-    Float_t         fBunches_fFinalPosY[300];
-    Float_t         fBunches_fFinalPosZ[300];
-    Float_t         fBunches_fMeanDirX[300];
-    Float_t         fBunches_fMeanDirY[300];
-    Float_t         fBunches_fMeanDirZ[300];
-    Float_t         fBunches_fYield[300];
-    Int_t           fBunches_fNumWavelengths[300];
-    Float_t         fBunches_fWlLambda[300];
-    Float_t         fBunches_fWlWeight[300];
-    UChar_t         fBunches_fFate[300];
-    TRefArray*      fBunches_fSingles[300];
-    Int_t           fBunches_fNumFluoDirect[300];
-    Int_t           fBunches_fNumCkovDirect[300];
-    Int_t           fBunches_fNumFluoAirScat[300];
-    Int_t           fBunches_fNumCkovAirScat[300];
-    Int_t           fBunches_fNumFluoAeroScat[300];
-    Int_t           fBunches_fNumCkovAeroScat[300];
-    Int_t           fBunches_fNumFluoCloudScat[300];
-    Int_t           fBunches_fNumCkovCloudScat[300];
-    Int_t           fBunches_fNumFluoReflected[300];
-    Int_t           fBunches_fNumCkovReflected[300];
-    UInt_t          fSingles_fUniqueID[38861];
-    UInt_t          fSingles_fBits[38861];
-    UChar_t         fSingles_fType[38861];
-    UInt_t          fSingles_fBunchId[38861];
-    UChar_t         fSingles_fHistory[38861];
-    TArrayC         fSingles_fAllHistory[38861];
-    Bool_t          fSingles_fAbsorbed[38861];
-    Bool_t          fSingles_fCloudAbsorbed[38861];
-    Float_t         fSingles_fLastTotTrans[38861];
-    Float_t         fSingles_fLastRaylTrans[38861];
-    Float_t         fSingles_fLastOzoneTrans[38861];
-    Float_t         fSingles_fLastAeroTrans[38861];
-    Float_t         fSingles_fLastCloudTrans[38861];
-    Bool_t          fSingles_fOutFoV[38861];
-    Float_t         fSingles_fDate[38861];
-    Float_t         fSingles_fShowerAge[38861];
-    Float_t         fSingles_fTof[38861];
-    Float_t         fSingles_fWl[38861];
-    Int_t           fSingles_fNbinter[38861];
-    Float_t         fSingles_fShowerPosX[38861];
-    Float_t         fSingles_fShowerPosY[38861];
-    Float_t         fSingles_fShowerPosZ[38861];
-    Float_t         fSingles_fPosX[38861];
-    Float_t         fSingles_fPosY[38861];
-    Float_t         fSingles_fPosZ[38861];
-    Float_t         fSingles_fMScatDirX[38861];
-    Float_t         fSingles_fMScatDirY[38861];
-    Float_t         fSingles_fMScatDirZ[38861];
-    Bool_t          fCopy;
-    UInt_t          fUniqueID;
-    UInt_t          fBits;
-    UInt_t          fPhotonFillingMode;
-    Bool_t          fNightGlowFillable;
-    TRef            fRunPars;
-    UInt_t          fElectronics_fUniqueID;
-    UInt_t          fElectronics_fBits;
-    Int_t           fElectronics_fNumActiveGtus;
-    Int_t           fElectronics_fGtuStart;
-    Int_t           fElectronics_fGtuEnd;
-    Int_t           fElectronics_fNumCells;
-    Float_t         fElectronics_fTimeGtu0;
-    Float_t         fElectronics_fTimeFirstGtu;
-    Float_t         fElectronics_fTimeLastGtu;
-    Float_t         fElectronics_fGtuLength;
-    UInt_t          fStatus_fUniqueID;
-    UInt_t          fStatus_fBits;
-    Int_t           fStatus_fNumActivePixels;
-    Int_t           fStatus_fNumSignals;
-    Int_t           fStatus_fNumBkg;
-    Int_t           fStatus_fNumHits;
-    Int_t           fStatus_fNumGtu;
-    Int_t           fStatus_fNumPhotons;
-    TArrayI         fStatus_fPhotonHistory;
-    TArrayI         fStatus_fMaxHits;
-    TArrayI         fStatus_fMaxBkg;
-    TArrayI         fStatus_fMaxSignals;
-    Int_t           fNumPhotons;
-    Int_t           fNumCellHits;
-    Int_t           fNumFee;
-    Int_t           fNumAFee;
-    Int_t           fNumCells;
-    Float_t         fFirstTime;
-    Float_t         fLastTime;
-    UInt_t          fPhotons_fUniqueID[22941];
-    UInt_t          fPhotons_fBits[22941];
-    UChar_t         fPhotons_fType[22941];
-    Float_t         fPhotons_fTheta[22941];
-    Float_t         fPhotons_fPhi[22941];
-    Float_t         fPhotons_fLambda[22941];
-    Float_t         fPhotons_fTime[22941];                  //leave that will be used
-    Float_t         fPhotons_fPosX[22941];
-    Float_t         fPhotons_fPosY[22941];
-    Float_t         fPhotons_fPosZ[22941];
-    UShort_t        fPhotons_fStatusBits[22941];
-    Float_t         fPhotons_fShowerPosX[22941];
-    Float_t         fPhotons_fShowerPosY[22941];
-    Float_t         fPhotons_fShowerPosZ[22941];
-    Float_t         fPhotons_fAge[22941];
-    Int_t           fPhotons_fHistory[22941];
-    Int_t           fPhotons_fFate[22941];
-    Float_t         fPhotons_fIdealFocalPosX[22941];
-    Float_t         fPhotons_fIdealFocalPosY[22941];
-    Float_t         fPhotons_fIdealFocalPosZ[22941];
-    Int_t           fPhotons_fFe[22941];
-    Int_t           fPhotons_fMacroCell[22941];
-    Int_t           fPhotons_fXCell[22941];
-    Int_t           fPhotons_fYCell[22941];
-    Int_t           fPhotons_fGtu[22941];
-    Int_t           fPhotons_fPixelUID[22941];
-    Int_t           fPhotons_fSignalId[22941];
-    Float_t         fPhotons_fCharge[22941];
-    Float_t         fPhotons_fIPeak[22941];
-    Float_t         fPhotons_fSignalTime[22941];
-    UInt_t          fMacroCellHits_fUniqueID[0];
-    UInt_t          fMacroCellHits_fBits[0];
-    Int_t           fMacroCellHits_fCellId[0];
-    Int_t           fMacroCellHits_fChUId[0];
-    Int_t           fMacroCellHits_fGtu[0];
-    Int_t           fMacroCellHits_fCounts[0];
-    Int_t           fMacroCellHits_fCellRow[0];
-    Int_t           fMacroCellHits_fCellCol[0];
-    Float_t         fMacroCellHits_fTime[0];
-    UInt_t          fFee_fUniqueID[73729];
-    UInt_t          fFee_fBits[73729];
-    Int_t           fFee_fGtu[73729];
-    Int_t           fFee_fFEId[73729];
-    Int_t           fFee_fChUId[73729];
-    Int_t           fFee_fNumHits[73729];
-    Int_t           fFee_fNumSignals[73729];
-    Bool_t          fFee_fHasTriggered[73729];
-    Float_t         fFee_fChCharge[73729];
-    UInt_t          fAFee_fUniqueID[441];
-    UInt_t          fAFee_fBits[441];
-    Int_t           fAFee_fGtu[441];
-    Int_t           fAFee_fMCId[441];
-    Int_t           fAFee_fFEId[441];
-    Float_t         fAFee_fDyCharge[441];
-    Bool_t          fAFee_fCherTrigg[441];
-    UInt_t          fMacroCell_fUniqueID[1];
-    UInt_t          fMacroCell_fBits[1];
-    Int_t           fMacroCell_fMCId[1];
-    Int_t           fMacroCell_fNumChips[1];
-    Int_t           fMacroCell_fNumPixels[1];
-    Int_t           fMacroCell_fNumCounts[1];
-    Int_t           fMacroCell_fNumFastOrs[1];
-    Int_t           fMacroCell_fHasTriggered[1];
-    Int_t           fMacroCell_fGtuTrigger[1];
-    Int_t           fMacroCell_fTriggerWord[1];
-    Int_t           fMacroCell_fGtuTriggerCCB[1];
-    Int_t           fMacroCell_fTrigDirCCB[1];
-    Int_t           fMacroCell_fTrigECRowCCB[1];
-    Int_t           fMacroCell_fTrigECColCCB[1];
-    Int_t           fMacroCell_fTrigChipIDCCB[1];
-    Int_t           fMacroCell_fTrigPDMIDCCB[1];
-    Int_t           fMacroCell_fTrigMaxCTSCCB[1];
-    TArrayI         fMacroCell_fTrgWords[1];
-    TArrayI         fMacroCell_fTrgIds[1];
-    UInt_t          fUniqueID;
-    UInt_t          fBits;
-    Bool_t          fEventIsTriggered;
-    UInt_t          fPhotonFillingMode;
-    Float_t         fMeanBgnd;
-    Float_t         fTriggerLevel;
-    UInt_t          fTriggPersistency;
-    UInt_t          fNbPixelOnSide;
-    Float_t         fPixelSideLength;
-    Float_t         fFirstPixelX;
-    Float_t         fFirstPixelY;
-    Int_t           fNumPhotons;
-    Int_t           fNumPhotoElectrons;
-    Float_t         fFirstTime;
-    Float_t         fLastTime;
-    Float_t         fFirstGTUTime;
-    UInt_t          fNbGTUs;
-    Float_t         fGTUlength;
-    UInt_t          fPhotons_fUniqueID[0];
-    
-    UInt_t          fPhotons_fBits[0];
-    UChar_t         fPhotons_fType[0];
-    Float_t         fPhotons_fTheta[0];
-    Float_t         fPhotons_fPhi[0];
-    Float_t         fPhotons_fLambda[0];
-    Float_t         fPhotons_fTime[0];
-    Float_t         fPhotons_fPosX[0];
-    Float_t         fPhotons_fPosY[0];
-    Float_t         fPhotons_fPosZ[0];
-    Float_t         fPhotons_fShowerPosX[0];
-    Float_t         fPhotons_fShowerPosY[0];
-    Float_t         fPhotons_fShowerPosZ[0];
-    Int_t           fPhotons_fAtmoHistory[0];
-    Int_t           fPhotons_fFate[0];
-    Int_t           fPhotons_fAtmoNbinter[0];
-    UInt_t          fPhotoElectrons_fUniqueID[0];
-    UInt_t          fPhotoElectrons_fBits[0];
-    UChar_t         fPhotoElectrons_fType[0];
-    UInt_t          fPhotoElectrons_fPixelID[0];
-    UInt_t          fPhotoElectrons_fDist2ShiftToShowPt[0];
-    Float_t         fPhotoElectrons_fTime[0];
-    Float_t         fPhotoElectrons_fSNR[0];
-    Bool_t          fPhotoElectrons_fTriggered[0];
-    Float_t         fPhotoElectrons_fWl[0];
-    Float_t         fPhotoElectrons_fShowerAge[0];
-    Float_t         fPhotoElectrons_fAtmoPosX[0];
-    Float_t         fPhotoElectrons_fAtmoPosY[0];
-    Float_t         fPhotoElectrons_fAtmoPosZ[0];
-    Int_t           fPhotoElectrons_fAtmoHistory[0];
-    Int_t           fPhotoElectrons_fAtmoNbinter[0];
-    UInt_t          fUniqueID;
-    UInt_t          fBits;
-    Int_t           fNumLblTracks;
-    UInt_t          fLblTracks_fUniqueID[0];
-    UInt_t          fLblTracks_fBits[0];
-    Int_t           fLblTracks_fCellId[0];
-    Int_t           fLblTracks_fChipUid[0];
-    Int_t           fLblTracks_fGtuStart[0];
-    Int_t           fLblTracks_fGtuEnd[0];
-    Int_t           fLblTracks_fRowStart[0];
-    Int_t           fLblTracks_fRowEnd[0];
-    Int_t           fLblTracks_fColStart[0];
-    Int_t           fLblTracks_fColEnd[0];
-    Int_t           fLblTracks_fNumSegs[0];
-    Int_t           fLblTracks_fSum[0];
-    Int_t           fLblTracks_fTriggerID[0];
-    Bool_t          fCopy;
-    UInt_t          fUniqueID;
-    UInt_t          fBits;
-    Int_t           fNumTrigg;
-    UInt_t          fPTTFlag_fUniqueID[1];
-    UInt_t          fPTTFlag_fBits[1];
-    Int_t           fPTTFlag_fNumEvt[1];
-    Int_t           fPTTFlag_fMaxCount[1];
-    Int_t           fPTTFlag_fMaxGtu[1];
-    Int_t           fPTTFlag_fMaxRow[1];
-    Int_t           fPTTFlag_fMaxCol[1];
-    Int_t           fPTTFlag_fMaxChipID[1];
-    Int_t           fPTTFlag_fPdmID[1];
-    Bool_t          fCopy;
-    UInt_t          fUniqueID;
-    UInt_t          fBits;
-    Int_t           fNumTrigg;
-    UInt_t          fCCB_LTTFlag_fUniqueID[1];
-    UInt_t          fCCB_LTTFlag_fBits[1];
-    Int_t           fCCB_LTTFlag_fNumEvt[1];
-    Int_t           fCCB_LTTFlag_fMaxCount[1];
-    Int_t           fCCB_LTTFlag_fMaxGtu[1];
-    Int_t           fCCB_LTTFlag_fMaxRow[1];
-    Int_t           fCCB_LTTFlag_fMaxCol[1];
-    Int_t           fCCB_LTTFlag_fMaxChipID[1];
-    Int_t           fCCB_LTTFlag_fMaxDir[1];
-    Int_t           fCCB_LTTFlag_fPdmID[1];
-    Bool_t          fCopy;
-    
-    // Set branch addresses.
-    //etree->SetBranchAddress("header",&header);
-    etree->SetBranchAddress("fUniqueID",&fUniqueID);
-    etree->SetBranchAddress("fBits",&fBits);
-    etree->SetBranchAddress("fNum",&fNum);
-    etree->SetBranchAddress("fRun",&fRun);
-    etree->SetBranchAddress("fRunName",&fRunName);
-    etree->SetBranchAddress("fRandom",&fRandom);
-    etree->SetBranchAddress("fStatus",&fStatus);
-    etree->SetBranchAddress("fStatusMsg",&fStatusMsg);
-    //etree->SetBranchAddress("truth",&truth);
-    etree->SetBranchAddress("fUniqueID",&fUniqueID);
-    etree->SetBranchAddress("fBits",&fBits);
-    etree->SetBranchAddress("fTrueEnergy",&fTrueEnergy);
-    etree->SetBranchAddress("fTrueTheta",&fTrueTheta);
-    etree->SetBranchAddress("fTruePhi",&fTruePhi);
-    etree->SetBranchAddress("fTrueParticleName",&fTrueParticleName);
-    etree->SetBranchAddress("fTrueParticleCode",&fTrueParticleCode);
-    etree->SetBranchAddress("fTrueInitPosX",&fTrueInitPosX);
-    etree->SetBranchAddress("fTrueInitPosY",&fTrueInitPosY);
-    etree->SetBranchAddress("fTrueInitPosZ",&fTrueInitPosZ);
-    etree->SetBranchAddress("fTrueX1",&fTrueX1);
-    etree->SetBranchAddress("fTrueEarthImpactX",&fTrueEarthImpactX);
-    etree->SetBranchAddress("fTrueEarthImpactY",&fTrueEarthImpactY);
-    etree->SetBranchAddress("fTrueEarthImpactZ",&fTrueEarthImpactZ);
-    etree->SetBranchAddress("fTrueTOAImpactX",&fTrueTOAImpactX);
-    etree->SetBranchAddress("fTrueTOAImpactY",&fTrueTOAImpactY);
-    etree->SetBranchAddress("fTrueTOAImpactZ",&fTrueTOAImpactZ);
-    etree->SetBranchAddress("fTrueEarthAge",&fTrueEarthAge);
-    etree->SetBranchAddress("fTrueShowerMaxPosX",&fTrueShowerMaxPosX);
-    etree->SetBranchAddress("fTrueShowerMaxPosY",&fTrueShowerMaxPosY);
-    etree->SetBranchAddress("fTrueShowerMaxPosZ",&fTrueShowerMaxPosZ);
-    etree->SetBranchAddress("fTrueShowerXMax",&fTrueShowerXMax);
-    etree->SetBranchAddress("fTrueHclouds",&fTrueHclouds);
-    etree->SetBranchAddress("fTrueCloudsthick",&fTrueCloudsthick);
-    etree->SetBranchAddress("fTrueCloudsOD",&fTrueCloudsOD);
-    etree->SetBranchAddress("fTrueLatitude",&fTrueLatitude);
-    etree->SetBranchAddress("fTrueLongitude",&fTrueLongitude);
-    etree->SetBranchAddress("fTrueDate",&fTrueDate);
-    etree->SetBranchAddress("fTrueHGround",&fTrueHGround);
-    etree->SetBranchAddress("fTrueGroundAlbedo",&fTrueGroundAlbedo);
-    etree->SetBranchAddress("fTrueGroundSpecular",&fTrueGroundSpecular);
-    //etree->SetBranchAddress("geometry",&geometry);
-    etree->SetBranchAddress("fFoV",&fFoV);
-    etree->SetBranchAddress("fRadius",&fRadius);
-    etree->SetBranchAddress("fOpticsRadius",&fOpticsRadius);
-    etree->SetBranchAddress("fPosX",&fPosX);
-    etree->SetBranchAddress("fPosY",&fPosY);
-    etree->SetBranchAddress("fPosZ",&fPosZ);
-    etree->SetBranchAddress("fRotation.fUniqueID",&fRotation_fUniqueID);
-    etree->SetBranchAddress("fRotation.fBits",&fRotation_fBits);
-    etree->SetBranchAddress("fRotation.fxx",&fRotation_fxx);
-    etree->SetBranchAddress("fRotation.fxy",&fRotation_fxy);
-    etree->SetBranchAddress("fRotation.fxz",&fRotation_fxz);
-    etree->SetBranchAddress("fRotation.fyx",&fRotation_fyx);
-    etree->SetBranchAddress("fRotation.fyy",&fRotation_fyy);
-    etree->SetBranchAddress("fRotation.fyz",&fRotation_fyz);
-    etree->SetBranchAddress("fRotation.fzx",&fRotation_fzx);
-    etree->SetBranchAddress("fRotation.fzy",&fRotation_fzy);
-    etree->SetBranchAddress("fRotation.fzz",&fRotation_fzz);
-    //etree->SetBranchAddress("shower",&shower);
-    etree->SetBranchAddress("fUniqueID",&fUniqueID);
-    etree->SetBranchAddress("fBits",&fBits);
-    etree->SetBranchAddress("fEnergy",&fEnergy);
-    etree->SetBranchAddress("fTheta",&fTheta);
-    etree->SetBranchAddress("fPhi",&fPhi);
-    etree->SetBranchAddress("fX1",&fX1);
-    etree->SetBranchAddress("fElectrEthres",&fElectrEthres);
-    etree->SetBranchAddress("fDirX",&fDirX);
-    etree->SetBranchAddress("fDirY",&fDirY);
-    etree->SetBranchAddress("fDirZ",&fDirZ);
-    etree->SetBranchAddress("fInitPosX",&fInitPosX);
-    etree->SetBranchAddress("fInitPosY",&fInitPosY);
-    etree->SetBranchAddress("fInitPosZ",&fInitPosZ);
-    etree->SetBranchAddress("fHitGround",&fHitGround);
-    etree->SetBranchAddress("fNumSteps",&fNumSteps);
-    //etree->SetBranchAddress("fSteps",&fSteps_);
-    etree->SetBranchAddress("fSteps.fUniqueID",fSteps_fUniqueID);
-    etree->SetBranchAddress("fSteps.fBits",fSteps_fBits);
-    etree->SetBranchAddress("fSteps.fXi",fSteps_fXi);
-    etree->SetBranchAddress("fSteps.fXf",fSteps_fXf);
-    etree->SetBranchAddress("fSteps.fPosiX",fSteps_fPosiX);
-    etree->SetBranchAddress("fSteps.fPosiY",fSteps_fPosiY);
-    etree->SetBranchAddress("fSteps.fPosiZ",fSteps_fPosiZ);
-    etree->SetBranchAddress("fSteps.fPosfX",fSteps_fPosfX);
-    etree->SetBranchAddress("fSteps.fPosfY",fSteps_fPosfY);
-    etree->SetBranchAddress("fSteps.fPosfZ",fSteps_fPosfZ);
-    etree->SetBranchAddress("fSteps.fTimei",fSteps_fTimei);
-    etree->SetBranchAddress("fSteps.fTimef",fSteps_fTimef);
-    etree->SetBranchAddress("fSteps.fAgei",fSteps_fAgei);
-    etree->SetBranchAddress("fSteps.fAgef",fSteps_fAgef);
-    etree->SetBranchAddress("fSteps.fNumElectrons",fSteps_fNumElectrons);
-    etree->SetBranchAddress("fSteps.fNumCharged",fSteps_fNumCharged);
-    etree->SetBranchAddress("fSteps.fEnergyLoss",fSteps_fEnergyLoss);
-    etree->SetBranchAddress("fSteps.fNumCherenkov",fSteps_fNumCherenkov);
-    etree->SetBranchAddress("fSteps.fEnergyAngle",fSteps_fEnergyAngle);
-    etree->SetBranchAddress("fSteps.fRadPhiElectrons",fSteps_fRadPhiElectrons);
-    etree->SetBranchAddress("fSteps.fRadDTimeElectrons",fSteps_fRadDTimeElectrons);
-    etree->SetBranchAddress("fSteps.fRadPhiEnergyLoss",fSteps_fRadPhiEnergyLoss);
-    etree->SetBranchAddress("fSteps.fAngleCherenkov",fSteps_fAngleCherenkov);
-    etree->SetBranchAddress("fCopy",&fCopy);
-    //etree->SetBranchAddress("atmosphere",&atmosphere);
-    etree->SetBranchAddress("fUniqueID",&fUniqueID);
-    etree->SetBranchAddress("fBits",&fBits);
-    etree->SetBranchAddress("fNumBunches",&fNumBunches);
-    etree->SetBranchAddress("fNumSingles",&fNumSingles);
-    etree->SetBranchAddress("fMaxScatOrder",&fMaxScatOrder);
-    //etree->SetBranchAddress("fBunches",&fBunches_);
-    etree->SetBranchAddress("fBunches.fUniqueID",fBunches_fUniqueID);
-    etree->SetBranchAddress("fBunches.fBits",fBunches_fBits);
-    etree->SetBranchAddress("fBunches.fType",fBunches_fType);
-    etree->SetBranchAddress("fBunches.fId",fBunches_fId);
-    etree->SetBranchAddress("fBunches.fWeight",fBunches_fWeight);
-    etree->SetBranchAddress("fBunches.fDatei",fBunches_fDatei);
-    etree->SetBranchAddress("fBunches.fDatef",fBunches_fDatef);
-    etree->SetBranchAddress("fBunches.fShowerAge",fBunches_fShowerAge);
-    etree->SetBranchAddress("fBunches.fShowerPosiX",fBunches_fShowerPosiX);
-    etree->SetBranchAddress("fBunches.fShowerPosiY",fBunches_fShowerPosiY);
-    etree->SetBranchAddress("fBunches.fShowerPosiZ",fBunches_fShowerPosiZ);
-    etree->SetBranchAddress("fBunches.fShowerPosfX",fBunches_fShowerPosfX);
-    etree->SetBranchAddress("fBunches.fShowerPosfY",fBunches_fShowerPosfY);
-    etree->SetBranchAddress("fBunches.fShowerPosfZ",fBunches_fShowerPosfZ);
-    etree->SetBranchAddress("fBunches.fFinalPosX",fBunches_fFinalPosX);
-    etree->SetBranchAddress("fBunches.fFinalPosY",fBunches_fFinalPosY);
-    etree->SetBranchAddress("fBunches.fFinalPosZ",fBunches_fFinalPosZ);
-    etree->SetBranchAddress("fBunches.fMeanDirX",fBunches_fMeanDirX);
-    etree->SetBranchAddress("fBunches.fMeanDirY",fBunches_fMeanDirY);
-    etree->SetBranchAddress("fBunches.fMeanDirZ",fBunches_fMeanDirZ);
-    etree->SetBranchAddress("fBunches.fYield",fBunches_fYield);
-    etree->SetBranchAddress("fBunches.fNumWavelengths",fBunches_fNumWavelengths);
-    etree->SetBranchAddress("fBunches.fWlLambda",fBunches_fWlLambda);
-    etree->SetBranchAddress("fBunches.fWlWeight",fBunches_fWlWeight);
-    etree->SetBranchAddress("fBunches.fFate",fBunches_fFate);
-    etree->SetBranchAddress("fBunches.fSingles",fBunches_fSingles);
-    etree->SetBranchAddress("fBunches.fNumFluoDirect",fBunches_fNumFluoDirect);
-    etree->SetBranchAddress("fBunches.fNumCkovDirect",fBunches_fNumCkovDirect);
-    etree->SetBranchAddress("fBunches.fNumFluoAirScat",fBunches_fNumFluoAirScat);
-    etree->SetBranchAddress("fBunches.fNumCkovAirScat",fBunches_fNumCkovAirScat);
-    etree->SetBranchAddress("fBunches.fNumFluoAeroScat",fBunches_fNumFluoAeroScat);
-    etree->SetBranchAddress("fBunches.fNumCkovAeroScat",fBunches_fNumCkovAeroScat);
-    etree->SetBranchAddress("fBunches.fNumFluoCloudScat",fBunches_fNumFluoCloudScat);
-    etree->SetBranchAddress("fBunches.fNumCkovCloudScat",fBunches_fNumCkovCloudScat);
-    etree->SetBranchAddress("fBunches.fNumFluoReflected",fBunches_fNumFluoReflected);
-    etree->SetBranchAddress("fBunches.fNumCkovReflected",fBunches_fNumCkovReflected);
-    //etree->SetBranchAddress("fSingles",&fSingles_);
-    etree->SetBranchAddress("fSingles.fUniqueID",fSingles_fUniqueID);
-    etree->SetBranchAddress("fSingles.fBits",fSingles_fBits);
-    etree->SetBranchAddress("fSingles.fType",fSingles_fType);
-    etree->SetBranchAddress("fSingles.fBunchId",fSingles_fBunchId);
-    etree->SetBranchAddress("fSingles.fHistory",fSingles_fHistory);
-    etree->SetBranchAddress("fSingles.fAllHistory",fSingles_fAllHistory);
-    etree->SetBranchAddress("fSingles.fAbsorbed",fSingles_fAbsorbed);
-    etree->SetBranchAddress("fSingles.fCloudAbsorbed",fSingles_fCloudAbsorbed);
-    etree->SetBranchAddress("fSingles.fLastTotTrans",fSingles_fLastTotTrans);
-    etree->SetBranchAddress("fSingles.fLastRaylTrans",fSingles_fLastRaylTrans);
-    etree->SetBranchAddress("fSingles.fLastOzoneTrans",fSingles_fLastOzoneTrans);
-    etree->SetBranchAddress("fSingles.fLastAeroTrans",fSingles_fLastAeroTrans);
-    etree->SetBranchAddress("fSingles.fLastCloudTrans",fSingles_fLastCloudTrans);
-    etree->SetBranchAddress("fSingles.fOutFoV",fSingles_fOutFoV);
-    etree->SetBranchAddress("fSingles.fDate",fSingles_fDate);
-    etree->SetBranchAddress("fSingles.fShowerAge",fSingles_fShowerAge);
-    etree->SetBranchAddress("fSingles.fTof",fSingles_fTof);
-    etree->SetBranchAddress("fSingles.fWl",fSingles_fWl);
-    etree->SetBranchAddress("fSingles.fNbinter",fSingles_fNbinter);
-    etree->SetBranchAddress("fSingles.fShowerPosX",fSingles_fShowerPosX);
-    etree->SetBranchAddress("fSingles.fShowerPosY",fSingles_fShowerPosY);
-    etree->SetBranchAddress("fSingles.fShowerPosZ",fSingles_fShowerPosZ);
-    etree->SetBranchAddress("fSingles.fPosX",fSingles_fPosX);
-    etree->SetBranchAddress("fSingles.fPosY",fSingles_fPosY);
-    etree->SetBranchAddress("fSingles.fPosZ",fSingles_fPosZ);
-    etree->SetBranchAddress("fSingles.fMScatDirX",fSingles_fMScatDirX);
-    etree->SetBranchAddress("fSingles.fMScatDirY",fSingles_fMScatDirY);
-    etree->SetBranchAddress("fSingles.fMScatDirZ",fSingles_fMScatDirZ);
-    etree->SetBranchAddress("fCopy",&fCopy);
-    //etree->SetBranchAddress("detector",&detector);
-    etree->SetBranchAddress("fUniqueID",&fUniqueID);
-    etree->SetBranchAddress("fBits",&fBits);
-    etree->SetBranchAddress("fPhotonFillingMode",&fPhotonFillingMode);
-    etree->SetBranchAddress("fNightGlowFillable",&fNightGlowFillable);
-    etree->SetBranchAddress("fRunPars",&fRunPars);
-    etree->SetBranchAddress("fElectronics.fUniqueID",&fElectronics_fUniqueID);
-    etree->SetBranchAddress("fElectronics.fBits",&fElectronics_fBits);
-    etree->SetBranchAddress("fElectronics.fNumActiveGtus",&fElectronics_fNumActiveGtus);
-    etree->SetBranchAddress("fElectronics.fGtuStart",&fElectronics_fGtuStart);
-    etree->SetBranchAddress("fElectronics.fGtuEnd",&fElectronics_fGtuEnd);
-    etree->SetBranchAddress("fElectronics.fNumCells",&fElectronics_fNumCells);
-    etree->SetBranchAddress("fElectronics.fTimeGtu0",&fElectronics_fTimeGtu0);
-    etree->SetBranchAddress("fElectronics.fTimeFirstGtu",&fElectronics_fTimeFirstGtu);
-    etree->SetBranchAddress("fElectronics.fTimeLastGtu",&fElectronics_fTimeLastGtu);
-    etree->SetBranchAddress("fElectronics.fGtuLength",&fElectronics_fGtuLength);
-    etree->SetBranchAddress("fStatus.fUniqueID",&fStatus_fUniqueID);
-    etree->SetBranchAddress("fStatus.fBits",&fStatus_fBits);
-    etree->SetBranchAddress("fStatus.fNumActivePixels",&fStatus_fNumActivePixels);
-    etree->SetBranchAddress("fStatus.fNumSignals",&fStatus_fNumSignals);
-    etree->SetBranchAddress("fStatus.fNumBkg",&fStatus_fNumBkg);
-    etree->SetBranchAddress("fStatus.fNumHits",&fStatus_fNumHits);
-    etree->SetBranchAddress("fStatus.fNumGtu",&fStatus_fNumGtu);
-    etree->SetBranchAddress("fStatus.fNumPhotons",&fStatus_fNumPhotons);
-    etree->SetBranchAddress("fStatus.fPhotonHistory",&fStatus_fPhotonHistory);
-    etree->SetBranchAddress("fStatus.fMaxHits",&fStatus_fMaxHits);
-    etree->SetBranchAddress("fStatus.fMaxBkg",&fStatus_fMaxBkg);
-    etree->SetBranchAddress("fStatus.fMaxSignals",&fStatus_fMaxSignals);
-    etree->SetBranchAddress("fNumPhotons",&fNumPhotons);
-    etree->SetBranchAddress("fNumCellHits",&fNumCellHits);
-    etree->SetBranchAddress("fNumFee",&fNumFee);
-    etree->SetBranchAddress("fNumAFee",&fNumAFee);
-    etree->SetBranchAddress("fNumCells",&fNumCells);
-    etree->SetBranchAddress("fFirstTime",&fFirstTime);
-    etree->SetBranchAddress("fLastTime",&fLastTime);
-    //etree->SetBranchAddress("fPhotons",&fPhotons_);
-    etree->SetBranchAddress("fPhotons.fUniqueID",fPhotons_fUniqueID);
-    etree->SetBranchAddress("fPhotons.fBits",fPhotons_fBits);
-    etree->SetBranchAddress("fPhotons.fType",fPhotons_fType);
-    etree->SetBranchAddress("fPhotons.fTheta",fPhotons_fTheta);
-    etree->SetBranchAddress("fPhotons.fPhi",fPhotons_fPhi);
-    etree->SetBranchAddress("fPhotons.fLambda",fPhotons_fLambda);
-    etree->SetBranchAddress("fPhotons.fTime",fPhotons_fTime);
-    etree->SetBranchAddress("fPhotons.fPosX",fPhotons_fPosX);
-    etree->SetBranchAddress("fPhotons.fPosY",fPhotons_fPosY);
-    etree->SetBranchAddress("fPhotons.fPosZ",fPhotons_fPosZ);
-    etree->SetBranchAddress("fPhotons.fStatusBits",fPhotons_fStatusBits);
-    etree->SetBranchAddress("fPhotons.fShowerPosX",fPhotons_fShowerPosX);
-    etree->SetBranchAddress("fPhotons.fShowerPosY",fPhotons_fShowerPosY);
-    etree->SetBranchAddress("fPhotons.fShowerPosZ",fPhotons_fShowerPosZ);
-    etree->SetBranchAddress("fPhotons.fAge",fPhotons_fAge);
-    etree->SetBranchAddress("fPhotons.fHistory",fPhotons_fHistory);
-    etree->SetBranchAddress("fPhotons.fFate",fPhotons_fFate);
-    etree->SetBranchAddress("fPhotons.fIdealFocalPosX",fPhotons_fIdealFocalPosX);
-    etree->SetBranchAddress("fPhotons.fIdealFocalPosY",fPhotons_fIdealFocalPosY);
-    etree->SetBranchAddress("fPhotons.fIdealFocalPosZ",fPhotons_fIdealFocalPosZ);
-    etree->SetBranchAddress("fPhotons.fFe",fPhotons_fFe);
-    etree->SetBranchAddress("fPhotons.fMacroCell",fPhotons_fMacroCell);
-    etree->SetBranchAddress("fPhotons.fXCell",fPhotons_fXCell);
-    etree->SetBranchAddress("fPhotons.fYCell",fPhotons_fYCell);
-    etree->SetBranchAddress("fPhotons.fGtu",fPhotons_fGtu);
-    etree->SetBranchAddress("fPhotons.fPixelUID",fPhotons_fPixelUID);
-    etree->SetBranchAddress("fPhotons.fSignalId",fPhotons_fSignalId);
-    etree->SetBranchAddress("fPhotons.fCharge",fPhotons_fCharge);
-    etree->SetBranchAddress("fPhotons.fIPeak",fPhotons_fIPeak);
-    etree->SetBranchAddress("fPhotons.fSignalTime",fPhotons_fSignalTime);
-    //etree->SetBranchAddress("fMacroCellHits",&fMacroCellHits_);
-    etree->SetBranchAddress("fMacroCellHits.fUniqueID",&fMacroCellHits_fUniqueID);
-    etree->SetBranchAddress("fMacroCellHits.fBits",&fMacroCellHits_fBits);
-    etree->SetBranchAddress("fMacroCellHits.fCellId",&fMacroCellHits_fCellId);
-    etree->SetBranchAddress("fMacroCellHits.fChUId",&fMacroCellHits_fChUId);
-    etree->SetBranchAddress("fMacroCellHits.fGtu",&fMacroCellHits_fGtu);
-    etree->SetBranchAddress("fMacroCellHits.fCounts",&fMacroCellHits_fCounts);
-    etree->SetBranchAddress("fMacroCellHits.fCellRow",&fMacroCellHits_fCellRow);
-    etree->SetBranchAddress("fMacroCellHits.fCellCol",&fMacroCellHits_fCellCol);
-    etree->SetBranchAddress("fMacroCellHits.fTime",&fMacroCellHits_fTime);
-    //etree->SetBranchAddress("fFee",&fFee_);
-    etree->SetBranchAddress("fFee.fUniqueID",fFee_fUniqueID);
-    etree->SetBranchAddress("fFee.fBits",fFee_fBits);
-    etree->SetBranchAddress("fFee.fGtu",fFee_fGtu);
-    etree->SetBranchAddress("fFee.fFEId",fFee_fFEId);
-    etree->SetBranchAddress("fFee.fChUId",fFee_fChUId);
-    etree->SetBranchAddress("fFee.fNumHits",fFee_fNumHits);
-    etree->SetBranchAddress("fFee.fNumSignals",fFee_fNumSignals);
-    etree->SetBranchAddress("fFee.fHasTriggered",fFee_fHasTriggered);
-    etree->SetBranchAddress("fFee.fChCharge",fFee_fChCharge);
-    //etree->SetBranchAddress("fAFee",&fAFee_);
-    etree->SetBranchAddress("fAFee.fUniqueID",fAFee_fUniqueID);
-    etree->SetBranchAddress("fAFee.fBits",fAFee_fBits);
-    etree->SetBranchAddress("fAFee.fGtu",fAFee_fGtu);
-    etree->SetBranchAddress("fAFee.fMCId",fAFee_fMCId);
-    etree->SetBranchAddress("fAFee.fFEId",fAFee_fFEId);
-    etree->SetBranchAddress("fAFee.fDyCharge",fAFee_fDyCharge);
-    etree->SetBranchAddress("fAFee.fCherTrigg",fAFee_fCherTrigg);
-    //etree->SetBranchAddress("fMacroCell",&fMacroCell_);
-    etree->SetBranchAddress("fMacroCell.fUniqueID",fMacroCell_fUniqueID);
-    etree->SetBranchAddress("fMacroCell.fBits",fMacroCell_fBits);
-    etree->SetBranchAddress("fMacroCell.fMCId",fMacroCell_fMCId);
-    etree->SetBranchAddress("fMacroCell.fNumChips",fMacroCell_fNumChips);
-    etree->SetBranchAddress("fMacroCell.fNumPixels",fMacroCell_fNumPixels);
-    etree->SetBranchAddress("fMacroCell.fNumCounts",fMacroCell_fNumCounts);
-    etree->SetBranchAddress("fMacroCell.fNumFastOrs",fMacroCell_fNumFastOrs);
-    etree->SetBranchAddress("fMacroCell.fHasTriggered",fMacroCell_fHasTriggered);
-    etree->SetBranchAddress("fMacroCell.fGtuTrigger",fMacroCell_fGtuTrigger);
-    etree->SetBranchAddress("fMacroCell.fTriggerWord",fMacroCell_fTriggerWord);
-    etree->SetBranchAddress("fMacroCell.fGtuTriggerCCB",fMacroCell_fGtuTriggerCCB);
-    etree->SetBranchAddress("fMacroCell.fTrigDirCCB",fMacroCell_fTrigDirCCB);
-    etree->SetBranchAddress("fMacroCell.fTrigECRowCCB",fMacroCell_fTrigECRowCCB);
-    etree->SetBranchAddress("fMacroCell.fTrigECColCCB",fMacroCell_fTrigECColCCB);
-    etree->SetBranchAddress("fMacroCell.fTrigChipIDCCB",fMacroCell_fTrigChipIDCCB);
-    etree->SetBranchAddress("fMacroCell.fTrigPDMIDCCB",fMacroCell_fTrigPDMIDCCB);
-    etree->SetBranchAddress("fMacroCell.fTrigMaxCTSCCB",fMacroCell_fTrigMaxCTSCCB);
-    etree->SetBranchAddress("fMacroCell.fTrgWords",fMacroCell_fTrgWords);
-    etree->SetBranchAddress("fMacroCell.fTrgIds",fMacroCell_fTrgIds);
-    //etree->SetBranchAddress("simpledetector",&simpledetector);
-    etree->SetBranchAddress("fUniqueID",&fUniqueID);
-    etree->SetBranchAddress("fBits",&fBits);
-    etree->SetBranchAddress("fEventIsTriggered",&fEventIsTriggered);
-    etree->SetBranchAddress("fPhotonFillingMode",&fPhotonFillingMode);
-    etree->SetBranchAddress("fMeanBgnd",&fMeanBgnd);
-    etree->SetBranchAddress("fTriggerLevel",&fTriggerLevel);
-    etree->SetBranchAddress("fTriggPersistency",&fTriggPersistency);
-    etree->SetBranchAddress("fNbPixelOnSide",&fNbPixelOnSide);
-    etree->SetBranchAddress("fPixelSideLength",&fPixelSideLength);
-    etree->SetBranchAddress("fFirstPixelX",&fFirstPixelX);
-    etree->SetBranchAddress("fFirstPixelY",&fFirstPixelY);
-    etree->SetBranchAddress("fNumPhotons",&fNumPhotons);
-    etree->SetBranchAddress("fNumPhotoElectrons",&fNumPhotoElectrons);
-    etree->SetBranchAddress("fFirstTime",&fFirstTime);
-    etree->SetBranchAddress("fLastTime",&fLastTime);
-    etree->SetBranchAddress("fFirstGTUTime",&fFirstGTUTime);
-    etree->SetBranchAddress("fNbGTUs",&fNbGTUs);
-    etree->SetBranchAddress("fGTUlength",&fGTUlength);
-    etree->SetBranchAddress("fPhotons",&fPhotons);
-    etree->SetBranchAddress("fPhotons.fUniqueID",&fPhotons_fUniqueID);
-    etree->SetBranchAddress("fPhotons.fBits",&fPhotons_fBits);
-    etree->SetBranchAddress("fPhotons.fType",&fPhotons_fType);
-    etree->SetBranchAddress("fPhotons.fTheta",&fPhotons_fTheta);
-    etree->SetBranchAddress("fPhotons.fPhi",&fPhotons_fPhi);
-    etree->SetBranchAddress("fPhotons.fLambda",&fPhotons_fLambda);
-    etree->SetBranchAddress("fPhotons.fTime",&fPhotons_fTime);                  //Branch we are going to use
-    etree->SetBranchAddress("fPhotons.fPosX",&fPhotons_fPosX);
-    etree->SetBranchAddress("fPhotons.fPosY",&fPhotons_fPosY);
-    etree->SetBranchAddress("fPhotons.fPosZ",&fPhotons_fPosZ);
-    etree->SetBranchAddress("fPhotons.fShowerPosX",&fPhotons_fShowerPosX);
-    etree->SetBranchAddress("fPhotons.fShowerPosY",&fPhotons_fShowerPosY);
-    etree->SetBranchAddress("fPhotons.fShowerPosZ",&fPhotons_fShowerPosZ);
-    etree->SetBranchAddress("fPhotons.fAtmoHistory",&fPhotons_fAtmoHistory);
-    etree->SetBranchAddress("fPhotons.fFate",&fPhotons_fFate);
-    etree->SetBranchAddress("fPhotons.fAtmoNbinter",&fPhotons_fAtmoNbinter);
-    //etree->SetBranchAddress("fPhotoElectrons",&fPhotoElectrons_);
-    etree->SetBranchAddress("fPhotoElectrons.fUniqueID",&fPhotoElectrons_fUniqueID);
-    etree->SetBranchAddress("fPhotoElectrons.fBits",&fPhotoElectrons_fBits);
-    etree->SetBranchAddress("fPhotoElectrons.fType",&fPhotoElectrons_fType);
-    etree->SetBranchAddress("fPhotoElectrons.fPixelID",&fPhotoElectrons_fPixelID);
-    etree->SetBranchAddress("fPhotoElectrons.fDist2ShiftToShowPt",&fPhotoElectrons_fDist2ShiftToShowPt);
-    etree->SetBranchAddress("fPhotoElectrons.fTime",&fPhotoElectrons_fTime);
-    etree->SetBranchAddress("fPhotoElectrons.fSNR",&fPhotoElectrons_fSNR);
-    etree->SetBranchAddress("fPhotoElectrons.fTriggered",&fPhotoElectrons_fTriggered);
-    etree->SetBranchAddress("fPhotoElectrons.fWl",&fPhotoElectrons_fWl);
-    etree->SetBranchAddress("fPhotoElectrons.fShowerAge",&fPhotoElectrons_fShowerAge);
-    etree->SetBranchAddress("fPhotoElectrons.fAtmoPosX",&fPhotoElectrons_fAtmoPosX);
-    etree->SetBranchAddress("fPhotoElectrons.fAtmoPosY",&fPhotoElectrons_fAtmoPosY);
-    etree->SetBranchAddress("fPhotoElectrons.fAtmoPosZ",&fPhotoElectrons_fAtmoPosZ);
-    etree->SetBranchAddress("fPhotoElectrons.fAtmoHistory",&fPhotoElectrons_fAtmoHistory);
-    etree->SetBranchAddress("fPhotoElectrons.fAtmoNbinter",&fPhotoElectrons_fAtmoNbinter);
-    //etree->SetBranchAddress("lbltrigger",&lbltrigger);
-    etree->SetBranchAddress("fUniqueID",&fUniqueID);
-    etree->SetBranchAddress("fBits",&fBits);
-    etree->SetBranchAddress("fNumLblTracks",&fNumLblTracks);
-    //etree->SetBranchAddress("fLblTracks",&fLblTracks_);
-    etree->SetBranchAddress("fLblTracks.fUniqueID",&fLblTracks_fUniqueID);
-    etree->SetBranchAddress("fLblTracks.fBits",&fLblTracks_fBits);
-    etree->SetBranchAddress("fLblTracks.fCellId",&fLblTracks_fCellId);
-    etree->SetBranchAddress("fLblTracks.fChipUid",&fLblTracks_fChipUid);
-    etree->SetBranchAddress("fLblTracks.fGtuStart",&fLblTracks_fGtuStart);
-    etree->SetBranchAddress("fLblTracks.fGtuEnd",&fLblTracks_fGtuEnd);
-    etree->SetBranchAddress("fLblTracks.fRowStart",&fLblTracks_fRowStart);
-    etree->SetBranchAddress("fLblTracks.fRowEnd",&fLblTracks_fRowEnd);
-    etree->SetBranchAddress("fLblTracks.fColStart",&fLblTracks_fColStart);
-    etree->SetBranchAddress("fLblTracks.fColEnd",&fLblTracks_fColEnd);
-    etree->SetBranchAddress("fLblTracks.fNumSegs",&fLblTracks_fNumSegs);
-    etree->SetBranchAddress("fLblTracks.fSum",&fLblTracks_fSum);
-    etree->SetBranchAddress("fLblTracks.fTriggerID",&fLblTracks_fTriggerID);
-    etree->SetBranchAddress("fCopy",&fCopy);
-    //etree->SetBranchAddress("PTT_trigger",&PTT_trigger);
-    etree->SetBranchAddress("fUniqueID",&fUniqueID);
-    etree->SetBranchAddress("fBits",&fBits);
-    etree->SetBranchAddress("fNumTrigg",&fNumTrigg);
-    //etree->SetBranchAddress("fPTTFlag",&fPTTFlag_);
-    etree->SetBranchAddress("fPTTFlag.fUniqueID",fPTTFlag_fUniqueID);
-    etree->SetBranchAddress("fPTTFlag.fBits",fPTTFlag_fBits);
-    etree->SetBranchAddress("fPTTFlag.fNumEvt",fPTTFlag_fNumEvt);
-    etree->SetBranchAddress("fPTTFlag.fMaxCount",fPTTFlag_fMaxCount);
-    etree->SetBranchAddress("fPTTFlag.fMaxGtu",fPTTFlag_fMaxGtu);
-    etree->SetBranchAddress("fPTTFlag.fMaxRow",fPTTFlag_fMaxRow);
-    etree->SetBranchAddress("fPTTFlag.fMaxCol",fPTTFlag_fMaxCol);
-    etree->SetBranchAddress("fPTTFlag.fMaxChipID",fPTTFlag_fMaxChipID);
-    etree->SetBranchAddress("fPTTFlag.fPdmID",fPTTFlag_fPdmID);
-    etree->SetBranchAddress("fCopy",&fCopy);
-    //etree->SetBranchAddress("CCB_LTTTrigger",&CCB_LTTTrigger);
-    etree->SetBranchAddress("fUniqueID",&fUniqueID);
-    etree->SetBranchAddress("fBits",&fBits);
-    etree->SetBranchAddress("fNumTrigg",&fNumTrigg);
-    //etree->SetBranchAddress("fCCB_LTTFlag",&fCCB_LTTFlag_);
-    etree->SetBranchAddress("fCCB_LTTFlag.fUniqueID",fCCB_LTTFlag_fUniqueID);
-    etree->SetBranchAddress("fCCB_LTTFlag.fBits",fCCB_LTTFlag_fBits);
-    etree->SetBranchAddress("fCCB_LTTFlag.fNumEvt",fCCB_LTTFlag_fNumEvt);
-    etree->SetBranchAddress("fCCB_LTTFlag.fMaxCount",fCCB_LTTFlag_fMaxCount);
-    etree->SetBranchAddress("fCCB_LTTFlag.fMaxGtu",fCCB_LTTFlag_fMaxGtu);
-    etree->SetBranchAddress("fCCB_LTTFlag.fMaxRow",fCCB_LTTFlag_fMaxRow);
-    etree->SetBranchAddress("fCCB_LTTFlag.fMaxCol",fCCB_LTTFlag_fMaxCol);
-    etree->SetBranchAddress("fCCB_LTTFlag.fMaxChipID",fCCB_LTTFlag_fMaxChipID);
-    etree->SetBranchAddress("fCCB_LTTFlag.fMaxDir",fCCB_LTTFlag_fMaxDir);
-    etree->SetBranchAddress("fCCB_LTTFlag.fPdmID",fCCB_LTTFlag_fPdmID);
-    etree->SetBranchAddress("fCopy",&fCopy);
-    
-    //     This is the loop skeleton
-    //       To read only selected branches, Insert statements like:
-    // etree->SetBranchStatus("*",0);  // disable all branches
-    // TTreePlayer->SetBranchStatus("branchname",1);  // activate branchname
-    
-    //etree->SetBranchStatus("*",0);
-    //etree->SetBranchStatus("fPhotons.fTime",1);
-    
-    //Get the number of entries in the tree
-    Long64_t nentries = etree->GetEntries();
-    std::cout << "Number of entries => " << nentries << std::endl;
-    
-    //Create a TProfile and an histogram
-    hprof = new TProfile("hprof", "Average number of photons detected by the electronics per GTU", 40, 160, 260);
-    TH1F *histo = new TH1F("histo", "fPhotons.fTime histogram (GTU in abscissa)", 40, 160, 260);
-    
-    //Loop on entries
-    Long64_t nbytes = 0;
-    for (Long64_t i=0; i<nentries;i++)
-    {
-        histo->Fill(fPhotons.fTime);
-        histo->Draw();
-        nbytes += etree->GetEntry(i);
-    }
-    
-
-}
Index: af_lal/branches/camille/camille_work/KIT_phase1_study/macros/read.C
===================================================================
--- /esaf_lal/branches/camille/camille_work/KIT_phase1_study/macros/read.C	(revision 167)
+++ 	(revision )
@@ -1,38 +1,0 @@
-void read()
-{
-    // note that we use "new" to create the TFile and TTree objects, because we
-    // want to keep these objects alive when we leave this function.
-    TFile *f = new TFile("/Users/moretto/Documents/thesis/ESAF/Code/esaf_lal/esaf/camille_work/KIT_phase1_study/30_ns_TimeResolution__100_event/simu.root");
-    TTree *etree = (TTree*)f->Get("etree");
-    
-    // create a pointer to an EDetPhoton object for reading the branch values.
-    EDetPhoton *edetphoton = new EDetPhoton();
-    
-    // get a branche and set the branch address
-    etree->SetBranchAddress("fPhotons.fSignalTime", &edetphoton);
-    
-    
-    //Get the number of entries in the tree
-    Long64_t nentries = etree->GetEntries();
-    std::cout << "**************************" << std::endl;
-    std::cout << "Number of entries => " << nentries << std::endl;
-    std::cout << "**************************" << std::endl;
-    
-    //Create a TProfile and an histogram
-    hprof = new TProfile("hprof", "Average number of photons detected by the electronics per GTU", 40, 160, 260);
-    TH1F *histo = new TH1F("histo", "fPhotons.fTime histogram (GTU in abscissa)", 40, 160, 260);
-
-    //Loop on entries
-    Long64_t nbytes = 0;
-    for (Long64_t i=0; i<nentries;i++)
-    {
-
-        //histo->Fill("fPhotons.fSignalTime");
-        //histo->Draw();
-    }
-
-    etree->GetEntry(0);
-    etree->Draw("fPhotons.fSignalTime");
-
-    
-}
Index: af_lal/branches/camille/camille_work/KIT_phase1_study/macros/write.c
===================================================================
--- /esaf_lal/branches/camille/camille_work/KIT_phase1_study/macros/write.c	(revision 167)
+++ 	(revision )
@@ -1,58 +1,0 @@
-//
-//  write.c
-//  
-//
-//  Created by moretto on 28/05/13.
-//
-//
-
-void write() {
-    // check to see if the event class is in the dictionary
-    // if it is not load the definition in libEvent.so
-    if (!TClassTable::GetDict("Event")) {
-        gSystem->Load("$ROOTSYS/test/libEvent.so");
-    }
-    // create a Tree file tree4.root
-    TFile f("tree4.root","RECREATE");
-    // create a ROOT Tree
-    TTree t4("t4","A Tree with Events");
-    // create a pointer to an Event object
-    Event *event = new Event();
-    // create two branches, split one
-    t4.Branch("event_branch", "Event", &event,16000,2);
-    t4.Branch("event_not_split", "Event", &event,16000,0);
-    
-    // a local variable for the event type
-    char etype[20];
-    
-    // fill the tree
-    for (Int_t ev = 0; ev <100; ev++) {
-        Float_t sigmat, sigmas;
-        gRandom->Rannor(sigmat,sigmas);
-        Int_t ntrack   = Int_t(600 + 600 *sigmat/120.);
-        Float_t random = gRandom->Rndm(1);
-        sprintf(etype,"type%d",ev%5);
-        event->SetType(etype);
-        event->SetHeader(ev, 200, 960312, random);
-        event->SetNseg(Int_t(10*ntrack+20*sigmas));
-        event->SetNvertex(Int_t(1+20*gRandom->Rndm()));
-        event->SetFlag(UInt_t(random+0.5));
-        event->SetTemperature(random+20.);
-        for(UChar_t m = 0; m < 10; m++) {
-            event->SetMeasure(m, Int_t(gRandom->Gaus(m,m+1)));
-        }
-        // continuedâŠ
-        // fill the matrix
-        for(UChar_t i0 = 0; i0 < 4; i0++) {
-            for(UChar_t i1 = 0; i1 < 4; i1++) {
-                event->SetMatrix(i0,i1,gRandom->Gaus(i0*i1,1));
-            }
-        }
-        // create and fill the Track objects
-        for (Int_t t = 0; t < ntrack; t++) event->AddTrack(random);
-        t4.Fill();      // Fill the tree
-        event->Clear(); // Clear before reloading event
-    }
-    f.Write();            // Write the file header
-    t4.Print();           // Print the tree contents
-}
