// CORRFW includes
#include "AliCFGridSparse.h"
-// PWG3 includes
+// PWG includes
#include "AliMergeableCollection.h"
#include "AliMuonEventCuts.h"
#include "AliMuonTrackCuts.h"
#include "AliMuonPairCuts.h"
#include "AliAnalysisMuonUtility.h"
+#include "AliUtilityMuonAncestor.h"
/// \cond CLASSIMP
ClassImp(AliVAnalysisMuon) // Class implementation in ROOT context
fChargeKeys(0x0),
fSrcKeys(0x0),
fPhysSelKeys(0x0),
+ fWeights(0x0),
+ fUtilityMuonAncestor(0x0),
fEventCounters(0x0),
fMergeableCollection(0x0),
fOutputList(0x0),
fChargeKeys(0x0),
fSrcKeys(0x0),
fPhysSelKeys(0x0),
+ fWeights(new THashList()),
+ fUtilityMuonAncestor(0x0),
fEventCounters(0x0),
fMergeableCollection(0x0),
fOutputList(0x0),
InitKeys();
SetTrigClassPatterns("");
SetCentralityClasses();
+ fWeights->SetOwner();
DefineOutput(1, TObjArray::Class());
}
fChargeKeys(0x0),
fSrcKeys(0x0),
fPhysSelKeys(0x0),
+ fWeights(new THashList()),
+ fUtilityMuonAncestor(0x0),
fEventCounters(0x0),
fMergeableCollection(0x0),
fOutputList(0x0),
InitKeys();
SetTrigClassPatterns("");
SetCentralityClasses();
+ fWeights->SetOwner();
DefineOutput(1, TObjArray::Class());
}
fChargeKeys(0x0),
fSrcKeys(0x0),
fPhysSelKeys(0x0),
+ fWeights(new THashList()),
+ fUtilityMuonAncestor(0x0),
fEventCounters(0x0),
fMergeableCollection(0x0),
fOutputList(0x0),
InitKeys();
SetTrigClassPatterns("");
SetCentralityClasses();
+ fWeights->SetOwner();
DefineOutput(1, TObjArray::Class());
}
delete fChargeKeys;
delete fSrcKeys;
delete fPhysSelKeys;
+ delete fWeights;
+ delete fUtilityMuonAncestor;
delete fOutputPrototypeList;
fMergeableCollection->PruneEmptyObjects();
-
- TString objectName = "";
// Add stat. info from physics selection
// (usefull when running on AODs)
TString statType = ( istat == 0 ) ? "ALL" : "BIN0";
TH2* hStat = dynamic_cast<TH2*>(fInputHandler->GetStatistics(statType.Data()));
if ( hStat ) {
- objectName = Form("%s_%s", hStat->GetName(), GetName());
+ TString objectName = Form("%s_%s", hStat->GetName(), GetName());
TH2* cloneStat = static_cast<TH2*>(hStat->Clone(objectName.Data()));
cloneStat->SetDirectory(0);
fOutputList->Add(cloneStat);
fEventCounters->AddRubric("selected", "yes/no");
fEventCounters->AddRubric("trigger", 100);
fEventCounters->AddRubric("centrality", centralityClasses);
+ fEventCounters->AddRubric("run", 10000);
fEventCounters->Init();
fOutputList->Add(fEventCounters);
fMuonEventCuts->Print();
MyUserCreateOutputObjects();
+
+ fUtilityMuonAncestor = new AliUtilityMuonAncestor();
}
//
// Global event info
//
- TObjArray* selectTrigClasses = fMuonEventCuts->GetSelectedTrigClassesInEvent(InputEvent());
+ const TObjArray* selectTrigClasses = fMuonEventCuts->GetSelectedTrigClassesInEvent(InputEvent());
Double_t centrality = fMuonEventCuts->GetCentrality(InputEvent());
Int_t centralityBin = GetCentralityClasses()->FindBin(centrality);
TString selKey = ( physSel == kPhysSelPass ) ? "yes" : "no";
for ( Int_t itrig=0; itrig<selectTrigClasses->GetEntries(); ++itrig ) {
TString trigName = selectTrigClasses->At(itrig)->GetName();
- fEventCounters->Count(Form("trigger:%s/selected:%s/centrality:%s", trigName.Data(), selKey.Data(), centralityBinLabel.Data()));
+ fEventCounters->Count(Form("trigger:%s/selected:%s/centrality:%s/run:%i", trigName.Data(), selKey.Data(), centralityBinLabel.Data(),fCurrentRunNumber));
}
ProcessEvent(fPhysSelKeys->At(physSel)->GetName(), *selectTrigClasses, centralityBinLabel);
if ( ! fTerminateOptions ) SetTerminateOptions();
- if ( gROOT->IsBatch() ) return;
+ TString furtherOpt = ((TObjString*)fTerminateOptions->At(3))->GetString();
+ furtherOpt.ToUpper();
+ if ( gROOT->IsBatch() && ! furtherOpt.Contains("FORCEBATCH") ) return;
fOutputList = dynamic_cast<TObjArray*>(GetOutputData(1));
if ( ! fOutputList ) return;
//________________________________________________________________________
-Int_t AliVAnalysisMuon::GetParticleType(AliVParticle* track)
+Int_t AliVAnalysisMuon::GetParticleType ( AliVParticle* track )
{
//
/// Get particle type from mathced MC track
//
- Int_t trackSrc = kUnidentified;
- Int_t trackLabel = track->GetLabel();
- if ( trackLabel >= 0 ) {
- AliVParticle* matchedMCTrack = AliAnalysisMuonUtility::GetMCTrack(trackLabel,InputEvent(),MCEvent());
- if ( matchedMCTrack ) trackSrc = RecoTrackMother(matchedMCTrack);
- } // track has MC label
- return trackSrc;
-}
-
-
-//________________________________________________________________________
-Int_t AliVAnalysisMuon::RecoTrackMother(AliVParticle* mcParticle)
-{
- //
- /// Find track mother from kinematics
- //
-
- Int_t recoPdg = mcParticle->PdgCode();
-
- // Track is not a muon
- if ( TMath::Abs(recoPdg) != 13 ) return kRecoHadron;
-
- Int_t imother = AliAnalysisMuonUtility::GetMotherIndex(mcParticle);
-
- Int_t den[3] = {100, 1000, 1};
-
- Int_t motherType = kDecayMu;
- while ( imother >= 0 ) {
- AliVParticle* part = AliAnalysisMuonUtility::GetMCTrack(imother,InputEvent(),MCEvent());
- //if ( ! part ) return motherType;
-
- Int_t absPdg = TMath::Abs(part->PdgCode());
-
- Bool_t isPrimary = AliAnalysisMuonUtility::IsPrimary(part, MCEvent());
-
- if ( isPrimary ) {
- if ( absPdg == 24 ) return kWbosonMu;
-
- for ( Int_t idec=0; idec<3; idec++ ) {
- Int_t flv = (absPdg%100000)/den[idec];
- if ( flv > 0 && flv < 4 ) return kDecayMu;
- else if ( flv == 0 || flv > 5 ) continue;
- else {
- if ( den[idec] == 100 ) motherType = kQuarkoniumMu;
- else if ( flv == 4 ) motherType = kCharmMu;
- else motherType = kBeautyMu;
- break; // break loop on pdg code
- // but continue the global loop to find higher mass HF
- }
- } // loop on pdg code
- if ( absPdg < 10 ) break; // particle loop
- } // is primary
- else {
- if ( part->Zv() < -90. ) {
- // If hadronic process => secondary
- //if ( part->GetUniqueID() == kPHadronic ) {
- return kSecondaryMu;
- //}
- }
- } // is secondary
-
- imother = AliAnalysisMuonUtility::GetMotherIndex(part);
-
- } // loop on mothers
-
- return motherType;
+ if ( fUtilityMuonAncestor->IsUnidentified(track,MCEvent()) ) return kUnidentified;
+ if ( fUtilityMuonAncestor->IsBeautyMu(track,MCEvent()) ) return kBeautyMu;
+ if ( fUtilityMuonAncestor->IsCharmMu(track,MCEvent()) ) return kCharmMu;
+ if ( fUtilityMuonAncestor->IsWBosonMu(track,MCEvent()) ) return kWbosonMu;
+ if ( fUtilityMuonAncestor->IsZBosonMu(track,MCEvent()) ) return kZbosonMu;
+ if ( fUtilityMuonAncestor->IsDecayMu(track,MCEvent()) ) return kDecayMu;
+ if ( fUtilityMuonAncestor->IsQuarkoniumMu(track,MCEvent()) ) return kQuarkoniumMu;
+ if ( fUtilityMuonAncestor->IsHadron(track,MCEvent()) ) return kRecoHadron;
+ if ( fUtilityMuonAncestor->IsSecondaryMu(track,MCEvent()) ) return kSecondaryMu;
+ return kDecayMu;
}
/// Check the bin limits.
//
- option.ToUpper();
- Int_t minVarBin = -1, maxVarBin = -1;
- TAxis* axis = gridSparse->GetAxis(ivar);
-
- if ( ! axis ) {
- printf("Warning: Axis %i not found in %s", ivar, gridSparse->GetName());
- return kFALSE;
- }
-
- if ( ! labelName.IsNull() ) {
- minVarBin = axis->FindBin(labelName.Data());
- maxVarBin = minVarBin;
- if ( minVarBin < 1 ) {
- printf("Warning: %s: label %s not found. Nothing done", gridSparse->GetName(), labelName.Data());
- return kFALSE;
- }
- }
- else if ( option.Contains( "USEBIN" ) ) {
- minVarBin = (Int_t)varMin;
- maxVarBin = (Int_t)varMax;
- }
- else {
- minVarBin = axis->FindBin(varMin);
- maxVarBin = axis->FindBin(varMax);
- }
-
- if ( axis->GetFirst() == minVarBin && axis->GetLast() == maxVarBin ) return kFALSE;
+ // Keep for backward compatibility
- gridSparse->SetRangeUser(ivar, axis->GetBinCenter(minVarBin), axis->GetBinCenter(maxVarBin));
-
- return kTRUE;
+ return AliAnalysisMuonUtility::SetSparseRange(gridSparse,ivar,labelName,varMin, varMax,option);
}
//________________________________________________________________________
TString currPattern = pattern;
if ( currPattern.IsNull() ) {
currPattern = GetDefaultTrigClassPatterns();
- currPattern.Append(" !CMUP"); // by default do not account for UltraPeripheral events
- }
+ currPattern.Append(",!CMUP*"); // by default do not account for UltraPeripheral events
+ }
fMuonEventCuts->SetTrigClassPatterns(currPattern);
}
//________________________________________________________________________
void AliVAnalysisMuon::InitKeys()
{
+ //
+ /// Init keys
+ //
TString chargeKeys = "MuMinus MuPlus";
fChargeKeys = chargeKeys.Tokenize(" ");
- TString srcKeys = "CharmMu BeautyMu QuarkoniumMu WbosonMu DecayMu SecondaryMu Hadron Unidentified";
+ TString srcKeys = "CharmMu BeautyMu QuarkoniumMu WbosonMu ZbosonMu DecayMu SecondaryMu Hadron Unidentified";
fSrcKeys = srcKeys.Tokenize(" ");
TString physSelKeys = "PhysSelPass PhysSelReject";
fPhysSelKeys = physSelKeys.Tokenize(" ");
}
+
+
+//________________________________________________________________________
+void AliVAnalysisMuon::SetWeight ( TObject* wgtObj )
+{
+ /// Set weight
+ if ( fWeights->FindObject(wgtObj->GetName()) ) {
+ AliWarning(Form("Weight object %s is already in the list",wgtObj->GetName()));
+ return;
+ }
+ fWeights->Add(wgtObj);
+}
+
+//________________________________________________________________________
+TObject* AliVAnalysisMuon::GetWeight ( const Char_t* wgtName )
+{
+ /// Get weight
+ return fWeights->FindObject(wgtName);
+}
+
+