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