1 Int_t AliITSHits2DigitsDubna(const char *inFile = "galice.root"){
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. Specificaly it replaces the
6 // default SPD simulation with that of Dubna It will measure the
7 // time required to do so and the increase in the galice.root file.
8 // There is only one input, that of the name of the root file
9 // containing the hits and to which the digits will be written to.
10 // This macro will process all of the events on the root file.
11 ////////////////////////////////////////////////////////////////////
13 // Dynamically link some shared libs
14 if (gClassTable->GetID("AliRun") < 0) {
15 gROOT->LoadMacro("loadlibs.C");
19 // Connect the Root Galice file containing Geometry, Kine and Hits
21 TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject(inFile);
22 if (file) {file->Close(); delete file;}
23 cout << "AliITSHits2DigitsDubna" << endl;
24 file = new TFile(inFile,"UPDATE");
25 if (!file->IsOpen()) {
26 cerr<<"Can't open "<<inFile<<" !" << endl;
31 // Get AliRun object from file or return if not on file
32 if (gAlice) delete gAlice;
33 gAlice = (AliRun*)file->Get("gAlice");
35 cerr<<"AliITSHits2DigitsDubna.C : AliRun object not found on file"
40 AliITS *ITS = (AliITS*)gAlice->GetDetector("ITS");
42 cerr<<"ITSHits2Digits.C : AliITS object not found on file" << endl;
45 if(!(ITS->GetITSgeom())){
46 cerr << " AliITSgeom not found. Can't digitize with out it." << endl;
51 cout << "Changing from Default SPD simulation, and responce." << endl;
52 AliITSDetType *iDetType=ITS->DetType(0);
53 AliITSsegmentationSPD *seg0=(AliITSsegmentationSPD*)iDetType->
54 GetSegmentationModel();
55 AliITSresponseSPDdubna *res0 = new AliITSresponseSPDdubna();
56 ITS->SetResponseModel(0,res0);
57 AliITSsimulationSPDdubna *sim0=new AliITSsimulationSPDdubna(seg0,res0);
58 ITS->SetSimulationModel(0,sim0);
60 cout << "SPD dimensions " << seg0->Dx() << " " << seg0->Dz() << endl;
61 cout << "SPD npixels " << seg0->Npz() << " " << seg0->Npx() << endl;
62 cout << "SPD pitches " << seg0->Dpz(0) << " " << seg0->Dpx(0) << endl;
66 cout << "Changing from Default SDD simulation, and responce." << endl;
67 //Set response functions
68 Float_t baseline = 10.;
70 // SDD compression param: 2 fDecrease, 2fTmin, 2fTmax or disable,
72 AliITSDetType *iDetType=ITS->DetType(1);
73 AliITSresponseSDD *res1 = (AliITSresponseSDD*)iDetType->GetResponseModel();
75 res1=new AliITSresponseSDD();
76 ITS->SetResponseModel(1,res1);
78 Float_t fCutAmp = baseline + 2.*noise;
79 Int_t cp[8]={0,0,fCutAmp,fCutAmp,0,0,0,0}; //1D
81 //res1->SetZeroSupp("2D");
82 res1->SetZeroSupp("1D");
83 res1->SetNoiseParam(noise,baseline);
84 res1->SetDo10to8(kTRUE);
85 res1->SetCompressParam(cp);
87 res1->SetDiffCoeff(3.6,40.);
88 AliITSsegmentationSDD *seg1=(AliITSsegmentationSDD*)iDetType->
89 GetSegmentationModel();
91 seg1 = new AliITSsegmentationSDD(ITS->GetITSgeom(),res1);
92 ITS->SetSegmentationModel(1,seg1);
94 AliITSsimulationSDD *sim1 = new AliITSsimulationSDD(seg1,res1);
96 sim1->SetCheckNoise(kFALSE);
97 ITS->SetSimulationModel(1,sim1);
100 cout << "Changing from Default SSD simulation, and responce." << endl;
101 AliITSDetType *iDetType = ITS->DetType(2);
102 AliITSsegmentationSSD *seg2 = (AliITSsegmentationSSD*)iDetType->
103 GetSegmentationModel();
104 AliITSresponseSSD *res2 = (AliITSresponseSSD*)iDetType->GetResponseModel();
105 res2->SetSigmaSpread(3.,2.);
106 AliITSsimulationSSD *sim2 = new AliITSsimulationSSD(seg2,res2);
107 ITS->SetSimulationModel(2,sim2);
109 cout << "Digitizing ITS..." << endl;
112 Long_t size0 = file->GetSize();
114 gAlice->Hits2Digits();
115 timer.Stop(); timer.Print();
118 Long_t size1 = file->GetSize();
119 cout << "File size before = " << size0 << " file size after = " << size1;
120 cout << "Increase in file size is " << size1-size0 << " Bytes" << endl;