From a328fff95a9650c3fca6c36d5990277fcb89afa8 Mon Sep 17 00:00:00 2001 From: cblume Date: Tue, 29 Jun 2004 09:23:45 +0000 Subject: [PATCH] Update of digitizer and new step manager --- TRD/AliTRD.cxx | 277 ++--------------- TRD/AliTRD.h | 30 +- TRD/AliTRDconfig.C | 15 +- TRD/AliTRDdigitizer.cxx | 55 +++- TRD/AliTRDdigitizer.h | 2 +- TRD/AliTRDdisplayDigits3D.C | 55 ++-- TRD/AliTRDparameter.cxx | 605 +++++++++++++++++++++++++++++------- TRD/AliTRDparameter.h | 64 ++-- TRD/AliTRDtest.C | 126 +++----- TRD/AliTRDv1.cxx | 389 +++++++++++++++++++++-- TRD/AliTRDv1.h | 17 +- 11 files changed, 1065 insertions(+), 570 deletions(-) diff --git a/TRD/AliTRD.cxx b/TRD/AliTRD.cxx index 736a417d3d6..682fe3b49d5 100644 --- a/TRD/AliTRD.cxx +++ b/TRD/AliTRD.cxx @@ -50,7 +50,6 @@ #include "AliTRDgeometryHole.h" #include "AliTRDhit.h" #include "AliTRDpoints.h" -#include "AliTRDtrackHits.h" #include "AliTRDrawData.h" #include "AliTrackReference.h" #include "AliMC.h" @@ -77,9 +76,6 @@ AliTRD::AliTRD() fDrawTR = 0; fDisplayType = 0; - fTrackHits = 0; - fHitType = 0; - } //_____________________________________________________________________________ @@ -130,9 +126,6 @@ AliTRD::AliTRD(const char *name, const char *title) fDrawTR = 0; fDisplayType = 0; - fTrackHits = 0; - fHitType = 2; - SetMarkerColor(kWhite); } @@ -165,14 +158,6 @@ AliTRD::~AliTRD() delete fHits; fHits = 0; } -// if (fRecPoints) { -// delete fRecPoints; -// fRecPoints = 0; -// } - if (fTrackHits) { - delete fTrackHits; - fTrackHits = 0; - } } @@ -200,6 +185,7 @@ void AliTRD::Hits2Digits() fLoader->UnloadHits(); fLoader->UnloadDigits(); + } //_____________________________________________________________________________ @@ -208,6 +194,7 @@ void AliTRD::Hits2SDigits() // // Create summable digits // + AliTRDdigitizer digitizer("TRDdigitizer","TRD digitizer class"); // For the summable digits digitizer.SetSDigits(kTRUE); @@ -228,12 +215,18 @@ void AliTRD::Hits2SDigits() fLoader->UnloadHits(); fLoader->UnloadSDigits(); - } + +} //_____________________________________________________________________________ AliDigitizer* AliTRD::CreateDigitizer(AliRunDigitizer* manager) const { + // + // Creates a new digitizer object + // + return new AliTRDdigitizer(manager); + } //_____________________________________________________________________________ @@ -315,18 +308,17 @@ void AliTRD::AddHit(Int_t track, Int_t det, Float_t *hits, Int_t q // // Add a hit for the TRD // - // The data structure is set according to fHitType: - // bit0: standard TClonesArray - // bit1: compressed trackHits structure - // - if (fHitType & 1) { - TClonesArray &lhits = *fHits; - new(lhits[fNhits++]) AliTRDhit(fIshunt,track,det,hits,q); + TClonesArray &lhits = *fHits; + AliTRDhit *hit = new(lhits[fNhits++]) AliTRDhit(fIshunt,track,det,hits,q); + if (inDrift) { + hit->SetDrift(); } - - if (fHitType > 1) { - AddHit2(track,det,hits,q,inDrift); + else { + hit->SetAmplification(); + } + if (q < 0) { + hit->SetTRphoton(); } } @@ -445,7 +437,6 @@ void AliTRD::Copy(TObject &trd) ((AliTRD &) trd).fFoilDensity = fFoilDensity; ((AliTRD &) trd).fDrawTR = fDrawTR; ((AliTRD &) trd).fDisplayType = fDisplayType; - ((AliTRD &) trd).fHitType = fHitType; //AliDetector::Copy(trd); @@ -796,15 +787,9 @@ void AliTRD::LoadPoints(Int_t ) // return; //} - if ((fHits == 0) && (fTrackHits == 0)) return; + if (fHits == 0) return; - Int_t nhits; - if (fHitType < 2) { - nhits = fHits->GetEntriesFast(); - } - else { - nhits = fTrackHits->GetEntriesFast(); - } + Int_t nhits = fHits->GetEntriesFast(); if (nhits == 0) return; Int_t tracks = gAlice->GetMCApp()->GetNtrack(); @@ -945,10 +930,6 @@ void AliTRD::MakeBranch(Option_t* option) MakeBranchInTree(gAlice->TreeD(),branchname,&fDigits,buffersize,0); } - if (fHitType > 1) { - MakeBranch2(option,0); - } - } //_____________________________________________________________________________ @@ -970,12 +951,10 @@ void AliTRD::SetTreeAddress() // Set the branch addresses for the trees. // - if ( fLoader->TreeH() && (fHits == 0x0)) fHits = new TClonesArray("AliTRDhit",405); - AliDetector::SetTreeAddress(); - - if (fHitType > 0) { - SetTreeAddress2(); + if ( fLoader->TreeH() && (fHits == 0x0)) { + fHits = new TClonesArray("AliTRDhit",405); } + AliDetector::SetTreeAddress(); } @@ -1031,216 +1010,6 @@ AliTRD &AliTRD::operator=(const AliTRD &trd) } -//_____________________________________________________________________________ -void AliTRD::FinishPrimary() -{ - // - // Store the hits in the containers after all primaries are finished - // - - if (fTrackHits) { - fTrackHits->FlushHitStack(); - } - -} - -//_____________________________________________________________________________ -void AliTRD::RemapTrackHitIDs(Int_t *map) -{ - // - // Remap the track IDs - // - - if (!fTrackHits) { - return; - } - - if (fTrackHits) { - TClonesArray *arr = fTrackHits->GetArray();; - for (Int_t i = 0; i < arr->GetEntriesFast(); i++){ - AliTrackHitsParamV2 *info = (AliTrackHitsParamV2 *) (arr->At(i)); - info->fTrackID = map[info->fTrackID]; - } - } - -} - -//_____________________________________________________________________________ -void AliTRD::ResetHits() -{ - // - // Reset the hits - // - - AliDetector::ResetHits(); - if (fTrackHits) { - fTrackHits->Clear(); - } - -} - -//_____________________________________________________________________________ -AliHit* AliTRD::FirstHit(Int_t track) -{ - // - // Return the first hit of a track - // - - if (fHitType > 1) { - return FirstHit2(track); - } - - return AliDetector::FirstHit(track); - -} - -//_____________________________________________________________________________ -AliHit* AliTRD::NextHit() -{ - // - // Returns the next hit of a track - // - - if (fHitType > 1) { - return NextHit2(); - } - - return AliDetector::NextHit(); - -} - -//_____________________________________________________________________________ -AliHit* AliTRD::FirstHit2(Int_t track) -{ - // - // Initializes the hit iterator. - // Returns the address of the first hit of a track. - // If >= 0 the track is read from disk, - // while if < 0 the first hit of the current - // track is returned. - // - - if (track >= 0) { - gAlice->ResetHits(); - TreeH()->GetEvent(track); - } - - if (fTrackHits) { - fTrackHits->First(); - return (AliHit*) fTrackHits->GetHit(); - } - else { - return 0; - } - -} - -//_____________________________________________________________________________ -AliHit* AliTRD::NextHit2() -{ - // - // Returns the next hit of the current track - // - - if (fTrackHits) { - fTrackHits->Next(); - return (AliHit *) fTrackHits->GetHit(); - } - else { - return 0; - } - -} - -//_____________________________________________________________________________ -void AliTRD::MakeBranch2(Option_t *option, const char* ) -{ - // - // Create a new branch in the current Root tree. - // The branch of fHits is automatically split. - // - - if (fHitType < 2) { - return; - } - - char branchname[10]; - sprintf(branchname,"%s2",GetName()); - - // Get the pointer to the header - const char *cH = strstr(option,"H"); - - if (!fTrackHits) { - fTrackHits = new AliTRDtrackHits(); - } - - - if (fTrackHits && TreeH() && cH) - { - TreeH()->Branch(branchname,"AliTRDtrackHits",&fTrackHits,fBufferSize,99); - Info("MakeBranch2","Making Branch %s for trackhits",branchname); - } -} - -//_____________________________________________________________________________ -void AliTRD::SetTreeAddress2() -{ - // - // Set the branch address for the trackHits tree - // - if (GetDebug()) Info("SetTreeAddress2",""); - - TBranch *branch; - char branchname[20]; - sprintf(branchname,"%s2",GetName()); - - // Branch address for hit tree - TTree *treeH = TreeH(); - if ((treeH) && (fHitType > 0)) { - branch = treeH->GetBranch(branchname); - if (branch) - { - branch->SetAddress(&fTrackHits); - if (GetDebug()) - Info("SetTreeAddress2","Success."); - } - else - { - if (GetDebug()) - Info("SetTreeAddress2","Can NOT get the branch %s",branchname); - } - } - -} - -//_____________________________________________________________________________ -void AliTRD::AddHit2(Int_t track, Int_t det, Float_t *hits, Int_t q - , Bool_t inDrift) -{ - // - // Add a hit to the list - // - - Int_t rtrack; - - if (fIshunt) { - Int_t primary = gAlice->GetMCApp()->GetPrimary(track); - gAlice->GetMCApp()->Particle(primary)->SetBit(kKeepBit); - rtrack = primary; - } - else { - rtrack = track; - gAlice->GetMCApp()->FlagTrack(track); - } - - if ((fTrackHits) && (fHitType > 0)) { - fTrackHits->AddHitTRD(det,rtrack,hits[0],hits[1],hits[2],q,inDrift); - } - -} - - - diff --git a/TRD/AliTRD.h b/TRD/AliTRD.h index 47703030294..64abc4b32a2 100644 --- a/TRD/AliTRD.h +++ b/TRD/AliTRD.h @@ -22,7 +22,6 @@ class AliDigit; class AliTRDhit; class AliTRDsim; class AliTRDgeometry; -class AliTRDtrackHits; //_____________________________________________________________________________ class AliTRD : public AliDetector { @@ -51,6 +50,12 @@ class AliTRD : public AliDetector { virtual void StepManager() = 0; virtual void SetTreeAddress(); + virtual void StepManagerErmilova() = 0; + virtual void StepManagerGeant() = 0; + virtual void StepManagerFixedStep() = 0; + virtual void SelectStepManager(Int_t t) = 0; + virtual void SetStepSize(Double_t s) = 0; + virtual void SetGasMix(Int_t imix = 0); virtual void SetHits() {}; virtual void SetPHOShole(); @@ -65,10 +70,6 @@ class AliTRD : public AliDetector { virtual void SetSensSector(Int_t isector) = 0; virtual void SetSensSector(Int_t isector, Int_t nsector) = 0; - virtual void SetHitTypeStandard() { fHitType = 1; }; - virtual void SetHitTypeCompressed() { fHitType = 2; }; - virtual void SetHitTypeBoth() { fHitType = 3; }; - virtual Int_t GetSensChamber() const = 0; virtual Int_t GetSensPlane() const = 0; virtual Int_t GetSensSector() const = 0; @@ -83,19 +84,6 @@ class AliTRD : public AliDetector { virtual AliTRDsim *CreateTR() = 0; virtual AliTRDsim *GetTR() const = 0; - virtual void MakeBranch2(Option_t *opt=" ", const char *file=0); - virtual void SetTreeAddress2(); - virtual void AddHit2(Int_t track, Int_t det, Float_t *hits, Int_t q, Bool_t inDrift); - virtual void ResetHits(); - - virtual AliHit* FirstHit(Int_t track); - virtual AliHit* NextHit(); - virtual AliHit* FirstHit2(Int_t track); - virtual AliHit* NextHit2(); - - virtual void FinishPrimary(); - virtual void RemapTrackHitIDs(Int_t *map); - protected: Int_t fGasMix; // Gas mixture. 0: Xe/Isobutane 1: Xe/CO2 @@ -108,11 +96,7 @@ class AliTRD : public AliDetector { Int_t fDrawTR; // Switches marking the TR photons in the display Int_t fDisplayType; // Display type (0: normal, 1: detailed) - - AliTRDtrackHits *fTrackHits; //! Compressed hits for a given track - Int_t fHitType; // Switch for the different hit data structures - - ClassDef(AliTRD,6) // Transition Radiation Detector base class + ClassDef(AliTRD,7) // Transition Radiation Detector base class }; diff --git a/TRD/AliTRDconfig.C b/TRD/AliTRDconfig.C index 422797fa4d4..f39870a7f4a 100644 --- a/TRD/AliTRDconfig.C +++ b/TRD/AliTRDconfig.C @@ -177,13 +177,16 @@ void Config() if (iITS) { //=================== ITS parameters ============================ // - // EUCLID is a flag to output (=1) both geometry and media to two ASCII files - // (called by default ITSgeometry.euc and ITSgeometry.tme) in a format - // understandable to the CAD system EUCLID. The default (=0) means that you - // dont want to use this facility. - // - AliITS *ITS = new AliITSv5asymm("ITS","Updates ITS TDR detailed version with asymmetric services"); + AliITSvPPRasymmFMD *ITS = new AliITSvPPRasymmFMD("ITS","ITS PPR"); + ITS->SetMinorVersion(2); + ITS->SetReadDet(kTRUE); + ITS->SetThicknessDet1(200.); + ITS->SetThicknessDet2(200.); + ITS->SetThicknessChip1(200.); + ITS->SetThicknessChip2(200.); + ITS->SetRails(0); + ITS->SetCoolingFluid(1); ITS->SetEUCLID(0); } diff --git a/TRD/AliTRDdigitizer.cxx b/TRD/AliTRDdigitizer.cxx index 8ed55b3711e..b2510599878 100644 --- a/TRD/AliTRDdigitizer.cxx +++ b/TRD/AliTRDdigitizer.cxx @@ -478,7 +478,6 @@ Bool_t AliTRDdigitizer::Open(const Char_t *file, Int_t nEvent) } else {//if we produce Digits - tree = loader->TreeD(); if (!tree) { loader->MakeTree("D"); @@ -657,6 +656,28 @@ Bool_t AliTRDdigitizer::MakeDigits() Int_t detectorOld = -1; Int_t countHits = 0; + if (fDebug > 0) { + printf(" "); + printf("Driftvelocity = %.2f, Sampling = %.2fns\n",fPar->GetDriftVelocity(), + fPar->GetTimeBinSize() / fPar->GetDriftVelocity() * 1000.); + printf(" "); + printf("Gain = %d, Noise = %d\n",(Int_t)fPar->GetGasGain(),(Int_t)fPar->GetNoise()); + if (fPar->TimeStructOn()) { + printf(" "); + printf("Time Structure of drift cells implemented.\n"); + if (fPar->StaggeringOn()) { + printf(" "); + printf("Staggered geometry.\n"); + } else { + printf(" "); + printf("Non-Staggered geometry.\n"); + } + } else { + printf(" "); + printf("Constant drift velocity in drift cells.\n"); + } + } + // Loop through all entries in the tree for (Int_t iTrack = 0; iTrack < nTrack; iTrack++) { @@ -796,9 +817,6 @@ Bool_t AliTRDdigitizer::MakeDigits() Float_t driftlength = time0 - rot[0]; // Take also the drift in the amplification region into account - // The drift length is at the moment still the same, regardless of - // the position relativ to the wire. This non-isochronity needs still - // to be implemented. Float_t driftlengthL = TMath::Abs(driftlength + kAmWidth); if (fPar->ExBOn()) driftlengthL /= TMath::Sqrt(fPar->GetLorentzFactor()); @@ -811,6 +829,26 @@ Bool_t AliTRDdigitizer::MakeDigits() xyz[1] = rot[1]; xyz[2] = rot[2]; + // Stupid patch to take care of TR photons that are absorbed + // outside the chamber volume. A real fix would actually need + // a more clever implementation of the TR hit generation + Float_t zz = xyz[2] - row0; + if ((zz < 0.0) || (zz > rowPadSize*nRowMax)) { + if (iEl == 0) { + printf(" "); + printf("Hit outside of sensitive volume, row (Q = %d)\n",((Int_t) q)); + } + continue; + } + Int_t tt = ((Int_t) (10*(driftlength + 2.0*kAmWidth))); + if (tt < 0) { + if (iEl == 0) { + printf(" "); + printf("Hit outside of sensitive volume, time (Q = %d)\n",((Int_t) q)); + } + continue; + } + // Electron attachment if (fPar->ElAttachOn()) { if (gRandom->Rndm() < (driftlengthL * elAttachProp)) @@ -827,6 +865,15 @@ Bool_t AliTRDdigitizer::MakeDigits() if (!(fPar->ExB(driftlength+kAmWidth,xyz))) continue; } + // Apply the drift time correction + if (fPar->TimeStructOn()) { + // Get z-position with respect to anode wire: + Float_t Z = xyz[2] - row0 + fPar->GetAnodeWireOffset(); + while (Z>0.5) Z -= 0.5; + if (Z>0.25) Z = 0.5-Z; + if (!(fPar->TimeStruct(driftlength+2*kAmWidth,Z,xyz))) continue; + } + // The electron position after diffusion and ExB in pad coordinates // The pad row (z-direction) Float_t rowDist = xyz[2] - row0; diff --git a/TRD/AliTRDdigitizer.h b/TRD/AliTRDdigitizer.h index bccbc3f2d3c..4bbd3d6b56f 100644 --- a/TRD/AliTRDdigitizer.h +++ b/TRD/AliTRDdigitizer.h @@ -47,7 +47,7 @@ class AliTRDdigitizer : public AliDigitizer { virtual Bool_t SDigits2Digits(); virtual Bool_t WriteDigits() const; - void InitOutput(Int_t iEvent); + void InitOutput(Int_t iEvent); virtual void SetCompress(Int_t c = 1) { fCompress = c; }; virtual void SetDebug(Int_t v = 1) { fDebug = v; }; diff --git a/TRD/AliTRDdisplayDigits3D.C b/TRD/AliTRDdisplayDigits3D.C index dfec4bfffbe..3a50a4a02cb 100644 --- a/TRD/AliTRDdisplayDigits3D.C +++ b/TRD/AliTRDdisplayDigits3D.C @@ -23,23 +23,34 @@ Int_t AliTRDdisplayDigits3D(Int_t event = 0, Int_t thresh = 2 Int_t track; Int_t idict; - // Connect the AliRoot file containing Geometry, Kine, Hits, and digits - TFile *gafl = (TFile*) gROOT->GetListOfFiles()->FindObject(inputFile); - if (!gafl) { - printf("Open the ALIROOT-file %s\n",inputFile); - gafl = new TFile(inputFile); + TString evfoldname = AliConfig::GetDefaultEventFolderName(); + fRunLoader = AliRunLoader::GetRunLoader(evfoldname); + if (!fRunLoader) { + fRunLoader = AliRunLoader::Open(inputFile + ,AliConfig::GetDefaultEventFolderName() + ,"UPDATE"); } - else { - printf("%s is already open",inputFile); + if (!fRunLoader) { + Printf("Can not open session for file %s.",inputFile); + return kFALSE; + } + + if (!fRunLoader->GetAliRun()) { + fRunLoader->LoadgAlice(); + } + gAlice = fRunLoader->GetAliRun(); + if (!gAlice) { + printf("Could not find AliRun object.\n"); + return kFALSE; } - // Get AliRun object from file or create it if not on file - gAlice = (AliRun *) gafl->Get("gAlice"); - if (!gAlice) return 1; - - // Import the Trees for the event nEvent in the file - Int_t nparticles = gAlice->GetEvent(event); - if (nparticles <= 0) return 1; + fRunLoader->GetEvent(event); + + AliLoader *loader = fRunLoader->GetLoader("TRDLoader"); + if (!loader) { + printf("Can not get TRD loader from Run Loader"); + } + loader->LoadDigits(); // Get the pointer to the detector object trd = (AliTRDv1*) gAlice->GetDetector("TRD"); @@ -72,8 +83,16 @@ Int_t AliTRDdisplayDigits3D(Int_t event = 0, Int_t thresh = 2 digitsManager->SetSDigits(sdigits); // Read the digits from the file - digitsManager->Open(inputFile); - digitsManager->ReadDigits(); + if (sdigits) { + digitsManager->ReadDigits(loader->TreeS()); + } + else { + if (!loader->TreeD()) { + printf("mist\n"); + return kFALSE; + } + digitsManager->ReadDigits(loader->TreeD()); + } Int_t totalsignal = 0; Int_t totalbgnd = 0; @@ -188,7 +207,7 @@ Int_t AliTRDdisplayDigits3D(Int_t event = 0, Int_t thresh = 2 } - TGeometry *geoAlice = (TGeometry *) gafl->Get("AliceGeom"); + TGeometry *geoAlice = gAlice->GetGeometry(); TNode *main = (TNode *) ((geoAlice->GetListOfNodes())->First()); TIter next(main->GetListOfNodes()); TNode *module = 0; @@ -208,8 +227,6 @@ Int_t AliTRDdisplayDigits3D(Int_t event = 0, Int_t thresh = 2 c1->Modified(); c1->Update(); - gafl->Close(); - printf(" Number of digits:\n"); printf(" signal = %d, bgnd = %d, merged = %d\n" ,totalsignal,totalbgnd,totalmerged); diff --git a/TRD/AliTRDparameter.cxx b/TRD/AliTRDparameter.cxx index 2c572649c52..845f32de1c8 100644 --- a/TRD/AliTRDparameter.cxx +++ b/TRD/AliTRDparameter.cxx @@ -82,6 +82,11 @@ AliTRDparameter::AliTRDparameter():TNamed() fClusMaxThresh = 0; fClusSigThresh = 0; + fTimeStructOn = 0; + fTimeStruct = 0; + fStaggeringOn = 0; + fAnodeWireOffset = 0.0; + } //_____________________________________________________________________________ @@ -136,6 +141,11 @@ AliTRDparameter::AliTRDparameter(const Text_t *name, const Text_t *title) fClusMaxThresh = 0; fClusSigThresh = 0; + fTimeStructOn = 0; + fTimeStruct = 0; + fStaggeringOn = 0; + fAnodeWireOffset = 0.0; + Init(); } @@ -184,6 +194,11 @@ AliTRDparameter::~AliTRDparameter() fGeo = 0; } + if (fTimeStruct) { + delete [] fTimeStruct; + fTimeStruct = 0; + } + } //_____________________________________________________________________________ @@ -268,6 +283,16 @@ void AliTRDparameter::Copy(TObject &p) ((AliTRDparameter &) p).fClusMaxThresh = fClusMaxThresh; ((AliTRDparameter &) p).fClusSigThresh = fClusSigThresh; + ((AliTRDparameter &) p).fAnodeWireOffset = fAnodeWireOffset; + ((AliTRDparameter &) p).fStaggeringOn = fStaggeringOn; + ((AliTRDparameter &) p).fTimeStructOn = fTimeStructOn; + if (((AliTRDparameter &) p).fTimeStruct) + delete [] ((AliTRDparameter &) p).fTimeStruct; + ((AliTRDparameter &) p).fTimeStruct = new Float_t[38*26]; + for (Int_t i = 0; i < 38*26; i++) { + ((AliTRDparameter &) p).fTimeStruct[i] = fTimeStruct[i]; + } + } //_____________________________________________________________________________ @@ -306,26 +331,25 @@ void AliTRDparameter::Init() // // The pad size in column direction (rphi-direction) - SetColPadSize(0,0.65); - SetColPadSize(1,0.68); - SetColPadSize(2,0.71); - SetColPadSize(3,0.74); - SetColPadSize(4,0.77); - SetColPadSize(5,0.80); - - // New pad size? Needs to be checked! - //SetColPadSize(0,0.664); - //SetColPadSize(1,0.695); - //SetColPadSize(2,0.726); - //SetColPadSize(3,0.756); - //SetColPadSize(4,0.788); - //SetColPadSize(5,0.818); + //SetColPadSize(0,0.65); + //SetColPadSize(1,0.68); + //SetColPadSize(2,0.71); + //SetColPadSize(3,0.74); + //SetColPadSize(4,0.77); + //SetColPadSize(5,0.80); + + SetColPadSize(0,0.664); + SetColPadSize(1,0.695); + SetColPadSize(2,0.726); + SetColPadSize(3,0.756); + SetColPadSize(4,0.788); + SetColPadSize(5,0.818); // The pad row (z-direction) SetNRowPad(); // The number of time bins. Default is 100 ns timbin size - SetNTimeBin(15); + SetNTimeBin(20); // Additional time bins before and after the drift region. // Default is to only sample the drift region @@ -338,7 +362,7 @@ void AliTRDparameter::Init() // // The default parameter for the digitization - fGasGain = 4500.; + fGasGain = 4000.; fChipGain = 12.4; fNoise = 1000.; fADCoutRange = 1023.; // 10-bit ADC @@ -375,11 +399,20 @@ void AliTRDparameter::Init() fTCnexp = 2; // The pad coupling factor (same number as for the TPC) - fPadCoupling = 0.5; + fPadCoupling = 0.3; // The time coupling factor (same number as for the TPC) fTimeCoupling = 0.4; + // Drift time non-isochronity on + fTimeStructOn = 1; + + // Wire planes staggered + fStaggeringOn = 1; + + // Distance of first Anode wire from first pad edge + fAnodeWireOffset = 0.25; + // The tilting angle for the readout pads SetTiltingAngle(2.0); @@ -410,6 +443,9 @@ void AliTRDparameter::ReInit() // Reinitializes the parameter class after a change // + // Create the sampled timing structure + SampleTimeStruct(); + // Calculate the time bin width in ns fTimeBinWidth = fTimeBinSize / fDriftVelocity * 1000.0; @@ -565,6 +601,62 @@ Float_t AliTRDparameter::CrossTalk(Float_t time) const } +//_____________________________________________________________________________ +Int_t AliTRDparameter::TimeStruct(Float_t time, Float_t z, Float_t *xyz) const +{ + // + // Applies the time structure of the drift cells (by C.Lippmann). + // The drift time of electrons to the anode wires depends on the + // distance to the wire (z) and on the position in the drift region. + // + // input : time (radial distance from pad cathode) in [cm] and z (distance + // from anode wire parallel to cathode planes) in [cm] + // + + if ( z > 0.24 ) z = 0.24; + if ( !fStaggeringOn && z < 0.01 ) z = 0.01; + + Int_t r1 = (Int_t)(10*time); + Int_t r2 = r1+1; + Int_t z1 = (Int_t)(100*z); + Int_t z2 = z1+1; + + if (r1<0 || r1>37 || z1<0 || z1>25) { + printf(" Warning. Indices out of range: "); + printf("time=%.2f, z=%.2f, r1=%d, z1=%d\n",time,z,r1,z1); + return kFALSE; + if (r1<0) r1 = 0; + if (r1>37) r1 = 37; + if (z1<0) z1 = 0; + if (z1>25) z1 = 25; + } + + // 2D Interpolation: + Float_t y11, y12, y21, y22, y1, y2; + y11 = fTimeStruct[r1+38*z1]; + y22 = (r2 <= 37 && z2 <= 25) ? fTimeStruct[r2+38*z2] : fTimeStruct[37+38*25]; + y12 = (z2 <= 25) ? fTimeStruct[r1+38*z2] : fTimeStruct[r1+38*25]; + y21 = (r2 <= 37) ? fTimeStruct[r2+38*z1] : fTimeStruct[37+38*z1]; + + y1 = (y21-y11)*10*time + y11 - (y21-y11)*r1; + y2 = (y22-y12)*10*time + y12 - (y22-y12)*r1; + + Float_t AmTh = AliTRDgeometry::AmThick() / 2.; + Float_t tdrift = 0.0; // drift time (GARFIELD) + if (TMath::Abs(time-AmTh)>0.005 || z>0.005) + tdrift = (y2-y1)*100*z + y1 - (y2-y1)*z1; + if (time < AmTh) tdrift *= -1.; + Float_t xdrift = tdrift*(AmTh + AliTRDgeometry::DrThick())/fTimeStruct[37] + AmTh; + Float_t offset = time - xdrift; + + xyz[0] = xyz[0] + offset; + xyz[1] = xyz[1]; + xyz[2] = xyz[2]; + + return 1; + +} + //_____________________________________________________________________________ Int_t AliTRDparameter::Diffusion(Float_t driftlength, Float_t *xyz) { @@ -665,7 +757,7 @@ Float_t AliTRDparameter::Col0Tilted(Float_t col0, Float_t rowOffset // Float_t diff = fTiltingAngle * rowOffset; - return (col0 + TMath::Power(-1.0,plane) * diff); + return (col0 + TMath::Power(-1.0,(plane+1)) * diff); } @@ -917,6 +1009,309 @@ void AliTRDparameter::SampleTRF() } +//_____________________________________________________________________________ +void AliTRDparameter::SampleTimeStruct() +{ + // + // Samples the timing structure of a drift cell + // Drift Time data calculated with Garfield (by C.Lippmann) + // + + const Int_t ktimebin = 38; + const Int_t kZbin = 26; + + Float_t stagg[ktimebin][kZbin] = + {{9.1221e-02, 9.1269e-02, 9.1426e-02, 9.1678e-02, 9.2041e-02, 9.2500e-02, + 9.3081e-02, 9.3760e-02, 9.4540e-02, 9.5434e-02, 9.6436e-02, 9.7554e-02, + 9.8796e-02, 1.0016e-01, 1.0167e-01, 1.0336e-01, 1.0528e-01, 1.0748e-01, + 1.1012e-01, 1.1348e-01, 1.1790e-01, 1.2395e-01, 1.3317e-01, 1.5036e-01, + 1.9348e-01, 5.7191e-01}, + {6.5708e-02, 6.5787e-02, 6.5954e-02, 6.6237e-02, 6.6646e-02, 6.7170e-02, + 6.7804e-02, 6.8554e-02, 6.9424e-02, 7.0392e-02, 7.1492e-02, 7.2693e-02, + 7.4006e-02, 7.5459e-02, 7.7042e-02, 7.8795e-02, 8.0786e-02, 8.3081e-02, + 8.5798e-02, 8.9290e-02, 9.3841e-02, 1.0007e-01, 1.0959e-01, 1.2741e-01, + 1.7152e-01, 5.4720e-01}, + {3.9602e-02, 3.9699e-02, 3.9969e-02, 4.0417e-02, 4.1015e-02, 4.1802e-02, + 4.2726e-02, 4.3804e-02, 4.4992e-02, 4.6309e-02, 4.7720e-02, 4.9244e-02, + 5.0874e-02, 5.2592e-02, 5.4437e-02, 5.6461e-02, 5.8704e-02, 6.1340e-02, + 6.4533e-02, 6.8509e-02, 7.3620e-02, 8.0737e-02, 9.1920e-02, 1.1276e-01, + 1.6078e-01, 5.2455e-01}, + {1.1236e-02, 1.1514e-02, 1.2355e-02, 1.3666e-02, 1.5354e-02, 1.7292e-02, + 1.9469e-02, 2.1756e-02, 2.4118e-02, 2.6505e-02, 2.8902e-02, 3.1273e-02, + 3.3618e-02, 3.5960e-02, 3.8367e-02, 4.0957e-02, 4.3859e-02, 4.7286e-02, + 5.1516e-02, 5.7160e-02, 6.5086e-02, 7.6740e-02, 9.4905e-02, 1.2426e-01, + 1.8267e-01, 4.8444e-01}, + {1.1285e-02, 1.1581e-02, 1.2430e-02, 1.3739e-02, 1.5383e-02, 1.7329e-02, + 1.9477e-02, 2.1732e-02, 2.4063e-02, 2.6412e-02, 2.8746e-02, 3.1073e-02, + 3.3329e-02, 3.5733e-02, 3.8146e-02, 4.0847e-02, 4.3908e-02, 4.7650e-02, + 5.2475e-02, 5.9069e-02, 6.8420e-02, 8.2181e-02, 1.0199e-01, 1.3525e-01, + 1.9150e-01, 4.6381e-01}, + {3.9345e-02, 3.9430e-02, 3.9698e-02, 4.0124e-02, 4.0714e-02, 4.1462e-02, + 4.2325e-02, 4.3327e-02, 4.4476e-02, 4.5727e-02, 4.7075e-02, 4.8532e-02, + 5.0118e-02, 5.1838e-02, 5.3758e-02, 5.5958e-02, 5.8528e-02, 6.1589e-02, + 6.5285e-02, 6.9903e-02, 7.6022e-02, 8.4799e-02, 9.8707e-02, 1.2316e-01, + 1.7495e-01, 5.2371e-01}, + {6.4837e-02, 6.4889e-02, 6.5062e-02, 6.5329e-02, 6.5688e-02, 6.6204e-02, + 6.6770e-02, 6.7494e-02, 6.8306e-02, 6.9234e-02, 7.0297e-02, 7.1484e-02, + 7.2842e-02, 7.4318e-02, 7.6041e-02, 7.8040e-02, 8.0428e-02, 8.3315e-02, + 8.6827e-02, 9.1171e-02, 9.6759e-02, 1.0445e-01, 1.1651e-01, 1.3841e-01, + 1.8746e-01, 5.4644e-01}, + {9.0789e-02, 9.0824e-02, 9.0908e-02, 9.1065e-02, 9.1268e-02, 9.1522e-02, + 9.1838e-02, 9.2207e-02, 9.2643e-02, 9.3230e-02, 9.4073e-02, 9.5341e-02, + 9.7229e-02, 1.0633e-01, 1.0703e-01, 1.0868e-01, 1.1124e-01, 1.1451e-01, + 1.1853e-01, 1.2342e-01, 1.2981e-01, 1.3868e-01, 1.5245e-01, 1.7661e-01, + 2.2796e-01, 5.6931e-01}, + {1.2735e-01, 1.2744e-01, 1.2775e-01, 1.2828e-01, 1.2909e-01, 1.3021e-01, + 1.3172e-01, 1.3377e-01, 1.3658e-01, 1.4055e-01, 1.4624e-01, 1.5549e-01, + 1.7490e-01, 2.1347e-01, 1.8445e-01, 1.7581e-01, 1.7263e-01, 1.7216e-01, + 1.7377e-01, 1.7731e-01, 1.8337e-01, 1.9306e-01, 2.0875e-01, 2.3610e-01, + 2.9100e-01, 6.0131e-01}, + {1.7654e-01, 1.7663e-01, 1.7711e-01, 1.7789e-01, 1.7901e-01, 1.8055e-01, + 1.8252e-01, 1.8511e-01, 1.8844e-01, 1.9288e-01, 1.9889e-01, 2.0816e-01, + 2.2673e-01, 2.7253e-01, 2.3949e-01, 2.3043e-01, 2.2695e-01, 2.2620e-01, + 2.2751e-01, 2.3091e-01, 2.3691e-01, 2.4671e-01, 2.6258e-01, 2.9036e-01, + 3.4575e-01, 6.4208e-01}, + {2.2845e-01, 2.2860e-01, 2.2907e-01, 2.2987e-01, 2.3103e-01, 2.3262e-01, + 2.3466e-01, 2.3727e-01, 2.4063e-01, 2.4510e-01, 2.5116e-01, 2.6032e-01, + 2.7853e-01, 3.2713e-01, 2.9240e-01, 2.8314e-01, 2.7962e-01, 2.7878e-01, + 2.8008e-01, 2.8341e-01, 2.8944e-01, 2.9918e-01, 3.1503e-01, 3.4275e-01, + 3.9786e-01, 6.8482e-01}, + {2.8077e-01, 2.8094e-01, 2.8142e-01, 2.8222e-01, 2.8341e-01, 2.8496e-01, + 2.8702e-01, 2.8962e-01, 2.9301e-01, 2.9745e-01, 3.0350e-01, 3.1263e-01, + 3.3069e-01, 3.8049e-01, 3.4500e-01, 3.3562e-01, 3.3206e-01, 3.3126e-01, + 3.3253e-01, 3.3588e-01, 3.4183e-01, 3.5155e-01, 3.6729e-01, 3.9494e-01, + 4.4955e-01, 7.2458e-01}, + {3.3321e-01, 3.3336e-01, 3.3385e-01, 3.3466e-01, 3.3584e-01, 3.3744e-01, + 3.3946e-01, 3.4213e-01, 3.4544e-01, 3.4987e-01, 3.5592e-01, 3.6502e-01, + 3.8298e-01, 4.3361e-01, 3.9758e-01, 3.8814e-01, 3.8456e-01, 3.8373e-01, + 3.8498e-01, 3.8831e-01, 3.9424e-01, 4.0392e-01, 4.1961e-01, 4.4703e-01, + 5.0121e-01, 7.6594e-01}, + {3.8572e-01, 3.8588e-01, 3.8634e-01, 3.8716e-01, 3.8834e-01, 3.8993e-01, + 3.9196e-01, 3.9456e-01, 3.9792e-01, 4.0236e-01, 4.0848e-01, 4.1745e-01, + 4.3532e-01, 4.8671e-01, 4.5019e-01, 4.4067e-01, 4.3708e-01, 4.3625e-01, + 4.3746e-01, 4.4078e-01, 4.4663e-01, 4.5626e-01, 4.7192e-01, 4.9913e-01, + 5.5270e-01, 8.0632e-01}, + {4.3847e-01, 4.3855e-01, 4.3892e-01, 4.3976e-01, 4.4089e-01, 4.4247e-01, + 4.4451e-01, 4.4711e-01, 4.5048e-01, 4.5489e-01, 4.6092e-01, 4.6997e-01, + 4.8773e-01, 5.3996e-01, 5.0285e-01, 4.9328e-01, 4.8966e-01, 4.8878e-01, + 4.9006e-01, 4.9327e-01, 4.9912e-01, 5.0870e-01, 5.2424e-01, 5.5126e-01, + 6.0420e-01, 8.4589e-01}, + {4.9089e-01, 4.9105e-01, 4.9153e-01, 4.9234e-01, 4.9351e-01, 4.9509e-01, + 4.9712e-01, 4.9970e-01, 5.0306e-01, 5.0749e-01, 5.1348e-01, 5.2250e-01, + 5.4016e-01, 5.9329e-01, 5.5559e-01, 5.4594e-01, 5.4229e-01, 5.4138e-01, + 5.4257e-01, 5.4584e-01, 5.5162e-01, 5.6114e-01, 5.7660e-01, 6.0338e-01, + 6.5560e-01, 8.8395e-01}, + {5.4358e-01, 5.4372e-01, 5.4422e-01, 5.4500e-01, 5.4618e-01, 5.4776e-01, + 5.4978e-01, 5.5238e-01, 5.5572e-01, 5.6014e-01, 5.6613e-01, 5.7508e-01, + 5.9263e-01, 6.4680e-01, 6.0840e-01, 5.9867e-01, 5.9497e-01, 5.9416e-01, + 5.9522e-01, 5.9846e-01, 6.0424e-01, 6.1369e-01, 6.2902e-01, 6.5556e-01, + 7.0707e-01, 9.1967e-01}, + {5.9631e-01, 5.9648e-01, 5.9694e-01, 5.9776e-01, 5.9892e-01, 6.0049e-01, + 6.0252e-01, 6.0511e-01, 6.0845e-01, 6.1287e-01, 6.1881e-01, 6.2775e-01, + 6.4519e-01, 7.0051e-01, 6.6128e-01, 6.5147e-01, 6.4773e-01, 6.4680e-01, + 6.4793e-01, 6.5114e-01, 6.5690e-01, 6.6624e-01, 6.8147e-01, 7.0775e-01, + 7.5854e-01, 9.5826e-01}, + {6.4916e-01, 6.4928e-01, 6.4976e-01, 6.5057e-01, 6.5173e-01, 6.5329e-01, + 6.5533e-01, 6.5792e-01, 6.6124e-01, 6.6563e-01, 6.7159e-01, 6.8051e-01, + 6.9779e-01, 7.5441e-01, 7.1424e-01, 7.0434e-01, 7.0057e-01, 6.9962e-01, + 7.0071e-01, 7.0392e-01, 7.0959e-01, 7.1891e-01, 7.3396e-01, 7.6003e-01, + 8.1008e-01, 9.9861e-01}, + {7.0207e-01, 7.0221e-01, 7.0264e-01, 7.0345e-01, 7.0461e-01, 7.0621e-01, + 7.0820e-01, 7.1079e-01, 7.1410e-01, 7.1849e-01, 7.2442e-01, 7.3329e-01, + 7.5047e-01, 8.0863e-01, 7.6728e-01, 7.5729e-01, 7.5348e-01, 7.5250e-01, + 7.5358e-01, 7.5674e-01, 7.6239e-01, 7.7162e-01, 7.8659e-01, 8.1236e-01, + 8.6164e-01, 1.0402}, + {7.5498e-01, 7.5573e-01, 7.5560e-01, 7.5642e-01, 7.5759e-01, 7.5913e-01, + 7.6116e-01, 7.6373e-01, 7.6704e-01, 7.7142e-01, 7.7734e-01, 7.8617e-01, + 8.0322e-01, 8.6277e-01, 8.2039e-01, 8.1030e-01, 8.0646e-01, 8.0546e-01, + 8.0650e-01, 8.0964e-01, 8.1524e-01, 8.2443e-01, 8.3926e-01, 8.6476e-01, + 9.1328e-01, 1.0826}, + {8.0804e-01, 8.0817e-01, 8.0865e-01, 8.0945e-01, 8.1060e-01, 8.1219e-01, + 8.1420e-01, 8.1674e-01, 8.2006e-01, 8.2444e-01, 8.3032e-01, 8.3912e-01, + 8.5604e-01, 9.1704e-01, 8.7360e-01, 8.6340e-01, 8.5952e-01, 8.5850e-01, + 8.5951e-01, 8.6262e-01, 8.6815e-01, 8.7727e-01, 8.9200e-01, 9.1725e-01, + 9.6506e-01, 1.1263}, + {8.6112e-01, 8.6129e-01, 8.6175e-01, 8.6255e-01, 8.6370e-01, 8.6526e-01, + 8.6729e-01, 8.6986e-01, 8.7316e-01, 8.7749e-01, 8.8338e-01, 8.9214e-01, + 9.0895e-01, 9.7166e-01, 9.2687e-01, 9.1657e-01, 9.1266e-01, 9.1157e-01, + 9.1260e-01, 9.1569e-01, 9.2125e-01, 9.3021e-01, 9.4481e-01, 9.6985e-01, + 1.0169, 1.1709}, + {9.1435e-01, 9.1448e-01, 9.1492e-01, 9.1575e-01, 9.1689e-01, 9.1846e-01, + 9.2046e-01, 9.2304e-01, 9.2633e-01, 9.3068e-01, 9.3652e-01, 9.4523e-01, + 9.6191e-01, 1.0265, 9.8022e-01, 9.6983e-01, 9.6588e-01, 9.6480e-01, + 9.6576e-01, 9.6877e-01, 9.7426e-01, 9.8323e-01, 9.9774e-01, 1.0225, + 1.0689, 1.2167}, + {9.6759e-01, 9.6773e-01, 9.6823e-01, 9.6900e-01, 9.7017e-01, 9.7170e-01, + 9.7372e-01, 9.7628e-01, 9.7957e-01, 9.8389e-01, 9.8975e-01, 9.9845e-01, + 1.0150, 1.0814, 1.0336, 1.0232, 1.0192, 1.0181, 1.0190, 1.0220, 1.0274, + 1.0363, 1.0507, 1.0752, 1.1210, 1.2635}, + {1.0219, 1.0211, 1.0215, 1.0223, 1.0235, 1.0250, 1.0270, 1.0296, 1.0329, + 1.0372, 1.0432, 1.0517, 1.0681, 1.1366, 1.0872, 1.0766, 1.0725, 1.0714, + 1.0723, 1.0753, 1.0807, 1.0895, 1.1038, 1.1281, 1.1732, 1.3110}, + {1.0743, 1.0748, 1.0749, 1.0757, 1.0770, 1.0784, 1.0804, 1.0830, 1.0863, + 1.0906, 1.0964, 1.1050, 1.1214, 1.1919, 1.1407, 1.1300, 1.1260, 1.1248, + 1.1257, 1.1287, 1.1340, 1.1428, 1.1570, 1.1810, 1.2256, 1.3591}, + {1.1278, 1.1279, 1.1284, 1.1292, 1.1304, 1.1319, 1.1339, 1.1364, 1.1397, + 1.1440, 1.1498, 1.1584, 1.1747, 1.2472, 1.1943, 1.1836, 1.1795, 1.1783, + 1.1792, 1.1821, 1.1874, 1.1961, 1.2102, 1.2340, 1.2781, 1.4079}, + {1.1912, 1.1815, 1.1820, 1.1827, 1.1839, 1.1854, 1.1875, 1.1900, 1.1933, + 1.1975, 1.2033, 1.2119, 1.2281, 1.3027, 1.2480, 1.2371, 1.2330, 1.2318, + 1.2327, 1.2356, 1.2409, 1.2495, 1.2635, 1.2872, 1.3308, 1.4571}, + {1.2349, 1.2351, 1.2356, 1.2363, 1.2375, 1.2390, 1.2410, 1.2436, 1.2468, + 1.2511, 1.2569, 1.2654, 1.2815, 1.3583, 1.3017, 1.2908, 1.2866, 1.2854, + 1.2863, 1.2892, 1.2944, 1.3030, 1.3170, 1.3404, 1.3836, 1.5071}, + {1.3170, 1.2887, 1.2892, 1.2900, 1.2911, 1.2927, 1.2947, 1.2972, 1.3005, + 1.3047, 1.3105, 1.3190, 1.3350, 1.4139, 1.3555, 1.3445, 1.3403, 1.3391, + 1.3399, 1.3428, 1.3480, 1.3566, 1.3704, 1.3937, 1.4366, 1.5575}, + {1.3423, 1.3424, 1.3429, 1.3437, 1.3449, 1.3464, 1.3484, 1.3509, 1.3541, + 1.3584, 1.3642, 1.3727, 1.3886, 1.4695, 1.4093, 1.3982, 1.3940, 1.3928, + 1.3936, 1.3966, 1.4017, 1.4103, 1.4240, 1.4472, 1.4896, 1.6085}, + {1.3960, 1.3962, 1.3966, 1.3974, 1.3985, 1.4001, 1.4021, 1.4046, 1.4079, + 1.4122, 1.4179, 1.4264, 1.4423, 1.5251, 1.4632, 1.4520, 1.4477, 1.4465, + 1.4474, 1.4502, 1.4554, 1.4639, 1.4776, 1.5007, 1.5429, 1.6600}, + {1.4498, 1.4499, 1.4504, 1.4512, 1.4524, 1.4539, 1.4559, 1.4584, 1.4616, + 1.4659, 1.4717, 1.4801, 1.4959, 1.5806, 1.5170, 1.5058, 1.5016, 1.5003, + 1.5011, 1.5040, 1.5091, 1.5177, 1.5313, 1.5542, 1.5962, 1.7119}, + {1.5036, 1.5037, 1.5042, 1.5050, 1.5061, 1.5077, 1.5097, 1.5122, 1.5154, + 1.5197, 1.5254, 1.5339, 1.5497, 1.6359, 1.5708, 1.5596, 1.5554, 1.5541, + 1.5549, 1.5577, 1.5629, 1.5714, 1.5850, 1.6079, 1.6497, 1.7643}, + {1.5574, 1.5575, 1.5580, 1.5588, 1.5600, 1.5615, 1.5635, 1.5660, 1.5693, + 1.5735, 1.5792, 1.5877, 1.6035, 1.6909, 1.6247, 1.6135, 1.6092, 1.6080, + 1.6088, 1.6117, 1.6167, 1.6252, 1.6388, 1.6616, 1.7033, 1.8171}, + {1.6173, 1.6114, 1.6119, 1.6127, 1.6138, 1.6153, 1.6173, 1.6198, 1.6231, + 1.6274, 1.6331, 1.6415, 1.6573, 1.7454, 1.6786, 1.6674, 1.6631, 1.6618, + 1.6626, 1.6654, 1.6706, 1.6791, 1.6926, 1.7154, 1.7570, 1.8704}, + {1.6651, 1.6652, 1.6657, 1.6665, 1.6676, 1.6692, 1.6712, 1.6737, 1.6769, + 1.6812, 1.6869, 1.6953, 1.7111, 1.7995, 1.7324, 1.7212, 1.7169, 1.7157, + 1.7164, 1.7193, 1.7244, 1.7328, 1.7465, 1.7693, 1.8108, 1.9241}}; + + Float_t nonstagg[ktimebin][kZbin] = + {{0.0912, 0.0913, 0.0914, 0.0917, 0.0920, 0.0925, 0.0931, 0.0938, 0.0946, + 0.0954, 0.0964, 0.0975, 0.0988, 0.1001, 0.1017, 0.1034, 0.1053, 0.1075, + 0.1101, 0.1135, 0.1179, 0.1239, 0.1332, 0.1504, 0.1935, 0.5719}, + {0.0657, 0.0658, 0.0660, 0.0662, 0.0666, 0.0672, 0.0678, 0.0685, 0.0694, + 0.0704, 0.0715, 0.0727, 0.0740, 0.0755, 0.0770, 0.0788, 0.0808, 0.0831, + 0.0858, 0.0893, 0.0938, 0.1001, 0.1096, 0.1274, 0.1715, 0.5475}, + {0.0396, 0.0397, 0.0400, 0.0404, 0.0410, 0.0418, 0.0427, 0.0438, 0.0450, + 0.0463, 0.0477, 0.0492, 0.0509, 0.0526, 0.0544, 0.0565, 0.0587, 0.0613, + 0.0645, 0.0685, 0.0736, 0.0807, 0.0919, 0.1128, 0.1608, 0.5233}, + {0.0112, 0.0115, 0.0124, 0.0137, 0.0154, 0.0173, 0.0195, 0.0218, 0.0241, + 0.0265, 0.0289, 0.0313, 0.0336, 0.0360, 0.0384, 0.0410, 0.0439, 0.0473, + 0.0515, 0.0571, 0.0651, 0.0767, 0.0949, 0.1243, 0.1826, 0.4858}, + {0.0113, 0.0116, 0.0124, 0.0137, 0.0154, 0.0173, 0.0195, 0.0217, 0.0241, + 0.0264, 0.0287, 0.0311, 0.0334, 0.0357, 0.0381, 0.0408, 0.0439, 0.0476, + 0.0525, 0.0591, 0.0684, 0.0821, 0.1019, 0.1352, 0.1914, 0.4601}, + {0.0394, 0.0394, 0.0397, 0.0401, 0.0407, 0.0415, 0.0423, 0.0434, 0.0445, + 0.0457, 0.0471, 0.0485, 0.0501, 0.0518, 0.0538, 0.0560, 0.0585, 0.0616, + 0.0652, 0.0698, 0.0759, 0.0846, 0.0983, 0.1226, 0.1742, 0.5225}, + {0.0650, 0.0650, 0.0652, 0.0655, 0.0658, 0.0663, 0.0669, 0.0676, 0.0685, + 0.0694, 0.0704, 0.0716, 0.0729, 0.0744, 0.0761, 0.0780, 0.0802, 0.0828, + 0.0860, 0.0899, 0.0950, 0.1020, 0.1130, 0.1334, 0.1809, 0.5444}, + {0.0929, 0.0929, 0.0922, 0.0921, 0.0923, 0.0928, 0.0934, 0.0941, 0.0950, + 0.0958, 0.0968, 0.0979, 0.0990, 0.1002, 0.1015, 0.1029, 0.1044, 0.1062, + 0.1080, 0.1101, 0.1126, 0.1155, 0.1192, 0.1241, 0.1312, 0.0000}, + {0.1688, 0.1657, 0.1518, 0.1450, 0.1409, 0.1382, 0.1366, 0.1357, 0.1352, + 0.1352, 0.1354, 0.1359, 0.1367, 0.1377, 0.1389, 0.1403, 0.1420, 0.1441, + 0.1465, 0.1495, 0.1532, 0.1580, 0.1643, 0.1736, 0.1902, 0.2919}, + {0.3413, 0.2191, 0.2052, 0.1981, 0.1936, 0.1905, 0.1883, 0.1869, 0.1860, + 0.1856, 0.1856, 0.1859, 0.1865, 0.1875, 0.1888, 0.1904, 0.1924, 0.1948, + 0.1977, 0.2011, 0.2054, 0.2107, 0.2175, 0.2272, 0.2440, 0.3413}, + {0.4016, 0.2716, 0.2576, 0.2505, 0.2459, 0.2428, 0.2406, 0.2392, 0.2383, + 0.2378, 0.2378, 0.2381, 0.2387, 0.2396, 0.2409, 0.2426, 0.2446, 0.2470, + 0.2500, 0.2535, 0.2578, 0.2631, 0.2700, 0.2796, 0.2964, 0.3877}, + {0.4388, 0.3240, 0.3100, 0.3029, 0.2983, 0.2952, 0.2931, 0.2916, 0.2907, + 0.2902, 0.2901, 0.2904, 0.2911, 0.2920, 0.2933, 0.2950, 0.2970, 0.2994, + 0.3024, 0.3059, 0.3102, 0.3155, 0.3224, 0.3319, 0.3486, 0.4320}, + {0.3580, 0.3764, 0.3625, 0.3554, 0.3509, 0.3477, 0.3455, 0.3440, 0.3431, + 0.3427, 0.3426, 0.3429, 0.3435, 0.3445, 0.3458, 0.3474, 0.3494, 0.3519, + 0.3548, 0.3583, 0.3626, 0.3679, 0.3747, 0.3843, 0.4008, 0.4768}, + {0.4023, 0.4289, 0.4150, 0.4079, 0.4033, 0.4002, 0.3980, 0.3965, 0.3956, + 0.3952, 0.3951, 0.3954, 0.3960, 0.3970, 0.3983, 0.3999, 0.4019, 0.4043, + 0.4072, 0.4107, 0.4150, 0.4203, 0.4271, 0.4367, 0.4530, 0.5228}, + {0.4334, 0.4815, 0.4676, 0.4604, 0.4559, 0.4527, 0.4506, 0.4491, 0.4482, + 0.4477, 0.4476, 0.4479, 0.4486, 0.4495, 0.4508, 0.4524, 0.4544, 0.4568, + 0.4597, 0.4632, 0.4675, 0.4728, 0.4796, 0.4890, 0.5052, 0.5699}, + {0.4695, 0.5341, 0.5202, 0.5130, 0.5085, 0.5053, 0.5032, 0.5017, 0.5008, + 0.5003, 0.5002, 0.5005, 0.5012, 0.5021, 0.5034, 0.5050, 0.5070, 0.5095, + 0.5123, 0.5158, 0.5200, 0.5253, 0.5321, 0.5415, 0.5576, 0.6179}, + {0.5905, 0.5868, 0.5729, 0.5657, 0.5612, 0.5580, 0.5559, 0.5544, 0.5535, + 0.5530, 0.5529, 0.5532, 0.5538, 0.5548, 0.5560, 0.5577, 0.5597, 0.5621, + 0.5649, 0.5684, 0.5726, 0.5779, 0.5846, 0.5940, 0.6099, 0.6666}, + {0.5940, 0.6307, 0.6254, 0.6185, 0.6141, 0.6108, 0.6086, 0.6071, 0.6062, + 0.6057, 0.6057, 0.6059, 0.6066, 0.6075, 0.6088, 0.6104, 0.6124, 0.6148, + 0.6176, 0.6211, 0.6253, 0.6306, 0.6373, 0.6465, 0.6623, 0.7156}, + {0.6986, 0.6924, 0.6784, 0.6713, 0.6667, 0.6636, 0.6614, 0.6599, 0.6590, + 0.6585, 0.6585, 0.6587, 0.6594, 0.6603, 0.6616, 0.6632, 0.6651, 0.6675, + 0.6704, 0.6739, 0.6781, 0.6833, 0.6900, 0.6992, 0.7147, 0.7651}, + {0.7449, 0.7453, 0.7312, 0.7242, 0.7196, 0.7165, 0.7143, 0.7128, 0.7119, + 0.7117, 0.7113, 0.7116, 0.7122, 0.7132, 0.7144, 0.7160, 0.7180, 0.7204, + 0.7233, 0.7267, 0.7309, 0.7361, 0.7427, 0.7519, 0.7672, 0.8151}, + {0.8011, 0.7982, 0.7843, 0.7772, 0.7726, 0.7694, 0.7673, 0.7658, 0.7649, + 0.7644, 0.7643, 0.7646, 0.7652, 0.7661, 0.7674, 0.7690, 0.7709, 0.7733, + 0.7763, 0.7796, 0.7838, 0.7890, 0.7956, 0.8046, 0.8198, 0.8656}, + {0.8261, 0.8513, 0.8374, 0.8302, 0.8256, 0.8225, 0.8203, 0.8188, 0.8179, + 0.8174, 0.8173, 0.8176, 0.8182, 0.8191, 0.8204, 0.8220, 0.8240, 0.8263, + 0.8292, 0.8326, 0.8367, 0.8419, 0.8485, 0.8575, 0.8725, 0.9163}, + {0.9145, 0.9043, 0.8905, 0.8834, 0.8788, 0.8756, 0.8734, 0.8720, 0.8710, + 0.8706, 0.8705, 0.8707, 0.8713, 0.8722, 0.8735, 0.8751, 0.8770, 0.8794, + 0.8822, 0.8856, 0.8898, 0.8949, 0.9015, 0.9104, 0.9252, 0.9674}, + {0.8915, 0.9576, 0.9437, 0.9365, 0.9320, 0.9288, 0.9267, 0.9251, 0.9242, + 0.9237, 0.9236, 0.9239, 0.9245, 0.9254, 0.9267, 0.9282, 0.9302, 0.9326, + 0.9354, 0.9388, 0.9429, 0.9480, 0.9545, 0.9635, 0.9781, 1.0188}, + {1.0290, 1.0109, 0.9970, 0.9898, 0.9852, 0.9821, 0.9799, 0.9784, 0.9775, + 0.9770, 0.9769, 0.9772, 0.9778, 0.9787, 0.9800, 0.9815, 0.9835, 0.9858, + 0.9886, 0.9920, 0.9961, 1.0012, 1.0077, 1.0165, 1.0310, 1.0705}, + {1.0470, 1.1170, 1.0503, 1.0431, 1.0386, 1.0354, 1.0333, 1.0318, 1.0308, + 1.0303, 1.0303, 1.0305, 1.0311, 1.0320, 1.0333, 1.0348, 1.0368, 1.0391, + 1.0419, 1.0453, 1.0494, 1.0545, 1.0609, 1.0697, 1.0840, 1.1223}, + {1.2284, 1.1176, 1.1037, 1.0966, 1.0922, 1.0889, 1.0867, 1.0852, 1.0842, + 1.0838, 1.0837, 1.0839, 1.0845, 1.0854, 1.0867, 1.0882, 1.0902, 1.0925, + 1.0953, 1.0987, 1.1028, 1.1078, 1.1143, 1.1230, 1.1371, 1.1744}, + {1.1548, 1.1712, 1.1572, 1.1501, 1.1455, 1.1424, 1.1402, 1.1387, 1.1377, + 1.1373, 1.1371, 1.1374, 1.1380, 1.1389, 1.1401, 1.1417, 1.1436, 1.1460, + 1.1488, 1.1521, 1.1562, 1.1613, 1.1676, 1.1763, 1.1903, 1.2267}, + {1.2050, 1.2248, 1.2108, 1.2037, 1.1991, 1.1959, 1.1937, 1.1922, 1.1913, + 1.1908, 1.1907, 1.1909, 1.1915, 1.1925, 1.1937, 1.1952, 1.1972, 1.1995, + 1.2023, 1.2056, 1.2097, 1.2147, 1.2211, 1.2297, 1.2436, 1.2791}, + {1.2799, 1.2784, 1.2644, 1.2573, 1.2527, 1.2495, 1.2473, 1.2458, 1.2449, + 1.2444, 1.2443, 1.2446, 1.2451, 1.2460, 1.2473, 1.2488, 1.2508, 1.2531, + 1.2559, 1.2592, 1.2633, 1.2683, 1.2746, 1.2833, 1.2970, 1.3317}, + {1.2857, 1.3320, 1.3181, 1.3109, 1.3063, 1.3032, 1.3010, 1.2995, 1.2986, + 1.2981, 1.2980, 1.2982, 1.2988, 1.2997, 1.3009, 1.3025, 1.3044, 1.3067, + 1.3095, 1.3129, 1.3169, 1.3219, 1.3283, 1.3368, 1.3505, 1.3845}, + {1.3924, 1.3856, 1.3718, 1.3646, 1.3601, 1.3569, 1.3547, 1.3532, 1.3523, + 1.3518, 1.3517, 1.3519, 1.3525, 1.3534, 1.3546, 1.3562, 1.3581, 1.3604, + 1.3632, 1.3665, 1.3706, 1.3756, 1.3819, 1.3904, 1.4041, 1.4375}, + {1.5732, 1.4395, 1.4255, 1.4184, 1.4138, 1.4107, 1.4085, 1.4070, 1.4060, + 1.4055, 1.4054, 1.4057, 1.4063, 1.4071, 1.4086, 1.4099, 1.4119, 1.4142, + 1.4170, 1.4203, 1.4243, 1.4293, 1.4356, 1.4441, 1.4576, 1.4906}, + {1.4352, 1.4933, 1.4793, 1.4722, 1.4676, 1.4644, 1.4623, 1.4607, 1.4598, + 1.4593, 1.4592, 1.4595, 1.4600, 1.4609, 1.4622, 1.4637, 1.4656, 1.4680, + 1.4707, 1.4741, 1.4781, 1.4831, 1.4894, 1.4979, 1.5113, 1.5439}, + {1.4933, 1.5471, 1.5332, 1.5260, 1.5214, 1.5183, 1.5161, 1.5146, 1.5136, + 1.5131, 1.5131, 1.5133, 1.5139, 1.5148, 1.5160, 1.5175, 1.5195, 1.5218, + 1.5247, 1.5279, 1.5319, 1.5369, 1.5432, 1.5516, 1.5650, 1.5973}, + {1.5709, 1.6010, 1.5870, 1.5798, 1.5753, 1.5721, 1.5699, 1.5684, 1.5675, + 1.5670, 1.5669, 1.5671, 1.5677, 1.5686, 1.5698, 1.5714, 1.5733, 1.5756, + 1.5784, 1.5817, 1.5857, 1.5907, 1.5970, 1.6054, 1.6188, 1.6509}, + {1.6675, 1.6548, 1.6408, 1.6337, 1.6291, 1.6259, 1.6238, 1.6223, 1.6213, + 1.6208, 1.6207, 1.6210, 1.6216, 1.6225, 1.6237, 1.6252, 1.6272, 1.6295, + 1.6322, 1.6356, 1.6396, 1.6445, 1.6508, 1.6593, 1.6727, 1.7046}, + {1.7042, 1.7087, 1.6947, 1.6876, 1.6830, 1.6798, 1.6776, 1.6761, 1.6752, + 1.6747, 1.6746, 1.6749, 1.6754, 1.6763, 1.6775, 1.6791, 1.6810, 1.6833, + 1.6861, 1.6894, 1.6935, 1.6984, 1.7047, 1.7132, 1.7265, 1.7584}}; + + if (fTimeStruct) delete [] fTimeStruct; + fTimeStruct = new Float_t[ktimebin*kZbin]; + + for (Int_t ctrt = 0; ctrtGetListOfFiles()->FindObject("TRD_test.root"); // gAlice = (AliRun *) file->Get("gAlice"); -// // Analyze the digits -// if (rc = AliTRDanalyzeDigits()) return rc; + // Analyze the digits + if (rc = AliTRDanalyzeDigits()) return rc; // // Create the cluster // if (rc = AliTRDcreateCluster()) return rc; @@ -117,15 +117,6 @@ Int_t AliTRDanalyzeHits() TH2F *hXZ = new TH2F("hXZ" ,"Z vs X (plane 0)" , ncol, -width/2., width/2. , nrow,-length/2.,length/2.); - TH1F *hNprimP = new TH1F("hNprimP","Number of primary electrons per cm (MIP pion)" - ,50,0.0,100.0); - TH1F *hNprimE = new TH1F("hNprimE","Number of primary electrons per cm (3GeV electron)" - ,50,0.0,100.0); - TH1F *hNtotP = new TH1F("hNtotP" ,"Number of electrons per cm (MIP pion)" - ,50,0.0,1000.0); - TH1F *hNtotE = new TH1F("hNtotE" ,"Number of electrons per cm (3GeV electron)" - ,50,0.0,1000.0); - // Get the pointer hit tree TTree *hitTree = loader->TreeH(); if (!hitTree) { @@ -149,11 +140,6 @@ Int_t AliTRDanalyzeHits() gAlice->ResetHits(); nBytes += hitTree->GetEvent(iTrack); - Int_t nPrimE = 0; - Int_t nPrimP = 0; - Int_t nTotE = 0; - Int_t nTotP = 0; - // Loop through the TRD hits Int_t iHit = 0; AliTRDhit *hit = (AliTRDhit *) trd->FirstHit(-1); @@ -181,36 +167,10 @@ Int_t AliTRDanalyzeHits() hQtr->Fill(TMath::Abs(q)); } -// printf("Getting TParticle for track %d\n",track); -// TParticle *part = gAlice->Particle(track); - -// if ((plane == 0) && (q > 0)) { - -// // 3 GeV electrons -// if ((part->GetPdgCode() == 11) && -// (part->P() > 2.9)) { -// nPrimE++; -// nTotE += ((Int_t) q); -// } - -// // MIP pions -// if ((part->GetPdgCode() == -211) && -// (part->P() > 0.5)) { -// nPrimP++; -// nTotP += ((Int_t) q); -// } - -// } - hit = (AliTRDhit *) trd->NextHit(); } - if (nPrimE > 0) hNprimE->Fill(((Double_t) nPrimE)/3.7); - if (nPrimP > 0) hNprimP->Fill(((Double_t) nPrimP)/3.7); - if (nTotE > 0) hNtotE->Fill(((Double_t) nTotE)/3.7); - if (nTotP > 0) hNtotP->Fill(((Double_t) nTotP)/3.7); - } cout << " Found " << countHits << " hits in total" << endl; @@ -228,28 +188,6 @@ Int_t AliTRDanalyzeHits() gPad->SetLogy(); hQtr->Draw(); - TCanvas *cNel = new TCanvas("cNel","Ionization",50,50,600,600); - cNel->Divide(2,2); - cNel->cd(1); - hNprimE->SetStats(); - hNprimE->Draw(); - cNel->cd(2); - hNprimP->SetStats(); - hNprimP->Draw(); - cNel->cd(3); - hNtotE->SetStats(); - hNtotE->Draw(); - cNel->cd(4); - hNtotP->SetStats(); - hNtotP->Draw(); - - TFile *fout = new TFile("TRD_ionization.root","RECREATE"); - hNprimE->Write(); - hNprimP->Write(); - hNtotE->Write(); - hNtotP->Write(); - fout->Close(); - return rc; } @@ -331,25 +269,38 @@ Int_t AliTRDanalyzeDigits() rc = 1; return rc; } - Int_t nPart = gAlice->GetEvent(0); - // Get the pointer to the TRD detector - AliTRD *trd = (AliTRD *) gAlice->GetDetector("TRD"); - if (!trd) { - cout << " No TRD detector found" << endl; + AliRunLoader *rl = gAlice->GetRunLoader(); + if (!rl) { + cout << " No RunLoader found" << endl; rc = 2; return rc; } - // Get the digitizer object - TFile *file = (TFile *) gROOT->GetListOfFiles()->FindObject("TRD_test.root"); - AliTRDparameter *parameter = (AliTRDparameter *) file->Get("TRDparameter"); - if (!parameter) { - cout << " No parameter object found" << endl; + // Import the Trees for the event nEvent in the file + rl->LoadKinematics(); + rl->GetEvent(0); + rl->GetHeader(); + + AliLoader* loader = rl->GetLoader("TRDLoader"); + if (!loader) { + cout << " No TRDLoader found" << endl; rc = 3; return rc; } + // Get the pointer to the TRD detector + AliTRD *trd = (AliTRD *) gAlice->GetDetector("TRD"); + if (!trd) { + cout << " No TRD detector found" << endl; + rc = 4; + return rc; + } + + // Get the parameter object + AliTRDparameter *parameter = new AliTRDparameter("TRDparameter" + ,"TRD parameter class"); + // Define the histograms Int_t adcRange = ((Int_t) parameter->GetADCoutRange()); TH1F *hAmpAll = new TH1F("hAmpAll" ,"Amplitude of the digits (all)" @@ -368,7 +319,7 @@ Int_t AliTRDanalyzeDigits() } else { cout << " No TRD geometry found" << endl; - rc = 4; + rc = 5; return rc; } @@ -376,12 +327,18 @@ Int_t AliTRDanalyzeDigits() AliTRDdigitsManager *digitsManager = new AliTRDdigitsManager(); digitsManager->SetDebug(1); - digitsManager->Open("TRD_test.root"); - // Read the digits from the file - if (!(digitsManager->ReadDigits())) { + if (!(digitsManager->ReadDigits(loader->TreeD()))) { cout << " Cannot read the digits" << endl; - rc = 5; + rc = 6; + return rc; + } + + // Get the particle stack + AliStack *kineStack = rl->Stack(); + if (!kineStack) { + cout << " Cannot find the KINE stack" << endl; + rc = 7; return rc; } @@ -419,7 +376,7 @@ Int_t AliTRDanalyzeDigits() Int_t track1 = digitsManager->GetTrack(1,row,col,time,iDet); TParticle *particle = 0; if (track0 > -1) { - particle = gAlice->Particle(track0); + particle = (TParticle *) kineStack->Particle(track0); } if (amp > 0) { @@ -493,15 +450,6 @@ Int_t AliTRDanalyzeDigits() hAmpTimePi->SetYTitle("Mean amplitude"); hAmpTimePi->Draw("HIST"); - TFile *fileOut = new TFile("digits_test.root","RECREATE"); - hAmpAll->Write(); - hAmpNoise->Write(); - hAmpEl->Write(); - hAmpPi->Write(); - hAmpTimeEl->Write(); - hAmpTimePi->Write(); - fileOut->Close(); - return rc; } diff --git a/TRD/AliTRDv1.cxx b/TRD/AliTRDv1.cxx index 72a4dc2adc9..c269d434d64 100644 --- a/TRD/AliTRDv1.cxx +++ b/TRD/AliTRDv1.cxx @@ -54,14 +54,18 @@ AliTRDv1::AliTRDv1():AliTRD() // Default constructor // - fSensSelect = 0; - fSensPlane = -1; - fSensChamber = -1; - fSensSector = -1; - fSensSectorRange = 0; + fSensSelect = 0; + fSensPlane = -1; + fSensChamber = -1; + fSensSector = -1; + fSensSectorRange = 0; - fDeltaE = NULL; - fTR = NULL; + fDeltaE = NULL; + fDeltaG = NULL; + fTR = NULL; + + fStepSize = 0.1; + fTypeOfStepManager = 2; } @@ -73,14 +77,17 @@ AliTRDv1::AliTRDv1(const char *name, const char *title) // Standard constructor for Transition Radiation Detector version 1 // - fSensSelect = 0; - fSensPlane = -1; - fSensChamber = -1; - fSensSector = -1; - fSensSectorRange = 0; + fSensSelect = 0; + fSensPlane = -1; + fSensChamber = -1; + fSensSector = -1; + fSensSectorRange = 0; - fDeltaE = NULL; - fTR = NULL; + fDeltaE = NULL; + fDeltaG = NULL; + fTR = NULL; + fStepSize = 0.1; + fTypeOfStepManager = 2; SetBufferSize(128000); @@ -105,6 +112,7 @@ AliTRDv1::~AliTRDv1() // if (fDeltaE) delete fDeltaE; + if (fDeltaG) delete fDeltaG; if (fTR) delete fTR; } @@ -128,13 +136,17 @@ void AliTRDv1::Copy(TObject &trd) // Copy function // - ((AliTRDv1 &) trd).fSensSelect = fSensSelect; - ((AliTRDv1 &) trd).fSensPlane = fSensPlane; - ((AliTRDv1 &) trd).fSensChamber = fSensChamber; - ((AliTRDv1 &) trd).fSensSector = fSensSector; - ((AliTRDv1 &) trd).fSensSectorRange = fSensSectorRange; + ((AliTRDv1 &) trd).fSensSelect = fSensSelect; + ((AliTRDv1 &) trd).fSensPlane = fSensPlane; + ((AliTRDv1 &) trd).fSensChamber = fSensChamber; + ((AliTRDv1 &) trd).fSensSector = fSensSector; + ((AliTRDv1 &) trd).fSensSectorRange = fSensSectorRange; + + ((AliTRDv1 &) trd).fTypeOfStepManager = fTypeOfStepManager; + ((AliTRDv1 &) trd).fStepSize = fStepSize; fDeltaE->Copy(*((AliTRDv1 &) trd).fDeltaE); + fDeltaG->Copy(*((AliTRDv1 &) trd).fDeltaG); fTR->Copy(*((AliTRDv1 &) trd).fTR); } @@ -246,7 +258,10 @@ void AliTRDv1::CreateTRhit(Int_t det) // is deposited. if (sigma > 0.0) { absLength = gRandom->Exp(1.0/sigma); - if (absLength > AliTRDgeometry::DrThick()) continue; + if (absLength > (AliTRDgeometry::DrThick() + + AliTRDgeometry::AmThick())) { + continue; + } } else { continue; @@ -308,7 +323,12 @@ void AliTRDv1::Init() // Ermilova distribution for the delta-ray spectrum Float_t poti = TMath::Log(kPoti); Float_t eEnd = TMath::Log(kEend); - fDeltaE = new TF1("deltae",Ermilova,poti,eEnd,0); + + // Ermilova distribution for the delta-ray spectrum + fDeltaE = new TF1("deltae" ,Ermilova ,poti,eEnd,0); + + // Geant3 distribution for the delta-ray spectrum + fDeltaG = new TF1("deltaeg",IntSpecGeant,poti,eEnd,0); if(fDebug) { printf("%s: ",ClassName()); @@ -416,6 +436,58 @@ void AliTRDv1::SetSensSector(Int_t isector, Int_t nsector) //_____________________________________________________________________________ void AliTRDv1::StepManager() +{ + // + // Slow simulator. Every charged track produces electron cluster as hits + // along its path across the drift volume. + // + + switch (fTypeOfStepManager) { + case 0 : StepManagerErmilova(); break; // 0 is Ermilova + case 1 : StepManagerGeant(); break; // 1 is Geant + case 2 : StepManagerFixedStep(); break; // 2 is fixed step + default : printf(": Not a valid Step Manager.\n"); + } + +} + +//_____________________________________________________________________________ +void AliTRDv1::SelectStepManager(Int_t t) +{ + // + // Selects a step manager type: + // 0 - Ermilova + // 1 - Geant3 + // 2 - Fixed step size + // + + if (t == 1) { + printf(": Sorry, Geant parametrization step" + "manager is not implemented yet. Please ask K.Oyama for detail.\n"); + } + + fTypeOfStepManager = t; + printf(": Step Manager type %d was selected.\n" + , fTypeOfStepManager); + +} + +//_____________________________________________________________________________ +void AliTRDv1::StepManagerGeant() +{ + // + // Slow simulator. Every charged track produces electron cluster as hits + // along its path across the drift volume. The step size is set acording + // to Bethe-Bloch. The energy distribution of the delta electrons follows + // a spectrum taken from Geant3. + // + + printf("AliTRDv1::StepManagerGeant: Not implemented yet.\n"); + +} + +//_____________________________________________________________________________ +void AliTRDv1::StepManagerErmilova() { // // Slow simulator. Every charged track produces electron cluster as hits @@ -456,26 +528,24 @@ void AliTRDv1::StepManager() const Int_t kNcham = AliTRDgeometry::Ncham(); const Int_t kNdetsec = kNplan * kNcham; - const Double_t kBig = 1.0E+12; + const Double_t kBig = 1.0E+12; // Infinitely big + const Float_t kWion = 22.04; // Ionization energy + const Float_t kPTotMaxEl = 0.002; // Maximum momentum for e+ e- g - // Ionization energy - const Float_t kWion = 22.04; - // Maximum momentum for e+ e- g - const Float_t kPTotMaxEl = 0.002; // Minimum energy for the step size adjustment const Float_t kEkinMinStep = 1.0e-5; + // Plateau value of the energy-loss for electron in xenon // taken from: Allison + Comb, Ann. Rev. Nucl. Sci. (1980), 30, 253 //const Double_t kPlateau = 1.70; // the averaged value (26/3/99) const Float_t kPlateau = 1.55; - // dN1/dx|min for the gas mixture (90% Xe + 10% CO2) - const Float_t kPrim = 48.0; + + const Float_t kPrim = 48.0; // dN1/dx|min for the gas mixture (90% Xe + 10% CO2) // First ionization potential (eV) for the gas mixture (90% Xe + 10% CO2) const Float_t kPoti = 12.1; - // PDG code electron - const Int_t kPdgElectron = 11; + const Int_t kPdgElectron = 11; // PDG code electron // Set the maximum step size to a very large number for all // neutral particles and those outside the driftvolume @@ -506,7 +576,6 @@ void AliTRDv1::StepManager() // The sector number (0 - 17) // The numbering goes clockwise and starts at y = 0 - // Not fully consistent to new corrdinate schema!!! Float_t phi = kRaddeg*TMath::ATan2(pos[0],pos[1]); if (phi < 90.) phi = phi + 270.; @@ -546,7 +615,7 @@ void AliTRDv1::StepManager() // The detector number det = fGeometry->GetDetector(pla,cha,sec); - // Special hits and TR photons only in the drift region + // Special hits only in the drift region if (drRegion) { // Create a track reference at the entrance and @@ -571,10 +640,12 @@ void AliTRDv1::StepManager() // Create a new dEdx hit if (drRegion) { - AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(),det,hits,qTot,kTRUE); + AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber() + ,det,hits,qTot,kTRUE); } else { - AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(),det,hits,qTot,kFALSE); + AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber() + ,det,hits,qTot,kFALSE); } // Calculate the maximum step size for the next tracking step @@ -617,6 +688,140 @@ void AliTRDv1::StepManager() } +//_____________________________________________________________________________ +void AliTRDv1::StepManagerFixedStep() +{ + // + // Slow simulator. Every charged track produces electron cluster as hits + // along its path across the drift volume. The step size is fixed in + // this version of the step manager. + // + + Int_t pla = 0; + Int_t cha = 0; + Int_t sec = 0; + Int_t det = 0; + Int_t qTot; + + Float_t hits[3]; + Double_t eDep; + + Bool_t drRegion = kFALSE; + Bool_t amRegion = kFALSE; + + TString cIdCurrent; + TString cIdSensDr = "J"; + TString cIdSensAm = "K"; + Char_t cIdChamber[3]; + cIdChamber[2] = 0; + + TLorentzVector pos, mom; + + const Int_t kNplan = AliTRDgeometry::Nplan(); + const Int_t kNcham = AliTRDgeometry::Ncham(); + const Int_t kNdetsec = kNplan * kNcham; + + const Double_t kBig = 1.0E+12; + + const Float_t kWion = 22.04; // Ionization energy + const Float_t kEkinMinStep = 1.0e-5; // Minimum energy for the step size adjustment + + // Set the maximum step size to a very large number for all + // neutral particles and those outside the driftvolume + gMC->SetMaxStep(kBig); + + // If not charged track or already stopped or disappeared, just return. + if ((!gMC->TrackCharge()) || + gMC->IsTrackStop() || + gMC->IsTrackDisappeared()) return; + + // Inside a sensitive volume? + cIdCurrent = gMC->CurrentVolName(); + + if (cIdSensDr == cIdCurrent[1]) drRegion = kTRUE; + if (cIdSensAm == cIdCurrent[1]) amRegion = kTRUE; + + if ((!drRegion) && (!amRegion)) return; + + // The hit coordinates and charge + gMC->TrackPosition(pos); + hits[0] = pos[0]; + hits[1] = pos[1]; + hits[2] = pos[2]; + + // The sector number (0 - 17) + // The numbering goes clockwise and starts at y = 0 + Float_t phi = kRaddeg*TMath::ATan2(pos[0],pos[1]); + if (phi < 90.) phi += 270.; + else phi -= 90.; + sec = ((Int_t) (phi / 20.)); + + // The plane and chamber number + cIdChamber[0] = cIdCurrent[2]; + cIdChamber[1] = cIdCurrent[3]; + Int_t idChamber = (atoi(cIdChamber) % kNdetsec); + cha = ((Int_t) idChamber / kNplan); + pla = ((Int_t) idChamber % kNplan); + + // Check on selected volumes + Int_t addthishit = 1; + if(fSensSelect) { + if ((fSensPlane >= 0) && (pla != fSensPlane )) addthishit = 0; + if ((fSensChamber >= 0) && (cha != fSensChamber)) addthishit = 0; + if (fSensSector >= 0) { + Int_t sens1 = fSensSector; + Int_t sens2 = fSensSector + fSensSectorRange; + sens2 -= ((Int_t) (sens2 / AliTRDgeometry::Nsect())) * AliTRDgeometry::Nsect(); + if (sens1 < sens2) { + if ((sec < sens1) || (sec >= sens2)) addthishit = 0; + } + else { + if ((sec < sens1) && (sec >= sens2)) addthishit = 0; + } + } + } + + if (!addthishit) return; + + det = fGeometry->GetDetector(pla,cha,sec); // The detector number + + Int_t trkStat = 0; // 0: InFlight 1:Entering 2:Exiting + + // Special hits only in the drift region + if (drRegion) { + + // Create a track reference at the entrance and exit of each + // chamber that contain the momentum components of the particle + + if (gMC->IsTrackEntering()) { + gMC->TrackMomentum(mom); + AddTrackReference(gAlice->GetMCApp()->GetCurrentTrackNumber()); + trkStat = 1; + } + if (gMC->IsTrackExiting()) { + gMC->TrackMomentum(mom); + AddTrackReference(gAlice->GetMCApp()->GetCurrentTrackNumber()); + trkStat = 2; + } + + // Create the hits from TR photons + if (fTR) CreateTRhit(det); + + } + + // Calculate the charge according to GEANT Edep + // Create a new dEdx hit + eDep = TMath::Max(gMC->Edep(),0.0) * 1.0e+09; + qTot = (Int_t) (eDep / kWion); + AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(),det,hits,qTot,drRegion); + + // Set Maximum Step Size + // Produce only one hit if Ekin is below cutoff + if ((gMC->Etot() - gMC->TrackMass()) < kEkinMinStep) return; + gMC->SetMaxStep(fStepSize); + +} + //_____________________________________________________________________________ Double_t AliTRDv1::BetheBloch(Double_t bg) { @@ -661,6 +866,49 @@ Double_t AliTRDv1::BetheBloch(Double_t bg) } +//_____________________________________________________________________________ +Double_t BetheBlochGeant(Double_t bg) +{ + // + // Return dN/dx (number of primary collisions per centimeter) + // for given beta*gamma factor. + // + // Implemented by K.Oyama according to GEANT 3 parametrization shown in + // A.Andronic's webpage: http://www-alice.gsi.de/trd/papers/dedx/dedx.html + // This must be used as a set with IntSpecGeant. + // + + Double_t arr_g[20] = { + 1.100000, 1.200000, 1.300000, 1.500000, + 1.800000, 2.000000, 2.500000, 3.000000, + 4.000000, 7.000000, 10.000000, 20.000000, + 40.000000, 70.000000, 100.000000, 300.000000, + 600.000000, 1000.000000, 3000.000000, 10000.000000 }; + + Double_t arr_nc[20] = { + 75.009056, 45.508083, 35.299252, 27.116327, + 22.734999, 21.411915, 19.934095, 19.449375, + 19.344431, 20.185553, 21.027925, 22.912676, + 24.933352, 26.504053, 27.387468, 29.566597, + 30.353779, 30.787134, 31.129285, 31.157350 }; + + // betagamma to gamma + Double_t g = TMath::Sqrt( 1. + bg*bg ); + + // Find the index just before the point we need. + int i; + for( i = 0 ; i < 18 ; i++ ) + if( arr_g[i] < g && arr_g[i+1] > g ) + break; + + // Simple interpolation. + Double_t pp = ((arr_nc[i+1] - arr_nc[i]) / + (arr_g[i+1]-arr_g[i])) * (g-arr_g[i]) + arr_nc[i]; + + return pp; + +} + //_____________________________________________________________________________ Double_t Ermilova(Double_t *x, Double_t *) { @@ -712,3 +960,76 @@ Double_t Ermilova(Double_t *x, Double_t *) return dnde; } + +//_____________________________________________________________________________ +Double_t IntSpecGeant(Double_t *x, Double_t *) +{ + // + // Integrated spectrum from Geant3 + // + + const Int_t n_pts = 83; + Double_t arr_e[n_pts] = { + 2.421257, 2.483278, 2.534301, 2.592230, + 2.672067, 2.813299, 3.015059, 3.216819, + 3.418579, 3.620338, 3.868209, 3.920198, + 3.978284, 4.063923, 4.186264, 4.308605, + 4.430946, 4.553288, 4.724261, 4.837736, + 4.999842, 5.161949, 5.324056, 5.486163, + 5.679688, 5.752998, 5.857728, 5.962457, + 6.067185, 6.171914, 6.315653, 6.393674, + 6.471694, 6.539689, 6.597658, 6.655627, + 6.710957, 6.763648, 6.816338, 6.876198, + 6.943227, 7.010257, 7.106285, 7.252151, + 7.460531, 7.668911, 7.877290, 8.085670, + 8.302979, 8.353585, 8.413120, 8.483500, + 8.541030, 8.592857, 8.668865, 8.820485, + 9.037086, 9.253686, 9.470286, 9.686887, + 9.930838, 9.994655, 10.085822, 10.176990, + 10.268158, 10.359325, 10.503614, 10.627565, + 10.804637, 10.981709, 11.158781, 11.335854, + 11.593397, 11.781165, 12.049404, 12.317644, + 12.585884, 12.854123, 14.278421, 16.975889, + 20.829416, 24.682943, 28.536469 + }; + Double_t arr_dndx[n_pts] = { + 19.344431, 18.664679, 18.136106, 17.567745, + 16.836426, 15.677382, 14.281277, 13.140237, + 12.207677, 11.445510, 10.697049, 10.562296, + 10.414673, 10.182341, 9.775256, 9.172330, + 8.240271, 6.898587, 4.808303, 3.889751, + 3.345288, 3.093431, 2.897347, 2.692470, + 2.436222, 2.340029, 2.208579, 2.086489, + 1.975535, 1.876519, 1.759626, 1.705024, + 1.656374, 1.502638, 1.330566, 1.200697, + 1.101168, 1.019323, 0.943867, 0.851951, + 0.755229, 0.671576, 0.570675, 0.449672, + 0.326722, 0.244225, 0.188225, 0.149608, + 0.121529, 0.116289, 0.110636, 0.103490, + 0.096147, 0.089191, 0.079780, 0.063927, + 0.047642, 0.036341, 0.028250, 0.022285, + 0.017291, 0.016211, 0.014802, 0.013533, + 0.012388, 0.011352, 0.009803, 0.008537, + 0.007039, 0.005829, 0.004843, 0.004034, + 0.003101, 0.002564, 0.001956, 0.001494, + 0.001142, 0.000873, 0.000210, 0.000014, + 0.000000, 0.000000, 0.000000 + }; + + Int_t i; + Double_t energy = x[0]; + Double_t dnde; + + for( i = 0 ; i < n_pts ; i++ ) + if( energy < arr_e[i] ) break; + + if( i == 0 ) + printf("Error in AliTRDv1::IntSpecGeant: " + "given energy value is too small or zero.\n"); + + // Interpolate + dnde = (arr_dndx[i-1] - arr_dndx[i]) / (arr_e[i] - arr_e[i-1]); + + return dnde; + +} diff --git a/TRD/AliTRDv1.h b/TRD/AliTRDv1.h index ae846aa6844..7365aaa115d 100644 --- a/TRD/AliTRDv1.h +++ b/TRD/AliTRDv1.h @@ -11,6 +11,7 @@ // Energy spectrum of the delta-rays Double_t Ermilova(Double_t *x, Double_t *par); +Double_t IntSpecGeant(Double_t *x, Double_t *par); #include "AliTRD.h" @@ -37,6 +38,12 @@ class AliTRDv1 : public AliTRD { virtual void StepManager(); virtual void Init(); + void StepManagerErmilova(); + void StepManagerGeant(); + void StepManagerFixedStep(); + void SelectStepManager(Int_t t); + void SetStepSize(Double_t s) { fStepSize = s; }; + void SetSensPlane(Int_t iplane = 0); void SetSensChamber(Int_t ichamber = 0); void SetSensSector(Int_t isector); @@ -53,6 +60,8 @@ class AliTRDv1 : public AliTRD { protected: + void *StepManagerEntity(); + Int_t fSensSelect; // Switch to select only parts of the detector Int_t fSensPlane; // Sensitive detector plane Int_t fSensChamber; // Sensitive detector chamber @@ -61,13 +70,17 @@ class AliTRDv1 : public AliTRD { AliTRDsim *fTR; // TR simulator + Int_t fTypeOfStepManager; // Type of Step Manager. + Double_t fStepSize; // Used for the fixed step size + private: virtual Double_t BetheBloch(Double_t bg); - TF1 *fDeltaE; // Energy distribution of the delta-electrons + TF1 *fDeltaE; // Energy distribution of the delta-electrons (Ermilova) + TF1 *fDeltaG; // for StepManagerGeant - ClassDef(AliTRDv1,2) // Transition Radiation Detector version 1 (slow simulator) + ClassDef(AliTRDv1,3) // Transition Radiation Detector version 1 (slow simulator) }; -- 2.39.3