1 Int_t AliITSHitsToSDigits(const char *inFile="galice.root"){
2 /////////////////////////////////////////////////////////////////////////
3 // This macro is a small example of a ROOT macro
4 // illustrating how to read the output of GALICE
5 // and do some analysis.
7 /////////////////////////////////////////////////////////////////////////
9 // Dynamically link some shared libs
10 if (gClassTable->GetID("AliRun") < 0) {
11 gROOT->LoadMacro("loadlibs.C");
15 // Connect the Root Galice file containing Geometry, Kine and Hit
17 TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject(inFile);
18 if (file) {file->Close(); delete file;}
19 cout << "AliITSHits2SDigitsDefault" << endl;
20 file = new TFile(inFile,"UPDATE");
21 if (!file->IsOpen()) {
22 cerr<<"Can't open "<<inFile<<" !" << endl;
27 // Get AliRun object from file or create it if not on file
28 if (gAlice) delete gAlice;
29 gAlice = (AliRun*)file->Get("gAlice");
31 cerr << "AliITSITSHits2Digits.C : AliRun object not found on file"
37 AliITS *ITS = (AliITS*)gAlice->GetDetector("ITS");
39 cerr<<"AliITSHits2DigitsDefault.C : AliITS object not found on file"
43 if(!(ITS->GetITSgeom())){
44 cerr << " AliITSgeom not found. Can't digitize with out it." << endl;
49 cout << "Changing from Default SPD simulation, and responce." << endl;
50 AliITSDetType *iDetType=ITS->DetType(0);
51 AliITSsegmentationSPD *seg0=(AliITSsegmentationSPD*)iDetType->
52 GetSegmentationModel();
53 AliITSresponseSPD *res0 = (AliITSresponseSPD*)iDetType->GetResponseModel();
54 AliITSsimulationSPD *sim0=new AliITSsimulationSPD(seg0,res0);
55 ITS->SetSimulationModel(0,sim0);
57 cout << "SPD dimensions " << seg0->Dx() << " " << seg0->Dz() << endl;
58 cout << "SPD npixels " << seg0->Npz() << " " << seg0->Npx() << endl;
59 cout << "SPD pitches " << seg0->Dpz(0) << " " << seg0->Dpx(0) << endl;
63 cout << "Changing from Default SDD simulation, and responce." << endl;
64 //Set response functions
65 Float_t baseline = 10.;
67 // SDD compression param: 2 fDecrease, 2fTmin, 2fTmax or disable,
69 AliITSDetType *iDetType=ITS->DetType(1);
70 AliITSresponseSDD *res1 = (AliITSresponseSDD*)iDetType->GetResponseModel();
72 res1=new AliITSresponseSDD();
73 ITS->SetResponseModel(1,res1);
75 Float_t fCutAmp = baseline + 2.*noise;
76 Int_t cp[8]={0,0,fCutAmp,fCutAmp,0,0,0,0}; //1D
78 //res1->SetZeroSupp("2D");
79 res1->SetZeroSupp("1D");
80 res1->SetNoiseParam(noise,baseline);
81 res1->SetDo10to8(kTRUE);
82 res1->SetCompressParam(cp);
84 res1->SetDiffCoeff(3.6,40.);
85 AliITSsegmentationSDD *seg1=(AliITSsegmentationSDD*)iDetType->
86 GetSegmentationModel();
88 seg1 = new AliITSsegmentationSDD(ITS->GetITSgeom(),res1);
89 ITS->SetSegmentationModel(1,seg1);
91 AliITSsimulationSDD *sim1 = new AliITSsimulationSDD(seg1,res1);
93 sim1->SetCheckNoise(kFALSE);
94 ITS->SetSimulationModel(1,sim1);
97 cout << "Changing from Default SSD simulation, and responce." << endl;
98 AliITSDetType *iDetType = ITS->DetType(2);
99 AliITSsegmentationSSD *seg2 = (AliITSsegmentationSSD*)iDetType->
100 GetSegmentationModel();
101 AliITSresponseSSD *res2 = (AliITSresponseSSD*)iDetType->GetResponseModel();
102 res2->SetSigmaSpread(3.,2.);
103 AliITSsimulationSSD *sim2 = new AliITSsimulationSSD(seg2,res2);
104 ITS->SetSimulationModel(2,sim2);
106 if(!gAlice->TreeS()){
107 cout << "Having to create the SDigits Tree." << endl;
108 gAlice->MakeTree("S");
109 } // end if !gAlice->TreeS()
111 ITS->MakeBranch("S");
112 ITS->SetTreeAddress();
113 cout<<"Digitizing ITS..." << endl;
116 Long_t size0 = file->GetSize();
118 for (Int_t nev=evNumber1; nev<= evNumber2; nev++) {
119 cout << "nev " <<nev<<endl;
121 gAlice->SetEvent(nev);
122 if(!gAlice->TreeD()) gAlice->MakeTree("D");
123 ITS->MakeBranch("D");
125 if (nev < evNumber1) continue;
127 ITS->HitsToSDigits(nev,0,-1," ","All"," ");
128 timer.Stop(); timer.Print();
131 delete gAlice; gAlice=0;
133 Long_t size1 = file->GetSize();
134 cout << "File size before = " << size0 << " file size after = " << size1;
135 cout << "Increase in file size is " << size1-size0 << " Bytes" << endl;