return ;
}
- Int_t nClusters = esd->GetNumberOfEMCALClusters();
- Int_t firstCluster = esd->GetFirstEMCALCluster();
+ Int_t nClusters = esd->GetNumberOfCaloClusters();
+ Int_t firstCluster = 0;
Double_t energy, lambda0;
for (Int_t iCluster = firstCluster; iCluster < (nClusters + firstCluster); iCluster++) {
AliESDCaloCluster *clust = esd->GetCaloCluster(iCluster);
+ if (!clust->IsEMCAL()) continue ;
energy = clust->E();
lambda0 = clust->GetM02();
// verify cluster type
//
// Check if the instance of AliEMCALRecParam exists,
- const AliEMCALRecParam* recParam = AliEMCALReconstructor::GetRecParam();
+ const AliEMCALRecParam* recParam = new AliEMCALRecParam();
+
if(!recParam){
AliFatal("Reconstruction parameters for EMCAL not set!");
}
// make sure that tracks/clusters collections are empty
Clear("CLUSTERS");
- Int_t start = esd->GetFirstEMCALCluster();
- Int_t nClustersEMC = esd->GetNumberOfEMCALClusters();
+ Int_t start = 0;
+ Int_t nClustersEMC = esd->GetNumberOfCaloClusters();
Int_t end = start + nClustersEMC;
fClusters = new TObjArray(0);
for (i = start; i < end; i++) {
AliESDCaloCluster *cluster = esd->GetCaloCluster(i);
if (!cluster) continue;
- if (cluster->GetClusterType() != AliESDCaloCluster::kEMCALClusterv1) continue;
+ if (!cluster->IsEMCAL()) continue ;
AliEMCALMatchCluster *matchCluster = new AliEMCALMatchCluster(i, cluster);
fClusters->AddLast(matchCluster);
}
// This macro reads comparison files and makes plots.
//
-void DrawComparison
-(const char *fileName = "match-comparison.root")
+void DrawComparison(const char *fileName = "match-comparison.root")
{
- TH1D *hg = new TH1D("hg", "Good matches / true matches", 20, 0.0, 10.0);
- TH1D *hf = new TH1D("hf", "Fake matches / found matches", 20, 0.0, 10.0);
+ gROOT->SetStyle("Plain");
+ gStyle->SetOptStat(0);
//
// Open file
//
TFile *file = TFile::Open(fileName);
if (!file) return;
- TH1D *hgood = (TH1D*)file->Get("hgood");
- TH1D *hfake = (TH1D*)file->Get("hfake");
- TH1D *htrue = (TH1D*)file->Get("htrue");
+ TH1D *hgood = (TH1D*)file->Get("hgood");
+ TH1D *hfake = (TH1D*)file->Get("hfake");
+ TH1D *htrue = (TH1D*)file->Get("htrue");
TH1D *hfound = (TH1D*)file->Get("hfound");
- gROOT->SetStyle("Plain");
- gStyle->SetOptStat(0);
-
- hg->Divide(hgood, htrue, 100.0, 1.0, "b");
- hf->Divide(hfake, hfound, 100.0, 1.0, "b");
-
- TCanvas *c = new TCanvas("c", "", 0, 0, 800, 600);
+ TH1D *hg = (TH1D*)hgood->Clone("hg");
+ TH1D *hf = (TH1D*)hfake->Clone("hf");
+ hg->Divide( htrue );
+ hf->Divide( hfound);
+ hg->Scale(100);
+ hf->Scale(100);
hg->SetMarkerStyle(21);
hf->SetMarkerStyle(25);
- hg->SetXTitle("p_{T} (GeV/c)");
+ TCanvas *c = new TCanvas("c", "", 0, 0, 800, 600);
- hg->GetXaxis()->SetRangeUser(0.0, 6.0);
- hf->GetXaxis()->SetRangeUser(0.0, 6.0);
-
+ TLegend* leg = new TLegend(0.6,0.8,0.88,0.88);
+ leg->SetFillColor(10);
+ leg->AddEntry(hg,"Good/True","p");
+ leg->AddEntry(hf,"Fake/Found","p");
+
+ hg->SetXTitle("p_{T} (GeV/c)");
+ hg->SetYTitle("efficiency (%)");
+ hg->SetTitle("Track-EMCAL Cluster Matching");
hg->SetMaximum(120.0);
hg->SetMinimum(0.0);
hg->Draw("PE1");
hf->Draw("PE1same");
+ leg->Draw();
+
}
if (!rl) return;
rl->LoadgAlice();
gAlice = rl->GetAliRun();
- AliMagF *magf = gAlice->Field();
- Bool_t constField = (magf->Type() == 1);
- AliTracker::SetFieldMap(magf, constField);
+ //AliMagF *magf = new AliMagF("Maps","Maps", 2, 1., 1., 10., AliMagF::k5kG);
+ AliMagF *magf = new AliMagF("Maps","Maps", 2, 1., 1.);
+
//
// Open ESD file and recoveries TTree of ESD objects.
//
TFile *esdFile = new TFile("AliESDs.root");
TTree *esdTree = (TTree*)esdFile->Get("esdTree");
- AliESD *esd = 0;
- esdTree->SetBranchAddress("ESD", &esd);
+ AliESDEvent* esd = new AliESDEvent();
+ esd->ReadFromTree(esdTree);
+ if (!esd) {cerr<<"no AliESDEvent"; return 1;};
+
Long64_t nEvents = esdTree->GetEntries();
//
//
TFile *outFile = TFile::Open(fileOut, "RECREATE");
TTree *outTree = new TTree("esdTree", "ESD with matched clusters");
- outTree->Branch("ESD", "AliESD", &esd);
+ //outTree->Branch("ESD", "AliESD", &esd);
+ esd->WriteToTree(outTree);
//
// Loop on events.
//
// Initialize AliRun manager
//
- if (gAlice) {
- delete gAlice;
- gAlice = 0;
- }
//
// Initialize run loader and load Kinematics
//
// Initialize histograms with their error computation
//
- TH1D *hgood = new TH1D("hgood", "Well matched tracks", 20, 0.0, 10.0);
- TH1D *hfake = new TH1D("hfake", "Fake matched tracks", 20, 0.0, 10.0);
- TH1D *htrue = new TH1D("htrue", "True matches", 20, 0.0, 10.0);
- TH1D *hfound = new TH1D("hfound", "Found matches", 20, 0.0, 10.0);
+ TH1D *hgood = new TH1D("hgood", "Well matched tracks", 40, 0.0, 40.0);
+ TH1D *hfake = new TH1D("hfake", "Fake matched tracks", 40, 0.0, 40.0);
+ TH1D *htrue = new TH1D("htrue", "True matches" , 40, 0.0, 40.0);
+ TH1D *hfound = new TH1D("hfound","Found matches" , 40, 0.0, 40.0);
hgood->Sumw2();
hfake->Sumw2();
htrue->Sumw2();
//
TFile *fileFound = TFile::Open("matchESD.root");
TTree *treeFound = (TTree*)fileFound->Get("esdTree");
- AliESD *esd = 0;
- treeFound->SetBranchAddress("ESD", &esd);
+ AliESDEvent* esd = new AliESDEvent();
+ esd->ReadFromTree(treeFound);
Long64_t nEvents = treeFound->GetEntries();
//
for (im = 0; im < nTrueMatches; im++) {
treeTrue->GetEntry(im);
AliESDtrack *track = esd->GetTrack(trueMatch.indexT);
+ if (!track) continue;
+
label = TMath::Abs(track->GetLabel());
TParticle *p = stack->Particle(label);
htrue->Fill(p->Pt());
+ cout <<"filling true"<< endl;
}
// compare found matches
ic = TMath::Abs(ic);
AliESDCaloCluster *cl = esd->GetCaloCluster(ic);
if (!cl) continue;
+ if (!cl->IsEMCAL()) continue ;
trkLabel = TMath::Abs(track->GetLabel());
- cluLabel = cl->GetPrimaryIndex();
+ cluLabel = cl->GetLabel();
if (trkLabel == cluLabel && trkLabel >= 0) {
TParticle *p = stack->Particle(TMath::Abs(trkLabel));
hgood->Fill(p->Pt());
hfound->Fill(p->Pt());
+ cout <<"filling GOOD, pt:" << p->Pt()<< endl;
}
else {
TParticle *p = stack->Particle(TMath::Abs(trkLabel));
hfake->Fill(p->Pt());
hfound->Fill(p->Pt());
+ cout <<"filling FAKE" << endl;
}
}
}
//
// Read AliESDs.root file and saves all true pairs of trak-cluster.
//
-void SaveTrueMatchesSimple_compiled(const char *outFileName)
+void SaveTrueMatchesSimple(const char *outFileName="true-matches.root")
{
//
// open ESD file, retrieve tree and link to branch cursor
if (!srcFile) return;
TTree *srcTree = (TTree*)srcFile->Get("esdTree");
if (!srcTree) return;
- AliESD *esd = 0;
- srcTree->SetBranchAddress("ESD", &esd);
+
+ AliESDEvent* esd = new AliESDEvent();
+ esd->ReadFromTree(srcTree);
Long64_t nEvents = srcTree->GetEntries();
//
cout << "Event " << iev + 1 << " of " << nEvents << ": " << endl;
nTracks = esd->GetNumberOfTracks();
- firstCluster = esd->GetFirstEMCALCluster();
- lastCluster = esd->GetFirstEMCALCluster() + esd->GetNumberOfEMCALClusters();
+ firstCluster = 0;
+ lastCluster = esd->GetNumberOfCaloClusters();
cout << "Tracks found : " << nTracks << endl;
cout << "EMC clusters found: " << lastCluster - firstCluster << endl;
count = 0;
for (Int_t ic = firstCluster; ic < lastCluster; ic++) {
AliESDCaloCluster *cl = esd->GetCaloCluster(ic);
- // reject pseudo-clusters & unmatched clusters
- if (cl->GetClusterType() != AliESDCaloCluster::kClusterv1) continue;
- if (cl->GetPrimaryIndex() != label) continue;
+ if (!cl->IsEMCAL()) continue;
+ if (cl->GetLabel() != label) continue;
// if the method reaches this point, we
// have found a match to be stored
match.label = label;