]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/ITSHitsToDigits.C
Scope error corrected
[u/mrichter/AliRoot.git] / ITS / ITSHitsToDigits.C
1 #include "iostream.h"
2
3 void ITSHitsToDigits (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 /////////////////////////////////////////////////////////////////////////
11
12 // Dynamically link some shared libs
13
14    if (gClassTable->GetID("AliRun") < 0) {
15       gROOT->LoadMacro("loadlibs.C");
16       loadlibs();
17    } else {
18       delete gAlice;
19       gAlice=0;
20    }
21
22
23 // Connect the Root Galice file containing Geometry, Kine and Hits
24
25    TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject("galice.root");
26    printf("file %p\n",file);
27    if (file) file->Close(); 
28    if (!file) file = new TFile("galice.root","UPDATE");
29    file->ls();
30
31    printf ("I'm after Map \n");
32
33 // Get AliRun object from file or create it if not on file
34
35    if (!gAlice) {
36        gAlice = (AliRun*)file->Get("gAlice");
37        if (gAlice) printf("AliRun object found on file\n");
38        if (!gAlice) gAlice = new AliRun("gAlice","Alice test program");
39    }
40    printf ("I'm after gAlice \n");
41    
42    AliITS *ITS  = (AliITS*) gAlice->GetModule("ITS");
43    if (!ITS) return;
44
45
46    // Set the simulation models
47
48    AliITSgeom *geom = ITS->GetITSgeom();
49
50    // SDD
51    // SDD compression param: 2 fDecrease, 2fTmin, 2fTmax or disable, 2 fTolerance
52    Float_t baseline = 10.;
53    Float_t noise = 1.75;
54
55
56    AliITSDetType *iDetType=ITS->DetType(1);
57    AliITSresponseSDD *res1 = (AliITSresponseSDD*)iDetType->GetResponseModel();
58    if (!res1) {
59          res1=new AliITSresponseSDD();
60          ITS->SetResponseModel(1,res1);
61    }
62         
63            //Float_t fCutAmp = baseline + 2.*noise;
64                 
65         Float_t maxadc = res1->MaxAdc();    
66    Float_t topValue = res1->MagicValue();
67    Float_t norm = maxadc/topValue;
68
69    Float_t fCutAmp = baseline + 2.*noise;
70    fCutAmp *= norm;
71
72    Int_t cp[8]={0,0,fCutAmp,fCutAmp,0,0,0,0}; //1D
73         
74    //res1->SetZeroSupp("2D");
75    res1->SetZeroSupp("1D");
76    res1->SetNoiseParam(noise,baseline);
77    res1->SetDo10to8(kTRUE);
78    res1->SetMinVal(4);
79    res1->SetCompressParam(cp);
80    res1->SetDiffCoeff(3.6,40.);
81    res1->SetMagicValue(96.95);
82
83    AliITSsegmentationSDD *seg1=(AliITSsegmentationSDD*)iDetType->GetSegmentationModel();
84    if (!seg1) {
85        seg1 = new AliITSsegmentationSDD(geom,res1);
86        ITS->SetSegmentationModel(1,seg1);
87    }
88
89    AliITSsimulationSDD *sim1=new AliITSsimulationSDD(seg1,res1);
90    sim1->SetDoFFT(1);
91    sim1->SetCheckNoise(kFALSE);
92
93    ITS->SetSimulationModel(1,sim1);
94    
95    
96
97    // SPD
98
99    AliITSDetType *iDetType=ITS->DetType(0);
100    AliITSsegmentationSPD *seg0=(AliITSsegmentationSPD*)iDetType->GetSegmentationModel();
101    AliITSresponseSPD *res0 = (AliITSresponseSPD*)iDetType->GetResponseModel();
102    AliITSsimulationSPD *sim0=new AliITSsimulationSPD(seg0,res0);
103    ITS->SetSimulationModel(0,sim0);
104    // test
105    //printf("SPD dimensions %f %f \n",seg0->Dx(),seg0->Dz());
106    //printf("SPD npixels %d %d \n",seg0->Npz(),seg0->Npx());
107    //printf("SPD pitches %d %d \n",seg0->Dpz(0),seg0->Dpx(0));
108    // end test
109
110
111    // SSD
112
113    AliITSDetType *iDetType=ITS->DetType(2);
114    AliITSsegmentationSSD *seg2=(AliITSsegmentationSSD*)iDetType->GetSegmentationModel();
115    AliITSresponseSSD *res2 = (AliITSresponseSSD*)iDetType->GetResponseModel();
116    res2->SetSigmaSpread(3.,2.);
117    AliITSsimulationSSD *sim2=new AliITSsimulationSSD(seg2,res2);
118    ITS->SetSimulationModel(2,sim2);
119
120
121 //
122 // Event Loop
123 //
124
125    Int_t nbgr_ev=0;
126
127    for (Int_t nev=evNumber1; nev<= evNumber2; nev++) {
128        cout << "nev         " <<nev<<endl;
129        Int_t nparticles = gAlice->GetEvent(nev);
130        cout << "nparticles  " <<nparticles<<endl;
131        if (nev < evNumber1) continue;
132        if (nparticles <= 0) return;
133
134        Int_t nbgr_ev=0;
135        if(nsignal) nbgr_ev=Int_t(nev/nsignal);
136        ITS->HitsToDigits(nev,nbgr_ev,size," ","All"," ");
137    } // event loop 
138
139    delete sim0;
140    delete sim1;
141    delete sim2;
142
143
144    file->Close();
145 }
146
147
148
149
150
151
152
153
154
155
156
157
158
159