https://alice.its.cern.ch/jira/browse/ALIROOT-5617
authormorsch <andreas.morsch@cern.ch>
Tue, 9 Sep 2014 13:08:51 +0000 (15:08 +0200)
committermorsch <andreas.morsch@cern.ch>
Tue, 9 Sep 2014 13:08:51 +0000 (15:08 +0200)
EVGEN/AliGenParam.cxx
EVGEN/AliGenParam.h

index 662a185..6dc049e 100644 (file)
@@ -69,7 +69,9 @@ AliGenParam::AliGenParam()
        fDeltaPt(0.01),
        fSelectAll(kFALSE),
   fDecayer(0),
-  fForceConv(kFALSE)
+  fForceConv(kFALSE),
+  fKeepParent(kFALSE),
+  fKeepIfOneChildSelected(kFALSE)
 {
   // Default constructor
 }
@@ -93,7 +95,9 @@ AliGenParam::AliGenParam(Int_t npart, const AliGenLib * Library,  Int_t param, c
      fDeltaPt(0.01),
      fSelectAll(kFALSE),
    fDecayer(0),
-   fForceConv(kFALSE)
+   fForceConv(kFALSE),
+   fKeepParent(kFALSE),
+   fKeepIfOneChildSelected(kFALSE)
 {
   // Constructor using number of particles parameterisation id and library
     fName = "Param";
@@ -121,7 +125,9 @@ AliGenParam::AliGenParam(Int_t npart, Int_t param, const char* tname, const char
     fDeltaPt(0.01),
     fSelectAll(kFALSE),
   fDecayer(0),
-  fForceConv(kFALSE)
+  fForceConv(kFALSE),
+  fKeepParent(kFALSE),
+  fKeepIfOneChildSelected(kFALSE)
 {
   // Constructor using parameterisation id and number of particles
   //
@@ -170,7 +176,9 @@ AliGenParam::AliGenParam(Int_t npart, Int_t param,
      fDeltaPt(0.01),
      fSelectAll(kFALSE),
   fDecayer(0),
-  fForceConv(kFALSE)
+  fForceConv(kFALSE),
+  fKeepParent(kFALSE),
+  fKeepIfOneChildSelected(kFALSE)
 {
   // Constructor
   // Gines Martinez 1/10/99 
@@ -729,8 +737,10 @@ void AliGenParam::GenerateN(Int_t ntimes)
                                  pSelected[i]  = 1;
                                  ncsel++;
                              } else {
-                                 ncsel=-1;
-                                 break;
+                                 if(!fKeepIfOneChildSelected){
+                                   ncsel=-1;
+                                   break;
+                                 }
                              } // child kine cuts
                          } else {
                              pSelected[i]  = 1;
@@ -741,8 +751,8 @@ void AliGenParam::GenerateN(Int_t ntimes)
              } // if decay products
              
              Int_t iparent;
-             if ((fCutOnChild && ncsel >0) || !fCutOnChild){
-                 ipa++;
+             
+             if (fKeepParent || (fCutOnChild && ncsel >0) || !fCutOnChild){
          //
          // Parent
                  
@@ -752,6 +762,11 @@ void AliGenParam::GenerateN(Int_t ntimes)
                  KeepTrack(nt); 
                  fNprimaries++;
                  
+                 //but count is as "generated" particle" only if it produced child(s) within cut
+                 if ((fCutOnChild && ncsel >0) || !fCutOnChild){
+                   ipa++;
+                 }
+                 
          //
          // Decay Products
          //              
index b00789c..bbd61ce 100644 (file)
@@ -47,6 +47,9 @@ public:
     virtual void SetDeltaPt(Float_t delta=0.01) {fDeltaPt = delta;}
     virtual void SetDecayer(AliDecayer* decayer) {fDecayer = decayer;}
     virtual void SetForceGammaConversion(Bool_t force=kTRUE) {fForceConv = force;}
+    virtual void SetKeepParent(Bool_t keep=kTRUE){fKeepParent= keep;} //Store parent even if it does not have childs within cuts
+    virtual void SetKeepIfOneChildSelected(Bool_t keep=kTRUE){fKeepIfOneChildSelected = keep;} //Accept parent and child even if other children are not within cut.
+    
     virtual void Draw(const char * opt);
     TF1 *  GetPt() { return fPtPara;}
     TF1 *  GetY() {return fYPara;}
@@ -82,6 +85,8 @@ protected:
     Bool_t      fSelectAll;    // Flag for transportation of Background while using SetForceDecay()
     AliDecayer  *fDecayer;     // ! Pointer to pythia object for decays
     Bool_t      fForceConv;    //
+    Bool_t      fKeepParent;   //  Store parent even if it does not have childs within cuts
+    Bool_t      fKeepIfOneChildSelected; //Accept parent and child even if other children are not within cut.
 
 private:
     AliGenParam(const AliGenParam &Param);