]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - STARLIGHT/AliGenStarLight.cxx
updated STARLIGHT to r191 of http://starlight.hepforge.org/svn/trunk
[u/mrichter/AliRoot.git] / STARLIGHT / AliGenStarLight.cxx
index 0fd2e78b4aadd171bcc8465d10260c16b2d4521f..696912ceafb19d79e35b7f5485f5ed8a38137490 100644 (file)
@@ -27,11 +27,20 @@ ClassImp(AliGenStarLight);
 
 AliGenStarLight::AliGenStarLight()
   : AliGenMC()
-  , fSLgenerator(NULL) {
+  , fRapidityMotherMin( 1) // Max < Min: no cut
+  , fRapidityMotherMax(-1)
+  , fEtaChildMin( 1)       // Max < Min: no cut
+  , fEtaChildMax(-1)
+  , fSLgenerator(NULL)
+{
 }
 //----------------------------------------------------------------------
 AliGenStarLight::AliGenStarLight(Int_t npart)
   : AliGenMC(npart)
+  , fRapidityMotherMin( 1) // Max < Min: no cut
+  , fRapidityMotherMax(-1)
+  , fEtaChildMin( 1)       // Max < Min: no cut
+  , fEtaChildMax(-1)
   , fSLgenerator(new TStarLight("TStarLight",
                                "StarLight UPC Event Generator",
                                ""))  // no config file name  
@@ -83,9 +92,15 @@ void AliGenStarLight::Generate() {
     fSLgenerator->BoostEvent();
     fSLgenerator->ImportParticles(&fParticles, "ALL");
     
+    TLorentzVector vSum;
     genOK = kTRUE;
-    for (Long64_t i(0), n(fParticles.GetEntries()); i<n && genOK; ++i) {
-      const TParticle *part(dynamic_cast<TParticle*>(fParticles.At(i)));
+    const Long64_t n(fParticles.GetEntries());
+    if (n == 0) {
+      AliFatal("no particles generated");
+      return;
+    }
+    for (Long64_t i(0); i<n; ++i) {
+      TParticle *part(dynamic_cast<TParticle*>(fParticles.At(i)));
       if (NULL == part) {
        AliFatal("NULL == part");
        return;
@@ -96,7 +111,23 @@ void AliGenStarLight::Generate() {
        (part->Y()     >= fYMin)     && (part->Y()     <  fYMax)     &&
        (part->P()     >= fPMin)     && (part->P()     <  fPMax)     &&
        (part->Pt()    >= fPtMin)    && (part->Pt()    <  fPtMax);
+      if (fEtaChildMin <= fEtaChildMax) // no cut if Max < Min
+       genOK = genOK && (part->Eta() >= fEtaChildMin &&
+                         part->Eta() <  fEtaChildMax);
+      if (kFALSE == genOK)
+       break;
+
+      TLorentzVector v;
+      part->Momentum(v);
+      vSum += v;
     }
+
+    if (fRapidityMotherMin <= fRapidityMotherMax) // no cut if Max < Min
+      genOK = (genOK
+              ? (vSum.Rapidity() > fRapidityMotherMin &&
+                 vSum.Rapidity() < fRapidityMotherMax)
+              : kFALSE);
+
     if (kFALSE == genOK) continue;
     
     fNprimaries = 0;