]>
Commit | Line | Data |
---|---|---|
2603d98a | 1 | Int_t AliITSHitsToDigits(Int_t evNumber1=0,Int_t evNumber2=0, |
2 | const char *inFile="galice.root"){ | |
c1bfc82c | 3 | ///////////////////////////////////////////////////////////////////////// |
4 | // This macro is a small example of a ROOT macro | |
5 | // illustrating how to read the output of GALICE | |
6 | // and do some analysis. | |
7 | // | |
8 | ///////////////////////////////////////////////////////////////////////// | |
9 | ||
10 | // Dynamically link some shared libs | |
11 | if (gClassTable->GetID("AliRun") < 0) { | |
12 | gROOT->LoadMacro("loadlibs.C"); | |
13 | loadlibs(); | |
14 | } // end if | |
15 | ||
16 | // Connect the Root Galice file containing Geometry, Kine and Hits | |
17 | ||
18 | TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject(inFile); | |
2603d98a | 19 | if (file) {file->Close(); delete file;} |
20 | cout << "AliITSHitsToDigitsDefault" << endl; | |
21 | file = new TFile(inFile,"UPDATE"); | |
22 | if (!file->IsOpen()) { | |
23 | cerr<<"Can't open "<<inFile<<" !" << endl; | |
24 | return 1; | |
25 | } // end if !file | |
c1bfc82c | 26 | file->ls(); |
27 | ||
28 | // Get AliRun object from file or create it if not on file | |
2603d98a | 29 | if (gAlice) delete gAlice; |
30 | gAlice = (AliRun*)file->Get("gAlice"); | |
c1bfc82c | 31 | if (!gAlice) { |
2603d98a | 32 | cerr << "AliITSITSHits2Digits.C : AliRun object not found on file" |
33 | << endl; | |
34 | return 2; | |
35 | } // end if !gAlice | |
c1bfc82c | 36 | |
2603d98a | 37 | gAlice->GetEvent(0); |
c1bfc82c | 38 | AliITS *ITS = (AliITS*) gAlice->GetModule("ITS"); |
2603d98a | 39 | if (!ITS){ |
40 | cerr << "ITS not found in gAlice. Exiting." << endl; | |
41 | return 3; | |
42 | } // end if | |
43 | if(!(ITS->GetITSgeom())){ | |
44 | cerr << " AliITSgeom not found. Can't digitize with out it." << endl; | |
45 | return 4; | |
46 | } // end if | |
c1bfc82c | 47 | |
48 | // SPD | |
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); | |
56 | // test | |
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; | |
60 | // end test | |
61 | ||
62 | // SDD | |
63 | cout << "Changing from Default SDD simulation, and responce." << endl; | |
64 | //Set response functions | |
65 | Float_t baseline = 10.; | |
66 | Float_t noise = 1.75; | |
67 | // SDD compression param: 2 fDecrease, 2fTmin, 2fTmax or disable, | |
68 | // 2 fTolerance | |
69 | AliITSDetType *iDetType=ITS->DetType(1); | |
70 | AliITSresponseSDD *res1 = (AliITSresponseSDD*)iDetType->GetResponseModel(); | |
71 | if (!res1) { | |
72 | res1=new AliITSresponseSDD(); | |
73 | ITS->SetResponseModel(1,res1); | |
74 | } // end if !res1 | |
75 | Float_t fCutAmp = baseline + 2.*noise; | |
76 | Int_t cp[8]={0,0,fCutAmp,fCutAmp,0,0,0,0}; //1D | |
77 | ||
78 | //res1->SetZeroSupp("2D"); | |
79 | res1->SetZeroSupp("1D"); | |
80 | res1->SetNoiseParam(noise,baseline); | |
81 | res1->SetDo10to8(kTRUE); | |
82 | res1->SetCompressParam(cp); | |
83 | res1->SetMinVal(4); | |
84 | res1->SetDiffCoeff(3.6,40.); | |
85 | AliITSsegmentationSDD *seg1=(AliITSsegmentationSDD*)iDetType-> | |
86 | GetSegmentationModel(); | |
87 | if (!seg1) { | |
2603d98a | 88 | seg1 = new AliITSsegmentationSDD(ITS->GetITSgeom(),res1); |
c1bfc82c | 89 | ITS->SetSegmentationModel(1,seg1); |
90 | } // end if !seg1 | |
91 | AliITSsimulationSDD *sim1 = new AliITSsimulationSDD(seg1,res1); | |
92 | sim1->SetDoFFT(1); | |
93 | sim1->SetCheckNoise(kFALSE); | |
94 | ITS->SetSimulationModel(1,sim1); | |
95 | ||
96 | // SSD | |
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); | |
105 | ||
106 | if(!gAlice->TreeD()){ | |
107 | cout << "Having to create the Digits Tree." << endl; | |
108 | gAlice->MakeTree("D"); | |
109 | } // end if !gAlice->TreeD() | |
110 | //make branch | |
111 | ITS->MakeBranch("D"); | |
112 | ITS->SetTreeAddress(); | |
2603d98a | 113 | |
c1bfc82c | 114 | cout<<"Digitizing ITS..." << endl; |
115 | TStopwatch timer; | |
116 | Long_t size0 = file->GetSize(); | |
117 | ||
118 | for (Int_t nev=evNumber1; nev<= evNumber2; nev++) { | |
119 | cout << "nev " <<nev<<endl; | |
120 | if(nev>0) { | |
c1bfc82c | 121 | gAlice->SetEvent(nev); |
122 | if(!gAlice->TreeD()) gAlice->MakeTree("D"); | |
123 | ITS->MakeBranch("D"); | |
124 | } // end if nev>0 | |
c1bfc82c | 125 | if (nev < evNumber1) continue; |
c1bfc82c | 126 | timer.Start(); |
2603d98a | 127 | ITS->HitsToDigits(nev,0,-1," ","All"," "); |
c1bfc82c | 128 | timer.Stop(); timer.Print(); |
129 | } // event loop | |
130 | ||
2603d98a | 131 | delete gAlice; gAlice=0; |
c1bfc82c | 132 | file->Close(); |
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; | |
136 | delete file; | |
137 | return 0; | |
138 | }; |