Prototype for PMD reconstructed hits (AliPMDRecPoint) added.
authormorsch <morsch@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 30 Oct 2000 09:04:00 +0000 (09:04 +0000)
committermorsch <morsch@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 30 Oct 2000 09:04:00 +0000 (09:04 +0000)
PMD/AliPMD.cxx
PMD/AliPMD.h
PMD/AliPMDRecPoint.cxx [new file with mode: 0644]
PMD/AliPMDRecPoint.h [new file with mode: 0644]
PMD/Makefile
PMD/PMDLinkDef.h

index fc3aab8..d75da6e 100644 (file)
@@ -15,6 +15,9 @@
 
 /*
 $Log$
+Revision 1.8  2000/10/20 06:24:40  fca
+Put the PMD at the right position in the event display
+
 Revision 1.7  2000/10/02 21:28:12  fca
 Removal of useless dependecies via forward declarations
 
@@ -51,13 +54,16 @@ Introduction of the Copyright and cvs Log
 
 #include <TBRIK.h>
 #include <TNode.h>
+#include <TTree.h>
 #include <TGeometry.h>
+#include <TClonesArray.h>
 
 #include "AliPMD.h"
 #include "AliRun.h"
 #include "AliMC.h" 
 #include "AliConst.h" 
+#include "AliPMDRecPoint.h"
+  
 ClassImp(AliPMD)
  
 //_____________________________________________________________________________
@@ -81,7 +87,11 @@ AliPMD::AliPMD(const char *name, const char *title)
   // Allocate the array of hits
   fHits   = new TClonesArray("AliPMDhit",  405);
   gAlice->AddHitList(fHits);
+
+  fRecPoints  = new TClonesArray("AliPMDRecPoint",10000); 
+  fNRecPoints = 0;
   
+
   fIshunt =  1;
   
   fPar[0] = 1;
@@ -102,6 +112,15 @@ AliPMD::AliPMD(const char *name, const char *title)
   fPadSize[3] = 1.5;
 }
 
+AliPMD::~AliPMD()
+{
+  //
+  // Default constructor
+  //
+    delete fRecPoints;
+    fNRecPoints=0;
+}
+
 //_____________________________________________________________________________
 void AliPMD::AddHit(Int_t track, Int_t *vol, Float_t *hits)
 {
@@ -217,6 +236,58 @@ void AliPMD::StepManager()
   //
 }
 
+void AliPMD::AddRecPoint(const AliPMDRecPoint &p)
+{
+    //
+    // Add a PMD reconstructed hit to the list
+    //
+    TClonesArray &lrecpoints = *fRecPoints;
+    new(lrecpoints[fNRecPoints++]) AliPMDRecPoint(p);
+}
+
+void AliPMD::MakeBranch(Option_t* option)
+{
+    // Create Tree branches for the PMD
+    printf("Make Branch - TreeR address %p\n",gAlice->TreeR());
+    
+    const Int_t kBufferSize = 4000;
+    char branchname[30];
+
+    AliDetector::MakeBranch(option);
+
+    sprintf(branchname,"%sRecPoints",GetName());
+    if (fRecPoints   && gAlice->TreeR()) {
+       gAlice->TreeR()->Branch(branchname, &fRecPoints, kBufferSize);
+       printf("Making Branch %s for reconstructed hits\n",branchname);
+    }  
+}
+
+
+void AliPMD::SetTreeAddress()
+{
+  // Set branch address for the TreeR
+    char branchname[30];
+    AliDetector::SetTreeAddress();
+
+    TBranch *branch;
+    TTree *treeR = gAlice->TreeR();
+
+    sprintf(branchname,"%s",GetName());
+    if (treeR && fRecPoints) {
+       branch = treeR->GetBranch(branchname);
+       if (branch) branch->SetAddress(&fRecPoints);
+    }
+}
+
+void AliPMD::ResetHits()
+{
+  //
+  // Reset number of hits and the hits array
+  //
+  fNRecPoints   = 0;
+  if (fRecPoints)   fRecPoints->Clear();
+}
+
 ///////////////////////////////////////////////////////////////////////////////
 //                                                                           //
 //  Photon Multiplicity Detector Version 1                                   //
@@ -229,6 +300,8 @@ void AliPMD::StepManager()
 //                                                                           //
 ///////////////////////////////////////////////////////////////////////////////
 
+
+
 ClassImp(AliPMDhit)
   
 //_____________________________________________________________________________
index e0b1254..5a75407 100644 (file)
@@ -12,6 +12,8 @@
 #include "AliDetector.h"
 #include "AliHit.h"
 
+class TClonesArray;
+class AliPMDRecPoint;
 
 class AliPMD : public AliDetector {
   
@@ -24,7 +26,7 @@ protected:
 public:
   AliPMD();
   AliPMD(const char *name, const char *title);
-  virtual      ~AliPMD() {}
+  virtual      ~AliPMD();
   virtual void  AddHit(Int_t, Int_t*, Float_t*);
    virtual void  BuildGeometry();
   virtual void  CreateGeometry() {}
@@ -36,6 +38,14 @@ public:
   virtual void  SetGEO(Float_t, Float_t, Float_t);
   virtual void  SetPadSize(Float_t, Float_t, Float_t, Float_t);
   virtual void  StepManager();
+  virtual void  AddRecPoint(const AliPMDRecPoint &p);
+  virtual void  MakeBranch(Option_t* option);
+  virtual void  SetTreeAddress();
+  virtual void  ResetHits();
+  
+ private:
+  TClonesArray* fRecPoints;   // List of reconstructed hits
+  Int_t         fNRecPoints;  // Number of reconstructed hits
   
   ClassDef(AliPMD,1)  // Base Class for Photon Multiplicity Detector
 };
@@ -70,7 +80,7 @@ public:
           fVolume[0],fVolume[1],fVolume[2],fVolume[3],fTrack,fEnergy);
   }
 
+  
   ClassDef(AliPMDhit,1)  //Hits object for set:PMD
 };
 #endif
diff --git a/PMD/AliPMDRecPoint.cxx b/PMD/AliPMDRecPoint.cxx
new file mode 100644 (file)
index 0000000..73623a2
--- /dev/null
@@ -0,0 +1,139 @@
+/**************************************************************************
+ * 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.                  *
+ **************************************************************************/
+
+/*
+$Log$
+*/
+
+//_________________________________________________________________________
+// Class for PMD reconstructed space points 
+// usually coming from the clusterisation algorithms
+// run on the digits
+//
+//////////////////////////////////////////////////////////////////////////////
+
+// --- ROOT system ---
+
+#include "TObjArray.h"
+
+// --- Standard library ---
+
+// --- AliRoot header files ---
+
+#include "AliPMDRecPoint.h"
+#include "AliGeometry.h"
+#include "AliDigitNew.h"
+
+ClassImp(AliPMDRecPoint)
+
+
+//____________________________________________________________________________
+//____________________________________________________________________________
+void AliPMDRecPoint::AddDigit(AliDigitNew & digit)
+{
+  // adds a digit to the digits list
+  // and accumulates the total amplitude and the multiplicity 
+  
+  
+  if ( fMulDigit >= fMaxDigit ) { // increase the size of the list 
+    int * tempo = new ( int[fMaxDigit*=2] ) ; 
+    
+    Int_t index ; 
+    
+    for ( index = 0 ; index < fMulDigit ; index++ )
+      tempo[index] = fDigitsList[index] ; 
+    
+    delete fDigitsList ; 
+    fDigitsList = tempo ; 
+  }
+  
+  fDigitsList[fMulDigit] = digit.GetIndexInList()  ; 
+  fMulDigit++ ; 
+  fAmp += digit.GetAmp() ; 
+}
+
+//____________________________________________________________________________
+void AliPMDRecPoint::Copy(AliPMDRecPoint& recp) const
+{
+  //
+  // Copy *this onto pts
+  //
+  // Copy all first
+  if(this != &recp) {
+    ((TObject*) this)->Copy((TObject&)recp);
+    recp.fAmp = fAmp;
+    recp.fGeom = fGeom;
+    recp.fIndexInList = fIndexInList;
+    recp.fLocPos = fLocPos;
+    recp.fLocPosM = new TMatrix(*fLocPosM);
+    recp.fMaxDigit = fMaxDigit;
+    recp.fMulDigit = fMulDigit;
+    recp.fMaxTrack = fMaxTrack;
+    recp.fMulTrack = fMulTrack;
+    
+    // Duplicate pointed objects
+    recp.fDigitsList = new Int_t[fMulDigit];
+    memcpy(recp.fDigitsList,fDigitsList,fMulDigit*sizeof(Int_t));
+    recp.fTracksList = new Int_t[fMulTrack];
+    memcpy(recp.fTracksList,fTracksList,fMulTrack*sizeof(Int_t));
+  }
+}
+
+//____________________________________________________________________________
+void AliPMDRecPoint::GetCovarianceMatrix(TMatrix & mat)
+{
+  // returns the covariant matrix for the local position
+  
+  mat = *fLocPosM ; 
+
+}
+
+//____________________________________________________________________________
+void AliPMDRecPoint::GetLocalPosition(TVector3 & pos) const
+{
+  // returns the position of the cluster in the local reference system of the sub-detector
+
+  pos = fLocPos;
+
+}
+
+//____________________________________________________________________________
+AliPMDRecPoint & AliPMDRecPoint::operator= (const AliPMDRecPoint &recp)
+{
+  recp.Copy(*this);
+  return (*this);
+}
+
+
+//____________________________________________________________________________
+void AliPMDRecPoint::GetGlobalPosition(TVector3 & gpos, TMatrix & gmat) const
+{
+  // returns the position of the cluster in the global reference system of ALICE
+  // and the uncertainty on this position
+  
+
+  fGeom->GetGlobal(this, gpos, gmat) ;
+}
+
+
+
+
+
+
+
+
+
diff --git a/PMD/AliPMDRecPoint.h b/PMD/AliPMDRecPoint.h
new file mode 100644 (file)
index 0000000..c20e12b
--- /dev/null
@@ -0,0 +1,44 @@
+#ifndef ALIPMDRECPOINT_H
+#define ALIPMDRECPOINT_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+/* $Id$ */
+
+////////////////////////////////////////////////
+//  PMD Reconstructed Point                   //
+//  Version 0.1                               //
+//                                            //  
+//                                            //
+////////////////////////////////////////////////
+
+#include "AliRecPoint.h"
+
+class AliPMDRecPoint : public AliRecPoint {
+
+public:
+  virtual void  AddDigit(AliDigitNew & digit) ;  // add a digit to the digit's indexes list  
+  //  virtual void  AddTrack(AliTrack & track) ;  // add a track to the tracks list  
+  void  Copy(AliPMDRecPoint &recp) const;
+  virtual void  GetCovarianceMatrix(TMatrix & mat) ;
+  virtual AliGeometry * GetGeom() const { return fGeom; } 
+  virtual void  GetGlobalPosition(TVector3 & gpos, TMatrix & gmat) const ; // return global position in ALICE
+  virtual int * GetDigitsList(void) const { return fDigitsList ; }
+  //  virtual int * GetTracksList(void) const { return fTracksList ; }
+  virtual Float_t GetEnergy() const {return fAmp; } 
+  virtual void  GetLocalPosition(TVector3 & pos) const ;
+  virtual Int_t GetDigitsMultiplicity(void) const { return fMulDigit ; }
+  Int_t         GetIndexInList() const { return fIndexInList ; } 
+  virtual Int_t GetMaximumDigitMultiplicity() const { return  fMaxDigit; } 
+  virtual Int_t GetMaximumTrackMultiplicity() const { return  fMaxTrack; } 
+  virtual Int_t GetTracksMultiplicity(void) const { return fMulTrack ; }
+  virtual void  Print(Option_t * opt = "void") {;}
+  
+  AliPMDRecPoint & operator= (const AliPMDRecPoint &recp);
+  void          SetIndexInList(Int_t val) { fIndexInList = val ; } 
+//
+  ClassDef(AliPMDRecPoint,1) // Base class for reconstructed space points
+};
+
+#endif // ALIPMDRECPOINT_H
index 4aa818a..b85d102 100644 (file)
@@ -9,11 +9,13 @@ PACKAGE = PMD
 
 # C++ sources
 
-SRCS          = AliPMD.cxx AliPMDv0.cxx AliPMDv1.cxx AliPMDv2.cxx
+SRCS          = AliPMD.cxx AliPMDv0.cxx AliPMDv1.cxx AliPMDv2.cxx AliPMDRecPoint.cxx
 
 # C++ Headers
 
-HDRS          = $(SRCS:.cxx=.h) PMDLinkDef.h
+HDRS    = $(SRCS:.cxx=.h) \
+       $(ROOTSYS)/include/TClonesArray.h \
+       PMDLinkDef.h
 
 # Library dictionary
 
index 0cbcb55..50137bf 100644 (file)
@@ -13,5 +13,5 @@
 #pragma link C++ class  AliPMDv1;
 #pragma link C++ class  AliPMDv2;
 #pragma link C++ class  AliPMDhit;
-
+#pragma link C++ class  AliPMDRecPoint;
 #endif