4 #include <TAlienCollection.h>
7 #include <TGridResult.h>
12 #include "AliCDBManager.h"
15 #include "AliQADataMakerSteer.h"
16 #include "AliRawReader.h"
17 #include "AliRawReaderRoot.h"
20 TString ClassName() { return "rawqa" ; }
22 //________________________________qa______________________________________
23 void rawqa(const Int_t runNumber, const UInt_t kMaxFiles = 10, const char* year = "08")
26 const char * kDefaultOCDBStorage = Form("alien://folder=/alice/data/20%s/LHC%sa/OCDB/", year, year) ;
27 AliLog::SetGlobalDebugLevel(0) ;
28 // connect to the grid
30 grid = TGrid::Connect("alien://") ;
32 Bool_t detIn[AliDAQ::kNDetectors] = {kFALSE} ;
33 char * detNameOff[AliDAQ::kNDetectors] = {"ITS", "ITS", "ITS", "TPC", "TRD", "TOF", "HMPID", "PHOS", "PHOS", "PMD", "MUON", "MUON", "FMD", "T0", "VZERO", "ZDC", "ACORDE", "TRG", "EMCAL", "DAQ_TEST", "HLT"} ;
34 // make the file name pattern year and run number
36 pattern.Form("%9d",runNumber);
37 pattern.ReplaceAll(" ", "0") ;
38 pattern.Prepend(year);
39 pattern.Append("*0.root");
41 // find the files associated to this run
42 TGridResult * result = 0x0 ;
43 Bool_t local = kFALSE ;
44 if (grid) { // get the list of files from AliEn directly
46 baseDir.Form("/alice/data/20%s/",year);
47 result = grid->Query(baseDir, pattern) ;
49 TString collectionFile(pattern) ;
50 collectionFile.Append(".xml") ;
51 if ( gSystem->AccessPathName(collectionFile) == 0 ) { // get the list of files from an a-priori created collection file
52 TAlienCollection collection(collectionFile.Data(), kMaxFiles) ;
53 result = collection.GetGridResult("", 0, 0);
54 } else { // get the list of files from the local current directory
57 sprintf(line, ".! ls %s*.root > tempo.txt", pattern.Data()) ;
58 gROOT->ProcessLine(line) ;
64 in.open("tempo.txt", ifstream::in) ;
66 AliCDBManager* man = AliCDBManager::Instance();
67 man->SetDefaultStorage(kDefaultOCDBStorage) ;
68 AliQA::SetQARefStorage("alien://folder=/alice/QA/2008") ;
69 man->SetSpecificStorage(Form("%s/20%s/*", AliQA::GetQAOCDBDirName(), year),AliQA::GetQARefStorage());
70 AliQADataMakerSteer qas ;
71 TString detectors = "";
72 TString detectorsW = "";
74 UShort_t filesProcessed = 0 ;
75 for ( file = 0 ; file < kMaxFiles ; file++) {
81 fileName = result->GetKey(file, "turl");
84 if ( fileName.Contains("tag") )
89 sprintf(input, "%s", fileName.Data()) ;
91 sprintf(input, "%s", result->GetKey(file, "turl"));
92 AliInfo(Form("Proccessing file # %d --> %s", file, input)) ;
94 // check which detectors are present
95 AliRawReader * rawReader = new AliRawReaderRoot(input);
96 rawReader->NextEvent() ;
97 man->SetRun(rawReader->GetRunNumber());
99 while (rawReader->ReadNextData(data)) {
100 Int_t detID = rawReader->GetDetectorID();
101 if (detID < 0 || detID >= AliDAQ::kNDetectors) {
102 AliError("Wrong detector ID! Skipping payload...");
105 detIn[detID] = kTRUE ;
107 for (Int_t detID = 0; detID < AliDAQ::kNDetectors ; detID++) {
109 if ( ! detectors.Contains(detNameOff[detID]) ) {
110 detectors.Append(detNameOff[detID]) ;
111 detectors.Append(" ") ;
115 // TEMPORARY REMOVAL OF TRD!!!
116 detectors.ReplaceAll("TRD","");
117 // TEMPORARY REMOVAL OF TRD!!!
118 if ( !detectors.IsNull() ) {
119 detectorsW = qas.Run(detectors, rawReader) ;
122 AliError("No valid detectors found") ;
127 qas.Merge(runNumber) ;
131 AliInfo(Form("\n\n********** Summary for run %d **********", runNumber)) ;
132 printf(" detectors present in the run : %s\n", detectors.Data()) ;
133 printf(" detectors present in the run with QA: %s\n", detectorsW.Data()) ;
134 printf(" number of files processed : %d\n", filesProcessed) ;
135 TFile * qaResult = TFile::Open(AliQA::GetQAResultFileName()) ;
136 AliQA * qa = dynamic_cast<AliQA *>(qaResult->Get("QA")) ;
137 for (Int_t index = 0 ; index < AliQA::kNDET ; index++)
138 if (detectorsW.Contains(AliQA::GetDetName(AliQA::DETECTORINDEX(index))))
139 qa->ShowStatus(AliQA::DETECTORINDEX(index)) ;