From 6f1e466d6db177aa095cc30f57958d5e62389e1c Mon Sep 17 00:00:00 2001 From: cblume Date: Mon, 8 May 2000 16:17:27 +0000 Subject: [PATCH] Merge TRD-develop --- TRD/AliTRD.cxx | 104 ++---- TRD/AliTRD.h | 38 +-- TRD/AliTRDarrayF.cxx | 64 ++++ TRD/AliTRDarrayF.h | 23 ++ TRD/AliTRDarrayI.cxx | 39 ++- TRD/AliTRDclusterizer.cxx | 31 +- TRD/AliTRDclusterizer.h | 28 -- TRD/AliTRDclusterizerV0.cxx | 107 +++--- TRD/AliTRDclusterizerV1.cxx | 25 +- TRD/AliTRDclusterizerV1.h | 12 +- TRD/AliTRDconst.h | 1 + TRD/AliTRDdataArray.cxx | 603 +++------------------------------ TRD/AliTRDdataArray.h | 93 ++--- TRD/AliTRDdataArrayF.cxx | 576 +++++++++++++++++++++++++++++++ TRD/AliTRDdataArrayF.h | 123 +++++++ TRD/AliTRDdataArrayI.cxx | 575 +++++++++++++++++++++++++++++++ TRD/AliTRDdataArrayI.h | 123 +++++++ TRD/AliTRDdigit.cxx | 66 ++++ TRD/AliTRDdigit.h | 42 +++ TRD/AliTRDdigitizer.h | 146 ++++---- TRD/AliTRDdigitsManager.cxx | 198 +++++++++++ TRD/AliTRDdigitsManager.h | 135 ++++++++ TRD/AliTRDgeometry.cxx | 39 +-- TRD/AliTRDgeometry.h | 6 + TRD/AliTRDgeometryFull.cxx | 271 ++++++++++++--- TRD/AliTRDgeometryFull.h | 23 +- TRD/AliTRDgeometryHole.h | 12 +- TRD/AliTRDhit.cxx | 50 +++ TRD/AliTRDhit.h | 32 ++ TRD/AliTRDmatrix.h | 5 + TRD/AliTRDrecPoint.h | 28 +- TRD/AliTRDsegmentArray.cxx | 10 +- TRD/AliTRDsegmentArray.h | 2 +- TRD/AliTRDsegmentArrayBase.cxx | 38 ++- TRD/AliTRDv0.h | 10 +- TRD/AliTRDv1.cxx | 12 +- TRD/AliTRDv1.h | 12 +- TRD/DrawTRD.C | 31 +- TRD/Makefile | 21 +- TRD/TRDLinkDef.h | 7 +- TRD/ViewTRD.C | 121 ++++++- TRD/ViewTRD0.C | 27 -- TRD/ViewTRD1.C | 28 -- TRD/ViewTRD2.C | 69 ---- TRD/ViewTRDfull.C | 18 - TRD/ViewTRDhole.C | 22 -- TRD/fastClusterAna.C | 79 +++-- TRD/fastClusterCreate.C | 46 +-- TRD/slowClusterAna.C | 7 +- TRD/slowClusterCreate.C | 2 +- TRD/slowDigitsAna.C | 57 ++-- TRD/slowDigitsCreate.C | 2 +- 52 files changed, 2911 insertions(+), 1328 deletions(-) create mode 100644 TRD/AliTRDarrayF.cxx create mode 100644 TRD/AliTRDarrayF.h create mode 100644 TRD/AliTRDdataArrayF.cxx create mode 100644 TRD/AliTRDdataArrayF.h create mode 100644 TRD/AliTRDdataArrayI.cxx create mode 100644 TRD/AliTRDdataArrayI.h create mode 100644 TRD/AliTRDdigit.cxx create mode 100644 TRD/AliTRDdigit.h create mode 100644 TRD/AliTRDdigitsManager.cxx create mode 100644 TRD/AliTRDdigitsManager.h create mode 100644 TRD/AliTRDhit.cxx create mode 100644 TRD/AliTRDhit.h delete mode 100644 TRD/ViewTRD0.C delete mode 100644 TRD/ViewTRD1.C delete mode 100644 TRD/ViewTRD2.C delete mode 100644 TRD/ViewTRDfull.C delete mode 100644 TRD/ViewTRDhole.C diff --git a/TRD/AliTRD.cxx b/TRD/AliTRD.cxx index 064bb0e1e9a..fcc367568ae 100644 --- a/TRD/AliTRD.cxx +++ b/TRD/AliTRD.cxx @@ -15,6 +15,12 @@ /* $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 @@ -45,16 +51,7 @@ Introduction of the Copyright and cvs Log // // // 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 -/* - -*/ -//End_Html -// // +// Detector. // // // /////////////////////////////////////////////////////////////////////////////// @@ -125,14 +122,14 @@ AliTRD::AliTRD(const char *name, const char *title) } // 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; @@ -163,17 +160,18 @@ void AliTRD::AddRecPoint(Float_t *pos, Int_t *digits, Int_t det, Float_t amp) // // 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); + } //_____________________________________________________________________________ @@ -184,7 +182,7 @@ void AliTRD::AddDigit(Int_t *digits) // TClonesArray &ldigits = *fDigits; - new(ldigits[fNdigits++]) AliTRDdigit(digits); + new(ldigits[fNdigits++]) AliTRDdigit(kFALSE,digits); } @@ -438,6 +436,10 @@ void AliTRD::DrawModule() 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); @@ -486,10 +488,15 @@ void AliTRD::Init() 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) @@ -511,17 +518,11 @@ void AliTRD::MakeBranch(Option_t* option) 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); } @@ -535,7 +536,7 @@ void AliTRD::ResetRecPoints() // fNRecPoints = 0; - if (fRecPoints) fRecPoints->Clear(); + if (fRecPoints) fRecPoints->Delete(); } @@ -583,50 +584,3 @@ void AliTRD::SetGasMix(Int_t imix) } -//______________________________________________________________________________ -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]; - -} - diff --git a/TRD/AliTRD.h b/TRD/AliTRD.h index bfaa6421ae4..67805277a96 100644 --- a/TRD/AliTRD.h +++ b/TRD/AliTRD.h @@ -11,13 +11,11 @@ #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 { @@ -35,7 +33,7 @@ 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); @@ -45,39 +43,29 @@ class AliTRD : public AliDetector { 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 }; diff --git a/TRD/AliTRDarrayF.cxx b/TRD/AliTRDarrayF.cxx new file mode 100644 index 00000000000..c9673677af5 --- /dev/null +++ b/TRD/AliTRDarrayF.cxx @@ -0,0 +1,64 @@ +/************************************************************************** + * 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 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; + +} + diff --git a/TRD/AliTRDarrayF.h b/TRD/AliTRDarrayF.h new file mode 100644 index 00000000000..e580d550fd9 --- /dev/null +++ b/TRD/AliTRDarrayF.h @@ -0,0 +1,23 @@ +#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 + diff --git a/TRD/AliTRDarrayI.cxx b/TRD/AliTRDarrayI.cxx index 609e67144a8..5293c057977 100644 --- a/TRD/AliTRDarrayI.cxx +++ b/TRD/AliTRDarrayI.cxx @@ -15,16 +15,22 @@ /* $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 // // // /////////////////////////////////////////////////////////////////////// @@ -32,21 +38,30 @@ $Log$ 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 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; + } diff --git a/TRD/AliTRDclusterizer.cxx b/TRD/AliTRDclusterizer.cxx index 67b8c125d6f..2bc4b35c607 100644 --- a/TRD/AliTRDclusterizer.cxx +++ b/TRD/AliTRDclusterizer.cxx @@ -15,6 +15,12 @@ /* $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 + */ /////////////////////////////////////////////////////////////////////////////// @@ -142,28 +148,3 @@ Bool_t AliTRDclusterizer::WriteCluster() 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]; - -} diff --git a/TRD/AliTRDclusterizer.h b/TRD/AliTRDclusterizer.h index 56381045bc7..8e0778dbe34 100644 --- a/TRD/AliTRDclusterizer.h +++ b/TRD/AliTRDclusterizer.h @@ -35,32 +35,4 @@ class AliTRDclusterizer : public TNamed { }; -//_____________________________________________________________________________ -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 diff --git a/TRD/AliTRDclusterizerV0.cxx b/TRD/AliTRDclusterizerV0.cxx index c55b93ac875..3b14832b6b1 100644 --- a/TRD/AliTRDclusterizerV0.cxx +++ b/TRD/AliTRDclusterizerV0.cxx @@ -15,6 +15,12 @@ /* $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 + */ /////////////////////////////////////////////////////////////////////////////// @@ -122,12 +128,14 @@ Bool_t AliTRDclusterizerV0::MakeCluster() 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++) { @@ -163,18 +171,15 @@ Bool_t AliTRDclusterizerV0::MakeCluster() 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); } @@ -183,73 +188,81 @@ Bool_t AliTRDclusterizerV0::MakeCluster() // 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); diff --git a/TRD/AliTRDclusterizerV1.cxx b/TRD/AliTRDclusterizerV1.cxx index 22efefb68e7..72ba361286a 100644 --- a/TRD/AliTRDclusterizerV1.cxx +++ b/TRD/AliTRDclusterizerV1.cxx @@ -15,6 +15,9 @@ /* $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 @@ -33,7 +36,7 @@ Add new TRD classes #include "AliTRDgeometry.h" #include "AliTRDdigitizer.h" #include "AliTRDrecPoint.h" -#include "AliTRDdataArray.h" +#include "AliTRDdataArrayF.h" ClassImp(AliTRDclusterizerV1) @@ -44,7 +47,7 @@ AliTRDclusterizerV1::AliTRDclusterizerV1():AliTRDclusterizer() // AliTRDclusterizerV1 default constructor // - fDigitsArray = NULL; + fDigitsManager = NULL; } @@ -56,7 +59,7 @@ AliTRDclusterizerV1::AliTRDclusterizerV1(const Text_t* name, const Text_t* title // AliTRDclusterizerV1 default constructor // - fDigitsArray = NULL; + fDigitsManager = new AliTRDdigitsManager(); Init(); @@ -66,9 +69,8 @@ AliTRDclusterizerV1::AliTRDclusterizerV1(const Text_t* name, const Text_t* title AliTRDclusterizerV1::~AliTRDclusterizerV1() { - if (fDigitsArray) { - fDigitsArray->Delete(); - delete fDigitsArray; + if (fDigitsManager) { + delete fDigitsManager; } } @@ -100,11 +102,8 @@ Bool_t AliTRDclusterizerV1::ReadDigits() 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()); } @@ -131,7 +130,7 @@ Bool_t AliTRDclusterizerV1::MakeCluster() printf("AliTRDclusterizerV1::MakeCluster -- "); printf("Start creating clusters.\n"); - AliTRDdataArray *Digits; + AliTRDdataArrayI *Digits; // Parameters Float_t maxThresh = fClusMaxThresh; // threshold value for maximum @@ -148,7 +147,7 @@ Bool_t AliTRDclusterizerV1::MakeCluster() 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; @@ -187,7 +186,7 @@ Bool_t AliTRDclusterizerV1::MakeCluster() ,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++) { diff --git a/TRD/AliTRDclusterizerV1.h b/TRD/AliTRDclusterizerV1.h index 84af1afa725..a43edc8a190 100644 --- a/TRD/AliTRDclusterizerV1.h +++ b/TRD/AliTRDclusterizerV1.h @@ -6,7 +6,7 @@ /* $Id$ */ #include "AliTRD.h" -#include "AliTRDsegmentArray.h" +#include "AliTRDdigitsManager.h" #include "AliTRDclusterizer.h" /////////////////////////////////////////////////////// @@ -25,8 +25,6 @@ class AliTRDclusterizerV1 : public AliTRDclusterizer { 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; }; @@ -37,11 +35,11 @@ class AliTRDclusterizerV1 : public AliTRDclusterizer { 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: diff --git a/TRD/AliTRDconst.h b/TRD/AliTRDconst.h index 2e096d7faf9..8b5edd872d3 100644 --- a/TRD/AliTRDconst.h +++ b/TRD/AliTRDconst.h @@ -12,6 +12,7 @@ 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; diff --git a/TRD/AliTRDdataArray.cxx b/TRD/AliTRDdataArray.cxx index 35b8df3aece..ebd1f69b6eb 100644 --- a/TRD/AliTRDdataArray.cxx +++ b/TRD/AliTRDdataArray.cxx @@ -15,14 +15,18 @@ /* $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. // // // /////////////////////////////////////////////////////////////////////////////// @@ -41,70 +45,63 @@ AliTRDdataArray::AliTRDdataArray() // 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 , , and . + // 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 x x + // Allocates memory for a AliTRDdataArray with the dimensions + // , , and . + // 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 @@ -118,9 +115,9 @@ void AliTRDdataArray::Allocate(Int_t nrow, Int_t ncol, Int_t ntime) 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; } @@ -130,528 +127,26 @@ void AliTRDdataArray::Allocate(Int_t nrow, Int_t ncol, Int_t ntime) } //_____________________________________________________________________________ -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; col0) { - //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; - } - -} - diff --git a/TRD/AliTRDdataArray.h b/TRD/AliTRDdataArray.h index 8cce169694b..81f556df476 100644 --- a/TRD/AliTRDdataArray.h +++ b/TRD/AliTRDdataArray.h @@ -7,6 +7,7 @@ /* $Id$ */ #include "AliTRDarrayI.h" +#include "AliTRDarrayF.h" #include "AliTRDsegmentID.h" ///////////////////////////////////////////////////////////// @@ -19,30 +20,16 @@ class AliTRDdataArray : public AliTRDsegmentID { 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: @@ -50,18 +37,6 @@ class AliTRDdataArray : public AliTRDsegmentID { 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 @@ -69,13 +44,9 @@ class AliTRDdataArray : public AliTRDsegmentID { 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 @@ -92,6 +63,13 @@ inline Int_t AliTRDdataArray::GetIndex(Int_t row, Int_t col, Int_t time) // 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); } @@ -103,7 +81,21 @@ inline Int_t AliTRDdataArray::GetIdx1(Int_t row, Int_t 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; } @@ -134,41 +126,12 @@ inline Bool_t AliTRDdataArray::OutOfBoundsError(const char *where // 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 diff --git a/TRD/AliTRDdataArrayF.cxx b/TRD/AliTRDdataArrayF.cxx new file mode 100644 index 00000000000..0f1c6060442 --- /dev/null +++ b/TRD/AliTRDdataArrayF.cxx @@ -0,0 +1,576 @@ +/************************************************************************** + * 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 , , and . + // 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 + // , , and . + // 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; + } + +} + diff --git a/TRD/AliTRDdataArrayF.h b/TRD/AliTRDdataArrayF.h new file mode 100644 index 00000000000..a2a4f13044e --- /dev/null +++ b/TRD/AliTRDdataArrayF.h @@ -0,0 +1,123 @@ +#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 + diff --git a/TRD/AliTRDdataArrayI.cxx b/TRD/AliTRDdataArrayI.cxx new file mode 100644 index 00000000000..b6dff588eb2 --- /dev/null +++ b/TRD/AliTRDdataArrayI.cxx @@ -0,0 +1,575 @@ +/************************************************************************** + * 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 , , and . + // 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 + // , , and . + // 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; + } + +} + diff --git a/TRD/AliTRDdataArrayI.h b/TRD/AliTRDdataArrayI.h new file mode 100644 index 00000000000..88ae230c506 --- /dev/null +++ b/TRD/AliTRDdataArrayI.h @@ -0,0 +1,123 @@ +#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 + diff --git a/TRD/AliTRDdigit.cxx b/TRD/AliTRDdigit.cxx new file mode 100644 index 00000000000..c7777fd92a0 --- /dev/null +++ b/TRD/AliTRDdigit.cxx @@ -0,0 +1,66 @@ +/************************************************************************** + * 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); + +} diff --git a/TRD/AliTRDdigit.h b/TRD/AliTRDdigit.h new file mode 100644 index 00000000000..0fb30cc72f9 --- /dev/null +++ b/TRD/AliTRDdigit.h @@ -0,0 +1,42 @@ +#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 diff --git a/TRD/AliTRDdigitizer.h b/TRD/AliTRDdigitizer.h index 6289a543fc6..9823b830ca1 100644 --- a/TRD/AliTRDdigitizer.h +++ b/TRD/AliTRDdigitizer.h @@ -7,19 +7,19 @@ #include #include +#include #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: @@ -28,98 +28,72 @@ class AliTRDdigitizer : public TNamed { 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 }; diff --git a/TRD/AliTRDdigitsManager.cxx b/TRD/AliTRDdigitsManager.cxx new file mode 100644 index 00000000000..ff96b315b67 --- /dev/null +++ b/TRD/AliTRDdigitsManager.cxx @@ -0,0 +1,198 @@ +/************************************************************************** + * 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; + +} diff --git a/TRD/AliTRDdigitsManager.h b/TRD/AliTRDdigitsManager.h new file mode 100644 index 00000000000..98aedb193bf --- /dev/null +++ b/TRD/AliTRDdigitsManager.h @@ -0,0 +1,135 @@ +#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 diff --git a/TRD/AliTRDgeometry.cxx b/TRD/AliTRDgeometry.cxx index 624005957fc..a16e99aae70 100644 --- a/TRD/AliTRDgeometry.cxx +++ b/TRD/AliTRDgeometry.cxx @@ -15,6 +15,12 @@ /* $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 + */ /////////////////////////////////////////////////////////////////////////////// @@ -286,24 +292,7 @@ Bool_t AliTRDgeometry::Local2Global(Int_t idet, Float_t *local, Float_t *global) 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); } @@ -329,8 +318,8 @@ Bool_t AliTRDgeometry::Local2Global(Int_t iplan, Int_t icham, Int_t isect 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 @@ -372,9 +361,9 @@ Bool_t AliTRDgeometry::RotateBack(Int_t d, Float_t *rot, Float_t *pos) 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; @@ -446,9 +435,9 @@ void AliTRDgeometry::GetGlobal(const AliRecPoint *p, TVector3 &pos) 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]); diff --git a/TRD/AliTRDgeometry.h b/TRD/AliTRDgeometry.h index 0cb221c9ad9..240aa61253f 100644 --- a/TRD/AliTRDgeometry.h +++ b/TRD/AliTRDgeometry.h @@ -28,10 +28,16 @@ class AliTRDgeometry : public AliGeometry { 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); diff --git a/TRD/AliTRDgeometryFull.cxx b/TRD/AliTRDgeometryFull.cxx index c3d4fe2d8fa..5e9fabef890 100644 --- a/TRD/AliTRDgeometryFull.cxx +++ b/TRD/AliTRDgeometryFull.cxx @@ -15,11 +15,20 @@ /* $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 // // // /////////////////////////////////////////////////////////////////////////////// @@ -53,25 +62,49 @@ void AliTRDgeometryFull::Init() 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 @@ -98,8 +131,23 @@ void AliTRDgeometryFull::Init() 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) @@ -140,16 +188,29 @@ void AliTRDgeometryFull::CreateGeometry(Int_t *idtmed) 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 @@ -192,85 +253,205 @@ void AliTRDgeometryFull::CreateGeometry(Int_t *idtmed) // 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); + } } @@ -278,7 +459,13 @@ void AliTRDgeometryFull::CreateGeometry(Int_t *idtmed) 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"); } diff --git a/TRD/AliTRDgeometryFull.h b/TRD/AliTRDgeometryFull.h index 96cea6a17a6..892f4f29905 100644 --- a/TRD/AliTRDgeometryFull.h +++ b/TRD/AliTRDgeometryFull.h @@ -14,16 +14,27 @@ class AliTRDgeometryFull : public AliTRDgeometry { 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 diff --git a/TRD/AliTRDgeometryHole.h b/TRD/AliTRDgeometryHole.h index b263469d57a..0aa6854bdf6 100644 --- a/TRD/AliTRDgeometryHole.h +++ b/TRD/AliTRDgeometryHole.h @@ -14,9 +14,15 @@ class AliTRDgeometryHole : public AliTRDgeometry { 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: diff --git a/TRD/AliTRDhit.cxx b/TRD/AliTRDhit.cxx new file mode 100644 index 00000000000..b26fccddcac --- /dev/null +++ b/TRD/AliTRDhit.cxx @@ -0,0 +1,50 @@ +/************************************************************************** + * 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]; + +} diff --git a/TRD/AliTRDhit.h b/TRD/AliTRDhit.h new file mode 100644 index 00000000000..2003167605c --- /dev/null +++ b/TRD/AliTRDhit.h @@ -0,0 +1,32 @@ +#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 diff --git a/TRD/AliTRDmatrix.h b/TRD/AliTRDmatrix.h index cc5ee47c19f..bd74d49a15a 100644 --- a/TRD/AliTRDmatrix.h +++ b/TRD/AliTRDmatrix.h @@ -21,6 +21,7 @@ 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 @@ -34,6 +35,7 @@ protected: 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(); @@ -45,6 +47,9 @@ public: 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 diff --git a/TRD/AliTRDrecPoint.h b/TRD/AliTRDrecPoint.h index e4076472827..4937e75b909 100644 --- a/TRD/AliTRDrecPoint.h +++ b/TRD/AliTRDrecPoint.h @@ -12,15 +12,25 @@ class AliTRDrecPoint : public AliRecPoint { 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: diff --git a/TRD/AliTRDsegmentArray.cxx b/TRD/AliTRDsegmentArray.cxx index 15306ccd9a7..ce6d710b03e 100644 --- a/TRD/AliTRDsegmentArray.cxx +++ b/TRD/AliTRDsegmentArray.cxx @@ -15,6 +15,12 @@ /* $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 + */ /////////////////////////////////////////////////////////////////////////////// @@ -37,8 +43,8 @@ AliTRDsegmentArray::AliTRDsegmentArray():AliTRDsegmentArrayBase() } //_____________________________________________________________________________ -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 diff --git a/TRD/AliTRDsegmentArray.h b/TRD/AliTRDsegmentArray.h index 2d296ea4157..304b8c4a35e 100644 --- a/TRD/AliTRDsegmentArray.h +++ b/TRD/AliTRDsegmentArray.h @@ -18,7 +18,7 @@ class AliTRDsegmentArray : public AliTRDsegmentArrayBase { public: AliTRDsegmentArray(); - AliTRDsegmentArray(Int_t n); + AliTRDsegmentArray(Text_t *classname, Int_t n); ~AliTRDsegmentArray() { }; virtual void Delete(); diff --git a/TRD/AliTRDsegmentArrayBase.cxx b/TRD/AliTRDsegmentArrayBase.cxx index 37b1f04c22d..b0e4564b92e 100644 --- a/TRD/AliTRDsegmentArrayBase.cxx +++ b/TRD/AliTRDsegmentArrayBase.cxx @@ -15,6 +15,12 @@ /* $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 + */ /////////////////////////////////////////////////////////////////////////////// @@ -39,21 +45,24 @@ $Log$ #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) { // @@ -74,6 +83,7 @@ AliTRDsegmentArrayBase::AliTRDsegmentArrayBase(Text_t *classname, Int_t n) } } +//_____________________________________________________________________________ Bool_t AliTRDsegmentArrayBase:: SetClass(Text_t *classname) { // @@ -109,6 +119,7 @@ Bool_t AliTRDsegmentArrayBase:: SetClass(Text_t *classname) return kTRUE; } +//_____________________________________________________________________________ //Bool_t AliTRDsegmentArrayBase::ClassError( ) //{ //signalize class error @@ -119,6 +130,7 @@ Bool_t AliTRDsegmentArrayBase:: SetClass(Text_t *classname) //// return kFALSE; //} +//_____________________________________________________________________________ AliTRDsegmentArrayBase::~AliTRDsegmentArrayBase() { if (fNSegment>0){ @@ -130,6 +142,7 @@ AliTRDsegmentArrayBase::~AliTRDsegmentArrayBase() if (fClass!=0) delete fClass; } +//_____________________________________________________________________________ AliTRDsegmentID * AliTRDsegmentArrayBase::NewSegment() { // @@ -140,7 +153,7 @@ AliTRDsegmentID * AliTRDsegmentArrayBase::NewSegment() return segment; } - +//_____________________________________________________________________________ Bool_t AliTRDsegmentArrayBase::AddSegment(AliTRDsegmentID *segment) { // @@ -159,6 +172,7 @@ Bool_t AliTRDsegmentArrayBase::AddSegment(AliTRDsegmentID *segment) return kTRUE; } +//_____________________________________________________________________________ AliTRDsegmentID * AliTRDsegmentArrayBase::AddSegment(Int_t index) { // @@ -175,8 +189,7 @@ AliTRDsegmentID * AliTRDsegmentArrayBase::AddSegment(Int_t index) return segment; } - - +//_____________________________________________________________________________ Bool_t AliTRDsegmentArrayBase::MakeArray(Int_t n) { // @@ -195,7 +208,7 @@ Bool_t AliTRDsegmentArrayBase::MakeArray(Int_t n) else return kFALSE; } - +//_____________________________________________________________________________ void AliTRDsegmentArrayBase::ClearSegment(Int_t index) { // @@ -208,7 +221,7 @@ void AliTRDsegmentArrayBase::ClearSegment(Int_t index) } } - +//_____________________________________________________________________________ void AliTRDsegmentArrayBase::MakeTree() { // AliTRDsegmentID segment; @@ -219,6 +232,7 @@ void AliTRDsegmentArrayBase::MakeTree() delete psegment; } +//_____________________________________________________________________________ Bool_t AliTRDsegmentArrayBase::ConnectTree(const char * treeName) { //connect tree from current directory @@ -235,6 +249,7 @@ Bool_t AliTRDsegmentArrayBase::ConnectTree(const char * treeName) return kTRUE; } +//_____________________________________________________________________________ AliTRDsegmentID *AliTRDsegmentArrayBase::LoadSegment(Int_t index) { // @@ -264,6 +279,8 @@ AliTRDsegmentID *AliTRDsegmentArrayBase::LoadSegment(Int_t index) return s; // AbstractMethod("LoadSegment"); } + +//_____________________________________________________________________________ AliTRDsegmentID *AliTRDsegmentArrayBase::LoadEntry(Int_t index) { // @@ -299,6 +316,7 @@ void AliTRDsegmentArrayBase::StoreSegment(Int_t index) fTree->Fill(); } +//_____________________________________________________________________________ Bool_t AliTRDsegmentArrayBase::MakeDictionary(Int_t size) { // diff --git a/TRD/AliTRDv0.h b/TRD/AliTRDv0.h index 14e5a61e38a..8f7782a59b6 100644 --- a/TRD/AliTRDv0.h +++ b/TRD/AliTRDv0.h @@ -27,9 +27,13 @@ class AliTRDv0 : public AliTRD { 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: diff --git a/TRD/AliTRDv1.cxx b/TRD/AliTRDv1.cxx index 50b80358c24..38ee115a6c8 100644 --- a/TRD/AliTRDv1.cxx +++ b/TRD/AliTRDv1.cxx @@ -15,6 +15,12 @@ /* $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 @@ -340,9 +346,9 @@ void AliTRDv1::StepManager() // 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 diff --git a/TRD/AliTRDv1.h b/TRD/AliTRDv1.h index ac3527ab5b6..d14fb00d03e 100644 --- a/TRD/AliTRDv1.h +++ b/TRD/AliTRDv1.h @@ -30,13 +30,13 @@ class AliTRDv1 : public AliTRD { 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: diff --git a/TRD/DrawTRD.C b/TRD/DrawTRD.C index c5945996ab5..f1e3079f9e4 100644 --- a/TRD/DrawTRD.C +++ b/TRD/DrawTRD.C @@ -2,13 +2,30 @@ void DrawTRD() { 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); diff --git a/TRD/Makefile b/TRD/Makefile index ee1296a23f4..e300505c38a 100644 --- a/TRD/Makefile +++ b/TRD/Makefile @@ -11,15 +11,18 @@ PACKAGE = TRD # 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 diff --git a/TRD/TRDLinkDef.h b/TRD/TRDLinkDef.h index 5e8d183a7e3..022dac79a4a 100644 --- a/TRD/TRDLinkDef.h +++ b/TRD/TRDLinkDef.h @@ -8,12 +8,12 @@ #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; @@ -26,9 +26,12 @@ #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 diff --git a/TRD/ViewTRD.C b/TRD/ViewTRD.C index 1dbb0838896..646fd5afca5 100644 --- a/TRD/ViewTRD.C +++ b/TRD/ViewTRD.C @@ -1,14 +1,22 @@ -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); @@ -17,3 +25,104 @@ void ViewTRD() 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); diff --git a/TRD/ViewTRD0.C b/TRD/ViewTRD0.C deleted file mode 100644 index 6492a598916..00000000000 --- a/TRD/ViewTRD0.C +++ /dev/null @@ -1,27 +0,0 @@ -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); - -} diff --git a/TRD/ViewTRD1.C b/TRD/ViewTRD1.C deleted file mode 100644 index c32e36fe901..00000000000 --- a/TRD/ViewTRD1.C +++ /dev/null @@ -1,28 +0,0 @@ -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); - -} diff --git a/TRD/ViewTRD2.C b/TRD/ViewTRD2.C deleted file mode 100644 index e956bc0fca5..00000000000 --- a/TRD/ViewTRD2.C +++ /dev/null @@ -1,69 +0,0 @@ -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); - -} diff --git a/TRD/ViewTRDfull.C b/TRD/ViewTRDfull.C deleted file mode 100644 index bc7a4e3e634..00000000000 --- a/TRD/ViewTRDfull.C +++ /dev/null @@ -1,18 +0,0 @@ -{ - - 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); - -} diff --git a/TRD/ViewTRDhole.C b/TRD/ViewTRDhole.C deleted file mode 100644 index 91afe4958ed..00000000000 --- a/TRD/ViewTRDhole.C +++ /dev/null @@ -1,22 +0,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("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); - -} diff --git a/TRD/fastClusterAna.C b/TRD/fastClusterAna.C index 19584b2df34..541c17a8806 100644 --- a/TRD/fastClusterAna.C +++ b/TRD/fastClusterAna.C @@ -13,17 +13,15 @@ void fastClusterAna() { } // 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); @@ -36,13 +34,11 @@ void fastClusterAna() { } // 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); @@ -50,18 +46,19 @@ void fastClusterAna() { 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; @@ -70,24 +67,42 @@ void fastClusterAna() { 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"); } diff --git a/TRD/fastClusterCreate.C b/TRD/fastClusterCreate.C index fd96fd545cd..cd9c36d0262 100644 --- a/TRD/fastClusterCreate.C +++ b/TRD/fastClusterCreate.C @@ -14,44 +14,22 @@ void fastClusterCreate() { } // 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(); } diff --git a/TRD/slowClusterAna.C b/TRD/slowClusterAna.C index bb646c29f45..1784d2c5cfc 100644 --- a/TRD/slowClusterAna.C +++ b/TRD/slowClusterAna.C @@ -13,7 +13,7 @@ void slowClusterAna() { } // Input file name - Char_t *alifile = "galice_c_v1.root"; + Char_t *alifile = "galice_r_v1.root"; // Event number Int_t nEvent = 0; @@ -50,11 +50,12 @@ void slowClusterAna() { // 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; @@ -65,7 +66,7 @@ void slowClusterAna() { // 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; diff --git a/TRD/slowClusterCreate.C b/TRD/slowClusterCreate.C index 4502954fbdc..66478f9a8d8 100644 --- a/TRD/slowClusterCreate.C +++ b/TRD/slowClusterCreate.C @@ -14,7 +14,7 @@ void slowClusterCreate() { } // Input (and output) file name - Char_t *alifile = "galice_c_v1.root"; + Char_t *alifile = "galice_r_v1.root"; // Create the clusterizer AliTRDclusterizerV1 *Clusterizer = diff --git a/TRD/slowDigitsAna.C b/TRD/slowDigitsAna.C index 4e5d549eecc..a604c8c7c69 100644 --- a/TRD/slowDigitsAna.C +++ b/TRD/slowDigitsAna.C @@ -22,6 +22,9 @@ void slowDigitsAna() { // 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); @@ -44,9 +47,10 @@ void slowDigitsAna() { 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(); } @@ -55,16 +59,16 @@ void slowDigitsAna() { 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(); @@ -73,24 +77,30 @@ void slowDigitsAna() { << " 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; } } @@ -98,8 +108,11 @@ void slowDigitsAna() { // 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(); } diff --git a/TRD/slowDigitsCreate.C b/TRD/slowDigitsCreate.C index 59922e78b0d..918d17bb2d4 100644 --- a/TRD/slowDigitsCreate.C +++ b/TRD/slowDigitsCreate.C @@ -21,7 +21,7 @@ void slowDigitsCreate() { // Set the parameter Digitizer->SetDiffusion(); - Digitizer->SetExB(); + //Digitizer->SetExB(); //Digitizer->SetElAttach(); //Digitizer->SetAttachProb(); -- 2.43.0