]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG4/PartCorrBase/AliCaloTrackReader.cxx
Centrality update (Alberica)
[u/mrichter/AliRoot.git] / PWG4 / PartCorrBase / AliCaloTrackReader.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 /* $Id:  $ */
16
17 //_________________________________________________________________________
18 // Base class for reading data: MonteCarlo, ESD or AOD, of PHOS EMCAL and 
19 // Central Barrel Tracking detectors (CTS).
20 // Not all MC particles/tracks/clusters are kept, some kinematical/fiducial restrictions are done.
21 // Mother class of : AliCaloTrackESDReader: Fills ESD data in 3 TObjArrays (PHOS, EMCAL, CTS)
22 //                 : AliCaloTrackMCReader : Fills Kinematics data in 3 TObjArrays (PHOS, EMCAL, CTS)
23 //                 : AliCaloTrackAODReader: Fills AOD data in 3 TObjArrays (PHOS, EMCAL, CTS) 
24 //-- Author: Gustavo Conesa (LNF-INFN) 
25 //////////////////////////////////////////////////////////////////////////////
26
27
28 // --- ROOT system ---
29 #include <TFile.h>
30
31 //---- ANALYSIS system ----
32 #include "AliMCEvent.h"
33 #include "AliAODMCHeader.h"
34 #include "AliGenPythiaEventHeader.h"
35 #include "AliESDEvent.h"
36 #include "AliAODEvent.h"
37 #include "AliVTrack.h"
38 #include "AliVParticle.h"
39 #include "AliMixedEvent.h"
40 #include "AliESDtrack.h"
41 #include "AliESDtrackCuts.h"
42 #include "AliTriggerAnalysis.h"
43 #include "AliESDVZERO.h"
44
45 //---- PartCorr/EMCAL ---
46 #include "AliEMCALRecoUtils.h"
47 #include "AliCaloTrackReader.h"
48
49 ClassImp(AliCaloTrackReader)
50   
51   
52 //____________________________________________________________________________
53   AliCaloTrackReader::AliCaloTrackReader() : 
54     TObject(),                   fEventNumber(-1), //fCurrentFileName(""),
55     fDataType(0),                fDebug(0), 
56     fFiducialCut(0x0),           fCheckFidCut(kFALSE), 
57     fComparePtHardAndJetPt(0),   fPtHardAndJetPtFactor(7),
58     fCTSPtMin(0),                fEMCALPtMin(0),                  fPHOSPtMin(0), 
59     fCTSPtMax(1000),             fEMCALPtMax(1000),               fPHOSPtMax(1000), 
60     fAODBranchList(new TList ),
61     fCTSTracks(new TObjArray()), fEMCALClusters(new TObjArray()), fPHOSClusters(new TObjArray()),
62     fEMCALCells(0x0),            fPHOSCells(0x0),
63     fInputEvent(0x0),            fOutputEvent(0x0),fMC(0x0),
64     fFillCTS(0),                 fFillEMCAL(0),                   fFillPHOS(0),
65     fFillEMCALCells(0),          fFillPHOSCells(0), 
66     fRecalculateClusters(kFALSE),fSelectEmbeddedClusters(kFALSE),
67     fTrackStatus(0),             fTrackFilterMask(0),             fESDtrackCuts(0), 
68     fTrackMult(0),               fTrackMultEtaCut(0.8),
69     fReadStack(kFALSE),          fReadAODMCParticles(kFALSE), 
70     fDeltaAODFileName("deltaAODPartCorr.root"),
71     fFiredTriggerClassName(""),  fAnaLED(kFALSE),
72     fTaskName(""),               fCaloUtils(0x0), 
73     fMixedEvent(NULL),           fNMixedEvent(1),                 fVertex(NULL), 
74     fWriteOutputDeltaAOD(kFALSE),fOldAOD(kFALSE),                 fCaloFilterPatch(kFALSE),
75     fEMCALClustersListName(""),  fZvtxCut(0.),                    
76     fAcceptFastCluster(kTRUE),   fRemoveLEDEvents(kFALSE), 
77     fDoEventSelection(kFALSE),   fDoV0ANDEventSelection(kFALSE),  fUseEventsWithPrimaryVertex(kFALSE),
78     fTriggerAnalysis (new AliTriggerAnalysis), 
79     fCentralityClass("V0M"),     fCentralityOpt(10),
80     fEventPlaneMethod("Q")
81    
82 {
83   //Ctor
84   
85   //Initialize parameters
86   InitParameters();
87 }
88
89 //_________________________________
90 AliCaloTrackReader::~AliCaloTrackReader() {
91   //Dtor
92   
93   delete fFiducialCut ;
94         
95   if(fAODBranchList){
96     fAODBranchList->Delete();
97     delete fAODBranchList ;
98   }  
99   
100   if(fCTSTracks){
101     if(fDataType!=kMC)fCTSTracks->Clear() ; 
102     else              fCTSTracks->Delete() ; 
103     delete fCTSTracks ;
104   }
105   
106   if(fEMCALClusters){
107     if(fDataType!=kMC)fEMCALClusters->Clear("C") ; 
108     else              fEMCALClusters->Delete() ; 
109     delete fEMCALClusters ;
110   }
111   
112   if(fPHOSClusters){
113     if(fDataType!=kMC)fPHOSClusters->Clear("C") ; 
114     else              fPHOSClusters->Delete() ; 
115     delete fPHOSClusters ;
116   }
117   
118   if(fVertex){
119     for (Int_t i = 0; i < fNMixedEvent; i++) {
120       delete [] fVertex[i] ;
121
122     }
123     delete [] fVertex ;
124         }
125
126   delete fESDtrackCuts;
127   delete fTriggerAnalysis;
128   
129 //  Pointers not owned, done by the analysis frame
130 //  if(fInputEvent)  delete fInputEvent ;
131 //  if(fOutputEvent) delete fOutputEvent ;
132 //  if(fMC)          delete fMC ;  
133 //  Pointer not owned, deleted by maker
134 //  if (fCaloUtils) delete fCaloUtils ;
135
136 }
137
138 //_________________________________________________________________________
139 Bool_t AliCaloTrackReader::ComparePtHardAndJetPt(){
140   // Check the event, if the requested ptHard is much larger than the jet pT, then there is a problem.
141   // Only for PYTHIA.
142   if(!fReadStack) return kTRUE; //Information not filtered to AOD
143   
144   if(!strcmp(GetGenEventHeader()->ClassName(), "AliGenPythiaEventHeader")){
145     TParticle * jet =  0;
146     AliGenPythiaEventHeader* pygeh= (AliGenPythiaEventHeader*) GetGenEventHeader();
147     Int_t nTriggerJets =  pygeh->NTriggerJets();
148     Float_t ptHard = pygeh->GetPtHard();
149     
150     //if(fDebug > 1) printf("AliMCAnalysisUtils::PythiaEventHeader: Njets: %d, pT Hard %f\n",nTriggerJets, ptHard);
151     Float_t tmpjet[]={0,0,0,0};
152     for(Int_t ijet = 0; ijet< nTriggerJets; ijet++){
153       pygeh->TriggerJet(ijet, tmpjet);
154       jet = new TParticle(94, 21, -1, -1, -1, -1, tmpjet[0],tmpjet[1],tmpjet[2],tmpjet[3], 0,0,0,0);
155       //Compare jet pT and pt Hard
156       //if(fDebug > 1) printf("AliMCAnalysisUtils:: %d pycell jet pT %f\n",ijet, jet->Pt());
157       if(jet->Pt() > fPtHardAndJetPtFactor * ptHard) {
158         printf("AliMCAnalysisUtils::PythiaEventHeader: Njets: %d, pT Hard %2.2f, pycell jet pT %2.2f, rejection factor %1.1f\n",
159                nTriggerJets, ptHard, jet->Pt(), fPtHardAndJetPtFactor);
160         return kFALSE;
161       }
162     }
163     if(jet) delete jet; 
164   }
165   
166   return kTRUE ;
167   
168 }
169
170 //____________________________________________________________________________
171 AliStack* AliCaloTrackReader::GetStack() const {
172   //Return pointer to stack
173   if(fMC)
174     return fMC->Stack();
175   else{
176     if(fDebug > 1) printf("AliCaloTrackReader::GetStack() - Stack is not available\n"); 
177     return 0x0 ;
178   }
179 }
180
181 //____________________________________________________________________________
182 AliHeader* AliCaloTrackReader::GetHeader() const {
183   //Return pointer to header
184   if(fMC)
185     return fMC->Header();
186   else{
187     printf("AliCaloTrackReader::Header is not available\n"); 
188     return 0x0 ;
189   }
190 }
191 //____________________________________________________________________________
192 AliGenEventHeader* AliCaloTrackReader::GetGenEventHeader() const {
193   //Return pointer to Generated event header
194   if(fMC)
195     return fMC->GenEventHeader();
196   else{
197     printf("AliCaloTrackReader::GenEventHeader is not available\n"); 
198     return 0x0 ;
199   }
200 }
201
202 //____________________________________________________________________________
203 TClonesArray* AliCaloTrackReader::GetAODMCParticles(Int_t input) const {
204   //Return list of particles in AOD. Do it for the corresponding input event.
205   
206   TClonesArray * rv = NULL ; 
207   if(fDataType == kAOD){
208  
209     if(input == 0){
210       //Normal input AOD
211       AliAODEvent * evt = dynamic_cast<AliAODEvent*> (fInputEvent) ;
212       if(evt)
213         rv = (TClonesArray*)evt->FindListObject("mcparticles");
214       else  
215         printf("AliCaloTrackReader::GetAODMCParticles() - wrong AOD input index? %d, or non existing tree? \n",input); 
216       
217     }  
218     
219   } else {
220       printf("AliCaloTrackReader::GetAODMCParticles() - Input are not AODs\n"); 
221   }
222   
223   return rv ; 
224 }
225
226 //____________________________________________________________________________
227 AliAODMCHeader* AliCaloTrackReader::GetAODMCHeader(Int_t input) const {
228   //Return MC header in AOD. Do it for the corresponding input event.
229   AliAODMCHeader *mch = NULL;
230   if(fDataType == kAOD){
231     //Normal input AOD
232     if(input == 0) {
233       mch = (AliAODMCHeader*)((AliAODEvent*)fInputEvent)->FindListObject("mcheader");
234     }
235     //          //Second input AOD
236     //          else if(input == 1){ 
237     //       mch = (AliAODMCHeader*) fSecondInputAODEvent->FindListObject("mcheader");
238     //  }
239     else {
240       printf("AliCaloTrackReader::GetAODMCHeader() - wrong AOD input index, %d\n",input);
241     }
242   }
243   else {
244     printf("AliCaloTrackReader::GetAODMCHeader() - Input are not AODs\n");
245   }
246   
247   return mch;
248 }
249
250 //_______________________________________________________________
251 void AliCaloTrackReader::Init()
252 {
253   //Init reader. Method to be called in AliAnaPartCorrMaker
254     
255   if(fReadStack && fReadAODMCParticles){
256     printf("AliCaloTrackReader::Init() - Cannot access stack and mcparticles at the same time, change them \n");
257     fReadStack = kFALSE;
258     fReadAODMCParticles = kFALSE;
259   }
260   
261 }
262
263 //_______________________________________________________________
264 void AliCaloTrackReader::InitParameters()
265 {
266   //Initialize the parameters of the analysis.
267   fDataType   = kESD ;
268   fCTSPtMin   = 0.1 ;
269   fEMCALPtMin = 0.1 ;
270   fPHOSPtMin  = 0.1 ;
271   fCTSPtMax   = 1000. ;
272   fEMCALPtMax = 1000. ;
273   fPHOSPtMax  = 1000. ;
274   
275   //Do not filter the detectors input by default.
276   fFillEMCAL      = kFALSE;
277   fFillPHOS       = kFALSE;
278   fFillCTS        = kFALSE;
279   fFillEMCALCells = kFALSE;
280   fFillPHOSCells  = kFALSE;
281
282   fReadStack             = kFALSE; // Check in the constructor of the other readers if it was set or in the configuration file
283   fReadAODMCParticles    = kFALSE; // Check in the constructor of the other readers if it was set or in the configuration file
284   fDeltaAODFileName      = "deltaAODPartCorr.root";
285   fFiredTriggerClassName = "";
286                 
287   fAnaLED = kFALSE;
288   
289   //We want tracks fitted in the detectors:
290   //fTrackStatus=AliESDtrack::kTPCrefit;
291   //fTrackStatus|=AliESDtrack::kITSrefit;  
292   fTrackFilterMask = 128; //For AODs, but what is the difference between fTrackStatus and fTrackFilterMask?
293   
294   fESDtrackCuts = AliESDtrackCuts::GetStandardTPCOnlyTrackCuts(); //initialize with TPC only tracks 
295
296   fV0ADC[0] = 0;   fV0ADC[1] = 0; 
297   fV0Mul[0] = 0;   fV0Mul[1] = 0; 
298
299   fZvtxCut   = 10.;
300   
301   //Centrality
302   fCentralityBin[0]=fCentralityBin[1]=-1;
303     
304 }
305
306 //________________________________________________________________
307 void AliCaloTrackReader::Print(const Option_t * opt) const
308 {
309
310   //Print some relevant parameters set for the analysis
311   if(! opt)
312     return;
313
314   printf("***** Print: %s %s ******\n", GetName(), GetTitle() ) ;
315   printf("Task name      : %s\n", fTaskName.Data()) ;
316   printf("Data type      : %d\n", fDataType) ;
317   printf("CTS Min pT     : %2.1f GeV/c\n", fCTSPtMin) ;
318   printf("EMCAL Min pT   : %2.1f GeV/c\n", fEMCALPtMin) ;
319   printf("PHOS Min pT    : %2.1f GeV/c\n", fPHOSPtMin) ;
320   printf("CTS Max pT     : %2.1f GeV/c\n", fCTSPtMax) ;
321   printf("EMCAL Max pT   : %2.1f GeV/c\n", fEMCALPtMax) ;
322   printf("PHOS Max pT    : %2.1f GeV/c\n", fPHOSPtMax) ;
323   printf("Use CTS         =     %d\n", fFillCTS) ;
324   printf("Use EMCAL       =     %d\n", fFillEMCAL) ;
325   printf("Use PHOS        =     %d\n", fFillPHOS) ;
326   printf("Use EMCAL Cells =     %d\n", fFillEMCALCells) ;
327   printf("Use PHOS  Cells =     %d\n", fFillPHOSCells) ;
328   printf("Track status    =     %d\n", (Int_t) fTrackStatus) ;
329   printf("Track filter mask (AODs) =  %d\n", (Int_t) fTrackFilterMask) ;
330   printf("Track Mult Eta Cut =  %d\n", (Int_t) fTrackMultEtaCut) ;
331   printf("Write delta AOD =     %d\n", fWriteOutputDeltaAOD) ;
332   printf("Recalculate Clusters = %d\n", fRecalculateClusters) ;
333   
334   if(fComparePtHardAndJetPt)
335           printf("Compare jet pt and pt hard to accept event, factor = %2.2f",fPtHardAndJetPtFactor);
336                 
337   printf("Read Kine from, stack? %d, AOD ? %d \n", fReadStack, fReadAODMCParticles) ;
338   printf("Delta AOD File Name =     %s\n", fDeltaAODFileName.Data()) ;
339   printf("Centrality: Class %s, Option %d, Bin [%d,%d] \n", fCentralityClass.Data(),fCentralityOpt,fCentralityBin[0], fCentralityBin[1]) ;
340
341   printf("    \n") ;
342   
343
344
345 //___________________________________________________
346 Bool_t AliCaloTrackReader::FillInputEvent(const Int_t iEntry, const char * /*currentFileName*/) {
347   //Fill the event counter and input lists that are needed, called by the analysis maker.
348
349   fEventNumber = iEntry;
350   //fCurrentFileName = TString(currentFileName);
351   if(!fInputEvent) {
352           if(fDebug >= 0) printf("AliCaloTrackReader::FillInputEvent() - Input event not available, skip event analysis\n");
353           return kFALSE;
354   }
355   //Select events only fired by a certain trigger configuration if it is provided
356   Int_t eventType = 0;
357   if(fInputEvent->GetHeader())
358           eventType = ((AliVHeader*)fInputEvent->GetHeader())->GetEventType();
359
360   if (GetFiredTriggerClasses().Contains("FAST")  && !GetFiredTriggerClasses().Contains("ALL") && !fAcceptFastCluster) {
361      if(fDebug > 0)  printf("AliCaloTrackReader::FillInputEvent - Do not count events from fast cluster, trigger name %s\n",fFiredTriggerClassName.Data());
362     return kFALSE;
363   }
364   
365   //-------------------------------------------------------------------------------------
366   // Reject event if large clusters with large energy
367   // Use only for LHC11a data for the moment, and if input is clusterizer V1 or V1+unfolding
368   // If clusterzer NxN or V2 it does not help
369   //-------------------------------------------------------------------------------------
370   if(fRemoveLEDEvents){
371     
372
373     //printf("Event %d\n",GetEventNumber());
374     for (Int_t i = 0; i < fInputEvent->GetNumberOfCaloClusters(); i++)
375     {
376       AliVCluster *clus = fInputEvent->GetCaloCluster(i);
377       if(clus->IsEMCAL()){               
378         if ((clus->E() > 500 && clus->GetNCells() > 200 ) || clus->GetNCells() > 200) {
379           Int_t absID = clus->GetCellsAbsId()[0];
380           Int_t sm = GetCaloUtils()->GetEMCALGeometry()->GetSuperModuleNumber(absID);
381            if(fDebug > 0) printf("AliCaloTrackReader::FillInputEvent - reject event %d with cluster : E %f, ncells %d, absId(0) %d, SM %d\n",GetEventNumber(),clus->E(),  clus->GetNCells(),absID, sm);
382           return kFALSE;
383         }
384       }
385     }
386     
387     // Count number of cells with energy larger than 0.1 in SM3, cut on this number
388     Int_t ncellsSM3 = 0;
389     Int_t ncellsSM4 = 0;
390     for(Int_t icell = 0; icell < fInputEvent->GetEMCALCells()->GetNumberOfCells(); icell++){
391       Int_t absID = fInputEvent->GetEMCALCells()->GetCellNumber(icell);
392       Int_t sm = GetCaloUtils()->GetEMCALGeometry()->GetSuperModuleNumber(absID);
393       if(fInputEvent->GetEMCALCells()->GetAmplitude(icell) > 0.1 && sm==3) ncellsSM3++;
394       if(fInputEvent->GetEMCALCells()->GetAmplitude(icell) > 0.1 && sm==4) ncellsSM4++;
395     }
396     
397     Int_t ncellcut = 21;
398     if(fFiredTriggerClassName.Contains("EMC")) ncellcut = 35;
399     
400     if(ncellsSM3 >= ncellcut || ncellsSM4 >= 100) {
401        if(fDebug > 0) printf(" AliCaloTrackReader::FillInputEvent() - reject event with ncells in SM3 %d and SM4 %d\n",ncellsSM3, ncellsSM4);
402       return kFALSE;
403     }
404   }// Remove LED events
405   
406   // Reject pure LED events?
407   if( fFiredTriggerClassName  !="" && !fAnaLED){
408     if(eventType!=7)
409       return kFALSE; //Only physics event, do not use for simulated events!!!
410     if(fDebug > 0) 
411       printf("AliCaloTrackReader::FillInputEvent() - FiredTriggerClass <%s>, selected class <%s>, compare name %d\n",
412              GetFiredTriggerClasses().Data(),fFiredTriggerClassName.Data(), GetFiredTriggerClasses().Contains(fFiredTriggerClassName));
413     if( !GetFiredTriggerClasses().Contains(fFiredTriggerClassName) ) return kFALSE;
414     else if(fDebug > 0) printf("AliCaloTrackReader::FillInputEvent() - Accepted triggered event\n");
415   }
416   else if(fAnaLED){
417 //        kStartOfRun =       1,    // START_OF_RUN
418 //        kEndOfRun =         2,    // END_OF_RUN
419 //        kStartOfRunFiles =  3,    // START_OF_RUN_FILES
420 //        kEndOfRunFiles =    4,    // END_OF_RUN_FILES
421 //        kStartOfBurst =     5,    // START_OF_BURST
422 //        kEndOfBurst =       6,    // END_OF_BURST
423 //        kPhysicsEvent =     7,    // PHYSICS_EVENT
424 //        kCalibrationEvent = 8,    // CALIBRATION_EVENT
425 //        kFormatError =      9,    // EVENT_FORMAT_ERROR
426 //        kStartOfData =      10,   // START_OF_DATA
427 //        kEndOfData =        11,   // END_OF_DATA
428 //        kSystemSoftwareTriggerEvent   = 12, // SYSTEM_SOFTWARE_TRIGGER_EVENT
429 //        kDetectorSoftwareTriggerEvent = 13  // DETECTOR_SOFTWARE_TRIGGER_EVENT
430          
431           if(eventType!=7 && fDebug > 1 )printf("AliCaloTrackReader::FillInputEvent() - DO LED, Event Type <%d>, 8 Calibration \n",  eventType);
432           if(eventType!=8)return kFALSE;
433   }
434   
435   //In case of analysis of events with jets, skip those with jet pt > 5 pt hard 
436   if(fComparePtHardAndJetPt && GetStack()) {
437     if(!ComparePtHardAndJetPt()) return kFALSE ;
438   }
439
440   //Fill Vertex array
441   FillVertexArray();
442   //Reject events with Z vertex too large, only for SE analysis, if not, cut on the analysis code
443   if(!GetMixedEvent() && TMath::Abs(fVertex[0][2]) > fZvtxCut) return kFALSE;  
444   
445   //------------------------------------------------------
446   //Event rejection depending on vertex, pileup, v0and
447   //------------------------------------------------------
448   if(fDoEventSelection){
449     if(!fCaloFilterPatch){
450       //Do not analyze events with pileup
451       Bool_t bPileup = fInputEvent->IsPileupFromSPD(3, 0.8, 3., 2., 5.); //Default values, if not it does not compile
452       //Bool_t bPileup = event->IsPileupFromSPD(); 
453       if(bPileup) return kFALSE;
454       
455       if(fDoV0ANDEventSelection){
456         Bool_t bV0AND = kTRUE; 
457         AliESDEvent* esd = dynamic_cast<AliESDEvent*> (fInputEvent);
458         if(esd) 
459           bV0AND = fTriggerAnalysis->IsOfflineTriggerFired(esd, AliTriggerAnalysis::kV0AND);
460         //else bV0AND = //FIXME FOR AODs
461         if(!bV0AND) return kFALSE;
462       }
463       
464       if(fUseEventsWithPrimaryVertex && !CheckForPrimaryVertex()) return kFALSE;
465       
466     }//CaloFilter patch
467     else{ 
468       if(fInputEvent->GetNumberOfCaloClusters() > 0) {
469         AliVCluster * calo = fInputEvent->GetCaloCluster(0);
470         if(calo->GetNLabels() == 4){
471           Int_t * selection = calo->GetLabels();
472           Bool_t bPileup = selection[0];
473           if(bPileup) return kFALSE;
474           
475           Bool_t bGoodV = selection[1]; 
476           if(fUseEventsWithPrimaryVertex && !bGoodV) return kFALSE;
477           
478           if(fDoV0ANDEventSelection){
479             Bool_t bV0AND = selection[2]; 
480             if(!bV0AND) return kFALSE;
481           }
482           
483           fTrackMult = selection[3];
484           if(fTrackMult == 0) return kFALSE;
485         } else {
486           //First filtered AODs, track multiplicity stored there.  
487           fTrackMult = (Int_t) ((AliAODHeader*)fInputEvent->GetHeader())->GetCentrality();
488           if(fTrackMult == 0) return kFALSE;          
489         }
490       }//at least one cluster
491       else {
492         //printf("AliCaloTrackReader::FillInputEvent() - No clusters in event\n");
493         //Remove events with  vertex (0,0,0), bad vertex reconstruction
494         if(fUseEventsWithPrimaryVertex && TMath::Abs(fVertex[0][0]) < 1.e-6 && TMath::Abs(fVertex[0][1]) < 1.e-6 && TMath::Abs(fVertex[0][2]) < 1.e-6) return kFALSE;
495         
496         //First filtered AODs, track multiplicity stored there.  
497         fTrackMult = (Int_t) ((AliAODHeader*)fInputEvent->GetHeader())->GetCentrality();
498         if(fTrackMult == 0) return kFALSE;
499       }// no cluster
500     }// CaloFileter patch
501   }// Event selection
502   //------------------------------------------------------
503
504   //Check if there is a centrality value, PbPb analysis, and if a centrality bin selection is requested
505   //If we need a centrality bin, we select only those events in the corresponding bin.
506   if(GetCentrality() && fCentralityBin[0]>=0 && fCentralityBin[1]>=0 && fCentralityOpt==100){
507     Int_t cen = GetEventCentrality();
508     if(cen > fCentralityBin[1] || cen < fCentralityBin[0]) return kFALSE; //reject events out of bin.
509   }
510   
511   //Fill the arrays with cluster/tracks/cells data
512    if(fFillEMCALCells) 
513     FillInputEMCALCells();
514   if(fFillPHOSCells)  
515     FillInputPHOSCells();
516         
517   if(fFillCTS){   
518     FillInputCTS();
519     //Accept events with at least one track
520     if(fTrackMult == 0 && fDoEventSelection) return kFALSE;
521   }
522   
523   if(fFillEMCAL) 
524     FillInputEMCAL();
525   if(fFillPHOS)  
526     FillInputPHOS();
527
528   FillInputVZERO();
529         
530   return kTRUE ;
531 }
532
533 //__________________________________________________
534 void AliCaloTrackReader::ResetLists() {
535   //  Reset lists, called by the analysis maker 
536
537   if(fCTSTracks)       fCTSTracks     -> Clear();
538   if(fEMCALClusters)   fEMCALClusters   -> Clear("C");
539   if(fPHOSClusters)    fPHOSClusters    -> Clear("C");
540 //  if(fEMCALCells) fEMCALCells -> Clear("");
541 //  if(fPHOSCells)  fPHOSCells  -> Clear("");
542
543   fV0ADC[0] = 0;   fV0ADC[1] = 0; 
544   fV0Mul[0] = 0;   fV0Mul[1] = 0; 
545
546 }
547
548 //____________________________________________________________________________
549 void AliCaloTrackReader::SetInputEvent(AliVEvent* const input)  
550 {
551   fInputEvent  = input;
552   fMixedEvent = dynamic_cast<AliMixedEvent*>(GetInputEvent()) ; 
553   if (fMixedEvent) {
554     fNMixedEvent = fMixedEvent->GetNumberOfEvents() ; 
555   }
556
557   //Delete previous vertex
558   if(fVertex){
559     for (Int_t i = 0; i < fNMixedEvent; i++) {
560       delete [] fVertex[i] ; 
561     }
562     delete [] fVertex ;
563   }
564   
565   fVertex = new Double_t*[fNMixedEvent] ; 
566   for (Int_t i = 0; i < fNMixedEvent; i++) {
567     fVertex[i] = new Double_t[3] ; 
568     fVertex[i][0] = 0.0 ; 
569     fVertex[i][1] = 0.0 ; 
570     fVertex[i][2] = 0.0 ; 
571   }
572 }
573
574 //__________________________________________________
575 Int_t AliCaloTrackReader::GetEventCentrality() const {
576   //Return current event centrality
577   
578   if(GetCentrality()){
579     if(fCentralityOpt==100)     return (Int_t) GetCentrality()->GetCentralityPercentile(fCentralityClass); // 100 bins max
580     else if(fCentralityOpt==10) return GetCentrality()->GetCentralityClass10(fCentralityClass);// 10 bins max
581     else if(fCentralityOpt==20) return GetCentrality()->GetCentralityClass5(fCentralityClass); // 20 bins max
582     else {
583       printf("AliAnaPartCorrBaseClass::Unknown centrality option %d, use 10, 20 or 100\n",fCentralityOpt);
584       return 0;
585     } 
586   }
587   else return 0;
588   
589 }
590
591 //____________________________________________________________________________
592 void AliCaloTrackReader::GetVertex(Double_t vertex[3]) const {
593   //Return vertex position to be used for single event analysis
594   vertex[0]=fVertex[0][0];  
595   vertex[1]=fVertex[0][1];  
596   vertex[2]=fVertex[0][2];
597 }
598
599 //____________________________________________________________________________
600 void AliCaloTrackReader::GetVertex(Double_t vertex[3], const Int_t evtIndex) const {
601   //Return vertex position for mixed event, recover the vertex in a particular event.
602   
603   vertex[0]=fVertex[evtIndex][0];  vertex[1]=fVertex[evtIndex][1];  vertex[2]=fVertex[evtIndex][2];
604   
605 }
606
607 //____________________________________________________________________________
608 void AliCaloTrackReader::FillVertexArray() {
609   
610   //Fill data member with vertex
611   //In case of Mixed event, multiple vertices
612   
613   //Delete previous vertex
614   if(fVertex){
615     for (Int_t i = 0; i < fNMixedEvent; i++) {
616       delete [] fVertex[i] ; 
617     }
618     delete [] fVertex ;  
619   }
620   
621   fVertex = new Double_t*[fNMixedEvent] ; 
622   for (Int_t i = 0; i < fNMixedEvent; i++) {
623     fVertex[i] = new Double_t[3] ; 
624     fVertex[i][0] = 0.0 ; 
625     fVertex[i][1] = 0.0 ; 
626     fVertex[i][2] = 0.0 ; 
627   }          
628   
629   if (!fMixedEvent) { //Single event analysis
630     if(fDataType!=kMC){
631
632       if(fInputEvent->GetPrimaryVertex()){
633         fInputEvent->GetPrimaryVertex()->GetXYZ(fVertex[0]); 
634       }
635       else {
636         printf("AliCaloTrackReader::FillVertexArray() - NULL primary vertex\n");
637         fVertex[0][0]=0.;   fVertex[0][1]=0.;   fVertex[0][2]=0.;
638       }//Primary vertex pointer do not exist
639       
640     } else {//MC read event 
641       fVertex[0][0]=0.;   fVertex[0][1]=0.;   fVertex[0][2]=0.;
642     }
643       
644     if(fDebug > 1)
645       printf("AliCaloTrackReader::FillVertexArray() - Single Event Vertex : %f,%f,%f\n",fVertex[0][0],fVertex[0][1],fVertex[0][2]);
646
647   } else { // MultiEvent analysis
648     for (Int_t iev = 0; iev < fNMixedEvent; iev++) {
649       if (fMixedEvent->GetVertexOfEvent(iev))
650         fMixedEvent->GetVertexOfEvent(iev)->GetXYZ(fVertex[iev]);
651       else { // no vertex found !!!!
652         AliWarning("No vertex found");
653       }
654
655       if(fDebug > 1)
656         printf("AliCaloTrackReader::FillVertexArray() - Multi Event %d Vertex : %f,%f,%f\n",iev,fVertex[iev][0],fVertex[iev][1],fVertex[iev][2]);
657
658     }
659   }
660   
661 }
662
663 //____________________________________________________________________________
664 void AliCaloTrackReader::FillInputCTS() {
665   //Return array with Central Tracking System (CTS) tracks
666   
667   if(fDebug > 2 ) printf("AliCaloTrackReader::FillInputCTS()\n");
668   
669   Int_t nTracks   = fInputEvent->GetNumberOfTracks() ;
670   Double_t p[3];
671   fTrackMult = 0;
672   Int_t nstatus = 0;
673   for (Int_t itrack =  0; itrack <  nTracks; itrack++) {////////////// track loop
674     AliVTrack * track = (AliVTrack*)fInputEvent->GetTrack(itrack) ; // retrieve track from esd
675
676     //Select tracks under certain conditions, TPCrefit, ITSrefit ... check the set bits
677     if (fTrackStatus && !((track->GetStatus() & fTrackStatus) == fTrackStatus)) 
678       continue ;
679     
680     nstatus++;
681     
682     if     (fDataType==kESD && !fESDtrackCuts->AcceptTrack((AliESDtrack*)track))
683     {
684       continue;
685     }
686     else if(fDataType==kAOD)
687     {
688       AliAODTrack *aodtrack = dynamic_cast <AliAODTrack*>(track);
689       if(aodtrack){
690         if(fDebug > 2 ) 
691           printf("AliCaloTrackReader::FillInputCTS():AOD track type: %c \n", aodtrack->GetType());
692         if (fDataType!=kMC && aodtrack->TestFilterMask(fTrackFilterMask)==kFALSE) continue;
693         if(aodtrack->GetType()!=AliAODTrack::kPrimary) continue;
694       }
695     }
696     
697     //Count the tracks in eta < 0.9
698     //printf("Eta %f cut  %f\n",TMath::Abs(track->Eta()),fTrackMultEtaCut);
699     if(TMath::Abs(track->Eta())< fTrackMultEtaCut) fTrackMult++;
700     
701     track->GetPxPyPz(p) ;
702     TLorentzVector momentum(p[0],p[1],p[2],0);
703     
704     if(fCTSPtMin < momentum.Pt() && fCTSPtMax > momentum.Pt()){
705       
706       if(fCheckFidCut && !fFiducialCut->IsInFiducialCut(momentum,"CTS")) 
707         continue;
708       
709       if(fDebug > 2 && momentum.Pt() > 0.1) 
710         printf("AliCaloTrackReader::FillInputCTS() - Selected tracks E %3.2f, pt %3.2f, phi %3.2f, eta %3.2f\n",
711                momentum.E(),momentum.Pt(),momentum.Phi()*TMath::RadToDeg(),momentum.Eta());
712       
713       if (fMixedEvent) {
714         track->SetID(itrack);
715       }
716       
717       fCTSTracks->Add(track);        
718        
719     }//Pt and Fiducial cut passed. 
720   }// track loop
721         
722   //fCTSTracksNormalInputEntries = fCTSTracks->GetEntriesFast();
723   if(fDebug > 1) 
724     printf("AliCaloTrackReader::FillInputCTS()   - aod entries %d, input tracks %d, pass status %d, multipliticy %d\n", fCTSTracks->GetEntriesFast(), nTracks, nstatus, fTrackMult);//fCTSTracksNormalInputEntries);
725
726 }
727
728 //____________________________________________________________________________
729 void AliCaloTrackReader::FillInputEMCALAlgorithm(AliVCluster * clus, const Int_t iclus) {
730   //Fill the EMCAL data in the array, do it
731   
732   Int_t vindex = 0 ;  
733   if (fMixedEvent) 
734     vindex = fMixedEvent->EventIndexForCaloCluster(iclus);
735   
736   //Reject clusters with bad channels, close to borders and exotic;
737   if(!GetCaloUtils()->GetEMCALRecoUtils()->IsGoodCluster(clus,GetCaloUtils()->GetEMCALGeometry(),GetEMCALCells(),fInputEvent->GetBunchCrossNumber())) return;
738   
739   //Mask all cells in collumns facing ALICE thick material if requested
740   if(GetCaloUtils()->GetNMaskCellColumns()){
741     Int_t absId   = -1;
742     Int_t iSupMod = -1;
743     Int_t iphi    = -1;
744     Int_t ieta    = -1;
745     Bool_t shared = kFALSE;
746     GetCaloUtils()->GetEMCALRecoUtils()->GetMaxEnergyCell(GetCaloUtils()->GetEMCALGeometry(), GetEMCALCells(),clus,absId,iSupMod,ieta,iphi,shared);
747     if(GetCaloUtils()->MaskFrameCluster(iSupMod, ieta)) return;
748   }
749   
750   if(fSelectEmbeddedClusters){
751     if(clus->GetNLabels()==0 || clus->GetLabel() < 0) return;
752     //else printf("Embedded cluster,  %d, n label %d label %d  \n",iclus,clus->GetNLabels(),clus->GetLabel());
753   }
754
755   //Float_t pos[3];
756   //clus->GetPosition(pos);
757   //printf("Before Corrections: e %f, x %f, y %f, z %f\n",clus->E(),pos[0],pos[1],pos[2]);
758   
759   if(fRecalculateClusters){
760     //Recalibrate the cluster energy 
761     if(GetCaloUtils()->IsRecalibrationOn()) {
762       
763       Float_t energy = GetCaloUtils()->RecalibrateClusterEnergy(clus, GetEMCALCells());
764       
765       clus->SetE(energy);
766       //printf("Recalibrated Energy %f\n",clus->E());  
767       
768       GetCaloUtils()->RecalculateClusterShowerShapeParameters(GetEMCALCells(),clus);
769       GetCaloUtils()->RecalculateClusterPID(clus);
770       
771     } // recalculate E
772     
773     //Recalculate distance to bad channels, if new list of bad channels provided
774     GetCaloUtils()->RecalculateClusterDistanceToBadChannel(GetEMCALCells(),clus);
775     
776     //Recalculate cluster position
777     if(GetCaloUtils()->IsRecalculationOfClusterPositionOn()){
778       GetCaloUtils()->RecalculateClusterPosition(GetEMCALCells(),clus); 
779       //clus->GetPosition(pos);
780       //printf("After  Corrections: e %f, x %f, y %f, z %f\n",clus->E(),pos[0],pos[1],pos[2]);
781     }
782   }
783   
784   // Recalculate TOF
785   if(GetCaloUtils()->GetEMCALRecoUtils()->IsTimeRecalibrationOn()) {
786     
787     Double_t tof      = clus->GetTOF();
788     Float_t  frac     =-1;
789     Int_t    absIdMax = GetCaloUtils()->GetMaxEnergyCell(fEMCALCells, clus,frac);
790     
791     if(fDataType==AliCaloTrackReader::kESD){ 
792       tof = fEMCALCells->GetCellTime(absIdMax);
793     }
794     
795     GetCaloUtils()->GetEMCALRecoUtils()->RecalibrateCellTime(absIdMax,fInputEvent->GetBunchCrossNumber(),tof);
796     
797     clus->SetTOF(tof);
798     
799   }// Time recalibration    
800   
801   //Correct non linearity
802   if(GetCaloUtils()->IsCorrectionOfClusterEnergyOn()){
803     GetCaloUtils()->CorrectClusterEnergy(clus) ;
804     //printf("Linearity Corrected Energy %f\n",clus->E());  
805     
806     //In case of MC analysis, to match resolution/calibration in real data
807     Float_t rdmEnergy = GetCaloUtils()->GetEMCALRecoUtils()->SmearClusterEnergy(clus);
808     // printf("\t Energy %f, smeared %f\n", clus->E(),rdmEnergy);
809     clus->SetE(rdmEnergy);
810   }
811   
812   TLorentzVector momentum ;
813   
814   clus->GetMomentum(momentum, fVertex[vindex]);      
815   
816   if(fCheckFidCut && !fFiducialCut->IsInFiducialCut(momentum,"EMCAL")) return;
817   
818   if(fEMCALPtMin > momentum.E() || fEMCALPtMax < momentum.E())         return;
819   
820   if(fDebug > 2 && momentum.E() > 0.1) 
821     printf("AliCaloTrackReader::FillInputEMCAL() - Selected clusters E %3.2f, pt %3.2f, phi %3.2f, eta %3.2f\n",
822            momentum.E(),momentum.Pt(),momentum.Phi()*TMath::RadToDeg(),momentum.Eta());
823       
824   if (fMixedEvent) 
825     clus->SetID(iclus) ; 
826   
827   fEMCALClusters->Add(clus);    
828   
829 }
830
831 //____________________________________________________________________________
832 void AliCaloTrackReader::FillInputEMCAL() {
833   //Return array with EMCAL clusters in aod format
834   
835   if(fDebug > 2 ) printf("AliCaloTrackReader::FillInputEMCAL()\n");
836   
837   // First recalibrate cells, time or energy
838   //  if(GetCaloUtils()->IsRecalibrationOn())
839   //    GetCaloUtils()->GetEMCALRecoUtils()->RecalibrateCells(GetCaloUtils()->GetEMCALGeometry(), 
840   //                                                          GetEMCALCells(), 
841   //                                                          fInputEvent->GetBunchCrossNumber());
842   
843   //Loop to select clusters in fiducial cut and fill container with aodClusters
844   if(fEMCALClustersListName==""){
845     Int_t nclusters = fInputEvent->GetNumberOfCaloClusters();
846     for (Int_t iclus =  0; iclus <  nclusters; iclus++) {
847       AliVCluster * clus = 0;
848       if ( (clus = fInputEvent->GetCaloCluster(iclus)) ) {
849         if (IsEMCALCluster(clus)){          
850           FillInputEMCALAlgorithm(clus, iclus);
851         }//EMCAL cluster
852       }// cluster exists
853     }// cluster loop
854     
855     //Recalculate track matching
856     GetCaloUtils()->RecalculateClusterTrackMatching(fInputEvent);
857     
858   }//Get the clusters from the input event
859   else {
860     TClonesArray * clusterList = 0x0; 
861     if(fOutputEvent) clusterList = dynamic_cast<TClonesArray*> (fOutputEvent->FindListObject(fEMCALClustersListName));
862     if(!clusterList){
863       //printf("AliCaloTrackReader::FillInputEMCAL() - Wrong name of list with clusters? Try input event <%s>\n",fEMCALClustersListName.Data());
864       //List not in output event, try input event
865       clusterList = dynamic_cast<TClonesArray*> (fInputEvent->FindListObject(fEMCALClustersListName));
866       if(!clusterList){
867         printf("AliCaloTrackReader::FillInputEMCAL() - Wrong name of list with clusters?  <%s>\n",fEMCALClustersListName.Data());
868         return;
869       }
870     }
871     
872     Int_t nclusters = clusterList->GetEntriesFast();
873     for (Int_t iclus =  0; iclus <  nclusters; iclus++) {
874       AliVCluster * clus = dynamic_cast<AliVCluster*> (clusterList->At(iclus));
875       //printf("E %f\n",clus->E());
876       if (clus) FillInputEMCALAlgorithm(clus, iclus);
877       else printf("AliCaloTrackReader::FillInputEMCAL() - Null cluster in list!\n");
878       
879     }// cluster loop
880     
881     // Recalculate track matching, not necessary if already done in the reclusterization task.
882     // in case it was not done ...
883     GetCaloUtils()->RecalculateClusterTrackMatching(fInputEvent,clusterList);
884     
885   }
886     
887   if(fDebug > 1) printf("AliCaloTrackReader::FillInputEMCAL() - aod entries %d\n",  fEMCALClusters->GetEntriesFast());
888   
889 }
890
891 //____________________________________________________________________________
892 void AliCaloTrackReader::FillInputPHOS() {
893   //Return array with PHOS clusters in aod format
894   
895   if(fDebug > 2 ) printf("AliCaloTrackReader::FillInputPHOS()\n");
896   
897   //Loop to select clusters in fiducial cut and fill container with aodClusters
898   Int_t nclusters = fInputEvent->GetNumberOfCaloClusters();
899   for (Int_t iclus = 0; iclus < nclusters; iclus++) {
900     AliVCluster * clus = 0;
901     if ( (clus = fInputEvent->GetCaloCluster(iclus)) ) {
902       if (IsPHOSCluster(clus)){
903         //Check if the cluster contains any bad channel and if close to calorimeter borders
904         Int_t vindex = 0 ;  
905         if (fMixedEvent) 
906           vindex = fMixedEvent->EventIndexForCaloCluster(iclus);
907         if( GetCaloUtils()->ClusterContainsBadChannel("PHOS",clus->GetCellsAbsId(), clus->GetNCells())) 
908           continue;
909         if(!GetCaloUtils()->CheckCellFiducialRegion(clus, fInputEvent->GetPHOSCells(), fInputEvent, vindex)) 
910           continue;
911                 
912         if(fRecalculateClusters){
913           
914           //Recalibrate the cluster energy 
915           if(GetCaloUtils()->IsRecalibrationOn()) {
916             Float_t energy = GetCaloUtils()->RecalibrateClusterEnergy(clus, (AliAODCaloCells*)GetPHOSCells());
917             clus->SetE(energy);
918           }
919           
920         }
921         
922         TLorentzVector momentum ;
923         
924         clus->GetMomentum(momentum, fVertex[vindex]);      
925         
926         if(fCheckFidCut && !fFiducialCut->IsInFiducialCut(momentum,"PHOS")) continue;
927         
928         if(fPHOSPtMin > momentum.E() || fPHOSPtMax < momentum.E())          continue;
929         
930         if(fDebug > 2 && momentum.E() > 0.1) 
931           printf("AliCaloTrackReader::FillInputPHOS() - Selected clusters E %3.2f, pt %3.2f, phi %3.2f, eta %3.2f\n",
932                  momentum.E(),momentum.Pt(),momentum.Phi()*TMath::RadToDeg(),momentum.Eta());        
933         
934         
935         if (fMixedEvent) {
936           clus->SetID(iclus) ; 
937         }              
938         
939         fPHOSClusters->Add(clus);       
940         
941       }//PHOS cluster
942     }//cluster exists
943   }//esd cluster loop
944   
945   if(fDebug > 1) printf("AliCaloTrackReader::FillInputPHOS()  - aod entries %d\n",  fPHOSClusters->GetEntriesFast());
946   
947 }
948
949 //____________________________________________________________________________
950 void AliCaloTrackReader::FillInputEMCALCells() {
951   //Return array with EMCAL cells in aod format
952   
953   fEMCALCells = fInputEvent->GetEMCALCells(); 
954   
955 }
956
957 //____________________________________________________________________________
958 void AliCaloTrackReader::FillInputPHOSCells() {
959   //Return array with PHOS cells in aod format
960   
961   fPHOSCells = fInputEvent->GetPHOSCells(); 
962   
963 }
964
965 //____________________________________________________________________________
966 void AliCaloTrackReader::FillInputVZERO(){
967   //Fill VZERO information in data member, add all the channels information.
968   AliVVZERO* v0 = fInputEvent->GetVZEROData();
969   //printf("Init V0: ADC (%d,%d), Multiplicity (%d,%d) \n",fV0ADC[0],fV0ADC[1],fV0Mul[0],fV0Mul[1]);
970   
971   if (v0) 
972   {
973     AliESDVZERO* esdV0 = dynamic_cast<AliESDVZERO*> (v0);
974     for (Int_t i = 0; i < 32; i++)
975     {
976       if(esdV0){//Only available in ESDs
977         fV0ADC[0] += (Int_t)esdV0->GetAdcV0C(i);
978         fV0ADC[1] += (Int_t)esdV0->GetAdcV0A(i);
979       }
980       fV0Mul[0] += (Int_t)v0->GetMultiplicityV0C(i);
981       fV0Mul[1] += (Int_t)v0->GetMultiplicityV0A(i);
982     }
983     if(fDebug > 0)
984       printf("V0: ADC (%d,%d), Multiplicity (%d,%d) \n",fV0ADC[0],fV0ADC[1],fV0Mul[0],fV0Mul[1]);
985   }
986   else
987   {
988     if(fDebug > 0)
989       printf("Cannot retrieve V0 ESD! Run w/ null V0 charges\n ");
990   }
991 }
992
993
994 //____________________________________________________________________________
995 Bool_t AliCaloTrackReader::IsEMCALCluster(AliVCluster* cluster) const {
996   // Check if it is a cluster from EMCAL. For old AODs cluster type has
997   // different number and need to patch here
998     
999   if(fDataType==kAOD && fOldAOD)
1000   {
1001     if (cluster->GetType() == 2) return kTRUE;
1002     else                         return kFALSE;
1003   }
1004   else 
1005   {
1006     return cluster->IsEMCAL();
1007   }
1008
1009 }
1010
1011 //____________________________________________________________________________
1012 Bool_t AliCaloTrackReader::IsPHOSCluster(AliVCluster * cluster) const {
1013   //Check if it is a cluster from PHOS.For old AODs cluster type has
1014   // different number and need to patch here
1015   
1016   if(fDataType==kAOD && fOldAOD)
1017   {
1018     Int_t type = cluster->GetType();
1019     if (type == 0 || type == 1) return kTRUE;
1020     else                        return kFALSE;
1021   }
1022   else 
1023   {
1024     return cluster->IsPHOS();
1025   }
1026   
1027 }
1028
1029 //____________________________________________________________________________
1030 Bool_t AliCaloTrackReader::CheckForPrimaryVertex(){
1031   //Check if the vertex was well reconstructed, copy from V0Reader of conversion group
1032   //Only for ESDs ...
1033   
1034   AliESDEvent * event = dynamic_cast<AliESDEvent*> (fInputEvent);
1035   if(!event) return kTRUE;
1036   
1037   if(event->GetPrimaryVertexTracks()->GetNContributors() > 0) {
1038     return kTRUE;
1039   }
1040   
1041   if(event->GetPrimaryVertexTracks()->GetNContributors() < 1) {
1042     // SPD vertex
1043     if(event->GetPrimaryVertexSPD()->GetNContributors() > 0) {
1044       //cout<<"spd vertex type::"<< fESDEvent->GetPrimaryVertex()->GetName() << endl;
1045       return kTRUE;
1046       
1047     }
1048     if(event->GetPrimaryVertexSPD()->GetNContributors() < 1) {
1049       //      cout<<"bad vertex type::"<< event->GetPrimaryVertex()->GetName() << endl;
1050       return kFALSE;
1051     }
1052   }
1053   
1054   return kFALSE;  
1055   
1056 }
1057
1058
1059