/*
$Log$
+Revision 1.17.2.1 2000/05/08 14:28:59 cblume
+Introduced SetPHOShole() and SetRICHhole(). AliTRDrecPoint container is now a TObjArray
+
+Revision 1.17 2000/02/28 19:10:26 cblume
+Include the new TRD classes
+
Revision 1.16.2.2 2000/02/28 17:53:24 cblume
Introduce TRD geometry classes
// //
// Transition Radiation Detector //
// This class contains the basic functions for the Transition Radiation //
-// Detector, as well as the geometry. //
-// Functions specific to one particular geometry are contained in the //
-// derived classes. //
-// //
-//Begin_Html
-/*
-<img src="picts/AliTRDClass.gif">
-*/
-//End_Html
-// //
+// Detector. //
// //
///////////////////////////////////////////////////////////////////////////////
}
// Allocate the hit array
- fHits = new TClonesArray("AliTRDhit" , 405);
+ fHits = new TClonesArray("AliTRDhit" ,405);
gAlice->AddHitList(fHits);
// Allocate the digits array
fDigits = 0;
// Allocate the rec point array
- fRecPoints = new TClonesArray("AliTRDrecPoint", 400);
+ fRecPoints = new TObjArray(400);
fNRecPoints = 0;
fIshunt = 0;
//
// Add a reconstructed point for the TRD
//
-
- TClonesArray &lRecPoints = *fRecPoints;
- AliTRDrecPoint *RecPoint = new(lRecPoints[fNRecPoints++]) AliTRDrecPoint();
+
+ AliTRDrecPoint *RecPoint = new AliTRDrecPoint();
TVector3 posVec(pos[0],pos[1],pos[2]);
RecPoint->SetLocalPosition(posVec);
RecPoint->SetDetector(det);
- RecPoint->SetAmplitude(amp);
+ RecPoint->SetEnergy(amp);
for (Int_t iDigit = 0; iDigit < 3; iDigit++) {
RecPoint->AddDigit(digits[iDigit]);
}
+ fRecPoints->Add(RecPoint);
+
}
//_____________________________________________________________________________
//
TClonesArray &ldigits = *fDigits;
- new(ldigits[fNdigits++]) AliTRDdigit(digits);
+ new(ldigits[fNdigits++]) AliTRDdigit(kFALSE,digits);
}
gMC->Gsatt("BTR2","SEEN", 0);
gMC->Gsatt("BTR3","SEEN", 0);
gMC->Gsatt("TRD1","SEEN", 0);
+ if (fGeometry->GetPHOShole())
+ gMC->Gsatt("TRD2","SEEN", 0);
+ if (fGeometry->GetRICHhole())
+ gMC->Gsatt("TRD3","SEEN", 0);
}
gMC->Gsatt("UCII","SEEN", 0);
gMC->Gsatt("UCIM","SEEN", 0);
printf("\n");
if (fGeometry->IsVersion() == 0) {
- printf(" Geometry with holes initialized.\n\n");
+ printf(" Geometry for spaceframe with holes initialized.\n\n");
}
else if (fGeometry->IsVersion() == 1) {
- printf(" Geometry without holes initialized.\n\n");
+ printf(" Geometry for spaceframe without holes initialized.\n");
+ if (fGeometry->GetPHOShole())
+ printf(" Leave space in front of PHOS free.\n");
+ if (fGeometry->GetRICHhole())
+ printf(" Leave space in front of RICH free.\n");
+ printf("\n");
}
if (fGasMix == 1)
AliDetector::MakeBranch(option);
- //Char_t *D = strstr(option,"D");
- //sprintf(branchname,"%s",GetName());
- //if (fDigits && gAlice->TreeD() && D) {
- // gAlice->TreeD()->Branch(branchname,&fDigits, buffersize);
- // printf("* AliTRD::MakeBranch * Making Branch %s for digits in TreeD\n",branchname);
- //}
-
Char_t *R = strstr(option,"R");
sprintf(branchname,"%srecPoints",GetName());
if (fRecPoints && gAlice->TreeR() && R) {
- gAlice->TreeR()->Branch(branchname,&fRecPoints,buffersize);
+ gAlice->TreeR()->Branch(branchname,fRecPoints->IsA()->GetName()
+ ,&fRecPoints,buffersize,0);
printf("* AliTRD::MakeBranch * Making Branch %s for points in TreeR\n",branchname);
}
//
fNRecPoints = 0;
- if (fRecPoints) fRecPoints->Clear();
+ if (fRecPoints) fRecPoints->Delete();
}
}
-//______________________________________________________________________________
-void AliTRD::Streamer(TBuffer &R__b)
-{
- //
- // Stream an object of class AliTRD.
- //
-
- if (R__b.IsReading()) {
- Version_t R__v = R__b.ReadVersion(); if (R__v) { }
- AliDetector::Streamer(R__b);
- R__b >> fGasMix;
- R__b >> fGeometry;
- // Stream the pointers but not the TClonesArray
- R__b >> fRecPoints; // diff
- }
- else {
- R__b.WriteVersion(AliTRD::IsA());
- AliDetector::Streamer(R__b);
- R__b << fGasMix;
- R__b << fGeometry;
- // Stream the pointers but not the TClonesArrays
- R__b << fRecPoints; // diff
- }
-
-}
-
-ClassImp(AliTRDhit)
-
-//_____________________________________________________________________________
-AliTRDhit::AliTRDhit(Int_t shunt, Int_t track, Int_t det, Float_t *hits)
- :AliHit(shunt, track)
-{
- //
- // Create a TRD hit
- //
-
- // Store volume hierarchy
- fDetector = det;
-
- // Store position and charge
- fX = hits[0];
- fY = hits[1];
- fZ = hits[2];
- fQ = hits[3];
-
-}
-
#include "AliRun.h"
#include "AliDetector.h"
-#include "AliHit.h"
+#include "AliTRDhit.h"
#include "AliDigit.h"
#include "AliTRDconst.h"
-//#include "AliTRDgeometry.h"
-
-class AliTRDgeometry;
+#include "AliTRDgeometry.h"
//_____________________________________________________________________________
class AliTRD : public AliDetector {
virtual void CreateMaterials();
virtual void DrawModule();
Int_t DistancetoPrimitive(Int_t px, Int_t py);
- TClonesArray *RecPoints() { return fRecPoints; };
+ TObjArray *RecPoints() { return fRecPoints; };
virtual void Init();
virtual Int_t IsVersion() const = 0;
virtual void MakeBranch(Option_t* option);
virtual void SetGasMix(Int_t imix = 0);
virtual void SetHits(Int_t ihit = 1) {};
+ virtual void SetPHOShole() { fGeometry->SetPHOShole(); };
+ virtual void SetRICHhole() { fGeometry->SetRICHhole(); };
AliTRDgeometry *GetGeometry() { return fGeometry; };
+ virtual void SetSensChamber(Int_t ichamber) = 0;
+ virtual void SetSensPlane(Int_t iplane) = 0;
+ virtual void SetSensSector(Int_t isector) = 0;
+
virtual Int_t GetSensChamber() = 0;
virtual Int_t GetSensPlane() = 0;
virtual Int_t GetSensSector() = 0;
protected:
- Int_t fGasMix; // Gas mixture. 0: Xe/Isobutane 1: Xe/CO2
+ Int_t fGasMix; // Gas mixture. 0: Xe/Isobutane 1: Xe/CO2
- AliTRDgeometry *fGeometry; // The TRD geometry
+ AliTRDgeometry *fGeometry; // The TRD geometry
- TClonesArray *fRecPoints; // List of reconstructed points
+ TObjArray *fRecPoints; // Array of reconstructed points
Int_t fNRecPoints; //! Number of reconstructed points
- ClassDef(AliTRD,1) // Transition Radiation Detector base class
-
-};
-
-//_____________________________________________________________________________
-class AliTRDhit : public AliHit {
-
-public:
- Int_t fDetector; // TRD detector number
- Float_t fQ; // Charge created by a hit (slow simulator only)
-
-public:
- AliTRDhit() {}
- AliTRDhit(Int_t shunt, Int_t track, Int_t det, Float_t *hits);
- virtual ~AliTRDhit() {};
-
- ClassDef(AliTRDhit,2) // Hits for Transition Radiation Detector
+ ClassDef(AliTRD,1) // Transition Radiation Detector base class
};
--- /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$
+Revision 1.1.2.1 2000/05/08 14:35:38 cblume
+Add float array
+
+*/
+
+///////////////////////////////////////////////////////////////////////
+// //
+// Added additional functionality to the original TArrayF. //
+// - Multiple inheritance from TObject //
+// - Function Expand() allows to expand the array without //
+// deleting the array contents //
+// //
+// Origin: Marian Ivanov, Uni. of Bratislava, ivanov@fmph.uniba.sk //
+// //
+///////////////////////////////////////////////////////////////////////
+
+#include "AliTRDarrayF.h"
+
+ClassImp(AliTRDarrayF)
+
+//_____________________________________________________________________________
+AliTRDarrayF::~AliTRDarrayF()
+{
+ //
+ // Default destructor
+ //
+
+}
+
+//_____________________________________________________________________________
+void AliTRDarrayF::Expand(Int_t n)
+{
+ //
+ // Sets the array size of the TArrayF object to <n> integers and copies
+ // the old array.
+ // If n < 0 leave the array unchanged.
+ // The user is responsible for the appropriate size of the array.
+ //
+
+ if (n < 0) return;
+ fArray = (Float_t*) TStorage::ReAlloc(fArray
+ ,n * sizeof(Float_t)
+ ,fN * sizeof(Float_t));
+ if (fArray != 0) fN = n;
+
+}
+
--- /dev/null
+#ifndef AliTRDArrayF_H
+#define AliTRDArrayF_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice */
+
+/* $Id: AliTRDarrayF.h,v */
+
+#include "TObject.h"
+#include "TArrayF.h"
+
+class AliTRDarrayF: public TObject ,public TArrayF {
+
+public:
+
+ ~AliTRDarrayF();
+ void Expand(Int_t n);
+
+ ClassDef(AliTRDarrayF,1)
+
+};
+
+#endif
+
/*
$Log$
+Revision 1.1.4.1 2000/05/08 14:35:54 cblume
+Update
+
+Revision 1.1 2000/02/28 18:57:18 cblume
+Add new TRD classes
+
*/
///////////////////////////////////////////////////////////////////////
-// Added additional functionality to original TArrayI //
-// multiple inheritance from TObject to be possible use automatic //
-// branch mechanism for tree //
-// function Expand to be possible expand array without deleting //
-// array contents //
+// //
+// Added additional functionality to the original TArrayI. //
+// - Multiple inheritance from TObject //
+// - Function Expand() allows to expand the array without //
+// deleting the array contents //
// //
-// Origin: Marian Ivanov, Uni. of Bratislava, ivanov@fmph.uniba.sk //
+// Origin: Marian Ivanov, Uni. of Bratislava, ivanov@fmph.uniba.sk //
// //
///////////////////////////////////////////////////////////////////////
ClassImp(AliTRDarrayI)
+//_____________________________________________________________________________
AliTRDarrayI::~AliTRDarrayI()
{
//
- //default destructor
+ // Default destructor
+ //
+
}
+//_____________________________________________________________________________
void AliTRDarrayI::Expand(Int_t n)
{
//
- // Set array size of TArrayI object to n integers and copy old array
- // If n<0 leave array unchanged.
- // user are responsible for appopiate size of array
+ // Sets the array size of the TArrayI object to <n> integers and copies
+ // the old array.
+ // If n < 0 leave the array unchanged.
+ // The user is responsible for the appropriate size of the array.
//
+
if (n < 0) return;
- fArray = (Int_t*) TStorage::ReAlloc(fArray, n * sizeof(Int_t),fN * sizeof(Int_t));
- if (fArray!=0) fN= n;
+ fArray = (Int_t*) TStorage::ReAlloc(fArray
+ ,n * sizeof(Int_t)
+ ,fN * sizeof(Int_t));
+ if (fArray != 0) fN = n;
+
}
/*
$Log$
+Revision 1.1.4.1 2000/05/08 15:08:03 cblume
+Remove the class AliTRDcluster
+
+Revision 1.1 2000/02/28 18:57:58 cblume
+Add new TRD classes
+
*/
///////////////////////////////////////////////////////////////////////////////
return kTRUE;
}
-
-ClassImp(AliTRDcluster)
-
-//_____________________________________________________________________________
-AliTRDcluster::AliTRDcluster(Int_t *tracks, Int_t *cluster, Float_t energy, Float_t* position)
- :TObject()
-{
- //
- // Create a TRD cluster
- //
-
- fDetector = cluster[0];
-
- fTimeSlice = cluster[1];
- fEnergy = energy;
-
- fX = position[0];
- fY = position[1];
- fZ = position[2];
-
- fTracks[0] = tracks[0];
- fTracks[1] = tracks[1];
- fTracks[2] = tracks[2];
-
-}
};
-//_____________________________________________________________________________
-class AliTRDcluster : public TObject {
-
-public:
-
- Int_t fDetector; // TRD detector number
-
- Int_t fTimeSlice; // Timeslice in chamber where cluster has been found
- Float_t fEnergy; // Charge sum of this cluster
-
- Float_t fX; // X coord in ALICE reference frame
- Float_t fY; // Y coord in ALICE reference frame
- Float_t fZ; // Z coord in ALICE reference frame
-
- Int_t fTracks[3]; // Track information
-
-public:
-
- AliTRDcluster() {};
- AliTRDcluster(Int_t *tracks, Int_t *cluster, Float_t energy, Float_t *pos);
- virtual ~AliTRDcluster() {};
-
- inline virtual Int_t *GetTracks() { return &fTracks[0]; }
-
- ClassDef(AliTRDcluster,1) // Cluster for Transition Radiation Detector
-
-};
-
#endif
/*
$Log$
+Revision 1.1.4.1 2000/05/08 15:08:41 cblume
+Replace AliTRDcluster by AliTRDrecPoint
+
+Revision 1.1 2000/02/28 18:58:33 cblume
+Add new TRD classes
+
*/
///////////////////////////////////////////////////////////////////////////////
for (Int_t iplan = 0; iplan < kNplan; iplan++) {
for (Int_t isect = 0; isect < kNsect; isect++) {
- Int_t nColMax = Geo->GetColMax(iplan);
- Float_t row0 = Geo->GetRow0(iplan,icham,isect);
- Float_t col0 = Geo->GetCol0(iplan);
+ Int_t nColMax = Geo->GetColMax(iplan);
+ Float_t row0 = Geo->GetRow0(iplan,icham,isect);
+ Float_t col0 = Geo->GetCol0(iplan);
+ Float_t time0 = Geo->GetTime0(iplan);
- Float_t rowPadSize = Geo->GetRowPadSize();
- Float_t colPadSize = Geo->GetColPadSize();
+ Float_t rowPadSize = Geo->GetRowPadSize();
+ Float_t colPadSize = Geo->GetColPadSize();
+ Float_t timeBinSize = Geo->GetTimeBinSize();
// Loop through all entries in the tree
for (Int_t iTrack = 0; iTrack < nTrack; iTrack++) {
Float_t rot[3];
Geo->Rotate(detector,pos,rot);
- // Add this cluster to the temporary cluster-array for this chamber
- Int_t tracks[3];
- tracks[0] = track;
- Int_t clusters[2];
- clusters[0] = detector;
- clusters[1] = 0;
- Float_t position[3];
- position[0] = rot[2];
- position[1] = rot[1];
- position[2] = rot[0];
- AliTRDcluster *Cluster = new AliTRDcluster(tracks,clusters,0,position);
- Chamber->Add(Cluster);
+ // Add this recPoint to the temporary array for this chamber
+ AliTRDrecPoint *RecPoint = new AliTRDrecPoint();
+ RecPoint->SetLocalRow(rot[2]);
+ RecPoint->SetLocalCol(rot[1]);
+ RecPoint->SetLocalTime(rot[0]);
+ RecPoint->SetEnergy(0);
+ RecPoint->SetDetector(detector);
+ RecPoint->AddDigit(track);
+ Chamber->Add(RecPoint);
}
// Loop through the temporary cluster-array
for (Int_t iClus1 = 0; iClus1 < Chamber->GetEntries(); iClus1++) {
- AliTRDcluster *Cluster1 = (AliTRDcluster *) Chamber->UncheckedAt(iClus1);
- Float_t x1 = Cluster1->fX;
- Float_t y1 = Cluster1->fY;
- Float_t z1 = Cluster1->fZ;
+ AliTRDrecPoint *RecPoint1 = (AliTRDrecPoint *) Chamber->UncheckedAt(iClus1);
+ Float_t row1 = RecPoint1->GetLocalRow();
+ Float_t col1 = RecPoint1->GetLocalCol();
+ Float_t time1 = RecPoint1->GetLocalTime();
- if (!(z1)) continue; // Skip marked cluster
+ if (RecPoint1->GetEnergy() < 0) continue; // Skip marked cluster
- const Int_t nSave = 2;
+ const Int_t nSave = 5;
Int_t idxSave[nSave];
Int_t iSave = 0;
- Int_t tracks[3];
- tracks[0] = Cluster1->fTracks[0];
+ const Int_t nTrack = 3;
+ Int_t tracks[nTrack];
+ tracks[0] = RecPoint1->GetDigit(0);
// Check the other cluster to see, whether there are close ones
for (Int_t iClus2 = iClus1 + 1; iClus2 < Chamber->GetEntries(); iClus2++) {
- AliTRDcluster *Cluster2 = (AliTRDcluster *) Chamber->UncheckedAt(iClus2);
- Float_t x2 = Cluster2->fX;
- Float_t y2 = Cluster2->fY;
- if ((TMath::Abs(x1 - x2) < rowPadSize) ||
- (TMath::Abs(y1 - y2) < fRphiDist)) {
+
+ AliTRDrecPoint *RecPoint2 = (AliTRDrecPoint *) Chamber->UncheckedAt(iClus2);
+ Float_t row2 = RecPoint2->GetLocalRow();
+ Float_t col2 = RecPoint2->GetLocalCol();
+
+ if ((TMath::Abs(row1 - row2) < rowPadSize) ||
+ (TMath::Abs(col1 - col2) < fRphiDist)) {
if (iSave == nSave) {
printf("AliTRDclusterizerV0::MakeCluster -- ");
printf("Boundary error: iSave = %d, nSave = %d.\n"
,iSave,nSave);
}
- else {
+ else {
idxSave[iSave] = iClus2;
- tracks[iSave+1] = Cluster2->fTracks[0];
+ iSave++;
+ if (iSave < nTrack) tracks[iSave] = RecPoint2->GetDigit(0);
}
- iSave++;
}
}
// Merge close cluster
- Float_t yMerge = y1;
- Float_t xMerge = x1;
+ Float_t rowMerge = row1;
+ Float_t colMerge = col1;
if (iSave) {
for (Int_t iMerge = 0; iMerge < iSave; iMerge++) {
- AliTRDcluster *Cluster2 =
- (AliTRDcluster *) Chamber->UncheckedAt(idxSave[iMerge]);
- xMerge += Cluster2->fX;
- yMerge += Cluster2->fY;
- Cluster2->fZ = 0; // Mark merged cluster
+ AliTRDrecPoint *RecPoint2 =
+ (AliTRDrecPoint *) Chamber->UncheckedAt(idxSave[iMerge]);
+ rowMerge += RecPoint2->GetLocalRow();
+ colMerge += RecPoint2->GetLocalCol();
+ RecPoint2->SetEnergy(-1); // Mark merged cluster
}
- xMerge /= (iSave + 1);
- yMerge /= (iSave + 1);
+ rowMerge /= (iSave + 1);
+ colMerge /= (iSave + 1);
}
Float_t smear[3];
- // The position smearing in z-direction (uniform over pad width)
- Int_t row = (Int_t) ((xMerge - row0) / rowPadSize);
+ // The position smearing in row-direction (uniform over pad width)
+ Int_t row = (Int_t) ((rowMerge - row0) / rowPadSize);
smear[0] = (row + gRandom->Rndm()) * rowPadSize + row0;
// The position smearing in rphi-direction (Gaussian)
smear[1] = 0;
do
- smear[1] = gRandom->Gaus(yMerge,fRphiSigma);
+ smear[1] = gRandom->Gaus(colMerge,fRphiSigma);
while ((smear[1] < col0 ) ||
(smear[1] > col0 + nColMax * colPadSize));
// Time direction stays unchanged
- smear[2] = z1;
+ smear[2] = time1;
+
+ // Transform into local coordinates
+ smear[0] = (Int_t) ((smear[0] - row0) / rowPadSize);
+ smear[1] = (Int_t) ((smear[1] - col0) / colPadSize);
+ smear[2] = (Int_t) ((smear[2] - time0) / timeBinSize);
// Add the smeared cluster to the output array
- Int_t detector = Cluster1->fDetector;
+ Int_t detector = RecPoint1->GetDetector();
Int_t digits[3] = {0};
TRD->AddRecPoint(smear,digits,detector,0.0);
/*
$Log$
+Revision 1.1.4.1 2000/05/08 15:09:01 cblume
+Introduce AliTRDdigitsManager
+
Revision 1.1 2000/02/28 18:58:54 cblume
Add new TRD classes
#include "AliTRDgeometry.h"
#include "AliTRDdigitizer.h"
#include "AliTRDrecPoint.h"
-#include "AliTRDdataArray.h"
+#include "AliTRDdataArrayF.h"
ClassImp(AliTRDclusterizerV1)
// AliTRDclusterizerV1 default constructor
//
- fDigitsArray = NULL;
+ fDigitsManager = NULL;
}
// AliTRDclusterizerV1 default constructor
//
- fDigitsArray = NULL;
+ fDigitsManager = new AliTRDdigitsManager();
Init();
AliTRDclusterizerV1::~AliTRDclusterizerV1()
{
- if (fDigitsArray) {
- fDigitsArray->Delete();
- delete fDigitsArray;
+ if (fDigitsManager) {
+ delete fDigitsManager;
}
}
return kFALSE;
}
- // Create a new segment array for the digits
- fDigitsArray = new AliTRDsegmentArray(kNsect*kNplan*kNcham);
-
// Read in the digit arrays
- return (fDigitsArray->LoadArray("TRDdigits"));
+ return (fDigitsManager->ReadDigits());
}
printf("AliTRDclusterizerV1::MakeCluster -- ");
printf("Start creating clusters.\n");
- AliTRDdataArray *Digits;
+ AliTRDdataArrayI *Digits;
// Parameters
Float_t maxThresh = fClusMaxThresh; // threshold value for maximum
Int_t chamEnd = kNcham;
if (TRD->GetSensChamber() >= 0) {
chamBeg = TRD->GetSensChamber();
- chamEnd = chamEnd + 1;
+ chamEnd = chamBeg + 1;
}
Int_t planBeg = 0;
Int_t planEnd = kNplan;
,isect,icham,iplan);
// Read in the digits
- Digits = (AliTRDdataArray *) fDigitsArray->At(idet);
+ Digits = fDigitsManager->GetDigits(idet);
// Loop through the detector pixel
for (time = 0; time < nTimeMax; time++) {
/* $Id$ */
#include "AliTRD.h"
-#include "AliTRDsegmentArray.h"
+#include "AliTRDdigitsManager.h"
#include "AliTRDclusterizer.h"
///////////////////////////////////////////////////////
virtual Bool_t MakeCluster();
virtual Bool_t ReadDigits();
- virtual void SetDigitsArray(AliTRDsegmentArray *Array) { fDigitsArray = Array; };
-
virtual void SetClusMaxThresh(Float_t thresh) { fClusMaxThresh = thresh; };
virtual void SetClusSigThresh(Float_t thresh) { fClusSigThresh = thresh; };
virtual void SetClusMethod(Int_t meth) { fClusMethod = meth; };
protected:
- AliTRDsegmentArray *fDigitsArray; //! Array of detector segments containing the digits
+ AliTRDdigitsManager *fDigitsManager; //! TRD digits manager
- Float_t fClusMaxThresh; // Threshold value for cluster maximum
- Float_t fClusSigThresh; // Threshold value for cluster signal
- Int_t fClusMethod; // Clustering method
+ Float_t fClusMaxThresh; // Threshold value for cluster maximum
+ Float_t fClusSigThresh; // Threshold value for cluster signal
+ Int_t fClusMethod; // Clustering method
private:
const Int_t kNsect = 18; // Number of sectors in the full detector
const Int_t kNplan = 6; // Number of planes of the TRD
const Int_t kNcham = 5; // Number of chambers in z-direction
+const Int_t kNdet = kNsect * kNplan * kNcham;
const Float_t kRmin = 294.0; // r-dimensions of the TRD
const Float_t kRmax = 368.0;
/*
$Log$
+Revision 1.1.4.1 2000/05/08 15:13:59 cblume
+Introduce boundary checking
+
+Revision 1.1 2000/02/28 18:59:19 cblume
+Add new TRD classes
+
*/
///////////////////////////////////////////////////////////////////////////////
// //
-// General container for data of a TRD detector segment. //
+// Base class of a general container for data of a TRD detector segment. //
// Adapted from AliDigits (origin: M.Ivanov). //
-// The main difference is that we used 4 byte integer, so that this class //
-// can also be used as a dictionary between digits and MC particles. //
// //
///////////////////////////////////////////////////////////////////////////////
// Default constructor
//
- fIndex = 0;
- fElements = 0;
- fThreshold = 0;
- Reset();
+ fIndex = 0;
+
+ fNdim1 = -1;
+ fNdim2 = -1;
+ fNelems = -1;
+
+ fBufType = -1;
+
+ fNrow = 0;
+ fNcol = 0;
+ fNtime = 0;
}
//_____________________________________________________________________________
-AliTRDdataArray::~AliTRDdataArray()
+AliTRDdataArray::AliTRDdataArray(Int_t nrow, Int_t ncol, Int_t ntime)
{
//
- // Destructor
+ // Creates a AliTRDdataArray with the dimensions <nrow>, <ncol>, and <ntime>.
+ // The row- and column dimensions are compressible.
//
- if (fIndex) fIndex->Delete();;
- if (fElements) fElements->Delete();
-
-}
+ Allocate(nrow,ncol,ntime);
+}
//_____________________________________________________________________________
-void AliTRDdataArray::Reset()
-{
+AliTRDdataArray::~AliTRDdataArray()
+{
//
- // Reset the array (old content gets deleted)
+ // Destructor
//
- if (fIndex) delete fIndex;
- fIndex = new AliTRDarrayI;
+ if (fIndex) fIndex->Delete();
- if (fElements) delete fElements;
- fElements = new AliTRDarrayI;
-
- fNdim1 = fNdim2 = fNelems = -1;
- fElements->Set(0);
- fIndex->Set(0);
- fBufType = -1;
-
- fNrow = 0;
- fNcol = 0;
- fNtime = 0;
-
}
//_____________________________________________________________________________
-void AliTRDdataArray::Allocate(Int_t nrow, Int_t ncol, Int_t ntime)
+void AliTRDdataArray::Allocate(Int_t nrow, Int_t ncol,Int_t ntime)
{
//
- // Allocate an empty buffer of the size <nrow> x <ncol> x <ntime>
+ // Allocates memory for a AliTRDdataArray with the dimensions
+ // <nrow>, <ncol>, and <ntime>.
+ // The row- and column dimensions are compressible.
//
- Reset();
-
if (nrow <= 0) {
Error("AliTRDdataArray::Allocate","The number of rows has to be positive");
- return;
+ exit(1);
}
if (ncol <= 0) {
Error("AliTRDdataArray::Allocate","The number of columns has to be positive");
- return;
+ exit(1);
}
if (ntime <= 0) {
Error("AliTRDdataArray::Allocate","The number of timebins has to be positive");
- return;
+ exit(1);
}
// The two-dimensional array row/column gets mapped into the first
fNcol = ncol;
fNtime = ntime;
- fElements->Set(fNelems);
+ if (fIndex) delete fIndex;
+ fIndex = new AliTRDarrayI;
fIndex->Set(fNdim2);
-
for (Int_t i = 0, k = 0; i < fNdim2; i++, k += fNdim1) {
(*fIndex)[i] = k;
}
}
//_____________________________________________________________________________
-Int_t AliTRDdataArray::GetSize()
-{
- //
- // Returns the size of the complete object
- //
-
- Int_t size = sizeof(this);
-
- if (fIndex) size += sizeof(fIndex)
- + fIndex->GetSize() * sizeof(Int_t);
- if (fElements) size += sizeof(fElements)
- + fElements->GetSize() * sizeof(Int_t);
-
- return size;
-
-}
-
-//_____________________________________________________________________________
-Int_t AliTRDdataArray::GetDataSize()
-{
- //
- // Returns the size of only the data part
- //
-
- if (fElements == 0)
- return 0;
- else
- return sizeof(fElements) + fElements->GetSize() * sizeof(Int_t);
-
-}
-
-//_____________________________________________________________________________
-Int_t AliTRDdataArray::GetOverThreshold(Float_t threshold)
-{
- //
- // Returns the number of entries over threshold
- //
-
- if ((fElements == 0) || (fElements->GetSize() <= 0))
- return 0;
-
- Int_t over = 0;
-
- for (Bool_t cont = First(); cont == kTRUE; cont = Next()) {
- if ((fCurrentIdx1 < 0) || (fCurrentIdx1 > fNdim1)) continue;
- if ((fCurrentIdx2 < 0) || (fCurrentIdx2 > fNdim2)) continue;
- if (fElements->At(fCurrentIndex) > threshold) over++;
- }
-
- return over;
-
-}
-
-//_____________________________________________________________________________
-Int_t AliTRDdataArray::GetData(Int_t row, Int_t col, Int_t time)
-{
- //
- // Returns the data value at a given position of the array
- //
-
- if (fBufType == 0) return GetDataFast(GetIdx1(row,col),time);
- if (fBufType == 1) return GetData1(GetIdx1(row,col),time);
-
- return 0;
-
-}
-
-//_____________________________________________________________________________
-void AliTRDdataArray::SetData(Int_t row, Int_t col, Int_t time, Int_t value)
-{
- //
- // Sets the data value at a given position of the array
- //
-
- SetDataFast(GetIdx1(row,col),time,value);
-
-}
-
-//_____________________________________________________________________________
-void AliTRDdataArray::Expand()
-{
- //
- // Expands the compressed buffer
- //
-
- if (fBufType < 0) {
- Error("AliTRDdataArray::Expand","Buffer does not exist");
- return;
- }
- if (fBufType == 0) {
- return;
- }
-
- // Expand a buffer of type 1
- if (fBufType == 1) Expand1();
-
- fBufType = 0;
-
-}
-
-//_____________________________________________________________________________
-void AliTRDdataArray::Compress(Int_t bufferType)
-{
- //
- // Compresses the buffer
- //
-
- if (fBufType < 0) {
- Error("AliTRDdataArray::Compress","Buffer does not exist");
- return;
- }
- if (fBufType == bufferType) {
- return;
- }
- if (fBufType > 0) {
- Expand();
- }
- if (fBufType !=0) {
- Error("AliTRDdataArray::Compress","Buffer does not exist");
- return;
- }
-
- // Compress a buffer of type 1
- if (bufferType == 1) {
- Compress1();
- }
-
-}
-
-//_____________________________________________________________________________
-void AliTRDdataArray::Compress(Int_t bufferType, Int_t threshold)
-{
- //
- // Compresses the buffer
- //
-
- fThreshold = threshold;
- Compress(bufferType);
-
-}
-
-//_____________________________________________________________________________
-Bool_t AliTRDdataArray::First()
-{
- //
- // Returns the position of the first valid data value
- //
-
- if (fBufType == 0) return First0();
- if (fBufType == 1) return First1();
- return kFALSE;
-
-}
-
-//_____________________________________________________________________________
-Bool_t AliTRDdataArray::Next()
-{
- //
- // Returns the position of the next valid data value
- //
-
- if (fBufType == 0) return Next0();
- if (fBufType == 1) return Next1();
- return kFALSE;
-
-}
-
-//_____________________________________________________________________________
-void AliTRDdataArray::Expand1()
-{
- //
- // Expands a buffer of type 1
- //
-
- Int_t i, k;
-
- fNelems = fNdim1 * fNdim2;
-
- Int_t *buf = new Int_t[fNelems];
-
- fIndex->Set(fNdim2);
-
- for (i = 0, k = 0; i < fNdim2; i++, k += fNdim1) (*fIndex)[i] = k;
-
- Int_t idx1 = 0;
- Int_t idx2 = 0;
- Int_t N = fElements->fN;
-
- for (i = 0; i < N; i++){
-
- // Negative sign counts the unwritten values (under threshold)
- if ((*fElements)[i] < 0) {
- idx1 -= fElements->At(i);
- }
- else {
- buf[(*fIndex)[idx2] + idx1] = fElements->At(i);
- idx1++;
- }
- if (idx1 == fNdim1) {
- idx1 = 0;
- idx2++;
- }
- else {
- if (idx1 > fNdim1){
- Reset();
- return;
- }
- }
- }
-
- fElements->Adopt(fNelems,buf);
-
-}
-
-//_____________________________________________________________________________
-void AliTRDdataArray::Compress1()
-{
- //
- // Compress a buffer of type 1
- //
-
- AliTRDarrayI buf;
- buf.Set(fNelems);
- AliTRDarrayI index;
- index.Set(fNdim2);
-
- Int_t icurrent = -1;
- Int_t izero;
- for (Int_t idx2 = 0; idx2 < fNdim2; idx2++){
-
- // Set the idx2 pointer
- index[idx2] = icurrent + 1;
-
- // Reset the zero counter
- izero = 0;
-
- for (Int_t idx1 = 0; idx1 < fNdim1; idx1++){
- // If below threshold
- if (GetDataFast(idx1,idx2) <= fThreshold) {
- izero++;
- }
- else {
- if (izero > 0) {
- // If we have currently izero counts under threshold
- icurrent++;
- if (icurrent >= buf.fN) buf.Expand(icurrent*2);
- // Store the number of entries below zero
- buf[icurrent] = -izero;
- izero = 0;
- }
- icurrent++;
- if (icurrent >= buf.fN) buf.Expand(icurrent*2);
- buf[icurrent] = GetDataFast(idx1,idx2);
- } // If signal larger than threshold
- } // End of loop over idx1
-
- if (izero > 0) {
- icurrent++;
- if (icurrent >= buf.fN) buf.Expand(icurrent*2);
- // Store the number of entries below zero
- buf[icurrent] = -izero;
- }
-
- }
-
- buf.Expand(icurrent+1);
- (*fElements) = buf;
- fNelems = fElements->fN;
- fBufType = 1;
- (*fIndex) = index;
-
-}
-
-//_____________________________________________________________________________
-void AliTRDdataArray::Expand2()
-{
- //
- // Expands a buffer of type 2
- //
-
- Int_t i, k;
- Int_t *buf = new Int_t[fNelems];
-
- fNelems = fNdim1 * fNdim2;
- fIndex->Set(fNdim2);
-
- for (i = 0, k = 0; i < fNdim2; i++, k += fNdim1) (*fIndex)[i] = k;
-
- Int_t idx1 = 0;
- Int_t idx2 = 0;
- Int_t N = fElements->fN;
- for (i = 0; i < N; i++){
- // Negative sign counts the unwritten values (under threshold)
- if ((*fElements)[i] < 0) {
- idx1 -= fElements->At(i);
- }
- else {
- buf[(*fIndex)[idx2]+idx1] = fElements->At(i);
- idx1++;
- }
- if (idx1 == fNdim1) {
- idx1 = 0;
- idx2++;
- }
- else {
- if (idx1 > fNdim1){
- Reset();
- return;
- }
- }
- }
-
- fElements->Adopt(fNelems,buf);
-
-}
-
-//_____________________________________________________________________________
-void AliTRDdataArray::Compress2()
-{
- /*
-
- //
- // Compress a buffer of type 2
- //
-
- AliArrayS buf; //lets have the nearly the "worst case"
- buf.Set(fNelems);
- AliTRDarrayI index;
- index.Set(fNdim2);
- Int_t icurrent=-1;
- Int_t izero;
-
- for (Int_t col = 0; col<fNdim2; col++){
- index[col]=icurrent+1;//set collumn pointer
- izero = 0; //reset zer counter at the begining of the column
- Int_t lastrow=0;
- Int_t lastrowval=GetDigitFast(row,0);
-
- for (Int_t row = 1; row< fNdim1;row++){
- //if under threshold
- Int_t val = GetDigitFast(row,col);
- Int_t dif = val -lastrowval;
-
- if (TMath::Abs(dif)<fThreshold) izero++;
- else{
- if (izero>0) {
- //if we have currently izero count under threshold
- icurrent++;
- if (icurrent>=buf.fN) buf.Expand(icurrent*2);
- buf[icurrent]= -izero; //write how many under zero
- izero = 0;
- } //end of reseting izero
- icurrent++;
- if (icurrent>=buf.fN) buf.Expand(icurrent*2);
- buf[icurrent] = GetDigitFast(row,col);
- }//if signal bigger then threshold
- } //end of loop over rows
-
- if (izero>0) {
- icurrent++;
- if (icurrent>=buf.fN) buf.Expand(icurrent*2);
- buf[icurrent]= -izero; //write how many under zero
- }
- }//end of lopping over digits
- buf.Expand(icurrent+1);
- (*fElements)=buf;
- fNelems = fElements->fN;
- fBufType = 1;
- (*fIndex) =index;
- //end of compresing bufer of type 1
-
- */
-
-}
-
-//_____________________________________________________________________________
-Bool_t AliTRDdataArray::First0()
-{
- //
- // Returns the first entry for a buffer of type 0
- //
-
- fCurrentIdx1 = -1;
- fCurrentIdx2 = -1;
- fCurrentIndex = -1;
-
- Int_t i;
- for (i = 0; ((i < fNelems) && (fElements->At(i) <= fThreshold)); i++)
- if (i == fNelems) return kFALSE;
-
- fCurrentIdx1 = i % fNdim1;
- fCurrentIdx2 = i / fNdim1;
- fCurrentIndex = i;
- return kTRUE;
-
-}
-
-//_____________________________________________________________________________
-Bool_t AliTRDdataArray::Next0()
-{
- //
- // Returns the next entry for a buffer of type 0
- //
-
- if (fCurrentIndex < 0) return kFALSE;
-
- Int_t i;
- for (i = fCurrentIndex + 1;
- ((i < fNelems) && (fElements->At(i) <= fThreshold));
- i++);
- if (i >= fNelems) {
- fCurrentIndex = -1;
- return kFALSE;
- }
-
- fCurrentIdx1 = i % fNdim1;
- fCurrentIdx2 = i / fNdim1;
- fCurrentIndex = i;
- return kTRUE;
-
-}
-
-//_____________________________________________________________________________
-Bool_t AliTRDdataArray::First1()
-{
+void AliTRDdataArray::Reset()
+{
//
- // Returns the first entry for a buffer of type 1
+ // Reset the array (old content gets deleted)
//
- fCurrentIdx1 = -1;
- fCurrentIdx2 = 0;
- fCurrentIndex = -1;
-
- Int_t i;
- for (i = 0; i < fNelems; i++){
- if (fElements->At(i) < 0) {
- fCurrentIdx1-=fElements->At(i);
- }
- else {
- fCurrentIdx1++;
- }
- if (fCurrentIdx1 >= fNdim1) {
- fCurrentIdx2++;
- fCurrentIdx1 -= fNdim1;
- }
- if (fElements->At(i) > fThreshold) break;
- }
-
- fCurrentIndex = i;
- if (fCurrentIndex >= 0) return kTRUE;
- fCurrentIdx1 = -1;
- fCurrentIdx2 = -1;
- return kFALSE;
-
-}
-
-//_____________________________________________________________________________
-Bool_t AliTRDdataArray::Next1()
-{
- //
- // Returns the next entry for a buffer of type 1
- //
+ if (fIndex) delete fIndex;
+ fIndex = new AliTRDarrayI;
+ fIndex->Set(0);
- if (fCurrentIndex < 0) return kFALSE;
+ fNdim1 = -1;
+ fNdim2 = -1;
+ fNelems = -1;
- Int_t i;
- for (i = fCurrentIndex + 1; i < fNelems; i++){
- if (fElements->At(i) < 0) {
- fCurrentIdx1 -= fElements->At(i);
- }
- else {
- fCurrentIdx1++;
- }
- if (fCurrentIdx1 >= fNdim1) {
- fCurrentIdx2++;
- fCurrentIdx1 -= fNdim1;
- }
- if (fElements->At(i) > fThreshold) break;
- }
+ fBufType = -1;
- fCurrentIndex = i;
- if ((i >= 0) && (i < fNelems)) return kTRUE;
- fCurrentIdx1 = -1;
- fCurrentIdx2 = -1;
- return kFALSE;
+ fNrow = 0;
+ fNcol = 0;
+ fNtime = 0;
}
-//_____________________________________________________________________________
-Int_t AliTRDdataArray::GetData1(Int_t idx1, Int_t idx2)
-{
- //
- // Returns the value at a given position of the array
- //
-
- Int_t i, n2;
-
- if ((idx2 + 1) >= fNdim2) {
- n2 = fNelems;
- }
- else {
- n2 = fIndex->At(idx2 + 1);
- }
-
- // Current idx1
- Int_t curidx1 = 0;
- for (i = fIndex->At(idx2); ((i < n2) && (curidx1 < idx1)); i++){
- if (fElements->At(i) < 0) {
- curidx1 -= fElements->At(i);
- }
- else {
- curidx1++;
- }
- }
-
- if ((curidx1 == idx1) && (fElements->At(i) > 0)) {
- return fElements->At(i);
- }
- else {
- return 0;
- }
-
-}
-
/* $Id$ */
#include "AliTRDarrayI.h"
+#include "AliTRDarrayF.h"
#include "AliTRDsegmentID.h"
/////////////////////////////////////////////////////////////
public:
AliTRDdataArray();
+ AliTRDdataArray(Int_t nrow, Int_t ncol,Int_t ntime);
~AliTRDdataArray();
- virtual void Allocate(Int_t nrow, Int_t ncol,Int_t ntime);
- virtual void Compress(Int_t bufferType, Int_t threshold);
- virtual void Compress(Int_t bufferType);
- virtual void Expand();
- virtual void Reset();
- virtual Bool_t First();
- virtual Bool_t Next();
+ virtual void Allocate(Int_t nrow, Int_t ncol,Int_t ntime);
+ virtual void Reset();
- virtual void SetData(Int_t row, Int_t col, Int_t time, Int_t value);
-
- virtual void SetThreshold(Int_t threshold) { fThreshold = threshold; };
-
- virtual Int_t GetThreshold() { return fThreshold; };
virtual Int_t GetNRow() { return fNrow; };
virtual Int_t GetNCol() { return fNcol; };
virtual Int_t GetNtime() { return fNtime; };
- virtual Int_t GetSize();
- virtual Int_t GetDataSize();
- virtual Int_t GetOverThreshold(Float_t threshold);
-
- virtual Int_t GetData(Int_t row, Int_t col, Int_t time);
inline Int_t GetIndex(Int_t row, Int_t col, Int_t time);
protected:
inline Int_t GetIdx1(Int_t row, Int_t col);
inline Bool_t CheckBounds(const char *where, Int_t idx1, Int_t idx2);
inline Bool_t OutOfBoundsError(const char *where, Int_t idx1, Int_t idx2);
- inline void SetDataFast(Int_t idx1, Int_t idx2, Int_t value);
- inline Int_t GetDataFast(Int_t idx1, Int_t idx2);
-
- Int_t GetData1(Int_t idx1, Int_t idx2);
- void Expand1();
- void Compress1();
- void Expand2();
- void Compress2();
- Bool_t First0();
- Bool_t Next0();
- Bool_t First1();
- Bool_t Next1();
Int_t fNrow; // Number of rows of the detector segement
Int_t fNcol; // Number of columns of the detector segment
Int_t fNdim1; // First dimension of the array (row * column)
Int_t fNdim2; // Second dimension of the array (time, not compressed)
-
- private:
- AliTRDarrayI *fElements; // Buffer of 4 bytes integers for the array content
AliTRDarrayI *fIndex; // Index position of column
Int_t fBufType; // Type of the buffer - defines the compression algorithm
- Int_t fThreshold; // Treshold for zero suppression
Int_t fNelems; // Total number of elements
Int_t fCurrentIdx1; // !Current index 1
Int_t fCurrentIdx2; // !Current index 2
// Maps the row/column/time into one number
//
+ if (time > fNtime) {
+ TObject::Error("GetIdx1"
+ ,"time %d out of bounds (size: %d, this: 0x%08x)"
+ ,time,fNtime,this);
+ return -1;
+ }
+
return time * fNrow*fNcol + GetIdx1(row,col);
}
// Maps the two-dimensional row/column plane into an one-dimensional array.
//
- return row * fNrow + col;
+ if (row >= fNrow) {
+ TObject::Error("GetIdx1"
+ ,"row %d out of bounds (size: %d, this: 0x%08x)"
+ ,row,fNrow,this);
+ return -1;
+ }
+
+ if (col >= fNcol) {
+ TObject::Error("GetIdx1"
+ ,"col %d out of bounds (size: %d, this: 0x%08x)"
+ ,col,fNcol,this);
+ return -1;
+ }
+
+ return row + col * fNrow;
}
// Generate an out-of-bounds error. Always returns false.
//
- ::Error(where, "idx1 %d idx2 %d out of bounds (size: %d x %d, this: 0x%08x)"
- ,idx1,idx2,fNdim1,fNdim2,this);
+ TObject::Error(where, "idx1 %d idx2 %d out of bounds (size: %d x %d, this: 0x%08x)"
+ ,idx1,idx2,fNdim1,fNdim2,this);
return kFALSE;
}
-//_____________________________________________________________________________
-inline Int_t AliTRDdataArray::GetDataFast(Int_t idx1, Int_t idx2)
-{
- //
- // Returns the value at a given position in the array
- //
-
- return fElements->At(fIndex->At(idx2) + idx1);
-
-}
-
-//_____________________________________________________________________________
-inline void AliTRDdataArray::SetDataFast(Int_t idx1, Int_t idx2, Int_t value)
-{
- //
- // Set the value at a given position in the array
- //
-
- if ((idx1 < 0) || (idx1 >= fNdim1) ||
- (idx2 < 0) || (idx2 >= fNdim2)) {
- ::Error("AliTRDdataArray::SetDataFast"
- ,"idx1 %d idx2 %d out of bounds (size: %d x %d, this: 0x%08x)"
- ,idx1,idx2,fNdim1,fNdim2,this);
- }
-
- (*fElements)[fIndex->fArray[idx2] + idx1] = value;
-
-}
-
#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$
+Revision 1.1.2.1 2000/05/08 15:14:34 cblume
+Add new data array classes
+
+*/
+
+///////////////////////////////////////////////////////////////////////////////
+// //
+// General container for integer data of a TRD detector segment. //
+// Adapted from AliDigits (origin: M.Ivanov). //
+// //
+///////////////////////////////////////////////////////////////////////////////
+
+#include "AliTRDdataArrayF.h"
+
+ClassImp(AliTRDdataArrayF)
+
+//_____________________________________________________________________________
+AliTRDdataArrayF::AliTRDdataArrayF():AliTRDdataArray()
+{
+ //
+ // Default constructor
+ //
+
+ fElements = 0;
+
+}
+
+//_____________________________________________________________________________
+AliTRDdataArrayF::AliTRDdataArrayF(Int_t nrow, Int_t ncol, Int_t ntime)
+ :AliTRDdataArray(nrow,ncol,ntime)
+{
+ //
+ // Creates a AliTRDdataArrayF with the dimensions <nrow>, <ncol>, and <ntime>.
+ // The row- and column dimensions are compressible.
+ //
+
+ Allocate(nrow,ncol,ntime);
+
+}
+
+//_____________________________________________________________________________
+AliTRDdataArrayF::~AliTRDdataArrayF()
+{
+ //
+ // Destructor
+ //
+
+ if (fElements) fElements->Delete();
+
+}
+
+//_____________________________________________________________________________
+void AliTRDdataArrayF::Allocate(Int_t nrow, Int_t ncol, Int_t ntime)
+{
+ //
+ // Allocates memory for a AliTRDdataArrayF with the dimensions
+ // <nrow>, <ncol>, and <ntime>.
+ // The row- and column dimensions are compressible.
+ //
+
+
+ if (fNelems < 0) AliTRDdataArray::Allocate(nrow,ncol,ntime);
+
+ if (fElements) delete fElements;
+ fElements = new AliTRDarrayF;
+ fElements->Set(fNelems);
+
+}
+
+//_____________________________________________________________________________
+void AliTRDdataArrayF::Reset()
+{
+ //
+ // Reset the array (old content gets deleted)
+ //
+
+ if (fElements) delete fElements;
+ fElements = new AliTRDarrayF;
+ fElements->Set(0);
+
+ AliTRDdataArray::Reset();
+
+}
+
+//_____________________________________________________________________________
+Int_t AliTRDdataArrayF::GetSize()
+{
+ //
+ // Returns the size of the complete object
+ //
+
+ Int_t size = sizeof(this);
+
+ if (fIndex) size += sizeof(fIndex)
+ + fIndex->GetSize() * sizeof(Float_t);
+ if (fElements) size += sizeof(fElements)
+ + fElements->GetSize() * sizeof(Float_t);
+
+ return size;
+
+}
+
+//_____________________________________________________________________________
+Int_t AliTRDdataArrayF::GetDataSize()
+{
+ //
+ // Returns the size of only the data part
+ //
+
+ if (fElements == 0)
+ return 0;
+ else
+ return sizeof(fElements) + fElements->GetSize() * sizeof(Float_t);
+
+}
+
+//_____________________________________________________________________________
+Int_t AliTRDdataArrayF::GetOverThreshold(Float_t threshold)
+{
+ //
+ // Returns the number of entries over threshold
+ //
+
+ if ((fElements == 0) || (fElements->GetSize() <= 0))
+ return 0;
+
+ Int_t over = 0;
+
+ for (Bool_t cont = First(); cont == kTRUE; cont = Next()) {
+ if ((fCurrentIdx1 < 0) || (fCurrentIdx1 > fNdim1)) continue;
+ if ((fCurrentIdx2 < 0) || (fCurrentIdx2 > fNdim2)) continue;
+ if (fElements->At(fCurrentIndex) > threshold) over++;
+ }
+
+ return over;
+
+}
+
+//_____________________________________________________________________________
+Float_t AliTRDdataArrayF::GetData(Int_t row, Int_t col, Int_t time)
+{
+ //
+ // Returns the data value at a given position of the array
+ // Includes boundary checking
+ //
+
+ if ((row >= 0) && (col >= 0) && (time >= 0)) {
+ Int_t idx1 = GetIdx1(row,col);
+ if ((idx1 >= 0) && (time < fNdim2)) {
+ if (fBufType == 0) return GetDataFast(idx1,time);
+ if (fBufType == 1) return GetData1(idx1,time);
+ }
+ else {
+ if (idx1 >= 0) {
+ TObject::Error("GetData"
+ ,"time %d out of bounds (size: %d, this: 0x%08x)"
+ ,time,fNdim2,this);
+ }
+ }
+ }
+
+ return -1;
+
+}
+
+//_____________________________________________________________________________
+void AliTRDdataArrayF::Compress(Int_t bufferType, Float_t threshold)
+{
+ //
+ // Compresses the buffer
+ //
+
+ fThreshold = threshold;
+ Compress(bufferType);
+
+}
+
+//_____________________________________________________________________________
+void AliTRDdataArrayF::Compress(Int_t bufferType)
+{
+ //
+ // Compresses the buffer
+ //
+
+ if (fBufType < 0) {
+ Error("AliTRDdataArrayF::Compress","Buffer does not exist");
+ return;
+ }
+ if (fBufType == bufferType) {
+ return;
+ }
+ if (fBufType > 0) {
+ Expand();
+ }
+ if (fBufType !=0) {
+ Error("AliTRDdataArrayF::Compress","Buffer does not exist");
+ return;
+ }
+
+ // Compress a buffer of type 1
+ if (bufferType == 1) {
+ Compress1();
+ }
+
+}
+
+//_____________________________________________________________________________
+void AliTRDdataArrayF::Expand()
+{
+ //
+ // Expands the compressed buffer
+ //
+
+ if (fBufType < 0) {
+ Error("AliTRDdataArrayF::Expand","Buffer does not exist");
+ return;
+ }
+ if (fBufType == 0) {
+ return;
+ }
+
+ // Expand a buffer of type 1
+ if (fBufType == 1) Expand1();
+
+ fBufType = 0;
+
+}
+
+//_____________________________________________________________________________
+Bool_t AliTRDdataArrayF::First()
+{
+ //
+ // Returns the position of the first valid data value
+ //
+
+ if (fBufType == 0) return First0();
+ if (fBufType == 1) return First1();
+ return kFALSE;
+
+}
+
+//_____________________________________________________________________________
+Bool_t AliTRDdataArrayF::Next()
+{
+ //
+ // Returns the position of the next valid data value
+ //
+
+ if (fBufType == 0) return Next0();
+ if (fBufType == 1) return Next1();
+ return kFALSE;
+
+}
+
+//_____________________________________________________________________________
+void AliTRDdataArrayF::Expand1()
+{
+ //
+ // Expands a buffer of type 1
+ //
+
+ Int_t i, k;
+
+ fNelems = fNdim1 * fNdim2;
+
+ Float_t *buf = new Float_t[fNelems];
+
+ fIndex->Set(fNdim2);
+
+ for (i = 0, k = 0; i < fNdim2; i++, k += fNdim1) (*fIndex)[i] = k;
+
+ Int_t idx1 = 0;
+ Int_t idx2 = 0;
+ Int_t N = fElements->fN;
+
+ for (i = 0; i < N; i++){
+
+ // Negative sign counts the unwritten values (under threshold)
+ if ((*fElements)[i] < 0) {
+ idx1 -= (Int_t) fElements->At(i);
+ }
+ else {
+ buf[(*fIndex)[idx2] + idx1] = fElements->At(i);
+ idx1++;
+ }
+ if (idx1 == fNdim1) {
+ idx1 = 0;
+ idx2++;
+ }
+ else {
+ if (idx1 > fNdim1){
+ Reset();
+ return;
+ }
+ }
+ }
+
+ fElements->Adopt(fNelems,buf);
+
+}
+
+//_____________________________________________________________________________
+void AliTRDdataArrayF::Compress1()
+{
+ //
+ // Compress a buffer of type 1
+ //
+
+ AliTRDarrayF buf;
+ buf.Set(fNelems);
+ AliTRDarrayI index;
+ index.Set(fNdim2);
+
+ Int_t icurrent = -1;
+ Int_t izero;
+ for (Int_t idx2 = 0; idx2 < fNdim2; idx2++){
+
+ // Set the idx2 pointer
+ index[idx2] = icurrent + 1;
+
+ // Reset the zero counter
+ izero = 0;
+
+ for (Int_t idx1 = 0; idx1 < fNdim1; idx1++){
+ // If below threshold
+ if (GetDataFast(idx1,idx2) <= fThreshold) {
+ izero++;
+ }
+ else {
+ if (izero > 0) {
+ // If we have currently izero counts under threshold
+ icurrent++;
+ if (icurrent >= buf.fN) buf.Expand(icurrent*2);
+ // Store the number of entries below zero
+ buf[icurrent] = -izero;
+ izero = 0;
+ }
+ icurrent++;
+ if (icurrent >= buf.fN) buf.Expand(icurrent*2);
+ buf[icurrent] = GetDataFast(idx1,idx2);
+ } // If signal larger than threshold
+ } // End of loop over idx1
+
+ if (izero > 0) {
+ icurrent++;
+ if (icurrent >= buf.fN) buf.Expand(icurrent*2);
+ // Store the number of entries below zero
+ buf[icurrent] = -izero;
+ }
+
+ }
+
+ buf.Expand(icurrent+1);
+ (*fElements) = buf;
+ fNelems = fElements->fN;
+ fBufType = 1;
+ (*fIndex) = index;
+
+}
+
+//_____________________________________________________________________________
+void AliTRDdataArrayF::Expand2()
+{
+ //
+ // Expands a buffer of type 2
+ //
+
+ Int_t i, k;
+ Float_t *buf = new Float_t[fNelems];
+
+ fNelems = fNdim1 * fNdim2;
+ fIndex->Set(fNdim2);
+
+ for (i = 0, k = 0; i < fNdim2; i++, k += fNdim1) (*fIndex)[i] = k;
+
+ Int_t idx1 = 0;
+ Int_t idx2 = 0;
+ Int_t N = fElements->fN;
+ for (i = 0; i < N; i++){
+ // Negative sign counts the unwritten values (under threshold)
+ if ((*fElements)[i] < 0) {
+ idx1 -= (Int_t) fElements->At(i);
+ }
+ else {
+ buf[(*fIndex)[idx2]+idx1] = fElements->At(i);
+ idx1++;
+ }
+ if (idx1 == fNdim1) {
+ idx1 = 0;
+ idx2++;
+ }
+ else {
+ if (idx1 > fNdim1){
+ Reset();
+ return;
+ }
+ }
+ }
+
+ fElements->Adopt(fNelems,buf);
+
+}
+
+//_____________________________________________________________________________
+void AliTRDdataArrayF::Compress2()
+{
+
+}
+
+//_____________________________________________________________________________
+Bool_t AliTRDdataArrayF::First0()
+{
+ //
+ // Returns the first entry for a buffer of type 0
+ //
+
+ fCurrentIdx1 = -1;
+ fCurrentIdx2 = -1;
+ fCurrentIndex = -1;
+
+ Int_t i;
+ for (i = 0; ((i < fNelems) && (fElements->At(i) <= fThreshold)); i++)
+ if (i == fNelems) return kFALSE;
+
+ fCurrentIdx1 = i % fNdim1;
+ fCurrentIdx2 = i / fNdim1;
+ fCurrentIndex = i;
+ return kTRUE;
+
+}
+
+//_____________________________________________________________________________
+Bool_t AliTRDdataArrayF::Next0()
+{
+ //
+ // Returns the next entry for a buffer of type 0
+ //
+
+ if (fCurrentIndex < 0) return kFALSE;
+
+ Int_t i;
+ for (i = fCurrentIndex + 1;
+ ((i < fNelems) && (fElements->At(i) <= fThreshold));
+ i++);
+ if (i >= fNelems) {
+ fCurrentIndex = -1;
+ return kFALSE;
+ }
+
+ fCurrentIdx1 = i % fNdim1;
+ fCurrentIdx2 = i / fNdim1;
+ fCurrentIndex = i;
+ return kTRUE;
+
+}
+
+//_____________________________________________________________________________
+Bool_t AliTRDdataArrayF::First1()
+{
+ //
+ // Returns the first entry for a buffer of type 1
+ //
+
+ fCurrentIdx1 = -1;
+ fCurrentIdx2 = 0;
+ fCurrentIndex = -1;
+
+ Int_t i;
+ for (i = 0; i < fNelems; i++){
+ if (fElements->At(i) < 0) {
+ fCurrentIdx1 -= (Int_t) fElements->At(i);
+ }
+ else {
+ fCurrentIdx1++;
+ }
+ if (fCurrentIdx1 >= fNdim1) {
+ fCurrentIdx2++;
+ fCurrentIdx1 -= fNdim1;
+ }
+ if (fElements->At(i) > fThreshold) break;
+ }
+
+ fCurrentIndex = i;
+ if (fCurrentIndex >= 0) return kTRUE;
+ fCurrentIdx1 = -1;
+ fCurrentIdx2 = -1;
+ return kFALSE;
+
+}
+
+//_____________________________________________________________________________
+Bool_t AliTRDdataArrayF::Next1()
+{
+ //
+ // Returns the next entry for a buffer of type 1
+ //
+
+ if (fCurrentIndex < 0) return kFALSE;
+
+ Int_t i;
+ for (i = fCurrentIndex + 1; i < fNelems; i++){
+ if (fElements->At(i) < 0) {
+ fCurrentIdx1 -= (Int_t) fElements->At(i);
+ }
+ else {
+ fCurrentIdx1++;
+ }
+ if (fCurrentIdx1 >= fNdim1) {
+ fCurrentIdx2++;
+ fCurrentIdx1 -= fNdim1;
+ }
+ if (fElements->At(i) > fThreshold) break;
+ }
+
+ fCurrentIndex = i;
+ if ((i >= 0) && (i < fNelems)) return kTRUE;
+ fCurrentIdx1 = -1;
+ fCurrentIdx2 = -1;
+ return kFALSE;
+
+}
+
+//_____________________________________________________________________________
+Float_t AliTRDdataArrayF::GetData1(Int_t idx1, Int_t idx2)
+{
+ //
+ // Returns the value at a given position of the array
+ //
+
+ Int_t i, n2;
+
+ if ((idx2 + 1) >= fNdim2) {
+ n2 = fNelems;
+ }
+ else {
+ n2 = fIndex->At(idx2 + 1);
+ }
+
+ // Current idx1
+ Int_t curidx1 = 0;
+
+ for (i = fIndex->At(idx2); ((i < n2) && (curidx1 < idx1)); i++){
+ if (fElements->At(i) < 0) {
+ curidx1 -= (Int_t) fElements->At(i);
+ }
+ else {
+ curidx1++;
+ }
+ }
+
+ if ((curidx1 == idx1) && (fElements->At(i) > 0)) {
+ return fElements->At(i);
+ }
+ else {
+ return 0;
+ }
+
+}
+
--- /dev/null
+#ifndef TRDdataArrayF_H
+#define TRDdataArrayF_H
+
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice */
+
+/* $Id: AliTRDdataArrayF.h,v */
+
+#include "AliTRDdataArray.h"
+
+/////////////////////////////////////////////////////////////
+// //
+// General container for float data from TRD detector //
+// segments. //
+// Adapted from AliDigits, origin M.Ivanov //
+// //
+/////////////////////////////////////////////////////////////
+
+class AliTRDdataArrayF : public AliTRDdataArray {
+
+ public:
+
+ AliTRDdataArrayF();
+ AliTRDdataArrayF(Int_t nrow, Int_t ncol,Int_t ntime);
+ ~AliTRDdataArrayF();
+
+ virtual void Allocate(Int_t nrow, Int_t ncol,Int_t ntime);
+ virtual void Compress(Int_t bufferType, Float_t threshold);
+ virtual void Compress(Int_t bufferType);
+ virtual void Expand();
+ virtual Bool_t First();
+ virtual Bool_t Next();
+ virtual void Reset();
+
+ inline void SetData(Int_t row, Int_t col, Int_t time, Float_t value);
+ virtual void SetThreshold(Float_t threshold) { fThreshold = threshold; };
+
+ virtual Float_t GetData(Int_t row, Int_t col, Int_t time);
+ virtual Float_t GetThreshold() { return fThreshold; };
+
+ virtual Int_t GetSize();
+ virtual Int_t GetDataSize();
+ virtual Int_t GetOverThreshold(Float_t threshold);
+
+ protected:
+
+ inline void SetDataFast(Int_t idx1, Int_t idx2, Float_t value);
+ inline Float_t GetDataFast(Int_t idx1, Int_t idx2);
+
+ Float_t GetData1(Int_t idx1, Int_t idx2);
+ void Expand1();
+ void Compress1();
+ void Expand2();
+ void Compress2();
+ Bool_t First0();
+ Bool_t Next0();
+ Bool_t First1();
+ Bool_t Next1();
+
+ AliTRDarrayF *fElements; // Buffer of 4 bytes floats for the array content
+ Float_t fThreshold; // Threshold for zero suppression
+
+ ClassDef(AliTRDdataArrayF,1) // Container for float data of one TRD detector segment
+
+};
+
+
+//_____________________________________________________________________________
+inline Float_t AliTRDdataArrayF::GetDataFast(Int_t idx1, Int_t idx2)
+{
+ //
+ // Returns the value at a given position in the array
+ //
+
+ return fElements->At(fIndex->At(idx2) + idx1);
+
+}
+
+//_____________________________________________________________________________
+inline void AliTRDdataArrayF::SetData(Int_t row, Int_t col, Int_t time
+ , Float_t value)
+{
+ //
+ // Sets the data value at a given position of the array
+ // Includes boundary checking
+ //
+
+ if ((row >= 0) && (col >= 0) && (time >= 0)) {
+ Int_t idx1 = GetIdx1(row,col);
+ if ((idx1 >= 0) && (time < fNdim2)) {
+ SetDataFast(idx1,time,value);
+ }
+ else {
+ if (idx1 >= 0) {
+ TObject::Error("SetData"
+ ,"time %d out of bounds (size: %d, this: 0x%08x)"
+ ,time,fNdim2,this);
+ }
+ }
+ }
+
+}
+
+//_____________________________________________________________________________
+inline void AliTRDdataArrayF::SetDataFast(Int_t idx1, Int_t idx2, Float_t value)
+{
+ //
+ // Set the value at a given position in the array
+ //
+
+ if ((idx1 < 0) || (idx1 >= fNdim1) ||
+ (idx2 < 0) || (idx2 >= fNdim2)) {
+ TObject::Error("SetDataFast"
+ ,"idx1 %d idx2 %d out of bounds (size: %d x %d, this: 0x%08x)"
+ ,idx1,idx2,fNdim1,fNdim2,this);
+ }
+
+ (*fElements)[fIndex->fArray[idx2] + idx1] = value;
+
+}
+
+#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$
+Revision 1.1.2.1 2000/05/08 15:14:34 cblume
+Add new data array classes
+
+*/
+
+///////////////////////////////////////////////////////////////////////////////
+// //
+// General container for integer data of a TRD detector segment. //
+// Adapted from AliDigits (origin: M.Ivanov). //
+// //
+///////////////////////////////////////////////////////////////////////////////
+
+#include "AliTRDdataArrayI.h"
+
+ClassImp(AliTRDdataArrayI)
+
+//_____________________________________________________________________________
+AliTRDdataArrayI::AliTRDdataArrayI():AliTRDdataArray()
+{
+ //
+ // Default constructor
+ //
+
+ fElements = 0;
+
+}
+
+//_____________________________________________________________________________
+AliTRDdataArrayI::AliTRDdataArrayI(Int_t nrow, Int_t ncol, Int_t ntime)
+ :AliTRDdataArray(nrow,ncol,ntime)
+{
+ //
+ // Creates a AliTRDdataArrayI with the dimensions <nrow>, <ncol>, and <ntime>.
+ // The row- and column dimensions are compressible.
+ //
+
+ Allocate(nrow,ncol,ntime);
+
+}
+
+//_____________________________________________________________________________
+AliTRDdataArrayI::~AliTRDdataArrayI()
+{
+ //
+ // Destructor
+ //
+
+ if (fElements) fElements->Delete();
+
+}
+
+//_____________________________________________________________________________
+void AliTRDdataArrayI::Allocate(Int_t nrow, Int_t ncol, Int_t ntime)
+{
+ //
+ // Allocates memory for a AliTRDdataArrayI with the dimensions
+ // <nrow>, <ncol>, and <ntime>.
+ // The row- and column dimensions are compressible.
+ //
+
+ if (fNelems < 0) AliTRDdataArray::Allocate(nrow,ncol,ntime);
+
+ if (fElements) delete fElements;
+ fElements = new AliTRDarrayI;
+ fElements->Set(fNelems);
+
+}
+
+//_____________________________________________________________________________
+void AliTRDdataArrayI::Reset()
+{
+ //
+ // Reset the array (old content gets deleted)
+ //
+
+ if (fElements) delete fElements;
+ fElements = new AliTRDarrayI;
+ fElements->Set(0);
+
+ AliTRDdataArray::Reset();
+
+
+}
+
+//_____________________________________________________________________________
+Int_t AliTRDdataArrayI::GetSize()
+{
+ //
+ // Returns the size of the complete object
+ //
+
+ Int_t size = sizeof(this);
+
+ if (fIndex) size += sizeof(fIndex)
+ + fIndex->GetSize() * sizeof(Int_t);
+ if (fElements) size += sizeof(fElements)
+ + fElements->GetSize() * sizeof(Int_t);
+
+ return size;
+
+}
+
+//_____________________________________________________________________________
+Int_t AliTRDdataArrayI::GetDataSize()
+{
+ //
+ // Returns the size of only the data part
+ //
+
+ if (fElements == 0)
+ return 0;
+ else
+ return sizeof(fElements) + fElements->GetSize() * sizeof(Int_t);
+
+}
+
+//_____________________________________________________________________________
+Int_t AliTRDdataArrayI::GetOverThreshold(Int_t threshold)
+{
+ //
+ // Returns the number of entries over threshold
+ //
+
+ if ((fElements == 0) || (fElements->GetSize() <= 0))
+ return 0;
+
+ Int_t over = 0;
+
+ for (Bool_t cont = First(); cont == kTRUE; cont = Next()) {
+ if ((fCurrentIdx1 < 0) || (fCurrentIdx1 > fNdim1)) continue;
+ if ((fCurrentIdx2 < 0) || (fCurrentIdx2 > fNdim2)) continue;
+ if (fElements->At(fCurrentIndex) > threshold) over++;
+ }
+
+ return over;
+
+}
+
+//_____________________________________________________________________________
+Int_t AliTRDdataArrayI::GetData(Int_t row, Int_t col, Int_t time)
+{
+ //
+ // Returns the data value at a given position of the array
+ //
+
+ if ((row >= 0) && (col >= 0) && (time >= 0)) {
+ Int_t idx1 = GetIdx1(row,col);
+ if ((idx1 >= 0) && (time < fNdim2)) {
+ if (fBufType == 0) return GetDataFast(idx1,time);
+ if (fBufType == 1) return GetData1(idx1,time);
+ }
+ else {
+ if (idx1 >= 0) {
+ TObject::Error("GetData"
+ ,"time %d out of bounds (size: %d, this: 0x%08x)"
+ ,time,fNdim2,this);
+ }
+ }
+ }
+
+ return -1;
+
+}
+
+//_____________________________________________________________________________
+void AliTRDdataArrayI::Compress(Int_t bufferType, Int_t threshold)
+{
+ //
+ // Compresses the buffer
+ //
+
+ fThreshold = threshold;
+ Compress(bufferType);
+
+}
+
+//_____________________________________________________________________________
+void AliTRDdataArrayI::Compress(Int_t bufferType)
+{
+ //
+ // Compresses the buffer
+ //
+
+ if (fBufType < 0) {
+ Error("AliTRDdataArrayI::Compress","Buffer does not exist");
+ return;
+ }
+ if (fBufType == bufferType) {
+ return;
+ }
+ if (fBufType > 0) {
+ Expand();
+ }
+ if (fBufType !=0) {
+ Error("AliTRDdataArrayI::Compress","Buffer does not exist");
+ return;
+ }
+
+ // Compress a buffer of type 1
+ if (bufferType == 1) {
+ Compress1();
+ }
+
+}
+
+//_____________________________________________________________________________
+void AliTRDdataArrayI::Expand()
+{
+ //
+ // Expands the compressed buffer
+ //
+
+ if (fBufType < 0) {
+ Error("AliTRDdataArrayI::Expand","Buffer does not exist");
+ return;
+ }
+ if (fBufType == 0) {
+ return;
+ }
+
+ // Expand a buffer of type 1
+ if (fBufType == 1) Expand1();
+
+ fBufType = 0;
+
+}
+
+//_____________________________________________________________________________
+Bool_t AliTRDdataArrayI::First()
+{
+ //
+ // Returns the position of the first valid data value
+ //
+
+ if (fBufType == 0) return First0();
+ if (fBufType == 1) return First1();
+ return kFALSE;
+
+}
+
+//_____________________________________________________________________________
+Bool_t AliTRDdataArrayI::Next()
+{
+ //
+ // Returns the position of the next valid data value
+ //
+
+ if (fBufType == 0) return Next0();
+ if (fBufType == 1) return Next1();
+ return kFALSE;
+
+}
+
+//_____________________________________________________________________________
+void AliTRDdataArrayI::Expand1()
+{
+ //
+ // Expands a buffer of type 1
+ //
+
+ Int_t i, k;
+
+ fNelems = fNdim1 * fNdim2;
+
+ Int_t *buf = new Int_t[fNelems];
+
+ fIndex->Set(fNdim2);
+
+ for (i = 0, k = 0; i < fNdim2; i++, k += fNdim1) (*fIndex)[i] = k;
+
+ Int_t idx1 = 0;
+ Int_t idx2 = 0;
+ Int_t N = fElements->fN;
+
+ for (i = 0; i < N; i++){
+
+ // Negative sign counts the unwritten values (under threshold)
+ if ((*fElements)[i] < 0) {
+ idx1 -= fElements->At(i);
+ }
+ else {
+ buf[(*fIndex)[idx2] + idx1] = fElements->At(i);
+ idx1++;
+ }
+ if (idx1 == fNdim1) {
+ idx1 = 0;
+ idx2++;
+ }
+ else {
+ if (idx1 > fNdim1){
+ Reset();
+ return;
+ }
+ }
+ }
+
+ fElements->Adopt(fNelems,buf);
+
+}
+
+//_____________________________________________________________________________
+void AliTRDdataArrayI::Compress1()
+{
+ //
+ // Compress a buffer of type 1
+ //
+
+ AliTRDarrayI buf;
+ buf.Set(fNelems);
+ AliTRDarrayI index;
+ index.Set(fNdim2);
+
+ Int_t icurrent = -1;
+ Int_t izero;
+ for (Int_t idx2 = 0; idx2 < fNdim2; idx2++){
+
+ // Set the idx2 pointer
+ index[idx2] = icurrent + 1;
+
+ // Reset the zero counter
+ izero = 0;
+
+ for (Int_t idx1 = 0; idx1 < fNdim1; idx1++){
+ // If below threshold
+ if (GetDataFast(idx1,idx2) <= fThreshold) {
+ izero++;
+ }
+ else {
+ if (izero > 0) {
+ // If we have currently izero counts under threshold
+ icurrent++;
+ if (icurrent >= buf.fN) buf.Expand(icurrent*2);
+ // Store the number of entries below zero
+ buf[icurrent] = -izero;
+ izero = 0;
+ }
+ icurrent++;
+ if (icurrent >= buf.fN) buf.Expand(icurrent*2);
+ buf[icurrent] = GetDataFast(idx1,idx2);
+ } // If signal larger than threshold
+ } // End of loop over idx1
+
+ if (izero > 0) {
+ icurrent++;
+ if (icurrent >= buf.fN) buf.Expand(icurrent*2);
+ // Store the number of entries below zero
+ buf[icurrent] = -izero;
+ }
+
+ }
+
+ buf.Expand(icurrent+1);
+ (*fElements) = buf;
+ fNelems = fElements->fN;
+ fBufType = 1;
+ (*fIndex) = index;
+
+}
+
+//_____________________________________________________________________________
+void AliTRDdataArrayI::Expand2()
+{
+ //
+ // Expands a buffer of type 2
+ //
+
+ Int_t i, k;
+ Int_t *buf = new Int_t[fNelems];
+
+ fNelems = fNdim1 * fNdim2;
+ fIndex->Set(fNdim2);
+
+ for (i = 0, k = 0; i < fNdim2; i++, k += fNdim1) (*fIndex)[i] = k;
+
+ Int_t idx1 = 0;
+ Int_t idx2 = 0;
+ Int_t N = fElements->fN;
+ for (i = 0; i < N; i++){
+ // Negative sign counts the unwritten values (under threshold)
+ if ((*fElements)[i] < 0) {
+ idx1 -= fElements->At(i);
+ }
+ else {
+ buf[(*fIndex)[idx2]+idx1] = fElements->At(i);
+ idx1++;
+ }
+ if (idx1 == fNdim1) {
+ idx1 = 0;
+ idx2++;
+ }
+ else {
+ if (idx1 > fNdim1){
+ Reset();
+ return;
+ }
+ }
+ }
+
+ fElements->Adopt(fNelems,buf);
+
+}
+
+//_____________________________________________________________________________
+void AliTRDdataArrayI::Compress2()
+{
+
+}
+
+//_____________________________________________________________________________
+Bool_t AliTRDdataArrayI::First0()
+{
+ //
+ // Returns the first entry for a buffer of type 0
+ //
+
+ fCurrentIdx1 = -1;
+ fCurrentIdx2 = -1;
+ fCurrentIndex = -1;
+
+ Int_t i;
+ for (i = 0; ((i < fNelems) && (fElements->At(i) <= fThreshold)); i++)
+ if (i == fNelems) return kFALSE;
+
+ fCurrentIdx1 = i % fNdim1;
+ fCurrentIdx2 = i / fNdim1;
+ fCurrentIndex = i;
+ return kTRUE;
+
+}
+
+//_____________________________________________________________________________
+Bool_t AliTRDdataArrayI::Next0()
+{
+ //
+ // Returns the next entry for a buffer of type 0
+ //
+
+ if (fCurrentIndex < 0) return kFALSE;
+
+ Int_t i;
+ for (i = fCurrentIndex + 1;
+ ((i < fNelems) && (fElements->At(i) <= fThreshold));
+ i++);
+ if (i >= fNelems) {
+ fCurrentIndex = -1;
+ return kFALSE;
+ }
+
+ fCurrentIdx1 = i % fNdim1;
+ fCurrentIdx2 = i / fNdim1;
+ fCurrentIndex = i;
+ return kTRUE;
+
+}
+
+//_____________________________________________________________________________
+Bool_t AliTRDdataArrayI::First1()
+{
+ //
+ // Returns the first entry for a buffer of type 1
+ //
+
+ fCurrentIdx1 = -1;
+ fCurrentIdx2 = 0;
+ fCurrentIndex = -1;
+
+ Int_t i;
+ for (i = 0; i < fNelems; i++){
+ if (fElements->At(i) < 0) {
+ fCurrentIdx1 -= fElements->At(i);
+ }
+ else {
+ fCurrentIdx1++;
+ }
+ if (fCurrentIdx1 >= fNdim1) {
+ fCurrentIdx2++;
+ fCurrentIdx1 -= fNdim1;
+ }
+ if (fElements->At(i) > fThreshold) break;
+ }
+
+ fCurrentIndex = i;
+ if (fCurrentIndex >= 0) return kTRUE;
+ fCurrentIdx1 = -1;
+ fCurrentIdx2 = -1;
+ return kFALSE;
+
+}
+
+//_____________________________________________________________________________
+Bool_t AliTRDdataArrayI::Next1()
+{
+ //
+ // Returns the next entry for a buffer of type 1
+ //
+
+ if (fCurrentIndex < 0) return kFALSE;
+
+ Int_t i;
+ for (i = fCurrentIndex + 1; i < fNelems; i++){
+ if (fElements->At(i) < 0) {
+ fCurrentIdx1 -= fElements->At(i);
+ }
+ else {
+ fCurrentIdx1++;
+ }
+ if (fCurrentIdx1 >= fNdim1) {
+ fCurrentIdx2++;
+ fCurrentIdx1 -= fNdim1;
+ }
+ if (fElements->At(i) > fThreshold) break;
+ }
+
+ fCurrentIndex = i;
+ if ((i >= 0) && (i < fNelems)) return kTRUE;
+ fCurrentIdx1 = -1;
+ fCurrentIdx2 = -1;
+ return kFALSE;
+
+}
+
+//_____________________________________________________________________________
+Int_t AliTRDdataArrayI::GetData1(Int_t idx1, Int_t idx2)
+{
+ //
+ // Returns the value at a given position of the array
+ //
+
+ Int_t i, n2;
+
+ if ((idx2 + 1) >= fNdim2) {
+ n2 = fNelems;
+ }
+ else {
+ n2 = fIndex->At(idx2 + 1);
+ }
+
+ // Current idx1
+ Int_t curidx1 = 0;
+
+ for (i = fIndex->At(idx2); ((i < n2) && (curidx1 < idx1)); i++){
+ if (fElements->At(i) < 0) {
+ curidx1 -= fElements->At(i);
+ }
+ else {
+ curidx1++;
+ }
+ }
+
+ if ((curidx1 == idx1) && (fElements->At(i) > 0)) {
+ return fElements->At(i);
+ }
+ else {
+ return 0;
+ }
+
+}
+
--- /dev/null
+#ifndef TRDdataArrayI_H
+#define TRDdataArrayI_H
+
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice */
+
+/* $Id: AliTRDdataArrayI.h,v */
+
+#include "AliTRDdataArray.h"
+
+/////////////////////////////////////////////////////////////
+// //
+// General container for integer data from TRD detector //
+// segments. //
+// Adapted from AliDigits, origin M.Ivanov //
+// //
+/////////////////////////////////////////////////////////////
+
+class AliTRDdataArrayI : public AliTRDdataArray {
+
+ public:
+
+ AliTRDdataArrayI();
+ AliTRDdataArrayI(Int_t nrow, Int_t ncol, Int_t ntime);
+ ~AliTRDdataArrayI();
+
+ virtual void Allocate(Int_t nrow, Int_t ncol, Int_t ntime);
+ virtual void Compress(Int_t bufferType, Int_t threshold);
+ virtual void Compress(Int_t bufferType);
+ virtual void Expand();
+ virtual Bool_t First();
+ virtual Bool_t Next();
+ virtual void Reset();
+
+ inline void SetData(Int_t row, Int_t col, Int_t time, Int_t value);
+ virtual void SetThreshold(Int_t threshold) { fThreshold = threshold; };
+
+ virtual Int_t GetData(Int_t row, Int_t col, Int_t time);
+ virtual Int_t GetThreshold() { return fThreshold; };
+
+ virtual Int_t GetSize();
+ virtual Int_t GetDataSize();
+ virtual Int_t GetOverThreshold(Int_t threshold);
+
+ protected:
+
+ inline void SetDataFast(Int_t idx1, Int_t idx2, Int_t value);
+ inline Int_t GetDataFast(Int_t idx1, Int_t idx2);
+
+ Int_t GetData1(Int_t idx1, Int_t idx2);
+ void Expand1();
+ void Compress1();
+ void Expand2();
+ void Compress2();
+ Bool_t First0();
+ Bool_t Next0();
+ Bool_t First1();
+ Bool_t Next1();
+
+ AliTRDarrayI *fElements; // Buffer of 4 bytes integers for the array content
+ Int_t fThreshold; // Threshold for zero suppression
+
+ ClassDef(AliTRDdataArrayI,1) // Container for integer data of one TRD detector segment
+
+};
+
+
+//_____________________________________________________________________________
+inline Int_t AliTRDdataArrayI::GetDataFast(Int_t idx1, Int_t idx2)
+{
+ //
+ // Returns the value at a given position in the array
+ //
+
+ return fElements->At(fIndex->At(idx2) + idx1);
+
+}
+
+//_____________________________________________________________________________
+inline void AliTRDdataArrayI::SetData(Int_t row, Int_t col, Int_t time
+ , Int_t value)
+{
+ //
+ // Sets the data value at a given position of the array
+ // Includes boundary checking
+ //
+
+ if ((row >= 0) && (col >= 0) && (time >= 0)) {
+ Int_t idx1 = GetIdx1(row,col);
+ if ((idx1 >= 0) && (time < fNdim2)) {
+ SetDataFast(idx1,time,value);
+ }
+ else {
+ if (idx1 >= 0) {
+ TObject::Error("SetData"
+ ,"time %d out of bounds (size: %d, this: 0x%08x)"
+ ,time,fNdim2,this);
+ }
+ }
+ }
+
+}
+
+//_____________________________________________________________________________
+inline void AliTRDdataArrayI::SetDataFast(Int_t idx1, Int_t idx2, Int_t value)
+{
+ //
+ // Set the value at a given position in the array
+ //
+
+ if ((idx1 < 0) || (idx1 >= fNdim1) ||
+ (idx2 < 0) || (idx2 >= fNdim2)) {
+ TObject::Error("SetDataFast"
+ ,"idx1 %d idx2 %d out of bounds (size: %d x %d, this: 0x%08x)"
+ ,idx1,idx2,fNdim1,fNdim2,this);
+ }
+
+ (*fElements)[fIndex->fArray[idx2] + idx1] = value;
+
+}
+
+#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$
+Revision 1.1.2.1 2000/05/08 14:40:29 cblume
+Introduce raw digit bit flag and DecodeAmp()
+
+*/
+
+///////////////////////////////////////////////////////////////////////////////
+// //
+// The TRD digit //
+// //
+///////////////////////////////////////////////////////////////////////////////
+
+#include "AliTRDdigit.h"
+
+ClassImp(AliTRDdigit)
+
+//_____________________________________________________________________________
+AliTRDdigit::AliTRDdigit():AliDigitNew()
+{
+ //
+ // Default constructor
+ //
+
+ fRow = 0;
+ fCol = 0;
+ fTime = 0;
+
+}
+
+//_____________________________________________________________________________
+AliTRDdigit::AliTRDdigit(Bool_t isRaw, Int_t *digits):AliDigitNew()
+{
+ //
+ // Create a TRD digit
+ //
+
+ // Store the volume hierarchy
+ fId = digits[0];
+
+ // Store the row, pad, and time bucket number
+ fRow = digits[1];
+ fCol = digits[2];
+ fTime = digits[3];
+
+ // Store the signal amplitude
+ fAmp = digits[4];
+
+ if (isRaw) SetBit(kRawDigit);
+
+}
--- /dev/null
+#ifndef TRDdigit_h
+#define TRDdigit_h
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice */
+
+/* $Id: AliTRDdigit.h,v */
+
+#include "AliDigitNew.h"
+
+const UInt_t kRawDigit = 0x00000001;
+
+//_____________________________________________________________________________
+class AliTRDdigit : public AliDigitNew {
+
+ public:
+
+ AliTRDdigit();
+ AliTRDdigit(Bool_t isRaw, Int_t *digits);
+ ~AliTRDdigit() {};
+
+ Int_t GetAmp() { if (TestBit(kRawDigit))
+ return DecodeAmp();
+ else
+ return fAmp; };
+ Int_t GetDetector() { return fId; };
+ Int_t GetRow() { return fRow; };
+ Int_t GetCol() { return fCol; };
+ Int_t GetTime() { return fTime; };
+
+ Int_t DecodeAmp() { return 0; };
+
+ protected:
+
+ Int_t fRow; // Pad row number
+ Int_t fCol; // Pad col number
+ Int_t fTime; // Time bucket
+
+ ClassDef(AliTRDdigit,1) // Digit for the TRD
+
+};
+
+#endif
#include <TNamed.h>
#include <TFile.h>
+#include <TF1.h>
#include "AliHit.h"
-#include "AliDigit.h"
+#include "AliTRDdigit.h"
#include "AliTRDconst.h"
#include "AliTRDgeometry.h"
-#include "AliTRDsegmentArray.h"
+
+class AliTRDdigitsManager;
///////////////////////////////////////////////////////
// Produces digits from the hits information //
///////////////////////////////////////////////////////
-const Int_t kNDict = 3;
-
class AliTRDdigitizer : public TNamed {
public:
AliTRDdigitizer(const Text_t* name, const Text_t* title);
~AliTRDdigitizer();
- virtual void Init();
- virtual Bool_t Open(const Char_t *name, Int_t nEvent = 0);
- virtual Bool_t MakeBranch();
- virtual Bool_t MakeDigits();
- virtual Bool_t WriteDigits();
-
- virtual void SetGasGain(Float_t gasgain) { fGasGain = gasgain; };
- virtual void SetNoise(Float_t noise) { fNoise = noise; };
- virtual void SetChipGain(Float_t chipgain) { fChipGain = chipgain; };
- virtual void SetADCoutRange(Float_t range) { fADCoutRange = range; };
- virtual void SetADCinRange(Float_t range) { fADCinRange = range; };
- virtual void SetADCthreshold(Int_t thresh) { fADCthreshold = thresh; };
- virtual void SetDiffusion(Int_t diff_on = 1) { fDiffusionOn = diff_on; };
- virtual void SetDiffusionT(Float_t diff) { fDiffusionT = diff; };
- virtual void SetDiffusionL(Float_t diff) { fDiffusionL = diff; };
- virtual void SetElAttach(Int_t el_on = 1) { fElAttachOn = el_on; };
- virtual void SetElAttachProp(Float_t prop) { fElAttachProp = prop; };
- virtual void SetExB(Int_t exb_on = 1) { fExBOn = exb_on; };
- virtual void SetLorentzAngle(Float_t angle) { fLorentzAngle = angle; };
-
- AliTRDsegmentArray *DigitsArray() { return fDigitsArray; };
- AliTRDsegmentArray *Dictionary(Int_t i) { return fDictionary[i]; };
-
- virtual Float_t GetGasGain() { return fGasGain; };
- virtual Float_t GetNoise() { return fNoise; };
- virtual Float_t GetChipGain() { return fChipGain; };
- virtual Float_t GetADCoutRange() { return fADCoutRange; };
- virtual Float_t GetADCinRange() { return fADCinRange; };
- virtual Int_t GetADCthreshold() { return fADCthreshold; };
- virtual Float_t GetDiffusionT() { return fDiffusionT; };
- virtual Float_t GetDiffusionL() { return fDiffusionL; };
- virtual Float_t GetElAttachProp() { return fElAttachProp; };
- virtual Float_t GetLorentzAngle() { return fLorentzAngle; };
+ virtual void Init();
+ virtual Bool_t Open(const Char_t *name, Int_t nEvent = 0);
+ virtual Bool_t MakeDigits();
+ virtual Bool_t WriteDigits();
+
+ virtual void SetGasGain(Float_t gasgain) { fGasGain = gasgain; };
+ virtual void SetNoise(Float_t noise) { fNoise = noise; };
+ virtual void SetChipGain(Float_t chipgain) { fChipGain = chipgain; };
+ virtual void SetADCoutRange(Float_t range) { fADCoutRange = range; };
+ virtual void SetADCinRange(Float_t range) { fADCinRange = range; };
+ virtual void SetADCthreshold(Int_t thresh) { fADCthreshold = thresh; };
+ virtual void SetDiffusion(Int_t diff_on = 1) { fDiffusionOn = diff_on; };
+ virtual void SetDiffusionT(Float_t diff) { fDiffusionT = diff; };
+ virtual void SetDiffusionL(Float_t diff) { fDiffusionL = diff; };
+ virtual void SetElAttach(Int_t el_on = 1) { fElAttachOn = el_on; };
+ virtual void SetElAttachProp(Float_t prop) { fElAttachProp = prop; };
+ virtual void SetExB(Int_t exb_on = 1) { fExBOn = exb_on; };
+ virtual void SetLorentzAngle(Float_t angle) { fLorentzAngle = angle; };
+ virtual void SetPadResponse(TF1 *PRF) { if (fPRF) delete fPRF;
+ fPRF = PRF; };
+
+ AliTRDdigitsManager *Digits() { return fDigits; };
+
+ virtual Float_t GetGasGain() { return fGasGain; };
+ virtual Float_t GetNoise() { return fNoise; };
+ virtual Float_t GetChipGain() { return fChipGain; };
+ virtual Float_t GetADCoutRange() { return fADCoutRange; };
+ virtual Float_t GetADCinRange() { return fADCinRange; };
+ virtual Int_t GetADCthreshold() { return fADCthreshold; };
+ virtual Float_t GetDiffusionT() { return fDiffusionT; };
+ virtual Float_t GetDiffusionL() { return fDiffusionL; };
+ virtual Float_t GetElAttachProp() { return fElAttachProp; };
+ virtual Float_t GetLorentzAngle() { return fLorentzAngle; };
+ virtual TF1 *GetPadResponse() { return fPRF; };
protected:
- TFile *fInputFile; //! ALIROOT-filename
-
- AliTRDsegmentArray *fDigitsArray; //! Array of detector segments containing the digits
- AliTRDsegmentArray *fDictionary[3]; //! Dictionary array, connecting MC tracks to the digits
+ TFile *fInputFile; //! ALIROOT-filename
+ AliTRDdigitsManager *fDigits; //! TRD digits manager
+ AliTRD *fTRD; //! TRD detector class
+ AliTRDgeometry *fGeo; //! TRD geometry
- Int_t fEvent; //! Event number
-
- Float_t fGasGain; // Gas gain
- Float_t fNoise; // Electronics noise
- Float_t fChipGain; // Electronics gain
- Float_t fADCoutRange; // ADC output range (number of channels)
- Float_t fADCinRange; // ADC input range (input charge)
- Int_t fADCthreshold; // ADC threshold in ADC channel
- Int_t fDiffusionOn; // Switch for the diffusion
- Float_t fDiffusionT; // Diffusion in transverse direction
- Float_t fDiffusionL; // Diffusion in longitudinal direction
- Int_t fElAttachOn; // Switch for the electron attachment
- Float_t fElAttachProp; // Propability for electron attachment (for 1m)
- Int_t fExBOn; // Switch for the ExB effects
- Float_t fLorentzAngle; // Lorentz angle
- Float_t fLorentzFactor; // Factor due to Lorentz force
+ Int_t fEvent; //! Event number
+
+ Float_t fGasGain; // Gas gain
+ Float_t fNoise; // Electronics noise
+ Float_t fChipGain; // Electronics gain
+ Float_t fADCoutRange; // ADC output range (number of channels)
+ Float_t fADCinRange; // ADC input range (input charge)
+ Int_t fADCthreshold; // ADC threshold in ADC channel
+ Int_t fDiffusionOn; // Switch for the diffusion
+ Float_t fDiffusionT; // Diffusion in transverse direction
+ Float_t fDiffusionL; // Diffusion in longitudinal direction
+ Int_t fElAttachOn; // Switch for the electron attachment
+ Float_t fElAttachProp; // Propability for electron attachment (for 1m)
+ Int_t fExBOn; // Switch for the ExB effects
+ Float_t fLorentzAngle; // Lorentz angle
+ Float_t fLorentzFactor; // Factor due to Lorentz force
+ TF1 *fPRF; // Pad response function
private:
virtual Int_t Diffusion(Float_t driftlength, Float_t *xyz);
virtual Int_t ExB(Float_t driftlength, Float_t *xyz);
- virtual Float_t PadResponse(Float_t x);
- ClassDef(AliTRDdigitizer,1) // TRD-Digits manager
-
-};
-
-//_____________________________________________________________________________
-class AliTRDdigit : public AliDigitNew {
-
- public:
-
- AliTRDdigit() {};
- AliTRDdigit(Int_t *digits);
- virtual ~AliTRDdigit() {};
-
- virtual Int_t GetAmp() { return fAmplitude; };
- virtual Int_t GetDetector() { return fDetector; };
- virtual Int_t GetRow() { return fRow; };
- virtual Int_t GetCol() { return fCol; };
- virtual Int_t GetTime() { return fTime; };
-
- protected:
-
- Int_t fDetector; // TRD detector number
- Int_t fRow; // Pad row number
- Int_t fCol; // Pad col number
- Int_t fTime; // Time bucket
- Int_t fAmplitude; // Signal amplitude
-
- ClassDef(AliTRDdigit,1) // Digits for Transition Radiation Detector
+ ClassDef(AliTRDdigitizer,1) // Produces TRD-Digits
};
--- /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$
+Revision 1.1.2.1 2000/05/08 14:44:01 cblume
+Add new class AliTRDdigitsManager
+
+*/
+
+///////////////////////////////////////////////////////////////////////////////
+// //
+// Manages the digits and the track dictionary in the form of //
+// AliTRDdataArray objects. //
+// //
+///////////////////////////////////////////////////////////////////////////////
+
+#include "AliRun.h"
+
+#include "AliTRDdigitsManager.h"
+#include "AliTRDconst.h"
+
+ClassImp(AliTRDdigitsManager)
+
+//_____________________________________________________________________________
+AliTRDdigitsManager::AliTRDdigitsManager():TObject()
+{
+ //
+ // Default constructor
+ //
+
+ fIsRaw = kFALSE;
+
+ fDigits = new AliTRDsegmentArray("AliTRDdataArrayI",kNdet);
+
+ for (Int_t iDict = 0; iDict < kNDict; iDict++) {
+ fDictionary[iDict] = new AliTRDsegmentArray("AliTRDdataArrayI",kNdet);
+ }
+
+}
+
+//_____________________________________________________________________________
+AliTRDdigitsManager::~AliTRDdigitsManager()
+{
+
+ if (fDigits) {
+ fDigits->Delete();
+ delete fDigits;
+ }
+
+ for (Int_t iDict = 0; iDict < kNDict; iDict++) {
+ fDictionary[iDict]->Delete();
+ delete fDictionary[iDict];
+ }
+
+}
+
+//_____________________________________________________________________________
+void AliTRDdigitsManager::SetRaw()
+{
+
+ fIsRaw = kTRUE;
+
+ fDigits->SetBit(kRawDigit);
+
+}
+
+//_____________________________________________________________________________
+Bool_t AliTRDdigitsManager::MakeBranch()
+{
+ //
+ // Creates the branches for the digits and the dictionary in the digits tree
+ //
+
+ Int_t buffersize = 64000;
+
+ Bool_t status = kTRUE;
+
+ if (gAlice->TreeD()) {
+
+ // Make the branch for the digits
+ if (fDigits) {
+ const AliTRDdataArrayI *Digits =
+ (AliTRDdataArrayI *) fDigits->At(0);
+ if (Digits) {
+ gAlice->TreeD()->Branch("TRDdigits",Digits->IsA()->GetName()
+ ,&Digits,buffersize,1);
+ printf("AliTRDdigitsManager::MakeBranch -- ");
+ printf("Making branch TRDdigits\n");
+ }
+ else {
+ status = kFALSE;
+ }
+ }
+ else {
+ status = kFALSE;
+ }
+
+ // Make the branches for the dictionaries
+ for (Int_t iDict = 0; iDict < kNDict; iDict++) {
+
+ Char_t branchname[15];
+ sprintf(branchname,"TRDdictionary%d",iDict);
+ if (fDictionary[iDict]) {
+ const AliTRDdataArrayI *Dictionary =
+ (AliTRDdataArrayI *) fDictionary[iDict]->At(0);
+ if (Dictionary) {
+ gAlice->TreeD()->Branch(branchname,Dictionary->IsA()->GetName()
+ ,&Dictionary,buffersize,1);
+ printf("AliTRDdigitsManager::MakeBranch -- ");
+ printf("Making branch %s\n",branchname);
+ }
+ else {
+ status = kFALSE;
+ }
+ }
+ else {
+ status = kFALSE;
+ }
+ }
+
+ }
+ else {
+ status = kFALSE;
+ }
+
+ return status;
+
+}
+
+//_____________________________________________________________________________
+Bool_t AliTRDdigitsManager::ReadDigits()
+{
+
+ Bool_t status = kTRUE;
+
+ status = fDigits->LoadArray("TRDdigits");
+
+ for (Int_t iDict = 0; iDict < kNDict; iDict++) {
+ Char_t branchname[15];
+ sprintf(branchname,"TRDdictionary%d",iDict);
+ status = fDictionary[iDict]->LoadArray(branchname);
+ }
+
+ if (fDigits->TestBit(kRawDigit)) {
+ fIsRaw = kTRUE;
+ }
+ else {
+ fIsRaw = kFALSE;
+ }
+
+ return kTRUE;
+
+}
+
+//_____________________________________________________________________________
+Bool_t AliTRDdigitsManager::WriteDigits()
+{
+ //
+ // Writes out the TRD-digits and the dictionaries
+ //
+
+ // Create the branches
+ if (!(gAlice->TreeD()->GetBranch("TRDdigits"))) {
+ if (!MakeBranch()) return kFALSE;
+ }
+
+ // Store the contents of the segment array in the tree
+ if (!fDigits->StoreArray("TRDdigits")) {
+ printf("AliTRDdigitsManager::WriteDigits -- ");
+ printf("Error while storing digits in branch TRDdigits\n");
+ return kFALSE;
+ }
+ for (Int_t iDict = 0; iDict < kNDict; iDict++) {
+ Char_t branchname[15];
+ sprintf(branchname,"TRDdictionary%d",iDict);
+ if (!fDictionary[iDict]->StoreArray(branchname)) {
+ printf("AliTRDdigitsManager::WriteDigits -- ");
+ printf("Error while storing dictionary in branch %s\n",branchname);
+ return kFALSE;
+ }
+ }
+
+ return kTRUE;
+
+}
--- /dev/null
+#ifndef TRDdigitsManager_H
+#define TRDdigitsManager_H
+
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice */
+
+/* $Id: AliTRDdigitsManager.h,v */
+
+/////////////////////////////////////////////////////////////
+// Manages the TRD digits //
+/////////////////////////////////////////////////////////////
+
+#include "TObject.h"
+
+#include "AliTRDsegmentArray.h"
+#include "AliTRDdataArrayI.h"
+#include "AliTRDdigit.h"
+
+const Int_t kNDict = 3;
+
+class AliTRDdigitsManager : public TObject {
+
+ public:
+
+ AliTRDdigitsManager();
+ ~AliTRDdigitsManager();
+
+ virtual Bool_t MakeBranch();
+ virtual Bool_t ReadDigits();
+ virtual Bool_t WriteDigits();
+
+ virtual void SetRaw();
+
+ virtual Bool_t IsRaw() { return fIsRaw; };
+ virtual AliTRDsegmentArray *GetDigits() { return fDigits; };
+ virtual AliTRDsegmentArray *GetDictionary(Int_t i) { return fDictionary[i]; };
+
+ inline AliTRDdataArrayI *GetDigits(Int_t det);
+ inline AliTRDdataArrayI *GetDictionary(Int_t det, Int_t i);
+ inline AliTRDdigit *GetDigit(Int_t row, Int_t col, Int_t time, Int_t det);
+ inline Int_t GetTrack(Int_t track, Int_t row, Int_t col, Int_t time, Int_t det);
+ inline Int_t GetTrack(Int_t track, AliTRDdigit *Digit);
+
+ protected:
+
+ AliTRDsegmentArray *fDigits; //! Digits data Array
+ AliTRDsegmentArray *fDictionary[kNDict]; //! Track dictionary data array
+
+ Bool_t fIsRaw; // Flag indicating raw digits
+
+ ClassDef(AliTRDdigitsManager,1) // Manages the TRD digits
+
+};
+
+//_____________________________________________________________________________
+inline AliTRDdataArrayI *AliTRDdigitsManager::GetDigits(Int_t det)
+{
+ //
+ // Returns the digits array for one detector
+ //
+
+ return (AliTRDdataArrayI *) fDigits->At(det);
+
+}
+
+
+//_____________________________________________________________________________
+inline AliTRDdataArrayI *AliTRDdigitsManager::GetDictionary(Int_t det, Int_t i)
+{
+ //
+ // Returns the dictionary for one detector
+ //
+
+ return (AliTRDdataArrayI *) fDictionary[i]->At(det);
+
+}
+
+//_____________________________________________________________________________
+inline AliTRDdigit *AliTRDdigitsManager::GetDigit(Int_t row, Int_t col
+ , Int_t time, Int_t det)
+{
+ //
+ // Creates a single digit object
+ //
+
+ Int_t digits[5];
+
+ digits[0] = det;
+ digits[1] = row;
+ digits[2] = col;
+ digits[3] = time;
+ digits[4] = GetDigits(det)->GetData(row,col,time);
+
+ return (new AliTRDdigit(fIsRaw,digits));
+
+}
+
+//_____________________________________________________________________________
+inline Int_t AliTRDdigitsManager::GetTrack(Int_t track
+ , Int_t row, Int_t col, Int_t time
+ , Int_t det)
+{
+ //
+ // Returns the MC-track numbers from the dictionary.
+ //
+
+ if ((track < 0) || (track >= kNDict)) {
+ TObject::Error("GetTracks"
+ ,"track %d out of bounds (size: %d, this: 0x%08x)"
+ ,track,kNDict,this);
+ return -1;
+ }
+
+ // Array contains index+1 to allow data compression
+ return (GetDictionary(det,track)->GetData(row,col,time) - 1);
+
+}
+
+//_____________________________________________________________________________
+inline Int_t AliTRDdigitsManager::GetTrack(Int_t track, AliTRDdigit *Digit)
+{
+ //
+ // Returns the MC-track numbers from the dictionary for a given digit
+ //
+
+ Int_t row = Digit->GetRow();
+ Int_t col = Digit->GetCol();
+ Int_t time = Digit->GetTime();
+ Int_t det = Digit->GetDetector();
+
+ return GetTrack(track,row,col,time,det);
+
+}
+
+#endif
/*
$Log$
+Revision 1.1.4.1 2000/05/08 14:45:55 cblume
+Bug fix in RotateBack(). Geometry update
+
+Revision 1.1 2000/02/28 19:00:44 cblume
+Add new TRD classes
+
*/
///////////////////////////////////////////////////////////////////////////////
Int_t isect = GetSector(idet); // Sector info (0-17)
Int_t iplan = GetPlane(idet); // Plane info (0-5)
- Float_t padRow = local[0]; // Pad Row position
- Float_t padCol = local[1]; // Pad Column position
- Float_t timeSlice = local[2]; // Time "position"
-
- Float_t row0 = GetRow0(iplan,icham,isect);
- Float_t col0 = GetCol0(iplan);
- Float_t time0 = GetTime0(iplan);
-
- Float_t rot[3];
-
- // calculate (x,y) position in rotated chamber
- rot[1] = col0 + padCol * fColPadSize;
- rot[0] = time0 + timeSlice * fTimeBinSize;
- // calculate z-position:
- rot[2] = row0 + padRow * fRowPadSize;
-
- // Rotate back to original position
- return RotateBack(idet,rot,global);
+ return Local2Global(iplan,icham,isect,local,global);
}
Float_t rot[3];
// calculate (x,y,z) position in rotated chamber
- rot[1] = col0 + padCol * fColPadSize;
rot[0] = time0 + timeSlice * fTimeBinSize;
+ rot[1] = col0 + padCol * fColPadSize;
rot[2] = row0 + padRow * fRowPadSize;
// Rotate back to original position
Float_t phi = 2.0 * kPI / (Float_t) kNsect * ((Float_t) sector + 0.5);
- rot[0] = pos[0] * TMath::Cos(phi) + pos[1] * TMath::Sin(phi);
- rot[1] = -pos[0] * TMath::Sin(phi) + pos[1] * TMath::Cos(phi);
- rot[2] = pos[2];
+ pos[0] = rot[0] * TMath::Cos(phi) + rot[1] * TMath::Sin(phi);
+ pos[1] = -rot[0] * TMath::Sin(phi) + rot[1] * TMath::Cos(phi);
+ pos[2] = rot[2];
return kTRUE;
Float_t global[3];
Float_t local[3];
- local[0] = pos.X();
- local[1] = pos.Y();
- local[2] = pos.Z();
+ local[0] = ((AliTRDrecPoint *) p)->GetLocalRow();
+ local[1] = ((AliTRDrecPoint *) p)->GetLocalCol();
+ local[2] = ((AliTRDrecPoint *) p)->GetLocalTime();
if (Local2Global(detector,local,global)) {
pos.SetX(global[0]);
virtual Bool_t Rotate(Int_t d, Float_t *pos, Float_t *rot);
virtual Bool_t RotateBack(Int_t d, Float_t *rot, Float_t *pos);
+ virtual void SetPHOShole() = 0;
+ virtual void SetRICHhole() = 0;
+
virtual void SetRowPadSize(Float_t size) { fRowPadSize = size; };
virtual void SetColPadSize(Float_t size) { fColPadSize = size; };
virtual void SetTimeBinSize(Float_t size) { fTimeBinSize = size; };
+ virtual Bool_t GetPHOShole() = 0;
+ virtual Bool_t GetRICHhole() = 0;
+
virtual Int_t GetDetector(Int_t p, Int_t c, Int_t s);
virtual Int_t GetPlane(Int_t d);
virtual Int_t GetChamber(Int_t d);
/*
$Log$
+Revision 1.1.4.2 2000/05/08 14:46:44 cblume
+Include options SetPHOShole() and SetRICHhole()
+
+Revision 1.1.4.1 2000/04/27 12:46:04 cblume
+Corrected bug in full geometry
+
+Revision 1.1 2000/02/28 19:01:15 cblume
+Add new TRD classes
+
*/
///////////////////////////////////////////////////////////////////////////////
// //
-// TRD geometry without holes //
+// TRD geometry for the spaceframe without holes //
// //
///////////////////////////////////////////////////////////////////////////////
Int_t iplan;
+ fPHOShole = kFALSE;
+ fRICHhole = kFALSE;
+
// The length of the inner chambers
for (iplan = 0; iplan < kNplan; iplan++)
fClengthI[iplan] = 110.0;
// The length of the middle chambers
- fClengthM[0] = 123.5;
- fClengthM[1] = 131.0;
- fClengthM[2] = 138.5;
- fClengthM[3] = 146.0;
- fClengthM[4] = 153.0;
- fClengthM[5] = 160.5;
+ fClengthM1[0] = 123.5;
+ fClengthM1[1] = 131.0;
+ fClengthM1[2] = 138.5;
+ fClengthM1[3] = 146.0;
+ fClengthM1[4] = 153.0;
+ fClengthM1[5] = 160.5;
+
+ fClengthM2[0] = 123.5 - 7.0;
+ fClengthM2[1] = 131.0 - 7.0;
+ fClengthM2[2] = 138.5 - 7.0;
+ fClengthM2[3] = 146.0 - 7.0;
+ fClengthM2[4] = 153.0 - 7.0;
+ fClengthM2[5] = 160.4 - 7.0;
// The length of the outer chambers
- fClengthO[0] = 123.5;
- fClengthO[1] = 131.0;
- fClengthO[2] = 134.5;
- fClengthO[3] = 142.0;
- fClengthO[4] = 142.0;
- fClengthO[5] = 134.5;
+ fClengthO1[0] = 123.5;
+ fClengthO1[1] = 131.0;
+ fClengthO1[2] = 134.5;
+ fClengthO1[3] = 142.0;
+ fClengthO1[4] = 142.0;
+ fClengthO1[5] = 134.5;
+
+ fClengthO2[0] = 123.5;
+ fClengthO2[1] = 131.0;
+ fClengthO2[2] = 134.5;
+ fClengthO2[3] = 142.0;
+ fClengthO2[4] = 142.0;
+ fClengthO2[5] = 134.5;
+
+ fClengthO3[0] = 86.5;
+ fClengthO3[1] = 101.5;
+ fClengthO3[2] = 112.5;
+ fClengthO3[3] = 127.5;
+ fClengthO3[4] = 134.5;
+ fClengthO3[5] = 134.5;
// The maximum number of pads
// and the position of pad 0,0,0
for (Int_t isect = 0; isect < kNsect; isect++) {
Float_t clengthI = fClengthI[iplan];
- Float_t clengthM = fClengthM[iplan];
- Float_t clengthO = fClengthO[iplan];
+ Float_t clengthM = fClengthM1[iplan];
+ Float_t clengthO = fClengthO1[iplan];
+ switch (isect) {
+ case 12:
+ case 13:
+ case 14:
+ case 15:
+ case 16:
+ clengthM = fClengthM2[iplan];
+ clengthO = fClengthO2[iplan];
+ break;
+ case 4:
+ case 5:
+ case 6:
+ clengthO = fClengthO3[iplan];
+ break;
+ };
fRowMax[iplan][0][isect] = 1 + TMath::Nint((clengthO - 2. * kCcthick)
/ fRowPadSize - 0.5);
fRowMax[iplan][1][isect] = 1 + TMath::Nint((clengthM - 2. * kCcthick)
AliTRDgeometry::CreateGeometry(idtmed);
- // The TRD mother volume for one sector (Air) (dimensions identical to BTR1)
+ // The TRD mother volume for one sector (Air), full length in z-direction
par_trd[0] = kSwidth1/2.;
par_trd[1] = kSwidth2/2.;
par_trd[2] = kSlenTR1/2.;
par_trd[3] = kSheight/2.;
gMC->Gsvolu("TRD1","TRD1",idtmed[1302-1],par_trd,npar_trd);
+ // The TRD mother volume for one sector (Air), leaving hole for PHOS
+ if (fPHOShole) {
+ gMC->Gsvolu("TRD2","TRD1",idtmed[1302-1],par_trd,npar_trd);
+ }
+
+ // The TRD mother volume for one sector (Air), leaving hole for RICH
+ if (fRICHhole) {
+ gMC->Gsvolu("TRD3","TRD1",idtmed[1302-1],par_trd,npar_trd);
+ }
+
// Position the chambers in the TRD mother volume
for (iplan = 1; iplan <= kNplan; iplan++) {
+ Float_t y1 = fClengthM1[iplan-1] - fClengthM2[iplan-1];
+ Float_t y2 = fClengthO1[iplan-1] - fClengthO3[iplan-1];
+
// The inner chambers ---------------------------------------------------------------
// the aluminum frame
// the aluminum frame
par_cha[0] = fCwidth[iplan-1]/2.;
- par_cha[1] = fClengthM[iplan-1]/2.;
+ par_cha[1] = fClengthM1[iplan-1]/2.;
par_cha[2] = kCaframe/2.;
xpos = 0.;
- ypos = fClengthI[iplan-1]/2. + fClengthM[iplan-1]/2.;
+ ypos = fClengthI[iplan-1]/2. + fClengthM1[iplan-1]/2.;
zpos = kCheight - kCaframe/2. - kSheight/2. + (iplan-1) * (kCheight + kCspace);
gMC->Gsposp("UAFM",iplan ,"TRD1",xpos, ypos,zpos,0,"MANY",par_cha,npar_cha);
gMC->Gsposp("UAFM",iplan+ kNplan,"TRD1",xpos,-ypos,zpos,0,"MANY",par_cha,npar_cha);
+ if (fPHOShole) {
+ par_cha[0] = fCwidth[iplan-1]/2.;
+ par_cha[1] = fClengthM2[iplan-1]/2.;
+ par_cha[2] = kCaframe/2.;
+ xpos = 0.;
+ ypos = fClengthI[iplan-1]/2. + fClengthM2[iplan-1]/2. + y1;
+ zpos = kCheight - kCaframe/2. - kSheight/2. + (iplan-1) * (kCheight + kCspace);
+ gMC->Gsposp("UAFM",iplan+2*kNplan,"TRD2",xpos, ypos,zpos,0,"MANY",par_cha,npar_cha);
+ gMC->Gsposp("UAFM",iplan+3*kNplan,"TRD2",xpos,-ypos,zpos,0,"MANY",par_cha,npar_cha);
+ }
// the inner part of the aluminum frame
- par_cha[0] = fCwidth[iplan-1]/2. - kCathick;
- par_cha[1] = fClengthM[iplan-1]/2. - kCathick;
+ par_cha[0] = fCwidth[iplan-1]/2. - kCathick;
+ par_cha[1] = fClengthM1[iplan-1]/2. - kCathick;
par_cha[2] = kCaframe/2.;
xpos = 0.;
- ypos = fClengthI[iplan-1]/2. + fClengthM[iplan-1]/2.;
+ ypos = fClengthI[iplan-1]/2. + fClengthM1[iplan-1]/2.;
zpos = kCheight - kCaframe/2. - kSheight/2. + (iplan-1) * (kCheight + kCspace);
gMC->Gsposp("UAIM",iplan ,"TRD1",xpos, ypos,zpos,0,"ONLY",par_cha,npar_cha);
gMC->Gsposp("UAIM",iplan+ kNplan,"TRD1",xpos,-ypos,zpos,0,"ONLY",par_cha,npar_cha);
+ if (fPHOShole) {
+ par_cha[0] = fCwidth[iplan-1]/2. - kCathick;
+ par_cha[1] = fClengthM2[iplan-1]/2. - kCathick;
+ par_cha[2] = kCaframe/2.;
+ xpos = 0.;
+ ypos = fClengthI[iplan-1]/2. + fClengthM2[iplan-1]/2. + y1;
+ zpos = kCheight - kCaframe/2. - kSheight/2. + (iplan-1) * (kCheight + kCspace);
+ gMC->Gsposp("UAIM",iplan+2*kNplan,"TRD2",xpos, ypos,zpos,0,"ONLY",par_cha,npar_cha);
+ gMC->Gsposp("UAIM",iplan+3*kNplan,"TRD2",xpos,-ypos,zpos,0,"ONLY",par_cha,npar_cha);
+ }
// the carbon frame
par_cha[0] = fCwidth[iplan-1]/2.;
- par_cha[1] = fClengthM[iplan-1]/2.;
+ par_cha[1] = fClengthM1[iplan-1]/2.;
par_cha[2] = kCcframe/2.;
xpos = 0.;
- ypos = fClengthI[iplan-1]/2. + fClengthM[iplan-1]/2.;
- zpos = kCcframe/2. - kSheight/2. + (iplan-1) * (kCheight + kCspace);
+ ypos = fClengthI[iplan-1]/2. + fClengthM1[iplan-1]/2.;
+ zpos = kCcframe/2. - kSheight/2. + (iplan-1) * (kCheight + kCspace);
gMC->Gsposp("UCFM",iplan ,"TRD1",xpos, ypos,zpos,0,"MANY",par_cha,npar_cha);
gMC->Gsposp("UCFM",iplan+ kNplan,"TRD1",xpos,-ypos,zpos,0,"MANY",par_cha,npar_cha);
+ if (fPHOShole) {
+ par_cha[0] = fCwidth[iplan-1]/2.;
+ par_cha[1] = fClengthM2[iplan-1]/2.;
+ par_cha[2] = kCcframe/2.;
+ xpos = 0.;
+ ypos = fClengthI[iplan-1]/2. + fClengthM2[iplan-1]/2. + y1;
+ zpos = kCcframe/2. - kSheight/2. + (iplan-1) * (kCheight + kCspace);
+ gMC->Gsposp("UCFM",iplan+2*kNplan,"TRD2",xpos, ypos,zpos,0,"MANY",par_cha,npar_cha);
+ gMC->Gsposp("UCFM",iplan+3*kNplan,"TRD2",xpos,-ypos,zpos,0,"MANY",par_cha,npar_cha);
+ }
// the inner part of the carbon frame
- par_cha[0] = fCwidth[iplan-1]/2. - kCcthick;
- par_cha[1] = fClengthM[iplan-1]/2. - kCcthick;
+ par_cha[0] = fCwidth[iplan-1]/2. - kCcthick;
+ par_cha[1] = fClengthM1[iplan-1]/2. - kCcthick;
par_cha[2] = kCcframe/2.;
xpos = 0.;
- ypos = fClengthI[iplan-1]/2. + fClengthM[iplan-1]/2.;
- zpos = kCcframe/2. - kSheight/2. + (iplan-1) * (kCheight + kCspace);
+ ypos = fClengthI[iplan-1]/2. + fClengthM1[iplan-1]/2.;
+ zpos = kCcframe/2. - kSheight/2. + (iplan-1) * (kCheight + kCspace);
gMC->Gsposp("UCIM",iplan ,"TRD1",xpos, ypos,zpos,0,"ONLY",par_cha,npar_cha);
gMC->Gsposp("UCIM",iplan+ kNplan,"TRD1",xpos,-ypos,zpos,0,"ONLY",par_cha,npar_cha);
+ if (fPHOShole) {
+ par_cha[0] = fCwidth[iplan-1]/2. - kCcthick;
+ par_cha[1] = fClengthM2[iplan-1]/2. - kCcthick;
+ par_cha[2] = kCcframe/2.;
+ xpos = 0.;
+ ypos = fClengthI[iplan-1]/2. + fClengthM2[iplan-1]/2. + y1;
+ zpos = kCcframe/2. - kSheight/2. + (iplan-1) * (kCheight + kCspace);
+ gMC->Gsposp("UCIM",iplan+2*kNplan,"TRD2",xpos, ypos,zpos,0,"ONLY",par_cha,npar_cha);
+ gMC->Gsposp("UCIM",iplan+3*kNplan,"TRD2",xpos,-ypos,zpos,0,"ONLY",par_cha,npar_cha);
+ }
// The outer chambers ---------------------------------------------------------------
// the aluminum frame
par_cha[0] = fCwidth[iplan-1]/2.;
- par_cha[1] = fClengthO[iplan-1]/2.;
+ par_cha[1] = fClengthO1[iplan-1]/2.;
par_cha[2] = kCaframe/2.;
xpos = 0.;
- ypos = fClengthI[iplan-1]/2. + fClengthM[iplan-1] + fClengthO[iplan-1]/2.;
+ ypos = fClengthI[iplan-1]/2. + fClengthM1[iplan-1] + fClengthO1[iplan-1]/2.;
zpos = kCheight - kCaframe/2. - kSheight/2. + (iplan-1) * (kCheight + kCspace);
gMC->Gsposp("UAFO",iplan ,"TRD1",xpos, ypos,zpos,0,"MANY",par_cha,npar_cha);
gMC->Gsposp("UAFO",iplan+ kNplan,"TRD1",xpos,-ypos,zpos,0,"MANY",par_cha,npar_cha);
+ if (fPHOShole) {
+ par_cha[0] = fCwidth[iplan-1]/2.;
+ par_cha[1] = fClengthO2[iplan-1]/2.;
+ par_cha[2] = kCaframe/2.;
+ xpos = 0.;
+ ypos = fClengthI[iplan-1]/2. + fClengthM1[iplan-1] + fClengthO2[iplan-1]/2.;
+ zpos = kCheight - kCaframe/2. - kSheight/2. + (iplan-1) * (kCheight + kCspace);
+ gMC->Gsposp("UAFO",iplan+2*kNplan,"TRD2",xpos, ypos,zpos,0,"MANY",par_cha,npar_cha);
+ gMC->Gsposp("UAFO",iplan+3*kNplan,"TRD2",xpos,-ypos,zpos,0,"MANY",par_cha,npar_cha);
+ }
+ if (fRICHhole) {
+ par_cha[0] = fCwidth[iplan-1]/2.;
+ par_cha[1] = fClengthO3[iplan-1]/2.;
+ par_cha[2] = kCaframe/2.;
+ xpos = 0.;
+ ypos = fClengthI[iplan-1]/2. + fClengthM1[iplan-1] + fClengthO3[iplan-1]/2. + y2;
+ zpos = kCheight - kCaframe/2. - kSheight/2. + (iplan-1) * (kCheight + kCspace);
+ gMC->Gsposp("UAFO",iplan+4*kNplan,"TRD3",xpos, ypos,zpos,0,"MANY",par_cha,npar_cha);
+ gMC->Gsposp("UAFO",iplan+5*kNplan,"TRD3",xpos,-ypos,zpos,0,"MANY",par_cha,npar_cha);
+ }
// the inner part of the aluminum frame
- par_cha[0] = fCwidth[iplan-1]/2. - kCathick;
- par_cha[1] = fClengthO[iplan-1]/2. - kCathick;
+ par_cha[0] = fCwidth[iplan-1]/2. - kCathick;
+ par_cha[1] = fClengthO1[iplan-1]/2. - kCathick;
par_cha[2] = kCaframe/2.;
xpos = 0.;
- ypos = fClengthI[iplan-1]/2. + fClengthM[iplan-1] + fClengthO[iplan-1]/2.;
+ ypos = fClengthI[iplan-1]/2. + fClengthM1[iplan-1] + fClengthO1[iplan-1]/2.;
zpos = kCheight - kCaframe/2. - kSheight/2. + (iplan-1) * (kCheight + kCspace);
gMC->Gsposp("UAIO",iplan ,"TRD1",xpos, ypos,zpos,0,"ONLY",par_cha,npar_cha);
gMC->Gsposp("UAIO",iplan+ kNplan,"TRD1",xpos,-ypos,zpos,0,"ONLY",par_cha,npar_cha);
+ if (fPHOShole) {
+ par_cha[0] = fCwidth[iplan-1]/2. - kCathick;
+ par_cha[1] = fClengthO2[iplan-1]/2. - kCathick;
+ par_cha[2] = kCaframe/2.;
+ xpos = 0.;
+ ypos = fClengthI[iplan-1]/2. + fClengthM1[iplan-1] + fClengthO2[iplan-1]/2.;
+ zpos = kCheight - kCaframe/2. - kSheight/2. + (iplan-1) * (kCheight + kCspace);
+ gMC->Gsposp("UAIO",iplan+2*kNplan,"TRD2",xpos, ypos,zpos,0,"ONLY",par_cha,npar_cha);
+ gMC->Gsposp("UAIO",iplan+3*kNplan,"TRD2",xpos,-ypos,zpos,0,"ONLY",par_cha,npar_cha);
+ }
+ if (fRICHhole) {
+ par_cha[0] = fCwidth[iplan-1]/2. - kCathick;
+ par_cha[1] = fClengthO3[iplan-1]/2. - kCathick;
+ par_cha[2] = kCaframe/2.;
+ xpos = 0.;
+ ypos = fClengthI[iplan-1]/2. + fClengthM1[iplan-1] + fClengthO3[iplan-1]/2. + y2;
+ zpos = kCheight - kCaframe/2. - kSheight/2. + (iplan-1) * (kCheight + kCspace);
+ gMC->Gsposp("UAIO",iplan+4*kNplan,"TRD3",xpos, ypos,zpos,0,"ONLY",par_cha,npar_cha);
+ gMC->Gsposp("UAIO",iplan+5*kNplan,"TRD3",xpos,-ypos,zpos,0,"ONLY",par_cha,npar_cha);
+ }
// the carbon frame
par_cha[0] = fCwidth[iplan-1]/2.;
- par_cha[1] = fClengthO[iplan-1]/2.;
+ par_cha[1] = fClengthO1[iplan-1]/2.;
par_cha[2] = kCcframe/2.;
xpos = 0.;
- ypos = fClengthI[iplan-1]/2. + fClengthM[iplan-1] + fClengthO[iplan-1]/2.;
- zpos = kCcframe/2. - kSheight/2. + (iplan-1) * (kCheight + kCspace);
+ ypos = fClengthI[iplan-1]/2. + fClengthM1[iplan-1] + fClengthO1[iplan-1]/2.;
+ zpos = kCcframe/2. - kSheight/2. + (iplan-1) * (kCheight + kCspace);
gMC->Gsposp("UCFO",iplan, "TRD1",xpos, ypos,zpos,0,"MANY",par_cha,npar_cha);
gMC->Gsposp("UCFO",iplan+ kNplan,"TRD1",xpos,-ypos,zpos,0,"MANY",par_cha,npar_cha);
+ if (fPHOShole) {
+ par_cha[0] = fCwidth[iplan-1]/2.;
+ par_cha[1] = fClengthO2[iplan-1]/2.;
+ par_cha[2] = kCcframe/2.;
+ xpos = 0.;
+ ypos = fClengthI[iplan-1]/2. + fClengthM1[iplan-1] + fClengthO2[iplan-1]/2.;
+ zpos = kCcframe/2. - kSheight/2. + (iplan-1) * (kCheight + kCspace);
+ gMC->Gsposp("UCFO",iplan+2*kNplan,"TRD2",xpos, ypos,zpos,0,"MANY",par_cha,npar_cha);
+ gMC->Gsposp("UCFO",iplan+3*kNplan,"TRD2",xpos,-ypos,zpos,0,"MANY",par_cha,npar_cha);
+ }
+ if (fRICHhole) {
+ par_cha[0] = fCwidth[iplan-1]/2.;
+ par_cha[1] = fClengthO3[iplan-1]/2.;
+ par_cha[2] = kCcframe/2.;
+ xpos = 0.;
+ ypos = fClengthI[iplan-1]/2. + fClengthM1[iplan-1] + fClengthO3[iplan-1]/2. + y2;
+ zpos = kCcframe/2. - kSheight/2. + (iplan-1) * (kCheight + kCspace);
+ gMC->Gsposp("UCFO",iplan+4*kNplan,"TRD3",xpos, ypos,zpos,0,"MANY",par_cha,npar_cha);
+ gMC->Gsposp("UCFO",iplan+5*kNplan,"TRD3",xpos,-ypos,zpos,0,"MANY",par_cha,npar_cha);
+ }
// the inner part of the carbon frame
- par_cha[0] = fCwidth[iplan-1]/2. - kCcthick;
- par_cha[1] = fClengthO[iplan-1]/2. - kCcthick;
+ par_cha[0] = fCwidth[iplan-1]/2. - kCcthick;
+ par_cha[1] = fClengthO1[iplan-1]/2. - kCcthick;
par_cha[2] = kCcframe/2.;
xpos = 0.;
- ypos = fClengthI[iplan-1]/2. + fClengthM[iplan-1] + fClengthO[iplan-1]/2.;
- zpos = kCcframe/2. - kSheight/2. + (iplan-1) * (kCheight + kCspace);
+ ypos = fClengthI[iplan-1]/2. + fClengthM1[iplan-1] + fClengthO1[iplan-1]/2.;
+ zpos = kCcframe/2. - kSheight/2. + (iplan-1) * (kCheight + kCspace);
gMC->Gsposp("UCIO",iplan ,"TRD1",xpos, ypos,zpos,0,"ONLY",par_cha,npar_cha);
gMC->Gsposp("UCIO",iplan+ kNplan,"TRD1",xpos,-ypos,zpos,0,"ONLY",par_cha,npar_cha);
+ if (fPHOShole) {
+ par_cha[0] = fCwidth[iplan-1]/2. - kCcthick;
+ par_cha[1] = fClengthO2[iplan-1]/2. - kCcthick;
+ par_cha[2] = kCcframe/2.;
+ xpos = 0.;
+ ypos = fClengthI[iplan-1]/2. + fClengthM1[iplan-1] + fClengthO2[iplan-1]/2.;
+ zpos = kCcframe/2. - kSheight/2. + (iplan-1) * (kCheight + kCspace);
+ gMC->Gsposp("UCIO",iplan+2*kNplan,"TRD2",xpos, ypos,zpos,0,"ONLY",par_cha,npar_cha);
+ gMC->Gsposp("UCIO",iplan+3*kNplan,"TRD2",xpos,-ypos,zpos,0,"ONLY",par_cha,npar_cha);
+ }
+ if (fRICHhole) {
+ par_cha[0] = fCwidth[iplan-1]/2. - kCcthick;
+ par_cha[1] = fClengthO3[iplan-1]/2. - kCcthick;
+ par_cha[2] = kCcframe/2.;
+ xpos = 0.;
+ ypos = fClengthI[iplan-1]/2. + fClengthM1[iplan-1] + fClengthO3[iplan-1]/2. + y2;
+ zpos = kCcframe/2. - kSheight/2. + (iplan-1) * (kCheight + kCspace);
+ gMC->Gsposp("UCIO",iplan+4*kNplan,"TRD3",xpos, ypos,zpos,0,"ONLY",par_cha,npar_cha);
+ gMC->Gsposp("UCIO",iplan+5*kNplan,"TRD3",xpos,-ypos,zpos,0,"ONLY",par_cha,npar_cha);
+ }
}
ypos = 0.;
zpos = 0.;
gMC->Gspos("TRD1",1,"BTR1",xpos,ypos,zpos,0,"ONLY");
- gMC->Gspos("TRD1",2,"BTR2",xpos,ypos,zpos,0,"ONLY");
- gMC->Gspos("TRD1",3,"BTR3",xpos,ypos,zpos,0,"ONLY");
+ if (fPHOShole)
+ gMC->Gspos("TRD2",2,"BTR2",xpos,ypos,zpos,0,"ONLY");
+ else
+ gMC->Gspos("TRD1",2,"BTR2",xpos,ypos,zpos,0,"ONLY");
+ if (fRICHhole)
+ gMC->Gspos("TRD3",3,"BTR3",xpos,ypos,zpos,0,"ONLY");
+ else
+ gMC->Gspos("TRD1",3,"BTR3",xpos,ypos,zpos,0,"ONLY");
}
AliTRDgeometryFull();
~AliTRDgeometryFull();
- virtual void CreateGeometry(Int_t *);
- virtual Int_t IsVersion() const { return 1; };
- virtual void Init();
+ void CreateGeometry(Int_t *);
+ Int_t IsVersion() const { return 1; };
+ void Init();
+
+ void SetPHOShole() { fPHOShole = kTRUE; };
+ void SetRICHhole() { fRICHhole = kTRUE; };
+
+ Bool_t GetPHOShole() { return fPHOShole; };
+ Bool_t GetRICHhole() { return fRICHhole; };
protected:
+ Bool_t fPHOShole; // Switch for the hole in front of the PHOS
+ Bool_t fRICHhole; // Switch for the hole in front of the RICH
+
Float_t fClengthI[kNplan]; // Length of the inner chambers
- Float_t fClengthM[kNplan]; // Length of the middle chambers
- Float_t fClengthO[kNplan]; // Length of the outer chambers
- Float_t fCwidth[kNplan]; // Width of the chambers
+ Float_t fClengthM1[kNplan]; // Length of the middle chambers
+ Float_t fClengthM2[kNplan]; //
+ Float_t fClengthO1[kNplan]; // Length of the outer chambers
+ Float_t fClengthO2[kNplan]; //
+ Float_t fClengthO3[kNplan]; //
ClassDef(AliTRDgeometryFull,1) // TRD geometry without hole
AliTRDgeometryHole();
~AliTRDgeometryHole();
- virtual void CreateGeometry(Int_t *);
- virtual Int_t IsVersion() const { return 0; };
- virtual void Init();
+ void CreateGeometry(Int_t *);
+ Int_t IsVersion() const { return 0; };
+ void Init();
+
+ void SetPHOShole() { };
+ void SetRICHhole() { };
+
+ Bool_t GetPHOShole() { return kTRUE; };
+ Bool_t GetRICHhole() { return kTRUE; };
protected:
--- /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$
+Revision 1.1.2.1 2000/05/08 14:48:31 cblume
+AliTRDhit class now in separate files
+
+*/
+
+///////////////////////////////////////////////////////////////////////////////
+// //
+// Hit object for the TRD //
+// //
+///////////////////////////////////////////////////////////////////////////////
+
+#include "AliTRDhit.h"
+
+ClassImp(AliTRDhit)
+
+//_____________________________________________________________________________
+AliTRDhit::AliTRDhit(Int_t shunt, Int_t track, Int_t det, Float_t *hits)
+ :AliHit(shunt, track)
+{
+ //
+ // Create a TRD hit
+ //
+
+ // Store volume hierarchy
+ fDetector = det;
+
+ // Store position and charge
+ fX = hits[0];
+ fY = hits[1];
+ fZ = hits[2];
+ fQ = hits[3];
+
+}
--- /dev/null
+#ifndef TRDhit_H
+#define TRDhit_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice */
+
+/* $Id: AliTRDhit.h,v */
+
+////////////////////////////////////////////////
+// Hit class for the TRD //
+////////////////////////////////////////////////
+
+#include "AliHit.h"
+
+//_____________________________________________________________________________
+class AliTRDhit : public AliHit {
+
+ public:
+
+ Int_t fDetector; // TRD detector number
+ Float_t fQ; // Charge created by a hit (slow simulator only)
+
+ public:
+
+ AliTRDhit() {}
+ AliTRDhit(Int_t shunt, Int_t track, Int_t det, Float_t *hits);
+ virtual ~AliTRDhit() {};
+
+ ClassDef(AliTRDhit,2) // Hit for the Transition Radiation Detector
+
+};
+
+#endif
class AliTRDmatrix : public TObject {
protected:
+
Int_t fRow; // Number of pad-rows
Int_t fCol; // Number of pad-columns
Int_t fTime; // Number of time buckets
virtual AliTRDpixel *GetPixel(Int_t iRow, Int_t iCol, Int_t iTime);
public:
+
AliTRDmatrix();
AliTRDmatrix(Int_t nRow, Int_t nCol, Int_t nTime, Int_t iSec, Int_t iCha, Int_t iPla);
virtual ~AliTRDmatrix();
virtual void DrawRow(Int_t iRow);
virtual void DrawCol(Int_t iCol);
virtual void DrawTime(Int_t iTime);
+ virtual void ProjRow();
+ virtual void ProjCol();
+ virtual void ProjTime();
virtual void SetSignal(Int_t iRow, Int_t iCol, Int_t iTime, Float_t signal);
virtual void SetTrack(Int_t iRow, Int_t iCol, Int_t iTime
public:
AliTRDrecPoint();
- virtual ~AliTRDrecPoint() {};
- virtual void Print(Option_t * opt = "void") {};
- virtual void AddDigit(Int_t digit);
-
- virtual void SetAmplitude(Float_t amp) { fAmp = amp; };
- virtual void SetDetector(Int_t det) { fDetector = det; };
- virtual void SetLocalPosition(TVector3 &pos);
-
- virtual Int_t GetDetector() { return fDetector; };
+ ~AliTRDrecPoint() {};
+ virtual void Print(Option_t * opt = "void") {};
+ virtual void AddDigit(Int_t digit);
+
+ virtual void SetEnergy(Float_t amp) { fAmp = amp; };
+ virtual void SetDetector(Int_t det) { fDetector = det; };
+ virtual void SetLocalPosition(TVector3 &pos);
+ virtual void SetLocalRow(Float_t r) { fLocPos.SetX(r); };
+ virtual void SetLocalCol(Float_t c) { fLocPos.SetY(c); };
+ virtual void SetLocalTime(Float_t t) { fLocPos.SetZ(t); };
+
+ virtual Int_t GetDetector() { return fDetector; };
+ virtual Int_t GetDigit(Int_t i = 0) { if (i < fMulDigit)
+ return fDigitsList[i];
+ else
+ return -1;};
+ virtual Float_t GetLocalRow() { return fLocPos(0); };
+ virtual Float_t GetLocalCol() { return fLocPos(1); };
+ virtual Float_t GetLocalTime() { return fLocPos(2); };
protected:
/*
$Log$
+Revision 1.1.4.1 2000/05/08 14:55:03 cblume
+Bug fixes
+
+Revision 1.1 2000/02/28 19:02:32 cblume
+Add new TRD classes
+
*/
///////////////////////////////////////////////////////////////////////////////
}
//_____________________________________________________________________________
-AliTRDsegmentArray::AliTRDsegmentArray(Int_t n)
- :AliTRDsegmentArrayBase("AliTRDdataArray",n)
+AliTRDsegmentArray::AliTRDsegmentArray(Text_t *classname, Int_t n)
+ :AliTRDsegmentArrayBase(classname,n)
{
//
// Constructor creating an array of AliTRDdataArray of size <n>
public:
AliTRDsegmentArray();
- AliTRDsegmentArray(Int_t n);
+ AliTRDsegmentArray(Text_t *classname, Int_t n);
~AliTRDsegmentArray() { };
virtual void Delete();
/*
$Log$
+Revision 1.1.4.1 2000/05/08 14:55:03 cblume
+Bug fixes
+
+Revision 1.1 2000/02/28 19:02:56 cblume
+Add new TRD classes
+
*/
///////////////////////////////////////////////////////////////////////////////
#include "AliTRDsegmentID.h"
#include "AliTRDsegmentArrayBase.h"
-//_____________________________________________________________________________
ClassImp(AliTRDsegmentArrayBase)
+//_____________________________________________________________________________
AliTRDsegmentArrayBase::AliTRDsegmentArrayBase()
{
//
//
//
- fNSegment=0;
- fSegment =0;
+
+ fNSegment = 0;
+ fSegment = 0;
fTreeIndex = 0;
- fTree = 0;
- fClass = 0;
+ fTree = 0;
+ fClass = 0;
+
}
+//_____________________________________________________________________________
AliTRDsegmentArrayBase::AliTRDsegmentArrayBase(Text_t *classname, Int_t n)
{
//
}
}
+//_____________________________________________________________________________
Bool_t AliTRDsegmentArrayBase:: SetClass(Text_t *classname)
{
//
return kTRUE;
}
+//_____________________________________________________________________________
//Bool_t AliTRDsegmentArrayBase::ClassError( )
//{
//signalize class error
//// return kFALSE;
//}
+//_____________________________________________________________________________
AliTRDsegmentArrayBase::~AliTRDsegmentArrayBase()
{
if (fNSegment>0){
if (fClass!=0) delete fClass;
}
+//_____________________________________________________________________________
AliTRDsegmentID * AliTRDsegmentArrayBase::NewSegment()
{
//
return segment;
}
-
+//_____________________________________________________________________________
Bool_t AliTRDsegmentArrayBase::AddSegment(AliTRDsegmentID *segment)
{
//
return kTRUE;
}
+//_____________________________________________________________________________
AliTRDsegmentID * AliTRDsegmentArrayBase::AddSegment(Int_t index)
{
//
return segment;
}
-
-
+//_____________________________________________________________________________
Bool_t AliTRDsegmentArrayBase::MakeArray(Int_t n)
{
//
else return kFALSE;
}
-
+//_____________________________________________________________________________
void AliTRDsegmentArrayBase::ClearSegment(Int_t index)
{
//
}
}
-
+//_____________________________________________________________________________
void AliTRDsegmentArrayBase::MakeTree()
{
// AliTRDsegmentID segment;
delete psegment;
}
+//_____________________________________________________________________________
Bool_t AliTRDsegmentArrayBase::ConnectTree(const char * treeName)
{
//connect tree from current directory
return kTRUE;
}
+//_____________________________________________________________________________
AliTRDsegmentID *AliTRDsegmentArrayBase::LoadSegment(Int_t index)
{
//
return s;
// AbstractMethod("LoadSegment");
}
+
+//_____________________________________________________________________________
AliTRDsegmentID *AliTRDsegmentArrayBase::LoadEntry(Int_t index)
{
//
fTree->Fill();
}
+//_____________________________________________________________________________
Bool_t AliTRDsegmentArrayBase::MakeDictionary(Int_t size)
{
//
virtual void SetHits(Int_t ihit = 1) { fHitsOn = ihit; };
- virtual Int_t GetSensChamber() { return 0; };
- virtual Int_t GetSensPlane() { return 0; };
- virtual Int_t GetSensSector() { return 0; };
+ void SetSensChamber(Int_t ichamber) { };
+ void SetSensPlane(Int_t iplane) { };
+ void SetSensSector(Int_t isector) { };
+
+ Int_t GetSensChamber() { return 0; };
+ Int_t GetSensPlane() { return 0; };
+ Int_t GetSensSector() { return 0; };
protected:
/*
$Log$
+Revision 1.17.2.1 2000/05/08 14:59:16 cblume
+Made inline function non-virtual. Bug fix in setting sensitive chamber
+
+Revision 1.17 2000/02/28 19:10:26 cblume
+Include the new TRD classes
+
Revision 1.16.4.1 2000/02/28 18:04:35 cblume
Change to new hit version, introduce geometry class, and move digitization and clustering to AliTRDdigitizer/AliTRDclusterizerV1
// Check on selected volumes
Int_t addthishit = 1;
if (fSensSelect) {
- if ((fSensPlane) && (pla != fSensPlane )) addthishit = 0;
- if ((fSensChamber) && (cha != fSensChamber)) addthishit = 0;
- if ((fSensSector) && (sec != fSensSector )) addthishit = 0;
+ if ((fSensPlane >= 0) && (pla != fSensPlane )) addthishit = 0;
+ if ((fSensChamber >= 0) && (cha != fSensChamber)) addthishit = 0;
+ if ((fSensSector >= 0) && (sec != fSensSector )) addthishit = 0;
}
// Add this hit
virtual void StepManager();
virtual void Init();
- virtual void SetSensPlane(Int_t iplane = 0);
- virtual void SetSensChamber(Int_t ichamber = 0);
- virtual void SetSensSector(Int_t isector = 0);
+ void SetSensPlane(Int_t iplane = 0);
+ void SetSensChamber(Int_t ichamber = 0);
+ void SetSensSector(Int_t isector = 0);
- virtual Int_t GetSensPlane() { return fSensPlane; };
- virtual Int_t GetSensChamber() { return fSensChamber; };
- virtual Int_t GetSensSector() { return fSensSector; };
+ Int_t GetSensPlane() { return fSensPlane; };
+ Int_t GetSensChamber() { return fSensChamber; };
+ Int_t GetSensSector() { return fSensSector; };
protected:
{
gMC->Gsatt("*", "seen", -1);
gMC->Gsatt("alic", "seen", 0);
- AliTRD *TRD = gAlice->GetModule("TRD");
- if (TRD->Hole())
- gROOT->LoadMacro("ViewTRDhole.C");
- gInterpreter->ProcessLine("ViewTRDhole()");
- else
- gROOT->LoadMacro("ViewTRDfull.C");
- gInterpreter->ProcessLine("ViewTRDfull()");
+ AliTRD *TRD = (AliTRD *) gAlice->GetModule("TRD");
+ AliTRDgeometry *Geo = TRD->GetGeometry();
+ gROOT->LoadMacro("ViewTRD.C");
+ if (Geo->IsVersion() == 0) {
+ gInterpreter->ProcessLine("ViewTRDhole()");
+ }
+ else {
+ if (Geo->GetPHOShole()) {
+ if (Geo->GetRICHhole()) {
+ gInterpreter->ProcessLine("ViewTRDfull3()");
+ }
+ else {
+ gInterpreter->ProcessLine("ViewTRDfull1()");
+ }
+ }
+ else {
+ if (Geo->GetRICHhole()) {
+ gInterpreter->ProcessLine("ViewTRDfull2()");
+ }
+ else {
+ gInterpreter->ProcessLine("ViewTRDfull0()");
+ }
+ }
+ }
gMC->Gdopt("hide", "on");
gMC->Gdopt("shad", "on");
gMC->Gsatt("*", "fill", 7);
# C++ sources
-SRCS = AliTRD.cxx AliTRDv0.cxx AliTRDv1.cxx \
- AliTRDpixel.cxx AliTRDmatrix.cxx \
- AliTRDgeometry.cxx AliTRDgeometryFull.cxx \
- AliTRDgeometryHole.cxx AliTRDdigitizer.cxx \
- AliTRDclusterizer.cxx AliTRDclusterizerV0.cxx \
- AliTRDclusterizerV1.cxx AliTRDrecPoint.cxx \
- AliTRDsegmentArray.cxx AliTRDdataArray.cxx \
- AliTRDsegmentID.cxx AliTRDsegmentArrayBase.cxx \
- AliTRDarrayI.cxx
+SRCS = AliTRD.cxx AliTRDv0.cxx AliTRDv1.cxx \
+ AliTRDhit.cxx AliTRDdigit.cxx \
+ AliTRDpixel.cxx AliTRDmatrix.cxx \
+ AliTRDgeometry.cxx AliTRDgeometryFull.cxx \
+ AliTRDgeometryHole.cxx AliTRDdigitizer.cxx \
+ AliTRDclusterizer.cxx AliTRDclusterizerV0.cxx \
+ AliTRDclusterizerV1.cxx AliTRDrecPoint.cxx \
+ AliTRDsegmentArray.cxx AliTRDdataArray.cxx \
+ AliTRDdataArrayI.cxx AliTRDdataArrayF.cxx \
+ AliTRDdigitsManager.cxx \
+ AliTRDsegmentID.cxx AliTRDsegmentArrayBase.cxx \
+ AliTRDarrayI.cxx AliTRDarrayF.cxx
# C++ Headers
#pragma link off all classes;
#pragma link off all functions;
-#pragma link C++ class AliTRD-;
+#pragma link C++ class AliTRD;
#pragma link C++ class AliTRDv0;
#pragma link C++ class AliTRDv1;
#pragma link C++ class AliTRDhit;
#pragma link C++ class AliTRDdigit;
-#pragma link C++ class AliTRDcluster;
+#pragma link C++ class AliTRDdigitsManager;
#pragma link C++ class AliTRDpixel;
#pragma link C++ class AliTRDmatrix;
#pragma link C++ class AliTRDgeometry;
#pragma link C++ class AliTRDrecPoint;
#pragma link C++ class AliTRDsegmentArray;
#pragma link C++ class AliTRDdataArray;
+#pragma link C++ class AliTRDdataArrayI;
+#pragma link C++ class AliTRDdataArrayF;
#pragma link C++ class AliTRDsegmentID;
#pragma link C++ class AliTRDsegmentArrayBase;
#pragma link C++ class AliTRDarrayI;
+#pragma link C++ class AliTRDarrayF;
#endif
-void ViewTRD()
+//_____________________________________________________________________________
+void ViewTRDhole()
{
+ //
+ // Draw a view of the TRD geometry with holes
+ //
- gMC->Gsatt("B032","SEEN", 0);
- gMC->Gsatt("B028","SEEN", 0);
- gMC->Gsatt("B029","SEEN", 0);
- gMC->Gsatt("B030","SEEN", 0);
+ gMC->Gsatt("B071","SEEN", 0);
+ gMC->Gsatt("B074","SEEN", 0);
+ gMC->Gsatt("B075","SEEN", 0);
+ gMC->Gsatt("B077","SEEN", 0);
+ gMC->Gsatt("B078","SEEN", 0);
+ gMC->Gsatt("B079","SEEN", 0);
gMC->Gsatt("BTR1","SEEN", 0);
gMC->Gsatt("BTR2","SEEN", 0);
gMC->Gsatt("BTR3","SEEN", 0);
- gMC->Gsatt("TRD" ,"SEEN", 0);
+ gMC->Gsatt("TRD1","SEEN", 0);
+ gMC->Gsatt("TRD2","SEEN", 0);
+ gMC->Gsatt("TRD3","SEEN", 0);
gMC->Gsatt("UCII","SEEN", 0);
gMC->Gsatt("UCIM","SEEN", 0);
gMC->Gsatt("UCIO","SEEN", 0);
gMC->Gsatt("UL06","SEEN", 1);
}
+
+//_____________________________________________________________________________
+void ViewTRDfull0()
+{
+ //
+ // Draws a view of the TRD geometry w/o holes
+ //
+
+ gMC->Gsatt("B071","SEEN", 0);
+ gMC->Gsatt("B074","SEEN", 0);
+ gMC->Gsatt("B075","SEEN", 0);
+ gMC->Gsatt("B077","SEEN", 0);
+ gMC->Gsatt("BTR1","SEEN", 0);
+ gMC->Gsatt("BTR2","SEEN", 0);
+ gMC->Gsatt("BTR3","SEEN", 0);
+ gMC->Gsatt("TRD1","SEEN", 0);
+ gMC->Gsatt("UCII","SEEN", 0);
+ gMC->Gsatt("UCIM","SEEN", 0);
+ gMC->Gsatt("UCIO","SEEN", 0);
+ gMC->Gsatt("UL02","SEEN", 1);
+ gMC->Gsatt("UL05","SEEN", 1);
+ gMC->Gsatt("UL06","SEEN", 1);
+
+}
+
+//_____________________________________________________________________________
+void ViewTRDfull1()
+{
+ //
+ // Draws a view of the TRD geometry w/o holes
+ //
+
+ gMC->Gsatt("B071","SEEN", 0);
+ gMC->Gsatt("B074","SEEN", 0);
+ gMC->Gsatt("B075","SEEN", 0);
+ gMC->Gsatt("B077","SEEN", 0);
+ gMC->Gsatt("BTR1","SEEN", 0);
+ gMC->Gsatt("BTR2","SEEN", 0);
+ gMC->Gsatt("BTR3","SEEN", 0);
+ gMC->Gsatt("TRD1","SEEN", 0);
+ gMC->Gsatt("TRD2","SEEN", 0);
+ gMC->Gsatt("UCII","SEEN", 0);
+ gMC->Gsatt("UCIM","SEEN", 0);
+ gMC->Gsatt("UCIO","SEEN", 0);
+ gMC->Gsatt("UL02","SEEN", 1);
+ gMC->Gsatt("UL05","SEEN", 1);
+ gMC->Gsatt("UL06","SEEN", 1);
+
+}
+
+//_____________________________________________________________________________
+void ViewTRDfull2()
+{
+ //
+ // Draws a view of the TRD geometry w/o holes
+ //
+
+ gMC->Gsatt("B071","SEEN", 0);
+ gMC->Gsatt("B074","SEEN", 0);
+ gMC->Gsatt("B075","SEEN", 0);
+ gMC->Gsatt("B077","SEEN", 0);
+ gMC->Gsatt("BTR1","SEEN", 0);
+ gMC->Gsatt("BTR2","SEEN", 0);
+ gMC->Gsatt("BTR3","SEEN", 0);
+ gMC->Gsatt("TRD1","SEEN", 0);
+ gMC->Gsatt("TRD3","SEEN", 0);
+ gMC->Gsatt("UCII","SEEN", 0);
+ gMC->Gsatt("UCIM","SEEN", 0);
+ gMC->Gsatt("UCIO","SEEN", 0);
+ gMC->Gsatt("UL02","SEEN", 1);
+ gMC->Gsatt("UL05","SEEN", 1);
+ gMC->Gsatt("UL06","SEEN", 1);
+
+}
+
+//_____________________________________________________________________________
+void ViewTRDfull3()
+{
+ //
+ // Draws a view of the TRD geometry w/o holes
+ //
+
+ gMC->Gsatt("B071","SEEN", 0);
+ gMC->Gsatt("B074","SEEN", 0);
+ gMC->Gsatt("B075","SEEN", 0);
+ gMC->Gsatt("B077","SEEN", 0);
+ gMC->Gsatt("BTR1","SEEN", 0);
+ gMC->Gsatt("BTR2","SEEN", 0);
+ gMC->Gsatt("BTR3","SEEN", 0);
+ gMC->Gsatt("TRD1","SEEN", 0);
+ gMC->Gsatt("TRD2","SEEN", 0);
+ gMC->Gsatt("TRD3","SEEN", 0);
+ gMC->Gsatt("UCII","SEEN", 0);
+ gMC->Gsatt("UCIM","SEEN", 0);
+ gMC->Gsatt("UCIO","SEEN", 0);
+ gMC->Gsatt("UL02","SEEN", 1);
+ gMC->Gsatt("UL05","SEEN", 1);
+ gMC->Gsatt("UL06","SEEN", 1);
+
+}
+ gMC->Gsatt("TRD1","SEEN", 0);
+++ /dev/null
-void ViewTRD()
-{
- geant3->Gsatt("TRD ","seen",0);
- geant3->Gsatt("UTRS","seen",0);
- geant3->Gsatt("UTRI","seen",0);
-
- geant3->Gsatt("UTCI","seen",0);
- geant3->Gsatt("UTCN","seen",0);
- geant3->Gsatt("UTCO","seen",0);
-
- geant3->Gsatt("UTII","seen",0);
- geant3->Gsatt("UTIN","seen",0);
- geant3->Gsatt("UTIO","seen",0);
-
- geant3->Gsatt("UTMI","seen",0);
- geant3->Gsatt("UTMN","seen",0);
- geant3->Gsatt("UTMO","seen",0);
-
- geant3->Gsatt("UT1I","seen",1);
- geant3->Gsatt("UT1N","seen",1);
- geant3->Gsatt("UT1O","seen",1);
-
- geant3->Gsatt("UT4I","seen",1);
- geant3->Gsatt("UT4N","seen",1);
- geant3->Gsatt("UT4O","seen",1);
-
-}
+++ /dev/null
-void ViewTRD()
-{
- geant3->Gsatt("TRD ","seen",0);
- geant3->Gsatt("UTRD","seen",0);
- geant3->Gsatt("UTRS","seen",0);
- geant3->Gsatt("UTRI","seen",0);
-
- geant3->Gsatt("UTCI","seen",0);
- geant3->Gsatt("UTCN","seen",0);
- geant3->Gsatt("UTCO","seen",0);
-
- geant3->Gsatt("UTII","seen",0);
- geant3->Gsatt("UTIN","seen",0);
- geant3->Gsatt("UTIO","seen",0);
-
- geant3->Gsatt("UTMI","seen",0);
- geant3->Gsatt("UTMN","seen",0);
- geant3->Gsatt("UTMO","seen",0);
-
- geant3->Gsatt("UT1I","seen",1);
- geant3->Gsatt("UT1N","seen",1);
- geant3->Gsatt("UT1O","seen",1);
-
- geant3->Gsatt("UT4I","seen",1);
- geant3->Gsatt("UT4N","seen",1);
- geant3->Gsatt("UT4O","seen",1);
-
-}
+++ /dev/null
-void ViewTRD()
-{
-
- geant3->Gsatt("TRD ","seen",0);
- geant3->Gsatt("UTRS","seen",0);
- geant3->Gsatt("UTRI","seen",0);
-
- geant3->Gsatt("UCI1","seen",0);
- geant3->Gsatt("UCI2","seen",0);
- geant3->Gsatt("UCI3","seen",0);
- geant3->Gsatt("UCI4","seen",0);
- geant3->Gsatt("UCI5","seen",0);
- geant3->Gsatt("UCI6","seen",0);
- geant3->Gsatt("UCN1","seen",0);
- geant3->Gsatt("UCN2","seen",0);
- geant3->Gsatt("UCN3","seen",0);
- geant3->Gsatt("UCN4","seen",0);
- geant3->Gsatt("UCN5","seen",0);
- geant3->Gsatt("UCN6","seen",0);
- geant3->Gsatt("UCO1","seen",0);
- geant3->Gsatt("UCO2","seen",0);
- geant3->Gsatt("UCO3","seen",0);
- geant3->Gsatt("UCO4","seen",0);
- geant3->Gsatt("UCO5","seen",0);
- geant3->Gsatt("UCO6","seen",0);
-
- geant3->Gsatt("UII1","seen",0);
- geant3->Gsatt("UII2","seen",0);
- geant3->Gsatt("UII3","seen",0);
- geant3->Gsatt("UII4","seen",0);
- geant3->Gsatt("UII5","seen",0);
- geant3->Gsatt("UII6","seen",0);
- geant3->Gsatt("UIN1","seen",0);
- geant3->Gsatt("UIN2","seen",0);
- geant3->Gsatt("UIN3","seen",0);
- geant3->Gsatt("UIN4","seen",0);
- geant3->Gsatt("UIN5","seen",0);
- geant3->Gsatt("UIN6","seen",0);
- geant3->Gsatt("UIO1","seen",0);
- geant3->Gsatt("UIO2","seen",0);
- geant3->Gsatt("UIO3","seen",0);
- geant3->Gsatt("UIO4","seen",0);
- geant3->Gsatt("UIO5","seen",0);
- geant3->Gsatt("UIO6","seen",0);
-
- geant3->Gsatt("UT1I","seen",1);
- geant3->Gsatt("UT1N","seen",1);
- geant3->Gsatt("UT1O","seen",1);
-
- geant3->Gsatt("UXI1","seen",1);
- geant3->Gsatt("UXI2","seen",1);
- geant3->Gsatt("UXI3","seen",1);
- geant3->Gsatt("UXI4","seen",1);
- geant3->Gsatt("UXI5","seen",1);
- geant3->Gsatt("UXI6","seen",1);
- geant3->Gsatt("UXN1","seen",1);
- geant3->Gsatt("UXN2","seen",1);
- geant3->Gsatt("UXN3","seen",1);
- geant3->Gsatt("UXN4","seen",1);
- geant3->Gsatt("UXN5","seen",1);
- geant3->Gsatt("UXN6","seen",1);
- geant3->Gsatt("UXO1","seen",1);
- geant3->Gsatt("UXO2","seen",1);
- geant3->Gsatt("UXO3","seen",1);
- geant3->Gsatt("UXO4","seen",1);
- geant3->Gsatt("UXO5","seen",1);
- geant3->Gsatt("UXO6","seen",1);
-
-}
+++ /dev/null
-{
-
- gMC->Gsatt("B071","SEEN", 0);
- gMC->Gsatt("B074","SEEN", 0);
- gMC->Gsatt("B075","SEEN", 0);
- gMC->Gsatt("B077","SEEN", 0);
- gMC->Gsatt("BTR1","SEEN", 0);
- gMC->Gsatt("BTR2","SEEN", 0);
- gMC->Gsatt("BTR3","SEEN", 0);
- gMC->Gsatt("TRD1","SEEN", 0);
- gMC->Gsatt("UCII","SEEN", 0);
- gMC->Gsatt("UCIM","SEEN", 0);
- gMC->Gsatt("UCIO","SEEN", 0);
- gMC->Gsatt("UL02","SEEN", 1);
- gMC->Gsatt("UL05","SEEN", 1);
- gMC->Gsatt("UL06","SEEN", 1);
-
-}
+++ /dev/null
-{
-
- gMC->Gsatt("B071","SEEN", 0);
- gMC->Gsatt("B074","SEEN", 0);
- gMC->Gsatt("B075","SEEN", 0);
- gMC->Gsatt("B077","SEEN", 0);
- gMC->Gsatt("B078","SEEN", 0);
- gMC->Gsatt("B079","SEEN", 0);
- gMC->Gsatt("BTR1","SEEN", 0);
- gMC->Gsatt("BTR2","SEEN", 0);
- gMC->Gsatt("BTR3","SEEN", 0);
- gMC->Gsatt("TRD1","SEEN", 0);
- gMC->Gsatt("TRD2","SEEN", 0);
- gMC->Gsatt("TRD3","SEEN", 0);
- gMC->Gsatt("UCII","SEEN", 0);
- gMC->Gsatt("UCIM","SEEN", 0);
- gMC->Gsatt("UCIO","SEEN", 0);
- gMC->Gsatt("UL02","SEEN", 1);
- gMC->Gsatt("UL05","SEEN", 1);
- gMC->Gsatt("UL06","SEEN", 1);
-
-}
}
// Input file name
- Char_t *alifile = "galice_c_v0.root";
+ Char_t *alifile = "galice_r_v0.root";
// Event number
Int_t nEvent = 0;
- // Define the objects
- AliTRDv1 *TRD;
- TClonesArray *TRDCluster;
- AliTRDcluster *OneTRDcluster;
-
- TH1F *hZ = new TH1F("hZ","Cluster z-position",700,-350.0,350.0);
+ TH2F *HLocal = new TH2F("HLocal" ,"rec. points local row/col-position"
+ ,21,-0.5,20.5,81,-0.5,80.5);
+ TH2F *HGlobal = new TH2F("HGlobal","rec. points global x/y-position"
+ ,800,-400,400,800,-400,400);
// Connect the AliRoot file containing Geometry, Kine, Hits, and Digits
TFile *gafl = (TFile*) gROOT->GetListOfFiles()->FindObject(alifile);
}
// Get AliRun object from file or create it if not on file
- if (!gAlice) {
- gAlice = (AliRun*) gafl->Get("gAlice");
- if (gAlice)
- cout << "AliRun object found on file" << endl;
- else
- gAlice = new AliRun("gAlice","Alice test program");
- }
+ gAlice = (AliRun*) gafl->Get("gAlice");
+ if (gAlice)
+ cout << "AliRun object found on file" << endl;
+ else
+ gAlice = new AliRun("gAlice","Alice test program");
// Import the Trees for the event nEvent in the file
Int_t nparticles = gAlice->GetEvent(nEvent);
if (nparticles <= 0) break;
// Get the pointer to the tree
- TTree *ClusterTree = gAlice->TreeD();
-
+ TTree *RecTree = gAlice->TreeR();
+ RecTree->Print();
// Get the pointer to the detector classes
- TRD = (AliTRDv1 *) gAlice->GetDetector("TRD");
+ AliTRDv0 *TRD = (AliTRDv0*) gAlice->GetDetector("TRD");
+ // Get the geometry
+ AliTRDgeometry *TRDgeometry = TRD->GetGeometry();
// Get the pointer to the hit container
- if (TRD) TRDCluster = TRD->Cluster();
-
- // Reconstruct the address
- ClusterTree->GetBranch("TRDcluster")->SetAddress(&TRDCluster);
+ TObjArray *RecPointArray = TRD->RecPoints();
+ // Set the branch address
+ RecTree->GetBranch("TRDrecPoints")->SetAddress(&RecPointArray);
- Int_t nEntries = ClusterTree->GetEntries();
- cout << "Number of entries in cluster tree = " << nEntries << endl;
+ Int_t nEntries = RecTree->GetEntries();
+ cout << "Number of entries in reconstruction tree = " << nEntries << endl;
// Loop through all entries in the tree
Int_t nbytes;
cout << "iEntry = " << iEntry << endl;
// Import the tree
- gAlice->ResetDigits();
- nbytes += ClusterTree->GetEvent(iEntry);
+ nbytes += RecTree->GetEvent(iEntry);
- // Get the number of digits in the detector
- Int_t nTRDCluster = TRDCluster->GetEntriesFast();
- cout << " nTRDCluster = " << nTRDCluster << endl;
+ // Get the number of points in the detector
+ Int_t nRecPoint = RecPointArray->GetEntriesFast();
+ cout << " nRecPoint = " << nRecPoint << endl;
// Loop through all TRD digits
- for (Int_t iTRDCluster = 0; iTRDCluster < nTRDCluster; iTRDCluster++) {
+ for (Int_t iRecPoint = 0; iRecPoint < nRecPoint; iRecPoint++) {
// Get the information for this digit
- OneTRDcluster = (AliTRDcluster*) TRDCluster->UncheckedAt(iTRDCluster);
- hZ->Fill(OneTRDcluster->fZ);
+ AliTRDrecPoint *RecPoint = (AliTRDrecPoint *) RecPointArray->UncheckedAt(iRecPoint);
+ Int_t detector = RecPoint->GetDetector();
+ Float_t row = RecPoint->GetLocalRow();
+ Float_t col = RecPoint->GetLocalCol();
+
+ Int_t sector = TRDgeometry->GetSector(detector);
+ Int_t plane = TRDgeometry->GetPlane(detector);
+ Int_t chamber = TRDgeometry->GetChamber(detector);
+
+ TVector3 Pos;
+ TMatrix Cov;
+ RecPoint->GetGlobalPosition(Pos,Cov);
+ HGlobal->Fill(Pos.X(),Pos.Y());
+ if ((sector == 17) && (plane == 0) && (chamber == 2)) {
+ HLocal->Fill(row,col);
+ }
}
}
- hZ->Draw();
+ TCanvas *C = new TCanvas("C","recPoints",10,10,400,600);
+ C->Divide(1,2);
+ C->cd(1);
+ HLocal->Draw("BOX");
+ C->cd(2);
+ HGlobal->Draw("BOX");
}
}
// Input (and output) file name
- Char_t *alifile = "galice_c_v0.root";
+ Char_t *alifile = "galice_r_v0.root";
- // Event number
- Int_t nEvent = 0;
+ // Create the clusterizer
+ AliTRDclusterizerV0 *Clusterizer =
+ new AliTRDclusterizerV0("clusterizer","fast clusterizer class");
- // Connect the AliRoot file containing Geometry, Kine, Hits, and Digits
- TFile *gafl = (TFile*) gROOT->GetListOfFiles()->FindObject(alifile);
- if (!gafl) {
- cout << "Open the ALIROOT-file " << alifile << endl;
- gafl = new TFile(alifile,"UPDATE");
- }
- else {
- cout << alifile << " is already open" << endl;
- }
-
- // Get AliRun object from file or create it if not on file
- if (!gAlice) {
- gAlice = (AliRun*) gafl->Get("gAlice");
- if (gAlice)
- cout << "AliRun object found on file" << endl;
- else
- gAlice = new AliRun("gAlice","Alice test program");
- }
-
- // Import the Trees for the event nEvent in the file
- Int_t nparticles = gAlice->GetEvent(nEvent);
- if (nparticles <= 0) break;
+ // Open the AliRoot file
+ Clusterizer->Open(alifile);
- // Get the pointer to the detector classes
- AliTRDv0 *TRD = (AliTRDv0*) gAlice->GetDetector("TRD");
+ // Find the cluster
+ Clusterizer->MakeCluster();
- // Create the clusters
- TRD->Hits2Clusters();
+ // Write the cluster into the input file
+ Clusterizer->WriteCluster();
- // Write the new tree into the input file
- cout << "Entries in digits tree = " << gAlice->TreeD()->GetEntries() << endl;
- Char_t treeName[7];
- sprintf(treeName,"TreeD%d",nEvent);
- gAlice->TreeD()->Write(treeName);
+ // Save the clusterizer class in the AliROOT file
+ Clusterizer->Write();
}
}
// Input file name
- Char_t *alifile = "galice_c_v1.root";
+ Char_t *alifile = "galice_r_v1.root";
// Event number
Int_t nEvent = 0;
// Get the geometry
AliTRDgeometry *TRDgeometry = TRD->GetGeometry();
// Get the pointer to the hit container
- TClonesArray *RecPointArray = TRD->RecPoints();
+ TObjArray *RecPointArray = TRD->RecPoints();
// Set the branch address
RecTree->GetBranch("TRDrecPoints")->SetAddress(&RecPointArray);
Int_t nEntries = RecTree->GetEntries();
+ cout << "nEntries = " << nEntries << endl;
// Loop through all entries in the tree
Int_t nbytes;
// Import the tree
nbytes += RecTree->GetEvent(iEntry);
- // Get the number of digits in the detector
+ // Get the number of points in the detector
Int_t nRecPoint = RecPointArray->GetEntriesFast();
cout << " nRecPoint = " << nRecPoint << endl;
}
// Input (and output) file name
- Char_t *alifile = "galice_c_v1.root";
+ Char_t *alifile = "galice_r_v1.root";
// Create the clusterizer
AliTRDclusterizerV1 *Clusterizer =
// Define the objects
AliTRDv1 *TRD;
AliTRDgeometry *TRDgeometry;
+ AliTRDdigit *Digit;
+
+ Int_t track;
// Connect the AliRoot file containing Geometry, Kine, Hits, and Digits
TFile *gafl = (TFile*) gROOT->GetListOfFiles()->FindObject(alifile);
Int_t nparticles = gAlice->GetEvent(nEvent);
if (nparticles <= 0) break;
- // Get the pointer to the detector classes
+ // Get the pointer to the detector object
TRD = (AliTRDv1*) gAlice->GetDetector("TRD");
- // Get the pointer to the digits container and the geometry
+
+ // Get the pointer to the geometry object
if (TRD) {
TRDgeometry = TRD->GetGeometry();
}
break;
}
- // Define the segment array for the digits
- AliTRDsegmentArray *DigitsArray = new AliTRDsegmentArray(540);
+ // Create the digits manager
+ AliTRDdigitsManager *DigitsManager = new AliTRDdigitsManager();
- // Load the digits from the tree
- DigitsArray->LoadArray("TRDdigits");
+ // Read the digits from the file
+ DigitsManager->ReadDigits();
// Define the detector matrix for one chamber
- const Int_t iSec = 13;
- const Int_t iCha = 3;
- const Int_t iPla = 3;
+ const Int_t iSec = 17;
+ const Int_t iCha = 2;
+ const Int_t iPla = 0;
Int_t rowMax = TRDgeometry->GetRowMax(iPla,iCha,iSec);
Int_t colMax = TRDgeometry->GetColMax(iPla);
Int_t timeMax = TRDgeometry->GetTimeMax();
<< " timeMax = " << timeMax << endl;
AliTRDmatrix *TRDmatrix = new AliTRDmatrix(rowMax,colMax,timeMax,iSec,iCha,iPla);
- // Get the digits for this detector
+ // Get the detector number
Int_t iDet = TRDgeometry->GetDetector(iPla,iCha,iSec);
- AliTRDdataArray *Digits = (AliTRDdataArray *) DigitsArray->At(iDet);
- Digits->Dump();
- // Expand the digits array
- //Digits->Expand();
-
- //Float_t signal = Digits->GetData(0,0,29);
+ cout << " iDet = " << iDet << endl;
// Loop through the detector pixel
for (Int_t time = 0; time < timeMax; time++) {
for (Int_t col = 0; col < colMax; col++) {
for (Int_t row = 0; row < rowMax; row++) {
- Float_t signal = Digits->GetData(row,col,time);
- if (signal != 0) {
+ Digit = DigitsManager->GetDigit(row,col,time,iDet);
+ track = DigitsManager->GetTrack(0,row,col,time,iDet);
+
+ TRDmatrix->SetSignal(row,col,time,Digit->GetAmp());
+ if (track == 96) {
+ cout << "-------------------------------------" << endl;
+ cout << " track = " << track << endl;
+ cout << " iRow = " << row
+ << " iCol = " << col
+ << " iTime = " << time << endl;
+ cout << " adc = " << Digit->GetAmp() << endl;
+ Digit->Dump();
}
- TRDmatrix->SetSignal(row,col,time,signal);
+
+ delete Digit;
}
}
// Display the detector matrix
TRDmatrix->Draw();
- TRDmatrix->DrawRow(18);
- TRDmatrix->DrawCol(58);
- TRDmatrix->DrawTime(20);
+ //TRDmatrix->DrawRow(18);
+ //TRDmatrix->DrawCol(58);
+ //TRDmatrix->DrawTime(20);
+ TRDmatrix->ProjRow();
+ TRDmatrix->ProjCol();
+ TRDmatrix->ProjTime();
}
// Set the parameter
Digitizer->SetDiffusion();
- Digitizer->SetExB();
+ //Digitizer->SetExB();
//Digitizer->SetElAttach();
//Digitizer->SetAttachProb();