]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
including MC features
authormcosenti <mcosenti@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 10 Sep 2012 14:04:46 +0000 (14:04 +0000)
committermcosenti <mcosenti@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 10 Sep 2012 14:04:46 +0000 (14:04 +0000)
PWGGA/EMCALTasks/AliAnalysisTaskEMCALIsoPhoton.cxx
PWGGA/EMCALTasks/AliAnalysisTaskEMCALIsoPhoton.h
PWGGA/EMCALTasks/macros/AddTaskEMCALIsoPhoton.C

index e65ddf00816470afe262c026a34109e424d41a71..2560f97bc69c72e938db4c0080f7d63640daa281 100644 (file)
@@ -47,16 +47,21 @@ AliAnalysisTaskEMCALIsoPhoton::AliAnalysisTaskEMCALIsoPhoton() :
   fPeriod("LHC11c"),
   fTrigBit("kEMC7"),
   fIsTrain(0),
+  fIsMc(0),
   fExoticCut(0.97),
   fIsoConeR(0.4),
   fNDimensions(7),
   fECut(3.),
   fTrackMult(0),        
   fESD(0),
+  fMCEvent(0),
+  fStack(0),
   fOutputList(0),
   fEvtSel(0),
   fNClusEt10(0),
-  fPVtxZ(0),                 
+  fPVtxZ(0),  
+  fDirPhotonPtMC(0),
+  fDecayPhotonPtMC(0),
   fCellAbsIdVsAmpl(0),       
   fNClusHighClusE(0),
   fHnOutput(0)
@@ -77,17 +82,22 @@ AliAnalysisTaskEMCALIsoPhoton::AliAnalysisTaskEMCALIsoPhoton(const char *name) :
   fPeriod("LHC11c"),
   fTrigBit("kEMC7"),
   fIsTrain(0),
+  fIsMc(0),
   fExoticCut(0.97),
   fIsoConeR(0.4),
   fNDimensions(7),
   fECut(3.),
   fTrackMult(0),        
   fESD(0),
+  fMCEvent(0),
+  fStack(0),
   fOutputList(0),
   fEvtSel(0),
   fNClusEt10(0),
   fPVtxZ(0),            
-  fCellAbsIdVsAmpl(0),  
+  fDirPhotonPtMC(0),
+  fDecayPhotonPtMC(0),
+  fCellAbsIdVsAmpl(0),       
   fNClusHighClusE(0),   
   fHnOutput(0)
 {
@@ -123,7 +133,15 @@ void AliAnalysisTaskEMCALIsoPhoton::UserCreateOutputObjects()
   
   fPVtxZ = new TH1F("hPVtxZ","primary vertex Z before cut;prim-vz(cm) ;",200,-100,100);
   fOutputList->Add(fPVtxZ);
-  
+
+  fDirPhotonPtMC = new TH1F("hDirPhotonPtMC","photon (gq->#gammaq) p_{T};GeV/c;dN/dp_{T} (c GeV^{-1})",1000,0,100);
+  fDirPhotonPtMC->Sumw2();
+  fOutputList->Add(fDirPhotonPtMC);
+
+  fDecayPhotonPtMC = new TH1F("hDecayPhotonPtMC","decay photon p_{T};GeV/c;dN/dp_{T} (c GeV^{-1})",1000,0,100);
+  fDecayPhotonPtMC->Sumw2();
+  fOutputList->Add(fDecayPhotonPtMC);
+
   fCellAbsIdVsAmpl = new TH2F("hCellAbsIdVsAmpl","cell abs id vs cell amplitude (energy);E (GeV);ID",200,0,100,24*48*10,-0.5,24*48*10-0.5);
   fOutputList->Add(fCellAbsIdVsAmpl);
 
@@ -163,6 +181,8 @@ void AliAnalysisTaskEMCALIsoPhoton::UserExec(Option_t *)
     else
       isSelected =  (((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected() & AliVEvent::kINT7);
   }
+  if(fIsMc)
+    isSelected = kTRUE;
   if(!isSelected )
         return; 
 
@@ -217,6 +237,11 @@ void AliAnalysisTaskEMCALIsoPhoton::UserExec(Option_t *)
 
   fCaloClusters->Clear();
   fSelPrimTracks->Clear();
+
+  fMCEvent = MCEvent();
+  if(fMCEvent)
+    fStack = (AliStack*)fMCEvent->Stack();
+
   PostData(1, fOutputList);
 }      
 
@@ -445,6 +470,34 @@ Double_t AliAnalysisTaskEMCALIsoPhoton ::GetMaxCellEnergy(const AliVCluster *clu
   return maxe;
 }
 
+//________________________________________________________________________
+void AliAnalysisTaskEMCALIsoPhoton ::FillMcHists()
+{
+  if(!fStack)
+    return;
+  Int_t nTracks = fStack->GetNtrack();
+  for(Int_t iTrack=0;iTrack<nTracks;iTrack++){
+    TParticle *mcp = static_cast<TParticle*>(fStack->Particle(iTrack));  
+    if(!mcp)
+      continue;  
+    Int_t pdg = mcp->GetPdgCode();
+    if(pdg!=22)
+      continue;
+    Int_t imom = mcp->GetMother(0);
+    if(imom<0 || imom>nTracks)
+      continue;
+    TParticle *mcmom = static_cast<TParticle*>(fStack->Particle(imom));  
+    if(!mcmom)
+      continue;
+    Int_t pdgMom = mcmom->GetPdgCode();
+    if(TMath::Abs(pdgMom)<7)
+      fDirPhotonPtMC->Fill(mcp->Pt());
+    else{
+      if(TMath::Abs(pdgMom)>100 && TMath::Abs(pdgMom)<1000)
+       fDecayPhotonPtMC->Fill(mcp->Pt());
+    }
+  }
+}
 //________________________________________________________________________
 void AliAnalysisTaskEMCALIsoPhoton::Terminate(Option_t *) 
 {
index f03f7bf92a734f0520cd89bc0f0ee34b2da56bfd..6b28a8f242543cd7a15d1ce61cd9de91401d9ac3 100644 (file)
@@ -14,6 +14,9 @@ class AliESDEvent;
 class AliESDtrack;
 class AliESDtrackCuts;
 class AliVCluster;
+class AliMCEvent;
+class AliStack;
+class TParticle;
 
 #include "AliAnalysisTaskSE.h"
 
@@ -32,6 +35,7 @@ class AliAnalysisTaskEMCALIsoPhoton : public AliAnalysisTaskSE {
   Double_t               GetMaxCellEnergy(const AliVCluster *cluster, Short_t &id) const; 
   void                   GetTrIso(TVector3 vec, Float_t &iso, Float_t &phiband, Float_t &core);
   void                   FillClusHists();
+  void                   FillMcHists();
   void                   SetExotCut(Double_t c)                 { fExoticCut          = c;       }
   void                   SetGeoName(const char *n)              { fGeoName            = n;       }
   void                   SetIsoConeR(Double_t r)                { fIsoConeR           = r;       }
@@ -39,6 +43,7 @@ class AliAnalysisTaskEMCALIsoPhoton : public AliAnalysisTaskSE {
   void                   SetTriggerBit(const char *tb)          { fTrigBit            = tb;      }
   void                   SetPrimTrackCuts(AliESDtrackCuts *c)   { fPrTrCuts           = c;       }
   void                   SetTrainMode(Bool_t t)                 { fIsTrain            = t;       }
+  void                   SetMcMode(Bool_t mc)                   { fIsMc               = mc;      }
   
  protected:
   TRefArray             *fCaloClusters;          //!pointer to EMCal clusters
@@ -51,6 +56,7 @@ class AliAnalysisTaskEMCALIsoPhoton : public AliAnalysisTaskSE {
   TString                fPeriod;                // string to the LHC period
   TString                fTrigBit;               // string to the trigger bit name
   Bool_t                 fIsTrain;               // variable to set train mode
+  Bool_t                 fIsMc;                  // variable to set mc mode
   Double_t               fExoticCut;             // variable to set the cut on exotic clusters
   Double_t               fIsoConeR;              // variable to set the isolation cone radius
   Int_t                  fNDimensions;           // variable to set the number of dimensions of n-sparse
@@ -60,11 +66,16 @@ class AliAnalysisTaskEMCALIsoPhoton : public AliAnalysisTaskSE {
   
  private:
   AliESDEvent *fESD;      //! ESD object
+  AliMCEvent  *fMCEvent;  //! MC event object
+  AliStack    *fStack;    //!MC particles stack object
+
   TList       *fOutputList; //! Output list
   //histograms for events with 1+ track pt>1
   TH1F        *fEvtSel;                  //!evt selection counter: 0=all trg, 1=pv cut 
   TH1F        *fNClusEt10;               //!number of clusters w/ Et>10 in the event
   TH1F        *fPVtxZ;                   //!primary vertex Z before cut
+  TH1F        *fDirPhotonPtMC;           //!direct produced photon pt
+  TH1F        *fDecayPhotonPtMC;         //!decay photon pt
   TH2F        *fCellAbsIdVsAmpl;         //!cell abs id vs cell amplitude (energy)
   TH2F        *fNClusHighClusE;          //!total number of clusters vs. highest clus energy in the event
   THnSparse   *fHnOutput;                //!Output matrix with 7 dimensions
index dcd5f9ae4b324c8270fea9f10609f4ace54da883..08138e8c8c043fb575810926a33ba894066bc11b 100644 (file)
@@ -24,6 +24,7 @@ AliAnalysisTaskEMCALIsoPhoton *AddTaskEMCALIsoPhoton(
   //ana->SetClusThreshold(clusTh);
   
   ana->SetTrainMode(kTRUE);
+  ana->SetMcMode(isMC);
   ana->SetTriggerBit(trigbitname);
   // ana->SetMcMode(isMC);