]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
new method to reject events triggered by clusters from other BC
authorgconesab <gconesab@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sat, 8 Jun 2013 19:50:44 +0000 (19:50 +0000)
committergconesab <gconesab@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sat, 8 Jun 2013 19:50:44 +0000 (19:50 +0000)
PWG/CaloTrackCorrBase/AliAnaCaloTrackCorrMaker.cxx
PWG/CaloTrackCorrBase/AliAnaCaloTrackCorrMaker.h
PWG/CaloTrackCorrBase/AliCaloTrackReader.cxx
PWG/CaloTrackCorrBase/AliCaloTrackReader.h
PWGGA/CaloTrackCorrelations/AliAnaPhoton.cxx
PWGGA/CaloTrackCorrelations/AliAnaPhoton.h
PWGGA/CaloTrackCorrelations/AliAnaPi0EbE.cxx
PWGGA/CaloTrackCorrelations/AliAnaPi0EbE.h

index 22980918cd898cbba7f404d6ca09cf895783fe4f..22097aa31983e5b7ae8e91f4558e0d803a48997f 100755 (executable)
@@ -49,7 +49,8 @@ fOutputContainer(new TList ), fAnalysisContainer(new TList ),
 fMakeHisto(kFALSE),           fMakeAOD(kFALSE), 
 fAnaDebug(0),                 fCuts(new TList), 
 fScaleFactor(-1),
-fhNEvents(0),                 fhNExoticEvents(), fhNPileUpEvents(0),
+fhNEvents(0),                 fhNExoticEvents(0),
+fhNPileUpEvents(0),           fhNPileUpEventsTriggerBC0(0),
 fhZVertex(0),                 
 fhPileUpClusterMult(0),       fhPileUpClusterMultAndSPDPileUp(0),
 fhTrackMult(0),
@@ -58,7 +59,8 @@ fhNMergedFiles(0),            fhScaleFactor(0),
 fhEMCalBCEvent(0),            fhEMCalBCEventCut(0),
 fhTrackBCEvent(0),            fhTrackBCEventCut(0),
 fhPrimaryVertexBC(0),         fhTimeStampFraction(0),
-fhNPileUpVertSPD(0),          fhNPileUpVertTracks(0)
+fhNPileUpVertSPD(0),          fhNPileUpVertTracks(0),
+fhPileUpClusterTrigger(0)
 {
   //Default Ctor
   if(fAnaDebug > 1 ) printf("*** Analysis Maker Constructor *** \n");
@@ -79,7 +81,8 @@ fScaleFactor(maker.fScaleFactor),
 fhNEvents(maker.fhNEvents),
 fhNExoticEvents(maker.fhNExoticEvents),
 fhNPileUpEvents(maker.fhNPileUpEvents),
-fhZVertex(maker.fhZVertex),    
+fhNPileUpEventsTriggerBC0(maker.fhNPileUpEventsTriggerBC0),
+fhZVertex(maker.fhZVertex),
 fhPileUpClusterMult(maker.fhPileUpClusterMult),
 fhPileUpClusterMultAndSPDPileUp(maker.fhPileUpClusterMultAndSPDPileUp),
 fhTrackMult(maker.fhTrackMult),
@@ -94,7 +97,8 @@ fhTrackBCEventCut(maker.fhTrackBCEventCut),
 fhPrimaryVertexBC(maker.fhPrimaryVertexBC),
 fhTimeStampFraction(maker.fhTimeStampFraction),
 fhNPileUpVertSPD(maker.fhNPileUpVertSPD),
-fhNPileUpVertTracks(maker.fhNPileUpVertTracks)
+fhNPileUpVertTracks(maker.fhNPileUpVertTracks),
+fhPileUpClusterTrigger(maker.fhPileUpClusterTrigger)
 {
   // cpy ctor
 }
@@ -173,7 +177,7 @@ void AliAnaCaloTrackCorrMaker::FillControlHistograms()
   AliAODEvent* aodevent = dynamic_cast<AliAODEvent*> (event);
   
   fhNEvents        ->Fill(0); // Number of events analyzed
-    
+  
   if( fReader->IsPileUpFromSPD())
     fhNPileUpEvents->Fill(0.5);
   //if( event->IsPileupFromSPDInMultBins())
@@ -191,6 +195,27 @@ void AliAnaCaloTrackCorrMaker::FillControlHistograms()
   if( fReader->IsPileUpFromNotSPDAndNotEMCal() )
     fhNPileUpEvents->Fill(7.5);
   
+  if(fReader->IsPileUpClusterTriggeredEvent() == 0 ||
+     fReader->IsPileUpClusterTriggeredEvent() == 6   )
+  {
+    if( fReader->IsPileUpFromSPD())
+      fhNPileUpEventsTriggerBC0->Fill(0.5);
+    //if( event->IsPileupFromSPDInMultBins())
+    //  fhNPileUpEventsTriggerBC0->Fill(1.5);
+    if( fReader->IsPileUpFromEMCal())
+      fhNPileUpEventsTriggerBC0->Fill(2.5);
+    if( fReader->IsPileUpFromSPDOrEMCal() )
+      fhNPileUpEventsTriggerBC0->Fill(3.5);
+    if( fReader->IsPileUpFromSPDAndEMCal() )
+      fhNPileUpEventsTriggerBC0->Fill(4.5);
+    if( fReader->IsPileUpFromSPDAndNotEMCal() )
+      fhNPileUpEventsTriggerBC0->Fill(5.5);
+    if( fReader->IsPileUpFromEMCalAndNotSPD() )
+      fhNPileUpEventsTriggerBC0->Fill(6.5);
+    if( fReader->IsPileUpFromNotSPDAndNotEMCal() )
+      fhNPileUpEventsTriggerBC0->Fill(7.5);
+  }
+  
   if(fReader->IsPileUpFromSPD())
     fhPileUpClusterMultAndSPDPileUp ->Fill(fReader->GetNPileUpClusters());
     
@@ -245,8 +270,6 @@ void AliAnaCaloTrackCorrMaker::FillControlHistograms()
 
     fhTimeStampFraction->Fill(timeStampFrac);
   }
-  
-  
 }
 
 //_______________________________________________________
@@ -287,6 +310,15 @@ TList *AliAnaCaloTrackCorrMaker::GetOutputContainer()
   fhNExoticEvents->SetYTitle("# exotic events");
   fOutputContainer->Add(fhNExoticEvents);
   
+  fhPileUpClusterTrigger      = new TH1F("hNPileUpClusterTriggerEvents",   "Number of analyzed events triggered by a cluster in a BC"     , 13 , -5 , 8  ) ;
+  fhPileUpClusterTrigger->SetYTitle("# events");
+  //fhPileUpClusterTrigger->SetXTitle("# BC");
+  for(Int_t i = 1; i < 12; i++)
+    fhPileUpClusterTrigger->GetXaxis()->SetBinLabel(i ,Form("BC%d",i-6));
+  fhPileUpClusterTrigger->GetXaxis()->SetBinLabel(12 ,"No Match,High E, BC0");
+  fhPileUpClusterTrigger->GetXaxis()->SetBinLabel(13 ,"No Match");
+  fOutputContainer->Add(fhPileUpClusterTrigger);
+  
   fhNPileUpEvents      = new TH1F("hNPileUpEvents",   "Number of events considered as pile-up", 8 , 0 , 8 ) ;
   fhNPileUpEvents->SetYTitle("# events");
   fhNPileUpEvents->GetXaxis()->SetBinLabel(1 ,"SPD");
@@ -298,6 +330,19 @@ TList *AliAnaCaloTrackCorrMaker::GetOutputContainer()
   fhNPileUpEvents->GetXaxis()->SetBinLabel(7 ,"EMCal && !SPD");
   fhNPileUpEvents->GetXaxis()->SetBinLabel(8 ,"!EMCal && !SPD");
   fOutputContainer->Add(fhNPileUpEvents);
+
+  fhNPileUpEventsTriggerBC0      = new TH1F("hNPileUpEventsTriggerBC0","Number of events considered as pile-up, trigger cluster in BC=0", 8 , 0 , 8 ) ;
+  fhNPileUpEventsTriggerBC0->SetYTitle("# events");
+  fhNPileUpEventsTriggerBC0->GetXaxis()->SetBinLabel(1 ,"SPD");
+  fhNPileUpEventsTriggerBC0->GetXaxis()->SetBinLabel(2 ,"Multi SPD");
+  fhNPileUpEventsTriggerBC0->GetXaxis()->SetBinLabel(3 ,"EMCal");
+  fhNPileUpEventsTriggerBC0->GetXaxis()->SetBinLabel(4 ,"EMCal || SPD");
+  fhNPileUpEventsTriggerBC0->GetXaxis()->SetBinLabel(5 ,"EMCal && SPD");
+  fhNPileUpEventsTriggerBC0->GetXaxis()->SetBinLabel(6 ,"!EMCal && SPD");
+  fhNPileUpEventsTriggerBC0->GetXaxis()->SetBinLabel(7 ,"EMCal && !SPD");
+  fhNPileUpEventsTriggerBC0->GetXaxis()->SetBinLabel(8 ,"!EMCal && !SPD");
+  fOutputContainer->Add(fhNPileUpEventsTriggerBC0);
+
   
   fhTrackBCEvent      = new TH1F("hTrackBCEvent",   "Number of events with at least 1 track in a bunch crossing ", 19 , 0 , 19 ) ;
   fhTrackBCEvent->SetYTitle("# events");
@@ -543,15 +588,19 @@ void AliAnaCaloTrackCorrMaker::ProcessEvent(const Int_t iEntry,
   
   //Tell the reader to fill the data in the 3 detector lists
   Bool_t ok = fReader->FillInputEvent(iEntry, currentFileName);
+  
+  if(fReader->IsExoticEvent()) fhNExoticEvents->Fill(0) ;
+  
+  fhPileUpClusterTrigger->Fill(fReader->IsPileUpClusterTriggeredEvent());
+  //printf("Maker: Cluster trigger BC = %d\n",fReader->IsPileUpClusterTriggeredEvent());
+
   if(!ok)
-  {
-    if(fReader->IsExoticEvent()) fhNExoticEvents->Fill(0) ;
-    
+  {    
          if(fAnaDebug >= 1 )printf("*** Skip event *** %d \n",iEntry);
     fReader->ResetLists();
          return ;
   }
-       
+  
   //Magic line to write events to file
   if(fReader->WriteDeltaAODToFile())AliAnalysisManager::GetAnalysisManager()->GetOutputEventHandler()->SetFillAOD(kTRUE);
   
index 9f30798af6a63b5251a8ff72f1859cedb7e8cce1..9d454c9e81974a67fc1b7bcd7ff6e570840f9fe6 100755 (executable)
@@ -97,6 +97,7 @@ class AliAnaCaloTrackCorrMaker : public TObject {
   TH1F *   fhNEvents;           //! Number of events counter histogram
   TH1F *   fhNExoticEvents;     //! Number of events triggered by exotic, counter histogram
   TH1F *   fhNPileUpEvents;     //! N events pasing pile up cut
+  TH1F *   fhNPileUpEventsTriggerBC0; //! N events pasing pile up cut
   TH1F *   fhZVertex;           //! Vertex of accepted event
   TH1F *   fhPileUpClusterMult; //! N clusters with high time
   TH1F *   fhPileUpClusterMultAndSPDPileUp; //! N clusters with high time in events tagged as pile-up by SPD
@@ -113,10 +114,11 @@ class AliAnaCaloTrackCorrMaker : public TObject {
   TH1F *   fhTimeStampFraction; //! event fraction depending on Time Stamp, only if activated on reader
   TH1F *   fhNPileUpVertSPD;    //! number of pile-up vertices from SPD
   TH1F *   fhNPileUpVertTracks; //! number of pile-up vertices from tracks
+  TH1F *   fhPileUpClusterTrigger; //! number of events triggered, depending on BC of the cluster
   
   AliAnaCaloTrackCorrMaker & operator = (const AliAnaCaloTrackCorrMaker & ) ; // cpy assignment
   
-  ClassDef(AliAnaCaloTrackCorrMaker,16)
+  ClassDef(AliAnaCaloTrackCorrMaker,17)
 } ;
  
 
index 9203d7c900cc19565386b336c091caba20ef3b2e..ca7b3900075fc07436209d01bdda2e1ade226c8b 100755 (executable)
@@ -93,8 +93,9 @@ fLastMixedTracksEvent(-1),   fLastMixedCaloEvent(-1),
 fWriteOutputDeltaAOD(kFALSE),fOldAOD(kFALSE),                 fCaloFilterPatch(kFALSE),
 fEMCALClustersListName(""),  fZvtxCut(0.),                    
 fAcceptFastCluster(kFALSE),  fRemoveLEDEvents(kTRUE),
-fRemoveExoticEvents(kFALSE), fTriggerPatchExoticRejection(1), fExoticTrigger(3.),
-fIsExoticEvent(kFALSE),      fForceExoticRejection(kFALSE),
+fRemoveExoticEvents(kFALSE), fRemoveTriggerOutBCEvents(kFALSE),
+fTriggerPatchExoticRejection(1), fTriggerEventThreshold(3.),
+fIsExoticEvent(kFALSE),      fIsTriggerEventOutBC(0),         fForceExoticRejection(kFALSE),
 fDoEventSelection(kFALSE),   fDoV0ANDEventSelection(kFALSE),
 fDoVertexBCEventSelection(kFALSE),
 fDoRejectNoTrackEvents(kFALSE),
@@ -696,16 +697,39 @@ Bool_t AliCaloTrackReader::FillInputEvent(const Int_t iEntry,
   }
   
   
+  //Get Patches that triggered
+  TArrayI patches = GetL0TriggerPatches();
+  
   //--------------------------------------------------------------------------------------------
   // Do not count events that where likely triggered by an exotic cluster
   //--------------------------------------------------------------------------------------------
+  
+  fIsExoticEvent = kFALSE ;
   if(fRemoveExoticEvents)
   {
-    RejectExoticEvents();
-    //printf("Is this event exotic? %d\n",fIsExoticEvent);
-    if(fIsExoticEvent) return kFALSE;
+    RejectExoticEvents(patches);
+    if(fIsExoticEvent)
+    {
+      //printf("AliCaloTrackReader::FillInputEvent() - REJECT exotic triggered event \n");
+      return kFALSE;
+    }
+  }
+  
+  fIsTriggerEventOutBC = -1 ;
+  RejectTriggeredEventsByPileUp(patches);
+  //printf("AliCaloTrackReader::FillInputEvent(), Trigger BC = %d\n",fIsTriggerEventOutBC);
+
+  if(fRemoveTriggerOutBCEvents)
+  {
+    if(fIsTriggerEventOutBC != 0 && fIsTriggerEventOutBC != 6)
+    {
+      //printf("\t REJECT, bad trigger cluster BC\n");
+      return kFALSE;
+    }
   }
   
+  patches.Reset();
+  
   //-------------------------------------------------------------------------------------
   // Reject event if large clusters with large energy
   // Use only for LHC11a data for the moment, and if input is clusterizer V1 or V1+unfolding
@@ -943,7 +967,6 @@ void AliCaloTrackReader::ResetLists()
   fV0ADC[0] = 0;   fV0ADC[1] = 0; 
   fV0Mul[0] = 0;   fV0Mul[1] = 0;
   
-  fIsExoticEvent = kFALSE;
 }
 
 //____________________________________________________________
@@ -1774,8 +1797,72 @@ Bool_t AliCaloTrackReader::CheckForPrimaryVertex()
   
 }
 
-//____________________________________________
-void  AliCaloTrackReader::RejectExoticEvents()
+//_______________________________________________
+TArrayI AliCaloTrackReader::GetL0TriggerPatches()
+{
+  //Select the patches that triggered
+  
+  // some variables
+  Int_t  trigtimes[30], globCol, globRow,ntimes, i;
+  Int_t  absId  = -1; //[100];
+  Int_t  nPatch = 0;
+  
+  TArrayI patches(0);
+  
+  // get object pointer
+  AliVCaloTrigger *caloTrigger = GetInputEvent()->GetCaloTrigger( "EMCAL" );
+  
+  // class is not empty
+  if( caloTrigger->GetEntries() > 0 )
+  {
+    // must reset before usage, or the class will fail
+    caloTrigger->Reset();
+    
+    // go throuth the trigger channels
+    while( caloTrigger->Next() )
+    {
+      // get position in global 2x2 tower coordinates
+      caloTrigger->GetPosition( globCol, globRow );
+      
+      // get dimension of time arrays
+      caloTrigger->GetNL0Times( ntimes );
+      
+      // no L0s in this channel
+      // presence of the channel in the iterator still does not guarantee that L0 was produced!!
+      if( ntimes < 1 )
+        continue;
+      
+      // get timing array
+      caloTrigger->GetL0Times( trigtimes );
+      
+      //printf("trigger time window %d - %d\n",fTriggerPatchTimeWindow[0],fTriggerPatchTimeWindow[1]);
+      // go through the array
+      for( i = 0; i < ntimes; i++ )
+      {
+        // check if in cut - 8,9 shall be accepted in 2011
+        if( trigtimes[i] >= fTriggerPatchTimeWindow[0] && trigtimes[i] <= fTriggerPatchTimeWindow[1] )
+        {
+          //printf("Accepted trigger time %d \n",trigtimes[i]);
+          //if(nTrig > 99) continue;
+          GetCaloUtils()->GetEMCALGeometry()->GetAbsFastORIndexFromPositionInEMCAL(globCol,globRow, absId);//absIDTrig[nTrig]) ;
+          //printf("pass the time cut globCol %d, globRow %d absId %d\n",globCol,globRow, absIDTrig[nTrig]);
+          patches.Set(nPatch+1);
+          patches.AddAt(absId,nPatch++);
+        }
+      } // trigger time array
+      
+    } // trigger iterator
+  } // go thorough triggers
+
+  //printf("N patches %d, test %d,first %d, last %d\n",patches.GetSize(), nTrig, patches.At(0), patches.At(patches.GetSize()-1));
+  
+  return patches;
+}
+
+
+
+//___________________________________________________________
+void  AliCaloTrackReader::RejectExoticEvents(TArrayI patches)
 {
   // Reject events triggered by exotic cells
   
@@ -1799,36 +1886,29 @@ void  AliCaloTrackReader::RejectExoticEvents()
       AliVCluster * clus = 0;
       if ( (clus = fInputEvent->GetCaloCluster(iclus)) )
       {
-        if (IsEMCALCluster(clus) && clus->E() > fExoticTrigger)
+        if (IsEMCALCluster(clus) && clus->E() > fTriggerEventThreshold)
         {
           Bool_t exotic = GetCaloUtils()->GetEMCALRecoUtils()->IsExoticCluster(clus, fInputEvent->GetEMCALCells());
-          Bool_t bad    = GetCaloUtils()->GetEMCALRecoUtils()->ClusterContainsBadChannel(GetCaloUtils()->GetEMCALGeometry(),clus->GetCellsAbsId(),clus->GetNCells());
-          
-          if     ( exotic) nExo++;
-          else if(!bad   ) nOfHighECl++;
+          Bool_t bad    = GetCaloUtils()->GetEMCALRecoUtils()->ClusterContainsBadChannel(GetCaloUtils()->GetEMCALGeometry(),
+                                                                                         clus->GetCellsAbsId(),clus->GetNCells());
           
-//          Float_t frac = -1;
-//          Int_t absId = GetCaloUtils()->GetMaxEnergyCell(fInputEvent->GetEMCALCells(), clus,frac);
-//          
-//          printf("Cluster E %f, AbsIdMax %d, sm %d, col %d, row %d, shared %d\n",clus->E(),absId,iSupMod,ieta,iphi,shared);
-//          printf("\t list of cells of exotic: ");
-//
-//          for(Int_t iCell = 0; iCell<clus->GetNCells(); iCell++)
-//          {
-//            printf(" id %d - E %2.2f; ",clus->GetCellsAbsId()[iCell], fInputEvent->GetEMCALCells()->GetCellAmplitude(clus->GetCellsAbsId()[iCell]));
-//          }
-//          printf("\n");
+          if     ( exotic)
+          {
+            //printf("- Exotic E %f, tof %f\n",clus->E(),clus->GetTOF()*1e9);
+            nExo++;
+          }
+          else if(!bad  && !exotic) nOfHighECl++;
           
         }//EMCAL cluster
       }// cluster exists
     }// cluster loop
     
-//    printf("- trigger %2.1f, n Exotic %d, n high energy %d\n", fExoticTrigger,nExo,nOfHighECl);
+    //printf("- trigger %2.1f, n Exotic %d, n high energy %d\n", fTriggerEventThreshold,nExo,nOfHighECl);
     
     if ( ( nExo > 0 ) && ( nOfHighECl == 0 ) )
     {
       fIsExoticEvent = kTRUE ;
-//      printf("*** Exotic Event\n");
+      //printf("*** Exotic Event\n");
     }
     else
       fIsExoticEvent = kFALSE;
@@ -1838,57 +1918,9 @@ void  AliCaloTrackReader::RejectExoticEvents()
   else
   {
     //printf("Trigger Exotic?\n");
-    // some variables
-    Int_t  trigtimes[30], globCol, globRow,ntimes, i;
-    Int_t  absIDTrig[100];
-    Bool_t trigInCut    = kFALSE;
-    Int_t  nTrig = 0;
-    // get object pointer
-    AliVCaloTrigger *caloTrigger = GetInputEvent()->GetCaloTrigger( "EMCAL" );
-    
-    // class is not empty
-    if( caloTrigger->GetEntries() > 0 )
-    {
-      // must reset before usage, or the class will fail 
-      caloTrigger->Reset();
-      
-      // go throuth the trigger channels
-      while( caloTrigger->Next() )
-      {
-        // get position in global 2x2 tower coordinates
-        caloTrigger->GetPosition( globCol, globRow );
-        
-        // get dimension of time arrays
-        caloTrigger->GetNL0Times( ntimes );
-        
-        // no L0s in this channel
-        // presence of the channel in the iterator still does not guarantee that L0 was produced!!
-        if( ntimes < 1 )
-          continue;
-        
-        // get timing array
-        caloTrigger->GetL0Times( trigtimes );
-        
-        // go through the array
-        for( i = 0; i < ntimes; i++ )
-        {
-          // check if in cut - 8,9 shall be accepted in 2011
-          if( trigtimes[i] >= fTriggerPatchTimeWindow[0] && trigtimes[i] <= fTriggerPatchTimeWindow[1] )
-          {
-            //printf("Accepted trigger time %d \n",trigtimes[i]);
-            trigInCut = kTRUE;
-            if(nTrig > 99) continue;
-            GetCaloUtils()->GetEMCALGeometry()->GetAbsFastORIndexFromPositionInEMCAL(globCol,globRow, absIDTrig[nTrig]) ;
-            //printf("pass the time cut globCol %d, globRow %d absId %d\n",globCol,globRow, absIDTrig[nTrig]);
-            nTrig++;
-          }
-        } // trigger time array
-        
-      } // trigger iterator
-    } // go thorough triggers
     
-    //printf("NTriggers %d, Trigger In Cut %d\n",nTrig, trigInCut);
-    if(nTrig > 99) printf("AliCaloTrackReader::RejectExoticEvents() - careful, too many triggering patches\n");
+  
+    Int_t nPatch = patches.GetSize();
     
 //    for(Int_t iabsId =0; iabsId < nTrig; iabsId++)
 //    {
@@ -1905,41 +1937,256 @@ void  AliCaloTrackReader::RejectExoticEvents()
       if ( (clus = fInputEvent->GetCaloCluster(iclus)) && IsEMCALCluster(clus))
       {
         Bool_t exotic = GetCaloUtils()->GetEMCALRecoUtils()->IsExoticCluster(clus, fInputEvent->GetEMCALCells());
-        if(exotic)
-        {
+
+//        if(nPatch > 4)
+//        {
 //          Float_t frac = -1;
 //          Int_t absIdMax = GetCaloUtils()->GetMaxEnergyCell(fInputEvent->GetEMCALCells(), clus,frac);
-//          printf("cluster %d, E %f, AbsId max %d\n",iclus,clus->E(),absIdMax);
-
-          for(Int_t iabsId =0; iabsId < nTrig; iabsId++)
+//          Double_t tof    = clus->GetTOF();
+//          Bool_t bad    = GetCaloUtils()->GetEMCALRecoUtils()->ClusterContainsBadChannel(GetCaloUtils()->GetEMCALGeometry(),
+//                                                                                         clus->GetCellsAbsId(),clus->GetNCells());
+//          GetCaloUtils()->GetEMCALRecoUtils()->RecalibrateCellTime(absIdMax,fInputEvent->GetBunchCrossNumber(),tof);
+//          printf("cluster %d, E %2.2f, tof %2.2f, AbsId max %d, exo %d, bad %d\n",iclus,clus->E(),tof*1e9,absIdMax,exotic,bad);
+//        }
+        
+        if(exotic)
+        {
+          Float_t frac = -1;
+          Int_t absIdMax = GetCaloUtils()->GetMaxEnergyCell(fInputEvent->GetEMCALCells(), clus,frac);
+          //Double_t tof    = clus->GetTOF();
+          //GetCaloUtils()->GetEMCALRecoUtils()->RecalibrateCellTime(absIdMax,fInputEvent->GetBunchCrossNumber(),tof);
+          //printf("cluster %d, E %2.2f, tof %2.2f, AbsId max %d\n",iclus,clus->E(),tof*1e9,absIdMax);
+          
+          for(Int_t iabsId =0; iabsId < nPatch; iabsId++)
           {
             Int_t absIDCell[4];
-            GetCaloUtils()->GetEMCALGeometry()->GetCellIndexFromFastORIndex(absIDTrig[iabsId], absIDCell);
+            GetCaloUtils()->GetEMCALGeometry()->GetCellIndexFromFastORIndex(patches.At(iabsId), absIDCell);
             for(Int_t ipatch = 0; ipatch < 4; ipatch++)
             {
               //Loop on the cluster cells and check if any is in patch, ideally
               // max id should suffice, but not always
-              for(Int_t iCell = 0; iCell<clus->GetNCells(); iCell++)
+              //              for(Int_t iCell = 0; iCell<clus->GetNCells(); iCell++)
+              //              {
+              //                Int_t id = clus->GetCellsAbsId()[iCell];
+              //                Double_t tofCell =  fInputEvent->GetEMCALCells()->GetCellTime(id);
+              //                GetCaloUtils()->GetEMCALRecoUtils()->RecalibrateCellTime(id,fInputEvent->GetBunchCrossNumber(),tofCell);
+              //                //printf(" id %d - E %2.2f - tof %2.2f; ",clus->GetCellsAbsId()[iCell],
+              //                //       fInputEvent->GetEMCALCells()->GetCellAmplitude(id), tofCell*1e9);
+              //                if(clus->GetCellsAbsId()[iCell] == absIDCell[ipatch])
+              //                {
+              //                  //printf("\n *** Exotic trigger : absId %d, E %2.1f \n",clus->GetCellsAbsId()[iCell],clus->E());
+              //                  fIsExoticEvent = kTRUE;
+              //                  //return;
+              //                }
+              //                //else printf("\n");
+              //              }
+              
+              if(absIdMax == absIDCell[ipatch])
               {
-                //printf(" id %d - E %2.2f; ",clus->GetCellsAbsId()[iCell], fInputEvent->GetEMCALCells()->GetCellAmplitude(clus->GetCellsAbsId()[iCell]));
-                if(clus->GetCellsAbsId()[iCell] == absIDCell[ipatch])
+                Double_t tof =  clus->GetTOF();
+                GetCaloUtils()->GetEMCALRecoUtils()->RecalibrateCellTime(absIdMax,fInputEvent->GetBunchCrossNumber(),tof);
+                //printf("*** Exotic trigger : absId %d, E %2.1f, tof %f \n",absIdMax,clus->E(), clus->GetTOF()*1e9);
+                
+                fIsExoticEvent = kTRUE;
+                return;
+              }
+            }// cell patch loop
+          }// trigger patch loop
+        }// exotic cluster
+      }// EMCal cluster
+    }// Cluster loop
+  }// exotic and trigger patch event flag
+  
+}
+
+//______________________________________________________________________
+void  AliCaloTrackReader::RejectTriggeredEventsByPileUp(TArrayI patches)
+{
+  // Reject events triggered by exotic cells
+  
+  if(!GetFiredTriggerClasses().Contains("EMC") && !fForceExoticRejection)
+  {
+    fIsTriggerEventOutBC = 0;
+    return;
+  }
+  
+  Int_t nclusters  = fInputEvent->GetNumberOfCaloClusters();
+  
+  // simple method, just count how many exotics and how many high energy clusters
+  // over the trigger threshold there are
+  
+  if(!fTriggerPatchExoticRejection)
+  {
+    Int_t nOfHighECl   = 0 ;
+    Int_t nOutBC       = 0 ;
+    Float_t tofcluster = 1000;
+    Float_t eBCN       =-1;
+
+    for (Int_t iclus = 0 ; iclus <  nclusters; iclus++)
+    {
+      AliVCluster * clus = 0;
+      if ( (clus = fInputEvent->GetCaloCluster(iclus)) )
+      {
+        if (IsEMCALCluster(clus) && clus->E() > fTriggerEventThreshold)
+        {
+          Bool_t bad    = GetCaloUtils()->GetEMCALRecoUtils()->ClusterContainsBadChannel(GetCaloUtils()->GetEMCALGeometry(),
+                                                                                         clus->GetCellsAbsId(),clus->GetNCells());
+          
+          Bool_t exotic = GetCaloUtils()->GetEMCALRecoUtils()->IsExoticCluster(clus, fInputEvent->GetEMCALCells());
+          
+          if(bad || exotic || clus->E() < 1) continue;
+          
+          Double_t tof   = clus->GetTOF();
+          Float_t frac   = -1;
+          Int_t absIdMax = GetCaloUtils()->GetMaxEnergyCell(fInputEvent->GetEMCALCells(), clus,frac);
+          GetCaloUtils()->GetEMCALRecoUtils()->RecalibrateCellTime(absIdMax,fInputEvent->GetBunchCrossNumber(),tof);
+          tof *=1.e9;
+          
+          if ( TMath::Abs(tof) > 25 )
+          {
+            nOutBC++;
+            if(clus->E() > eBCN)
+            {
+              tofcluster = tof;
+              eBCN       = clus->E();
+            }
+            
+            printf("Simple: Large time:  E %f, tof %f, absId %d\n",clus->E(),tofcluster, absIdMax);
+            
+          }
+          else
+          {
+            printf("Simple: OK cluster E %f, tof %f\n",clus->E(),tofcluster);
+            nOfHighECl++;
+          }
+          
+        }//EMCAL cluster
+      }// cluster exists
+    }// cluster loop
+    
+    printf("- n OutBC %d, n high energy %d\n", nOutBC,nOfHighECl);
+    
+    Double_t tofclusterUS = TMath::Abs(tofcluster);
+    if ( ( nOutBC > 0 ) && ( nOfHighECl == 0 ) )
+    {
+      if     (tofclusterUS < 75 ) fIsTriggerEventOutBC = 1 ;
+      else if(tofclusterUS < 125) fIsTriggerEventOutBC = 2 ;
+      else if(tofclusterUS < 175) fIsTriggerEventOutBC = 3 ;
+      else if(tofclusterUS < 225) fIsTriggerEventOutBC = 4 ;
+      else if(tofclusterUS < 275) fIsTriggerEventOutBC = 5 ;
+      else                        fIsTriggerEventOutBC = 6 ;
+      
+      if(tofcluster < 0) fIsTriggerEventOutBC*=-1;
+
+    }
+    else if(( nOutBC == 0 ) && ( nOfHighECl == 0 ) )
+    {
+      fIsTriggerEventOutBC = 7 ;
+    }
+    else
+    {
+      fIsTriggerEventOutBC = 0;
+    }
+
+    printf("*** Simple: Trigger tag BC %d, tof %2.2f, E %2.2f\n",fIsTriggerEventOutBC, tofcluster, eBCN);
+
+  }
+  //Check if there is any trigger patch that has an associated exotic cluster
+  else
+  {
+    //printf("Trigger Exotic?\n");
+    
+    Int_t nPatch = patches.GetSize();
+    
+    // Loop on the clusters, check if there is any that falls into one of the patches
+
+    Float_t tofcluster = 1000;
+    Float_t eBCN       =-1;
+
+    Bool_t ok   = kFALSE;
+    Bool_t ok2  = kFALSE;
+    
+    for (Int_t iclus =  0; iclus <  nclusters; iclus++)
+    {
+      AliVCluster * clus = 0;
+      if ( (clus = fInputEvent->GetCaloCluster(iclus)) && IsEMCALCluster(clus))
+      {
+        
+        Bool_t bad    = GetCaloUtils()->GetEMCALRecoUtils()->ClusterContainsBadChannel(GetCaloUtils()->GetEMCALGeometry(),
+                                                                                       clus->GetCellsAbsId(),clus->GetNCells());
+        
+        Bool_t exotic = GetCaloUtils()->GetEMCALRecoUtils()->IsExoticCluster(clus, fInputEvent->GetEMCALCells());
+        
+        if(bad || exotic || clus->E() < 1) continue;
+
+        
+        Double_t tof   = clus->GetTOF();
+        Float_t frac   = -1;
+        Int_t absIdMax = GetCaloUtils()->GetMaxEnergyCell(fInputEvent->GetEMCALCells(), clus,frac);
+        GetCaloUtils()->GetEMCALRecoUtils()->RecalibrateCellTime(absIdMax,fInputEvent->GetBunchCrossNumber(),tof);
+        tof *=1.e9;
+        
+        // in case no final match with the trigger, check if there was a high energy cluster
+        // with the timing of BC=0
+        if(clus->E() > fTriggerEventThreshold)
+        {
+          if(TMath::Abs(tof) < 25) ok  = kTRUE;
+          else                     ok2 = kTRUE;
+        }
+        //printf("cluster %d, E %2.2f, tof %2.2f, AbsId max %d, exotic %d, bad %d\n",iclus,clus->E(),tof,absIdMax, exotic, bad);
+
+ //       if ( TMath::Abs(tof) > 25 )
+ //       {
+          //printf("cluster %d, E %2.2f, tof %2.2f, AbsId max %d\n",iclus,clus->E(),tof*1e9,absIdMax);
+          
+          for(Int_t iabsId =0; iabsId < nPatch; iabsId++)
+          {
+            Int_t absIDCell[4];
+            GetCaloUtils()->GetEMCALGeometry()->GetCellIndexFromFastORIndex(patches.At(iabsId), absIDCell);
+            //if(tof > 75 ) printf("E %2.2f TOF %2.2f Trigger patch %d, cells : %d, %d, %d, %d\n",
+            //                     clus->E(),tof,patches.At(iabsId), absIDCell[0],absIDCell[1],absIDCell[2],absIDCell[3]);
+            
+            
+            for(Int_t ipatch = 0; ipatch < 4; ipatch++)
+            {              
+              if(absIdMax == absIDCell[ipatch])
+              {
+                //printf("*** Patches : absId %d, E %2.1f, tof %f \n",absIdMax,clus->E(), tof);
+                if(clus->E() > eBCN)
                 {
-//                  printf("*** Exotic trigger : absId %d, E %2.1f \n",clus->GetCellsAbsId()[iCell],clus->E());
-                  fIsExoticEvent = kTRUE;
-                  return;
+                  tofcluster = tof;
+                  eBCN       = clus->E();
                 }
               }
-//              if(absIdMax == absIDCell[ipatch])
-//              {
-//                printf("*** Exotic trigger : absId %d, E %2.1f \n",absIdMax,clus->E());
-//                fIsExoticEvent = kTRUE;
-//                return;
-//              }
             }// cell patch loop
           }// trigger patch loop
-        }// exotic cluster
+//        }// out BC
       }// EMCal cluster
     }// Cluster loop
+    
+    Double_t tofclusterUS = TMath::Abs(tofcluster);
+    
+    if     (tofcluster == 1000)
+    {
+      if(ok) fIsTriggerEventOutBC = 6 ; // no trigger match but high energy cluster with time at BC=0
+      else   fIsTriggerEventOutBC = 7 ; // no trigger match and no likely good cluster
+    }
+    else if(tofclusterUS < 25 ) fIsTriggerEventOutBC = 0 ;
+    else if(tofclusterUS < 75 ) fIsTriggerEventOutBC = 1 ;
+    else if(tofclusterUS < 125) fIsTriggerEventOutBC = 2 ;
+    else if(tofclusterUS < 175) fIsTriggerEventOutBC = 3 ;
+    else if(tofclusterUS < 225) fIsTriggerEventOutBC = 4 ;
+    else                        fIsTriggerEventOutBC = 5 ;
+    
+    //printf(" selected tof %f\n",tofcluster);
+    
+    if(tofcluster < 0) fIsTriggerEventOutBC*=-1;
+    
+    //if(fIsTriggerEventOutBC != 0) printf("*** Patches: Trigger out of BC %d, tof %2.2f, E %2.2f\n",fIsTriggerEventOutBC,tofcluster,eBCN);
+    
+    //if(fIsTriggerEventOutBC==7) printf("*** No trigger match, high energy cluster? %d\n",ok2);
+    //if(fIsTriggerEventOutBC==6) printf("*** No trigger match, but high energy cluster in BC0\n");
+    
   }// exotic and trigger patch event flag
   
 }
index d3c968cdcacc08e6c978c62c48e7507a4ae5db97..1ef03d93a5d3d8607d234777500fe692593d693a 100755 (executable)
@@ -247,14 +247,21 @@ public:
   UInt_t           GetEventTriggerMask()             const { return fEventTriggerMask        ; }
   void             SetEventTriggerMaks(UInt_t evtTrig = AliVEvent::kAny) 
                                                            { fEventTriggerMask = evtTrig     ; }
-
-  void             RejectExoticEvents();
+  TArrayI          GetL0TriggerPatches();
+  void             RejectExoticEvents(TArrayI patches);
   Bool_t           IsExoticEvent()                         { return fIsExoticEvent           ; }
+  void             SwitchOffExoticEventsRemoval()          { fRemoveExoticEvents    = kFALSE ; }
   void             SwitchOnExoticEventsRemoval(Bool_t all = kFALSE)
                                                            { fRemoveExoticEvents    = kTRUE  ;
                                                              fForceExoticRejection  = all    ; }
-  void             SwitchOffExoticEventsRemoval()          { fRemoveExoticEvents    = kFALSE ; }
-  void             SetExoticEventTrigger(Float_t tr)       { fExoticTrigger         = tr     ; }
+  
+  Int_t            IsPileUpClusterTriggeredEvent()         { return fIsTriggerEventOutBC     ; }
+  void             SwitchOffTriggerOutBCEventsRemoval()    { fRemoveTriggerOutBCEvents = kFALSE ; }
+  void             SwitchOnTriggerOutBCEventsRemoval()     { fRemoveTriggerOutBCEvents = kTRUE  ; }
+  
+  void             RejectTriggeredEventsByPileUp(TArrayI patches);
+  
+  void             SetEventTriggerThreshold(Float_t tr)    { fTriggerEventThreshold       = tr     ; }
   
   void             SwitchOffExoticEventsFromTriggerPatch() { fTriggerPatchExoticRejection = kFALSE ; }
   void             SwitchOnExoticEventsFromTriggerPatch()  { fTriggerPatchExoticRejection = kTRUE  ; }
@@ -266,7 +273,6 @@ public:
   void             SetMixEventTriggerMaks(UInt_t evtTrig = AliVEvent::kAnyINT) 
                                                            { fMixEventTriggerMask = evtTrig  ; }
   
-  
   Bool_t           IsEventTriggerAtSEOn()            const { return fEventTriggerAtSE        ; }
   void             SwitchOnEventTriggerAtSE()              { fEventTriggerAtSE      = kTRUE  ; }
   void             SwitchOffEventTriggerAtSE()             { fEventTriggerAtSE      = kFALSE ; }
@@ -335,10 +341,10 @@ public:
   void             SetEMCalEventBCcut(Int_t bc)            { if(bc >=0 && bc < 19) fEMCalBCEventCut[bc] = 1 ; }
   void             SetTrackEventBCcut(Int_t bc)            { if(bc >=0 && bc < 19) fTrackBCEventCut[bc] = 1 ; }
 
-  Int_t           GetVertexBC(const AliVVertex * vtx);
-  Int_t           GetVertexBC()                  const     { return fVertexBC              ; }
-  void            SwitchOnRecalculateVertexBC()            { fRecalculateVertexBC = kTRUE  ; }
-  void            SwitchOffRecalculateVertexBC()           { fRecalculateVertexBC = kFALSE ; }
+  Int_t            GetVertexBC(const AliVVertex * vtx);
+  Int_t            GetVertexBC()                  const    { return fVertexBC              ; }
+  void             SwitchOnRecalculateVertexBC()           { fRecalculateVertexBC = kTRUE  ; }
+  void             SwitchOffRecalculateVertexBC()          { fRecalculateVertexBC = kFALSE ; }
   
   // Track selection
   ULong_t          GetTrackStatus()                  const { return fTrackStatus          ; }
@@ -610,10 +616,12 @@ public:
   Bool_t           fRemoveLEDEvents;             // Remove events where LED was wrongly firing - EMCAL LHC11a
   
   Bool_t           fRemoveExoticEvents;          // Remove events triggered by exotic cluster
+  Bool_t           fRemoveTriggerOutBCEvents;    // Remove events triggered by pile-up cluster
   Bool_t           fTriggerPatchExoticRejection; // Search for the trigger patch and check if associated cluster was the trigger
   Int_t            fTriggerPatchTimeWindow[2];   // Trigger patch selection window
-  Float_t          fExoticTrigger;               // Threshold to look for triggered events by exotic clusters
+  Float_t          fTriggerEventThreshold;       // Threshold to look for triggered events 
   Bool_t           fIsExoticEvent;               // Exotic event flag
+  Int_t            fIsTriggerEventOutBC;         // Event triggered by pile-up in BC
   Bool_t           fForceExoticRejection;        // Reject events triggered by exotic only on EMC triggered events, except in MC to study false rejections
   
   Bool_t           fDoEventSelection;            // Select events depending on V0, pileup, vertex well reconstructed, at least 1 track ...
index bebcea8104a3f1ce9ad2d45973021092d3268747..ba57df083a75f88de14aac4c862c0c4aba7281c5 100755 (executable)
@@ -62,13 +62,16 @@ AliAnaPhoton::AliAnaPhoton() :
     fNLMCutMin(-1),               fNLMCutMax(10), 
     fFillSSHistograms(kFALSE),    fFillOnlySimpleSSHisto(1),   
     fNOriginHistograms(8),        fNPrimaryHistograms(4),
-    fFillPileUpHistograms(0),
+    fFillPileUpHistograms(0),     fFillEMCALBCHistograms(0),
     // Histograms
     fhNCellsE(0),                 fhCellsE(0),   // Control histograms            
     fhMaxCellDiffClusterE(0),     fhTimeE(0),    // Control histograms
+    fhEtaPhi(0),                  fhEtaPhiEMCALBC0(0),
+    fhEtaPhiEMCALBC1(0),          fhEtaPhiEMCALBCN(0),
     fhEPhoton(0),                 fhPtPhoton(0),  
     fhPhiPhoton(0),               fhEtaPhoton(0), 
     fhEtaPhiPhoton(0),            fhEtaPhi05Photon(0),
+    fhEtaPhiPhotonEMCALBC0(0),    fhEtaPhiPhotonEMCALBC1(0),   fhEtaPhiPhotonEMCALBCN(0),
     fhPtCentralityPhoton(0),      fhPtEventPlanePhoton(0),
 
     // Shower shape histograms
@@ -209,6 +212,14 @@ AliAnaPhoton::AliAnaPhoton() :
      fhClusterMultNoPileUp [i] = 0;
    }
    
+   for(Int_t i = 0; i < 12; i++)
+   {
+     fhEtaPhiTriggerEMCALBC[i] = 0 ;
+     fhTimeTriggerEMCALBC  [i] = 0 ;
+     fhEtaPhiPhotonTriggerEMCALBC[i] = 0 ;
+     fhTimePhotonTriggerEMCALBC  [i] = 0 ;
+   }
+   
   //Initialize parameters
   InitParameters();
 
@@ -219,17 +230,46 @@ Bool_t  AliAnaPhoton::ClusterSelected(AliVCluster* calo, TLorentzVector mom, Int
 {
   //Select clusters if they pass different cuts
   
-  Float_t ptcluster = mom.Pt();
-  Float_t ecluster  = mom.E();
-  Float_t l0cluster = calo->GetM02();
+  Float_t ptcluster  = mom.Pt();
+  Float_t ecluster   = mom.E();
+  Float_t l0cluster  = calo->GetM02();
+  Float_t etacluster = mom.Eta();
+  Float_t phicluster = mom.Phi();
+  if(phicluster<0) phicluster+=TMath::TwoPi();
+  Float_t tofcluster   = calo->GetTOF()*1.e9;
+  Float_t tofclusterUS = TMath::Abs(tofcluster);
+  
   
   if(GetDebug() > 2)
     printf("AliAnaPhoton::ClusterSelected() Current Event %d; Before selection : E %2.2f, pT %2.2f, phi %2.2f, eta %2.2f\n",
            GetReader()->GetEventNumber(),
-           ecluster,ptcluster, mom.Phi()*TMath::RadToDeg(),mom.Eta());
+           ecluster,ptcluster, phicluster*TMath::RadToDeg(),etacluster);
   
   fhClusterCuts[1]->Fill(ecluster);
   
+  if(ecluster > 0.5) fhEtaPhi->Fill(etacluster, phicluster);
+  
+  if(fFillEMCALBCHistograms && fCalorimeter=="EMCAL")
+  {
+    if(ecluster > 2)
+    {
+      if      (tofclusterUS < 25) fhEtaPhiEMCALBC0->Fill(etacluster, phicluster);
+      else if (tofclusterUS < 75) fhEtaPhiEMCALBC1->Fill(etacluster, phicluster);
+      else                        fhEtaPhiEMCALBCN->Fill(etacluster, phicluster);
+    }
+    
+    Int_t bc = GetReader()->IsPileUpClusterTriggeredEvent();
+    if(bc > -6 && bc < 8)
+    {
+      if(ecluster > 2) fhEtaPhiTriggerEMCALBC[bc+5]->Fill(etacluster, phicluster);
+      fhTimeTriggerEMCALBC[bc+5]->Fill(ecluster, tofcluster);
+      if(GetReader()->IsPileUpFromSPD()) fhTimeTriggerEMCALBCPileUpSPD[bc+5]->Fill(ecluster, tofcluster);
+
+    }
+    else printf("AliAnaPhoton::ClusterSelected() - Trigger BC not expected = %d\n",bc);
+    
+  }
+  
   //.......................................
   //If too small or big energy, skip it
   if(ecluster < GetMinEnergy() || ecluster > GetMaxEnergy() ) return kFALSE ; 
@@ -1386,7 +1426,7 @@ TObjString *  AliAnaPhoton::GetAnalysisCuts()
 
 //________________________________________________________________________
 TList *  AliAnaPhoton::GetCreateOutputObjects()
-{  
+{
   // Create histograms to be saved in output file and 
   // store them in outputContainer
   TList * outputContainer = new TList() ; 
@@ -1467,6 +1507,61 @@ TList *  AliAnaPhoton::GetCreateOutputObjects()
   fhPtEventPlanePhoton->SetXTitle("p_{T} (GeV/c)");
   outputContainer->Add(fhPtEventPlanePhoton) ;
 
+  fhEtaPhi  = new TH2F
+  ("hEtaPhi","cluster,E > 0.5 GeV, #eta vs #phi",netabins,etamin,etamax,nphibins,phimin,phimax);
+  fhEtaPhi->SetYTitle("#phi (rad)");
+  fhEtaPhi->SetXTitle("#eta");
+  outputContainer->Add(fhEtaPhi) ;
+
+  if(fCalorimeter=="EMCAL" && fFillEMCALBCHistograms)
+  {
+    fhEtaPhiEMCALBC0  = new TH2F
+    ("hEtaPhiEMCALBC0","cluster,E > 2 GeV, #eta vs #phi, for clusters with |time| < 25 ns, EMCAL-BC=0",netabins,etamin,etamax,nphibins,phimin,phimax);
+    fhEtaPhiEMCALBC0->SetYTitle("#phi (rad)");
+    fhEtaPhiEMCALBC0->SetXTitle("#eta");
+    outputContainer->Add(fhEtaPhiEMCALBC0) ;
+    
+    fhEtaPhiEMCALBC1  = new TH2F
+    ("hEtaPhiEMCALBC1","cluster,E > 2 GeV, #eta vs #phi, for clusters with 25 < |time| < 75 ns, EMCAL-BC=1",netabins,etamin,etamax,nphibins,phimin,phimax);
+    fhEtaPhiEMCALBC1->SetYTitle("#phi (rad)");
+    fhEtaPhiEMCALBC1->SetXTitle("#eta");
+    outputContainer->Add(fhEtaPhiEMCALBC1) ;
+    
+    fhEtaPhiEMCALBCN  = new TH2F
+    ("hEtaPhiEMCALBCN","cluster,E > 2 GeV, #eta vs #phi, for clusters with |time| > 75 ns, EMCAL-BC>1",netabins,etamin,etamax,nphibins,phimin,phimax);
+    fhEtaPhiEMCALBCN->SetYTitle("#phi (rad)");
+    fhEtaPhiEMCALBCN->SetXTitle("#eta");
+    outputContainer->Add(fhEtaPhiEMCALBCN) ;
+    
+    for(Int_t i = 0; i < 12; i++)
+    {
+      fhEtaPhiTriggerEMCALBC[i] = new TH2F
+      (Form("hEtaPhiTriggerEMCALBC%d",i-5),
+       Form("cluster,E > 2 GeV, #eta vs #phi, Trigger EMCAL-BC=%d",i-5),
+       netabins,etamin,etamax,nphibins,phimin,phimax);
+      fhEtaPhiTriggerEMCALBC[i]->SetYTitle("#phi (rad)");
+      fhEtaPhiTriggerEMCALBC[i]->SetXTitle("#eta");
+      outputContainer->Add(fhEtaPhiTriggerEMCALBC[i]) ;
+      
+      fhTimeTriggerEMCALBC[i] = new TH2F
+      (Form("hTimeTriggerEMCALBC%d",i-5),
+       Form("time of cluster vs E of clusters, Trigger EMCAL-BC=%d",i-5),
+       nptbins,ptmin,ptmax, ntimebins,timemin,timemax);
+      fhTimeTriggerEMCALBC[i]->SetXTitle("E (GeV)");
+      fhTimeTriggerEMCALBC[i]->SetYTitle("time (ns)");
+      outputContainer->Add(fhTimeTriggerEMCALBC[i]);
+      
+      fhTimeTriggerEMCALBCPileUpSPD[i] = new TH2F
+      (Form("hTimeTriggerEMCALBC%dPileUpSPD",i-5),
+       Form("time of cluster vs E of clusters, Trigger EMCAL-BC=%d",i-5),
+       nptbins,ptmin,ptmax, ntimebins,timemin,timemax);
+      fhTimeTriggerEMCALBCPileUpSPD[i]->SetXTitle("E (GeV)");
+      fhTimeTriggerEMCALBCPileUpSPD[i]->SetYTitle("time (ns)");
+      outputContainer->Add(fhTimeTriggerEMCALBCPileUpSPD[i]);
+
+    }
+  }
+  
   fhPhiPhoton  = new TH2F
     ("hPhiPhoton","#phi_{#gamma} vs p_{T}",nptbins,ptmin,ptmax,nphibins,phimin,phimax); 
   fhPhiPhoton->SetYTitle("#phi (rad)");
@@ -1493,6 +1588,54 @@ TList *  AliAnaPhoton::GetCreateOutputObjects()
     outputContainer->Add(fhEtaPhi05Photon) ;
   }
 
+  if(fCalorimeter=="EMCAL" && fFillEMCALBCHistograms)
+  {
+    fhEtaPhiPhotonEMCALBC0  = new TH2F
+    ("hEtaPhiEMCALBC0","identified photon, E > 2 GeV, #eta vs #phi, for clusters with |time| < 25 ns, EMCAL-BC=0",netabins,etamin,etamax,nphibins,phimin,phimax);
+    fhEtaPhiPhotonEMCALBC0->SetYTitle("#phi (rad)");
+    fhEtaPhiPhotonEMCALBC0->SetXTitle("#eta");
+    outputContainer->Add(fhEtaPhiPhotonEMCALBC0) ;
+    
+    fhEtaPhiPhotonEMCALBC1  = new TH2F
+    ("hEtaPhiEMCALBC1","identified photon, E > 2 GeV, #eta vs #phi, for clusters with 25 < |time| < 75 ns, EMCAL-BC=1",netabins,etamin,etamax,nphibins,phimin,phimax);
+    fhEtaPhiPhotonEMCALBC1->SetYTitle("#phi (rad)");
+    fhEtaPhiPhotonEMCALBC1->SetXTitle("#eta");
+    outputContainer->Add(fhEtaPhiPhotonEMCALBC1) ;
+    
+    fhEtaPhiPhotonEMCALBCN  = new TH2F
+    ("hEtaPhiEMCALBCN","identified photon, E > 2 GeV, #eta vs #phi, for clusters with |time| > 75 ns, EMCAL-BC>1",netabins,etamin,etamax,nphibins,phimin,phimax);
+    fhEtaPhiPhotonEMCALBCN->SetYTitle("#phi (rad)");
+    fhEtaPhiPhotonEMCALBCN->SetXTitle("#eta");
+    outputContainer->Add(fhEtaPhiPhotonEMCALBCN) ;
+    
+    for(Int_t i = 0; i < 12; i++)
+    {
+      fhEtaPhiPhotonTriggerEMCALBC[i] = new TH2F
+      (Form("hEtaPhiPhotonTriggerEMCALBC%d",i-5),
+       Form("cluster,E > 2 GeV, #eta vs #phi, PhotonTrigger EMCAL-BC=%d",i-5),
+       netabins,etamin,etamax,nphibins,phimin,phimax);
+      fhEtaPhiPhotonTriggerEMCALBC[i]->SetYTitle("#phi (rad)");
+      fhEtaPhiPhotonTriggerEMCALBC[i]->SetXTitle("#eta");
+      outputContainer->Add(fhEtaPhiPhotonTriggerEMCALBC[i]) ;
+      
+      fhTimePhotonTriggerEMCALBC[i] = new TH2F
+      (Form("hTimePhotonTriggerEMCALBC%d",i-5),
+       Form("time of cluster vs E of clusters, PhotonTrigger EMCAL-BC=%d",i-5),
+       nptbins,ptmin,ptmax, ntimebins,timemin,timemax);
+      fhTimePhotonTriggerEMCALBC[i]->SetXTitle("E (GeV)");
+      fhTimePhotonTriggerEMCALBC[i]->SetYTitle("time (ns)");
+      outputContainer->Add(fhTimePhotonTriggerEMCALBC[i]);
+      
+      fhTimePhotonTriggerEMCALBCPileUpSPD[i] = new TH2F
+      (Form("hTimePhotonTriggerEMCALBC%dPileUpSPD",i-5),
+       Form("time of cluster vs E of clusters, PhotonTrigger EMCAL-BC=%d",i-5),
+       nptbins,ptmin,ptmax, ntimebins,timemin,timemax);
+      fhTimePhotonTriggerEMCALBCPileUpSPD[i]->SetXTitle("E (GeV)");
+      fhTimePhotonTriggerEMCALBCPileUpSPD[i]->SetYTitle("time (ns)");
+      outputContainer->Add(fhTimePhotonTriggerEMCALBCPileUpSPD[i]);
+      
+    }
+  }
   
   fhNLocMax = new TH2F("hNLocMax","Number of local maxima in cluster",
                        nptbins,ptmin,ptmax,10,0,10); 
@@ -2677,7 +2820,7 @@ void  AliAnaPhoton::MakeAnalysisFillAOD()
       Double_t vertex[]={0,0,0};
       calo->GetMomentum(mom,vertex) ;
     }
-        
+    
     //--------------------------------------
     // Cluster selection
     //--------------------------------------
@@ -2777,7 +2920,30 @@ void  AliAnaPhoton::MakeAnalysisFillAOD()
     // Add number of local maxima to AOD, method name in AOD to be FIXED
     aodph.SetFiducialArea(nMaxima);
     
-
+    if(fFillEMCALBCHistograms && fCalorimeter=="EMCAL")
+    {
+      Double_t calotof   = calo->GetTOF()*1e9;
+      Float_t  calotofUS = TMath::Abs(calotof);
+      Float_t phicluster = aodph.Phi();
+      if(phicluster < 0) phicluster+=TMath::TwoPi();
+      
+      if(calo->E() > 2)
+      {
+        if      (calotofUS < 25) fhEtaPhiPhotonEMCALBC0->Fill(aodph.Eta(), phicluster);
+        else if (calotofUS < 75) fhEtaPhiPhotonEMCALBC1->Fill(aodph.Eta(), phicluster);
+        else                     fhEtaPhiPhotonEMCALBCN->Fill(aodph.Eta(), phicluster);
+      }
+      
+      Int_t bc = GetReader()->IsPileUpClusterTriggeredEvent();
+      if(bc > -6 && bc < 8)
+      {
+        if(calo->E() > 2) fhEtaPhiPhotonTriggerEMCALBC[bc+5]->Fill(aodph.Eta(), phicluster);
+        fhTimePhotonTriggerEMCALBC[bc+5]->Fill(calo->E(), calotof);
+        if(GetReader()->IsPileUpFromSPD()) fhTimePhotonTriggerEMCALBCPileUpSPD[bc+5]->Fill(calo->E(), calotof);
+      }
+      else printf("AliAnaPhoton::MakeAnalysisFillAOD() - Trigger BC not expected = %d\n",bc);
+    }
+    
     //Add AOD with photon object to aod branch
     AddAODParticle(aodph);
     
index 56ace9c8c318e682a1b67a6a129f922ab15ebd4f..72bd02f54c5adcacce2f4eb6cfca012205f61fb6 100755 (executable)
@@ -57,22 +57,26 @@ class AliAnaPhoton : public AliAnaCaloTrackCorrBaseClass {
 
   void         FillShowerShapeHistograms( AliVCluster* cluster, Int_t mcTag) ;
   
-  void         SwitchOnFillShowerShapeHistograms()    { fFillSSHistograms = kTRUE  ; }
-  void         SwitchOffFillShowerShapeHistograms()   { fFillSSHistograms = kFALSE ; }  
+  void         SwitchOnFillShowerShapeHistograms()    { fFillSSHistograms      = kTRUE  ; }
+  void         SwitchOffFillShowerShapeHistograms()   { fFillSSHistograms      = kFALSE ; }  
   
   void         SwitchOnOnlySimpleSSHistoFill()        { fFillOnlySimpleSSHisto = kTRUE  ; }
   void         SwitchOffOnlySimpleHistoFill()         { fFillOnlySimpleSSHisto = kFALSE ; }
   
   void         FillTrackMatchingResidualHistograms(AliVCluster* calo, Int_t cut);
   
-  void         SwitchOnTMHistoFill()                  { fFillTMHisto      = kTRUE  ; }
-  void         SwitchOffTMHistoFill()                 { fFillTMHisto      = kFALSE ; }
+  void         SwitchOnTMHistoFill()                  { fFillTMHisto           = kTRUE  ; }
+  void         SwitchOffTMHistoFill()                 { fFillTMHisto           = kFALSE ; }
 
   void         FillPileUpHistograms(Float_t energy, Float_t pt, Float_t time) ;
   void         FillPileUpHistogramsPerEvent(TObjArray * clusters) ;
 
-  void         SwitchOnFillPileUpHistograms()         { fFillPileUpHistograms = kTRUE  ; }
-  void         SwitchOffFillPileUpHistograms()        { fFillPileUpHistograms = kFALSE ; }    
+  void         SwitchOnFillPileUpHistograms()         { fFillPileUpHistograms  = kTRUE  ; }
+  void         SwitchOffFillPileUpHistograms()        { fFillPileUpHistograms  = kFALSE ; }    
+  
+  void         SwitchOnFillEMCALBCHistograms()        { fFillEMCALBCHistograms = kTRUE  ; }
+  void         SwitchOffFillEMCALBCHistograms()       { fFillEMCALBCHistograms = kFALSE ; }
+
   
   // Analysis parameters setters getters
   
@@ -92,10 +96,10 @@ class AliAnaPhoton : public AliAnaCaloTrackCorrBaseClass {
   void         SetNCellCut(Int_t n)                   { fNCellsCut = n             ; }
   Double_t     GetNCellCut()                    const { return fNCellsCut          ; }
   
-  void           SetNLMCut(Int_t min, Int_t max)             { fNLMCutMin = min; 
+  void         SetNLMCut(Int_t min, Int_t max)        { fNLMCutMin = min; 
     fNLMCutMax = max                ; }
-  Int_t          GetNLMCutMin()                        const { return fNLMCutMin               ; }
-  Int_t          GetNLMCutMax()                        const { return fNLMCutMax               ; }     
+  Int_t        GetNLMCutMin()                   const { return fNLMCutMin          ; }
+  Int_t        GetNLMCutMax()                   const { return fNLMCutMax          ; } 
   
   
   Bool_t       IsTrackMatchRejectionOn()        const { return fRejectTrackMatch   ; }
@@ -138,20 +142,36 @@ class AliAnaPhoton : public AliAnaCaloTrackCorrBaseClass {
   Int_t    fNOriginHistograms;           // Fill only NOriginHistograms of the 14 defined types
   Int_t    fNPrimaryHistograms;          // Fill only NPrimaryHistograms of the 7 defined types
   Bool_t   fFillPileUpHistograms;        // Fill pile-up related histograms
+  Bool_t   fFillEMCALBCHistograms;       // Fill eta-phi BC dependent histograms
   
   //Histograms 
   TH1F * fhClusterCuts[10];              //! control histogram on the different photon selection cuts
   TH2F * fhNCellsE;                      //! number of cells in cluster vs E 
   TH2F * fhCellsE;                       //! energy of cells in cluster vs E of cluster
   TH2F * fhMaxCellDiffClusterE;          //! Fraction of energy carried by cell with maximum energy
-  TH2F * fhTimeE;                        //! time of cluster vs E 
+  TH2F * fhTimeE;                        //! time of cluster vs E
+  
+  TH2F * fhEtaPhi  ;                     //! Pseudorapidity vs Phi of clusters for E > 0.5
+  TH2F * fhEtaPhiEMCALBC0  ;             //! Pseudorapidity vs Phi of clusters for E > 0.5
+  TH2F * fhEtaPhiEMCALBC1  ;             //! Pseudorapidity vs Phi of clusters for E > 0.5
+  TH2F * fhEtaPhiEMCALBCN  ;             //! Pseudorapidity vs Phi of clusters for E > 0.5
+
+  TH2F * fhEtaPhiTriggerEMCALBC[12] ;     //! Pseudorapidity vs Phi of clusters for E > 0.5
+  TH2F * fhTimeTriggerEMCALBC  [12] ;     //! Time distribution of clusters, when trigger is in a given BC
+  TH2F * fhTimeTriggerEMCALBCPileUpSPD[12]; //! Time distribution of clusters, when trigger is in a given BC, tagged as pile-up SPD
 
   TH1F * fhEPhoton    ;                  //! Number of identified photon vs energy
   TH1F * fhPtPhoton   ;                  //! Number of identified photon vs transerse momentum 
   TH2F * fhPhiPhoton  ;                  //! Azimuthal angle of identified  photon vs transerse momentum 
   TH2F * fhEtaPhoton  ;                  //! Pseudorapidity of identified  photon vs transerse momentum 
-  TH2F * fhEtaPhiPhoton  ;               //! Pseudorapidity vs Phi of identified  photon for transerse momentum > 0.5
-  TH2F * fhEtaPhi05Photon  ;             //! Pseudorapidity vs Phi of identified  photon for transerse momentum < 0.5
+  TH2F * fhEtaPhiPhoton  ;               //! Pseudorapidity vs Phi of identified  photon for E > 0.5
+  TH2F * fhEtaPhi05Photon  ;             //! Pseudorapidity vs Phi of identified  photon for E < 0.5
+  TH2F * fhEtaPhiPhotonEMCALBC0  ;       //! Pseudorapidity vs Phi of identified  photon for E > 0.5
+  TH2F * fhEtaPhiPhotonEMCALBC1  ;       //! Pseudorapidity vs Phi of identified  photon for E > 0.5
+  TH2F * fhEtaPhiPhotonEMCALBCN  ;       //! Pseudorapidity vs Phi of identified  photon for E > 0.5
+  TH2F * fhEtaPhiPhotonTriggerEMCALBC[12]; //! Pseudorapidity vs Phi of photons for E > 0.5
+  TH2F * fhTimePhotonTriggerEMCALBC  [12]; //! Time distribution of photons, when trigger is in a given BC
+  TH2F * fhTimePhotonTriggerEMCALBCPileUpSPD[12] ; //! Time distribution of photons, when trigger is in a given BC, tagged as pile-up SPD
   TH2F * fhPtCentralityPhoton    ;       //! centrality  vs photon pT
   TH2F * fhPtEventPlanePhoton    ;       //! event plane vs photon pT
   
@@ -318,7 +338,7 @@ class AliAnaPhoton : public AliAnaCaloTrackCorrBaseClass {
   AliAnaPhoton(              const AliAnaPhoton & g) ; // cpy ctor
   AliAnaPhoton & operator = (const AliAnaPhoton & g) ; // cpy assignment
   
-  ClassDef(AliAnaPhoton,29)
+  ClassDef(AliAnaPhoton,30)
 
 } ;
  
index 457e35127087276d01e97f4b18f207852f463e1d..6fd6309a92d3b913dd3c74cdb52c91c2e356cd66 100755 (executable)
@@ -55,12 +55,13 @@ AliAnaPi0EbE::AliAnaPi0EbE() :
     fRejectTrackMatch(kTRUE),
     fFillPileUpHistograms(0),
     fFillWeightHistograms(kFALSE), fFillTMHisto(0),              
-    fFillSelectClHisto(0),         fFillOnlySimpleSSHisto(1),
+    fFillSelectClHisto(0),         fFillOnlySimpleSSHisto(1),    fFillEMCALBCHistograms(0),
     fInputAODGammaConvName(""),
     // Histograms
     fhPt(0),                       fhE(0),                    
     fhEEta(0),                     fhEPhi(0),                    
     fhPtEta(0),                    fhPtPhi(0),                   fhEtaPhi(0),
+    fhEtaPhiEMCALBC0(0),           fhEtaPhiEMCALBC1(0),          fhEtaPhiEMCALBCN(0),
     fhPtCentrality(),              fhPtEventPlane(0),
     fhPtReject(0),                 fhEReject(0),
     fhEEtaReject(0),               fhEPhiReject(0),              fhEtaPhiReject(0),
@@ -185,6 +186,12 @@ AliAnaPi0EbE::AliAnaPi0EbE() :
     if(i<8)fhMassPairLocMax[i] = 0;
   }
   
+  for(Int_t i = 0; i < 12; i++)
+  {
+    fhEtaPhiTriggerEMCALBC[i] = 0 ;
+    fhTimeTriggerEMCALBC  [i] = 0 ;
+  }
+  
   //Initialize parameters
   InitParameters();
   
@@ -698,6 +705,54 @@ TList *  AliAnaPi0EbE::GetCreateOutputObjects()
   fhEtaPhi->SetXTitle("#eta");
   outputContainer->Add(fhEtaPhi) ; 
   
+  if(fCalorimeter=="EMCAL" && fFillEMCALBCHistograms)
+  {
+    fhEtaPhiEMCALBC0  = new TH2F
+    ("hEtaPhiEMCALBC0","cluster,E > 2 GeV, #eta vs #phi, for clusters with |time| < 25 ns, EMCAL-BC=0",netabins,etamin,etamax,nphibins,phimin,phimax);
+    fhEtaPhiEMCALBC0->SetYTitle("#phi (rad)");
+    fhEtaPhiEMCALBC0->SetXTitle("#eta");
+    outputContainer->Add(fhEtaPhiEMCALBC0) ;
+    
+    fhEtaPhiEMCALBC1  = new TH2F
+    ("hEtaPhiEMCALBC1","cluster,E > 2 GeV, #eta vs #phi, for clusters with 25 < |time| < 75 ns, EMCAL-BC=1",netabins,etamin,etamax,nphibins,phimin,phimax);
+    fhEtaPhiEMCALBC1->SetYTitle("#phi (rad)");
+    fhEtaPhiEMCALBC1->SetXTitle("#eta");
+    outputContainer->Add(fhEtaPhiEMCALBC1) ;
+    
+    fhEtaPhiEMCALBCN  = new TH2F
+    ("hEtaPhiEMCALBCN","cluster,E > 2 GeV, #eta vs #phi, for clusters with |time| > 75 ns, EMCAL-BC>1",netabins,etamin,etamax,nphibins,phimin,phimax);
+    fhEtaPhiEMCALBCN->SetYTitle("#phi (rad)");
+    fhEtaPhiEMCALBCN->SetXTitle("#eta");
+    outputContainer->Add(fhEtaPhiEMCALBCN) ;
+    
+    for(Int_t i = 0; i < 12; i++)
+    {
+      fhEtaPhiTriggerEMCALBC[i] = new TH2F
+      (Form("hEtaPhiTriggerEMCALBC%d",i-5),
+       Form("cluster,E > 2 GeV, #eta vs #phi, Trigger EMCAL-BC=%d",i-5),
+       netabins,etamin,etamax,nphibins,phimin,phimax);
+      fhEtaPhiTriggerEMCALBC[i]->SetYTitle("#phi (rad)");
+      fhEtaPhiTriggerEMCALBC[i]->SetXTitle("#eta");
+      outputContainer->Add(fhEtaPhiTriggerEMCALBC[i]) ;
+      
+      fhTimeTriggerEMCALBC[i] = new TH2F
+      (Form("hTimeTriggerEMCALBC%d",i-5),
+       Form("time of cluster vs E of clusters, Trigger EMCAL-BC=%d",i-5),
+       nptbins,ptmin,ptmax, ntimebins,timemin,timemax);
+      fhTimeTriggerEMCALBC[i]->SetXTitle("E (GeV)");
+      fhTimeTriggerEMCALBC[i]->SetYTitle("time (ns)");
+      outputContainer->Add(fhTimeTriggerEMCALBC[i]);
+      
+      fhTimeTriggerEMCALBCPileUpSPD[i] = new TH2F
+      (Form("hTimeTriggerEMCALBC%dPileUpSPD",i-5),
+       Form("time of cluster vs E of clusters, Trigger EMCAL-BC=%d",i-5),
+       nptbins,ptmin,ptmax, ntimebins,timemin,timemax);
+      fhTimeTriggerEMCALBCPileUpSPD[i]->SetXTitle("E (GeV)");
+      fhTimeTriggerEMCALBCPileUpSPD[i]->SetYTitle("time (ns)");
+      outputContainer->Add(fhTimeTriggerEMCALBCPileUpSPD[i]);
+    }
+  }
+  
   fhPtCentrality  = new TH2F("hPtCentrality","centrality vs p_{T}",nptbins,ptmin,ptmax, 100,0,100);
   fhPtCentrality->SetYTitle("centrality");
   fhPtCentrality->SetXTitle("p_{T}(GeV/c)");
@@ -2433,7 +2488,6 @@ void  AliAnaPi0EbE::MakeShowerShapeIdentification()
       fhMCSelectedMassSplitPt[mcIndex]->Fill(ptSplit,mass);
 
     }
-
     
     //-----------------------
     //Create AOD for analysis
@@ -2465,7 +2519,32 @@ void  AliAnaPi0EbE::MakeShowerShapeIdentification()
     
     // Fill histograms to undertand pile-up before other cuts applied
     // Remember to relax time cuts in the reader
-    FillPileUpHistograms(calo->E(),calo->GetTOF()*1e9);
+    Double_t tofcluster   = calo->GetTOF()*1e9;
+    Double_t tofclusterUS = TMath::Abs(tofcluster);
+
+    FillPileUpHistograms(calo->E(),tofcluster);
+    if(fFillEMCALBCHistograms && fCalorimeter=="EMCAL")
+    {
+      Float_t phicluster = aodpi0.Phi();
+      if(phicluster < 0) phicluster+=TMath::TwoPi();
+      
+      if(calo->E() > 2)
+      {
+        if      (tofclusterUS < 25) fhEtaPhiEMCALBC0->Fill(aodpi0.Eta(), phicluster);
+        else if (tofclusterUS < 75) fhEtaPhiEMCALBC1->Fill(aodpi0.Eta(), phicluster);
+        else                        fhEtaPhiEMCALBCN->Fill(aodpi0.Eta(), phicluster);
+      }
+      
+      Int_t bc = GetReader()->IsPileUpClusterTriggeredEvent();
+      if(bc > -7 && bc < 8)
+      {
+        if(calo->E() > 2) fhEtaPhiTriggerEMCALBC[bc+5]->Fill(aodpi0.Eta(), phicluster);
+        fhTimeTriggerEMCALBC[bc+5]->Fill(calo->E(), tofcluster);
+        if(GetReader()->IsPileUpFromSPD()) fhTimeTriggerEMCALBCPileUpSPD[bc+5]->Fill(calo->E(), tofcluster);
+      }
+      else printf("AliAnaPi0EbE::MakeShowerShapeIdentification() - Trigger BC not expected = %d\n",bc);
+    }
     
     //Add AOD with pi0 object to aod branch
     AddAODParticle(aodpi0);
index 04466718700490fba87d71f453d32c6bfd6d92a0..a607d8795a87a1e63089211c2c2403fbe5af6e62 100755 (executable)
@@ -115,7 +115,8 @@ class AliAnaPi0EbE : public AliAnaCaloTrackCorrBaseClass {
   void           SwitchOnOnlySimpleSSHistoFill()             { fFillOnlySimpleSSHisto = kTRUE  ; }
   void           SwitchOffOnlySimpleHistoFill()              { fFillOnlySimpleSSHisto = kFALSE ; }
 
-  
+  void           SwitchOnFillEMCALBCHistograms()             { fFillEMCALBCHistograms = kTRUE  ; }
+  void           SwitchOffFillEMCALBCHistograms()            { fFillEMCALBCHistograms = kFALSE ; }
   
   //For histograms
   enum mcTypes   { kmcPhoton = 0, kmcConversion = 1, kmcPi0    = 2,  
@@ -142,6 +143,7 @@ class AliAnaPi0EbE : public AliAnaCaloTrackCorrBaseClass {
   Bool_t         fFillTMHisto;             // Fill track matching plots
   Bool_t         fFillSelectClHisto;       // Fill selected cluster histograms
   Bool_t         fFillOnlySimpleSSHisto;   // Fill selected cluster histograms, selected SS histograms
+  Bool_t         fFillEMCALBCHistograms;   // Fill eta-phi BC dependent histograms
 
   
   //Only for combination of calorimeter and conversion photons, kIMCaloTracks
@@ -156,6 +158,13 @@ class AliAnaPi0EbE : public AliAnaCaloTrackCorrBaseClass {
   TH2F         * fhPtEta  ;                //! Pt vs eta of identified  pi0/eta
   TH2F         * fhPtPhi  ;                //! Pt vs phi of identified  pi0/eta
   TH2F         * fhEtaPhi  ;               //! eta vs phi of identified  pi0/eta
+  TH2F         * fhEtaPhiEMCALBC0  ;       //! Pseudorapidity vs Phi of clusters 
+  TH2F         * fhEtaPhiEMCALBC1  ;       //! Pseudorapidity vs Phi of clusters 
+  TH2F         * fhEtaPhiEMCALBCN  ;       //! Pseudorapidity vs Phi of clusters 
+
+  TH2F         * fhEtaPhiTriggerEMCALBC[12]  ;    //! Pseudorapidity vs Phi of pi0 for E > 0.5
+  TH2F         * fhTimeTriggerEMCALBC  [12]  ;    //! Time distribution of pi0, when trigger is in a given BC
+  TH2F         * fhTimeTriggerEMCALBCPileUpSPD[12] ; //! Time distribution of pi0, when trigger is in a given BC, tagged as pile-up SPD
 
   TH2F         * fhPtCentrality ;          //! centrality  vs pi0/eta pT
   TH2F         * fhPtEventPlane ;          //! event plane vs pi0/eta pT