]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/ITSdigitBari.C
Fixed bug with GetCovMatrix returning a pointer to a deleted local array.
[u/mrichter/AliRoot.git] / ITS / ITSdigitBari.C
CommitLineData
88c93889 1#include "iostream.h"
2
3void ITSdigitBari (Int_t evNumber1=0,Int_t evNumber2=0,Int_t nsignal =25, Int_t size=-1)
4{
5/////////////////////////////////////////////////////////////////////////
6// This macro is a small example of a ROOT macro
7// illustrating how to read the output of GALICE
8// and do some analysis.
9//
10// Macro to run the Bari model on the SPDs
11//
12/////////////////////////////////////////////////////////////////////////
13
14// Dynamically link some shared libs
15
16 if (gClassTable->GetID("AliRun") < 0) {
17 gROOT->LoadMacro("loadlibs.C");
18 loadlibs();
19 }
20
21
22// Connect the Root Galice file containing Geometry, Kine and Hits
23
24 TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject("galice.root");
25 printf("file %p\n",file);
26 if (file) file->Close();
27 file = new TFile("galice.root","UPDATE");
28 file->ls();
29
30 printf ("I'm after Map \n");
31
32// Get AliRun object from file or create it if not on file
33
34 if (!gAlice) {
35 gAlice = (AliRun*)file->Get("gAlice");
36 if (gAlice) printf("AliRun object found on file\n");
37 if (!gAlice) gAlice = new AliRun("gAlice","Alice test program");
38 }
39 printf ("I'm after gAlice \n");
40
41 AliITS *ITS = (AliITS*) gAlice->GetModule("ITS");
42 if (!ITS) return;
43
44 AliITSgeom *geom = ITS->GetITSgeom();
45
46//
47// Event Loop
48//
49
50
51 // SPD
52 printf ("Beginning of SPD processing \n\n");
53
54 AliITSDetType *iDetType=ITS->DetType(0);
55 AliITSsegmentationSPD *seg0=(AliITSsegmentationSPD*)iDetType->GetSegmentationModel();
56 // AliITSresponseSPDbari *res0=(AliITSresponseSPDbari*)iDetType->GetResponseModel();
57 AliITSresponseSPDbari *res0= new AliITSresponseSPDbari();
58
59// to change or monitor the parameters
60
61//--occhio
62 res0->SetThresholds(7.2e-6, 1.e-6);
63 Float_t thresh, sigma;
64 res0->Thresholds(thresh, sigma);
65 printf("SPDbari: threshold %e sigma %e\n",thresh, sigma);
66
67//--occhio
68 res0->SetNoiseParam(0., 0.);
69// res0->SetNoiseParam(0.04, 0.08);
70 Float_t col, row;
71 res0->GetNoiseParam(col, row);
72 printf("SPDbari: Couplcol %e Couplrow %e\n",col, row);
73
74 ITS->SetResponseModel(0,res0);
75
76
77 AliITSsimulationSPDbari *sim0=new AliITSsimulationSPDbari(seg0,res0);
78 ITS->SetSimulationModel(0,sim0);
79
80 // test
81 printf("SPD dimensions %f %f \n",seg0->Dx(),seg0->Dz());
82 printf("SPD npixels %d %d \n",seg0->Npz(),seg0->Npx());
83 printf("SPD pitches %d %d \n",seg0->Dpz(0),seg0->Dpx(0));
84 // end test
85
86 printf("End SPD processing \n\n");
87
88
89
90
91
92 Int_t nbgr_ev=0;
93
94 for (int nev=evNumber1; nev<= evNumber2; nev++) {
95 Int_t nparticles = gAlice->GetEvent(nev);
96 cout << "nev " <<nev<<endl;
97 cout << "nparticles " <<nparticles<<endl;
98 if (nev < evNumber1) continue;
99 if (nparticles <= 0) return;
100
101 Int_t nbgr_ev=Int_t(nev/nsignal);
102 //printf("nbgr_ev %d\n",nbgr_ev);
103// ITS->HitsToDigits(nev,nbgr_ev,evNumber2,size," ","All"," ");
104 ITS->HitsToDigits(nev,nbgr_ev,size," ","SPD"," ");
105 } // event loop
106
107 file->Close();
108}
109