]>
Commit | Line | Data |
---|---|---|
99d5402e | 1 | { |
2 | ||
3 | ///////////////////////////////////////////////////////////////////////// | |
4 | // | |
5 | // Creates the digits from the hit information. An additional hit-tree | |
6 | // is added to the input file. | |
7 | // | |
8 | ///////////////////////////////////////////////////////////////////////// | |
9 | ||
10 | // Dynamically link some shared libs | |
11 | if (gClassTable->GetID("AliRun") < 0) { | |
12 | gROOT->LoadMacro("loadlibs.C"); | |
13 | loadlibs(); | |
14 | } | |
15 | ||
16 | // Input (and output) file name | |
17 | Char_t *alifile = "galice_v2.root"; | |
18 | ||
19 | // Event number | |
20 | Int_t nEvent = 0; | |
21 | ||
22 | // Connect the AliRoot file containing Geometry, Kine, and Hits | |
23 | TFile *gafl = (TFile*) gROOT->GetListOfFiles()->FindObject(alifile); | |
24 | if (!gafl) { | |
25 | cout << "Open the ALIROOT-file " << alifile << endl; | |
26 | gafl = new TFile(alifile,"UPDATE"); | |
27 | } | |
28 | else { | |
29 | cout << alifile << " is already open" << endl; | |
30 | } | |
31 | ||
32 | // Get AliRun object from file or create it if not on file | |
33 | if (!gAlice) { | |
34 | gAlice = (AliRun*) gafl->Get("gAlice"); | |
35 | if (gAlice) | |
36 | cout << "AliRun object found on file" << endl; | |
37 | else | |
38 | gAlice = new AliRun("gAlice","Alice test program"); | |
39 | } | |
40 | ||
41 | // Import the Trees for the event nEvent in the file | |
42 | Int_t nparticles = gAlice->GetEvent(nEvent); | |
43 | if (nparticles <= 0) break; | |
44 | ||
45 | // Get the pointer to the detector class | |
46 | AliTRDv2 *TRD = (AliTRDv2*) gAlice->GetDetector("TRD"); | |
47 | ||
48 | // Create the digitd and fill the digits-tree | |
49 | TRD->Hits2Digits(); | |
50 | ||
51 | // Write the new tree into the input file | |
52 | cout << "Entries in hit tree = " << gAlice->TreeD()->GetEntries()) << endl; | |
53 | Char_t treeName[7]; | |
54 | sprintf(treeName,"TreeD%d",nEvent); | |
55 | gAlice->TreeD()->Write(treeName); | |
56 | ||
57 | } |