added new classes for TOF clusters/matches storage in the ESD
authorshahoian <ruben.shahoyan@cern.ch>
Wed, 12 Feb 2014 15:34:49 +0000 (16:34 +0100)
committershahoian <ruben.shahoyan@cern.ch>
Wed, 12 Feb 2014 15:45:48 +0000 (16:45 +0100)
STEER/ESD/AliESDTOFCluster.cxx [new file with mode: 0644]
STEER/ESD/AliESDTOFCluster.h [new file with mode: 0644]
STEER/ESD/AliESDTOFHit.cxx [new file with mode: 0644]
STEER/ESD/AliESDTOFHit.h [new file with mode: 0644]
STEER/ESD/AliESDTOFMatch.cxx [new file with mode: 0644]
STEER/ESD/AliESDTOFMatch.h [new file with mode: 0644]
STEER/STEERBase/AliVTOFHit.cxx [new file with mode: 0644]
STEER/STEERBase/AliVTOFHit.h [new file with mode: 0644]
STEER/STEERBase/AliVTOFMatch.cxx [new file with mode: 0644]
STEER/STEERBase/AliVTOFMatch.h [new file with mode: 0644]

diff --git a/STEER/ESD/AliESDTOFCluster.cxx b/STEER/ESD/AliESDTOFCluster.cxx
new file mode 100644 (file)
index 0000000..27c6bb3
--- /dev/null
@@ -0,0 +1,461 @@
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ *                                                                        *
+ * Author: The ALICE Off-line Project.                                    *
+ * Contributors are mentioned in the code where appropriate.              *
+ *                                                                        *    
+ * Permission to use, copy, modify and distribute this software and its   *
+ * documentation strictly for non-commercial purposes is hereby granted   *
+ * without fee, provided that the above copyright notice appears in all   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appear in the supporting documentation. The authors make no claims     *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  * 
+ **************************************************************************/
+
+/* $Id:  $ */
+
+//_________________________________________________________________________//
+//_________________________________________________________________________//
+
+#include "AliESDTOFCluster.h"
+#include "TClonesArray.h"
+#include "AliESDEvent.h"
+
+ClassImp(AliESDTOFCluster)
+
+//_________________________________________________________________________
+AliESDTOFCluster::AliESDTOFCluster(Int_t clID) :
+  fID(clID),
+  fNTOFhits(0),
+  fStatus(0),
+  fNmatchableTracks(0)
+{
+  //
+  // default ctor
+  //
+
+  for(Int_t i=kMaxHits;i--;)    fHitIndex[i] = -1;
+  for(Int_t i=kMaxMatches;i--;) fMatchIndex[i] = -1;
+}
+
+//_________________________________________________________________________
+AliESDTOFCluster::AliESDTOFCluster(Int_t ,Int_t ,Float_t ,Float_t ,Float_t ,Int_t*,Int_t ,Int_t ,
+                                  Bool_t ,Float_t ,Float_t ,Float_t ,
+                                  Int_t ,Float_t ,Float_t ,Float_t ,Float_t ,Double_t*) :
+  fID(-1),
+  fNTOFhits(0),
+  fStatus(1),
+  fNmatchableTracks(1)
+{
+  //
+  // Constructor of AliESDTOFCluster object
+  //
+
+  // to be replaced with hit creation
+  for(Int_t i=kMaxHits;i--;) fHitIndex[i] = -1;
+  for(Int_t i=kMaxMatches;i--;) fMatchIndex[i] = -1;
+  //
+}
+
+//_________________________________________________________________________
+AliESDTOFCluster::AliESDTOFCluster(Int_t ,Int_t ,Float_t ,Float_t ,Float_t ,Int_t*,Int_t ,Int_t ,
+                                  Bool_t ,Float_t ,Float_t ,Float_t ) :
+  fID(-1),
+  fNTOFhits(0),
+  fStatus(1),
+  fNmatchableTracks(0)
+{
+  //
+  // Constructor of AliESDTOFCluster object
+  //
+
+  // to be replaced with hit creation
+  for(Int_t i=kMaxHits;i--;) fHitIndex[i] = -1;
+  for(Int_t i=kMaxMatches;i--;) fMatchIndex[i] = -1;
+
+}
+
+//_________________________________________________________________________
+AliESDTOFCluster::AliESDTOFCluster(const AliESDTOFCluster & source) :
+  AliVTOFcluster(source),
+  fID(source.fID),
+  fNTOFhits(source.fNTOFhits),
+  fStatus(source.fStatus),
+  fNmatchableTracks(source.fNmatchableTracks)
+{
+  // 
+  // copy ctor for AliESDTOFCluster object
+  //
+
+  SetEvent(source.GetEvent());
+
+  for(Int_t i=kMaxHits;i--;)    fHitIndex[i] = source.fHitIndex[i];
+  for(Int_t i=kMaxMatches;i--;) fMatchIndex[i] = source.fMatchIndex[i];
+
+}
+
+//_________________________________________________________________________
+AliESDTOFCluster & AliESDTOFCluster::operator=(const AliESDTOFCluster & source)
+{
+  // 
+  // assignment op-r
+  //
+  if (this == &source) return *this;
+  AliVTOFcluster::operator=(source);
+  fID = source.fID;
+  fNTOFhits = source.fNTOFhits;
+  fStatus = source.fStatus;
+  fNmatchableTracks = source.fNmatchableTracks;
+
+  for(Int_t i=kMaxHits;i--;)    fHitIndex[i] = source.fHitIndex[i];
+  for(Int_t i=kMaxMatches;i--;) fMatchIndex[i] = source.fMatchIndex[i];
+
+  return *this;
+}
+
+//_________________________________________________________________________
+Int_t AliESDTOFCluster::Update(Int_t trackIndex,Float_t dX,Float_t dY,Float_t dZ,
+                              Float_t length,Double_t expTimes[AliPID::kSPECIESC])
+{
+  // update cluster info by new track
+  //  AliInfo(Form("TOF %d %d",fNmatchableTracks,fNTOFhits));
+
+  if(fNmatchableTracks >= kMaxMatches) return 2; // max number reached
+  //
+  // check if the track is not already stored
+  for (Int_t ii=fNmatchableTracks; ii--;) if (trackIndex==GetTrackIndex(ii)) return 1;
+  //
+  const AliESDEvent *event = (AliESDEvent *) GetEvent();
+  TClonesArray *matchAr = event->GetESDTOFMatches();
+  int ntr = matchAr->GetEntriesFast();
+  new((*matchAr)[ntr]) AliESDTOFMatch(trackIndex,expTimes,dX,dY,dZ,length);
+  fMatchIndex[fNmatchableTracks++] = ntr;
+  //
+  return 0;
+  //
+}
+
+//_________________________________________________________________________
+void AliESDTOFCluster::AddESDTOFHitIndex(Int_t hitID)
+{
+  // register new hit in the cluster
+  if(fNTOFhits >= kMaxHits) return;
+  fHitIndex[fNTOFhits++] = hitID; // add the hit to the array
+}
+
+//_________________________________________________________________________
+void AliESDTOFCluster::AddTOFhit(AliESDTOFHit *hit)
+{
+  // add new hit
+  if(fNTOFhits >= kMaxHits) return;
+  // add the hit to the array
+  const AliESDEvent *event = (AliESDEvent *) GetEvent();
+  TClonesArray *hitAr = event->GetESDTOFHits();
+  int nh = hitAr->GetEntriesFast();
+  new((*hitAr)[nh]) AliESDTOFHit(*hit);
+  //   hitN->SetIndex(nh); // RS: why do we need this
+  fHitIndex[fNTOFhits++] = nh;
+  //
+}
+
+//_________________________________________________________________________
+void AliESDTOFCluster::AddTOFhit(Int_t ,Int_t ,Float_t ,Float_t ,Float_t ,Int_t*,Int_t ,Int_t , Bool_t ,Float_t ,Float_t ,Float_t )
+{
+}
+
+//_________________________________________________________________________
+Int_t AliESDTOFCluster::GetClusterIndex(int ihit) const
+{
+  AliESDTOFHit* hit = GetTOFHit(ihit);
+  return hit ? hit->GetClusterIndex() : -1;
+} 
+
+//_________________________________________________________________________
+Int_t AliESDTOFCluster::GetTOFchannel(int ihit) const 
+{
+  AliESDTOFHit* hit = GetTOFHit(ihit);
+  return hit ? hit->GetTOFchannel() : -1;
+}
+
+//_________________________________________________________________________
+Float_t AliESDTOFCluster::GetTime(int ihit) const 
+{
+  AliESDTOFHit* hit = GetTOFHit(ihit);
+  return hit ? hit->GetTime() : 0;
+}
+
+//_________________________________________________________________________
+Float_t AliESDTOFCluster::GetTimeRaw(Int_t ihit) const 
+{
+ AliESDTOFHit* hit = GetTOFHit(ihit);
+ return hit ? hit->GetTimeRaw() : 0;
+} // TOF raw time
+
+//_________________________________________________________________________
+Float_t AliESDTOFCluster::GetTOT(Int_t ihit) const 
+{
+  AliESDTOFHit* hit = GetTOFHit(ihit);
+  return hit ? hit->GetTOT() : 0;
+} // TOF tot
+
+//_________________________________________________________________________
+Float_t AliESDTOFCluster::GetTOFsignalToT(Int_t ihit) const 
+{
+  AliESDTOFHit* hit = GetTOFHit(ihit);
+  return hit ? hit->GetTOT() : 0; // RS: Why signalTot and TOT are the same?
+} // TOF tot
+
+//_________________________________________________________________________
+Int_t AliESDTOFCluster::GetLabel(Int_t i,Int_t ihit) const 
+{
+  AliESDTOFHit* hit = GetTOFHit(ihit);
+  if (!hit || i>=3) return -999;
+  return hit->GetTOFLabel(i);
+}
+
+//_________________________________________________________________________
+Int_t AliESDTOFCluster::GetDeltaBC(Int_t ihit) const 
+{
+  AliESDTOFHit* hit = GetTOFHit(ihit);
+  return hit ? hit->GetDeltaBC() : 0;
+}
+
+//_________________________________________________________________________
+Int_t AliESDTOFCluster::GetL0L1Latency(Int_t ihit) const 
+{
+  AliESDTOFHit* hit = GetTOFHit(ihit);  
+  return hit ? hit->GetL0L1Latency() : 0;
+}
+
+//_________________________________________________________________________
+Bool_t AliESDTOFCluster::GetStatus() const 
+{
+  if(!fEvent){
+    AliInfo("No AliESDEvent available here!");
+    return 0;
+  }
+  return fStatus;
+}
+
+//_________________________________________________________________________
+Float_t AliESDTOFCluster::GetZ() const 
+{
+  AliESDTOFHit* hit = GetTOFHit(0);
+  return hit ? hit->GetZ() : 0;
+}
+
+//_________________________________________________________________________
+Float_t AliESDTOFCluster::GetPhi() const 
+{
+  AliESDTOFHit* hit = GetTOFHit(0);
+  return hit ? hit->GetPhi() : 0;
+}
+
+//_________________________________________________________________________
+Float_t AliESDTOFCluster::GetR() const 
+{
+  AliESDTOFHit* hit = GetTOFHit(0);
+  return hit ? hit->GetR() : 0;
+}
+
+//_________________________________________________________________________
+Int_t AliESDTOFCluster::GetNMatchableTracks() const 
+{
+  return fNmatchableTracks;
+}
+
+//_________________________________________________________________________
+Int_t AliESDTOFCluster::GetNTOFhits() const 
+{
+  return fNTOFhits;
+}
+
+//_________________________________________________________________________
+Int_t AliESDTOFCluster::GetTrackIndex(Int_t i) const 
+{
+  AliESDTOFMatch* match = 0;
+  return (i<fNmatchableTracks && (match=GetTOFMatch(i))) ? match->GetTrackIndex() : -999;
+}
+
+//_________________________________________________________________________
+Float_t AliESDTOFCluster::GetDistanceInStripPlane(Int_t i) const 
+{
+  // distance
+  AliESDTOFMatch* match = 0;
+  if (i>=fNmatchableTracks || !(match=GetTOFMatch(i))) return -999;
+  Double_t dz = match->GetDz();
+  Double_t dx = match->GetDx();
+  return TMath::Sqrt(dx*dx+dz*dz);
+}
+
+//_________________________________________________________________________
+Float_t AliESDTOFCluster::GetDx(Int_t i)  const 
+{
+  AliESDTOFMatch* match = 0;  
+  return (i<fNmatchableTracks && (match=GetTOFMatch(i))) ? match->GetDx() : -999;
+} // distance, X component
+
+//_________________________________________________________________________
+Float_t AliESDTOFCluster::GetDy(Int_t i)  const 
+{
+  AliESDTOFMatch* match = 0;  
+  return (i<fNmatchableTracks && (match=GetTOFMatch(i))) ? match->GetDy() : -999;
+} // distance, Y component
+
+//_________________________________________________________________________
+Float_t AliESDTOFCluster::GetDz(Int_t i)  const 
+{
+  AliESDTOFMatch* match = 0;  
+  return (i<fNmatchableTracks && (match=GetTOFMatch(i))) ? match->GetDz() : -999;
+} // distance, Z component
+
+//_________________________________________________________________________
+Float_t AliESDTOFCluster::GetLength(Int_t i) const 
+{
+  AliESDTOFMatch* match = 0;  
+  return (i<fNmatchableTracks && (match=GetTOFMatch(i))) ? match->GetTrackLength() : -999.;
+} // reconstructed track length at TOF
+
+//_________________________________________________________________________
+Double_t AliESDTOFCluster::GetIntegratedTime(Int_t iPart,Int_t i) const 
+{
+  AliESDTOFMatch* match = 0;  
+  return (i<fNmatchableTracks && (match=GetTOFMatch(i))) ? match->GetIntegratedTimes(iPart) : -999.;
+} // reconstructed track length at TOF
+
+//_________________________________________________________________________
+void AliESDTOFCluster::Print(const Option_t*) const
+{
+  // print full chain
+  printf("#%5d TOF Cluster %5d of %d Hits, %d Matchable Tracks\n",GetESDID(),fID, fNTOFhits, fNmatchableTracks);
+  for (int ih=0;ih<fNTOFhits;ih++) {
+    AliESDTOFHit* ht = GetTOFHit(ih);
+    if (ht) {
+      printf("%d: ",ih);
+      ht->Print();
+    }
+  }
+  //
+  for (int it=0;it<fNmatchableTracks;it++) {
+    AliESDTOFMatch* mt = GetTOFMatch(it);
+    if (mt) {
+      printf("%d: ",it);
+      mt->Print();
+    }
+  }
+  //
+}
+
+//_________________________________________________________________________
+AliESDTOFHit* AliESDTOFCluster::GetTOFHit(Int_t i) const
+{
+  return fEvent ? ((AliESDTOFHit *) ((AliESDEvent *) GetEvent())->GetESDTOFHits()->At(fHitIndex[i])):0;
+}
+
+//_________________________________________________________________________
+AliESDTOFMatch* AliESDTOFCluster::GetTOFMatch(Int_t i) const 
+{
+  return fEvent ? ((AliESDTOFMatch *) ((AliESDEvent *) GetEvent())->GetESDTOFMatches()->At(fMatchIndex[i])) : 0;
+}
+
+//_________________________________________________________________________
+void AliESDTOFCluster::SuppressMatchedTrack(Int_t id)
+{
+  // suppress the reference to track id
+  for (int it=fNmatchableTracks;it--;) {
+    AliESDTOFMatch* mtc = GetTOFMatch(it);
+    if (mtc->GetTrackIndex()!=id) continue;
+    // need to suprress the match: simply remove reference to it
+    int rmID = fMatchIndex[it];
+    for (int jt=it+1;jt<fNmatchableTracks;jt++) fMatchIndex[jt-1] = fMatchIndex[jt];
+    fNmatchableTracks--;
+    // remove match rmID
+    TClonesArray* arrMatch = ((AliESDEvent *)GetEvent())->GetESDTOFMatches();
+    int last = arrMatch->GetEntriesFast()-1;
+    AliESDTOFMatch* mtcL = (AliESDTOFMatch*)arrMatch->At(last);
+    if (rmID!=last) {
+      *mtc = *mtcL; // assign the last match to removed slot
+      int trID = mtc->GetTrackIndex();
+      AliESDtrack* trc = ((AliESDEvent *)GetEvent())->GetTrack(trID);
+      trc->ReplaceTOFMatchID(last,rmID); // fix the reference to reassigned match
+      // fix the 
+    }
+    arrMatch->RemoveAt(last);
+    break;
+  }
+  //
+  if (!fNmatchableTracks) { // no matches left, clear all hits: prepare for selfelimination
+    // first remove associated hits
+    TClonesArray* arrHits = ((AliESDEvent *)GetEvent())->GetESDTOFHits();
+    TClonesArray* arrClus = ((AliESDEvent *)GetEvent())->GetESDTOFClusters();
+    int last = arrHits->GetEntriesFast()-1;
+    for (;fNTOFhits--;) { // remove hits
+      int hID = fHitIndex[fNTOFhits];
+      AliESDTOFHit* hit = (AliESDTOFHit*)arrHits->At(hID);
+      AliESDTOFHit* hitL = (AliESDTOFHit*)arrHits->At(last);
+      if (hID!=last) {
+       *hit = *hitL; // assign the last match to removed slot
+       // fix reference on hitL in the owner cluster
+       int clID = hit->GetESDTOFClusterIndex();
+       AliESDTOFCluster* clusL = (AliESDTOFCluster*)arrClus->At(clID);
+       clusL->ReplaceHitID(last,hID);
+      }
+      arrHits->RemoveAt(last--);
+    }
+  }
+
+}
+
+//_________________________________________________________________________
+void AliESDTOFCluster::ReplaceHitID(int oldID, int newID)
+{
+  // replace the reference to hit from oldID by newID
+  for (int it=fNTOFhits;it--;) {
+    if (fHitIndex[it]==oldID) {
+      fHitIndex[it]=newID;
+      return;
+    }
+  }
+}
+
+//_________________________________________________________________________
+void AliESDTOFCluster::ReplaceMatchID(int oldID, int newID)
+{
+  // replace the reference to match from oldID by newID
+  for (int it=fNmatchableTracks;it--;) {
+    if (fMatchIndex[it]==oldID) {
+      fMatchIndex[it]=newID;
+      return;
+    }
+  }
+}
+
+//_________________________________________________________________________
+void AliESDTOFCluster::ReplaceMatchedTrackID(int oldID, int newID)
+{
+  // replace the reference to track oldID by newID
+  for (int it=fNmatchableTracks;it--;) {
+    AliESDTOFMatch* mtc = GetTOFMatch(it);
+    if (mtc->GetTrackIndex()!=oldID) continue;
+    mtc->SetTrackIndex(newID);
+    break;
+  }
+  //
+}
+
+//_________________________________________________________________________
+void AliESDTOFCluster::FixSelfReferences(int oldID, int newID)
+{
+  // replace the references (in tracks and hist) to this cluster from oldID by newID  
+  for (int it=fNmatchableTracks;it--;) {
+    int trID = GetTOFMatch(it)->GetTrackIndex();
+    AliESDtrack* trc = ((AliESDEvent *)GetEvent())->GetTrack(trID);
+    trc->ReplaceTOFClusterID(oldID,newID);
+  }
+  for (int it=fNTOFhits;it--;) {
+    AliESDTOFHit* hit = GetTOFHit(it);
+    hit->SetESDTOFClusterIndex(newID);
+  }
+  //
+}
diff --git a/STEER/ESD/AliESDTOFCluster.h b/STEER/ESD/AliESDTOFCluster.h
new file mode 100644 (file)
index 0000000..8bd41bc
--- /dev/null
@@ -0,0 +1,95 @@
+#ifndef ALIESDTOFCLUSTER_H
+#define ALIESDTOFCLUSTER_H
+
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+/* $Id: $ */
+
+//----------------------------------------------------------------------//
+//                                                                      //
+// AliESDTOFCluster Class                                                //
+//                                                                      //
+//----------------------------------------------------------------------//
+#include "TMath.h"
+#include <AliVTOFcluster.h>
+#include "AliESDTOFHit.h"
+#include "AliESDTOFMatch.h"
+
+class AliESDEvent;
+
+class AliESDTOFCluster : public AliVTOFcluster {
+
+ public:
+  AliESDTOFCluster(Int_t id=-1);
+  AliESDTOFCluster(Int_t ,Int_t ,Float_t ,Float_t ,Float_t ,Int_t*,Int_t ,Int_t ,  Bool_t ,Float_t ,Float_t ,Float_t ,
+                  Int_t ,Float_t ,Float_t ,Float_t ,Float_t ,Double_t*);
+  AliESDTOFCluster(Int_t ,Int_t ,Float_t ,Float_t ,Float_t t,Int_t*,Int_t ,Int_t ,
+                  Bool_t ,Float_t ,Float_t ,Float_t );
+  AliESDTOFCluster(const AliESDTOFCluster & source);
+  AliESDTOFCluster & operator=(const AliESDTOFCluster & source);
+  virtual ~AliESDTOFCluster() {}
+
+  Int_t GetESDID()          const {return GetUniqueID();}
+  void  SetESDID(Int_t id)        {SetUniqueID(id);}
+  Int_t GetID()             const {return fID;}
+  void  SetID(Int_t id)           {fID = id;}
+
+  Int_t Update(Int_t trackIndex,Float_t dX,Float_t dY,Float_t dZ,Float_t length,Double_t expTimes[9]);
+  void  SuppressMatchedTrack(Int_t id);
+  void  ReplaceMatchedTrackID(int oldID, int newID);
+  void  ReplaceMatchID(int oldID, int newID);
+  void  ReplaceHitID(int oldID, int newID);
+  void  FixSelfReferences(int oldID, int newID);
+  Int_t GetClusterIndex(Int_t ihit=0) const; // cluster index
+  Int_t GetTOFchannel(Int_t ihit=0) const; // TOF channel
+  Float_t GetTime(Int_t ihit=0) const; // TOF time
+  Float_t GetTimeRaw(Int_t ihit=0) const; // TOF raw time
+  Float_t GetTOT(Int_t ihit=0) const; // TOF tot
+  Float_t GetTOFsignalToT(Int_t ihit=0) const; // TOF tot
+  Int_t GetLabel(Int_t i=0,Int_t ihit=0) const;
+  Int_t GetDeltaBC(Int_t ihit=0) const;
+  Int_t GetL0L1Latency(Int_t ihit=0) const;
+  Bool_t GetStatus() const;
+  Float_t GetZ() const;
+  Float_t GetPhi() const;
+  Float_t GetR() const;
+  Int_t GetNMatchableTracks() const;
+  Int_t GetNTOFhits() const;
+
+  Int_t GetTrackIndex(Int_t i=0) const;
+  Float_t GetDistanceInStripPlane(Int_t i=0)   const; // distance
+  Float_t GetDx(Int_t i=0)  const; // distance, X component
+  Float_t GetDy(Int_t i=0)  const; // distance, Y component
+  Float_t GetDz(Int_t i=0)  const; // distance, Z component
+  Float_t GetLength(Int_t i=0) const; // reconstructed track length at TOF
+  Double_t GetIntegratedTime(Int_t iPart=0,Int_t i=0) const; // reconstructed track length at TOF
+  void SetStatus(Int_t status) {fStatus=status;};
+
+  void AddESDTOFHitIndex(Int_t hitID);
+  void AddTOFhit(Int_t ,Int_t ,Float_t ,Float_t ,Float_t ,Int_t*,Int_t ,Int_t , Bool_t ,Float_t ,Float_t ,Float_t );
+  void AddTOFhit(AliESDTOFHit *hit);
+
+  Int_t GetHitIndex(Int_t i) const {return fHitIndex[i];}
+  void  SetHitIndex(Int_t i,Int_t index) {fHitIndex[i] = index;}
+
+  void Print(const Option_t *opt=0) const;
+
+ protected:
+
+  AliESDTOFHit*   GetTOFHit(Int_t i) const;
+  AliESDTOFMatch* GetTOFMatch(Int_t i) const;
+
+ protected:
+  Int_t  fID;               // raw cluster id
+  Char_t fNTOFhits;         // number of TOF hit in the cluster
+  Bool_t fStatus;           // !
+  Char_t fNmatchableTracks; // number of matchable tracks with the same TOF matchable hit
+  Int_t  fHitIndex[kMaxHits];          // pointing to hit info
+  Int_t  fMatchIndex[kMaxMatches];     // pointing to matching info
+
+  ClassDef(AliESDTOFCluster, 2) // TOF matchable cluster
+
+}; 
+
+#endif
diff --git a/STEER/ESD/AliESDTOFHit.cxx b/STEER/ESD/AliESDTOFHit.cxx
new file mode 100644 (file)
index 0000000..e5392af
--- /dev/null
@@ -0,0 +1,84 @@
+#include "AliESDTOFHit.h"
+
+ClassImp(AliESDTOFHit)
+
+
+//________________________________________________________________
+AliESDTOFHit::AliESDTOFHit():
+  fTimeRaw(0),
+  fTime(0),
+  fTOT(0),
+  fL0L1Latency(0),
+  fDeltaBC(0),
+  fTOFchannel(-1),
+  fZ(0),
+  fR(0),
+  fPhi(0)
+{
+  for (int i=3;i--;) fTOFLabel[i]=-1;
+}
+
+//________________________________________________________________
+AliESDTOFHit::AliESDTOFHit(Double_t time,Double_t timeraw, Double_t tot, Int_t channel,Int_t label[3],
+                          Int_t latency,Int_t deltabc,Int_t cluster,Float_t z,Float_t r,Float_t phi):
+  fTimeRaw(timeraw), 
+  fTime(time),
+  fTOT(tot),
+  fL0L1Latency(latency),
+  fDeltaBC(deltabc),
+  fTOFchannel(channel),
+  fZ(z),
+  fR(r),
+  fPhi(phi)
+{   
+  SetESDTOFClusterIndex(cluster);
+  for (int i=3;i--;) fTOFLabel[i] = label[i];
+}
+
+//________________________________________________________________
+AliESDTOFHit::AliESDTOFHit(AliESDTOFHit &source):
+  AliVTOFHit(source),
+  fTimeRaw(source.fTimeRaw),
+  fTime(source.fTime),
+  fTOT(source.fTOT),
+  fL0L1Latency(source.fL0L1Latency),
+  fDeltaBC(source.fDeltaBC),
+  fTOFchannel(source.fTOFchannel),
+  fZ(source.fZ),
+  fR(source.fR),
+  fPhi(source.fPhi)
+{
+  SetESDTOFClusterIndex(source.GetClusterIndex());
+  for (int i=3;i--;) fTOFLabel[i] = source.fTOFLabel[i];
+}
+
+//________________________________________________________________
+void AliESDTOFHit::Print(const Option_t*) const
+{
+  // print hit info
+  printf("TOF Hit: Time:%f TOT:%f Chan:%5d DeltaBC:%+2d Labels: %d %d %d\n",
+        fTime,fTOT,fTOFchannel,fDeltaBC,fTOFLabel[0],fTOFLabel[1],fTOFLabel[2]);
+}
+
+//_________________________________________________________________________
+AliESDTOFHit & AliESDTOFHit::operator=(const AliESDTOFHit & source)
+{
+  // assignment op-r
+  //
+  if (this == &source) return *this;
+  AliVTOFHit::operator=(source);
+  //
+  fTimeRaw = source.fTimeRaw;
+  fTime = source.fTime;
+  fTOT = source.fTOT;
+  fL0L1Latency = source.fL0L1Latency;
+  fDeltaBC = source.fDeltaBC;
+  fTOFchannel = source.fTOFchannel;
+  fZ = source.fZ;
+  fR = source.fR;
+  fPhi = source.fPhi;
+  SetESDTOFClusterIndex(source.GetESDTOFClusterIndex());
+  for (int i=3;i--;) fTOFLabel[i] = source.fTOFLabel[i];
+
+  return *this;
+}
diff --git a/STEER/ESD/AliESDTOFHit.h b/STEER/ESD/AliESDTOFHit.h
new file mode 100644 (file)
index 0000000..360fe18
--- /dev/null
@@ -0,0 +1,69 @@
+#ifndef ALIESDTOFHIT_H
+#define ALIESDTOFHIT_H
+
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+/* $Id: $ */
+
+//----------------------------------------------------------------------//
+//                                                                      //
+// AliESDTOFHit Class                                                   //
+//                                                                      //
+//----------------------------------------------------------------------//
+
+#include "AliVTOFHit.h"
+
+class AliESDTOFHit : public AliVTOFHit
+{
+   public:
+     AliESDTOFHit();
+     AliESDTOFHit(Double_t time,Double_t timeraw, Double_t tot, Int_t channel, Int_t label[3],Int_t latency,Int_t deltabc,Int_t cluster,Float_t z,Float_t r,Float_t phi);
+     AliESDTOFHit(AliESDTOFHit &source);
+     virtual ~AliESDTOFHit() {}
+     AliESDTOFHit & operator=(const AliESDTOFHit & source);
+     //
+     virtual Int_t   GetESDTOFClusterIndex()             const {return GetUniqueID();};
+     virtual void    SetESDTOFClusterIndex(Int_t ind)          {SetUniqueID(ind);};
+     //
+     virtual void    SetTime(Double_t time) {fTime = time;}
+     virtual void    SetTimeRaw(Double_t timeraw) {fTimeRaw=timeraw;};
+     virtual void    SetTOT(Double_t tot) {fTOT = tot;};
+     virtual void    SetL0L1Latency(Int_t latency) {fL0L1Latency = latency;};
+     virtual void    SetDeltaBC(Int_t deltabc) {fDeltaBC = deltabc;};
+     virtual void    SetTOFchannel(Int_t tofch) {fTOFchannel = tofch;};
+     virtual Double_t GetTimeRaw() const {return fTimeRaw;};
+     virtual Double_t GetTOT() const {return fTOT;};
+     virtual Int_t   GetL0L1Latency() const {return fL0L1Latency;};
+     virtual Int_t   GetDeltaBC() const {return fDeltaBC;};
+     virtual Int_t   GetTOFchannel() const {return fTOFchannel;};
+     virtual Double_t GetTime() const {return fTime;}
+     virtual Int_t   GetTOFLabel(Int_t i) const {return (i >=0 && i < 3) ? fTOFLabel[i] : -1;}
+     virtual void    SetTOFLabel(Int_t label[3])  {for(Int_t i=3;i--;) fTOFLabel[i] = label[i];}
+     Float_t GetR() const {return fR;};
+     Float_t GetZ() const {return fZ;};
+     Float_t GetPhi() const {return fPhi;};
+     void SetR(Float_t val) {fR=val;};
+     void SetZ(Float_t val) {fZ=val;};
+     void SetPhi(Float_t val) {fPhi=val;};
+     //
+     void Print(const Option_t *opt=0) const;
+     //
+   protected:
+     // additional info for ESD
+     Double32_t fTimeRaw;         // Time Raw
+     Double32_t fTime;            // TOF calibrated time
+     Double32_t fTOT;             // Time Over Threshold
+     Int_t fTOFLabel[3];          // TOF MC labels
+     Int_t fL0L1Latency;          // L0L1 latency
+     Int_t fDeltaBC;              // DeltaBC can it be Char_t of Short_t ?
+     Int_t fTOFchannel;           // TOF channel
+
+     Float_t fZ;                  //! coordinate for reco
+     Float_t fR;                  //! coordinate for reco
+     Float_t fPhi;                //! coordinate for reco
+
+  ClassDef(AliESDTOFHit, 1) // TOF matchable hit
+
+};
+#endif
diff --git a/STEER/ESD/AliESDTOFMatch.cxx b/STEER/ESD/AliESDTOFMatch.cxx
new file mode 100644 (file)
index 0000000..07097d0
--- /dev/null
@@ -0,0 +1,62 @@
+#include "AliESDTOFMatch.h"
+
+ClassImp(AliESDTOFMatch)
+
+//___________________________________________
+AliESDTOFMatch::AliESDTOFMatch():
+  fDx(0),
+  fDy(0),
+  fDz(0),
+  fTrackLength(0)
+{
+  for(Int_t i=AliPID::kSPECIESC;i--;) fIntegratedTimes[i] = 0;
+}
+
+//___________________________________________
+AliESDTOFMatch::AliESDTOFMatch(Int_t ind,Double_t inttimes[AliPID::kSPECIESC],Double_t dx,Double_t dy,Double_t dz,Double_t l):
+  fDx(dx),
+  fDy(dy),
+  fDz(dz),
+  fTrackLength(l)
+{
+  for(Int_t i=AliPID::kSPECIESC;i--;) fIntegratedTimes[i] = inttimes[i];
+  SetTrackIndex(ind);
+}
+
+//___________________________________________
+AliESDTOFMatch::AliESDTOFMatch(AliESDTOFMatch &source):
+  AliVTOFMatch(source),
+  fDx(source.fDx),
+  fDy(source.fDy),
+  fDz(source.fDz),
+  fTrackLength(source.fTrackLength)
+{
+  for(Int_t i=AliPID::kSPECIESC;i--;) fIntegratedTimes[i] = source.fIntegratedTimes[i];
+  SetTrackIndex(source.GetTrackIndex());
+}
+
+
+//___________________________________________
+void AliESDTOFMatch::Print(const Option_t*) const
+{
+  // print matchi info
+  printf("TOF Match to ESDtrack %5d: Dx:%+7.2f Dy:%+7.2f Dz:%+7.2f Lg: %+8.2f | Tpion:%e\n",
+        GetTrackIndex(),fDx,fDy,fDz,fTrackLength,fIntegratedTimes[AliPID::kPion]); 
+  //
+} 
+
+//___________________________________________
+AliESDTOFMatch & AliESDTOFMatch::operator=(const AliESDTOFMatch& source)
+{
+  // assignment operator
+  if(&source == this) return *this;
+  AliVTOFMatch::operator=(source);
+  fDx = source.fDx;
+  fDy = source.fDy;
+  fDz = source.fDz;
+  fTrackLength = source.fTrackLength;
+  SetTrackIndex(source.GetTrackIndex());
+  for (int i=AliPID::kSPECIESC;i--;)  fIntegratedTimes[i] = source.fIntegratedTimes[i];
+  return *this;
+  //
+}
diff --git a/STEER/ESD/AliESDTOFMatch.h b/STEER/ESD/AliESDTOFMatch.h
new file mode 100644 (file)
index 0000000..10460a3
--- /dev/null
@@ -0,0 +1,52 @@
+#ifndef ALIESDTOFMATCH_H
+#define ALIESDTOFMATCH_H
+
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+/* $Id: $ */
+
+//----------------------------------------------------------------------//
+//                                                                      //
+// AliESDTOFMatch Class                                                 //
+//                                                                      //
+//----------------------------------------------------------------------//
+
+#include "AliVTOFMatch.h"
+
+class AliESDTOFMatch : public AliVTOFMatch
+{
+ public:
+  AliESDTOFMatch();
+  AliESDTOFMatch(Int_t i,Double_t inttimes[AliPID::kSPECIESC],Double_t dx,Double_t dy,Double_t dz,Double_t l);
+  AliESDTOFMatch(AliESDTOFMatch &source);
+  virtual ~AliESDTOFMatch() {}
+  AliESDTOFMatch &operator=(const AliESDTOFMatch& source);
+  virtual Float_t GetDx() const {return fDx;}
+  virtual Float_t GetDy() const {return fDy;}
+  virtual Float_t GetDz() const {return fDz;}
+  virtual Float_t GetTrackLength() const {return fTrackLength;}
+  virtual void SetDx(Double_t delta) {fDx = delta;}
+  virtual void SetDy(Double_t delta) {fDy = delta;}
+  virtual void SetDz(Double_t delta) {fDz = delta;}
+  virtual void SetTrackLength(Double_t length) {fTrackLength = length;}
+  //
+  virtual Double_t GetIntegratedTimes(Int_t i) const {return fIntegratedTimes[i];}
+  virtual void     GetIntegratedTimes(Double_t* t) const {for (int i=AliPID::kSPECIESC;i--;) t[i]=fIntegratedTimes[i];}
+  virtual void     SetIntegratedTimes(Double_t* t)       {for (int i=AliPID::kSPECIESC;i--;) fIntegratedTimes[i]=t[i];}
+  //
+  virtual Int_t GetTrackIndex()           const {return GetUniqueID();}
+  virtual void  SetTrackIndex(Int_t id)         {SetUniqueID(id);}
+  void Print(const Option_t *opt=0) const;
+  
+ protected:
+  Double32_t fDx;                // DeltaX residual
+  Double32_t fDy;                //! DeltaY residual
+  Double32_t fDz;                // DeltaZ residual
+  Double32_t fTrackLength;       // track Length
+  Double32_t fIntegratedTimes[AliPID::kSPECIESC]; // int timex
+  //
+  ClassDef(AliESDTOFMatch, 1) // TOF matchable hit
+    //
+};
+#endif
diff --git a/STEER/STEERBase/AliVTOFHit.cxx b/STEER/STEERBase/AliVTOFHit.cxx
new file mode 100644 (file)
index 0000000..45a356d
--- /dev/null
@@ -0,0 +1,13 @@
+#include "AliVTOFHit.h"
+
+ClassImp(AliVTOFHit)
+
+//________________________________________
+AliVTOFHit & AliVTOFHit::operator=(const AliVTOFHit& source)
+{
+  // assignment op-r
+  if (this == &source) return *this;
+  TObject::operator=(source);
+  return *this;
+}
+
diff --git a/STEER/STEERBase/AliVTOFHit.h b/STEER/STEERBase/AliVTOFHit.h
new file mode 100644 (file)
index 0000000..072bbae
--- /dev/null
@@ -0,0 +1,48 @@
+#ifndef ALIVTOFHIT_H
+#define ALIVTOFHIT_H
+
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+/* $Id: $ */
+
+//----------------------------------------------------------------------//
+//                                                                      //
+// AliVTOFHit Class                                                     //
+//                                                                      //
+//----------------------------------------------------------------------//
+
+#include "TObject.h"
+
+class AliVTOFHit : public TObject 
+{
+ public:
+  AliVTOFHit() {}
+  AliVTOFHit(const AliVTOFHit &source) : TObject(source) {}  
+  virtual ~AliVTOFHit() {}
+  AliVTOFHit & operator=(const AliVTOFHit& source);
+  //
+  virtual Int_t   GetESDTOFClusterIndex()             const {return -1;}
+  virtual void    SetESDTOFClusterIndex(Int_t ) {}
+  
+  virtual void    SetTime(Double_t ) {}
+  virtual void    SetLabel(Int_t *) {}
+  virtual void    SetTimeRaw(Double_t) {}
+  virtual void    SetTOT(Double_t) {}
+  virtual void    SetL0L1Latency(Int_t) {}
+  virtual void    SetDeltaBC(Int_t) {}
+  virtual void    SetTOFchannel(Int_t) {}
+  virtual void    SetClusterIndex(Int_t) {}
+  virtual Double_t GetTime() const {return 0;}
+  virtual Double_t GetTimeRaw() const {return 0;}
+  virtual Double_t GetTOT() const {return 0;};
+  virtual Int_t   GetL0L1Latency() const {return 0;};
+  virtual Int_t   GetTOFLabel(Int_t ) const {return -1;}
+  virtual Int_t   GetDeltaBC() const {return 0;};
+  virtual Int_t   GetTOFchannel() const {return -1;};
+  virtual Int_t   GetClusterIndex() const {return -1;};
+  //
+  ClassDef(AliVTOFHit, 1) // TOF matchable hit
+
+};
+#endif
diff --git a/STEER/STEERBase/AliVTOFMatch.cxx b/STEER/STEERBase/AliVTOFMatch.cxx
new file mode 100644 (file)
index 0000000..b2b4513
--- /dev/null
@@ -0,0 +1,12 @@
+#include "AliVTOFMatch.h"
+
+ClassImp(AliVTOFMatch)
+
+//___________________________________________________
+AliVTOFMatch & AliVTOFMatch::operator=(const AliVTOFMatch& source) 
+{
+  // assignment op-r
+  if (this == &source) return *this;
+  TObject::operator=(source);
+  return *this;
+}
diff --git a/STEER/STEERBase/AliVTOFMatch.h b/STEER/STEERBase/AliVTOFMatch.h
new file mode 100644 (file)
index 0000000..4914a79
--- /dev/null
@@ -0,0 +1,47 @@
+#ifndef ALIVTOFMATCH_H
+#define ALIVTOFMATCH_H
+
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+/* $Id: $ */
+
+//----------------------------------------------------------------------//
+//                                                                      //
+// AliVTOFMatch Class                                                   //
+//                                                                      //
+//----------------------------------------------------------------------//
+
+#include "TObject.h"
+#include "AliPID.h"
+
+class AliVTOFMatch : public TObject
+{
+ public:
+  AliVTOFMatch() {}
+  AliVTOFMatch(AliVTOFMatch &source) : TObject(source) {}
+  virtual ~AliVTOFMatch() {}
+  AliVTOFMatch &operator=(const AliVTOFMatch& source);
+  // 
+  virtual Int_t GetTrackIndex()           const {return -1;}
+  virtual void  SetTrackIndex(Int_t ) {}
+  //
+  virtual Float_t GetDx() const {return 0;};
+  virtual Float_t GetDy() const {return 0;};
+  virtual Float_t GetDz() const {return 0;};
+  virtual Float_t GetTrackLength() const {return 0;};
+  virtual void    GetIntegratedTimes(Double_t *) const {}
+  virtual Double_t GetIntegratedTimes(Int_t) const {return 0;}
+  virtual void    SetIntegratedTimes(Double_t *) {}
+  virtual void    SetDx(Double_t) {};
+  virtual void    SetDy(Double_t) {};
+  virtual void    SetDz(Double_t) {};
+  virtual void    SetTrackLength(Double_t) {};
+  
+  
+ protected:
+  
+  ClassDef(AliVTOFMatch, 1) // TOF matchable hit
+    
+};
+#endif