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