]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
03-jul-2001 NvE Protections added in AliJet::GetTrack() and AliVertex::GetVertex...
authornick <nick@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 3 Jul 2001 14:16:20 +0000 (14:16 +0000)
committernick <nick@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 3 Jul 2001 14:16:20 +0000 (14:16 +0000)
                VertexCopy introduced in AliVertex.
                Naming facility introduced in AliCalorimeter in order to identify
                different calorimeter systems in an event structure.
                Storage of jets introduced in AliVertex on the same footing as the
                storage of (secondary) vertices.

RALICE/AliCalorimeter.cxx
RALICE/AliCalorimeter.h
RALICE/AliJet.cxx
RALICE/AliVertex.cxx
RALICE/AliVertex.h
RALICE/history.txt

index 42d179be0f78a90d357a995a0d920e01e01cf295..bc7218ae0fa55a1f047ff2781f2cdf41a376f5c1 100644 (file)
@@ -72,6 +72,7 @@ AliCalorimeter::AliCalorimeter()
  fAttributes=0;
  fGains=0;
  fPositions=0;
+ fName=" ";
 }
 ///////////////////////////////////////////////////////////////////////////
 AliCalorimeter::~AliCalorimeter()
@@ -183,6 +184,8 @@ AliCalorimeter::AliCalorimeter(Int_t nrow,Int_t ncol)
 
  fNvetos=0;
  fVetos=0;
+
+ fName=" ";
 }
 ///////////////////////////////////////////////////////////////////////////
 Int_t AliCalorimeter::GetNrows()
@@ -1094,3 +1097,13 @@ AliSignal* AliCalorimeter::GetVetoSignal(Int_t i)
  }
 }
 ///////////////////////////////////////////////////////////////////////////
+void AliCalorimeter::SetName(TString name)
+{
+ fName=name;
+}
+///////////////////////////////////////////////////////////////////////////
+TString AliCalorimeter::GetName()
+{
+ return fName;
+}
+///////////////////////////////////////////////////////////////////////////
index a494899295f9571b2c1e6ded8ecb990bb4a6393b..838e143aae4542e56b50cf0a7abb157c7165df23 100644 (file)
@@ -56,6 +56,8 @@ class AliCalorimeter : public TObject
   void AddVetoSignal(Float_t* r,TString f,Float_t s=0); // Associate (extrapolated) signal
   AliSignal* GetVetoSignal(Int_t j);               // Access to veto signal number j
   Int_t GetNvetos();                               // Provide the number of veto signals
+  void SetName(TString name);                      // Set the name of the calorimeter system
+  TString GetName();                               // Provide the name of the calorimeter system
  
  protected:
   Int_t fNrows;                              // The number of rows
@@ -76,6 +78,7 @@ class AliCalorimeter : public TObject
   TMatrix* fAttributes;                      // Matrix with module attributes (dead+10*edge)
   TMatrix* fGains;                           // Matrix with module gains
   AliPosition ***fPositions;                 //! Matrix of module position pointers for internal use
+  TString fName;                             // Name of the calorimeter system
  
  ClassDef(AliCalorimeter,1) // Description of a modular calorimeter system.
 };
index 175e368f18969d0db48143112273eea9d15c82fa..6a22c617d0d46c61f65b3ca46ccf6a6398d4bdff 100644 (file)
@@ -295,7 +295,24 @@ Float_t AliJet::GetCharge()
 AliTrack* AliJet::GetTrack(Int_t i)
 {
 // Return the i-th track of this jet
- return (AliTrack*)fTracks->At(i-1);
+ if (!fTracks)
+ {
+  cout << " *AliJet*::GetTrack* No tracks present." << endl;
+  return 0;
+ }
+ else
+ {
+  if (i<=0 || i>fNtrk)
+  {
+   cout << " *AliJet*::GetTrack* Invalid argument i : " << i
+        << " Ntrk = " << fNtrk << endl;
+   return 0;
+  }
+  else
+  {
+   return (AliTrack*)fTracks->At(i-1);
+  }
+ }
 }
 ///////////////////////////////////////////////////////////////////////////
 Double_t AliJet::GetPt()
index 7c4c9640ec7961479de18ce414d5158fa87cda49..38fd633c9b9cc1b5b8e3a7380cfc5b8d723e91e3 100644 (file)
 //
 // Note : Also (secondary) vertices can be added to a vertex.
 //
+// To provide maximal flexibility to the user, two modes of vertex storage
+// are provided by means of the memberfunction SetVertexCopy().
+// The same holds for the storage of jets via SetJetCopy().
+//
+// a) SetVertexCopy(0) (which is the default).
+//    Only the pointers of the 'added' vertices are stored.
+//    This mode is typically used by making vertex studies based on a fixed list
+//    of vertices which stays under user control or is contained for instance
+//    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.
+//    Modifications made to the original vertices also affect the AliVertex objects
+//    which are stored. 
+// b) SetVertexCopy(1).
+//    Of every 'added' vertex a private copy will be made of which the pointer
+//    will be stored.
+//    In this way the AliVertex represents an entity on its own and modifications
+//    made to the original vertices do not affect the AliVertex objects which are
+//    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.
+//
 // Coding example to make 3 vertices v1, v2 and v3.
 // ------------------------------------------------
 // v1 contains the tracks 1,2,3 and 4
-// v2 contains the tracks 5,6 and 7
+// v2 contains many different tracks
 // v3 contains the jets 1 and 2
 //
-//        AliTrack t1,t2,t3,t4,t5,t6,t7;
+//        AliTrack t1,t2,t3,t4;
 //         ...
 //         ... // code to fill the track data
 //         ...
@@ -38,7 +61,8 @@
 //         ... // code to fill the jet data
 //         ...
 //
-//        AliVertex v1(5);
+//        AliVertex v1;
+//        v1.SetVertexCopy(1);
 //
 //        v1.AddTrack(t1);
 //        v1.AddTrack(t2);
 //        Float_t r1[3]={2.4,0.1,-8.5};
 //        v1.SetPosition(r1,"car");
 //
-//        AliVertex v2(2);
-//        v2.AddTrack(t5);
-//        v2.AddTrack(t6);
-//        v2.AddTrack(t7);
+//        AliVertex v2;
+//        v2.SetTrackCopy(1);
+//
+//        AliTrack* tx=new AliTrack();
+//        for (Int_t i=0; i<10; i++)
+//        {
+//         ...
+//         ... // code to fill the track data
+//         ...
+//         v2.AddTrack(tx);
+//         tx->Reset(); 
+//        }
 //
 //        Float_t r2[3]={1.6,-3.2,5.7};
 //        v2.SetPosition(r2,"car");
 //        v1.Reset();
 //        v1.SetNvmax(25); // Increase initial no. of sec. vertices
 //        v1.AddTrack(t3);
-//        v1.AddTrack(t7);
+//        v1.AddTrack(t4);
 //        v1.AddJet(j2);
 //        Float_t pos[3]={7,9,4};
 //        v1.SetPosition(pos,"car");
@@ -119,9 +151,14 @@ AliVertex::AliVertex()
  fNvmax=0;
  fVertices=0;
  fConnects=0;
+ fVertexCopy=0;
+ fNjmax=0;
+ fJets=0;
+ fJetCopy=0;
  Reset();
  SetNtinit();
  SetNvmax();
+ SetNjmax();
 }
 ///////////////////////////////////////////////////////////////////////////
 AliVertex::AliVertex(Int_t n)
@@ -131,6 +168,10 @@ AliVertex::AliVertex(Int_t n)
  fNvmax=0;
  fVertices=0;
  fConnects=0;
+ fVertexCopy=0;
+ fNjmax=0;
+ fJets=0;
+ fJetCopy=0;
  Reset();
  if (n > 0)
  {
@@ -145,19 +186,30 @@ AliVertex::AliVertex(Int_t n)
   SetNtinit();
  }
  SetNvmax();
+ SetNjmax();
 }
 ///////////////////////////////////////////////////////////////////////////
 AliVertex::~AliVertex()
 {
 // Default destructor
- if (fVertices) delete fVertices;
- fVertices=0;
+ if (fVertices)
+ {
+  if (fVertexCopy) fVertices->Delete();
+  delete fVertices;
+  fVertices=0;
+ }
  if (fConnects)
  {
   fConnects->Delete();
   delete fConnects;
   fConnects=0;
  }
+ if (fJets)
+ {
+  if (fJetCopy) fJets->Delete();
+  delete fJets;
+  fJets=0;
+ }
 }
 ///////////////////////////////////////////////////////////////////////////
 void AliVertex::SetNvmax(Int_t n)
@@ -171,8 +223,31 @@ void AliVertex::SetNvmax(Int_t n)
  {
   fNvmax=1;
  }
- if (fVertices) delete fVertices;
- fVertices=new TObjArray(fNvmax);
+ if (fVertices)
+ {
+  if (fVertexCopy) fVertices->Delete();
+  delete fVertices;
+  fVertices=0;
+ }
+}
+///////////////////////////////////////////////////////////////////////////
+void AliVertex::SetNjmax(Int_t n)
+{
+// Set the initial maximum number of jets
+ if (n > 0)
+ {
+  fNjmax=n;
+ }
+ else
+ {
+  fNjmax=1;
+ }
+ if (fJets)
+ {
+  if (fJetCopy) fJets->Delete();
+  delete fJets;
+  fJets=0;
+ }
 }
 ///////////////////////////////////////////////////////////////////////////
 void AliVertex::Reset()
@@ -195,16 +270,52 @@ void AliVertex::Reset()
   delete fConnects;
   fConnects=0;
  }
+
+ fNjets=0;
+ if (fNjmax>0) SetNjmax(fNjmax);
 }
 ///////////////////////////////////////////////////////////////////////////
-void AliVertex::AddJet(AliJet& j)
+void AliVertex::AddJet(AliJet& j,Int_t tracks)
 {
-// Add the tracks of a jet to the vertex
- AliTrack* tj;
- for (Int_t i=1; i<=j.GetNtracks(); i++)
+// Add a jet (and its tracks) to the vertex
+// In case the maximum number of jets has been reached,
+// the array space will be extended automatically
+//
+// Note : By default the tracks of the jet are added to the current (primary)
+//        vertex.
+//        The automatic addition of the tracks of the jet can be suppressed
+//        by specifying tracks=0. In this case only the AliJet object will
+//        be stored according to the mode specified by SetJetCopy().
+//        The latter will enable jet studies based on a fixed list of tracks
+//        as contained e.g. in an AliVertex or AliEvent. 
+ if (!fJets) fJets=new TObjArray(fNjmax);
+ if (fNjets == fNjmax) // Check if maximum jet number is reached
  {
-  tj=j.GetTrack(i);
-  AliJet::AddTrack(tj);
+  fNjmax++;
+  fJets->Expand(fNjmax);
+ }
+
+ // Add the jet to the list 
+ fNjets++;
+ if (fJetCopy)
+ {
+  AliJet* jx=new AliJet(j);
+  fJets->Add(jx);
+ }
+ else
+ {
+  fJets->Add(&j);
+ }
+
+ // Add the tracks of the jet to this vertex
+ if (tracks)
+ {
+  AliTrack* tj;
+  for (Int_t i=1; i<=j.GetNtracks(); i++)
+  {
+   tj=j.GetTrack(i);
+   AddTrack(tj);
+  }
  }
 }
 ///////////////////////////////////////////////////////////////////////////
@@ -224,6 +335,7 @@ void AliVertex::AddVertex(AliVertex& v,Int_t connect)
 //        has to introduce the connecting track lateron by hand
 //        explicitly in order to match the kinematics and charge.
 //
+ if (!fVertices) fVertices=new TObjArray(fNvmax);
  if (fNvtx == fNvmax) // Check if maximum vertex number is reached
  {
   fNvmax++;
@@ -232,7 +344,15 @@ void AliVertex::AddVertex(AliVertex& v,Int_t connect)
 
  // Add the linked (secondary) vertex to the list 
  fNvtx++;
- fVertices->Add(&v);
+ if (fVertexCopy)
+ {
+  AliVertex* vx=new AliVertex(v);
+  fVertices->Add(vx);
+ }
+ else
+ {
+  fVertices->Add(&v);
+ }
 
  // Create connecting track and update 4-momentum and charge for current vertex
  if (connect)
@@ -251,7 +371,7 @@ void AliVertex::AddVertex(AliVertex& v,Int_t connect)
   t->Set3Momentum(p);
   t->SetInvariant(v2,dv2);
 
-  AliJet::AddTrack(t);
+  AddTrack(t);
 
   if (!fConnects) fConnects=new TObjArray(fNvmax);
   fConnects->Add(t);
@@ -263,7 +383,8 @@ void AliVertex::Info(TString f)
 // Provide vertex information within the coordinate frame f
  cout << " *AliVertex::Info* Invmass : " << GetInvmass()
       << " Charge : " << GetCharge() << " Momentum : " << GetMomentum()
-      << " Ntracks : " << GetNtracks() << " Nvertices : " << fNvtx << endl;
+      << " Ntracks : " << GetNtracks() << " Nvertices : " << fNvtx 
+      << " Njets : " << fNjets << endl;
  cout << " ";
  Ali4Vector::Info(f);
  cout << "  Position";
@@ -387,6 +508,124 @@ Int_t AliVertex::GetNvertices()
 AliVertex* AliVertex::GetVertex(Int_t i)
 {
 // Return the i-th (secondary) vertex of the current vertex
- return (AliVertex*)fVertices->At(i-1);
+ if (!fVertices)
+ {
+  cout << " *AliVertex*::GetVertex* No (secondary) vertices present." << endl;
+  return 0;
+ }
+ else
+ {
+  if (i<=0 || i>fNvtx)
+  {
+   cout << " *AliVertex*::GetVertex* Invalid argument i : " << i
+        << " Nvtx = " << fNvtx << endl;
+   return 0;
+  }
+  else
+  {
+   return (AliVertex*)fVertices->At(i-1);
+  }
+ }
+}
+///////////////////////////////////////////////////////////////////////////
+void AliVertex::SetVertexCopy(Int_t j)
+{
+// (De)activate the creation of private copies of the added vertices.
+// j=0 ==> No private copies are made; pointers of original vertices are stored.
+// j=1 ==> Private copies of the vertices are made and these pointers are stored.
+//
+// Note : Once the storage contains pointer(s) to AliVertex objects one cannot
+//        change the VertexCopy mode anymore.
+//        To change the VertexCopy mode for an existing AliVertex containing
+//        vertices one first has to invoke Reset().
+ if (!fVertices)
+ {
+  if (j==0 || j==1)
+  {
+   fVertexCopy=j;
+  }
+  else
+  {
+   cout << "*AliVertex::SetVertexCopy* Invalid argument : " << j << endl;
+  }
+ }
+ else
+ {
+  cout << "*AliVertex::SetVertexCopy* Storage already contained vertices."
+       << "  ==> VertexCopy mode not changed." << endl; 
+ }
+}
+///////////////////////////////////////////////////////////////////////////
+Int_t AliVertex::GetVertexCopy()
+{
+// Provide value of the VertexCopy mode.
+// 0 ==> No private copies are made; pointers of original vertices are stored.
+// 1 ==> Private copies of the vertices are made and these pointers are stored.
+ return fVertexCopy;
+}
+///////////////////////////////////////////////////////////////////////////
+Int_t AliVertex::GetNjets()
+{
+// Return the current number of jets
+ return fNjets;
+}
+///////////////////////////////////////////////////////////////////////////
+AliJet* AliVertex::GetJet(Int_t i)
+{
+// Return the i-th jet of the current vertex
+ if (!fJets)
+ {
+  cout << " *AliVertex*::GetJet* No jets present." << endl;
+  return 0;
+ }
+ else
+ {
+  if (i<=0 || i>fNjets)
+  {
+   cout << " *AliVertex*::GetJet* Invalid argument i : " << i
+        << " Njets = " << fNjets << endl;
+   return 0;
+  }
+  else
+  {
+   return (AliJet*)fJets->At(i-1);
+  }
+ }
+}
+///////////////////////////////////////////////////////////////////////////
+void AliVertex::SetJetCopy(Int_t j)
+{
+// (De)activate the creation of private copies of the added jets.
+// j=0 ==> No private copies are made; pointers of original jets are stored.
+// j=1 ==> Private copies of the jets are made and these pointers are stored.
+//
+// Note : Once the storage contains pointer(s) to AliJet objects one cannot
+//        change the JetCopy mode anymore.
+//        To change the JetCopy mode for an existing AliVertex containing
+//        jets one first has to invoke Reset().
+ if (!fJets)
+ {
+  if (j==0 || j==1)
+  {
+   fJetCopy=j;
+  }
+  else
+  {
+   cout << "*AliVertex::SetJetCopy* Invalid argument : " << j << endl;
+  }
+ }
+ else
+ {
+  cout << "*AliVertex::SetJetCopy* Storage already contained jets."
+       << "  ==> JetCopy mode not changed." << endl; 
+ }
+}
+///////////////////////////////////////////////////////////////////////////
+Int_t AliVertex::GetJetCopy()
+{
+// Provide value of the JetCopy mode.
+// 0 ==> No private copies are made; pointers of original jets are stored.
+// 1 ==> Private copies of the jets are made and these pointers are stored.
+ return fJetCopy;
 }
 ///////////////////////////////////////////////////////////////////////////
index 9dfcde0679526101b82acb266eb09c0e85b34895..22bc757284422626087138acfd46d6293ee83653 100644 (file)
@@ -21,9 +21,9 @@ class AliVertex : public AliJet,public AliPosition
   AliVertex(Int_t n);                     // Create a vertex to hold initially n tracks
   ~AliVertex();                           // Default destructor
   void Reset();                           // Reset all values
-  void AddJet(AliJet& j);                 // Add a jet of tracks to the vertex
+  void AddJet(AliJet& j,Int_t tracks=1);  // Add a jet (and its tracks) to the vertex
   void AddVertex(AliVertex& v,Int_t connect=1);// Add (and connect) a (sec.) vertex to the current vertex
-  void AddJet(AliJet* j)    { AddJet(*j); }
+  void AddJet(AliJet* j,Int_t tracks=1)    { AddJet(*j,tracks); }
   void AddVertex(AliVertex* v,Int_t connect=1) { AddVertex(*v,connect); }
   void Info(TString f="car");             // Print the vertex info within coordinate frame f
   void List(TString f="car");             // Print vertex prim. track information for coord. frame f
@@ -31,12 +31,24 @@ class AliVertex : public AliJet,public AliPosition
   Int_t GetNvertices();                   // Return the number of (secondary) vertices
   AliVertex* GetVertex(Int_t i);          // Provide i-th (secondary) vertex
   void SetNvmax(Int_t n=2);               // Set the initial max. number of (secondary) vertices
+  void SetVertexCopy(Int_t j);            // (De)activate creation of private copies in fVertices
+  Int_t GetVertexCopy();                  // Provide VertexCopy flag value      
+  Int_t GetNjets();                       // Return the number of jets
+  AliJet* GetJet(Int_t i);                // Provide i-th jet
+  void SetNjmax(Int_t n=2);               // Set the initial max. number of jets
+  void SetJetCopy(Int_t j);               // (De)activate creation of private copies in fJets
+  Int_t GetJetCopy();                     // Provide JetCopy flag value      
 
  protected:
   Int_t fNvmax;         // The maximum number of (secondary) vertices
   Int_t fNvtx;          // The number of (secondary) vertices
   TObjArray* fVertices; // Array to hold the pointers to the (secondary) vertices
   TObjArray* fConnects; // Array to hold the pointers to the auto-generated connecting tracks
+  Int_t fVertexCopy;    // Flag to denote creation of private copies in fVertices
+  Int_t fNjmax;         // The maximum number of jets
+  Int_t fNjets;         // The number of jets
+  TObjArray* fJets;     // Array to hold the pointers to the jets
+  Int_t fJetCopy;       // Flag to denote creation of private copies in fJets
 
  private:
   void Dump(AliVertex* v,Int_t n,TString f); // Recursively print all sec. vertices
index 9e31337e6984b291822d2c5bf35975c5803d8535..60645d37666a249f32c3b6ed5c0cb78d29b6f07a 100644 (file)
                 into AddJet(AliJet*) and AddVertex(AliVertex*) in class AliVertex.
 29-jun-2001 NvE TrackCopy mode introduced in AliJet.
 02-jul-2001 NvE Misplaced statement corrected in AliJet::SetNtinit().
+03-jul-2001 NvE Protections added in AliJet::GetTrack() and AliVertex::GetVertex() and
+                VertexCopy introduced in AliVertex.
+                Naming facility introduced in AliCalorimeter in order to identify
+                different calorimeter systems in an event structure.
+                Storage of jets introduced in AliVertex on the same footing as the
+                storage of (secondary) vertices.