4 //#include <TAlienCollection.h>
7 //#include <TGridResult.h>
10 //#include <TString.h>
11 //#include <TSystem.h>
13 //#include "AliCDBManager.h"
17 //#include "AliQADataMakerSteer.h"
18 //#include "AliRawReader.h"
19 //#include "AliRawReaderRoot.h"
20 //#include "AliTRDrawStreamBase.h"
21 //#include "AliGeomManager.h"
23 TString ClassName() { return "rawqa" ; }
25 //________________________________qa______________________________________
26 void rawqa(const char * filename)
28 // retrieve evironment variables
29 const char * year = gSystem->Getenv("YEAR") ;
30 const TString baseDir(gSystem->Getenv("BASEDIR")) ;
31 const Int_t runNumber = atoi(gSystem->Getenv("RUNNUM")) ;
33 // build the default storage of OCDB
34 TString sfilename(filename) ;
35 sfilename = sfilename.Strip() ;
36 sfilename = sfilename.Strip(TString::kLeading) ;
37 sfilename.Prepend("alien://") ;
40 TString temp(filename) ;
41 temp = temp.ReplaceAll(baseDir, "") ;
42 temp = temp.Strip(TString::kLeading, '/') ;
43 baseDir.Append(temp(0, temp.Index("/"))) ;
44 char * kDefaultOCDBStorage = Form("alien://folder=%s/OCDB/", baseDir.Data()) ;
46 // set the location of reference data
47 //AliQA::SetQARefStorage(Form("%s%s/", AliQA::GetQARefDefaultStorage(), year)) ;
48 AliQA::SetQARefStorage("local://$ALICE_ROOT/OCDB") ;
50 AliLog::SetGlobalDebugLevel(0) ;
52 // connect to the grid
54 grid = TGrid::Connect("alien://") ;
56 Bool_t detIn[AliDAQ::kNDetectors] = {kFALSE} ;
57 char * detNameOff[AliDAQ::kNDetectors] = {"ITS", "ITS", "ITS", "TPC", "TRD", "TOF", "HMPID", "PHOS", "PHOS",
58 "PMD", "MUON", "MUON", "FMD", "T0", "VZERO", "ZDC", "ACORDE", "TRG",
59 "EMCAL", "DAQ_TEST", "HLT"} ;
61 AliQADataMakerSteer qas("rec") ;
62 TString detectors = "";
63 TString detectorsW = "";
64 UShort_t eventsProcessed = 0 ;
65 UShort_t filesProcessed = 1 ;
66 AliCDBManager* man = AliCDBManager::Instance();
67 man->SetDefaultStorage(kDefaultOCDBStorage) ;
68 man->SetRun(runNumber) ;
69 AliGeomManager::LoadGeometry();
70 printf("INFO: Proccessing file %s\n", filename) ;
71 // check which detectors are present
72 AliRawReader * rawReader = new AliRawReaderRoot(sfilename);
73 AliTRDrawStreamBase::SetRawStreamVersion("TB");
74 while ( rawReader->NextEvent() ) {
75 man->SetRun(rawReader->GetRunNumber());
78 while (rawReader->ReadNextData(data)) {
79 Int_t detID = rawReader->GetDetectorID();
80 if (detID < 0 || detID >= AliDAQ::kNDetectors) {
81 printf("INFO: Wrong detector ID! Skipping payload...\n");
84 detIn[detID] = kTRUE ;
86 for (Int_t detID = 0; detID < AliDAQ::kNDetectors ; detID++) {
88 if ( ! detectors.Contains(detNameOff[detID]) ) {
89 detectors.Append(detNameOff[detID]) ;
90 detectors.Append(" ") ;
94 if ( !detectors.IsNull() )
97 if ( !detectors.IsNull() ) {
98 //qas->SetMaxEvents(1) ;
99 qas.SetTasks(Form("%d", AliQA::kRAWS));
100 detectorsW = qas.Run(detectors, rawReader) ;
103 printf("ERROR: No valid detectors found") ;
106 eventsProcessed += qas.GetCurrentEvent() ;
107 //qas.Merge(runNumber) ;
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()) ;
117 AliQA * qa = dynamic_cast<AliQA *>(qaResult->Get(AliQA::GetQAName())) ;
119 for (Int_t index = 0 ; index < AliQA::kNDET ; index++)
120 if (detectorsW.Contains(AliQA::GetDetName(index)))
121 qa->Show((AliQA::GetDetIndex(AliQA::GetDetName(index)))) ;
123 printf("ERROR: %s not found in %s !", AliQA::GetQAName(), AliQA::GetQAResultFileName()) ;
126 printf("ERROR: %s has not been produced !", AliQA::GetQAResultFileName()) ;