]>
Commit | Line | Data |
---|---|---|
c630aafd | 1 | /**************************************************************************** |
2 | * Origin: I.Belikov, CERN, Jouri.Belikov@cern.ch * | |
3 | ****************************************************************************/ | |
f2718ade | 4 | |
c630aafd | 5 | #if !defined(__CINT__) || defined(__MAKECINT__) |
88cb7938 | 6 | #include <Riostream.h> |
03248e6d | 7 | |
8 | #include "AliRun.h" | |
88cb7938 | 9 | #include "AliRunLoader.h" |
c630aafd | 10 | #include "AliITSLoader.h" |
03248e6d | 11 | #include "AliITS.h" |
12 | #include "AliITSgeom.h" | |
f2718ade | 13 | #include "AliITSclustererV2.h" |
03248e6d | 14 | |
c630aafd | 15 | #include "TTree.h" |
f2718ade | 16 | #include "TStopwatch.h" |
03248e6d | 17 | #endif |
18 | ||
c630aafd | 19 | extern AliRun *gAlice; |
03248e6d | 20 | |
c630aafd | 21 | Int_t AliITSFindClustersV2(Int_t nev=5, Char_t SlowOrFast='s') { |
22 | ||
23 | cerr<<"Looking for clusters...\n"; | |
24 | ||
25 | if (gAlice) { | |
88cb7938 | 26 | delete gAlice->GetRunLoader(); |
27 | delete gAlice; | |
28 | gAlice=0; | |
c630aafd | 29 | } |
88cb7938 | 30 | |
c630aafd | 31 | AliRunLoader *rl = AliRunLoader::Open("galice.root"); |
32 | if (rl == 0x0) { | |
33 | cerr<<"AliITSFindClustersV2.C : Can not open session RL=NULL"<< endl; | |
34 | return 1; | |
35 | } | |
88cb7938 | 36 | |
c630aafd | 37 | AliITSLoader *itsl = (AliITSLoader*)rl->GetLoader("ITSLoader"); |
38 | if (itsl == 0x0) { | |
39 | cerr<<"AliITSFindClustersV2.C : can not get ITS loader"<< endl; | |
40 | return 2; | |
41 | } | |
42 | ||
43 | rl->LoadKinematics(); | |
44 | ||
45 | Int_t retval = rl->LoadgAlice(); | |
46 | if (retval) { | |
47 | cerr<<"AliITSFindClustersV2.C : LoadgAlice returned error"<< endl; | |
48 | delete rl; | |
49 | return 3; | |
50 | } | |
f2718ade | 51 | |
c630aafd | 52 | gAlice=rl->GetAliRun(); |
88cb7938 | 53 | AliITS *ITS = (AliITS*)gAlice->GetModule("ITS"); |
54 | if (!ITS) { cerr<<"Can't find the ITS !\n"; delete rl; return 3; } | |
03248e6d | 55 | AliITSgeom *geom=ITS->GetITSgeom(); |
c630aafd | 56 | |
57 | itsl->LoadRecPoints("recreate"); | |
58 | if (SlowOrFast=='s') itsl->LoadDigits("read"); | |
59 | else itsl->LoadHits("read"); | |
60 | ||
61 | AliITSclustererV2 clusterer(geom); | |
62 | ||
63 | TStopwatch timer; | |
64 | if (nev>rl->GetNumberOfEvents()) nev=rl->GetNumberOfEvents(); | |
65 | for (Int_t i=0; i<nev; i++) { | |
66 | cerr<<"Processing event number: "<<i<<endl; | |
67 | rl->GetEvent(i); | |
68 | ||
69 | TTree *out=itsl->TreeR(); | |
70 | if (!out) { | |
71 | itsl->MakeTree("R"); | |
72 | out=itsl->TreeR(); | |
73 | } | |
74 | ||
75 | if (SlowOrFast=='s') { | |
76 | TTree *in=itsl->TreeD(); | |
77 | if (!in) { | |
78 | cerr<<"Can't get digits tree !\n"; | |
79 | return 4; | |
80 | } | |
81 | clusterer.Digits2Clusters(in,out); | |
82 | } else { | |
83 | TTree *in=itsl->TreeH(); | |
84 | if (!in) { | |
85 | cerr<<"Can't get hits tree !\n"; | |
86 | return 5; | |
87 | } | |
88 | clusterer.Hits2Clusters(in,out); | |
89 | } | |
90 | ||
91 | itsl->WriteRecPoints("OVERWRITE"); | |
88cb7938 | 92 | } |
c630aafd | 93 | timer.Stop(); timer.Print(); |
94 | ||
88cb7938 | 95 | delete rl; |
88cb7938 | 96 | |
c630aafd | 97 | return 0; |
03248e6d | 98 | } |
99 | ||
100 | ||
101 |