#include "AliMUONVTriggerStore.h"
#include "AliMpCDB.h"
-#include "AliMpIntPair.h"
+#include "AliMpEncodePair.h"
#include "AliMpDEManager.h"
#include "AliMpConstants.h"
#include "AliMpCDB.h"
#include "AliLoader.h"
-#include "AliLog.h"
#include "AliRunLoader.h"
+#include "AliHeader.h"
+#include "AliCDBManager.h"
+#include "AliLog.h"
-#include <TError.h>
-#include <TParticle.h>
#include <Riostream.h>
#include <TFile.h>
#include <TList.h>
fTriggerStore(0x0),
fClusterStore(0x0),
fCurrentEvent(-1),
+fTreeLetter(""),
fIsValid(kFALSE),
fCurrentIteratorType(kNoIterator),
fCurrentIndex(-1),
++fgInstanceCounter;
+ if ( AliCDBManager::Instance() != NULL &&
+ AliCDBManager::Instance()->GetDefaultStorage() == NULL ) {
+ AliFatal("CDB default storage not defined.");
+ }
+
Open(filename);
// Load mapping
{
/// dtor
ResetStores();
- if ( fLoader != 0x0 )
- {
- delete fLoader->GetRunLoader();
- }
--fgInstanceCounter;
}
/// Return digitStore for a given event.
/// Return 0x0 if event not found.
/// Returned pointer should not be deleted
+ ///
+ /// \note If a previous store has been retrieved by one of the methods of
+ /// this class, but for a different event number, then those stores will
+ /// be deleted and no longer valid.
+ /// If you require access to the data for the earlier retrieved store,
+ /// but for different events, then you should deep copy / clone the object.
if (not IsValid()) return 0x0;
- if (event == fCurrentEvent and fDigitStore != 0x0) return fDigitStore;
- ResetStores();
- if (not LoadEvent(event)) return 0x0;
+ if (event == fCurrentEvent)
+ {
+ if (fDigitStore != 0x0)
+ return fDigitStore;
+ }
+ else
+ {
+ ResetStores();
+ if ( not LoadEvent(event) ) return 0x0;
+ }
fLoader->LoadDigits();
/// Return clusterStore for a given event.
/// Return 0x0 if event not found.
/// Returned pointer should not be deleted
+ ///
+ /// \note If a previous store has been retrieved by one of the methods of
+ /// this class, but for a different event number, then those stores will
+ /// be deleted and no longer valid.
+ /// If you require access to the data for the earlier retrieved store,
+ /// but for different events, then you should deep copy / clone the object.
if (not IsValid()) return 0x0;
- if (event == fCurrentEvent and fClusterStore != 0x0) return fClusterStore;
- ResetStores();
- if (not LoadEvent(event)) return 0x0;
+ if (event == fCurrentEvent)
+ {
+ if (fClusterStore != 0x0)
+ return fClusterStore;
+ }
+ else
+ {
+ ResetStores();
+ if ( not LoadEvent(event) ) return 0x0;
+ }
fLoader->LoadRecPoints();
/// Return 0x0 if event not found.
/// Returned pointer should not be deleted
/// treeLetter can be R or D to tell from which tree to read the information
+ ///
+ /// \note If a previous store has been retrieved by one of the methods of
+ /// this class, but for a different event number, then those stores will
+ /// be deleted and no longer valid.
+ /// If you require access to the data for the earlier retrieved store,
+ /// but for different events, then you should deep copy / clone the object.
if (not IsValid()) return 0x0;
- if (event == fCurrentEvent and fTriggerStore != 0x0) return fTriggerStore;
- ResetStores();
- if (not LoadEvent(event)) return 0x0;
+ if (event == fCurrentEvent)
+ {
+ if (fTreeLetter == treeLetter)
+ {
+ if (fTriggerStore != 0x0)
+ return fTriggerStore;
+ }
+ else
+ {
+ // Reset only the fTriggerStore since the others might still be valid
+ // for the same event.
+ if (fTriggerStore != 0x0)
+ {
+ delete fTriggerStore;
+ fTriggerStore = 0x0;
+ }
+ }
+ }
+ else
+ {
+ // Event has changed so reset all the stores.
+ ResetStores();
+ if ( not LoadEvent(event) ) return 0x0;
+ }
TTree* tree(0x0);
{
fLoader->UnloadRecPoints();
}
+ fTreeLetter = stree;
return fTriggerStore;
}
AliMUONLocalTrigger* locTrg(0x0);
while ( ( locTrg = static_cast<AliMUONLocalTrigger*>(next()) ) )
{
- Bool_t xTrig=kFALSE;
- Bool_t yTrig=kFALSE;
-
- if ( locTrg->LoSdev()==1 && locTrg->LoDev()==0 &&
- locTrg->LoStripX()==0) xTrig=kFALSE; // no trigger in X
- else xTrig=kTRUE; // trigger in X
- if (locTrg->LoTrigY()==1 &&
- locTrg->LoStripY()==15 ) yTrig = kFALSE; // no trigger in Y
- else yTrig = kTRUE; // trigger in Y
+ Bool_t xTrig=locTrg->IsTrigX();
+ Bool_t yTrig=locTrg->IsTrigY();
if (xTrig && yTrig)
{ // fill ntuple if trigger in X and Y
{
AliError(Form("Cannot open file %s",filename));
fIsValid = kFALSE;
+ return;
}
+
+ runLoader->LoadHeader();
+ if ( ! runLoader->GetHeader() ) {
+ AliError("Cannot load header.");
+ fIsValid = kFALSE;
+ }
+ else {
+ Int_t runNumber = runLoader->GetHeader()->GetRun();
+ AliCDBManager::Instance()->SetRun(runNumber>=0 ? runNumber : 1);
+ }
+ runLoader->UnloadHeader();
+
fLoader = runLoader->GetDetectorLoader("MUON");
if (fLoader == 0x0)
{
AliMUONVDigitStore* store = DigitStore(fCurrentEvent);
if (store == 0x0) return 0x0;
- AliMpIntPair pair = AliMpDEManager::GetDetElemIdRange(chamber);
- fIterator = store->CreateIterator(pair.GetFirst(), pair.GetSecond(), cathode);
+ MpPair_t pair = AliMpDEManager::GetDetElemIdRange(chamber);
+ fIterator = store->CreateIterator(AliMp::PairFirst(pair), AliMp::PairSecond(pair), cathode);
if (fIterator == 0x0) return 0x0;
fCurrentIteratorType = kDigitIteratorByChamberAndCathode;
fDataX = chamber;