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