#include "AliMultiplicity.h"
#include <TROOT.h>
#include <TFile.h>
+#include <TError.h>
#include <iostream>
#include <iomanip>
DefineOutput(1, TList::Class());
}
//____________________________________________________________________
-void AliCentralMultiplicityTask::UserCreateOutputObjects() {
+void AliCentralMultiplicityTask::UserCreateOutputObjects()
+{
AliAnalysisManager* am = AliAnalysisManager::GetAnalysisManager();
AliAODHandler* ah =
}
//____________________________________________________________________
-void AliCentralMultiplicityTask::UserExec(Option_t* /*option*/) {
+void AliCentralMultiplicityTask::UserExec(Option_t* /*option*/)
+{
AliESDInputHandler* eventHandler =
dynamic_cast<AliESDInputHandler*> (AliAnalysisManager::GetAnalysisManager()
vertex->GetXYZ(vertexXYZ);
if(TMath::Abs(vertexXYZ[2]) > 10) return;
- Double_t delta = 2 ;
+ Double_t delta = 2 ;
Double_t vertexBinDouble = (vertexXYZ[2] + 10) / delta;
- Int_t vtxbin = (Int_t)vertexBinDouble +1 ; //HHD: The vtxbins are 1-10, not 0-9
+ //HHD: The vtxbins are 1-10, not 0-9
+ Int_t vtxbin = Int_t(vertexBinDouble + 1) ;
// Make sure AOD is filled
AliAnalysisManager* am = AliAnalysisManager::GetAnalysisManager();
const AliMultiplicity* spdmult = esd->GetMultiplicity();
//Filling clusters in layer 1 used for tracklets...
- for(Int_t j = 0; j< spdmult->GetNumberOfTracklets();j++) {
+ for(Int_t j = 0; j< spdmult->GetNumberOfTracklets();j++)
aodHist->Fill(spdmult->GetEta(j),spdmult->GetPhi(j));
- }
+
//...and then the unused ones in layer 1
- for(Int_t j = 0; j< spdmult->GetNumberOfSingleClusters();j++) {
+ for(Int_t j = 0; j< spdmult->GetNumberOfSingleClusters();j++)
aodHist->Fill(-TMath::Log(TMath::Tan(spdmult->GetThetaSingle(j)/2.)),
- spdmult->GetPhiSingle(j));
- }
+ spdmult->GetPhiSingle(j));
- // Corrections
+ // Corrections
TH2D* hSecMap = fManager.GetSecMapCorrection(vtxbin);
TH1D* hAcceptance = fManager.GetAcceptanceCorrection(vtxbin);
Float_t aodnew = aodvalue / acccor ;
aodHist->SetBinContent(nx,ny, aodnew);
- Float_t error = aodnew*TMath::Sqrt(TMath::Power(aodHist->GetBinError(nx,ny)/aodvalue,2) +
- TMath::Power(hAcceptance->GetBinError(nx)/acccor,2) );
+ Float_t aodErr = aodHist->GetBinError(nx,ny);
+ Float_t accErr = hAcceptance->GetBinError(nx);
+ Float_t error = aodnew *TMath::Sqrt(TMath::Power(aodErr/aodvalue,2) +
+ TMath::Power(accErr/acccor,2) );
aodHist->SetBinError(nx,ny,error);
}
//Filling underflow bin if we eta bin is in range
if(etabinSeen) aodHist->SetBinContent(nx,0, 1.);
-
}
PostData(1,fList);
-
}
//____________________________________________________________________
-void AliCentralMultiplicityTask::Terminate(Option_t* /*option*/) {
-
-
-
+void AliCentralMultiplicityTask::Terminate(Option_t* /*option*/)
+{
}
//____________________________________________________________________
void
AliCentralMultiplicityTask::Print(Option_t* /*option*/) const
{
-
}
-//____________________________________________________________________
+//====================================================================
AliCentralMultiplicityTask::Manager::Manager() :
fAcceptancePath("$ALICE_ROOT/PWG2/FORWARD/corrections/CentralAcceptance"),
fSecMapPath("$ALICE_ROOT/PWG2/FORWARD/corrections/CentralSecMap"),
}
//____________________________________________________________________
-const char* AliCentralMultiplicityTask::Manager::GetFileName(UShort_t what ,
- UShort_t sys,
- UShort_t sNN,
- Short_t field) {
-
- TString fname = "";
+AliCentralMultiplicityTask::Manager::Manager(const Manager& o)
+ :fAcceptancePath(o.fAcceptancePath),
+ fSecMapPath(o.fSecMapPath),
+ fAcceptance(o.fAcceptance),
+ fSecmap(o.fSecmap),
+ fAcceptanceName(o.fAcceptanceName),
+ fSecMapName(o.fSecMapName)
+{}
+//____________________________________________________________________
+AliCentralMultiplicityTask::Manager&
+AliCentralMultiplicityTask::Manager::operator=(const Manager& o)
+{
+ fAcceptancePath = o.fAcceptancePath;
+ fSecMapPath = o.fSecMapPath;
+ fAcceptance = o.fAcceptance;
+ fSecmap = o.fSecmap;
+ fAcceptanceName = o.fAcceptanceName;
+ fSecMapName = o.fSecMapName;
+ return *this;
+}
+
+//____________________________________________________________________
+const char*
+AliCentralMultiplicityTask::Manager::GetFullFileName(UShort_t what,
+ UShort_t sys,
+ UShort_t sNN,
+ Short_t field) const
+{
+ return Form("%s/%s",
+ what == 0 ? GetSecMapPath() : GetAcceptancePath(),
+ GetFileName(what, sys, sNN, field));
+}
+
+//____________________________________________________________________
+const char*
+AliCentralMultiplicityTask::Manager::GetFileName(UShort_t what ,
+ UShort_t sys,
+ UShort_t sNN,
+ Short_t field) const
+{
+ // Must be static - otherwise the data may disappear on return from
+ // this member function
+ static TString fname = "";
switch(what) {
- case 0:
- fname.Append(fSecMapName.Data());
- break;
- case 1:
- fname.Append(fAcceptanceName.Data());
- break;
+ case 0: fname.Append(fSecMapName.Data()); break;
+ case 1: fname.Append(fAcceptanceName.Data()); break;
default:
- printf("Invalid indentifier for central object, must be 0 or 1!");
+ ::Error("GetFileName",
+ "Invalid indentifier %d for central object, must be 0 or 1!", what);
break;
}
fname.Append(Form("_%s_%04dGeV_%c%1dkG.root",
sNN, (field < 0 ? 'm' : 'p'), TMath::Abs(field)));
return fname.Data();
-
}
+
//____________________________________________________________________
-void AliCentralMultiplicityTask::Manager::Init( UShort_t sys,
- UShort_t sNN,
- Short_t field) {
-
+TH2D*
+AliCentralMultiplicityTask::Manager::GetSecMapCorrection(UShort_t vtxbin) const
+{
+ if (!fSecmap) {
+ ::Warning("GetSecMapCorrection","No secondary map defined");
+ return 0;
+ }
+ return fSecmap->GetCorrection(vtxbin);
+}
+//____________________________________________________________________
+TH1D*
+AliCentralMultiplicityTask::Manager::GetAcceptanceCorrection(UShort_t vtxbin)
+ const
+{
+ if (!fAcceptance) {
+ ::Warning("GetAcceptanceCorrection","No acceptance map defined");
+ return 0;
+ }
+ return fAcceptance->GetCorrection(vtxbin);
+}
+
+//____________________________________________________________________
+void
+AliCentralMultiplicityTask::Manager::Init(UShort_t sys,
+ UShort_t sNN,
+ Short_t field)
+{
TFile fsec(GetFullFileName(0,sys,sNN,field));
- fSecmap = dynamic_cast<AliCentralCorrSecondaryMap*>(fsec.Get(fSecMapName.Data()));
+ fSecmap =
+ dynamic_cast<AliCentralCorrSecondaryMap*>(fsec.Get(fSecMapName.Data()));
if(!fSecmap) {
- printf("no central Secondary Map found!") ;
+ ::Error("Init", "no central Secondary Map found!") ;
return;
}
TFile facc(GetFullFileName(1,sys,sNN,field));
- fAcceptance = dynamic_cast<AliCentralCorrAcceptance*>(facc.Get(fAcceptanceName.Data()));
-if(!fAcceptance) {
- printf("no central Acceptance found!") ;
- return;
- }
+ fAcceptance =
+ dynamic_cast<AliCentralCorrAcceptance*>(facc.Get(fAcceptanceName.Data()));
+ if(!fAcceptance) {
+ ::Error("Init", "no central Acceptance found!") ;
+ return;
+ }
}
//
fAODCentral(),
fManager()
{
-
}
/**
* Copy constructor
fAODCentral(o.fAODCentral),
fManager(o.fManager)
{
-
+ DefineOutput(1, TList::Class());
}
/**
* Assignment operator
fAODCentral = o.fAODCentral;
fManager = o.fManager;
+
+ DefineOutput(1, TList::Class());
+
return *this;
}
/**
* @param option Not used
*/
virtual void Print(Option_t* option="") const;
- /**
- * Set Path for acceptance
- *
- * @param path
- */
- void SetAcceptancePath(const char* path) {fManager.SetAcceptancePath(path); }
- /**
- * Set Path for Secondary Map
+
+ //__________________________________________________________________
+ /**
+ * Manager of corrections
+ *
+ * This is a small class to fetch corrections for secondaries and
+ * dead channels.
*
- * @param path
*/
-
- void SetSecMapPath(const char* path) {fManager.SetSecMapPath(path); }
-
- char* GetFullFileName(UShort_t what ,
- UShort_t sys,
- UShort_t sNN,
- Short_t field) {return fManager.GetFullFileName(what ,sys, sNN, field); }
-
- const char* GetAcceptanceName() {return fManager.GetAcceptanceName(); }
- const char* GetSecMapName() {return fManager.GetSecMapName(); }
-
-
- class Manager {
-
- // This is a small class to fetch corrections for secondaries and dead
- // channels.
-
+ class Manager
+ {
public:
+ /**
+ * Constructor
+ *
+ */
Manager();
- Manager(const Manager& o) :
- fAcceptancePath(o.fAcceptancePath),
- fSecMapPath(o.fSecMapPath),
- fAcceptance(o.fAcceptance),
- fSecmap(o.fSecmap),
- fAcceptanceName(o.fAcceptanceName),
- fSecMapName(o.fSecMapName) {}
-
- /**
- * Assignment operator
- *
- * @param o Object to assign from
- *
- * @return Reference to this object
- */
- Manager& operator=(const Manager& o)
- {
- fAcceptancePath = o.fAcceptancePath;
- fSecMapPath = o.fSecMapPath;
- fAcceptance = o.fAcceptance;
- fSecmap = o.fSecmap;
- fAcceptanceName = o.fAcceptanceName;
- fSecMapName = o.fSecMapName;
- return *this;
- }
-
- void Init(UShort_t sys,
- UShort_t sNN,
- Short_t field);
- const char* GetAcceptancePath() {return fAcceptancePath.Data(); }
- const char* GetSecMapPath() {return fSecMapPath.Data(); }
- void SetAcceptancePath(const char* path) {fAcceptancePath=path; }
- void SetSecMapPath(const char* path) {fSecMapPath=path; }
- char* GetFullFileName(UShort_t what ,
- UShort_t sys,
- UShort_t sNN,
- Short_t field) {return Form("%s/%s",
-what == 0 ? GetSecMapPath() : GetAcceptancePath(), GetFileName(what, sys, sNN, field));}
- const char* GetAcceptanceName() {return fAcceptanceName.Data(); }
- const char* GetSecMapName() {return fSecMapName.Data(); }
+ /**
+ * Copy constructor
+ *
+ * @param o
+ */
+ Manager(const Manager& o);
+ /**
+ * Destructor
+ */
+ virtual ~Manager() {}
+ /**
+ * Assignment operator
+ *
+ * @param o Object to assign from
+ *
+ * @return Reference to this object
+ */
+ Manager& operator=(const Manager& o);
- TH2D* GetSecMapCorrection(UShort_t vtxbin) {return fSecmap->GetCorrection(vtxbin);}
- TH1D* GetAcceptanceCorrection(UShort_t vtxbin) {return fAcceptance->GetCorrection(vtxbin);}
+ /**
+ * Initialize
+ *
+ * @param sys Collision system (1: pp, 2: PbPb)
+ * @param sNN Center of mass energy per nucleon pair [GeV]
+ * @param field Magnetic field [kG]
+ */
+ void Init(UShort_t sys, UShort_t sNN, Short_t field);
+ /**
+ * Get the acceptance path
+ *
+ * @return
+ */
+ const char* GetAcceptancePath() const {return fAcceptancePath.Data(); }
+ /**
+ * Get the secondary path
+ *
+ * @return
+ */
+ const char* GetSecMapPath() const {return fSecMapPath.Data(); }
+ /**
+ * Set the path to the acceptance maps
+ *
+ * @param path PAth to object file
+ */
+ void SetAcceptancePath(const char* path) {fAcceptancePath=path; }
+ /**
+ * Set the path to the secondary maps
+ *
+ * @param path Path to object files
+ */
+ void SetSecMapPath(const char* path) {fSecMapPath=path; }
+ /**
+ * Get full path name to object file
+ *
+ * @param what What to get
+ * @param sys Collision system
+ * @param sNN Center of mass energy
+ * @param field Magnetic field
+ *
+ * @return
+ */
+ const char* GetFullFileName(UShort_t what, UShort_t sys, UShort_t sNN,
+ Short_t field) const;
+ /**
+ * Get the acceptance object name
+ *
+ * @return
+ */
+ const char* GetAcceptanceName() const {return fAcceptanceName.Data(); }
+ /**
+ * Get the secondary object name
+ *
+ * @return
+ */
+ const char* GetSecMapName() const {return fSecMapName.Data(); }
+ /**
+ * Get the secondary map
+ *
+ * @param vtxbin
+ *
+ * @return
+ */
+ TH2D* GetSecMapCorrection(UShort_t vtxbin) const;
+ /**
+ * Get the acceptance correction
+ *
+ * @param vtxbin
+ *
+ * @return
+ */
+ TH1D* GetAcceptanceCorrection(UShort_t vtxbin) const;
private:
+ /**
+ * Get the full path name
+ *
+ * @param what What to get
+ * @param sys Collision system
+ * @param sNN Center of mass energy
+ * @param field Magnetic field
+ *
+ * @return
+ */
+ const char* GetFileName(UShort_t what, UShort_t sys, UShort_t sNN,
+ Short_t field) const;
- const char* GetFileName(UShort_t what ,
- UShort_t sys,
- UShort_t sNN,
- Short_t field);
-
-
- TString fAcceptancePath;
- TString fSecMapPath;
- AliCentralCorrAcceptance* fAcceptance;
- AliCentralCorrSecondaryMap* fSecmap;
- TString fAcceptanceName;
- TString fSecMapName;
+ TString fAcceptancePath; // Path to acceptance
+ TString fSecMapPath; // Path to secondary map
+ AliCentralCorrAcceptance* fAcceptance; // Acceptance
+ AliCentralCorrSecondaryMap* fSecmap; // Secindary map
+ TString fAcceptanceName; // Acceptance name
+ TString fSecMapName; // Secindary name
+ ClassDef(Manager,1); // Manager of data
};
+ /**
+ * Get a reference to the manager
+ *
+ * @return Reference to corrections manager
+ */
+ Manager& GetManager() { return fManager; }
+ /**
+ * Get a reference to the manager
+ *
+ * @return Reference to corrections manager
+ */
+ const Manager& GetManager() const { return fManager; }
+
+
protected:
-
-
-private:
TH2D* fData; //sum histogram if needed
TList* fList; //Output List for diagnostics