#include "AliCaloTrackReader.h"
// ---- Jets ----
#include "AliAODJet.h"
+#include "AliAODJetEventBackground.h"
ClassImp(AliCaloTrackReader)
fFillEMCALCells(0), fFillPHOSCells(0),
fRecalculateClusters(kFALSE),fCorrectELinearity(kTRUE),
fSelectEmbeddedClusters(kFALSE),
-fTrackStatus(0), fTrackFilterMask(0),
+fTrackStatus(0), fTrackFilterMask(0), fTrackFilterMaskComplementary(0),
fESDtrackCuts(0), fESDtrackComplementaryCuts(0), fConstrainTrack(kFALSE),
-fSelectHybridTracks(0), fSelectSPDHitTracks(kFALSE),
+fSelectHybridTracks(0), fSelectPrimaryTracks(0),
+fSelectSPDHitTracks(0), fSelectFractionTPCSharedClusters(0), fCutTPCSharedClustersFraction(0),
fTrackMult(0), fTrackMultEtaCut(0.9),
fReadStack(kFALSE), fReadAODMCParticles(kFALSE),
fDeltaAODFileName(""), fFiredTriggerClassName(""),
fAcceptOnlyHIJINGLabels(0), fNMCProducedMin(0), fNMCProducedMax(0),
fFillInputNonStandardJetBranch(kFALSE),
fNonStandardJets(new TClonesArray("AliAODJet",100)),fInputNonStandardJetBranchName("jets"),
+fFillInputBackgroundJetBranch(kFALSE),
+fBackgroundJets(0x0),fInputBackgroundJetBranchName("jets"),
fAcceptEventsWithBit(0), fRejectEventsWithBit(0)
{
//Ctor
else fNonStandardJets->Delete() ;
delete fNonStandardJets ;
}
-
+ delete fBackgroundJets ;
+
fRejectEventsWithBit.Reset();
fAcceptEventsWithBit.Reset();
//fTrackStatus|=AliESDtrack::kITSrefit;
fTrackStatus = 0;
fTrackFilterMask = 128; //For AODs, but what is the difference between fTrackStatus and fTrackFilterMask?
+ fTrackFilterMaskComplementary = 0; // in case of hybrid tracks, without using the standard method
+
+ fSelectFractionTPCSharedClusters = kTRUE;
+ fCutTPCSharedClustersFraction = 0.4,
fESDtrackCuts = 0;
fESDtrackComplementaryCuts = 0;
fInputNonStandardJetBranchName = "jets";
fFillInputNonStandardJetBranch = kFALSE;
if(!fNonStandardJets) fNonStandardJets = new TClonesArray("AliAODJet",100);
-
+ fInputBackgroundJetBranchName = "jets";
+ fFillInputBackgroundJetBranch = kFALSE;
+ if(!fBackgroundJets) fBackgroundJets = new AliAODJetEventBackground();
+
}
//___________________________________________________________________
//----------------------------------------------------------------------
- // Do not count events that where likely triggered by an exotic cluster
+ // Do not count events that were likely triggered by an exotic cluster
// or out BC cluster
//----------------------------------------------------------------------
- // Set a bit with the event kind, MB, L0, L1 ...
- SetEventTriggerBit();
+ // Set a bit with the event kind, MB, L0, L1 ...
+ SetEventTriggerBit();
- //Get Patches that triggered
- TArrayI patches = GetTriggerPatches(fTriggerPatchTimeWindow[0],fTriggerPatchTimeWindow[1]);
-
- MatchTriggerCluster(patches);
-
- // If requested, remove badly triggeed events, but only when the EMCal trigger bit is set
- if(fRemoveBadTriggerEvents && (IsEventEMCALL1() || IsEventEMCALL0()))
+ if( IsEventEMCALL1() || IsEventEMCALL0() )
{
- if(fDebug > 0) printf("AliCaloTrackReader::FillInputEvent() - ACCEPT triggered event? \n exotic? %d - bad cell %d - bad Max cell %d - BC %d - Matched %d\n",
- fIsExoticEvent,fIsBadCellEvent, fIsBadMaxCellEvent, fTriggerClusterBC,fIsTriggerMatch);
- if (fIsExoticEvent) return kFALSE;
- else if(fIsBadCellEvent) return kFALSE;
- else if(fRemoveUnMatchedTriggers && !fIsTriggerMatch) return kFALSE ;
- else if(fTriggerClusterBC != 0) return kFALSE;
- //printf("\t *** YES\n");
- }
-
- patches.Reset();
-
- if(fDebug > 0) printf("AliCaloTrackReader::FillInputEvent()-Pass EMCal triggered event rejection \n");
+ //Get Patches that triggered
+ TArrayI patches = GetTriggerPatches(fTriggerPatchTimeWindow[0],fTriggerPatchTimeWindow[1]);
+
+ MatchTriggerCluster(patches);
+
+ patches.Reset();
+ // If requested, remove badly triggeed events, but only when the EMCal trigger bit is set
+ if(fRemoveBadTriggerEvents)
+ {
+ if(fDebug > 0)
+ printf("AliCaloTrackReader::FillInputEvent() - ACCEPT triggered event? \n exotic? %d - bad cell %d - bad Max cell %d - BC %d - Matched %d\n",
+ fIsExoticEvent,fIsBadCellEvent, fIsBadMaxCellEvent, fTriggerClusterBC,fIsTriggerMatch);
+ if (fIsExoticEvent) return kFALSE;
+ else if(fIsBadCellEvent) return kFALSE;
+ else if(fRemoveUnMatchedTriggers && !fIsTriggerMatch) return kFALSE ;
+ else if(fTriggerClusterBC != 0) return kFALSE;
+ if(fDebug > 0) printf("\t *** YES\n");
+ }
+
+ if(fDebug > 0)
+ printf("AliCaloTrackReader::FillInputEvent()-Pass EMCal triggered event rejection \n");
+ }
+ else if(!IsEventEMCALL1Jet() && !IsEventMinimumBias() && !IsEventCentral() && !IsEventSemiCentral())
+ {
+ // In case there was a EG1&&EG2, it is selected as EG1, reject when requesting EG2
+ return kFALSE;
+ }
// Get the main vertex BC, in case not available
// it is calculated in FillCTS checking the BC of tracks
//one specified jet branch
if(fFillInputNonStandardJetBranch)
FillInputNonStandardJets();
+ if(fFillInputBackgroundJetBranch)
+ FillInputBackgroundJets();
+
return kTRUE ;
}
aodtrack->GetType(),AliAODTrack::kPrimary,
aodtrack->IsHybridGlobalConstrainedGlobal());
-
- if (fSelectHybridTracks)
+ if (fSelectHybridTracks && fTrackFilterMaskComplementary == 0)
{
if (!aodtrack->IsHybridGlobalConstrainedGlobal()) continue ;
}
else
{
- if ( aodtrack->TestFilterBit(fTrackFilterMask)==kFALSE) continue ;
+ Bool_t accept = aodtrack->TestFilterBit(fTrackFilterMask);
+
+ if(!fSelectHybridTracks && !accept) continue ;
+
+ if(fSelectHybridTracks)
+ {
+ Bool_t acceptcomplement = aodtrack->TestFilterBit(fTrackFilterMaskComplementary);
+ if (!accept && !acceptcomplement) continue ;
+ }
}
if(fSelectSPDHitTracks)
if(!aodtrack->HasPointOnITSLayer(0) && !aodtrack->HasPointOnITSLayer(1)) continue ;
}
- if (aodtrack->GetType()!= AliAODTrack::kPrimary) continue ;
+ if ( fSelectFractionTPCSharedClusters )
+ {
+ Double_t frac = Double_t(aodtrack->GetTPCnclsS()) / Double_t(aodtrack->GetTPCncls());
+ if (frac > fCutTPCSharedClustersFraction)
+ {
+ if (fDebug > 2 )printf("\t Reject track, shared cluster fraction %f > %f\n",frac, fCutTPCSharedClustersFraction);
+ continue ;
+ }
+ }
- if (fDebug > 2 ) printf("AliCaloTrackReader::FillInputCTS(): \t accepted track! \n");
+ if ( fSelectPrimaryTracks )
+ {
+ if ( aodtrack->GetType()!= AliAODTrack::kPrimary )
+ {
+ if (fDebug > 2 ) printf("\t Remove not primary track\n");
+ continue ;
+ }
+ }
+
+ if (fDebug > 2 ) printf("\t accepted track! \n");
//In case of AODs, TPC tracks cannot be propagated back to primary vertex,
// info stored here
//else printf("Accept track time %f and bc = %d\n",tof,trackBC);
}
-
+
//Count the tracks in eta < 0.9
//printf("Eta %f cut %f\n",TMath::Abs(track->Eta()),fTrackMultEtaCut);
if(TMath::Abs(track->Eta())< fTrackMultEtaCut) fTrackMult++;
if(fCheckFidCut && !fFiducialCut->IsInFiducialCut(momentum,"CTS")) continue;
if(fDebug > 2 && momentum.Pt() > 0.1)
- printf("AliCaloTrackReader::FillInputCTS() - Selected tracks E %3.2f, pt %3.2f, phi %3.2f, eta %3.2f\n",
- momentum.E(),momentum.Pt(),momentum.Phi()*TMath::RadToDeg(),momentum.Eta());
+ printf("AliCaloTrackReader::FillInputCTS() - Selected tracks pt %3.2f, phi %3.2f, eta %3.2f\n",
+ momentum.Pt(),momentum.Phi()*TMath::RadToDeg(),momentum.Eta());
if (fMixedEvent) track->SetID(itrack);
}
+//_________________________________________________
+void AliCaloTrackReader::FillInputBackgroundJets()
+{
+ //
+ //fill array with Background jets
+ //
+ // Adam T. Matyja
+
+ if(fDebug > 2 ) printf("AliCaloTrackReader::FillInputBackgroundJets()\n");
+ //
+ //check if branch name is given
+ if(!fInputBackgroundJetBranchName.Length())
+ {
+ Printf("No background jet branch name specified. Specify among existing ones.");
+ fInputEvent->Print();
+ abort();
+ }
+
+ fBackgroundJets = (AliAODJetEventBackground*)(fInputEvent->FindListObject(fInputBackgroundJetBranchName.Data()));
+
+ if(!fBackgroundJets)
+ {
+ //check if jet branch exist; exit if not
+ Printf("%s:%d no reconstructed jet array with name %s in AOD", (char*)__FILE__,__LINE__,fInputBackgroundJetBranchName.Data());
+ fInputEvent->Print();
+ abort();
+ }
+ else
+ {
+ if(fDebug > 1){
+ printf("AliCaloTrackReader::FillInputBackgroundJets()\n");
+ fBackgroundJets->Print("");
+ }
+ }
+
+}
+
+
//________________________________________________
Bool_t AliCaloTrackReader::CheckForPrimaryVertex()
{
// get object pointer
AliVCaloTrigger *caloTrigger = GetInputEvent()->GetCaloTrigger( "EMCAL" );
+ //printf("CaloTrigger Entries %d\n",caloTrigger->GetEntries() );
// class is not empty
if( caloTrigger->GetEntries() > 0 )
{
// get timing array
caloTrigger->GetL0Times( trigtimes );
- //printf("trigger time window %d - %d\n",fTriggerPatchTimeWindow[0],fTriggerPatchTimeWindow[1]);
+ //printf("Get L0 patch : n times %d - trigger time window %d - %d\n",ntimes, tmin,tmax);
// go through the array
for( i = 0; i < ntimes; i++ )
{
//printf("Accepted trigger time %d \n",trigtimes[i]);
//if(nTrig > 99) continue;
GetCaloUtils()->GetEMCALGeometry()->GetAbsFastORIndexFromPositionInEMCAL(globCol,globRow, absId);
- //printf("pass the time cut globCol %d, globRow %d absId %d\n",globCol,globRow, absIDTrig[nTrig]);
+ //printf("pass the time cut globCol %d, globRow %d absId %d\n",globCol,globRow, absId);
patches.Set(nPatch+1);
patches.AddAt(absId,nPatch++);
}
if(!isEGA && !isEJE) continue;
+ //printf("**** Get L1 Patch: EGA %d, EJE %d\n",isEGA,isEJE);
+
Int_t patchsize = -1;
if (isEGA) patchsize = 2;
else if (isEJE) patchsize = 16;
for(Int_t icol=0; icol < patchsize; icol++)
{
GetCaloUtils()->GetEMCALGeometry()->GetAbsFastORIndexFromPositionInEMCAL(globCol+icol,globRow+irow, absId);
- //printf("pass the time cut globCol %d, globRow %d absId %d\n",globCol,globRow, absIDTrig[nTrig]);
+ //printf("pass the time cut globCol %d, globRow %d absId %d\n",globCol,globRow, absId);
patches.Set(nPatch+1);
patches.AddAt(absId,nPatch++);
}
return;
}
+ //printf("***** Try to match trigger to cluster %d **** L0 %d, L1 %d\n",fTriggerPatchClusterMatch,IsEventEMCALL0(),IsEventEMCALL1());
+
//Recover the list of clusters
TClonesArray * clusterList = 0;
if (fInputEvent->FindListObject(fEMCALClustersListName))
Bool_t badClMax = kFALSE;
Bool_t badCeMax = kFALSE;
Bool_t exoMax = kFALSE;
- Int_t absIdMaxTrig= -1;
+// Int_t absIdMaxTrig= -1;
Int_t absIdMaxMax = -1;
Int_t nOfHighECl = 0 ;
Float_t minE = fTriggerEventThreshold / 2.;
// This method is not really suitable for JET trigger
// but in case, reduce the energy cut since we do not trigger on high energy particle
- if(IsEventEMCALL1()) minE = 1;
-
+ if(IsEventEMCALL1Jet() || minE < 1) minE = 1;
+
+ //printf("Min trigger Energy threshold %f\n",minE);
+
// Loop on the clusters, check if there is any that falls into one of the patches
for (Int_t iclus = 0; iclus < nclusters; iclus++)
{
Bool_t badCluster = GetCaloUtils()->GetEMCALRecoUtils()->ClusterContainsBadChannel(GetCaloUtils()->GetEMCALGeometry(),
clus->GetCellsAbsId(),clus->GetNCells());
- UShort_t cellMax[] = {absIdMax};
+ UShort_t cellMax[] = {(UShort_t) absIdMax};
Bool_t badCell = GetCaloUtils()->GetEMCALRecoUtils()->ClusterContainsBadChannel(GetCaloUtils()->GetEMCALGeometry(),cellMax,1);
// if cell is bad, it can happen that time calibration is not available,
fTriggerClusterIndex = iclus;
fTriggerClusterId = idclus;
fIsTriggerMatch = kTRUE;
- absIdMaxTrig = absIdMax;
+// absIdMaxTrig = absIdMax;
}
}
}// cell patch loop
patchOpen.Reset();
}// No trigger match found
+ //printf("Trigger BC %d, Id %d, Index %d\n",fTriggerClusterBC,fTriggerClusterId,fTriggerClusterIndex);
}
printf("Use EMCAL Cells = %d\n", fFillEMCALCells) ;
printf("Use PHOS Cells = %d\n", fFillPHOSCells) ;
printf("Track status = %d\n", (Int_t) fTrackStatus) ;
- printf("AODs Track filter mask = %d or hybrid %d, SPD hit %d\n", (Int_t) fTrackFilterMask,fSelectHybridTracks,fSelectSPDHitTracks) ;
+ printf("AODs Track filter mask = %d or hybrid %d (if filter bit comp %d), select : SPD hit %d, primary %d\n",
+ (Int_t) fTrackFilterMask, fSelectHybridTracks, (Int_t) fTrackFilterMaskComplementary, fSelectSPDHitTracks,fSelectPrimaryTracks) ;
printf("Track Mult Eta Cut = %d\n", (Int_t) fTrackMultEtaCut) ;
printf("Write delta AOD = %d\n", fWriteOutputDeltaAOD) ;
printf("Recalculate Clusters = %d, E linearity = %d\n", fRecalculateClusters, fCorrectELinearity) ;
fV0Mul[0] = 0; fV0Mul[1] = 0;
if(fNonStandardJets) fNonStandardJets -> Clear("C");
-
+ fBackgroundJets->Reset();
+
}
//___________________________________________
fEventTrigEMCALL1Jet1 = kFALSE;
fEventTrigEMCALL1Jet2 = kFALSE;
- if(fDebug > 0) printf("AliCaloTrackReader::SetEventTriggerBit() - Select trigger mask bit %d - Trigger Event %s\n",fEventTriggerMask,GetFiredTriggerClasses().Data());
+ if(fDebug > 0)
+ printf("AliCaloTrackReader::SetEventTriggerBit() - Select trigger mask bit %d - Trigger Event %s\n",fEventTriggerMask,GetFiredTriggerClasses().Data());
if(fEventTriggerMask <=0 )// in case no mask set
{
// EMC L1 Gamma
if ( fEventTriggerMask & AliVEvent::kEMCEGA )
{
+ //printf("EGA trigger bit\n");
if (GetFiredTriggerClasses().Contains("EG1" ) ||
GetFiredTriggerClasses().Contains("EGA" ) )
{
fEventTrigEMCALL1Gamma1 = kTRUE;
- if( GetFiredTriggerClasses().Contains("EG1" ) && !fFiredTriggerClassName.Contains("EG1") ) fEventTrigEMCALL1Gamma1 = kFALSE;
+ if( GetFiredTriggerClasses().Contains("EG1" ) && !fFiredTriggerClassName.Contains("EG1") ) fEventTrigEMCALL1Gamma1 = kFALSE;
}
else if(GetFiredTriggerClasses().Contains("EG2" ))
{
// EMC L1 Jet
else if( fEventTriggerMask & AliVEvent::kEMCEJE )
{
+ //printf("EJE trigger bit\n");
if (GetFiredTriggerClasses().Contains("EJ1" )||
GetFiredTriggerClasses().Contains("EJE" ) )
{
else if((fEventTriggerMask & AliVEvent::kEMC7) ||
(fEventTriggerMask & AliVEvent::kEMC1) )
{
+ //printf("L0 trigger bit\n");
fEventTrigEMCALL0 = kTRUE;
}
// Min Bias Pb-Pb
else if( fEventTriggerMask & AliVEvent::kCentral )
{
+ //printf("MB semi central trigger bit\n");
fEventTrigSemiCentral = kTRUE;
}
// Min Bias Pb-Pb
else if( fEventTriggerMask & AliVEvent::kSemiCentral )
{
+ //printf("MB central trigger bit\n");
fEventTrigCentral = kTRUE;
}
// Min Bias pp, PbPb, pPb
(fEventTriggerMask & AliVEvent::kINT8) ||
(fEventTriggerMask & AliVEvent::kAnyINT) )
{
+ //printf("MB trigger bit\n");
fEventTrigMinBias = kTRUE;
}
}
fBitEGA = 6;
fBitEJE = 8;
}
- } else printf("AliCaloTrackReader()::Init() - Streamer info for trigger class not available, bit not changed\n");
- } else printf("AliCaloTrackReader::Init() - Streamer list not available!, bit not changed\n");
+ } else printf("AliCaloTrackReader()::SetEventTriggerBit() - Streamer info for trigger class not available, bit not changed\n");
+ } else printf("AliCaloTrackReader::SetEventTriggerBit() - Streamer list not available!, bit not changed\n");
} // set once the EJE, EGA trigger bit