]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
adding switches for 2011 data
authorcnattras <saccharomyces.cerevisae@gmail.com>
Tue, 24 Jun 2014 01:02:46 +0000 (21:02 -0400)
committercnattras <saccharomyces.cerevisae@gmail.com>
Tue, 24 Jun 2014 01:02:46 +0000 (21:02 -0400)
PWGLF/totEt/AliAnalysisHadEtMonteCarlo.cxx
PWGLF/totEt/AliAnalysisHadEtMonteCarlo.h
PWGLF/totEt/AliAnalysisTaskHadEt.cxx

index 77f31b54a8f750ccd5d15bff3ea67799d89631f9..406dc6dc6b9ea8729e993557ea73f7f738f6d258 100644 (file)
@@ -33,6 +33,9 @@
 #include "AliTPCPIDResponse.h" 
 #include "AliInputEventHandler.h"
 #include "AliAnalysisManager.h"
+#include "AliGenEventHeader.h"
+#include "AliGenCocktailEventHeader.h"
+#include "AliGenHijingEventHeader.h"
 //class AliPWG0Helper;
 //#include "$ALICE_ROOT/PWG0/AliPWG0Helper.h"
 
@@ -45,6 +48,9 @@ Int_t AliAnalysisHadEtMonteCarlo::fgNumSmearWidths = 4;
 Float_t AliAnalysisHadEtMonteCarlo::fgSmearWidths[4] = {0.005,0.006,0.007,0.008};
 
 AliAnalysisHadEtMonteCarlo::AliAnalysisHadEtMonteCarlo():AliAnalysisHadEt()
+                                                       ,checkLabelForHIJING(kFALSE)
+                                                       ,fNMCProducedMin(0)
+                                                       ,fNMCProducedMax(0)
                                                        ,fSimPiKPEt(0)
                                                        ,fSimRawEtTPC(0)
                                                        ,fSimRawEtITS(0)
@@ -97,6 +103,8 @@ Int_t AliAnalysisHadEtMonteCarlo::AnalyseEvent(AliVEvent* ev,AliVEvent* ev2)
     return 0;
   }
   AliStack *stack = mcEvent->Stack();
+
+  if(checkLabelForHIJING) SetGeneratorMinMaxParticles(mcEvent);
   fCentBin= -1;
   fGoodEvent = kTRUE;//for p+p collisions if we made it this far we have a good event
   if(fDataSet==20100){//If this is Pb+Pb
@@ -167,6 +175,9 @@ Int_t AliAnalysisHadEtMonteCarlo::AnalyseEvent(AliVEvent* ev,AliVEvent* ev2)
     for (Int_t iTrack = 0; iTrack < nGoodTracks; iTrack++)
       {
        AliESDtrack *track = dynamic_cast<AliESDtrack*> (list->At(iTrack));
+       UInt_t label = (UInt_t)TMath::Abs(track->GetLabel());
+       if(checkLabelForHIJING && !IsHIJINGLabel(label,mcEvent,stack) ){cout<<"I am rejecting this particle because it is not HIJING"<<endl;}
+       if(checkLabelForHIJING && !IsHIJINGLabel(label,mcEvent,stack) ) continue;
        if (!track)
          {
            Printf("ERROR: Could not get track %d", iTrack);
@@ -218,7 +229,6 @@ Int_t AliAnalysisHadEtMonteCarlo::AnalyseEvent(AliVEvent* ev,AliVEvent* ev2)
 
          FillHisto2D(Form("dEdxAll%s",cutName->Data()),track->P(),dEdx,1.0);
 
-         UInt_t label = (UInt_t)TMath::Abs(track->GetLabel());
            TParticle  *simPart  = stack->Particle(label);
          if(!simPart) {
            Printf("no MC particle\n");                 
@@ -1059,6 +1069,7 @@ Int_t AliAnalysisHadEtMonteCarlo::AnalyseEvent(AliVEvent* ev)
     // Let's play with the stack!
     AliStack *stack = mcEvent->Stack();
 
+
     Int_t nPrim = stack->GetNtrack();
 
     Float_t fSimPiKPEtPtSmeared = 0;
@@ -1078,6 +1089,8 @@ Int_t AliAnalysisHadEtMonteCarlo::AnalyseEvent(AliVEvent* ev)
 
       TParticle *part = stack->Particle(iPart);//This line is identified as a loss of memory by valgrind, however, the pointer still belongs to the stack, so it's the stack's problem
 
+       if(checkLabelForHIJING && !IsHIJINGLabel(iPart,mcEvent,stack) ) continue;
+
         if (!part)
          {
             Printf("ERROR: Could not get particle %d", iPart);
@@ -2495,3 +2508,114 @@ void AliAnalysisHadEtMonteCarlo::CreateHistograms(){
 
 }
 
+void AliAnalysisHadEtMonteCarlo::SetGeneratorMinMaxParticles(AliMCEvent *eventMC){
+  // In case of access only to hijing particles in cocktail
+  // get the min and max labels
+  // TODO: Check when generator is not the first one ...
+  
+  fNMCProducedMin = 0;
+  fNMCProducedMax = 0;
+  
+  AliGenEventHeader * eventHeader = eventMC->GenEventHeader();
+  
+  AliGenCocktailEventHeader *cocktail = dynamic_cast<AliGenCocktailEventHeader *>(eventHeader);
+  
+  if(!cocktail) return ;
+    
+  TList *genHeaders = cocktail->GetHeaders();
+  
+  Int_t nGenerators = genHeaders->GetEntries();
+  //printf("N generators %d \n", nGenerators);
+  
+  for(Int_t igen = 0; igen < nGenerators; igen++)
+    {
+      AliGenEventHeader * eventHeader2 = (AliGenEventHeader*)genHeaders->At(igen) ;
+      TString name = eventHeader2->GetName();
+      
+      //printf("Generator %d: Class Name %s, Name %s, title %s \n",igen, eventHeader2->ClassName(), name.Data(), eventHeader2->GetTitle());
+      
+      fNMCProducedMin = fNMCProducedMax;
+      fNMCProducedMax+= eventHeader2->NProduced();
+      
+      if(name.Contains("Hijing",TString::kIgnoreCase)){
+       //cout<<"Found HIJING event and set range "<<fNMCProducedMin<<"-"<<fNMCProducedMax<<endl;
+       return ;
+      }
+    }
+        
+}
+AliGenEventHeader* AliAnalysisHadEtMonteCarlo::GetGenEventHeader(AliMCEvent *eventMC) const
+{
+  // Return pointer to Generated event header
+  // If requested and cocktail, search for the hijing generator
+  AliGenEventHeader * eventHeader = eventMC->GenEventHeader();
+  AliGenCocktailEventHeader *cocktail = dynamic_cast<AliGenCocktailEventHeader *>(eventHeader);
+  
+  if(!cocktail) return 0x0 ;
+  
+  TList *genHeaders = cocktail->GetHeaders();
+  
+  Int_t nGenerators = genHeaders->GetEntries();
+  //printf("N generators %d \n", nGenerators);
+  
+  for(Int_t igen = 0; igen < nGenerators; igen++)
+    {
+      AliGenEventHeader * eventHeader2 = (AliGenEventHeader*)genHeaders->At(igen) ;
+      TString name = eventHeader2->GetName();
+      
+      //printf("Generator %d: Class Name %s, Name %s, title %s \n",igen, eventHeader2->ClassName(), name.Data(), eventHeader2->GetTitle());
+      
+      if(name.Contains("Hijing",TString::kIgnoreCase)) return eventHeader2 ;
+    }
+  
+  return 0x0;
+  
+}
+Bool_t AliAnalysisHadEtMonteCarlo::IsHIJINGLabel(Int_t label,AliMCEvent *eventMC,AliStack *stack)
+{
+  // Find if cluster/track was generated by HIJING
+  
+  AliGenHijingEventHeader*  hijingHeader =  dynamic_cast<AliGenHijingEventHeader *> (GetGenEventHeader(eventMC));
+  
+  //printf("header %p, label %d\n",hijingHeader,label);
+  
+  if(!hijingHeader || label < 0 ) return kFALSE;
+  
+  
+  //printf("pass a), N produced %d\n",nproduced);
+  
+  if(label >= fNMCProducedMin && label < fNMCProducedMax)
+  {
+    //printf(" accept!, label is smaller than produced, N %d\n",nproduced);
+
+    return kTRUE;
+  }
+  
+  if(!stack) return kFALSE;
+  
+  Int_t nprimaries = stack->GetNtrack();
+  
+  if(label > nprimaries) return kFALSE;
+    
+  TParticle * mom = stack->Particle(label);
+    
+  Int_t iMom = label;
+  Int_t iParent = mom->GetFirstMother();
+  while(iParent!=-1){
+    if(iParent >= fNMCProducedMin && iParent < fNMCProducedMax){
+      return kTRUE;
+    }
+      
+    iMom = iParent;
+    mom = stack->Particle(iMom);
+    iParent = mom->GetFirstMother();
+  }
+    
+  return kFALSE ;
+    
+}
+
+
+
+
index db0d41fba1af6cfb15ee531fca8eee52e8715bda..8ccc8071d0e860a7513c3e66d13f5884aa5cae2c 100644 (file)
@@ -13,6 +13,9 @@
 class AliVEvent;
 class TRandom;
 class AliAnalysisHadEtReconstructed;
+class AliMCEvent;
+class AliGenEventHeader;
+class AliStack;
 
 class AliAnalysisHadEtMonteCarlo : public AliAnalysisHadEt
 {
@@ -131,7 +134,17 @@ public:
     void DoTriggerChecksOnly(){kDoTriggerChecksOnly=kTRUE;}
     void SetIsOfflineV0AND(Bool_t val){kIsOfflineV0AND = val;}
     void SetIsOfflineMB(Bool_t val){kIsOfflineMB = val;}
+
+
+    void SetGeneratorMinMaxParticles(AliMCEvent *eventMC);
+    AliGenEventHeader* GetGenEventHeader(AliMCEvent *eventMC) const;
+    Bool_t IsHIJINGLabel(Int_t label,AliMCEvent *eventMC,AliStack *stack);
+    void CheckForHIJINGLabel(){checkLabelForHIJING = kTRUE;}
+
  protected:
+    Bool_t checkLabelForHIJING;//Boolean - do we need to check this data set for HIJING labels?  We don't need to do this unless there were signals embedded
+    Int_t            fNMCProducedMin;             // In case of cocktail, select particles in the list with label from this value
+    Int_t            fNMCProducedMax;             // In case of cocktail, select particles in the list with label up to this value
 
  private:
     //Declare it private to avoid compilation warning
@@ -167,8 +180,8 @@ public:
     //Float_t fSimPiKPEtSmeared[4];//simulated Et for pi,k,p smeared for each event by different momentum resolutions
     static Float_t fgSmearWidths[4];//array with widths for smearing with different momentum resultions
     static Int_t fgNumSmearWidths;//number of entries in the array above
-    TRandom *fPtSmearer;//!a TRandom used for investigating momentum smearing
-    AliAnalysisHadEtReconstructed *fHadEtReco;//!corresponding class for data reconstruction.  Used to access corrections directly used here.
+    TRandom *fPtSmearer;//a TRandom used for investigating momentum smearing
+    AliAnalysisHadEtReconstructed *fHadEtReco;//corresponding class for data reconstruction.  Used to access corrections directly used here.
 
     ClassDef(AliAnalysisHadEtMonteCarlo, 1);
 };
index f060883a73c5c8ac2b1fcb4f7d186148987362ed..743eb2170d6e8f8b0076f07d83b1c66822546cdf 100644 (file)
@@ -179,7 +179,7 @@ void AliAnalysisTaskHadEt::UserCreateOutputObjects()
     fEsdtrackCutsITS =  AliESDtrackCuts::GetStandardITSSATrackCuts2010(kTRUE,kFALSE);//we do want primaries but we do not want to require PID info
     fEsdtrackCutsITS->SetName("fEsdTrackCutsITS");
   }
-  if(fRecAnalysis->DataSet()==20100){
+  if(fRecAnalysis->DataSet()==20100 || fRecAnalysis->DataSet()==2011){
     cout<<"Setting track cuts for the 2010 Pb+Pb collisions at 2.76 TeV"<<endl;
     //cout<<"Warning:  Have not set 2010 track cuts yet!!"<<endl;
     fEsdtrackCutsITSTPC = AliESDtrackCuts::GetStandardITSTPCTrackCuts2010(selectPrimaries);