]>
Commit | Line | Data |
---|---|---|
fb4129e9 | 1 | Int_t AliITSHits2SDigits(const char *inFile = "galice.root"){ |
2 | ||
3 | // Dynamically link some shared libs | |
4 | if (gClassTable->GetID("AliRun") < 0) { | |
5 | gROOT->LoadMacro("loadlibs.C"); | |
6 | loadlibs(); | |
7 | } // end if | |
8 | ||
9 | // Connect the Root Galice file containing Geometry, Kine and Hits | |
10 | ||
11 | TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject(inFile); | |
12 | if (file) {file->Close(); delete file;} | |
13 | cout << "AliITSHits2SDigitsDefault" << endl; | |
14 | file = new TFile(inFile,"UPDATE"); | |
15 | if (!file->IsOpen()) { | |
16 | cerr<<"Can't open "<<inFile<<" !" << endl; | |
17 | return 1; | |
18 | } // end if !file | |
19 | file->ls(); | |
20 | if(!file) file = new TFile(fileNameSDigitsSig.Data()); | |
21 | TDatime *ct0 = new TDatime(2002,04,26,00,00,00), ct = file->GetCreationDate(); | |
22 | ||
23 | // Get AliRun object from file or return if not on file | |
24 | if (gAlice) delete gAlice; | |
25 | gAlice = (AliRun*)file->Get("gAlice"); | |
26 | if (!gAlice) { | |
27 | cerr << "AliITSITSHits2Digits.C : AliRun object not found on file" | |
28 | << endl; | |
29 | return 2; | |
30 | } // end if !gAlice | |
31 | ||
32 | gAlice->GetEvent(0); | |
33 | AliITS *ITS = (AliITS*)gAlice->GetDetector("ITS"); | |
34 | if (!ITS) { | |
35 | cerr<<"AliITSHits2DigitsDefault.C : AliITS object not found on file" | |
36 | << endl; | |
37 | return 3; | |
38 | } // end if !ITS | |
39 | if(!(ITS->GetITSgeom())){ | |
40 | cerr << " AliITSgeom not found. Can't digitize with out it." << endl; | |
41 | return 4; | |
42 | } // end if | |
43 | ||
44 | if(ct0->GetDate()>ct.GetDate()){ | |
45 | // For old files, must change SDD noise. | |
46 | AliITS *ITS = (AliITS*) gAlice->GetDetector("ITS"); | |
47 | AliITSresponseSDD *resp1 = ITS->DetType(1)->GetResponseModel(); | |
48 | resp1->SetNoiseParam(); | |
49 | resp1->SetNoiseAfterElectronics(); | |
50 | Float_t n,b; | |
51 | Int_t cPar[8]; | |
52 | resp1->GetNoiseParam(n,b); | |
53 | n = resp1->GetNoiseAfterElectronics(); | |
54 | cPar[0]=0; | |
55 | cPar[1]=0; | |
56 | cPar[2]=(Int_t)(b + 2.*n + 0.5); | |
57 | cPar[3]=(Int_t)(b + 2.*n + 0.5); | |
58 | cPar[4]=0; | |
59 | cPar[5]=0; | |
60 | cPar[6]=0; | |
61 | cPar[7]=0; | |
62 | resp1->SetCompressParam(cPar); | |
63 | } // end if | |
64 | ||
65 | if(!gAlice->TreeS()){ | |
66 | cout << "Having to create the SDigits Tree." << endl; | |
67 | gAlice->MakeTree("S"); | |
68 | } // end if !gAlice->TreeS() | |
69 | //make branch | |
70 | ITS->MakeBranch("S"); | |
71 | ITS->SetTreeAddress(); | |
72 | cout << "Digitizing ITS..." << endl; | |
73 | ||
74 | TStopwatch timer; | |
75 | Long_t size0 = file->GetSize(); | |
76 | timer.Start(); | |
77 | ITS->Hits2SDigits(); | |
78 | timer.Stop(); timer.Print(); | |
79 | ||
80 | delete gAlice; gAlice=0; | |
81 | file->Close(); | |
82 | Long_t size1 = file->GetSize(); | |
83 | cout << "File size before = " << size0 << " file size after = " << size1; | |
84 | cout << "Increase in file size is " << size1-size0 << " Bytes" << endl; | |
85 | delete file; | |
86 | return 0; | |
87 | }; | |
88 |