]>
Commit | Line | Data |
---|---|---|
48b962f0 | 1 | #include "TChain.h" |
2 | #include "TTree.h" | |
3 | #include "TClonesArray.h" | |
4 | #include "TFile.h" | |
5 | #include "../digits/AliHLTPHOSDebugRawDigit.h" | |
6 | #include "../digits/AliHLTPHOSDigit.h" | |
7 | #include "../digits/AliHLTPHOSAltroConfig.h" | |
8 | #include <iostream> | |
9 | ||
10 | Int_t digitConverter(Int_t runNb, Int_t segNb) | |
11 | { | |
12 | gROOT->ProcessLine(".L ../digits/AliHLTPHOSDigit.cxx+"); | |
13 | gROOT->ProcessLine(".L ../digits/AliHLTPHOSDebugRawDigit.cxx+"); | |
14 | char filename [50]; | |
15 | sprintf(filename, "/tmp/phoshlt/aldaqpc019/hlt/run%d_digitTree_%d.root", runNb, segNb); | |
16 | ||
17 | char filepath [50]; | |
18 | ||
19 | bool finished = false; | |
20 | ||
21 | TChain *tree= new TChain("digitTree"); | |
22 | TTree *newTree = new TTree("digitTree", "Digits tree" ); | |
23 | ||
24 | tree->Add(filename); | |
25 | TClonesArray *rawDigArray = new TClonesArray("AliHLTPHOSDebugRawDigit" , 100); | |
26 | TClonesArray *oldDigArray = new TClonesArray("AliHLTPHOSDigit" , 100); | |
27 | TClonesArray *newDigArray = new TClonesArray("AliHLTPHOSDigit" , 100); | |
28 | ||
29 | newTree->Branch("Digit", &newDigArray); | |
30 | tree->SetBranchAddress("DebugRawDigit", &digArray); | |
31 | AliHLTPHOSDebugRawDigit *digit = 0; | |
32 | AliHLTPHOSDigit *newDigit = 0; | |
33 | cout << endl << "Opening file: " << filename << endl; | |
34 | cout << "Converting tree with " << tree->GetEntries() << " events\n"; | |
35 | ||
36 | for(int k = 0; k < tree->GetEntries(); k++) | |
37 | { | |
38 | tree->GetEntry(k); | |
39 | for(int j = 0; j < digArray->GetEntriesFast(); j++) | |
40 | { | |
41 | digit = (AliHLTPHOSDebugRawDigit*)digArray->At(j); | |
42 | newDigit = (AliHLTPHOSDigit*)newDigArray->New(j); | |
43 | newDigit->SetX(digit->GetX()); | |
44 | newDigit->SetZ(digit->GetZ()); | |
45 | newDigit->SetAmplitude(digit->GetAmplitude()); | |
46 | newDigit->SetTime(digit->GetTime()); | |
47 | newDigit->SetEnergy(digit->GetEnergy()); | |
48 | newDigit->SetGain(digit->GetGain()); | |
49 | newDigit->SetRawData((Int_t*)(digit->GetRawData())); | |
50 | if(digit->GetCrazyness() == 0) | |
51 | newDigit->SetCrazyness(1); | |
52 | if(digit->GetCrazyness() == 1) | |
53 | newDigit->SetCrazyness(0); | |
54 | newDigit->SetBaseline(digit->GetBaseline()); | |
55 | } | |
56 | newTree->Fill(); | |
57 | newDigArray->Clear(); | |
58 | } | |
59 | cout << "Conversion done, writing file: " << filename << endl;; | |
60 | TFile *outfile = new TFile(filename,"recreate"); | |
61 | newTree->Write(); | |
62 | delete outfile; | |
63 | outfile = 0; | |
64 | cout << "Done!\n"; | |
65 | return 0; | |
66 | } | |
67 | ||
68 |