]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/AliITSDigits2RecPoints.C
new TTask to replace non-working AliITSFindClusterV2.C macro.
[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
f4db0776 32 if (gAlice) {delete gAlice; gAlice = 0;}
cc2535cd 33 TFile *retfil = 0;
34 TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject(FileName);
35 if (file) {file->Close(); delete file; file = 0;}
36 if(acctype.Contains("U")){
37 file = new TFile(FileName,"update");
38 }
39 if(acctype.Contains("N") && !file){
40 file = new TFile(FileName,"recreate");
41 }
42 if(!file) file = new TFile(FileName); // default readonly
43 if (!file->IsOpen()) {
44 cerr<<"Can't open "<<FileName<<" !" << endl;
45 return retfil;
46 }
47
48 // Get AliRun object from file or return if not on file
f4db0776 49 // if (gAlice) {delete gAlice; gAlice = 0;}
cc2535cd 50 gAlice = (AliRun*)file->Get("gAlice");
51 if (!gAlice) {
52 cerr << "AliRun object not found on file"<< endl;
53 return retfil;
54 }
55 return file;
af8e1c2d 56}