]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Add pile up selection via EMCal cluster multiplicity, add or update pile-up control...
authorgconesab <gconesab@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 9 Nov 2012 15:44:40 +0000 (15:44 +0000)
committergconesab <gconesab@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 9 Nov 2012 15:44:40 +0000 (15:44 +0000)
PWG/CaloTrackCorrBase/AliAnaCaloTrackCorrMaker.cxx
PWG/CaloTrackCorrBase/AliAnaCaloTrackCorrMaker.h
PWG/CaloTrackCorrBase/AliCaloTrackReader.cxx
PWG/CaloTrackCorrBase/AliCaloTrackReader.h

index 1d61a8db8ee1394f4295322ff078e51a7b669dda..114c2cab22fbc219dc06ffe45c77dca77b8b7eac 100755 (executable)
@@ -49,8 +49,10 @@ fAnaDebug(0),                 fCuts(new TList),
 fScaleFactor(-1),
 fhNEvents(0),                 fhNPileUpEvents(0),
 fhZVertex(0),                 
-fhTrackMult(0),               fhCentrality(0),
-fhEventPlaneAngle(0),
+fhPileUpClusterMult(0),       fhPileUpClusterMultAndSPDPileUp(0),
+fh2PileUpClusterMult(0),      fh2PileUpClusterMultAndSPDPileUp(0),
+fhTrackMult(0),
+fhCentrality(0),              fhEventPlaneAngle(0),
 fhNMergedFiles(0),            fhScaleFactor(0)
 {
   //Default Ctor
@@ -72,6 +74,10 @@ fScaleFactor(maker.fScaleFactor),
 fhNEvents(maker.fhNEvents), 
 fhNPileUpEvents(maker.fhNPileUpEvents),
 fhZVertex(maker.fhZVertex),    
+fhPileUpClusterMult(maker.fhPileUpClusterMult),
+fhPileUpClusterMultAndSPDPileUp(maker.fhPileUpClusterMultAndSPDPileUp),
+fh2PileUpClusterMult(maker.fh2PileUpClusterMult),
+fh2PileUpClusterMultAndSPDPileUp(maker.fh2PileUpClusterMultAndSPDPileUp),
 fhTrackMult(maker.fhTrackMult),
 fhCentrality(maker.fhCentrality),
 fhEventPlaneAngle(maker.fhEventPlaneAngle),
@@ -179,20 +185,49 @@ TList *AliAnaCaloTrackCorrMaker::GetOutputContainer()
   fhNEvents->SetYTitle("# events");
   fOutputContainer->Add(fhNEvents);
   
-  fhNPileUpEvents      = new TH1I("hNPileUpEvents",   "Number of events considered as pile-up", 2 , 0 , 2  ) ;
+  fhNPileUpEvents      = new TH1I("hNPileUpEvents",   "Number of events considered as pile-up", 8 , 0 , 8 ) ;
   fhNPileUpEvents->SetYTitle("# events");
   fhNPileUpEvents->GetXaxis()->SetBinLabel(1 ,"SPD");
   fhNPileUpEvents->GetXaxis()->SetBinLabel(2 ,"Multi SPD");
+  fhNPileUpEvents->GetXaxis()->SetBinLabel(3 ,"EMCal");
+  fhNPileUpEvents->GetXaxis()->SetBinLabel(4 ,"EMCal || SPD");
+  fhNPileUpEvents->GetXaxis()->SetBinLabel(5 ,"EMCal && SPD");
+  fhNPileUpEvents->GetXaxis()->SetBinLabel(6 ,"!EMCal && SPD");
+  fhNPileUpEvents->GetXaxis()->SetBinLabel(7 ,"EMCal && !SPD");
+  fhNPileUpEvents->GetXaxis()->SetBinLabel(8 ,"!EMCal && !SPD");
+
   fOutputContainer->Add(fhNPileUpEvents);
   
   fhZVertex      = new TH1F("hZVertex", " Z vertex distribution"   , 200 , -50 , 50  ) ;
   fhZVertex->SetXTitle("v_{z} (cm)");
   fOutputContainer->Add(fhZVertex);
   
+  fhZVertex      = new TH1F("hZVertex", " Z vertex distribution"   , 200 , -50 , 50  ) ;
+  fhZVertex->SetXTitle("v_{z} (cm)");
+  fOutputContainer->Add(fhZVertex);
+  
   fhTrackMult    = new TH1I("hTrackMult", "Number of tracks per events"   , 2000 , 0 , 2000  ) ;
   fhTrackMult->SetXTitle("# tracks");
   fOutputContainer->Add(fhTrackMult);
   
+  fhPileUpClusterMult    = new TH1I("hPileUpClusterMult", "Number of clusters per event with large time (|t| > 20 ns)" , 100 , 0 , 100  ) ;
+  fhPileUpClusterMult->SetXTitle("# clusters");
+  fOutputContainer->Add(fhPileUpClusterMult);
+  
+  fhPileUpClusterMultAndSPDPileUp = new TH1I("hPileUpClusterMultAndSPDPileUp", "Number of clusters per event with large time (|t| > 20 ns, events tagged as pile-up by SPD)" , 100 , 0 , 100 ) ;
+  fhPileUpClusterMultAndSPDPileUp->SetXTitle("# clusters");
+  fOutputContainer->Add(fhPileUpClusterMultAndSPDPileUp);
+  
+  fh2PileUpClusterMult = new TH2I("h2PileUpClusterMult", "Number of clusters per event with large time (|t| > 20 ns)" , 100 , 0 , 100 , 100 , 0 , 100 ) ;
+  fh2PileUpClusterMult->SetXTitle("# clusters (large t)");
+  fh2PileUpClusterMult->SetYTitle("# clusters (small t)");
+  fOutputContainer->Add(fh2PileUpClusterMult);
+  
+  fh2PileUpClusterMultAndSPDPileUp = new TH2I("h2PileUpClusterMultAndSPDPileUp", "Number of clusters per event with large time (|t| > 20 ns, events tagged as pile-up by SPD)" , 100 , 0 , 100 , 100 , 0 , 100) ;
+  fh2PileUpClusterMultAndSPDPileUp->SetXTitle("# clusters (large t)");
+  fh2PileUpClusterMultAndSPDPileUp->SetYTitle("# clusters (small t)");
+  fOutputContainer->Add(fh2PileUpClusterMultAndSPDPileUp);
+  
   fhCentrality   = new TH1F("hCentrality","Number of events in centrality bin",100,0.,100) ;
   fhCentrality->SetXTitle("Centrality bin");
   fOutputContainer->Add(fhCentrality) ;  
@@ -424,13 +459,34 @@ void AliAnaCaloTrackCorrMaker::ProcessEvent(const Int_t iEntry,
   // Event control histograms
  
   fhNEvents        ->Fill(0); // Number of events analyzed
-  if(fReader->IsPileUpFromSPD()) 
+  
+  if( fReader->IsPileUpFromSPD()) 
     fhNPileUpEvents->Fill(0.5);
-  if(fReader->GetInputEvent()->IsPileupFromSPDInMultBins()) 
+  if( fReader->GetInputEvent()->IsPileupFromSPDInMultBins()) 
     fhNPileUpEvents->Fill(1.5);
-  fhTrackMult      ->Fill(fReader->GetTrackMultiplicity()); 
-  fhCentrality     ->Fill(fReader->GetEventCentrality  ());
-  fhEventPlaneAngle->Fill(fReader->GetEventPlaneAngle  ());
+  if( fReader->IsPileUpFromEMCal())
+    fhNPileUpEvents->Fill(2.5);
+  if( fReader->IsPileUpFromSPDOrEMCal() )
+    fhNPileUpEvents->Fill(3.5);
+  if( fReader->IsPileUpFromSPDAndEMCal() )
+    fhNPileUpEvents->Fill(4.5);
+  if( fReader->IsPileUpFromSPDAndNotEMCal() )
+    fhNPileUpEvents->Fill(5.5);
+  if( fReader->IsPileUpFromEMCalAndNotSPD() )
+    fhNPileUpEvents->Fill(6.5);
+  if( fReader->IsPileUpFromNotSPDAndNotEMCal() )
+    fhNPileUpEvents->Fill(7.5);
+  
+  if(fReader->IsPileUpFromSPD())
+  {
+    fhPileUpClusterMultAndSPDPileUp ->Fill(fReader->GetNPileUpClusters());
+    fh2PileUpClusterMultAndSPDPileUp->Fill(fReader->GetNPileUpClusters(),fReader->GetNNonPileUpClusters());
+  }
+  fhPileUpClusterMult ->Fill(fReader->GetNPileUpClusters  ());
+  fh2PileUpClusterMult->Fill(fReader->GetNPileUpClusters  (),fReader->GetNNonPileUpClusters());
+  fhTrackMult         ->Fill(fReader->GetTrackMultiplicity());
+  fhCentrality        ->Fill(fReader->GetEventCentrality  ());
+  fhEventPlaneAngle   ->Fill(fReader->GetEventPlaneAngle  ());
 
   Double_t v[3];
   fReader->GetInputEvent()->GetPrimaryVertex()->GetXYZ(v) ;
index 0716d0bcaf5b88800f806044ddccb7332489294f..dfaa008f1e45b28b61f2458a0dee0bb0494e7ca7 100755 (executable)
@@ -95,6 +95,10 @@ class AliAnaCaloTrackCorrMaker : public TObject {
   TH1I *   fhNEvents;           //! Number of events counter histogram
   TH1I *   fhNPileUpEvents;     //! N events pasing pile up cut
   TH1F *   fhZVertex;           //! Vertex of accepted event
+  TH1I *   fhPileUpClusterMult; //! N clusters with high time
+  TH1I *   fhPileUpClusterMultAndSPDPileUp; //! N clusters with high time in events tagged as pile-up by SPD
+  TH2I *   fh2PileUpClusterMult; //! N clusters with high time vs N clusterd with small time
+  TH2I *   fh2PileUpClusterMultAndSPDPileUp; //! N clusters with high time vs N clusterd with small time in events tagged as pile-up by SPD
   TH1I *   fhTrackMult;         //! Number of tracks per event histogram
   TH1F *   fhCentrality;        //! Histogram with centrality bins
   TH1F *   fhEventPlaneAngle;   //! Histogram with Event plane angle
@@ -103,7 +107,7 @@ class AliAnaCaloTrackCorrMaker : public TObject {
 
   AliAnaCaloTrackCorrMaker & operator = (const AliAnaCaloTrackCorrMaker & ) ; // cpy assignment
   
-  ClassDef(AliAnaCaloTrackCorrMaker,12)
+  ClassDef(AliAnaCaloTrackCorrMaker,13)
 } ;
  
 
index 86134dce4d6a52970fe91c191d83a82fb77b9780..d150cc3338affd3d5fa2edb5a6845701f5553a5e 100755 (executable)
@@ -91,7 +91,8 @@ fWriteOutputDeltaAOD(kFALSE),fOldAOD(kFALSE),                 fCaloFilterPatch(k
 fEMCALClustersListName(""),  fZvtxCut(0.),                    
 fAcceptFastCluster(kFALSE),  fRemoveLEDEvents(kTRUE), 
 fDoEventSelection(kFALSE),   fDoV0ANDEventSelection(kFALSE),  fUseEventsWithPrimaryVertex(kFALSE),
-fTriggerAnalysis (0x0), 
+fTriggerAnalysis (0x0),
+fNPileUpClusters(-1),        fNNonPileUpClusters(-1),         fNPileUpClustersCut(3),
 fCentralityClass(""),        fCentralityOpt(0),
 fEventPlaneMethod(""),       fImportGeometryFromFile(kFALSE), fImportGeometryFilePath("")
 {
@@ -435,8 +436,8 @@ void AliCaloTrackReader::InitParameters()
 
   fImportGeometryFromFile = kFALSE;
   
-  fPileUpParam[0] = 3   ; fPileUpParam[1] = 0.8 ;
-  fPileUpParam[2] = 3.0 ; fPileUpParam[3] = 2.0 ; fPileUpParam[4] = 5.0;
+  fPileUpParamSPD[0] = 3   ; fPileUpParamSPD[1] = 0.8 ;
+  fPileUpParamSPD[2] = 3.0 ; fPileUpParamSPD[3] = 2.0 ; fPileUpParamSPD[4] = 5.0;
   
   // Parametrized time cut (LHC11d)
   fEMCALParamTimeCutMin[0] =-5; fEMCALParamTimeCutMin[1] =-1 ; fEMCALParamTimeCutMin[2] = 3.5 ; fEMCALParamTimeCutMin[3] = 1.  ;   
@@ -447,16 +448,83 @@ void AliCaloTrackReader::InitParameters()
   //fEMCALParamTimeCutMax[0] = 3.5; fEMCALParamTimeCutMax[1] = 50; fEMCALParamTimeCutMax[2] = 0.15; fEMCALParamTimeCutMax[3] = 1.6;   
 }
 
+//___________________________________________________________
+Bool_t AliCaloTrackReader::IsInTimeWindow(const Double_t tof, const Float_t energy) const
+{
+  // Cluster time selection window
+  
+  // Parametrized cut depending on E
+  if(fUseParamTimeCut)
+  {
+    Float_t minCut= fEMCALParamTimeCutMin[0]+fEMCALParamTimeCutMin[1]*TMath::Exp(-(energy-fEMCALParamTimeCutMin[2])/fEMCALParamTimeCutMin[3]);
+    Float_t maxCut= fEMCALParamTimeCutMax[0]+fEMCALParamTimeCutMax[1]*TMath::Exp(-(energy-fEMCALParamTimeCutMax[2])/fEMCALParamTimeCutMax[3]);
+    //printf("tof %f, minCut %f, maxCut %f\n",tof,minCut,maxCut);
+    if( tof < minCut || tof > maxCut )  return kFALSE ;
+  }
+  
+  //In any case, the time should to be larger than the fixed window ...
+  if( tof < fEMCALTimeCutMin  || tof > fEMCALTimeCutMax )  return kFALSE ;
+  
+  return kTRUE ;
+}
 
 //________________________________________________
 Bool_t AliCaloTrackReader::IsPileUpFromSPD() const
 {
   // Check if event is from pile-up determined by SPD
   // Default values: (3, 0.8, 3., 2., 5.)
-  return fInputEvent->IsPileupFromSPD((Int_t) fPileUpParam[0] , fPileUpParam[1] , 
-                                              fPileUpParam[2] , fPileUpParam[3] , fPileUpParam[4] ); 
-  //printf("Param : %d, %2.2f, %2.2f, %2.2f, %2.2f\n",(Int_t) fPileUpParam[0], fPileUpParam[1], fPileUpParam[2], fPileUpParam[3], fPileUpParam[4]);
+  return fInputEvent->IsPileupFromSPD((Int_t) fPileUpParamSPD[0] , fPileUpParamSPD[1] , 
+                                              fPileUpParamSPD[2] , fPileUpParamSPD[3] , fPileUpParamSPD[4] ); 
+  //printf("Param : %d, %2.2f, %2.2f, %2.2f, %2.2f\n",(Int_t) fPileUpParamSPD[0], fPileUpParamSPD[1], fPileUpParamSPD[2], fPileUpParamSPD[3], fPileUpParamSPD[4]);
+
+}
+
+//__________________________________________________
+Bool_t AliCaloTrackReader::IsPileUpFromEMCal() const
+{
+  // Check if event is from pile-up determined by EMCal
+  if(fNPileUpClusters > fNPileUpClustersCut) return kTRUE ;
+  else                                       return kFALSE;
+}
+
+//________________________________________________________
+Bool_t AliCaloTrackReader::IsPileUpFromSPDAndEMCal() const
+{
+  // Check if event is from pile-up determined by SPD and EMCal
+  if( IsPileUpFromSPD() && IsPileUpFromEMCal()) return kTRUE ;
+  else                                          return kFALSE;
+}
 
+//_______________________________________________________
+Bool_t AliCaloTrackReader::IsPileUpFromSPDOrEMCal() const
+{
+  // Check if event is from pile-up determined by SPD or EMCal
+  if( IsPileUpFromSPD() || IsPileUpFromEMCal()) return kTRUE ;
+  else                                          return kFALSE;
+}
+
+//___________________________________________________________
+Bool_t AliCaloTrackReader::IsPileUpFromSPDAndNotEMCal() const
+{
+  // Check if event is from pile-up determined by SPD and not by EMCal
+  if( IsPileUpFromSPD() && !IsPileUpFromEMCal()) return kTRUE ;
+  else                                          return kFALSE;
+}
+
+//___________________________________________________________
+Bool_t AliCaloTrackReader::IsPileUpFromEMCalAndNotSPD() const
+{
+  // Check if event is from pile-up determined by EMCal, not by SPD
+  if( !IsPileUpFromSPD() && IsPileUpFromEMCal()) return kTRUE ;
+  else                                           return kFALSE;
+}
+
+//______________________________________________________________
+Bool_t AliCaloTrackReader::IsPileUpFromNotSPDAndNotEMCal() const
+{
+  // Check if event not from pile-up determined neither by SPD nor by EMCal
+  if( !IsPileUpFromSPD() && !IsPileUpFromEMCal()) return kTRUE ;
+  else                                            return kFALSE;
 }
 
 //________________________________________________________
@@ -630,7 +698,7 @@ Bool_t AliCaloTrackReader::FillInputEvent(const Int_t iEntry,
       // Do not analyze events with pileup
       Bool_t bPileup = IsPileUpFromSPD();
       //IsPileupFromSPDInMultBins() // method to try
-      //printf("pile-up %d, %d, %2.2f, %2.2f, %2.2f, %2.2f\n",bPileup, (Int_t) fPileUpParam[0], fPileUpParam[1], fPileUpParam[2], fPileUpParam[3], fPileUpParam[4]);
+      //printf("pile-up %d, %d, %2.2f, %2.2f, %2.2f, %2.2f\n",bPileup, (Int_t) fPileUpParamSPD[0], fPileUpParamSPD[1], fPileUpParamSPD[2], fPileUpParamSPD[3], fPileUpParamSPD[4]);
       if(bPileup) return kFALSE;
       
       if(fDoV0ANDEventSelection)
@@ -1153,17 +1221,13 @@ void AliCaloTrackReader::FillInputEMCALAlgorithm(AliVCluster * clus,
   
   Double_t tof = clus->GetTOF()*1e9;
 
-  if(!fUseParamTimeCut)
+  if(!IsInTimeWindow(tof,momentum.E()))
   {
-    if( tof < fEMCALTimeCutMin  || tof > fEMCALTimeCutMax )            return ;
-  }
-  else 
-  {
-    Float_t minCut= fEMCALParamTimeCutMin[0]+fEMCALParamTimeCutMin[1]*TMath::Exp(-(momentum.E()-fEMCALParamTimeCutMin[2])/fEMCALParamTimeCutMin[3]);
-    Float_t maxCut= fEMCALParamTimeCutMax[0]+fEMCALParamTimeCutMax[1]*TMath::Exp(-(momentum.E()-fEMCALParamTimeCutMax[2])/fEMCALParamTimeCutMax[3]);
-    //printf("tof %f, minCut %f, maxCut %f\n",tof,minCut,maxCut);
-    if( tof < minCut || tof > maxCut )  return ;
+    fNPileUpClusters++ ;
+    return ;
   }
+  else
+    fNNonPileUpClusters++;
 
   if(fDebug > 2 && momentum.E() > 0.1) 
     printf("AliCaloTrackReader::FillInputEMCAL() - Selected clusters E %3.2f, pt %3.2f, phi %3.2f, eta %3.2f\n",
@@ -1189,6 +1253,9 @@ void AliCaloTrackReader::FillInputEMCAL()
   //                                                          GetEMCALCells(), 
   //                                                          fInputEvent->GetBunchCrossNumber());
   
+  fNPileUpClusters    = 0; // Init counter
+  fNNonPileUpClusters = 0; // Init counter
+  
   //Loop to select clusters in fiducial cut and fill container with aodClusters
   if(fEMCALClustersListName=="")
   {
@@ -1248,8 +1315,8 @@ void AliCaloTrackReader::FillInputEMCAL()
     GetCaloUtils()->RecalculateClusterTrackMatching(fInputEvent,clusterList);
     
   }
-  
-  if(fDebug > 1) printf("AliCaloTrackReader::FillInputEMCAL() - aod entries %d\n",  fEMCALClusters->GetEntriesFast());
+    
+  if(fDebug > 1) printf("AliCaloTrackReader::FillInputEMCAL() - aod entries %d, n pile-up clusters %d, n non pile-up %d \n",  fEMCALClusters->GetEntriesFast(),fNPileUpClusters,fNNonPileUpClusters);
   
 }
 
index e97767e28f5fb6d50924043d24d74a62bc52aa80..80f142ecd3b0ce72a6024899dd90d2eb00d941da 100755 (executable)
@@ -123,6 +123,8 @@ public:
   Double_t         GetEMCALTimeCutMin()              const { return fEMCALTimeCutMin       ; }
   Double_t         GetEMCALTimeCutMax()              const { return fEMCALTimeCutMax       ; } 
 
+  Bool_t           IsInTimeWindow(const Double_t tof, const Float_t energy)  const ;
+  
   void             SetEMCALTimeCut(Double_t a, Double_t b) { fEMCALTimeCutMin = a ; 
                                                              fEMCALTimeCutMax = b          ; } // ns
   
@@ -242,9 +244,21 @@ public:
   void             SwitchOffPrimaryVertexSelection()       { fUseEventsWithPrimaryVertex = kFALSE ; }
   Bool_t           IsPrimaryVertexSelectionDone()    const { return fUseEventsWithPrimaryVertex   ; } 
   
-  Bool_t           IsPileUpFromSPD() const ;    
-  void             SetPileUpParam(Int_t i, Double_t param) { fPileUpParam[i] = param   ; }
+  Bool_t           IsPileUpFromSPD()               const ;
+  Bool_t           IsPileUpFromEMCal()             const ;
+  Bool_t           IsPileUpFromSPDAndEMCal()       const ;
+  Bool_t           IsPileUpFromSPDOrEMCal()        const ;
+  Bool_t           IsPileUpFromSPDAndNotEMCal()    const ;
+  Bool_t           IsPileUpFromEMCalAndNotSPD()    const ;
+  Bool_t           IsPileUpFromNotSPDAndNotEMCal() const ;
+
+  void             SetPileUpParamForSPD  (Int_t i, Double_t param)
+                                                           { fPileUpParamSPD[i]  = param ; }
+  void             SetPileUpParamForEMCal(Int_t param)     { fNPileUpClustersCut = param ; }
   
+  Int_t            GetNPileUpClusters()                    { return  fNPileUpClusters    ; }
+  Int_t            GetNNonPileUpClusters()                 { return  fNNonPileUpClusters ; }
+
   // Track selection
   ULong_t          GetTrackStatus()                  const { return fTrackStatus       ; }
   void             SetTrackStatus(ULong_t bit)             { fTrackStatus = bit        ; }             
@@ -502,11 +516,16 @@ public:
   Bool_t           fDoV0ANDEventSelection;       // Select events depending on V0, fDoEventSelection should be on
   Bool_t           fUseEventsWithPrimaryVertex ; // Select events with primary vertex
   AliTriggerAnalysis* fTriggerAnalysis;          // Access to trigger selection algorithm for V0AND calculation
-  Double_t         fPileUpParam[5];              // Parameters to pass to method IsPileupFromSPD: Int_t minContributors, 
+  Double_t         fPileUpParamSPD[5];           // Parameters to pass to method IsPileupFromSPD: Int_t minContributors,
                                                  // Double_t minZdist, 
                                                  // Double_t nSigmaZdist, 
                                                  // Double_t nSigmaDiamXY, 
                                                  // Double_t nSigmaDiamZ)
+  // Pile-up in EMCal
+  Int_t            fNPileUpClusters;             // Number of clusters with time avobe 20 ns
+  Int_t            fNNonPileUpClusters;          // Number of clusters with time below 20 ns
+  Int_t            fNPileUpClustersCut;          // Cut to select event as pile-up
+
   //Centrality/Event plane
   TString          fCentralityClass;        // Name of selected centrality class     
   Int_t            fCentralityOpt;          // Option for the returned value of the centrality, possible options 5, 10, 100
@@ -516,10 +535,11 @@ public:
   Bool_t           fImportGeometryFromFile; // Import geometry settings in geometry.root file
   TString          fImportGeometryFilePath; // path fo geometry.root file
 
+  
   AliCaloTrackReader(              const AliCaloTrackReader & r) ; // cpy ctor
   AliCaloTrackReader & operator = (const AliCaloTrackReader & r) ; // cpy assignment
   
-  ClassDef(AliCaloTrackReader,45)
+  ClassDef(AliCaloTrackReader,46)
   
 } ;