]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/AliITSFindClustersV2.C
Use default errors in case the vertexer didn't find any
[u/mrichter/AliRoot.git] / ITS / AliITSFindClustersV2.C
CommitLineData
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 19extern AliRun *gAlice;
03248e6d 20
c630aafd 21Int_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");
7d62fb64 60
61 if(SlowOrFast=='s'){
62 AliITSclustererV2 clusterer(geom);
c630aafd 63
7d62fb64 64 TStopwatch timer;
65 if (nev>rl->GetNumberOfEvents()) nev=rl->GetNumberOfEvents();
66 for (Int_t i=0; i<nev; i++) {
c630aafd 67 cerr<<"Processing event number: "<<i<<endl;
68 rl->GetEvent(i);
7d62fb64 69
c630aafd 70 TTree *out=itsl->TreeR();
71 if (!out) {
7d62fb64 72 itsl->MakeTree("R");
73 out=itsl->TreeR();
c630aafd 74 }
7d62fb64 75
76 TTree *in=itsl->TreeD();
77 if (!in) {
78 cerr<<"Can't get digits tree !\n";
79 return 4;
c630aafd 80 }
7d62fb64 81 clusterer.Digits2Clusters(in,out);
82 itsl->WriteRecPoints("OVERWRITE");
83 timer.Stop(); timer.Print();
84 }
c630aafd 85
7d62fb64 86 } else{
87
88 for(Int_t i=0;i<3;i++){
89 ITS->SetSimulationModel(i,new AliITSsimulationFastPoints());
90 }
91
92 TStopwatch timer;
93 for (Int_t i=0; i<nev; i++) {
94 rl->GetEvent(i);
95 if(itsl->TreeR()== 0x0) itsl->MakeTree("R");
96 TTree* in = (TTree*)itsl->TreeH();
97 TTree* out= (TTree*)itsl->TreeR();
98 timer.Start();
99 ITS->Hits2Clusters(in,out);
100 timer.Stop(); timer.Print();
c630aafd 101 itsl->WriteRecPoints("OVERWRITE");
7d62fb64 102 }
88cb7938 103 }
c630aafd 104
88cb7938 105 delete rl;
88cb7938 106
c630aafd 107 return 0;
03248e6d 108}
109
110
111