Line data Source code
1 : /**************************************************************************
2 : * This file is property of and copyright by the ALICE HLT Project *
3 : * ALICE Experiment at CERN, All rights reserved. *
4 : * *
5 : * Primary Authors: Oystein Djuvsland <oysteind@ift.uib.no> *
6 : * for The ALICE HLT Project. *
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 : #include "AliHLTPHOSDigitHandler.h"
18 : #include "AliRunLoader.h"
19 : #include "AliLoader.h"
20 : #include "AliHLTPHOSGeometry.h"
21 : #include "TTree.h"
22 : #include "AliPHOSDigit.h"
23 :
24 : AliHLTPHOSDigitHandler *AliHLTPHOSDigitHandler::fgkInstance = NULL;
25 :
26 0 : AliHLTPHOSDigitHandler::AliHLTPHOSDigitHandler() : AliHLTCaloDigitHandler("PHOS")
27 0 : {
28 :
29 0 : }
30 :
31 0 : AliHLTPHOSDigitHandler::~AliHLTPHOSDigitHandler()
32 0 : {
33 :
34 0 : }
35 :
36 : AliHLTPHOSDigitHandler* AliHLTPHOSDigitHandler::Instance()
37 : {
38 0 : if (!fgkInstance)
39 : {
40 0 : fgkInstance = new AliHLTPHOSDigitHandler;
41 0 : }
42 0 : return fgkInstance;
43 0 : }
44 :
45 : Int_t AliHLTPHOSDigitHandler::Init(AliRunLoader* runLoader)
46 : {
47 :
48 0 : fGeometry = new AliHLTPHOSGeometry();
49 0 : if(fGeometry) fGeometry->InitialiseGeometry();
50 :
51 0 : Int_t nev = AliHLTCaloDigitHandler::Init(runLoader);
52 0 : if(nev > 0)
53 : {
54 0 : if (fRunLoader)
55 : {
56 0 : fDetLoader = fRunLoader->GetDetectorLoader("PHOS");
57 0 : if (!fDetLoader)
58 : {
59 0 : HLTFatal("Could not get PHOS loader");
60 0 : return -1;
61 : }
62 : }
63 : else
64 : {
65 0 : return -2;
66 : }
67 : }
68 0 : return nev;
69 0 : }
70 :
71 : Int_t AliHLTPHOSDigitHandler::ConvertDigit(AliDigitNew* digit)
72 : {
73 0 : AliPHOSDigit *dig = dynamic_cast<AliPHOSDigit*>(digit);
74 0 : if(!dig)
75 : {
76 0 : HLTError("Wrong data, cannot create digits");
77 0 : return -1;
78 : }
79 :
80 0 : Int_t module = 0;
81 0 : Int_t x = 0;
82 0 : Int_t z = 0;
83 :
84 0 : fGeometry->GetLocalCoordinatesFromAbsId(dig->GetId(), module, x, z);
85 :
86 0 : AliHLTCaloDigitDataStruct *hDig = &(fDigits[module][fDigitsInModule[module]]);
87 :
88 0 : hDig->fID = dig->GetId();
89 0 : hDig->fX = x;
90 0 : hDig->fZ = z;
91 0 : hDig->fModule = module;
92 0 : hDig->fEnergy = dig->GetEnergy();
93 0 : hDig->fTime = dig->GetTime();
94 0 : hDig->fAmplitude = 0;
95 0 : hDig->fOverflow = false;
96 0 : hDig->fHgPresent = true;
97 0 : hDig->fAssociatedCluster = -1;
98 0 : fDigitsInModule[module]++;
99 :
100 : return 0;
101 0 : }
|