]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HLT/PHOS/AliHLTPHOSTreeMaker.cxx
Classes for online creation of root trees
[u/mrichter/AliRoot.git] / HLT / PHOS / AliHLTPHOSTreeMaker.cxx
CommitLineData
f3ab4848 1
2 /**************************************************************************
3 * This file is property of and copyright by the ALICE HLT Project *
4 * All rights reserved. *
5 * *
6 * Primary Authors: Oystein Djuvsland *
7 * *
8 * Permission to use, copy, modify and distribute this software and its *
9 * documentation strictly for non-commercial purposes is hereby granted *
10 * without fee, provided that the above copyright notice appears in all *
11 * copies and that both the copyright notice and this permission notice *
12 * appear in the supporting documentation. The authors make no claims *
13 * about the suitability of this software for any purpose. It is *
14 * provided "as is" without express or implied warranty. *
15 **************************************************************************/
16
17
18#include "AliHLTPHOSTreeMaker.h"
19#include "AliHLTPHOSBase.h"
20#include "AliHLTPHOSDigitContainerDataStruct.h"
21#include "AliHLTPHOSDigitDataStruct.h"
22#include "AliHLTPHOSDigit.h"
23#include "TClonesArray.h"
24#include "TTree.h"
25
26ClassImp(AliHLTPHOSTreeMaker);
27
28AliHLTPHOSTreeMaker::AliHLTPHOSTreeMaker() :
29 AliHLTPHOSBase(),
30 fDigitArrayPtr(0),
31 fDigitTreePtr(0)
32{
33
34 fDigitArrayPtr = new TClonesArray("AliHLTPHOSDigit", 300); //!!!!!!!!!!!!!!!!
35 fDigitTreePtr = new TTree("digitTree", "Digits Tree");
36
37 fDigitTreePtr->Branch("Digit", &fDigitArrayPtr);
38
39}
40
41AliHLTPHOSTreeMaker::~AliHLTPHOSTreeMaker()
42{
43}
44
45Int_t
46AliHLTPHOSTreeMaker::MakeDigitArray(AliHLTPHOSDigitContainerDataStruct *digitContainer, Int_t nDigits)
47{
48 AliHLTPHOSDigit *digit = 0;
49 AliHLTPHOSDigitDataStruct *digitStruct = 0;
50
51 for(Int_t i = 0; i < digitContainer->fNDigits; i++)
52 {
53 digitStruct = &(digitContainer->fDigitDataStruct[i]);
54 digit = (AliHLTPHOSDigit*)fDigitArrayPtr->New(i + nDigits);
55 digit->SetX(digitStruct->fX);
56 digit->SetZ(digitStruct->fZ);
57 digit->SetAmplitude(digitStruct->fAmplitude);
58 digit->SetTime(digitStruct->fTime);
59 digit->SetGain(digitStruct->fGain);
60 digit->SetRawData(digitStruct->fData);
61 digit->SetCrazyness(digitStruct->fCrazyness);
62 digit->SetBaseline(digitStruct->fBaseline);
63 }
64 return digitContainer->fNDigits;
65}
66
67void
68AliHLTPHOSTreeMaker::FillDigitTree()
69{
70 fDigitTreePtr->Fill();
71 fDigitArrayPtr->Clear();
72}
73
74void
75AliHLTPHOSTreeMaker::SetDigitTree(TTree *tree)
76{
77 fDigitTreePtr = tree;
78 fDigitTreePtr->Branch("Digit", &fDigitArrayPtr);
79}