]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/ITS/AliHLTITSDigitPublisherComponent.cxx
257fbde2d30e977451d4ed9c3264b61506261cfe
[u/mrichter/AliRoot.git] / HLT / ITS / AliHLTITSDigitPublisherComponent.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: Kenneth Aamodt, Sergey Gorbunov                       *
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 /** @file   AliHLTITSDigitPublisherComponent.cxx
18     @author Kenneth Aamodt, Sergey Gorbunov
19     @date   
20     @brief  Component to run offline clusterfinders
21 */
22
23 #if __GNUC__>= 3
24 using namespace std;
25 #endif
26
27 #include <TSystem.h>
28 #include <TROOT.h>
29 #include "AliHLTITSDigitPublisherComponent.h" 
30 #include "AliRun.h"
31 #include "AliRunLoader.h"
32 #include "AliGeomManager.h"
33 #include "AliITSInitGeometry.h"
34 #include "AliITSLoader.h"
35 #include "AliCDBManager.h"
36 #include "AliLog.h"
37 #include "TTree.h"
38 #include "TObjArray.h"
39 #include "TClonesArray.h"
40 /** ROOT macro for the implementation of ROOT specific class methods */
41 ClassImp(AliHLTITSDigitPublisherComponent);
42
43 AliHLTITSDigitPublisherComponent::AliHLTITSDigitPublisherComponent()
44   :
45   fRunLoader(NULL),
46   fITSLoader(NULL),
47   fNumberOfEvents(0),
48   fEventNumber(0),
49   tD(NULL)
50
51   // see header file for class documentation
52   // or
53   // refer to README to build package
54   // or
55   // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
56 }
57
58 AliHLTITSDigitPublisherComponent::~AliHLTITSDigitPublisherComponent() {
59   // see header file for class documentation
60 }
61
62 // Public functions to implement AliHLTComponent's interface.
63 // These functions are required for the registration process
64
65 const char* AliHLTITSDigitPublisherComponent::GetComponentID()
66 {
67   // see header file for class documentation
68   return "ITSDigitPublisher";
69 }
70
71 void AliHLTITSDigitPublisherComponent::GetInputDataTypes( vector<AliHLTComponentDataType>& list) {
72   // see header file for class documentation
73   list.clear(); 
74   //list.push_back( ???? | ???? );
75 }
76
77 AliHLTComponentDataType AliHLTITSDigitPublisherComponent::GetOutputDataType() {
78   // see header file for class documentation
79
80   return kAliHLTDataTypeTTree|kAliHLTDataOriginITS;
81 }
82
83 void AliHLTITSDigitPublisherComponent::GetOutputDataSize( unsigned long& constBase, double& inputMultiplier ) {
84   // see header file for class documentation
85   constBase = 20000;
86   inputMultiplier = 1000;
87 }
88
89 AliHLTComponent* AliHLTITSDigitPublisherComponent::Spawn() {
90   // see header file for class documentation
91   return new AliHLTITSDigitPublisherComponent();
92 }
93         
94 Int_t AliHLTITSDigitPublisherComponent::DoInit( int /*argc*/, const char** /*argv*/ ) {
95   // see header file for class documentation
96   
97   if(AliGeomManager::GetGeometry()==NULL){
98     AliGeomManager::LoadGeometry();
99   }
100
101   fRunLoader = GetRunLoader();//AliRunLoader::Open("galice.root");
102   if(!fRunLoader){
103     HLTFatal("No RunLoader found");
104     return -1;
105   }
106   fITSLoader = (AliITSLoader *)(fRunLoader->GetLoader("ITSLoader"));
107   if(!fITSLoader){
108     HLTFatal("No ITS RunLoader found");
109     return -1;
110   }
111   fNumberOfEvents = fRunLoader->GetNumberOfEvents();
112  
113   return 0;
114 }
115
116 Int_t AliHLTITSDigitPublisherComponent::DoDeinit() {
117   // see header file for class documentation
118
119   return 0;
120 }
121
122 Int_t AliHLTITSDigitPublisherComponent::GetEvent(const AliHLTComponentEventData& /*evtData*/,AliHLTComponentTriggerData& /*trigData*/)
123 {
124   // see header file for class documentation
125   if (!IsDataEvent()) return 0;
126
127   fRunLoader->GetEvent(fEventNumber);
128   fITSLoader->LoadDigits("read");
129   tD = fITSLoader->TreeD();
130   if(!tD){
131     HLTFatal("No Digit Tree found");
132     return -1;
133   } 
134   //tD->GetEntry(fEventNumber);
135   
136   PushBack((TObject*)tD,kAliHLTDataTypeTTree|kAliHLTDataOriginITS,0x00000000);
137   fEventNumber++;
138   return 0;
139 }
140