]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
added max events to process
authorschutz <schutz@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 10 Mar 2008 17:38:06 +0000 (17:38 +0000)
committerschutz <schutz@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 10 Mar 2008 17:38:06 +0000 (17:38 +0000)
STEER/AliQADataMakerSteer.cxx
STEER/AliQADataMakerSteer.h
test/cosmic/rawqa.C

index 3bad46eab7737c8d775c1a8fe0d07f8674823352..6b9b3053c83ca3c23024ab69122192d3e47c65db 100644 (file)
@@ -67,13 +67,15 @@ AliQADataMakerSteer::AliQADataMakerSteer(const char* gAliceFilename, const char
        fESDTree(NULL),
        fFirst(kTRUE),  
        fGAliceFileName(gAliceFilename), 
-       fRunNumber(0), 
+    fMaxEvents(0),        
        fNumberOfEvents(999999), 
+    fRunNumber(0), 
        fRawReader(NULL), 
        fRawReaderDelete(kTRUE), 
        fRunLoader(NULL)  
 {
        // default ctor
+       fMaxEvents = fNumberOfEvents ; 
        for (UInt_t iDet = 0; iDet < fgkNDetectors; iDet++) {
                if (IsSelected(AliQA::GetDetName(iDet))) {
                        fLoader[iDet]      = NULL ;
@@ -94,8 +96,9 @@ AliQADataMakerSteer::AliQADataMakerSteer(const AliQADataMakerSteer & qas) :
        fESDTree(NULL), 
        fFirst(qas.fFirst),  
        fGAliceFileName(qas.fGAliceFileName), 
-       fRunNumber(qas.fRunNumber), 
+    fMaxEvents(qas.fMaxEvents),        
        fNumberOfEvents(qas.fNumberOfEvents), 
+    fRunNumber(qas.fRunNumber), 
        fRawReader(NULL), 
        fRawReaderDelete(kTRUE), 
        fRunLoader(NULL)  
@@ -146,7 +149,7 @@ Bool_t AliQADataMakerSteer::DoIt(const AliQA::TASKINDEX taskIndex, const char *
 
        Bool_t rv = kFALSE ;
     // Fill QA data in event loop 
-       for (UInt_t iEvent = 0 ; iEvent < fNumberOfEvents ; iEvent++) {
+       for (UInt_t iEvent = 0 ; iEvent < (UInt_t)fMaxEvents ; iEvent++) {
                fCurrentEvent++ ; 
                // Get the event
                if ( iEvent%10 == 0  ) 
@@ -387,7 +390,9 @@ Bool_t AliQADataMakerSteer::Init(const AliQA::TASKINDEX taskIndex, const char *
                AliCDBManager::Instance()->SetRun(fRunNumber) ; 
                fRawReader->RewindEvents();
                fNumberOfEvents = 999999 ;
-       } else if (taskIndex == AliQA::kESDS) {
+               if ( fMaxEvents < 0 ) 
+                       fMaxEvents = fNumberOfEvents ; 
+               } else if (taskIndex == AliQA::kESDS) {
                if (!gSystem->AccessPathName("AliESDs.root")) { // AliESDs.root exists
                        TFile * esdFile = TFile::Open("AliESDs.root") ;
                        fESDTree = dynamic_cast<TTree *> (esdFile->Get("esdTree")) ; 
@@ -400,6 +405,8 @@ Bool_t AliQADataMakerSteer::Init(const AliQA::TASKINDEX taskIndex, const char *
                                fESDTree->GetEntry(0) ; 
                                fRunNumber = fESD->GetRunNumber() ; 
                                fNumberOfEvents = fESDTree->GetEntries() ;
+                               if ( fMaxEvents < 0 ) 
+                                       fMaxEvents = fNumberOfEvents ; 
                        }
                } else {
                        AliError("AliESDs.root not found") ; 
@@ -410,6 +417,9 @@ Bool_t AliQADataMakerSteer::Init(const AliQA::TASKINDEX taskIndex, const char *
                        AliWarning("No Run Loader not found") ; 
                } else {
                        fNumberOfEvents = fRunLoader->GetNumberOfEvents() ;
+                       if ( fMaxEvents < 0 ) 
+                               fMaxEvents = fNumberOfEvents ; 
+
                }
        }
                // Initialize all QA data makers for all detectors
index 9d116c73b279cdfb359d33e38bc9c76e71d0d1d5..387a5d5419ee315c78010b01a7eaef4fb9aa83bd 100644 (file)
@@ -36,7 +36,7 @@ public:
        AliQADataMakerSteer(const AliQADataMakerSteer & qas) ; 
        AliQADataMakerSteer & operator = (const AliQADataMakerSteer & qas) ; 
        virtual ~AliQADataMakerSteer() ; 
-       UInt_t   GetCurrentEvent() { return fCurrentEvent ; }
+       UInt_t   GetCurrentEvent() const { return fCurrentEvent ; }
     TObjArray * GetFromOCDB(AliQA::DETECTORINDEX det, AliQA::TASKINDEX task) const ; 
        Bool_t  Merge(const Int_t runNumber = -1) const ;  
     void    Reset(const Bool_t sameCycle = kFALSE) ;  
@@ -45,6 +45,7 @@ public:
        TString Run(const char * detectors, const char * filename) ;
     Bool_t  Save2OCDB(const Int_t runNumber, const Int_t cycleNumber, const char * detectors = "ALL") const ; 
        void    SetCycleLength(const AliQA::DETECTORINDEX det, const Int_t cycle) { fQACycles[det] = cycle ; }
+       void    SetMaxEvents(UInt_t max) { fMaxEvents = max ; }      
        void    SetNewCycle() { fCycleSame = kTRUE ; }
     void    SetRunLoader(AliRunLoader * rl) { fRunLoader = rl ; }
 
@@ -68,8 +69,9 @@ private:
        TTree *            fESDTree ;                      //! current ESD Tree
        Bool_t             fFirst ;                        //! to search the detector QA data maker only once
        TString            fGAliceFileName ;               //! name of the galice file
-       UInt_t             fRunNumber ;                    //! current run number
+       Int_t              fMaxEvents ;                    //! number of events to process
        Long64_t           fNumberOfEvents ;               //! number of events in the run 
+       UInt_t             fRunNumber ;                    //! current run number
        AliRawReader     * fRawReader ;                    //! current raw reader object 
        Bool_t             fRawReaderDelete ;              //! tells if the rawReader has been created by this
        AliRunLoader *     fRunLoader ;                    //! current run loader object
index 0d423ce40b7f6f09f6a2d827fd518c2bb85caba4..6e35cd057f5a3299bd4f5362a7069f5d26589460 100644 (file)
@@ -27,8 +27,8 @@ void rawqa(const Int_t runNumber, Int_t maxFiles = 10, const char* year = "08")
        
        UInt_t maxEvents = 99999 ;
        if ( maxFiles < 0 ) {
-               maxFiles = 99 ; 
                maxEvents = TMath::Abs(maxFiles) ; 
+               maxFiles = 99 ; 
        }
        AliLog::SetGlobalDebugLevel(0) ; 
        // connect to the grid 
@@ -101,6 +101,7 @@ void rawqa(const Int_t runNumber, Int_t maxFiles = 10, const char* year = "08")
                AliRawReader * rawReader = new AliRawReaderRoot(input);
                while ( rawReader->NextEvent() ) {
                        man->SetRun(rawReader->GetRunNumber());
+                       AliLog::Flush();
                        UChar_t * data ; 
                        while (rawReader->ReadNextData(data)) {
                                Int_t detID = rawReader->GetDetectorID();
@@ -121,18 +122,21 @@ void rawqa(const Int_t runNumber, Int_t maxFiles = 10, const char* year = "08")
                        if ( !detectors.IsNull() )
                                break ; 
                }
-               delete rawReader;
+               AliInfo(Form("Current = %d Max = %d", qas.GetCurrentEvent(), maxEvents)) ; 
+               AliLog::Flush();
                if ( qas.GetCurrentEvent() > maxEvents) 
                        break ;
                // TEMPORARY REMOVAL OF TRD!!!
                detectors.ReplaceAll("TRD", "") ;
                // TEMPORARY REMOVAL OF TRD!!!
                if ( !detectors.IsNull() ) {
-                 detectorsW = qas.Run(detectors, rawReader) ;
-                 qas.Reset() ;
+                       qas.SetMaxEvents(maxEvents) ;   
+                       detectorsW = qas.Run(detectors, rawReader) ;
+                       qas.Reset() ;
                } else {
-                 AliError("No valid detectors found") ; 
+                       AliError("No valid detectors found") ; 
                } 
+               delete rawReader ;
        }
        AliLog::Flush();
        qas.Merge(runNumber) ;