From: hdalsgaa Date: Wed, 5 Aug 2009 10:16:39 +0000 (+0000) Subject: Implemented correction for trigger efficiency and vertex reconstruction as well as... X-Git-Url: http://git.uio.no/git/?a=commitdiff_plain;h=b64db9b14f75a3a1ac3562768d811fd744312249;hp=be28462a69497a390358bed198a62e7c8eca7e0c;p=u%2Fmrichter%2FAliRoot.git Implemented correction for trigger efficiency and vertex reconstruction as well as other fixes and upgrades - the trigger introduces dependence on PWG0 code --- diff --git a/FMD/analysis/AliFMDAnaParameters.cxx b/FMD/analysis/AliFMDAnaParameters.cxx index 5fe83131181..a1cd5298ac6 100644 --- a/FMD/analysis/AliFMDAnaParameters.cxx +++ b/FMD/analysis/AliFMDAnaParameters.cxx @@ -32,6 +32,8 @@ #include #include #include +#include "AliESDEvent.h" +#include "AliESDVertex.h" //==================================================================== ClassImp(AliFMDAnaParameters) @@ -43,6 +45,7 @@ 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; @@ -61,10 +64,15 @@ AliFMDAnaParameters::AliFMDAnaParameters() : 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) { @@ -81,7 +89,7 @@ void AliFMDAnaParameters::Init(Bool_t forceReInit, UInt_t what) if (fIsInit) return; if (what & kBackgroundCorrection) InitBackground(); if (what & kEnergyDistributions) InitEnergyDists(); - + if (what & kEventSelectionEfficiency) InitEventSelectionEff(); fIsInit = kTRUE; } @@ -98,6 +106,7 @@ void AliFMDAnaParameters::InitBackground() { if (!fBackground) AliFatal("Invalid background object from CDB"); } + //____________________________________________________________________ void AliFMDAnaParameters::InitEnergyDists() { @@ -110,6 +119,20 @@ 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(fin->Get(fgkEventSelectionEffID)); + if (!fEventSelectionEfficiency) AliFatal("Invalid background object from CDB"); + } //____________________________________________________________________ Float_t AliFMDAnaParameters::GetVtxCutZ() { @@ -266,6 +289,15 @@ TH1F* AliFMDAnaParameters::GetDoubleHitCorrection(Int_t det, 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') @@ -368,27 +400,45 @@ Float_t AliFMDAnaParameters::GetEtaFromStrip(UShort_t det, Char_t ring, UShort_t 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<GetName()<<" "<< vertex->GetTitle() <<" "<< vertex->GetZv()<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) diff --git a/FMD/analysis/AliFMDAnaParameters.h b/FMD/analysis/AliFMDAnaParameters.h index 8b646d32005..79885e19340 100644 --- a/FMD/analysis/AliFMDAnaParameters.h +++ b/FMD/analysis/AliFMDAnaParameters.h @@ -37,14 +37,11 @@ #include "TH1F.h" #include "AliFMDAnaCalibBackgroundCorrection.h" #include "AliFMDAnaCalibEnergyDistribution.h" +#include "AliFMDAnaCalibEventSelectionEfficiency.h" #include #include -//____________________________________________________________________ -// -// Singleton class to handle various parameters (not geometry) of the -// FMD -// Should get ata fromm Conditions DB. -// +#include "AliPWG0Helper.h" +class AliESDEvent; /** * @ingroup FMD_ana @@ -55,15 +52,16 @@ public: /** Enumeration of things to initialize */ enum What { /** Pulser gain */ - kBackgroundCorrection = 0x1, // Background Correction - kEnergyDistributions = 0x2 // Energy Distributions + kBackgroundCorrection = 0x1, // Background Correction + kEnergyDistributions = 0x2, // Energy Distributions + kEventSelectionEfficiency = 0x4 // Event Selection Efficiency }; /** Singleton access @return single to */ static AliFMDAnaParameters* Instance(); - void Init(Bool_t forceReInit=kTRUE, UInt_t what=kBackgroundCorrection|kEnergyDistributions); + void Init(Bool_t forceReInit=kTRUE, UInt_t what=kBackgroundCorrection|kEnergyDistributions|kEventSelectionEfficiency); Float_t GetVtxCutZ(); Int_t GetNvtxBins(); Int_t GetNetaBins(); @@ -77,8 +75,11 @@ public: // static const char* GetEdistPath() { return fgkEnergyDists;} static const char* GetBackgroundID() { return fgkBackgroundID;} static const char* GetEdistID() { return fgkEnergyDistributionID;} + static const char* GetEventSelectionEffID() { return fgkEventSelectionEffID;} TH2F* GetBackgroundCorrection(Int_t det, Char_t ring, Int_t vtxbin); TH1F* GetDoubleHitCorrection(Int_t det, Char_t ring); + + Float_t GetEventSelectionEfficiency(Int_t vtxbin); Float_t GetPhiFromSector(UShort_t det, Char_t ring, UShort_t sec) const; Float_t GetEtaFromStrip(UShort_t det, Char_t ring, UShort_t sec, UShort_t strip, Float_t zvtx) const; Float_t GetStripLength(Char_t ring, UShort_t strip) ; @@ -87,8 +88,14 @@ public: Float_t GetMinR(Char_t ring) const; void SetBackgroundPath(const Char_t* bgpath) {fBackgroundPath.Form(bgpath);} void SetEnergyPath(const Char_t* epath) {fEnergyPath.Form(epath);} - - + void SetProcessPrimary(Bool_t prim=kTRUE) {fProcessPrimary = prim;} + void SetProcessHits(Bool_t hits=kTRUE) {fProcessHits = hits;} + Bool_t GetProcessPrimary() {return fProcessPrimary;} + Bool_t GetProcessHits() {return fProcessHits;} + void GetVertex(AliESDEvent* esd, Double_t* vertexXYZ); + void SetTriggerDefinition(AliPWG0Helper::Trigger trigger) {fTrigger = trigger;} + Int_t SetTriggerDefinition() {return fTrigger;} + Bool_t IsEventTriggered(AliESDEvent* esd); protected: AliFMDAnaParameters(); @@ -98,10 +105,14 @@ protected: fIsInit(o.fIsInit), fBackground(o.fBackground), fEnergyDistribution(o.fEnergyDistribution), + fEventSelectionEfficiency(o.fEventSelectionEfficiency), fCorner1(o.fCorner1), fCorner2(o.fCorner2), fEnergyPath(o.fEnergyPath), - fBackgroundPath(o.fBackgroundPath) + fBackgroundPath(o.fBackgroundPath), + fProcessPrimary(o.fProcessPrimary), + fProcessHits(o.fProcessHits), + fTrigger(o.fTrigger) {} AliFMDAnaParameters& operator=(const AliFMDAnaParameters&) { return *this; } virtual ~AliFMDAnaParameters() {} @@ -111,6 +122,8 @@ protected: // AliCDBEntry* GetEntry(const char* path, Bool_t fatal=kTRUE) const ; void InitBackground(); void InitEnergyDists(); + void InitEventSelectionEff(); + TH1F* GetEnergyDistribution(Int_t det, Char_t ring, Float_t eta); TObjArray* GetBackgroundArray(); @@ -120,17 +133,24 @@ protected: Bool_t fIsInit; //TObjArray* fBackgroundArray; // TObjArray* fEdistArray; - AliFMDAnaCalibBackgroundCorrection* fBackground; - AliFMDAnaCalibEnergyDistribution* fEnergyDistribution; + AliFMDAnaCalibBackgroundCorrection* fBackground; + AliFMDAnaCalibEnergyDistribution* fEnergyDistribution; + AliFMDAnaCalibEventSelectionEfficiency* fEventSelectionEfficiency; + //static const char* fgkBackgroundCorrection; //static const char* fgkEnergyDists; static const char* fgkBackgroundID; static const char* fgkEnergyDistributionID ; + static const char* fgkEventSelectionEffID ; + TVector2 fCorner1; TVector2 fCorner2; - TString fEnergyPath; - TString fBackgroundPath; - + TString fEnergyPath; + TString fBackgroundPath; + TString fEventSelectionEffPath; + Bool_t fProcessPrimary; + Bool_t fProcessHits; + AliPWG0Helper::Trigger fTrigger; ClassDef(AliFMDAnaParameters,0) // Manager of parameters }; diff --git a/FMD/analysis/AliFMDAnalysisTaskDensity.cxx b/FMD/analysis/AliFMDAnalysisTaskDensity.cxx index 82223adf3d1..2d888d4c339 100644 --- a/FMD/analysis/AliFMDAnalysisTaskDensity.cxx +++ b/FMD/analysis/AliFMDAnalysisTaskDensity.cxx @@ -316,37 +316,6 @@ Float_t AliFMDAnalysisTaskDensity::GetAcceptanceCorrection(Char_t ring, UShort_t return correction; } //_____________________________________________________________________ -/*Float_t AliFMDAnalysisTaskDensity::GetPhiFromSector(UShort_t det, Char_t ring, UShort_t sec) -{ - Int_t nsec = (ring == 'I' ? 20 : 40); - Float_t basephi = 0; - if(det == 1) - basephi = 1.72787594; - if(det == 2 && ring == 'I') - basephi = 0.15707963; - if(det == 2 && ring == 'O') - basephi = 0.078539818; - if(det == 3 && ring == 'I') - basephi = 2.984513044; - if(det == 3 && ring == 'O') - basephi = 3.06305289; - - Float_t step = 2*TMath::Pi() / nsec; - Float_t phi = 0; - if(det == 3) - phi = basephi - sec*step; - else - phi = basephi + sec*step; - - if(phi < 0) - phi = phi +2*TMath::Pi(); - if(phi > 2*TMath::Pi() ) - phi = phi - 2*TMath::Pi(); - - return phi; -} - -*/ // //EOF // diff --git a/FMD/analysis/AliFMDAnalysisTaskDndeta.cxx b/FMD/analysis/AliFMDAnalysisTaskDndeta.cxx index b5d5fe43f83..5950d4e1ba4 100644 --- a/FMD/analysis/AliFMDAnalysisTaskDndeta.cxx +++ b/FMD/analysis/AliFMDAnalysisTaskDndeta.cxx @@ -33,16 +33,16 @@ AliFMDAnalysisTaskDndeta::AliFMDAnalysisTaskDndeta() : fDebug(0), fOutputList(0), fInputList(0), - fArray(0), +// fArray(0), fInputArray(0), fVertexString(0x0), fNevents(), fNMCevents(), fStandalone(kTRUE), - fMCevent(0), - fLastTrackByStrip(0), - fPrimary(kTRUE), - fRecordHits(kFALSE) +//fMCevent(0), + fLastTrackByStrip(0) +// fPrimary(kTRUE), +// fRecordHits(kFALSE) { // Default constructor DefineInput (0, TList::Class()); @@ -54,16 +54,16 @@ AliFMDAnalysisTaskDndeta::AliFMDAnalysisTaskDndeta(const char* name, Bool_t SE): fDebug(0), fOutputList(0), fInputList(0), - fArray(), + // fArray(), fInputArray(0), fVertexString(0x0), fNevents(), fNMCevents(), fStandalone(kTRUE), - fMCevent(0), - fLastTrackByStrip(0), - fPrimary(kTRUE), - fRecordHits(kFALSE) + // fMCevent(0), + fLastTrackByStrip(0) + // fPrimary(kTRUE), + // fRecordHits(kFALSE) { fStandalone = SE; if(fStandalone) { @@ -78,8 +78,8 @@ void AliFMDAnalysisTaskDndeta::CreateOutputObjects() { AliFMDAnaParameters* pars = AliFMDAnaParameters::Instance(); - fArray.SetName("FMD"); - fArray.SetOwner(); + // fArray.SetName("FMD"); + // fArray.SetOwner(); if(!fOutputList) fOutputList = new TList(); @@ -87,6 +87,7 @@ void AliFMDAnalysisTaskDndeta::CreateOutputObjects() TH2F* hMult = 0; + TH2F* hMultTrVtx = 0; TH1F* hHits = 0; TH1F* hPrimVertexBin = 0; @@ -103,18 +104,18 @@ void AliFMDAnalysisTaskDndeta::CreateOutputObjects() for(Int_t det =1; det<=3;det++) { - TObjArray* detArray = new TObjArray(); - detArray->SetName(Form("FMD%d",det)); - fArray.AddAtAndExpand(detArray,det); + // TObjArray* detArray = new TObjArray(); + // detArray->SetName(Form("FMD%d",det)); + // fArray.AddAtAndExpand(detArray,det); Int_t nRings = (det==1 ? 1 : 2); for(Int_t ring = 0;ringSetName(Form("FMD%d%c",det,ringChar)); - detArray->AddAtAndExpand(vtxArray,ring); + // TObjArray* vtxArray = new TObjArray(); + // vtxArray->SetName(Form("FMD%d%c",det,ringChar)); + // detArray->AddAtAndExpand(vtxArray,ring); for(Int_t i = 0; i< nVtxbins; i++) { TH2F* hBg = pars->GetBackgroundCorrection(det, ringChar, i); hMult = new TH2F(Form("dNdeta_FMD%d%c_vtxbin%d",det,ringChar,i),Form("dNdeta_FMD%d%c_vtxbin%d",det,ringChar,i), @@ -133,8 +134,9 @@ void AliFMDAnalysisTaskDndeta::CreateOutputObjects() hMult->Sumw2(); hHits->Sumw2(); fOutputList->Add(hMult); + // fOutputList->Add(hMultTrVtx); fOutputList->Add(hHits); - vtxArray->AddAtAndExpand(hMult,i); + //vtxArray->AddAtAndExpand(hMult,i); } } @@ -171,28 +173,31 @@ void AliFMDAnalysisTaskDndeta::ConnectInputData(Option_t */*option*/) //_____________________________________________________________________ void AliFMDAnalysisTaskDndeta::Exec(Option_t */*option*/) { + AliFMDAnaParameters* pars = AliFMDAnaParameters::Instance(); Int_t vtxbin = fVertexString->GetString().Atoi(); fNevents.Fill(vtxbin); for(UShort_t det=1;det<=3;det++) { //TObjArray* detInputArray = (TObjArray*)fInputArray->At(det); - TObjArray* detArray = (TObjArray*)fArray.At(det); + // TObjArray* detArray = (TObjArray*)fArray.At(det); Int_t nRings = (det==1 ? 1 : 2); for (UShort_t ir = 0; ir < nRings; ir++) { Char_t ringChar = (ir == 0 ? 'I' : 'O'); //TObjArray* vtxInputArray = (TObjArray*)detInputArray->At(ir); - TObjArray* vtxArray = (TObjArray*)detArray->At(ir); - TH2F* hMultTotal = (TH2F*)vtxArray->At(vtxbin); + //TObjArray* vtxArray = (TObjArray*)detArray->At(ir); + // TH2F* hMultTotal = (TH2F*)vtxArray->At(vtxbin); + TH2F* hMultTotal = (TH2F*)fOutputList->FindObject(Form("dNdeta_FMD%d%c_vtxbin%d",det,ringChar,vtxbin)); + TH2F* hMultInput = (TH2F*)fInputList->FindObject(Form("mult_FMD%d%c_vtxbin%d",det,ringChar,vtxbin)); hMultTotal->Add(hMultInput); - + //hMultTrVtx->Add(hMultInput); } } - if(fMCevent && fPrimary) + if(pars->GetProcessPrimary()) ProcessPrimary(); if(fStandalone) { @@ -209,15 +214,26 @@ void AliFMDAnalysisTaskDndeta::Terminate(Option_t */*option*/) { Int_t nVtxbins = pars->GetNvtxBins(); for(UShort_t det=1;det<=3;det++) { - TObjArray* detArray = (TObjArray*)fArray.At(det); + // TObjArray* detArray = (TObjArray*)fArray.At(det); Int_t nRings = (det==1 ? 1 : 2); for (UShort_t ir = 0; ir < nRings; ir++) { - TObjArray* vtxArray = (TObjArray*)detArray->At(ir); + // TObjArray* vtxArray = (TObjArray*)detArray->At(ir); Char_t ringChar = (ir == 0 ? 'I' : 'O'); for(Int_t i =0; iAt(i); + + //TH2F* hMultTotal = (TH2F*)vtxArray->At(i); + //hMultTotal->Scale(pars->GetTriggerEfficiency(i)); + TH2F* hMultTotal = (TH2F*)fOutputList->FindObject(Form("dNdeta_FMD%d%c_vtxbin%d",det,ringChar,i)); + TH2F* hMultTrVtx = (TH2F*)hMultTotal->Clone(Form("dNdeta_FMD_TrVtx_%d%c_vtxbin%d",det,ringChar,i)); + + hMultTotal->Scale(pars->GetEventSelectionEfficiency(i)); + //std::cout<GetTriggerEfficiency(i)<GetEventSelectionEfficiency(i)<ProjectionX(Form("dNdeta_FMD%d%c_vtxbin%d_proj",det,ringChar,i),1,hMultTotal->GetNbinsY()); + TH1D* hMultProjTrVtx = hMultTrVtx->ProjectionX(Form("dNdeta_FMD_TrVtx_%d%c_vtxbin%d_proj",det,ringChar,i),1,hMultTotal->GetNbinsY()); + fOutputList->Add(hMultTrVtx); fOutputList->Add(hMultProj); + fOutputList->Add(hMultProjTrVtx); } } } @@ -226,15 +242,20 @@ void AliFMDAnalysisTaskDndeta::Terminate(Option_t */*option*/) { //_____________________________________________________________________ void AliFMDAnalysisTaskDndeta::ProcessPrimary() { + AliMCEventHandler* eventHandler = dynamic_cast (AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler()); + AliMCEvent* mcEvent = eventHandler->MCEvent(); + if(!mcEvent) + return; + fLastTrackByStrip.Reset(-1); AliFMDAnaParameters* pars = AliFMDAnaParameters::Instance(); AliMCParticle* particle = 0; - AliStack* stack = fMCevent->Stack(); + AliStack* stack = mcEvent->Stack(); TH1F* hPrimary = (TH1F*)fOutputList->FindObject("hMultvsEta"); - AliHeader* header = fMCevent->Header(); + AliHeader* header = mcEvent->Header(); AliGenEventHeader* genHeader = header->GenEventHeader(); TArrayF vertex; @@ -249,11 +270,11 @@ void AliFMDAnalysisTaskDndeta::ProcessPrimary() { // we loop over the primaries only unless we need the hits (diagnostics running slowly) Int_t nTracks = stack->GetNprimary(); - if(fRecordHits) + if(pars->GetProcessHits()) nTracks = stack->GetNtrack(); for(Int_t i = 0 ;iGetTrack(i); + particle = mcEvent->GetTrack(i); if(!particle) continue; @@ -269,7 +290,7 @@ void AliFMDAnalysisTaskDndeta::ProcessPrimary() { } } - if(fRecordHits) { + if(pars->GetProcessPrimary()) { for(Int_t j=0; jGetNumberOfTrackReferences();j++) { AliTrackReference* ref = particle->GetTrackReference(j); diff --git a/FMD/analysis/AliFMDAnalysisTaskDndeta.h b/FMD/analysis/AliFMDAnalysisTaskDndeta.h index 479c747c175..4966c667f77 100644 --- a/FMD/analysis/AliFMDAnalysisTaskDndeta.h +++ b/FMD/analysis/AliFMDAnalysisTaskDndeta.h @@ -26,16 +26,17 @@ class AliFMDAnalysisTaskDndeta : public AliAnalysisTask fDebug(o.fDebug), fOutputList(0), fInputList(0), - fArray(o.fArray), + //fArray(o.fArray), fInputArray(o.fInputArray), fVertexString(o.fVertexString), fNevents(o.fNevents), fNMCevents(o.fNMCevents), fStandalone(o.fStandalone), - fMCevent(o.fMCevent), - fLastTrackByStrip(o.fLastTrackByStrip), - fPrimary(o.fPrimary), - fRecordHits(o.fRecordHits) {} + //fMCevent(o.fMCevent), + fLastTrackByStrip(o.fLastTrackByStrip) + // fPrimary(o.fPrimary), + //fRecordHits(o.fRecordHits) +{} AliFMDAnalysisTaskDndeta& operator=(const AliFMDAnalysisTaskDndeta&) { return *this; } // Implementation of interface methods virtual void ConnectInputData(Option_t *option = ""); @@ -48,25 +49,25 @@ class AliFMDAnalysisTaskDndeta : public AliAnalysisTask void SetInputList(TList* inputList) {fInputList = inputList;} void SetInputVertex(TObjString* vtxString) {fVertexString = vtxString;} void SetOutputList(TList* outputList) {fOutputList = outputList;} - void SetMCEvent(AliMCEvent* mcevent) {fMCevent = mcevent;} + // void SetMCEvent(AliMCEvent* mcevent) {fMCevent = mcevent;} void ProcessPrimary(); TList* GetOutputList() {return fOutputList;} - void SetAnalyzePrimary(Bool_t prim) {fPrimary = prim;} - void SetRecordHits(Bool_t recordhits) {fRecordHits = recordhits;} + // void SetAnalyzePrimary(Bool_t prim) {fPrimary = prim;} + // void SetRecordHits(Bool_t recordhits) {fRecordHits = recordhits;} private: Int_t fDebug; // Debug flag TList* fOutputList; TList* fInputList; - TObjArray fArray; + //TObjArray fArray; TObjArray* fInputArray; TObjString* fVertexString; TH1I fNevents; TH1I fNMCevents; Bool_t fStandalone; - AliMCEvent* fMCevent; + // AliMCEvent* fMCevent; AliFMDFloatMap fLastTrackByStrip; - Bool_t fPrimary; - Bool_t fRecordHits; + //Bool_t fPrimary; + //Bool_t fRecordHits; ClassDef(AliFMDAnalysisTaskDndeta, 0); // Analysis task for FMD analysis }; diff --git a/FMD/analysis/AliFMDAnalysisTaskSE.cxx b/FMD/analysis/AliFMDAnalysisTaskSE.cxx index dfb649266b0..6b3253f3a99 100644 --- a/FMD/analysis/AliFMDAnalysisTaskSE.cxx +++ b/FMD/analysis/AliFMDAnalysisTaskSE.cxx @@ -4,6 +4,7 @@ #include "AliESDFMD.h" #include "AliMCEventHandler.h" #include "AliAnalysisManager.h" +#include "AliFMDAnaParameters.h" ClassImp(AliFMDAnalysisTaskSE) @@ -14,9 +15,9 @@ AliAnalysisTaskSE(), fSharing("Sharing",kFALSE), fDensity("Density",kFALSE), fBackground("BackgroundCorrected",kFALSE), - fDndeta("dNdeta",kFALSE), - fPrimary(kTRUE), - fRecordHits(kFALSE) + fDndeta("dNdeta",kFALSE) +// fPrimary(kTRUE), +// fRecordHits(kFALSE) { // Default constructor } @@ -27,9 +28,9 @@ AliFMDAnalysisTaskSE::AliFMDAnalysisTaskSE(const char* name): fSharing("Sharing",kFALSE), fDensity("Density",kFALSE), fBackground("BackgroundCorrected",kFALSE), - fDndeta("dNdeta",kFALSE), - fPrimary(kTRUE), - fRecordHits(kFALSE) + fDndeta("dNdeta",kFALSE) + // fPrimary(kTRUE), + // fRecordHits(kFALSE) { DefineOutput(1, TList::Class()); @@ -66,8 +67,8 @@ void AliFMDAnalysisTaskSE::UserCreateOutputObjects() fDndeta.SetInputVertex(vtxString1); fDndeta.SetInputList(bgcorlist); fDndeta.SetOutputList(fListOfHistos); - fDndeta.SetAnalyzePrimary(fPrimary); - fDndeta.SetRecordHits(fRecordHits); + //fDndeta.SetAnalyzePrimary(fPrimary); + //fDndeta.SetRecordHits(fRecordHits); fSharing.CreateOutputObjects(); fDensity.CreateOutputObjects(); fBackground.CreateOutputObjects(); @@ -86,6 +87,7 @@ void AliFMDAnalysisTaskSE::UserExec(Option_t */*option*/) { // Execute analysis for current event // + // AliFMDAnaParameters* pars = AliFMDAnaParameters::Instance(); AliESDEvent* fESD = (AliESDEvent*)InputEvent(); fSharing.SetInputESD(fESD); @@ -94,12 +96,6 @@ void AliFMDAnalysisTaskSE::UserExec(Option_t */*option*/) fDensity.Exec(""); if(fDensity.GetEventStatus()) { fBackground.Exec(""); - //AliMCEvent* mcevent = MCEvent(); - if(fPrimary) { - AliMCEventHandler* eventHandler = dynamic_cast (AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler()); - AliMCEvent* mcevent = eventHandler->MCEvent(); - fDndeta.SetMCEvent(mcevent); - } fDndeta.Exec(""); } diff --git a/FMD/analysis/AliFMDAnalysisTaskSE.h b/FMD/analysis/AliFMDAnalysisTaskSE.h index 2ea9db5080b..3b1e6ee3de0 100644 --- a/FMD/analysis/AliFMDAnalysisTaskSE.h +++ b/FMD/analysis/AliFMDAnalysisTaskSE.h @@ -36,17 +36,18 @@ class AliFMDAnalysisTaskSE : public AliAnalysisTaskSE fSharing(o.fSharing), fDensity(o.fDensity), fBackground(o.fBackground), - fDndeta(o.fDndeta), - fPrimary(o.fPrimary), - fRecordHits(o.fRecordHits) {} + fDndeta(o.fDndeta) + // fPrimary(o.fPrimary), + // fRecordHits(o.fRecordHits) + {} AliFMDAnalysisTaskSE& operator=(const AliFMDAnalysisTaskSE&) { return *this; } virtual void Init(); virtual void UserCreateOutputObjects(); virtual void UserExec(Option_t* /*option*/); void Terminate(Option_t */*option*/); - void SetAnalyzePrimary(Bool_t prim) {fPrimary = prim;} - void SetRecordHits(Bool_t recordhits) {fRecordHits = recordhits;} + // void SetAnalyzePrimary(Bool_t prim) {fPrimary = prim;} + // void SetRecordHits(Bool_t recordhits) {fRecordHits = recordhits;} private: TList* fListOfHistos; @@ -54,8 +55,8 @@ class AliFMDAnalysisTaskSE : public AliAnalysisTaskSE AliFMDAnalysisTaskDensity fDensity; AliFMDAnalysisTaskBackgroundCorrection fBackground; AliFMDAnalysisTaskDndeta fDndeta; - Bool_t fPrimary; - Bool_t fRecordHits; + // Bool_t fPrimary; + // Bool_t fRecordHits; ClassDef(AliFMDAnalysisTaskSE, 1); }; diff --git a/FMD/analysis/AliFMDAnalysisTaskSharing.cxx b/FMD/analysis/AliFMDAnalysisTaskSharing.cxx index c8c2b2428d9..8f5f13df0cf 100644 --- a/FMD/analysis/AliFMDAnalysisTaskSharing.cxx +++ b/FMD/analysis/AliFMDAnalysisTaskSharing.cxx @@ -13,12 +13,17 @@ #include "AliESDFMD.h" //#include "AliFMDGeometry.h" #include "AliMCEventHandler.h" +#include "AliMCEvent.h" #include "AliStack.h" #include "AliESDVertex.h" #include "AliMultiplicity.h" #include "AliFMDAnaParameters.h" //#include "/home/canute/ALICE/AliRoot/PWG0/AliPWG0Helper.h" //#include "AliFMDParameters.h" +#include "AliGenEventHeader.h" +#include "AliHeader.h" +#include "AliStack.h" +#include "AliMCParticle.h" ClassImp(AliFMDAnalysisTaskSharing) @@ -80,6 +85,28 @@ void AliFMDAnalysisTaskSharing::CreateOutputObjects() fDiagList = new TList(); fDiagList->SetName("Sharing diagnostics"); + + AliFMDAnaParameters* pars = AliFMDAnaParameters::Instance(); + TH2F* hBg = pars->GetBackgroundCorrection(1, 'I', 0); + TH1F* hPrimary = new TH1F("hMultvsEtaNoCuts","hMultvsEtaNoCuts", + hBg->GetNbinsX(), + hBg->GetXaxis()->GetXmin(), + hBg->GetXaxis()->GetXmax()); + hPrimary->Sumw2(); + fDiagList->Add(hPrimary); + TH1F* hPrimVertexBin = 0; + for(Int_t i = 0; i< pars->GetNvtxBins(); i++) { + + hPrimVertexBin = new TH1F(Form("primmult_NoCuts_vtxbin%d",i), + Form("primmult_NoCuts_vtxbin%d",i), + hBg->GetNbinsX(), + hBg->GetXaxis()->GetXmin(), + hBg->GetXaxis()->GetXmax()); + hPrimVertexBin->Sumw2(); + fDiagList->Add(hPrimVertexBin); + + } + for(Int_t det = 1; det<=3; det++) { Int_t nRings = (det==1 ? 1 : 2); @@ -93,15 +120,19 @@ void AliFMDAnalysisTaskSharing::CreateOutputObjects() 1000,0,25); - TH1F* hNstripsHit = new TH1F(Form("N_strips_hit_FMD%d%c",det,ringChar), - Form("N_strips_hit_FMD%d%c",det,ringChar), - 25,0,25); + //TH1F* hNstripsHit = new TH1F(Form("N_strips_hit_FMD%d%c",det,ringChar), + // Form("N_strips_hit_FMD%d%c",det,ringChar), + // 25,0,25); fDiagList->Add(hEdist); fDiagList->Add(hEdist_after); - fDiagList->Add(hNstripsHit); + //fDiagList->Add(hNstripsHit); } } + TH1F* nMCevents = new TH1F("nMCEventsNoCuts","nMCEventsNoCuts",pars->GetNvtxBins(),0,pars->GetNvtxBins()); + + fDiagList->Add(nMCevents); + } //_____________________________________________________________________ void AliFMDAnalysisTaskSharing::ConnectInputData(Option_t */*option*/) @@ -120,35 +151,41 @@ void AliFMDAnalysisTaskSharing::Exec(Option_t */*option*/) foutputESDFMD->Clear(); + AliFMDAnaParameters* pars = AliFMDAnaParameters::Instance(); Double_t vertex[3]; - GetVertex(vertex); + pars->GetVertex(fESD,vertex); fEsdVertex->SetXYZ(vertex); - /* - Bool_t isTriggered = AliPWG0Helper::IsEventTriggered(fESD, AliPWG0Helper::kMB1); - - if(!isTriggered) { + + // Process primaries here to get true MC distribution + if(pars->GetProcessPrimary()) + ProcessPrimary(); + + Bool_t isTriggered = pars->IsEventTriggered(fESD); + + if(!isTriggered) { fStatus = kFALSE; - std::cout<<"no trigger"<GetMultiplicity(); Int_t nTrackLets = testmult->GetNumberOfTracklets(); if(nTrackLets < 1000) foutputESDFMD->SetUniqueID(kTRUE); else foutputESDFMD->SetUniqueID(kFALSE); - + AliESDFMD* fmd = fESD->GetFMDData(); - AliFMDAnaParameters* pars = AliFMDAnaParameters::Instance(); + if (!fmd) return; Int_t nHits = 0; for(UShort_t det=1;det<=3;det++) { @@ -206,6 +243,7 @@ void AliFMDAnalysisTaskSharing::Exec(Option_t */*option*/) } } + if(fStandalone) { PostData(0, foutputESDFMD); PostData(1, fEsdVertex); @@ -240,52 +278,7 @@ Float_t AliFMDAnalysisTaskSharing::GetMultiplicityOfStrip(Float_t mult, // Float_t cutPart = pars->GetMPV(det,ring,eta) - 5*pars->GetSigma(det,ring,eta); Float_t Etotal = mult; - //if(mult > 5) - // std::cout<GetMPV(det,ring,eta); - - //if(recopars->IsDead(det,ring,sec,strip)) - // std::cout<<"dead channel"<GetUniqueID() == kTRUE) { - // Float_t mpv = pars->GetMPV(det,ring,eta); - - /* - if(foutputESDFMD->GetUniqueID() == kFALSE) { - - if(mult > 15) - return 0; - if(mult > cutLow ) { - fEnergy = fEnergy + mult; - fNstrips++; - } - - if( (Enext < cutLow && fEnergy > 0 ) || fNstrips >2 ){ - - //if((fEnergy*TMath::Cos(Eta2Theta(eta))) > cutPart || fNstrips > 1) { - nParticles = 1; - merged_energy = fEnergy*TMath::Cos(Eta2Theta(eta)); - TH1F* hEdist = (TH1F*)fDiagList.FindObject(Form("Edist_after_sharing_FMD%d%c",det,ring)); - hEdist->Fill(fEnergy); - TH1F* hNstrips = (TH1F*)fDiagList.FindObject(Form("N_strips_hit_FMD%d%c",det,ring)); - hNstrips->Fill(fNstrips); - // std::cout<GetPrimaryVertex(); - if(!vertex || (vertexXYZ[0] == 0 && vertexXYZ[1] == 0 && vertexXYZ[2] == 0)) - vertex = fESD->GetPrimaryVertexSPD(); - if(!vertex || (vertexXYZ[0] == 0 && vertexXYZ[1] == 0 && vertexXYZ[2] == 0)) - vertex = fESD->GetPrimaryVertexTPC(); - if(!vertex || (vertexXYZ[0] == 0 && vertexXYZ[1] == 0 && vertexXYZ[2] == 0)) - vertex = fESD->GetVertex(); - if (vertex && (vertexXYZ[0] != 0 || vertexXYZ[1] != 0 || vertexXYZ[2] != 0)) { - vertex->GetXYZ(vertexXYZ); - //std::cout<GetName()<<" "<< vertex->GetTitle() <<" "<< vertex->GetZv()<GetESDTZERO()) { - vertexXYZ[0] = 0; - vertexXYZ[1] = 0; - vertexXYZ[2] = fESD->GetT0zVertex(); - - return; - } - - return; - -} + //_____________________________________________________________________ Float_t AliFMDAnalysisTaskSharing::Eta2Theta(Float_t eta) { @@ -383,30 +350,64 @@ Float_t AliFMDAnalysisTaskSharing::Eta2Theta(Float_t eta) { } + + + //_____________________________________________________________________ -/*Double_t AliFMDAnalysisTaskSharing::EtaFromStrip(UShort_t det, - Char_t ring, - UShort_t sector, - UShort_t strip, - Double_t zvtx) -{ - - AliFMDGeometry* geo = AliFMDGeometry::Instance(); +void AliFMDAnalysisTaskSharing::ProcessPrimary() { - Double_t x,y,z; - geo->Detector2XYZ(det,ring,sector,strip,x,y,z); + AliMCEventHandler* eventHandler = dynamic_cast (AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler()); + AliMCEvent* mcEvent = eventHandler->MCEvent(); + if(!mcEvent) + return; + + AliFMDAnaParameters* pars = AliFMDAnaParameters::Instance(); + + AliMCParticle* particle = 0; + + AliStack* stack = mcEvent->Stack(); + + TH1F* hPrimary = (TH1F*)fDiagList->FindObject("hMultvsEtaNoCuts"); + AliHeader* header = mcEvent->Header(); + AliGenEventHeader* genHeader = header->GenEventHeader(); - Double_t r = TMath::Sqrt(x*x+y*y); - Double_t z_real = z-zvtx; - Double_t theta = TMath::ATan2(r,z_real); - // std::cout<<"From EtaFromStrip "<PrimaryVertex(vertex); + if(TMath::Abs(vertex.At(2)) > pars->GetVtxCutZ()) + return; + + Double_t delta = 2*pars->GetVtxCutZ()/pars->GetNvtxBins(); + Double_t vertexBinDouble = (vertex.At(2) + pars->GetVtxCutZ()) / delta; + Int_t vertexBin = (Int_t)vertexBinDouble; + + Bool_t firstTrack = kTRUE; - return eta; - }*/ + Int_t nTracks = stack->GetNprimary(); + TH1F* nMCevents = (TH1F*)fDiagList->FindObject("nMCEventsNoCuts"); + for(Int_t i = 0 ;iGetTrack(i); + if(!particle) + continue; + + if(stack->IsPhysicalPrimary(i) && particle->Charge() != 0) { + hPrimary->Fill(particle->Eta()); + + + TH1F* hPrimVtxBin = (TH1F*)fDiagList->FindObject(Form("primmult_NoCuts_vtxbin%d",vertexBin)); + hPrimVtxBin->Fill(particle->Eta()); + + if(firstTrack) { + nMCevents->Fill(vertexBin); + firstTrack = kFALSE; + } + + } + } + +} + //_____________________________________________________________________ // // EOF diff --git a/FMD/analysis/AliFMDAnalysisTaskSharing.h b/FMD/analysis/AliFMDAnalysisTaskSharing.h index cd948a230b6..11963c358d0 100644 --- a/FMD/analysis/AliFMDAnalysisTaskSharing.h +++ b/FMD/analysis/AliFMDAnalysisTaskSharing.h @@ -50,7 +50,7 @@ class AliFMDAnalysisTaskSharing : public AliAnalysisTask virtual void Terminate(Option_t* /* option*/) {} virtual void SetDebugLevel(Int_t level) {fDebug = level;} Float_t GetMultiplicityOfStrip(Float_t mult, Float_t eta, Float_t Eprev, Float_t Enext, UShort_t det, Char_t ring, UShort_t sec, UShort_t strip); - void GetVertex(Double_t* vertexXYZ) ; + // void GetVertex(Double_t* vertexXYZ) ; void SetFMDData(AliESDFMD* fmd) {foutputESDFMD = fmd;} void SetOutputList(TList* outlist) {fDiagList = outlist;} void SetVertex(AliESDVertex* vertex) {fEsdVertex = vertex;} @@ -59,6 +59,8 @@ class AliFMDAnalysisTaskSharing : public AliAnalysisTask private: Float_t Eta2Theta(Float_t eta); Double_t EtaFromStrip(UShort_t det, Char_t ring, UShort_t sector, UShort_t strip, Double_t zvtx); + void ProcessPrimary(); + Int_t fDebug; // Debug flag AliESDEvent* fESD; //! ESD // AliESDEvent fOutputESD; diff --git a/FMD/analysis/FMDanalysisLinkDef.h b/FMD/analysis/FMDanalysisLinkDef.h index 981718c2c6f..0e6229ff26d 100644 --- a/FMD/analysis/FMDanalysisLinkDef.h +++ b/FMD/analysis/FMDanalysisLinkDef.h @@ -31,6 +31,7 @@ #pragma link C++ class AliFMDAnalysisTaskDndeta+; #pragma link C++ class AliFMDAnaCalibBackgroundCorrection+; #pragma link C++ class AliFMDAnaCalibEnergyDistribution+; +#pragma link C++ class AliFMDAnaCalibEventSelectionEfficiency+; #pragma link C++ class AliFMDAnaParameters+; #pragma link C++ class AliFMDAnaCalibEnergyDistribution+; #pragma link C++ class AliFMDAnaCalibBackgroundCorrection+; @@ -39,7 +40,7 @@ #pragma link C++ class AliFMDAnalysisTaskDensity+; #pragma link C++ class AliFMDAnalysisTaskBackgroundCorrection+; #pragma link C++ class AliFMDAnalysisTaskCollector+; -#pragma link C++ class AliFMDAnalysisTaskGenerateBackground+; +#pragma link C++ class AliFMDAnalysisTaskGenerateCorrection+; #else # error Not for compilation diff --git a/FMD/libFMDanalysis.pkg b/FMD/libFMDanalysis.pkg index 3bb69ce3346..299e79e188b 100644 --- a/FMD/libFMDanalysis.pkg +++ b/FMD/libFMDanalysis.pkg @@ -4,18 +4,19 @@ SRCS = analysis/AliFMDAnaParameters.cxx \ analysis/AliFMDAnaCalibEnergyDistribution.cxx \ analysis/AliFMDAnaCalibBackgroundCorrection.cxx \ - analysis/AliFMDAnalysisTaskESDReader.cxx \ + analysis/AliFMDAnaCalibEventSelectionEfficiency.cxx \ + analysis/AliFMDAnalysisTaskESDReader.cxx \ analysis/AliFMDAnalysisTaskSharing.cxx \ analysis/AliFMDAnalysisTaskDensity.cxx \ analysis/AliFMDAnalysisTaskBackgroundCorrection.cxx \ analysis/AliFMDAnalysisTaskCollector.cxx \ analysis/AliFMDAnalysisTaskDndeta.cxx \ analysis/AliFMDAnalysisTaskSE.cxx \ - analysis/AliFMDAnalysisTaskGenerateBackground.cxx + analysis/AliFMDAnalysisTaskGenerateCorrection.cxx HDRS = $(SRCS:.cxx=.h) -EINCLUDE := ANALYSIS +EINCLUDE := ANALYSIS PWG0 #ELIBS := ANALYSIS #ELIBSDIR := $(ALICE_ROOT)/lib/tgt_$(ALICE_TARGET) DHDR := analysis/FMDanalysisLinkDef.h