1 Int_t AliITSHits2SDigits(const char *inFile = "galice.root"){
2 // Connect the Root Galice file containing Geometry, Kine and Hits
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");
9 cerr<<"Can't open "<<inFile<<" !" << endl;
14 // Get AliRun object from file or return if not on file
15 if (gAlice) delete gAlice;
16 gAlice = (AliRun*)file->Get("gAlice");
18 cerr << "AliITSITSHits2Digits.C : AliRun object not found on file"
24 AliITS *ITS = (AliITS*)gAlice->GetDetector("ITS");
26 cerr<<"AliITSHits2Digits.C : AliITS object not found on file"
31 // Set the simulation models for the three detector types
32 AliITSgeom *geom = ITS->GetITSgeom();
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);
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;
49 cout << "Changing from Default SDD simulation, and responce." << endl;
50 //Set response functions
51 Float_t baseline = 10.;
53 // SDD compression param: 2 fDecrease, 2fTmin, 2fTmax or disable,
55 AliITSDetType *iDetType=ITS->DetType(1);
56 AliITSresponseSDD *res1 = (AliITSresponseSDD*)iDetType->GetResponseModel();
58 res1=new AliITSresponseSDD();
59 ITS->SetResponseModel(1,res1);
61 Float_t fCutAmp = baseline + 2.*noise;
62 Int_t cp[8]={0,0,fCutAmp,fCutAmp,0,0,0,0}; //1D
64 //res1->SetZeroSupp("2D");
65 res1->SetZeroSupp("1D");
66 res1->SetNoiseParam(noise,baseline);
67 res1->SetDo10to8(kTRUE);
68 res1->SetCompressParam(cp);
70 res1->SetDiffCoeff(3.6,40.);
71 AliITSsegmentationSDD *seg1=(AliITSsegmentationSDD*)iDetType->
72 GetSegmentationModel();
74 seg1 = new AliITSsegmentationSDD(geom,res1);
75 ITS->SetSegmentationModel(1,seg1);
77 AliITSsimulationSDD *sim1 = new AliITSsimulationSDD(seg1,res1);
79 sim1->SetCheckNoise(kFALSE);
80 ITS->SetSimulationModel(1,sim1);
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);
93 cout << "Having to create the SDigits Tree." << endl;
94 gAlice->MakeTree("S");
95 } // end if !gAlice->TreeS()
98 ITS->SetTreeAddress();
99 cout << "Digitizing ITS..." << endl;
102 Long_t size0 = file->GetSize();
105 timer.Stop(); timer.Print();
107 delete gAlice; gAlice=0;
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;