]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STEER/AliQAManager.h
add protection in case no recoparam
[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(AliQAv1::kRAWS, rawROOTFileName);                                 //
14 //   qas.Run(AliQAv1::kHITS);                                                  //
15 //   qas.Run(AliQAv1::kSDIGITS);                                               //
16 //   qas.Run(AliQAv1::kDIGITS);                                                //
17 //   qas.Run(AliQAv1::kRECPOINTS);                                             //
18 //   qas.Run(AliQAv1::kESDS);                                                  //
19 //                                                                           //
20 ///////////////////////////////////////////////////////////////////////////////
21
22 #include <TNamed.h>
23 #include "AliQAv1.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(AliQAv1::DETECTORINDEX_t det, AliQAv1::TASKINDEX_t task, const char * year) const ; 
49   AliQAv1     * 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(Int_t runNumber = -1) const ;  
54   void        MergeCustom() const ;
55   Bool_t      MergeXML(const char * collection, const char * subFile = 0, const char * outFile = 0) ; 
56   static      AliQAManager * QAManager(const Char_t * mode="", TMap *entryCache = NULL, Int_t run = -1) ;
57         void        Reset(const Bool_t sameCycle = kFALSE) ;  
58         TString     Run(const char * detectors, const AliQAv1::TASKINDEX_t taskIndex=AliQAv1::kNULLTASKINDEX, Bool_t const sameCycle = kFALSE, const char * fileName = NULL) ; 
59         TString     Run(const char * detectors, AliRawReader * rawReader, Bool_t const sameCycle = kFALSE) ; 
60         TString     Run(const char * detectors, const char * filename, Bool_t const sameCycle = kFALSE) ;
61         void        RunOneEvent(AliRawReader * rawReader) ; 
62         void        RunOneEventInOneDetector(Int_t det, TTree * tree) ; 
63         void        RunOneEvent(AliESDEvent *& esd)  ;
64         Bool_t      Save2OCDB(const Int_t runNumber, AliRecoParam::EventSpecie_t es, const char * year = "08", const char * detectors = "ALL") const ; 
65         void        SetActiveDetectors(TString aDet) { fDetectors = aDet ;  }
66         void        SetCycleLength(const AliQAv1::DETECTORINDEX_t det, const Int_t cycle) { fQACycles[det] = cycle ; }
67         void        SetWriteExpert(const AliQAv1::DETECTORINDEX_t det) { fQAWriteExpert[det] = kTRUE ; }
68         void        SetEventRange(UInt_t first, UInt_t last) { fFirstEvent = first ; fMaxEvents = last - first + 1 ; }    
69   void        SetEventSpecie(AliRecoParam::EventSpecie_t es) ; 
70         void        SetFirsEvent(UInt_t first) { fFirstEvent = first ; }      
71         void        SetMaxEvents(UInt_t max) { fMaxEvents = max ; }      
72         void        SetNewCycle() { fCycleSame = kTRUE ; }
73         void        SetRecoParam(const Int_t det, const AliDetectorRecoParam *par) ;
74         void        SetRunLoader(AliRunLoader * rl) { fRunLoader = rl ; }
75         void        SetTasks(TString tasks) { fTasks = tasks ; }
76   void        SetWriteExpert() ; 
77 private: 
78         Bool_t                    DoIt(const AliQAv1::TASKINDEX_t taskIndex) ;
79         AliLoader   * GetLoader(Int_t iDet) ; 
80         Int_t         GetQACycles(const Int_t iDet) const { return fQACycles[iDet] ; }
81         Bool_t                    InitQA(const AliQAv1::TASKINDEX_t taskIndex, const  char * fileName = NULL) ;
82         Bool_t        InitRunLoader() ; 
83         Bool_t        IsSelected(const char * detName)  ;
84         Bool_t        Finish(const AliQAv1::TASKINDEX_t taskIndex) ;
85         Bool_t        MergeData(const Int_t runNumber) const ;  
86         Bool_t        MergeResults(const Int_t runNumber) const ;  
87         Bool_t        SaveIt2OCDB(const Int_t runNumber, TFile * inputFile, const char * year, AliRecoParam::EventSpecie_t es) const ;  
88
89         static AliQAManager* fgQAInstance; // AliQAManager instance
90         UInt_t                  fCurrentEvent ;                 //! event counter
91         Bool_t                  fCycleSame ;                    //! true if 2 consecutive data making for a same detector   
92         TString                 fDetectors ;                    //! list of active detectors 
93         TString                 fDetectorsW ;                   //! list of active detectors with QA implemented 
94         AliESDEvent *           fESD ;                          //! current ESD
95         TTree *                 fESDTree ;                      //! current ESD Tree
96         TString                 fGAliceFileName ;               //! name of the galice file
97         UInt_t                  fFirstEvent ;                   //! first event to process
98         Long64_t                fMaxEvents ;                    //! number of events to process
99         const Char_t *          fMode ;                         //! sim or rec
100         Long64_t                fNumberOfEvents ;               //! number of events in the run 
101   AliRecoParam            fRecoParam;                     //! container for the reco-param objects for detectors
102         UInt_t                  fRunNumber ;                    //! current run number
103         AliRawReader *          fRawReader ;                    //! current raw reader object 
104         Bool_t                  fRawReaderDelete ;              //! tells if the rawReader has been created by this
105         AliRunLoader *          fRunLoader ;                    //! current run loader object
106         TString                 fTasks ;                        //! list of QA tasks to be performed
107         static const UInt_t     fgkNDetectors = AliQAv1::kNDET ;  //! number of detectors    
108         AliLoader      *        fLoader[fgkNDetectors];         //! array of detectors loader
109         AliQADataMaker *        fQADataMaker[fgkNDetectors];    //! array of QA data maker objects
110         Int_t                   fQACycles[fgkNDetectors];       //! array of QA cycle length
111         Bool_t                  fQAWriteExpert[fgkNDetectors];  //! array of QA cycle length
112   AliRecoParam::EventSpecie_t fEventSpecie ;              //! type of event 
113     
114   ClassDef(AliQAManager, 0)      // class for running the QA makers
115 };
116
117 #endif