]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/oldmacros/AliITSHits2SDigits.C
New physics processes and cuts added (E. Futo)
[u/mrichter/AliRoot.git] / ITS / oldmacros / AliITSHits2SDigits.C
CommitLineData
08cb00f2 1Int_t AliITSHits2SDigits(const char *inFile = "galice.root"){
2
3 // Dynamically link some shared libs
4 if (gClassTable->GetID("AliRun") < 0) {
5 gROOT->LoadMacro("loadlibs.C");
6 loadlibs();
7 } // end if
8
9 // Connect the Root Galice file containing Geometry, Kine and Hits
10
11 TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject(inFile);
12 if (file) {file->Close(); delete file;}
13 cout << "AliITSHits2SDigits" << endl;
14 file = new TFile(inFile,"UPDATE");
15 if (!file->IsOpen()) {
16 cerr<<"Can't open "<<inFile<<" !" << endl;
17 return 1;
18 } // end if !file
19 file->ls();
20
21 // Get AliRun object from file or return if not on file
22 if (gAlice) delete gAlice;
23 gAlice = (AliRun*)file->Get("gAlice");
24 if (!gAlice) {
25 cerr << "AliITSITSHits2Digits.C : AliRun object not found on file"
26 << endl;
27 return 2;
28 } // end if !gAlice
29
30 gAlice->GetEvent(0);
31 AliITS *ITS = (AliITS*)gAlice->GetDetector("ITS");
32 if (!ITS) {
33 cerr<<"AliITSHits2Digits.C : AliITS object not found on file"
34 << endl;
35 return 3;
36 } // end if !ITS
37 if(!(ITS->GetITSgeom())){
38 cerr << " AliITSgeom not found. Can't digitize with out it." << endl;
39 return 4;
40 } // end if
41
42 // SPD
43 cout << "Changing from Default SPD simulation, and responce." << endl;
44 AliITSDetType *iDetType=ITS->DetType(0);
45 AliITSsegmentationSPD *seg0=(AliITSsegmentationSPD*)iDetType->
46 GetSegmentationModel();
47 AliITSresponseSPD *res0 = (AliITSresponseSPD*)iDetType->GetResponseModel();
48 AliITSsimulationSPD *sim0=new AliITSsimulationSPD(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(ITS->GetITSgeom(),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 if(!gAlice->TreeS()){
101 cout << "Having to create the SDigits Tree." << endl;
102 gAlice->MakeTree("S");
103 } // end if !gAlice->TreeS()
104 //make branch
105 ITS->MakeBranch("S");
106 ITS->SetTreeAddress();
107 cout << "Digitizing ITS..." << endl;
108
109 TStopwatch timer;
110 Long_t size0 = file->GetSize();
111 timer.Start();
112 ITS->Hits2SDigits();
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