]>
Commit | Line | Data |
---|---|---|
de3b7b4d | 1 | //#include <iostream> |
2 | //#include <fstream> | |
3 | // | |
4 | //#include <TAlienCollection.h> | |
5 | //#include <TFile.h> | |
6 | //#include <TGrid.h> | |
7 | //#include <TGridResult.h> | |
8 | //#include <TMath.h> | |
9 | //#include <TROOT.h> | |
10 | //#include <TString.h> | |
11 | //#include <TSystem.h> | |
12 | // | |
13 | //#include "AliCDBManager.h" | |
14 | //#include "AliDAQ.h" | |
15 | //#include "AliLog.h" | |
16 | //#include "AliQA.h" | |
17 | //#include "AliQADataMakerSteer.h" | |
18 | //#include "AliRawReader.h" | |
19 | //#include "AliRawReaderRoot.h" | |
20 | //#include "AliTRDrawStreamBase.h" | |
21 | //#include "AliGeomManager.h" | |
40d0f38f | 22 | |
23 | TString ClassName() { return "rawqa" ; } | |
24 | ||
25 | //________________________________qa______________________________________ | |
de3b7b4d | 26 | void rawqa(const char * filename) |
40d0f38f | 27 | { |
35bb17ae | 28 | |
29 | // retrieve evironment variables | |
30 | const char * year = gSystem->Getenv("YEAR") ; | |
31 | const TString baseDir(gSystem->Getenv("BASEDIR")) ; | |
32 | const Int_t runNumber = atoi(gSystem->Getenv("RUNNUM")) ; | |
33 | ||
de3b7b4d | 34 | // build the default storage of OCDB |
35 | TString sfilename(filename) ; | |
36 | sfilename = sfilename.Strip() ; | |
37 | sfilename = sfilename.Strip(TString::kLeading) ; | |
35bb17ae | 38 | sfilename.Prepend("alien://") ; |
39 | ||
de3b7b4d | 40 | baseDir.Append("/") ; |
35bb17ae | 41 | TString temp(filename) ; |
42 | temp = temp.ReplaceAll(baseDir, "") ; | |
de3b7b4d | 43 | temp = temp.Strip(TString::kLeading, '/') ; |
44 | baseDir.Append(temp(0, temp.Index("/"))) ; | |
45 | char * kDefaultOCDBStorage = Form("alien://folder=%s/OCDB/", baseDir.Data()) ; | |
de3b7b4d | 46 | |
47 | // set the location of reference data | |
de3b7b4d | 48 | //AliQA::SetQARefStorage(Form("%s%s/", AliQA::GetQARefDefaultStorage(), year)) ; |
49 | AliQA::SetQARefStorage("local://$ALICE_ROOT") ; | |
35bb17ae | 50 | |
40d0f38f | 51 | AliLog::SetGlobalDebugLevel(0) ; |
35bb17ae | 52 | |
40d0f38f | 53 | // connect to the grid |
54 | TGrid * grid = 0x0 ; | |
de3b7b4d | 55 | grid = TGrid::Connect("alien://") ; |
35bb17ae | 56 | |
57 | Bool_t detIn[AliDAQ::kNDetectors] = {kFALSE} ; | |
58 | char * detNameOff[AliDAQ::kNDetectors] = {"ITS", "ITS", "ITS", "TPC", "TRD", "TOF", "HMPID", "PHOS", "PHOS", | |
59 | "PMD", "MUON", "MUON", "FMD", "T0", "VZERO", "ZDC", "ACORDE", "TRG", | |
60 | "EMCAL", "DAQ_TEST", "HLT"} ; | |
61 | ||
de3ab376 | 62 | AliQADataMakerSteer qas("rec") ; |
35bb17ae | 63 | TString detectors = ""; |
64 | TString detectorsW = ""; | |
65 | UShort_t eventsProcessed = 0 ; | |
66 | UShort_t filesProcessed = 1 ; | |
67 | AliCDBManager* man = AliCDBManager::Instance(); | |
68 | man->SetDefaultStorage(kDefaultOCDBStorage) ; | |
69 | man->SetRun(runNumber) ; | |
70 | AliGeomManager::LoadGeometry(); | |
71 | printf("INFO: Proccessing file %s\n", filename) ; | |
72 | // check which detectors are present | |
73 | AliRawReader * rawReader = new AliRawReaderRoot(sfilename); | |
74 | AliTRDrawStreamBase::SetRawStreamVersion("TB"); | |
75 | while ( rawReader->NextEvent() ) { | |
76 | man->SetRun(rawReader->GetRunNumber()); | |
77 | AliLog::Flush(); | |
78 | UChar_t * data ; | |
79 | while (rawReader->ReadNextData(data)) { | |
80 | Int_t detID = rawReader->GetDetectorID(); | |
81 | if (detID < 0 || detID >= AliDAQ::kNDetectors) { | |
82 | printf("INFO: Wrong detector ID! Skipping payload...\n"); | |
83 | continue; | |
84 | } | |
85 | detIn[detID] = kTRUE ; | |
86 | } | |
87 | for (Int_t detID = 0; detID < AliDAQ::kNDetectors ; detID++) { | |
88 | if (detIn[detID]) { | |
89 | if ( ! detectors.Contains(detNameOff[detID]) ) { | |
90 | detectors.Append(detNameOff[detID]) ; | |
91 | detectors.Append(" ") ; | |
92 | } | |
93 | } | |
94 | } | |
95 | if ( !detectors.IsNull() ) | |
96 | break ; | |
97 | } | |
98 | if ( !detectors.IsNull() ) { | |
12e6d563 | 99 | //qas->SetMaxEvents(1) ; |
35bb17ae | 100 | detectorsW = qas.Run(detectors, rawReader) ; |
101 | qas.Reset() ; | |
102 | } else { | |
103 | printf("ERROR: No valid detectors found") ; | |
104 | } | |
105 | delete rawReader ; | |
106 | eventsProcessed += qas.GetCurrentEvent() ; | |
107 | //qas.Merge(runNumber) ; | |
108 | ||
109 | // The summary | |
110 | printf("\n\n********** Summary for run %d **********", runNumber) ; | |
111 | printf(" data file : %s\n", filename); | |
112 | printf(" detectors present in the run : %s\n", detectors.Data()) ; | |
113 | printf(" detectors present in the run with QA: %s\n", detectorsW.Data()) ; | |
114 | printf(" number of files/events processed : %d/%d\n", filesProcessed, eventsProcessed) ; | |
115 | TFile * qaResult = TFile::Open(AliQA::GetQAResultFileName()) ; | |
116 | if ( qaResult ) { | |
117 | AliQA * qa = dynamic_cast<AliQA *>(qaResult->Get(AliQA::GetQAName())) ; | |
118 | if ( qa) { | |
119 | for (Int_t index = 0 ; index < AliQA::kNDET ; index++) | |
120 | if (detectorsW.Contains(AliQA::GetDetName(index))) | |
12e6d563 | 121 | qa->Show((AliQA::GetDetIndex(AliQA::GetDetName(index)))) ; |
35bb17ae | 122 | } else { |
123 | printf("ERROR: %s not found in %s !", AliQA::GetQAName(), AliQA::GetQAResultFileName()) ; | |
124 | } | |
125 | } else { | |
126 | printf("ERROR: %s has not been produced !", AliQA::GetQAResultFileName()) ; | |
127 | } | |
40d0f38f | 128 | } |