Added check for floating exception in TParticle->Eta() and support for various Eventh...
authorloizides <loizides@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sat, 11 Sep 2004 17:13:24 +0000 (17:13 +0000)
committerloizides <loizides@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sat, 11 Sep 2004 17:13:24 +0000 (17:13 +0000)
JETAN/AliJetParticlesReaderKine.cxx
JETAN/AliJetParticlesReaderKine.h

index 6c4c7b1..d55939c 100644 (file)
 #include <Riostream.h>
 #include <TString.h>
 #include <TParticle.h>
+#include <TLorentzVector.h>
 #include <AliRunLoader.h>
 #include <AliStack.h>
-
+#include <AliHeader.h>
+#include <AliGenEventHeader.h>
+#include <AliGenPythiaEventHeader.h>
+#include <AliGenHijingEventHeader.h>
 #include "AliJetParticle.h"
 #include "AliJetEventParticles.h"
 #include "AliJetParticlesReaderKine.h"
-#include "AliHeader.h"
-#include "AliGenPythiaEventHeader.h"
 
 ClassImp(AliJetParticlesReaderKine)
 
@@ -114,49 +116,91 @@ Int_t AliJetParticlesReaderKine::ReadNext()
       fEventParticles->Reset(npart);
 
       TString headdesc="";
+      Int_t gentype=-1;
       AliHeader *header=fRunLoader->GetHeader();
       if(!header) {
        Warning("ReadNext","Header not found in event %d",fCurrentEvent);
       } else {
-       headdesc+="Run ";
-       headdesc+=header->GetRun();
-       headdesc+=": Ev ";
-       headdesc+=header->GetEventNrInRun();
-       AliGenPythiaEventHeader *pheader=(AliGenPythiaEventHeader*)header->GenEventHeader();
-       if(!pheader) {
-         Warning("ReadNext","Pythia-Header not found in event %d",fCurrentEvent);
-       } else {
-         Int_t ntruq=0;
+       AliGenEventHeader *genheader=header->GenEventHeader();
+       TString hname=genheader->GetName();
+       if(hname.CompareTo("HIJINGparam")==0) {
+         gentype=1;      ;
+         headdesc+="HIJINGparam";
+       } else if(hname.CompareTo("Hijing")==0) {
+         gentype=2;
+         AliGenHijingEventHeader *hheader=(AliGenHijingEventHeader*)header->GenEventHeader();
+         headdesc+="Hijing";
+         if(!hheader) {
+           Warning("ReadNext","Hijing-Header not found in event %d",fCurrentEvent);
+         } else {
+           Int_t ntrials=hheader->Trials();
+           fEventParticles->SetTrials(ntrials);
+           fEventParticles->SetImpact(hheader->ImpactParameter());
+           fEventParticles->SetNhard(hheader->HardScatters());
+           fEventParticles->SetNpart(hheader->NwNw());
+
+           TLorentzVector  jet1; 
+           TLorentzVector  jet2; 
+           TLorentzVector  jetFsr1;
+           TLorentzVector  jetFsr2;
+           hheader->GetJets(jet1,jet2,jetFsr1,jetFsr2);
+           fEventParticles->AddHard(0,jet1.X(),jet1.Y(),jet1.Z(),jet1.T(),0);
+           fEventParticles->AddHard(1,jet2.X(),jet2.Y(),jet2.Z(),jet2.T(),0);
+         }
+       } else if(hname.CompareTo("Pythia")==0){
+         gentype=3;
+         headdesc+="Pythia";
+         AliGenPythiaEventHeader *pheader=(AliGenPythiaEventHeader*)header->GenEventHeader();
+         if(!pheader) {
+           Warning("ReadNext","Pythia-Header not found in event %d",fCurrentEvent);
+         } else {
+           Int_t ntruq=0;
 #ifndef NOUQHEADERINFO
-         ntruq=pheader->NUQTriggerJets();
-         if(ntruq){
-           Double_t x0=pheader->GetXJet();
-           Double_t y0=pheader->GetYJet();
-           Double_t zquench[4];
-           pheader->GetZQuench(zquench);
-           fEventParticles->SetXYJet(x0,y0);
-           fEventParticles->SetZQuench(zquench);
-           for(Int_t j=0;j<ntruq;j++){
-             Float_t pjet[4];
-             pheader->UQJet(j,pjet);
-             fEventParticles->AddUQJet(pjet);
+           ntruq=pheader->NUQTriggerJets();
+           if(ntruq){
+             Double_t x0=pheader->GetXJet();
+             Double_t y0=pheader->GetYJet();
+             if(x0==y0==-1){
+               x0=y0=0.;
+             }
+             Double_t zquench[4];
+             pheader->GetZQuench(zquench);
+             fEventParticles->SetXYJet(x0,y0);
+             fEventParticles->SetZQuench(zquench);
+             for(Int_t j=0;j<ntruq;j++){
+               Float_t pjet[4];
+               pheader->UQJet(j,pjet);
+               fEventParticles->AddUQJet(pjet);
+             }
            }
-         }
 #endif
-         //Int_t ptyp=pheader->ProcessType();
-         Int_t ntrials=pheader->Trials();
-         headdesc+=": Tr ";
-         headdesc+=ntrials;
-         Int_t ntr=pheader->NTriggerJets();
-         if(ntr){
-           for(Int_t j=0;j<ntr;j++){
-             Float_t pjet[4];
-             pheader->TriggerJet(j,pjet);
-             fEventParticles->AddJet(pjet);
-             if(!ntruq) fEventParticles->AddUQJet(pjet);
+           //Int_t ptyp=pheader->ProcessType();
+           Int_t ntrials=pheader->Trials();
+           fEventParticles->SetTrials(ntrials);
+
+           Int_t ntr=pheader->NTriggerJets();
+           if(ntr){
+             for(Int_t j=0;j<ntr;j++){
+               Float_t pjet[4];
+               pheader->TriggerJet(j,pjet);
+               fEventParticles->AddJet(pjet);
+               if(!ntruq) fEventParticles->AddUQJet(pjet);
+             }
+           }
+           for(Int_t i=6;i<=7;i++){
+             TParticle *MP = stack->Particle(i);
+             if(!MP) break;
+             Int_t type=0;
+             if(MP->GetPdgCode()==21) type=2;
+             else type=1;
+             fEventParticles->AddHard(i-6,MP->Px(),MP->Py(),MP->Pz(),MP->Energy(),type);
            }
          }
        }
+       headdesc+="Run ";
+       headdesc+=header->GetRun();
+       headdesc+=": Ev ";
+       headdesc+=header->GetEventNrInRun();
       }
       fEventParticles->SetHeader(headdesc);
 
@@ -176,12 +220,23 @@ Int_t AliJetParticlesReaderKine::ReadNext()
          //Int_t mother = p->GetFirstMother();    
          //cout << child1 << " " << child2 << " " << mother << endl;
          if((child1>=0) && (child1<nprim)) continue; 
-         if(p->GetStatusCode()!=1){
-           //p->Print();
-           continue;
+
+         //check status code depending on gentype
+         if(gentype==1){ // Hijing Param
+           if(p->GetStatusCode()!=0) continue;
+         } else if(gentype==2){ //Hijing
+           //if( p->GetStatusCode()!=0){
+           //  cout <<p->GetStatusCode() << " ";p->Print(); 
+           //}
+         } else if(gentype==3){ //Pythia
+           if(p->GetStatusCode()!=1) continue;
          }
-         if(IsAcceptedParticle(p)) //put particle in event
+
+         //kinematic cuts
+         if(IsAcceptedParticle(p)){ //put particle in event
+           //if(p->Pt()>20){cout <<p->GetStatusCode() << " ";p->Print(); }
            fEventParticles->AddParticle(p,i); 
+         }
        }
       fCurrentEvent++;
       fNEventsRead++;
index ba6b065..23dc993 100644 (file)
@@ -61,7 +61,13 @@ inline Bool_t AliJetParticlesReaderKine::IsAcceptedParticle(TParticle *p) const
     if((!fNeutral)&&(!ch)) return kFALSE;
   }
 
-  Float_t eta=p->Eta();
+  Float_t eta=0.;//p->Eta();
+  Float_t pz=p->Pz();
+  //if(TMath::Abs(pz)>150.) return kFALSE;
+  Float_t pabs=p->P();
+  if(pabs-TMath::Abs(pz)>1.e-8) eta=0.5*TMath::Log((pabs+pz)/(pabs-pz));
+  else return kFALSE;
+
   if((eta<fEtaMin)||(eta>fEtaMax)) return kFALSE;
 
   Float_t phi=p->Phi();