+ // h[1]
+ Int_t bcCtr = 99; // bunch crossing counter. Here it is set to 99 always for no reason
+ Int_t ptCtr = 15; // pretrigger counter. Here it is set to 15 always for no reason
+ Int_t ptPhase = 11; // pretrigger phase. Here it is set to 11 always for no reason
+ x = (bcCtr<<16) | (ptCtr<<12) | (ptPhase<<8) | ((kNTBin-1)<<2) | 1;
+ if (nw < maxSize) {
+ buf[nw++] = x;
+ }
+ else {
+ of++;
+ }
+ // h[2]
+ Int_t pedSetup = 1; // Pedestal filter setup (0:1). Here it is always 1 for no reason
+ Int_t gainSetup = 1; // Gain filter setup (0:1). Here it is always 1 for no reason
+ Int_t tailSetup = 1; // Tail filter setup (0:1). Here it is always 1 for no reason
+ Int_t xtSetup = 0; // Cross talk filter setup (0:1). Here it is always 0 for no reason
+ Int_t nonlinSetup = 0; // Nonlinearity filter setup (0:1). Here it is always 0 for no reason
+ Int_t bypassSetup = 0; // Filter bypass (for raw data) setup (0:1). Here it is always 0 for no reason
+ Int_t commonAdditive = 10; // Digital filter common additive (0:63). Here it is always 10 for no reason
+ x = (pedSetup<<31) | (gainSetup<<30) | (tailSetup<<29) | (xtSetup<<28) | (nonlinSetup<<27)
+ | (bypassSetup<<26) | (commonAdditive<<20) | 1;
+ if (nw < maxSize) {
+ buf[nw++] = x;
+ }
+ else {
+ of++;
+ }
+
+ // Scan for ROB and MCM
+ for (Int_t iRobRow = 0; iRobRow < (kCtype + 3); iRobRow++ ) {
+ Int_t iRob = iRobRow * 2 + side;
+ for (Int_t iMcm = 0; iMcm < fGeo->MCMmax(); iMcm++ ) {
+
+ AliTRDmcmSim *mcm = new AliTRDmcmSim();
+ mcm->Init( det, iRob, iMcm );
+ Int_t padrow = mcm->GetRow();
+
+ // Copy ADC data to MCM simulator
+ for (Int_t iAdc = 0; iAdc < 21; iAdc++ ) {
+ Int_t padcol = mcm->GetCol( iAdc );
+ if ((padcol >= 0) && (padcol < nCol)) {
+ for (Int_t iT = 0; iT < kNTBin; iT++) {
+ mcm->SetData( iAdc, iT, digits->GetDataUnchecked( padrow, padcol, iT) );
+ }
+ } else { // this means it is out of chamber, and masked ADC
+ mcm->SetDataPedestal( iAdc );
+ }
+ }
+ // Simulate process in MCM
+ mcm->Filter(); // Apply filter
+ mcm->ZSMapping(); // Calculate zero suppression mapping
+ //mcm->DumpData( "trdmcmdata.txt", "RFZS" ); // debugging purpose
+
+ // Write MCM data to buffer
+ Int_t tempNw = mcm->ProduceRawStream( &buf[nw], maxSize - nw );
+ if( tempNw < 0 ) {
+ of += tempNw;
+ nw += maxSize - nw;
+ AliError(Form("Buffer overflow detected. Please increase the buffer size and recompile."));
+ } else {
+ nw += tempNw;
+ }