]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Improve LED events rejection, based on Rongrong studies
authorgconesab <gconesab@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 28 Sep 2011 12:41:54 +0000 (12:41 +0000)
committergconesab <gconesab@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 28 Sep 2011 12:41:54 +0000 (12:41 +0000)
Add it to PartCorr frame.
Selection in 3 different places, to be moved to common place, maybe AliEMCALRecoUtils

PWG4/CaloCalib/AliAnalysisTaskEMCALClusterize.cxx
PWG4/PartCorrBase/AliAnalysisTaskCounter.cxx
PWG4/PartCorrBase/AliAnalysisTaskCounter.h
PWG4/PartCorrBase/AliCaloTrackReader.cxx
PWG4/PartCorrBase/AliCaloTrackReader.h

index f1d5c1ed0bdd9bac32146cd79b5fbb30de0e143a..898e891e7388a7cff5b8da02d9e31fbef511e0f6 100644 (file)
@@ -353,26 +353,6 @@ void AliAnalysisTaskEMCALClusterize::UserExec(Option_t *)
   //Remove the contents of output list set in the previous event 
   fOutputAODBranch->Clear("C");
   
-  // 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
-  // If clusterzer NxN or V2 it does not help
-  if(fRemoveLEDEvents){
-    for (Int_t i = 0; i < InputEvent()->GetNumberOfCaloClusters(); i++)
-    {
-      AliVCluster *clus = InputEvent()->GetCaloCluster(i);
-      if(clus->IsEMCAL()){    
-        
-        if ((clus->E() > 500 && clus->GetNCells() > 200 ) || clus->GetNCells() > 300) {
-          Int_t absID = clus->GetCellsAbsId()[0];
-          Int_t sm = fGeom->GetSuperModuleNumber(absID);
-          printf("AliAnalysisTaskEMCALClusterize - reject event with cluster : E %f, ncells %d, absId(0) %d, SM %d\n",clus->E(),  clus->GetNCells(),absID, sm);
-          
-          return;
-        }
-      }
-    }
-  }// Remove LED events
-  
   //Magic line to write events to AOD file
   AliAnalysisManager::GetAnalysisManager()->GetOutputEventHandler()->SetFillAOD(fFillAODFile);
   LoadBranches();
@@ -420,6 +400,48 @@ void AliAnalysisTaskEMCALClusterize::UserExec(Option_t *)
     return;
   }
   
+  //-------------------------------------------------------------------------------------
+  // 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
+  // If clusterzer NxN or V2 it does not help
+  //-------------------------------------------------------------------------------------
+  if(fRemoveLEDEvents){
+    for (Int_t i = 0; i < InputEvent()->GetNumberOfCaloClusters(); i++)
+    {
+      AliVCluster *clus = InputEvent()->GetCaloCluster(i);
+      if(clus->IsEMCAL()){    
+        
+        if ((clus->E() > 500 && clus->GetNCells() > 200 ) || clus->GetNCells() > 200) {
+          Int_t absID = clus->GetCellsAbsId()[0];
+          Int_t sm = fGeom->GetSuperModuleNumber(absID);
+          printf("AliAnalysisTaskEMCALClusterize - reject event with cluster : E %f, ncells %d, absId(0) %d, SM %d\n",clus->E(),  clus->GetNCells(),absID, sm);
+          
+          return;
+        }
+      }
+    }
+    
+    // Count number of cells with energy larger than 0.1 in SM3, cut on this number
+    Int_t ncells = 0;
+    for(Int_t icell = 0; icell < event->GetEMCALCells()->GetNumberOfCells(); icell++){
+      if(event->GetEMCALCells()->GetAmplitude(icell) > 0.1 && event->GetEMCALCells()->GetCellNumber(icell)/(24*48)==3) ncells++;
+    }
+    
+    TString triggerclasses = "";
+    if(esdevent) triggerclasses = esdevent             ->GetFiredTriggerClasses();
+    else         triggerclasses = ((AliAODEvent*)event)->GetFiredTriggerClasses();
+    
+    Int_t ncellcut = 21;
+    if(triggerclasses.Contains("EMC")) ncellcut = 35;
+    
+    if(ncells >= ncellcut ){
+      printf("AliAnalysisTaskEMCALClusterize - reject event with cluster  - reject event with ncells in SM3: ncells %d\n",ncells);
+
+      return;
+    }
+    
+  }// Remove LED events
+  
   //-------------------------------------------------------------------------------------
   //Set the geometry matrix, for the first event, skip the rest
   //-------------------------------------------------------------------------------------
index 7c5d4bb79b1358163287a8b8f6fde546c7d3dca3..85fde25a71940f182808145004d4ac371ce5a219 100644 (file)
@@ -44,6 +44,7 @@
 #include "AliAODHeader.h"
 #include "AliTriggerAnalysis.h"
 #include "AliESDEvent.h"
+#include "AliAODEvent.h"
 #include "AliESDtrackCuts.h"
 #include "AliAnalysisManager.h"
 #include "AliInputEventHandler.h"
@@ -54,14 +55,15 @@ ClassImp(AliAnalysisTaskCounter)
 //________________________________________________________________________
 AliAnalysisTaskCounter::AliAnalysisTaskCounter(const char *name) 
 : AliAnalysisTaskSE(name), 
-  fZVertexCut(10.),
+  fAcceptFastCluster(kTRUE),
+  fZVertexCut(10.), 
   fTrackMultEtaCut(0.8),
   fCaloFilterPatch(kFALSE),
   fOutputContainer(0x0), 
   fESDtrackCuts(AliESDtrackCuts::GetStandardITSTPCTrackCuts2010()),
   fTriggerAnalysis (new AliTriggerAnalysis),
   fhNEvents(0),
-  fhXVertex(0),fhYVertex(0),fhZVertex(0),
+  fhXVertex(0),    fhYVertex(0),    fhZVertex(0),
   fhXGoodVertex(0),fhYGoodVertex(0),fhZGoodVertex(0)
 {
   //ctor
@@ -71,6 +73,7 @@ AliAnalysisTaskCounter::AliAnalysisTaskCounter(const char *name)
 //________________________________________________________________________
 AliAnalysisTaskCounter::AliAnalysisTaskCounter() 
   : AliAnalysisTaskSE("DefaultAnalysis_AliAnalysisTaskCounter"),
+    fAcceptFastCluster(kTRUE),
     fZVertexCut(10.),
     fTrackMultEtaCut(0.8),
     fCaloFilterPatch(kFALSE),
@@ -78,7 +81,7 @@ AliAnalysisTaskCounter::AliAnalysisTaskCounter()
     fESDtrackCuts(AliESDtrackCuts::GetStandardITSTPCTrackCuts2010()),
     fTriggerAnalysis (new AliTriggerAnalysis),
     fhNEvents(0),
-    fhXVertex(0),fhYVertex(0),fhZVertex(0),
+    fhXVertex(0),    fhYVertex(0),    fhZVertex(0),
     fhXGoodVertex(0),fhYGoodVertex(0),fhZGoodVertex(0)
 {
   // ctor
@@ -132,7 +135,7 @@ void AliAnalysisTaskCounter::UserCreateOutputObjects()
   fOutputContainer->Add(fhYGoodVertex);
   
   
-  fhNEvents = new TH1I("hNEvents", "Number of analyzed events", 20, 0, 20) ;
+  fhNEvents = new TH1I("hNEvents", "Number of analyzed events", 21, 0, 21) ;
   fhNEvents->SetXTitle("Selection");
   fhNEvents->SetYTitle("# events");
   fhNEvents->GetXaxis()->SetBinLabel(1 ,"1  = PS");
@@ -153,9 +156,10 @@ void AliAnalysisTaskCounter::UserCreateOutputObjects()
   fhNEvents->GetXaxis()->SetBinLabel(16,"16 = 10 & 11");
   fhNEvents->GetXaxis()->SetBinLabel(17,"17 = 6  & 10");
   fhNEvents->GetXaxis()->SetBinLabel(17,"17 = 1  & |Z|<50");  
-  fhNEvents->GetXaxis()->SetBinLabel(18,"18 = Reject EMCAL");
+  fhNEvents->GetXaxis()->SetBinLabel(18,"18 = Reject EMCAL 1");
   fhNEvents->GetXaxis()->SetBinLabel(19,"19 = 18 & 2");
-  fhNEvents->GetXaxis()->SetBinLabel(20,"20 = 18 & |Z|<50");
+  fhNEvents->GetXaxis()->SetBinLabel(20,"20 = Reject EMCAL 2");
+  fhNEvents->GetXaxis()->SetBinLabel(21,"20 = 20 & 2");
 
   fOutputContainer->Add(fhNEvents);
 
@@ -180,7 +184,18 @@ void AliAnalysisTaskCounter::UserExec(Option_t *)
     printf("AliAnalysisTaskCounter::UserExec() - ERROR: event not available \n");
     return;
   }
+  
   AliESDEvent * esdevent = dynamic_cast<AliESDEvent*> (event);
+  AliAODEvent * aodevent = dynamic_cast<AliAODEvent*> (event);
+  
+  TString triggerclasses = "";
+  if(esdevent) triggerclasses = esdevent->GetFiredTriggerClasses();
+  if(aodevent) triggerclasses = aodevent->GetFiredTriggerClasses();
+
+  if (triggerclasses.Contains("FAST") && !triggerclasses.Contains("ALL") && !fAcceptFastCluster) {
+    //printf("Do not count events from fast cluster, trigger name %s\n",triggerclasses.Data());
+    return;
+  }
 
   fhNEvents->Fill(1.5);  
     
@@ -311,22 +326,45 @@ void AliAnalysisTaskCounter::UserExec(Option_t *)
   //printf("AliAnalysisTaskCounter::UserExec() : z vertex %d, good vertex %d, v0and %d, pile up %d, track mult %d\n ", bSelectVZ, bGoodV, bV0AND, bPileup, trackMult);
   
   // Events that could be rejected in EMCAL
+  // LHC11a, SM4 and some SM3 events cut with this
+  Bool_t bEMCALRejected = kFALSE;
   for (Int_t i = 0; i < InputEvent()->GetNumberOfCaloClusters(); i++)
   {
     AliVCluster *clus = InputEvent()->GetCaloCluster(i);
     if(clus->IsEMCAL()){    
-      
-      if ((clus->E() > 500 && clus->GetNCells() > 200 ) || clus->GetNCells() > 300)  {
+      if ((clus->E() > 500 && clus->GetNCells() > 200 ) || clus->GetNCells() > 200)  {
+        
         //printf("Counter: Reject event with cluster: E %f, ncells %d\n",clus->E(),clus->GetNCells());
+        
                          fhNEvents->Fill(17.5); 
         if(bSelectVZ)    fhNEvents->Fill(18.5);
-        if(TMath::Abs(v[2]) < 50.)  fhNEvents->Fill(19.5); 
+        bEMCALRejected = kTRUE;
         break;
       }
-        
     }
   }
   
+  //LHC11a, 3 last runs, cut with this
+  if(!bEMCALRejected){
+    // Count number of cells in SM3 with energy larger than 0.1, cut on this number
+    Int_t ncells = 0;
+    for(Int_t icell = 0; icell < event->GetEMCALCells()->GetNumberOfCells(); icell++){
+      if(event->GetEMCALCells()->GetAmplitude(icell) > 0.1 && event->GetEMCALCells()->GetCellNumber(icell)/(24*48)==3) ncells++;
+    }
+    
+    Int_t ncellcut = 21;
+    if(triggerclasses.Contains("EMC")) ncellcut = 35;
+    
+    if(ncells >= ncellcut ){
+      
+      //printf("Counter: reject event with ncells in SM3: ncells %d\n",ncells);
+
+                       fhNEvents->Fill(19.5); 
+      if(bSelectVZ)    fhNEvents->Fill(20.5);
+    }
+    
+  }
+  
   PostData(1,fOutputContainer);
 
 }
index 7c213005b441b834aaf96c3ad0a408d80510bc09..4ce1bf517e8cacd124827e28a6cc1b4e28f4c5ef 100644 (file)
@@ -33,23 +33,27 @@ class AliAnalysisTaskCounter : public AliAnalysisTaskSE {
   virtual void UserExec(Option_t *option);  
   virtual void FinishTaskOutput();  
   
-  void SetTrackMultiplicityEtaCut(Float_t eta) { fTrackMultEtaCut = eta  ; }  
-  void SetZVertexCut(Float_t vcut)             { fZVertexCut      = vcut ; }  
+  void SetTrackMultiplicityEtaCut(Float_t eta) { fTrackMultEtaCut   = eta    ; }  
+  void SetZVertexCut(Float_t vcut)             { fZVertexCut        = vcut   ; }  
 
-  void SwitchOnCaloFilterPatch()               { fCaloFilterPatch = kTRUE  ; } 
-  void SwitchOffCaloFilterPatch()              { fCaloFilterPatch = kFALSE ; }  
-  Bool_t IsCaloFilterPatchOn()                 { return fCaloFilterPatch   ; }   
+  void SwitchOnCaloFilterPatch()               { fCaloFilterPatch   = kTRUE  ; } 
+  void SwitchOffCaloFilterPatch()              { fCaloFilterPatch   = kFALSE ; }  
+  Bool_t IsCaloFilterPatchOn()                 { return fCaloFilterPatch     ; }   
+  
+  void AcceptFastCluster()                     { fAcceptFastCluster = kTRUE  ; } 
+  void RejectFastCluster()                     { fAcceptFastCluster = kFALSE ; }  
+  Bool_t IsFastClusterAccepted()               { return fAcceptFastCluster   ; }   
   
   Bool_t CheckForPrimaryVertex() ;
    
  private: 
-  
-  Float_t              fZVertexCut;      // Z vertex cut  
-  Float_t              fTrackMultEtaCut; // Track multiplicity eta cut  
-  Bool_t               fCaloFilterPatch; // CaloFilter patch  
-  TList*               fOutputContainer; //! Histogram container  
-  AliESDtrackCuts    * fESDtrackCuts;    // Track cut    
-  AliTriggerAnalysis * fTriggerAnalysis; // Trigger algorithm 
+  Bool_t               fAcceptFastCluster; // Accept events from fast cluster, exclude thiese events for LHC11a
+  Float_t              fZVertexCut;        // Z vertex cut  
+  Float_t              fTrackMultEtaCut;   // Track multiplicity eta cut  
+  Bool_t               fCaloFilterPatch;   // CaloFilter patch  
+  TList*               fOutputContainer;   //! Histogram container  
+  AliESDtrackCuts    * fESDtrackCuts;      // Track cut    
+  AliTriggerAnalysis * fTriggerAnalysis;   // Trigger algorithm 
   
   //Histograms
   TH1I *  fhNEvents;      //! Events that delivers the analysis frame after different assumptions  
index 045a21ad2c8b0a6319bfe0bc082f03ba4538b90a..706a4ac1edcc8cbfd3b2fa8a65907066df446d98 100755 (executable)
@@ -72,7 +72,8 @@ ClassImp(AliCaloTrackReader)
     fTaskName(""),               fCaloUtils(0x0), 
     fMixedEvent(NULL),           fNMixedEvent(1),                 fVertex(NULL), 
     fWriteOutputDeltaAOD(kFALSE),fOldAOD(kFALSE),                 fCaloFilterPatch(kFALSE),
-    fEMCALClustersListName(""),  fZvtxCut(0.), 
+    fEMCALClustersListName(""),  fZvtxCut(0.),                    
+    fAcceptFastCluster(kTRUE),   fRemoveLEDEvents(kFALSE), 
     fDoEventSelection(kFALSE),   fDoV0ANDEventSelection(kFALSE),  fUseEventsWithPrimaryVertex(kFALSE),
     fTriggerAnalysis (new AliTriggerAnalysis), 
     fCentralityClass("V0M"),     fCentralityOpt(10),
@@ -356,6 +357,49 @@ Bool_t AliCaloTrackReader::FillInputEvent(const Int_t iEntry, const char * /*cur
   if(fInputEvent->GetHeader())
          eventType = ((AliVHeader*)fInputEvent->GetHeader())->GetEventType();
 
+  if (GetFiredTriggerClasses().Contains("FAST")  && !GetFiredTriggerClasses().Contains("ALL") && !fAcceptFastCluster) {
+     if(fDebug > 0)  printf("AliCaloTrackReader::FillInputEvent - Do not count events from fast cluster, trigger name %s\n",fFiredTriggerClassName.Data());
+    return kFALSE;
+  }
+  
+  //-------------------------------------------------------------------------------------
+  // 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
+  // If clusterzer NxN or V2 it does not help
+  //-------------------------------------------------------------------------------------
+  if(fRemoveLEDEvents){
+    for (Int_t i = 0; i < fInputEvent->GetNumberOfCaloClusters(); i++)
+    {
+      AliVCluster *clus = fInputEvent->GetCaloCluster(i);
+      if(clus->IsEMCAL()){    
+        
+        if ((clus->E() > 500 && clus->GetNCells() > 200 ) || clus->GetNCells() > 200) {
+          Int_t absID = clus->GetCellsAbsId()[0];
+          Int_t sm = GetCaloUtils()->GetEMCALGeometry()->GetSuperModuleNumber(absID);
+           if(fDebug > 0)  printf("AliCaloTrackReader::FillInputEvent - reject event with cluster : E %f, ncells %d, absId(0) %d, SM %d\n",clus->E(),  clus->GetNCells(),absID, sm);
+          return kFALSE;
+        }
+      }
+    }
+    
+    // Count number of cells with energy larger than 0.1 in SM3, cut on this number
+    Int_t ncells = 0;
+    for(Int_t icell = 0; icell < fInputEvent->GetEMCALCells()->GetNumberOfCells(); icell++){
+      Int_t absID = fInputEvent->GetEMCALCells()->GetCellNumber(icell);
+      Int_t sm = GetCaloUtils()->GetEMCALGeometry()->GetSuperModuleNumber(absID);
+      if(fInputEvent->GetEMCALCells()->GetAmplitude(icell) > 0.1 && sm==3) ncells++;
+    }
+    
+    Int_t ncellcut = 21;
+    if(fFiredTriggerClassName.Contains("EMC")) ncellcut = 35;
+    
+    if(ncells >= ncellcut ) {
+       if(fDebug > 0) printf(" AliCaloTrackReader::FillInputEvent() - reject event with ncells in SM3: ncells %d\n",ncells);
+      return kFALSE;
+    }
+  }// Remove LED events
+  
+  // Reject pure LED events?
   if( fFiredTriggerClassName  !="" && !fAnaLED){
     if(eventType!=7)
       return kFALSE; //Only physics event, do not use for simulated events!!!
@@ -383,7 +427,7 @@ Bool_t AliCaloTrackReader::FillInputEvent(const Int_t iEntry, const char * /*cur
          if(eventType!=7 && fDebug > 1 )printf("AliCaloTrackReader::FillInputEvent() - DO LED, Event Type <%d>, 8 Calibration \n",  eventType);
          if(eventType!=8)return kFALSE;
   }
-               
+  
   //In case of analysis of events with jets, skip those with jet pt > 5 pt hard        
   if(fComparePtHardAndJetPt && GetStack()) {
     if(!ComparePtHardAndJetPt()) return kFALSE ;
index e62e9cf67b92e51c17a05cd8319a1b8da471c1e8..8822f4ec31936473a28ee68f5f5f7e62d9ea9a3e 100755 (executable)
@@ -190,12 +190,20 @@ public:
   // Event/track selection methods
   //-------------------------------------
   
+  void             AcceptFastClusterEvents()               { fAcceptFastCluster     = kTRUE  ; } 
+  void             RejectFastClusterEvents()               { fAcceptFastCluster     = kFALSE ; }  
+  Bool_t           IsFastClusterAccepted()                 { return fAcceptFastCluster       ; }   
+  
+  void             SwitchOnLEDEventsRemoval()              { fRemoveLEDEvents       = kTRUE  ; }
+  void             SwitchOffLEDEventsRemoval()             { fRemoveLEDEvents       = kFALSE ; } 
+  Bool_t           IsLEDEventRemoved()                     { return fRemoveLEDEvents         ; }   
+
   void             SetFiredTriggerClassName(TString name ) { fFiredTriggerClassName = name   ; }
   TString          GetFiredTriggerClassName()        const { return fFiredTriggerClassName   ; }
   virtual TString  GetFiredTriggerClasses()                { return ""                       ; } // look the ESD/AOD reader 
   
-  void             SwitchOnEventSelection()                { fDoEventSelection = kTRUE       ; }
-  void             SwitchOffEventSelection()               { fDoEventSelection = kFALSE      ; }
+  void             SwitchOnEventSelection()                { fDoEventSelection      = kTRUE  ; }
+  void             SwitchOffEventSelection()               { fDoEventSelection      = kFALSE ; }
   Bool_t           IsEventSelectionDone()            const { return fDoEventSelection        ; } 
   
   void             SwitchOnV0ANDSelection()                { fDoV0ANDEventSelection = kTRUE  ; }
@@ -206,8 +214,6 @@ public:
   void             SwitchOffPrimaryVertexSelection()       { fUseEventsWithPrimaryVertex = kFALSE ; }
   Bool_t           IsPrimaryVertexSelectionDone()    const { return fUseEventsWithPrimaryVertex   ; } 
   
-  
-  
   // Track selection
   ULong_t          GetTrackStatus()                  const { return fTrackStatus       ; }
   void             SetTrackStatus(ULong_t bit)             { fTrackStatus = bit        ; }             
@@ -389,7 +395,11 @@ public:
 
   Bool_t           fCaloFilterPatch;             // CaloFilter patch
   TString          fEMCALClustersListName;       // Alternative list of clusters produced elsewhere and not from InputEvent
-  Float_t          fZvtxCut ;                     // Cut on vertex position  
+  
+  // Event selection
+  Float_t          fZvtxCut ;                     // Cut on vertex position
+  Bool_t           fAcceptFastCluster;           // Accept events from fast cluster, exclude these events for LHC11a
+  Bool_t           fRemoveLEDEvents;             // Remove events where LED was wrongly firing - EMCAL LHC11a
   Bool_t           fDoEventSelection;            // Select events depending on V0, pileup, vertex well reconstructed, at least 1 track ...
   Bool_t           fDoV0ANDEventSelection;       // Select events depending on V0, fDoEventSelection should be on
   Bool_t           fUseEventsWithPrimaryVertex ; // Select events with primary vertex
@@ -401,7 +411,7 @@ public:
   Int_t            fCentralityBin[2];    // Minimum and maximum value of the centrality for the analysis
   TString          fEventPlaneMethod;    // Name of event plane method, by default "Q"
   
-  ClassDef(AliCaloTrackReader,33)
+  ClassDef(AliCaloTrackReader,34)
 } ;