/*
$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
#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)
//_____________________________________________________________________________
// 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;
fPadSize[3] = 1.5;
}
+AliPMD::~AliPMD()
+{
+ //
+ // Default constructor
+ //
+ delete fRecPoints;
+ fNRecPoints=0;
+}
+
//_____________________________________________________________________________
void AliPMD::AddHit(Int_t track, Int_t *vol, Float_t *hits)
{
//
}
+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 //
// //
///////////////////////////////////////////////////////////////////////////////
+
+
ClassImp(AliPMDhit)
//_____________________________________________________________________________
#include "AliDetector.h"
#include "AliHit.h"
+class TClonesArray;
+class AliPMDRecPoint;
class AliPMD : public AliDetector {
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() {}
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
};
fVolume[0],fVolume[1],fVolume[2],fVolume[3],fTrack,fEnergy);
}
-
+
ClassDef(AliPMDhit,1) //Hits object for set:PMD
};
#endif
--- /dev/null
+/**************************************************************************
+ * 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) ;
+
+}
+
+
+
+
+
+
+
+
+
--- /dev/null
+#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
# 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
#pragma link C++ class AliPMDv1;
#pragma link C++ class AliPMDv2;
#pragma link C++ class AliPMDhit;
-
+#pragma link C++ class AliPMDRecPoint;
#endif