]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/AliITSDigits2RecPoints.C
new macros compliant with multiple events/files for TreeS,D,R
[u/mrichter/AliRoot.git] / ITS / AliITSDigits2RecPoints.C
CommitLineData
cc2535cd 1TFile* AccessFile(TString inFile="galice.root", TString acctype="R");
2
3void AliITSDigits2RecPoints(TString inFile="galice.root", TString outFile="galice.root"){
4
5 TFile *file;
6 if(outFile.Data() == inFile.Data()){
7 file = AccessFile(inFile,"U");
8 }
9 else {
10 file = AccessFile(inFile);
11 }
12
13 TStopwatch timer;
14
15 cout << "Creating reconstructed points from digits for the ITS..." << endl;
16 const char *nulptr=0;
17 AliITSreconstruction *itsr = new AliITSreconstruction(nulptr);
18 if(outFile.Data() != inFile.Data())itsr->SetOutputFile(outFile);
19 timer.Start();
20 itsr->Init();
21 itsr->Exec();
22 timer.Stop();
23 timer.Print();
24 delete itsr;
25}
26
27//-------------------------------------------------------------------
28TFile * AccessFile(TString FileName, TString acctype){
29
30 // Function used to open the input file and fetch the AliRun object
31
32 TFile *retfil = 0;
33 TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject(FileName);
34 if (file) {file->Close(); delete file; file = 0;}
35 if(acctype.Contains("U")){
36 file = new TFile(FileName,"update");
37 }
38 if(acctype.Contains("N") && !file){
39 file = new TFile(FileName,"recreate");
40 }
41 if(!file) file = new TFile(FileName); // default readonly
42 if (!file->IsOpen()) {
43 cerr<<"Can't open "<<FileName<<" !" << endl;
44 return retfil;
45 }
46
47 // Get AliRun object from file or return if not on file
48 if (gAlice) {delete gAlice; gAlice = 0;}
49 gAlice = (AliRun*)file->Get("gAlice");
50 if (!gAlice) {
51 cerr << "AliRun object not found on file"<< endl;
52 return retfil;
53 }
54 return file;
af8e1c2d 55}