]>
Commit | Line | Data |
---|---|---|
a23b2a58 | 1 | #if !defined(__CINT__) || defined(__MAKECINT__) |
2 | ||
3 | #include "iostream.h" | |
4 | #include "TDatime.h" | |
5 | #include "TFile.h" | |
6 | #include "TString.h" | |
7 | #include "../STEER/AliRun.h" | |
8 | #include "../STEER/AliRunDigitizer.h" | |
9 | #include "ITS/AliITSDigitizer.h" | |
10 | #include "ITS/AliITS.h" | |
11 | #include "ITS/AliITSDetType.h" | |
12 | #include "ITS/AliITSresponseSDD.h" | |
13 | #include "TStopwatch.h" | |
14 | ||
15 | Bool_t GaliceITSok(); | |
16 | TFile* AccessFile(TString inFile="galice.root", TString acctype="R"); | |
17 | void writeAR(TFile * fin, TFile *fou); | |
18 | Int_t ChangeITSDefaults(TFile *hitfile,AliITS *ITS,TString opt=""); | |
19 | void loadlibs(); | |
20 | ||
21 | #endif | |
22 | ||
23 | //#define DEBUG | |
24 | ||
25 | Int_t AliITSd2r(TString df="galice.root",TString rf="",TString opt=""){ | |
26 | // Produce ITS RecPoints from Digits. | |
27 | ||
28 | // Dynamically link some shared libs | |
29 | if (gClassTable->GetID("AliRun") < 0) { | |
30 | gROOT->LoadMacro("loadlibs.C"); | |
31 | loadlibs(); | |
32 | } // end if | |
33 | gROOT->LoadMacro("$(ALICE_ROOT)/ITS/AliITSstandard.C"); | |
34 | ||
35 | TFile *dfp = 0, *rfp = 0; | |
36 | if(!GaliceITSok()){ | |
37 | // gAlice not define. Must open a file and read it in. | |
38 | if(rf.CompareTo(df) == 0 || rf.CompareTo("") == 0) { | |
39 | // Input file = output file | |
40 | dfp = AccessFile(df,"U"); // input file open for update. | |
41 | }else{ // Input file different from output file. | |
42 | dfp = AccessFile(df,"R"); // input file open as read only | |
43 | // open output file and create TreeR on it | |
44 | rfp = new TFile(rp,"NEW"); | |
45 | } // end if | |
46 | } // end if !GALICEITSOK() | |
47 | AliITS *ITS = (AliITS*)gAlice->GetDetector("ITS"); | |
48 | ||
49 | ChangeITSDefaults(dfp,ITS,opt); | |
50 | // write the AliRun object to the output file if different from input file. | |
51 | if(rfp) { | |
52 | writeAR(dfp,rfp); | |
53 | rfp->Close(); // Manager will open in update mode. | |
54 | } // end if | |
55 | ||
56 | TStopwatch timer; | |
57 | ||
58 | #ifdef DEBUG | |
59 | cout << "Creating reconstructed points from digits for the ITS..." << endl; | |
60 | #endif | |
61 | if(dfp!=0) | |
62 | AliITSreconstruction *itsr = new AliITSreconstruction(df.Data()); | |
63 | else | |
64 | AliITSreconstruction *itsr = new AliITSreconstruction(0); | |
65 | if(df.CompareTo(rf)!=0 && rf.CompareTo("")!=0) { | |
66 | itsr->SetOutputFile(rf.Data()); | |
67 | } // end if | |
68 | timer.Start(); | |
69 | itsr->Init(); | |
70 | itsr->Exec(); | |
71 | timer.Stop(); | |
72 | timer.Print(); | |
73 | delete itsr; | |
74 | ||
75 | if(rfp!=0){ | |
76 | cout <<"After Reconstruction "<<rf<<" size ="<< rfp->GetSize()<< endl; | |
77 | }else if(dfp!=0){ | |
78 | cout <<"After Reconstruction "<<df<<" size ="<< dfp->GetSize()<< endl; | |
79 | } // end if sf1!=0 | |
80 | return 0; | |
81 | } |