]>
Commit | Line | Data |
---|---|---|
903e67e7 | 1 | // $Id$ |
2 | /** | |
3 | * @file print-RAW-HLTdecision.C | |
4 | * @brief Print HLT decisions per event of RAW data | |
5 | * The uses the RawReader interface for data access and can be used | |
6 | * with different types of data as long as a RawReader is implemented. | |
7 | * | |
8 | * <pre> | |
9 | * Usage: aliroot -b -q print-RAW-HLTdecision.C'(input, minEvent, maxEvent)' | |
10 | * | |
11 | * For help: aliroot -b -q print-RAW-HLTdecision.C | |
12 | * </pre> | |
13 | * | |
14 | * @author Matthias.Richter@ift.uib.no | |
15 | * @ingroup alihlt_programs | |
16 | */ | |
17 | void print_RAW_HLTdecision(const char* rawFileName, | |
18 | int minEvent=0, int maxEvent=-1) | |
19 | { | |
20 | AliHLTLogging log; | |
21 | log.SetGlobalLoggingLevel(0x7c); | |
22 | ||
23 | AliRawReader* rawReader=NULL; | |
24 | if (rawFileName && rawFileName[0]!=0) rawReader=AliRawReader::Create(rawFileName); | |
25 | if (!rawFileName || rawFileName[0]==0 || !rawReader) { | |
26 | if (rawFileName && rawFileName[0]!=0) | |
27 | cerr << "can not open raw reader " << rawFileName << endl; | |
28 | else | |
29 | cerr << "print-RAW-HLTdecision.C Print HLT decisions per event of RAW data" << endl; | |
30 | cerr << "===============================================================" << endl; | |
31 | cerr << "usage: aliroot -b -q -l print-RAW-HLTdecision.C'(rawFileName" << endl; | |
32 | cerr << " minEvent, maxEvent)'" << endl << endl; | |
33 | cerr << " Parameter:" << endl; | |
34 | cerr << " rawFileName e.g \"raw.root\", \"./\"" << endl; | |
35 | cerr << " minEvent first event (optional)" << endl; | |
36 | cerr << " maxEvent last event (optional)" << endl; | |
37 | cerr << "===============================================================" << endl; | |
38 | return; | |
39 | } | |
40 | ||
41 | rawReader->RewindEvents(); | |
42 | int event=0; | |
43 | if (!rawReader->NextEvent()) { | |
44 | cout << "no events found in " << rawFileName << endl; | |
45 | return; | |
46 | } | |
47 | ||
48 | AliHLTOUT* pHLTOUT=AliHLTOUT::New(rawReader); | |
49 | if (!pHLTOUT) { | |
50 | cerr << "can not create HLTOUT instance" << endl; | |
51 | return; | |
52 | } | |
53 | ||
54 | do { | |
55 | if (minEvent>=0 && event<minEvent) continue; | |
56 | cout << "===================== event " << event << " ==========================" << endl; | |
57 | if (pHLTOUT->Init()<0) { | |
58 | cerr << "failed to initialize HLTOUT for event " << event << endl; | |
59 | break; | |
60 | } | |
61 | bool found=false; | |
62 | do { | |
63 | TObject* decision=NULL; | |
64 | // in the original implementation, the GlobalTriggerDecision has been | |
65 | // sent with data type kAliHLTDataTypeTObject, thats why we check for | |
66 | // both | |
67 | if (pHLTOUT->SelectFirstDataBlock(kAliHLTDataTypeGlobalTrigger)>=0 || | |
68 | pHLTOUT->SelectFirstDataBlock(kAliHLTDataTypeTObject)>=0) { | |
69 | decision=pHLTOUT->GetDataObject(); | |
70 | } | |
71 | if (decision) { | |
72 | if (decision->IsA() == AliHLTGlobalTriggerDecision::Class()) { | |
73 | cout << "HLT Global Trigger: " << decision->GetOption() << " " << decision->GetTitle() << endl; | |
74 | decision->Print(); | |
75 | found=true; | |
76 | } | |
77 | pHLTOUT->ReleaseDataObject(decision); | |
78 | } | |
79 | } while (!found && pHLTOUT->SelectNextDataBlock()); | |
80 | ||
81 | if (!found) { | |
82 | cout << " no HLT decision found" << endl; | |
83 | } | |
84 | pHLTOUT->Reset(); | |
ee94773a | 85 | event++; |
903e67e7 | 86 | } while (rawReader->NextEvent() && (maxEvent<0 || event<maxEvent)); |
87 | } | |
88 | ||
89 | void print_RAW_HLTdecision() | |
90 | { | |
91 | // print usage | |
92 | print_RAW_HLTdecision(NULL); | |
93 | } |