From 16bf9884944415aae082b0e4d1dcd96a20bbc8e6 Mon Sep 17 00:00:00 2001 From: cblume Date: Tue, 6 Nov 2001 17:20:07 +0000 Subject: [PATCH] Add detailed geometry and simple simulator --- TRD/AliTRD.cxx | 45 ++- TRD/AliTRDdigitizer.cxx | 14 + TRD/AliTRDdigitizer.h | 84 ++--- TRD/AliTRDdigitsManager.cxx | 15 + TRD/AliTRDdigitsManager.h | 1 + TRD/AliTRDgeometry.cxx | 9 +- TRD/AliTRDgeometryDetail.cxx | 604 +++++++++++++++++++++++++++++++++++ TRD/AliTRDgeometryDetail.h | 31 ++ TRD/AliTRDmcTrack.cxx | 123 +++++++ TRD/AliTRDmcTrack.h | 59 ++++ TRD/AliTRDpid.cxx | 562 ++++++++++++++++---------------- TRD/AliTRDpid.h | 67 ++-- TRD/AliTRDpidLQ.cxx | 404 +++++++++++++++++++++++ TRD/AliTRDpidLQ.h | 66 ++++ TRD/AliTRDsimple.cxx | 114 +++++++ TRD/AliTRDsimple.h | 34 ++ TRD/AliTRDsimpleGen.cxx | 125 ++++++++ TRD/AliTRDsimpleGen.h | 36 +++ TRD/AliTRDsimpleMC.cxx | 321 +++++++++++++++++++ TRD/AliTRDsimpleMC.h | 234 ++++++++++++++ TRD/AliTRDtimeBin.cxx | 5 +- TRD/AliTRDtimeBin.h | 2 +- TRD/AliTRDv2.cxx | 144 +++++++++ TRD/AliTRDv2.h | 38 +++ TRD/Makefile | 37 ++- TRD/TRDLinkDef.h | 9 +- TRD/libTRD.pkg | 38 ++- 27 files changed, 2813 insertions(+), 408 deletions(-) create mode 100644 TRD/AliTRDgeometryDetail.cxx create mode 100644 TRD/AliTRDgeometryDetail.h create mode 100644 TRD/AliTRDmcTrack.cxx create mode 100644 TRD/AliTRDmcTrack.h create mode 100644 TRD/AliTRDpidLQ.cxx create mode 100644 TRD/AliTRDpidLQ.h create mode 100644 TRD/AliTRDsimple.cxx create mode 100644 TRD/AliTRDsimple.h create mode 100644 TRD/AliTRDsimpleGen.cxx create mode 100644 TRD/AliTRDsimpleGen.h create mode 100644 TRD/AliTRDsimpleMC.cxx create mode 100644 TRD/AliTRDsimpleMC.h create mode 100644 TRD/AliTRDv2.cxx create mode 100644 TRD/AliTRDv2.h diff --git a/TRD/AliTRD.cxx b/TRD/AliTRD.cxx index 390340b00bd..f9608cef36f 100644 --- a/TRD/AliTRD.cxx +++ b/TRD/AliTRD.cxx @@ -15,6 +15,9 @@ /* $Log$ +Revision 1.32 2001/10/08 06:57:33 hristov +Branches for TRD digits are created only during the digitisation + Revision 1.31 2001/08/30 09:30:30 hristov The split level of branches is set to 99 @@ -641,12 +644,15 @@ void AliTRD::CreateMaterials() // Define Materials ////////////////////////////////////////////////////////////////////////// - AliMaterial( 1, "Al ", 26.98, 13.0, 2.7 , 8.9 , 37.2); - AliMaterial( 2, "Air", 14.61, 7.3, 0.001205, 30420.0 , 67500.0); - AliMaterial( 4, "Xe ", 131.29, 54.0, dxe , 1447.59, 0.0); - AliMaterial( 5, "Cu ", 63.54, 29.0, 8.96 , 1.43, 14.8); - AliMaterial( 6, "C ", 12.01, 6.0, 2.265 , 18.8 , 74.4); - AliMaterial(12, "G10", 20.00, 10.0, 1.7 , 19.4 , 999.0); + AliMaterial( 1, "Al" , 26.98, 13.0, 2.7 , 8.9 , 37.2); + AliMaterial( 2, "Air" , 14.61, 7.3, 0.001205, 30420.0 , 67500.0); + AliMaterial( 4, "Xe" , 131.29, 54.0, dxe , 1447.59, 0.0); + AliMaterial( 5, "Cu" , 63.54, 29.0, 8.96 , 1.43, 14.8); + AliMaterial( 6, "C" , 12.01, 6.0, 2.265 , 18.8 , 74.4); + AliMaterial(12, "G10" , 20.00, 10.0, 1.7 , 19.4 , 999.0); + AliMaterial(15, "Sn" , 118.71, 50.0, 7.31 , 1.21, 14.8); + AliMaterial(16, "Si" , 28.09, 14.0, 2.33 , 9.36, 37.2); + AliMaterial(17, "Epoxy", 17.75, 8.9, 1.8 , 21.82, 999.0); // Mixtures AliMixture(3, "Polyethilene", ape, zpe, dpe, -2, wpe); @@ -735,6 +741,33 @@ void AliTRD::CreateMaterials() // Rohacell (plexiglas) for the radiator AliMedium(15, "Rohacell", 14, 0, isxfld, sxmgmx , tmaxfd, stemax, deemax, epsil, stmin); + // Al layer in MCMs + AliMedium(16, "MCM-Al" , 1, 0, isxfld, sxmgmx + , tmaxfd, stemax, deemax, epsil, stmin); + // Sn layer in MCMs + AliMedium(17, "MCM-Sn" , 15, 0, isxfld, sxmgmx + , tmaxfd, stemax, deemax, epsil, stmin); + // Cu layer in MCMs + AliMedium(18, "MCM-Cu" , 5, 0, isxfld, sxmgmx + , tmaxfd, stemax, deemax, epsil, stmin); + // G10 layer in MCMs + AliMedium(19, "MCM-G10" , 12, 0, isxfld, sxmgmx + , tmaxfd, stemax, deemax, epsil, stmin); + // Si in readout chips + AliMedium(20, "Chip-Si" , 16, 0, isxfld, sxmgmx + , tmaxfd, stemax, deemax, epsil, stmin); + // Epoxy in readout chips + AliMedium(21, "Chip-Ep" , 17, 0, isxfld, sxmgmx + , tmaxfd, stemax, deemax, epsil, stmin); + // PE in connectors + AliMedium(22, "Conn-PE" , 3, 0, isxfld, sxmgmx + , tmaxfd, stemax, deemax, epsil, stmin); + // Cu in connectors + AliMedium(23, "Chip-Cu" , 5, 0, isxfld, sxmgmx + , tmaxfd, stemax, deemax, epsil, stmin); + // Al of cooling pipes + AliMedium(24, "Cooling" , 1, 0, isxfld, sxmgmx + , tmaxfd, stemax, deemax, epsil, stmin); // Save the density values for the TRD absorbtion fFoilDensity = dmy; diff --git a/TRD/AliTRDdigitizer.cxx b/TRD/AliTRDdigitizer.cxx index b81bf024212..4a371b7a772 100644 --- a/TRD/AliTRDdigitizer.cxx +++ b/TRD/AliTRDdigitizer.cxx @@ -15,6 +15,9 @@ /* $Log$ +Revision 1.25 2001/06/27 09:54:44 cblume +Moved fField initialization to InitDetector() + Revision 1.24 2001/05/21 16:45:47 hristov Last minute changes (C.Blume) @@ -1282,6 +1285,17 @@ Bool_t AliTRDdigitizer::MakeDigits() } +//_____________________________________________________________________________ +Bool_t AliTRDdigitizer::Merge(TTree *trees, Int_t *mask, Int_t nin, Int_t event) +{ + // + // Merges the summable digits of different events + // + + return kTRUE; + +} + //_____________________________________________________________________________ Bool_t AliTRDdigitizer::CheckDetector(Int_t plane, Int_t chamber, Int_t sector) { diff --git a/TRD/AliTRDdigitizer.h b/TRD/AliTRDdigitizer.h index 9fdc87bd53b..9d773b9aad9 100644 --- a/TRD/AliTRDdigitizer.h +++ b/TRD/AliTRDdigitizer.h @@ -32,52 +32,54 @@ class AliTRDdigitizer : public TNamed { virtual void Init(); virtual Bool_t Open(const Char_t *name, Int_t nEvent = 0); virtual Bool_t MakeDigits(); + virtual Bool_t Merge(TTree *trees, Int_t *mask, Int_t nin, Int_t event); virtual void ReInit(); virtual Bool_t SumSDigits(); virtual Bool_t WriteDigits(); 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 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 SetPadResponse(Int_t prfOn = 1) { fPRFOn = prfOn; }; - virtual void SetTimeResponse(Int_t trfOn = 1) { fTRFOn = trfOn; - ReInit(); }; - virtual void SetDriftVelocity(Float_t v) { fDriftVelocity = v; - ReInit(); }; - virtual void SetPadCoupling(Float_t v) { fPadCoupling = v; }; - virtual void SetTimeCoupling(Float_t v) { fTimeCoupling = v; }; - virtual void SetCompress(Int_t c = 1) { fCompress = c; }; - virtual void SetVerbose(Int_t v = 1) { fVerbose = v; }; - virtual void SetSDigits(Int_t v = 1) { fSDigits = v; }; - virtual void SetEvent(Int_t v = 0) { fEvent = v; }; - - AliTRDdigitsManager *Digits() const { return fDigits; }; - - Float_t GetGasGain() const { return fGasGain; }; - Float_t GetNoise() const { return fNoise; }; - Float_t GetChipGain() const { return fChipGain; }; - Float_t GetADCoutRange() const { return fADCoutRange; }; - Float_t GetADCinRange() const { return fADCinRange; }; - Int_t GetADCthreshold() const { return fADCthreshold; }; - Float_t GetDiffusionT() const { return fDiffusionT; }; - Float_t GetDiffusionL() const { return fDiffusionL; }; - Float_t GetElAttachProp() const { return fElAttachProp; }; - Int_t GetExB() const { return fExBOn; }; - Float_t GetOmegaTau() const { return fOmegaTau; }; - Float_t GetDriftVelocity() const { return fDriftVelocity; }; - Float_t GetPadCoupling() const { return fPadCoupling; }; - Float_t GetTimeCoupling() const { return fTimeCoupling; }; - Bool_t GetCompress() const { return fCompress; }; - Bool_t GetSDigits() const { return fSDigits; }; - Float_t GetTimeBinWidth() const { return fTimeBinWidth; }; + 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 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 SetPadResponse(Int_t prfOn = 1) { fPRFOn = prfOn; }; + virtual void SetTimeResponse(Int_t trfOn = 1) { fTRFOn = trfOn; + ReInit(); }; + virtual void SetDriftVelocity(Float_t v) { fDriftVelocity = v; + ReInit(); }; + virtual void SetPadCoupling(Float_t v) { fPadCoupling = v; }; + virtual void SetTimeCoupling(Float_t v) { fTimeCoupling = v; }; + virtual void SetCompress(Int_t c = 1) { fCompress = c; }; + virtual void SetVerbose(Int_t v = 1) { fVerbose = v; }; + virtual void SetSDigits(Int_t v = 1) { fSDigits = v; }; + virtual void SetEvent(Int_t v = 0) { fEvent = v; }; + virtual void SetManager(AliTRDdigitsManager *man) { fDigits = man; }; + + AliTRDdigitsManager *Digits() const { return fDigits; }; + + Float_t GetGasGain() const { return fGasGain; }; + Float_t GetNoise() const { return fNoise; }; + Float_t GetChipGain() const { return fChipGain; }; + Float_t GetADCoutRange() const { return fADCoutRange; }; + Float_t GetADCinRange() const { return fADCinRange; }; + Int_t GetADCthreshold() const { return fADCthreshold; }; + Float_t GetDiffusionT() const { return fDiffusionT; }; + Float_t GetDiffusionL() const { return fDiffusionL; }; + Float_t GetElAttachProp() const { return fElAttachProp; }; + Int_t GetExB() const { return fExBOn; }; + Float_t GetOmegaTau() const { return fOmegaTau; }; + Float_t GetDriftVelocity() const { return fDriftVelocity; }; + Float_t GetPadCoupling() const { return fPadCoupling; }; + Float_t GetTimeCoupling() const { return fTimeCoupling; }; + Bool_t GetCompress() const { return fCompress; }; + Bool_t GetSDigits() const { return fSDigits; }; + Float_t GetTimeBinWidth() const { return fTimeBinWidth; }; virtual Float_t GetDiffusionL(Float_t vd, Float_t b); virtual Float_t GetDiffusionT(Float_t vd, Float_t b); virtual Float_t GetOmegaTau(Float_t vd, Float_t b); diff --git a/TRD/AliTRDdigitsManager.cxx b/TRD/AliTRDdigitsManager.cxx index 08deda4acc1..4f86fc0a6ac 100644 --- a/TRD/AliTRDdigitsManager.cxx +++ b/TRD/AliTRDdigitsManager.cxx @@ -15,6 +15,9 @@ /* $Log$ +Revision 1.12 2001/05/16 14:57:28 alibrary +New files for folders and Stack + Revision 1.11 2001/03/13 09:30:35 cblume Update of digitization. Moved digit branch definition to AliTRD @@ -159,6 +162,18 @@ void AliTRDdigitsManager::SetRaw() } +//_____________________________________________________________________________ +Short_t AliTRDdigitsManager::GetDigitAmp(Int_t row, Int_t col,Int_t time + , Int_t det) const +{ + // + // Returns the amplitude of a digit + // + + return ((Short_t) GetDigits(det)->GetData(row,col,time)); + +} + //_____________________________________________________________________________ Bool_t AliTRDdigitsManager::MakeBranch(char *file) { diff --git a/TRD/AliTRDdigitsManager.h b/TRD/AliTRDdigitsManager.h index 33580682413..ce298b7314c 100644 --- a/TRD/AliTRDdigitsManager.h +++ b/TRD/AliTRDdigitsManager.h @@ -49,6 +49,7 @@ class AliTRDdigitsManager : public TObject { AliTRDdataArrayI *GetDigits(Int_t det) const; AliTRDdataArrayI *GetDictionary(Int_t det, Int_t i) const; Int_t GetTrack(Int_t track, AliTRDdigit *Digit) const; + Short_t GetDigitAmp(Int_t row, Int_t col, Int_t time, Int_t det) const; protected: diff --git a/TRD/AliTRDgeometry.cxx b/TRD/AliTRDgeometry.cxx index a80a39283c5..179304325ce 100644 --- a/TRD/AliTRDgeometry.cxx +++ b/TRD/AliTRDgeometry.cxx @@ -15,6 +15,9 @@ /* $Log$ +Revision 1.13 2001/08/02 08:30:45 cblume +Fix positions of cooling material + Revision 1.12 2001/05/21 16:45:47 hristov Last minute changes (C.Blume) @@ -467,9 +470,9 @@ Bool_t AliTRDgeometry::Local2Global(Int_t iplan, Int_t icham, Int_t isect 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]+0.5; // Pad Row position + Float_t padCol = local[1]+0.5; // Pad Column position + Float_t timeSlice = local[2]+0.5; // Time "position" Float_t row0 = GetRow0(iplan,icham,isect); Float_t col0 = GetCol0(iplan); diff --git a/TRD/AliTRDgeometryDetail.cxx b/TRD/AliTRDgeometryDetail.cxx new file mode 100644 index 00000000000..119baefce8e --- /dev/null +++ b/TRD/AliTRDgeometryDetail.cxx @@ -0,0 +1,604 @@ +/************************************************************************** + * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * * + * Author: The ALICE Off-line Project. * + * Contributors are mentioned in the code where appropriate. * + * * + * Permission to use, copy, modify and distribute this software and its * + * documentation strictly for non-commercial purposes is hereby granted * + * without fee, provided that the above copyright notice appears in all * + * copies and that both the copyright notice and this permission notice * + * appear in the supporting documentation. The authors make no claims * + * about the suitability of this software for any purpose. It is * + * provided "as is" without express or implied warranty. * + **************************************************************************/ + +/* +$Log$ +*/ + +/////////////////////////////////////////////////////////////////////////////// +// // +// TRD geometry for the spaceframe without holes // +// // +/////////////////////////////////////////////////////////////////////////////// + +#include "AliMC.h" + +#include "AliTRDgeometryDetail.h" + +ClassImp(AliTRDgeometryDetail) + +//_____________________________________________________________________________ +AliTRDgeometryDetail::AliTRDgeometryDetail():AliTRDgeometryFull() +{ + // + // AliTRDgeometryDetail default constructor + // + + Init(); + +} + +//_____________________________________________________________________________ +AliTRDgeometryDetail::~AliTRDgeometryDetail() +{ + // + // AliTRDgeometryDetail destructor + // + +} + +//_____________________________________________________________________________ +void AliTRDgeometryDetail::Init() +{ + // + // Initializes the geometry parameter + // + + AliTRDgeometryFull::Init(); + +} + +//_____________________________________________________________________________ +void AliTRDgeometryDetail::CreateGeometry(Int_t *idtmed) +{ + // + // Create the detailed TRD geometry without hole + // + + Int_t iplan; + + const Int_t kNparTrd = 4; + const Int_t kNparCha = 3; + const Int_t kNplan = fgkNplan; + + Float_t parDum[3]; + Float_t parTrd[kNparTrd]; + Float_t parCha[kNparCha]; + + Float_t xpos, ypos, zpos; + + // The aluminum frames - readout + electronics (Al) + // The inner chambers + gMC->Gsvolu("UAFI","BOX ",idtmed[1301-1],parDum,0); + // The middle chambers + gMC->Gsvolu("UAFM","BOX ",idtmed[1301-1],parDum,0); + // The outer chambers + gMC->Gsvolu("UAFO","BOX ",idtmed[1301-1],parDum,0); + + // The inner part of the aluminum frames (Air) + // The inner chambers + gMC->Gsvolu("UAII","BOX ",idtmed[1302-1],parDum,0); + // The middle chambers + gMC->Gsvolu("UAIM","BOX ",idtmed[1302-1],parDum,0); + // The outer chambers + gMC->Gsvolu("UAIO","BOX ",idtmed[1302-1],parDum,0); + + // The carbon frames - radiator + driftchamber (C) + // The inner chambers + gMC->Gsvolu("UCFI","BOX ",idtmed[1307-1],parDum,0); + // The middle chambers + gMC->Gsvolu("UCFM","BOX ",idtmed[1307-1],parDum,0); + // The outer chambers + gMC->Gsvolu("UCFO","BOX ",idtmed[1307-1],parDum,0); + + // The inner part of the carbon frames (Air) + // The inner chambers + gMC->Gsvolu("UCII","BOX ",idtmed[1302-1],parDum,0); + // The middle chambers + gMC->Gsvolu("UCIM","BOX ",idtmed[1302-1],parDum,0); + // The outer chambers + gMC->Gsvolu("UCIO","BOX ",idtmed[1302-1],parDum,0); + + // The material layers inside the chambers + parCha[0] = -1.; + parCha[1] = -1.; + // Rohacell layer (radiator) + parCha[2] = fgkRaThick/2; + gMC->Gsvolu("UL03","BOX ",idtmed[1315-1],parCha,kNparCha); + // Mylar layer (entrance window + HV cathode) + parCha[2] = fgkMyThick/2; + gMC->Gsvolu("UL04","BOX ",idtmed[1308-1],parCha,kNparCha); + // Xe/Isobutane layer (drift volume) + parCha[2] = fgkDrThick/2.; + gMC->Gsvolu("UL05","BOX ",idtmed[1309-1],parCha,kNparCha); + // Xe/Isobutane layer (amplification volume) + parCha[2] = fgkAmThick/2.; + gMC->Gsvolu("UL06","BOX ",idtmed[1309-1],parCha,kNparCha); + + // Cu layer (pad plane) + parCha[2] = fgkCuThick/2; + gMC->Gsvolu("UL07","BOX ",idtmed[1305-1],parCha,kNparCha); + // G10 layer (support structure) + parCha[2] = fgkSuThick/2; + gMC->Gsvolu("UL08","BOX ",idtmed[1313-1],parCha,kNparCha); + + // Create the readout volumina + CreateReadout(idtmed); + + // Create the volumina for the cooling + CreateCooling(idtmed); + + // Position the layers in the chambers + xpos = 0; + ypos = 0; + + // Rohacell layer (radiator) + zpos = fgkRaZpos; + gMC->Gspos("UL03",1,"UCII",xpos,ypos,zpos,0,"ONLY"); + gMC->Gspos("UL03",2,"UCIM",xpos,ypos,zpos,0,"ONLY"); + gMC->Gspos("UL03",3,"UCIO",xpos,ypos,zpos,0,"ONLY"); + // Mylar layer (entrance window + HV cathode) + 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 = 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 = 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 = 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 = 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"); + + // The TRD mother volume for one sector (Air), full length in z-direction + 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); + + // Make the aluminum frame of the chamber 0.5cm shorter to acommodate + // the volumes for the detailed readout electronics + const Float_t kcaframeOff = 0.5; + Float_t caframe = fgkCaframe - kcaframeOff; + + // Position the chambers in the TRD mother volume + for (iplan = 1; iplan <= kNplan; iplan++) { + + // The inner chambers --------------------------------------------------------------- + + // the aluminum frame + parCha[0] = fCwidth[iplan-1]/2.; + parCha[1] = fClengthI[iplan-1]/2.; + parCha[2] = caframe/2.; + xpos = 0.; + ypos = 0.; + zpos = fgkCheight - fgkSheight/2. - kcaframeOff - caframe/2. + + (iplan-1) * (fgkCheight + fgkCspace); + gMC->Gsposp("UAFI",iplan ,"TRD1",xpos,ypos,zpos,0,"ONLY",parCha,kNparCha); + + // the inner part of the aluminum frame + parCha[0] = fCwidth[iplan-1]/2. - fgkCathick; + parCha[1] = fClengthI[iplan-1]/2. - fgkCathick; + parCha[2] = caframe/2.; + xpos = 0.; + ypos = 0.; + zpos = fgkCheight - fgkSheight/2. - kcaframeOff - caframe/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] = fgkCcframe/2.; + xpos = 0.; + ypos = 0.; + zpos = fgkCcframe/2. - fgkSheight/2. + + (iplan-1) * (fgkCheight + fgkCspace); + gMC->Gsposp("UCFI",iplan ,"TRD1",xpos,ypos,zpos,0,"ONLY",parCha,kNparCha); + + // the inner part of the carbon frame + parCha[0] = fCwidth[iplan-1]/2. - fgkCcthick; + parCha[1] = fClengthI[iplan-1]/2. - fgkCcthick; + parCha[2] = fgkCcframe/2.; + xpos = 0.; + ypos = 0.; + zpos = fgkCcframe/2. - fgkSheight/2. + + (iplan-1) * (fgkCheight + fgkCspace); + gMC->Gsposp("UCII",iplan ,"TRD1",xpos,ypos,zpos,0,"ONLY",parCha,kNparCha); + + PositionReadout(iplan-1,2); + PositionCooling(iplan-1,2); + + // The middle chambers -------------------------------------------------------------- + + // the aluminum frame + parCha[0] = fCwidth[iplan-1]/2.; + parCha[1] = fClengthM1[iplan-1]/2.; + parCha[2] = caframe/2.; + xpos = 0.; + ypos = fClengthI[iplan-1]/2. + fClengthM1[iplan-1]/2.; + zpos = fgkCheight - fgkSheight/2. - kcaframeOff - caframe/2. + + (iplan-1) * (fgkCheight + fgkCspace); + gMC->Gsposp("UAFM",iplan ,"TRD1",xpos, ypos,zpos,0,"ONLY",parCha,kNparCha); + gMC->Gsposp("UAFM",iplan+ kNplan,"TRD1",xpos,-ypos,zpos,0,"ONLY",parCha,kNparCha); + + // the inner part of the aluminum frame + parCha[0] = fCwidth[iplan-1]/2. - fgkCathick; + parCha[1] = fClengthM1[iplan-1]/2. - fgkCathick; + parCha[2] = caframe/2.; + xpos = 0.; + ypos = fClengthI[iplan-1]/2. + fClengthM1[iplan-1]/2.; + zpos = fgkCheight - fgkSheight/2. - kcaframeOff - caframe/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); + + // the carbon frame + parCha[0] = fCwidth[iplan-1]/2.; + parCha[1] = fClengthM1[iplan-1]/2.; + parCha[2] = fgkCcframe/2.; + xpos = 0.; + ypos = fClengthI[iplan-1]/2. + fClengthM1[iplan-1]/2.; + zpos = fgkCcframe/2. - fgkSheight/2. + + (iplan-1) * (fgkCheight + fgkCspace); + gMC->Gsposp("UCFM",iplan ,"TRD1",xpos, ypos,zpos,0,"ONLY",parCha,kNparCha); + gMC->Gsposp("UCFM",iplan+ kNplan,"TRD1",xpos,-ypos,zpos,0,"ONLY",parCha,kNparCha); + + // the inner part of the carbon frame + 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 = 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); + + PositionReadout(iplan-1,1); + PositionReadout(iplan-1,3); + PositionCooling(iplan-1,1); + PositionCooling(iplan-1,3); + + // The outer chambers --------------------------------------------------------------- + + // the aluminum frame + parCha[0] = fCwidth[iplan-1]/2.; + parCha[1] = fClengthO1[iplan-1]/2.; + parCha[2] = caframe/2.; + xpos = 0.; + ypos = fClengthI[iplan-1]/2. + fClengthM1[iplan-1] + fClengthO1[iplan-1]/2.; + zpos = fgkCheight - fgkSheight/2. - kcaframeOff - caframe/2. + + (iplan-1) * (fgkCheight + fgkCspace); + gMC->Gsposp("UAFO",iplan ,"TRD1",xpos, ypos,zpos,0,"ONLY",parCha,kNparCha); + gMC->Gsposp("UAFO",iplan+ kNplan,"TRD1",xpos,-ypos,zpos,0,"ONLY",parCha,kNparCha); + + // the inner part of the aluminum frame + parCha[0] = fCwidth[iplan-1]/2. - fgkCathick; + parCha[1] = fClengthO1[iplan-1]/2. - fgkCathick; + parCha[2] = caframe/2.; + xpos = 0.; + ypos = fClengthI[iplan-1]/2. + fClengthM1[iplan-1] + fClengthO1[iplan-1]/2.; + zpos = fgkCheight - fgkSheight/2. - kcaframeOff - caframe/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); + + // the carbon frame + parCha[0] = fCwidth[iplan-1]/2.; + parCha[1] = fClengthO1[iplan-1]/2.; + parCha[2] = fgkCcframe/2.; + xpos = 0.; + ypos = fClengthI[iplan-1]/2. + fClengthM1[iplan-1] + fClengthO1[iplan-1]/2.; + zpos = fgkCcframe/2. - fgkSheight/2. + + (iplan-1) * (fgkCheight + fgkCspace); + gMC->Gsposp("UCFO",iplan, "TRD1",xpos, ypos,zpos,0,"ONLY",parCha,kNparCha); + gMC->Gsposp("UCFO",iplan+ kNplan,"TRD1",xpos,-ypos,zpos,0,"ONLY",parCha,kNparCha); + + // the inner part of the carbon frame + 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 = 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); + + PositionReadout(iplan-1,0); + PositionReadout(iplan-1,4); + PositionCooling(iplan-1,0); + PositionCooling(iplan-1,4); + + } + + xpos = 0.; + ypos = 0.; + zpos = 0.; + gMC->Gspos("TRD1",1,"BTR1",xpos,ypos,zpos,0,"ONLY"); + gMC->Gspos("TRD1",2,"BTR2",xpos,ypos,zpos,0,"ONLY"); + gMC->Gspos("TRD1",3,"BTR3",xpos,ypos,zpos,0,"ONLY"); + +} + +//_____________________________________________________________________________ +void AliTRDgeometryDetail::CreateReadout(Int_t *idtmed) +{ + // + // Create the volumina of the readout electronics + // + + const Int_t kNparBox = 3; + + Float_t parBox[kNparBox]; + Float_t xpos = 0.0; + Float_t ypos = 0.0; + Float_t zpos = 0.0; + + // The mother volume for the MCMs + connectors (air) + parBox[0] = 3.0/2.; + parBox[1] = 3.4/2.; + parBox[2] = 0.5/2.; + gMC->Gsvolu("UMCM","BOX",idtmed[1302-1],parBox,kNparBox); + + // The MCM carrier G10 layer + parBox[0] = 3.0/2.; + parBox[1] = 3.0/2.; + parBox[2] = 0.1/2.; + gMC->Gsvolu("UMC1","BOX",idtmed[1319-1],parBox,kNparBox); + // The MCM carrier Cu layer + parBox[0] = 3.0/2.; + parBox[1] = 3.0/2.; + parBox[2] = 0.0034/2.; + gMC->Gsvolu("UMC2","BOX",idtmed[1318-1],parBox,kNparBox); + // The MCM carrier Sn layer + parBox[0] = 3.0/2.; + parBox[1] = 3.0/2.; + parBox[2] = 0.004/2.; + gMC->Gsvolu("UMC3","BOX",idtmed[1317-1],parBox,kNparBox); + // The MCM carrier Al layer + parBox[0] = 3.0/2.; + parBox[1] = 3.0/2.; + parBox[2] = 0.05/2.; + gMC->Gsvolu("UMC4","BOX",idtmed[1316-1],parBox,kNparBox); + + // The epoxy of chip no.1 + parBox[0] = 0.548/2.; + parBox[1] = 0.548/2.; + parBox[2] = 0.1/2.; + gMC->Gsvolu("UCE1","BOX",idtmed[1321-1],parBox,kNparBox); + // The silicon of chip no.1 + parBox[0] = 0.316/2.; + parBox[1] = 0.316/2.; + parBox[2] = 0.03/2.; + gMC->Gsvolu("UCS1","BOX",idtmed[1320-1],parBox,kNparBox); + + // The epoxy of chip no.2 + parBox[0] = 1.549/2.; + parBox[1] = 1.549/2.; + parBox[2] = 0.1/2.; + gMC->Gsvolu("UCE2","BOX",idtmed[1321-1],parBox,kNparBox); + // The silicon of chip no.2 + parBox[0] = 0.894/2.; + parBox[1] = 0.894/2.; + parBox[2] = 0.03/2.; + gMC->Gsvolu("UCS2","BOX",idtmed[1320-1],parBox,kNparBox); + + // The PE of the connector + parBox[0] = 2.25/2.; + parBox[1] = 0.4/2.; + parBox[2] = 0.3/2.; + gMC->Gsvolu("UCN1","BOX",idtmed[1322-1],parBox,kNparBox); + // The Cu of the connector + parBox[0] = 2.25/2.; + parBox[1] = 0.4/2.; + parBox[2] = 0.005/2.; + gMC->Gsvolu("UCN2","BOX",idtmed[1323-1],parBox,kNparBox); + + xpos = 0.0; + ypos = -0.4/2.; + zpos = -0.25 + 0.1/2.; + gMC->Gspos("UMC1",1,"UMCM",xpos,ypos,zpos,0,"ONLY"); + zpos += 0.1/2. + 0.0034/2.; + gMC->Gspos("UMC2",1,"UMCM",xpos,ypos,zpos,0,"ONLY"); + zpos += 0.0034/2 + 0.004/2.; + gMC->Gspos("UMC3",1,"UMCM",xpos,ypos,zpos,0,"ONLY"); + zpos += 0.004/2 + 0.05/2.; + gMC->Gspos("UMC4",1,"UMCM",xpos,ypos,zpos,0,"ONLY"); + zpos += 0.05/2. + 0.1/2.; + xpos = 1.0; + gMC->Gspos("UCE1",1,"UMCM",xpos,ypos,zpos,0,"ONLY"); + xpos = -0.5; + gMC->Gspos("UCE2",1,"UMCM",xpos,ypos,zpos,0,"ONLY"); + zpos += 0.1/2. + 0.03/2.; + xpos = 1.0; + gMC->Gspos("UCS1",1,"UMCM",xpos,ypos,zpos,0,"ONLY"); + xpos = -0.5; + gMC->Gspos("UCS2",1,"UMCM",xpos,ypos,zpos,0,"ONLY"); + xpos = 0.0; + ypos = 3.4/2. - 0.4/2.; + zpos = -0.25 + 0.3/2.; + gMC->Gspos("UCN1",1,"UMCM",xpos,ypos,zpos,0,"ONLY"); + zpos += 0.3/2. + 0.005/2.; + gMC->Gspos("UCN2",1,"UMCM",xpos,ypos,zpos,0,"ONLY"); + +} + +//_____________________________________________________________________________ +void AliTRDgeometryDetail::PositionReadout(Int_t ipla, Int_t icha) +{ + // + // Position the volumina inside the readout mother volume + // + + const Float_t kcaframeOff = 0.5; + + Int_t nMCMrow = GetRowMax(ipla,icha,0); + Int_t nMCMcol = 6; + + Float_t xSize = GetChamberWidth(ipla) / ((Float_t) nMCMcol); + Float_t ySize = 0.0; + Float_t x0 = - GetChamberWidth(ipla) /2. + fgkCcthick; + Float_t y0 = 0.0; + switch (icha) { + case 0: + ySize = GetChamberLengthO(ipla) / ((Float_t) nMCMrow); + y0 = fClengthI[ipla]/2. + fClengthM1[ipla] + fClengthO1[ipla]/2. + - GetChamberLengthO(ipla) / 2. + fgkCcthick; + break; + case 1: + ySize = GetChamberLengthM(ipla) / ((Float_t) nMCMrow); + y0 = fClengthI[ipla]/2. + fClengthM1[ipla]/2. + - GetChamberLengthM(ipla) / 2. + fgkCcthick; + break; + case 2: + ySize = GetChamberLengthI(ipla) / ((Float_t) nMCMrow); + y0 = - GetChamberLengthI(ipla) / 2. + fgkCcthick; + break; + case 3: + ySize = GetChamberLengthM(ipla) / ((Float_t) nMCMrow); + y0 = - fClengthI[ipla]/2. - fClengthM1[ipla]/2. + - GetChamberLengthM(ipla) / 2. + fgkCcthick; + break; + case 4: + ySize = GetChamberLengthO(ipla) / ((Float_t) nMCMrow); + y0 = - fClengthI[ipla]/2. - fClengthM1[ipla] - fClengthO1[ipla]/2. + - GetChamberLengthO(ipla) / 2. + fgkCcthick; + break; + }; + + Int_t iCopy = GetDetector(ipla,icha,0) * 1000; + for (Int_t iMCMrow = 0; iMCMrow < nMCMrow; iMCMrow++) { + for (Int_t iMCMcol = 0; iMCMcol < nMCMcol; iMCMcol++) { + iCopy++; + Float_t xpos = (0.5 + iMCMcol) * xSize + x0; + Float_t ypos = (0.5 + iMCMrow) * ySize + y0; + Float_t zpos = fgkCheight - fgkSheight/2. - kcaframeOff/2. + + ipla * (fgkCheight + fgkCspace); + gMC->Gspos("UMCM",iCopy,"TRD1",xpos,ypos,zpos,0,"ONLY"); + } + } + +} + +//_____________________________________________________________________________ +void AliTRDgeometryDetail::CreateCooling(Int_t *idtmed) +{ + // + // Create the volumina of the cooling + // + + const Int_t kNparBox = 3; + + Float_t parBox[kNparBox]; + + // The aluminum pipe for the cooling + parBox[0] = 0.0; + parBox[1] = 0.0; + parBox[2] = 0.0; + gMC->Gsvolu("UCOA","BOX",idtmed[1324-1],parBox,0); + + // The cooling water + parBox[0] = -1.; + parBox[1] = 0.2/2.; + parBox[2] = 0.2/2.; + gMC->Gsvolu("UCOW","BOX",idtmed[1314-1],parBox,kNparBox); + + // Water inside he cooling pipe + Float_t xpos = 0.0; + Float_t ypos = 0.0; + Float_t zpos = 0.0; + gMC->Gspos("UCOW",1,"UCOA",xpos,ypos,zpos,0,"ONLY"); + +} + +//_____________________________________________________________________________ +void AliTRDgeometryDetail::PositionCooling(Int_t ipla, Int_t icha) +{ + // + // Position the volumina of the cooling + // + + const Int_t kNpar = 3; + + const Float_t kcaframeOff = 0.5; + + Float_t par[kNpar]; + Float_t xpos = 0.0; + Float_t ypos = 0.0; + Float_t zpos = 0.0; + + Int_t iCopy = GetDetector(ipla,icha,0) * 100; + Int_t nMCMrow = GetRowMax(ipla,icha,0); + + Float_t xSize = 0.0; + Float_t x0 = 0.0; + switch (icha) { + case 0: + xSize = GetChamberLengthO(ipla) / ((Float_t) nMCMrow); + x0 = fClengthI[ipla]/2. + fClengthM1[ipla] + fClengthO1[ipla]/2. + - GetChamberLengthO(ipla) / 2. + fgkCcthick; + break; + case 1: + xSize = GetChamberLengthM(ipla) / ((Float_t) nMCMrow); + x0 = fClengthI[ipla]/2. + fClengthM1[ipla]/2. + - GetChamberLengthM(ipla) / 2. + fgkCcthick; + break; + case 2: + xSize = GetChamberLengthI(ipla) / ((Float_t) nMCMrow); + x0 = - GetChamberLengthI(ipla) / 2. + fgkCcthick; + break; + case 3: + xSize = GetChamberLengthM(ipla) / ((Float_t) nMCMrow); + x0 = - fClengthI[ipla]/2. - fClengthM1[ipla]/2. + - GetChamberLengthM(ipla) / 2. + fgkCcthick; + break; + case 4: + xSize = GetChamberLengthO(ipla) / ((Float_t) nMCMrow); + x0 = - fClengthI[ipla]/2. - fClengthM1[ipla] - fClengthO1[ipla]/2. + - GetChamberLengthO(ipla) / 2. + fgkCcthick; + break; + }; + + // Position the cooling pipes + for (Int_t iMCMrow = 0; iMCMrow < nMCMrow; iMCMrow++) { + + xpos = 0.0; + ypos = (0.5 + iMCMrow) * xSize + x0 - 1.9; + zpos = fgkCheight - fgkSheight/2. - kcaframeOff/2. + + ipla * (fgkCheight + fgkCspace); + par[0] = GetChamberWidth(ipla) / 2. - fgkCcthick; + par[1] = 0.3/2.; + par[2] = 0.3/2.; + gMC->Gsposp("UCOA",iCopy+iMCMrow,"TRD1",xpos,ypos,zpos,0,"ONLY",par,kNpar); + + } + +} diff --git a/TRD/AliTRDgeometryDetail.h b/TRD/AliTRDgeometryDetail.h new file mode 100644 index 00000000000..cd181023022 --- /dev/null +++ b/TRD/AliTRDgeometryDetail.h @@ -0,0 +1,31 @@ +#ifndef ALITRDGEOMETRYDETAIL_H +#define ALITRDGEOMETRYDETAIL_H +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ + +/* $Id$ */ + +#include "AliTRDgeometryFull.h" + +class AliTRDgeometryDetail : public AliTRDgeometryFull { + + public: + + AliTRDgeometryDetail(); + virtual ~AliTRDgeometryDetail(); + + void CreateGeometry(Int_t *idtmed); + void CreateReadout(Int_t *idtmed); + void CreateCooling(Int_t *idtmed); + void PositionReadout(Int_t ipla, Int_t icha); + void PositionCooling(Int_t ipla, Int_t icha); + Int_t IsVersion() const { return 2; }; + void Init(); + + protected: + + ClassDef(AliTRDgeometryDetail,1) // Detailed TRD geometry without hole + +}; + +#endif diff --git a/TRD/AliTRDmcTrack.cxx b/TRD/AliTRDmcTrack.cxx new file mode 100644 index 00000000000..2b441d60033 --- /dev/null +++ b/TRD/AliTRDmcTrack.cxx @@ -0,0 +1,123 @@ +/************************************************************************** + * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * * + * Author: The ALICE Off-line Project. * + * Contributors are mentioned in the code where appropriate. * + * * + * Permission to use, copy, modify and distribute this software and its * + * documentation strictly for non-commercial purposes is hereby granted * + * without fee, provided that the above copyright notice appears in all * + * copies and that both the copyright notice and this permission notice * + * appear in the supporting documentation. The authors make no claims * + * about the suitability of this software for any purpose. It is * + * provided "as is" without express or implied warranty. * + **************************************************************************/ + +#include "AliTRDmcTrack.h" +#include "AliTRDgeometry.h" + +ClassImp(AliTRDmcTrack) + +//_____________________________________________________________________________ +AliTRDmcTrack::AliTRDmcTrack() +{ + + // + // Default constructor + // + + fLab = -1; + fPrimary = kFALSE; + fMass = 0; + fCharge = 0; + fN = 0; + + for(Int_t i=0; i<200; i++) fIndex[i]=-1; + + for(Int_t i=0; i<6; i++) { + for(Int_t j=0; j<3; j++) { + Pin[i][j]=0.; + Pout[i][j] = 0.; + } + } + +} + +//_____________________________________________________________________________ +AliTRDmcTrack::AliTRDmcTrack(Int_t label, Bool_t primary, Float_t mass + ,Int_t charge, Int_t pdg) +{ + + // + // Main constructor + // + + fLab = label; + fPrimary = primary; + fMass = mass; + fCharge = charge; + fPDG = pdg; + fN = 0; + + for(Int_t i=0; i<200; i++) fIndex[i]=-1; + + for(Int_t i=0; i<6; i++) { + for(Int_t j=0; j<3; j++) { + Pin[i][j]=0.; + Pout[i][j] = 0.; + } + } + +} + +//_____________________________________________________________________________ +void AliTRDmcTrack::GetPxPyPz(Double_t& px, Double_t& py, Double_t& pz, + Int_t opt = 0) const +{ + // + // Returns momentum components at the entrance (opt >= 0), or + // exit (opt < 0) of TRD. + // + + Int_t i; + + if(opt >= 0) { + for(i = 0; i < AliTRDgeometry::Nplan(); i++) { + if( Pin[i][0] * Pin[i][0] + + Pin[i][1] * Pin[i][1] + + Pin[i][2] * Pin[i][2] > 0.0005) break; + } + px = Pin[0][0]; py = Pin[0][1]; pz = Pin[0][2]; + } + else { + for(i = AliTRDgeometry::Nplan() - 1; i >= 0; i--) { + if( Pout[i][0] * Pout[i][0] + + Pout[i][1] * Pout[i][1] + + Pout[i][2] * Pout[i][2] > 0.0005) break; + } + px = Pout[i][0]; py = Pout[i][1]; pz = Pout[i][2]; + } + + return; + +} + +//_____________________________________________________________________________ +void AliTRDmcTrack::GetPlanePxPyPz(Double_t& px, Double_t& py, Double_t& pz, + Int_t plane, Int_t opt = 0) const +{ + // + // Returns momentum components at the entrance (opt >= 0), or + // exit (opt < 0) of TRD plane . + // + + if(opt >= 0) { + px = Pin[plane][0]; py = Pin[plane][1]; pz = Pin[plane][2]; + } + else { + px = Pout[plane][0]; py = Pout[plane][1]; pz = Pout[plane][2]; + } + + return; + +} diff --git a/TRD/AliTRDmcTrack.h b/TRD/AliTRDmcTrack.h new file mode 100644 index 00000000000..3c39143990f --- /dev/null +++ b/TRD/AliTRDmcTrack.h @@ -0,0 +1,59 @@ +#ifndef ALITRDMCTRACK_H +#define ALITRDMCTRACK_H + +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ + +#include + +class AliTRDgeometry; + +class AliTRDmcTrack : public TObject { + +// Represents TRD related info about generated track + +public: + + AliTRDmcTrack(); + AliTRDmcTrack(Int_t label, Bool_t primary, Float_t mass, Int_t charge, Int_t pdg); + + void SetPin(Int_t plane, Double_t px, Double_t py, Double_t pz) + { Pin[plane][0] = px; Pin[plane][1] = py; Pin[plane][2] = pz; } + + void SetPout(Int_t plane, Double_t px, Double_t py, Double_t pz) + { Pout[plane][0] = px; Pout[plane][1] = py; Pout[plane][2] = pz; } + + void GetPxPyPz(Double_t &px, Double_t &py, Double_t &pz, Int_t opt = 0) const; + void GetPlanePxPyPz(Double_t &px, Double_t &py, Double_t &pz + ,Int_t plane, Int_t opt = 0) const; + + void Update(Int_t index) { if (fN < 199) fIndex[fN++] = index; } + + Int_t GetTrackIndex() const { return fLab; } + Bool_t IsPrimary() const { return fPrimary; } + Float_t GetMass() const { return fMass; } + Int_t GetCharge() const { return fCharge; } + Int_t GetPdgCode() const { return fPDG; } + + Int_t GetNumberOfClusters() const { return fN; } + Int_t GetClusterIndex(Int_t i) const { return fIndex[i]; } + +protected: + + Int_t fLab; // Track index + Bool_t fPrimary; // TRUE if it's a primary particle + Float_t fMass; // Mass of the MC track + Int_t fCharge; // Charge of the MC track + Int_t fPDG; // PDG code of the MC track + + Int_t fN; // Number of TRD clusters associated with the track + Int_t fIndex[200]; // Indices of these clusters + + Double_t Pin[6][3]; // Px,Py,Pz at the entrance of each TRD plane + Double_t Pout[6][3]; // Px,Py,Pz at the exit of each TRD plane + + ClassDef(AliTRDmcTrack,1) // TRD MC track + +}; + +#endif diff --git a/TRD/AliTRDpid.cxx b/TRD/AliTRDpid.cxx index 1629e8a9aa3..c6a2105164b 100644 --- a/TRD/AliTRDpid.cxx +++ b/TRD/AliTRDpid.cxx @@ -15,14 +15,17 @@ /* $Log$ +Revision 1.1 2001/05/07 08:08:05 cblume +Update of TRD code + */ /////////////////////////////////////////////////////////////////////////////// // // -// The TRD particle identification class // +// The TRD particle identification base class // // // // Its main purposes are: // -// - Creation and bookkeeping of the propability distributions // +// - Provide I/O framework for all neccessary files // // - Assignment of a e/pi propability to a given track // // // /////////////////////////////////////////////////////////////////////////////// @@ -54,16 +57,17 @@ AliTRDpid::AliTRDpid():TNamed() // AliTRDpid default constructor // - fNMom = 0; - fMinMom = 0; - fMaxMom = 0; - fWidMom = 0; + fTrackArray = NULL; + fClusterArray = NULL; + fGeometry = NULL; + fFileKine = NULL; - fQHist = NULL; - fLQHist = NULL; - fTrackArray = NULL; - fClusterArray = NULL; - fGeometry = NULL; + fPIDratioMin = 0.0; + fPIDpurePoints = kFALSE; + fPIDindexMin = 0; + fPIDindexMax = 0; + + fThreePadOnly = kFALSE; } @@ -74,16 +78,10 @@ AliTRDpid::AliTRDpid(const char* name, const char* title):TNamed(name,title) // AliTRDpid constructor // - fNMom = 0; - fMinMom = 0; - fMaxMom = 0; - fWidMom = 0; - - fQHist = NULL; - fLQHist = NULL; fTrackArray = NULL; fClusterArray = NULL; fGeometry = NULL; + fFileKine = NULL; Init(); @@ -117,15 +115,7 @@ AliTRDpid::~AliTRDpid() delete fTrackArray; } - if (fQHist) { - fQHist->Delete(); - delete fQHist; - } - - if (fLQHist) { - fLQHist->Delete(); - delete fLQHist; - } + fFileKine->Close(); } @@ -148,17 +138,15 @@ void AliTRDpid::Copy(TObject &p) // Copy function // - fQHist->Copy(*((AliTRDpid &) p).fQHist); - fLQHist->Copy(*((AliTRDpid &) p).fLQHist); - - ((AliTRDpid &) p).fTrackArray = NULL; - ((AliTRDpid &) p).fClusterArray = NULL; - ((AliTRDpid &) p).fGeometry = NULL; - - ((AliTRDpid &) p).fNMom = fNMom; - ((AliTRDpid &) p).fMinMom = fMinMom; - ((AliTRDpid &) p).fMaxMom = fMaxMom; - ((AliTRDpid &) p).fWidMom = fWidMom; + ((AliTRDpid &) p).fTrackArray = NULL; + ((AliTRDpid &) p).fClusterArray = NULL; + ((AliTRDpid &) p).fGeometry = NULL; + ((AliTRDpid &) p).fFileKine = NULL; + ((AliTRDpid &) p).fPIDratioMin = fPIDratioMin; + ((AliTRDpid &) p).fPIDpurePoints = fPIDpurePoints; + ((AliTRDpid &) p).fPIDindexMin = fPIDindexMin; + ((AliTRDpid &) p).fPIDindexMax = fPIDindexMax; + ((AliTRDpid &) p).fThreePadOnly = fThreePadOnly; } @@ -169,172 +157,81 @@ Bool_t AliTRDpid::Init() // Initializes the PID object // - fClusterArray = new TObjArray(); - fTrackArray = new TObjArray(); + fClusterArray = new TObjArray(); + fTrackArray = new TObjArray(); + + fPIDratioMin = 0.7; + fPIDpurePoints = kTRUE; + fPIDindexMin = -1; + fPIDindexMax = -1; + + fThreePadOnly = kFALSE; return kTRUE; } //_____________________________________________________________________________ -Bool_t AliTRDpid::AssignLQ(TObjArray *tarray) +Bool_t AliTRDpid::AssignLikelihood() { // - // Assigns the e / pi Q-likelihood to all tracks in the array + // Assigns the e / pi likelihood to all tracks. // - Bool_t status = kTRUE; - - AliTRDtrack *track; - - TIter nextTrack(tarray); - while ((track = (AliTRDtrack *) nextTrack())) { - if (!AssignLQ(track)) { - status = kFALSE; - break; - } - } - - return status; + return AssignLikelihood(fTrackArray); } //_____________________________________________________________________________ -Bool_t AliTRDpid::AssignLQ(AliTRDtrack *t) +Bool_t AliTRDpid::AssignLikelihood(TObjArray *tarray) { // - // Assigns the e / pi Q-likelihood to a given track + // Assigns the e / pi likelihood to all tracks in the array . // - const Int_t kNplane = AliTRDgeometry::Nplan(); - Float_t charge[kNplane]; + Bool_t status = kTRUE; - // Calculate the total charge in each plane - if (!SumCharge(t,charge)) return kFALSE; + AliTRDtrack *track; - // Assign the likelihoods - t->SetLikelihoodPion(LQPion(charge)); - t->SetLikelihoodElectron(LQElectron(charge)); + TIter nextTrack(tarray); + while ((track = (AliTRDtrack *) nextTrack())) { + if (!AssignLikelihood(track)) { + status = kFALSE; + continue; + } + } - return kTRUE; + return status; } //_____________________________________________________________________________ -Bool_t AliTRDpid::CreateHistograms(const Int_t nmom - , const Float_t minmom - , const Float_t maxmom) +Bool_t AliTRDpid::FillSpectra() { // - // Creates the likelihood histograms + // Fills the energy loss distributions with all tracks. // - Int_t imom; - Int_t ipid; - Int_t ipla; - - const Int_t kNpla = AliTRDgeometry::Nplan(); - - fNMom = nmom; - fMinMom = minmom; - fMaxMom = maxmom; - fWidMom = (maxmom - minmom) / ((Float_t) nmom); - - // The L-Q distributions - fLQHist = new TObjArray(kNpid * nmom); - for (imom = 0; imom < nmom; imom++) { - for (ipid = 0; ipid < kNpid; ipid++) { - Int_t index = GetIndexLQ(imom,ipid); - Char_t name[10]; - Char_t title[80]; - sprintf(name ,"hLQ%03d",index); - if (ipid == kElectron) { - sprintf(title,"L-Q electron p-bin %03d",imom); - } - else { - sprintf(title,"L-Q pion p-bin %03d",imom); - } - TH1F *hTmp = new TH1F(name,title,416,-0.02,1.02); - fLQHist->AddAt(hTmp,index); - } - } - - // The Q-distributions - fQHist = new TObjArray(kNpla * kNpid * nmom); - for (imom = 0; imom < nmom; imom++) { - for (ipid = 0; ipid < kNpid; ipid++) { - for (ipla = 0; ipla < kNpla; ipla++) { - Int_t index = GetIndexQ(imom,ipla,ipid); - Char_t name[10]; - Char_t title[80]; - sprintf(name ,"hQ%03d",index); - if (ipid == kElectron) { - sprintf(title,"Q electron p-bin %03d plane %d",imom,ipla); - } - else { - sprintf(title,"Q pion p-bin %03d plane %d",imom,ipla); - } - TH1F *hTmp = new TH1F(name,title,100,0.0,5000.0); - fQHist->AddAt(hTmp,index); - } - } - } - - return kTRUE; + return FillSpectra(fTrackArray); } - + //_____________________________________________________________________________ -Bool_t AliTRDpid::FillQspectra() +Bool_t AliTRDpid::FillSpectra(TObjArray *tarray) { // - // Fills the Q-spectra histograms. + // Fills the energy loss distributions with all tracks in . // Bool_t status = kTRUE; AliTRDtrack *track; - TIter nextTrack(fTrackArray); + TIter nextTrack(tarray); while ((track = (AliTRDtrack *) nextTrack())) { - if (!FillQspectra(track)) { + if (!FillSpectra(track)) { status = kFALSE; - break; - } - } - - return status; - -} - -//_____________________________________________________________________________ -Bool_t AliTRDpid::FillQspectra(const AliTRDtrack *t) -{ - // - // Fills the Q-spectra histograms with track . - // - - const Int_t kNpla = AliTRDgeometry::Nplan(); - - if (isnan(t->GetP())) return kTRUE; - - printf("----------------------------------------------------------\n"); - Float_t charge[kNpla]; - Float_t mom = t->GetP(); - Int_t ipid = Pid(t); - - if (!SumCharge(t,charge)) return kFALSE; - - printf(" ipid = %d\n",ipid); - printf(" mom = %f\n",mom); - printf(" charge = %8.2f, %8.2f, %8.2f, %8.2f, %8.2f, %8.2f\n" - ,charge[0],charge[1],charge[2],charge[3],charge[4],charge[5]); - - for (Int_t ipla = 0; ipla < kNpla; ipla++) { - Int_t index = GetIndexQ(mom,ipla,ipid); - if (index > -1) { - TH1F *hTmp = (TH1F *) fQHist->UncheckedAt(index); - hTmp->Fill(charge[ipla]); + continue; } } @@ -346,15 +243,15 @@ Bool_t AliTRDpid::FillQspectra(const AliTRDtrack *t) Bool_t AliTRDpid::Open(const Char_t *name, Int_t event) { // - // Opens and reads the kine tree, the geometry, the cluster array. - // and the track array from the file + // Opens and reads the kine tree, the geometry, the cluster array + // and the track array from the file . // Bool_t status = kTRUE; - status = ReadKine(name,event); status = ReadCluster(name); status = ReadTracks(name); + status = ReadKine(name,event); return status; @@ -369,14 +266,14 @@ Bool_t AliTRDpid::Open(const Char_t *namekine // // Opens and reads the kine tree and the geometry from file , // the cluster array from file , - // and the track array from the file + // and the track array from the file . // Bool_t status = kTRUE; - status = ReadKine(namekine,event); status = ReadCluster(namecluster); status = ReadTracks(nametracks); + status = ReadKine(namekine,event); return status; @@ -389,19 +286,19 @@ Bool_t AliTRDpid::ReadKine(const Char_t *name, Int_t event) // Opens and reads the kine tree and the geometry from the file . // - TFile *file = (TFile *) gROOT->GetListOfFiles()->FindObject(name); - if (!file) { + TFile *fFileKine = (TFile *) gROOT->GetListOfFiles()->FindObject(name); + if (!fFileKine) { printf("AliTRDpid::ReadKine -- "); printf("Open file %s\n",name); - file = new TFile(name); - if (!file) { + fFileKine = new TFile(name); + if (!fFileKine) { printf("AliTRDpid::ReadKine -- "); printf("Cannot open file %s\n",name); return kFALSE; } } - gAlice = (AliRun *) file->Get("gAlice"); + gAlice = (AliRun *) fFileKine->Get("gAlice"); if (!gAlice) { printf("AliTRDpid::ReadKine -- "); printf("No AliRun object found\n"); @@ -423,8 +320,6 @@ Bool_t AliTRDpid::ReadKine(const Char_t *name, Int_t event) return kFALSE; } - file->Close(); - return kTRUE; } @@ -435,8 +330,15 @@ Bool_t AliTRDpid::ReadCluster(const Char_t *name) // // Opens and reads the cluster array from the file . // + + TDirectory *savedir = gDirectory; - fClusterArray->Delete(); + if (fClusterArray) { + fClusterArray->Delete(); + } + else { + fClusterArray = new TObjArray(); + } printf("AliTRDpid::ReadCluster -- "); printf("Open file %s\n",name); @@ -452,6 +354,8 @@ Bool_t AliTRDpid::ReadCluster(const Char_t *name) delete tracker; + savedir->cd(); + return kTRUE; } @@ -462,8 +366,15 @@ Bool_t AliTRDpid::ReadTracks(const Char_t *name) // // Opens and reads the track array from the file . // + + TDirectory *savedir = gDirectory; - fTrackArray->Delete(); + if (fTrackArray) { + fTrackArray->Delete(); + } + else { + fTrackArray = new TObjArray(); + } TFile *file = (TFile *) gROOT->GetListOfFiles()->FindObject(name); if (!file) { @@ -490,93 +401,38 @@ Bool_t AliTRDpid::ReadTracks(const Char_t *name) file->Close(); - return kTRUE; - -} - -//_____________________________________________________________________________ -Int_t AliTRDpid::GetIndexQ(const Float_t mom, const Int_t ipla, const Int_t ipid) -{ - // - // Returns the Q-spectrum histogram index - // - - if ((mom < fMinMom) || (mom > fMaxMom)) return -1; - Int_t imom = ((Int_t) ((mom - fMinMom) / fWidMom)); - return GetIndexQ(imom,ipla,ipid); - -} - -//_____________________________________________________________________________ -Int_t AliTRDpid::GetIndexQ(const Int_t imom, const Int_t ipla, const Int_t ipid) -{ - // - // Returns the Q-spectrum histogram index - // - - const Int_t kNpla = AliTRDgeometry::Nplan(); - if ((ipid < 0) || (ipid >= kNpid)) return -1; - return imom * (kNpid * kNpla) + ipla * kNpid + ipid; - -} - -//_____________________________________________________________________________ -Int_t AliTRDpid::GetIndexLQ(const Float_t mom, const Int_t ipid) -{ - // - // Returns the Q-likelihood histogram index - // - - if ((mom < fMinMom) || (mom > fMaxMom)) return -1; - Int_t imom = ((Int_t) ((mom - fMinMom) / fWidMom)); - return GetIndexLQ(imom,ipid); - -} - -//_____________________________________________________________________________ -Int_t AliTRDpid::GetIndexLQ(const Int_t imom, const Int_t ipid) -{ - // - // Returns the Q-likelihood histogram index - // + savedir->cd(); - if ((ipid < 0) || (ipid >= kNpid)) return -1; - return imom * kNpid + ipid; + return kTRUE; } //_____________________________________________________________________________ -Int_t AliTRDpid::Pid(const AliTRDtrack *t) +Int_t AliTRDpid::MCpid(const AliTRDtrack *t) { // - // Determines the pid of the track - // For a given track to be assigned an electron or pion pid it requires - // that more than a fraction of 0.7 of all associated cluster are 'pure' - // clusters -- meaning to have only contribution from one particle -- - // of the specific particle type. + // Determines the pid of the MC track . // // PDG codes const Int_t kPdgEl = 11; const Int_t kPdgPi = 211; - // Minimum fraction of cluster from one particle - const Float_t kRatioMin = 0.7; - AliTRDcluster *cluster; TParticle *particle; - Int_t nClusterEl = 0; - Int_t nClusterPi = 0; - Int_t nClusterNo = 0; + Int_t nClusterEl = 0; + Int_t nClusterPi = 0; + Int_t nClusterPure = 0; + Int_t nClusterMix = 0; - Float_t ratioEl = 0; - Float_t ratioPi = 0; + Float_t ratioEl = 0; + Float_t ratioPi = 0; - Int_t ipid = -1; + Int_t ipid = -1; if (!fClusterArray) { - printf("AliTRDpid::Pid -- "); + printf("AliTRDpid::MCpid -- "); printf("ClusterArray not defined. Initialize the PID object first\n"); return -1; } @@ -594,23 +450,37 @@ Int_t AliTRDpid::Pid(const AliTRDtrack *t) // Get the first two MC track indices Int_t track0 = cluster->GetTrackIndex(0); Int_t track1 = cluster->GetTrackIndex(1); - printf(" track0 = %d, track1 = %d\n",track0,track1); - - // Take only 'pure' cluster - if ((track0 > -1) && (track1 == -1)) { - - particle = gAlice->Particle(track0); - switch (TMath::Abs(particle->GetPdgCode())) { - case kPdgEl: - nClusterEl++; - break; - case kPdgPi: - nClusterPi++; - break; - default: - nClusterNo++; - break; - }; + + // Check on the track index to find the right primaries + if ((track0 > fPIDindexMin) && + (track0 <= fPIDindexMax)) { + + // Check whether it is a pure cluster, i.e. not overlapping + Bool_t accept = kTRUE; + if ((fPIDpurePoints) && (track1 != -1)) { + accept = kFALSE; + } + if (accept) { + + particle = gAlice->Particle(track0); + if (particle->GetFirstMother() == -1) { + switch (TMath::Abs(particle->GetPdgCode())) { + case kPdgEl: + nClusterEl++; + break; + case kPdgPi: + nClusterPi++; + break; + }; + nClusterPure++; + } + + } + else { + + nClusterMix++; + + } } @@ -619,23 +489,125 @@ Int_t AliTRDpid::Pid(const AliTRDtrack *t) if (nCluster) { ratioEl = ((Float_t) nClusterEl) / ((Float_t) nCluster); ratioPi = ((Float_t) nClusterPi) / ((Float_t) nCluster); - if (ratioEl > kRatioMin) { + if (ratioEl > fPIDratioMin) { ipid = kElectron; } - else if (ratioPi > kRatioMin) { + else if (ratioPi > fPIDratioMin) { ipid = kPion; } } - printf(" nCluster = %d, nClusterEl = %d, nClusterPi = %d, nClusterNo = %d\n" - ,nCluster,nClusterEl,nClusterPi,nClusterNo); - printf(" ratioEl = %f, ratioPi = %f\n",ratioEl,ratioPi); +// printf("AliTRDpid::MCpid -- "); +// printf("nCluster = %d, nClusterEl = %d, nClusterPi = %d\n" +// ,nCluster,nClusterEl,nClusterPi); +// printf("AliTRDpid::MCpid -- "); +// printf("nClusterPure = %d, nClusterMix = %d\n" +// ,nClusterPure,nClusterMix); +// printf("AliTRDpid::MCpid -- "); +// printf("ratioEl = %f, ratioPi = %f, ipid = %d\n",ratioEl,ratioPi,ipid); return ipid; } //_____________________________________________________________________________ -Bool_t AliTRDpid::SumCharge(const AliTRDtrack *t, Float_t *charge) +Int_t AliTRDpid::MCpid(const AliTRDtrack *t, Int_t *pdg + , Int_t *nFound + , Int_t *indices) +{ + // + // Determines the pid of the MC track . + // Returns the number of different MC particles that contribute to this + // track. contains their PDG code, ordered by their frequency. + // contains the corresponding number of cluster that contain + // contributions to this cluster. + // + + const Int_t kNtrack = 3; + const Int_t kNpart = 200; + + AliTRDcluster *cluster; + TParticle *particle; + + Int_t nPart = 0; + Int_t iPart = 0; + Int_t iTrack = 0; + Int_t iCluster = 0; + + if (!fClusterArray) { + printf("AliTRDpid::MCpid -- "); + printf("ClusterArray not defined. Initialize the PID object first\n"); + return -1; + } + + Int_t sort[kNpart]; + Int_t pdgTmp[kNpart]; + Int_t nFoundTmp[kNpart]; + Int_t indicesTmp[kNpart]; + for (iPart = 0; iPart < kNpart; iPart++) { + pdg[iPart] = 0; + nFound[iPart] = 0; + indices[iPart] = 0; + pdgTmp[iPart] = 0; + nFoundTmp[iPart] = 0; + indicesTmp[iPart] = 0; + sort[iPart] = 0; + } + + // Loop through all clusters associated to this track + Int_t nCluster = t->GetNclusters(); + for (iCluster = 0; iCluster < nCluster; iCluster++) { + + // Get a cluster + Int_t index = t->GetClusterIndex(iCluster); + if (!(cluster = (AliTRDcluster *) fClusterArray->UncheckedAt(index))) { + break; + } + + // Get the MC track indices + for (iTrack = 0; iTrack < kNtrack; iTrack++) { + + Int_t trackIndex = cluster->GetTrackIndex(iTrack); + if (trackIndex >= 0) { + particle = gAlice->Particle(trackIndex); + Int_t pdgCode = particle->GetPdgCode(); + Bool_t newPart = kTRUE; + for (iPart = 0; iPart < nPart; iPart++) { + if (trackIndex == indicesTmp[iPart]) { + nFoundTmp[iPart]++; + newPart = kFALSE; + break; + } + } + if ((newPart) && (nPart < kNpart)) { + indicesTmp[nPart] = trackIndex; + pdgTmp[nPart] = pdgCode; + nFoundTmp[nPart]++; + nPart++; + } + } + + } + + } + + // Sort the arrays by the frequency of the appearance of a MC track + TMath::Sort(nPart,nFoundTmp,sort,kTRUE); + for (iPart = 0; iPart < nPart; iPart++) { + pdg[iPart] = pdgTmp[sort[iPart]]; + nFound[iPart] = nFoundTmp[sort[iPart]]; + indices[iPart] = indicesTmp[sort[iPart]]; +// printf(" iPart = %d, pdg = %d, nFound = %d, indices = %d\n" +// ,iPart,pdg[iPart],nFound[iPart],indices[iPart]); + } + + return nPart; + +} + +//_____________________________________________________________________________ +Bool_t AliTRDpid::SumCharge(const AliTRDtrack *t + , Float_t *charge + , Int_t *nCluster) { // // Sums up the charge in each plane for track . @@ -647,7 +619,8 @@ Bool_t AliTRDpid::SumCharge(const AliTRDtrack *t, Float_t *charge) const Int_t kNplane = AliTRDgeometry::Nplan(); for (Int_t iPlane = 0; iPlane < kNplane; iPlane++) { - charge[iPlane] = 0.0; + charge[iPlane] = 0.0; + nCluster[iPlane] = 0; } if (!fClusterArray) { @@ -662,45 +635,46 @@ Bool_t AliTRDpid::SumCharge(const AliTRDtrack *t, Float_t *charge) } // Loop through all clusters associated to this track - Int_t nCluster = t->GetNclusters(); - for (Int_t iCluster = 0; iCluster < nCluster; iCluster++) { + Int_t nClus = t->GetNclusters(); + for (Int_t iClus = 0; iClus < nClus; iClus++) { // Get a cluster - Int_t index = t->GetClusterIndex(iCluster); + Int_t index = t->GetClusterIndex(iClus); if (!(cluster = (AliTRDcluster *) fClusterArray->UncheckedAt(index))) { status = kFALSE; break; } + if (fThreePadOnly) { + if ((!cluster->From2pad()) && + (!cluster->From3pad())) continue; + } + // Sum up the charge Int_t plane = fGeometry->GetPlane(cluster->GetDetector()); - charge[plane] += cluster->GetQ(); + //charge[plane] += cluster->GetQ(); + // Corrected charge + charge[plane] += t->GetClusterdQdl(iClus); + nCluster[plane]++; } +// printf("AliTRDpid::SumCharge -- "); +// printf("charge = %d, %d, %d, %d, %d, %d\n" +// ,(Int_t) charge[0] +// ,(Int_t) charge[1] +// ,(Int_t) charge[2] +// ,(Int_t) charge[3] +// ,(Int_t) charge[4] +// ,(Int_t) charge[5]); +// printf("AliTRDpid::SumCharge -- "); +// printf("nCluster = %d, %d, %d, %d, %d, %d\n" +// ,nCluster[0] +// ,nCluster[1] +// ,nCluster[2] +// ,nCluster[3] +// ,nCluster[4] +// ,nCluster[5]); return status; } - -//_____________________________________________________________________________ -Float_t AliTRDpid::LQElectron(const Float_t *charge) -{ - // - // Returns the Q-likelihood to be a electron - // - - return 1; - -} - -//_____________________________________________________________________________ -Float_t AliTRDpid::LQPion(const Float_t *charge) -{ - // - // Returns the Q-likelihood to be a pion - // - - return 0; - -} - diff --git a/TRD/AliTRDpid.h b/TRD/AliTRDpid.h index 886d0117769..99da2182ad3 100644 --- a/TRD/AliTRDpid.h +++ b/TRD/AliTRDpid.h @@ -3,7 +3,7 @@ /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * * See cxx source for full Copyright notice */ -/* $Id$ */ +/* $Id$ */ #include @@ -25,36 +25,45 @@ class AliTRDpid : public TNamed { virtual void Copy(TObject &p); virtual Bool_t Init(); - virtual Bool_t AssignLQ(TObjArray *tarray); - virtual Bool_t AssignLQ(AliTRDtrack *t); - virtual Bool_t FillQspectra(); - virtual Bool_t FillQspectra(const AliTRDtrack *t); - virtual Bool_t CreateHistograms(const Int_t nmom - , const Float_t minmom - , const Float_t maxmom); - virtual Float_t LQPion(const Float_t *charge); - virtual Float_t LQElectron(const Float_t *charge); + virtual Bool_t AssignLikelihood(); + virtual Bool_t AssignLikelihood(TObjArray *tarray); + virtual Bool_t AssignLikelihood(AliTRDtrack *t) = 0; + virtual Bool_t FillSpectra(); + virtual Bool_t FillSpectra(TObjArray *tarray); + virtual Bool_t FillSpectra(const AliTRDtrack *t) = 0; virtual Bool_t Open(const Char_t *name, Int_t event = 0); virtual Bool_t Open(const Char_t *namekine , const Char_t *namecluster , const Char_t *nametracks, Int_t event = 0); - virtual Int_t Pid(const AliTRDtrack *t); + virtual Int_t MCpid(const AliTRDtrack *t); + virtual Int_t MCpid(const AliTRDtrack *t, Int_t *pdg, Int_t *nFound, Int_t *indices); virtual Bool_t ReadCluster(const Char_t *name); virtual Bool_t ReadTracks(const Char_t *name); virtual Bool_t ReadKine(const Char_t *name, Int_t event); - virtual Bool_t SumCharge(const AliTRDtrack *t, Float_t *charge); + virtual Bool_t SumCharge(const AliTRDtrack *t, Float_t *charge, Int_t *nCluster); - inline Int_t GetIndexLQ(const Int_t imom, const Int_t ipid); - inline Int_t GetIndexLQ(const Float_t mom, const Int_t ipid); - inline Int_t GetIndexQ(const Int_t imom, const Int_t ipla, const Int_t ipid); - inline Int_t GetIndexQ(const Float_t mom, const Int_t ipla, const Int_t ipid); + virtual Int_t GetIndex(const AliTRDtrack *t) = 0; - TObjArray* GetQHist() const { return fQHist; }; - TObjArray* GetLQHist() const { return fLQHist; }; + void SetGeometry(AliTRDgeometry *geo) { fGeometry = geo; }; + void SetTrackArray(TObjArray *tarray) { fTrackArray = tarray; }; + void SetClusterArray(TObjArray *carray) { fClusterArray = carray; }; - void SetGeometry(AliTRDgeometry *geo) { fGeometry = geo; }; - void SetTrackArray(TObjArray *tarray) { fTrackArray = tarray; }; - void SetClusterArray(TObjArray *carray) { fClusterArray = carray; }; + void SetPIDratioMin(Float_t min) { fPIDratioMin = min; }; + void SetPIDpurePoints(Bool_t pure) { fPIDpurePoints = pure; }; + void SetPIDindexMin(Int_t min) { fPIDindexMin = min; }; + void SetPIDindexMax(Int_t max) { fPIDindexMax = max; }; + + void SetThreePadOnly(Bool_t only) { fThreePadOnly = only; }; + + TObjArray *GetTrackArray() { return fTrackArray; }; + TObjArray *GetClusterArray() { return fClusterArray; }; + + Float_t GetPIDratioMin() { return fPIDratioMin; }; + Bool_t GetPIDpurePoints() { return fPIDpurePoints; }; + Float_t GetPIDindexMin() { return fPIDindexMin; }; + Float_t GetPIDindexMax() { return fPIDindexMax; }; + + Bool_t GetThreePadOnly() { return fThreePadOnly; }; protected: @@ -64,17 +73,19 @@ class AliTRDpid : public TNamed { kPion = 1 // Pion pid }; - Int_t fNMom; // Number of momentum bins - Float_t fMinMom; // Lower momentum - Float_t fMaxMom; // Upper momentum - Float_t fWidMom; // Width of the momentum bins - TObjArray *fLQHist; // Array of L-Q histograms - TObjArray *fQHist; // Array of Q histograms + Float_t fPIDratioMin; // Minimum fraction of cluster from one particle + Bool_t fPIDpurePoints; // Require pure (nono overlapping) cluster + Int_t fPIDindexMin; // Lower index MC particles to be considered + Int_t fPIDindexMax; // Upper index MC particles to be considered + + Bool_t fThreePadOnly; // Use only three pad cluster in the charge sum + TObjArray *fTrackArray; //! Array containing the tracks TObjArray *fClusterArray; //! Array containing the cluster AliTRDgeometry *fGeometry; //! The TRD geometry + TFile *fFileKine; //! The kine input file - ClassDef(AliTRDpid,1) // Assigns e/pi propability to the tracks + ClassDef(AliTRDpid,1) // Assigns the e/pi propability to the tracks }; #endif diff --git a/TRD/AliTRDpidLQ.cxx b/TRD/AliTRDpidLQ.cxx new file mode 100644 index 00000000000..b500c4e62f0 --- /dev/null +++ b/TRD/AliTRDpidLQ.cxx @@ -0,0 +1,404 @@ +/************************************************************************** + * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * * + * Author: The ALICE Off-line Project. * + * Contributors are mentioned in the code where appropriate. * + * * + * Permission to use, copy, modify and distribute this software and its * + * documentation strictly for non-commercial purposes is hereby granted * + * without fee, provided that the above copyright notice appears in all * + * copies and that both the copyright notice and this permission notice * + * appear in the supporting documentation. The authors make no claims * + * about the suitability of this software for any purpose. It is * + * provided "as is" without express or implied warranty. * + **************************************************************************/ + +/* +$Log$ +*/ + +/////////////////////////////////////////////////////////////////////////////// +// // +// The TRD particle identification class // +// // +// Its main purposes are: // +// - Creation and bookkeeping of the propability distributions // +// - Assignment of a e/pi propability to a given track based on // +// the LQ method // +// // +/////////////////////////////////////////////////////////////////////////////// + +#include +#include + +#include +#include +#include +#include +#include +#include + +#include "AliRun.h" +#include "AliTRD.h" +#include "AliTRDpidLQ.h" +#include "AliTRDcluster.h" +#include "AliTRDtrack.h" +#include "AliTRDtracker.h" +#include "AliTRDgeometry.h" + +ClassImp(AliTRDpidLQ) + +//_____________________________________________________________________________ +AliTRDpidLQ::AliTRDpidLQ():AliTRDpid() +{ + // + // AliTRDpidLQ default constructor + // + + fNMom = 0; + fMinMom = 0; + fMaxMom = 0; + fWidMom = 0; + + fNLh = 0; + fMinLh = 0; + fMaxLh = 0; + + fHist = NULL; + + fChargeMin = 0; + fNClusterMin = 0; + +} + +//_____________________________________________________________________________ +AliTRDpidLQ::AliTRDpidLQ(const char* name, const char* title) + :AliTRDpid(name,title) +{ + // + // AliTRDpidLQ constructor + // + + fNMom = 0; + fMinMom = 0; + fMaxMom = 0; + fWidMom = 0; + + fNLh = 0; + fMinLh = 0; + fMaxLh = 0; + + fHist = NULL; + + Init(); + +} + +//_____________________________________________________________________________ +AliTRDpidLQ::AliTRDpidLQ(const AliTRDpidLQ &p) +{ + // + // AliTRDpidLQ copy constructor + // + + ((AliTRDpidLQ &) p).Copy(*this); + +} + +//_____________________________________________________________________________ +AliTRDpidLQ::~AliTRDpidLQ() +{ + // + // AliTRDpidLQ destructor + // + + if (fHist) { + fHist->Delete(); + delete fHist; + } + +} + +//_____________________________________________________________________________ +AliTRDpidLQ &AliTRDpidLQ::operator=(const AliTRDpidLQ &p) +{ + // + // Assignment operator + // + + if (this != &p) ((AliTRDpidLQ &) p).Copy(*this); + return *this; + +} + +//_____________________________________________________________________________ +void AliTRDpidLQ::Copy(TObject &p) +{ + // + // Copy function + // + + fHist->Copy(*((AliTRDpidLQ &) p).fHist); + + ((AliTRDpidLQ &) p).fNMom = fNMom; + ((AliTRDpidLQ &) p).fMinMom = fMinMom; + ((AliTRDpidLQ &) p).fMaxMom = fMaxMom; + ((AliTRDpidLQ &) p).fWidMom = fWidMom; + ((AliTRDpidLQ &) p).fChargeMin = fChargeMin; + ((AliTRDpidLQ &) p).fNClusterMin = fNClusterMin; + ((AliTRDpidLQ &) p).fNLh = fNLh; + ((AliTRDpidLQ &) p).fMinLh = fMinLh; + ((AliTRDpidLQ &) p).fMaxLh = fMaxLh; + + AliTRDpid::Copy(p); + +} + +//_____________________________________________________________________________ +Bool_t AliTRDpidLQ::Init() +{ + // + // Initializes the PID object + // + + fChargeMin = 0.0; + fNClusterMin = 10; + + fNLh = 100; + fMinLh = 0.0; + fMaxLh = 500.0; + + return kTRUE; + +} + +//_____________________________________________________________________________ +Bool_t AliTRDpidLQ::AssignLikelihood(AliTRDtrack *t) +{ + // + // Assigns the e / pi likelihood to a given track + // + + const Int_t kNpla = AliTRDgeometry::Nplan(); + Float_t charge[kNpla]; + Int_t nCluster[kNpla]; + + Float_t lhPi = 0; + Float_t lhEl = 0; + + Double_t pPi = 1; + Double_t pEl = 1; + Double_t pSum = 0; + + Int_t indexEl; + Int_t indexPi; + TH1F *hTmpEl; + TH1F *hTmpPi; + + t->SetLikelihoodElectron(-1.); + if (isnan(t->GetP())) return kFALSE; + Float_t mom = t->GetP(); + + // Calculate the total charge in each plane + if (!SumCharge(t,charge,nCluster)) return kFALSE; + + indexEl = GetIndex(mom,kElectron); + indexPi = GetIndex(mom,kPion); + if ((indexEl > -1) && (indexPi > -1)) { + hTmpEl = (TH1F *) fHist->UncheckedAt(indexEl); + hTmpPi = (TH1F *) fHist->UncheckedAt(indexPi); + for (Int_t ipla = 0; ipla < kNpla; ipla++) { + Float_t chargePlane = charge[ipla]; + Int_t nClusterPlane = nCluster[ipla]; + if ((chargePlane > fChargeMin) && + (nClusterPlane > fNClusterMin)){ + Float_t chargeNorm = chargePlane / ((Float_t) nClusterPlane); + if (chargeNorm < fMaxLh) { + Int_t ibinEl = hTmpEl->FindBin(chargeNorm); + Float_t pElPlane = hTmpEl->GetBinContent(ibinEl); + if (pElPlane > 0) { + pEl = pEl * pElPlane; + } + Int_t ibinPi = hTmpPi->FindBin(chargeNorm); + Float_t pPiPlane = hTmpPi->GetBinContent(ibinPi); + if (pPiPlane > 0) { + pPi = pPi * pPiPlane; + } +// printf(" ipla = %d, nCluster = %d, charge = %f\n" +// ,ipla,nClusterPlane,chargeNorm); +// printf("electron: pElPlane = %f, ibinEl = %d, pEl = %f\n" +// ,pElPlane,ibinEl,pEl); +// printf(" pion: pPiPlane = %f, ibinPi = %d, pPi = %f\n" +// ,pPiPlane,ibinPi,pPi); + } + } + } + } + else { + return kTRUE; + } + + pSum = pEl + pPi; + if (pSum <= 0) return kFALSE; + lhEl = pEl / pSum; + lhPi = pPi / pSum; + +// printf("---- mom = %f, lhEl = %f, lhPi = %f\n",mom,lhEl,lhPi); + + // Assign the likelihoods + t->SetLikelihoodElectron(lhEl); + + return kTRUE; + +} + +//_____________________________________________________________________________ +Bool_t AliTRDpidLQ::CreateHistograms(const Int_t nmom + , const Float_t minmom + , const Float_t maxmom) +{ + // + // Creates the histograms + // + + Int_t imom; + Int_t ipid; + + fNMom = nmom; + fMinMom = minmom; + fMaxMom = maxmom; + fWidMom = (maxmom - minmom) / ((Float_t) nmom); + + fHist = new TObjArray(kNpid * nmom); + for (imom = 0; imom < nmom; imom++) { + for (ipid = 0; ipid < kNpid; ipid++) { + + Int_t index = GetIndex(imom,ipid); + Char_t name[10]; + Char_t title[80]; + sprintf(name ,"hQ%03d",index); + if (ipid == kElectron) { + sprintf(title,"Q electron p-bin %03d",imom); + } + else { + sprintf(title,"Q pion p-bin %03d",imom); + } + TH1F *hTmp = new TH1F(name,title,fNLh,fMinLh,fMaxLh); + fHist->AddAt(hTmp,index); + + } + } + + return kTRUE; + +} + +// //_____________________________________________________________________________ +// Bool_t AliTRDpidLQ::FillSpectra(const AliTRDtrack *t) +// { +// // +// // Fills the energy loss distributions with track . +// // + +// Bool_t status = kTRUE; + +// if (isnan(t->GetP())) return kFALSE; + +// Float_t mom = t->GetP(); +// Int_t ipid = MCpid(t); +// TH1F *hTmp = NULL; +// AliTRDcluster *cluster = NULL; + +// Int_t index = GetIndex(mom,ipid); +// if (index > -1) { +// hTmp = (TH1F *) fHist->UncheckedAt(index); +// // Loop through all clusters associated to this track +// Int_t nClus = t->GetNclusters(); +// for (Int_t iClus = 0; iClus < nClus; iClus++) { +// // Get a cluster +// Int_t idxClus = t->GetClusterIndex(iClus); +// if (!(cluster = (AliTRDcluster *) fClusterArray->UncheckedAt(idxClus))) { +// status = kFALSE; +// break; +// } +// hTmp->Fill(cluster->GetQ()); +// } +// } + +// return status; + +// } + +//_____________________________________________________________________________ +Bool_t AliTRDpidLQ::FillSpectra(const AliTRDtrack *t) +{ + // + // Fills the energy loss distributions with track . + // + + const Int_t kNpla = AliTRDgeometry::Nplan(); + + if (isnan(t->GetP())) return kFALSE; + + Float_t charge[kNpla]; + Int_t nCluster[kNpla]; + Float_t mom = t->GetP(); + Int_t ipid = MCpid(t); + TH1F *hTmp = NULL; + + if (!SumCharge(t,charge,nCluster)) return kFALSE; + + Int_t index = GetIndex(mom,ipid); + if (index > -1) { + hTmp = (TH1F *) fHist->UncheckedAt(index); + for (Int_t ipla = 0; ipla < kNpla; ipla++) { + if ((charge[ipla] > fChargeMin) && + (nCluster[ipla] > fNClusterMin)){ + hTmp->Fill(charge[ipla] / ((Float_t) nCluster[ipla])); + } + } + } + + return kTRUE; + +} + +//_____________________________________________________________________________ +Int_t AliTRDpidLQ::GetIndex(const AliTRDtrack *t) +{ + // + // Returns the histogram index + // + + if (isnan(t->GetP())) return -1; + Float_t mom = t->GetP(); + Int_t ipid = MCpid(t); + + return GetIndex(mom,ipid); + +} + +//_____________________________________________________________________________ +Int_t AliTRDpidLQ::GetIndex(const Float_t mom, const Int_t ipid) +{ + // + // Returns the histogram index + // + + if ((mom < fMinMom) || (mom > fMaxMom)) return -1; + Int_t imom = ((Int_t) ((mom - fMinMom) / fWidMom)); + return GetIndex(imom,ipid); + +} + +//_____________________________________________________________________________ +Int_t AliTRDpidLQ::GetIndex(const Int_t imom, const Int_t ipid) +{ + // + // Returns the histogram index + // + + if ((ipid < 0) || (ipid >= kNpid)) return -1; + return imom * kNpid + ipid; + +} diff --git a/TRD/AliTRDpidLQ.h b/TRD/AliTRDpidLQ.h new file mode 100644 index 00000000000..20773bab6a8 --- /dev/null +++ b/TRD/AliTRDpidLQ.h @@ -0,0 +1,66 @@ +#ifndef ALITRDPIDLQ_H +#define ALITRDPIDLQ_H +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ + +/* $Id$ */ + +#include "AliTRDpid.h" + +class AliTRDpidLQ : public AliTRDpid { + + public: + + AliTRDpidLQ(); + AliTRDpidLQ(const char* name, const char* title); + AliTRDpidLQ(const AliTRDpidLQ &p); + virtual ~AliTRDpidLQ(); + AliTRDpidLQ &operator=(const AliTRDpidLQ &p); + + virtual void Copy(TObject &p); + virtual Bool_t Init(); + virtual Bool_t AssignLikelihood(AliTRDtrack *t); + virtual Bool_t CreateHistograms(const Int_t nmom + , const Float_t minmom + , const Float_t maxmom); + virtual Bool_t FillSpectra(const AliTRDtrack *t); + + inline Int_t GetIndex(const AliTRDtrack *t); + inline Int_t GetIndex(const Int_t imom, const Int_t ipid); + inline Int_t GetIndex(const Float_t mom, const Int_t ipid); + + TObjArray* GetHist() const { return fHist; }; + + Float_t GetChargeMin() const { return fChargeMin; }; + Int_t GetNClusterMin() const { return fNClusterMin; }; + + Int_t GetNLh() const { return fNLh; }; + Float_t GetMinLh() const { return fMinLh; }; + Float_t GetMaxLh() const { return fMaxLh; }; + + void SetChargeMin(const Float_t min) { fChargeMin = min; }; + void SetNClusterMin(const Int_t min) { fNClusterMin = min; }; + + void SetNLh(const Int_t n) { fNLh = n; }; + void SetMinLh(const Float_t min) { fMinLh = min; }; + void SetMaxLh(const Float_t max) { fMaxLh = max; }; + + protected: + + Int_t fNMom; // Number of momentum bins + Float_t fMinMom; // Lower momentum + Float_t fMaxMom; // Upper momentum + Float_t fWidMom; // Width of the momentum bins + TObjArray *fHist; // Array of histograms + + Int_t fNLh; // Number of bins of the likelihood spectra + Float_t fMinLh; // Lower range of the likelihood spectra + Float_t fMaxLh; // Upper range of the likelihood spectra + + Float_t fChargeMin; // Minimum charge required in one plane + Int_t fNClusterMin; // Minimum number of clusters required in one plane + + ClassDef(AliTRDpidLQ,1) // Assigns e/pi propability to the tracks based on LQ method + +}; +#endif diff --git a/TRD/AliTRDsimple.cxx b/TRD/AliTRDsimple.cxx new file mode 100644 index 00000000000..1cb09ff374f --- /dev/null +++ b/TRD/AliTRDsimple.cxx @@ -0,0 +1,114 @@ +/************************************************************************** + * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * * + * Author: The ALICE Off-line Project. * + * Contributors are mentioned in the code where appropriate. * + * * + * Permission to use, copy, modify and distribute this software and its * + * documentation strictly for non-commercial purposes is hereby granted * + * without fee, provided that the above copyright notice appears in all * + * copies and that both the copyright notice and this permission notice * + * appear in the supporting documentation. The authors make no claims * + * about the suitability of this software for any purpose. It is * + * provided "as is" without express or implied warranty. * + **************************************************************************/ + +/* +$Log$ +*/ + +/////////////////////////////////////////////////////////////////////////////// +// // +// Simplified TRD slow simulator // +// // +/////////////////////////////////////////////////////////////////////////////// + +#include + +#include "AliTRDsimple.h" +#include "AliTRDsimpleGen.h" +#include "AliTRDsimpleMC.h" + +ClassImp(AliTRDsimple) + +//_____________________________________________________________________________ +AliTRDsimple::AliTRDsimple():TObject() +{ + // + // AliTRDsimple default constructor + // + + fGenerator = new AliTRDsimpleGen(); + + // Create the MC object + new AliTRDsimpleMC("simple","Simplified Monte Carlo"); + +} + +//_____________________________________________________________________________ +AliTRDsimple::AliTRDsimple(const AliTRDsimple &s) +{ + // + // AliTRDsimple copy constructor + // + + ((AliTRDsimple &) s).Copy(*this); + +} + +//_____________________________________________________________________________ +AliTRDsimple::~AliTRDsimple() +{ + // + // AliTRDsimple destructor + // + + if (fGenerator) { + delete fGenerator; + } + +} + +//_____________________________________________________________________________ +AliTRDsimple &AliTRDsimple::operator=(const AliTRDsimple &s) +{ + // + // Assignment operator + // + + if (this != &s) ((AliTRDsimple &) s).Copy(*this); + return *this; + +} + +//_____________________________________________________________________________ +void AliTRDsimple::Copy(TObject &s) +{ + // + // Copy function + // + + fGenerator->Copy(*((AliTRDsimple &) s).fGenerator); + +} + +//_____________________________________________________________________________ +void AliTRDsimple::ProcessEvent(Int_t ievent) +{ + // + // Runs a single event + // + + Int_t copy = 0; + + // Generate a new particle + fGenerator->NewParticle(ievent); + + // Track the event + do { + gMC->ProcessEvent(); + } + while (gMC->CurrentVolID(copy) != -1); + +} + diff --git a/TRD/AliTRDsimple.h b/TRD/AliTRDsimple.h new file mode 100644 index 00000000000..0c08d2557b8 --- /dev/null +++ b/TRD/AliTRDsimple.h @@ -0,0 +1,34 @@ +#ifndef ALITRDSIMPLE_H +#define ALITRDSIMPLE_H +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ + +/* $Id$ */ + +#include + +class AliTRDsimpleGen; + +class AliTRDsimple : public TObject { + + public: + + AliTRDsimple(); + AliTRDsimple(const AliTRDsimple &s); + + virtual ~AliTRDsimple(); + AliTRDsimple &operator=(const AliTRDsimple &s); + + virtual void Copy(TObject &s); + virtual void ProcessEvent(Int_t ievent); + + virtual AliTRDsimpleGen *GetGenerator() { return fGenerator; }; + + protected: + + AliTRDsimpleGen *fGenerator; // The generator class for the simple simulator + + ClassDef(AliTRDsimple,1) // Simplified TRD slow simulator + +}; +#endif diff --git a/TRD/AliTRDsimpleGen.cxx b/TRD/AliTRDsimpleGen.cxx new file mode 100644 index 00000000000..098fcaf8a8a --- /dev/null +++ b/TRD/AliTRDsimpleGen.cxx @@ -0,0 +1,125 @@ +/************************************************************************** + * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * * + * Author: The ALICE Off-line Project. * + * Contributors are mentioned in the code where appropriate. * + * * + * Permission to use, copy, modify and distribute this software and its * + * documentation strictly for non-commercial purposes is hereby granted * + * without fee, provided that the above copyright notice appears in all * + * copies and that both the copyright notice and this permission notice * + * appear in the supporting documentation. The authors make no claims * + * about the suitability of this software for any purpose. It is * + * provided "as is" without express or implied warranty. * + **************************************************************************/ + +/* +$Log$ +*/ + +/////////////////////////////////////////////////////////////////////////////// +// // +// Particle generator for the simplescopic TRD simulator // +// // +/////////////////////////////////////////////////////////////////////////////// + +#include + +#include + +#include "AliTRDsimpleGen.h" +#include "AliTRDsimpleMC.h" + +ClassImp(AliTRDsimpleGen) + +//_____________________________________________________________________________ +AliTRDsimpleGen::AliTRDsimpleGen():TObject() +{ + // + // AliTRDsimpleGen default constructor + // + + fPdg = 211; + fMomMin = 1.0; + fMomMax = 1.0; + +} + +//_____________________________________________________________________________ +AliTRDsimpleGen::AliTRDsimpleGen(const AliTRDsimpleGen &g) +{ + // + // AliTRDsimpleGen copy constructor + // + + ((AliTRDsimpleGen &) g).Copy(*this); + +} + +//_____________________________________________________________________________ +AliTRDsimpleGen::~AliTRDsimpleGen() +{ + // + // AliTRDsimpleGen destructor + // + +} + +//_____________________________________________________________________________ +AliTRDsimpleGen &AliTRDsimpleGen::operator=(const AliTRDsimpleGen &g) +{ + // + // Assignment operator + // + + if (this != &g) ((AliTRDsimpleGen &) g).Copy(*this); + return *this; + +} + +//_____________________________________________________________________________ +void AliTRDsimpleGen::Copy(TObject &g) +{ + // + // Copy function + // + + ((AliTRDsimpleGen &) g).fPdg = fPdg; + ((AliTRDsimpleGen &) g).fMomMin = fMomMin; + ((AliTRDsimpleGen &) g).fMomMax = fMomMax; + +} + +//_____________________________________________________________________________ +void AliTRDsimpleGen::NewParticle(Int_t ievent) +{ + // + // Generate a new particle and initialize the MC object + // + + if (ievent == 0) { + printf("\n"); + printf(" Generate particles with PDG code %d\n",fPdg); + if (fMomMax > fMomMin) { + printf(" Momentum range = %4.2f - %4.2f GeV/c\n" + ,fMomMin,fMomMax); + } + else { + printf(" Fixed momentum = %4.2f GeV/c\n" + ,fMomMax); + } + printf("\n"); + } + + Double_t p = fMomMax; + if (fMomMax > fMomMin) { + p = (fMomMax - fMomMin) * gRandom->Rndm() + fMomMin; + } + + Double_t px = p; + Double_t py = 0.0; + Double_t pz = 0.0; + + ((AliTRDsimpleMC *) gMC)->NewTrack(ievent,fPdg,px,py,pz); + +} diff --git a/TRD/AliTRDsimpleGen.h b/TRD/AliTRDsimpleGen.h new file mode 100644 index 00000000000..b663bd306b7 --- /dev/null +++ b/TRD/AliTRDsimpleGen.h @@ -0,0 +1,36 @@ +#ifndef ALITRDSIMPLEGEN_H +#define ALITRDSIMPLEGEN_H +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ + +/* $Id$ */ + +#include + +class AliTRDsimpleGen : public TObject { + + public: + + AliTRDsimpleGen(); + AliTRDsimpleGen(const AliTRDsimpleGen &g); + + virtual ~AliTRDsimpleGen(); + AliTRDsimpleGen &operator=(const AliTRDsimpleGen &g); + + virtual void Copy(TObject &g); + virtual void NewParticle(Int_t ievent); + + virtual void SetMomentum(Double_t min, Double_t max) { fMomMin = min; + fMomMax = max; }; + virtual void SetPdg(Int_t pdg) { fPdg = pdg; }; + + protected: + + Int_t fPdg; // Particle PDG code + Double_t fMomMin; // Particle minimum momentum + Double_t fMomMax; // Particle maximum momentum + + ClassDef(AliTRDsimpleGen,1) // Particle generator for the simplified TRD simulator + +}; +#endif diff --git a/TRD/AliTRDsimpleMC.cxx b/TRD/AliTRDsimpleMC.cxx new file mode 100644 index 00000000000..36e01a1c6e0 --- /dev/null +++ b/TRD/AliTRDsimpleMC.cxx @@ -0,0 +1,321 @@ +/************************************************************************** + * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * * + * Author: The ALICE Off-line Project. * + * Contributors are mentioned in the code where appropriate. * + * * + * Permission to use, copy, modify and distribute this software and its * + * documentation strictly for non-commercial purposes is hereby granted * + * without fee, provided that the above copyright notice appears in all * + * copies and that both the copyright notice and this permission notice * + * appear in the supporting documentation. The authors make no claims * + * about the suitability of this software for any purpose. It is * + * provided "as is" without express or implied warranty. * + **************************************************************************/ + +/* +$Log$ +*/ + +/////////////////////////////////////////////////////////////////////////////// +// // +// Simple TRD Monte Carlo class // +// // +/////////////////////////////////////////////////////////////////////////////// + +#include + +#include + +#include "AliRun.h" + +#include "AliTRDsimpleMC.h" +#include "AliTRDgeometry.h" +#include "AliTRDv1.h" + +ClassImp(AliTRDsimpleMC) + +//_____________________________________________________________________________ +AliTRDsimpleMC::AliTRDsimpleMC():AliMC() +{ + // + // AliTRDsimpleMC default constructor + // + + fMaxStep = 0.0; + fNStep = 0; + fTrack = 0; + fTrackPx = 0.0; + fTrackPy = 0.0; + fTrackPz = 0.0; + fTrackPtot = 0.0; + fTrackEtot = 0.0; + fTrackX = 0.0; + fTrackY = 0.0; + fTrackZ = 0.0; + fTrackStep = 0.0; + fTrackPid = 0; + fTrackCharge = 0.0; + fTrackMass = 0.0; + fTrackEntering = kFALSE; + + fTRD = NULL; + +} + +//_____________________________________________________________________________ +AliTRDsimpleMC::AliTRDsimpleMC(const char *name, const char *title) + :AliMC(name,title) +{ + // + // AliTRDsimpleMC default constructor + // + + fMaxStep = 0.0; + fNStep = 0; + fTrack = 0; + fTrackPx = 0.0; + fTrackPy = 0.0; + fTrackPz = 0.0; + fTrackPtot = 0.0; + fTrackEtot = 0.0; + fTrackX = 0.0; + fTrackY = 0.0; + fTrackZ = 0.0; + fTrackStep = 0.0; + fTrackPid = 0; + fTrackCharge = 0.0; + fTrackMass = 0.0; + fTrackEntering = kFALSE; + + fTRD = NULL; + +} + +//_____________________________________________________________________________ +AliTRDsimpleMC::AliTRDsimpleMC(const AliTRDsimpleMC &m) +{ + // + // AliTRDsimpleMC copy constructor + // + + ((AliTRDsimpleMC &) m).Copy(*this); + +} + +//_____________________________________________________________________________ +AliTRDsimpleMC::~AliTRDsimpleMC() +{ + // + // AliTRDsimpleMC destructor + // + +} + +//_____________________________________________________________________________ +AliTRDsimpleMC &AliTRDsimpleMC::operator=(const AliTRDsimpleMC &m) +{ + // + // Assignment operator + // + + if (this != &m) ((AliTRDsimpleMC &) m).Copy(*this); + return *this; + +} + +//_____________________________________________________________________________ +void AliTRDsimpleMC::Copy(TObject &m) +{ + // + // Copy function + // + + ((AliTRDsimpleMC &) m).fMaxStep = fMaxStep; + ((AliTRDsimpleMC &) m).fNStep = fNStep; + ((AliTRDsimpleMC &) m).fTrack = fTrack; + ((AliTRDsimpleMC &) m).fTrackPx = fTrackPx; + ((AliTRDsimpleMC &) m).fTrackPy = fTrackPy; + ((AliTRDsimpleMC &) m).fTrackPz = fTrackPz; + ((AliTRDsimpleMC &) m).fTrackPtot = fTrackPtot; + ((AliTRDsimpleMC &) m).fTrackEtot = fTrackEtot; + ((AliTRDsimpleMC &) m).fTrackX = fTrackX; + ((AliTRDsimpleMC &) m).fTrackY = fTrackY; + ((AliTRDsimpleMC &) m).fTrackZ = fTrackZ; + ((AliTRDsimpleMC &) m).fTrackStep = fTrackStep; + ((AliTRDsimpleMC &) m).fTrackPid = fTrackPid; + ((AliTRDsimpleMC &) m).fTrackCharge = fTrackCharge; + ((AliTRDsimpleMC &) m).fTrackMass = fTrackMass; + ((AliTRDsimpleMC &) m).fTrackEntering = fTrackEntering; + +} + +//_____________________________________________________________________________ +void AliTRDsimpleMC::NewTrack(Int_t iTrack, Int_t pdg + , Double_t px, Double_t py, Double_t pz) +{ + // + // Starts a new track. + // + + if (!fTRD) { + fTRD = (AliTRDv1 *) gAlice->GetDetector("TRD"); + AliTRDgeometry *geometry = fTRD->GetGeometry(); + fX0 = geometry->GetTime0(0) - AliTRDgeometry::DrThick(); + } + + fTRD->ResetHits(); + + fTrack = iTrack; + fMaxStep = 0.0; + fNStep = 0; + fTrackStep = 0.0; + fTrackPid = pdg; + fTrackEntering = kTRUE; + + switch (pdg) { + case kPdgElectron: + fTrackMass = 5.11e-4; + fTrackCharge = -1.0; + break; + case kPdgPion: + fTrackMass = 0.13957; + fTrackCharge = 1.0; + break; + default: + printf(" PDG code %d not implemented\n",pdg); + break; + }; + + Double_t pTot2 = px*px + py*py + pz*pz; + fTrackPtot = TMath::Sqrt(pTot2); + fTrackEtot = TMath::Sqrt(pTot2 + fTrackMass*fTrackMass); + fTrackPx = px; + fTrackPy = py; + fTrackPz = pz; + + fTrackX = fX0; + fTrackY = 0.0; + fTrackZ = 0.0; + + gAlice->SetCurrentTrack(-1); + +} + +//_____________________________________________________________________________ +void AliTRDsimpleMC::ProcessEvent() +{ + // + // Process one single track: + // - Determines the step size. + // - Calculates the track position + // - Calls TRD step manager. + // + + // The stepsize from an exponential distribution + fTrackStep = gRandom->Exp(fMaxStep); + + if ((fTrackEntering) && (fNStep > 0)) { + fTrackEntering = kFALSE; + } + fNStep++; + + // New track position + Double_t d = fTrackStep / fTrackPtot; + fTrackX += fTrackPx * d; + fTrackY += fTrackPy * d; + fTrackZ += fTrackPz * d; + + // Call the TRD step manager + fTRD->StepManager(); + +} + +//_____________________________________________________________________________ +void AliTRDsimpleMC::TrackPosition(TLorentzVector& position) const +{ + // + // Track Position + // + + position[0] = fTrackX; + position[1] = fTrackY; + position[2] = fTrackZ; + +} + +//_____________________________________________________________________________ +void AliTRDsimpleMC::TrackMomentum(TLorentzVector& momentum) const +{ + // + // Track Momentum + // + + momentum[0] = fTrackPx; + momentum[1] = fTrackPy; + momentum[2] = fTrackPz; + momentum[3] = fTrackEtot; + +} + +//_____________________________________________________________________________ +Int_t AliTRDsimpleMC::VolId(const Text_t* volName) const +{ + // + // Returns the volume IDs: + // 1 = drift region + // 2 = amplification region + // 3 = drift chambers + // + + Int_t volId = -1; + + if (strcmp(volName,"UL05") == 0) { + volId = kVolDrRg; + } + else if (strcmp(volName,"UL06") == 0) { + volId = kVolAmRg; + } + else if (strcmp(volName,"UCII") == 0) { + volId = kVolDrCh; + } + + return volId; + +} + +//_____________________________________________________________________________ +Int_t AliTRDsimpleMC::CurrentVolID(Int_t& copyNo) const +{ + // + // Check for the current volume + // + + Int_t volId = -1; + + copyNo = 0; + + // Drift region + if ((fTrackX-fX0) < AliTRDgeometry::DrThick()) { + volId = kVolDrRg; + } + else if ((fTrackX-fX0) < (AliTRDgeometry::DrThick() + + AliTRDgeometry::AmThick())) { + volId = kVolAmRg; + } + + return volId; + +} + +//_____________________________________________________________________________ +Int_t AliTRDsimpleMC::CurrentVolOffID(Int_t off, Int_t ©No) const +{ + // + // Check for the current volume + // + + copyNo = 1; + return kVolDrCh; + +} diff --git a/TRD/AliTRDsimpleMC.h b/TRD/AliTRDsimpleMC.h new file mode 100644 index 00000000000..5bcc8ea8da7 --- /dev/null +++ b/TRD/AliTRDsimpleMC.h @@ -0,0 +1,234 @@ +#ifndef ALITRDSIMPLEMC_H +#define ALITRDSIMPLEMC_H +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ + +/* $Id$ */ + +#include "AliMC.h" +#include "AliMCProcess.h" + +class AliTRDv1; + +class AliTRDsimpleMC : public AliMC { + + public: + + enum { + kPdgElectron = 11 + , kPdgPion = 211 + }; + + AliTRDsimpleMC(); + AliTRDsimpleMC(const char *name, const char *title); + AliTRDsimpleMC(const AliTRDsimpleMC &m); + + virtual ~AliTRDsimpleMC(); + AliTRDsimpleMC &operator=(const AliTRDsimpleMC &m); + + virtual void Copy(TObject &m); + + // + // Methods for building / management of geometry + // + + // Functions from GCONS + virtual void Gfmate(Int_t imat, char *name, Float_t &a, Float_t &z, + Float_t &dens, Float_t &radl, Float_t &absl, + Float_t* ubuf, Int_t& nbuf) { }; + + // Detector composition + virtual void Material(Int_t& kmat, const char* name, Float_t a, + Float_t z, Float_t dens, Float_t radl, Float_t absl, + Float_t* buf, Int_t nwbuf) { }; + virtual void Mixture(Int_t& kmat, const char *name, Float_t *a, + Float_t *z, Float_t dens, Int_t nlmat, Float_t *wmat) { }; + virtual void Medium(Int_t& kmed, const char *name, Int_t nmat, + Int_t isvol, Int_t ifield, Float_t fieldm, Float_t tmaxfd, + Float_t stemax, Float_t deemax, Float_t epsil, + Float_t stmin, Float_t* ubuf, Int_t nbuf) { }; + virtual void Matrix(Int_t& krot, Float_t thetaX, Float_t phiX, + Float_t thetaY, Float_t phiY, Float_t thetaZ, + Float_t phiZ) { }; + virtual void Gstpar(Int_t itmed, const char *param, Float_t parval) { }; + + // Functions from GGEOM + virtual Int_t Gsvolu(const char *name, const char *shape, Int_t nmed, + Float_t *upar, Int_t np) { return 0; }; + virtual void Gsdvn(const char *name, const char *mother, Int_t ndiv, + Int_t iaxis) { }; + virtual void Gsdvn2(const char *name, const char *mother, Int_t ndiv, + Int_t iaxis, Float_t c0i, Int_t numed) { }; + virtual void Gsdvt(const char *name, const char *mother, Float_t step, + Int_t iaxis, Int_t numed, Int_t ndvmx) { }; + virtual void Gsdvt2(const char *name, const char *mother, Float_t step, + Int_t iaxis, Float_t c0, Int_t numed, Int_t ndvmx) { }; + virtual void Gsord(const char *name, Int_t iax) { }; + virtual void Gspos(const char *name, Int_t nr, const char *mother, + Float_t x, Float_t y, Float_t z, Int_t irot, + const char *konly="ONLY") { }; + virtual void Gsposp(const char *name, Int_t nr, const char *mother, + Float_t x, Float_t y, Float_t z, Int_t irot, + const char *konly, Float_t *upar, Int_t np) { }; + + virtual void SetCerenkov(Int_t itmed, Int_t npckov, Float_t *ppckov, + Float_t *absco, Float_t *effic, Float_t *rindex) { }; + + // Functions for drawing + virtual void DrawOneSpec(const char* name) { }; + virtual void Gsatt(const char* name, const char* att, Int_t val) { }; + virtual void Gdraw(const char*,Float_t theta = 30, Float_t phi = 30, + Float_t psi = 0, Float_t u0 = 10, Float_t v0 = 10, + Float_t ul = 0.01, Float_t vl = 0.01) { }; + + // Euclid + virtual void WriteEuclid(const char *a, const char *b, Int_t c, Int_t d) { }; + + // Get methods + virtual Int_t VolId(const Text_t* volName) const; + virtual const char *VolName(Int_t id) const { return " "; }; + virtual Int_t NofVolumes() const { return 0; }; + virtual Int_t VolId2Mate(Int_t id) const { return 0; }; + + // + // Methods for physics management + // + + // Set methods + virtual void SetCut(const char* cutName, Float_t cutValue) { }; + virtual void SetProcess(const char* flagName, Int_t flagValue) { }; + virtual Float_t Xsec(char *a, Float_t b, Int_t c, Int_t d) { return 0.0; }; + + // Particle table usage + virtual Int_t IdFromPDG(Int_t id) const { return 0; }; + virtual Int_t PDGFromId(Int_t pdg) const { return 0; }; + virtual void DefineParticles() { }; + + // + // Methods for step management + // + + // Action methods + virtual void StopTrack() { }; + virtual void StopEvent() { }; + + // Set methods + virtual void SetMaxStep(Float_t step) { fMaxStep = step; }; + virtual void SetMaxNStep(Int_t n) { }; + virtual void SetUserDecay(Int_t d) { }; + + virtual void NewTrack(Int_t iTrack, Int_t pdg, Double_t px, Double_t py, Double_t pz); + + // Tracking volume(s) + virtual Int_t CurrentVolID(Int_t& copyNo) const; + virtual Int_t CurrentVolOffID(Int_t off, Int_t& copyNo) const; + virtual const char* CurrentVolName() const { return ""; }; + virtual const char* CurrentVolOffName(Int_t off) const { return ""; }; + virtual Int_t CurrentMaterial(Float_t &a, Float_t &z, + Float_t &dens, Float_t &radl, + Float_t &absl) const { return 0; }; + virtual Int_t CurrentEvent() const { return 0; }; + virtual void Gmtod(Float_t* xm, Float_t* xd, Int_t iflag) { }; + virtual void Gdtom(Float_t* xd, Float_t* xm, Int_t iflag) { } ; + virtual Float_t MaxStep() const { return fMaxStep; }; + virtual Int_t GetNStep() const { return fNStep; }; + virtual Int_t GetMaxNStep() const { return 0; }; + virtual Int_t GetMedium() const { return 0; }; + + // Dynamic properties + virtual void TrackPosition(TLorentzVector& position) const; + virtual void TrackMomentum(TLorentzVector& momentum) const; + virtual Float_t TrackStep() const { return fTrackStep; }; + virtual Float_t TrackLength() const { return 0.0; }; + virtual Float_t TrackTime() const { return 0.0; }; + virtual Float_t Edep() const { return 0.0; }; + + // Static properties + virtual Int_t TrackPid() const { return fTrackPid; }; + virtual Float_t TrackCharge() const { return fTrackCharge; }; + virtual Float_t TrackMass() const { return fTrackMass; }; + virtual Float_t Etot() const { return fTrackEtot; }; + + // Track status + virtual Bool_t IsNewTrack() const { return kFALSE; }; + virtual Bool_t IsTrackInside() const { return kFALSE; }; + virtual Bool_t IsTrackEntering() const { return fTrackEntering; }; + virtual Bool_t IsTrackExiting() const { return kFALSE; }; + virtual Bool_t IsTrackOut() const { return kFALSE; }; + virtual Bool_t IsTrackDisappeared() const { return kFALSE; }; + virtual Bool_t IsTrackStop() const { return kFALSE; }; + virtual Bool_t IsTrackAlive() const { return kFALSE; }; + + // Secondaries + virtual Int_t NSecondaries() const { return 0; }; + virtual void GetSecondary(Int_t isec, Int_t& particleId, + TLorentzVector& position, + TLorentzVector& momentum) { }; + virtual AliMCProcess ProdProcess(Int_t isec) const { return kPNoProcess; }; + virtual Int_t StepProcesses(TArrayI &proc) const { return 0; }; + + // + // Other (then geometry/step/run management) methods + // + + // Geant3 specific methods + virtual void Gdopt(const char *c1,const char*c2) { }; + virtual void SetClipBox(const char* cc,Float_t a=-9999,Float_t b=0, + Float_t c=-9999,Float_t d=0, + Float_t e=-9999,Float_t f=0) { }; + virtual void DefaultRange() { }; + virtual void Gdhead(Int_t, const char *c, Float_t a=0) { }; + virtual void Gdman(Float_t a, Float_t b, const char *c) { }; + virtual void SetColors() { }; + virtual void Gtreve() { }; + virtual void GtreveRoot() { }; + virtual void Gckmat(Int_t, char*) { }; + virtual void InitLego() { }; + virtual void Gfpart(Int_t a, char *b, Int_t &c, Float_t &d, + Float_t &e, Float_t &g) { }; + virtual void Gspart(Int_t a, const char *b, Int_t c, Float_t d, + Float_t e, Float_t g) { }; + + // Control Methods + virtual void Init() { }; + virtual void FinishGeometry() { }; + virtual void BuildPhysics() { }; + virtual void ProcessEvent(); + virtual void ProcessRun(Int_t nevent) { }; + + // External Decayer + virtual void SetExternalDecayer(AliDecayer* decayer) { }; + virtual AliDecayer *Decayer() const { return 0; }; + + protected: + + enum { + kVolDrRg + , kVolAmRg + , kVolDrCh + }; + + Float_t fMaxStep; // Maximum step size + Int_t fNStep; // Number of steps + Int_t fTrack; // Track number + Double_t fTrackPx; // Track px + Double_t fTrackPy; // Track py + Double_t fTrackPz; // Track pz + Double_t fTrackPtot; // Track total momentum + Double_t fTrackEtot; // Track total energy + Double_t fTrackX; // Track x position + Double_t fTrackY; // Track y position + Double_t fTrackZ; // Track z position + Double_t fX0; // X position of the beginning of the chamber + Double_t fTrackStep; // Track step size + Int_t fTrackPid; // Track PID + Float_t fTrackCharge; // Track charge + Float_t fTrackMass; // Track particle mass + Bool_t fTrackEntering; // Track entering chamber + + AliTRDv1 *fTRD; //! TRD detector object + + ClassDef(AliTRDsimpleMC,1) // Simple TRD Monte Carlo class + +}; +#endif diff --git a/TRD/AliTRDtimeBin.cxx b/TRD/AliTRDtimeBin.cxx index 19cb1a2099c..c32cbf8f8b7 100644 --- a/TRD/AliTRDtimeBin.cxx +++ b/TRD/AliTRDtimeBin.cxx @@ -15,6 +15,9 @@ /* $Log$ +Revision 1.4 2001/10/21 18:30:02 hristov +Several pointers were set to zero in the default constructors to avoid memory management problems + Revision 1.3 2000/10/15 23:40:01 cblume Remove AliTRDconst @@ -39,7 +42,7 @@ ClassImp(AliTRDtimeBin) AliTRDtimeBin::AliTRDtimeBin() { //default constructor fN=0; - for (Int_t i=0; i + +#include + +#include "AliRun.h" +#include "AliMC.h" +#include "AliConst.h" + +#include "AliTRDv2.h" +#include "AliTRDgeometryDetail.h" + +ClassImp(AliTRDv2) + +//_____________________________________________________________________________ +AliTRDv2::AliTRDv2():AliTRDv1() +{ + // + // Default constructor + // + +} + +//_____________________________________________________________________________ +AliTRDv2::AliTRDv2(const char *name, const char *title) + :AliTRDv1(name, title) +{ + // + // Standard constructor for Transition Radiation Detector version 2 + // + + // Check that FRAME is there otherwise we have no place where to + // put TRD + AliModule* frame = gAlice->GetModule("FRAME"); + if (!frame) { + Error("Ctor","TRD needs FRAME to be present\n"); + exit(1); + } + + if (frame->IsVersion() == 1) { + // Detailed geometry without hole + if (fGeometry) delete fGeometry; + fGeometry = new AliTRDgeometryDetail(); + } + else { + Error("Ctor","Could not find valid FRAME version 1\n"); + exit(1); + } + +} + +//_____________________________________________________________________________ +AliTRDv2::AliTRDv2(const AliTRDv2 &trd) +{ + // + // Copy constructor + // + + ((AliTRDv2 &) trd).Copy(*this); + +} + +//_____________________________________________________________________________ +AliTRDv2::~AliTRDv2() +{ + // + // AliTRDv2 destructor + // + +} + +//_____________________________________________________________________________ +AliTRDv2 &AliTRDv2::operator=(const AliTRDv2 &trd) +{ + // + // Assignment operator + // + + if (this != &trd) ((AliTRDv2 &) trd).Copy(*this); + return *this; + +} + +//_____________________________________________________________________________ +void AliTRDv2::Copy(TObject &trd) +{ + // + // Copy function + // + +} + +//_____________________________________________________________________________ +void AliTRDv2::CreateGeometry() +{ + // + // Create the geometry for the Transition Radiation Detector version 2 + // + + // Check that FRAME is there otherwise we have no place where to put the TRD + AliModule* frame = gAlice->GetModule("FRAME"); + if (!frame) return; + + // Define the chambers + AliTRD::CreateGeometry(); + +} + +//_____________________________________________________________________________ +void AliTRDv2::CreateMaterials() +{ + // + // Create materials for the Transition Radiation Detector version 2 + // + + AliTRD::CreateMaterials(); + +} + diff --git a/TRD/AliTRDv2.h b/TRD/AliTRDv2.h new file mode 100644 index 00000000000..a2ce97195e0 --- /dev/null +++ b/TRD/AliTRDv2.h @@ -0,0 +1,38 @@ +#ifndef ALITRDV2_H +#define ALITRDV2_H +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ + +/* $Id$ */ + +//////////////////////////////////////////////////////// +// Manager and hits classes for set: TRD version 2 // +//////////////////////////////////////////////////////// + +#include "AliTRDv1.h" + +//_____________________________________________________________________________ +class AliTRDv2 : public AliTRDv1 { + + public: + + AliTRDv2(); + AliTRDv2(const char *name, const char *title); + AliTRDv2(const AliTRDv2 &trd); + virtual ~AliTRDv2(); + AliTRDv2 &operator=(const AliTRDv2 &trd); + + virtual void Copy(TObject &trd); + virtual void CreateGeometry(); + virtual void CreateMaterials(); + virtual Int_t IsVersion() const { return 2; }; + + protected: + + private: + + ClassDef(AliTRDv2,1) // Transition Radiation Detector version 2 (slow simulator,detailed geometry) + +}; + +#endif diff --git a/TRD/Makefile b/TRD/Makefile index 312289e6f8b..2b466cf36ce 100644 --- a/TRD/Makefile +++ b/TRD/Makefile @@ -11,22 +11,27 @@ PACKAGE = TRD # C++ sources -SRCS = AliTRD.cxx AliTRDv0.cxx AliTRDv1.cxx \ - AliTRDhit.cxx AliTRDdigit.cxx \ - AliTRDpixel.cxx AliTRDmatrix.cxx \ - AliTRDgeometry.cxx AliTRDgeometryFull.cxx \ - AliTRDgeometryHole.cxx AliTRDdigitizer.cxx \ - AliTRDclusterizer.cxx AliTRDclusterizerV0.cxx \ - AliTRDclusterizerV1.cxx AliTRDrecPoint.cxx \ - AliTRDsegmentArray.cxx AliTRDdataArray.cxx \ - AliTRDdataArrayI.cxx AliTRDdataArrayF.cxx \ - AliTRDdigitsManager.cxx AliTRDsim.cxx \ - AliTRDsegmentID.cxx AliTRDsegmentArrayBase.cxx \ - AliTRDarrayI.cxx AliTRDarrayF.cxx \ - AliTRDpoints.cxx AliTRDtimeBin.cxx \ - AliTRDtrackingSector.cxx \ - AliTRDtrack.cxx AliTRDtracker.cxx \ - AliTRDcluster.cxx +SRCS = AliTRD.cxx AliTRDv0.cxx AliTRDv1.cxx AliTRDv2.cxx \ + AliTRDhit.cxx AliTRDdigit.cxx \ + AliTRDpixel.cxx AliTRDmatrix.cxx \ + AliTRDgeometry.cxx AliTRDgeometryFull.cxx \ + AliTRDgeometryDetail.cxx \ + AliTRDgeometryHole.cxx AliTRDdigitizer.cxx \ + AliTRDclusterizer.cxx AliTRDclusterizerV0.cxx \ + AliTRDclusterizerV1.cxx AliTRDrecPoint.cxx \ + AliTRDsegmentArray.cxx AliTRDdataArray.cxx \ + AliTRDdataArrayI.cxx AliTRDdataArrayF.cxx \ + AliTRDdigitsManager.cxx AliTRDsim.cxx \ + AliTRDsegmentID.cxx AliTRDsegmentArrayBase.cxx \ + AliTRDarrayI.cxx AliTRDarrayF.cxx \ + AliTRDpoints.cxx AliTRDtimeBin.cxx \ + AliTRDtrackingSector.cxx \ + AliTRDtrack.cxx AliTRDtracker.cxx \ + AliTRDcluster.cxx \ + AliTRDpid.cxx AliTRDpidLQ.cxx \ + AliTRDmcTrack.cxx \ + AliTRDsimple.cxx AliTRDsimpleMC.cxx \ + AliTRDsimpleGen.cxx # C++ Headers diff --git a/TRD/TRDLinkDef.h b/TRD/TRDLinkDef.h index 2197bed6fb2..c5b072b3bc5 100644 --- a/TRD/TRDLinkDef.h +++ b/TRD/TRDLinkDef.h @@ -11,6 +11,7 @@ #pragma link C++ class AliTRD+; #pragma link C++ class AliTRDv0+; #pragma link C++ class AliTRDv1+; +#pragma link C++ class AliTRDv2+; #pragma link C++ class AliTRDhit+; #pragma link C++ class AliTRDdigit+; #pragma link C++ class AliTRDdigitsManager+; @@ -19,6 +20,7 @@ #pragma link C++ class AliTRDgeometry+; #pragma link C++ class AliTRDgeometryFull+; #pragma link C++ class AliTRDgeometryHole+; +#pragma link C++ class AliTRDgeometryDetail+; #pragma link C++ class AliTRDdigitizer+; #pragma link C++ class AliTRDclusterizer+; #pragma link C++ class AliTRDclusterizerV0+; @@ -35,7 +37,12 @@ #pragma link C++ class AliTRDtrack-; #pragma link C++ class AliTRDtracker+; #pragma link C++ class AliTRDcluster+; - +#pragma link C++ class AliTRDpid+; +#pragma link C++ class AliTRDpidLQ+; +#pragma link C++ class AliTRDmcTrack+; +#pragma link C++ class AliTRDsimple+; +#pragma link C++ class AliTRDsimpleMC+; +#pragma link C++ class AliTRDsimpleGen+; #pragma link C++ class AliTRDsegmentID+; #pragma link C++ class AliTRDsegmentArrayBase+; #pragma link C++ class AliTRDarrayI+; diff --git a/TRD/libTRD.pkg b/TRD/libTRD.pkg index e9db9fc7a90..ce1fcc8e316 100644 --- a/TRD/libTRD.pkg +++ b/TRD/libTRD.pkg @@ -1,20 +1,24 @@ -SRCS= AliTRD.cxx AliTRDv0.cxx AliTRDv1.cxx \ - AliTRDhit.cxx AliTRDdigit.cxx \ - AliTRDpixel.cxx AliTRDmatrix.cxx \ - AliTRDgeometry.cxx AliTRDgeometryFull.cxx \ - AliTRDgeometryHole.cxx AliTRDdigitizer.cxx \ - AliTRDclusterizer.cxx AliTRDclusterizerV0.cxx \ - AliTRDclusterizerV1.cxx AliTRDrecPoint.cxx \ - AliTRDsegmentArray.cxx AliTRDdataArray.cxx \ - AliTRDdataArrayI.cxx AliTRDdataArrayF.cxx \ - AliTRDdigitsManager.cxx AliTRDsim.cxx \ - AliTRDsegmentID.cxx AliTRDsegmentArrayBase.cxx \ - AliTRDarrayI.cxx AliTRDarrayF.cxx \ - AliTRDpoints.cxx AliTRDtimeBin.cxx \ - AliTRDtrackingSector.cxx \ - AliTRDtrack.cxx AliTRDtracker.cxx \ - AliTRDcluster.cxx - +SRCS= AliTRD.cxx AliTRDv0.cxx AliTRDv1.cxx AliTRDv2.cxx \ + AliTRDhit.cxx AliTRDdigit.cxx \ + AliTRDpixel.cxx AliTRDmatrix.cxx \ + AliTRDgeometry.cxx AliTRDgeometryFull.cxx \ + AliTRDgeometryDetail.cxx \ + AliTRDgeometryHole.cxx AliTRDdigitizer.cxx \ + AliTRDclusterizer.cxx AliTRDclusterizerV0.cxx \ + AliTRDclusterizerV1.cxx AliTRDrecPoint.cxx \ + AliTRDsegmentArray.cxx AliTRDdataArray.cxx \ + AliTRDdataArrayI.cxx AliTRDdataArrayF.cxx \ + AliTRDdigitsManager.cxx AliTRDsim.cxx \ + AliTRDsegmentID.cxx AliTRDsegmentArrayBase.cxx \ + AliTRDarrayI.cxx AliTRDarrayF.cxx \ + AliTRDpoints.cxx AliTRDtimeBin.cxx \ + AliTRDtrackingSector.cxx \ + AliTRDtrack.cxx AliTRDtracker.cxx \ + AliTRDcluster.cxx \ + AliTRDpid.cxx AliTRDpidLQ.cxx \ + AliTRDmcTrack.cxx \ + AliTRDsimple.cxx AliTRDsimpleMC.cxx \ + AliTRDsimpleGen.cxx HDRS= $(SRCS:.cxx=.h) -- 2.43.0