// in an AliEvent.
// In this way the AliVertex just represents a 'logical structure' for the
// physics analysis which can be embedded in e.g. an AliEvent or AliVertex.
+//
+// Note :
// Modifications made to the original vertices also affect the AliVertex objects
-// which are stored.
+// which are stored.
+//
// b) SetVertexCopy(1).
// Of every 'added' vertex a private copy will be made of which the pointer
// will be stored.
// stored.
// This mode will allow 'adding' many different AliVertex objects by
// creating only one AliVertex instance in the main programme and using the
-// AliVertex::Reset() and AliVertex::AddTrack and parameter setting memberfunctions.
+// AliVertex::Reset, AliVertex::AddTrack and parameter setting memberfunctions.
//
// Coding example to make 3 vertices v1, v2 and v3.
// ------------------------------------------------
///////////////////////////////////////////////////////////////////////////
void AliVertex::Reset()
{
-// Reset all variables to 0
+// Reset all variables to 0 and reset all stored vertex and jet lists.
// The max. number of tracks is set to the initial value again
// The max. number of vertices is set to the default value again
+// The max. number of jets is set to the default value again
AliJet::Reset();
if (fNjmax>0) SetNjmax(fNjmax);
}
///////////////////////////////////////////////////////////////////////////
+void AliVertex::ResetVertices()
+{
+// Reset the stored vertex list and delete all connecting tracks which
+// were generated automatically via connect=1 in AddVertex().
+// The max. number of vertices is set to the default value again.
+// All physics quantities are updated according to the removal of the
+// connecting tracks.
+ AliTrack* t;
+ if (fConnects)
+ {
+ for (Int_t i=0; i<=fConnects->GetLast(); i++)
+ {
+ t=(AliTrack*)fConnects->At(i);
+ AliTrack* test=(AliTrack*)fTracks->Remove(t);
+ if (test)
+ {
+ fNtrk--;
+ (Ali4Vector&)(*this)-=(Ali4Vector&)(*t);
+ fQ-=t->GetCharge();
+ }
+ }
+ fTracks->Compress();
+ }
+
+ fNvtx=0;
+ if (fNvmax>0) SetNvmax(fNvmax);
+ if (fConnects)
+ {
+ fConnects->Delete();
+ delete fConnects;
+ fConnects=0;
+ }
+}
+///////////////////////////////////////////////////////////////////////////
void AliVertex::AddJet(AliJet& j,Int_t tracks)
{
// Add a jet (and its tracks) to the vertex
fNjets++;
if (fJetCopy)
{
- AliJet* jx=new AliJet(j);
- fJets->Add(jx);
+ fJets->Add(j.Clone());
}
else
{
fNvtx++;
if (fVertexCopy)
{
- AliVertex* vx=new AliVertex(v);
- fVertices->Add(vx);
+ fVertices->Add(v.Clone());
}
else
{
Double_t v2=v.GetInvariant();
Double_t dv2=v.Ali4Vector::GetResultError();
- AliTrack* t=new AliTrack;
+ AliTrack* t=new AliTrack();
t->SetBeginPoint(r1);
t->SetEndPoint(r2);
t->SetCharge(q);
void AliVertex::Info(TString f)
{
// Provide vertex information within the coordinate frame f
- cout << " *AliVertex::Info* Invmass : " << GetInvmass()
+ cout << " *AliVertex::Info* Id : " << fUserId << " Invmass : " << GetInvmass()
<< " Charge : " << GetCharge() << " Momentum : " << GetMomentum()
<< " Ntracks : " << GetNtracks() << " Nvertices : " << fNvtx
<< " Njets : " << fNjets << endl;
}
}
///////////////////////////////////////////////////////////////////////////
+AliVertex* AliVertex::GetIdVertex(Int_t id)
+{
+// Return the (sec.) vertex with user identifier "id"
+ AliVertex* vx=0;
+ AliVertex* v=0;
+ if (!fVertices)
+ {
+ cout << " *AliVertex*::GetIdVertex* No (secondary) vertices present." << endl;
+ return 0;
+ }
+ else
+ {
+ for (Int_t i=0; i<fNvtx; i++)
+ {
+ vx=(AliVertex*)fVertices->At(i);
+ if (id == vx->GetId()) v=vx;
+ }
+ return v;
+ }
+}
+///////////////////////////////////////////////////////////////////////////
void AliVertex::SetVertexCopy(Int_t j)
{
// (De)activate the creation of private copies of the added vertices.
}
}
///////////////////////////////////////////////////////////////////////////
+AliJet* AliVertex::GetIdJet(Int_t id)
+{
+// Return the jet with user identifier "id"
+ AliJet* jx=0;
+ AliJet* j=0;
+ if (!fJets)
+ {
+ cout << " *AliVertex*::GetIdJet* No jets present." << endl;
+ return 0;
+ }
+ else
+ {
+ for (Int_t i=0; i<fNjets; i++)
+ {
+ jx=(AliJet*)fJets->At(i);
+ if (id == jx->GetId()) j=jx;
+ }
+ return j;
+ }
+}
+///////////////////////////////////////////////////////////////////////////
void AliVertex::SetJetCopy(Int_t j)
{
// (De)activate the creation of private copies of the added jets.