]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGGA/EMCALTasks/AliAnalysisTaskESDfilterEMCALEventSelect.cxx
Merge branch 'feature-movesplit'
[u/mrichter/AliRoot.git] / PWGGA / EMCALTasks / AliAnalysisTaskESDfilterEMCALEventSelect.cxx
1 /**************************************************************************
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3  *                                                                        *
4  * Author: The ALICE Off-line Project.                                    *
5  * Contributors are mentioned in the code where appropriate.              *
6  *                                                                        *
7  * Permission to use, copy, modify and distribute this software and its   *
8  * documentation strictly for non-commercial purposes is hereby granted   *
9  * without fee, provided that the above copyright notice appears in all   *
10  * copies and that both the copyright notice and this permission notice   *
11  * appear in the supporting documentation. The authors make no claims     *
12  * about the suitability of this software for any purpose. It is          *
13  * provided "as is" without express or implied warranty.                  *
14  **************************************************************************/
15
16 //////////////////////////////////////////////////////////
17 // Calls derived from AliAnalysisTaskESDfilter
18 // Filter the ESD Events to AODs, only those events with
19 // some signal in EMCAL, righ now at least a 
20 // cluster of high energy
21 //
22 // Author: Gustavo Conesa Balbastre (LPSC - Grenoble)
23 //
24 // $Id$
25 //
26 //////////////////////////////////////////////////////////
27
28 #include "AliESDCaloCluster.h"
29
30 #include "AliAnalysisTaskESDfilterEMCALEventSelect.h"
31
32 ClassImp(AliAnalysisTaskESDfilterEMCALEventSelect)
33
34 //____________________________________________________________________________________
35 AliAnalysisTaskESDfilterEMCALEventSelect::AliAnalysisTaskESDfilterEMCALEventSelect() : 
36 AliAnalysisTaskESDfilter("ESD Filte : EMCAL selected events"), 
37 fEnergyCut(10),            fNcellsCut (2),
38 fRecoUtils(0x0),           
39 fGeometry(0),              fGeoName("EMCAL_COMPLETE12SMV1")        
40 {
41   // Default constructor
42   
43   fRecoUtils = new AliEMCALRecoUtils;
44
45 }                     
46
47 //____________________________________________________________________________________________________
48 AliAnalysisTaskESDfilterEMCALEventSelect::AliAnalysisTaskESDfilterEMCALEventSelect(const char *name) : 
49 AliAnalysisTaskESDfilter(name), 
50 fEnergyCut(10),            fNcellsCut (2),
51 fRecoUtils(0x0),           
52 fGeometry(0),              fGeoName("EMCAL_COMPLETE12SMV1")
53 {
54   // Constructor
55   
56   fRecoUtils = new AliEMCALRecoUtils;
57
58 }
59
60 //_________________________________________________________________
61 Bool_t AliAnalysisTaskESDfilterEMCALEventSelect::AcceptEventEMCAL()
62 {
63   // Accept event given there is a cluster with enough energy
64     
65   if(!fGeometry)  fGeometry  = AliEMCALGeometry::GetInstance("EMCAL_COMPLETE12SMV1");
66
67   Int_t           nCluster = InputEvent() -> GetNumberOfCaloClusters();
68   AliVCaloCells * caloCell = InputEvent() -> GetEMCALCells();
69   Int_t           bc       = InputEvent() -> GetBunchCrossNumber();
70   
71   for(Int_t icalo = 0; icalo < nCluster; icalo++)
72   {
73     AliESDCaloCluster *clus = (AliESDCaloCluster*) (InputEvent()->GetCaloCluster(icalo));
74     
75     if( ( clus->IsEMCAL() ) && ( clus->GetNCells() > fNcellsCut ) && ( clus->E() > fEnergyCut ) &&
76         fRecoUtils->IsGoodCluster(clus,fGeometry,caloCell,bc))
77     {
78       
79      // printf("Accept event %d, E %2.2f > %2.2f, nCells %d > %d \n", 
80      //        (Int_t) Entry(),clus->E(), fEnergyCut, clus->GetNCells(), fNcellsCut);
81       
82       return kTRUE;
83     }
84     
85   }// loop
86   
87   return kFALSE;
88   
89 }  
90
91 //_________________________________________________________________
92 void AliAnalysisTaskESDfilterEMCALEventSelect::UserExec(Option_t *) 
93 {
94   // Main loop
95
96   // Check if the events contains what we want in EMCAL, if not, 
97   // do not copy the ESD into AOD
98   
99   if(!AcceptEventEMCAL()) return ;
100   
101   // Continue the processing in the same way as in the ESD filter
102   
103   AliAnalysisTaskESDfilter::UserExec("");
104   
105 }