1 Int_t AliITSHits2Digits(const char *inFile = "galice.root"){
3 // Dynamically link some shared libs
4 if (gClassTable->GetID("AliRun") < 0) {
5 gROOT->LoadMacro("loadlibs.C");
9 // Connect the Root Galice file containing Geometry, Kine and Hits
11 TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject(inFile);
12 if (file) {file->Close(); delete file;}
13 cout << "AliITSHits2Digits" << endl;
14 file = new TFile(inFile,"UPDATE");
15 if (!file->IsOpen()) {
16 cerr<<"Can't open "<<inFile<<" !" << endl;
21 // Get AliRun object from file or return if not on file
22 if (gAlice) delete gAlice;
23 gAlice = (AliRun*)file->Get("gAlice");
25 cerr << "AliITSITSHits2Digits.C : AliRun object not found on file"
31 AliITS *ITS = (AliITS*)gAlice->GetDetector("ITS");
33 cerr<<"AliITSHits2Digits.C : AliITS object not found on file"
37 if(!(ITS->GetITSgeom())){
38 cerr << " AliITSgeom not found. Can't digitize with out it." << endl;
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);
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;
57 cout << "Changing from Default SDD simulation, and responce." << endl;
58 //Set response functions
59 Float_t baseline = 10.;
61 // SDD compression param: 2 fDecrease, 2fTmin, 2fTmax or disable,
63 AliITSDetType *iDetType=ITS->DetType(1);
64 AliITSresponseSDD *res1 = (AliITSresponseSDD*)iDetType->GetResponseModel();
66 res1=new AliITSresponseSDD();
67 ITS->SetResponseModel(1,res1);
69 Float_t fCutAmp = baseline + 2.*noise;
70 Int_t cp[8]={0,0,fCutAmp,fCutAmp,0,0,0,0}; //1D
72 //res1->SetZeroSupp("2D");
73 res1->SetZeroSupp("1D");
74 res1->SetNoiseParam(noise,baseline);
75 res1->SetDo10to8(kTRUE);
76 res1->SetCompressParam(cp);
78 res1->SetDiffCoeff(3.6,40.);
79 AliITSsegmentationSDD *seg1=(AliITSsegmentationSDD*)iDetType->
80 GetSegmentationModel();
82 seg1 = new AliITSsegmentationSDD(ITS->GetITSgeom(),res1);
83 ITS->SetSegmentationModel(1,seg1);
85 AliITSsimulationSDD *sim1 = new AliITSsimulationSDD(seg1,res1);
87 sim1->SetCheckNoise(kFALSE);
88 ITS->SetSimulationModel(1,sim1);
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);
100 if(!gAlice->TreeD()){
101 cout << "Having to create the Digits Tree." << endl;
102 gAlice->MakeTree("D");
103 } // end if !gAlice->TreeD()
105 ITS->MakeBranch("D");
106 ITS->SetTreeAddress();
107 cout << "Digitizing ITS..." << endl;
110 Long_t size0 = file->GetSize();
113 timer.Stop(); timer.Print();
115 delete gAlice; gAlice=0;
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;