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

#include <map>
#include "TKey.h"
#include "TList.h"
#include <TROOT.h>
#include <TRint.h>
#include <TTree.h>
#include <TFile.h>
#include <stdlib.h>
#include <TSystem.h>
#include <iostream>
#include <sstream>
#include "Log.hh"
#include "MicroException.hh"
#include <string>
#include "mysql/Mysql.hh"
#include "root/MTRun.hh"
#include "root/MTTrack.hh"
#include "root/MTChamber.hh"
#include "root/MTDetector.hh"
#include "root/MTBoard.hh"
#include "root/MTChip.hh"
#include "root/MTChannel.hh"
#include "root/MTEvent.hh"
#include "root/MTDif.hh"
#include "root/MTHardroc1Chip.hh"
#include "root/MTHardroc2Chip.hh"
#include "root/MTDiracChip.hh"
#include "root/MTMicrorocChip.hh"

Include dependency graph for time.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 41 of file time.cpp.

00041                               {
00042 
00043    if ( argc !=2  ) {
00044    FILE_LOG(logERROR)  << "usage: example rootFile " << endl;
00045    exit(1);
00046   }
00047 
00048   string rootName;
00049   rootName.assign(argv[1]);
00050   int nbHit = 0;
00051   int nbEvt = 0;
00052 
00053   TFile f(rootName.c_str());
00054   f.ls();
00055 
00056 
00057 
00058   TIter nextkey(f.GetListOfKeys());
00059   TKey *key;
00060   while (key = (TKey*)nextkey()) 
00061   {
00062     TTree *tree = (TTree*)key->ReadObj();                
00063 
00064 
00065   MTEvent *evt =  new MTEvent();
00066   TBranch *branch= tree->GetBranch("MTEvent");
00067   branch->SetAddress(&evt);
00068 
00069   MTChannel* channel =NULL;
00070   int nbEntries = tree->GetEntries();
00071 
00072   for ( int evtNum = 0; evtNum < 2 ; evtNum++)
00073   {
00074     tree->GetEntry(evtNum);
00075     nbEvt++;
00076      bool show = false;
00077 
00078 
00079 
00080 
00081       UInt_t evtMin = 0xffffffff;
00082       UInt_t evtMax = 0x0;
00083 
00084       int nbChannel = evt->GetNchannel();
00085       //evt->GetChannels()->Sort();
00086       for(int i=0;i<nbChannel  ;i++)
00087       {
00088         nbHit++;
00089         channel = (MTChannel*)evt->GetChannels()->UncheckedAt(i);
00090 
00091 
00092         i32 deltaT = channel->GetBcId_Dif() - channel->GetBcId_Hit();
00093         ui32 absTime = channel->GetAbsTime();
00094         if (deltaT < 0  )
00095         {
00096           cout << "deltaT < 0"<<endl;
00097         }
00098         show = true;
00099         cout << "**** Event Information "<< dec << evtNum+1 << "/" << nbEntries<< " ****" <<  endl;
00100           cout << "      channel num :           " << i <<endl;
00101           cout << "      deltaT :           " << deltaT <<endl;
00102           cout << "      bcId dif:           " << channel->GetBcId_Dif() <<endl;
00103           cout << "      bcId hit:           " << channel->GetBcId_Hit() <<endl;
00104           cout << "    event id:" << evt->GetEventId() <<endl;
00105 
00106           cout << "      chamber id:         " << channel->GetChamberId() <<endl;
00107           cout << "      dif id:             " << channel->GetDifId() <<endl;
00108           cout << "      boardId id:         " << channel->GetBoardId() <<endl;
00109           cout << "      chip id(format dec):" << dec << channel->GetChipId() <<endl;
00110           cout << "      hard id    :        " << dec << channel->GetHardId() <<endl;
00111           cout << "      bcId abs:           " << channel->GetBcId_Abs() <<endl;
00112           cout << "      absolute time:bcid_abs - (bcid_dif - bcid_hit)       " << absTime <<endl;
00113           cout << "      nbHit for this absolute time:" << evt->GetNbHitPerAbsTime(channel->GetSoftId().GetBoardId(),absTime)<<endl;
00114       //}
00115       //else  {
00116         //if ( i ==0 ) 
00117         //{
00118          // cout << "**** Event Information "<< dec << evtNum+1 << "/" << nbEntries<< " ****" <<  endl;
00119         //  cout << "----     bcId  abs  " << channel->GetBcId_Abs()  <<endl;
00120         //  cout << "----      absolute time:bcid_abs + (bcid_dif - bcid_hit)       " << absTime <<endl;
00121         //}
00122       //}
00123       
00124         if ( absTime > evtMax ) evtMax = absTime;
00125         if ( absTime < evtMin ) evtMin = absTime;
00126       } // END LOOP ON CHANNELHIT
00127      cout << "Min Evt absTime: " << evtMin << endl;
00128      cout << "Max Evt absTime: " << evtMax << endl;
00129     } // END LOOP ON EVENT
00130     cout << "End of TTree[" << tree->GetName() << "]" <<endl;
00131     cout << endl << "** Nombre d Event["<< nbEvt <<"] ** "<< endl;
00132     cout << endl << "** Nombre de Hits["<< nbHit <<"] ** "<< endl;
00133 
00134   } // end loop on TKEy
00135 return 0 ;
00136 }


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