]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TRD/fastClusterCreate.C
New version of TRD introduced
[u/mrichter/AliRoot.git] / TRD / fastClusterCreate.C
1 {
2
3 ///////////////////////////////////////////////////////////////////////// 
4 //
5 // Creates cluster from the hit information (fast simulator). 
6 // An additional hit-tree 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_c_v0.root";
18
19   // Event number
20   Int_t   nEvent  = 0;
21
22   // Connect the AliRoot file containing Geometry, Kine, Hits, and Digits
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 classes
46   AliTRDv0 *TRD = (AliTRDv0*) gAlice->GetDetector("TRD");
47
48   // Create the clusters
49   TRD->Hits2Clusters();
50
51   // Write the new tree into the input file
52   cout << "Entries in digits tree = " << gAlice->TreeD()->GetEntries() << endl;
53   Char_t treeName[7];
54   sprintf(treeName,"TreeD%d",nEvent);
55   gAlice->TreeD()->Write(treeName);
56
57 }