]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/oldmacros/AliITSHitsToSDigits.C
New physics processes and cuts added (E. Futo)
[u/mrichter/AliRoot.git] / ITS / oldmacros / AliITSHitsToSDigits.C
CommitLineData
08cb00f2 1Int_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.
6//
7/////////////////////////////////////////////////////////////////////////
8
9 // Dynamically link some shared libs
10 if (gClassTable->GetID("AliRun") < 0) {
11 gROOT->LoadMacro("loadlibs.C");
12 loadlibs();
13 } // end if
14
15 // Connect the Root Galice file containing Geometry, Kine and Hit
16
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;
23 return 1;
24 } // end if !file
25 file->ls();
26
27 // Get AliRun object from file or create it if not on file
28 if (gAlice) delete gAlice;
29 gAlice = (AliRun*)file->Get("gAlice");
30 if (!gAlice) {
31 cerr << "AliITSITSHits2Digits.C : AliRun object not found on file"
32 << endl;
33 return 2;
34 } // end if !gAlice
35
36 gAlice->GetEvent(0);
37 AliITS *ITS = (AliITS*)gAlice->GetDetector("ITS");
38 if (!ITS) {
39 cerr<<"AliITSHits2DigitsDefault.C : AliITS object not found on file"
40 << endl;
41 return 3;
42 } // end if !ITS
43 if(!(ITS->GetITSgeom())){
44 cerr << " AliITSgeom not found. Can't digitize with out it." << endl;
45 return 4;
46 } // end ifs
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) {
88 seg1 = new AliITSsegmentationSDD(ITS->GetITSgeom(),res1);
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->TreeS()){
107 cout << "Having to create the SDigits Tree." << endl;
108 gAlice->MakeTree("S");
109 } // end if !gAlice->TreeS()
110 //make branch
111 ITS->MakeBranch("S");
112 ITS->SetTreeAddress();
113 cout<<"Digitizing ITS..." << endl;
114
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) {
121 gAlice->SetEvent(nev);
122 if(!gAlice->TreeD()) gAlice->MakeTree("D");
123 ITS->MakeBranch("D");
124 } // end if nev>0
125 if (nev < evNumber1) continue;
126 timer.Start();
127 ITS->HitsToSDigits(nev,0,-1," ","All"," ");
128 timer.Stop(); timer.Print();
129 } // event loop
130
131 delete gAlice; gAlice=0;
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};