]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/PHOS/offline/AliHLTPHOSDigitHandler.cxx
Added SPD outlier trigger bit
[u/mrichter/AliRoot.git] / HLT / PHOS / offline / AliHLTPHOSDigitHandler.cxx
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 AliHLTPHOSDigitHandler::AliHLTPHOSDigitHandler() : AliHLTCaloDigitHandler("PHOS")
27 {
28
29 }
30
31 AliHLTPHOSDigitHandler::~AliHLTPHOSDigitHandler()
32 {
33
34 }
35
36 AliHLTPHOSDigitHandler* AliHLTPHOSDigitHandler::Instance()
37 {
38     if (!fgkInstance)
39     {
40         fgkInstance = new AliHLTPHOSDigitHandler;
41     }
42     return fgkInstance;
43 }
44
45 Int_t AliHLTPHOSDigitHandler::Init(AliRunLoader* runLoader)
46 {
47   
48     fGeometry = new AliHLTPHOSGeometry();
49     if(fGeometry) fGeometry->InitialiseGeometry();
50     
51     Int_t nev = AliHLTCaloDigitHandler::Init(runLoader);
52     if(nev > 0)
53     {
54       if (fRunLoader)
55       {
56         fDetLoader = fRunLoader->GetDetectorLoader("PHOS");
57         if (!fDetLoader)
58         {
59             HLTFatal("Could not get PHOS loader");
60             return -1;
61         }
62       }
63       else
64       {
65         return -2;
66       }
67     }
68     return nev;
69 }
70
71 Int_t AliHLTPHOSDigitHandler::ConvertDigit(AliDigitNew* digit)
72 {
73   AliPHOSDigit *dig = dynamic_cast<AliPHOSDigit*>(digit);
74     if(!dig)
75     {
76       HLTError("Wrong data, cannot create digits");
77       return -1;
78     }
79
80     Int_t module = 0;
81     Int_t x = 0;
82     Int_t z = 0;
83
84     fGeometry->GetLocalCoordinatesFromAbsId(dig->GetId(), module, x, z);
85
86     AliHLTCaloDigitDataStruct *hDig = &(fDigits[module][fDigitsInModule[module]]);
87
88     hDig->fID = dig->GetId();
89     hDig->fX = x;
90     hDig->fZ = z;
91     hDig->fModule = module;
92     hDig->fEnergy = dig->GetEnergy();
93     hDig->fTime = dig->GetTime();
94     hDig->fAmplitude = 0;
95     hDig->fOverflow = false;
96     hDig->fHgPresent = true;
97     hDig->fAssociatedCluster = -1;
98     fDigitsInModule[module]++;
99     
100     return 0;
101 }