/data3/calcul/jacquem/working_dir/Micromegas/micromegasFrameWork/src/analyse/root/analog.cpp File Reference

#include <map>
#include "TKey.h"
#include <TROOT.h>
#include <TStyle.h>
#include <TRint.h>
#include <TTree.h>
#include <TCanvas.h>
#include "TH1.h"
#include "TF1.h"
#include <TH1I.h>
#include <TH2I.h>
#include <TFile.h>
#include <stdlib.h>
#include <TSystem.h>
#include <iostream>
#include "TApplication.h"
#include <sstream>
#include "Log.hh"
#include <Rtypes.h>
#include "TColor.h"
#include "TFunction.h"
#include "TAttLine.h"
#include "TPaveStats.h"
#include "MicroException.hh"
#include <string>
#include "root/MTChannel.hh"
#include "root/MTEvent.hh"

Include dependency graph for analog.cpp:

Go to the source code of this file.

Functions

int main (int argc, char **argv)


Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 39 of file analog.cpp.

00039                               {
00040         gROOT->Reset();
00041         
00042         gROOT->SetStyle("Plain");
00043         gStyle->SetTitleBorderSize(0);
00044         gStyle->SetTitleX(0.35);
00045         gStyle->SetTitleY(0.995);
00046 
00047         gStyle->SetFrameFillStyle(0);
00048         gStyle->SetOptStat("");
00049         gStyle->SetOptFit(0111);
00050         gStyle->SetStatX(0.9);
00051         gStyle->SetStatY(0.9);
00052         gStyle->SetStatH(0.1);
00053         gStyle->SetStatW(0.1);
00054 
00055         gStyle->SetOptStat("") ;
00056         gStyle->SetOptFit(0000);        
00057         
00058         gStyle->SetOptStat("");
00059         gStyle->SetOptFit(10001);
00060         
00061         
00062         
00063         
00064    if ( argc !=2  ) {
00065    FILE_LOG(logERROR)  << "usage: analog rootFile " << endl;
00066    exit(1);
00067   }
00068 
00069   string rootName;
00070   rootName.assign(argv[1]);
00071   int nbHit = 0;
00072   int nbEvt = 0;
00073 
00074   TApplication *theApp  = NULL;
00075 
00076   theApp  = new TRint("App",NULL,NULL );
00077 
00078 
00079   TFile *output= new TFile("output.root","RECREATE");
00080 
00081 
00082   UInt_t nb_ped=0 ;     // cut on number of pedestal event
00083 
00084   TFile f(rootName.c_str());
00085   TIter nextkey(f.GetListOfKeys());
00086   TKey *key;
00087   while (key = (TKey*)nextkey()) 
00088   {
00089     TTree *tree = (TTree*)key->ReadObj();                
00090 
00091     MTEvent *evt =  new MTEvent();
00092     TBranch *branch= tree->GetBranch("MTEvent");
00093     branch->SetAddress(&evt);
00094 
00095     MTChannel* channel =NULL;
00096     int nbEntries = tree->GetEntries();
00097 
00098     for ( int evtNum = 0; evtNum < 5 ; evtNum++)
00099     {
00100       cout << "New dacPed" << endl;
00101       TH1I * dacPed = new TH1I("ped","",100000,0,50000);
00102       tree->GetEntry(evtNum);
00103       nbEvt++;
00104       UInt_t channel68 = 0;
00105 
00106                   UInt_t absTime = 0 ;
00107 
00108       int nbChannel = evt->GetNchannel();
00109       for(int i=0;i<nbChannel  ;i++)
00110       {
00111         nbHit++;
00112         channel = (MTChannel*)evt->GetChannels()->UncheckedAt(i);
00113 
00114         UInt_t adc = channel->GetAnalogValue();
00115         UInt_t id = channel->GetSoftId().GetValue()  - 304000000;
00116 
00117         cout << "Id[" << id << "] adc" << adc << endl;
00118 
00119                         dacPed->Fill(id,adc);
00120       }
00121       output->cd();
00122       dacPed->Write("");
00123     }
00124   }
00125 
00126         
00127    theApp->Run();
00128    delete theApp;
00129     return 0 ;
00130 }


Generated on Mon Jan 7 13:17:07 2013 for MicromegasFramework by  doxygen 1.4.7