]>
Commit | Line | Data |
---|---|---|
409f8c84 | 1 | Int_t AliITSHits2DigitsDubna() |
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 | //AliITSresponseSPDdubna *res0 = (AliITSresponseSPDdubna*)iDetType->GetResponseModel(); | |
39 | AliITSresponseSPDdubna *res0 = new AliITSresponseSPDdubna(); | |
40 | ITS->SetResponseModel(0,res0); | |
41 | AliITSsimulationSPDdubna *sim0=new AliITSsimulationSPDdubna(seg0,res0); | |
42 | ITS->SetSimulationModel(0,sim0); | |
43 | // test | |
44 | printf("SPD dimensions %f %f \n",seg0->Dx(),seg0->Dz()); | |
45 | printf("SPD npixels %d %d \n",seg0->Npz(),seg0->Npx()); | |
46 | printf("SPD pitches %d %d \n",seg0->Dpz(0),seg0->Dpx(0)); | |
47 | // end test | |
48 | ||
49 | // SDD | |
50 | // Set response parameters | |
51 | // SDD compression param: 2 fDecrease, 2fTmin, 2fTmax or disable, 2 fTolerance | |
52 | AliITSDetType *iDetType=ITS->DetType(1); | |
53 | AliITSresponseSDD *res1 = (AliITSresponseSDD*)iDetType->GetResponseModel(); | |
54 | if (!res1) { | |
55 | res1=new AliITSresponseSDD(); | |
56 | ITS->SetResponseModel(1,res1); | |
57 | } | |
58 | Float_t baseline; | |
59 | Float_t noise; | |
60 | res1->GetNoiseParam(noise,baseline); | |
61 | Float_t noise_after_el = res1->GetNoiseAfterElectronics(); | |
62 | cout << "noise_after_el: " << noise_after_el << endl; | |
63 | Float_t fCutAmp; | |
64 | fCutAmp = baseline; | |
65 | fCutAmp += (2.*noise_after_el); // noise | |
66 | cout << "Cut amplitude: " << fCutAmp << endl; | |
67 | Int_t cp[8]={0,0,fCutAmp,fCutAmp,0,0,0,0}; | |
68 | res1->SetCompressParam(cp); | |
69 | ||
70 | res1->Print(); | |
71 | AliITSsegmentationSDD *seg1=(AliITSsegmentationSDD*)iDetType->GetSegmentationModel(); | |
72 | if (!seg1) { | |
73 | seg1 = new AliITSsegmentationSDD(geom,res1); | |
74 | ITS->SetSegmentationModel(1,seg1); | |
75 | } | |
76 | AliITSsimulationSDD *sim1=new AliITSsimulationSDD(seg1,res1); | |
77 | ITS->SetSimulationModel(1,sim1); | |
78 | ||
79 | // SSD | |
80 | AliITSDetType *iDetType=ITS->DetType(2); | |
81 | AliITSsegmentationSSD *seg2=(AliITSsegmentationSSD*)iDetType->GetSegmentationModel(); | |
82 | AliITSresponseSSD *res2 = (AliITSresponseSSD*)iDetType->GetResponseModel(); | |
83 | res2->SetSigmaSpread(3.,2.); | |
84 | AliITSsimulationSSD *sim2=new AliITSsimulationSSD(seg2,res2); | |
85 | ITS->SetSimulationModel(2,sim2); | |
86 | ||
87 | cerr<<"Digitizing ITS...\n"; | |
88 | ||
89 | if(!gAlice->TreeD()) gAlice->MakeTree("D"); | |
90 | printf("TreeD %p\n",gAlice->TreeD()); | |
91 | //make branch | |
92 | ITS->MakeBranch("D"); | |
93 | ||
94 | TStopwatch timer; | |
95 | timer.Start(); | |
96 | ITS->HitsToDigits(0,0,-1," ","All"," "); | |
97 | timer.Stop(); timer.Print(); | |
98 | ||
99 | delete sim0; | |
100 | delete sim1; | |
101 | delete sim2; | |
102 | ||
103 | ||
104 | delete gAlice; gAlice=0; | |
105 | file->Close(); | |
106 | delete file; | |
107 | return 0; | |
108 | }; | |
109 |