]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/AliITSHits2Digits.C
Services volumes slightly modified and material added following Pierluigi Barberis...
[u/mrichter/AliRoot.git] / ITS / AliITSHits2Digits.C
CommitLineData
20623db1 1Int_t AliITSHits2Digits()
2{
3
4 // Connect the Root Galice file containing Geometry, Kine and Hits
5
6 const char * inFile = "galice.root";
7 TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject(inFile);
8 if (file) {file->Close(); delete file;}
9 printf("Hits2Digits\n");
10 file = new TFile(inFile,"UPDATE");
11 if (!file->IsOpen()) {
12 cerr<<"Can't open "<<inFile<<" !\n";
13 return 1;
14 }
15 file->ls();
16
17 // Get AliRun object from file or return if not on file
18 if (gAlice) delete gAlice;
19 gAlice = (AliRun*)file->Get("gAlice");
20 if (!gAlice) {
21 cerr<<"ITSHits2Digits.C : AliRun object not found on file\n";
22 return 2;
23 }
24
25 gAlice->GetEvent(0);
26 AliITS *ITS = (AliITS*)gAlice->GetDetector("ITS");
27 if (!ITS) {
28 cerr<<"ITSHits2Digits.C : AliITS object not found on file\n";
29 return 3;
30 }
31
32// Set the simulation models for the three detector types
33 AliITSgeom *geom = ITS->GetITSgeom();
34
35 // SPD
36 AliITSDetType *iDetType=ITS->DetType(0);
37 AliITSsegmentationSPD *seg0=(AliITSsegmentationSPD*)iDetType->GetSegmentationModel();
38 AliITSresponseSPD *res0 = (AliITSresponseSPD*)iDetType->GetResponseModel();
39 AliITSsimulationSPD *sim0=new AliITSsimulationSPD(seg0,res0);
40 ITS->SetSimulationModel(0,sim0);
41 // test
42 printf("SPD dimensions %f %f \n",seg0->Dx(),seg0->Dz());
43 printf("SPD npixels %d %d \n",seg0->Npz(),seg0->Npx());
44 printf("SPD pitches %d %d \n",seg0->Dpz(0),seg0->Dpx(0));
45 // end test
46
47 // SDD
48 //Set response functions
49 Float_t baseline = 10.;
50 Float_t noise = 1.75;
51
52 // SDD compression param: 2 fDecrease, 2fTmin, 2fTmax or disable, 2 fTolerance
b210b385 53 //Float_t fCutAmp = baseline + 2.*noise;
54
55 Float_t maxadc = res1->MaxAdc();
56 Float_t topValue = res1->MagicValue();
57 Float_t norm = maxadc/topValue;
58
20623db1 59 Float_t fCutAmp = baseline + 2.*noise;
b210b385 60 fCutAmp *= norm;
61
20623db1 62 Int_t cp[8]={0,0,fCutAmp,fCutAmp,0,0,0,0};
63
64 AliITSDetType *iDetType=ITS->DetType(1);
65 AliITSresponseSDD *res1 = (AliITSresponseSDD*)iDetType->GetResponseModel();
66 if (!res1) {
67 res1=new AliITSresponseSDD();
68 ITS->SetResponseModel(1,res1);
69 }
70 //res1->SetZeroSupp("2D");
71 res1->SetZeroSupp("1D");
72 res1->SetNoiseParam(noise,baseline);
73 res1->SetDo10to8(kTRUE);
74 res1->SetCompressParam(cp);
75 res1->SetMinVal(4);
76 res1->SetDiffCoeff(3.6,40.);
77 res1->SetMagicValue(96.95);
78
79 AliITSsegmentationSDD *seg1=(AliITSsegmentationSDD*)iDetType->GetSegmentationModel();
80 if (!seg1) {
81 seg1 = new AliITSsegmentationSDD(geom,res1);
82 ITS->SetSegmentationModel(1,seg1);
83 }
84 AliITSsimulationSDD *sim1=new AliITSsimulationSDD(seg1,res1);
85 sim1->SetDoFFT(1);
86 sim1->SetCheckNoise(kFALSE);
87 ITS->SetSimulationModel(1,sim1);
88
89 // SSD
90 AliITSDetType *iDetType=ITS->DetType(2);
91 AliITSsegmentationSSD *seg2=(AliITSsegmentationSSD*)iDetType->GetSegmentationModel();
92 AliITSresponseSSD *res2 = (AliITSresponseSSD*)iDetType->GetResponseModel();
93 res2->SetSigmaSpread(3.,2.);
94 AliITSsimulationSSD *sim2=new AliITSsimulationSSD(seg2,res2);
95 ITS->SetSimulationModel(2,sim2);
96
97
98 cerr<<"Digitizing ITS...\n";
99
100 TStopwatch timer;
101 timer.Start();
102 ITS->HitsToDigits(0,0,-1," ","All"," ");
103 timer.Stop(); timer.Print();
104
105 delete sim0;
106 delete sim1;
107 delete sim2;
108
109
110 delete gAlice; gAlice=0;
111 file->Close();
112 delete file;
113 return 0;
114};
115