+++ /dev/null
-#include "TChain.h"
-#include "TTree.h"
-#include "TH1F.h"
-#include "TCanvas.h"
-#include "TList.h"
-#include "TFile.h"
-#include "TParticle.h"
-#include "TParticlePDG.h"
-
-#include "AliESDtrackCuts.h"
-#include "AliPWG0Helper.h"
-#include "AliTriggerAnalysis.h"
-
-#include "AliAnalysisTask.h"
-#include "AliAnalysisManager.h"
-#include "AliESDEvent.h"
-#include "AliESDInputHandler.h"
-#include "AliESDVertex.h"
-
-#include "AliMCEventHandler.h"
-#include "AliMCEvent.h"
-#include "AliStack.h"
-#include "AliLog.h"
-
-#include "AliCutTask.h"
-
-// simple task that runs the esd track cuts to evaluate the basic plots created during the cuts
-
-ClassImp(AliCutTask)
-
-//________________________________________________________________________
-AliCutTask::AliCutTask(const char *name) :
- AliAnalysisTask(name, ""), fESD(0), fTrackCuts(0),
- fAnalysisMode(AliPWG0Helper::kTPCITS),
- fTrackCutsPrimaries(0),
- fTrackCutsSecondaries(0), fVertex(0), fTriggerStats(0), fOutput(0),
- fPrimStats(0)
-{
- // Constructor
-
- // Define input and output slots here
- DefineInput(0, TChain::Class());
- DefineOutput(0, TList::Class());
-}
-
-//________________________________________________________________________
-void AliCutTask::ConnectInputData(Option_t *)
-{
- // Connect ESD or AOD here
- // Called once
-
- TTree* tree = dynamic_cast<TTree*> (GetInputData(0));
- if (!tree) {
- Printf("ERROR: Could not read chain from input slot 0");
- } else {
- // Disable all branches and enable only the needed ones
- //tree->SetBranchStatus("*", kFALSE);
-
- // old esd
- tree->SetBranchStatus("fTriggerMask", kTRUE);
- tree->SetBranchStatus("fTracks.*", kTRUE);
- tree->SetBranchStatus("fSPDVertex*", kTRUE);
-
- // new esd
- tree->SetBranchStatus("TriggerMask", kTRUE);
- tree->SetBranchStatus("AliESDHeader", kTRUE);
- //AliPWG0Helper::SetBranchStatusRecursive(tree, "Tracks", kTRUE);
- //AliPWG0Helper::SetBranchStatusRecursive(tree, "SPDVertex", kTRUE);
-
- AliESDInputHandler *esdH = dynamic_cast<AliESDInputHandler*> (AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler());
-
- if (!esdH) {
- Printf("ERROR: Could not get ESDInputHandler");
- } else
- fESD = esdH->GetEvent();
- }
-}
-
-//________________________________________________________________________
-void AliCutTask::CreateOutputObjects()
-{
- // Create histograms
- // Called once
-
- fOutput = new TList;
- fOutput->SetOwner();
-
- fOutput->Add(fTrackCuts);
- if (fTrackCutsPrimaries)
- fOutput->Add(fTrackCutsPrimaries);
- if (fTrackCutsSecondaries)
- fOutput->Add(fTrackCutsSecondaries);
-
- fVertex = new TH1F("fVertex", "fVertex;z vtx (cm);Count", 201, -20, 20);
- fOutput->Add(fVertex);
-
- fTriggerStats = new TH1F("fTriggerStats", "fTriggerStats;trigger;Count", 5, -0.5, 4.5);
- fTriggerStats->GetXaxis()->SetBinLabel(1, "!MB1 & !MB2");
- fTriggerStats->GetXaxis()->SetBinLabel(2, "MB1");
- fTriggerStats->GetXaxis()->SetBinLabel(3, "MB2");
- fTriggerStats->GetXaxis()->SetBinLabel(4, "ITS_SPD_GFO_L0");
- fTriggerStats->GetXaxis()->SetBinLabel(5, "VZERO_OR_LEFT | VZERO_OR_RIGHT");
- fOutput->Add(fTriggerStats);
-
- fPrimStats = new TH1F("fPrimStats", "fPrimStats", 8, 0.5, 8.5);
- fPrimStats->GetXaxis()->SetBinLabel(1, "Primary accepted once");
- fPrimStats->GetXaxis()->SetBinLabel(2, "Primary accepted more than once");
- fPrimStats->GetXaxis()->SetBinLabel(3, "Primary accepted more than once (count)");
- fPrimStats->GetXaxis()->SetBinLabel(4, "Primary track rejected");
- fPrimStats->GetXaxis()->SetBinLabel(5, "Primary track rejected (count)");
- fPrimStats->GetXaxis()->SetBinLabel(6, "Primary track rejected, but other track accepted");
- fPrimStats->GetXaxis()->SetBinLabel(7, "Primary track rejected, but other track accepted (count)");
- fOutput->Add(fPrimStats);
-
- // disable info messages of AliMCEvent (per event)
- AliLog::SetClassDebugLevel("AliMCEvent", AliLog::kWarning - AliLog::kDebug + 1);
-}
-
-//________________________________________________________________________
-void AliCutTask::Exec(Option_t *)
-{
- // Main loop
- // Called for each event
-
- if (!fESD) {
- Printf("ERROR: fESD not available");
- return;
- }
-
- // Post output data.
- PostData(0, fOutput);
-
- //fESD->GetVertex()->Print();
-
- static AliTriggerAnalysis* triggerAnalysis = new AliTriggerAnalysis;
-
- if (!triggerAnalysis->IsTriggerFired(fESD, AliTriggerAnalysis::kMB1) && !triggerAnalysis->IsTriggerFired(fESD, AliTriggerAnalysis::kMB2))
- fTriggerStats->Fill(0);
-
- if (triggerAnalysis->IsTriggerFired(fESD, AliTriggerAnalysis::kMB1))
- fTriggerStats->Fill(1);
-
- if (triggerAnalysis->IsTriggerFired(fESD, AliTriggerAnalysis::kMB2))
- fTriggerStats->Fill(2);
-
- if (fESD->GetTriggerMask() & (0x1 << 14))
- fTriggerStats->Fill(3);
-
- if (fESD->GetTriggerMask() & 1 || fESD->GetTriggerMask() & 2)
- fTriggerStats->Fill(4);
-
- //if (fESD->GetTriggerMask() & (0x1 << 14) == 0)
- if (!triggerAnalysis->IsTriggerFired(fESD, AliTriggerAnalysis::kMB2))
- return;
-
- // get the ESD vertex
- const AliESDVertex* vtxESD = AliPWG0Helper::GetVertex(fESD, fAnalysisMode);
-
- if (!vtxESD)
- {
- Printf("No vertex. Skipping event");
- return;
- }
-
- Printf("There are %d tracks in this event", fESD->GetNumberOfTracks());
- Int_t acceptedTracks = fTrackCuts->CountAcceptedTracks(fESD);
- Printf("Accepted %d tracks", acceptedTracks);
-
- if (fTrackCutsPrimaries && fTrackCutsSecondaries)
- {
- AliMCEventHandler* eventHandler = dynamic_cast<AliMCEventHandler*> (AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler());
- if (!eventHandler) {
- Printf("ERROR: Could not retrieve MC event handler");
- return;
- }
-
- AliMCEvent* mcEvent = eventHandler->MCEvent();
- if (!mcEvent) {
- Printf("ERROR: Could not retrieve MC event");
- return;
- }
-
- AliStack* stack = mcEvent->Stack();
- if (!stack)
- {
- Printf("ERROR: Stack not available");
- return;
- }
-
- // count if primaries are counted several times
- Int_t max = stack->GetNprimary();
- Int_t* primAcc = new Int_t[max];
- Int_t* primRej = new Int_t[max];
- for (Int_t i=0; i<max; i++)
- {
- primAcc[i] = 0;
- primRej[i] = 0;
- }
-
- for (Int_t trackId = 0; trackId < fESD->GetNumberOfTracks(); trackId++)
- {
- AliESDtrack* track = fESD->GetTrack(trackId);
- if (!track)
- {
- Printf("UNEXPECTED: Could not get track with id %d", trackId);
- continue;
- }
-
- if (track->GetLabel() == 0)
- {
- Printf("Track %d has no label. Skipping", trackId);
- continue;
- }
-
- Int_t label = TMath::Abs(track->GetLabel());
- if (stack->IsPhysicalPrimary(label) == kTRUE)
- {
- if (label >= max)
- {
- Printf("Warning label %d is higher than number of primaries %d", label, max);
- continue;
- }
-
- if (fTrackCutsPrimaries->AcceptTrack(track))
- {
- primAcc[label]++;
- }
- else
- primRej[label]++;
-
- }
- else
- {
- if (!stack->Particle(label)) {
- Printf("ERROR: Could not get particle with label %d", label);
- continue;
- }
-
- // Deuteron is ok, but missing in Pdg particles in root
- if (stack->Particle(label)->GetPdgCode() != 10010020) {
- if (!stack->Particle(label)->GetPDG()) {
- Printf("ERROR: Could not get PDG particle of particle with label %d (pdg code is %d)", label, stack->Particle(label)->GetPdgCode());
- stack->Particle(label)->Print();
- continue;
- }
-
- if (stack->Particle(label)->GetPDG()->Charge() == 0) {
- Printf("Particle %d has 0 charge. Skipping.", label);
- continue;
- }
- }
-
- fTrackCutsSecondaries->AcceptTrack(track);
- }
- }
-
- for (Int_t i=0; i<max; i++) {
- if (primAcc[i] == 1) {
- fPrimStats->Fill(1);
- } else if (primAcc[i] > 1) {
- fPrimStats->Fill(2);
- fPrimStats->Fill(3, primAcc[i]);
- }
-
- if (primRej[i] > 0) {
- if (primAcc[i] == 0) {
- fPrimStats->Fill(4);
- fPrimStats->Fill(5, primRej[i]);
- } else if (primAcc[i] > 0) {
- fPrimStats->Fill(6);
- fPrimStats->Fill(7, primRej[i]);
- }
- }
- }
-
- delete[] primAcc;
- delete[] primRej;
- }
-
- // get the ESD vertex
- fVertex->Fill(vtxESD->GetZv());
-}
-
-//________________________________________________________________________
-void AliCutTask::Terminate(Option_t *)
-{
- // Draw result to the screen
- // Called once at the end of the query
-
- fOutput = dynamic_cast<TList*> (GetOutputData(0));
- if (!fOutput) {
- Printf("ERROR: fOutput not available");
- return;
- }
-
- fTrackCuts = dynamic_cast<AliESDtrackCuts*> (fOutput->FindObject("AliESDtrackCuts"));
- if (!fTrackCuts) {
- Printf("ERROR: fTrackCuts not available");
- return;
- }
-
- fVertex = dynamic_cast<TH1F*> (fOutput->FindObject("fVertex"));
- if (!fVertex) {
- Printf("ERROR: fVertex not available");
- return;
- }
-
- fTriggerStats = dynamic_cast<TH1F*> (fOutput->FindObject("fTriggerStats"));
- if (!fTriggerStats) {
- Printf("ERROR: fTriggerStats not available");
- return;
- }
-
- fTrackCutsPrimaries = dynamic_cast<AliESDtrackCuts*> (fOutput->FindObject("fTrackCutsPrimaries"));
- fTrackCutsSecondaries = dynamic_cast<AliESDtrackCuts*> (fOutput->FindObject("fTrackCutsSecondaries"));
-
- TFile* file = TFile::Open("trackCuts.root", "RECREATE");
-
- fTrackCuts->SaveHistograms();
- fVertex->Write();
- fTriggerStats->Write();
-
- if (fTrackCutsPrimaries)
- fTrackCutsPrimaries->SaveHistograms();
-
- if (fTrackCutsSecondaries)
- fTrackCutsSecondaries->SaveHistograms();
-
- if (fPrimStats)
- fPrimStats->Write();
-
- file->Close();
-
- Printf("Writting results to trackCuts.root.");
-
- fTrackCuts->DrawHistograms();
-
- new TCanvas;
- fVertex->Draw();
-
- new TCanvas;
- fTriggerStats->Draw();
-}
-
-void AliCutTask::EnableSecondaryStudy()
-{
- //
- // clones the fTrackCuts
- //
-
- if (!fTrackCuts) {
- Printf("ERROR: fTrackCuts 0. Do not call this function before SetTrackCuts");
- return;
- }
-
- fTrackCutsPrimaries = dynamic_cast<AliESDtrackCuts*> (fTrackCuts->Clone("fTrackCutsPrimaries"));
- fTrackCutsSecondaries = dynamic_cast<AliESDtrackCuts*> (fTrackCuts->Clone("fTrackCutsSecondaries"));
-}
+++ /dev/null
-#ifndef AliCutTask_cxx
-#define AliCutTask_cxx
-
-// simple task that runs the esd track cuts to evaluate the basic plots created during the cuts
-
-class TH1F;
-class AliESDtrackCuts;
-class AliESDEvent;
-class TList;
-
-#include "AliAnalysisTask.h"
-#include "AliPWG0Helper.h"
-
-class AliCutTask : public AliAnalysisTask {
- public:
- AliCutTask(const char *name = "AliCutTask");
- virtual ~AliCutTask() {}
-
- virtual void ConnectInputData(Option_t *);
- virtual void CreateOutputObjects();
- virtual void Exec(Option_t *option);
- virtual void Terminate(Option_t *);
-
- void SetTrackCuts(AliESDtrackCuts* cuts) { fTrackCuts = cuts; }
- void SetAnalysisMode(AliPWG0Helper::AnalysisMode mode) { fAnalysisMode = mode; }
- void EnableSecondaryStudy();
-
- private:
- AliESDEvent *fESD; //! ESD object
- AliESDtrackCuts* fTrackCuts; // track cuts
- AliPWG0Helper::AnalysisMode fAnalysisMode; // detector that is used for analysis
-
- AliESDtrackCuts* fTrackCutsPrimaries; // cuts for tracks from primary particles
- AliESDtrackCuts* fTrackCutsSecondaries; // cuts for tracks from secondary particles
-
- TH1F* fVertex; //! event z vertex distribution
- TH1F* fTriggerStats; //! triggers
-
- TList* fOutput; //! list send on output slot 0
-
- TH1F* fPrimStats; //! statistics about primaries, see bin names in CreateOutputData
-
- AliCutTask(const AliCutTask&); // not implemented
- AliCutTask& operator=(const AliCutTask&); // not implemented
-
- ClassDef(AliCutTask, 1); // example of analysis
-};
-
-#endif
+++ /dev/null
-void draw()
-{
- //const char* files[] = { "trackCuts_normal.root", "trackCuts_increased.root", "trackCuts_decreased.root" };
- const char* files[] =
- { "Material-normal/trackCuts.root",
- "Material-increased-mcvtx/trackCuts.root",
- "Material-decreased-mcvtx/trackCuts.root" };
- const char* titles[] = { "default geometry", "+ 10% material", "- 10% material" };
- Int_t colors[] = { 1, 2, 4 };
- Int_t markers[] = {24, 25, 26, 27 };
-
- TCanvas* c = new TCanvas;
- TCanvas* c2 = new TCanvas;
-
- TLegend* legend = new TLegend(0.6, 0.5, 0.9, 0.9);
- TLegend* legend2 = new TLegend(0.7, 0.7, 0.9, 0.9);
-
- for (Int_t i=0; i<3; i++) {
- if (!TFile::Open(files[i]))
- return;
-
- TH1* ptPrim = gFile->Get("fTrackCutsPrimaries/before_cuts/pt");
- TH1* ptPrimCut = gFile->Get("fTrackCutsPrimaries/after_cuts/pt_cut");
-
- TH1* ptSec = gFile->Get("fTrackCutsSecondaries/before_cuts/pt");
- TH1* ptSecCut = gFile->Get("fTrackCutsSecondaries/after_cuts/pt_cut");
-
- TH1* vertex = gFile->Get("fVertex");
- Int_t nEvents = vertex->GetEntries();
-
- ptPrim->Add(ptSec);
- ptPrimCut->Add(ptSecCut);
-
- ptPrim->Sumw2();
- ptPrimCut->Sumw2();
- ptSec->Sumw2();
- ptSecCut->Sumw2();
-
- Printf("%s", titles[i]);
- Printf("Total particles: %d", (Int_t) (ptPrim->GetEntries() + ptSec->GetEntries()));
- Printf("Total particles/event: %.2f", (ptPrim->GetEntries() + ptSec->GetEntries()) / nEvents);
- Printf("Primaries/event: %.2f", ptPrim->GetEntries() / nEvents);
- Printf("Secondaries/event: %.2f", ptSec->GetEntries() / nEvents);
- Printf("Primaries > 0.2 GeV/c/event: %.2f", ptPrim->Integral(ptPrim->GetXaxis()->FindBin(0.21), ptPrim->GetNbinsX()) / nEvents);
- Printf("Secondaries > 0.2 GeV/c/event: %.2f", ptSec->Integral(ptSec->GetXaxis()->FindBin(0.21), ptSec->GetNbinsX()) / nEvents);
- Printf("Primaries after cuts > 0.2 GeV/c/event: %.2f +- %.2f", ptPrimCut->Integral(ptPrimCut->GetXaxis()->FindBin(0.21), ptPrimCut->GetNbinsX()) / nEvents, TMath::Sqrt(ptPrimCut->Integral(ptPrimCut->GetXaxis()->FindBin(0.21), ptPrimCut->GetNbinsX())) / nEvents);
- Printf("Secondaries after cuts > 0.2 GeV/c/event: %.2f +- %.2f", ptSecCut->Integral(ptSecCut->GetXaxis()->FindBin(0.21), ptSecCut->GetNbinsX()) / nEvents, TMath::Sqrt(ptSecCut->Integral(ptSecCut->GetXaxis()->FindBin(0.21), ptSecCut->GetNbinsX())) / nEvents);
- Printf("%.2f %% secondaries before cuts", 100.0 * ptSec->GetEntries() / ptPrim->GetEntries());
- Printf("%.2f %% secondaries after cuts", 100.0 * ptSecCut->GetEntries() / ptPrimCut->GetEntries());
- Printf("");
-
- ptPrim->SetLineColor(colors[i]);
- ptPrimCut->SetLineColor(colors[i]);
- ptSec->SetLineColor(colors[i]);
- ptSecCut->SetLineColor(colors[i]);
-
- ptPrim->SetMarkerColor(colors[i]);
- ptPrimCut->SetMarkerColor(colors[i]);
- ptSec->SetMarkerColor(colors[i]);
- ptSecCut->SetMarkerColor(colors[i]);
-
- ptPrim->SetStats(kFALSE);
- ptPrim->SetTitle("");
- ptPrim->GetYaxis()->SetTitle("N");
- ptSec->SetStats(kFALSE);
- ptSec->SetTitle("");
-
- ptPrim->SetMarkerStyle(markers[0]);
- ptPrimCut->SetMarkerStyle(markers[1]);
- ptSec->SetMarkerStyle(markers[2]);
- ptSecCut->SetMarkerStyle(markers[3]);
-
- if (i == 0) {
- legend->AddEntry(ptPrim->Clone(), "Primaries");
- legend->AddEntry(ptPrimCut->Clone(), "Primaries after cuts");
- legend->AddEntry(ptSec->Clone(), "Secondaries");
- legend->AddEntry(ptSecCut->Clone(), "Secondaries after cuts");
- }
-
- ptPrim->GetXaxis()->SetRangeUser(0, 2);
- ptSec->GetXaxis()->SetRangeUser(0, 2);
- //ptPrim->GetYaxis()->SetRangeUser(1e-5, ptSec->GetMaximum() * 1.1);
-
- c->cd();
- ptPrim->DrawCopy((i > 0) ? "SAME" : "");
- ptPrimCut->DrawCopy("SAME");
- ptSec->DrawCopy("SAME");
- ptSecCut->DrawCopy("SAME");
-
- ptSec->Divide(ptSec, ptPrim, 1, 1, "B");
- ptSecCut->Divide(ptSecCut, ptPrimCut, 1, 1, "B");
-
- ptSec->SetMarkerStyle(1);
- ptSecCut->SetMarkerStyle(1);
-
- ptSec->GetYaxis()->SetRangeUser(0, 1);
-
- ptSec->GetYaxis()->SetTitle("N_{Secondaries} / N_{All}");
-
- c2->cd();
- ptSec->DrawCopy((i > 0) ? "SAME" : "");
- ptSecCut->DrawCopy("SAME");
-
- legend->AddEntry(ptSec, titles[i]);
- legend2->AddEntry(ptSec, titles[i]);
- }
-
- c->cd();
- legend->Draw();
- c->SaveAs("changedmaterial_absolute.gif");
-
- c2->cd();
- legend2->Draw();
- c2->SaveAs("changedmaterial_relative.gif");
-}
-
-void drawStats(const char* fileName = "trackCuts.root")
-{
- TFile::Open(fileName);
-
- TH1* stat1 = gFile->Get("fTrackCutsPrimaries/cut_statistics");
- TH1* stat2 = gFile->Get("fTrackCutsSecondaries/cut_statistics");
-
- new TCanvas;
- stat1->Draw();
- stat2->SetLineColor(2);
- stat2->Draw("SAME");
-}
+++ /dev/null
-void printStats(const char* fileName = "trackCuts.root")
-{
- TFile::Open(fileName);
-
- fTriggerStats = (TH1*) gFile->Get("fTriggerStats");
-
- // !MB1 + MB1
- Int_t allEvents = fTriggerStats->GetBinContent(1) + fTriggerStats->GetBinContent(2);
-
- // MB2
- Int_t triggeredEvents = fTriggerStats->GetBinContent(3);
-
- Printf("Triggered %d out of %d events (%.2f %%)", triggeredEvents, allEvents, 100.0 * triggeredEvents / allEvents);
-
- fVertex = (TH1*) gFile->Get("fVertex");
- Int_t eventsVertex = fVertex->GetEntries();
-
- Printf("%d events have a vertex out of %d triggered (%.2f %%)", eventsVertex, triggeredEvents, 100.0 * eventsVertex / triggeredEvents);
-
- fStatsPrim = (TH1*) gFile->Get("fTrackCutsPrimaries/cut_statistics");
-
- Int_t tracksPrim = fStatsPrim->GetBinContent(1);
- Int_t tracksPrimAc = tracksPrim - fStatsPrim->GetBinContent(2);
-
- fStatsSec = (TH1*) gFile->Get("fTrackCutsSecondaries/cut_statistics");
-
- Int_t tracksSec = fStatsSec->GetBinContent(1);
- Int_t tracksSecAc = tracksSec - fStatsSec->GetBinContent(2);
-
- fPrimStats = (TH1*) gFile->Get("fPrimStats");
-
- if (fPrimStats->GetBinContent(5) + fPrimStats->GetBinContent(7) != fStatsPrim->GetBinContent(2))
- Printf("UNEXPECTED: %f != %f", fPrimStats->GetBinContent(5) + fPrimStats->GetBinContent(7), fStatsPrim->GetBinContent(2));
-
- Float_t notLostPrimaries = 100.0 * fPrimStats->GetBinContent(7) / (fPrimStats->GetBinContent(5) + fPrimStats->GetBinContent(7));
-
- Printf("Accepted %d out of %d primary tracks (%.2f %%)", tracksPrimAc, tracksPrim, 100.0 * tracksPrimAc / tracksPrim);
- Printf("Per Event: %.2f out of %.2f", (Float_t) tracksPrimAc / eventsVertex, (Float_t) tracksPrim / eventsVertex);
-
- Printf("Among the non accepted ones %.2f %% are from primaries that have been found with other tracks", notLostPrimaries);
-
- Printf("Accepted %d out of %d secondary tracks (%.2f %%)", tracksSecAc, tracksSec, 100.0 * tracksSecAc / tracksSec);
- Printf("Per Event: %.2f out of %.2f", (Float_t) tracksSecAc / eventsVertex, (Float_t) tracksSec / eventsVertex);
-
- Printf("Before cuts: %.2f %% of the tracks are secondaries", 100.0 * tracksSec / (tracksPrim + tracksSec));
-
- Printf("After cuts: %.2f %% of the tracks are secondaries", 100.0 * tracksSecAc / (tracksPrimAc + tracksSecAc));
-}
-
-void ComparePlots(const char* fileName1, const char* fileName2, const char* dirName1 = "AliESDtrackCuts/before_cuts", const char* dirName2 = 0)
-{
- file1 = TFile::Open(fileName1);
- file2 = TFile::Open(fileName2);
-
- if (!dirName2)
- dirName1 = dirName2;
-
- dir1 = file1->GetDirectory(dirName1);
- dir2 = file2->GetDirectory(dirName2);
-
- keyList = dir1->GetListOfKeys();
- TIter iter(keyList);
-
- TKey* key = 0;
- while ((key = (TKey*) iter())) {
- TH1* hist1 = (TH1*) dir1->Get(key->GetName());
- TH1* hist2 = (TH1*) dir2->Get(key->GetName());
-
- if (hist1->Integral() > 0)
- hist1->Scale(1.0 / hist1->Integral());
- if (hist2->Integral())
- hist2->Scale(1.0 / hist2->Integral());
-
- TString name(key->GetName());
-
- c = new TCanvas(Form("%s_canvas", key->GetName()), key->GetName(), 600, 400);
-
- hist1->Draw();
- hist2->SetLineColor(2);
- hist2->Draw("SAME");
-
- /* this does not work, although given here: http://pcroot.cern.ch/root/html/THistPainter.html ;-)
- TPaveStats *st = (TPaveStats*) hist1->FindObject("stats");
- st->SetTextColor(2);
- st->SetY1NDC(st->GetY1NDC() - 0.2);
- st->SetY2NDC(st->GetY2NDC() - 0.2);
- */
-
- Float_t min = 0.9 * TMath::Min(hist1->GetMinimum(), hist2->GetMinimum());
-
- if (name.Contains("cov") || name.Contains("dXY") || name.Contains("dZ")) {
- min += 1e-6;
- c->cd(1)->SetLogy();
- if (name.Contains("cov"))
- hist1->GetXaxis()->SetRangeUser(0, 5);
- }
-
- hist1->GetYaxis()->SetRangeUser(min, 1.1 * TMath::Max(hist1->GetMaximum(), hist2->GetMaximum()));
-
- c->SaveAs(Form("%s.gif", key->GetName()));
-
- //break;
- }
-}
-
+++ /dev/null
-void run(Char_t* data, Int_t nRuns=20, Int_t offset=0, Bool_t aDebug = kFALSE, Bool_t aProof = kFALSE, Bool_t mc = kFALSE, const char* option = "")
-{
- if (aProof)
- {
- TProof::Open("lxb6046");
-
- // Enable the needed package
- gProof->UploadPackage("STEERBase");
- gProof->EnablePackage("STEERBase");
- gProof->UploadPackage("ESD");
- gProof->EnablePackage("ESD");
- gProof->UploadPackage("AOD");
- gProof->EnablePackage("AOD");
- gProof->UploadPackage("ANALYSIS");
- gProof->EnablePackage("ANALYSIS");
- gProof->UploadPackage("PWG0base");
- gProof->EnablePackage("PWG0base");
- }
- else
- {
- gSystem->Load("libVMC");
- gSystem->Load("libTree");
- gSystem->Load("libSTEERBase");
- gSystem->Load("libESD");
- gSystem->Load("libAOD");
- gSystem->Load("libANALYSIS");
- gSystem->Load("libPWG0base");
- }
-
- // Create chain of input files
- gROOT->LoadMacro("../CreateESDChain.C");
- chain = CreateESDChain(data, nRuns, offset);
-
- // Create the analysis manager
- mgr = new AliAnalysisManager("testAnalysis");
-
- TString taskName("AliCutTask.cxx+");
- if (aDebug)
- taskName += "+g";
-
- // Create, add task
- if (aProof) {
- gProof->Load(taskName);
- } else
- gROOT->Macro(taskName);
-
- task = new AliCutTask;
-
- AliPWG0Helper::AnalysisMode analysisMode = AliPWG0Helper::kTPC;
- task->SetAnalysisMode(analysisMode);
-
- if (analysisMode != AliPWG0Helper::kSPD)
- {
- // selection of esd tracks
- gROOT->ProcessLine(".L ../CreateStandardCuts.C");
- AliESDtrackCuts* esdTrackCuts = CreateTrackCuts(analysisMode);
- if (!esdTrackCuts)
- {
- printf("ERROR: esdTrackCuts could not be created\n");
- return;
- }
-
- task->SetTrackCuts(esdTrackCuts);
- }
-
- mgr->AddTask(task);
-
- // Add ESD handler
- AliESDInputHandler* esdH = new AliESDInputHandler;
- mgr->SetInputEventHandler(esdH);
-
- if (mc) {
- task->EnableSecondaryStudy();
- // Enable MC event handler
- AliMCEventHandler* handler = new AliMCEventHandler;
- handler->SetReadTR(kFALSE);
- mgr->SetMCtruthEventHandler(handler);
- }
-
- // Attach input
- cInput = mgr->GetCommonInputContainer();
- mgr->ConnectInput(task, 0, cInput);
-
- // Attach output
- cOutput = mgr->CreateContainer("cOutput", TList::Class(), AliAnalysisManager::kOutputContainer);
- mgr->ConnectOutput(task, 0, cOutput);
-
- // Enable debug printouts
- if (aDebug)
- mgr->SetDebugLevel(2);
-
- // Run analysis
- mgr->InitAnalysis();
- mgr->PrintStatus();
- mgr->StartAnalysis((aProof) ? "proof" : "local", chain);
-}
+++ /dev/null
-void extrapolateXSection()
-{
- TFile* file2 = TFile::Open("crosssectionEx_10TeV.root", "RECREATE");
-
- c = new TCanvas;
- TH1* base = 0;
-
- for (Int_t fileId = 0; fileId < 2; fileId++)
- {
- if (fileId == 1)
- {
- TFile* file = TFile::Open("out_phojet.root");
- }
- else
- TFile* file = TFile::Open("out_pythia.root");
-
- TH1* xSection2 = dynamic_cast<TH1*> (gFile->Get("fMult"));
- if (!base)
- base = xSection2;
- xSection2->Sumw2();
- xSection2->Scale(1.0 / xSection2->Integral());
- //TH1* xSection15 = dynamic_cast<TH1*> (gFile->Get("xSection15"));
-
- //TH1F* xSection15Ex = new TH1F("xSection15Ex", ";Npart", 1001, -0.5, 1000.5);
-
- TF1* func[3];
- Float_t lowLimit[] = { 150, 175, 200 };
- if (fileId == 1)
- {
- lowLimit[0] = 50;
- lowLimit[1] = 75;
- lowLimit[2] = 100;
- }
-
- c->cd();
- xSection2->Draw((fileId == 0) ? "" : "SAME");
-
- for (Int_t i=0; i<3; i++)
- {
- func[i] = new TF1("func", "[0]*exp([1]*x)", 0, 1000);
- func[i]->SetParameters(1, -1e-4);
-
- xSection2->Fit(func[i], "0", "", lowLimit[i], 250);
- func[i]->SetRange(lowLimit[i], 500);
- func[i]->SetLineColor(i+1);
- func[i]->Draw("SAME");
- gPad->SetLogy();
- }
-
- base->GetXaxis()->SetRangeUser(0, 500);
- base->GetYaxis()->SetRangeUser(func[2]->Eval(500), xSection2->GetMaximum());
-
- for (Int_t j=0; j<3; j++)
- {
- gROOT->cd();
- TH1F* xSection2Ex = new TH1F(Form("xSection2Ex_%d_%d", fileId, j), ";Npart", 1001, -0.5, 1000.5);
-
- for (Int_t i=1; i<=1000; ++i)
- {
- if (i < lowLimit[j])
- {
- xSection2Ex->SetBinContent(i, xSection2->GetBinContent(i));
- xSection2Ex->SetBinError(i, xSection2->GetBinError(i));
- }
- else
- xSection2Ex->SetBinContent(i, func[j]->Eval(i));
- }
-
- new TCanvas;
- xSection2Ex->Draw();
- gPad->SetLogy();
-
- file2->cd();
- xSection2Ex->Write();
- }
- }
-
- file2->Close();
-}
-
-
-
+++ /dev/null
-/* $Id$ */
-
-//
-// Script to run the AliFirstPlotsSelector
-//
-
-#include "../CreateESDChain.C"
-#include "../PWG0Helper.C"
-
-void runHighMultiplicitySelector(Char_t* data, Int_t nRuns=20, Int_t offset=0, Bool_t aDebug = kFALSE, Bool_t aProof = kFALSE, const char* option = "", const char* proofServer = "jgrosseo@lxb6046")
-{
- if (aProof)
- {
- connectProof(proofServer);
- gProof->AddInput(new TParameter<long>("PROOF_MaxSlavesPerNode", (long)2));
- gProof->AddInput(new TNamed("PROOF_Packetizer", "TAdaptivePacketizer"));
- }
-
- //gProof->SetParallel(1);
-
- TString libraries("libPWG0base");
- TString packages("PWG0base");
-
- if (!prepareQuery(libraries, packages, 1))
- return;
-
- if (aProof)
- ProofAddAliRootIncludePath(1, "ITS");
-
- TChain* chain = CreateESDChain(data, nRuns, offset);
-
- TList inputList;
-
- TString selectorName = "AliHighMultiplicitySelector";
- AliLog::SetClassDebugLevel(selectorName, AliLog::kInfo);
-
- selectorName += ".cxx+";
-
- if (aDebug != kFALSE)
- selectorName += "+g";
-
- executeQuery(chain, &inputList, selectorName, option);
-}
-