]>
Commit | Line | Data |
---|---|---|
171dcedf | 1 | #include "AliHLTFastJetMonitorComponent.h" |
2 | #include "AliHLTFastJetMonitor.h" | |
3 | #include "AliHLTScalars.h" | |
4 | ||
5 | #include "TFile.h" | |
6 | #include "TString.h" | |
7 | ||
8 | AliHLTFastJetMonitorComponent::AliHLTFastJetMonitorComponent() : | |
9 | fRootFileName("fjtrigger_histos.root"), | |
10 | fPushFraction(10), | |
11 | fLocalEventCount(0), | |
12 | fVerbose(0), | |
13 | fHistoPtr(NULL) | |
14 | { | |
15 | ||
16 | // default constructor | |
17 | ||
18 | } | |
19 | //____________________________________________________________________________________________________________ | |
20 | ||
21 | AliHLTFastJetMonitorComponent::~AliHLTFastJetMonitorComponent() | |
22 | { | |
23 | ||
24 | // default destructor | |
25 | ||
26 | } | |
27 | //____________________________________________________________________________________________________________ | |
28 | ||
29 | int AliHLTFastJetMonitorComponent::DoInit(int argc, const char **argv) | |
30 | { | |
31 | // initialize | |
32 | ||
33 | fHistoPtr = new AliHLTFastJetMonitor(); | |
34 | for (int i = 0; i < argc; i++) { | |
35 | if (!strcmp("-roothistofilename", argv[i])) | |
36 | fRootFileName = argv[i+1]; | |
37 | if (!strcmp("-pushfraction", argv[i])) | |
38 | fPushFraction = atoi(argv[i+1]); | |
39 | if (!strcmp("-verbose", argv[i])) | |
40 | fVerbose = atoi(argv[i+1]); | |
41 | } | |
42 | ||
43 | return 0; | |
44 | ||
45 | } | |
46 | //____________________________________________________________________________________________________________ | |
47 | ||
48 | int AliHLTFastJetMonitorComponent::Deinit() | |
49 | { | |
50 | // de-initialize | |
51 | ||
52 | if (fHistoPtr) { | |
53 | delete fHistoPtr; | |
54 | fHistoPtr = NULL; | |
55 | } | |
56 | return 0; | |
57 | ||
58 | } | |
59 | //____________________________________________________________________________________________________________ | |
60 | const char* AliHLTFastJetMonitorComponent::GetComponentID() | |
61 | { | |
62 | // component id | |
63 | ||
64 | return "EmcalFastJetMonitor"; | |
65 | ||
66 | } | |
67 | //____________________________________________________________________________________________________________ | |
68 | ||
69 | void AliHLTFastJetMonitorComponent::GetInputDataTypes(vector<AliHLTComponentDataType> &list) | |
70 | { | |
71 | // define input data types | |
72 | ||
73 | list.clear(); | |
74 | list.push_back(kAliHLTDataTypeEventStatistics|kAliHLTDataOriginHLT); | |
75 | ||
76 | } | |
77 | //____________________________________________________________________________________________________________ | |
78 | ||
79 | AliHLTComponentDataType AliHLTFastJetMonitorComponent::GetOutputDataType() | |
80 | { | |
81 | ||
82 | // return output data types | |
83 | ||
84 | return kAliHLTDataTypeHistogram | kAliHLTDataOriginEMCAL; | |
85 | ||
86 | } | |
87 | //____________________________________________________________________________________________________________ | |
88 | ||
89 | void AliHLTFastJetMonitorComponent::GetOutputDataSize(unsigned long &constBase, double &inputMultiplier) | |
90 | { | |
91 | ||
92 | // calculate output data size | |
93 | ||
94 | constBase = 0; | |
95 | inputMultiplier = 100; | |
96 | ||
97 | } | |
98 | //____________________________________________________________________________________________________________ | |
99 | ||
100 | int AliHLTFastJetMonitorComponent::DoEvent(const AliHLTComponentEventData &evtData, const AliHLTComponentBlockData *blocks, | |
101 | AliHLTComponentTriggerData &/*trigData*/, AliHLTUInt8_t */*outputPtr*/, AliHLTUInt32_t &/*size*/, | |
102 | std::vector<AliHLTComponentBlockData> &/*outputBlocks*/) | |
103 | { | |
104 | ||
105 | // do event | |
106 | ||
107 | const AliHLTComponentBlockData *iter = NULL; | |
108 | UInt_t specification = 0; | |
109 | ||
110 | for (unsigned long ij = 0; ij < evtData.fBlockCnt; ij++) { | |
111 | AliHLTScalars *scalarPtr = NULL; | |
112 | iter = blocks + ij; | |
113 | if (fVerbose) PrintComponentDataTypeInfo(iter->fDataType); | |
114 | ||
115 | if (iter->fDataType == kAliHLTDataTypeEventStatistics) { | |
116 | scalarPtr = reinterpret_cast<AliHLTScalars*>(iter->fPtr); | |
117 | } | |
118 | else { | |
119 | if (fVerbose) HLTWarning("FastJet Monitor: Data block does not contain event stats - check if flag is set for histograming for AliHLTTriggerFastJet \n"); | |
120 | } | |
121 | ||
122 | specification |= iter->fSpecification; | |
93bfb33c | 123 | if (scalarPtr) |
124 | fHistoPtr->MakeHisto(scalarPtr); | |
171dcedf | 125 | } |
126 | ||
127 | fLocalEventCount++; | |
128 | ||
129 | TFile rootHistFile(fRootFileName, "RECREATE"); | |
130 | ||
131 | fHistoPtr->GetHistograms()->Write(); | |
132 | ||
133 | if (fLocalEventCount%fPushFraction == 0) { | |
134 | if (fVerbose) cout << "FastJet Monitor: pushback done at " << fLocalEventCount << " evens " << endl; | |
135 | PushBack(fHistoPtr->GetHistograms(), kAliHLTDataTypeTObjArray | kAliHLTDataOriginEMCAL, specification); | |
136 | } | |
137 | ||
138 | return 0; | |
139 | } | |
140 | //____________________________________________________________________________________________________________ | |
141 | ||
142 | AliHLTComponent* AliHLTFastJetMonitorComponent::Spawn() | |
143 | { | |
144 | // spawn | |
145 | ||
146 | return new AliHLTFastJetMonitorComponent(); | |
147 | ||
148 | } |