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.
9 * Usage: aliroot -b -q print-RAW-HLTdecision.C'(input, minEvent, maxEvent)'
11 * For help: aliroot -b -q print-RAW-HLTdecision.C
14 * The input file can be a file on Grid like e.g.
15 * "alien:///alice/data/2009/LHC09d/000104321/raw/09000104321018.30.root"
16 * In that case you need a valid token in order to connect to the Grid.
17 * Use 'alien-token-init' from your alien installation.
19 * @author Matthias.Richter@ift.uib.no
20 * @ingroup alihlt_programs
22 void print_RAW_HLTdecision(const char* rawFileName,
23 int minEvent=0, int maxEvent=-1)
26 log.SetGlobalLoggingLevel(0x7c);
28 TString strfile=rawFileName;
29 if (strfile.Contains("://") && !strfile.Contains("local://")) {
30 TGrid::Connect("alien");
33 AliRawReader* rawReader=NULL;
34 if (rawFileName && rawFileName[0]!=0) rawReader=AliRawReader::Create(rawFileName);
35 if (!rawFileName || rawFileName[0]==0 || !rawReader) {
36 if (rawFileName && rawFileName[0]!=0)
37 cerr << "can not open raw reader " << rawFileName << endl;
39 cerr << "print-RAW-HLTdecision.C Print HLT decisions per event of RAW data" << endl;
40 cerr << "===============================================================" << endl;
41 cerr << "usage: aliroot -b -q -l print-RAW-HLTdecision.C'(rawFileName" << endl;
42 cerr << " minEvent, maxEvent)'" << endl << endl;
43 cerr << " Parameter:" << endl;
44 cerr << " rawFileName e.g \"raw.root\", \"./\"" << endl;
45 cerr << " minEvent first event (optional)" << endl;
46 cerr << " maxEvent last event (optional)" << endl;
47 cerr << "===============================================================" << endl;
51 rawReader->RewindEvents();
53 if (!rawReader->NextEvent()) {
54 cout << "no events found in " << rawFileName << endl;
58 AliHLTOUT* pHLTOUT=AliHLTOUT::New(rawReader);
60 cerr << "can not create HLTOUT instance" << endl;
65 if (minEvent>=0 && event<minEvent) continue;
66 cout << "===================== event " << event << " ==========================" << endl;
67 if (pHLTOUT->Init()<0) {
68 cerr << "failed to initialize HLTOUT for event " << event << endl;
73 // in the original implementation, the GlobalTriggerDecision has been
74 // sent with data type kAliHLTDataTypeTObject, thats why we check for
76 if (pHLTOUT->SelectFirstDataBlock(kAliHLTDataTypeGlobalTrigger)>=0 ||
77 pHLTOUT->SelectFirstDataBlock(kAliHLTDataTypeTObject)>=0) {
79 TObject* decision = pHLTOUT->GetDataObject();
81 if (decision->IsA() == AliHLTGlobalTriggerDecision::Class()) {
82 cout << "HLT Global Trigger: " << decision->GetOption() << " " << decision->GetTitle() << endl;
86 pHLTOUT->ReleaseDataObject(decision);
88 } while (!found && pHLTOUT->SelectNextDataBlock());
92 cout << " no HLT decision found" << endl;
96 } while (rawReader->NextEvent() && (maxEvent<0 || event<maxEvent));
99 void print_RAW_HLTdecision()
102 print_RAW_HLTdecision(NULL);