]>
Commit | Line | Data |
---|---|---|
fa6c57a3 | 1 | #include "iostream.h" |
2 | ||
3 | void ITSdigit (Int_t evNumber1=0,Int_t evNumber2=0,Int_t nsignal =25, Int_t size=-1) | |
fe4da5cc | 4 | { |
5 | ///////////////////////////////////////////////////////////////////////// | |
6 | // This macro is a small example of a ROOT macro | |
7 | // illustrating how to read the output of GALICE | |
fa6c57a3 | 8 | // and do some analysis. |
fe4da5cc | 9 | // |
fe4da5cc | 10 | ///////////////////////////////////////////////////////////////////////// |
11 | ||
fe4da5cc | 12 | // Dynamically link some shared libs |
fa6c57a3 | 13 | |
fe4da5cc | 14 | if (gClassTable->GetID("AliRun") < 0) { |
fa6c57a3 | 15 | gROOT->LoadMacro("loadlibs.C"); |
16 | loadlibs(); | |
fe4da5cc | 17 | } |
fa6c57a3 | 18 | |
19 | ||
fe4da5cc | 20 | // Connect the Root Galice file containing Geometry, Kine and Hits |
fa6c57a3 | 21 | |
fe4da5cc | 22 | TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject("galice.root"); |
fa6c57a3 | 23 | printf("file %p\n",file); |
24 | if (file) file->Close(); | |
25 | file = new TFile("galice.root","UPDATE"); | |
26 | file->ls(); | |
27 | ||
28 | printf ("I'm after Map \n"); | |
fe4da5cc | 29 | |
30 | // Get AliRun object from file or create it if not on file | |
fa6c57a3 | 31 | |
fe4da5cc | 32 | if (!gAlice) { |
fa6c57a3 | 33 | gAlice = (AliRun*)file->Get("gAlice"); |
34 | if (gAlice) printf("AliRun object found on file\n"); | |
35 | if (!gAlice) gAlice = new AliRun("gAlice","Alice test program"); | |
fe4da5cc | 36 | } |
fa6c57a3 | 37 | printf ("I'm after gAlice \n"); |
fe4da5cc | 38 | |
fa6c57a3 | 39 | AliITS *ITS = (AliITS*) gAlice->GetModule("ITS"); |
40 | if (!ITS) return; | |
41 | ||
42 | AliITSgeom *geom = ITS->GetITSgeom(); | |
43 | ||
44 | // | |
45 | // Event Loop | |
46 | // | |
47 | ||
48 | // SDD | |
49 | ||
50 | ||
51 | // SDD compression param: 2 fDecrease, 2fTmin, 2fTmax or disable, 2 fTolerance | |
52 | //Int_t cp[8]={5,7,17,17,20,20,0,0}; | |
53 | //Int_t cp[8]={0,0,21,21,21,21,0,0}; | |
54 | ||
55 | Int_t cp[8]={0,0,0,0,0,0,0,0}; | |
56 | ||
57 | AliITSDetType *iDetType=ITS->DetType(1); | |
58 | AliITSresponseSDD *res1 = (AliITSresponseSDD*)iDetType->GetResponseModel(); | |
59 | if (!res1) { | |
60 | res1=new AliITSresponseSDD(); | |
61 | ITS->SetResponseModel(1,res1); | |
62 | } | |
63 | res1->SetZeroSupp("2D"); | |
64 | //res1->SetZeroSupp("1D"); | |
65 | res1->SetParamOptions("same","same"); | |
66 | //res1->SetFilenames(" ","$(ALICE_ROOT)/ITS/base.dat","$(ALICE_ROOT)/ITS/2D.dat "); | |
67 | //res1->SetNoiseParam(3.,20.); | |
68 | res1->SetNoiseParam(0.,0.); | |
69 | res1->SetCompressParam(cp); | |
70 | res1->SetMinVal(4); | |
71 | ||
72 | AliITSsegmentationSDD *seg1=(AliITSsegmentationSDD*)iDetType->GetSegmentationModel(); | |
73 | if (!seg1) { | |
74 | seg1 = new AliITSsegmentationSDD(geom,res1); | |
75 | ITS->SetSegmentationModel(1,seg1); | |
fe4da5cc | 76 | } |
fa6c57a3 | 77 | |
78 | AliITSsimulationSDD *sim1=new AliITSsimulationSDD(seg1,res1); | |
79 | ITS->SetSimulationModel(1,sim1); | |
80 | ||
81 | // SPD | |
82 | ||
83 | AliITSDetType *iDetType=ITS->DetType(0); | |
84 | AliITSsegmentationSPD *seg0=(AliITSsegmentationSPD*)iDetType->GetSegmentationModel(); | |
85 | AliITSresponseSPD *res0 = (AliITSresponseSPD*)iDetType->GetResponseModel(); | |
86 | AliITSsimulationSPD *sim0=new AliITSsimulationSPD(seg0,res0); | |
87 | ITS->SetSimulationModel(0,sim0); | |
88 | // test | |
89 | printf("SPD dimensions %f %f \n",seg0->Dx(),seg0->Dz()); | |
90 | printf("SPD npixels %d %d \n",seg0->Npz(),seg0->Npx()); | |
91 | printf("SPD pitches %d %d \n",seg0->Dpz(0),seg0->Dpx(0)); | |
92 | // end test | |
93 | ||
94 | ||
95 | // SSD | |
96 | ||
97 | AliITSDetType *iDetType=ITS->DetType(2); | |
98 | AliITSsegmentationSSD *seg2=(AliITSsegmentationSSD*)iDetType->GetSegmentationModel(); | |
99 | AliITSresponseSSD *res2 = (AliITSresponseSSD*)iDetType->GetResponseModel(); | |
100 | res2->SetSigmaSpread(3.,2.); | |
101 | AliITSsimulationSSD *sim2=new AliITSsimulationSSD(seg2,res2); | |
102 | ITS->SetSimulationModel(2,sim2); | |
103 | ||
104 | ||
105 | // tests | |
106 | printf("sim0 sim1 sim2 %p %p %p\n",sim0,sim1,sim2); | |
107 | Float_t n,b; | |
108 | res1->GetNoiseParam(n,b); | |
109 | printf("SDD: noise baseline %f %f zs option %s data type %s\n",n,b,res1->ZeroSuppOption(),res1->DataType()); | |
110 | printf("SDD: DriftSpeed %f TopValue %f\n",res1->DriftSpeed(),res1->MagicValue()); | |
111 | printf("SDD: DiffCoeff %f Qref %f\n",res1->DiffCoeff(),res1->Qref()); | |
112 | // end tests | |
113 | ||
114 | ||
115 | Int_t nbgr_ev=0; | |
116 | ||
117 | for (int nev=evNumber1; nev<= evNumber2; nev++) { | |
118 | Int_t nparticles = gAlice->GetEvent(nev); | |
119 | cout << "nev " <<nev<<endl; | |
120 | cout << "nparticles " <<nparticles<<endl; | |
121 | if (nev < evNumber1) continue; | |
122 | if (nparticles <= 0) return; | |
123 | ||
124 | Int_t nbgr_ev=Int_t(nev/nsignal); | |
125 | //printf("nbgr_ev %d\n",nbgr_ev); | |
126 | ITS->HitsToDigits(nev,nbgr_ev,evNumber2,size," ","All"," "); | |
127 | //ITS->HitsToDigits(nev,nbgr_ev,evNumber2,size," ","SSD"," "); | |
128 | } // event loop | |
129 | ||
130 | file->Close(); | |
fe4da5cc | 131 | } |
fa6c57a3 | 132 | |
133 | ||
134 | ||
135 | ||
136 | ||
137 | ||
138 | ||
139 | ||
140 | ||
141 | ||
142 | ||
143 | ||
144 | ||
145 |