fV0ampl(0)
{
// Constructor
- AliInfo("Constructor AliAnaFwdDetsQA");
// Define input and output slots here
// Input slot #0 works with a TChain
+ AliInfo("Constructor AliAnaFwdDetsQA");
DefineInput(0, TChain::Class());
// Output slot #1 TList
DefineOutput(1, TList::Class());
Double_t xMin, Double_t xMax,
const char* xLabel, const char* yLabel)
{
- // create a histogram
+ // helper method which can be used
+ // in order to create a histogram
TH1F* result = new TH1F(name, title, nBins, xMin, xMax);
result->SetOption("E");
if (xLabel) result->GetXaxis()->SetTitle(xLabel);
TH1F *AliAnaFwdDetsQA::CreateEffHisto(const TH1F* hGen, const TH1F* hRec)
{
- // create an efficiency histogram
+ // helper method which can be used
+ // in order create an efficiency histogram
Int_t nBins = hGen->GetNbinsX();
TH1F* hEff = (TH1F*) hGen->Clone("hEff");
hEff->SetTitle("");
Double_t eff = nRecEff/nGenEff;
hEff->SetBinContent(iBin, 100. * eff);
Double_t error = sqrt(eff*(1.-eff) / nGenEff);
- if (error == 0) error = 0.0001;
+ if (error < 1e-12) error = 0.0001;
hEff->SetBinError(iBin, 100. * error);
}
else {
Bool_t AliAnaFwdDetsQA::FitHisto(TH1* histo, Double_t& res, Double_t& resError)
{
- // fit a gaussian to a histogram
+ // fit a gaussian to
+ // a histogram
static TF1* fitFunc = new TF1("fitFunc", "gaus");
fitFunc->SetLineWidth(2);
fitFunc->SetFillStyle(0);
void AliAnaFwdDetsQA::UserCreateOutputObjects()
{
// Create histograms
- AliInfo("AliAnaFwdDetsQA::UserCreateOutputObjects");
// Create output container
+ AliInfo("AliAnaFwdDetsQA::UserCreateOutputObjects");
fListOfHistos = new TList();
fT0vtxRec = CreateHisto("hT0vtxRec", "Z vertex reconstructed with T0", 100, -25, 25, "Z_{vtx} [cm]", "");
void AliAnaFwdDetsQA::UserExec(Option_t */*option*/)
{
-
+ // The analysis code
+ // goes here
AliMCEvent* mcEvent = MCEvent();
if (!mcEvent) {
Printf("ERROR: Could not retrieve MC event");
}
AliESDEvent* esd = dynamic_cast<AliESDEvent*>(event);
+ if (!esd) {
+ Printf("ERROR: Could not retrieve esd");
+ return;
+ }
const AliESDTZERO* esdT0 = esd->GetESDTZERO();
Double_t t0zvtx = esdT0->GetT0zVertex();
Double_t t0time = esdT0->GetT0();
void AliAnaFwdDetsQA::Terminate(Option_t *)
{
+ // Terminate
+ // Store the output histos
fListOfHistos = dynamic_cast<TList*>(GetOutputData(1));
if (!fListOfHistos) {
Printf("ERROR: fListOfHistos not available");
return;
}
- fT0vtxRec = dynamic_cast<TH1F*>(fListOfHistos->At(0));
- fT0time = dynamic_cast<TH1F*>(fListOfHistos->At(1));
- fT0mult = dynamic_cast<TH1F*>(fListOfHistos->At(2));
- fT0vtxRecGen = dynamic_cast<TH2F*>(fListOfHistos->At(3));
- fT0vtxRes = dynamic_cast<TH1F*>(fListOfHistos->At(4));
-
- fV0a = dynamic_cast<TH1F*>(fListOfHistos->At(5));
- fV0c = dynamic_cast<TH1F*>(fListOfHistos->At(6));
- fV0multA = dynamic_cast<TH1F*>(fListOfHistos->At(7));
- fV0multC = dynamic_cast<TH1F*>(fListOfHistos->At(8));
- fV0multAcorr = dynamic_cast<TH2F*>(fListOfHistos->At(9));
- fV0multCcorr = dynamic_cast<TH2F*>(fListOfHistos->At(10));
- fV0Acorr = dynamic_cast<TH2F*>(fListOfHistos->At(11));
- fV0Ccorr = dynamic_cast<TH2F*>(fListOfHistos->At(12));
-
- fT0ampl = dynamic_cast<TH1F*>(fListOfHistos->At(13));
- fV0ampl = dynamic_cast<TH1F*>(fListOfHistos->At(14));
- fT0time2 = dynamic_cast<TH1F*>(fListOfHistos->At(15));
-
-
- // draw the histograms if not in batch mode
- if (!gROOT->IsBatch()) {
- new TCanvas;
- fT0vtxRec->DrawCopy("E");
- new TCanvas;
- fT0time->DrawCopy("E");
- new TCanvas;
- fT0mult->DrawCopy("E");
- new TCanvas;
- fT0vtxRes->DrawCopy("E");
- new TCanvas;
- fT0vtxRecGen->DrawCopy();
- new TCanvas;
- fV0a->DrawCopy("E");
- new TCanvas;
- fV0c->DrawCopy("E");
- new TCanvas;
- fV0multA->DrawCopy("E");
- new TCanvas;
- fV0multC->DrawCopy("E");
- new TCanvas;
- fV0multAcorr->DrawCopy();
- new TCanvas;
- fV0multCcorr->DrawCopy();
- new TCanvas;
- fV0Acorr->DrawCopy();
- new TCanvas;
- fV0Ccorr->DrawCopy();
- new TCanvas;
- fT0ampl->DrawCopy("E");
- new TCanvas;
- fV0ampl->DrawCopy("E");
- new TCanvas;
- fT0time2->DrawCopy("E");
- }
-
- // write the output histograms to a file
- TFile* outputFile = TFile::Open("FwdDetsQA.root", "recreate");
- if (!outputFile || !outputFile->IsOpen())
- {
- Error("AliAnaFwdDetsQA", "opening output file FwdDetsQA.root failed");
- return;
- }
- fT0vtxRec->Write();
- fT0time->Write();
- fT0mult->Write();
- fT0vtxRecGen->Write();
- fT0vtxRes->Write();
- fT0ampl->Write();
- fT0time2->Write();
-
- fV0a->Write();
- fV0c->Write();
- fV0multA->Write();
- fV0multC->Write();
- fV0multAcorr->Write();
- fV0multCcorr->Write();
- fV0Acorr->Write();
- fV0Ccorr->Write();
- fV0ampl->Write();
-
- outputFile->Close();
- delete outputFile;
-
//delete esd;
Info("AliAnaFwdDetsQA", "Successfully finished");
}