/data3/calcul/jacquem/working_dir/Micromegas/micromegasFrameWork/src/analyse/root/powerPulse.cpp

Go to the documentation of this file.
00001 /* @version $Revision: 1871 $ * @modifiedby $Author: jacquem $ * @lastmodified $Date: 2012-08-29 09:45:12 +0200 (Wed, 29 Aug 2012) $ */
00002 #include <map>
00003 #include "TKey.h"
00004 #include <TROOT.h>
00005 #include <TStyle.h>
00006 #include <TRint.h>
00007 #include <TKey.h>
00008 #include <TTree.h>
00009 #include <TCanvas.h>
00010 #include "TH1.h"
00011 #include "TF1.h"
00012 #include <TH1I.h>
00013 #include <TH2I.h>
00014 #include <TFile.h>
00015 #include <stdlib.h>
00016 #include <TSystem.h>
00017 #include <iostream>
00018 #include "TApplication.h"
00019 #include <sstream>
00020 #include "Log.hh"
00021 #include <Rtypes.h>
00022 #include <TCanvas.h>
00023 #include "TColor.h"
00024 #include "TFunction.h"
00025 #include "TAttLine.h"
00026 #include "TPaveStats.h"
00027 #include "MicroException.hh"
00028 #include <string>
00029 
00030 
00031 
00032 #include "mTypes.h"
00033 
00034 #include "root/MTRun.hh"
00035 #include "root/MTChannel.hh"
00036 #include "root/MTEvent.hh"
00037 
00038 using namespace std;
00039 
00040 
00041 int main(int argc, char**argv){
00042         gROOT->Reset();
00043         
00044         gROOT->SetStyle("Plain");
00045         gStyle->SetTitleBorderSize(0);
00046         gStyle->SetTitleX(0.35);
00047         gStyle->SetTitleY(0.995);
00048 
00049         gStyle->SetFrameFillStyle(0);
00050         gStyle->SetOptStat("");
00051         gStyle->SetOptFit(0111);
00052         gStyle->SetStatX(0.9);
00053         gStyle->SetStatY(0.9);
00054         gStyle->SetStatH(0.1);
00055         gStyle->SetStatW(0.1);
00056 
00057         gStyle->SetOptStat("") ;
00058         gStyle->SetOptFit(0000);        
00059         
00060         gStyle->SetOptStat("");
00061         gStyle->SetOptFit(10001);
00062         
00063         
00064         
00065         
00066    if ( argc !=2  ) {
00067    FILE_LOG(logERROR)  << "usage: analog rootFile " << endl;
00068    exit(1);
00069   }
00070 
00071   string rootName;
00072   rootName.assign(argv[1]);
00073   int nbHit = 0;
00074   int nbEvt = 0;
00075 
00076   //TApplication *theApp  = NULL;
00077 
00078  // theApp  = new TRint("App",NULL,NULL );
00079 
00080 
00081   TFile *output= new TFile("output.root","RECREATE");
00082 
00083 
00084   UInt_t nb_ped=0 ;     // cut on number of pedestal event
00085 
00086   TFile f(rootName.c_str());
00087   TIter nextkey(f.GetListOfKeys());
00088   TKey *key;
00089   //TH1I * dacPed = new TH1I("ped","",391643019,820234834,1211877853);
00090   //TH1I * dacPed = new TH1I("ped","",100000,820234834,1211877853); //1109
00091   // TH1I * dacPed = new TH1I("ped","",100000,1682148314,2170757373); // 1112
00092   // TH1I * dacPed = new TH1I("ped","",100000,2437670539,2850616067); // 1114
00093   // TH1I * dacPed = new TH1I("ped","",100000,3098777110,3548395920); // 1116
00094    //TH1I * dacPed = new TH1I("ped","",100000,12721389,4293974986); // 1118
00095    TH1I * dacPed = new TH1I("ped","",100000,0,10000000000); // 1116
00096 
00097 
00098 
00099 
00100   UInt_t min = 0xffffffff;
00101   UInt_t max = 0;
00102 
00103   while (key = (TKey*)nextkey()) 
00104   {
00105     TTree *tree = (TTree*)key->ReadObj();                
00106 
00107     MTEvent *evt =  new MTEvent();
00108     TBranch *branch= tree->GetBranch("MTEvent");
00109     branch->SetAddress(&evt);
00110 
00111     MTChannel* channel =NULL;
00112     int nbEntries = tree->GetEntries();
00113 
00114     for ( int evtNum = 0; evtNum < nbEntries ; evtNum++)
00115     {
00116       tree->GetEntry(evtNum);
00117       nbEvt++;
00118 
00119       int nbChannel = evt->GetNchannel();
00120       for(int i=0;i<nbChannel  ;i++)
00121       {
00122         nbHit++;
00123         channel = (MTChannel*)evt->GetChannels()->UncheckedAt(i);
00124                     UInt_t absTime = (channel->GetBcIdAbs() ); 
00125         if ( absTime > max ) max = absTime;
00126         if ( absTime < min ) min = absTime;
00127         dacPed->Fill(absTime,1);
00128       }
00129     }
00130   }
00131   cout << "max " << max << endl;
00132   cout << "min " << min << endl;
00133  output->cd();
00134  dacPed->Write("");
00135 
00136         
00137 //   theApp->Run();
00138  //  delete theApp;
00139     return 0 ;
00140 }
00141 
00142 
00143 
00144 

Generated on Mon Jan 7 13:15:21 2013 for MicromegasFramework by  doxygen 1.4.7