Working on the electron cut
[u/mrichter/AliRoot.git] / prod / cosmic / rawqa.C
CommitLineData
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"
4c39e638 13#include "AliCDBEntry.h"
a7f6b5bc 14#include "AliDAQ.h"
4c39e638 15#include "AliGRPObject.h"
a7f6b5bc 16#include "AliLog.h"
17#include "AliQAv1.h"
18#include "AliQAManager.h"
19#include "AliRawReader.h"
20#include "AliRawReaderRoot.h"
a7f6b5bc 21#include "AliGeomManager.h"
4c39e638 22#include "AliRecoParam.h"
40d0f38f 23
24TString ClassName() { return "rawqa" ; }
25
26//________________________________qa______________________________________
4c39e638 27void rawqa(Char_t * filename, Int_t run, AliRecoParam::EventSpecie_t es=AliRecoParam::kDefault)
40d0f38f 28{
4e056e45 29// TGrid * grid = TGrid::Connect("alien://") ;
30// TString filename ;
31// if (grid) {
32// filename = Form("alien:///alice/data/2009/LHC09c/000085034/raw/09000085034023.40.root") ;
33// } else {
34// filename = "raw.root" ;
35// }
36
a7f6b5bc 37 // Set the CDB storage location
38 AliCDBManager * man = AliCDBManager::Instance();
4e056e45 39// man->SetDefaultStorage("local://cdb2");
a7f6b5bc 40 man->SetDefaultStorage("raw://");
4c39e638 41 man->SetRun(run);
42 AliCDBEntry * entry = man->Get("GRP/GRP/Data");
43 if (!entry)
44 return ;
45 AliGRPObject * fGRPData = dynamic_cast<AliGRPObject*>(entry->GetObject());
46 if (!fGRPData) {
47 printf("ERROR: No GRP entry found in OCDB") ;
48 return ;
49 }
50 Int_t activeDetectors = fGRPData->GetDetectorMask();
51 const char * detNameOff[AliDAQ::kNDetectors] = {
52 "ITS",
53 "ITS",
54 "ITS",
55 "TPC",
56 "TRD",
57 "TOF",
58 "HMPID",
59 "PHOS",
60 "CPV",
61 "PMD",
62 "MUON",
63 "MUON",
64 "FMD",
65 "T0",
66 "VZERO", // Name to be changed to V0 ?
67 "ZDC",
68 "ACORDE",
69 "TRG",
70 "EMCAL",
71 "DAQ_TEST",
72 "HLT"
73 } ;
74 TString detectors = "";
75 TString detectorsW ;
76 for(Int_t iDet = 0; iDet < (AliDAQ::kNDetectors-1); iDet++) {
77 if ((activeDetectors >> iDet) & 0x1) {
78 if (!detectors.Contains(detNameOff[iDet])) {
79 detectors +=detNameOff[iDet] ;
80 detectors += " " ;
81 }
82 }
83 }
a7f6b5bc 84 AliQAv1::SetQARefStorage("local://$ALICE_ROOT/QAref") ;
4c39e638 85
aaab6050 86 AliLog::SetGlobalDebugLevel(0) ;
35bb17ae 87
5aae1dab 88 AliQAManager * qam = AliQAManager::QAManager(AliQAv1::kQAMODE) ;
a7f6b5bc 89 qam->SetEventSpecie(AliRecoParam::kCosmic) ;
4c39e638 90 AliQAv1::Instance()->SetEventSpecie(es) ;
91// TString detectorsW = "";
aaab6050 92 UShort_t eventsProcessed = 0 ;
93 UShort_t filesProcessed = 1 ;
aaab6050 94 AliGeomManager::LoadGeometry();
4c39e638 95 printf("INFO: Proccessing detectors %s from file %s\n", detectors.Data(), filename) ;
aaab6050 96 if ( !detectors.IsNull() ) {
a7f6b5bc 97 qam->SetMaxEvents(-1) ;
4c39e638 98 qam->SetTasks(Form("%d", AliQAv1::kRAWS));
99 AliRawReader * rawReader = new AliRawReaderRoot(Form("alien://%s", filename));
a7f6b5bc 100 detectorsW = qam->Run(detectors, rawReader) ;
101 qam->Reset() ;
aaab6050 102 } else {
4c39e638 103 printf("ERROR: No valid detectors found") ;
aaab6050 104 }
a7f6b5bc 105 eventsProcessed += qam->GetCurrentEvent() ;
106 //qam->Merge(run) ;
35bb17ae 107
108 // The summary
a7f6b5bc 109 printf("\n\n********** Summary for run %d **********", run) ;
aaab6050 110 printf(" data file : %s\n", filename);
111 printf(" detectors present in the run : %s\n", detectors.Data()) ;
112 printf(" detectors present in the run with QA: %s\n", detectorsW.Data()) ;
113 printf(" number of files/events processed : %d/%d\n", filesProcessed, eventsProcessed) ;
a7f6b5bc 114 //const char * qaFileName = AliQAv1::GetQAResultFileName() ;
115 // TFile * qaResult = TFile::Open(qaFileName) ;
116 TFile * qaResult = TFile::Open("QA.root") ;
aaab6050 117 if ( qaResult ) {
a7f6b5bc 118 AliQAv1 * qa = dynamic_cast<AliQAv1 *>(qaResult->Get(AliQAv1::GetQAName())) ;
aaab6050 119 if ( qa) {
a7f6b5bc 120 for (Int_t index = 0 ; index < AliQAv1::kNDET ; index++)
121 if (detectorsW.Contains(AliQAv1::GetDetName(index)))
122 qa->Show((AliQAv1::GetDetIndex(AliQAv1::GetDetName(index)))) ;
aaab6050 123 } else {
a7f6b5bc 124 printf("ERROR: %s not found in %s !", AliQAv1::GetQAName(), AliQAv1::GetQAResultFileName()) ;
aaab6050 125 }
126 } else {
a7f6b5bc 127 printf("ERROR: %s has not been produced !", AliQAv1::GetQAResultFileName()) ;
aaab6050 128 }
40d0f38f 129}