From 5fc47291ce288bd365bdee7151ed8f1a394c92a7 Mon Sep 17 00:00:00 2001 From: cblume Date: Mon, 21 Jan 2008 16:36:43 +0000 Subject: [PATCH] Add a protection against empty chambers --- TRD/AliTRDrawData.cxx | 39 ++++++++++++++++++++++++++------------- 1 file changed, 26 insertions(+), 13 deletions(-) diff --git a/TRD/AliTRDrawData.cxx b/TRD/AliTRDrawData.cxx index 80f0ee0b8ad..ebed36f421b 100644 --- a/TRD/AliTRDrawData.cxx +++ b/TRD/AliTRDrawData.cxx @@ -191,24 +191,37 @@ Bool_t AliTRDrawData::Digits2Raw(AliTRDdigitsManager *digitsManager) // Get the digits array AliTRDdataArrayS *digits = (AliTRDdataArrayS *) digitsManager->GetDigits(iDet); - digits->Expand(); + if (digits->HasData()) { - Int_t hcwords = 0; - Int_t rv = fFee->GetRAWversion(); + digits->Expand(); - // Process A side of the chamber - if ( rv >= 1 && rv <= 2 ) hcwords = ProduceHcDataV1andV2(digits,0,iDet,hcBuffer,kMaxHcWords); - if ( rv == 3 ) hcwords = ProduceHcDataV3 (digits,0,iDet,hcBuffer,kMaxHcWords); + Int_t hcwords = 0; + Int_t rv = fFee->GetRAWversion(); - of->WriteBuffer((char *) hcBuffer, hcwords*4); - npayloadbyte += hcwords*4; + // Process A side of the chamber + if ( rv >= 1 && rv <= 2 ) { + hcwords = ProduceHcDataV1andV2(digits,0,iDet,hcBuffer,kMaxHcWords); + } + if ( rv == 3 ) { + hcwords = ProduceHcDataV3 (digits,0,iDet,hcBuffer,kMaxHcWords); + } + + of->WriteBuffer((char *) hcBuffer, hcwords*4); + npayloadbyte += hcwords*4; + + // Process B side of the chamber + if ( rv >= 1 && rv <= 2 ) { + hcwords = ProduceHcDataV1andV2(digits,1,iDet,hcBuffer,kMaxHcWords); + } + if ( rv >= 3 ) { + hcwords = ProduceHcDataV3 (digits,1,iDet,hcBuffer,kMaxHcWords); + } - // Process B side of the chamber - if ( rv >= 1 && rv <= 2 ) hcwords = ProduceHcDataV1andV2(digits,1,iDet,hcBuffer,kMaxHcWords); - if ( rv >= 3 ) hcwords = ProduceHcDataV3 (digits,1,iDet,hcBuffer,kMaxHcWords); + of->WriteBuffer((char *) hcBuffer, hcwords*4); + npayloadbyte += hcwords*4; + + } - of->WriteBuffer((char *) hcBuffer, hcwords*4); - npayloadbyte += hcwords*4; } } -- 2.43.0