Adding macros to create Calibration objects
[u/mrichter/AliRoot.git] / TRD / Macros / AliTRDDigitsDDL2Clusters.C
CommitLineData
928e9fae 1void AliTRDDigitsDDL2Clusters()
2{
3
4/////////////////////////////////////////////////////////////////////////
5//
6// Creates cluster from the digit information.
7//
8/////////////////////////////////////////////////////////////////////////
9
10 // Dynamically link some shared libs
11 if (gClassTable->GetID("AliRun") < 0) {
12 gROOT->LoadMacro("loadlibs.C");
13 loadlibs();
14 cout << "Loaded shared libraries" << endl;
15 }
16
17 // Input and output file names
18 Char_t *infile = "galice.root";
19
20 // Create the clusterizer
21 AliTRDclusterizerV1 *clusterizer =
22 new AliTRDclusterizerV1("clusterizer","Clusterizer class");
23
24 // Read the parameter
25 TFile *parfile = TFile::Open(infile);
26 AliTRDparameter *par = (AliTRDparameter *) parfile->Get("TRDparameter");
27 par->ReInit();
28 clusterizer->SetParameter(par);
29
30 // Set the parameter
31 clusterizer->SetVerbose(1);
32
33 //Number of events
34 TTree * te = (TTree*)parfile->Get("TE");
35 Int_t nev = (Int_t)te->GetEntries();
36
37 for(Int_t iev=0;iev<nev;iev++) {
38
39 AliRawReaderFile rawReader(iev);
40
41 // Open the AliRoot file
42 clusterizer->Open(infile,iev);
43
44 // Load the digits
45 clusterizer->ReadDigits(&rawReader);
46 clusterizer->Dump();
47
48 // Find the cluster
49 clusterizer->MakeClusters();
50
51 // Write the cluster tree into file AliTRDclusters.root
52 clusterizer->WriteClusters(-1);
53
54 }
55
56}