AliRoot Core  a565103 (a565103)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliTPCHits2Digits.C
Go to the documentation of this file.
1 
3 #if !defined(__CINT__) || defined(__MAKECINT__)
4  #include <Riostream.h>
5 
6  #include "AliRun.h"
7  #include "AliRunLoader.h"
8  #include "AliLoader.h"
9  #include "AliTPC.h"
10 
11  #include "TStopwatch.h"
12 #endif
13 
14 extern AliRun *gAlice;
15 
16 Int_t AliTPCHits2Digits(Int_t nev=5) {
18 
19  if (gAlice) {
20  delete AliRunLoader::Instance();
21  delete gAlice;//if everything was OK here it is already NULL
22  gAlice = 0x0;
23  }
24 
25  AliRunLoader *rl = AliRunLoader::Open("galice.root","Event","update");
26  if (!rl) {
27  cerr<<"Can't load RunLoader from "<<endl;
28  return 1;
29  }
30 
31  // Get AliRun object from file or create it if not on file
32 
33  rl->LoadgAlice();
34 
35  gAlice = rl->GetAliRun();
36  if (!gAlice) {
37  cerr<<"AliTPCHits2Digits.C : AliRun object not found on file\n";
38  return 2;
39  }
40 
41  AliTPC *TPC = (AliTPC*)gAlice->GetDetector("TPC");
42  AliLoader * tpcl = rl->GetLoader("TPCLoader");
43  if ((TPC == 0x0) || (tpcl == 0x0)) {
44  cerr<<"AliTPCHits2Digits.C : Can not find TPC or TPCLoader\n";
45  delete rl;
46  return 3;
47  }
48  tpcl->LoadHits("READ");
49  tpcl->LoadDigits("recreate");
50 
51  TStopwatch timer;
52  timer.Start();
53 
54  // uncomment below lines to set sectors active
55  // Int_t sec[10]={0,1,2,3,4,5,6,7,8,9};
56  // TPC->SetActiveSectors(sec,10);
57 
58  for (Int_t i=0; i<nev; i++){
59  printf("Processing event %d \n",i);
60  if(rl->GetEvent(i)) break;
61  TPC->SetActiveSectors(); // all sectors set active
62  TPC->Hits2Digits(i);
63  }
64 
65  delete rl;
66 
67  timer.Stop();
68  timer.Print();
69 
70  return 0;
71 }
72 
printf("Chi2/npoints = %f\n", TMath::Sqrt(chi2/npoints))
TFile * Open(const char *filename, Long64_t &nevents)
Int_t AliTPCHits2Digits(Int_t nev=5)
AliRun * gAlice