+void AliEMCALJetFinder::DrawLegoEMCAL(const char *opt)
+{
+// Draw EMCAL Lego
+ if(fhLegoEMCAL) fhLegoEMCAL->Draw(opt);
+}
+
+void AliEMCALJetFinder::DrawHistsForTuning(Int_t mode)
+{
+// Draw all hists
+ static TPaveText *varLabel=0;
+ if(!fC1) {
+ fC1 = new TCanvas("C1","Hists. for tunning", 0,25,600,800);
+ }
+ fC1->Clear();
+ fC1->Divide(2,2);
+ fC1->cd(1);
+ gPad->SetLogy(1);
+ fhCellEt->Draw();
+
+ fC1->cd(2);
+ gPad->SetLogy(1);
+ fhCellEMCALEt->Draw();
+
+ fC1->cd(3);
+ gPad->SetLogy(1);
+ fhTrackPt->Draw();
+ fhTrackPtBcut->SetLineColor(2);
+ fhTrackPtBcut->Draw("same");
+
+ fC1->cd(4);
+ if(!varLabel) {
+ PrintParameters(1);
+ varLabel = new TPaveText(0.05,0.5,0.95,0.95,"NDC");
+ varLabel->SetTextAlign(12);
+ varLabel->SetFillColor(19); // see TAttFill
+ TString tmp(GetTitle());
+ varLabel->ReadFile(GetFileNameForParameters());
+ }
+ varLabel->Draw();
+ fC1->Update();
+ if(mode) { // for saving picture to the file
+ TString stmp(GetFileNameForParameters());
+ stmp.ReplaceAll("_Par.txt",".ps");
+ fC1->Print(stmp.Data());
+ }
+}
+
+void AliEMCALJetFinder::PrintParameters(Int_t mode)
+{
+// Print all parameters out
+
+ FILE *file=0;
+ if(mode==0) file = stdout; // output to terminal
+ else {
+ file = fopen(GetFileNameForParameters(),"w");
+ if(file==0) file = stdout;
+ }
+ fprintf(file,"==== Filling lego ==== \n");
+ fprintf(file,"Sampling fraction %6.3f ", fSamplingF);
+ fprintf(file,"Smearing %6i ", fSmear);
+ fprintf(file,"Efficiency %6i\n", fEffic);
+ fprintf(file,"Hadr.Correct. %6i ", fHCorrection);
+ fprintf(file,"P_{T} Cut of ch.par. %6.2f\n", fPtCut);
+ fprintf(file,"==== Jet finding ==== \n");
+ fprintf(file,"Cone radius %6.2f ", fConeRadius);
+ fprintf(file,"Seed E_{T} %6.1f\n", fEtSeed);
+ fprintf(file,"Min E_{T} of cell %6.1f ", fMinCellEt);
+ fprintf(file,"Min E_{T} of jet %6.1f\n", fMinJetEt);
+ if(fMode) {
+ fprintf(file,"==== Bg subtraction ==== \n");
+ fprintf(file,"BG subtraction %6i ", fMode);
+ fprintf(file,"Min cone move %6.2f\n", fMinMove);
+ fprintf(file,"Max cone move %6.2f ", fMaxMove);
+ fprintf(file,"%% change for BG %6.4f\n", fPrecBg);
+ } else
+ fprintf(file,"==== No Bg subtraction ==== \n");
+ //
+ printf("BG file name is %s \n", fBGFileName.Data());
+ if(file != stdout) fclose(file);
+}
+
+void AliEMCALJetFinder::DrawLegos()
+{
+// Draw all legos
+ if(!fC1) {
+ fC1 = new TCanvas("C1","Hists. for tunning", 0,25,600,800);
+ }
+ fC1->Clear();
+ fC1->Divide(2,2);
+ gStyle->SetOptStat(111111);
+
+ Int_t nent1, nent2, nent3, nent4;
+ Double_t int1, int2, int3, int4;
+ nent1 = (Int_t)fLego->GetEntries();
+ int1 = fLego->Integral();
+ fC1->cd(1);
+ if(int1) fLego->Draw("lego");
+
+ nent2 = (Int_t)fhLegoTracks->GetEntries();
+ int2 = fhLegoTracks->Integral();
+ fC1->cd(2);
+ if(int2) fhLegoTracks->Draw("lego");
+
+ nent3 = (Int_t)fhLegoEMCAL->GetEntries();
+ int3 = fhLegoEMCAL->Integral();
+ fC1->cd(3);
+ if(int3) fhLegoEMCAL->Draw("lego");
+
+ nent4 = (Int_t)fhLegoHadrCorr->GetEntries();
+ int4 = fhLegoHadrCorr->Integral();
+ fC1->cd(4);
+ if(int4) fhLegoHadrCorr->Draw("lego");
+
+ // just for checking
+ printf(" Integrals \n");
+ printf("lego %10.3f \ntrack %10.3f \nhits %10.3f \nHCorr %10.3f\n-- %10.3f(must be 0)\n",
+ int1, int2, int3, int4, int1 - (int2 + int3 - int4));
+}
+
+const Char_t* AliEMCALJetFinder::GetFileNameForParameters(const char* dir)
+{
+// Get paramters from a file
+ static TString tmp;
+ if(strlen(dir)) tmp = dir;
+ tmp += GetTitle();
+ tmp += "_Par.txt";
+ return tmp.Data();
+}
+
+void AliEMCALJetFinder::RearrangeParticlesMemory(Int_t npart)
+{
+ // See FillFromTracks() - npart must be positive
+ if (fTrackList) delete[] fTrackList;
+ if (fPtT) delete[] fPtT;
+ if (fEtaT) delete[] fEtaT;
+ if (fPhiT) delete[] fPhiT;
+ if (fPdgT) delete[] fPdgT;
+
+ if(npart>0) {
+ fTrackList = new Int_t [npart];
+ fPtT = new Float_t[npart];
+ fEtaT = new Float_t[npart];
+ fPhiT = new Float_t[npart];
+ fPdgT = new Int_t[npart];
+ } else {
+ printf("AliEMCALJetFinder::RearrangeParticlesMemory : npart = %d\n", npart);
+ }
+}