]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STEER/AliQAManager.h
added method to merge files listed in a xml collection
[u/mrichter/AliRoot.git] / STEER / AliQAManager.h
1 #ifndef ALIQAMANAGER_H
2 #define ALIQAMANAGER_H
3 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4  * See cxx source for full Copyright notice                               */
5
6 /* $Id: AliQAManager.h 30796 2009-01-28 11:05:10Z schutz $ */
7
8 ///////////////////////////////////////////////////////////////////////////////
9 //                                                                           //
10 // class for running the QA makers                                           //
11 //                                                                           //
12 //   AliQAManager qas;                                                //
13 //   qas.Run(AliQA::kRAWS, rawROOTFileName);                                 //
14 //   qas.Run(AliQA::kHITS);                                                  //
15 //   qas.Run(AliQA::kSDIGITS);                                               //
16 //   qas.Run(AliQA::kDIGITS);                                                //
17 //   qas.Run(AliQA::kRECPOINTS);                                             //
18 //   qas.Run(AliQA::kESDS);                                                  //
19 //                                                                           //
20 ///////////////////////////////////////////////////////////////////////////////
21
22 #include <TNamed.h>
23 #include "AliQA.h"
24 #include "AliLoader.h"
25 #include "AliCDBManager.h"
26 #include "AliRecoParam.h"
27  
28 class AliESDEvent ; 
29 class AliDetectorRecoParam ; 
30 class AliESDEvent ; 
31 class AliQADataMaker ;
32 class AliRawReader ;  
33 class AliRunLoader ; 
34 class AliCorrQADataMakerRec ;
35
36 class AliQAManager : public AliCDBManager {
37 private:
38   AliQAManager() ; 
39         AliQAManager(const Char_t * mode, const Char_t * gAliceFilename = "galice.root") ; 
40         AliQAManager(const AliQAManager & qas) ; 
41         AliQAManager & operator = (const AliQAManager & qas) ; 
42
43 public:
44         virtual ~AliQAManager() ; 
45         void        EndOfCycle(TObjArray * detArray=0x0) ; 
46   void        EndOfCycle(TString detectors) ; 
47         UInt_t      GetCurrentEvent() const { return fCurrentEvent ; }
48         TObjArray * GetFromOCDB(AliQA::DETECTORINDEX_t det, AliQA::TASKINDEX_t task, const char * year) const ; 
49   AliQA     * GetQA(UInt_t run, UInt_t evt) ; 
50         AliQADataMaker * GetQADataMaker(const Int_t iDet) ; 
51         void        Increment() ;
52         void        InitQADataMaker(UInt_t run, TObjArray * detArray=0x0) ;
53         Bool_t      Merge(const Int_t runNumber = -1 ) const ;  
54   Bool_t      MergeXML(const char * collection, const char * subFile = 0, const char * outFile = 0) ; 
55   static      AliQAManager * QAManager(const Char_t * mode="", TMap *entryCache = NULL, Int_t run = -1) ;
56         void        Reset(const Bool_t sameCycle = kFALSE) ;  
57         TString     Run(const char * detectors, const AliQA::TASKINDEX_t taskIndex=AliQA::kNULLTASKINDEX, Bool_t const sameCycle = kFALSE, const char * fileName = NULL) ; 
58         TString     Run(const char * detectors, AliRawReader * rawReader, Bool_t const sameCycle = kFALSE) ; 
59         TString     Run(const char * detectors, const char * filename, Bool_t const sameCycle = kFALSE) ;
60         void        RunOneEvent(AliRawReader * rawReader) ; 
61         void        RunOneEventInOneDetector(Int_t det, TTree * tree) ; 
62         void        RunOneEvent(AliESDEvent *& esd)  ;
63         Bool_t      Save2OCDB(const Int_t runNumber, AliRecoParam::EventSpecie_t es, const char * year = "08", const char * detectors = "ALL") const ; 
64         void        SetActiveDetectors(TString aDet) { fDetectors = aDet ;  }
65         void        SetCycleLength(const AliQA::DETECTORINDEX_t det, const Int_t cycle) { fQACycles[det] = cycle ; }
66         void        SetWriteExpert(const AliQA::DETECTORINDEX_t det) { fQAWriteExpert[det] = kTRUE ; }
67         void        SetEventRange(UInt_t first, UInt_t last) { fFirstEvent = first ; fMaxEvents = last - first + 1 ; }    
68   void        SetEventSpecie(AliRecoParam::EventSpecie_t es) ; 
69         void        SetFirsEvent(UInt_t first) { fFirstEvent = first ; }      
70         void        SetMaxEvents(UInt_t max) { fMaxEvents = max ; }      
71         void        SetNewCycle() { fCycleSame = kTRUE ; }
72         void        SetRecoParam(const Int_t det, const AliDetectorRecoParam *par) ;
73         void        SetRunLoader(AliRunLoader * rl) { fRunLoader = rl ; }
74         void        SetTasks(TString tasks) { fTasks = tasks ; }
75
76 private: 
77         Bool_t                    DoIt(const AliQA::TASKINDEX_t taskIndex) ;
78         AliLoader   * GetLoader(Int_t iDet) ; 
79         Int_t         GetQACycles(const Int_t iDet) const { return fQACycles[iDet] ; }
80         Bool_t                    InitQA(const AliQA::TASKINDEX_t taskIndex, const  char * fileName = NULL) ;
81         Bool_t        InitRunLoader() ; 
82         Bool_t        IsSelected(const char * detName)  ;
83         Bool_t        Finish(const AliQA::TASKINDEX_t taskIndex) ;
84         Bool_t        MergeData(const Int_t runNumber) const ;  
85         Bool_t        MergeResults(const Int_t runNumber) const ;  
86         Bool_t        SaveIt2OCDB(const Int_t runNumber, TFile * inputFile, const char * year, AliRecoParam::EventSpecie_t es) const ;  
87
88         static AliQAManager* fgQAInstance; // AliQAManager instance
89         UInt_t                  fCurrentEvent ;                 //! event counter
90         Bool_t                  fCycleSame ;                    //! true if 2 consecutive data making for a same detector   
91         TString                 fDetectors ;                    //! list of active detectors 
92         TString                 fDetectorsW ;                   //! list of active detectors with QA implemented 
93         AliESDEvent *           fESD ;                          //! current ESD
94         TTree *                 fESDTree ;                      //! current ESD Tree
95         TString                 fGAliceFileName ;               //! name of the galice file
96         UInt_t                  fFirstEvent ;                   //! first event to process
97         Long64_t                fMaxEvents ;                    //! number of events to process
98         const Char_t *          fMode ;                         //! sim or rec
99         Long64_t                fNumberOfEvents ;               //! number of events in the run 
100   AliRecoParam            fRecoParam;                     //! container for the reco-param objects for detectors
101         UInt_t                  fRunNumber ;                    //! current run number
102         AliRawReader *          fRawReader ;                    //! current raw reader object 
103         Bool_t                  fRawReaderDelete ;              //! tells if the rawReader has been created by this
104         AliRunLoader *          fRunLoader ;                    //! current run loader object
105         TString                 fTasks ;                        //! list of QA tasks to be performed
106         static const UInt_t     fgkNDetectors = AliQA::kNDET ;  //! number of detectors    
107         AliLoader      *        fLoader[fgkNDetectors];         //! array of detectors loader
108         AliQADataMaker *        fQADataMaker[fgkNDetectors];    //! array of QA data maker objects
109         Int_t                   fQACycles[fgkNDetectors];       //! array of QA cycle length
110         Bool_t                  fQAWriteExpert[fgkNDetectors];  //! array of QA cycle length
111         AliRecoParam::EventSpecie_t fEventSpecie ;              //! event specie, see AliRecoParam::EventSpecie_t 
112   ClassDef(AliQAManager, 0)      // class for running the QA makers
113 };
114
115 #endif