1 /**************************************************************************
2 * Copyright(c) 1998-2002, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
19 //----------------------------------------
21 // JetMicroDst to store information about
22 // jetfinding for offline analysis
24 //*-- Authors: Aleksei Pavlinov (WSU)
26 //-----------------------------------------
34 #include <TParticle.h>
39 #include "AliEMCALJetFinder.h"
40 #include "AliEMCALJetMicroDst.h"
41 #include "AliGenEventHeader.h"
42 #include "AliGenHijingEventHeader.h"
43 #include "AliHeader.h"
47 ClassImp(AliEMCALJetMicroDst)
49 TString gAliNameTree("jetMDST"); // 7-feb-2002
51 //TH1F* fhPtPart, *fhNJet, *fhPtJet;
52 //TH2F* fhEtaPhiPart, *fhEtaPhiJet;
53 //TH1F* fhNcell, *fhCellId, *fhCellEt, *fhSumEt;
54 //TH1F* fhNgrid, *fhGridId, *fhGridEt, *fhSumEtGrForJF;
56 extern "C" void sgpdge_(Int_t &i, Int_t &pdggea);
58 AliEMCALJetMicroDst::AliEMCALJetMicroDst(const char *name, const char *tit) :
60 fDebug(0),fFile(0),fTree(0),fListHist(0),fFileName(0),fdecone(0.),fptcone(0.),
61 fnpart(0),fnjet(0),fncell(0),fngrid(0),fnchp(0),fhPtPart(0),fhNJet(0),fhPtJet(0),
62 fhEtaPhiPart(0),fhEtaPhiJet(0),fhNcell(0),fhCellId(0),fhCellEt(0),fhSumEt(0),fhNgrid(0),
63 fhGridId(0),fhGridEt(0),fhSumEtGrForJF(0)
70 // Don't add histos to the current directory
71 // TH1::AddDirectory(0);
73 fhPtPart = new TH1F("fhPtPart","P_{T} for partons", 300, 0., 300.);
74 // 16-jan-2002 - new limit fo phi
75 fhEtaPhiPart = new TH2F("fhEtaPhiPart","#eta #phi distr.for partons after HSc",
76 28, -0.7, 0.7, 21, 0.0, (2.0/3.0)*TMath::Pi());
78 fhNJet = new TH1F("fhNJet","number of jets", 11, -0.5, 10.5);
79 fhPtJet = new TH1F("fhPtJet","P_{T} for jets", 500, 0., 500.);
80 fhEtaPhiJet = new TH2F("fhEtaPhiJet","#eta #phi distr.for jets (W)",
81 28, -0.7, 0.7, 21, 0.0, (2.0/3.0)*TMath::Pi());
83 fhNcell = new TH1F("fhNcell","#cell with de>0.0 for EMCAL", 1400, 0.0, 14000.);
84 fhCellId = new TH1F("fhCellId","cell ID with de>0.0 for EMCAL", 1400, 0.0, 14000.);
85 fhCellEt = new TH1F("fhCellEt","cell Et for EMCAL", 1000, 0.0, 10.);
86 fhSumEt = new TH1F("fhSumEt","sum Et for EMCAL", 1000, 0.0, 1000.);
88 fhNgrid = new TH1F("fhNgrid","#cell with de>0.0 in EMCAL grid for JF", 1400, 0.0, 14000.);
89 fhGridId = new TH1F("fhGridId","cell ID with de>0.0 in EMCAL grid for JF", 1400, 0.0, 14000.);
90 fhGridEt = new TH1F("fhGridEt","cell Et in EMCAL grid for JF", 1000, 0.0, 10.);
91 fhSumEtGrForJF = new TH1F("fhSumEtGrForJF","sum Et in EMCAL grid for JF", 1000, 0.0, 1000.);
93 fListHist = MoveHistsToList("Hist For AliEMCALJetMicroDst", kFALSE);
97 AliEMCALJetMicroDst::AliEMCALJetMicroDst(const AliEMCALJetMicroDst& jet) :
98 TNamed(jet.GetName(),jet.GetTitle()),
102 fListHist(jet.fListHist),
103 fFileName(jet.fFileName),
104 fdecone(jet.fdecone),
105 fptcone(jet.fptcone),
111 fhPtPart(jet.fhPtPart),
113 fhPtJet(jet.fhPtJet),
114 fhEtaPhiPart(jet.fhEtaPhiPart),
115 fhEtaPhiJet(jet.fhEtaPhiJet),
116 fhNcell(jet.fhNcell),
117 fhCellId(jet.fhCellId),
118 fhCellEt(jet.fhCellEt),
119 fhSumEt(jet.fhSumEt),
120 fhNgrid(jet.fhNgrid),
121 fhGridId(jet.fhGridId),
122 fhGridEt(jet.fhGridEt),
123 fhSumEtGrForJF(jet.fhSumEtGrForJF)
128 AliEMCALJetMicroDst::~AliEMCALJetMicroDst()
131 if(fFile) fFile->Close();
134 Bool_t AliEMCALJetMicroDst::Create(TFile *file)
136 // Creates the DST file
138 Error("Create", "define TFile for output\n");
142 fFileName = fFile->GetName();
144 fTree = new TTree(gAliNameTree.Data(),"Temporary micro DST for jets analysis");
145 // for jet calibration - 4-mar-2003
146 fTree->Branch("fdecone", &fdecone, "fdecone/F");
147 fTree->Branch("fptcone", &fptcone, "fptcone/F");
149 fTree->Branch("fnpart", &fnpart, "fnpart/I");
150 fTree->Branch("fxpt", fxpt, "fxpt[fnpart]/F");
151 fTree->Branch("fxeta", fxeta, "fxeta[fnpart]/F");
152 fTree->Branch("fxphi", fxphi, "fxphi[fnpart]/F");
154 fTree->Branch("fnjet", &fnjet, "fnjet/I");
155 fTree->Branch("fjet", fjet, "fjet[fnjet]/F");
156 fTree->Branch("fjetaw", fjetaw, "fjetaw[fnjet]/F");
157 fTree->Branch("fjphiw", fjphiw, "fjphiw[fnjet]/F");
158 fTree->Branch("fjetal", fjetal, "fjetal[fnjet]/F");
159 fTree->Branch("fjphil", fjphil, "fjphil[fnjet]/F");
161 // Et in EMCAL itself
162 fTree->Branch("fncell", &fncell, "fncell/I");
163 fTree->Branch("fidcell", fidcell, "fidcell[fncell]/I");
164 fTree->Branch("fetcell", fetcell, "fetcell[fncell]/F");
166 // Et in EMCAL grid for JF
167 fTree->Branch("fngrid", &fngrid, "fngrid/I");
168 fTree->Branch("fidgrid", fidgrid, "fidgrid[fngrid]/I");
169 fTree->Branch("fetgrid", fetgrid, "fetgrid[fngrid]/F");
171 // charge particle which hit to EMCAL
172 fTree->Branch("fnchp", &fnchp, "fnchp/I");
173 fTree->Branch("fpid", fpid, "fpid[fnchp]/I");
174 fTree->Branch("fppt", fppt, "fppt[fnchp]/F");
175 fTree->Branch("fpeta", fpeta, "fpeta[fnchp]/F");
176 fTree->Branch("fpphi", fpphi, "fpphi[fnchp]/F");
181 Bool_t AliEMCALJetMicroDst::Create(const char *fname)
184 TFile *file = new TFile(fname, "RECREATE");
186 // fNameFile = fname;
188 } else return kFALSE;
191 Bool_t AliEMCALJetMicroDst::Open(const char *fname)
194 if(fFile && fFile->IsOpen()) fFile->Close();
195 if(strlen(fname)) fName = fname;
196 TFile *file = new TFile(fName.Data(), "READ");
198 Bool_t ini = Initialize(file);
199 Info("Open", "open file %s : initialize TTree %i",fName.Data(), Int_t(ini));
202 Error("Open", "can not open file %s",fName.Data());
207 const Char_t* AliEMCALJetMicroDst::DefineName(Int_t mode)
210 static TString dir, name;
211 // dir = "jetDST/"; // 24-jan-2003
212 dir = "/auto/alice/pavlinov/jet/microDST/"; // 24-jan-2003
214 case 1: // for characteristic of BG
215 name = dir + "mDst1_1.root"; // Bg 2000 - first version
218 case 2: // for characteristic of BG
219 name = dir + "mDst2_1.root"; // Bg 4000 - first version
222 case 3: // for characteristic of BG
223 name = dir + "mDst3_1.root"; // Bg 8000 - first version
226 case 4: // Central Hijing - 18-mar-2003
227 name = dir + "march/";
228 name += "jF_R0.50MinCell1.0PtCut0.0EtSeed4.0MinEt40.0BGSubtr0SF11.6Smear0Eff0HijingCentral.root";
229 SetTitle("HijingCentral");
231 case 5: // Para Hijing (Dn/Dy=8000) - 21-mar-2003
232 name = dir + "march/";
233 name += "jF_R0.50MinCell1.0PtCut0.0EtSeed4.0MinEt40.0BGSubtr0SF11.6Smear0Eff0ParaHijing8000.root";
234 SetTitle("HIJINGparaDnDy8000");
236 case 6: // Para Hijing (Dn/Dy=4000) - 21-mar-2003
237 name = dir + "march/";
238 name += "jF_R0.50MinCell1.0PtCut0.0EtSeed4.0MinEt40.0BGSubtr0SF11.6Smear0Eff0ParaHijing4000.root";
239 SetTitle("HIJINGparaDnDy4000");
241 case 7: // Para Hijing (Dn/Dy=2000) - 21-mar-2003
242 name = dir + "march/";
243 name += "jF_R0.50MinCell1.0PtCut0.0EtSeed4.0MinEt40.0BGSubtr0SF11.6Smear0Eff0ParaHijing2000.root";
244 SetTitle("HIJINGparaDnDy2000");
246 case 11: // pure PYTHIA with default value of parameters
247 name = dir + "jF_R0.50MinCell0.0PtCut0.0EtSeed8.0MinEt40.0BGSubtr0SF11.6.root";
249 case 12: // 0 + background
250 name = dir + "jF_R0.50MinCell0.0PtCut0.0EtSeed8.0MinEt40.0BGSubtr0SF11.6kBackground2000.root";
254 name = dir + "march/";
255 name += "Pythia100_1.root";
256 SetTitle("Pythia100_1");
258 case 102: // 2-apr-2003
259 name = dir + "march/";
260 name += "Pythia50_1.root";
261 SetTitle("Pythia50_1");
262 // name = "microDst3th.root"; // 101 + (smearing and eff) - 14-mar-2003
264 case 103:// 4-apr-2003
265 name = dir + "march/";
266 name += "Pythia200_1.root";
267 SetTitle("Pythia200_1");
268 // name = "microDst4th.root"; // 102 + MinCell= 1.0
271 Fatal("DefineName", "NO D E F A U L T : mode %i\n", mode);
273 Info("DefineName", "mode %5i file : %s : Title %s\n", mode, name.Data(), GetTitle());
277 Bool_t AliEMCALJetMicroDst::Initialize(TFile *file)
280 if(file) fFile = file;
282 fTree = (TTree*)fFile->Get(gAliNameTree.Data());
283 if(!fTree) return kFALSE;
284 // for jet calibration - 4-mar-2003
285 fTree->SetBranchAddress("fdecone",&fdecone);
286 fTree->SetBranchAddress("fptcone",&fptcone);
288 fTree->SetBranchAddress("fnpart",&fnpart);
289 fTree->SetBranchAddress("fxpt", fxpt);
290 fTree->SetBranchAddress("fxeta", fxeta);
291 fTree->SetBranchAddress("fxphi", fxphi);
293 fTree->SetBranchAddress("fnjet", &fnjet);
294 fTree->SetBranchAddress("fjet", fjet);
295 fTree->SetBranchAddress("fjetaw", fjetaw);
296 fTree->SetBranchAddress("fjphiw", fjphiw);
297 fTree->SetBranchAddress("fjetal", fjetal);
298 fTree->SetBranchAddress("fjphil", fjphil);
300 fTree->SetBranchAddress("fncell", &fncell);
301 fTree->SetBranchAddress("fidcell", fidcell);
302 fTree->SetBranchAddress("fetcell", fetcell);
303 // eT in EMCAL grid for JF
304 fTree->SetBranchAddress("fngrid", &fngrid);
305 fTree->SetBranchAddress("fidgrid", fidgrid);
306 fTree->SetBranchAddress("fetgrid", fetgrid);
308 fTree->SetBranchAddress("fnchp", &fnchp);
309 fTree->SetBranchAddress("fpid", fpid);
310 fTree->SetBranchAddress("fppt", fppt);
311 fTree->SetBranchAddress("fpeta", fpeta);
312 fTree->SetBranchAddress("fpphi", fpphi);
317 void AliEMCALJetMicroDst::Print(Option_t* option) const
323 if(fTree) fTree->Print();
324 else Info("Print", "TRee is zero\n");
326 Info("Print", "File with TRee is closed \n Name of file %s(from fFileName", fFileName.Data());
329 Info("Print", "******* Current(last) event *****");
330 printf("#partons %2i \n", fnpart);
331 for(Int_t i=0; i<fnpart; i++){
332 printf(" %1i Pt %7.1f eta %7.4f phi %7.4f \n",
333 i, fxpt[i],fxeta[i],fxphi[i]);
335 printf("#jets %2i \n", fnjet);
336 for(Int_t i=0; i<fnjet; i++){
337 printf(" %1i Et %7.1f etaw %7.4f phiw %7.4f \n",
338 i,fjet[i],fjetaw[i],fjphiw[i]);
340 printf(" Title %s \n", GetTitle());
343 void AliEMCALJetMicroDst::Fill(AliRun *run, AliEMCALJetFinder* jetFinder, Int_t modeFilling)
345 // modeFilling >=1 - fill info for EMCAL grid
346 if(!run) run = gAlice;
347 AliGenEventHeader* evHeader = run->GetHeader()->GenEventHeader();
348 TString tmp(evHeader->ClassName());
349 if(tmp.Contains("Hijing")) {
350 AliGenHijingEventHeader *hijEvHeader = (AliGenHijingEventHeader*)evHeader;
351 FillPartons(hijEvHeader);
352 } else if(tmp.Contains("Pythia")) {
355 Error("Fill", "Wrong type of generator -> %s \n Info about partons will be absent",tmp.Data());
360 if(modeFilling >= 1) {
361 FillEtForEMCAL(jetFinder);
362 FillEtForGrid(jetFinder);
363 FillChargeParticles(jetFinder);
365 fncell = 0; // 27-jan-2003
366 fngrid = 0; // 27-jan-2003
368 // negative - no signal
373 FillJetsControl(); //24-jan-2003
378 void AliEMCALJetMicroDst::FillPartons(AliGenHijingEventHeader *header)
380 //Make partons arrays
381 TLorentzVector parton[4];
382 header->GetJets(parton[0], parton[1], parton[2], parton[3]);
385 for(Int_t i=0; i<4; i++){
386 fxpt[i] = parton[i].Pt();
387 fxeta[i] = parton[i].Eta();
388 fxphi[i] = parton[i].Phi();
392 void AliEMCALJetMicroDst::FillPartons()
394 // for case of Pythia -> get info from full event record
399 for(Int_t i=6; i<8; i++){
400 mPart = gAlice->GetMCApp()->Particle(i);
402 fxpt[ind] = mPart->Pt();
403 fxeta[ind] = mPart->Eta();
404 fxphi[ind] = mPart->Phi();
408 void AliEMCALJetMicroDst::FillJets(AliEMCALJetFinder* jetFinder)
412 if(fDebug>1) Info("FillJets", "Debug");
414 if(fDebug>1) Info("FillJets", "jetFinder is zero");
417 fnjet = jetFinder->Njets();
419 if(fDebug>1) Warning("FillJets", "wrong value of jetFinder->Njets() %i ", fnjet);
422 // fhNJet->Fill(njet);
423 if(fDebug>1) Info("FillJets", "njet %i", fnjet);
425 for(Int_t i=0; i<fnjet; i++){
426 fjet[i] = jetFinder->JetEnergy(i);
427 fjetaw[i] = jetFinder->JetEtaW(i);
428 fjphiw[i] = jetFinder->JetPhiW(i);
429 fjetal[i] = jetFinder->JetEtaL(i);
430 fjphil[i] = jetFinder->JetPhiL(i);
435 void AliEMCALJetMicroDst::FillEtForEMCAL(AliEMCALJetFinder* jetFinder)
439 TH2F *hid = jetFinder->GetLegoEMCAL();
443 Int_t neta = hid->GetNbinsX(), nphi = hid->GetNbinsY();
444 for(Int_t ieta=1; ieta<=neta; ieta++) {
445 for(Int_t iphi=1; iphi<=nphi; iphi++) {
446 de = hid->GetBinContent(ieta,iphi);
448 fetcell[fncell] = Float_t(de);
449 fidcell[fncell] = nphi*(ieta-1) + iphi;
451 if(fncell >= 13824) break;
452 // Info("FillEtForEMCAL", " ncell %i6 id %i6 de %f \n", ncell, idcell[ncell], etcell[ncell]);
457 // jet energy calculate around LP direction !!! - 10-mar-2003
458 fdecone = jetFinder->EMCALConeEnergy(fjetal[0],fjphil[0]);
459 fptcone = jetFinder->TrackConeEnergy(fjetal[0],fjphil[0]); // get from lego plot fo ch.part
460 Info("FillEtForEMCAL", " njet %i Emcal in cone %f pt ch.part in cone %f\n", fnjet, fdecone, fptcone);
461 Info("FillEtForEMCAL", " jet - decone - ptcone : %9.2f\n", fjet[0]-fdecone-fptcone);
467 Info("FillEtForEMCAL", "neta %3i nphi %3i # array size %i Sum.Et %f\n",
468 neta,nphi, fncell, hid->Integral());
471 void AliEMCALJetMicroDst::FillEtForGrid(AliEMCALJetFinder* jetFinder)
474 TH2F *hid = jetFinder->GetLego();
477 FillArrays(hid, fngrid, fidgrid, fetgrid);
480 void AliEMCALJetMicroDst::FillArrays(TH2* hid, Int_t &n, Int_t *id, Float_t *et)
485 Int_t neta = hid->GetNbinsX(), nphi = hid->GetNbinsY();
486 for(Int_t ieta=1; ieta<=neta; ieta++) {
487 for(Int_t iphi=1; iphi<=nphi; iphi++) {
488 de = hid->GetBinContent(ieta,iphi);
491 id[n] = nphi*(ieta-1) + iphi;
493 if(n >= 13824) break;
497 Info("FillArrays", "neta %3i nphi %3i # array size %i Sum.Et %f\n",
498 neta, nphi, n, hid->Integral());
501 void AliEMCALJetMicroDst::FillChargeParticles(AliEMCALJetFinder* jetFinder)
503 // 28-jan-2003 for fullness ; 18-mar - sometimes
506 for(Int_t i=0; i<jetFinder->fNt; i++) {
508 if(jetFinder->fTrackList[i] >= 1) {
509 sgpdge_(jetFinder->fPdgT[i], gid);
511 fppt[fnchp] = jetFinder->fPtT[i];
512 fpeta[fnchp] = jetFinder->fEtaT[i];
513 fpphi[fnchp] = jetFinder->fPhiT[i];
517 Info("FillChargedParticles", "fNtS %i : nchp %i -> %i\n", jetFinder->fNtS, fnchp, jetFinder->fNtS - fnchp);
520 void AliEMCALJetMicroDst::FillJetsControl()
522 // see FillJets(AliEMCALJetFinder* jetFinder) and FillPartons
524 for(Int_t i=0; i<fnjet; i++){
525 fhPtJet->Fill(fjet[i]);
526 fhEtaPhiJet->Fill(fjetaw[i],fjphiw[i]);
529 for(Int_t i=0; i < fnpart; i++){
530 fhEtaPhiPart->Fill(fxeta[i], fxphi[i]);
531 fhPtPart->Fill(fxpt[i]);
535 fhNcell->Fill(fncell);
536 for(Int_t i=0; i < fncell; i++){
537 fhCellId->Fill(fidcell[i]);
538 fhCellEt->Fill(fetcell[i]);
539 sum += Double_t(fetcell[i]);
544 fhNgrid->Fill(fngrid);
545 for(Int_t i=0; i < fngrid; i++){
546 fhGridId->Fill(fidgrid[i]);
547 fhGridEt->Fill(fetgrid[i]);
548 sum += Double_t(fetgrid[i]);
550 fhSumEtGrForJF->Fill(sum);
553 Int_t AliEMCALJetMicroDst::GetEntry(Int_t entry)
555 // Read contents of entry.
557 Error("GetEntry", "define TTree");
560 return fTree->GetEntry(entry);
563 Bool_t AliEMCALJetMicroDst::GetParton(Int_t i, Float_t& pt, Float_t& eta, Float_t& phi) const
566 if(i>=0 && i<fnpart) {
571 } else return kFALSE;
574 Bool_t AliEMCALJetMicroDst::GetParton(Int_t i, TVector3& vec) const
577 static Float_t pt, eta, phi;
579 if(!GetParton(i, pt, eta, phi)) return kFALSE;
581 FillVector(pt, eta, phi, vec);
585 Bool_t AliEMCALJetMicroDst::GetJet(Int_t i,Int_t mode,Float_t& pt, Float_t& eta, Float_t& phi) const
587 // mode=1(W) mode=any(L)
588 if(i>=0 && i<fnjet) {
598 } else return kFALSE;
601 Bool_t AliEMCALJetMicroDst::GetJet(Int_t i, Int_t mode, TVector3& vec) const
604 static Float_t pt, eta, phi;
606 if(!GetJet(i, mode, pt, eta, phi)) return kFALSE;
607 FillVector(pt, eta, phi, vec);
611 void AliEMCALJetMicroDst::Test()
614 if(!fFile || !fTree ) {
615 Info("Test", "define file with proper TTree !");
618 Int_t nbytes=0, nb=0, nentries=Int_t(fTree->GetEntries());
619 for(Int_t i=0; i<nentries; i++){
620 nb = fTree->GetEntry(i);
622 for(Int_t j=0; j<fnpart; j++){
623 fhEtaPhiPart->Fill(fxeta[j], fxphi[j]);
624 fhPtPart->Fill(fxpt[j]);
629 for(Int_t j=0; j<fnjet; j++) {
630 fhPtJet->Fill(fjet[j]);
631 fhEtaPhiJet->Fill(fjetaw[j],fjphiw[j]);
635 Info("Test", "Entries %5i Bytes %10i\n", nentries, nbytes);
638 void AliEMCALJetMicroDst::FillVector(Float_t pt, Float_t eta, Float_t phi, TVector3& vec)
641 static Float_t px, py, pz;
643 px = pt*TMath::Cos(phi);
644 py = pt*TMath::Sin(phi);
645 pz = pt*TMath::SinH(eta); // sinh(eta) = cot(theta)
647 vec.SetXYZ(px, py, pz);
650 void AliEMCALJetMicroDst::GetEtaPhi(Int_t id, Double_t &eta, Double_t &phi) const
652 // see AliEMCALGeometry
653 static Int_t ieta, iphi, nphi=144, neta=96;
654 static Double_t phiMax=(2.0/3.0)*TMath::Pi(), phiMin=0.0;
655 static Double_t phiStep=(phiMax-phiMin)/nphi, phiBeg = phiMin + phiStep/2.;
656 static Double_t etaMax=0.7, etaMin=-etaMax;
657 static Double_t etaStep=(etaMax-etaMin)/neta, etaBeg = etaMin + etaStep/2.;
659 ieta = (id-1)/nphi + 1; // id = nphi*(ieta-1) + iphi
660 iphi = id - nphi*(ieta-1);
661 if(ieta<=0 || ieta>neta) {
662 Fatal("GetEtaPhi", "wrong id %i(ieta %i,iphi %i) : nphi %i neta %i", id,iphi,ieta, nphi,neta);
666 eta = etaBeg + etaStep*(ieta-1);
667 phi = phiBeg + phiStep*(iphi-1);
670 TVector3& AliEMCALJetMicroDst::GetCellVector(Int_t i) const
673 static Double_t eta,phi;
675 vec.SetXYZ(0.,0.,0.);
676 if(i>=0 && i<fncell) {
677 GetEtaPhi(fidcell[i], eta, phi);
678 vec.SetPtEtaPhi(Double_t(fetcell[i]),eta,phi);
683 TVector3& AliEMCALJetMicroDst::GetGridVector(Int_t i) const
686 static Double_t eta,phi;
688 vec.SetXYZ(0.,0.,0.);
689 if(i>=0 && i<fngrid) {
690 GetEtaPhi(fidgrid[i], eta, phi);
691 vec.SetPtEtaPhi(Double_t(fetgrid[i]),eta,phi);
696 Double_t AliEMCALJetMicroDst::GetSumInCone(TVector3 &jet,Int_t nc, Float_t *et,Float_t *eta,Float_t *phi, Double_t cellEtCut, Double_t rJet) const
699 static Double_t sum=0.;
700 static TVector3 cell(0., 0., 0.);
701 if(nc<=0 || et==0 || eta==0 || phi==0) {
702 Error("GetSumInCone", "nc %d %f %f %f ", nc, et, eta, phi);
707 // jet.SetPtEtaPhi(jet[0],jetaw[0],jphiw[0]); // must be one jet !!
708 Info("GetSumInCone", "jet.Mag() %f : njet %i\n", jet.Mag(), fnjet);
709 for(Int_t i=0; i<nc; i++){
710 if(et[i] < cellEtCut) continue;
711 cell.SetPtEtaPhi(et[i], eta[i], phi[i]);
712 if(jet.DeltaR(cell) > rJet) continue;
715 Info("GetSumCone", "Sum %f \n", sum);
719 Double_t AliEMCALJetMicroDst::GetEmcalEtInCone(TVector3 &jet, Double_t cellEtCut, Double_t rJet)
721 // Get EMCAL Et in cone
725 Float_t *et=fetcell, *eta=new Float_t[nc], *phi=new Float_t[nc];
726 Double_t etaCell=0., phiCell=0., eTotal=0;
728 for(Int_t i=0; i<nc; i++) {
729 GetEtaPhi(fidcell[i], etaCell, phiCell);
734 eTotal = GetSumInCone(jet, nc, et,eta,phi, cellEtCut,rJet);
741 Double_t AliEMCALJetMicroDst::GetTpcPtInCone(TVector3 &jet,Double_t cellEtCut, Double_t rJet)
743 // Get TPC PT in cone
744 if(fnchp<=0) return 0.;
745 return GetSumInCone(jet, fnchp, fppt,fpeta,fpphi, cellEtCut,rJet);
748 Double_t AliEMCALJetMicroDst::GetSum(Int_t n, Float_t *ar, Double_t cut) const
752 if(n<=0 || ar==0) return sum;
753 for(Int_t i=0; i<n; i++) {if(ar[i]>=cut) sum += Double_t(ar[i]);}
757 void AliEMCALJetMicroDst::Close()
767 void AliEMCALJetMicroDst::Browse(TBrowser* b)
770 if(fTree) b->Add((TObject*)fTree);
771 if(fListHist) b->Add((TObject*)fListHist);
772 // TObject::Browse(b);
775 Bool_t AliEMCALJetMicroDst::IsPythiaDst() const
778 TString st(GetTitle());
779 if(st.Contains("py",TString::kIgnoreCase)||!st.Contains("hijing", TString::kIgnoreCase)) return kTRUE;
783 Bool_t AliEMCALJetMicroDst::IsFolder() const
786 if(fTree || fListHist) return kTRUE;
790 TList* AliEMCALJetMicroDst::MoveHistsToList(const char* name, Bool_t putToBrowser)
794 TIter nextHist(gDirectory->GetList());
795 TList *list = new TList;
798 while((objHist=nextHist())){
799 if (!objHist->InheritsFrom("TH1")) continue;
800 ((TH1*)objHist)->SetDirectory(0); // Remove from gROOT
803 if(putToBrowser) gROOT->GetListOfBrowsables()->Add((TObject*)list);
807 void AliEMCALJetMicroDst::FillH1(TList *l, Int_t ind, Double_t x, Double_t w)
809 //Fill 1d histogram with input data
813 if(ind < l->GetSize()){
814 hid = (TH1*)l->At(ind);
819 void AliEMCALJetMicroDst::FillH2(TList *l, Int_t ind, Double_t x, Double_t y, Double_t w)
821 //Fill 2d histogram with input data
825 if(ind < l->GetSize()){
826 hid = (TH2*)l->At(ind);
831 int AliEMCALJetMicroDst::SaveListOfHists(TList *list,const char* name,Bool_t kSingleKey,const char* opt)
833 //Save histograms to file
835 printf(" Name of out file |%s|\n", name);
837 if(list && list->GetSize() && strlen(name)){
839 if(nf.Contains(".root") == kFALSE) nf += ".root";
840 TFile file(nf.Data(),opt);
841 TIter nextHist(list);
846 list->Write(list->GetName(),TObject::kSingleKey);
850 while((objHist=nextHist())) { // loop over list
851 if(objHist->InheritsFrom("TH1")) {
852 TH1* hid = (TH1*)objHist;
856 printf("Save hist. %s \n",hid ->GetName());
859 printf("%i hists. save to file -> %s\n", nh,file.GetName());
864 printf("TAliasPAI::saveListOfHists : N O S A V I N G \n");
865 if(list==0) printf("List of object 0 : %p \n", (void*)list);
866 else printf("Size of list %i \n", list->GetSize());
871 void AliEMCALJetMicroDst::Sgpdge(Int_t pdgId, Int_t &gId)