]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/AliITSHits2Digits.C
Add Boost() method to boost all particles to LHC lab frame. Needed for asymmetric...
[u/mrichter/AliRoot.git] / ITS / AliITSHits2Digits.C
CommitLineData
c1bfc82c 1Int_t AliITSHits2Digits(const char *inFile = "galice.root"){
bcb08e43 2 ////////////////////////////////////////////////////////////////////
3 // This macro will take hits from a galice.root file and
4 // produce digits for the ITS using the settings for the detector
5 // simulations defined in this file. It will measure the time
6 // required to do so and the increase in the galice.root file.
7 // There is only one input, that of the name of the root file
8 // containing the hits and to which the digits will be written to.
9 // This macro will process all of the events on the root file.
10 ////////////////////////////////////////////////////////////////////
20623db1 11
c1bfc82c 12 // Dynamically link some shared libs
13 if (gClassTable->GetID("AliRun") < 0) {
14 gROOT->LoadMacro("loadlibs.C");
15 loadlibs();
16 } // end if
20623db1 17
c1bfc82c 18 // Connect the Root Galice file containing Geometry, Kine and Hits
20623db1 19
c1bfc82c 20 TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject(inFile);
21 if (file) {file->Close(); delete file;}
22 cout << "AliITSHits2Digits" << endl;
23 file = new TFile(inFile,"UPDATE");
24 if (!file->IsOpen()) {
25 cerr<<"Can't open "<<inFile<<" !" << endl;
26 return 1;
27 } // end if !file
28 file->ls();
29
30 // Get AliRun object from file or return if not on file
31 if (gAlice) delete gAlice;
32 gAlice = (AliRun*)file->Get("gAlice");
33 if (!gAlice) {
34 cerr << "AliITSITSHits2Digits.C : AliRun object not found on file"
35 << endl;
36 return 2;
37 } // end if !gAlice
38
39 AliITS *ITS = (AliITS*)gAlice->GetDetector("ITS");
40 if (!ITS) {
41 cerr<<"AliITSHits2Digits.C : AliITS object not found on file"
42 << endl;
43 return 3;
44 } // end if !ITS
2603d98a 45 if(!(ITS->GetITSgeom())){
46 cerr << " AliITSgeom not found. Can't digitize with out it." << endl;
47 return 4;
48 } // end if
c1bfc82c 49
50 // SPD
51 cout << "Changing from Default SPD simulation, and responce." << endl;
52 AliITSDetType *iDetType=ITS->DetType(0);
53 AliITSsegmentationSPD *seg0=(AliITSsegmentationSPD*)iDetType->
54 GetSegmentationModel();
55 AliITSresponseSPD *res0 = (AliITSresponseSPD*)iDetType->GetResponseModel();
56 AliITSsimulationSPD *sim0=new AliITSsimulationSPD(seg0,res0);
57 ITS->SetSimulationModel(0,sim0);
58 // test
59 cout << "SPD dimensions " << seg0->Dx() << " " << seg0->Dz() << endl;
60 cout << "SPD npixels " << seg0->Npz() << " " << seg0->Npx() << endl;
61 cout << "SPD pitches " << seg0->Dpz(0) << " " << seg0->Dpx(0) << endl;
62 // end test
63
64 // SDD
65 cout << "Changing from Default SDD simulation, and responce." << endl;
66 //Set response functions
67 Float_t baseline = 10.;
68 Float_t noise = 1.75;
69 // SDD compression param: 2 fDecrease, 2fTmin, 2fTmax or disable,
70 // 2 fTolerance
71 AliITSDetType *iDetType=ITS->DetType(1);
72 AliITSresponseSDD *res1 = (AliITSresponseSDD*)iDetType->GetResponseModel();
73 if (!res1) {
74 res1=new AliITSresponseSDD();
75 ITS->SetResponseModel(1,res1);
76 } // end if !res1
77 Float_t fCutAmp = baseline + 2.*noise;
78 Int_t cp[8]={0,0,fCutAmp,fCutAmp,0,0,0,0}; //1D
79
80 //res1->SetZeroSupp("2D");
81 res1->SetZeroSupp("1D");
82 res1->SetNoiseParam(noise,baseline);
83 res1->SetDo10to8(kTRUE);
84 res1->SetCompressParam(cp);
85 res1->SetMinVal(4);
86 res1->SetDiffCoeff(3.6,40.);
87 AliITSsegmentationSDD *seg1=(AliITSsegmentationSDD*)iDetType->
88 GetSegmentationModel();
89 if (!seg1) {
2603d98a 90 seg1 = new AliITSsegmentationSDD(ITS->GetITSgeom(),res1);
c1bfc82c 91 ITS->SetSegmentationModel(1,seg1);
92 } // end if !seg1
93 AliITSsimulationSDD *sim1 = new AliITSsimulationSDD(seg1,res1);
94 sim1->SetDoFFT(1);
95 sim1->SetCheckNoise(kFALSE);
96 ITS->SetSimulationModel(1,sim1);
97
98 // SSD
99 cout << "Changing from Default SSD simulation, and responce." << endl;
100 AliITSDetType *iDetType = ITS->DetType(2);
101 AliITSsegmentationSSD *seg2 = (AliITSsegmentationSSD*)iDetType->
102 GetSegmentationModel();
103 AliITSresponseSSD *res2 = (AliITSresponseSSD*)iDetType->GetResponseModel();
104 res2->SetSigmaSpread(3.,2.);
105 AliITSsimulationSSD *sim2 = new AliITSsimulationSSD(seg2,res2);
106 ITS->SetSimulationModel(2,sim2);
107
c1bfc82c 108 cout << "Digitizing ITS..." << endl;
109
110 TStopwatch timer;
111 Long_t size0 = file->GetSize();
112 timer.Start();
bcb08e43 113 gAlice->Hits2Digits("ITS");
c1bfc82c 114 timer.Stop(); timer.Print();
115
c1bfc82c 116 file->Close();
117 Long_t size1 = file->GetSize();
118 cout << "File size before = " << size0 << " file size after = " << size1;
119 cout << "Increase in file size is " << size1-size0 << " Bytes" << endl;
120 delete file;
121 return 0;
20623db1 122};
123