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