1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
18 ////////////////////////////////////////////////////////////////////////////
20 // Creates and handles digits from TRD hits //
22 // Authors: C. Blume (blume@ikf.uni-frankfurt.de) //
26 // The following effects are included: //
29 // - Gas gain including fluctuations //
30 // - Pad-response (simple Gaussian approximation) //
32 // - Electronics noise //
33 // - Electronics gain //
35 // - Zero suppression //
37 ////////////////////////////////////////////////////////////////////////////
39 #include <TGeoManager.h>
47 #include "AliRunLoader.h"
48 #include "AliLoader.h"
49 #include "AliConfig.h"
50 #include "AliRunDigitizer.h"
51 #include "AliRunLoader.h"
52 #include "AliLoader.h"
56 #include "AliTRDhit.h"
57 #include "AliTRDdigitizer.h"
58 #include "AliTRDarrayDictionary.h"
59 #include "AliTRDarrayADC.h"
60 #include "AliTRDarraySignal.h"
61 #include "AliTRDdigitsManager.h"
62 #include "AliTRDgeometry.h"
63 #include "AliTRDpadPlane.h"
64 #include "AliTRDcalibDB.h"
65 #include "AliTRDSimParam.h"
66 #include "AliTRDCommonParam.h"
67 #include "AliTRDfeeParam.h"
68 #include "AliTRDmcmSim.h"
69 #include "Cal/AliTRDCalROC.h"
70 #include "Cal/AliTRDCalDet.h"
72 ClassImp(AliTRDdigitizer)
74 //_____________________________________________________________________________
75 AliTRDdigitizer::AliTRDdigitizer()
80 ,fSDigitsManagerList(0)
87 ,fMergeSignalOnly(kFALSE)
90 // AliTRDdigitizer default constructor
97 //_____________________________________________________________________________
98 AliTRDdigitizer::AliTRDdigitizer(const Text_t *name, const Text_t *title)
99 :AliDigitizer(name,title)
103 ,fSDigitsManagerList(0)
110 ,fMergeSignalOnly(kFALSE)
113 // AliTRDdigitizer constructor
120 //_____________________________________________________________________________
121 AliTRDdigitizer::AliTRDdigitizer(AliRunDigitizer *manager
122 , const Text_t *name, const Text_t *title)
123 :AliDigitizer(manager,name,title)
127 ,fSDigitsManagerList(0)
134 ,fMergeSignalOnly(kFALSE)
137 // AliTRDdigitizer constructor
144 //_____________________________________________________________________________
145 AliTRDdigitizer::AliTRDdigitizer(AliRunDigitizer *manager)
146 :AliDigitizer(manager,"AliTRDdigitizer","TRD digitizer")
150 ,fSDigitsManagerList(0)
157 ,fMergeSignalOnly(kFALSE)
160 // AliTRDdigitizer constructor
167 //_____________________________________________________________________________
168 Bool_t AliTRDdigitizer::Init()
171 // Initialize the digitizer with default values
177 fSDigitsManagerList = 0;
185 fMergeSignalOnly = kFALSE;
187 return AliDigitizer::Init();
191 //_____________________________________________________________________________
192 AliTRDdigitizer::AliTRDdigitizer(const AliTRDdigitizer &d)
197 ,fSDigitsManagerList(0)
202 ,fCompress(d.fCompress)
203 ,fSDigits(d.fSDigits)
204 ,fMergeSignalOnly(d.fMergeSignalOnly)
207 // AliTRDdigitizer copy constructor
212 //_____________________________________________________________________________
213 AliTRDdigitizer::~AliTRDdigitizer()
216 // AliTRDdigitizer destructor
219 if (fDigitsManager) {
220 delete fDigitsManager;
224 if (fDigitsManager) { //typo? fSDigitsManager?
225 delete fSDigitsManager;
229 if (fSDigitsManagerList) {
230 fSDigitsManagerList->Delete();
231 delete fSDigitsManagerList;
232 fSDigitsManagerList = 0;
247 //_____________________________________________________________________________
248 AliTRDdigitizer &AliTRDdigitizer::operator=(const AliTRDdigitizer &d)
251 // Assignment operator
255 ((AliTRDdigitizer &) d).Copy(*this);
262 //_____________________________________________________________________________
263 void AliTRDdigitizer::Copy(TObject &d) const
269 ((AliTRDdigitizer &) d).fRunLoader = 0;
270 ((AliTRDdigitizer &) d).fDigitsManager = 0;
271 ((AliTRDdigitizer &) d).fSDigitsManager = 0;
272 ((AliTRDdigitizer &) d).fSDigitsManagerList = 0;
273 ((AliTRDdigitizer &) d).fTRD = 0;
274 ((AliTRDdigitizer &) d).fGeo = 0;
275 ((AliTRDdigitizer &) d).fEvent = 0;
276 ((AliTRDdigitizer &) d).fMasks = 0;
277 ((AliTRDdigitizer &) d).fCompress = fCompress;
278 ((AliTRDdigitizer &) d).fSDigits = fSDigits;
279 ((AliTRDdigitizer &) d).fMergeSignalOnly = fMergeSignalOnly;
283 //_____________________________________________________________________________
284 void AliTRDdigitizer::Exec(const Option_t * const option)
287 // Executes the merging
292 AliTRDdigitsManager *sdigitsManager;
294 TString optionString = option;
295 if (optionString.Contains("deb")) {
296 AliLog::SetClassDebugLevel("AliTRDdigitizer",1);
297 AliInfo("Called with debug option");
300 // The AliRoot file is already connected by the manager
301 AliRunLoader *inrl = 0x0;
304 AliDebug(1,"AliRun object found on file.");
307 inrl = AliRunLoader::GetRunLoader(fManager->GetInputFolderName(0));
309 gAlice = inrl->GetAliRun();
311 AliError("Could not find AliRun object.")
316 Int_t nInput = fManager->GetNinputs();
317 fMasks = new Int_t[nInput];
318 for (iInput = 0; iInput < nInput; iInput++) {
319 fMasks[iInput] = fManager->GetMask(iInput);
326 AliRunLoader *orl = AliRunLoader::GetRunLoader(fManager->GetOutputFolderName());
328 if (InitDetector()) {
330 AliLoader *ogime = orl->GetLoader("TRDLoader");
334 // If we produce SDigits
335 tree = ogime->TreeS();
337 ogime->MakeTree("S");
338 tree = ogime->TreeS();
342 // If we produce Digits
343 tree = ogime->TreeD();
345 ogime->MakeTree("D");
346 tree = ogime->TreeD();
354 for (iInput = 0; iInput < nInput; iInput++) {
356 AliDebug(1,Form("Add input stream %d",iInput));
358 // Check if the input tree exists
359 inrl = AliRunLoader::GetRunLoader(fManager->GetInputFolderName(iInput));
360 AliLoader *gime = inrl->GetLoader("TRDLoader");
362 TTree *treees = gime->TreeS();
364 if (gime->LoadSDigits()) {
365 AliError(Form("Error Occured while loading S. Digits for input %d.",iInput));
368 treees = gime->TreeS();
372 AliError(Form("Input stream %d does not exist",iInput));
376 // Read the s-digits via digits manager
377 sdigitsManager = new AliTRDdigitsManager();
378 sdigitsManager->SetSDigits(kTRUE);
380 AliRunLoader *rl = AliRunLoader::GetRunLoader(fManager->GetInputFolderName(iInput));
381 AliLoader *gimme = rl->GetLoader("TRDLoader");
384 gimme->LoadSDigits();
387 sdigitsManager->ReadDigits(gimme->TreeS());
389 // Add the s-digits to the input list
390 AddSDigitsManager(sdigitsManager);
394 // Convert the s-digits to normal digits
395 AliDebug(1,"Do the conversion");
399 AliDebug(1,"Write the digits");
400 fDigitsManager->WriteDigits();
406 DeleteSDigitsManager();
412 //_____________________________________________________________________________
413 Bool_t AliTRDdigitizer::Open(const Char_t *file, Int_t nEvent)
416 // Opens a ROOT-file with TRD-hits and reads in the hit-tree
418 // Connect the AliRoot file containing Geometry, Kine, and Hits
421 TString evfoldname = AliConfig::GetDefaultEventFolderName();
423 fRunLoader = AliRunLoader::GetRunLoader(evfoldname);
425 fRunLoader = AliRunLoader::Open(file,evfoldname,"UPDATE");
428 AliError(Form("Can not open session for file %s.",file));
432 if (!fRunLoader->GetAliRun()) {
433 fRunLoader->LoadgAlice();
435 gAlice = fRunLoader->GetAliRun();
438 AliDebug(1,"AliRun object found on file.");
441 AliError("Could not find AliRun object.");
447 AliLoader *loader = fRunLoader->GetLoader("TRDLoader");
449 AliError("Can not get TRD loader from Run Loader");
453 if (InitDetector()) {
456 // If we produce SDigits
457 tree = loader->TreeS();
459 loader->MakeTree("S");
460 tree = loader->TreeS();
464 // If we produce Digits
465 tree = loader->TreeD();
467 loader->MakeTree("D");
468 tree = loader->TreeD();
471 return MakeBranch(tree);
479 //_____________________________________________________________________________
480 Bool_t AliTRDdigitizer::Open(AliRunLoader * const runLoader, Int_t nEvent)
483 // Opens a ROOT-file with TRD-hits and reads in the hit-tree
485 // Connect the AliRoot file containing Geometry, Kine, and Hits
488 fRunLoader = runLoader;
490 AliError("RunLoader does not exist");
494 if (!fRunLoader->GetAliRun()) {
495 fRunLoader->LoadgAlice();
497 gAlice = fRunLoader->GetAliRun();
500 AliDebug(1,"AliRun object found on file.");
503 AliError("Could not find AliRun object.");
509 AliLoader *loader = fRunLoader->GetLoader("TRDLoader");
511 AliError("Can not get TRD loader from Run Loader");
515 if (InitDetector()) {
518 // If we produce SDigits
519 tree = loader->TreeS();
521 loader->MakeTree("S");
522 tree = loader->TreeS();
526 // If we produce Digits
527 tree = loader->TreeD();
529 loader->MakeTree("D");
530 tree = loader->TreeD();
533 return MakeBranch(tree);
541 //_____________________________________________________________________________
542 Bool_t AliTRDdigitizer::InitDetector()
545 // Sets the pointer to the TRD detector and the geometry
548 // Get the pointer to the detector class and check for version 1
549 fTRD = (AliTRD *) gAlice->GetDetector("TRD");
551 AliFatal("No TRD module found");
554 if (fTRD->IsVersion() != 1) {
555 AliFatal("TRD must be version 1 (slow simulator)");
560 fGeo = new AliTRDgeometry();
562 // Create a digits manager
563 if (fDigitsManager) {
564 delete fDigitsManager;
566 fDigitsManager = new AliTRDdigitsManager();
567 fDigitsManager->SetSDigits(fSDigits);
568 fDigitsManager->CreateArrays();
569 fDigitsManager->SetEvent(fEvent);
571 // The list for the input s-digits manager to be merged
572 if (fSDigitsManagerList) {
573 fSDigitsManagerList->Delete();
576 fSDigitsManagerList = new TList();
582 //_____________________________________________________________________________
583 Bool_t AliTRDdigitizer::MakeBranch(TTree *tree) const
586 // Create the branches for the digits array
589 return fDigitsManager->MakeBranch(tree);
593 //_____________________________________________________________________________
594 void AliTRDdigitizer::AddSDigitsManager(AliTRDdigitsManager *man)
597 // Add a digits manager for s-digits to the input list.
600 fSDigitsManagerList->Add(man);
604 //_____________________________________________________________________________
605 void AliTRDdigitizer::DeleteSDigitsManager()
608 // Removes digits manager from the input list.
611 fSDigitsManagerList->Delete();
615 //_____________________________________________________________________________
616 Bool_t AliTRDdigitizer::MakeDigits()
622 AliDebug(1,"Start creating digits");
625 AliError("No geometry defined");
629 AliTRDcalibDB *calibration = AliTRDcalibDB::Instance();
631 AliFatal("Could not get calibration object");
635 const Int_t kNdet = AliTRDgeometry::Ndet();
637 Float_t **hits = new Float_t*[kNdet];
638 Int_t *nhit = new Int_t[kNdet];
640 AliTRDarraySignal *signals = 0x0;
642 // Sort all hits according to detector number
643 if (!SortHits(hits,nhit)) {
644 AliError("Sorting hits failed");
648 // Loop through all detectors
649 for (Int_t det = 0; det < kNdet; det++) {
651 // Detectors that are switched off, not installed, etc.
652 if (( calibration->IsChamberInstalled(det)) &&
653 (!calibration->IsChamberMasked(det)) &&
654 ( fGeo->ChamberInGeometry(det)) &&
657 signals = new AliTRDarraySignal();
659 // Convert the hits of the current detector to detector signals
660 if (!ConvertHits(det,hits[det],nhit[det],signals)) {
661 AliError(Form("Conversion of hits failed for detector=%d",det));
664 // Convert the detector signals to digits or s-digits
665 if (!ConvertSignals(det,signals)) {
666 AliError(Form("Conversion of signals failed for detector=%d",det));
670 // Delete the signals array
674 } // if: detector status
687 //_____________________________________________________________________________
688 Bool_t AliTRDdigitizer::SortHits(Float_t **hits, Int_t *nhit)
691 // Read all the hits and sorts them according to detector number
692 // in the output array <hits>.
695 AliDebug(1,"Start sorting hits");
697 const Int_t kNdet = AliTRDgeometry::Ndet();
698 // Size of the hit vector
699 const Int_t kNhit = 6;
704 Int_t *lhit = new Int_t[kNdet];
706 for (Int_t det = 0; det < kNdet; det++) {
712 AliLoader *gimme = fRunLoader->GetLoader("TRDLoader");
713 if (!gimme->TreeH()) {
716 TTree *hitTree = gimme->TreeH();
717 if (hitTree == 0x0) {
718 AliError("Can not get TreeH");
721 fTRD->SetTreeAddress();
723 // Get the number of entries in the hit tree
724 // (Number of primary particles creating a hit somewhere)
725 Int_t nTrk = (Int_t) hitTree->GetEntries();
726 AliDebug(1,Form("Found %d tracks",nTrk));
728 // Loop through all the tracks in the tree
729 for (Int_t iTrk = 0; iTrk < nTrk; iTrk++) {
731 gAlice->GetMCApp()->ResetHits();
732 hitTree->GetEvent(iTrk);
735 AliError(Form("No hits array for track = %d",iTrk));
739 // Number of hits for this track
740 nhitTrk = fTRD->Hits()->GetEntriesFast();
743 // Loop through the TRD hits
744 AliTRDhit *hit = (AliTRDhit *) fTRD->FirstHit(-1);
749 // Don't analyze test hits
750 if (((Int_t) hit->GetCharge()) != 0) {
752 Int_t trk = hit->Track();
753 Int_t det = hit->GetDetector();
754 Int_t q = hit->GetCharge();
755 Float_t x = hit->X();
756 Float_t y = hit->Y();
757 Float_t z = hit->Z();
758 Float_t time = hit->GetTime();
760 if (nhit[det] == lhit[det]) {
761 // Inititialization of new detector
762 xyz = new Float_t[kNhit*(nhitTrk+lhit[det])];
764 memcpy(xyz,hits[det],sizeof(Float_t)*kNhit*lhit[det]);
767 lhit[det] += nhitTrk;
773 xyz[nhit[det]*kNhit+0] = x;
774 xyz[nhit[det]*kNhit+1] = y;
775 xyz[nhit[det]*kNhit+2] = z;
776 xyz[nhit[det]*kNhit+3] = q;
777 xyz[nhit[det]*kNhit+4] = trk;
778 xyz[nhit[det]*kNhit+5] = time;
783 hit = (AliTRDhit *) fTRD->NextHit();
785 } // for: hits of one track
795 //_____________________________________________________________________________
796 Bool_t AliTRDdigitizer::ConvertHits(Int_t det
797 , const Float_t * const hits
799 , AliTRDarraySignal *signals)
802 // Converts the detectorwise sorted hits to detector signals
805 AliDebug(1,Form("Start converting hits for detector=%d (nhits=%d)",det,nhit));
807 // Number of pads included in the pad response
808 const Int_t kNpad = 3;
809 // Number of track dictionary arrays
810 const Int_t kNdict = AliTRDdigitsManager::kNDict;
811 // Size of the hit vector
812 const Int_t kNhit = 6;
814 // Width of the amplification region
815 const Float_t kAmWidth = AliTRDgeometry::AmThick();
816 // Width of the drift region
817 const Float_t kDrWidth = AliTRDgeometry::DrThick();
818 // Drift + amplification region
819 const Float_t kDrMin = - 0.5 * kAmWidth;
820 const Float_t kDrMax = kDrWidth + 0.5 * kAmWidth;
824 Int_t timeBinTRFend = 1;
828 Double_t padSignal[kNpad];
829 Double_t signalOld[kNpad];
831 AliTRDarrayDictionary *dictionary[kNdict];
833 AliTRDSimParam *simParam = AliTRDSimParam::Instance();
834 AliTRDCommonParam *commonParam = AliTRDCommonParam::Instance();
835 AliTRDcalibDB *calibration = AliTRDcalibDB::Instance();
838 AliFatal("Could not get common parameterss");
842 AliFatal("Could not get simulation parameters");
846 AliFatal("Could not get calibration object");
850 // Get the detector wise calibration objects
851 AliTRDCalROC *calVdriftROC = 0;
852 Float_t calVdriftDetValue = 0.0;
853 const AliTRDCalDet *calVdriftDet = calibration->GetVdriftDet();
854 AliTRDCalROC *calT0ROC = 0;
855 Float_t calT0DetValue = 0.0;
856 const AliTRDCalDet *calT0Det = calibration->GetT0Det();
858 if (simParam->TRFOn()) {
859 timeBinTRFend = ((Int_t) (simParam->GetTRFhi()
860 * commonParam->GetSamplingFrequency())) - 1;
863 Int_t nTimeTotal = calibration->GetNumberOfTimeBins();
864 Float_t samplingRate = commonParam->GetSamplingFrequency();
865 Float_t elAttachProp = simParam->GetElAttachProp() / 100.0;
867 AliTRDpadPlane *padPlane = fGeo->GetPadPlane(det);
868 Int_t layer = fGeo->GetLayer(det); //update
869 Float_t row0 = padPlane->GetRow0ROC();
870 Int_t nRowMax = padPlane->GetNrows();
871 Int_t nColMax = padPlane->GetNcols();
873 // Create a new array for the signals
874 signals->Allocate(nRowMax,nColMax,nTimeTotal);
876 // Create a new array for the dictionary
877 for (dict = 0; dict < kNdict; dict++) {
878 dictionary[dict] = (AliTRDarrayDictionary *) fDigitsManager->GetDictionary(det,dict);
879 dictionary[dict]->Allocate(nRowMax,nColMax,nTimeTotal);
882 // Loop through the hits in this detector
883 for (Int_t hit = 0; hit < nhit; hit++) {
885 pos[0] = hits[hit*kNhit+0];
886 pos[1] = hits[hit*kNhit+1];
887 pos[2] = hits[hit*kNhit+2];
888 Float_t q = hits[hit*kNhit+3];
889 Float_t hittime = hits[hit*kNhit+5];
890 Int_t track = ((Int_t) hits[hit*kNhit+4]);
894 // Find the current volume with the geo manager
895 gGeoManager->SetCurrentPoint(pos);
896 gGeoManager->FindNode();
897 if (strstr(gGeoManager->GetPath(),"/UK")) {
901 // Get the calibration objects
902 calVdriftROC = calibration->GetVdriftROC(det);
903 calVdriftDetValue = calVdriftDet->GetValue(det);
904 calT0ROC = calibration->GetT0ROC(det);
905 calT0DetValue = calT0Det->GetValue(det);
907 // Go to the local coordinate system:
908 // loc[0] - col direction in amplification or driftvolume
909 // loc[1] - row direction in amplification or driftvolume
910 // loc[2] - time direction in amplification or driftvolume
911 gGeoManager->MasterToLocal(pos,loc);
913 // Relative to middle of amplification region
914 loc[2] = loc[2] - kDrWidth/2.0 - kAmWidth/2.0;
917 // The driftlength [cm] (w/o diffusion yet !).
918 // It is negative if the hit is between pad plane and anode wires.
919 Double_t driftlength = -1.0 * loc[2];
921 // Stupid patch to take care of TR photons that are absorbed
922 // outside the chamber volume. A real fix would actually need
923 // a more clever implementation of the TR hit generation
925 if ((loc[1] < padPlane->GetRowEndROC()) ||
926 (loc[1] > padPlane->GetRow0ROC())) {
929 if ((driftlength < kDrMin) ||
930 (driftlength > kDrMax)) {
935 // Get row and col of unsmeared electron to retrieve drift velocity
936 // The pad row (z-direction)
937 Int_t rowE = padPlane->GetPadRowNumberROC(loc[1]);
941 Double_t rowOffset = padPlane->GetPadRowOffsetROC(rowE,loc[1]);
942 // The pad column (rphi-direction)
943 Double_t offsetTilt = padPlane->GetTiltOffset(rowOffset);
944 Int_t colE = padPlane->GetPadColNumber(loc[0]+offsetTilt);
948 Double_t colOffset = 0.0;
950 // Normalized drift length
951 Float_t driftvelocity = calVdriftDetValue * calVdriftROC->GetValue(colE,rowE);
952 Double_t absdriftlength = TMath::Abs(driftlength);
953 if (commonParam->ExBOn()) {
954 absdriftlength /= TMath::Sqrt(GetLorentzFactor(driftvelocity));
957 // Loop over all electrons of this hit
958 // TR photons produce hits with negative charge
959 Int_t nEl = ((Int_t) TMath::Abs(q));
960 for (Int_t iEl = 0; iEl < nEl; iEl++) {
962 // Now the real local coordinate system of the ROC
963 // column direction: locC
964 // row direction: locR
965 // time direction: locT
966 // locR and locC are identical to the coordinates of the corresponding
967 // volumina of the drift or amplification region.
968 // locT is defined relative to the wire plane (i.e. middle of amplification
969 // region), meaning locT = 0, and is negative for hits coming from the
971 Double_t locC = loc[0];
972 Double_t locR = loc[1];
973 Double_t locT = loc[2];
975 // Electron attachment
976 if (simParam->ElAttachOn()) {
977 if (gRandom->Rndm() < (absdriftlength * elAttachProp)) {
982 // Apply the diffusion smearing
983 if (simParam->DiffusionOn()) {
984 if (!(Diffusion(driftvelocity,absdriftlength,locR,locC,locT))) {
989 // Apply E x B effects (depends on drift direction)
990 if (commonParam->ExBOn()) {
991 if (!(ExB(driftvelocity,driftlength,locC))) {
996 // The electron position after diffusion and ExB in pad coordinates.
997 // The pad row (z-direction)
998 rowE = padPlane->GetPadRowNumberROC(locR);
999 if (rowE < 0) continue;
1000 rowOffset = padPlane->GetPadRowOffsetROC(rowE,locR);
1002 // The pad column (rphi-direction)
1003 offsetTilt = padPlane->GetTiltOffset(rowOffset);
1004 colE = padPlane->GetPadColNumber(locC+offsetTilt);
1005 if (colE < 0) continue;
1006 colOffset = padPlane->GetPadColOffset(colE,locC+offsetTilt);
1008 // Also re-retrieve drift velocity because col and row may have changed
1009 driftvelocity = calVdriftDetValue * calVdriftROC->GetValue(colE,rowE);
1010 Float_t t0 = calT0DetValue + calT0ROC->GetValue(colE,rowE);
1012 // Convert the position to drift time [mus], using either constant drift velocity or
1013 // time structure of drift cells (non-isochronity, GARFIELD calculation).
1014 // Also add absolute time of hits to take pile-up events into account properly
1016 if (simParam->TimeStructOn()) {
1017 // Get z-position with respect to anode wire
1018 Double_t zz = row0 - locR + padPlane->GetAnodeWireOffset();
1019 zz -= ((Int_t)(2 * zz)) / 2.0;
1023 // Use drift time map (GARFIELD)
1024 drifttime = commonParam->TimeStruct(driftvelocity,0.5*kAmWidth-1.0*locT,zz)
1028 // Use constant drift velocity
1029 drifttime = TMath::Abs(locT) / driftvelocity
1033 // Apply the gas gain including fluctuations
1034 Double_t ggRndm = 0.0;
1036 ggRndm = gRandom->Rndm();
1037 } while (ggRndm <= 0);
1038 Double_t signal = -(simParam->GetGasGain()) * TMath::Log(ggRndm);
1040 // Apply the pad response
1041 if (simParam->PRFOn()) {
1042 // The distance of the electron to the center of the pad
1043 // in units of pad width
1044 Double_t dist = (colOffset - 0.5*padPlane->GetColSize(colE))
1045 / padPlane->GetColSize(colE);
1046 // This is a fixed parametrization, i.e. not dependent on
1047 // calibration values !
1048 if (!(calibration->PadResponse(signal,dist,layer,padSignal))) continue;
1052 padSignal[1] = signal;
1056 // The time bin (always positive), with t0 distortion
1057 Double_t timeBinIdeal = drifttime * samplingRate + t0;
1059 if (TMath::Abs(timeBinIdeal) > 2*nTimeTotal) {
1060 timeBinIdeal = 2 * nTimeTotal;
1062 Int_t timeBinTruncated = ((Int_t) timeBinIdeal);
1063 // The distance of the position to the middle of the timebin
1064 Double_t timeOffset = ((Float_t) timeBinTruncated
1065 + 0.5 - timeBinIdeal) / samplingRate;
1067 // Sample the time response inside the drift region
1068 // + additional time bins before and after.
1069 // The sampling is done always in the middle of the time bin
1070 for (Int_t iTimeBin = TMath::Max(timeBinTruncated,0)
1071 ;iTimeBin < TMath::Min(timeBinTruncated+timeBinTRFend,nTimeTotal)
1074 // Apply the time response
1075 Double_t timeResponse = 1.0;
1076 Double_t crossTalk = 0.0;
1077 Double_t time = (iTimeBin - timeBinTruncated) / samplingRate + timeOffset;
1079 if (simParam->TRFOn()) {
1080 timeResponse = simParam->TimeResponse(time);
1082 if (simParam->CTOn()) {
1083 crossTalk = simParam->CrossTalk(time);
1090 for (iPad = 0; iPad < kNpad; iPad++) {
1092 Int_t colPos = colE + iPad - 1;
1093 if (colPos < 0) continue;
1094 if (colPos >= nColMax) break;
1097 signalOld[iPad] = signals->GetData(rowE,colPos,iTimeBin);
1099 if (colPos != colE) {
1100 // Cross talk added to non-central pads
1101 signalOld[iPad] += padSignal[iPad]
1102 * (timeResponse + crossTalk);
1105 // W/o cross talk at central pad
1106 signalOld[iPad] += padSignal[iPad]
1110 signals->SetData(rowE,colPos,iTimeBin,signalOld[iPad]);
1112 // Store the track index in the dictionary
1113 // Note: We store index+1 in order to allow the array to be compressed
1114 // Note2: Taking out the +1 in track
1115 if (signalOld[iPad] > 0.0) {
1116 for (dict = 0; dict < kNdict; dict++) {
1117 Int_t oldTrack = dictionary[dict]->GetData(rowE,colPos,iTimeBin);
1118 if (oldTrack == track) break;
1119 if (oldTrack == -1 ) {
1120 dictionary[dict]->SetData(rowE,colPos,iTimeBin,track);
1128 } // Loop: time bins
1130 } // Loop: electrons of a single hit
1134 AliDebug(2,Form("Finished analyzing %d hits",nhit));
1140 //_____________________________________________________________________________
1141 Bool_t AliTRDdigitizer::ConvertSignals(Int_t det, AliTRDarraySignal *signals)
1144 // Convert signals to digits
1147 AliDebug(1,Form("Start converting the signals for detector %d",det));
1150 // Convert the signal array to s-digits
1151 if (!Signal2SDigits(det,signals)) {
1156 // Convert the signal array to digits
1157 if (!Signal2ADC(det,signals)) {
1160 // Run digital processing for digits
1161 RunDigitalProcessing(det);
1164 // Compress the arrays
1165 CompressOutputArrays(det);
1171 //_____________________________________________________________________________
1172 Bool_t AliTRDdigitizer::Signal2ADC(Int_t det, AliTRDarraySignal *signals)
1175 // Converts the sampled electron signals to ADC values for a given chamber
1178 AliDebug(1,Form("Start converting signals to ADC values for detector=%d",det));
1180 AliTRDcalibDB *calibration = AliTRDcalibDB::Instance();
1182 AliFatal("Could not get calibration object");
1186 AliTRDSimParam *simParam = AliTRDSimParam::Instance();
1188 AliFatal("Could not get simulation parameters");
1192 // Converts number of electrons to fC
1193 const Double_t kEl2fC = 1.602e-19 * 1.0e15;
1196 Double_t coupling = simParam->GetPadCoupling()
1197 * simParam->GetTimeCoupling();
1198 // Electronics conversion factor
1199 Double_t convert = kEl2fC
1200 * simParam->GetChipGain();
1201 // ADC conversion factor
1202 Double_t adcConvert = simParam->GetADCoutRange()
1203 / simParam->GetADCinRange();
1204 // The electronics baseline in mV
1205 Double_t baseline = simParam->GetADCbaseline()
1207 // The electronics baseline in electrons
1208 Double_t baselineEl = baseline
1215 Int_t nRowMax = fGeo->GetPadPlane(det)->GetNrows();
1216 Int_t nColMax = fGeo->GetPadPlane(det)->GetNcols();
1217 Int_t nTimeTotal = calibration->GetNumberOfTimeBins();
1219 // The gainfactor calibration objects
1220 const AliTRDCalDet *calGainFactorDet = calibration->GetGainFactorDet();
1221 AliTRDCalROC *calGainFactorROC = 0;
1222 Float_t calGainFactorDetValue = 0.0;
1224 AliTRDarrayADC *digits = 0x0;
1227 AliError(Form("Signals array for detector %d does not exist\n",det));
1230 if (signals->HasData()) {
1231 // Expand the container if neccessary
1235 // Create missing containers
1236 signals->Allocate(nRowMax,nColMax,nTimeTotal);
1239 // Get the container for the digits of this detector
1240 if (fDigitsManager->HasSDigits()) {
1241 AliError("Digits manager has s-digits");
1245 digits = (AliTRDarrayADC *) fDigitsManager->GetDigits(det);
1246 // Allocate memory space for the digits buffer
1247 if (!digits->HasData()) {
1248 digits->Allocate(nRowMax,nColMax,nTimeTotal);
1251 // Get the calibration objects
1252 calGainFactorROC = calibration->GetGainFactorROC(det);
1253 calGainFactorDetValue = calGainFactorDet->GetValue(det);
1255 // Create the digits for this chamber
1256 for (row = 0; row < nRowMax; row++ ) {
1257 for (col = 0; col < nColMax; col++ ) {
1259 // Check whether pad is masked
1260 // Bridged pads are not considered yet!!!
1261 if (calibration->IsPadMasked(det,col,row)) {
1266 Float_t padgain = calGainFactorDetValue
1267 * calGainFactorROC->GetValue(col,row);
1269 AliError(Form("Not a valid gain %f, %d %d %d",padgain,det,col,row));
1272 for (time = 0; time < nTimeTotal; time++) {
1274 // Get the signal amplitude
1275 Float_t signalAmp = signals->GetData(row,col,time);
1276 // Pad and time coupling
1277 signalAmp *= coupling;
1279 signalAmp *= padgain;
1281 // Add the noise, starting from minus ADC baseline in electrons
1282 signalAmp = TMath::Max((Double_t) gRandom->Gaus(signalAmp,simParam->GetNoise())
1286 signalAmp *= convert;
1287 // Add ADC baseline in mV
1288 signalAmp += baseline;
1290 // Convert to ADC counts. Set the overflow-bit fADCoutRange if the
1291 // signal is larger than fADCinRange
1293 if (signalAmp >= simParam->GetADCinRange()) {
1294 adc = ((Short_t) simParam->GetADCoutRange());
1297 adc = TMath::Nint(signalAmp * adcConvert);
1300 // Saving all digits
1301 digits->SetData(row,col,time,adc);
1312 //_____________________________________________________________________________
1313 Bool_t AliTRDdigitizer::Signal2SDigits(Int_t det, AliTRDarraySignal *signals)
1316 // Converts the sampled electron signals to s-digits
1319 AliDebug(1,Form("Start converting signals to s-digits for detector=%d",det));
1321 AliTRDcalibDB *calibration = AliTRDcalibDB::Instance();
1323 AliFatal("Could not get calibration object");
1331 Int_t nRowMax = fGeo->GetPadPlane(det)->GetNrows();
1332 Int_t nColMax = fGeo->GetPadPlane(det)->GetNcols();
1333 Int_t nTimeTotal = calibration->GetNumberOfTimeBins();
1335 // Get the container for the digits of this detector
1337 if (!fDigitsManager->HasSDigits()) {
1338 AliError("Digits manager has no s-digits");
1342 AliTRDarraySignal *digits = (AliTRDarraySignal *) fDigitsManager->GetSDigits(det);
1343 // Allocate memory space for the digits buffer
1344 if (!digits->HasData()) {
1345 digits->Allocate(nRowMax,nColMax,nTimeTotal);
1348 // Create the sdigits for this chamber
1349 for (row = 0; row < nRowMax; row++ ) {
1350 for (col = 0; col < nColMax; col++ ) {
1351 for (time = 0; time < nTimeTotal; time++) {
1352 digits->SetData(row,col,time,signals->GetData(row,col,time));
1361 //_____________________________________________________________________________
1362 Bool_t AliTRDdigitizer::Digits2SDigits(AliTRDdigitsManager * const manDig
1363 , AliTRDdigitsManager * const manSDig)
1366 // Converts digits into s-digits. Needed for embedding into real data.
1369 AliDebug(1,"Start converting digits to s-digits");
1372 fGeo = new AliTRDgeometry();
1375 AliTRDcalibDB *calibration = AliTRDcalibDB::Instance();
1377 AliFatal("Could not get calibration object");
1381 AliTRDSimParam *simParam = AliTRDSimParam::Instance();
1383 AliFatal("Could not get simulation parameters");
1387 // Converts number of electrons to fC
1388 const Double_t kEl2fC = 1.602e-19 * 1.0e15;
1391 Double_t coupling = simParam->GetPadCoupling()
1392 * simParam->GetTimeCoupling();
1393 // Electronics conversion factor
1394 Double_t convert = kEl2fC
1395 * simParam->GetChipGain();
1396 // ADC conversion factor
1397 Double_t adcConvert = simParam->GetADCoutRange()
1398 / simParam->GetADCinRange();
1399 // The electronics baseline in mV
1400 Double_t baseline = simParam->GetADCbaseline()
1402 // The electronics baseline in electrons
1403 //Double_t baselineEl = baseline
1406 // The gainfactor calibration objects
1407 //const AliTRDCalDet *calGainFactorDet = calibration->GetGainFactorDet();
1408 //AliTRDCalROC *calGainFactorROC = 0;
1409 //Float_t calGainFactorDetValue = 0.0;
1415 for (Int_t det = 0; det < AliTRDgeometry::Ndet(); det++) {
1417 Int_t nRowMax = fGeo->GetPadPlane(det)->GetNrows();
1418 Int_t nColMax = fGeo->GetPadPlane(det)->GetNcols();
1419 Int_t nTimeTotal = calibration->GetNumberOfTimeBins();
1421 // Get the calibration objects
1422 //calGainFactorROC = calibration->GetGainFactorROC(det);
1423 //calGainFactorDetValue = calGainFactorDet->GetValue(det);
1426 AliTRDarrayADC *digits = (AliTRDarrayADC *) manDig->GetDigits(det);
1428 if (!manSDig->HasSDigits()) {
1429 AliError("SDigits manager has no s-digits");
1433 AliTRDarraySignal *sdigits = (AliTRDarraySignal *) manSDig->GetSDigits(det);
1434 AliTRDarrayDictionary *tracks0 = (AliTRDarrayDictionary *) manSDig->GetDictionary(det,0);
1435 AliTRDarrayDictionary *tracks1 = (AliTRDarrayDictionary *) manSDig->GetDictionary(det,1);
1436 AliTRDarrayDictionary *tracks2 = (AliTRDarrayDictionary *) manSDig->GetDictionary(det,2);
1437 // Allocate memory space for the digits buffer
1438 sdigits->Allocate(nRowMax,nColMax,nTimeTotal);
1439 tracks0->Allocate(nRowMax,nColMax,nTimeTotal);
1440 tracks1->Allocate(nRowMax,nColMax,nTimeTotal);
1441 tracks2->Allocate(nRowMax,nColMax,nTimeTotal);
1443 if (digits->HasData()) {
1447 // Create the sdigits for this chamber
1448 for (row = 0; row < nRowMax; row++ ) {
1449 for (col = 0; col < nColMax; col++ ) {
1452 //Float_t padgain = calGainFactorDetValue
1453 // * calGainFactorROC->GetValue(col,row);
1455 for (time = 0; time < nTimeTotal; time++) {
1457 Short_t adcVal = digits->GetData(row,col,time);
1458 Double_t signal = (Double_t) adcVal;
1459 // ADC -> signal in mV
1460 signal /= adcConvert;
1461 // Subtract baseline in mV
1463 // Signal in mV -> signal in #electrons
1466 //signal /= padgain; // Not needed for real data
1467 // Pad and time coupling
1470 sdigits->SetData(row,col,time,signal);
1471 tracks0->SetData(row,col,time,0);
1472 tracks1->SetData(row,col,time,0);
1473 tracks2->SetData(row,col,time,0);
1482 sdigits->Compress(0);
1483 tracks0->Compress();
1484 tracks1->Compress();
1485 tracks2->Compress();
1487 // No compress just remove
1488 manDig->RemoveDigits(det);
1489 manDig->RemoveDictionaries(det);
1497 //_____________________________________________________________________________
1498 Bool_t AliTRDdigitizer::SDigits2Digits()
1501 // Merges the input s-digits and converts them to normal digits
1504 if (!MergeSDigits()) {
1508 return ConvertSDigits();
1512 //_____________________________________________________________________________
1513 Bool_t AliTRDdigitizer::MergeSDigits()
1516 // Merges the input s-digits:
1517 // - The amplitude of the different inputs are summed up.
1518 // - Of the track IDs from the input dictionaries only one is
1519 // kept for each input. This works for maximal 3 different merged inputs.
1522 // Number of track dictionary arrays
1523 const Int_t kNDict = AliTRDdigitsManager::kNDict;
1525 AliTRDSimParam *simParam = AliTRDSimParam::Instance();
1527 AliFatal("Could not get simulation parameters");
1531 AliTRDcalibDB *calibration = AliTRDcalibDB::Instance();
1533 AliFatal("Could not get calibration object");
1540 AliTRDarraySignal *digitsA;
1541 AliTRDarraySignal *digitsB;
1542 AliTRDarrayDictionary *dictionaryA[kNDict];
1543 AliTRDarrayDictionary *dictionaryB[kNDict];
1545 AliTRDdigitsManager *mergeSDigitsManager = 0x0;
1546 // Get the first s-digits
1547 fSDigitsManager = (AliTRDdigitsManager *) fSDigitsManagerList->First();
1548 if (!fSDigitsManager) {
1549 AliError("No SDigits manager");
1553 // Loop through the other sets of s-digits
1554 mergeSDigitsManager = (AliTRDdigitsManager *) fSDigitsManagerList->After(fSDigitsManager);
1556 if (mergeSDigitsManager) {
1557 AliDebug(1,Form("Merge %d input files.",fSDigitsManagerList->GetSize()));
1560 AliDebug(1,"Only one input file.");
1563 Int_t nTimeTotal = calibration->GetNumberOfTimeBins();
1566 while (mergeSDigitsManager) {
1570 // Loop through the detectors
1571 for (Int_t iDet = 0; iDet < AliTRDgeometry::Ndet(); iDet++) {
1573 Int_t nRowMax = fGeo->GetPadPlane(iDet)->GetNrows();
1574 Int_t nColMax = fGeo->GetPadPlane(iDet)->GetNcols();
1576 // Loop through the pixels of one detector and add the signals
1577 digitsA = (AliTRDarraySignal *) fSDigitsManager->GetSDigits(iDet);
1578 digitsB = (AliTRDarraySignal *) mergeSDigitsManager->GetSDigits(iDet);
1580 if (!digitsA->HasData()) continue;
1582 if (!digitsB->HasData()) continue;
1584 for (iDict = 0; iDict < kNDict; iDict++) {
1585 dictionaryA[iDict] = (AliTRDarrayDictionary *) fSDigitsManager->GetDictionary(iDet,iDict);
1586 dictionaryB[iDict] = (AliTRDarrayDictionary *) mergeSDigitsManager->GetDictionary(iDet,iDict);
1587 dictionaryA[iDict]->Expand();
1588 dictionaryB[iDict]->Expand();
1591 // Merge only detectors that contain a signal
1592 Bool_t doMerge = kTRUE;
1593 if (fMergeSignalOnly) {
1594 if (digitsA->GetOverThreshold(0) == 0) {
1601 AliDebug(1,Form("Merge detector %d of input no.%d",iDet,iMerge+1));
1603 for (Int_t iRow = 0; iRow < nRowMax; iRow++ ) {
1604 for (Int_t iCol = 0; iCol < nColMax; iCol++ ) {
1605 for (Int_t iTime = 0; iTime < nTimeTotal; iTime++) {
1607 // Add the amplitudes of the summable digits
1608 Float_t ampA = digitsA->GetData(iRow,iCol,iTime);
1609 Float_t ampB = digitsB->GetData(iRow,iCol,iTime);
1611 digitsA->SetData(iRow,iCol,iTime,ampA);
1613 // Add the mask to the track id if defined.
1614 for (iDict = 0; iDict < kNDict; iDict++) {
1615 Int_t trackB = dictionaryB[iDict]->GetData(iRow,iCol,iTime);
1616 if ((fMasks) && (trackB > 0)) {
1617 for (jDict = 0; jDict < kNDict; jDict++) {
1618 Int_t trackA = dictionaryA[iDict]->GetData(iRow,iCol,iTime);
1620 trackA = trackB + fMasks[iMerge];
1621 dictionaryA[iDict]->SetData(iRow,iCol,iTime,trackA);
1622 } // if: track A == 0
1624 } // if: fMasks and trackB > 0
1633 mergeSDigitsManager->RemoveDigits(iDet);
1634 mergeSDigitsManager->RemoveDictionaries(iDet);
1637 digitsA->Compress(0);
1638 for (iDict = 0; iDict < kNDict; iDict++) {
1639 dictionaryA[iDict]->Compress();
1645 // The next set of s-digits
1646 mergeSDigitsManager = (AliTRDdigitsManager *) fSDigitsManagerList->After(mergeSDigitsManager);
1648 } // while: mergeDigitsManagers
1654 //_____________________________________________________________________________
1655 Bool_t AliTRDdigitizer::ConvertSDigits()
1658 // Converts s-digits to normal digits
1661 AliTRDarraySignal *digitsIn = 0x0;
1663 if (!fSDigitsManager->HasSDigits()) {
1664 AliError("No s-digits in digits manager");
1668 // Loop through the detectors
1669 for (Int_t det = 0; det < AliTRDgeometry::Ndet(); det++) {
1671 // Get the merged s-digits (signals)
1672 digitsIn = (AliTRDarraySignal *) fSDigitsManager->GetSDigits(det);
1673 if (!digitsIn->HasData()) {
1674 AliDebug(2,Form("No digits for det=%d",det));
1678 // Convert the merged sdigits to digits
1679 if (!Signal2ADC(det,digitsIn)) {
1683 // Copy the dictionary information to the output array
1684 if (!CopyDictionary(det)) {
1689 fSDigitsManager->RemoveDigits(det);
1690 fSDigitsManager->RemoveDictionaries(det);
1692 // Run digital processing
1693 RunDigitalProcessing(det);
1695 // Compress the arrays
1696 CompressOutputArrays(det);
1698 } // for: detector numbers
1705 //_____________________________________________________________________________
1706 Bool_t AliTRDdigitizer::CopyDictionary(Int_t det)
1709 // Copies the dictionary information from the s-digits arrays
1710 // to the output arrays
1713 AliTRDcalibDB *calibration = AliTRDcalibDB::Instance();
1715 AliFatal("Could not get calibration object");
1719 AliDebug(1,Form("Start copying dictionaries for detector=%d",det));
1721 const Int_t kNDict = AliTRDdigitsManager::kNDict;
1722 AliTRDarrayDictionary *dictionaryIn[kNDict];
1723 AliTRDarrayDictionary *dictionaryOut[kNDict];
1725 Int_t nRowMax = fGeo->GetPadPlane(det)->GetNrows();
1726 Int_t nColMax = fGeo->GetPadPlane(det)->GetNcols();
1727 Int_t nTimeTotal = calibration->GetNumberOfTimeBins();
1734 for (dict = 0; dict < kNDict; dict++) {
1736 dictionaryIn[dict] = (AliTRDarrayDictionary *) fSDigitsManager->GetDictionary(det,dict);
1737 dictionaryIn[dict]->Expand();
1738 dictionaryOut[dict] = (AliTRDarrayDictionary *) fDigitsManager->GetDictionary(det,dict);
1739 dictionaryOut[dict]->Allocate(nRowMax,nColMax,nTimeTotal);
1741 for (row = 0; row < nRowMax; row++) {
1742 for (col = 0; col < nColMax; col++) {
1743 for (time = 0; time < nTimeTotal; time++) {
1744 Int_t track = dictionaryIn[dict]->GetData(row,col,time);
1745 dictionaryOut[dict]->SetData(row,col,time,track);
1750 } // for: dictionaries
1756 //_____________________________________________________________________________
1757 void AliTRDdigitizer::CompressOutputArrays(Int_t det)
1760 // Compress the output arrays
1763 const Int_t kNDict = AliTRDdigitsManager::kNDict;
1764 AliTRDarrayDictionary *dictionary = 0x0;
1769 AliTRDarrayADC *digits = 0x0;
1770 digits = (AliTRDarrayADC *) fDigitsManager->GetDigits(det);
1775 AliTRDarraySignal *digits = 0x0;
1776 digits = (AliTRDarraySignal *) fDigitsManager->GetSDigits(det);
1777 digits->Compress(0);
1780 for (Int_t dict = 0; dict < kNDict; dict++) {
1781 dictionary = (AliTRDarrayDictionary *) fDigitsManager->GetDictionary(det,dict);
1782 dictionary->Compress();
1789 //_____________________________________________________________________________
1790 Bool_t AliTRDdigitizer::WriteDigits() const
1793 // Writes out the TRD-digits and the dictionaries
1797 fRunLoader->CdGAFile();
1799 // Store the digits and the dictionary in the tree
1800 return fDigitsManager->WriteDigits();
1804 //_____________________________________________________________________________
1805 void AliTRDdigitizer::InitOutput(Int_t iEvent)
1808 // Initializes the output branches
1814 AliError("Run Loader is NULL");
1818 AliLoader *loader = fRunLoader->GetLoader("TRDLoader");
1820 AliError("Can not get TRD loader from Run Loader");
1827 // If we produce SDigits
1828 tree = loader->TreeS();
1830 loader->MakeTree("S");
1831 tree = loader->TreeS();
1835 // If we produce Digits
1836 tree = loader->TreeD();
1838 loader->MakeTree("D");
1839 tree = loader->TreeD();
1842 fDigitsManager->SetEvent(iEvent);
1843 fDigitsManager->MakeBranch(tree);
1847 //_____________________________________________________________________________
1848 Int_t AliTRDdigitizer::Diffusion(Float_t vdrift, Double_t absdriftlength
1849 , Double_t &lRow, Double_t &lCol, Double_t &lTime)
1852 // Applies the diffusion smearing to the position of a single electron.
1853 // Depends on absolute drift length.
1856 Float_t diffL = 0.0;
1857 Float_t diffT = 0.0;
1859 if (AliTRDCommonParam::Instance()->GetDiffCoeff(diffL,diffT,vdrift)) {
1861 Float_t driftSqrt = TMath::Sqrt(absdriftlength);
1862 Float_t sigmaT = driftSqrt * diffT;
1863 Float_t sigmaL = driftSqrt * diffL;
1864 lRow = gRandom->Gaus(lRow ,sigmaT);
1865 lCol = gRandom->Gaus(lCol ,sigmaT * GetLorentzFactor(vdrift));
1866 lTime = gRandom->Gaus(lTime,sigmaL * GetLorentzFactor(vdrift));
1879 //_____________________________________________________________________________
1880 Float_t AliTRDdigitizer::GetLorentzFactor(Float_t vd)
1883 // Returns the Lorentz factor
1886 Double_t omegaTau = AliTRDCommonParam::Instance()->GetOmegaTau(vd);
1887 Double_t lorentzFactor = 1.0;
1888 if (AliTRDCommonParam::Instance()->ExBOn()) {
1889 lorentzFactor = 1.0 / (1.0 + omegaTau*omegaTau);
1892 return lorentzFactor;
1896 //_____________________________________________________________________________
1897 Int_t AliTRDdigitizer::ExB(Float_t vdrift, Double_t driftlength, Double_t &lCol)
1900 // Applies E x B effects to the position of a single electron.
1901 // Depends on signed drift length.
1905 + AliTRDCommonParam::Instance()->GetOmegaTau(vdrift)
1912 //_____________________________________________________________________________
1913 void AliTRDdigitizer::RunDigitalProcessing(Int_t det)
1916 // Run the digital processing in the TRAP
1919 AliTRDfeeParam *feeParam = AliTRDfeeParam::Instance();
1921 //Create and initialize the mcm object
1922 AliTRDmcmSim* mcmfast = new AliTRDmcmSim();
1924 AliTRDarrayADC *digits = fDigitsManager->GetDigits(det);
1928 //Call the methods in the mcm class using the temporary array as input
1929 for(Int_t rob = 0; rob < digits->GetNrow() / 2; rob++)
1931 for(Int_t mcm = 0; mcm < 16; mcm++)
1933 mcmfast->Init(det, rob, mcm);
1934 mcmfast->SetData(digits, fDigitsManager);
1936 if (feeParam->GetTracklet()) {
1937 mcmfast->Tracklet();
1938 mcmfast->StoreTracklets();
1940 mcmfast->ZSMapping();
1941 mcmfast->WriteData(digits);