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 // TRD raw data conversion class //
22 ///////////////////////////////////////////////////////////////////////////////
28 #include "AliRawDataHeaderSim.h"
29 #include "AliRawReader.h"
31 #include "AliFstream.h"
33 #include "AliTRDrawData.h"
34 #include "AliTRDdigitsManager.h"
35 #include "AliTRDgeometry.h"
36 #include "AliTRDdataArrayI.h"
37 #include "AliTRDdataArrayS.h"
38 #include "AliTRDrawStreamBase.h"
39 #include "AliTRDRawStream.h"
40 #include "AliTRDRawStreamV2.h"
41 #include "AliTRDcalibDB.h"
42 #include "AliTRDSignalIndex.h"
43 #include "AliTRDfeeParam.h"
44 #include "AliTRDmcmSim.h"
46 ClassImp(AliTRDrawData)
48 //_____________________________________________________________________________
49 AliTRDrawData::AliTRDrawData()
56 // Default constructor
59 fFee = AliTRDfeeParam::Instance();
60 fNumberOfDDLs = AliDAQ::NumberOfDdls("TRD");
64 //_____________________________________________________________________________
65 AliTRDrawData::AliTRDrawData(const AliTRDrawData &r)
75 fFee = AliTRDfeeParam::Instance();
76 fNumberOfDDLs = AliDAQ::NumberOfDdls("TRD");
80 //_____________________________________________________________________________
81 AliTRDrawData::~AliTRDrawData()
89 //_____________________________________________________________________________
90 Bool_t AliTRDrawData::Digits2Raw(TTree *digitsTree, TTree *tracks )
93 // Initialize necessary parameters and call one
94 // of the raw data simulator selected by SetRawVersion.
96 // Currently tracklet output is not spported yet and it
97 // will be supported in higher version simulator.
100 AliTRDdigitsManager* digitsManager = new AliTRDdigitsManager();
102 if (!digitsManager->ReadDigits(digitsTree)) {
103 delete digitsManager;
107 if (tracks != NULL) {
108 delete digitsManager;
109 AliError("Tracklet input is not supported yet.");
113 fGeo = new AliTRDgeometry();
115 if (!AliTRDcalibDB::Instance()) {
116 AliError("Could not get calibration object");
118 delete digitsManager;
122 Int_t retval = kTRUE;
123 Int_t rv = fFee->GetRAWversion();
125 // Call appropriate Raw Simulator
126 if ( rv > 0 && rv <= 3 ) retval = Digits2Raw(digitsManager);
129 AliWarning(Form("Unsupported raw version (%d).", rv));
134 delete digitsManager;
140 //_____________________________________________________________________________
141 Bool_t AliTRDrawData::Digits2Raw(AliTRDdigitsManager *digitsManager)
144 // Raw data simulator for all versions > 0. This is prepared for real data.
145 // This version simulate only raw data with ADC data and not with tracklet.
148 const Int_t kMaxHcWords = (fGeo->TBmax()/3)
154 // Buffer to temporary store half chamber data
155 UInt_t *hcBuffer = new UInt_t[kMaxHcWords];
157 Bool_t newEvent = kFALSE; // only for correct readout tree
159 // sect is same as iDDL, so I use only sect here.
160 for (Int_t sect = 0; sect < fGeo->Nsect(); sect++) {
163 sprintf(name,"TRD_%d.ddl",sect + AliTRDRawStream::kDDLOffset);
165 AliFstream* of = new AliFstream(name);
167 // Write a dummy data header
168 AliRawDataHeaderSim header; // the event header
169 UInt_t hpos = of->Tellp();
170 of->WriteBuffer((char *) (& header), sizeof(header));
172 // Reset payload byte size (payload does not include header).
173 Int_t npayloadbyte = 0;
177 // GTU common data header (5x4 bytes per super module, shows link mask)
178 for( Int_t cham = 0; cham < fGeo->Ncham(); cham++ ) {
179 UInt_t gtuCdh = (UInt_t)(0xe << 28);
180 for( Int_t plan = 0; plan < fGeo->Nplan(); plan++) {
181 Int_t iDet = fGeo->GetDetector(plan, cham, sect);
183 // If chamber status is ok, we assume that the optical link is also OK.
184 // This is shown in the GTU link mask.
185 if ( AliTRDcalibDB::Instance()->GetChamberStatus(iDet) )
186 gtuCdh = gtuCdh | (3 << (2*plan));
188 of->WriteBuffer((char *) (& gtuCdh), sizeof(gtuCdh));
192 // Prepare chamber data
193 for( Int_t cham = 0; cham < fGeo->Ncham(); cham++) {
194 for( Int_t plan = 0; plan < fGeo->Nplan(); plan++) {
196 Int_t iDet = fGeo->GetDetector(plan,cham,sect);
197 if (iDet == 0) newEvent = kTRUE; // it is expected that each event has at least one tracklet; this is only needed for correct readout tree
198 // Get the digits array
199 AliTRDdataArrayS *digits = (AliTRDdataArrayS *) digitsManager->GetDigits(iDet);
200 if (digits->HasData() ) { // second part is new!! and is for indicating a new event
205 Int_t rv = fFee->GetRAWversion();
207 // Process A side of the chamber
208 if ( rv >= 1 && rv <= 2 ) {
209 hcwords = ProduceHcDataV1andV2(digits,0,iDet,hcBuffer,kMaxHcWords);
213 // hcwords = ProduceHcDataV3 (digits,0,iDet,hcBuffer,kMaxHcWords,newEvent);
214 hcwords = ProduceHcDataV3 (digits,0,iDet,hcBuffer,kMaxHcWords);
215 if(newEvent == kTRUE) newEvent = kFALSE;
218 of->WriteBuffer((char *) hcBuffer, hcwords*4);
219 npayloadbyte += hcwords*4;
221 // Process B side of the chamber
222 if ( rv >= 1 && rv <= 2 ) {
223 hcwords = ProduceHcDataV1andV2(digits,1,iDet,hcBuffer,kMaxHcWords);
227 //hcwords = ProduceHcDataV3 (digits,1,iDet,hcBuffer,kMaxHcWords,newEvent);
228 hcwords = ProduceHcDataV3 (digits,1,iDet,hcBuffer,kMaxHcWords);
231 of->WriteBuffer((char *) hcBuffer, hcwords*4);
232 npayloadbyte += hcwords*4;
240 header.fSize = UInt_t(of->Tellp()) - hpos;
241 header.SetAttribute(0); // Valid data
242 of->Seekp(hpos); // Rewind to header position
243 of->WriteBuffer((char *) (& header), sizeof(header));
253 //_____________________________________________________________________________
254 Int_t AliTRDrawData::ProduceHcDataV1andV2(AliTRDdataArrayS *digits, Int_t side
255 , Int_t det, UInt_t *buf, Int_t maxSize)
258 // This function simulates: 1) SM-I commissiong data Oct. 06 (Raw Version == 1).
259 // 2) Full Raw Production Version (Raw Version == 2)
261 // Produce half chamber data (= an ORI data) for the given chamber (det) and side (side)
264 // side=0 means A side with ROB positions 0, 2, 4, 6.
265 // side=1 means B side with ROB positions 1, 3, 5, 7.
267 // Chamber type (C0 orC1) is determined by "det" automatically.
268 // Appropriate size of buffer (*buf) must be prepared prior to calling this function.
269 // Pointer to the buffer and its size must be given to "buf" and "maxSize".
270 // Return value is the number of valid data filled in the buffer in unit of 32 bits
272 // If buffer size if too small, the data is truncated with the buffer size however
273 // the function will finish without crash (this behaviour is similar to the MCM).
276 Int_t nw = 0; // Number of written words
277 Int_t of = 0; // Number of overflowed words
278 Int_t plan = fGeo->GetPlane( det ); // Plane
279 Int_t cham = fGeo->GetChamber( det ); // Chamber
280 Int_t sect = fGeo->GetSector( det ); // Sector (=iDDL)
281 Int_t nRow = fGeo->GetRowMax( plan, cham, sect );
282 Int_t nCol = fGeo->GetColMax( plan );
283 const Int_t kNTBin = AliTRDcalibDB::Instance()->GetNumberOfTimeBins();
284 Int_t kCtype = 0; // Chamber type (0:C0, 1:C1)
285 Int_t iEv = 0xA; // Event ID. Now fixed to 10, how do I get event id?
286 UInt_t x = 0; // General used number
287 Int_t rv = fFee->GetRAWversion();
289 // Check the nCol and nRow.
291 (nRow == 16 || nRow == 12)) {
292 kCtype = (nRow-12) / 4;
295 AliError(Form("This type of chamber is not supported (nRow=%d, nCol=%d)."
300 AliDebug(1,Form("Producing raw data for sect=%d plan=%d cham=%d side=%d"
301 ,sect,plan,cham,side));
303 // Tracklet should be processed here but not implemented yet
305 // Write end of tracklet marker
307 buf[nw++] = kEndoftrackletmarker;
313 // Half Chamber header
315 // Now it is the same version as used in SM-I commissioning.
316 Int_t dcs = det+100; // DCS Serial (in simulation, it is meaningless
317 x = (dcs<<20) | (sect<<15) | (plan<<12) | (cham<<9) | (side<<8) | 1;
325 else if ( rv == 2 ) {
326 // h[0] (there are 3 HC header)
327 Int_t minorv = 0; // The minor version number
328 Int_t add = 2; // The number of additional header words to follow
329 x = (1<<31) | (rv<<24) | (minorv<<17) | (add<<14) | (sect<<9) | (plan<<6) | (cham<<3) | (side<<2) | 1;
337 Int_t bcCtr = 99; // bunch crossing counter. Here it is set to 99 always for no reason
338 Int_t ptCtr = 15; // pretrigger counter. Here it is set to 15 always for no reason
339 Int_t ptPhase = 11; // pretrigger phase. Here it is set to 11 always for no reason
340 x = (bcCtr<<16) | (ptCtr<<12) | (ptPhase<<8) | ((kNTBin-1)<<2) | 1;
348 Int_t pedSetup = 1; // Pedestal filter setup (0:1). Here it is always 1 for no reason
349 Int_t gainSetup = 1; // Gain filter setup (0:1). Here it is always 1 for no reason
350 Int_t tailSetup = 1; // Tail filter setup (0:1). Here it is always 1 for no reason
351 Int_t xtSetup = 0; // Cross talk filter setup (0:1). Here it is always 0 for no reason
352 Int_t nonlinSetup = 0; // Nonlinearity filter setup (0:1). Here it is always 0 for no reason
353 Int_t bypassSetup = 0; // Filter bypass (for raw data) setup (0:1). Here it is always 0 for no reason
354 Int_t commonAdditive = 10; // Digital filter common additive (0:63). Here it is always 10 for no reason
355 x = (pedSetup<<31) | (gainSetup<<30) | (tailSetup<<29) | (xtSetup<<28) | (nonlinSetup<<27)
356 | (bypassSetup<<26) | (commonAdditive<<20) | 1;
365 // Scan for ROB and MCM
366 for (Int_t iRobRow = 0; iRobRow < (kCtype + 3); iRobRow++ ) {
367 Int_t iRob = iRobRow * 2 + side;
368 for (Int_t iMcm = 0; iMcm < fGeo->MCMmax(); iMcm++ ) {
369 Int_t padrow = iRobRow * 4 + iMcm / 4;
372 x = ((iRob * fGeo->MCMmax() + iMcm) << 24) | ((iEv % 0x100000) << 4) | 0xC;
381 for (Int_t iAdc = 0; iAdc < 21; iAdc++ ) {
382 Int_t padcol = fFee->GetPadColFromADC(iRob, iMcm, iAdc);
383 UInt_t aa = !(iAdc & 1) + 2;
384 UInt_t *a = new UInt_t[kNTBin+2];
385 // 3 timebins are packed into one 32 bits word
386 for (Int_t iT = 0; iT < kNTBin; iT+=3) {
387 if ((padcol >= 0) && (padcol < nCol)) {
388 a[iT ] = ((iT ) < kNTBin ) ? digits->GetDataUnchecked(padrow,padcol,iT ) : 0;
389 a[iT+1] = ((iT + 1) < kNTBin ) ? digits->GetDataUnchecked(padrow,padcol,iT + 1) : 0;
390 a[iT+2] = ((iT + 2) < kNTBin ) ? digits->GetDataUnchecked(padrow,padcol,iT + 2) : 0;
393 a[iT] = a[iT+1] = a[iT+2] = 0; // This happenes at the edge of chamber (should be pedestal! How?)
395 x = (a[iT+2] << 22) | (a[iT+1] << 12) | (a[iT] << 2) | aa;
406 for (Int_t iT = 0; iT < kNTBin; iT++) {
407 avg += (Float_t) (a[iT]);
409 avg /= (Float_t) kNTBin;
410 for (Int_t iT = 0; iT < kNTBin; iT++) {
411 rms += ((Float_t) (a[iT]) - avg) * ((Float_t) (a[iT]) - avg);
413 rms = TMath::Sqrt(rms / (Float_t) kNTBin);
415 AliDebug(2,Form("Large RMS (>1.7) (ROB,MCM,ADC)=(%02d,%02d,%02d), avg=%03.1f, rms=%03.1f"
416 ,iRob,iMcm,iAdc,avg,rms));
423 // Write end of raw data marker
425 buf[nw++] = kEndofrawdatamarker;
431 AliWarning("Buffer overflow. Data is truncated. Please increase buffer size and recompile.");
438 //_____________________________________________________________________________
439 //Int_t AliTRDrawData::ProduceHcDataV3(AliTRDdataArrayS *digits, Int_t side , Int_t det, UInt_t *buf, Int_t maxSize, Bool_t newEvent)
440 Int_t AliTRDrawData::ProduceHcDataV3(AliTRDdataArrayS *digits, Int_t side , Int_t det, UInt_t *buf, Int_t maxSize)
443 // This function simulates: Raw Version == 3 (Zero Suppression Prototype)
446 Int_t nw = 0; // Number of written words
447 Int_t of = 0; // Number of overflowed words
448 Int_t plan = fGeo->GetPlane( det ); // Plane
449 Int_t cham = fGeo->GetChamber( det ); // Chamber
450 Int_t sect = fGeo->GetSector( det ); // Sector (=iDDL)
451 Int_t nRow = fGeo->GetRowMax( plan, cham, sect );
452 Int_t nCol = fGeo->GetColMax( plan );
453 const Int_t kNTBin = AliTRDcalibDB::Instance()->GetNumberOfTimeBins();
454 Int_t kCtype = 0; // Chamber type (0:C0, 1:C1)
455 //Int_t iEv = 0xA; // Event ID. Now fixed to 10, how do I get event id?
459 Bool_t tracklet_on = fFee->GetTracklet(); // **new**
461 // Check the nCol and nRow.
463 (nRow == 16 || nRow == 12)) {
464 kCtype = (nRow-12) / 4;
467 AliError(Form("This type of chamber is not supported (nRow=%d, nCol=%d)."
472 AliDebug(1,Form("Producing raw data for sect=%d plan=%d cham=%d side=%d"
473 ,sect,plan,cham,side));
475 AliTRDmcmSim** mcm = new AliTRDmcmSim*[(kCtype + 3)*(fGeo->MCMmax())];
477 // in case no tracklet-words are processed: write the tracklet-endmarker as well as all additional words immediately and write
478 // raw-data in one go; if tracklet-processing is enabled, first all tracklet-words of a half-chamber have to be processed before the
479 // additional words (tracklet-endmarker,headers,...)are written. Raw-data is written in a second loop;
482 WriteIntermediateWords(buf,nw,of,maxSize,det,side);
485 // Scan for ROB and MCM
486 // scanning direction such, that tracklet-words are sorted in ascending z and then in ascending y order
487 // ROB numbering on chamber and MCM numbering on ROB increase with decreasing z and increasing y
488 for (Int_t iRobRow = (kCtype + 3)-1; iRobRow >= 0; iRobRow-- ) {
489 Int_t iRob = iRobRow * 2 + side;
491 for (Int_t iMcmRB = 0; iMcmRB < fGeo->MCMmax(); iMcmRB++ ) {
492 Int_t iMcm = 16 - 4*(iMcmRB/4 + 1) + (iMcmRB%4);
493 Int_t entry = iRobRow*(fGeo->MCMmax()) + iMcm;
495 mcm[entry] = new AliTRDmcmSim();
496 //mcm[entry]->Init( det, iRob, iMcm , newEvent);
497 mcm[entry]->Init( det, iRob, iMcm);
498 //if (newEvent == kTRUE) newEvent = kFALSE; // only one mcm is concerned with new event
499 Int_t padrow = mcm[entry]->GetRow();
501 // Copy ADC data to MCM simulator
502 for (Int_t iAdc = 0; iAdc < 21; iAdc++ ) {
503 Int_t padcol = mcm[entry]->GetCol( iAdc );
504 if ((padcol >= 0) && (padcol < nCol)) {
505 for (Int_t iT = 0; iT < kNTBin; iT++) {
506 mcm[entry]->SetData( iAdc, iT, digits->GetDataUnchecked( padrow, padcol, iT) );
509 else { // this means it is out of chamber, and masked ADC
510 mcm[entry]->SetDataPedestal( iAdc );
514 // Simulate process in MCM
515 mcm[entry]->Filter(); // Apply filter
516 mcm[entry]->ZSMapping(); // Calculate zero suppression mapping
519 mcm[entry]->Tracklet();
520 Int_t tempNw = mcm[entry]->ProduceTrackletStream( &buf[nw], maxSize - nw );
525 AliError(Form("Buffer overflow detected. Please increase the buffer size and recompile."));
530 // no tracklets: write raw-data already in this loop
532 // Write MCM data to buffer
533 Int_t tempNw = mcm[entry]->ProduceRawStream( &buf[nw], maxSize - nw );
537 AliError(Form("Buffer overflow detected. Please increase the buffer size and recompile."));
548 //mcm->DumpData( "trdmcmdata.txt", "RFZS" ); // debugging purpose
552 // if tracklets are switched on, raw-data can be written only after all tracklets
554 WriteIntermediateWords(buf,nw,of,maxSize,det,side);
557 // Scan for ROB and MCM
558 for (Int_t iRobRow = (kCtype + 3)-1; iRobRow >= 0; iRobRow-- ) {
559 //Int_t iRob = iRobRow * 2 + side;
561 for (Int_t iMcmRB = 0; iMcmRB < fGeo->MCMmax(); iMcmRB++ ) {
562 Int_t iMcm = 16 - 4*(iMcmRB/4 + 1) + (iMcmRB%4);
564 Int_t entry = iRobRow*(fGeo->MCMmax()) + iMcm;
566 // Write MCM data to buffer
567 Int_t tempNw = mcm[entry]->ProduceRawStream( &buf[nw], maxSize - nw );
571 AliError(Form("Buffer overflow detected. Please increase the buffer size and recompile."));
584 // Write end of raw data marker
586 buf[nw++] = kEndofrawdatamarker;
592 AliError("Buffer overflow. Data is truncated. Please increase buffer size and recompile.");
600 //_____________________________________________________________________________
601 AliTRDdigitsManager *AliTRDrawData::Raw2Digits(AliRawReader *rawReader)
604 // Vx of the raw data reading
607 AliTRDdataArrayS *digits = 0;
608 AliTRDdataArrayI *track0 = 0;
609 AliTRDdataArrayI *track1 = 0;
610 AliTRDdataArrayI *track2 = 0;
612 //AliTRDSignalIndex *indexes = 0;
613 // Create the digits manager
614 AliTRDdigitsManager* digitsManager = new AliTRDdigitsManager();
615 digitsManager->CreateArrays();
617 //AliTRDRawStream input(rawReader);
618 // AliTRDRawStreamV2 input(rawReader);
619 // input.SetRawVersion( fFee->GetRAWversion() );
622 AliTRDrawStreamBase *pinput = AliTRDrawStreamBase::GetRawStream(rawReader);
623 AliTRDrawStreamBase &input = *pinput;
625 AliInfo(Form("Stream version: %s", input.IsA()->GetName()));
627 // Loop through the digits
632 det = input.NextChamber(digitsManager);
636 digits = (AliTRDdataArrayS *) digitsManager->GetDigits(det);
637 track0 = (AliTRDdataArrayI *) digitsManager->GetDictionary(det,0);
638 track1 = (AliTRDdataArrayI *) digitsManager->GetDictionary(det,1);
639 track2 = (AliTRDdataArrayI *) digitsManager->GetDictionary(det,2);
641 if (digits) digits->Compress(1,0);
642 if (track0) track0->Compress(1,0);
643 if (track1) track1->Compress(1,0);
644 if (track2) track2->Compress(1,0);
651 return digitsManager;
655 //_____________________________________________________________________________
656 void AliTRDrawData::WriteIntermediateWords(UInt_t* buf, Int_t& nw, Int_t& of, const Int_t& maxSize, const Int_t& det, const Int_t& side) {
658 Int_t plan = fGeo->GetPlane( det ); // Plane
659 Int_t cham = fGeo->GetChamber( det ); // Chamber
660 Int_t sect = fGeo->GetSector( det ); // Sector (=iDDL)
661 Int_t rv = fFee->GetRAWversion();
662 const Int_t kNTBin = AliTRDcalibDB::Instance()->GetNumberOfTimeBins();
665 // Write end of tracklet marker
667 buf[nw++] = kEndoftrackletmarker;
673 // Half Chamber header
674 // h[0] (there are 3 HC header)
675 Int_t minorv = 0; // The minor version number
676 Int_t add = 2; // The number of additional header words to follow
677 x = (1<<31) | (rv<<24) | (minorv<<17) | (add<<14) | (sect<<9) | (plan<<6) | (cham<<3) | (side<<2) | 1;
685 Int_t bcCtr = 99; // bunch crossing counter. Here it is set to 99 always for no reason
686 Int_t ptCtr = 15; // pretrigger counter. Here it is set to 15 always for no reason
687 Int_t ptPhase = 11; // pretrigger phase. Here it is set to 11 always for no reason
688 x = (bcCtr<<16) | (ptCtr<<12) | (ptPhase<<8) | ((kNTBin-1)<<2) | 1;
696 Int_t pedSetup = 1; // Pedestal filter setup (0:1). Here it is always 1 for no reason
697 Int_t gainSetup = 1; // Gain filter setup (0:1). Here it is always 1 for no reason
698 Int_t tailSetup = 1; // Tail filter setup (0:1). Here it is always 1 for no reason
699 Int_t xtSetup = 0; // Cross talk filter setup (0:1). Here it is always 0 for no reason
700 Int_t nonlinSetup = 0; // Nonlinearity filter setup (0:1). Here it is always 0 for no reason
701 Int_t bypassSetup = 0; // Filter bypass (for raw data) setup (0:1). Here it is always 0 for no reason
702 Int_t commonAdditive = 10; // Digital filter common additive (0:63). Here it is always 10 for no reason
703 x = (pedSetup<<31) | (gainSetup<<30) | (tailSetup<<29) | (xtSetup<<28) | (nonlinSetup<<27)
704 | (bypassSetup<<26) | (commonAdditive<<20) | 1;
714 //_____________________________________________________________________________
715 AliTRDdigitsManager *AliTRDrawData::Raw2DigitsOLD(AliRawReader *rawReader)
718 // Vx of the raw data reading
721 AliTRDdataArrayS *digits = 0;
722 AliTRDdataArrayI *track0 = 0;
723 AliTRDdataArrayI *track1 = 0;
724 AliTRDdataArrayI *track2 = 0;
726 AliTRDSignalIndex *indexes = 0;
727 // Create the digits manager
728 AliTRDdigitsManager* digitsManager = new AliTRDdigitsManager();
729 digitsManager->CreateArrays();
731 //AliTRDRawStream input(rawReader);
732 AliTRDRawStreamV2 input(rawReader);
733 input.SetRawVersion( fFee->GetRAWversion() );
736 AliInfo(Form("Stream version: %s", input.IsA()->GetName()));
738 // Loop through the digits
742 while (input.Next()) {
744 det = input.GetDet();
746 if (det != lastdet) { // If new detector found
750 if (digits) digits->Compress(1,0);
751 if (track0) track0->Compress(1,0);
752 if (track1) track1->Compress(1,0);
753 if (track2) track2->Compress(1,0);
755 // Add a container for the digits of this detector
756 digits = (AliTRDdataArrayS *) digitsManager->GetDigits(det);
757 track0 = (AliTRDdataArrayI *) digitsManager->GetDictionary(det,0);
758 track1 = (AliTRDdataArrayI *) digitsManager->GetDictionary(det,1);
759 track2 = (AliTRDdataArrayI *) digitsManager->GetDictionary(det,2);
761 // Allocate memory space for the digits buffer
762 if (digits->GetNtime() == 0)
764 digits->Allocate(input.GetMaxRow(),input.GetMaxCol(), input.GetNumberOfTimeBins());
765 track0->Allocate(input.GetMaxRow(),input.GetMaxCol(), input.GetNumberOfTimeBins());
766 track1->Allocate(input.GetMaxRow(),input.GetMaxCol(), input.GetNumberOfTimeBins());
767 track2->Allocate(input.GetMaxRow(),input.GetMaxCol(), input.GetNumberOfTimeBins());
770 indexes = digitsManager->GetIndexes(det);
771 indexes->SetSM(input.GetSM());
772 indexes->SetStack(input.GetStack());
773 indexes->SetLayer(input.GetLayer());
774 indexes->SetDetNumber(det);
775 if (indexes->IsAllocated() == kFALSE)
776 indexes->Allocate(input.GetMaxRow(), input.GetMaxCol(), input.GetNumberOfTimeBins());
779 // 3 timebin data are stored per word
780 for (it = 0; it < 3; it++)
782 if ( input.GetTimeBin() + it < input.GetNumberOfTimeBins() )
784 if (input.GetSignals()[it] > 0)
786 digits->SetDataUnchecked(input.GetRow(), input.GetCol(),
787 input.GetTimeBin() + it, input.GetSignals()[it]);
789 indexes->AddIndexTBin(input.GetRow(), input.GetCol(),
790 input.GetTimeBin() + it);
791 track0->SetDataUnchecked(input.GetRow(), input.GetCol(),
792 input.GetTimeBin() + it, 0);
793 track1->SetDataUnchecked(input.GetRow(), input.GetCol(),
794 input.GetTimeBin() + it, 0);
795 track2->SetDataUnchecked(input.GetRow(), input.GetCol(),
796 input.GetTimeBin() + it, 0);
802 if (digits) digits->Compress(1,0);
803 if (track0) track0->Compress(1,0);
804 if (track1) track1->Compress(1,0);
805 if (track2) track2->Compress(1,0);
807 return digitsManager;