From 793ff80c55ff5c109e52679681ffde680cc9ff22 Mon Sep 17 00:00:00 2001 From: cblume Date: Wed, 1 Nov 2000 14:54:05 +0000 Subject: [PATCH] Merge with TRD-develop --- TRD/AliTRD.cxx | 366 ++++++++++++-- TRD/AliTRD.h | 45 +- TRD/AliTRDanalyzeDigits.C | 11 + TRD/AliTRDanalyzeHits.C | 99 ++++ TRD/AliTRDarrayI.cxx | 23 +- TRD/AliTRDarrayI.h | 8 +- TRD/AliTRDclusterizer.cxx | 96 +++- TRD/AliTRDclusterizer.h | 7 +- TRD/AliTRDclusterizerV0.cxx | 48 +- TRD/AliTRDclusterizerV0.h | 7 +- TRD/AliTRDclusterizerV1.cxx | 99 +++- TRD/AliTRDclusterizerV1.h | 12 +- TRD/AliTRDconfig.C | 179 +++++++ TRD/AliTRDcreateDigits.C | 40 ++ TRD/AliTRDdataArray.cxx | 13 +- TRD/AliTRDdataArray.h | 15 +- TRD/AliTRDdataArrayF.cxx | 31 +- TRD/AliTRDdataArrayF.h | 10 +- TRD/AliTRDdataArrayI.cxx | 23 +- TRD/AliTRDdataArrayI.h | 9 +- TRD/AliTRDdigit.cxx | 62 ++- TRD/AliTRDdigit.h | 32 +- TRD/AliTRDdigitizer.cxx | 880 +++++++++++++++++++++------------ TRD/AliTRDdigitizer.h | 107 ++-- TRD/AliTRDdigitsManager.cxx | 45 +- TRD/AliTRDdigitsManager.h | 32 +- TRD/AliTRDgeometry.cxx | 292 ++++++++--- TRD/AliTRDgeometry.h | 188 ++++--- TRD/AliTRDgeometryFull.cxx | 222 +++++---- TRD/AliTRDgeometryFull.h | 14 +- TRD/AliTRDgeometryHole.cxx | 254 +++++----- TRD/AliTRDgeometryHole.h | 12 +- TRD/AliTRDhit.cxx | 41 +- TRD/AliTRDhit.h | 16 +- TRD/AliTRDmatrix.cxx | 32 +- TRD/AliTRDmatrix.h | 23 +- TRD/AliTRDpixel.cxx | 16 +- TRD/AliTRDpixel.h | 13 +- TRD/AliTRDrecPoint.cxx | 118 +++++ TRD/AliTRDrecPoint.h | 30 +- TRD/AliTRDsegmentArray.cxx | 16 +- TRD/AliTRDsegmentArray.h | 9 +- TRD/AliTRDsegmentArrayBase.cxx | 25 +- TRD/AliTRDsegmentArrayBase.h | 10 +- TRD/AliTRDsegmentID.cxx | 6 + TRD/AliTRDsegmentID.h | 4 +- TRD/AliTRDtest.C | 29 ++ TRD/AliTRDv0.cxx | 24 +- TRD/AliTRDv0.h | 33 +- TRD/AliTRDv1.cxx | 165 ++++++- TRD/AliTRDv1.h | 41 +- TRD/Makefile | 14 +- TRD/TRDLinkDef.h | 11 +- TRD/slowClusterCreate.C | 9 +- TRD/slowDigitsAna.C | 13 +- TRD/slowDigitsCreate.C | 3 +- 56 files changed, 2956 insertions(+), 1026 deletions(-) create mode 100644 TRD/AliTRDanalyzeDigits.C create mode 100644 TRD/AliTRDanalyzeHits.C create mode 100644 TRD/AliTRDconfig.C create mode 100644 TRD/AliTRDcreateDigits.C create mode 100644 TRD/AliTRDtest.C diff --git a/TRD/AliTRD.cxx b/TRD/AliTRD.cxx index 9105866f6ae..ab1425de59d 100644 --- a/TRD/AliTRD.cxx +++ b/TRD/AliTRD.cxx @@ -15,6 +15,37 @@ /* $Log$ + +Revision 1.17.2.6 2000/10/15 23:29:08 cblume +Introduced more detailed geometry for the display + +Revision 1.17.2.5 2000/10/06 16:49:46 cblume +Made Getters const + +Revision 1.17.2.4 2000/10/04 16:34:57 cblume +Replace include files by forward declarations + +Revision 1.17.2.3 2000/09/22 14:45:17 cblume +Included changes for the tracking + +Revision 1.17.2.2 2000/09/18 13:25:13 cblume +Included LoadPoints() method to display the TR photons + +Revision 1.22 2000/10/02 21:28:19 fca +Removal of useless dependecies via forward declarations + +Revision 1.21 2000/06/09 11:10:07 cblume +Compiler warnings and coding conventions, next round + +Revision 1.20 2000/06/08 18:32:57 cblume +Make code compliant to coding conventions + +Revision 1.19 2000/06/07 16:25:37 cblume +Try to remove compiler warnings on Sun and HP + +Revision 1.18 2000/05/08 16:17:27 cblume +Merge TRD-develop + Revision 1.21 2000/06/09 11:10:07 cblume Compiler warnings and coding conventions, next round @@ -71,21 +102,26 @@ Introduction of the Copyright and cvs Log #include #include -#include #include -#include +#include +#include -#include "AliTRD.h" #include "AliRun.h" #include "AliConst.h" +#include "AliDigit.h" +#include "AliMagF.h" +#include "AliMC.h" + +#include "AliTRD.h" +#include "AliTRDhit.h" +#include "AliTRDpoints.h" +#include "AliTRDdigit.h" #include "AliTRDdigitizer.h" #include "AliTRDclusterizer.h" #include "AliTRDgeometryHole.h" #include "AliTRDgeometryFull.h" #include "AliTRDrecPoint.h" -#include "AliMagF.h" -#include "AliMC.h" - + ClassImp(AliTRD) //_____________________________________________________________________________ @@ -105,6 +141,12 @@ AliTRD::AliTRD() fGeometry = 0; + fGasDensity = 0; + fFoilDensity = 0; + + fDrawTR = 0; + fDisplayType = 0; + } //_____________________________________________________________________________ @@ -138,18 +180,24 @@ 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; + fDigits = 0; // Allocate the rec point array - fRecPoints = new TObjArray(400); - fNRecPoints = 0; + fRecPoints = new TObjArray(400); + fNRecPoints = 0; - fIshunt = 0; - fGasMix = 0; + fIshunt = 0; + fGasMix = 0; + + fGasDensity = 0; + fFoilDensity = 0; + + fDrawTR = 0; + fDisplayType = 0; SetMarkerColor(kWhite); @@ -182,12 +230,13 @@ AliTRD::~AliTRD() } //_____________________________________________________________________________ -void AliTRD::AddRecPoint(Float_t *pos, Int_t *digits, Int_t det, Float_t amp) +void AliTRD::AddRecPoint(Float_t *pos, Int_t *digits, Int_t det, Float_t amp + , Int_t *tracks) { // // Add a reconstructed point for the TRD // - + AliTRDrecPoint *recPoint = new AliTRDrecPoint(); TVector3 posVec(pos[0],pos[1],pos[2]); recPoint->SetLocalPosition(posVec); @@ -197,6 +246,9 @@ void AliTRD::AddRecPoint(Float_t *pos, Int_t *digits, Int_t det, Float_t amp) recPoint->AddDigit(digits[iDigit]); } + recPoint->AddTrackIndex(tracks); + + recPoint->SetTrackingYZ(0.,0.); // variance values set inside fRecPoints->Add(recPoint); } @@ -214,14 +266,14 @@ void AliTRD::AddDigit(Int_t *digits, Int_t *amp) } //_____________________________________________________________________________ -void AliTRD::AddHit(Int_t track, Int_t *det, Float_t *hits) +void AliTRD::AddHit(Int_t track, Int_t det, Float_t *hits, Int_t q) { // // Add a hit for the TRD // TClonesArray &lhits = *fHits; - new(lhits[fNhits++]) AliTRDhit(fIshunt,track,det,hits); + new(lhits[fNhits++]) AliTRDhit(fIshunt,track,det,hits,q); } @@ -234,23 +286,68 @@ void AliTRD::BuildGeometry() TNode *node, *top; TPGON *pgon; + + Float_t rmin, rmax; + Float_t zmax1, zmax2; + const Int_t kColorTRD = 46; // Find the top node alice top = gAlice->GetGeometry()->GetNode("alice"); - pgon = new TPGON("S_TRD","TRD","void",0,360,kNsect,4); - Float_t ff = TMath::Cos(kDegrad * 180 / kNsect); - Float_t rrmin = kRmin / ff; - Float_t rrmax = kRmax / ff; - pgon->DefineSection(0,-kZmax1,rrmax,rrmax); - pgon->DefineSection(1,-kZmax2,rrmin,rrmax); - pgon->DefineSection(2, kZmax2,rrmin,rrmax); - pgon->DefineSection(3, kZmax1,rrmax,rrmax); - top->cd(); - node = new TNode("TRD","TRD","S_TRD",0,0,0,""); - node->SetLineColor(kColorTRD); - fNodes->Add(node); + switch (fDisplayType) { + + case 0: + + pgon = new TPGON("S_TRD","TRD","void",0,360,AliTRDgeometry::Nsect(),4); + rmin = AliTRDgeometry::Rmin(); + rmax = AliTRDgeometry::Rmax(); + pgon->DefineSection(0,-AliTRDgeometry::Zmax1(),rmax,rmax); + pgon->DefineSection(1,-AliTRDgeometry::Zmax2(),rmin,rmax); + pgon->DefineSection(2, AliTRDgeometry::Zmax2(),rmin,rmax); + pgon->DefineSection(3, AliTRDgeometry::Zmax1(),rmax,rmax); + top->cd(); + node = new TNode("TRD","TRD","S_TRD",0,0,0,""); + node->SetLineColor(kColorTRD); + fNodes->Add(node); + + break; + + case 1: + + Float_t slope = (AliTRDgeometry::Zmax1() - AliTRDgeometry::Zmax2()) + / (AliTRDgeometry::Rmax() - AliTRDgeometry::Rmin()); + + rmin = AliTRDgeometry::Rmin() + AliTRDgeometry::RaThick(); + rmax = rmin + AliTRDgeometry::DrThick(); + zmax2 = AliTRDgeometry::Zmax2() + slope * AliTRDgeometry::RaThick(); + zmax1 = zmax2 + slope * AliTRDgeometry::DrThick(); + Char_t name[7]; + + for (Int_t iPlan = 0; iPlan < AliTRDgeometry::Nplan(); iPlan++) { + + sprintf(name,"S_TRD%d",iPlan); + pgon = new TPGON(name,"TRD","void",0,360,AliTRDgeometry::Nsect(),4); + pgon->DefineSection(0,-zmax1,rmax,rmax); + pgon->DefineSection(1,-zmax2,rmin,rmax); + pgon->DefineSection(2, zmax2,rmin,rmax); + pgon->DefineSection(3, zmax1,rmax,rmax); + top->cd(); + node = new TNode("TRD","TRD",name,0,0,0,""); + node->SetLineColor(kColorTRD); + fNodes->Add(node); + + Float_t height = AliTRDgeometry::Cheight() + AliTRDgeometry::Cspace(); + rmin = rmin + height; + rmax = rmax + height; + zmax1 = zmax1 + slope * height; + zmax2 = zmax2 + slope * height; + + } + + break; + + }; } @@ -261,10 +358,14 @@ void AliTRD::Copy(TObject &trd) // Copy function // - ((AliTRD &) trd).fGasMix = fGasMix; - ((AliTRD &) trd).fGeometry = fGeometry; - ((AliTRD &) trd).fRecPoints = fRecPoints; - ((AliTRD &) trd).fNRecPoints = fNRecPoints; + ((AliTRD &) trd).fGasMix = fGasMix; + ((AliTRD &) trd).fGeometry = fGeometry; + ((AliTRD &) trd).fRecPoints = fRecPoints; + ((AliTRD &) trd).fNRecPoints = fNRecPoints; + ((AliTRD &) trd).fGasDensity = fGasDensity; + ((AliTRD &) trd).fFoilDensity = fFoilDensity; + ((AliTRD &) trd).fDrawTR = fDrawTR; + ((AliTRD &) trd).fDisplayType = fDisplayType; //AliDetector::Copy(trd); @@ -344,7 +445,8 @@ void AliTRD::CreateMaterials() Float_t stmin = -0.001; Float_t absl, radl, d, buf[1]; - Float_t agm[2], dgm, zgm[2], wgm[2]; + Float_t agm[2], zgm[2], wgm[2]; + Float_t dgm1, dgm2; Int_t nbuf; ////////////////////////////////////////////////////////////////////////// @@ -375,8 +477,8 @@ void AliTRD::CreateMaterials() // Create gas mixture wgm[0] = fxc; wgm[1] = 1. - fxc; - dgm = wgm[0] * dxe + wgm[1] * dco; - AliMixture(10, "Gas mixture 1$", agm, zgm, dgm, 2, wgm); + dgm1 = wgm[0] * dxe + wgm[1] * dco; + AliMixture(10, "Gas mixture 1$", agm, zgm, dgm1, 2, wgm); // Xe/Isobutane-mixture // Get properties of Xe gMC->Gfmate((*fIdmate)[4], namate, agm[0], zgm[0], d, radl, absl, buf, nbuf); @@ -385,8 +487,8 @@ void AliTRD::CreateMaterials() // Create gas mixture wgm[0] = fxi; wgm[1] = 1. - fxi; - dgm = wgm[0] * dxe + wgm[1] * dis; - AliMixture(11, "Gas mixture 2$", agm, zgm, dgm, 2, wgm); + dgm2 = wgm[0] * dxe + wgm[1] * dis; + AliMixture(11, "Gas mixture 2$", agm, zgm, dgm2, 2, wgm); ////////////////////////////////////////////////////////////////////////// // Tracking Media Parameters @@ -442,6 +544,13 @@ void AliTRD::CreateMaterials() AliMedium(14, "Water$", 13, 0, isxfld, sxmgmx , tmaxfd, stemax, deemax, epsil, stmin); + // Save the density values for the TRD absorbtion + fFoilDensity = dmy; + if (fGasMix == 1) + fGasDensity = dgm1; + else + fGasDensity = dgm2; + } //_____________________________________________________________________________ @@ -549,6 +658,142 @@ void AliTRD::Init() } +//_____________________________________________________________________________ +void AliTRD::LoadPoints(Int_t track) +{ + // + // Store x, y, z of all hits in memory. + // Hit originating from TR photons are given a different color + // + + if (!fDrawTR) { + AliDetector::LoadPoints(track); + return; + } + + if (fHits == 0) return; + + Int_t nhits = fHits->GetEntriesFast(); + if (nhits == 0) return; + + Int_t tracks = gAlice->GetNtrack(); + if (fPoints == 0) fPoints = new TObjArray(tracks); + + AliTRDhit *ahit; + + Int_t *ntrkE = new Int_t[tracks]; + Int_t *ntrkT = new Int_t[tracks]; + Int_t *limiE = new Int_t[tracks]; + Int_t *limiT = new Int_t[tracks]; + Float_t **coorE = new Float_t*[tracks]; + Float_t **coorT = new Float_t*[tracks]; + for(Int_t i = 0; i < tracks; i++) { + ntrkE[i] = 0; + ntrkT[i] = 0; + coorE[i] = 0; + coorT[i] = 0; + limiE[i] = 0; + limiT[i] = 0; + } + + AliTRDpoints *points = 0; + Float_t *fp = 0; + Int_t trk; + Int_t chunk = nhits / 4 + 1; + + // Loop over all the hits and store their position + for (Int_t hit = 0; hit < nhits; hit++) { + + ahit = (AliTRDhit *) fHits->UncheckedAt(hit); + + // dEdx hits + if (ahit->GetCharge() >= 0) { + + trk = ahit->GetTrack(); + if (ntrkE[trk] == limiE[trk]) { + // Initialise a new track + fp = new Float_t[3*(limiE[trk]+chunk)]; + if (coorE[trk]) { + memcpy(fp,coorE[trk],sizeof(Float_t)*3*limiE[trk]); + delete [] coorE[trk]; + } + limiE[trk] += chunk; + coorE[trk] = fp; + } + else { + fp = coorE[trk]; + } + fp[3*ntrkE[trk] ] = ahit->X(); + fp[3*ntrkE[trk]+1] = ahit->Y(); + fp[3*ntrkE[trk]+2] = ahit->Z(); + ntrkE[trk]++; + + } + // TR photon hits + else { + + trk = ahit->GetTrack(); + if (ntrkT[trk] == limiT[trk]) { + // Initialise a new track + fp = new Float_t[3*(limiT[trk]+chunk)]; + if (coorT[trk]) { + memcpy(fp,coorT[trk],sizeof(Float_t)*3*limiT[trk]); + delete [] coorT[trk]; + } + limiT[trk] += chunk; + coorT[trk] = fp; + } + else { + fp = coorT[trk]; + } + fp[3*ntrkT[trk] ] = ahit->X(); + fp[3*ntrkT[trk]+1] = ahit->Y(); + fp[3*ntrkT[trk]+2] = ahit->Z(); + ntrkT[trk]++; + + } + + } + + for (trk = 0; trk < tracks; ++trk) { + + if (ntrkE[trk] || ntrkT[trk]) { + + points = new AliTRDpoints(); + points->SetDetector(this); + points->SetParticle(trk); + + // Set the dEdx points + if (ntrkE[trk]) { + points->SetMarkerColor(GetMarkerColor()); + points->SetMarkerSize(GetMarkerSize()); + points->SetPolyMarker(ntrkE[trk],coorE[trk],GetMarkerStyle()); + delete [] coorE[trk]; + coorE[trk] = 0; + } + + // Set the TR photon points + if (ntrkT[trk]) { + points->SetTRpoints(ntrkT[trk],coorT[trk]); + delete [] coorT[trk]; + coorT[trk] = 0; + } + + fPoints->AddAt(points,trk); + + } + + } + + delete [] coorE; + delete [] coorT; + delete [] ntrkE; + delete [] ntrkT; + delete [] limiE; + delete [] limiT; + +} + //_____________________________________________________________________________ void AliTRD::MakeBranch(Option_t* option) { @@ -556,18 +801,18 @@ void AliTRD::MakeBranch(Option_t* option) // Create Tree branches for the TRD digits and cluster. // - Int_t buffersize = 4000; - Char_t branchname[15]; + //Int_t buffersize = 4000; + //Char_t branchname[15]; AliDetector::MakeBranch(option); - Char_t *r = strstr(option,"R"); - sprintf(branchname,"%srecPoints",GetName()); - if (fRecPoints && gAlice->TreeR() && r) { - gAlice->TreeR()->Branch(branchname,fRecPoints->IsA()->GetName() - ,&fRecPoints,buffersize,0); - printf("* AliTRD::MakeBranch * Making Branch %s for points in TreeR\n",branchname); - } + //Char_t *r = strstr(option,"R"); + //sprintf(branchname,"%srecPoints",GetName()); + //if (fRecPoints && gAlice->TreeR() && r) { + // gAlice->TreeR()->Branch(branchname,fRecPoints->IsA()->GetName() + // ,&fRecPoints,buffersize,0); + // printf("* AliTRD::MakeBranch * Making Branch %s for points in TreeR\n",branchname); + //} } @@ -578,8 +823,11 @@ void AliTRD::ResetRecPoints() // Reset number of reconstructed points and the point array // - fNRecPoints = 0; - if (fRecPoints) fRecPoints->Delete(); + if(fRecPoints) { + fNRecPoints = 0; + Int_t nentr = fRecPoints->GetEntriesFast(); + for(Int_t i = 0; i < nentr; i++) delete fRecPoints->RemoveAt(i); + } } @@ -627,6 +875,28 @@ void AliTRD::SetGasMix(Int_t imix) } +//_____________________________________________________________________________ +void AliTRD::SetPHOShole() +{ + // + // Selects a geometry with a hole in front of the PHOS + // + + fGeometry->SetPHOShole(); + +} + +//_____________________________________________________________________________ +void AliTRD::SetRICHhole() +{ + // + // Selects a geometry with a hole in front of the RICH + // + + fGeometry->SetRICHhole(); + +} + //_____________________________________________________________________________ AliTRD &AliTRD::operator=(const AliTRD &trd) { diff --git a/TRD/AliTRD.h b/TRD/AliTRD.h index a7d926478c2..f6917314b17 100644 --- a/TRD/AliTRD.h +++ b/TRD/AliTRD.h @@ -8,14 +8,15 @@ //////////////////////////////////////////////// // Manager and hits classes for set: TRD // //////////////////////////////////////////////// - -#include "AliRun.h" + #include "AliDetector.h" -#include "AliTRDhit.h" -#include "AliDigit.h" -#include "AliTRDconst.h" -#include "AliTRDgeometry.h" +class AliRun; +class AliDigit; + +class AliTRDhit; +class AliTRDsim; +class AliTRDgeometry; //_____________________________________________________________________________ class AliTRD : public AliDetector { @@ -29,17 +30,18 @@ class AliTRD : public AliDetector { AliTRD &operator=(const AliTRD &trd); - virtual void AddHit(Int_t track, Int_t *det, Float_t *hits); + virtual void AddHit(Int_t track, Int_t det, Float_t *hits, Int_t q); virtual void AddDigit(Int_t *digits, Int_t *amp); virtual void AddRecPoint(Float_t *pos, Int_t *digits - , Int_t det, Float_t amp); + , Int_t det, Float_t amp, Int_t *tracks); virtual void BuildGeometry(); virtual void Copy(TObject &trd); virtual void CreateGeometry(); virtual void CreateMaterials(); virtual void DrawModule(); Int_t DistancetoPrimitive(Int_t px, Int_t py); - TObjArray *RecPoints() { return fRecPoints; }; + virtual void LoadPoints(Int_t track); + TObjArray *RecPoints() const { return fRecPoints; }; virtual void Init(); virtual Int_t IsVersion() const = 0; virtual void MakeBranch(Option_t* option); @@ -49,20 +51,25 @@ class AliTRD : public AliDetector { virtual void SetGasMix(Int_t imix = 0); virtual void SetHits() {}; - virtual void SetPHOShole() { fGeometry->SetPHOShole(); }; - virtual void SetRICHhole() { fGeometry->SetRICHhole(); }; + virtual void SetPHOShole(); + virtual void SetRICHhole(); + virtual void SetDrawTR(Int_t idraw = 1) { fDrawTR = idraw; }; + virtual void SetDisplayType(Int_t type = 0) { fDisplayType = type; }; - AliTRDgeometry *GetGeometry() { return fGeometry; }; + AliTRDgeometry *GetGeometry() const { return fGeometry; }; virtual void SetSensChamber(Int_t ichamber) = 0; virtual void SetSensPlane(Int_t iplane) = 0; virtual void SetSensSector(Int_t isector) = 0; virtual void SetSensSector(Int_t isector, Int_t nsector) = 0; - virtual Int_t GetSensChamber() = 0; - virtual Int_t GetSensPlane() = 0; - virtual Int_t GetSensSector() = 0; - virtual Int_t GetSensSectorRange() = 0; + virtual Int_t GetSensChamber() const = 0; + virtual Int_t GetSensPlane() const = 0; + virtual Int_t GetSensSector() const = 0; + virtual Int_t GetSensSectorRange() const = 0; + + virtual AliTRDsim *CreateTR() = 0; + virtual AliTRDsim *GetTR() const = 0; protected: @@ -73,6 +80,12 @@ class AliTRD : public AliDetector { TObjArray *fRecPoints; // Array of reconstructed points Int_t fNRecPoints; //! Number of reconstructed points + Float_t fGasDensity; // The density of the drift gas + Float_t fFoilDensity; // The density of the entrance window foil + + Int_t fDrawTR; // Switches marking the TR photons in the display + Int_t fDisplayType; // Display type (0: normal, 1: detailed) + ClassDef(AliTRD,1) // Transition Radiation Detector base class }; diff --git a/TRD/AliTRDanalyzeDigits.C b/TRD/AliTRDanalyzeDigits.C new file mode 100644 index 00000000000..18b9c3ddddd --- /dev/null +++ b/TRD/AliTRDanalyzeDigits.C @@ -0,0 +1,11 @@ +Int_t AliTRDanalyzeDigits() +{ + // + // Analyzes the digits + // + + Int_t rc = 0; + + return rc; + +} diff --git a/TRD/AliTRDanalyzeHits.C b/TRD/AliTRDanalyzeHits.C new file mode 100644 index 00000000000..dd5a46fb283 --- /dev/null +++ b/TRD/AliTRDanalyzeHits.C @@ -0,0 +1,99 @@ +Int_t AliTRDanalyzeHits() +{ + // + // Analyzes the hits and fills QA-histograms + // + + Int_t rc = 0; + + if (!gAlice) { + cout << " No AliRun object found" << endl; + rc = 1; + return rc; + } + gAlice->GetEvent(0); + + // Get the pointer to the TRD detector + AliDetector *TRD = gAlice->GetDetector("TRD"); + if (!TRD) { + cout << " No TRD detector found" << endl; + rc = 2; + return rc; + } + + // Define the histograms + TH1F *hQdedx = new TH1F("hQdedx","Charge dedx-hits",100,0.0,1000.0); + TH1F *hQtr = new TH1F("hQtr" ,"Charge TR-hits" ,100,0.0,1000.0); + TH2F *hZY = new TH2F("hZY" ,"Y vs Z",50,-100.0,100.0,40,290.0,370.0); + TH2F *hXZ = new TH2F("hXZ" ,"Z vs X",50,-100.0,100.0,50,-100.0,100.0); + + // Get the pointer hit tree + TTree *HitTree = gAlice->TreeH(); + if (!HitTree) { + cout << " No hit tree found" << endl; + rc = 3; + return rc; + } + + Int_t countHits = 0; + Int_t nBytes = 0; + + // Get the number of entries in the hit tree + // (Number of primary particles creating a hit somewhere) + Int_t nTrack = (Int_t) HitTree->GetEntries(); + cout << " Found " << nTrack + << " primary particles with hits" << endl; + + // Loop through all entries in the tree + for (Int_t iTrack = 0; iTrack < nTrack; iTrack++) { + + gAlice->ResetHits(); + nBytes += HitTree->GetEvent(iTrack); + + // Get the number of hits in the TRD created by this particle + Int_t nHit = TRD->Hits()->GetEntriesFast(); + //cout << " Found " << nHit + // << " hits for primary particle " << iTrack << endl; + + // Loop through the TRD hits + for (Int_t iHit = 0; iHit < nHit; iHit++) { + + countHits++; + + AliTRDhit *hit = (AliTRDhit *) TRD->Hits()->UncheckedAt(iHit); + + Float_t x = hit->X(); + Float_t y = hit->Y(); + Float_t z = hit->Z(); + Float_t q = hit->GetCharge(); + + if (q > 0) + hQdedx->Fill(q); + else + hQtr->Fill(TMath::Abs(q)); + + hZY->Fill(z,y); + hXZ->Fill(x,z); + + } + + } + + cout << " Found " << countHits << " hits in total" << endl; + + TCanvas *cHits = new TCanvas("cHits","AliTRDanalyzeHits",50,50,600,600); + cHits->Divide(2,2); + cHits->cd(1); + hXZ->Draw("COL"); + cHits->cd(2); + hZY->Draw("COL"); + cHits->cd(3); + gPad->SetLogy(); + hQdedx->Draw(); + cHits->cd(4); + gPad->SetLogy(); + hQtr->Draw(); + + return rc; + +} diff --git a/TRD/AliTRDarrayI.cxx b/TRD/AliTRDarrayI.cxx index cf4bf61332d..71af135ac5b 100644 --- a/TRD/AliTRDarrayI.cxx +++ b/TRD/AliTRDarrayI.cxx @@ -15,6 +15,28 @@ /* $Log$ + +Revision 1.1.4.3 2000/10/06 16:49:46 cblume +Made Getters const + +Revision 1.1.4.2 2000/10/04 16:34:58 cblume +Replace include files by forward declarations + +Revision 1.4 2000/06/09 11:10:07 cblume +Compiler warnings and coding conventions, next round + +Revision 1.3 2000/06/08 18:32:58 cblume +Make code compliant to coding conventions + +Revision 1.2 2000/05/08 16:17:27 cblume +Merge TRD-develop + +Revision 1.1.4.1 2000/05/08 14:35:54 cblume +Update + +Revision 1.4 2000/06/09 11:10:07 cblume +Compiler warnings and coding conventions, next round + Revision 1.3 2000/06/08 18:32:58 cblume Make code compliant to coding conventions @@ -65,7 +87,6 @@ void AliTRDarrayI::Copy(TObject &a) } - //_____________________________________________________________________________ void AliTRDarrayI::Expand(Int_t n) { diff --git a/TRD/AliTRDarrayI.h b/TRD/AliTRDarrayI.h index 577a9c21511..be88900e3b1 100644 --- a/TRD/AliTRDarrayI.h +++ b/TRD/AliTRDarrayI.h @@ -5,18 +5,18 @@ /* $Id: AliTRDarrayI.h,v */ -#include "TObject.h" -#include "TArrayI.h" +#include +#include class AliTRDarrayI: public TObject ,public TArrayI { public: - ~AliTRDarrayI(); + virtual ~AliTRDarrayI(); void Copy(TObject &a); void Expand(Int_t n); - ClassDef(AliTRDarrayI,1) + ClassDef(AliTRDarrayI,1) // An array of integers }; diff --git a/TRD/AliTRDclusterizer.cxx b/TRD/AliTRDclusterizer.cxx index dd2451dd8df..2c1884810d3 100644 --- a/TRD/AliTRDclusterizer.cxx +++ b/TRD/AliTRDclusterizer.cxx @@ -15,6 +15,34 @@ /* $Log$ + +Revision 1.1.4.5 2000/10/15 23:40:01 cblume +Remove AliTRDconst + +Revision 1.1.4.4 2000/10/06 16:49:46 cblume +Made Getters const + +Revision 1.1.4.3 2000/10/04 16:34:58 cblume +Replace include files by forward declarations + +Revision 1.1.4.2 2000/09/22 14:49:49 cblume +Adapted to tracking code + +Revision 1.5 2000/10/02 21:28:19 fca +Removal of useless dependecies via forward declarations + +Revision 1.4 2000/06/09 11:10:07 cblume +Compiler warnings and coding conventions, next round + +Revision 1.3 2000/06/08 18:32:58 cblume +Make code compliant to coding conventions + +Revision 1.2 2000/05/08 16:17:27 cblume +Merge TRD-develop + +Revision 1.1.4.1 2000/05/08 15:08:03 cblume +Remove the class AliTRDcluster + Revision 1.4 2000/06/09 11:10:07 cblume Compiler warnings and coding conventions, next round @@ -40,10 +68,13 @@ Add new TRD classes #include #include +#include #include "AliRun.h" #include "AliTRD.h" #include "AliTRDclusterizer.h" +#include "AliTRDrecPoint.h" +#include "AliTRDgeometry.h" ClassImp(AliTRDclusterizer) @@ -180,20 +211,63 @@ Bool_t AliTRDclusterizer::Open(const Char_t *name, Int_t nEvent) } //_____________________________________________________________________________ -Bool_t AliTRDclusterizer::WriteCluster() +Bool_t AliTRDclusterizer::WriteClusters(Int_t det) { // - // Writes out the TRD-cluster - // + // Fills TRDrecPoints branch in TRDrecPoints## tree with rec. points + // found in detector = det. For det=-1 writes the tree. + // For det=-2 recreates the tree. + + Char_t treeName[14]; + sprintf(treeName,"TRDrecPoints%d", fEvent); + + if (det == -2) { + fInputFile->Delete(treeName); + TTree *tree = new TTree(treeName,"Tree with TRD rec. points"); + tree->Write(); + return kTRUE; + } - // Write the new tree into the input file (use overwrite option) - Char_t treeName[7]; - sprintf(treeName,"TreeR%d",fEvent); - printf("AliTRDclusterizer::WriteCluster -- "); - printf("Write the cluster tree %s for event %d.\n" - ,treeName,fEvent); - gAlice->TreeR()->Write(treeName,2); + TTree *tree=(TTree*)fInputFile->Get(treeName); + TBranch *branch=tree->GetBranch("TRDrecPoints"); - return kTRUE; + if(!branch) { + TObjArray *ioArray = 0; + branch = tree->Branch("TRDrecPoints","TObjArray",&ioArray,32000,0); + } + + if ((det >= 0) && (det < AliTRDgeometry::Ndet())) { + + AliTRD *TRD = (AliTRD*) gAlice->GetDetector("TRD"); + Int_t nRecPoints = TRD->RecPoints()->GetEntriesFast(); + TObjArray *fDetRecPoints = new TObjArray(400); + + for (Int_t i=0; iRecPoints()->UncheckedAt(i); + if(det == p->GetDetector()) fDetRecPoints->AddLast(p); + else printf("attempt to write a RecPoint with unexpected detector index"); + } + + branch->SetAddress(&fDetRecPoints); + tree->Fill(); + return kTRUE; + } + + if (det == -1) { + + printf("\rAliTRDclusterizer::WriteClusters -- "); + printf("Writing the cluster tree %-18s for event %d.\n" + ,tree->GetName(),fEvent); + + tree->Write(); + return kTRUE; + } + + printf("\rAliTRDclusterizer::WriteClusters -- "); + printf("Unexpected detector index %d.\n", det); + return kFALSE; } + + + diff --git a/TRD/AliTRDclusterizer.h b/TRD/AliTRDclusterizer.h index b38b5dbb3a3..af8997d4583 100644 --- a/TRD/AliTRDclusterizer.h +++ b/TRD/AliTRDclusterizer.h @@ -6,7 +6,8 @@ /* $Id$ */ #include -#include + +class TFile; /////////////////////////////////////////////////////// // Finds and handles cluster // @@ -25,8 +26,8 @@ class AliTRDclusterizer : public TNamed { virtual void Copy(TObject &c); virtual void Init(); virtual Bool_t Open(const Char_t *name, Int_t nEvent = 0); - virtual Bool_t MakeCluster() = 0; - virtual Bool_t WriteCluster(); + virtual Bool_t MakeClusters() = 0; + virtual Bool_t WriteClusters(Int_t det); protected: diff --git a/TRD/AliTRDclusterizerV0.cxx b/TRD/AliTRDclusterizerV0.cxx index 48091dee55d..361ac5e5487 100644 --- a/TRD/AliTRDclusterizerV0.cxx +++ b/TRD/AliTRDclusterizerV0.cxx @@ -15,6 +15,36 @@ /* $Log$ +Revision 1.1.4.6 2000/10/16 01:16:53 cblume +Changed timebin 0 to be the one closest to the readout + +Revision 1.1.4.5 2000/10/15 23:40:01 cblume +Remove AliTRDconst + +Revision 1.1.4.4 2000/10/06 16:49:46 cblume +Made Getters const + +Revision 1.1.4.3 2000/10/04 16:34:58 cblume +Replace include files by forward declarations + +Revision 1.1.4.2 2000/09/22 14:49:49 cblume +Adapted to tracking code + +Revision 1.5 2000/10/02 21:28:19 fca +Removal of useless dependecies via forward declarations + +Revision 1.4 2000/06/08 18:32:58 cblume +Make code compliant to coding conventions + +Revision 1.3 2000/06/07 16:27:01 cblume +Try to remove compiler warnings on Sun and HP + +Revision 1.2 2000/05/08 16:17:27 cblume +Merge TRD-develop + +Revision 1.1.4.1 2000/05/08 15:08:41 cblume +Replace AliTRDcluster by AliTRDrecPoint + Revision 1.4 2000/06/08 18:32:58 cblume Make code compliant to coding conventions @@ -48,9 +78,12 @@ Add new TRD classes #include #include + +#include "AliRun.h" +#include "AliTRD.h" #include "AliTRDclusterizerV0.h" -#include "AliTRDconst.h" +#include "AliTRDhit.h" #include "AliTRDgeometry.h" #include "AliTRDrecPoint.h" @@ -101,7 +134,7 @@ void AliTRDclusterizerV0::Init() } //_____________________________________________________________________________ -Bool_t AliTRDclusterizerV0::MakeCluster() +Bool_t AliTRDclusterizerV0::MakeClusters() { // // Generates the cluster @@ -137,9 +170,9 @@ Bool_t AliTRDclusterizerV0::MakeCluster() Int_t nTrack = (Int_t) hitTree->GetEntries(); // Loop through all the chambers - for (Int_t icham = 0; icham < kNcham; icham++) { - for (Int_t iplan = 0; iplan < kNplan; iplan++) { - for (Int_t isect = 0; isect < kNsect; isect++) { + for (Int_t icham = 0; icham < AliTRDgeometry::Ncham(); icham++) { + for (Int_t iplan = 0; iplan < AliTRDgeometry::Nplan(); iplan++) { + for (Int_t isect = 0; isect < AliTRDgeometry::Nsect(); isect++) { Int_t nColMax = geo->GetColMax(iplan); Float_t row0 = geo->GetRow0(iplan,icham,isect); @@ -274,12 +307,13 @@ Bool_t AliTRDclusterizerV0::MakeCluster() // 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); + smear[2] = (Int_t) ((time0 - smear[2]) / timeBinSize); // Add the smeared cluster to the output array Int_t detector = recPoint1->GetDetector(); Int_t digits[3] = {0}; - trd->AddRecPoint(smear,digits,detector,0.0); + Int_t tr[9] = {-1}; + trd->AddRecPoint(smear,digits,detector,0.0,tr); } diff --git a/TRD/AliTRDclusterizerV0.h b/TRD/AliTRDclusterizerV0.h index 9a16d6fcd37..588c6aa521c 100644 --- a/TRD/AliTRDclusterizerV0.h +++ b/TRD/AliTRDclusterizerV0.h @@ -5,7 +5,6 @@ /* $Id$ */ -#include "AliTRD.h" #include "AliTRDclusterizer.h" /////////////////////////////////////////////////////// @@ -21,13 +20,13 @@ class AliTRDclusterizerV0 : public AliTRDclusterizer { virtual ~AliTRDclusterizerV0(); virtual void Init(); - virtual Bool_t MakeCluster(); + virtual Bool_t MakeClusters(); virtual void SetRphiSigma(Float_t sigma) { fRphiSigma = sigma; }; virtual void SetRphiDist(Float_t dist) { fRphiDist = dist; }; - virtual Float_t GetRphiSigma() { return fRphiSigma; }; - virtual Float_t GetRphiDist() { return fRphiDist; }; + virtual Float_t GetRphiSigma() const { return fRphiSigma; }; + virtual Float_t GetRphiDist() const { return fRphiDist; }; protected: diff --git a/TRD/AliTRDclusterizerV1.cxx b/TRD/AliTRDclusterizerV1.cxx index 520c521eb19..e76f11e6b70 100644 --- a/TRD/AliTRDclusterizerV1.cxx +++ b/TRD/AliTRDclusterizerV1.cxx @@ -15,6 +15,21 @@ /* $Log$ +Revision 1.1.4.5 2000/10/15 23:40:01 cblume +Remove AliTRDconst + +Revision 1.1.4.4 2000/10/06 16:49:46 cblume +Made Getters const + +Revision 1.1.4.3 2000/10/04 16:34:58 cblume +Replace include files by forward declarations + +Revision 1.1.4.2 2000/09/22 14:49:49 cblume +Adapted to tracking code + +Revision 1.8 2000/10/02 21:28:19 fca +Removal of useless dependecies via forward declarations + Revision 1.7 2000/06/27 13:08:50 cblume Changed to Copy(TObject &A) to appease the HP-compiler @@ -46,13 +61,19 @@ Add new TRD classes #include #include +#include +#include "AliRun.h" + +#include "AliTRD.h" #include "AliTRDclusterizerV1.h" #include "AliTRDmatrix.h" #include "AliTRDgeometry.h" #include "AliTRDdigitizer.h" #include "AliTRDrecPoint.h" #include "AliTRDdataArrayF.h" +#include "AliTRDdataArrayI.h" +#include "AliTRDdigitsManager.h" ClassImp(AliTRDclusterizerV1) @@ -166,7 +187,7 @@ Bool_t AliTRDclusterizerV1::ReadDigits() } //_____________________________________________________________________________ -Bool_t AliTRDclusterizerV1::MakeCluster() +Bool_t AliTRDclusterizerV1::MakeClusters() { // // Generates the cluster. @@ -189,6 +210,9 @@ Bool_t AliTRDclusterizerV1::MakeCluster() printf("Start creating clusters.\n"); AliTRDdataArrayI *digits; + AliTRDdataArrayI *track0; + AliTRDdataArrayI *track1; + AliTRDdataArrayI *track2; // Parameters Float_t maxThresh = fClusMaxThresh; // threshold value for maximum @@ -202,19 +226,19 @@ Bool_t AliTRDclusterizerV1::MakeCluster() const Int_t kNsig = 5; Int_t chamBeg = 0; - Int_t chamEnd = kNcham; + Int_t chamEnd = AliTRDgeometry::Ncham(); if (trd->GetSensChamber() >= 0) { chamBeg = trd->GetSensChamber(); chamEnd = chamBeg + 1; } Int_t planBeg = 0; - Int_t planEnd = kNplan; + Int_t planEnd = AliTRDgeometry::Nplan(); if (trd->GetSensPlane() >= 0) { planBeg = trd->GetSensPlane(); planEnd = planBeg + 1; } Int_t sectBeg = 0; - Int_t sectEnd = kNsect; + Int_t sectEnd = AliTRDgeometry::Nsect(); // *** Start clustering *** in every chamber for (Int_t icham = chamBeg; icham < chamEnd; icham++) { @@ -224,7 +248,8 @@ Bool_t AliTRDclusterizerV1::MakeCluster() if (trd->GetSensSector() >= 0) { Int_t sens1 = trd->GetSensSector(); Int_t sens2 = sens1 + trd->GetSensSectorRange(); - sens2 -= ((Int_t) (sens2 / kNsect)) * kNsect; + sens2 -= ((Int_t) (sens2 / AliTRDgeometry::Nsect())) + * AliTRDgeometry::Nsect(); if (sens1 < sens2) { if ((isect < sens1) || (isect >= sens2)) continue; } @@ -251,8 +276,15 @@ Bool_t AliTRDclusterizerV1::MakeCluster() AliTRDmatrix *maximaMatrix = new AliTRDmatrix(nRowMax,nColMax,nTimeMax ,isect,icham,iplan); + // Create a matrix for track indexes + AliTRDmatrix *trackMatrix = new AliTRDmatrix(nRowMax,nColMax,nTimeMax + ,isect,icham,iplan); + // Read in the digits digits = fDigitsManager->GetDigits(idet); + track0 = fDigitsManager->GetDictionary(idet,0); + track1 = fDigitsManager->GetDictionary(idet,1); + track2 = fDigitsManager->GetDictionary(idet,2); // Loop through the detector pixel for (time = 0; time < nTimeMax; time++) { @@ -261,6 +293,10 @@ Bool_t AliTRDclusterizerV1::MakeCluster() Int_t signal = digits->GetData(row,col,time); Int_t index = digits->GetIndex(row,col,time); + Int_t t[3] = {-1}; + t[0] = track0->GetData(row,col,time) - 1; + t[1] = track1->GetData(row,col,time) - 1; + t[2] = track2->GetData(row,col,time) - 1; // Fill the detector matrix if (signal > signalThresh) { @@ -268,8 +304,10 @@ Bool_t AliTRDclusterizerV1::MakeCluster() digitMatrix->SetSignal(row,col,time,signal); // Store the digits number digitMatrix->AddTrack(row,col,time,index); + for(Int_t i = 0; i < 3; i++) { + trackMatrix->AddTrack(row,col,time,t[i]); + } } - } } } @@ -314,11 +352,17 @@ Bool_t AliTRDclusterizerV1::MakeCluster() Float_t clusterPads[kNclus] = {0}; // Cluster digit info Int_t clusterDigit[kNclus] = {0}; + // Cluster MC tracks info + const Int_t nt = kNclus*3; + Int_t clusterTracks[nt] = {-1}; Int_t iPad; for (iPad = 0; iPad < kNclus; iPad++) { clusterSignal[iPad] = digitMatrix->GetSignal(row,col-1+iPad,time); clusterDigit[iPad] = digitMatrix->GetTrack(row,col-1+iPad,time,0); + for (Int_t j = 0; j < 3; j++) { + clusterTracks[iPad*3+j] = trackMatrix->GetTrack(row,col-1+iPad,time,j); + } } // neighbouring maximum on right side? @@ -343,10 +387,27 @@ Bool_t AliTRDclusterizerV1::MakeCluster() case 1: // method 1: simply center of mass clusterPads[0] = row + 0.5; - clusterPads[1] = col - 0.5 + (clusterSignal[2] - clusterSignal[0]) / + clusterPads[1] = col + 0.5 + (clusterSignal[2] - clusterSignal[0]) / (clusterSignal[0] + clusterSignal[1] + clusterSignal[2]); clusterPads[2] = time + 0.5; + +/* printf("col = %d, left = %f, center = %f, right = %f, + final =%f \n", col, + digitMatrix->GetSignal(row,col-1,time), + digitMatrix->GetSignal(row,col,time), + digitMatrix->GetSignal(row,col+1,time), + clusterPads[1]); + + printf("col = %d, sig(0) = %f, sig(1) = %f, sig(2) = %f, + final =%f \n", col, + clusterSignal[0], + clusterSignal[1], + clusterSignal[2], + clusterPads[1]); + +*/ + nClusters++; break; case 2: @@ -376,7 +437,7 @@ Bool_t AliTRDclusterizerV1::MakeCluster() + clusterSignal[2]; // Add the cluster to the output array - trd->AddRecPoint(clusterPads,clusterDigit,idet,clusterCharge); + trd->AddRecPoint(clusterPads,clusterDigit,idet,clusterCharge,clusterTracks); } } // time @@ -386,24 +447,28 @@ Bool_t AliTRDclusterizerV1::MakeCluster() printf("AliTRDclusterizerV1::MakeCluster -- "); printf("Number of clusters found: %d\n",nClusters); + WriteClusters(idet); + trd->ResetRecPoints(); + delete digitMatrix; delete maximaMatrix; + delete trackMatrix; } // isect } // iplan } // icham - printf("AliTRDclusterizerV1::MakeCluster -- "); - printf("Total number of points found: %d\n" - ,trd->RecPoints()->GetEntries()); +// printf("AliTRDclusterizerV1::MakeCluster -- "); +// printf("Total number of points found: %d\n" +// ,trd->RecPoints()->GetEntries()); - // Get the pointer to the cluster branch - TTree *clusterTree = gAlice->TreeR(); +// // Get the pointer to the cluster branch +// TTree *clusterTree = gAlice->TreeR(); - // Fill the cluster-branch - printf("AliTRDclusterizerV1::MakeCluster -- "); - printf("Fill the cluster tree.\n"); - clusterTree->Fill(); +// // Fill the cluster-branch +// printf("AliTRDclusterizerV1::MakeCluster -- "); +// printf("Fill the cluster tree.\n"); +// clusterTree->Fill(); printf("AliTRDclusterizerV1::MakeCluster -- "); printf("Done.\n"); diff --git a/TRD/AliTRDclusterizerV1.h b/TRD/AliTRDclusterizerV1.h index 3ebea4584be..bd46599df96 100644 --- a/TRD/AliTRDclusterizerV1.h +++ b/TRD/AliTRDclusterizerV1.h @@ -5,14 +5,14 @@ /* $Id$ */ -#include "AliTRD.h" -#include "AliTRDdigitsManager.h" #include "AliTRDclusterizer.h" /////////////////////////////////////////////////////// // Finds and handles cluster (slow simulation) // /////////////////////////////////////////////////////// +class AliTRDdigitsManager; + class AliTRDclusterizerV1 : public AliTRDclusterizer { public: @@ -25,16 +25,16 @@ class AliTRDclusterizerV1 : public AliTRDclusterizer { virtual void Copy(TObject &c); virtual void Init(); - virtual Bool_t MakeCluster(); + virtual Bool_t MakeClusters(); virtual Bool_t ReadDigits(); virtual void SetClusMaxThresh(Float_t thresh) { fClusMaxThresh = thresh; }; virtual void SetClusSigThresh(Float_t thresh) { fClusSigThresh = thresh; }; virtual void SetClusMethod(Int_t meth) { fClusMethod = meth; }; - virtual Float_t GetClusMaxThresh() { return fClusMaxThresh; }; - virtual Float_t GetClusSigThresh() { return fClusSigThresh; }; - virtual Int_t GetClusMethod() { return fClusMethod; }; + virtual Float_t GetClusMaxThresh() const { return fClusMaxThresh; }; + virtual Float_t GetClusSigThresh() const { return fClusSigThresh; }; + virtual Int_t GetClusMethod() const { return fClusMethod; }; protected: diff --git a/TRD/AliTRDconfig.C b/TRD/AliTRDconfig.C new file mode 100644 index 00000000000..e5c2b8507ed --- /dev/null +++ b/TRD/AliTRDconfig.C @@ -0,0 +1,179 @@ +void Config() +{ + + new AliGeant3("C++ Interface to Geant3"); + + // Create the output file + TFile *rootfile = new TFile("TRD_test.root","recreate"); + rootfile->SetCompressionLevel(2); + + // Define the monte carlo + TGeant3 *geant3 = (TGeant3*) gMC; + + // Set external decayer + AliDecayer* decayer = new AliDecayerPythia(); + decayer->SetForceDecay(all); + decayer->Init(); + gMC->SetExternalDecayer(decayer); + + // ******* GEANT STEERING parameters FOR ALICE SIMULATION ******* + geant3->SetTRIG(1); // Number of events to be processed + geant3->SetSWIT(4,10); + geant3->SetDEBU(0,0,1); + //geant3->SetSWIT(2,2); + geant3->SetDCAY(1); + geant3->SetPAIR(1); + geant3->SetCOMP(1); + geant3->SetPHOT(1); + geant3->SetPFIS(0); + geant3->SetDRAY(0); + geant3->SetANNI(1); + geant3->SetBREM(1); + geant3->SetMUNU(1); + geant3->SetCKOV(1); + geant3->SetHADR(1); // Select pure GEANH (HADR 1) or GEANH/NUCRIN (HADR 3) + geant3->SetLOSS(2); + geant3->SetMULS(1); + geant3->SetRAYL(1); + geant3->SetAUTO(1); // Select automatic STMIN etc... calc. (AUTO 1) or manual (AUTO 0) + geant3->SetABAN(0); // Restore 3.16 behaviour for abandoned tracks + geant3->SetOPTI(2); // Select optimisation level for GEANT geometry searches (0,1,2) + geant3->SetERAN(5.e-7); + + Float_t cut = 1.e-3; // 1MeV cut by default + Float_t tofmax = 1.e10; + // GAM ELEC NHAD CHAD MUON EBREM MUHAB EDEL MUDEL MUPA TOFMAX + geant3->SetCUTS(cut,cut, cut, cut, cut, cut, cut, cut, cut, cut, tofmax); + + // ************* STEERING parameters FOR ALICE SIMULATION ************** + // --- Specify event type to be tracked through the ALICE setup + // --- All positions are in cm, angles in degrees, and P and E in GeV + //AliGenHIJINGpara *gener = new AliGenHIJINGpara(250); + AliGenBox *gener = new AliGenBox(100); + gener->SetMomentumRange(1.0,3.0); + gener->SetPhiRange(80.0,100.0); + gener->SetThetaRange(70.0,110.0); + gener->SetPart(11); // Only electrons + gener->SetOrigin(0,0,0); // Vertex position + gener->SetSigma(0,0,0); // Sigma in (X,Y,Z) (cm) on IP position + gener->Init(); + + //Specify maximum magnetic field in Tesla (neg. ==> default field) + gAlice->SetField(-999,2); + + Int_t iMAG = 1; + Int_t iITS = 1; + Int_t iTPC = 1; + Int_t iTRD = 1; + Int_t iABSO = 1; + Int_t iDIPO = 1; + Int_t iHALL = 1; + Int_t iFRAME = 1; + Int_t iSHIL = 1; + Int_t iPIPE = 1; + + //=================== Alice BODY parameters ============================= + AliBODY *BODY = new AliBODY("BODY","Alice envelop"); + + if (iMAG) { + //=================== MAG parameters ============================ + // --- Start with Magnet since detector layouts may be depending --- + // --- on the selected Magnet dimensions --- + AliMAG *MAG = new AliMAG("MAG","Magnet"); + } + + if (iABSO) { + //=================== ABSO parameters ============================ + AliABSO *ABSO = new AliABSOv0("ABSO","Muon Absorber"); + } + + if (iDIPO) { + //=================== DIPO parameters ============================ + AliDIPO *DIPO = new AliDIPOv2("DIPO","Dipole version 2"); + } + + if (iHALL) { + //=================== HALL parameters ============================ + AliHALL *HALL = new AliHALL("HALL","Alice Hall"); + } + + if (iFRAME) { + //=================== FRAME parameters ============================ + AliFRAME *FRAME = new AliFRAMEv1("FRAME","Space Frame"); + } + + if (iSHIL) { + //=================== SHIL parameters ============================ + AliSHIL *SHIL = new AliSHILv0("SHIL","Shielding"); + } + + if (iPIPE) { + //=================== PIPE parameters ============================ + AliPIPE *PIPE = new AliPIPEv0("PIPE","Beam Pipe"); + } + + if (iITS) { + //=================== ITS parameters ============================ + // + // EUCLID is a flag to output (=1) both geometry and media to two ASCII files + // (called by default ITSgeometry.euc and ITSgeometry.tme) in a format + // understandable to the CAD system EUCLID. The default (=0) means that you + // dont want to use this facility. + // + AliITS *ITS = new AliITSv5("ITS","normal ITS"); + ITS->SetEUCLID(0); + } + + if (iTPC) { + //============================ TPC parameters ================================ + // --- This allows the user to specify sectors for the SLOW (TPC geometry 2) + // --- Simulator. SecAL (SecAU) <0 means that ALL lower (upper) + // --- sectors are specified, any value other than that requires at least one + // --- sector (lower or upper)to be specified! + // --- Reminder: sectors 1-24 are lower sectors (1-12 -> z>0, 13-24 -> z<0) + // --- sectors 25-72 are the upper ones (25-48 -> z>0, 49-72 -> z<0) + // --- SecLows - number of lower sectors specified (up to 6) + // --- SecUps - number of upper sectors specified (up to 12) + // --- Sens - sensitive strips for the Slow Simulator !!! + // --- This does NOT work if all S or L-sectors are specified, i.e. + // --- if SecAL or SecAU < 0 + // + // + //----------------------------------------------------------------------------- + + gROOT->LoadMacro("SetTPCParam.C"); + AliTPCParam *param = SetTPCParam(); + AliTPC *TPC = new AliTPCv1("TPC","Default"); //v1 is default + TPC->SetParam(param); // pass the parameter object to the TPC + + // set gas mixture + TPC->SetGasMixt(2,20,10,-1,0.9,0.1,0.); + TPC->SetSecAL(4); + TPC->SetSecAU(4); + TPC->SetSecLows(1, 2, 3, 19, 20, 21); + TPC->SetSecUps(37, 38, 39, 37+18, 38+18, 39+18, -1, -1, -1, -1, -1, -1); + TPC->SetSens(1); + + if (TPC->IsVersion()==1) param->Write(param->GetTitle()); + + } + + if (iTRD) { + //=================== TRD parameters ============================ + + AliTRD *TRD = new AliTRDv1("TRD","TRD slow simulator"); + TRD->SetSensChamber(2); + TRD->SetSensSector(13); + + // Select the gas mixture (0: 97% Xe + 3% isobutane, 1: 90% Xe + 10% CO2) + TRD->SetGasMix(1); + + // Set to detailed display + TRD->SetDisplayType(1); + + // Switch on TR + AliTRDsim *TRDsim = TRD->CreateTR(); + + } + +} diff --git a/TRD/AliTRDcreateDigits.C b/TRD/AliTRDcreateDigits.C new file mode 100644 index 00000000000..da75b659fe4 --- /dev/null +++ b/TRD/AliTRDcreateDigits.C @@ -0,0 +1,40 @@ +Int_t AliTRDcreateDigits() +{ + // + // Creates the digits from the hits of the slow simulator + // + + Int_t rc = 0; + + return rc; + + if (!gAlice) { + cout << " No AliRun object found" << endl; + rc = 1; + return rc; + } + gAlice->GetEvent(0); + + // Create the TRD digitzer + AliTRDdigitizer *Digitizer = new AliTRDdigitizer("digitizer","Digitizer class"); + + // Initialize the TRD and the geometry + if (!Digitizer->InitDetector()) { + cout << " No TRD geometry found" << endl; + rc = 2; + return rc; + } + + // Set the parameter + Digitizer->SetDiffusion(); + Digitizer->SetVerbose(1); + + // Create the digits + if (!Digitizer->MakeDigits()) { + rc = 3; + return rc; + } + + return rc; + +} diff --git a/TRD/AliTRDdataArray.cxx b/TRD/AliTRDdataArray.cxx index 0cd7633d4cb..e7002b029d1 100644 --- a/TRD/AliTRDdataArray.cxx +++ b/TRD/AliTRDdataArray.cxx @@ -15,6 +15,15 @@ /* $Log$ +Revision 1.1.4.3 2000/10/06 16:49:46 cblume +Made Getters const + +Revision 1.1.4.2 2000/10/04 16:34:58 cblume +Replace include files by forward declarations + +Revision 1.6 2000/06/09 11:10:07 cblume +Compiler warnings and coding conventions, next round + Revision 1.5 2000/06/08 18:32:58 cblume Make code compliant to coding conventions @@ -244,7 +253,7 @@ void AliTRDdataArray::Reset() } //_____________________________________________________________________________ -Int_t AliTRDdataArray::GetIdx1(Int_t row, Int_t col) +Int_t AliTRDdataArray::GetIdx1(Int_t row, Int_t col) const { // // Maps the two-dimensional row/column plane into an one-dimensional array. @@ -269,7 +278,7 @@ Int_t AliTRDdataArray::GetIdx1(Int_t row, Int_t col) } //_____________________________________________________________________________ -Int_t AliTRDdataArray::GetIndex(Int_t row, Int_t col, Int_t time) +Int_t AliTRDdataArray::GetIndex(Int_t row, Int_t col, Int_t time) const { // // Maps the row/column/time into one number diff --git a/TRD/AliTRDdataArray.h b/TRD/AliTRDdataArray.h index c6ecdf51e44..b00ffb2f34e 100644 --- a/TRD/AliTRDdataArray.h +++ b/TRD/AliTRDdataArray.h @@ -6,8 +6,6 @@ /* $Id$ */ -#include "AliTRDarrayI.h" -#include "AliTRDarrayF.h" #include "AliTRDsegmentID.h" ///////////////////////////////////////////////////////////// @@ -15,6 +13,8 @@ // Adapted from AliDigits, origin M.Ivanov // ///////////////////////////////////////////////////////////// +class AliTRDarrayI; + class AliTRDdataArray : public AliTRDsegmentID { public: @@ -29,15 +29,14 @@ class AliTRDdataArray : public AliTRDsegmentID { virtual void Allocate(Int_t nrow, Int_t ncol,Int_t ntime); virtual void Reset(); - virtual Int_t GetNRow() { return fNrow; }; - virtual Int_t GetNCol() { return fNcol; }; - virtual Int_t GetNtime() { return fNtime; }; - - Int_t GetIndex(Int_t row, Int_t col, Int_t time); + virtual Int_t GetNRow() const { return fNrow; }; + virtual Int_t GetNCol() const { return fNcol; }; + virtual Int_t GetNtime() const { return fNtime; }; + Int_t GetIndex(Int_t row, Int_t col, Int_t time) const; protected: - Int_t GetIdx1(Int_t row, Int_t col); + Int_t GetIdx1(Int_t row, Int_t col) const; 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); diff --git a/TRD/AliTRDdataArrayF.cxx b/TRD/AliTRDdataArrayF.cxx index e352f663817..96630e4aa5c 100644 --- a/TRD/AliTRDdataArrayF.cxx +++ b/TRD/AliTRDdataArrayF.cxx @@ -15,6 +15,15 @@ /* $Log$ +Revision 1.1.2.3 2000/10/06 16:49:46 cblume +Made Getters const + +Revision 1.1.2.2 2000/10/04 16:34:58 cblume +Replace include files by forward declarations + +Revision 1.5 2000/06/27 13:08:50 cblume +Changed to Copy(TObject &A) to appease the HP-compiler + Revision 1.4 2000/06/09 11:10:07 cblume Compiler warnings and coding conventions, next round @@ -37,6 +46,8 @@ Add new data array classes /////////////////////////////////////////////////////////////////////////////// #include "AliTRDdataArrayF.h" +#include "AliTRDarrayI.h" +#include "AliTRDarrayF.h" ClassImp(AliTRDdataArrayF) @@ -83,6 +94,7 @@ AliTRDdataArrayF::~AliTRDdataArrayF() // if (fElements) fElements->Delete(); + delete fElements; } @@ -153,7 +165,7 @@ Int_t AliTRDdataArrayF::GetSize() } //_____________________________________________________________________________ -Int_t AliTRDdataArrayF::GetDataSize() +Int_t AliTRDdataArrayF::GetDataSize() { // // Returns the size of only the data part @@ -167,7 +179,7 @@ Int_t AliTRDdataArrayF::GetDataSize() } //_____________________________________________________________________________ -Int_t AliTRDdataArrayF::GetOverThreshold(Float_t threshold) +Int_t AliTRDdataArrayF::GetOverThreshold(Float_t threshold) { // // Returns the number of entries over threshold @@ -189,7 +201,7 @@ Int_t AliTRDdataArrayF::GetOverThreshold(Float_t threshold) } //_____________________________________________________________________________ -Float_t AliTRDdataArrayF::GetData(Int_t row, Int_t col, Int_t time) +Float_t AliTRDdataArrayF::GetData(Int_t row, Int_t col, Int_t time) const { // // Returns the data value at a given position of the array @@ -279,7 +291,7 @@ void AliTRDdataArrayF::Expand() } //_____________________________________________________________________________ -Bool_t AliTRDdataArrayF::First() +Bool_t AliTRDdataArrayF::First() { // // Returns the position of the first valid data value @@ -463,7 +475,7 @@ void AliTRDdataArrayF::Compress2() } //_____________________________________________________________________________ -Bool_t AliTRDdataArrayF::First0() +Bool_t AliTRDdataArrayF::First0() { // // Returns the first entry for a buffer of type 0 @@ -510,7 +522,7 @@ Bool_t AliTRDdataArrayF::Next0() } //_____________________________________________________________________________ -Bool_t AliTRDdataArrayF::First1() +Bool_t AliTRDdataArrayF::First1() { // // Returns the first entry for a buffer of type 1 @@ -544,7 +556,7 @@ Bool_t AliTRDdataArrayF::First1() } //_____________________________________________________________________________ -Bool_t AliTRDdataArrayF::Next1() +Bool_t AliTRDdataArrayF::Next1() { // // Returns the next entry for a buffer of type 1 @@ -576,7 +588,7 @@ Bool_t AliTRDdataArrayF::Next1() } //_____________________________________________________________________________ -Float_t AliTRDdataArrayF::GetData1(Int_t idx1, Int_t idx2) +Float_t AliTRDdataArrayF::GetData1(Int_t idx1, Int_t idx2) const { // // Returns the value at a given position of the array @@ -613,7 +625,7 @@ Float_t AliTRDdataArrayF::GetData1(Int_t idx1, Int_t idx2) } //____________________________________________________________________________ -Float_t AliTRDdataArrayF::GetDataFast(Int_t idx1, Int_t idx2) +Float_t AliTRDdataArrayF::GetDataFast(Int_t idx1, Int_t idx2) const { // // Returns the value at a given position in the array @@ -676,3 +688,4 @@ AliTRDdataArrayF &AliTRDdataArrayF::operator=(const AliTRDdataArrayF &a) return *this; } + diff --git a/TRD/AliTRDdataArrayF.h b/TRD/AliTRDdataArrayF.h index 5be7dca8927..5bb79313404 100644 --- a/TRD/AliTRDdataArrayF.h +++ b/TRD/AliTRDdataArrayF.h @@ -16,6 +16,8 @@ // // ///////////////////////////////////////////////////////////// +class AliTRDarrayF; + class AliTRDdataArrayF : public AliTRDdataArray { public: @@ -38,8 +40,8 @@ class AliTRDdataArrayF : public AliTRDdataArray { 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 Float_t GetData(Int_t row, Int_t col, Int_t time) const; + virtual Float_t GetThreshold() const { return fThreshold; }; virtual Int_t GetSize(); virtual Int_t GetDataSize(); @@ -48,9 +50,9 @@ class AliTRDdataArrayF : public AliTRDdataArray { protected: inline void SetDataFast(Int_t idx1, Int_t idx2, Float_t value); - inline Float_t GetDataFast(Int_t idx1, Int_t idx2); + inline Float_t GetDataFast(Int_t idx1, Int_t idx2) const; - Float_t GetData1(Int_t idx1, Int_t idx2); + Float_t GetData1(Int_t idx1, Int_t idx2) const; void Expand1(); void Compress1(); void Expand2(); diff --git a/TRD/AliTRDdataArrayI.cxx b/TRD/AliTRDdataArrayI.cxx index e9e007f3544..35887f545a2 100644 --- a/TRD/AliTRDdataArrayI.cxx +++ b/TRD/AliTRDdataArrayI.cxx @@ -15,6 +15,15 @@ /* $Log$ +Revision 1.1.2.3 2000/10/06 16:49:46 cblume +Made Getters const + +Revision 1.1.2.2 2000/10/04 16:34:58 cblume +Replace include files by forward declarations + +Revision 1.5 2000/06/27 13:08:50 cblume +Changed to Copy(TObject &A) to appease the HP-compiler + Revision 1.4 2000/06/09 11:10:07 cblume Compiler warnings and coding conventions, next round @@ -37,6 +46,7 @@ Add new data array classes /////////////////////////////////////////////////////////////////////////////// #include "AliTRDdataArrayI.h" +#include "AliTRDarrayI.h" ClassImp(AliTRDdataArrayI) @@ -83,6 +93,7 @@ AliTRDdataArrayI::~AliTRDdataArrayI() // if (fElements) fElements->Delete(); + delete fElements; } @@ -189,7 +200,7 @@ Int_t AliTRDdataArrayI::GetOverThreshold(Int_t threshold) } //_____________________________________________________________________________ -Int_t AliTRDdataArrayI::GetData(Int_t row, Int_t col, Int_t time) +Int_t AliTRDdataArrayI::GetData(Int_t row, Int_t col, Int_t time) const { // // Returns the data value at a given position of the array @@ -484,7 +495,7 @@ Bool_t AliTRDdataArrayI::First0() } //_____________________________________________________________________________ -Bool_t AliTRDdataArrayI::Next0() +Bool_t AliTRDdataArrayI::Next0() { // // Returns the next entry for a buffer of type 0 @@ -509,7 +520,7 @@ Bool_t AliTRDdataArrayI::Next0() } //_____________________________________________________________________________ -Bool_t AliTRDdataArrayI::First1() +Bool_t AliTRDdataArrayI::First1() { // // Returns the first entry for a buffer of type 1 @@ -543,7 +554,7 @@ Bool_t AliTRDdataArrayI::First1() } //_____________________________________________________________________________ -Bool_t AliTRDdataArrayI::Next1() +Bool_t AliTRDdataArrayI::Next1() { // // Returns the next entry for a buffer of type 1 @@ -575,7 +586,7 @@ Bool_t AliTRDdataArrayI::Next1() } //_____________________________________________________________________________ -Int_t AliTRDdataArrayI::GetData1(Int_t idx1, Int_t idx2) +Int_t AliTRDdataArrayI::GetData1(Int_t idx1, Int_t idx2) const { // // Returns the value at a given position of the array @@ -612,7 +623,7 @@ Int_t AliTRDdataArrayI::GetData1(Int_t idx1, Int_t idx2) } //_____________________________________________________________________________ -Int_t AliTRDdataArrayI::GetDataFast(Int_t idx1, Int_t idx2) +Int_t AliTRDdataArrayI::GetDataFast(Int_t idx1, Int_t idx2) const { // // Returns the value at a given position in the array diff --git a/TRD/AliTRDdataArrayI.h b/TRD/AliTRDdataArrayI.h index 157efd373ea..7f1008ba379 100644 --- a/TRD/AliTRDdataArrayI.h +++ b/TRD/AliTRDdataArrayI.h @@ -38,8 +38,8 @@ class AliTRDdataArrayI : public AliTRDdataArray { 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 GetData(Int_t row, Int_t col, Int_t time) const; + virtual Int_t GetThreshold() const { return fThreshold; }; virtual Int_t GetSize(); virtual Int_t GetDataSize(); @@ -48,9 +48,9 @@ class AliTRDdataArrayI : public AliTRDdataArray { protected: inline void SetDataFast(Int_t idx1, Int_t idx2, Int_t value); - inline Int_t GetDataFast(Int_t idx1, Int_t idx2); + inline Int_t GetDataFast(Int_t idx1, Int_t idx2) const; - Int_t GetData1(Int_t idx1, Int_t idx2); + Int_t GetData1(Int_t idx1, Int_t idx2) const; void Expand1(); void Compress1(); void Expand2(); @@ -69,3 +69,4 @@ class AliTRDdataArrayI : public AliTRDdataArray { #endif + diff --git a/TRD/AliTRDdigit.cxx b/TRD/AliTRDdigit.cxx index fb79d86f8cf..502d47378c0 100644 --- a/TRD/AliTRDdigit.cxx +++ b/TRD/AliTRDdigit.cxx @@ -1,3 +1,5 @@ + + /************************************************************************** * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * * * @@ -15,6 +17,18 @@ /* $Log$ +Revision 1.1.2.4 2000/10/17 02:27:34 cblume +Get rid of global constants + +Revision 1.1.2.3 2000/10/06 16:49:46 cblume +Made Getters const + +Revision 1.1.2.2 2000/09/22 14:42:05 cblume +Changed data members to UShort_t + +Revision 1.4 2000/06/08 18:32:58 cblume +Make code compliant to coding conventions + Revision 1.3 2000/06/07 16:25:37 cblume Try to remove compiler warnings on Sun and HP @@ -36,6 +50,11 @@ Introduce raw digit bit flag and DecodeAmp() ClassImp(AliTRDdigit) +//_____________________________________________________________________________ + + // Marks a raw digit + const UInt_t AliTRDdigit::fgkRawDigit = 0x00000001; + //_____________________________________________________________________________ AliTRDdigit::AliTRDdigit():AliDigitNew() { @@ -43,9 +62,9 @@ AliTRDdigit::AliTRDdigit():AliDigitNew() // Default constructor // - fRow = 0; - fCol = 0; - fTime = 0; + fRow = 0; + fCol = 0; + fTime = 0; } @@ -67,7 +86,7 @@ AliTRDdigit::AliTRDdigit(Bool_t isRaw, Int_t *digits, Int_t *amp):AliDigitNew() // Store the signal amplitude fAmp = amp[0]; - if (isRaw) SetBit(kRawDigit); + if (isRaw) SetBit(fgkRawDigit); } @@ -79,3 +98,38 @@ AliTRDdigit::~AliTRDdigit() // } + +//_____________________________________________________________________________ +Int_t AliTRDdigit::DecodeAmp() const +{ + // + // Decodes the digit amplitude + // + + return 0; + +} + +//______________________________________________________________________________ +void AliTRDdigit::Streamer(TBuffer &R__b) +{ + // + // Stream an object of class AliTRDdigit. + // + + if (R__b.IsReading()) { + Version_t R__v = R__b.ReadVersion(); if (R__v) { } + AliDigitNew::Streamer(R__b); + R__b >> fRow; + R__b >> fCol; + R__b >> fTime; + } + else { + R__b.WriteVersion(AliTRDdigit::IsA()); + AliDigitNew::Streamer(R__b); + R__b << fRow; + R__b << fCol; + R__b << fTime; + } + +} diff --git a/TRD/AliTRDdigit.h b/TRD/AliTRDdigit.h index de3fc903dca..8d48938cdd7 100644 --- a/TRD/AliTRDdigit.h +++ b/TRD/AliTRDdigit.h @@ -7,8 +7,6 @@ #include "AliDigitNew.h" -const UInt_t kRawDigit = 0x00000001; - //_____________________________________________________________________________ class AliTRDdigit : public AliDigitNew { @@ -18,24 +16,28 @@ class AliTRDdigit : public AliDigitNew { AliTRDdigit(Bool_t isRaw, Int_t *digits, Int_t *amp); virtual ~AliTRDdigit(); - Int_t GetAmp() const { 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; }; + static UInt_t RawDigit() { return fgkRawDigit; }; + + Int_t GetAmp() const { if (TestBit(fgkRawDigit)) + return DecodeAmp(); + else + return fAmp; }; + Int_t GetDetector() const { return fId; }; + Int_t GetRow() const { return fRow; }; + Int_t GetCol() const { return fCol; }; + Int_t GetTime() const { return fTime; }; - Int_t DecodeAmp() const { return 0; }; + virtual Int_t DecodeAmp() const; protected: - Int_t fRow; // Pad row number - Int_t fCol; // Pad col number - Int_t fTime; // Time bucket + static const UInt_t fgkRawDigit; // Marks a raw digit + + UShort_t fRow; // Pad row number + UShort_t fCol; // Pad col number + UShort_t fTime; // Time bucket - ClassDef(AliTRDdigit,1) // Digit for the TRD + ClassDef(AliTRDdigit,2) // Digit for the TRD }; diff --git a/TRD/AliTRDdigitizer.cxx b/TRD/AliTRDdigitizer.cxx index 5629b8be0e1..e88093e7ddd 100644 --- a/TRD/AliTRDdigitizer.cxx +++ b/TRD/AliTRDdigitizer.cxx @@ -15,6 +15,30 @@ /* $Log$ +Revision 1.1.4.9 2000/10/26 17:00:22 cblume +Fixed bug in CheckDetector() + +Revision 1.1.4.8 2000/10/23 13:41:35 cblume +Added protection against Log(0) in the gas gain calulation + +Revision 1.1.4.7 2000/10/17 02:27:34 cblume +Get rid of global constants + +Revision 1.1.4.6 2000/10/16 01:16:53 cblume +Changed timebin 0 to be the one closest to the readout + +Revision 1.1.4.5 2000/10/15 23:34:29 cblume +Faster version of the digitizer + +Revision 1.1.4.4 2000/10/06 16:49:46 cblume +Made Getters const + +Revision 1.1.4.3 2000/10/04 16:34:58 cblume +Replace include files by forward declarations + +Revision 1.1.4.2 2000/09/22 14:41:10 cblume +Bug fix in PRF. Included time response. New structure + Revision 1.10 2000/10/05 07:27:53 cblume Changes in the header-files by FCA @@ -75,12 +99,19 @@ Add new TRD classes #include #include #include +#include +#include + +#include "AliRun.h" #include "AliTRD.h" +#include "AliTRDhit.h" #include "AliTRDdigitizer.h" #include "AliTRDdataArrayI.h" #include "AliTRDdataArrayF.h" +#include "AliTRDsegmentArray.h" #include "AliTRDdigitsManager.h" +#include "AliTRDgeometry.h" ClassImp(AliTRDdigitizer) @@ -96,6 +127,8 @@ AliTRDdigitizer::AliTRDdigitizer():TNamed() fTRD = NULL; fGeo = NULL; fPRF = NULL; + fTRF = NULL; + fTRFint = NULL; fEvent = 0; fGasGain = 0.0; @@ -110,7 +143,17 @@ AliTRDdigitizer::AliTRDdigitizer():TNamed() fElAttachOn = 0; fElAttachProp = 0.0; fExBOn = 0; - fLorentzAngle = 0.0; + fOmegaTau = 0.0; + fPRFOn = 0; + fTRFOn = 0; + fDriftVelocity = 0.0; + + fTRFbin = 0; + fTRFlo = 0.0; + fTRFhi = 0.0; + fTRFwid = 0.0; + fCompress = kFALSE; + fVerbose = 1; } @@ -129,6 +172,9 @@ AliTRDdigitizer::AliTRDdigitizer(const Text_t *name, const Text_t *title) fEvent = 0; + fCompress = kTRUE; + fVerbose = 1; + Init(); } @@ -161,6 +207,7 @@ AliTRDdigitizer::~AliTRDdigitizer() } if (fPRF) delete fPRF; + if (fTRF) delete fTRF; } @@ -202,10 +249,26 @@ void AliTRDdigitizer::Copy(TObject &d) ((AliTRDdigitizer &) d).fElAttachOn = fElAttachOn; ((AliTRDdigitizer &) d).fElAttachProp = fElAttachProp; ((AliTRDdigitizer &) d).fExBOn = fExBOn; - ((AliTRDdigitizer &) d).fLorentzAngle = fLorentzAngle; + ((AliTRDdigitizer &) d).fOmegaTau = fOmegaTau; ((AliTRDdigitizer &) d).fLorentzFactor = fLorentzFactor; + ((AliTRDdigitizer &) d).fPRFOn = fPRFOn; + ((AliTRDdigitizer &) d).fTRFOn = fTRFOn; + + ((AliTRDdigitizer &) d).fCompress = fCompress; + ((AliTRDdigitizer &) d).fVerbose = fVerbose; fPRF->Copy(*((AliTRDdigitizer &) d).fPRF); + fTRF->Copy(*((AliTRDdigitizer &) d).fTRF); + + ((AliTRDdigitizer &) d).fTRFbin = fTRFbin; + ((AliTRDdigitizer &) d).fTRFlo = fTRFlo; + ((AliTRDdigitizer &) d).fTRFhi = fTRFhi; + ((AliTRDdigitizer &) d).fTRFwid = fTRFwid; + if (((AliTRDdigitizer &) d).fTRFint) delete ((AliTRDdigitizer &) d).fTRFint; + ((AliTRDdigitizer &) d).fTRFint = new Float_t[fTRFbin]; + for (Int_t iBin = 0; iBin < fTRFbin; iBin++) { + ((AliTRDdigitizer &) d).fTRFint[iBin] = fTRFint[iBin]; + } } @@ -222,6 +285,7 @@ Int_t AliTRDdigitizer::Diffusion(Float_t driftlength, Float_t *xyz) xyz[0] = gRandom->Gaus(xyz[0], sigmaL * fLorentzFactor); xyz[1] = gRandom->Gaus(xyz[1], sigmaT * fLorentzFactor); xyz[2] = gRandom->Gaus(xyz[2], sigmaT); + return 1; } @@ -234,13 +298,49 @@ Int_t AliTRDdigitizer::ExB(Float_t driftlength, Float_t *xyz) // xyz[0] = xyz[0]; - xyz[1] = xyz[1] + fLorentzAngle * driftlength; + xyz[1] = xyz[1] + fOmegaTau * driftlength; xyz[2] = xyz[2]; return 1; } +//_____________________________________________________________________________ +Int_t AliTRDdigitizer::PadResponse(Float_t signal, Float_t dist, Float_t *pad) +{ + // + // Applies the pad response + // + + if (fPRF) { + pad[0] = TMath::Max(fPRF->Eval(-1.0 - dist,0,0) * signal,0.0); + pad[1] = TMath::Max(fPRF->Eval( - dist,0,0) * signal,0.0); + pad[2] = TMath::Max(fPRF->Eval( 1.0 - dist,0,0) * signal,0.0); + return 1; + } + else { + return 0; + } + +} + +//_____________________________________________________________________________ +Float_t AliTRDdigitizer::TimeResponse(Float_t time) +{ + // + // Applies the preamp shaper time response + // + + Int_t iBin = ((Int_t) ((time - fTRFlo) / fTRFwid)); + if ((iBin >= 0) && (iBin < fTRFbin)) { + return fTRFint[iBin]; + } + else { + return 0.0; + } + +} + //_____________________________________________________________________________ void AliTRDdigitizer::Init() { @@ -249,7 +349,7 @@ void AliTRDdigitizer::Init() // // The default parameter for the digitization - fGasGain = 2.0E3; + fGasGain = 8.0E3; fNoise = 3000.; fChipGain = 10.; fADCoutRange = 255.; @@ -268,14 +368,51 @@ void AliTRDdigitizer::Init() // E x B effects fExBOn = 0; // omega * tau. (tau ~ 12 * 10^-12, B = 0.2T) - fLorentzAngle = 17.6 * 12.0 * 0.2 * 0.01; + fOmegaTau = 17.6 * 12.0 * 0.2 * 0.01; // The pad response function - fPRF = new TF1("PRF","[0]*([1]+exp(-x*x/(2.0*[2])))",-2,2); + fPRFOn = 1; + fPRF = new TF1("PRF","[0]*([1]+exp(-x*x/(2.0*[2])))",-3,3); fPRF->SetParameter(0, 0.8872); fPRF->SetParameter(1,-0.00573); fPRF->SetParameter(2, 0.454 * 0.454); + // The drift velocity (cm / mus) + fDriftVelocity = 1.0; + + // The time response function + fTRFOn = 1; + Float_t loTRF = -200.0; + Float_t hiTRF = 1000.0; + fTRF = new TF1("TRF",TRFlandau,loTRF,hiTRF,3); + fTRF->SetParameter(0, 1.0 / 24.24249); + fTRF->SetParameter(1, 0.0); + fTRF->SetParameter(2, 25.0); + fTRFbin = 1200; + fTRFlo = loTRF * fDriftVelocity / 1000.0; + fTRFhi = hiTRF * fDriftVelocity / 1000.0; + fTRFwid = (fTRFhi - fTRFlo) / ((Float_t) fTRFbin); + +} + +//_____________________________________________________________________________ +void AliTRDdigitizer::IntegrateTRF() +{ + // + // Integrates the time response function over the time bin size + // + + if (fTRFint) delete fTRFint; + fTRFint = new Float_t[fTRFbin]; + Float_t hiTRF = fTRFhi / fDriftVelocity * 1000.0; + Float_t loTRF = fTRFlo / fDriftVelocity * 1000.0; + Float_t timeBin = fGeo->GetTimeBinSize() / fDriftVelocity * 1000.0; + Float_t binWidth = (hiTRF - loTRF) / ((Float_t) fTRFbin); + for (Int_t iBin = 0; iBin < fTRFbin; iBin++) { + Float_t bin = iBin * binWidth + loTRF - 0.5 * timeBin; + fTRFint[iBin] = fTRF->Integral(bin,bin + timeBin); + } + } //_____________________________________________________________________________ @@ -318,6 +455,17 @@ Bool_t AliTRDdigitizer::Open(const Char_t *name, Int_t nEvent) return kFALSE; } + return InitDetector(); + +} + +//_____________________________________________________________________________ +Bool_t AliTRDdigitizer::InitDetector() +{ + // + // Sets the pointer to the TRD detector and the geometry + // + // Get the pointer to the detector class and check for version 1 fTRD = (AliTRD*) gAlice->GetDetector("TRD"); if (fTRD->IsVersion() != 1) { @@ -351,359 +499,422 @@ Bool_t AliTRDdigitizer::MakeDigits() /////////////////////////////////////////////////////////////// + // Number of pads included in the pad response + const Int_t kNpad = 3; + + // Number of track dictionary arrays + const Int_t kNDict = AliTRDdigitsManager::NDict(); + Int_t iRow, iCol, iTime; - Int_t nBytes = 0; Int_t iDict; + Int_t nBytes = 0; Int_t totalSizeDigits = 0; Int_t totalSizeDict0 = 0; Int_t totalSizeDict1 = 0; Int_t totalSizeDict2 = 0; - AliTRDdataArrayI *digits; + AliTRDdataArrayF *signals = 0; + AliTRDdataArrayI *digits = 0; AliTRDdataArrayI *dictionary[kNDict]; + // Create a digits manager + fDigits = new AliTRDdigitsManager(); + + // Create a container for the amplitudes + AliTRDsegmentArray *signalsArray + = new AliTRDsegmentArray("AliTRDdataArrayF",AliTRDgeometry::Ndet()); + if (!fGeo) { printf("AliTRDdigitizer::MakeDigits -- "); printf("No geometry defined\n"); return kFALSE; } - // Create a digits manager - fDigits = new AliTRDdigitsManager(); - - // Create detector arrays to keep the signal and track numbers - AliTRDdataArrayF *signal = new AliTRDdataArrayF(); - AliTRDdataArrayI *tracks[kNDict]; - for (iDict = 0; iDict < kNDict; iDict++) { - tracks[iDict] = new AliTRDdataArrayI(); - } - - // Get the pointer to the hit tree - TTree *hitTree = gAlice->TreeH(); - - // Get the number of entries in the hit tree - // (Number of primary particles creating a hit somewhere) - Int_t nTrack = (Int_t) hitTree->GetEntries(); - printf("AliTRDdigitizer::MakeDigits -- "); printf("Start creating digits.\n"); + if (fVerbose > 0) this->Dump(); // The Lorentz factor if (fExBOn) { - fLorentzFactor = 1.0 / (1.0 + fLorentzAngle*fLorentzAngle); + fLorentzFactor = 1.0 / (1.0 + fOmegaTau*fOmegaTau); } else { fLorentzFactor = 1.0; } - Int_t chamBeg = 0; - Int_t chamEnd = kNcham; - if (fTRD->GetSensChamber() >= 0) { - chamBeg = fTRD->GetSensChamber(); - chamEnd = chamBeg + 1; - } - Int_t planBeg = 0; - Int_t planEnd = kNplan; - if (fTRD->GetSensPlane() >= 0) { - planBeg = fTRD->GetSensPlane(); - planEnd = planBeg + 1; - } - Int_t sectBeg = 0; - Int_t sectEnd = kNsect; - - Int_t countHits = 0; - - // Loop through all the chambers - for (Int_t iCham = chamBeg; iCham < chamEnd; iCham++) { - for (Int_t iPlan = planBeg; iPlan < planEnd; iPlan++) { - for (Int_t iSect = sectBeg; iSect < sectEnd; iSect++) { - - if (fTRD->GetSensSector() >= 0) { - Int_t sens1 = fTRD->GetSensSector(); - Int_t sens2 = sens1 + fTRD->GetSensSectorRange(); - sens2 -= ((Int_t) (sens2 / kNsect)) * kNsect; - if (sens1 < sens2) { - if ((iSect < sens1) || (iSect >= sens2)) continue; + // Create the integrated TRF + IntegrateTRF(); + + // Get the pointer to the hit tree + TTree *HitTree = gAlice->TreeH(); + + // Get the number of entries in the hit tree + // (Number of primary particles creating a hit somewhere) + Int_t nTrack = (Int_t) HitTree->GetEntries(); + if (fVerbose > 0) { + printf("AliTRDdigitizer::MakeDigits -- "); + printf("Found %d primary particles\n",nTrack); + } + + Int_t detectorOld = -1; + Int_t countHits = 0; + + // Loop through all entries in the tree + for (Int_t iTrack = 0; iTrack < nTrack; iTrack++) { + + gAlice->ResetHits(); + nBytes += HitTree->GetEvent(iTrack); + + // Get the number of hits in the TRD created by this particle + Int_t nHit = fTRD->Hits()->GetEntriesFast(); + if (fVerbose > 0) { + printf("AliTRDdigitizer::MakeDigits -- "); + printf("Found %d hits for primary particle %d\n",nHit,iTrack); + } + + // Loop through the TRD hits + for (Int_t iHit = 0; iHit < nHit; iHit++) { + + countHits++; + + AliTRDhit *hit = (AliTRDhit *) fTRD->Hits()->UncheckedAt(iHit); + Float_t pos[3]; + pos[0] = hit->X(); + pos[1] = hit->Y(); + pos[2] = hit->Z(); + Float_t q = hit->GetCharge(); + Int_t track = hit->Track(); + Int_t detector = hit->GetDetector(); + Int_t plane = fGeo->GetPlane(detector); + Int_t sector = fGeo->GetSector(detector); + Int_t chamber = fGeo->GetChamber(detector); + + if (!(CheckDetector(plane,chamber,sector))) continue; + + Int_t nRowMax = fGeo->GetRowMax(plane,chamber,sector); + Int_t nColMax = fGeo->GetColMax(plane); + Int_t nTimeMax = fGeo->GetTimeMax(); + Float_t row0 = fGeo->GetRow0(plane,chamber,sector); + Float_t col0 = fGeo->GetCol0(plane); + Float_t time0 = fGeo->GetTime0(plane); + Float_t rowPadSize = fGeo->GetRowPadSize(); + Float_t colPadSize = fGeo->GetColPadSize(); + Float_t timeBinSize = fGeo->GetTimeBinSize(); + + if (fVerbose > 1) { + printf("Analyze hit no. %d ",iHit); + printf("-----------------------------------------------------------\n"); + hit->Dump(); + printf("plane = %d, sector = %d, chamber = %d\n" + ,plane,sector,chamber); + printf("nRowMax = %d, nColMax = %d, nTimeMax = %d\n" + ,nRowMax,nColMax,nTimeMax); + printf("row0 = %f, col0 = %f, time0 = %f\n" + ,row0,col0,time0); + } + + // Get different container if the detector has changed + if (detector != detectorOld) { + if (fVerbose > 1) { + printf("AliTRDdigitizer::MakeDigits -- "); + printf("Get new container. New det = %d, Old det = %d\n" + ,detector,detectorOld); + } + // Compress the old one if enabled + if ((fCompress) && (detectorOld > -1)) { + if (fVerbose > 1) { + printf("AliTRDdigitizer::MakeDigits -- "); + printf("Compress the old container ... "); } - else { - if ((iSect < sens1) && (iSect >= sens2)) continue; + signals->Compress(1,0); + for (iDict = 0; iDict < kNDict; iDict++) { + dictionary[iDict]->Compress(1,0); } + if (fVerbose > 1) printf("done\n"); } + // Get the new container + signals = (AliTRDdataArrayF *) signalsArray->At(detector); + if (signals->GetNtime() == 0) { + // Allocate a new one if not yet existing + if (fVerbose > 1) { + printf("AliTRDdigitizer::MakeDigits -- "); + printf("Allocate a new container ... "); + } + signals->Allocate(nRowMax,nColMax,nTimeMax); + } + else { + // Expand an existing one + if (fVerbose > 1) { + printf("AliTRDdigitizer::MakeDigits -- "); + printf("Expand an existing container ... "); + } + if (fCompress) signals->Expand(); + } + // The same for the dictionary + for (iDict = 0; iDict < kNDict; iDict++) { + dictionary[iDict] = fDigits->GetDictionary(detector,iDict); + if (dictionary[iDict]->GetNtime() == 0) { + dictionary[iDict]->Allocate(nRowMax,nColMax,nTimeMax); + } + else { + if (fCompress) dictionary[iDict]->Expand(); + } + } + if (fVerbose > 1) printf("done\n"); + detectorOld = detector; + } - Int_t nDigits = 0; - - printf("AliTRDdigitizer::MakeDigits -- "); - printf("Digitizing chamber %d, plane %d, sector %d.\n" - ,iCham,iPlan,iSect); - - Int_t iDet = fGeo->GetDetector(iPlan,iCham,iSect); - Int_t nRowMax = fGeo->GetRowMax(iPlan,iCham,iSect); - Int_t nColMax = fGeo->GetColMax(iPlan); - Int_t nTimeMax = fGeo->GetTimeMax(); - Float_t row0 = fGeo->GetRow0(iPlan,iCham,iSect); - Float_t col0 = fGeo->GetCol0(iPlan); - Float_t time0 = fGeo->GetTime0(iPlan); - Float_t rowPadSize = fGeo->GetRowPadSize(); - Float_t colPadSize = fGeo->GetColPadSize(); - Float_t timeBinSize = fGeo->GetTimeBinSize(); - - // Adjust the size of the detector arrays - signal->Allocate(nRowMax,nColMax,nTimeMax); - for (iDict = 0; iDict < kNDict; iDict++) { - tracks[iDict]->Allocate(nRowMax,nColMax,nTimeMax); + // Rotate the sectors on top of each other + Float_t rot[3]; + fGeo->Rotate(detector,pos,rot); + + // The driftlength + Float_t driftlength = time0 - rot[0]; + if ((driftlength < 0) || + (driftlength > AliTRDgeometry::DrThick())) break; + Float_t driftlengthL = driftlength; + if (fExBOn) driftlengthL /= TMath::Sqrt(fLorentzFactor); + + // The hit position in pad coordinates (center pad) + // The pad row (z-direction) + Int_t rowH = (Int_t) ((rot[2] - row0) / rowPadSize); + // The pad column (rphi-direction) + Int_t colH = (Int_t) ((rot[1] - col0) / colPadSize); + // The time bucket + Int_t timeH = (Int_t) (driftlength / timeBinSize); + if (fVerbose > 1) { + printf("rowH = %d, colH = %d, timeH = %d\n" + ,rowH,colH,timeH); + } + + // Loop over all electrons of this hit + // TR photons produce hits with negative charge + Int_t nEl = ((Int_t) TMath::Abs(q)); + for (Int_t iEl = 0; iEl < nEl; iEl++) { + + Float_t xyz[3]; + xyz[0] = rot[0]; + xyz[1] = rot[1]; + xyz[2] = rot[2]; + + // Electron attachment + if (fElAttachOn) { + if (gRandom->Rndm() < (driftlengthL * fElAttachProp / 100.)) + continue; + } + + // Apply the diffusion smearing + if (fDiffusionOn) { + if (!(Diffusion(driftlengthL,xyz))) continue; } - // Loop through all entries in the tree - for (Int_t iTrack = 0; iTrack < nTrack; iTrack++) { - - gAlice->ResetHits(); - nBytes += hitTree->GetEvent(iTrack); - - // Get the number of hits in the TRD created by this particle - Int_t nHit = fTRD->Hits()->GetEntriesFast(); - - // Loop through the TRD hits - for (Int_t iHit = 0; iHit < nHit; iHit++) { - - countHits++; - - AliTRDhit *hit = (AliTRDhit *) fTRD->Hits()->UncheckedAt(iHit); - Float_t pos[3]; - pos[0] = hit->X(); - pos[1] = hit->Y(); - pos[2] = hit->Z(); - Float_t q = hit->GetCharge(); - Int_t track = hit->Track(); - Int_t detector = hit->GetDetector(); - Int_t plane = fGeo->GetPlane(detector); - Int_t sector = fGeo->GetSector(detector); - Int_t chamber = fGeo->GetChamber(detector); - - if ((sector != iSect) || - (plane != iPlan) || - (chamber != iCham)) - continue; - - // Rotate the sectors on top of each other - Float_t rot[3]; - fGeo->Rotate(detector,pos,rot); - - // The hit position in pad coordinates (center pad) - // The pad row (z-direction) - Int_t rowH = (Int_t) ((rot[2] - row0) / rowPadSize); - // The pad column (rphi-direction) - Int_t colH = (Int_t) ((rot[1] - col0) / colPadSize); - // The time bucket - Int_t timeH = (Int_t) ((rot[0] - time0) / timeBinSize); - - // Array to sum up the signal in a box surrounding the - // hit postition - const Int_t kTimeBox = 7; - const Int_t kColBox = 9; - const Int_t kRowBox = 7; - Float_t signalSum[kRowBox][kColBox][kTimeBox]; - for (iRow = 0; iRow < kRowBox; iRow++ ) { - for (iCol = 0; iCol < kColBox; iCol++ ) { - for (iTime = 0; iTime < kTimeBox; iTime++) { - signalSum[iRow][iCol][iTime] = 0; - } - } - } - - // Loop over all electrons of this hit - Int_t nEl = (Int_t) q; - for (Int_t iEl = 0; iEl < nEl; iEl++) { - - // The driftlength - Float_t driftlength = rot[0] - time0; - if ((driftlength < 0) || - (driftlength > kDrThick)) break; - Float_t driftlengthL = driftlength; - if (fExBOn) driftlengthL /= TMath::Sqrt(fLorentzFactor); - Float_t xyz[3]; - xyz[0] = rot[0]; - xyz[1] = rot[1]; - xyz[2] = rot[2]; - - // Electron attachment - if (fElAttachOn) { - if (gRandom->Rndm() < (driftlengthL * fElAttachProp / 100.)) continue; - } + // Apply E x B effects + if (fExBOn) { + if (!(ExB(driftlength,xyz))) continue; + } - // Apply the diffusion smearing - if (fDiffusionOn) { - if (!(Diffusion(driftlengthL,xyz))) continue; - } + // The electron position + // The pad row (z-direction) + Int_t rowE = (Int_t) ((xyz[2] - row0) / rowPadSize); + // The pad column (rphi-direction) + Int_t colE = (Int_t) ((xyz[1] - col0) / colPadSize); + // The time bucket + Int_t timeE = (Int_t) ((time0 - xyz[0]) / timeBinSize); + + if (( rowE < 0) || ( rowE >= nRowMax)) continue; + if (( colE < 0) || ( colE >= nColMax)) continue; + if ((timeE < 0) || (timeE >= nTimeMax)) continue; + + // Apply the gas gain including fluctuations + Float_t ggRndm = 0.0; + do { + ggRndm = gRandom->Rndm(); + } while (ggRndm <= 0); + Int_t signal = (Int_t) (-fGasGain * TMath::Log(ggRndm)); + + if (fVerbose > 2) { + printf(" electron no. %d, signal = %d\n",iEl,signal); + printf(" rowE = %d, colE = %d, timeE = %d\n" + ,rowE,colE,timeE); + } - // Apply E x B effects - if (fExBOn) { - if (!(ExB(driftlength,xyz))) continue; - } + // Apply the pad response + Float_t padSignal[kNpad]; + if (fPRFOn) { + // The distance of the electron to the center of the pad + // in units of pad width + Float_t dist = (xyz[1] - col0 - (colE + 0.5) * colPadSize) + / colPadSize; + if (!(PadResponse(signal,dist,padSignal))) continue; + } + else { + padSignal[0] = 0.0; + padSignal[1] = signal; + padSignal[2] = 0.0; + } - // The electron position and the distance to the hit position - // in pad units - // The pad row (z-direction) - Int_t rowE = (Int_t) ((xyz[2] - row0) / rowPadSize); - Int_t rowD = rowH - rowE; - // The pad column (rphi-direction) - Int_t colE = (Int_t) ((xyz[1] - col0) / colPadSize); - Int_t colD = colH - colE; - // The time bucket - Int_t timeE = (Int_t) ((xyz[0] - time0) / timeBinSize); - Int_t timeD = timeH - timeE; - - // Apply the gas gain including fluctuations - Float_t ggRndm = 0.0; - do { - ggRndm = gRandom->Rndm(); - } while (ggRndm <= 0); - Int_t signal = (Int_t) (-fGasGain * TMath::Log(ggRndm)); - - // The distance of the electron to the center of the pad - // in units of pad width - Float_t dist = (xyz[1] - col0 - (colE + 0.5) * colPadSize) - / colPadSize; - - // Sum up the signal in the different pixels - // and apply the pad response - Int_t rowIdx = rowD + (Int_t) ( kRowBox / 2); - Int_t colIdx = colD + (Int_t) ( kColBox / 2); - Int_t timeIdx = timeD + (Int_t) (kTimeBox / 2); - - if (( rowIdx < 0) || ( rowIdx > kRowBox)) { - printf("AliTRDdigitizer::MakeDigits -- "); - printf("Boundary error. rowIdx = %d (%d)\n", rowIdx, kRowBox); - continue; - } - if (( colIdx < 0) || ( colIdx > kColBox)) { - printf("AliTRDdigitizer::MakeDigits -- "); - printf("Boundary error. colIdx = %d (%d)\n", colIdx, kColBox); - continue; - } - if ((timeIdx < 0) || (timeIdx > kTimeBox)) { - printf("AliTRDdigitizer::MakeDigits -- "); - printf("Boundary error. timeIdx = %d (%d)\n",timeIdx,kTimeBox); - continue; - } - signalSum[rowIdx][colIdx-1][timeIdx] += fPRF->Eval(dist-1.0,0,0) * signal; - signalSum[rowIdx][colIdx ][timeIdx] += fPRF->Eval(dist ,0,0) * signal; - signalSum[rowIdx][colIdx+1][timeIdx] += fPRF->Eval(dist+1.0,0,0) * signal; + // The distance of the position to the beginning of the timebin + Float_t timeOffset = (time0 - timeE * timeBinSize) - xyz[0]; + Int_t timeTRDbeg = 0; + Int_t timeTRDend = 1; + if (fTRFOn) { + timeTRDbeg = 2; + timeTRDend = 11; + } + for (Int_t iTimeBin = TMath::Max(timeE - timeTRDbeg, 0) + ; iTimeBin < TMath::Min(timeE + timeTRDend,nTimeMax) + ; iTimeBin++) { + + // Apply the time response + Float_t timeResponse = 1.0; + if (fTRFOn) { + Float_t time = (iTimeBin - timeE) * timeBinSize + timeOffset; + timeResponse = TimeResponse(time); + } - } + // Add the signals + Float_t signalOld[kNpad] = { 0.0, 0.0, 0.0 }; + for (Int_t iPad = 0; iPad < kNpad; iPad++) { + Int_t colPos = colE + iPad - 1; + if (colPos < 0) continue; + if (colPos >= nColMax) break; + signalOld[iPad] = signals->GetData(rowE,colPos,iTimeBin); + signalOld[iPad] += padSignal[iPad] * timeResponse; + signals->SetData(rowE,colPos,iTimeBin,signalOld[iPad]); + } + if (fVerbose > 3) { + printf(" iTimeBin = %d, timeResponse = %f\n" + ,iTimeBin,timeResponse); + printf(" pad-signal = %f, %f, %f\n" + ,signalOld[0],signalOld[1],signalOld[2]); + } - // Add the padcluster to the detector matrix - for (iRow = 0; iRow < kRowBox; iRow++ ) { - for (iCol = 0; iCol < kColBox; iCol++ ) { - for (iTime = 0; iTime < kTimeBox; iTime++) { - - Int_t rowB = rowH + iRow - (Int_t) ( kRowBox / 2); - Int_t colB = colH + iCol - (Int_t) ( kColBox / 2); - Int_t timeB = timeH + iTime - (Int_t) (kTimeBox / 2); - Float_t signalB = signalSum[iRow][iCol][iTime]; - if (( rowB < 0) || ( rowB >= nRowMax)) continue; - if (( colB < 0) || ( colB >= nColMax)) continue; - if ((timeB < 0) || (timeB >= nTimeMax)) continue; - if (signalB > 0.0) { - - // Add the signal sum - signalB += signal->GetData(rowB,colB,timeB); - signal->SetData(rowB,colB,timeB,signalB); - // Store the track index in the dictionary - // Note: We store index+1 in order to allow the array to be compressed - for (iDict = 0; iDict < kNDict; iDict++) { - Int_t oldTrack = tracks[iDict]->GetData(rowB,colB,timeB); - if (oldTrack == track+1) break; - if (oldTrack == -1) break; - if (oldTrack == 0) { - tracks[iDict]->SetData(rowB,colB,timeB,track+1); - break; - } - } - if (iDict == kNDict) { - printf("AliTRDdigitizer::MakeDigits -- "); - printf("More than three tracks for one digit!\n"); - } - } - - } + // Store the track index in the dictionary + // Note: We store index+1 in order to allow the array to be compressed + for (iDict = 0; iDict < kNDict; iDict++) { + Int_t oldTrack = dictionary[iDict]->GetData(rowE,colE,timeE); + if (oldTrack == track+1) break; + //if (oldTrack == -1) break; + if (oldTrack == 0) { + dictionary[iDict]->SetData(rowE,colE,timeE,track+1); + if (fVerbose > 3) { + printf(" track index = %d\n",track); } - } - + break; + } + } + if ((fVerbose > 1) && (iDict == kNDict)) { + printf("AliTRDdigitizer::MakeDigits -- "); + printf("More than three tracks for one digit!\n"); } - } - - // Add a container for the digits of this detector - digits = fDigits->GetDigits(iDet); - // Allocate memory space for the digits buffer - digits->Allocate(nRowMax,nColMax,nTimeMax); - - // Do the same for the dictionary arrays - for (iDict = 0; iDict < kNDict; iDict++) { - dictionary[iDict] = fDigits->GetDictionary(iDet,iDict); - dictionary[iDict]->Allocate(nRowMax,nColMax,nTimeMax); } - // Create the digits for this chamber - for (iRow = 0; iRow < nRowMax; iRow++ ) { - for (iCol = 0; iCol < nColMax; iCol++ ) { - for (iTime = 0; iTime < nTimeMax; iTime++) { - - Float_t signalAmp = signal->GetData(iRow,iCol,iTime); + } - // Add the noise - signalAmp = TMath::Max((Float_t) gRandom->Gaus(signalAmp,fNoise) - ,(Float_t) 0.0); - // Convert to fC - signalAmp *= kEl2fC; - // Convert to mV - signalAmp *= fChipGain; - // Convert to ADC counts - Int_t adc = (Int_t) (signalAmp * (fADCoutRange / fADCinRange)); + } - if (adc > fADCthreshold) { + } // All hits finished - nDigits++; + printf("AliTRDdigitizer::MakeDigits -- "); + printf("Finished analyzing %d hits\n",countHits); + + // Loop through all chambers to finalize the digits + for (Int_t iDet = 0; iDet < AliTRDgeometry::Ndet(); iDet++) { + + Int_t plane = fGeo->GetPlane(iDet); + Int_t sector = fGeo->GetSector(iDet); + Int_t chamber = fGeo->GetChamber(iDet); + Int_t nRowMax = fGeo->GetRowMax(plane,chamber,sector); + Int_t nColMax = fGeo->GetColMax(plane); + Int_t nTimeMax = fGeo->GetTimeMax(); + + if (!(CheckDetector(plane,chamber,sector))) continue; + if (fVerbose > 0) { + printf("AliTRDdigitizer::MakeDigits -- "); + printf("Digitization for chamber %d\n",iDet); + } - // Store the amplitude of the digit - digits->SetData(iRow,iCol,iTime,adc); + // Add a container for the digits of this detector + digits = fDigits->GetDigits(iDet); + // Allocate memory space for the digits buffer + digits->Allocate(nRowMax,nColMax,nTimeMax); - // Store the track index in the dictionary - // Note: We store index+1 in order to allow the array to be compressed - for (iDict = 0; iDict < kNDict; iDict++) { - dictionary[iDict]->SetData(iRow,iCol,iTime - ,tracks[iDict]->GetData(iRow,iCol,iTime)); - } + // Get the signal container + signals = (AliTRDdataArrayF *) signalsArray->At(iDet); + if (signals->GetNtime() == 0) { + // Create missing containers + signals->Allocate(nRowMax,nColMax,nTimeMax); + } + else { + // Expand the container if neccessary + if (fCompress) signals->Expand(); + } + // Create the missing dictionary containers + for (iDict = 0; iDict < kNDict; iDict++) { + dictionary[iDict] = fDigits->GetDictionary(iDet,iDict); + if (dictionary[iDict]->GetNtime() == 0) { + dictionary[iDict]->Allocate(nRowMax,nColMax,nTimeMax); + } + } - } + Int_t nDigits = 0; + + // Create the digits for this chamber + for (iRow = 0; iRow < nRowMax; iRow++ ) { + for (iCol = 0; iCol < nColMax; iCol++ ) { + for (iTime = 0; iTime < nTimeMax; iTime++) { + + Float_t signalAmp = signals->GetData(iRow,iCol,iTime); + + // Add the noise + signalAmp = TMath::Max((Float_t) gRandom->Gaus(signalAmp,fNoise),0.0); + // Convert to fC + signalAmp *= kEl2fC; + // Convert to mV + signalAmp *= fChipGain; + // Convert to ADC counts. Set the overflow-bit fADCoutRange if the + // signal is larger than fADCinRange + Int_t adc = 0; + if (signalAmp >= fADCinRange) { + adc = ((Int_t) fADCoutRange); + } + else { + adc = ((Int_t) (signalAmp * (fADCoutRange / fADCinRange))); + } + if (fVerbose > 2) { + printf(" iRow = %d, iCol = %d, iTime = %d\n" + ,iRow,iCol,iTime); + printf(" signal = %f, adc = %d\n",signalAmp,adc); + } - } + // Store the amplitude of the digit if above threshold + if (adc > fADCthreshold) { + nDigits++; + digits->SetData(iRow,iCol,iTime,adc); } - } - // Compress the arrays - digits->Compress(1,0); - for (iDict = 0; iDict < kNDict; iDict++) { - dictionary[iDict]->Compress(1,0); } + } + } + + // Compress the arrays + digits->Compress(1,0); + for (iDict = 0; iDict < kNDict; iDict++) { + dictionary[iDict]->Compress(1,0); + } - totalSizeDigits += digits->GetSize(); - totalSizeDict0 += dictionary[0]->GetSize(); - totalSizeDict1 += dictionary[1]->GetSize(); - totalSizeDict2 += dictionary[2]->GetSize(); + totalSizeDigits += digits->GetSize(); + totalSizeDict0 += dictionary[0]->GetSize(); + totalSizeDict1 += dictionary[1]->GetSize(); + totalSizeDict2 += dictionary[2]->GetSize(); - printf("AliTRDdigitizer::MakeDigits -- "); - printf("Number of digits found: %d.\n",nDigits); + printf("AliTRDdigitizer::MakeDigits -- "); + printf("Found %d digits in detector %d.\n",nDigits,iDet); - // Reset the arrays - signal->Reset(); - for (iDict = 0; iDict < kNDict; iDict++) { - tracks[iDict]->Reset(); - } + if (fCompress) signals->Compress(1,0); - } - } } printf("AliTRDdigitizer::MakeDigits -- "); @@ -719,6 +930,34 @@ Bool_t AliTRDdigitizer::MakeDigits() } +//_____________________________________________________________________________ +Bool_t AliTRDdigitizer::CheckDetector(Int_t plane, Int_t chamber, Int_t sector) +{ + // + // Checks whether a detector is enabled + // + + if ((fTRD->GetSensChamber() >= 0) && + (fTRD->GetSensChamber() != chamber)) return kFALSE; + if ((fTRD->GetSensPlane() >= 0) && + (fTRD->GetSensPlane() != sector)) return kFALSE; + if ( fTRD->GetSensSector() >= 0) { + Int_t sens1 = fTRD->GetSensSector(); + Int_t sens2 = sens1 + fTRD->GetSensSectorRange(); + sens2 -= ((Int_t) (sens2 / AliTRDgeometry::Nsect())) + * AliTRDgeometry::Nsect(); + if (sens1 < sens2) { + if ((sector < sens1) || (sector >= sens2)) return kFALSE; + } + else { + if ((sector < sens1) && (sector >= sens2)) return kFALSE; + } + } + + return kTRUE; + +} + //_____________________________________________________________________________ Bool_t AliTRDdigitizer::WriteDigits() { @@ -745,3 +984,38 @@ Bool_t AliTRDdigitizer::WriteDigits() return kTRUE; } + +//_____________________________________________________________________________ +void AliTRDdigitizer::SetPRF(TF1 *prf) +{ + // + // Defines a new pad response function + // + + if (fPRF) delete fPRF; + fPRF = prf; + +} + +//_____________________________________________________________________________ +void AliTRDdigitizer::SetTRF(TF1 *trf) +{ + // + // Defines a new time response function + // + + if (fTRF) delete fTRF; + fTRF = trf; + +} + +//_____________________________________________________________________________ +Double_t TRFlandau(Double_t *x, Double_t *par) +{ + + Double_t xx = x[0]; + Double_t landau = par[0] * TMath::Landau(xx,par[1],par[2]); + + return landau; + +} diff --git a/TRD/AliTRDdigitizer.h b/TRD/AliTRDdigitizer.h index 59eb90cb4a9..95bde794f02 100644 --- a/TRD/AliTRDdigitizer.h +++ b/TRD/AliTRDdigitizer.h @@ -6,15 +6,16 @@ /* $Id$ */ #include -#include -#include -#include "AliHit.h" -#include "AliTRDdigit.h" -#include "AliTRDconst.h" -#include "AliTRDgeometry.h" +// Time response function of the preamp +Double_t TRFlandau(Double_t *x, Double_t *par); +class TFile; +class TF1; + +class AliTRD; class AliTRDdigitsManager; +class AliTRDgeometry; /////////////////////////////////////////////////////// // Produces digits from the hits information // @@ -35,36 +36,45 @@ class AliTRDdigitizer : public TNamed { 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 diffOn = 1) { fDiffusionOn = diffOn; }; - virtual void SetDiffusionT(Float_t diff) { fDiffusionT = diff; }; - virtual void SetDiffusionL(Float_t diff) { fDiffusionL = diff; }; - virtual void SetElAttach(Int_t elOn = 1) { fElAttachOn = elOn; }; - virtual void SetElAttachProp(Float_t prop) { fElAttachProp = prop; }; - virtual void SetExB(Int_t exbOn = 1) { fExBOn = exbOn; }; - 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; }; + virtual Bool_t InitDetector(); + + 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 diffOn = 1) { fDiffusionOn = diffOn; }; + virtual void SetDiffusionT(Float_t diff) { fDiffusionT = diff; }; + virtual void SetDiffusionL(Float_t diff) { fDiffusionL = diff; }; + virtual void SetElAttach(Int_t elOn = 1) { fElAttachOn = elOn; }; + virtual void SetElAttachProp(Float_t prop) { fElAttachProp = prop; }; + virtual void SetExB(Int_t exbOn = 1) { fExBOn = exbOn; }; + virtual void SetOmegaTau(Float_t ot) { fOmegaTau = ot; }; + virtual void SetPadResponse(Int_t prfOn = 1) { fPRFOn = prfOn; }; + virtual void SetPRF(TF1 *prf); + virtual void SetTimeResponse(Int_t trfOn = 1) { fTRFOn = trfOn; }; + virtual void SetTRF(TF1 *trf); + virtual void SetDriftVelocity(Float_t v) { fDriftVelocity = v; }; + virtual void SetCompress(Int_t c = 1) { fCompress = c; }; + virtual void SetVerbose(Int_t v = 1) { fVerbose = v; }; + + AliTRDdigitsManager *Digits() const { return fDigits; }; + + virtual Float_t GetGasGain() const { return fGasGain; }; + virtual Float_t GetNoise() const { return fNoise; }; + virtual Float_t GetChipGain() const { return fChipGain; }; + virtual Float_t GetADCoutRange() const { return fADCoutRange; }; + virtual Float_t GetADCinRange() const { return fADCinRange; }; + virtual Int_t GetADCthreshold() const { return fADCthreshold; }; + virtual Float_t GetDiffusionT() const { return fDiffusionT; }; + virtual Float_t GetDiffusionL() const { return fDiffusionL; }; + virtual Float_t GetElAttachProp() const { return fElAttachProp; }; + virtual Float_t GetOmegaTau() const { return fOmegaTau; }; + virtual TF1 *GetPadResponse() const { return fPRF; }; + virtual TF1 *GetTimeResponse() const { return fTRF; }; + virtual Float_t GetDriftVelocity() const { return fDriftVelocity; }; + virtual Bool_t GetCompress() const { return fCompress; }; protected: @@ -87,16 +97,31 @@ class AliTRDdigitizer : public TNamed { 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 fOmegaTau; // Tangens of the Lorentz angle Float_t fLorentzFactor; // Factor due to Lorentz force + Int_t fPRFOn; // Switch for the pad response TF1 *fPRF; // Pad response function + Int_t fTRFOn; // Switch for the time response + TF1 *fTRF; // Time response function of the shaper + Float_t *fTRFint; //!Integrated time response + Int_t fTRFbin; // Number of bins for the TRF + Float_t fTRFlo; // Lower boundary of the TRF + Float_t fTRFhi; // Higher boundary of the TRF + Float_t fTRFwid; // Bin width of the integrated TRF + Float_t fDriftVelocity; // Drift velocity (cm / mus) + Bool_t fCompress; // Switch to keep only compressed data in memory + Int_t fVerbose; // Sets the verbose level private: - virtual Int_t Diffusion(Float_t driftlength, Float_t *xyz); - virtual Int_t ExB(Float_t driftlength, Float_t *xyz); - - ClassDef(AliTRDdigitizer,1) // Produces TRD-Digits + virtual Int_t Diffusion(Float_t driftlength, Float_t *xyz); + virtual Int_t ExB(Float_t driftlength, Float_t *xyz); + virtual Int_t PadResponse(Float_t signal, Float_t dist, Float_t *pad); + virtual Float_t TimeResponse(Float_t time); + virtual Bool_t CheckDetector(Int_t plane, Int_t chamber, Int_t sector); + virtual void IntegrateTRF(); + + ClassDef(AliTRDdigitizer,2) // Produces TRD-Digits }; diff --git a/TRD/AliTRDdigitsManager.cxx b/TRD/AliTRDdigitsManager.cxx index 606d2a9ed6a..be75e8125fa 100644 --- a/TRD/AliTRDdigitsManager.cxx +++ b/TRD/AliTRDdigitsManager.cxx @@ -15,6 +15,18 @@ /* $Log$ +Revision 1.1.2.5 2000/10/17 02:27:34 cblume +Get rid of global constants + +Revision 1.1.2.4 2000/10/15 23:40:01 cblume +Remove AliTRDconst + +Revision 1.1.2.3 2000/10/06 16:49:46 cblume +Made Getters const + +Revision 1.1.2.2 2000/10/04 16:34:58 cblume +Replace include files by forward declarations + Revision 1.5 2000/06/09 11:10:07 cblume Compiler warnings and coding conventions, next round @@ -38,16 +50,24 @@ Add new class AliTRDdigitsManager // AliTRDdataArray objects. // // // /////////////////////////////////////////////////////////////////////////////// - -#include + +#include #include "AliRun.h" #include "AliTRDdigitsManager.h" -#include "AliTRDconst.h" +#include "AliTRDsegmentArray.h" +#include "AliTRDdataArrayI.h" +#include "AliTRDdigit.h" +#include "AliTRDgeometry.h" ClassImp(AliTRDdigitsManager) +//_____________________________________________________________________________ + + // Number of track dictionary arrays + const Int_t AliTRDdigitsManager::fgkNDict = kNDict; + //_____________________________________________________________________________ AliTRDdigitsManager::AliTRDdigitsManager():TObject() { @@ -57,10 +77,11 @@ AliTRDdigitsManager::AliTRDdigitsManager():TObject() fIsRaw = kFALSE; - fDigits = new AliTRDsegmentArray("AliTRDdataArrayI",kNdet); + fDigits = new AliTRDsegmentArray("AliTRDdataArrayI",AliTRDgeometry::Ndet()); for (Int_t iDict = 0; iDict < kNDict; iDict++) { - fDictionary[iDict] = new AliTRDsegmentArray("AliTRDdataArrayI",kNdet); + fDictionary[iDict] = new AliTRDsegmentArray("AliTRDdataArrayI" + ,AliTRDgeometry::Ndet()); } } @@ -114,7 +135,7 @@ void AliTRDdigitsManager::SetRaw() fIsRaw = kTRUE; - fDigits->SetBit(kRawDigit); + fDigits->SetBit(AliTRDdigit::RawDigit()); } @@ -198,7 +219,7 @@ Bool_t AliTRDdigitsManager::ReadDigits() status = fDictionary[iDict]->LoadArray(branchname); } - if (fDigits->TestBit(kRawDigit)) { + if (fDigits->TestBit(AliTRDdigit::RawDigit())) { fIsRaw = kTRUE; } else { @@ -243,7 +264,7 @@ Bool_t AliTRDdigitsManager::WriteDigits() //_____________________________________________________________________________ AliTRDdigit *AliTRDdigitsManager::GetDigit(Int_t row, Int_t col - , Int_t time, Int_t det) + , Int_t time, Int_t det) const { // // Creates a single digit object @@ -266,7 +287,7 @@ AliTRDdigit *AliTRDdigitsManager::GetDigit(Int_t row, Int_t col //_____________________________________________________________________________ Int_t AliTRDdigitsManager::GetTrack(Int_t track , Int_t row, Int_t col, Int_t time - , Int_t det) + , Int_t det) const { // // Returns the MC-track numbers from the dictionary. @@ -285,7 +306,7 @@ Int_t AliTRDdigitsManager::GetTrack(Int_t track } //_____________________________________________________________________________ -AliTRDdataArrayI *AliTRDdigitsManager::GetDigits(Int_t det) +AliTRDdataArrayI *AliTRDdigitsManager::GetDigits(Int_t det) const { // // Returns the digits array for one detector @@ -296,7 +317,7 @@ AliTRDdataArrayI *AliTRDdigitsManager::GetDigits(Int_t det) } //_____________________________________________________________________________ -AliTRDdataArrayI *AliTRDdigitsManager::GetDictionary(Int_t det, Int_t i) +AliTRDdataArrayI *AliTRDdigitsManager::GetDictionary(Int_t det, Int_t i) const { // // Returns the dictionary for one detector @@ -307,7 +328,7 @@ AliTRDdataArrayI *AliTRDdigitsManager::GetDictionary(Int_t det, Int_t i) } //_____________________________________________________________________________ -Int_t AliTRDdigitsManager::GetTrack(Int_t track, AliTRDdigit *Digit) +Int_t AliTRDdigitsManager::GetTrack(Int_t track, AliTRDdigit *Digit) const { // // Returns the MC-track numbers from the dictionary for a given digit diff --git a/TRD/AliTRDdigitsManager.h b/TRD/AliTRDdigitsManager.h index 6956086fe52..d8ac50726c0 100644 --- a/TRD/AliTRDdigitsManager.h +++ b/TRD/AliTRDdigitsManager.h @@ -10,13 +10,11 @@ // Manages the TRD digits // ///////////////////////////////////////////////////////////// -#include "TObject.h" +#include -#include "AliTRDsegmentArray.h" -#include "AliTRDdataArrayI.h" -#include "AliTRDdigit.h" - -const Int_t kNDict = 3; +class AliTRDsegmentArray; +class AliTRDdataArrayI; +class AliTRDdigit; class AliTRDdigitsManager : public TObject { @@ -34,19 +32,25 @@ class AliTRDdigitsManager : public TObject { virtual void SetRaw(); - virtual Bool_t IsRaw() { return fIsRaw; }; - virtual AliTRDsegmentArray *GetDigits() { return fDigits; }; - virtual AliTRDsegmentArray *GetDictionary(Int_t i) { return fDictionary[i]; }; + virtual Bool_t IsRaw() const { return fIsRaw; }; + static Int_t NDict() { return fgkNDict; }; + + virtual AliTRDsegmentArray *GetDigits() const { return fDigits; }; + virtual AliTRDsegmentArray *GetDictionary(Int_t i) const { return fDictionary[i]; }; - AliTRDdigit *GetDigit(Int_t row, Int_t col, Int_t time, Int_t det); - Int_t GetTrack(Int_t track, Int_t row, Int_t col, Int_t time, Int_t det); + AliTRDdigit *GetDigit(Int_t row, Int_t col, Int_t time, Int_t det) const; + Int_t GetTrack(Int_t track, Int_t row, Int_t col + , Int_t time, Int_t det) const; - AliTRDdataArrayI *GetDigits(Int_t det); - AliTRDdataArrayI *GetDictionary(Int_t det, Int_t i); - Int_t GetTrack(Int_t track, AliTRDdigit *Digit); + AliTRDdataArrayI *GetDigits(Int_t det) const; + AliTRDdataArrayI *GetDictionary(Int_t det, Int_t i) const; + Int_t GetTrack(Int_t track, AliTRDdigit *Digit) const; protected: + enum { kNDict = 3 }; + static const Int_t fgkNDict; // Number of track dictionary arrays + AliTRDsegmentArray *fDigits; //! Digits data Array AliTRDsegmentArray *fDictionary[kNDict]; //! Track dictionary data array diff --git a/TRD/AliTRDgeometry.cxx b/TRD/AliTRDgeometry.cxx index 0988e586630..2e7b3806365 100644 --- a/TRD/AliTRDgeometry.cxx +++ b/TRD/AliTRDgeometry.cxx @@ -15,6 +15,39 @@ /* $Log$ +Revision 1.1.4.7 2000/10/16 01:16:53 cblume +Changed timebin 0 to be the one closest to the readout + +Revision 1.1.4.6 2000/10/15 23:35:57 cblume +Include geometry constants as static member + +Revision 1.1.4.5 2000/10/06 16:49:46 cblume +Made Getters const + +Revision 1.1.4.4 2000/10/04 16:34:58 cblume +Replace include files by forward declarations + +Revision 1.1.4.3 2000/09/22 14:43:40 cblume +Allow the pad/timebin-dimensions to be changed after initialization + +Revision 1.1.4.2 2000/09/18 13:37:01 cblume +Minor coding corrections + +Revision 1.5 2000/10/02 21:28:19 fca +Removal of useless dependecies via forward declarations + +Revision 1.4 2000/06/08 18:32:58 cblume +Make code compliant to coding conventions + +Revision 1.3 2000/06/07 16:25:37 cblume +Try to remove compiler warnings on Sun and HP + +Revision 1.2 2000/05/08 16:17:27 cblume +Merge TRD-develop + +Revision 1.1.4.1 2000/05/08 14:45:55 cblume +Bug fix in RotateBack(). Geometry update + Revision 1.4 2000/06/08 18:32:58 cblume Make code compliant to coding conventions @@ -38,12 +71,80 @@ Add new TRD classes // // /////////////////////////////////////////////////////////////////////////////// +#include "AliMC.h" + #include "AliTRDgeometry.h" #include "AliTRDrecPoint.h" #include "AliMC.h" ClassImp(AliTRDgeometry) +//_____________________________________________________________________________ + + // + // The geometry constants + // + const Int_t AliTRDgeometry::fgkNsect = kNsect; + const Int_t AliTRDgeometry::fgkNplan = kNplan; + const Int_t AliTRDgeometry::fgkNcham = kNcham; + const Int_t AliTRDgeometry::fgkNdet = kNdet; + + // + // Dimensions of the detector + // + const Float_t AliTRDgeometry::fgkRmin = 294.0; + const Float_t AliTRDgeometry::fgkRmax = 368.0; + + const Float_t AliTRDgeometry::fgkZmax1 = 378.35; + const Float_t AliTRDgeometry::fgkZmax2 = 302.0; + + const Float_t AliTRDgeometry::fgkSheight = 74.0; + const Float_t AliTRDgeometry::fgkSwidth1 = 99.613; + const Float_t AliTRDgeometry::fgkSwidth2 = 125.707; + const Float_t AliTRDgeometry::fgkSlenTR1 = 751.0; + const Float_t AliTRDgeometry::fgkSlenTR2 = 313.5; + const Float_t AliTRDgeometry::fgkSlenTR3 = 159.5; + + const Float_t AliTRDgeometry::fgkCheight = 11.0; + const Float_t AliTRDgeometry::fgkCspace = 1.6; + const Float_t AliTRDgeometry::fgkCathick = 1.0; + const Float_t AliTRDgeometry::fgkCcthick = 1.0; + const Float_t AliTRDgeometry::fgkCaframe = 2.675; + const Float_t AliTRDgeometry::fgkCcframe = AliTRDgeometry::fgkCheight + - AliTRDgeometry::fgkCaframe; + + // + // Thickness of the the material layers + // + const Float_t AliTRDgeometry::fgkSeThick = 0.02; + const Float_t AliTRDgeometry::fgkRaThick = 4.8; + const Float_t AliTRDgeometry::fgkPeThick = 0.20; + const Float_t AliTRDgeometry::fgkMyThick = 0.005; + const Float_t AliTRDgeometry::fgkXeThick = 3.5; + const Float_t AliTRDgeometry::fgkDrThick = 3.0; + const Float_t AliTRDgeometry::fgkAmThick = AliTRDgeometry::fgkXeThick + - AliTRDgeometry::fgkDrThick; + const Float_t AliTRDgeometry::fgkCuThick = 0.001; + const Float_t AliTRDgeometry::fgkSuThick = 0.06; + const Float_t AliTRDgeometry::fgkFeThick = 0.0044; + const Float_t AliTRDgeometry::fgkCoThick = 0.02; + const Float_t AliTRDgeometry::fgkWaThick = 0.01; + + // + // Position of the material layers + // + const Float_t AliTRDgeometry::fgkSeZpos = -4.1525; + const Float_t AliTRDgeometry::fgkRaZpos = -1.7425; + const Float_t AliTRDgeometry::fgkPeZpos = 0.0000; + const Float_t AliTRDgeometry::fgkMyZpos = 0.6600; + const Float_t AliTRDgeometry::fgkDrZpos = 2.1625; + const Float_t AliTRDgeometry::fgkAmZpos = 4.1125; + const Float_t AliTRDgeometry::fgkCuZpos = -1.3370; + const Float_t AliTRDgeometry::fgkSuZpos = 0.0000; + const Float_t AliTRDgeometry::fgkFeZpos = 1.3053; + const Float_t AliTRDgeometry::fgkCoZpos = 1.3175; + const Float_t AliTRDgeometry::fgkWaZpos = 1.3325; + //_____________________________________________________________________________ AliTRDgeometry::AliTRDgeometry():AliGeometry() { @@ -71,20 +172,15 @@ void AliTRDgeometry::Init() // Initializes the geometry parameter // - Int_t iplan; + Int_t isect; // The width of the chambers - fCwidth[0] = 99.6; - fCwidth[1] = 104.1; - fCwidth[2] = 108.5; - fCwidth[3] = 112.9; - fCwidth[4] = 117.4; - fCwidth[5] = 121.8; - - // The default pad dimensions - fRowPadSize = 4.5; - fColPadSize = 1.0; - fTimeBinSize = 0.1; + fCwidth[0] = 99.6; + fCwidth[1] = 104.1; + fCwidth[2] = 108.5; + fCwidth[3] = 112.9; + fCwidth[4] = 117.4; + fCwidth[5] = 121.8; // The maximum number of pads // and the position of pad 0,0,0 @@ -92,33 +188,74 @@ void AliTRDgeometry::Init() // chambers seen from the top: // +----------------------------+ // | | - // | | ^ - // | | rphi| - // | | | - // |0 | | - // +----------------------------+ +------> + // | | ^ + // | | rphi| + // | | | + // |0 | | + // +----------------------------+ +------> // z - // chambers seen from the side: ^ - // +----------------------------+ time| - // | | | - // |0 | | - // +----------------------------+ +------> + // chambers seen from the side: ^ + // +----------------------------+ drift| + // |0 | | + // | | | + // +----------------------------+ +------> // z // + // IMPORTANT: time bin 0 is now the one closest to the readout !!! + // // The pad column (rphi-direction) - for (iplan = 0; iplan < kNplan; iplan++) { - fColMax[iplan] = 1 + TMath::Nint((fCwidth[iplan] - 2. * kCcthick) + SetColPadSize(1.0); + + // The time bucket + SetTimeBinSize(0.1); + + // The rotation matrix elements + Float_t phi = 0; + for (isect = 0; isect < fgkNsect; isect++) { + phi = -2.0 * kPI / (Float_t) fgkNsect * ((Float_t) isect + 0.5); + fRotA11[isect] = TMath::Cos(phi); + fRotA12[isect] = TMath::Sin(phi); + fRotA21[isect] = TMath::Sin(phi); + fRotA22[isect] = TMath::Cos(phi); + phi = -1.0 * phi; + fRotB11[isect] = TMath::Cos(phi); + fRotB12[isect] = TMath::Sin(phi); + fRotB21[isect] = TMath::Sin(phi); + fRotB22[isect] = TMath::Cos(phi); + } + +} + +//_____________________________________________________________________________ +void AliTRDgeometry::SetColPadSize(Float_t size) +{ + // + // Redefines the pad size in column direction + // + + fColPadSize = size; + for (Int_t iplan = 0; iplan < fgkNplan; iplan++) { + fColMax[iplan] = 1 + TMath::Nint((fCwidth[iplan] - 2. * fgkCcthick) / fColPadSize - 0.5); - fCol0[iplan] = -fCwidth[iplan]/2. + kCcthick; + fCol0[iplan] = -fCwidth[iplan]/2. + fgkCcthick; } - // The time bucket - fTimeMax = 1 + TMath::Nint(kDrThick / fTimeBinSize - 0.5); - for (iplan = 0; iplan < kNplan; iplan++) { - fTime0[iplan] = kRmin + kCcframe/2. + kDrZpos - 0.5 * kDrThick - + iplan * (kCheight + kCspace); - } +} + +//_____________________________________________________________________________ +void AliTRDgeometry::SetTimeBinSize(Float_t size) +{ + // + // Redefines the time bin size + // + + fTimeBinSize = size; + fTimeMax = 1 + TMath::Nint(fgkDrThick / fTimeBinSize - 0.5); + for (Int_t iplan = 0; iplan < fgkNplan; iplan++) { + fTime0[iplan] = fgkRmin + fgkCcframe/2. + fgkDrZpos + 0.5 * fgkDrThick + + iplan * (fgkCheight + fgkCspace); + } } @@ -198,38 +335,38 @@ void AliTRDgeometry::CreateGeometry(Int_t *idtmed) parCha[0] = -1.; parCha[1] = -1.; // G10 layer (radiator seal) - parCha[2] = kSeThick/2; + parCha[2] = fgkSeThick/2; gMC->Gsvolu("UL01","BOX ",idtmed[1313-1],parCha,kNparCha); // CO2 layer (radiator) - parCha[2] = kRaThick/2; + parCha[2] = fgkRaThick/2; gMC->Gsvolu("UL02","BOX ",idtmed[1312-1],parCha,kNparCha); // PE layer (radiator) - parCha[2] = kPeThick/2; + parCha[2] = fgkPeThick/2; gMC->Gsvolu("UL03","BOX ",idtmed[1303-1],parCha,kNparCha); // Mylar layer (entrance window + HV cathode) - parCha[2] = kMyThick/2; + parCha[2] = fgkMyThick/2; gMC->Gsvolu("UL04","BOX ",idtmed[1308-1],parCha,kNparCha); // Xe/Isobutane layer (drift volume, sensitive) - parCha[2] = kDrThick/2.; + parCha[2] = fgkDrThick/2.; gMC->Gsvolu("UL05","BOX ",idtmed[1309-1],parCha,kNparCha); // Xe/Isobutane layer (amplification volume, not sensitive) - parCha[2] = kAmThick/2.; + parCha[2] = fgkAmThick/2.; gMC->Gsvolu("UL06","BOX ",idtmed[1309-1],parCha,kNparCha); // Cu layer (pad plane) - parCha[2] = kCuThick/2; + parCha[2] = fgkCuThick/2; gMC->Gsvolu("UL07","BOX ",idtmed[1305-1],parCha,kNparCha); // G10 layer (support structure) - parCha[2] = kSuThick/2; + parCha[2] = fgkSuThick/2; gMC->Gsvolu("UL08","BOX ",idtmed[1313-1],parCha,kNparCha); // Cu layer (FEE + signal lines) - parCha[2] = kFeThick/2; + parCha[2] = fgkFeThick/2; gMC->Gsvolu("UL09","BOX ",idtmed[1305-1],parCha,kNparCha); // PE layer (cooling devices) - parCha[2] = kCoThick/2; + parCha[2] = fgkCoThick/2; gMC->Gsvolu("UL10","BOX ",idtmed[1303-1],parCha,kNparCha); // Water layer (cooling) - parCha[2] = kWaThick/2; + parCha[2] = fgkWaThick/2; gMC->Gsvolu("UL11","BOX ",idtmed[1314-1],parCha,kNparCha); // Position the layers in the chambers @@ -237,12 +374,12 @@ void AliTRDgeometry::CreateGeometry(Int_t *idtmed) ypos = 0; // G10 layer (radiator seal) - zpos = kSeZpos; + zpos = fgkSeZpos; gMC->Gspos("UL01",1,"UCII",xpos,ypos,zpos,0,"ONLY"); gMC->Gspos("UL01",2,"UCIM",xpos,ypos,zpos,0,"ONLY"); gMC->Gspos("UL01",3,"UCIO",xpos,ypos,zpos,0,"ONLY"); // CO2 layer (radiator) - zpos = kRaZpos; + zpos = fgkRaZpos; gMC->Gspos("UL02",1,"UCII",xpos,ypos,zpos,0,"ONLY"); gMC->Gspos("UL02",2,"UCIM",xpos,ypos,zpos,0,"ONLY"); gMC->Gspos("UL02",3,"UCIO",xpos,ypos,zpos,0,"ONLY"); @@ -250,43 +387,43 @@ void AliTRDgeometry::CreateGeometry(Int_t *idtmed) zpos = 0; gMC->Gspos("UL03",1,"UL02",xpos,ypos,zpos,0,"ONLY"); // Mylar layer (entrance window + HV cathode) - zpos = kMyZpos; + zpos = fgkMyZpos; gMC->Gspos("UL04",1,"UCII",xpos,ypos,zpos,0,"ONLY"); gMC->Gspos("UL04",2,"UCIM",xpos,ypos,zpos,0,"ONLY"); gMC->Gspos("UL04",3,"UCIO",xpos,ypos,zpos,0,"ONLY"); // Xe/Isobutane layer (drift volume) - zpos = kDrZpos; + zpos = fgkDrZpos; gMC->Gspos("UL05",1,"UCII",xpos,ypos,zpos,0,"ONLY"); gMC->Gspos("UL05",2,"UCIM",xpos,ypos,zpos,0,"ONLY"); gMC->Gspos("UL05",3,"UCIO",xpos,ypos,zpos,0,"ONLY"); // Xe/Isobutane layer (amplification volume) - zpos = kAmZpos; + zpos = fgkAmZpos; gMC->Gspos("UL06",1,"UCII",xpos,ypos,zpos,0,"ONLY"); gMC->Gspos("UL06",2,"UCIM",xpos,ypos,zpos,0,"ONLY"); gMC->Gspos("UL06",3,"UCIO",xpos,ypos,zpos,0,"ONLY"); // Cu layer (pad plane) - zpos = kCuZpos; + zpos = fgkCuZpos; gMC->Gspos("UL07",1,"UAII",xpos,ypos,zpos,0,"ONLY"); gMC->Gspos("UL07",2,"UAIM",xpos,ypos,zpos,0,"ONLY"); gMC->Gspos("UL07",3,"UAIO",xpos,ypos,zpos,0,"ONLY"); // G10 layer (support structure) - zpos = kSuZpos; + zpos = fgkSuZpos; gMC->Gspos("UL08",1,"UAII",xpos,ypos,zpos,0,"ONLY"); gMC->Gspos("UL08",2,"UAIM",xpos,ypos,zpos,0,"ONLY"); gMC->Gspos("UL08",3,"UAIO",xpos,ypos,zpos,0,"ONLY"); // Cu layer (FEE + signal lines) - zpos = kFeZpos; + zpos = fgkFeZpos; gMC->Gspos("UL09",1,"UAII",xpos,ypos,zpos,0,"ONLY"); gMC->Gspos("UL09",2,"UAIM",xpos,ypos,zpos,0,"ONLY"); gMC->Gspos("UL09",3,"UAIO",xpos,ypos,zpos,0,"ONLY"); // PE layer (cooling devices) - zpos = kCoZpos; + zpos = fgkCoZpos; gMC->Gspos("UL10",1,"UAII",xpos,ypos,zpos,0,"ONLY"); gMC->Gspos("UL10",2,"UAIM",xpos,ypos,zpos,0,"ONLY"); gMC->Gspos("UL10",3,"UAIO",xpos,ypos,zpos,0,"ONLY"); // Water layer (cooling) - zpos = kWaZpos; + zpos = fgkWaZpos; gMC->Gspos("UL11",1,"UAII",xpos,ypos,zpos,0,"ONLY"); gMC->Gspos("UL11",1,"UAIM",xpos,ypos,zpos,0,"ONLY"); gMC->Gspos("UL11",1,"UAIO",xpos,ypos,zpos,0,"ONLY"); @@ -301,9 +438,9 @@ Bool_t AliTRDgeometry::Local2Global(Int_t idet, Float_t *local, Float_t *global) // global ALICE reference frame coordinates (x,y,z) // - Int_t icham = GetChamber(idet); // Chamber info (0-4) - Int_t isect = GetSector(idet); // Sector info (0-17) - Int_t iplan = GetPlane(idet); // Plane info (0-5) + Int_t icham = GetChamber(idet); // Chamber info (0-4) + Int_t isect = GetSector(idet); // Sector info (0-17) + Int_t iplan = GetPlane(idet); // Plane info (0-5) return Local2Global(iplan,icham,isect,local,global); @@ -318,17 +455,17 @@ Bool_t AliTRDgeometry::Local2Global(Int_t iplan, Int_t icham, Int_t isect // global ALICE reference frame coordinates (x,y,z) // - Int_t idet = GetDetector(iplan,icham,isect); // Detector number + Int_t idet = GetDetector(iplan,icham,isect); // Detector number - 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 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 row0 = GetRow0(iplan,icham,isect); + Float_t col0 = GetCol0(iplan); + Float_t time0 = GetTime0(iplan); - Float_t rot[3]; + Float_t rot[3]; // calculate (x,y,z) position in rotated chamber rot[0] = time0 + timeSlice * fTimeBinSize; @@ -341,7 +478,7 @@ Bool_t AliTRDgeometry::Local2Global(Int_t iplan, Int_t icham, Int_t isect } //_____________________________________________________________________________ -Bool_t AliTRDgeometry::Rotate(Int_t d, Float_t *pos, Float_t *rot) +Bool_t AliTRDgeometry::Rotate(Int_t d, Float_t *pos, Float_t *rot) const { // // Rotates all chambers in the position of sector 0 and transforms @@ -349,12 +486,10 @@ Bool_t AliTRDgeometry::Rotate(Int_t d, Float_t *pos, Float_t *rot) // corresponding local frame . // - Int_t sector = GetSector(d); - - Float_t phi = -2.0 * kPI / (Float_t) kNsect * ((Float_t) sector + 0.5); + Int_t sector = GetSector(d); - 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[0] = pos[0] * fRotA11[sector] + pos[1] * fRotA12[sector]; + rot[1] = -pos[0] * fRotA21[sector] + pos[1] * fRotA22[sector]; rot[2] = pos[2]; return kTRUE; @@ -370,12 +505,10 @@ Bool_t AliTRDgeometry::RotateBack(Int_t d, Float_t *rot, Float_t *pos) const // coordinates into the coordinates of the ALICE restframe . // - Int_t sector = GetSector(d); - - Float_t phi = 2.0 * kPI / (Float_t) kNsect * ((Float_t) sector + 0.5); + Int_t sector = GetSector(d); - 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[0] = rot[0] * fRotB11[sector] + rot[1] * fRotB12[sector]; + pos[1] = -rot[0] * fRotB21[sector] + rot[1] * fRotB22[sector]; pos[2] = rot[2]; return kTRUE; @@ -389,7 +522,7 @@ Int_t AliTRDgeometry::GetDetector(Int_t p, Int_t c, Int_t s) const // Convert plane / chamber / sector into detector number // - return (p + c * kNplan + s * kNplan * kNcham); + return (p + c * fgkNplan + s * fgkNplan * fgkNcham); } @@ -400,7 +533,7 @@ Int_t AliTRDgeometry::GetPlane(Int_t d) const // Reconstruct the plane number from the detector number // - return ((Int_t) (d % kNplan)); + return ((Int_t) (d % fgkNplan)); } @@ -411,7 +544,7 @@ Int_t AliTRDgeometry::GetChamber(Int_t d) const // Reconstruct the chamber number from the detector number // - return ((Int_t) (d % (kNplan * kNcham)) / kNplan); + return ((Int_t) (d % (fgkNplan * fgkNcham)) / fgkNplan); } @@ -422,12 +555,13 @@ Int_t AliTRDgeometry::GetSector(Int_t d) const // Reconstruct the sector number from the detector number // - return ((Int_t) (d / (kNplan * kNcham))); + return ((Int_t) (d / (fgkNplan * fgkNcham))); } //_____________________________________________________________________________ -void AliTRDgeometry::GetGlobal(const AliRecPoint *p, TVector3 &pos, TMatrix &mat) const +void AliTRDgeometry::GetGlobal(const AliRecPoint *p, TVector3 &pos + , TMatrix &mat) const { // // Returns the global coordinate and error matrix of a AliTRDrecPoint diff --git a/TRD/AliTRDgeometry.h b/TRD/AliTRDgeometry.h index 820946990d4..d446455cb07 100644 --- a/TRD/AliTRDgeometry.h +++ b/TRD/AliTRDgeometry.h @@ -5,15 +5,8 @@ /* $Id$ */ -#include -#include - -#include "AliRun.h" -#include "AliRecPoint.h" #include "AliGeometry.h" -#include "AliTRDconst.h" - class AliTRDgeometry : public AliGeometry { public: @@ -21,61 +14,144 @@ class AliTRDgeometry : public AliGeometry { AliTRDgeometry(); virtual ~AliTRDgeometry(); - virtual void CreateGeometry(Int_t *idtmed); - virtual Int_t IsVersion() const = 0; - virtual void Init(); - virtual Bool_t Local2Global(Int_t d, Float_t *local, Float_t *global) const; - virtual Bool_t Local2Global(Int_t p, Int_t c, Int_t s, Float_t *local, Float_t *global) const; - 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) const; - - 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) const; - virtual Int_t GetPlane(Int_t d) const; - virtual Int_t GetChamber(Int_t d) const; - virtual Int_t GetSector(Int_t d) const; - - virtual Int_t GetRowMax(Int_t p, Int_t c, Int_t s) { return fRowMax[p][c][s]; }; - virtual Int_t GetColMax(Int_t p) { return fColMax[p]; }; - virtual Int_t GetTimeMax() { return fTimeMax; }; + virtual void CreateGeometry(Int_t *idtmed); + virtual Int_t IsVersion() const = 0; + virtual void Init(); + virtual Bool_t Local2Global(Int_t d, Float_t *local, Float_t *global) const; + virtual Bool_t Local2Global(Int_t p, Int_t c, Int_t s, Float_t *local, Float_t *global) const; + virtual Bool_t Rotate(Int_t d, Float_t *pos, Float_t *rot) const; + virtual Bool_t RotateBack(Int_t d, Float_t *rot, Float_t *pos) const; + + static Int_t Nsect() { return fgkNsect; }; + static Int_t Nplan() { return fgkNplan; }; + static Int_t Ncham() { return fgkNcham; }; + static Int_t Ndet() { return fgkNdet; }; + + static Float_t Rmin() { return fgkRmin; }; + static Float_t Rmax() { return fgkRmax; }; + static Float_t Zmax1() { return fgkZmax1; }; + static Float_t Zmax2() { return fgkZmax2; }; + + static Float_t Cwidcha() { return (fgkSwidth2 - fgkSwidth1) + / fgkSheight * (fgkCheight + fgkCspace); }; + static Float_t Cheight() { return fgkCheight; }; + static Float_t Cspace() { return fgkCspace; }; + static Float_t MyThick() { return fgkMyThick; }; + static Float_t DrThick() { return fgkDrThick; }; + static Float_t RaThick() { return fgkRaThick; }; + + virtual void SetPHOShole() = 0; + virtual void SetRICHhole() = 0; + + virtual void SetRowPadSize(Float_t size) {}; + virtual void SetColPadSize(Float_t size); + virtual void SetTimeBinSize(Float_t size); + + virtual Bool_t GetPHOShole() const = 0; + virtual Bool_t GetRICHhole() const = 0; + + virtual Int_t GetDetector(Int_t p, Int_t c, Int_t s) const; + virtual Int_t GetPlane(Int_t d) const; + virtual Int_t GetChamber(Int_t d) const; + virtual Int_t GetSector(Int_t d) const; + + virtual Float_t GetChamberWidth(Int_t p) const { return fCwidth[p]; }; + + virtual Int_t GetRowMax(Int_t p, Int_t c, Int_t s) const { return fRowMax[p][c][s]; }; + virtual Int_t GetColMax(Int_t p) const { return fColMax[p]; }; + virtual Int_t GetTimeMax() const { return fTimeMax; }; - virtual Float_t GetRow0(Int_t p, Int_t c, Int_t s) const { return fRow0[p][c][s]; }; - virtual Float_t GetCol0(Int_t p) const { return fCol0[p]; }; - virtual Float_t GetTime0(Int_t p) const { return fTime0[p]; }; - - virtual Float_t GetRowPadSize() const { return fRowPadSize; }; - virtual Float_t GetColPadSize() const { return fColPadSize; }; - virtual Float_t GetTimeBinSize() const { return fTimeBinSize; }; - - virtual void GetGlobal(const AliRecPoint *p, TVector3 &pos, TMatrix &mat) const; - virtual void GetGlobal(const AliRecPoint *p, TVector3 &pos) const; + virtual Float_t GetRow0(Int_t p, Int_t c, Int_t s) const { return fRow0[p][c][s]; }; + virtual Float_t GetCol0(Int_t p) const { return fCol0[p]; }; + virtual Float_t GetTime0(Int_t p) const { return fTime0[p]; }; - protected: - - Float_t fCwidth[kNplan]; // Width of the chambers + virtual Float_t GetRowPadSize() const { return fRowPadSize; }; + virtual Float_t GetColPadSize() const { return fColPadSize; }; + virtual Float_t GetTimeBinSize() const { return fTimeBinSize; }; - Int_t fRowMax[kNplan][kNcham][kNsect]; // Number of pad-rows - Int_t fColMax[kNplan]; // Number of pad-columns - Int_t fTimeMax; // Number of time buckets + virtual void GetGlobal(const AliRecPoint *p, TVector3 &pos, TMatrix &mat) const; + virtual void GetGlobal(const AliRecPoint *p, TVector3 &pos) const; - Float_t fRow0[kNplan][kNcham][kNsect]; // Row-position of pad 0 - Float_t fCol0[kNplan]; // Column-position of pad 0 - Float_t fTime0[kNplan]; // Time-position of pad 0 + static Double_t GetAlpha() { return 2 * 3.14159265358979323846 / fgkNsect; }; - Float_t fRowPadSize; // Pad size in z-direction - Float_t fColPadSize; // Pad size in rphi-direction - Float_t fTimeBinSize; // Size of the time buckets + protected: - ClassDef(AliTRDgeometry,1) // TRD geometry base class + enum { kNplan = 6, kNcham = 5, kNsect = 18, kNdet = 540 }; + static const Int_t fgkNsect; // Number of sectors in the full detector (18) + static const Int_t fgkNplan; // Number of planes of the TRD (6) + static const Int_t fgkNcham; // Number of chambers in z-direction (5) + static const Int_t fgkNdet; // Total number of detectors (18 * 6 * 5 = 540) + + static const Float_t fgkRmin; // Minimal radius of the TRD + static const Float_t fgkRmax; // Maximal radius of the TRD + + static const Float_t fgkZmax1; // Half-length of the TRD at outer radius + static const Float_t fgkZmax2; // Half-length of the TRD at inner radius + + static const Float_t fgkSheight; // Height of the TRD-volume in spaceframe (BTR1-3) + static const Float_t fgkSwidth1; // Lower width of the TRD-volume in spaceframe (BTR1-3) + static const Float_t fgkSwidth2; // Upper width of the TRD-volume in spaceframe (BTR1-3) + static const Float_t fgkSlenTR1; // Length of the TRD-volume in spaceframe (BTR1) + static const Float_t fgkSlenTR2; // Length of the TRD-volume in spaceframe (BTR2) + static const Float_t fgkSlenTR3; // Length of the TRD-volume in spaceframe (BTR3) + + static const Float_t fgkCheight; // Height of the chambers + static const Float_t fgkCspace; // Vertical spacing of the chambers + static const Float_t fgkCaframe; // Height of the aluminum frame + static const Float_t fgkCcframe; // Height of the carbon frame + static const Float_t fgkCathick; // Thickness of the aluminum frame + static const Float_t fgkCcthick; // Thickness of the carbon frame + + static const Float_t fgkSeThick; // Thickness of the radiator seal + static const Float_t fgkRaThick; // Thickness of the radiator + static const Float_t fgkPeThick; // Thickness of the PE-layer in the radiator + static const Float_t fgkMyThick; // Thickness of the mylar-layer + static const Float_t fgkXeThick; // Thickness of the gas volume + static const Float_t fgkDrThick; // Thickness of the drift region + static const Float_t fgkAmThick; // Thickness of the amplification region + static const Float_t fgkCuThick; // Thickness of the pad plane + static const Float_t fgkSuThick; // Thickness of the HEXCEL+G10 support structure + static const Float_t fgkFeThick; // Thickness of the FEE + signal lines + static const Float_t fgkCoThick; // Thickness of the PE of the cooling device + static const Float_t fgkWaThick; // Thickness of the cooling water + + static const Float_t fgkSeZpos; // Position of the radiator seal + static const Float_t fgkRaZpos; // Position of the radiator + static const Float_t fgkPeZpos; // Position of the PE-layer in the radiator + static const Float_t fgkMyZpos; // Position of the mylar-layer + static const Float_t fgkDrZpos; // Position of the drift region + static const Float_t fgkAmZpos; // Position of the amplification region + static const Float_t fgkCuZpos; // Position of the pad plane + static const Float_t fgkSuZpos; // Position of the HEXCEL+G10 support structure + static const Float_t fgkFeZpos; // Position of the FEE + signal lines + static const Float_t fgkCoZpos; // Position of the PE of the cooling device + static const Float_t fgkWaZpos; // Position of the colling water + + Int_t fRowMax[kNplan][kNcham][kNsect]; // Number of pad-rows + Int_t fColMax[kNplan]; // Number of pad-columns + Int_t fTimeMax; // Number of time buckets + + Float_t fCwidth[kNplan]; // Width of the chambers + + Float_t fRow0[kNplan][kNcham][kNsect]; // Row-position of pad 0 + Float_t fCol0[kNplan]; // Column-position of pad 0 + Float_t fTime0[kNplan]; // Time-position of pad 0 + + Float_t fRowPadSize; // Pad size in z-direction + Float_t fColPadSize; // Pad size in rphi-direction + Float_t fTimeBinSize; // Size of the time buckets + + Float_t fRotA11[kNsect]; // Matrix elements for the rotation + Float_t fRotA12[kNsect]; // Matrix elements for the rotation + Float_t fRotA21[kNsect]; // Matrix elements for the rotation + Float_t fRotA22[kNsect]; // Matrix elements for the rotation + + Float_t fRotB11[kNsect]; // Matrix elements for the backward rotation + Float_t fRotB12[kNsect]; // Matrix elements for the backward rotation + Float_t fRotB21[kNsect]; // Matrix elements for the backward rotation + Float_t fRotB22[kNsect]; // Matrix elements for the backward rotation + + ClassDef(AliTRDgeometry,2) // TRD geometry base class }; diff --git a/TRD/AliTRDgeometryFull.cxx b/TRD/AliTRDgeometryFull.cxx index 008f2cf0b62..6daca0fbea6 100644 --- a/TRD/AliTRDgeometryFull.cxx +++ b/TRD/AliTRDgeometryFull.cxx @@ -15,6 +15,21 @@ /* $Log$ +Revision 1.1.4.6 2000/10/15 23:40:01 cblume +Remove AliTRDconst + +Revision 1.1.4.5 2000/10/06 16:49:46 cblume +Made Getters const + +Revision 1.1.4.4 2000/10/04 16:34:58 cblume +Replace include files by forward declarations + +Revision 1.1.4.3 2000/09/22 14:43:41 cblume +Allow the pad/timebin-dimensions to be changed after initialization + +Revision 1.4 2000/10/02 21:28:19 fca +Removal of useless dependecies via forward declarations + Revision 1.3 2000/06/08 18:32:58 cblume Make code compliant to coding conventions @@ -38,9 +53,10 @@ Add new TRD classes // // /////////////////////////////////////////////////////////////////////////////// -#include "AliTRDgeometryFull.h" #include "AliMC.h" +#include "AliTRDgeometryFull.h" + ClassImp(AliTRDgeometryFull) //_____________________________________________________________________________ @@ -76,7 +92,7 @@ void AliTRDgeometryFull::Init() fRICHhole = kFALSE; // The length of the inner chambers - for (iplan = 0; iplan < kNplan; iplan++) + for (iplan = 0; iplan < fgkNplan; iplan++) fClengthI[iplan] = 110.0; // The length of the middle chambers @@ -137,9 +153,22 @@ void AliTRDgeometryFull::Init() // // The pad row (z-direction) - for (iplan = 0; iplan < kNplan; iplan++) { + SetRowPadSize(4.5); + +} - for (Int_t isect = 0; isect < kNsect; isect++) { +//_____________________________________________________________________________ +void AliTRDgeometryFull::SetRowPadSize(Float_t size) +{ + // + // Redefines the pad size in row direction + // + + fRowPadSize = size; + + for (Int_t iplan = 0; iplan < fgkNplan; iplan++) { + + for (Int_t isect = 0; isect < fgkNsect; isect++) { Float_t clengthI = fClengthI[iplan]; Float_t clengthM = fClengthM1[iplan]; Float_t clengthO = fClengthO1[iplan]; @@ -158,21 +187,21 @@ void AliTRDgeometryFull::Init() clengthO = fClengthO3[iplan]; break; }; - fRowMax[iplan][0][isect] = 1 + TMath::Nint((clengthO - 2. * kCcthick) + fRowMax[iplan][0][isect] = 1 + TMath::Nint((clengthO - 2. * fgkCcthick) / fRowPadSize - 0.5); - fRowMax[iplan][1][isect] = 1 + TMath::Nint((clengthM - 2. * kCcthick) + fRowMax[iplan][1][isect] = 1 + TMath::Nint((clengthM - 2. * fgkCcthick) / fRowPadSize - 0.5); - fRowMax[iplan][2][isect] = 1 + TMath::Nint((clengthI - 2. * kCcthick) + fRowMax[iplan][2][isect] = 1 + TMath::Nint((clengthI - 2. * fgkCcthick) / fRowPadSize - 0.5); - fRowMax[iplan][3][isect] = 1 + TMath::Nint((clengthM - 2. * kCcthick) + fRowMax[iplan][3][isect] = 1 + TMath::Nint((clengthM - 2. * fgkCcthick) / fRowPadSize - 0.5); - fRowMax[iplan][4][isect] = 1 + TMath::Nint((clengthO - 2. * kCcthick) + fRowMax[iplan][4][isect] = 1 + TMath::Nint((clengthO - 2. * fgkCcthick) / fRowPadSize - 0.5); - fRow0[iplan][0][isect] = -clengthI/2. - clengthM - clengthO + kCcthick; - fRow0[iplan][1][isect] = -clengthI/2. - clengthM + kCcthick; - fRow0[iplan][2][isect] = -clengthI/2. + kCcthick; - fRow0[iplan][3][isect] = clengthI/2. + kCcthick; - fRow0[iplan][4][isect] = clengthI/2. + clengthM + kCcthick; + fRow0[iplan][0][isect] = -clengthI/2. - clengthM - clengthO + fgkCcthick; + fRow0[iplan][1][isect] = -clengthI/2. - clengthM + fgkCcthick; + fRow0[iplan][2][isect] = -clengthI/2. + fgkCcthick; + fRow0[iplan][3][isect] = clengthI/2. + fgkCcthick; + fRow0[iplan][4][isect] = clengthI/2. + clengthM + fgkCcthick; } } @@ -190,6 +219,7 @@ void AliTRDgeometryFull::CreateGeometry(Int_t *idtmed) const Int_t kNparTrd = 4; const Int_t kNparCha = 3; + const Int_t kNplan = fgkNplan; Float_t parTrd[kNparTrd]; Float_t parCha[kNparCha]; @@ -199,12 +229,12 @@ void AliTRDgeometryFull::CreateGeometry(Int_t *idtmed) AliTRDgeometry::CreateGeometry(idtmed); // The TRD mother volume for one sector (Air), full length in z-direction - parTrd[0] = kSwidth1/2.; - parTrd[1] = kSwidth2/2.; - parTrd[2] = kSlenTR1/2.; - parTrd[3] = kSheight/2.; + parTrd[0] = fgkSwidth1/2.; + parTrd[1] = fgkSwidth2/2.; + parTrd[2] = fgkSlenTR1/2.; + parTrd[3] = fgkSheight/2.; gMC->Gsvolu("TRD1","TRD1",idtmed[1302-1],parTrd,kNparTrd); - + // The TRD mother volume for one sector (Air), leaving hole for PHOS if (fPHOShole) { gMC->Gsvolu("TRD2","TRD1",idtmed[1302-1],parTrd,kNparTrd); @@ -226,37 +256,37 @@ void AliTRDgeometryFull::CreateGeometry(Int_t *idtmed) // the aluminum frame parCha[0] = fCwidth[iplan-1]/2.; parCha[1] = fClengthI[iplan-1]/2.; - parCha[2] = kCaframe/2.; + parCha[2] = fgkCaframe/2.; xpos = 0.; ypos = 0.; - zpos = kCheight - kCaframe/2. - kSheight/2. + (iplan-1) * (kCheight + kCspace); + zpos = fgkCheight - fgkCaframe/2. - fgkSheight/2. + (iplan-1) * (fgkCheight + fgkCspace); gMC->Gsposp("UAFI",iplan ,"TRD1",xpos,ypos,zpos,0,"MANY",parCha,kNparCha); // the inner part of the aluminum frame - parCha[0] = fCwidth[iplan-1]/2. - kCathick; - parCha[1] = fClengthI[iplan-1]/2. - kCathick; - parCha[2] = kCaframe/2.; + parCha[0] = fCwidth[iplan-1]/2. - fgkCathick; + parCha[1] = fClengthI[iplan-1]/2. - fgkCathick; + parCha[2] = fgkCaframe/2.; xpos = 0.; ypos = 0.; - zpos = kCheight - kCaframe/2. - kSheight/2. + (iplan-1) * (kCheight + kCspace); + zpos = fgkCheight - fgkCaframe/2. - fgkSheight/2. + (iplan-1) * (fgkCheight + fgkCspace); gMC->Gsposp("UAII",iplan ,"TRD1",xpos,ypos,zpos,0,"ONLY",parCha,kNparCha); // the carbon frame parCha[0] = fCwidth[iplan-1]/2.; parCha[1] = fClengthI[iplan-1]/2.; - parCha[2] = kCcframe/2.; + parCha[2] = fgkCcframe/2.; xpos = 0.; ypos = 0.; - zpos = kCcframe/2. - kSheight/2. + (iplan-1) * (kCheight + kCspace); + zpos = fgkCcframe/2. - fgkSheight/2. + (iplan-1) * (fgkCheight + fgkCspace); gMC->Gsposp("UCFI",iplan ,"TRD1",xpos,ypos,zpos,0,"MANY",parCha,kNparCha); // the inner part of the carbon frame - parCha[0] = fCwidth[iplan-1]/2. - kCcthick; - parCha[1] = fClengthI[iplan-1]/2. - kCcthick; - parCha[2] = kCcframe/2.; + parCha[0] = fCwidth[iplan-1]/2. - fgkCcthick; + parCha[1] = fClengthI[iplan-1]/2. - fgkCcthick; + parCha[2] = fgkCcframe/2.; xpos = 0.; ypos = 0.; - zpos = kCcframe/2. - kSheight/2. + (iplan-1) * (kCheight + kCspace); + zpos = fgkCcframe/2. - fgkSheight/2. + (iplan-1) * (fgkCheight + fgkCspace); gMC->Gsposp("UCII",iplan ,"TRD1",xpos,ypos,zpos,0,"ONLY",parCha,kNparCha); // The middle chambers -------------------------------------------------------------- @@ -264,39 +294,39 @@ void AliTRDgeometryFull::CreateGeometry(Int_t *idtmed) // the aluminum frame parCha[0] = fCwidth[iplan-1]/2.; parCha[1] = fClengthM1[iplan-1]/2.; - parCha[2] = kCaframe/2.; + parCha[2] = fgkCaframe/2.; xpos = 0.; ypos = fClengthI[iplan-1]/2. + fClengthM1[iplan-1]/2.; - zpos = kCheight - kCaframe/2. - kSheight/2. + (iplan-1) * (kCheight + kCspace); + zpos = fgkCheight - fgkCaframe/2. - fgkSheight/2. + (iplan-1) * (fgkCheight + fgkCspace); gMC->Gsposp("UAFM",iplan ,"TRD1",xpos, ypos,zpos,0,"MANY",parCha,kNparCha); - gMC->Gsposp("UAFM",iplan+ kNplan,"TRD1",xpos,-ypos,zpos,0,"MANY",parCha,kNparCha); + gMC->Gsposp("UAFM",iplan+ fgkNplan,"TRD1",xpos,-ypos,zpos,0,"MANY",parCha,kNparCha); if (fPHOShole) { parCha[0] = fCwidth[iplan-1]/2.; parCha[1] = fClengthM2[iplan-1]/2.; - parCha[2] = kCaframe/2.; + parCha[2] = fgkCaframe/2.; xpos = 0.; ypos = fClengthI[iplan-1]/2. + fClengthM2[iplan-1]/2. + y1; - zpos = kCheight - kCaframe/2. - kSheight/2. + (iplan-1) * (kCheight + kCspace); + zpos = fgkCheight - fgkCaframe/2. - fgkSheight/2. + (iplan-1) * (fgkCheight + fgkCspace); gMC->Gsposp("UAFM",iplan+2*kNplan,"TRD2",xpos, ypos,zpos,0,"MANY",parCha,kNparCha); gMC->Gsposp("UAFM",iplan+3*kNplan,"TRD2",xpos,-ypos,zpos,0,"MANY",parCha,kNparCha); } // the inner part of the aluminum frame - parCha[0] = fCwidth[iplan-1]/2. - kCathick; - parCha[1] = fClengthM1[iplan-1]/2. - kCathick; - parCha[2] = kCaframe/2.; + parCha[0] = fCwidth[iplan-1]/2. - fgkCathick; + parCha[1] = fClengthM1[iplan-1]/2. - fgkCathick; + parCha[2] = fgkCaframe/2.; xpos = 0.; ypos = fClengthI[iplan-1]/2. + fClengthM1[iplan-1]/2.; - zpos = kCheight - kCaframe/2. - kSheight/2. + (iplan-1) * (kCheight + kCspace); + zpos = fgkCheight - fgkCaframe/2. - fgkSheight/2. + (iplan-1) * (fgkCheight + fgkCspace); gMC->Gsposp("UAIM",iplan ,"TRD1",xpos, ypos,zpos,0,"ONLY",parCha,kNparCha); - gMC->Gsposp("UAIM",iplan+ kNplan,"TRD1",xpos,-ypos,zpos,0,"ONLY",parCha,kNparCha); + gMC->Gsposp("UAIM",iplan+ fgkNplan,"TRD1",xpos,-ypos,zpos,0,"ONLY",parCha,kNparCha); if (fPHOShole) { - parCha[0] = fCwidth[iplan-1]/2. - kCathick; - parCha[1] = fClengthM2[iplan-1]/2. - kCathick; - parCha[2] = kCaframe/2.; + parCha[0] = fCwidth[iplan-1]/2. - fgkCathick; + parCha[1] = fClengthM2[iplan-1]/2. - fgkCathick; + parCha[2] = fgkCaframe/2.; xpos = 0.; ypos = fClengthI[iplan-1]/2. + fClengthM2[iplan-1]/2. + y1; - zpos = kCheight - kCaframe/2. - kSheight/2. + (iplan-1) * (kCheight + kCspace); + zpos = fgkCheight - fgkCaframe/2. - fgkSheight/2. + (iplan-1) * (fgkCheight + fgkCspace); gMC->Gsposp("UAIM",iplan+2*kNplan,"TRD2",xpos, ypos,zpos,0,"ONLY",parCha,kNparCha); gMC->Gsposp("UAIM",iplan+3*kNplan,"TRD2",xpos,-ypos,zpos,0,"ONLY",parCha,kNparCha); } @@ -304,39 +334,39 @@ void AliTRDgeometryFull::CreateGeometry(Int_t *idtmed) // the carbon frame parCha[0] = fCwidth[iplan-1]/2.; parCha[1] = fClengthM1[iplan-1]/2.; - parCha[2] = kCcframe/2.; + parCha[2] = fgkCcframe/2.; xpos = 0.; ypos = fClengthI[iplan-1]/2. + fClengthM1[iplan-1]/2.; - zpos = kCcframe/2. - kSheight/2. + (iplan-1) * (kCheight + kCspace); + zpos = fgkCcframe/2. - fgkSheight/2. + (iplan-1) * (fgkCheight + fgkCspace); gMC->Gsposp("UCFM",iplan ,"TRD1",xpos, ypos,zpos,0,"MANY",parCha,kNparCha); gMC->Gsposp("UCFM",iplan+ kNplan,"TRD1",xpos,-ypos,zpos,0,"MANY",parCha,kNparCha); if (fPHOShole) { parCha[0] = fCwidth[iplan-1]/2.; parCha[1] = fClengthM2[iplan-1]/2.; - parCha[2] = kCcframe/2.; + parCha[2] = fgkCcframe/2.; xpos = 0.; ypos = fClengthI[iplan-1]/2. + fClengthM2[iplan-1]/2. + y1; - zpos = kCcframe/2. - kSheight/2. + (iplan-1) * (kCheight + kCspace); + zpos = fgkCcframe/2. - fgkSheight/2. + (iplan-1) * (fgkCheight + fgkCspace); gMC->Gsposp("UCFM",iplan+2*kNplan,"TRD2",xpos, ypos,zpos,0,"MANY",parCha,kNparCha); gMC->Gsposp("UCFM",iplan+3*kNplan,"TRD2",xpos,-ypos,zpos,0,"MANY",parCha,kNparCha); } // the inner part of the carbon frame - parCha[0] = fCwidth[iplan-1]/2. - kCcthick; - parCha[1] = fClengthM1[iplan-1]/2. - kCcthick; - parCha[2] = kCcframe/2.; + parCha[0] = fCwidth[iplan-1]/2. - fgkCcthick; + parCha[1] = fClengthM1[iplan-1]/2. - fgkCcthick; + parCha[2] = fgkCcframe/2.; xpos = 0.; ypos = fClengthI[iplan-1]/2. + fClengthM1[iplan-1]/2.; - zpos = kCcframe/2. - kSheight/2. + (iplan-1) * (kCheight + kCspace); + zpos = fgkCcframe/2. - fgkSheight/2. + (iplan-1) * (fgkCheight + fgkCspace); gMC->Gsposp("UCIM",iplan ,"TRD1",xpos, ypos,zpos,0,"ONLY",parCha,kNparCha); gMC->Gsposp("UCIM",iplan+ kNplan,"TRD1",xpos,-ypos,zpos,0,"ONLY",parCha,kNparCha); if (fPHOShole) { - parCha[0] = fCwidth[iplan-1]/2. - kCcthick; - parCha[1] = fClengthM2[iplan-1]/2. - kCcthick; - parCha[2] = kCcframe/2.; + parCha[0] = fCwidth[iplan-1]/2. - fgkCcthick; + parCha[1] = fClengthM2[iplan-1]/2. - fgkCcthick; + parCha[2] = fgkCcframe/2.; xpos = 0.; ypos = fClengthI[iplan-1]/2. + fClengthM2[iplan-1]/2. + y1; - zpos = kCcframe/2. - kSheight/2. + (iplan-1) * (kCheight + kCspace); + zpos = fgkCcframe/2. - fgkSheight/2. + (iplan-1) * (fgkCheight + fgkCspace); gMC->Gsposp("UCIM",iplan+2*kNplan,"TRD2",xpos, ypos,zpos,0,"ONLY",parCha,kNparCha); gMC->Gsposp("UCIM",iplan+3*kNplan,"TRD2",xpos,-ypos,zpos,0,"ONLY",parCha,kNparCha); } @@ -346,59 +376,59 @@ void AliTRDgeometryFull::CreateGeometry(Int_t *idtmed) // the aluminum frame parCha[0] = fCwidth[iplan-1]/2.; parCha[1] = fClengthO1[iplan-1]/2.; - parCha[2] = kCaframe/2.; + parCha[2] = fgkCaframe/2.; xpos = 0.; ypos = fClengthI[iplan-1]/2. + fClengthM1[iplan-1] + fClengthO1[iplan-1]/2.; - zpos = kCheight - kCaframe/2. - kSheight/2. + (iplan-1) * (kCheight + kCspace); + zpos = fgkCheight - fgkCaframe/2. - fgkSheight/2. + (iplan-1) * (fgkCheight + fgkCspace); gMC->Gsposp("UAFO",iplan ,"TRD1",xpos, ypos,zpos,0,"MANY",parCha,kNparCha); gMC->Gsposp("UAFO",iplan+ kNplan,"TRD1",xpos,-ypos,zpos,0,"MANY",parCha,kNparCha); if (fPHOShole) { parCha[0] = fCwidth[iplan-1]/2.; parCha[1] = fClengthO2[iplan-1]/2.; - parCha[2] = kCaframe/2.; + parCha[2] = fgkCaframe/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); + zpos = fgkCheight - fgkCaframe/2. - fgkSheight/2. + (iplan-1) * (fgkCheight + fgkCspace); gMC->Gsposp("UAFO",iplan+2*kNplan,"TRD2",xpos, ypos,zpos,0,"MANY",parCha,kNparCha); gMC->Gsposp("UAFO",iplan+3*kNplan,"TRD2",xpos,-ypos,zpos,0,"MANY",parCha,kNparCha); } if (fRICHhole) { parCha[0] = fCwidth[iplan-1]/2.; parCha[1] = fClengthO3[iplan-1]/2.; - parCha[2] = kCaframe/2.; + parCha[2] = fgkCaframe/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); + zpos = fgkCheight - fgkCaframe/2. - fgkSheight/2. + (iplan-1) * (fgkCheight + fgkCspace); gMC->Gsposp("UAFO",iplan+4*kNplan,"TRD3",xpos, ypos,zpos,0,"MANY",parCha,kNparCha); gMC->Gsposp("UAFO",iplan+5*kNplan,"TRD3",xpos,-ypos,zpos,0,"MANY",parCha,kNparCha); } // the inner part of the aluminum frame - parCha[0] = fCwidth[iplan-1]/2. - kCathick; - parCha[1] = fClengthO1[iplan-1]/2. - kCathick; - parCha[2] = kCaframe/2.; + parCha[0] = fCwidth[iplan-1]/2. - fgkCathick; + parCha[1] = fClengthO1[iplan-1]/2. - fgkCathick; + parCha[2] = fgkCaframe/2.; xpos = 0.; ypos = fClengthI[iplan-1]/2. + fClengthM1[iplan-1] + fClengthO1[iplan-1]/2.; - zpos = kCheight - kCaframe/2. - kSheight/2. + (iplan-1) * (kCheight + kCspace); + zpos = fgkCheight - fgkCaframe/2. - fgkSheight/2. + (iplan-1) * (fgkCheight + fgkCspace); gMC->Gsposp("UAIO",iplan ,"TRD1",xpos, ypos,zpos,0,"ONLY",parCha,kNparCha); gMC->Gsposp("UAIO",iplan+ kNplan,"TRD1",xpos,-ypos,zpos,0,"ONLY",parCha,kNparCha); if (fPHOShole) { - parCha[0] = fCwidth[iplan-1]/2. - kCathick; - parCha[1] = fClengthO2[iplan-1]/2. - kCathick; - parCha[2] = kCaframe/2.; + parCha[0] = fCwidth[iplan-1]/2. - fgkCathick; + parCha[1] = fClengthO2[iplan-1]/2. - fgkCathick; + parCha[2] = fgkCaframe/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); + zpos = fgkCheight - fgkCaframe/2. - fgkSheight/2. + (iplan-1) * (fgkCheight + fgkCspace); gMC->Gsposp("UAIO",iplan+2*kNplan,"TRD2",xpos, ypos,zpos,0,"ONLY",parCha,kNparCha); gMC->Gsposp("UAIO",iplan+3*kNplan,"TRD2",xpos,-ypos,zpos,0,"ONLY",parCha,kNparCha); } if (fRICHhole) { - parCha[0] = fCwidth[iplan-1]/2. - kCathick; - parCha[1] = fClengthO3[iplan-1]/2. - kCathick; - parCha[2] = kCaframe/2.; + parCha[0] = fCwidth[iplan-1]/2. - fgkCathick; + parCha[1] = fClengthO3[iplan-1]/2. - fgkCathick; + parCha[2] = fgkCaframe/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); + zpos = fgkCheight - fgkCaframe/2. - fgkSheight/2. + (iplan-1) * (fgkCheight + fgkCspace); gMC->Gsposp("UAIO",iplan+4*kNplan,"TRD3",xpos, ypos,zpos,0,"ONLY",parCha,kNparCha); gMC->Gsposp("UAIO",iplan+5*kNplan,"TRD3",xpos,-ypos,zpos,0,"ONLY",parCha,kNparCha); } @@ -406,68 +436,68 @@ void AliTRDgeometryFull::CreateGeometry(Int_t *idtmed) // the carbon frame parCha[0] = fCwidth[iplan-1]/2.; parCha[1] = fClengthO1[iplan-1]/2.; - parCha[2] = kCcframe/2.; + parCha[2] = fgkCcframe/2.; xpos = 0.; ypos = fClengthI[iplan-1]/2. + fClengthM1[iplan-1] + fClengthO1[iplan-1]/2.; - zpos = kCcframe/2. - kSheight/2. + (iplan-1) * (kCheight + kCspace); + zpos = fgkCcframe/2. - fgkSheight/2. + (iplan-1) * (fgkCheight + fgkCspace); gMC->Gsposp("UCFO",iplan, "TRD1",xpos, ypos,zpos,0,"MANY",parCha,kNparCha); gMC->Gsposp("UCFO",iplan+ kNplan,"TRD1",xpos,-ypos,zpos,0,"MANY",parCha,kNparCha); if (fPHOShole) { parCha[0] = fCwidth[iplan-1]/2.; parCha[1] = fClengthO2[iplan-1]/2.; - parCha[2] = kCcframe/2.; + parCha[2] = fgkCcframe/2.; xpos = 0.; ypos = fClengthI[iplan-1]/2. + fClengthM1[iplan-1] + fClengthO2[iplan-1]/2.; - zpos = kCcframe/2. - kSheight/2. + (iplan-1) * (kCheight + kCspace); + zpos = fgkCcframe/2. - fgkSheight/2. + (iplan-1) * (fgkCheight + fgkCspace); gMC->Gsposp("UCFO",iplan+2*kNplan,"TRD2",xpos, ypos,zpos,0,"MANY",parCha,kNparCha); gMC->Gsposp("UCFO",iplan+3*kNplan,"TRD2",xpos,-ypos,zpos,0,"MANY",parCha,kNparCha); } if (fRICHhole) { parCha[0] = fCwidth[iplan-1]/2.; parCha[1] = fClengthO3[iplan-1]/2.; - parCha[2] = kCcframe/2.; + parCha[2] = fgkCcframe/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); + zpos = fgkCcframe/2. - fgkSheight/2. + (iplan-1) * (fgkCheight + fgkCspace); gMC->Gsposp("UCFO",iplan+4*kNplan,"TRD3",xpos, ypos,zpos,0,"MANY",parCha,kNparCha); gMC->Gsposp("UCFO",iplan+5*kNplan,"TRD3",xpos,-ypos,zpos,0,"MANY",parCha,kNparCha); } // the inner part of the carbon frame - parCha[0] = fCwidth[iplan-1]/2. - kCcthick; - parCha[1] = fClengthO1[iplan-1]/2. - kCcthick; - parCha[2] = kCcframe/2.; + parCha[0] = fCwidth[iplan-1]/2. - fgkCcthick; + parCha[1] = fClengthO1[iplan-1]/2. - fgkCcthick; + parCha[2] = fgkCcframe/2.; xpos = 0.; ypos = fClengthI[iplan-1]/2. + fClengthM1[iplan-1] + fClengthO1[iplan-1]/2.; - zpos = kCcframe/2. - kSheight/2. + (iplan-1) * (kCheight + kCspace); + zpos = fgkCcframe/2. - fgkSheight/2. + (iplan-1) * (fgkCheight + fgkCspace); gMC->Gsposp("UCIO",iplan ,"TRD1",xpos, ypos,zpos,0,"ONLY",parCha,kNparCha); gMC->Gsposp("UCIO",iplan+ kNplan,"TRD1",xpos,-ypos,zpos,0,"ONLY",parCha,kNparCha); if (fPHOShole) { - parCha[0] = fCwidth[iplan-1]/2. - kCcthick; - parCha[1] = fClengthO2[iplan-1]/2. - kCcthick; - parCha[2] = kCcframe/2.; + parCha[0] = fCwidth[iplan-1]/2. - fgkCcthick; + parCha[1] = fClengthO2[iplan-1]/2. - fgkCcthick; + parCha[2] = fgkCcframe/2.; xpos = 0.; ypos = fClengthI[iplan-1]/2. + fClengthM1[iplan-1] + fClengthO2[iplan-1]/2.; - zpos = kCcframe/2. - kSheight/2. + (iplan-1) * (kCheight + kCspace); + zpos = fgkCcframe/2. - fgkSheight/2. + (iplan-1) * (fgkCheight + fgkCspace); gMC->Gsposp("UCIO",iplan+2*kNplan,"TRD2",xpos, ypos,zpos,0,"ONLY",parCha,kNparCha); gMC->Gsposp("UCIO",iplan+3*kNplan,"TRD2",xpos,-ypos,zpos,0,"ONLY",parCha,kNparCha); } if (fRICHhole) { - parCha[0] = fCwidth[iplan-1]/2. - kCcthick; - parCha[1] = fClengthO3[iplan-1]/2. - kCcthick; - parCha[2] = kCcframe/2.; + parCha[0] = fCwidth[iplan-1]/2. - fgkCcthick; + parCha[1] = fClengthO3[iplan-1]/2. - fgkCcthick; + parCha[2] = fgkCcframe/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); + zpos = fgkCcframe/2. - fgkSheight/2. + (iplan-1) * (fgkCheight + fgkCspace); gMC->Gsposp("UCIO",iplan+4*kNplan,"TRD3",xpos, ypos,zpos,0,"ONLY",parCha,kNparCha); gMC->Gsposp("UCIO",iplan+5*kNplan,"TRD3",xpos,-ypos,zpos,0,"ONLY",parCha,kNparCha); } } - xpos = 0.; - ypos = 0.; - zpos = 0.; + xpos = 0.; + ypos = 0.; + zpos = 0.; gMC->Gspos("TRD1",1,"BTR1",xpos,ypos,zpos,0,"ONLY"); if (fPHOShole) gMC->Gspos("TRD2",2,"BTR2",xpos,ypos,zpos,0,"ONLY"); diff --git a/TRD/AliTRDgeometryFull.h b/TRD/AliTRDgeometryFull.h index cdb85b7311f..77709bba40d 100644 --- a/TRD/AliTRDgeometryFull.h +++ b/TRD/AliTRDgeometryFull.h @@ -12,17 +12,19 @@ class AliTRDgeometryFull : public AliTRDgeometry { public: AliTRDgeometryFull(); - ~AliTRDgeometryFull(); + virtual ~AliTRDgeometryFull(); void CreateGeometry(Int_t *idtmed); - Int_t IsVersion() const { return 1; }; + Int_t IsVersion() const { return 1; }; void Init(); - void SetPHOShole() { fPHOShole = kTRUE; }; - void SetRICHhole() { fRICHhole = kTRUE; }; + void SetPHOShole() { fPHOShole = kTRUE; }; + void SetRICHhole() { fRICHhole = kTRUE; }; - Bool_t GetPHOShole() { return fPHOShole; }; - Bool_t GetRICHhole() { return fRICHhole; }; + virtual void SetRowPadSize(Float_t size); + + Bool_t GetPHOShole() const { return fPHOShole; }; + Bool_t GetRICHhole() const { return fRICHhole; }; protected: diff --git a/TRD/AliTRDgeometryHole.cxx b/TRD/AliTRDgeometryHole.cxx index 366b80721df..83760496eef 100644 --- a/TRD/AliTRDgeometryHole.cxx +++ b/TRD/AliTRDgeometryHole.cxx @@ -15,6 +15,21 @@ /* $Log$ +Revision 1.1.4.4 2000/10/15 23:40:01 cblume +Remove AliTRDconst + +Revision 1.1.4.3 2000/10/06 16:49:46 cblume +Made Getters const + +Revision 1.1.4.2 2000/10/04 16:34:58 cblume +Replace include files by forward declarations + +Revision 1.1.4.1 2000/09/22 14:43:41 cblume +Allow the pad/timebin-dimensions to be changed after initialization + +Revision 1.3 2000/10/02 21:28:19 fca +Removal of useless dependecies via forward declarations + Revision 1.2 2000/06/08 18:32:58 cblume Make code compliant to coding conventions @@ -29,9 +44,10 @@ Add new TRD classes // // /////////////////////////////////////////////////////////////////////////////// -#include "AliTRDgeometryHole.h" #include "AliMC.h" +#include "AliTRDgeometryHole.h" + ClassImp(AliTRDgeometryHole) //_____________________________________________________________________________ @@ -64,7 +80,7 @@ void AliTRDgeometryHole::Init() Int_t iplan; // The length of the inner chambers - for (iplan = 0; iplan < kNplan; iplan++) + for (iplan = 0; iplan < fgkNplan; iplan++) fClengthI[iplan] = 110.0; // The length of the middle chambers @@ -125,9 +141,22 @@ void AliTRDgeometryHole::Init() // // The pad row (z-direction) - for (iplan = 0; iplan < kNplan; iplan++) { + SetRowPadSize(4.5); + +} - for (Int_t isect = 0; isect < kNsect; isect++) { +//_____________________________________________________________________________ +void AliTRDgeometryHole::SetRowPadSize(Float_t size) +{ + // + // Redefines the pad size in row direction + // + + fRowPadSize = size; + + for (Int_t iplan = 0; iplan < fgkNplan; iplan++) { + + for (Int_t isect = 0; isect < fgkNsect; isect++) { Float_t clengthI = fClengthI[iplan]; Float_t clengthM = fClengthM1[iplan]; Float_t clengthO = fClengthO1[iplan]; @@ -146,21 +175,21 @@ void AliTRDgeometryHole::Init() clengthO = fClengthO3[iplan]; break; }; - fRowMax[iplan][0][isect] = 1 + TMath::Nint((clengthO - 2. * kCcthick) + fRowMax[iplan][0][isect] = 1 + TMath::Nint((clengthO - 2. * fgkCcthick) / fRowPadSize - 0.5); - fRowMax[iplan][1][isect] = 1 + TMath::Nint((clengthM - 2. * kCcthick) + fRowMax[iplan][1][isect] = 1 + TMath::Nint((clengthM - 2. * fgkCcthick) / fRowPadSize - 0.5); - fRowMax[iplan][2][isect] = 1 + TMath::Nint((clengthI - 2. * kCcthick) + fRowMax[iplan][2][isect] = 1 + TMath::Nint((clengthI - 2. * fgkCcthick) / fRowPadSize - 0.5); - fRowMax[iplan][3][isect] = 1 + TMath::Nint((clengthM - 2. * kCcthick) + fRowMax[iplan][3][isect] = 1 + TMath::Nint((clengthM - 2. * fgkCcthick) / fRowPadSize - 0.5); - fRowMax[iplan][4][isect] = 1 + TMath::Nint((clengthO - 2. * kCcthick) + fRowMax[iplan][4][isect] = 1 + TMath::Nint((clengthO - 2. * fgkCcthick) / fRowPadSize - 0.5); - fRow0[iplan][0][isect] = -clengthI/2. - clengthM - clengthO + kCcthick; - fRow0[iplan][1][isect] = -clengthI/2. - clengthM + kCcthick; - fRow0[iplan][2][isect] = -clengthI/2. + kCcthick; - fRow0[iplan][3][isect] = clengthI/2. + kCcthick; - fRow0[iplan][4][isect] = clengthI/2. + clengthM + kCcthick; + fRow0[iplan][0][isect] = -clengthI/2. - clengthM - clengthO + fgkCcthick; + fRow0[iplan][1][isect] = -clengthI/2. - clengthM + fgkCcthick; + fRow0[iplan][2][isect] = -clengthI/2. + fgkCcthick; + fRow0[iplan][3][isect] = clengthI/2. + fgkCcthick; + fRow0[iplan][4][isect] = clengthI/2. + clengthM + fgkCcthick; } } @@ -178,6 +207,7 @@ void AliTRDgeometryHole::CreateGeometry(Int_t *idtmed) const Int_t kNparTrd = 4; const Int_t kNparCha = 3; + const Int_t kNplan = fgkNplan; Float_t parTrd[kNparTrd]; Float_t parCha[kNparCha]; @@ -187,24 +217,24 @@ void AliTRDgeometryHole::CreateGeometry(Int_t *idtmed) AliTRDgeometry::CreateGeometry(idtmed); // The TRD mother volume for one sector (Air) (dimensions identical to BTR1) - parTrd[0] = kSwidth1/2.; - parTrd[1] = kSwidth2/2.; - parTrd[2] = kSlenTR1/2.; - parTrd[3] = kSheight/2.; + parTrd[0] = fgkSwidth1/2.; + parTrd[1] = fgkSwidth2/2.; + parTrd[2] = fgkSlenTR1/2.; + parTrd[3] = fgkSheight/2.; gMC->Gsvolu("TRD1","TRD1",idtmed[1302-1],parTrd,kNparTrd); // The TRD mother volume for one sector (Air) (dimensions identical to BTR2) - parTrd[0] = kSwidth1/2.; - parTrd[1] = kSwidth2/2.; - parTrd[2] = kSlenTR2/2.; - parTrd[3] = kSheight/2.; + parTrd[0] = fgkSwidth1/2.; + parTrd[1] = fgkSwidth2/2.; + parTrd[2] = fgkSlenTR2/2.; + parTrd[3] = fgkSheight/2.; gMC->Gsvolu("TRD2","TRD1",idtmed[1302-1],parTrd,kNparTrd); // The TRD mother volume for one sector (Air) (dimensions identical to BTR3) - parTrd[0] = kSwidth1/2.; - parTrd[1] = kSwidth2/2.; - parTrd[2] = kSlenTR3/2.; - parTrd[3] = kSheight/2.; + parTrd[0] = fgkSwidth1/2.; + parTrd[1] = fgkSwidth2/2.; + parTrd[2] = fgkSlenTR3/2.; + parTrd[3] = fgkSheight/2.; gMC->Gsvolu("TRD3","TRD1",idtmed[1302-1],parTrd,kNparTrd); // Position the chambers in the TRD mother volume @@ -215,37 +245,37 @@ void AliTRDgeometryHole::CreateGeometry(Int_t *idtmed) // the aluminum frame parCha[0] = fCwidth[iplan-1]/2.; parCha[1] = fClengthI[iplan-1]/2.; - parCha[2] = kCaframe/2.; + parCha[2] = fgkCaframe/2.; xpos = 0.; ypos = 0.; - zpos = kCheight - kCaframe/2. - kSheight/2. + (iplan-1) * (kCheight + kCspace); + zpos = fgkCheight - fgkCaframe/2. - fgkSheight/2. + (iplan-1) * (fgkCheight + fgkCspace); gMC->Gsposp("UAFI",iplan ,"TRD1",xpos,ypos,zpos,0,"MANY",parCha,kNparCha); // the inner part of the aluminum frame - parCha[0] = fCwidth[iplan-1]/2. - kCathick; - parCha[1] = fClengthI[iplan-1]/2. - kCathick; - parCha[2] = kCaframe/2.; + parCha[0] = fCwidth[iplan-1]/2. - fgkCathick; + parCha[1] = fClengthI[iplan-1]/2. - fgkCathick; + parCha[2] = fgkCaframe/2.; xpos = 0.; ypos = 0.; - zpos = kCheight - kCaframe/2. - kSheight/2. + (iplan-1) * (kCheight + kCspace); + zpos = fgkCheight - fgkCaframe/2. - fgkSheight/2. + (iplan-1) * (fgkCheight + fgkCspace); gMC->Gsposp("UAII",iplan ,"TRD1",xpos,ypos,zpos,0,"ONLY",parCha,kNparCha); // the carbon frame parCha[0] = fCwidth[iplan-1]/2.; parCha[1] = fClengthI[iplan-1]/2.; - parCha[2] = kCcframe/2.; + parCha[2] = fgkCcframe/2.; xpos = 0.; ypos = 0.; - zpos = kCcframe/2. - kSheight/2. + (iplan-1) * (kCheight + kCspace); + zpos = fgkCcframe/2. - fgkSheight/2. + (iplan-1) * (fgkCheight + fgkCspace); gMC->Gsposp("UCFI",iplan ,"TRD1",xpos,ypos,zpos,0,"MANY",parCha,kNparCha); // the inner part of the carbon frame - parCha[0] = fCwidth[iplan-1]/2. - kCcthick; - parCha[1] = fClengthI[iplan-1]/2. - kCcthick; - parCha[2] = kCcframe/2.; + parCha[0] = fCwidth[iplan-1]/2. - fgkCcthick; + parCha[1] = fClengthI[iplan-1]/2. - fgkCcthick; + parCha[2] = fgkCcframe/2.; xpos = 0.; ypos = 0.; - zpos = kCcframe/2. - kSheight/2. + (iplan-1) * (kCheight + kCspace); + zpos = fgkCcframe/2. - fgkSheight/2. + (iplan-1) * (fgkCheight + fgkCspace); gMC->Gsposp("UCII",iplan ,"TRD1",xpos,ypos,zpos,0,"ONLY",parCha,kNparCha); // The middle chambers -------------------------------------------------------------- @@ -253,69 +283,69 @@ void AliTRDgeometryHole::CreateGeometry(Int_t *idtmed) // the aluminum frame parCha[0] = fCwidth[iplan-1]/2.; parCha[1] = fClengthM1[iplan-1]/2.; - parCha[2] = kCaframe/2.; + parCha[2] = fgkCaframe/2.; xpos = 0.; - ypos = fClengthI[iplan-1]/2. + fClengthM1[iplan-1]/2.; - zpos = kCheight - kCaframe/2. - kSheight/2. + (iplan-1) * (kCheight + kCspace); + ypos = fClengthI[iplan-1]/2.+ fClengthM1[iplan-1]/2.; + zpos = fgkCheight - fgkCaframe/2. - fgkSheight/2. + (iplan-1) * (fgkCheight + fgkCspace); gMC->Gsposp("UAFM",iplan ,"TRD1",xpos, ypos,zpos,0,"MANY",parCha,kNparCha); gMC->Gsposp("UAFM",iplan+ kNplan,"TRD1",xpos,-ypos,zpos,0,"MANY",parCha,kNparCha); parCha[0] = fCwidth[iplan-1]/2.; parCha[1] = fClengthM2[iplan-1]/2.; - parCha[2] = kCaframe/2.; + parCha[2] = fgkCaframe/2.; xpos = 0.; - ypos = fClengthM2[iplan-1]/2. - kSlenTR2/2.; - zpos = kCheight - kCaframe/2. - kSheight/2. + (iplan-1) * (kCheight + kCspace); + ypos = fClengthM2[iplan-1]/2. - fgkSlenTR2/2.; + zpos = fgkCheight - fgkCaframe/2. - fgkSheight/2. + (iplan-1) * (fgkCheight + fgkCspace); gMC->Gsposp("UAFM",iplan+2*kNplan,"TRD2",xpos, ypos,zpos,0,"MANY",parCha,kNparCha); // the inner part of the aluminum frame - parCha[0] = fCwidth[iplan-1]/2. - kCathick; - parCha[1] = fClengthM1[iplan-1]/2. - kCathick; - parCha[2] = kCaframe/2.; + parCha[0] = fCwidth[iplan-1]/2. - fgkCathick; + parCha[1] = fClengthM1[iplan-1]/2. - fgkCathick; + parCha[2] = fgkCaframe/2.; xpos = 0.; - ypos = fClengthI[iplan-1]/2. + fClengthM1[iplan-1]/2.; - zpos = kCheight - kCaframe/2. - kSheight/2. + (iplan-1) * (kCheight + kCspace); + ypos = fClengthI[iplan-1]/2. + fClengthM1[iplan-1]/2.; + zpos = fgkCheight - fgkCaframe/2. - fgkSheight/2. + (iplan-1) * (fgkCheight + fgkCspace); gMC->Gsposp("UAIM",iplan ,"TRD1",xpos, ypos,zpos,0,"ONLY",parCha,kNparCha); gMC->Gsposp("UAIM",iplan+ kNplan,"TRD1",xpos,-ypos,zpos,0,"ONLY",parCha,kNparCha); - parCha[0] = fCwidth[iplan-1]/2. - kCathick; - parCha[1] = fClengthM2[iplan-1]/2. - kCathick; - parCha[2] = kCaframe/2.; + parCha[0] = fCwidth[iplan-1]/2. - fgkCathick; + parCha[1] = fClengthM2[iplan-1]/2. - fgkCathick; + parCha[2] = fgkCaframe/2.; xpos = 0.; - ypos = fClengthM2[iplan-1]/2. - kSlenTR2/2.; - zpos = kCheight - kCaframe/2. - kSheight/2. + (iplan-1) * (kCheight + kCspace); + ypos = fClengthM2[iplan-1]/2. - fgkSlenTR2/2.; + zpos = fgkCheight - fgkCaframe/2. - fgkSheight/2. + (iplan-1) * (fgkCheight + fgkCspace); gMC->Gsposp("UAIM",iplan+2*kNplan,"TRD2",xpos, ypos,zpos,0,"ONLY",parCha,kNparCha); // the carbon frame parCha[0] = fCwidth[iplan-1]/2.; parCha[1] = fClengthM1[iplan-1]/2.; - parCha[2] = kCcframe/2.; + parCha[2] = fgkCcframe/2.; xpos = 0.; ypos = fClengthI[iplan-1]/2. + fClengthM1[iplan-1]/2.; - zpos = kCcframe/2. - kSheight/2. + (iplan-1) * (kCheight + kCspace); + zpos = fgkCcframe/2. - fgkSheight/2. + (iplan-1) * (fgkCheight + fgkCspace); gMC->Gsposp("UCFM",iplan ,"TRD1",xpos, ypos,zpos,0,"MANY",parCha,kNparCha); gMC->Gsposp("UCFM",iplan+ kNplan,"TRD1",xpos,-ypos,zpos,0,"MANY",parCha,kNparCha); parCha[0] = fCwidth[iplan-1]/2.; parCha[1] = fClengthM2[iplan-1]/2.; - parCha[2] = kCcframe/2.; + parCha[2] = fgkCcframe/2.; xpos = 0.; - ypos = fClengthM2[iplan-1]/2. - kSlenTR2/2.; - zpos = kCcframe/2. - kSheight/2. + (iplan-1) * (kCheight + kCspace); + ypos = fClengthM2[iplan-1]/2. - fgkSlenTR2/2.; + zpos = fgkCcframe/2. - fgkSheight/2. + (iplan-1) * (fgkCheight + fgkCspace); gMC->Gsposp("UCFM",iplan+2*kNplan,"TRD2",xpos, ypos,zpos,0,"MANY",parCha,kNparCha); // the inner part of the carbon frame - parCha[0] = fCwidth[iplan-1]/2. - kCcthick; - parCha[1] = fClengthM1[iplan-1]/2. - kCcthick; - parCha[2] = kCcframe/2.; + parCha[0] = fCwidth[iplan-1]/2. - fgkCcthick; + parCha[1] = fClengthM1[iplan-1]/2. - fgkCcthick; + parCha[2] = fgkCcframe/2.; xpos = 0.; ypos = fClengthI[iplan-1]/2. + fClengthM1[iplan-1]/2.; - zpos = kCcframe/2. - kSheight/2. + (iplan-1) * (kCheight + kCspace); + zpos = fgkCcframe/2. - fgkSheight/2. + (iplan-1) * (fgkCheight + fgkCspace); gMC->Gsposp("UCIM",iplan ,"TRD1",xpos, ypos,zpos,0,"ONLY",parCha,kNparCha); gMC->Gsposp("UCIM",iplan+ kNplan,"TRD1",xpos,-ypos,zpos,0,"ONLY",parCha,kNparCha); - parCha[0] = fCwidth[iplan-1]/2. - kCcthick; - parCha[1] = fClengthM2[iplan-1]/2. - kCcthick; - parCha[2] = kCcframe/2.; + parCha[0] = fCwidth[iplan-1]/2. - fgkCcthick; + parCha[1] = fClengthM2[iplan-1]/2. - fgkCcthick; + parCha[2] = fgkCcframe/2.; xpos = 0.; - ypos = fClengthM2[iplan-1]/2. - kSlenTR2/2.; - zpos = kCcframe/2. - kSheight/2. + (iplan-1) * (kCheight + kCspace); + ypos = fClengthM2[iplan-1]/2. - fgkSlenTR2/2.; + zpos = fgkCcframe/2. - fgkSheight/2. + (iplan-1) * (fgkCheight + fgkCspace); gMC->Gsposp("UCIM",iplan+2*kNplan,"TRD2",xpos, ypos,zpos,0,"ONLY",parCha,kNparCha); // The outer chambers --------------------------------------------------------------- @@ -323,97 +353,97 @@ void AliTRDgeometryHole::CreateGeometry(Int_t *idtmed) // the aluminum frame parCha[0] = fCwidth[iplan-1]/2.; parCha[1] = fClengthO1[iplan-1]/2.; - parCha[2] = kCaframe/2.; + parCha[2] = fgkCaframe/2.; xpos = 0.; ypos = fClengthI[iplan-1]/2. + fClengthM1[iplan-1] + fClengthO1[iplan-1]/2.; - zpos = kCheight - kCaframe/2. - kSheight/2. + (iplan-1) * (kCheight + kCspace); + zpos = fgkCheight - fgkCaframe/2. - fgkSheight/2. + (iplan-1) * (fgkCheight + fgkCspace); gMC->Gsposp("UAFO",iplan ,"TRD1",xpos, ypos,zpos,0,"MANY",parCha,kNparCha); gMC->Gsposp("UAFO",iplan+ kNplan,"TRD1",xpos,-ypos,zpos,0,"MANY",parCha,kNparCha); parCha[0] = fCwidth[iplan-1]/2.; parCha[1] = fClengthO2[iplan-1]/2.; - parCha[2] = kCaframe/2.; + parCha[2] = fgkCaframe/2.; xpos = 0.; - ypos = fClengthM2[iplan-1] + fClengthO2[iplan-1]/2. - kSlenTR2/2.; - zpos = kCheight - kCaframe/2. - kSheight/2. + (iplan-1) * (kCheight + kCspace); + ypos = fClengthM2[iplan-1] + fClengthO2[iplan-1]/2. - fgkSlenTR2/2.; + zpos = fgkCheight - fgkCaframe/2. - fgkSheight/2. + (iplan-1) * (fgkCheight + fgkCspace); gMC->Gsposp("UAFO",iplan+2*kNplan,"TRD2",xpos, ypos,zpos,0,"MANY",parCha,kNparCha); parCha[0] = fCwidth[iplan-1]/2.; parCha[1] = fClengthO3[iplan-1]/2.; - parCha[2] = kCaframe/2.; + parCha[2] = fgkCaframe/2.; xpos = 0.; - ypos = fClengthO3[iplan-1]/2. - kSlenTR3/2.; - zpos = kCheight - kCaframe/2. - kSheight/2. + (iplan-1) * (kCheight + kCspace); + ypos = fClengthO3[iplan-1]/2. - fgkSlenTR3/2.; + zpos = fgkCheight - fgkCaframe/2. - fgkSheight/2. + (iplan-1) * (fgkCheight + fgkCspace); gMC->Gsposp("UAFO",iplan+4*kNplan,"TRD3",xpos, ypos,zpos,0,"MANY",parCha,kNparCha); // the inner part of the aluminum frame - parCha[0] = fCwidth[iplan-1]/2. - kCathick; - parCha[1] = fClengthO1[iplan-1]/2. - kCathick; - parCha[2] = kCaframe/2.; + parCha[0] = fCwidth[iplan-1]/2. - fgkCathick; + parCha[1] = fClengthO1[iplan-1]/2. - fgkCathick; + parCha[2] = fgkCaframe/2.; xpos = 0.; ypos = fClengthI[iplan-1]/2. + fClengthM1[iplan-1] + fClengthO1[iplan-1]/2.; - zpos = kCheight - kCaframe/2. - kSheight/2. + (iplan-1) * (kCheight + kCspace); + zpos = fgkCheight - fgkCaframe/2. - fgkSheight/2. + (iplan-1) * (fgkCheight + fgkCspace); gMC->Gsposp("UAIO",iplan ,"TRD1",xpos, ypos,zpos,0,"ONLY",parCha,kNparCha); gMC->Gsposp("UAIO",iplan+ kNplan,"TRD1",xpos,-ypos,zpos,0,"ONLY",parCha,kNparCha); - parCha[0] = fCwidth[iplan-1]/2. - kCathick; - parCha[1] = fClengthO2[iplan-1]/2. - kCathick; - parCha[2] = kCaframe/2.; + parCha[0] = fCwidth[iplan-1]/2. - fgkCathick; + parCha[1] = fClengthO2[iplan-1]/2. - fgkCathick; + parCha[2] = fgkCaframe/2.; xpos = 0.; - ypos = fClengthM2[iplan-1] + fClengthO2[iplan-1]/2. - kSlenTR2/2.; - zpos = kCheight - kCaframe/2. - kSheight/2. + (iplan-1) * (kCheight + kCspace); + ypos = fClengthM2[iplan-1] + fClengthO2[iplan-1]/2. - fgkSlenTR2/2.; + zpos = fgkCheight - fgkCaframe/2. - fgkSheight/2. + (iplan-1) * (fgkCheight + fgkCspace); gMC->Gsposp("UAIO",iplan+2*kNplan,"TRD2",xpos, ypos,zpos,0,"ONLY",parCha,kNparCha); - parCha[0] = fCwidth[iplan-1]/2. - kCathick; - parCha[1] = fClengthO3[iplan-1]/2. - kCathick; - parCha[2] = kCaframe/2.; + parCha[0] = fCwidth[iplan-1]/2. - fgkCathick; + parCha[1] = fClengthO3[iplan-1]/2. - fgkCathick; + parCha[2] = fgkCaframe/2.; xpos = 0.; - ypos = fClengthO3[iplan-1]/2. - kSlenTR3/2.; - zpos = kCheight - kCaframe/2. - kSheight/2. + (iplan-1) * (kCheight + kCspace); + ypos = fClengthO3[iplan-1]/2. - fgkSlenTR3/2.; + zpos = fgkCheight - fgkCaframe/2. - fgkSheight/2. + (iplan-1) * (fgkCheight + fgkCspace); gMC->Gsposp("UAIO",iplan+4*kNplan,"TRD3",xpos, ypos,zpos,0,"ONLY",parCha,kNparCha); // the carbon frame parCha[0] = fCwidth[iplan-1]/2.; parCha[1] = fClengthO1[iplan-1]/2.; - parCha[2] = kCcframe/2.; + parCha[2] = fgkCcframe/2.; xpos = 0.; ypos = fClengthI[iplan-1]/2. + fClengthM1[iplan-1] + fClengthO1[iplan-1]/2.; - zpos = kCcframe/2. - kSheight/2. + (iplan-1) * (kCheight + kCspace); + zpos = fgkCcframe/2. - fgkSheight/2. + (iplan-1) * (fgkCheight + fgkCspace); gMC->Gsposp("UCFO",iplan, "TRD1",xpos, ypos,zpos,0,"MANY",parCha,kNparCha); gMC->Gsposp("UCFO",iplan+ kNplan,"TRD1",xpos,-ypos,zpos,0,"MANY",parCha,kNparCha); parCha[0] = fCwidth[iplan-1]/2.; parCha[1] = fClengthO2[iplan-1]/2.; - parCha[2] = kCcframe/2.; + parCha[2] = fgkCcframe/2.; xpos = 0.; - ypos = fClengthM2[iplan-1] + fClengthO2[iplan-1]/2. - kSlenTR2/2.; - zpos = kCcframe/2. - kSheight/2. + (iplan-1) * (kCheight + kCspace); + ypos = fClengthM2[iplan-1] + fClengthO2[iplan-1]/2. - fgkSlenTR2/2.; + zpos = fgkCcframe/2. - fgkSheight/2. + (iplan-1) * (fgkCheight + fgkCspace); gMC->Gsposp("UCFO",iplan+2*kNplan,"TRD2",xpos, ypos,zpos,0,"MANY",parCha,kNparCha); parCha[0] = fCwidth[iplan-1]/2.; parCha[1] = fClengthO3[iplan-1]/2.; - parCha[2] = kCcframe/2.; + parCha[2] = fgkCcframe/2.; xpos = 0.; - ypos = fClengthO3[iplan-1]/2. - kSlenTR3/2.; - zpos = kCcframe/2. - kSheight/2. + (iplan-1) * (kCheight + kCspace); + ypos = fClengthO3[iplan-1]/2. - fgkSlenTR3/2.; + zpos = fgkCcframe/2. - fgkSheight/2. + (iplan-1) * (fgkCheight + fgkCspace); gMC->Gsposp("UCFO",iplan+4*kNplan,"TRD3",xpos, ypos,zpos,0,"MANY",parCha,kNparCha); // the inner part of the carbon frame - parCha[0] = fCwidth[iplan-1]/2. - kCcthick; - parCha[1] = fClengthO1[iplan-1]/2. - kCcthick; - parCha[2] = kCcframe/2.; + parCha[0] = fCwidth[iplan-1]/2. - fgkCcthick; + parCha[1] = fClengthO1[iplan-1]/2. - fgkCcthick; + parCha[2] = fgkCcframe/2.; xpos = 0.; ypos = fClengthI[iplan-1]/2. + fClengthM1[iplan-1] + fClengthO1[iplan-1]/2.; - zpos = kCcframe/2. - kSheight/2. + (iplan-1) * (kCheight + kCspace); + zpos = fgkCcframe/2. - fgkSheight/2. + (iplan-1) * (fgkCheight + fgkCspace); gMC->Gsposp("UCIO",iplan ,"TRD1",xpos, ypos,zpos,0,"ONLY",parCha,kNparCha); gMC->Gsposp("UCIO",iplan+ kNplan,"TRD1",xpos,-ypos,zpos,0,"ONLY",parCha,kNparCha); - parCha[0] = fCwidth[iplan-1]/2. - kCcthick; - parCha[1] = fClengthO2[iplan-1]/2. - kCcthick; - parCha[2] = kCcframe/2.; + parCha[0] = fCwidth[iplan-1]/2. - fgkCcthick; + parCha[1] = fClengthO2[iplan-1]/2. - fgkCcthick; + parCha[2] = fgkCcframe/2.; xpos = 0.; - ypos = fClengthM2[iplan-1] + fClengthO2[iplan-1]/2. - kSlenTR2/2.; - zpos = kCcframe/2. - kSheight/2. + (iplan-1) * (kCheight + kCspace); + ypos = fClengthM2[iplan-1] + fClengthO2[iplan-1]/2. - fgkSlenTR2/2.; + zpos = fgkCcframe/2. - fgkSheight/2. + (iplan-1) * (fgkCheight + fgkCspace); gMC->Gsposp("UCIO",iplan+2*kNplan,"TRD2",xpos, ypos,zpos,0,"ONLY",parCha,kNparCha); - parCha[0] = fCwidth[iplan-1]/2. - kCcthick; - parCha[1] = fClengthO3[iplan-1]/2. - kCcthick; - parCha[2] = kCcframe/2.; + parCha[0] = fCwidth[iplan-1]/2. - fgkCcthick; + parCha[1] = fClengthO3[iplan-1]/2. - fgkCcthick; + parCha[2] = fgkCcframe/2.; xpos = 0.; - ypos = fClengthO3[iplan-1]/2. - kSlenTR3/2.; - zpos = kCcframe/2. - kSheight/2. + (iplan-1) * (kCheight + kCspace); + ypos = fClengthO3[iplan-1]/2. - fgkSlenTR3/2.; + zpos = fgkCcframe/2. - fgkSheight/2. + (iplan-1) * (fgkCheight + fgkCspace); gMC->Gsposp("UCIO",iplan+4*kNplan,"TRD3",xpos, ypos,zpos,0,"ONLY",parCha,kNparCha); } diff --git a/TRD/AliTRDgeometryHole.h b/TRD/AliTRDgeometryHole.h index 7fe4cedb6ae..dba38f2ccb9 100644 --- a/TRD/AliTRDgeometryHole.h +++ b/TRD/AliTRDgeometryHole.h @@ -15,14 +15,16 @@ class AliTRDgeometryHole : public AliTRDgeometry { virtual ~AliTRDgeometryHole(); void CreateGeometry(Int_t *idtmed); - Int_t IsVersion() const { return 0; }; + Int_t IsVersion() const { return 0; }; void Init(); - void SetPHOShole() { }; - void SetRICHhole() { }; + void SetPHOShole() { }; + void SetRICHhole() { }; - Bool_t GetPHOShole() { return kTRUE; }; - Bool_t GetRICHhole() { return kTRUE; }; + virtual void SetRowPadSize(Float_t size); + + Bool_t GetPHOShole() const { return kTRUE; }; + Bool_t GetRICHhole() const { return kTRUE; }; protected: diff --git a/TRD/AliTRDhit.cxx b/TRD/AliTRDhit.cxx index f1f77eaca28..41ef71a621a 100644 --- a/TRD/AliTRDhit.cxx +++ b/TRD/AliTRDhit.cxx @@ -15,6 +15,12 @@ /* $Log$ +Revision 1.1.2.2 2000/09/18 13:41:29 cblume +Changed fDetector to UShort and fQ to Short_t. Use customized streamer + +Revision 1.4 2000/06/08 18:32:58 cblume +Make code compliant to coding conventions + Revision 1.3 2000/06/07 16:25:37 cblume Try to remove compiler warnings on Sun and HP @@ -46,21 +52,24 @@ AliTRDhit::AliTRDhit():AliHit() } //_____________________________________________________________________________ -AliTRDhit::AliTRDhit(Int_t shunt, Int_t track, Int_t *det, Float_t *hits) +AliTRDhit::AliTRDhit(Int_t shunt, Int_t track, Int_t det + , Float_t *hits, Int_t q) :AliHit(shunt, track) { // // Create a TRD hit // - // Store volume hierarchy - fDetector = det[0]; + // Store detector number + fDetector = (UShort_t) det; - // Store position and charge + // Store position fX = hits[0]; fY = hits[1]; fZ = hits[2]; - fQ = hits[3]; + + // Store the charge + fQ = (Short_t) q; } @@ -72,3 +81,25 @@ AliTRDhit::~AliTRDhit() // } + +//_____________________________________________________________________________ +void AliTRDhit::Streamer(TBuffer &R__b) +{ + // + // Stream an object of class AliTRDhit. + // + + if (R__b.IsReading()) { + Version_t R__v = R__b.ReadVersion(); if (R__v) { } + AliHit::Streamer(R__b); + R__b >> fDetector; + R__b >> fQ; + } + else { + R__b.WriteVersion(AliTRDhit::IsA()); + AliHit::Streamer(R__b); + R__b << fDetector; + R__b << fQ; + } + +} diff --git a/TRD/AliTRDhit.h b/TRD/AliTRDhit.h index 05aea9a6c2a..5b7bd4cda42 100644 --- a/TRD/AliTRDhit.h +++ b/TRD/AliTRDhit.h @@ -13,22 +13,22 @@ //_____________________________________________________________________________ class AliTRDhit : public AliHit { - + public: AliTRDhit(); - AliTRDhit(Int_t shunt, Int_t track, Int_t *det, Float_t *hits); + AliTRDhit(Int_t shunt, Int_t track, Int_t det, Float_t *hits, Int_t q); virtual ~AliTRDhit(); - Int_t GetDetector() { return fDetector; }; - Float_t GetCharge() { return fQ; }; + Int_t GetDetector() const { return fDetector; }; + Int_t GetCharge() const { return fQ; }; protected: - Int_t fDetector; // TRD detector number - Float_t fQ; // Charge created by a hit (slow simulator only) - - ClassDef(AliTRDhit,2) // Hit for the Transition Radiation Detector + UShort_t fDetector; // TRD detector number + Short_t fQ; // Charge created by a hit. TR signals are negative. + + ClassDef(AliTRDhit,3) // Hit for the Transition Radiation Detector }; diff --git a/TRD/AliTRDmatrix.cxx b/TRD/AliTRDmatrix.cxx index 137841d1c5d..0b18cf20dbf 100644 --- a/TRD/AliTRDmatrix.cxx +++ b/TRD/AliTRDmatrix.cxx @@ -15,6 +15,18 @@ /* $Log$ +Revision 1.4.2.5 2000/10/17 02:27:34 cblume +Get rid of global constants + +Revision 1.4.2.4 2000/10/06 16:49:46 cblume +Made Getters const + +Revision 1.4.2.3 2000/10/04 16:34:58 cblume +Replace include files by forward declarations + +Revision 1.8 2000/06/09 11:10:07 cblume +Compiler warnings and coding conventions, next round + Revision 1.7 2000/06/08 18:32:58 cblume Make code compliant to coding conventions @@ -47,7 +59,14 @@ Introduction of the Copyright and cvs Log // // /////////////////////////////////////////////////////////////////////////////// +#include +#include +#include +#include +#include + #include "AliTRDmatrix.h" +#include "AliTRDpixel.h" ClassImp(AliTRDmatrix) @@ -428,7 +447,7 @@ Bool_t AliTRDmatrix::AddTrack(Int_t iRow, Int_t iCol, Int_t iTime, Int_t track) if (!(pixel)) return kTRUE; Bool_t trackSet = kFALSE; - for (Int_t i = 0; i < kTrackPixel; i++) { + for (Int_t i = 0; i < AliTRDpixel::NTrackPixel(); i++) { if (pixel->GetTrack(i) == track) { trackSet = kTRUE; break; @@ -460,7 +479,7 @@ void AliTRDmatrix::SetTrack(Int_t iRow, Int_t iCol, Int_t iTime } //_____________________________________________________________________________ -Float_t AliTRDmatrix::GetSignal(Int_t iRow, Int_t iCol, Int_t iTime) +Float_t AliTRDmatrix::GetSignal(Int_t iRow, Int_t iCol, Int_t iTime) const { // // Returns the amplitude of the signal for one specific pixel @@ -477,13 +496,14 @@ Float_t AliTRDmatrix::GetSignal(Int_t iRow, Int_t iCol, Int_t iTime) } //_____________________________________________________________________________ -Int_t AliTRDmatrix::GetTrack(Int_t iRow, Int_t iCol, Int_t iTime, Int_t iTrack) +Int_t AliTRDmatrix::GetTrack(Int_t iRow, Int_t iCol, Int_t iTime + , Int_t iTrack) const { // // Returns the numbers of the tracks passing through one specific pixel // - if ((iTrack < 0) || (iTrack >= kTrackPixel)) { + if ((iTrack < 0) || (iTrack >= AliTRDpixel::NTrackPixel())) { printf("AliTRDmatrix::GetTrack -- "); printf("Index out of bounds (%d)\n",iTrack); return -1; @@ -500,7 +520,7 @@ Int_t AliTRDmatrix::GetTrack(Int_t iRow, Int_t iCol, Int_t iTime, Int_t iTrack) } //_____________________________________________________________________________ -Int_t AliTRDmatrix::GetIndex(Int_t iRow, Int_t iCol, Int_t iTime) +Int_t AliTRDmatrix::GetIndex(Int_t iRow, Int_t iCol, Int_t iTime) const { if ((iRow >= 0) && (iRow < fRow ) && @@ -515,7 +535,7 @@ Int_t AliTRDmatrix::GetIndex(Int_t iRow, Int_t iCol, Int_t iTime) } //_____________________________________________________________________________ -AliTRDpixel *AliTRDmatrix::GetPixel(Int_t iRow, Int_t iCol, Int_t iTime) +AliTRDpixel *AliTRDmatrix::GetPixel(Int_t iRow, Int_t iCol, Int_t iTime) const { Int_t iPixel = GetIndex(iRow,iCol,iTime); diff --git a/TRD/AliTRDmatrix.h b/TRD/AliTRDmatrix.h index 5e45ca0de73..d28e61b01a2 100644 --- a/TRD/AliTRDmatrix.h +++ b/TRD/AliTRDmatrix.h @@ -6,13 +6,10 @@ /* $Id$ */ #include -#include -#include -#include -#include -#include -#include "AliTRDpixel.h" +class TObjArray; + +class AliTRDpixel; /////////////////////////////////////////////////////// // Stores the pixel-information of one TRD chamber // @@ -44,17 +41,17 @@ public: virtual void SetTrack(Int_t iRow, Int_t iCol, Int_t iTime , Int_t iTrack, Int_t track); - virtual Float_t GetSignal(Int_t iRow, Int_t iCol, Int_t iTime); - virtual Int_t GetTrack(Int_t iRow, Int_t iCol, Int_t iTime, Int_t iTrack); + virtual Float_t GetSignal(Int_t iRow, Int_t iCol, Int_t iTime) const; + virtual Int_t GetTrack(Int_t iRow, Int_t iCol, Int_t iTime, Int_t iTrack) const; - virtual Int_t GetSector() { return fSector; }; - virtual Int_t GetChamber() { return fChamber; }; - virtual Int_t GetPlane() { return fPlane; }; + virtual Int_t GetSector() const { return fSector; }; + virtual Int_t GetChamber() const { return fChamber; }; + virtual Int_t GetPlane() const { return fPlane; }; protected: - virtual Int_t GetIndex(Int_t iRow, Int_t iCol, Int_t iTime); - virtual AliTRDpixel *GetPixel(Int_t iRow, Int_t iCol, Int_t iTime); + virtual Int_t GetIndex(Int_t iRow, Int_t iCol, Int_t iTime) const; + virtual AliTRDpixel *GetPixel(Int_t iRow, Int_t iCol, Int_t iTime) const; Int_t fRow; // Number of pad-rows Int_t fCol; // Number of pad-columns diff --git a/TRD/AliTRDpixel.cxx b/TRD/AliTRDpixel.cxx index 8f216a68e8a..c0c0fbc06c9 100644 --- a/TRD/AliTRDpixel.cxx +++ b/TRD/AliTRDpixel.cxx @@ -15,6 +15,15 @@ /* $Log$ +Revision 1.3.2.2 2000/10/17 02:27:34 cblume +Get rid of global constants + +Revision 1.3.2.1 2000/10/04 16:34:58 cblume +Replace include files by forward declarations + +Revision 1.5 2000/06/09 11:10:07 cblume +Compiler warnings and coding conventions, next round + Revision 1.4 2000/06/08 18:32:58 cblume Make code compliant to coding conventions @@ -39,6 +48,11 @@ Introduction of the Copyright and cvs Log ClassImp(AliTRDpixel) +//_____________________________________________________________________________ + + // Maximal number of stored tracks + const Int_t AliTRDpixel::fgkNTrackPixel = kNTrackPixel; + //_____________________________________________________________________________ AliTRDpixel::AliTRDpixel():TObject() { @@ -70,7 +84,7 @@ void AliTRDpixel::Copy(TObject &p) // ((AliTRDpixel &) p).fSignal = fSignal; - for (Int_t iTrackPixel = 0; iTrackPixel < kTrackPixel; iTrackPixel++) { + for (Int_t iTrackPixel = 0; iTrackPixel < kNTrackPixel; iTrackPixel++) { ((AliTRDpixel &) p).fTrack[iTrackPixel] = fTrack[iTrackPixel]; } diff --git a/TRD/AliTRDpixel.h b/TRD/AliTRDpixel.h index ecb32b49722..22b91d361dc 100644 --- a/TRD/AliTRDpixel.h +++ b/TRD/AliTRDpixel.h @@ -11,8 +11,6 @@ // Stores the information for one detector pixel // ////////////////////////////////////////////////////// -const Int_t kTrackPixel = 3; - class AliTRDpixel : public TObject { public: @@ -22,16 +20,21 @@ public: virtual void Copy(TObject &p); + static Int_t NTrackPixel() { return fgkNTrackPixel; }; + virtual void SetSignal(Float_t signal) { fSignal = signal; }; virtual void SetTrack(Int_t i, Int_t track) { fTrack[i] = track; }; - virtual Float_t GetSignal() { return fSignal; }; - virtual Int_t GetTrack(Int_t i) { return fTrack[i]; }; + virtual Float_t GetSignal() const { return fSignal; }; + virtual Int_t GetTrack(Int_t i) const { return fTrack[i]; }; protected: + enum { kNTrackPixel = 3 }; + static const Int_t fgkNTrackPixel; // Maximal number of stored tracks + Float_t fSignal; // Signal sum - Int_t fTrack[kTrackPixel]; // Tracks contributing to this pixel + Int_t fTrack[kNTrackPixel]; // Tracks contributing to this pixel ClassDef(AliTRDpixel,1) // Information for one detector pixel diff --git a/TRD/AliTRDrecPoint.cxx b/TRD/AliTRDrecPoint.cxx index 5a1742314ad..b1fa00a11bc 100644 --- a/TRD/AliTRDrecPoint.cxx +++ b/TRD/AliTRDrecPoint.cxx @@ -15,6 +15,15 @@ /* $Log$ +Revision 1.1.4.2 2000/10/04 16:34:58 cblume +Replace include files by forward declarations + +Revision 1.1.4.1 2000/09/22 14:50:39 cblume +Adapted to tracking code + +Revision 1.3 2000/06/09 11:10:07 cblume +Compiler warnings and coding conventions, next round + Revision 1.2 2000/06/08 18:32:58 cblume Make code compliant to coding conventions @@ -29,6 +38,8 @@ Add new TRD classes // // /////////////////////////////////////////////////////////////////////////////// +#include "AliRun.h" + #include "AliTRDgeometry.h" #include "AliTRDrecPoint.h" #include "AliTRD.h" @@ -118,4 +129,111 @@ void AliTRDrecPoint::SetLocalPosition(TVector3 &pos) fLocPosM->operator()(2,2) = ((AliTRDgeometry *) fGeom)->GetTimeBinSize() / kSq12; + // printf("rec. point: row = %f, col = %f, time = %f \n", + // fLocPos[0],fLocPos[1],fLocPos[2]); + } + +//_____________________________________________________________________________ +void AliTRDrecPoint::SetTrackingYZ(Float_t sigmaY, Float_t sigmaZ) +{ + // + // Sets the position of the point in the local coordinate system + // of tracking sector + // + + Int_t plane = ((AliTRDgeometry *) fGeom)->GetPlane(fDetector); + Int_t chamber = ((AliTRDgeometry *) fGeom)->GetChamber(fDetector); + Int_t sector = ((AliTRDgeometry *) fGeom)->GetSector(fDetector); + + + // Set the position + + Float_t padRow = fLocPos[0]; // Pad Row position + Float_t padCol = fLocPos[1]; // Pad Column position + + Float_t col0 = ((AliTRDgeometry *) fGeom)->GetCol0(plane); + Float_t row0 = ((AliTRDgeometry *) fGeom)->GetRow0(plane,chamber,sector); + + // Float_t offset = 0.5 * ((AliTRDgeometry *) fGeom)->GetChamberWidth(plane); + + fY = - (col0 + padCol * ((AliTRDgeometry *) fGeom)->GetColPadSize()); + + fZ = row0 + padRow * ((AliTRDgeometry *) fGeom)->GetRowPadSize(); + + // fSigmaY = sigmaY * sigmaY; + // fSigmaZ = sigmaZ * sigmaZ; + + fSigmaY2 = 0.05 * 0.05; + + fSigmaZ2 = ((AliTRDgeometry *) fGeom)->GetRowPadSize() * + ((AliTRDgeometry *) fGeom)->GetRowPadSize() / 12.; +} + +//_____________________________________________________________________________ +void AliTRDrecPoint::AddTrackIndex(Int_t *track) +{ + // Adds track index. Currently assumed that track is an array of + // size 9, and up to 3 track indexes are stored in fTracks[3]. + // Indexes are sorted according to: + // 1) index of max number of appearances is stored first + // 2) if two or more indexes appear equal number of times, the lowest + // ones are stored first; + + const Int_t size = 9; + + Int_t entries[size][2], i, j, index; + + Bool_t index_added; + + for (i=0; i= 0) { + while ( (!index_added) && ( j < size ) ) { + if ((entries[j][0]==index) || (entries[j][1]==0)) { + entries[j][0]=index; + entries[j][1]=entries[j][1]+1; + index_added=true; + } + j++; + } + } + } + + // sort by number of appearances and index value + Int_t swap=1, tmp0, tmp1; + while ( swap > 0) { + swap=0; + for(i=0; i<(size-1); i++) { + if ((entries[i][0] >= 0) && (entries[i+1][0] >= 0)) { + if ((entries[i][1] < entries[i+1][1]) || + ((entries[i][1] == entries[i+1][1]) && + (entries[i][0] > entries[i+1][0]))) { + tmp0=entries[i][0]; + tmp1=entries[i][1]; + entries[i][0]=entries[i+1][0]; + entries[i][1]=entries[i+1][1]; + entries[i+1][0]=tmp0; + entries[i+1][1]=tmp1; + swap++; + } + } + } + } + + // set track indexes + + for(i=0; i<3; i++) { + fTracks[i] = entries[i][0]; + } + + return; + +} diff --git a/TRD/AliTRDrecPoint.h b/TRD/AliTRDrecPoint.h index 700028a0358..926e8edaea5 100644 --- a/TRD/AliTRDrecPoint.h +++ b/TRD/AliTRDrecPoint.h @@ -25,18 +25,38 @@ class AliTRDrecPoint : public AliRecPoint { 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) + virtual void SetLocalTimeBin(Int_t tb) { fTimeBin = tb; } + virtual void SetTrackingYZ(Float_t fSigmaY = 0.0, Float_t fSigmaZ = 0.0); + + virtual Int_t GetDetector() const { return fDetector; }; + virtual Int_t GetDigit(Int_t i = 0) const { 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); }; + virtual Float_t GetLocalRow() const { return fLocPos(0); }; + virtual Float_t GetLocalCol() const { return fLocPos(1); }; + virtual Float_t GetLocalTime() const { return fLocPos(2); }; + + virtual Int_t GetLocalTimeBin() const { return Int_t(fLocPos(2)); } + virtual Float_t GetSigmaY2() const { return fSigmaY2; } + virtual Float_t GetSigmaZ2() const { return fSigmaZ2; } + virtual Float_t GetY() const { return fY; } + virtual Float_t GetZ() const { return fZ; } + Int_t IsUsed() const { return fUsed; } + void Use() { fUsed++; } + Int_t GetTrackIndex(Int_t i) const { return fTracks[i]; } + void AddTrackIndex(Int_t *i); protected: Int_t fDetector; // TRD detector number + Int_t fTimeBin; // Time bin number within the detector + Int_t fUsed; // 0 initially and incremented if the point is "used" + Int_t fTracks[3]; // labels of overlapped tracks + Float_t fY; // local Rphi coordinate (cm) within tracking sector + Float_t fZ; // local Z coordinate (cm) within tracking sector + Float_t fSigmaY2; // Y variance (cm) + Float_t fSigmaZ2; // Z variance (cm) ClassDef(AliTRDrecPoint,1) // Reconstructed point for the TRD diff --git a/TRD/AliTRDsegmentArray.cxx b/TRD/AliTRDsegmentArray.cxx index 4c6973b910a..d2fb55ff670 100644 --- a/TRD/AliTRDsegmentArray.cxx +++ b/TRD/AliTRDsegmentArray.cxx @@ -15,6 +15,15 @@ /* $Log$ +Revision 1.1.4.3 2000/10/06 16:49:46 cblume +Made Getters const + +Revision 1.1.4.2 2000/10/04 16:34:58 cblume +Replace include files by forward declarations + +Revision 1.5 2000/10/02 21:28:19 fca +Removal of useless dependecies via forward declarations + Revision 1.4 2000/06/27 13:08:50 cblume Changed to Copy(TObject &A) to appease the HP-compiler @@ -40,6 +49,8 @@ Add new TRD classes #include +#include "AliRun.h" + #include "AliTRD.h" #include "AliTRDgeometry.h" #include "AliTRDsegmentArray.h" @@ -180,7 +191,7 @@ Bool_t AliTRDsegmentArray::StoreArray(const Char_t *branchname) } //_____________________________________________________________________________ -AliTRDdataArray *AliTRDsegmentArray::GetDataArray(Int_t det) +AliTRDdataArray *AliTRDsegmentArray::GetDataArray(Int_t det) const { // // Returns the data array for a given detector @@ -191,7 +202,8 @@ AliTRDdataArray *AliTRDsegmentArray::GetDataArray(Int_t det) } //_____________________________________________________________________________ -AliTRDdataArray *AliTRDsegmentArray::GetDataArray(Int_t pla, Int_t cha, Int_t sec) +AliTRDdataArray *AliTRDsegmentArray::GetDataArray(Int_t pla + , Int_t cha, Int_t sec) const { // // Returns the data array for a given detector diff --git a/TRD/AliTRDsegmentArray.h b/TRD/AliTRDsegmentArray.h index f8cf5ca3cba..fcfa8220458 100644 --- a/TRD/AliTRDsegmentArray.h +++ b/TRD/AliTRDsegmentArray.h @@ -5,12 +5,13 @@ /* $Id$ */ +#include "AliTRDsegmentArrayBase.h" + //////////////////////////////////////////////////////// // Array for TRD detector segments containing digits // //////////////////////////////////////////////////////// -#include "AliTRDsegmentArrayBase.h" -#include "AliTRDdataArray.h" +class AliTRDdataArray; //_____________________________________________________________________________ class AliTRDsegmentArray : public AliTRDsegmentArrayBase { @@ -29,8 +30,8 @@ class AliTRDsegmentArray : public AliTRDsegmentArrayBase { virtual Bool_t LoadArray(const Char_t *branchname); virtual Bool_t StoreArray(const Char_t *branchname); - virtual AliTRDdataArray *GetDataArray(Int_t det); - virtual AliTRDdataArray *GetDataArray(Int_t sec, Int_t cha, Int_t pla); + virtual AliTRDdataArray *GetDataArray(Int_t det) const; + virtual AliTRDdataArray *GetDataArray(Int_t sec, Int_t cha, Int_t pla) const; protected: diff --git a/TRD/AliTRDsegmentArrayBase.cxx b/TRD/AliTRDsegmentArrayBase.cxx index 4d29214958e..ca55dfcde6f 100644 --- a/TRD/AliTRDsegmentArrayBase.cxx +++ b/TRD/AliTRDsegmentArrayBase.cxx @@ -15,6 +15,15 @@ /* $Log$ +Revision 1.1.4.3 2000/10/06 16:49:46 cblume +Made Getters const + +Revision 1.1.4.2 2000/10/04 16:34:58 cblume +Replace include files by forward declarations + +Revision 1.5 2000/06/09 11:10:07 cblume +Compiler warnings and coding conventions, next round + Revision 1.4 2000/06/08 18:32:58 cblume Make code compliant to coding conventions @@ -38,14 +47,14 @@ Add new TRD classes // // /////////////////////////////////////////////////////////////////////////////// -#include +#include #include -#include "TClonesArray.h" -#include "TDirectory.h" -#include "AliTRDarrayI.h" -#include "TError.h" -#include "TClass.h" +#include +#include +#include +#include +#include "AliTRDarrayI.h" #include "AliTRDsegmentID.h" #include "AliTRDsegmentArrayBase.h" @@ -63,6 +72,7 @@ AliTRDsegmentArrayBase::AliTRDsegmentArrayBase():TNamed() fTreeIndex = 0; fTree = 0; fClass = 0; + fBranch = 0; } @@ -80,6 +90,7 @@ AliTRDsegmentArrayBase::AliTRDsegmentArrayBase(Text_t *classname, Int_t n) fTreeIndex = 0; fTree = 0; fClass = 0; + fBranch = 0; SetClass(classname); @@ -452,7 +463,7 @@ const AliTRDsegmentID * AliTRDsegmentArrayBase::operator[](Int_t i) } //_____________________________________________________________________________ -const AliTRDsegmentID *AliTRDsegmentArrayBase::At(Int_t i) +const AliTRDsegmentID *AliTRDsegmentArrayBase::At(Int_t i) const { // // Returns a segment with the given index diff --git a/TRD/AliTRDsegmentArrayBase.h b/TRD/AliTRDsegmentArrayBase.h index ef6bf48e011..01d1475b15c 100644 --- a/TRD/AliTRDsegmentArrayBase.h +++ b/TRD/AliTRDsegmentArrayBase.h @@ -9,9 +9,7 @@ // Manager class for a general Alice segment // //////////////////////////////////////////////// -#include "TNamed.h" -#include "TError.h" -#include "TObjArray.h" +#include class TTree; class TBranch; @@ -29,7 +27,7 @@ class AliTRDsegmentArrayBase: public TNamed { virtual ~AliTRDsegmentArrayBase(); AliTRDsegmentArrayBase &operator=(const AliTRDsegmentArrayBase &a); - const AliTRDsegmentID *At(Int_t i); + const AliTRDsegmentID *At(Int_t i) const; const AliTRDsegmentID *operator[](Int_t i); Bool_t AddSegment(AliTRDsegmentID *segment); @@ -47,8 +45,8 @@ class AliTRDsegmentArrayBase: public TNamed { Bool_t SetClass(Text_t *classname); - TClass *GetClass() { return fClass; }; - TTree *GetTree() { return fTree; }; + TClass *GetClass() const { return fClass; }; + TTree *GetTree() const { return fTree; }; protected: diff --git a/TRD/AliTRDsegmentID.cxx b/TRD/AliTRDsegmentID.cxx index dcf7c45104f..5975e8fea88 100644 --- a/TRD/AliTRDsegmentID.cxx +++ b/TRD/AliTRDsegmentID.cxx @@ -15,6 +15,12 @@ /* $Log$ +Revision 1.1.4.1 2000/10/04 16:34:58 cblume +Replace include files by forward declarations + +Revision 1.2 2000/06/08 18:32:58 cblume +Make code compliant to coding conventions + Revision 1.1 2000/02/28 19:03:35 cblume Add new TRD classes diff --git a/TRD/AliTRDsegmentID.h b/TRD/AliTRDsegmentID.h index 65e28a86217..a5344d00a46 100644 --- a/TRD/AliTRDsegmentID.h +++ b/TRD/AliTRDsegmentID.h @@ -10,7 +10,7 @@ // Base class for a detector segment // //////////////////////////////////////////////// -#include "TObject.h" +#include class AliTRDsegmentID : public TObject { @@ -20,7 +20,7 @@ class AliTRDsegmentID : public TObject { AliTRDsegmentID(Int_t index); virtual ~AliTRDsegmentID(); - Int_t GetID() { return fSegmentID; } + Int_t GetID() const { return fSegmentID; } virtual Int_t GetSize() { return sizeof(*this); } void SetID(Int_t index) { fSegmentID = index;} diff --git a/TRD/AliTRDtest.C b/TRD/AliTRDtest.C new file mode 100644 index 00000000000..e1ac3df5bfd --- /dev/null +++ b/TRD/AliTRDtest.C @@ -0,0 +1,29 @@ +Int_t AliTRDtest() +{ + // + // Test macro for the TRD code + // + + Int_t rc = 0; + + // Initialize the test setup + gAlice->Init("AliTRDconfig.C"); + + // Run one event and create the hits + gAlice->Run(1); + + // Analyze the TRD hits + gROOT->LoadMacro("$(ALICE_ROOT)/TRD/AliTRDanalyzeHits.C"); + if (rc = AliTRDanalyzeHits()) return rc; + + // Run the digitization + gROOT->LoadMacro("$(ALICE_ROOT)/TRD/AliTRDcreateDigits.C"); + if (rc = AliTRDcreateDigits()) return rc; + + // Analyze the digits + gROOT->LoadMacro("$(ALICE_ROOT)/TRD/AliTRDanalyzeDigits.C"); + if (rc = AliTRDanalyzeDigits()) return rc; + + return rc; + +} diff --git a/TRD/AliTRDv0.cxx b/TRD/AliTRDv0.cxx index 8e36f0a2745..024b6334a94 100644 --- a/TRD/AliTRDv0.cxx +++ b/TRD/AliTRDv0.cxx @@ -15,6 +15,18 @@ /* $Log$ +Revision 1.14.2.3 2000/10/06 16:49:46 cblume +Made Getters const + +Revision 1.14.2.2 2000/10/04 16:34:58 cblume +Replace include files by forward declarations + +Revision 1.14.2.1 2000/09/18 13:48:18 cblume +Adapt to new AliTRDhit + +Revision 1.16 2000/06/08 18:32:58 cblume +Make code compliant to coding conventions + Revision 1.15 2000/06/07 16:25:37 cblume Try to remove compiler warnings on Sun and HP @@ -60,6 +72,7 @@ Introduction of the Copyright and cvs Log #include "AliConst.h" #include "AliTRDv0.h" +#include "AliTRDhit.h" #include "AliTRDgeometry.h" ClassImp(AliTRDv0) @@ -172,8 +185,8 @@ void AliTRDv0::StepManager() Int_t iIdSens, icSens; Int_t iIdChamber, icChamber; - Float_t hits[4]; - Int_t det[1]; + Float_t hits[3]; + Int_t det; TLorentzVector p; TClonesArray &lhits = *fHits; @@ -191,8 +204,6 @@ void AliTRDv0::StepManager() gMC->TrackPosition(p); for (Int_t i = 0; i < 3; i++) hits[i] = p[i]; - // No charge created - hits[3] = 0; // The sector number (0 - 17) // The numbering goes clockwise and starts at y = 0 @@ -219,12 +230,13 @@ void AliTRDv0::StepManager() // The plane number (0 - 5) pla = icChamber - TMath::Nint((Float_t) (icChamber / 7)) * 6 - 1; + det = fGeometry->GetDetector(pla,cha,sec); - det[0] = fGeometry->GetDetector(pla,cha,sec); new(lhits[fNhits++]) AliTRDhit(fIshunt ,gAlice->CurrentTrack() ,det - ,hits); + ,hits + ,0); } diff --git a/TRD/AliTRDv0.h b/TRD/AliTRDv0.h index 02edc4eb7e7..d5104c66f9f 100644 --- a/TRD/AliTRDv0.h +++ b/TRD/AliTRDv0.h @@ -11,6 +11,8 @@ #include "AliTRD.h" +class AliTRDsim; + //_____________________________________________________________________________ class AliTRDv0 : public AliTRD { @@ -20,23 +22,26 @@ class AliTRDv0 : public AliTRD { AliTRDv0(const char *name, const char *title); virtual ~AliTRDv0(); - virtual void CreateGeometry(); - virtual void CreateMaterials(); - virtual Int_t IsVersion() const { return 0; }; - virtual void StepManager(); - virtual void Init(); + virtual void CreateGeometry(); + virtual void CreateMaterials(); + virtual Int_t IsVersion() const { return 0; }; + virtual void StepManager(); + virtual void Init(); + + virtual void SetHits() { fHitsOn = 1; }; - virtual void SetHits() { fHitsOn = 1; }; + void SetSensChamber(Int_t ) { }; + void SetSensPlane(Int_t ) { }; + void SetSensSector(Int_t ) { }; + void SetSensSector(Int_t ,Int_t) { }; - void SetSensChamber(Int_t ) { }; - void SetSensPlane(Int_t ) { }; - void SetSensSector(Int_t ) { }; - void SetSensSector(Int_t ,Int_t) { }; + Int_t GetSensChamber() const { return 0; }; + Int_t GetSensPlane() const { return 0; }; + Int_t GetSensSector() const { return 0; }; + Int_t GetSensSectorRange() const { return 0; }; - Int_t GetSensChamber() { return 0; }; - Int_t GetSensPlane() { return 0; }; - Int_t GetSensSector() { return 0; }; - Int_t GetSensSectorRange() { return 0; }; + AliTRDsim *CreateTR() { return 0; }; + AliTRDsim *GetTR() const { return 0; }; protected: diff --git a/TRD/AliTRDv1.cxx b/TRD/AliTRDv1.cxx index 0d56cd7221b..18d6b2fadef 100644 --- a/TRD/AliTRDv1.cxx +++ b/TRD/AliTRDv1.cxx @@ -15,6 +15,21 @@ /* $Log$ +Revision 1.17.2.5 2000/10/15 23:40:01 cblume +Remove AliTRDconst + +Revision 1.17.2.4 2000/10/06 16:49:46 cblume +Made Getters const + +Revision 1.17.2.3 2000/10/04 16:34:58 cblume +Replace include files by forward declarations + +Revision 1.17.2.2 2000/09/18 13:50:17 cblume +Include TR photon generation and adapt to new AliTRDhit + +Revision 1.22 2000/06/27 13:08:50 cblume +Changed to Copy(TObject &A) to appease the HP-compiler + Revision 1.21 2000/06/09 11:10:07 cblume Compiler warnings and coding conventions, next round @@ -75,17 +90,19 @@ Introduction of the Copyright and cvs Log #include #include #include +#include #include "AliRun.h" #include "AliMC.h" #include "AliConst.h" #include "AliTRDv1.h" +#include "AliTRDhit.h" #include "AliTRDmatrix.h" #include "AliTRDgeometry.h" +#include "AliTRDsim.h" ClassImp(AliTRDv1) - //_____________________________________________________________________________ AliTRDv1::AliTRDv1():AliTRD() @@ -107,6 +124,7 @@ AliTRDv1::AliTRDv1():AliTRD() fSensSectorRange = 0; fDeltaE = NULL; + fTR = NULL; } @@ -131,6 +149,7 @@ AliTRDv1::AliTRDv1(const char *name, const char *title) fSensSectorRange = 0; fDeltaE = NULL; + fTR = NULL; SetBufferSize(128000); @@ -155,6 +174,7 @@ AliTRDv1::~AliTRDv1() // if (fDeltaE) delete fDeltaE; + if (fTR) delete fTR; } @@ -189,7 +209,8 @@ void AliTRDv1::Copy(TObject &trd) ((AliTRDv1 &) trd).fSensSector = fSensSector; ((AliTRDv1 &) trd).fSensSectorRange = fSensSectorRange; - ((AliTRDv1 &) trd).fDeltaE = NULL; + fDeltaE->Copy(*((AliTRDv1 &) trd).fDeltaE); + fTR->Copy(*((AliTRDv1 &) trd).fTR); } @@ -221,6 +242,103 @@ void AliTRDv1::CreateMaterials() } +//_____________________________________________________________________________ +void AliTRDv1::CreateTRhit(Int_t det) +{ + // + // Creates an electron cluster from a TR photon. + // The photon is assumed to be created a the end of the radiator. The + // distance after which it deposits its energy takes into account the + // absorbtion of the entrance window and of the gas mixture in drift + // volume. + // + + // PDG code electron + const Int_t kPdgElectron = 11; + + // Ionization energy + const Float_t kWion = 22.04; + + // Maximum number of TR photons per track + const Int_t kNTR = 50; + + TLorentzVector mom, pos; + TClonesArray &lhits = *fHits; + + // Create TR only for electrons + Int_t iPdg = gMC->TrackPid(); + if (TMath::Abs(iPdg) != kPdgElectron) return; + + // Create TR at the entrance of the chamber + if (gMC->IsTrackEntering()) { + + Float_t eTR[kNTR]; + Int_t nTR; + + // Create TR photons + gMC->TrackMomentum(mom); + Float_t pTot = mom.Rho(); + fTR->CreatePhotons(iPdg,pTot,nTR,eTR); + if (nTR > kNTR) { + printf("AliTRDv1::CreateTRhit -- "); + printf("Boundary error: nTR = %d, kNTR = %d\n",nTR,kNTR); + exit(1); + } + + // Loop through the TR photons + for (Int_t iTR = 0; iTR < nTR; iTR++) { + + Float_t energyMeV = eTR[iTR] * 0.001; + Float_t energyeV = eTR[iTR] * 1000.0; + Float_t absLength = 0; + Float_t sigma = 0; + + // Take the absorbtion in the entrance window into account + Double_t muMy = fTR->GetMuMy(energyMeV); + sigma = muMy * fFoilDensity; + absLength = gRandom->Exp(sigma); + if (absLength < AliTRDgeometry::MyThick()) continue; + + // The absorbtion cross sections in the drift gas + if (fGasMix == 1) { + // Gas-mixture (Xe/CO2) + Double_t muXe = fTR->GetMuXe(energyMeV); + Double_t muCO = fTR->GetMuCO(energyMeV); + sigma = (0.90 * muXe + 0.10 * muCO) * fGasDensity; + } + else { + // Gas-mixture (Xe/Isobutane) + Double_t muXe = fTR->GetMuXe(energyMeV); + Double_t muBu = fTR->GetMuBu(energyMeV); + sigma = (0.97 * muXe + 0.03 * muBu) * fGasDensity; + } + + // The distance after which the energy of the TR photon + // is deposited. + absLength = gRandom->Exp(sigma); + if (absLength > AliTRDgeometry::DrThick()) continue; + + // The position of the absorbtion + Float_t posHit[3]; + gMC->TrackPosition(pos); + posHit[0] = pos[0] + mom[0] / pTot * absLength; + posHit[1] = pos[1] + mom[1] / pTot * absLength; + posHit[2] = pos[2] + mom[2] / pTot * absLength; + + // Create the charge + Int_t q = ((Int_t) (energyeV / kWion)); + + // Add the hit to the array. TR photon hits are marked + // by negative charge + new(lhits[fNhits++]) AliTRDhit(fIshunt,gAlice->CurrentTrack() + ,det,posHit,-q); + + } + + } + +} + //_____________________________________________________________________________ void AliTRDv1::Init() { @@ -239,10 +357,15 @@ void AliTRDv1::Init() if (fSensSector >= 0) { Int_t sens1 = fSensSector; Int_t sens2 = fSensSector + fSensSectorRange; - sens2 -= ((Int_t) (sens2 / kNsect)) * kNsect; + sens2 -= ((Int_t) (sens2 / AliTRDgeometry::Nsect())) + * AliTRDgeometry::Nsect(); printf(" Only sectors %d - %d are sensitive\n",sens1,sens2-1); } } + if (fTR) + printf(" TR simulation on\n"); + else + printf(" TR simulation off\n"); printf("\n"); // First ionization potential (eV) for the gas mixture (90% Xe + 10% CO2) @@ -252,7 +375,7 @@ void AliTRDv1::Init() // Ermilova distribution for the delta-ray spectrum Float_t poti = TMath::Log(kPoti); Float_t eEnd = TMath::Log(kEend); - fDeltaE = new TF1("deltae",Ermilova,poti,eEnd,0); + fDeltaE = new TF1("deltae",Ermilova,poti,eEnd,0); // Identifier of the sensitive volume (drift region) fIdSens = gMC->VolId("UL05"); @@ -267,6 +390,18 @@ void AliTRDv1::Init() } +//_____________________________________________________________________________ +AliTRDsim *AliTRDv1::CreateTR() +{ + // + // Enables the simulation of TR + // + + fTR = new AliTRDsim(); + return fTR; + +} + //_____________________________________________________________________________ void AliTRDv1::SetSensPlane(Int_t iplane) { @@ -367,17 +502,16 @@ void AliTRDv1::StepManager() Int_t pla = 0; Int_t cha = 0; Int_t sec = 0; + Int_t det = 0; Int_t iPdg; + Int_t qTot; - Int_t det[1]; - - Float_t hits[4]; + Float_t hits[3]; Float_t random[1]; Float_t charge; Float_t aMass; Double_t pTot; - Double_t qTot; Double_t eDelta; Double_t betaGamma, pp; @@ -424,14 +558,13 @@ void AliTRDv1::StepManager() eDelta = TMath::Max(eDelta,0.0); // The number of secondary electrons created - qTot = (Double_t) ((Int_t) (eDelta / kWion) + 1); + qTot = ((Int_t) (eDelta / kWion) + 1); // The hit coordinates and charge gMC->TrackPosition(pos); hits[0] = pos[0]; hits[1] = pos[1]; hits[2] = pos[2]; - hits[3] = qTot; // The sector number (0 - 17) // The numbering goes clockwise and starts at y = 0 @@ -467,7 +600,8 @@ void AliTRDv1::StepManager() if (fSensSector >= 0) { Int_t sens1 = fSensSector; Int_t sens2 = fSensSector + fSensSectorRange; - sens2 -= ((Int_t) (sens2 / kNsect)) * kNsect; + sens2 -= ((Int_t) (sens2 / AliTRDgeometry::Nsect())) + * AliTRDgeometry::Nsect(); if (sens1 < sens2) { if ((sec < sens1) || (sec >= sens2)) addthishit = 0; } @@ -480,11 +614,16 @@ void AliTRDv1::StepManager() // Add this hit if (addthishit) { - det[0] = fGeometry->GetDetector(pla,cha,sec); + det = fGeometry->GetDetector(pla,cha,sec); + + // Create the electron cluster from TR photons + if (fTR) CreateTRhit(det); + new(lhits[fNhits++]) AliTRDhit(fIshunt ,gAlice->CurrentTrack() ,det - ,hits); + ,hits + ,qTot); // The energy loss according to Bethe Bloch gMC->TrackMomentum(mom); diff --git a/TRD/AliTRDv1.h b/TRD/AliTRDv1.h index 2745ecb8667..c69cfd6476b 100644 --- a/TRD/AliTRDv1.h +++ b/TRD/AliTRDv1.h @@ -12,10 +12,12 @@ // Energy spectrum of the delta-rays Double_t Ermilova(Double_t *x, Double_t *par); -#include - #include "AliTRD.h" +class TF1; + +class AliTRDsim; + //_____________________________________________________________________________ class AliTRDv1 : public AliTRD { @@ -27,22 +29,27 @@ class AliTRDv1 : public AliTRD { virtual ~AliTRDv1(); AliTRDv1 &operator=(const AliTRDv1 &trd); - virtual void Copy(TObject &trd); - virtual void CreateGeometry(); - virtual void CreateMaterials(); - virtual Int_t IsVersion() const { return 1; }; - virtual void StepManager(); - virtual void Init(); + virtual void Copy(TObject &trd); + virtual void CreateGeometry(); + virtual void CreateMaterials(); + virtual void CreateTRhit(Int_t det); + virtual Int_t IsVersion() const { return 1; }; + virtual void StepManager(); + virtual void Init(); - void SetSensPlane(Int_t iplane = 0); - void SetSensChamber(Int_t ichamber = 0); - void SetSensSector(Int_t isector); - void SetSensSector(Int_t isector, Int_t nsector); + void SetSensPlane(Int_t iplane = 0); + void SetSensChamber(Int_t ichamber = 0); + void SetSensSector(Int_t isector); + void SetSensSector(Int_t isector, Int_t nsector); - Int_t GetSensPlane() { return fSensPlane; }; - Int_t GetSensChamber() { return fSensChamber; }; - Int_t GetSensSector() { return fSensSector; }; - Int_t GetSensSectorRange() { return fSensSectorRange; }; + AliTRDsim *CreateTR(); + + Int_t GetSensPlane() const { return fSensPlane; }; + Int_t GetSensChamber() const { return fSensChamber; }; + Int_t GetSensSector() const { return fSensSector; }; + Int_t GetSensSectorRange() const { return fSensSectorRange; }; + + AliTRDsim *GetTR() const { return fTR; }; protected: @@ -58,6 +65,8 @@ class AliTRDv1 : public AliTRD { Int_t fSensSector; // Sensitive detector sector Int_t fSensSectorRange; // Sensitive detector range + AliTRDsim *fTR; // TR simulator + private: virtual Double_t BetheBloch(Double_t bg); diff --git a/TRD/Makefile b/TRD/Makefile index 3f651e34be2..312289e6f8b 100644 --- a/TRD/Makefile +++ b/TRD/Makefile @@ -20,13 +20,21 @@ SRCS = AliTRD.cxx AliTRDv0.cxx AliTRDv1.cxx \ AliTRDclusterizerV1.cxx AliTRDrecPoint.cxx \ AliTRDsegmentArray.cxx AliTRDdataArray.cxx \ AliTRDdataArrayI.cxx AliTRDdataArrayF.cxx \ - AliTRDdigitsManager.cxx \ + AliTRDdigitsManager.cxx AliTRDsim.cxx \ AliTRDsegmentID.cxx AliTRDsegmentArrayBase.cxx \ - AliTRDarrayI.cxx AliTRDarrayF.cxx + AliTRDarrayI.cxx AliTRDarrayF.cxx \ + AliTRDpoints.cxx AliTRDtimeBin.cxx \ + AliTRDtrackingSector.cxx \ + AliTRDtrack.cxx AliTRDtracker.cxx \ + AliTRDcluster.cxx # C++ Headers -HDRS = $(SRCS:.cxx=.h) TRDLinkDef.h +HDRS = $(SRCS:.cxx=.h) \ + $(ROOTSYS)/include/TF1.h \ + $(ROOTSYS)/include/TFile.h \ + $(ROOTSYS)/include/TObjArray.h \ + TRDLinkDef.h # Library dictionary diff --git a/TRD/TRDLinkDef.h b/TRD/TRDLinkDef.h index 022dac79a4a..8d45bde8aa2 100644 --- a/TRD/TRDLinkDef.h +++ b/TRD/TRDLinkDef.h @@ -11,8 +11,8 @@ #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 AliTRDhit-; +#pragma link C++ class AliTRDdigit-; #pragma link C++ class AliTRDdigitsManager; #pragma link C++ class AliTRDpixel; #pragma link C++ class AliTRDmatrix; @@ -28,6 +28,13 @@ #pragma link C++ class AliTRDdataArray; #pragma link C++ class AliTRDdataArrayI; #pragma link C++ class AliTRDdataArrayF; +#pragma link C++ class AliTRDsim-; +#pragma link C++ class AliTRDpoints; +#pragma link C++ class AliTRDtimeBin; +#pragma link C++ class AliTRDtrackingSector; +#pragma link C++ class AliTRDtrack-; +#pragma link C++ class AliTRDtracker; +#pragma link C++ class AliTRDcluster; #pragma link C++ class AliTRDsegmentID; #pragma link C++ class AliTRDsegmentArrayBase; diff --git a/TRD/slowClusterCreate.C b/TRD/slowClusterCreate.C index 66478f9a8d8..2d7d937139f 100644 --- a/TRD/slowClusterCreate.C +++ b/TRD/slowClusterCreate.C @@ -14,7 +14,7 @@ void slowClusterCreate() { } // Input (and output) file name - Char_t *alifile = "galice_r_v1.root"; + Char_t *alifile = "galice.root"; // Create the clusterizer AliTRDclusterizerV1 *Clusterizer = @@ -26,11 +26,14 @@ void slowClusterCreate() { // Load the digits Clusterizer->ReadDigits(); + // Clean output branch + Clusterizer->WriteClusters(-2); + // Find the cluster - Clusterizer->MakeCluster(); + Clusterizer->MakeClusters(); // Write the cluster into the input file - Clusterizer->WriteCluster(); + Clusterizer->WriteClusters(-1); // Save the clusterizer class in the AliROOT file Clusterizer->Write(); diff --git a/TRD/slowDigitsAna.C b/TRD/slowDigitsAna.C index a604c8c7c69..b488e1a06f5 100644 --- a/TRD/slowDigitsAna.C +++ b/TRD/slowDigitsAna.C @@ -14,7 +14,7 @@ void slowDigitsAna() { } // Input file name - Char_t *alifile = "galice_d_v1.root"; + Char_t *alifile = "galice.root"; // Event number Int_t nEvent = 0; @@ -66,7 +66,7 @@ void slowDigitsAna() { DigitsManager->ReadDigits(); // Define the detector matrix for one chamber - const Int_t iSec = 17; + const Int_t iSec = 11; const Int_t iCha = 2; const Int_t iPla = 0; Int_t rowMax = TRDgeometry->GetRowMax(iPla,iCha,iSec); @@ -90,15 +90,6 @@ void slowDigitsAna() { 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(); - } delete Digit; diff --git a/TRD/slowDigitsCreate.C b/TRD/slowDigitsCreate.C index 918d17bb2d4..aeef8fb5d22 100644 --- a/TRD/slowDigitsCreate.C +++ b/TRD/slowDigitsCreate.C @@ -14,13 +14,14 @@ void slowDigitsCreate() { } // Input (and output) file name - Char_t *alifile = "galice_d_v1.root"; + Char_t *alifile = "galice.root"; // Create the TRD digitzer AliTRDdigitizer *Digitizer = new AliTRDdigitizer("digitizer","Digitizer class"); // Set the parameter Digitizer->SetDiffusion(); + Digitizer->SetVerbose(1); //Digitizer->SetExB(); //Digitizer->SetElAttach(); //Digitizer->SetAttachProb(); -- 2.43.5