]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PWGGA/EMCALTasks/AliAnalysisTaskEMCALPhoton.cxx
Relaxed the requirement for "mothers" to come before "daughters" in the data array.
[u/mrichter/AliRoot.git] / PWGGA / EMCALTasks / AliAnalysisTaskEMCALPhoton.cxx
index 4642ab7d4e823603703a1b9923ee156be219b4e9..ca22d58e7421eddda88e6609531c89f2d5a5c069 100644 (file)
@@ -69,6 +69,7 @@ AliAnalysisTaskEMCALPhoton::AliAnalysisTaskEMCALPhoton() :
   fMyTracks(0),
   fMyMcParts(0),
   fHeader(0x0),
+  fOADBContainer(0),
   fCaloClusters(0),
   fCaloClustersNew(0),
   fAODMCParticles(0),
@@ -120,6 +121,7 @@ AliAnalysisTaskEMCALPhoton::AliAnalysisTaskEMCALPhoton(const char *name) :
   fMyTracks(0),
   fMyMcParts(0),
   fHeader(0),
+  fOADBContainer(0),
   fCaloClusters(0),
   fCaloClustersNew(0),
   fAODMCParticles(0),
@@ -247,6 +249,8 @@ void AliAnalysisTaskEMCALPhoton::UserCreateOutputObjects()
   }
   //if(fIsGrid)fOutputList->Add(fTree);
   fGeom = AliEMCALGeometry::GetInstance(fGeoName);
+  fOADBContainer = new AliOADBContainer("AliEMCALgeo");
+  fOADBContainer->InitFromFile(Form("$ALICE_ROOT/OADB/EMCAL/EMCALlocal2master.root"),"AliEMCALgeo");
   
   
   fNV0sBefAndAftRerun = new TH2F("hNV0sBefAndAftRerun","check if the number of v0s change with rerun;old v0 n;new v0 n",50,0.5,50.5,50,0.5,50.5);
@@ -281,7 +285,7 @@ void AliAnalysisTaskEMCALPhoton::UserExec(Option_t *)
 {
   // User exec, called once per event.
 
-  Bool_t isSelected = 0;
+  Bool_t isSelected = kTRUE;
   if(fPeriod.Contains("11")){
     if(fPeriod.Contains("11a"))
       isSelected =  (((AliInputEventHandler*)(AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected() & AliVEvent::kEMC1);
@@ -340,6 +344,8 @@ void AliAnalysisTaskEMCALPhoton::UserExec(Option_t *)
     printf("Error: no primary vertex found!\n");
     return;
   }
+  if(!pvStatus && this->fDebug)
+    printf("bad pv status\n");
   if(TMath::Abs(pv->GetZ())>15)
     return;
   if(this->fDebug)
@@ -380,6 +386,7 @@ void AliAnalysisTaskEMCALPhoton::UserExec(Option_t *)
     
 
   fHeader->fInputFileName  = inpfile->GetName();
+  fHeader->fRunNumber =  runnumber;
   fHeader->fTrClassMask    = fVev->GetHeader()->GetTriggerMask();
   fHeader->fTrCluster      = fVev->GetHeader()->GetTriggerCluster();
   AliCentrality *cent = InputEvent()->GetCentrality();
@@ -387,9 +394,7 @@ void AliAnalysisTaskEMCALPhoton::UserExec(Option_t *)
   fHeader->fCl1Cent   = cent->GetCentralityPercentileUnchecked("CL1");
   fHeader->fTrCent    = cent->GetCentralityPercentileUnchecked("TRK");
 
-  AliOADBContainer emcGeoMat("AliEMCALgeo");
-  emcGeoMat.InitFromFile(Form("$ALICE_ROOT/OADB/EMCAL/EMCALlocal2master.root"),"AliEMCALgeo");
-  TObjArray *matEMCAL=(TObjArray*)emcGeoMat.GetObject(runnumber,"EmcalMatrices");
+  TObjArray *matEMCAL=(TObjArray*)fOADBContainer->GetObject(runnumber,"EmcalMatrices");
   for(Int_t mod=0; mod < (fGeom->GetEMCGeometry())->GetNumberOfSuperModules(); mod++){
     if(fGeoName=="EMCAL_FIRSTYEARV1" && mod>3)
       break;
@@ -468,7 +473,7 @@ void AliAnalysisTaskEMCALPhoton::UserExec(Option_t *)
   if(fIsMC)
     GetMcParts();
 
-  if(this->fDebug)
+  if(this->fDebug && fIsMC)
     printf("fMyMcParts nentries=%d",fMyMcParts->GetEntries());
   
   fTree->Fill();
@@ -616,7 +621,8 @@ void AliAnalysisTaskEMCALPhoton::FillMyCells()
   if (!fVCells)
     return;
   Int_t ncells = fVCells->GetNumberOfCells();
-  Int_t mcel = 0;
+  Int_t mcel = 0;//, maxcelid=-1;
+  Double_t maxcellE = 0;//, maxcellEta=0, maxcellPhi=0;
   for(Int_t icell = 0; icell<ncells; icell++){
     Int_t absID = TMath::Abs(fVCells->GetCellNumber(icell));
     AliPhotonCellObj *mycell = static_cast<AliPhotonCellObj*>(fMyCells->New(mcel++));
@@ -628,6 +634,12 @@ void AliAnalysisTaskEMCALPhoton::FillMyCells()
     if(!fGeom)
       return;
     /*if(!fIsMC)*/fGeom->EtaPhiFromIndex(absID,eta,phi);
+    if(maxcellE<fVCells->GetCellAmplitude(absID)){
+      maxcellE = fVCells->GetCellAmplitude(absID);
+      /*maxcellEta = eta;
+      maxcellPhi = phi;
+      maxcelid = absID;*/
+    }
     Float_t theta = 2*TMath::ATan(TMath::Exp(-eta));
     mycell->fAbsID = absID;
     mycell->fE = fVCells->GetCellAmplitude(absID);
@@ -654,7 +666,8 @@ void AliAnalysisTaskEMCALPhoton::FillMyClusters()
   Int_t nclus = fCaloClusters->GetEntries();
   if(0==nclus)
     printf("CaloClusters has ZERO entries\n");
-  Int_t mcl = 0;
+  Int_t mcl = 0, maxcelid=-1;
+  Double_t maxcellE=0, maxcellEtac=0,maxcellPhic=0;
   for(Int_t ic=0; ic < nclus; ic++){
     AliVCluster *clus = static_cast<AliVCluster*>(fCaloClusters->At(ic));
     if(!clus)
@@ -663,6 +676,8 @@ void AliAnalysisTaskEMCALPhoton::FillMyClusters()
       continue;
     if(clus->E() < fClusThresh)
       continue;
+    if(fDebug)
+      printf("cluster %d survived\n", ic);
     Float_t pos[3];
     clus->GetPosition(pos);
     TVector3 cpos(pos);
@@ -680,6 +695,12 @@ void AliAnalysisTaskEMCALPhoton::FillMyClusters()
     Short_t  id = -1;
     myclus->fEmax    = GetMaxCellEnergy( clus, id); 
     myclus->fIdmax   = id;
+    if(maxcellE <  myclus->fEmax){
+      maxcellE =  myclus->fEmax;
+      maxcelid = id;
+      maxcellEtac = cpos.Eta();
+      maxcellPhic = cpos.Phi();
+    }
     myclus->fTmax    = fVCells->GetCellTime(id);
     myclus->fEcross  = GetCrossEnergy( clus, id);
     myclus->fDisp    = clus->GetDispersion();
@@ -720,8 +741,10 @@ void AliAnalysisTaskEMCALPhoton::FillMyClusters()
     myclus->fTrEp = clus->E()/track->P();
     myclus->fTrDedx = track->GetTPCsignal();
   }
-  if(this->fDebug)
+  if(this->fDebug){
+    printf(" ---===+++ Max Cell among clusters: id=%d, E=%1.2f, eta-clus=%1.2f, phi-clus=%1.2f\n",maxcelid,maxcellE,maxcellEtac,maxcellPhic);
     printf("::FillMyClusters() returning...\n\n");
+  }
   
 }
 //________________________________________________________________________
@@ -1001,7 +1024,7 @@ Double_t AliAnalysisTaskEMCALPhoton::GetMcIsolation( Int_t itrack, Double_t radi
     printf("\t\t::GetMcIsolation() starting\n");
     //printf("\t\t   incoming particle: PDG = %d, itrack=%d;\n",mcP->GetPdgCode(),itrack);
   }
-  if (!this->fStack && !this->fAODMCParticles){
+  if (!this->fStack && !this->fAODMCParticles && this->fDebug){
     printf("\t\t\tNo MC stack/array!\n");
     return -1;
   }