3 void ITSHitsToDigits (Int_t evNumber1=0,Int_t evNumber2=0,Int_t nsignal =25, Int_t size=-1)
5 /////////////////////////////////////////////////////////////////////////
6 // This macro is a small example of a ROOT macro
7 // illustrating how to read the output of GALICE
8 // and do some analysis.
10 /////////////////////////////////////////////////////////////////////////
12 // Dynamically link some shared libs
14 if (gClassTable->GetID("AliRun") < 0) {
15 gROOT->LoadMacro("loadlibs.C");
23 // Connect the Root Galice file containing Geometry, Kine and Hits
25 TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject("galice.root");
26 printf("file %p\n",file);
27 if (file) file->Close();
28 if (!file) file = new TFile("galice.root","UPDATE");
31 printf ("I'm after Map \n");
33 // Get AliRun object from file or create it if not on file
36 gAlice = (AliRun*)file->Get("gAlice");
37 if (gAlice) printf("AliRun object found on file\n");
38 if (!gAlice) gAlice = new AliRun("gAlice","Alice test program");
40 printf ("I'm after gAlice \n");
42 AliITS *ITS = (AliITS*) gAlice->GetModule("ITS");
46 // Set the simulation models
48 AliITSgeom *geom = ITS->GetITSgeom();
51 // SDD compression param: 2 fDecrease, 2fTmin, 2fTmax or disable, 2 fTolerance
53 AliITSDetType *iDetType=ITS->DetType(1);
54 AliITSresponseSDD *res1 = (AliITSresponseSDD*)iDetType->GetResponseModel();
56 res1=new AliITSresponseSDD();
57 ITS->SetResponseModel(1,res1);
60 //res1->SetChargeLoss(0.);
63 res1->GetNoiseParam(noise,baseline);
64 Float_t noise_after_el = res1->GetNoiseAfterElectronics();
65 cout << "noise_after_el: " << noise_after_el << endl;
68 fCutAmp += (2.*noise_after_el); // noise
69 cout << "Cut amplitude: " << fCutAmp << endl;
70 Int_t cp[8]={0,0,fCutAmp,fCutAmp,0,0,0,0};
71 res1->SetCompressParam(cp);
72 // res1->SetElectronics(2); // 1 = Pascal, 2 = OLA
76 //cout << "SDD segmentation" << endl;
78 AliITSsegmentationSDD *seg1=(AliITSsegmentationSDD*)iDetType->GetSegmentationModel();
80 seg1 = new AliITSsegmentationSDD(geom,res1);
81 ITS->SetSegmentationModel(1,seg1);
85 //cout << "SDD segmentation" << endl;
86 AliITSsimulationSDD *sim1=new AliITSsimulationSDD(seg1,res1);
87 ITS->SetSimulationModel(1,sim1);
94 AliITSDetType *iDetType=ITS->DetType(0);
95 AliITSsegmentationSPD *seg0=(AliITSsegmentationSPD*)iDetType->GetSegmentationModel();
96 AliITSresponseSPD *res0 = (AliITSresponseSPD*)iDetType->GetResponseModel();
97 AliITSsimulationSPD *sim0=new AliITSsimulationSPD(seg0,res0);
98 ITS->SetSimulationModel(0,sim0);
100 //printf("SPD dimensions %f %f \n",seg0->Dx(),seg0->Dz());
101 //printf("SPD npixels %d %d \n",seg0->Npz(),seg0->Npx());
102 //printf("SPD pitches %d %d \n",seg0->Dpz(0),seg0->Dpx(0));
108 AliITSDetType *iDetType=ITS->DetType(2);
109 AliITSsegmentationSSD *seg2=(AliITSsegmentationSSD*)iDetType->GetSegmentationModel();
110 AliITSresponseSSD *res2 = (AliITSresponseSSD*)iDetType->GetResponseModel();
111 res2->SetSigmaSpread(3.,2.);
112 AliITSsimulationSSD *sim2=new AliITSsimulationSSD(seg2,res2);
113 ITS->SetSimulationModel(2,sim2);
123 Int_t nparticles=gAlice->GetEvent(0);
124 printf("Create TreeD \n");
125 if(!gAlice->TreeD()) gAlice->MakeTree("D");
127 ITS->MakeBranch("D");
132 cout<<"Digitizing ITS...\n";
135 for (Int_t nev=evNumber1; nev<= evNumber2; nev++) {
136 cout << "nev " <<nev<<endl;
138 nparticles = gAlice->GetEvent(nev);
139 gAlice->SetEvent(nev);
140 if(!gAlice->TreeD()) gAlice-> MakeTree("D");
141 ITS->MakeBranch("D");
143 cout << "nparticles " <<nparticles<<endl;
144 if (nev < evNumber1) continue;
145 if (nparticles <= 0) return;
148 if(nsignal) nbgr_ev=Int_t(nev/nsignal);
150 ITS->HitsToDigits(nev,nbgr_ev,size," ","All"," ");
151 timer.Stop(); timer.Print();