Fixes to AliFMDMCDensityCalculator - didn't call parent Init.
Provide options for enabling/disabling corrections
task->GetDensityCalculator().SetMaxParticles(2);
// Set the lower multiplicity cut. Overrides setting in energy loss fits.
task->GetDensityCalculator().SetMultCut(0.3);
+ // Whether to use the secondary map correction
+ task->GetCorrections().SetUseSecondaryMap(true);
+ // Whether to use the vertex bias correction
+ task->GetCorrections().SetUseVertexBias(true);
+ // Whether to use the vertex bias correction
+ task->GetCorrections().SetUseAcceptance(true);
// Whether to use the merging efficiency correction
task->GetCorrections().SetUseMergingEfficiency(false);
// Set the number of extra bins (beyond the secondary map border)
AliFMDCorrector::AliFMDCorrector()
: TNamed(),
fRingHistos(),
+ fUseSecondaryMap(true),
+ fUseVertexBias(true),
+ fUseAcceptance(true),
fUseMergingEfficiency(true),
fDebug(0)
{
AliFMDCorrector::AliFMDCorrector(const char* title)
: TNamed("fmdCorrector", title),
fRingHistos(),
+ fUseSecondaryMap(true),
+ fUseVertexBias(true),
+ fUseAcceptance(true),
fUseMergingEfficiency(true),
fDebug(0)
{
AliFMDCorrector::AliFMDCorrector(const AliFMDCorrector& o)
: TNamed(o),
fRingHistos(),
+ fUseSecondaryMap(o.fUseSecondaryMap),
+ fUseVertexBias(o.fUseVertexBias),
+ fUseAcceptance(o.fUseAcceptance),
fUseMergingEfficiency(o.fUseMergingEfficiency),
fDebug(o.fDebug)
{
fDebug = o.fDebug;
fRingHistos.Delete();
+ fUseSecondaryMap = o.fUseSecondaryMap;
+ fUseVertexBias = o.fUseVertexBias;
+ fUseAcceptance = o.fUseAcceptance;
fUseMergingEfficiency = o.fUseMergingEfficiency;
TIter next(&o.fRingHistos);
TObject* obj = 0;
return *this;
}
+//____________________________________________________________________
+void
+AliFMDCorrector::Init(const TAxis&)
+{
+ //
+ // Initialize this object
+ //
+ // Parameters:
+ // etaAxis Eta axis to use
+ //
+ if (!fUseSecondaryMap)
+ AliWarning("Secondary maps not used - BE CAREFUL");
+ if (!fUseVertexBias)
+ AliWarning("Vertex bias not used");
+ if (!fUseAcceptance)
+ AliWarning("Acceptance from dead-channels not used");
+}
+
//____________________________________________________________________
AliFMDCorrector::RingHistos*
AliFMDCorrector::GetRingHistos(UShort_t d, Char_t r) const
//____________________________________________________________________
Bool_t
AliFMDCorrector::Correct(AliForwardUtil::Histos& hists,
- UShort_t vtxbin)
+ UShort_t vtxbin)
{
//
// Do the calculations
Char_t r = (q == 0 ? 'I' : 'O');
TH2D* h = hists.Get(d,r);
RingHistos* rh = GetRingHistos(d,r);
- TH2D* bg = fcm.GetSecondaryMap()->GetCorrection(d, r, uvb);
- TH2D* ef = fcm.GetVertexBias()->GetCorrection(r, uvb);
- TH2D* ac = fcm.GetAcceptance()->GetCorrection(d, r, uvb);
- if (!bg) {
- AliWarning(Form("No secondary correction for FMDM%d%c in vertex bin %d",
- d, r, uvb));
- continue;
+
+ if (fUseSecondaryMap) {
+ TH2D* bg = fcm.GetSecondaryMap()->GetCorrection(d, r, uvb);
+ if (!bg) {
+ AliWarning(Form("No secondary correction for FMDM%d%c in vertex bin %d",
+ d, r, uvb));
+ continue;
+ }
+ // Divide by primary/total ratio
+ h->Divide(bg);
}
- if (!ef) {
- AliWarning(Form("No event %s vertex bias correction in vertex bin %d",
- (r == 'I' || r == 'i' ? "inner" : "outer"), uvb));
- continue;
+ if (fUseVertexBias) {
+ TH2D* ef = fcm.GetVertexBias()->GetCorrection(r, uvb);
+ if (!ef) {
+ AliWarning(Form("No event %s vertex bias correction in vertex bin %d",
+ (r == 'I' || r == 'i' ? "inner" : "outer"), uvb));
+ continue;
+ }
+ // Divide by the event selection efficiency
+ h->Divide(ef);
}
- if (!ac) {
- AliWarning(Form("No acceptance correction for FMD%d%c in vertex bin %d",
+ if (fUseAcceptance) {
+ TH2D* ac = fcm.GetAcceptance()->GetCorrection(d, r, uvb);
+ if (!ac) {
+ AliWarning(Form("No acceptance correction for FMD%d%c in vertex bin %d",
d, r, uvb));
- continue;
+ continue;
+ }
+ // Divide by the acceptance correction
+ h->Divide(ac);
}
- // Divide by primary/total ratio
- h->Divide(bg);
-
- // Divide by the event selection efficiency
- h->Divide(ef);
- // Divide by the acceptance correction
- h->Divide(ac);
+
+
if (fUseMergingEfficiency) {
if (!fcm.GetMergingEfficiency()) {
char ind[gROOT->GetDirLevel()+1];
for (Int_t i = 0; i < gROOT->GetDirLevel(); i++) ind[i] = ' ';
ind[gROOT->GetDirLevel()] = '\0';
- std::cout << ind << "AliFMDCorrector: " << GetName() << std::endl;
+ std::cout << ind << "AliFMDCorrector: " << GetName() << "\n"
+ << std::boolalpha
+ << ind << " Use secondary maps: " << fUseSecondaryMap << "\n"
+ << ind << " Use vertex bias: " << fUseVertexBias << "\n"
+ << ind << " Use acceptance: " << fUseAcceptance << "\n"
+ << ind << " Use merging efficiency: " << fUseMergingEfficiency
+ << std::endl;
}
//====================================================================
*/
AliFMDCorrector& operator=(const AliFMDCorrector&);
/**
+ * Initialize this object
+ *
+ * @param etaAxis Eta axis to use -- not used
+ */
+ virtual void Init(const TAxis& etaAxis);
+ /**
* Do the calculations
*
* @param hists Cache of histograms
*/
void SetDebug(Int_t dbg=1) { fDebug = dbg; }
/**
+ * @{
+ * @name Enable/disable parts of the corrections
+ */
+ /**
+ * Whether to do correction for secondaries
+ *
+ * @param use If true, use the secondary correction
+ */
+ void SetUseSecondaryMap(Bool_t use=true) { fUseSecondaryMap = use; }
+ /**
+ * Check
+ *
+ * @return true if the correction for secondaries is done
+ */
+ Bool_t IsUseSecondaryMap() const { return fUseSecondaryMap; }
+ /**
+ * Whether to do correction for vertex bias
+ *
+ * @param use If true, use the vertex bias correction
+ */
+ void SetUseVertexBias(Bool_t use=true) { fUseVertexBias = use; }
+ /**
+ * Check
+ *
+ * @return true if the correction for vertex bias is done
+ */
+ Bool_t IsUseVertexBias() const { return fUseVertexBias; }
+ /**
+ * Whether to do correction for dead-channel acceptance
+ *
+ * @param use If true, use the dead-channel acceptance correction
+ */
+ void SetUseAcceptance(Bool_t use=true) { fUseAcceptance = use; }
+ /**
+ * Check
+ *
+ * @return true if the correction for dead-channel acceptance is done
+ */
+ Bool_t IsUseAcceptance() const { return fUseAcceptance; }
+ /**
* Whether to use the merging efficiency correction
- *
+ *
* @param use If true, use the merging efficiency correction
*/
void SetUseMergingEfficiency(Bool_t use=true) { fUseMergingEfficiency = use; }
- /**
- * Check
- *
+ /**
+ * Check
+ *
* @return true if the merging efficiency correction is used.
*/
Bool_t IsUseMergingEfficiency() const { return fUseMergingEfficiency; }
- /**
+ /* @} */
+
+ /**
* Print information
*
* @param option Not used
RingHistos* GetRingHistos(UShort_t d, Char_t r) const;
TList fRingHistos; // List of histogram containers
+ Bool_t fUseSecondaryMap; // Whether to do correction for secondaries
+ Bool_t fUseVertexBias; // Whether to do correction for vertex bias
+ Bool_t fUseAcceptance; // Whether to do correction for dead ch's.
Bool_t fUseMergingEfficiency; // Whether to use the merging efficiency
Int_t fDebug; // Debug level
- ClassDef(AliFMDCorrector,2); // Calculate Nch density
+ ClassDef(AliFMDCorrector,2); // Correct the inclusive d2N/detadphi
};
#endif
#include <TH2D.h>
#include <TROOT.h>
#include <TProfile2D.h>
-#include <iostream>
-#include <iomanip>
ClassImp(AliFMDMCCorrector)
#if 0
for (UShort_t q=0; q<nr; q++) {
Char_t r = (q == 0 ? 'I' : 'O');
TH2D* h = hists.Get(d,r);
- TH2D* bg = fcm.GetSecondaryMap()->GetCorrection(d,r,uvb);
- TH2D* ef = fcm.GetVertexBias()->GetCorrection(r, uvb);
- if (!bg) {
- AliWarning(Form("No secondary correction for FMDM%d%c in vertex bin %d",
- d, r, uvb));
- continue;
+
+
+ if (fUseSecondaryMap) {
+ TH2D* bg = fcm.GetSecondaryMap()->GetCorrection(d,r,uvb);
+ if (!bg) {
+ AliWarning(Form("No secondary correction for FMDM%d%c in vertex bin %d",
+ d, r, uvb));
+ continue;
+ }
+ // Divide by primary/total ratio
+ h->Divide(bg);
}
- if (!ef) {
- AliWarning(Form("No event vertex bias correction in vertex bin %d",
+ if (fUseVertexBias) {
+ TH2D* ef = fcm.GetVertexBias()->GetCorrection(r, uvb);
+ if (!ef) {
+ AliWarning(Form("No event vertex bias correction in vertex bin %d",
uvb));
- continue;
+ continue;
+ }
+ // Divide by the event selection efficiency
+ h->Divide(ef);
}
-
- // Divide by primary/total ratio
- h->Divide(bg);
-
- // Divide by the event selection efficiency
- h->Divide(ef);
}
}
// Parameters:
// etaAxis Eta axis to use
//
+ AliFMDCorrector::Init(eAxis);
+
fFMD1i = Make(1,'I',eAxis);
fFMD2i = Make(2,'I',eAxis);
fFMD2o = Make(2,'O',eAxis);
// Parameters:
// etaAxis Eta axis to use
//
+ AliFMDDensityCalculator::Init(eAxis);
fFMD1i = Make(1,'I',eAxis);
fFMD2i = Make(2,'I',eAxis);
fFMD2o = Make(2,'O',eAxis);
return;
}
- UInt_t triggers;
- Bool_t gotTrigggers;
- Bool_t gotInel;
- Double_t vZ;
- Bool_t gotVertex;
+ // UInt_t triggers;
+ // Bool_t gotTrigggers = false;
+ Bool_t gotInel = false;
+ // Double_t vZ;
+ Bool_t gotVertex = false;
#if 0
// Use event inspector instead
// Get the triggers
// Get event counts
Int_t nEventsAll = eventsAll->GetBinContent(v);
Int_t nEventsTr = eventsTr->GetBinContent(v);
- Int_t nEventsVtx = eventsVtx->GetBinContent(v);
- Int_t nEventsTrVtx = eventsTrVtx->GetBinContent(v);
+ // Int_t nEventsVtx = eventsVtx->GetBinContent(v);
+ // Int_t nEventsTrVtx = eventsTrVtx->GetBinContent(v);
// Project event histograms, set names, and store
TH2D* primIAllV = GetVertexProj(v, primIAll);
#include <TDirectory.h>
#include <TTree.h>
#include <TROOT.h>
-#include <iostream>
-#include <iomanip>
//====================================================================
AliForwardMCMultiplicityTask::AliForwardMCMultiplicityTask()
// Initialise the sub objects and stuff. Called on first event
//
//
- UInt_t what = AliForwardCorrectionManager::kAll;
- if (!fEnableLowFlux)
- what ^= AliForwardCorrectionManager::kDoubleHit;
- if (!fCorrections.IsUseMergingEfficiency())
- what ^= AliForwardCorrectionManager::kMergingEfficiency;
-
- AliForwardCorrectionManager& fcm = AliForwardCorrectionManager::Instance();
- fcm.Init(fEventInspector.GetCollisionSystem(),
- fEventInspector.GetEnergy(),
- fEventInspector.GetField(),
- true,
- what);
- if (!CheckCorrections(what)) return;
-
- const TAxis* pe = fcm.GetEtaAxis();
- const TAxis* pv = fcm.GetVertexAxis();
- if (!pe) AliFatal("No eta axis defined");
- if (!pv) AliFatal("No vertex axis defined");
+ const TAxis* pe = 0;
+ const TAxis* pv = 0;
+
+ if (!ReadCorrections(pe,pv)) return;
fHistos.Init(*pe);
fAODFMD.Init(*pe);
//
// Get the input data
- AliESDEvent* esd = dynamic_cast<AliESDEvent*>(InputEvent());
- if (!esd) {
- AliWarning("No ESD event found for input event");
- return;
- }
+ AliESDEvent* esd = GetESDEvent();
- // On the first event, initialize the parameters
- if (fFirstEvent && esd->GetESDRun()) {
- fEventInspector.ReadRunDetails(esd);
-
- AliInfo(Form("Initializing with parameters from the ESD:\n"
- " AliESDEvent::GetBeamEnergy() ->%f\n"
- " AliESDEvent::GetBeamType() ->%s\n"
- " AliESDEvent::GetCurrentL3() ->%f\n"
- " AliESDEvent::GetMagneticField()->%f\n"
- " AliESDEvent::GetRunNumber() ->%d\n",
- esd->GetBeamEnergy(),
- esd->GetBeamType(),
- esd->GetCurrentL3(),
- esd->GetMagneticField(),
- esd->GetRunNumber()));
-
- fFirstEvent = false;
-
- InitializeSubs();
- }
// Clear stuff
fHistos.Clear();
fESDFMD.Clear();
#include "AliFMDDensityCalculator.h"
#include "AliFMDCorrector.h"
#include "AliFMDHistCollector.h"
+#include "AliESDEvent.h"
#include <TROOT.h>
-#include <iostream>
-#include <iomanip>
+
//====================================================================
Bool_t
}
return true;
}
+//____________________________________________________________________
+Bool_t
+AliForwardMultiplicityBase::ReadCorrections(const TAxis*& pe, const TAxis*& pv)
+{
+ UInt_t what = AliForwardCorrectionManager::kAll;
+ if (!fEnableLowFlux)
+ what ^= AliForwardCorrectionManager::kDoubleHit;
+ if (!GetCorrections().IsUseSecondaryMap()) {
+ what ^= AliForwardCorrectionManager::kSecondaryMap;
+ // Need to make eta and vertex axis here since we don't read
+ // that from the secondary correction objects
+ pe = new TAxis(200, -4, 6);
+ pv = new TAxis(10, -10, 10);
+ }
+ if (!GetCorrections().IsUseVertexBias())
+ what ^= AliForwardCorrectionManager::kVertexBias;
+ if (!GetCorrections().IsUseAcceptance())
+ what ^= AliForwardCorrectionManager::kAcceptance;
+ if (!GetCorrections().IsUseMergingEfficiency())
+ what ^= AliForwardCorrectionManager::kMergingEfficiency;
+
+ AliForwardCorrectionManager& fcm = AliForwardCorrectionManager::Instance();
+ if (!fcm.Init(GetEventInspector().GetCollisionSystem(),
+ GetEventInspector().GetEnergy(),
+ GetEventInspector().GetField(),
+ false,
+ what)) return false;
+ if (!CheckCorrections(what)) return false;
+
+ // Get the eta axis from the secondary maps - if read in
+ if (!pe) {
+ pe = fcm.GetEtaAxis();
+ if (!pe) AliFatal("No eta axis defined");
+ }
+ // Get the vertex axis from the secondary maps - if read in
+ if (!pv) {
+ pv = fcm.GetVertexAxis();
+ if (!pv) AliFatal("No vertex axis defined");
+ }
+
+ return true;
+}
+//____________________________________________________________________
+AliESDEvent*
+AliForwardMultiplicityBase::GetESDEvent()
+{
+ AliESDEvent* esd = dynamic_cast<AliESDEvent*>(InputEvent());
+ if (!esd) {
+ AliWarning("No ESD event found for input event");
+ return 0;
+ }
+ // On the first event, initialize the parameters
+ if (fFirstEvent && esd->GetESDRun()) {
+ GetEventInspector().ReadRunDetails(esd);
+
+ AliInfo(Form("Initializing with parameters from the ESD:\n"
+ " AliESDEvent::GetBeamEnergy() ->%f\n"
+ " AliESDEvent::GetBeamType() ->%s\n"
+ " AliESDEvent::GetCurrentL3() ->%f\n"
+ " AliESDEvent::GetMagneticField()->%f\n"
+ " AliESDEvent::GetRunNumber() ->%d\n",
+ esd->GetBeamEnergy(),
+ esd->GetBeamType(),
+ esd->GetCurrentL3(),
+ esd->GetMagneticField(),
+ esd->GetRunNumber()));
+
+ fFirstEvent = false;
+
+ InitializeSubs();
+ }
+ return esd;
+}
//____________________________________________________________________
void
AliForwardMultiplicityBase::MarkEventForStore() const
* @return true if all present, false otherwise
*/
Bool_t CheckCorrections(UInt_t what) const;
+ /**
+ * Read corrections
+ *
+ */
+ virtual Bool_t ReadCorrections(const TAxis*& pe, const TAxis*& pv);
+ /**
+ * Get the ESD event. IF this is the first event, initialise
+ */
+ virtual AliESDEvent* GetESDEvent();
/**
+ * Initialise the sub objects and stuff. Called on first event
+ *
+ */
+ virtual void InitializeSubs() = 0;
+ /**
* Mark this event as one to store in the AOD
*
*/
#include <TDirectory.h>
#include <TTree.h>
#include <TROOT.h>
-#include <iostream>
-#include <iomanip>
+
//====================================================================
AliForwardMultiplicityTask::AliForwardMultiplicityTask()
// Initialise the sub objects and stuff. Called on first event
//
//
- UInt_t what = AliForwardCorrectionManager::kAll;
- if (!fEnableLowFlux)
- what ^= AliForwardCorrectionManager::kDoubleHit;
- if (!fCorrections.IsUseMergingEfficiency())
- what ^= AliForwardCorrectionManager::kMergingEfficiency;
-
- AliForwardCorrectionManager& fcm = AliForwardCorrectionManager::Instance();
- fcm.Init(fEventInspector.GetCollisionSystem(),
- fEventInspector.GetEnergy(),
- fEventInspector.GetField(),
- false,
- what);
- if (!CheckCorrections(what)) return;
-
-
- const TAxis* pe = fcm.GetEtaAxis();
- const TAxis* pv = fcm.GetVertexAxis();
- if (!pe) AliFatal("No eta axis defined");
- if (!pv) AliFatal("No vertex axis defined");
+ const TAxis* pe = 0;
+ const TAxis* pv = 0;
+
+ if (!ReadCorrections(pe,pv)) return;
fHistos.Init(*pe);
fAODFMD.Init(*pe);
fEnergyFitter.Init(*pe);
fEventInspector.Init(*pv);
fDensityCalculator.Init(*pe);
+ fCorrections.Init(*pe);
fHistCollector.Init(*pv);
this->Print();
// static Int_t cnt = 0;
// cnt++;
// Get the input data
- AliESDEvent* esd = dynamic_cast<AliESDEvent*>(InputEvent());
- // AliInfo(Form("Event # %6d (esd=%p)", cnt, esd));
- if (!esd) {
- AliWarning("No ESD event found for input event");
- return;
- }
+ AliESDEvent* esd = GetESDEvent();
- // On the first event, initialize the parameters
- if (fFirstEvent && esd->GetESDRun()) {
- fEventInspector.ReadRunDetails(esd);
-
- AliInfo(Form("Initializing with parameters from the ESD:\n"
- " AliESDEvent::GetBeamEnergy() ->%f\n"
- " AliESDEvent::GetBeamType() ->%s\n"
- " AliESDEvent::GetCurrentL3() ->%f\n"
- " AliESDEvent::GetMagneticField()->%f\n"
- " AliESDEvent::GetRunNumber() ->%d\n",
- esd->GetBeamEnergy(),
- esd->GetBeamType(),
- esd->GetCurrentL3(),
- esd->GetMagneticField(),
- esd->GetRunNumber()));
-
- fFirstEvent = false;
-
- InitializeSubs();
- }
// Clear stuff
fHistos.Clear();
fESDFMD.Clear();