1 #include "AliAnalysisMuMuEventCutter.h"
5 * \ingroup pwg-muon-mumu
7 * \class AliAnalysisMuMuEventCutter
9 * We're grouping here various event cut methods that can be used
10 * as AliAnalysisMuMuCutElement. For instance :
12 * - \ref IsPhysicsSelected this is the normal physics selection check
13 * - \ref IsPhysicsSelectedVDM version of the physics selection used for VdM analysis
14 * - \ref IsSPDzVertexInRange selects event with a SPDvertex in a given range
15 * - \ref IsAbsZBelowValue selects event with |Zvertex| (being SPD or not) below a given value
16 * - \ref IsAbsZBelowValue as above but requesting explicitely the SPD vertex
17 * - \ref IsSPDzQA whether the SPD vertex is a good one
20 #include "TObjString.h"
22 #include "AliMuonEventCuts.h"
24 #include "Riostream.h"
25 #include "AliVVertex.h"
26 #include "AliAODVertex.h"
27 #include "AliVVZERO.h"
28 #include "AliInputEventHandler.h"
29 #include "AliVEvent.h"
31 #include "AliESDTZERO.h"
32 #include "AliAODTZERO.h"
33 #include "AliESDEvent.h"
34 #include "AliAODEvent.h"
36 ClassImp(AliAnalysisMuMuEventCutter)
38 //______________________________________________________________________________
39 AliAnalysisMuMuEventCutter::AliAnalysisMuMuEventCutter(TList* triggerClasses)
40 : TObject(), fMuonEventCuts(0x0)
45 if ( !triggerClasses )
52 TIter next(triggerClasses);
54 while ( ( tname = static_cast<TObjString*>(next()) ) )
56 if (tclasses.Length()>0)
61 tclasses += tname->String();
65 MuonEventCuts()->SetTrigClassPatterns(tclasses);
68 //______________________________________________________________________________
69 AliAnalysisMuMuEventCutter::~AliAnalysisMuMuEventCutter()
72 delete fMuonEventCuts;
75 //_____________________________________________________________________________
76 Bool_t AliAnalysisMuMuEventCutter::SelectTriggerClass(const TString& firedTriggerClasses,
77 TString& acceptedClasses,
78 UInt_t L0, UInt_t L1, UInt_t L2) const
80 /// Forward the trigger class selection to MuonEventCuts::GetSelectedTrigClassesInEvent
83 TIter next(MuonEventCuts()->GetSelectedTrigClassesInEvent(firedTriggerClasses,L0,L1,L2));
86 while ( ( str = static_cast<TObjString*>(next()) ) )
88 acceptedClasses += str->String();
89 acceptedClasses += " ";
91 return (acceptedClasses.Length()>0);
94 //_____________________________________________________________________________
95 Bool_t AliAnalysisMuMuEventCutter::IsPhysicsSelected(const AliInputEventHandler& eventHandler) const
97 /// Whether or not the event is physics selected
98 return const_cast<AliInputEventHandler&>(eventHandler).IsEventSelected() & AliVEvent::kAny;
101 //_____________________________________________________________________________
102 Bool_t AliAnalysisMuMuEventCutter::IsPhysicsSelectedVDM(const AliVEvent& event) const
104 // cut used in vdM scans
106 AliVVZERO* vzero = event.GetVZEROData();
110 Float_t v0a = vzero->GetV0ATime();
111 Float_t v0c = vzero->GetV0CTime();
113 Float_t v0diff = v0a-v0c;
114 Float_t v0sum = v0a+v0c;
116 if ( ( v0sum > 10.5 && v0sum < 18 ) && ( v0diff > 4 && v0diff < 12 ) )
124 //_____________________________________________________________________________
125 Bool_t AliAnalysisMuMuEventCutter::IsAbsZBelowValue(const AliVEvent& event, const Double_t& z) const
127 // Checks if the absolute value of the Z component of the primary vertex is below a certain value
129 const AliVVertex* vertex = event.GetPrimaryVertex();
130 return (TMath::Abs(vertex->GetZ())<=z);
133 //_____________________________________________________________________________
134 Bool_t AliAnalysisMuMuEventCutter::IsAbsZSPDBelowValue(const AliVEvent& event, const Double_t& z) const
136 // Checks if the absolute value of the SPD Z component of the given vertex is below a certain value
137 AliAODVertex* SPDVertex = static_cast<const AliAODEvent*>(&event)->GetPrimaryVertexSPD();
141 AliError("SPD |z| cut requested and no SPD vertex found in the event");
145 else return (TMath::Abs(SPDVertex->GetZ())<=z);
149 //_____________________________________________________________________________
150 Bool_t AliAnalysisMuMuEventCutter::IsSPDzVertexInRange(AliVEvent& event, const Double_t& zMin, const Double_t& zMax) const
152 /// Whether or not the SPD Z vertex is in the range [zMin,zMax[
154 AliAODVertex* SPDVertex = static_cast<AliAODEvent*>(&event)->GetPrimaryVertexSPD();
158 AliError("Cut on SPD z Vertex requested for an event with no SPD vertex info");
161 Double_t zV = SPDVertex->GetZ();
163 if ( zV >= zMin && zV < zMax ) return kTRUE;
168 //_____________________________________________________________________________
169 Bool_t AliAnalysisMuMuEventCutter::HasSPDVertex(AliVEvent& event) const
171 /// Does the event have a SPD vertex ?
172 AliAODVertex* SPDVertex = static_cast<AliAODEvent*>(&event)->GetPrimaryVertexSPD();
173 if ( SPDVertex && SPDVertex->GetNContributors() > 0) return kTRUE;
178 //_____________________________________________________________________________
179 Bool_t AliAnalysisMuMuEventCutter::IsSPDzQA(const AliVEvent& event, /*const AliVVertex& vertex2Test,*/ const Double_t& zResCut, const Double_t& zDifCut) const
181 // Checks if the value of the Z component of the given vertex fullfills the quality assurance condition
183 const AliVVertex* vertex = event.GetPrimaryVertex();
184 const AliAODVertex* vertex2Test = static_cast<const AliAODEvent*>(&event)->GetPrimaryVertexSPD();
187 vertex2Test->GetCovarianceMatrix(cov);
188 Double_t zRes = TMath::Sqrt(cov[5]);
190 if ( (zRes < zResCut) && TMath::Abs(vertex2Test->GetZ() - vertex->GetZ()) <= zDifCut )
198 //_____________________________________________________________________________
199 Bool_t AliAnalysisMuMuEventCutter::IsMeandNchdEtaInRange(AliVEvent& event, const Double_t& dNchdEtaMin, const Double_t& dNchdEtaMax) const
201 TList* nchList = static_cast<TList*>(event.FindListObject("NCH"));
203 if (!nchList || nchList->IsEmpty())
205 AliFatal("No NCH information found in event. Nch analysis MUST be executed to apply a NCH cut");
211 while ( nchList->At(i)->IsA() != TObjString::Class() ) //Asign a name to find it by name
216 TObjString* value = static_cast<TObjString*>(nchList->At(i));
217 Double_t meandNchdEta = value->String().Atof();
219 if ( meandNchdEta >= dNchdEtaMin && meandNchdEta < dNchdEtaMax ) return kTRUE;
224 //_____________________________________________________________________________
226 AliAnalysisMuMuEventCutter::MuonEventCuts() const
228 /// Return the single instance of AliMuonEventCuts object we're using
232 fMuonEventCuts = new AliMuonEventCuts("EventCut","");
234 return fMuonEventCuts;
238 //_____________________________________________________________________________
239 void AliAnalysisMuMuEventCutter::NameOfIsSPDzVertexInRange(TString& name, const Double_t& zMin, const Double_t& zMax) const
241 name.Form("SPDZBTW%3.2f_%3.2f",zMin,zMax);
243 //_____________________________________________________________________________
244 void AliAnalysisMuMuEventCutter::NameOfIsAbsZBelowValue(TString& name, const Double_t& z) const
246 name.Form("ABSZLT%3.2f",z);
249 //_____________________________________________________________________________
250 void AliAnalysisMuMuEventCutter::NameOfIsAbsZSPDBelowValue(TString& name, const Double_t& z) const
252 name.Form("SPDABSZLT%3.2f",z);
256 //_____________________________________________________________________________
257 void AliAnalysisMuMuEventCutter::NameOfIsSPDzQA(TString& name, const Double_t& zResCut, const Double_t& zDifCut) const
259 name.Form("SPDZQA_RES%3.2f_ZDIF%3.2f",zResCut,zDifCut);
262 //_____________________________________________________________________________
263 void AliAnalysisMuMuEventCutter::NameOfIsMeandNchdEtaInRange(TString& name, const Double_t& dNchdEtaMin, const Double_t& dNchdEtaMax) const
265 name.Form("MEANDNDETABTW%3.2f_%3.2f",dNchdEtaMin,dNchdEtaMax);
269 //_____________________________________________________________________________
270 Bool_t AliAnalysisMuMuEventCutter::IsTZEROPileUp(const AliVEvent& event) const
272 Bool_t pileupFlag(kFALSE);
274 if ( event.IsA() == AliESDEvent::Class() )
276 const AliESDTZERO* tzero = static_cast<AliESDEvent&>(const_cast<AliVEvent&>(event)).GetESDTZERO();
279 pileupFlag = tzero->GetPileupFlag();
282 else if ( event.IsA() == AliAODEvent::Class() )
284 AliAODTZERO* tzero = static_cast<const AliAODEvent&>(event).GetTZEROData();
287 pileupFlag = tzero->GetPileupFlag();