#include <TH2D.h>
#include <TF1.h>
#include <TMath.h>
+#include "AliESDEvent.h"
+#include "AliESDVertex.h"
//====================================================================
ClassImp(AliFMDAnaParameters)
//const char* AliFMDAnaParameters::fgkEnergyDists = "FMD/Correction/EnergyDistribution";
const char* AliFMDAnaParameters::fgkBackgroundID = "background";
const char* AliFMDAnaParameters::fgkEnergyDistributionID = "energydistributions";
+const char* AliFMDAnaParameters::fgkEventSelectionEffID = "eventselectionefficiency";
//____________________________________________________________________
AliFMDAnaParameters* AliFMDAnaParameters::fgInstance = 0;
fIsInit(kFALSE),
fBackground(0),
fEnergyDistribution(0),
+ fEventSelectionEfficiency(0),
fCorner1(4.2231, 26.6638),
fCorner2(1.8357, 27.9500),
fEnergyPath("$ALICE_ROOT/FMD/Correction/EnergyDistribution/energydistributions.root"),
- fBackgroundPath("$ALICE_ROOT/FMD/Correction/Background/background.root")
+ fBackgroundPath("$ALICE_ROOT/FMD/Correction/Background/background.root"),
+ fEventSelectionEffPath("$ALICE_ROOT/FMD/Correction/EventSelectionEfficiency/eventselectionefficiency.root"),
+ fProcessPrimary(kFALSE),
+ fProcessHits(kFALSE),
+ fTrigger(AliPWG0Helper::kMB1)
{
if (fIsInit) return;
if (what & kBackgroundCorrection) InitBackground();
if (what & kEnergyDistributions) InitEnergyDists();
-
+ if (what & kEventSelectionEfficiency) InitEventSelectionEff();
fIsInit = kTRUE;
}
if (!fBackground) AliFatal("Invalid background object from CDB");
}
+
//____________________________________________________________________
void AliFMDAnaParameters::InitEnergyDists() {
if (!fEnergyDistribution) AliFatal("Invalid background object from CDB");
+}
+
+//____________________________________________________________________
+
+void AliFMDAnaParameters::InitEventSelectionEff() {
+
+ //AliCDBEntry* background = GetEntry(fgkBackgroundCorrection);
+ TFile* fin = TFile::Open(fEventSelectionEffPath.Data());
+
+ if (!fin) return;
+
+ fEventSelectionEfficiency = dynamic_cast<AliFMDAnaCalibEventSelectionEfficiency*>(fin->Get(fgkEventSelectionEffID));
+ if (!fEventSelectionEfficiency) AliFatal("Invalid background object from CDB");
+
}
//____________________________________________________________________
Float_t AliFMDAnaParameters::GetVtxCutZ() {
return fBackground->GetDoubleHitCorrection(det,ring);
}
//_____________________________________________________________________
+Float_t AliFMDAnaParameters::GetEventSelectionEfficiency(Int_t vtxbin) {
+ if(!fIsInit) {
+ AliWarning("Not initialized yet. Call Init() to remedy");
+ return 0;
+ }
+ return fEventSelectionEfficiency->GetCorrection(vtxbin);
+
+}
+//_____________________________________________________________________
Float_t AliFMDAnaParameters::GetMaxR(Char_t ring) const{
Float_t radius = 0;
if(ring == 'I')
Float_t eta = -1*TMath::Log(TMath::Tan(0.5*theta));
return eta;
-}/*
-//____________________________________________________________________
-AliCDBEntry* AliFMDAnaParameters::GetEntry(const char* path, Bool_t fatal) const
+}
+
+//_____________________________________________________________________
+
+void AliFMDAnaParameters::GetVertex(AliESDEvent* esd, Double_t* vertexXYZ)
{
- // Get an entry from the CDB or via preprocessor
- AliCDBEntry* entry = 0;
- AliCDBManager* cdb = AliCDBManager::Instance();
- entry = cdb->Get(path);
-
- if (!entry) {
- TString msg(Form("No %s found in CDB, perhaps you need to "
- "use AliFMDCalibFaker?", path));
- if (fatal) { AliFatal(msg.Data()); }
- else AliLog::Message(AliLog::kWarning, msg.Data(), "FMD",
- "AliFMDParameters", "GetEntry", __FILE__,
- __LINE__);
- return 0;
+ const AliESDVertex* vertex = 0;
+ vertex = esd->GetPrimaryVertex();
+ if(!vertex || (vertexXYZ[0] == 0 && vertexXYZ[1] == 0 && vertexXYZ[2] == 0))
+ vertex = esd->GetPrimaryVertexSPD();
+ if(!vertex || (vertexXYZ[0] == 0 && vertexXYZ[1] == 0 && vertexXYZ[2] == 0))
+ vertex = esd->GetPrimaryVertexTPC();
+ if(!vertex || (vertexXYZ[0] == 0 && vertexXYZ[1] == 0 && vertexXYZ[2] == 0))
+ vertex = esd->GetVertex();
+ if (vertex && (vertexXYZ[0] != 0 || vertexXYZ[1] != 0 || vertexXYZ[2] != 0)) {
+ vertex->GetXYZ(vertexXYZ);
+ //std::cout<<vertex->GetName()<<" "<< vertex->GetTitle() <<" "<< vertex->GetZv()<<std::endl;
+ return;
}
- return entry;
+ else if (esd->GetESDTZERO()) {
+ vertexXYZ[0] = 0;
+ vertexXYZ[1] = 0;
+ vertexXYZ[2] = esd->GetT0zVertex();
+
+ return;
+ }
+
+ return;
+
+}
+//____________________________________________________________________
+Bool_t AliFMDAnaParameters::IsEventTriggered(AliESDEvent* esd) {
+
+
+ Bool_t trigger = AliPWG0Helper::IsEventTriggered(esd, AliPWG0Helper::kMB1);
+ // Bool_t trigger = AliPWG0Helper::IsEventTriggered(esd, fTrigger);
+ return trigger;
}
- */
+
//____________________________________________________________________
Float_t
AliFMDAnaParameters::GetStripLength(Char_t ring, UShort_t strip)