]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TOF/AliTOFDecoder.cxx
tpc_clusters.C - return null pointer if tree can be obtained from run-loader.
[u/mrichter/AliRoot.git] / TOF / AliTOFDecoder.cxx
index 47fd50ff0c23c172e97c6685ee78f76fb7d5f544..6fa854d281ecf28683fb5aa7049ae9577e6e8b03 100644 (file)
 
 /*
 $Log$
+Revision 1.5  2007/11/24 14:58:34  zampolli
+New Method implemented (#DDL <-> TOF channels)
+
+Revision 1.4  2007/05/18 13:08:57  decaro
+Coding convention: RS1 violation -> suppression
+
+Revision 1.3  2007/05/08 11:56:05  arcelli
+improved verbosity in verbose mode (R.Preghenella)
+
+Revision 1.2  2007/05/03 11:34:43  decaro
+Coding convention: RS1 violation -> suppression
+
+Revision 1.1  2007/04/27 11:00:32  arcelli
+TOF Raw Data decoder
+
   author: Roberto Preghenella (R+), preghenella@bo.infn.it
 */
 
 
-/*********************************************************************
- *                                                                   *
- *                                                                   *
- *   Class for raw data decoding                                     *
- *                                                                   *
- *                                                                   *
- ********************************************************************/
+//////////////////////////////////////////////////////////////////////
+//                                                                  //
+//                                                                  //
+//   Class for raw data decoding                                    //
+//                                                                  //
+//                                                                  //
+//////////////////////////////////////////////////////////////////////
                                
 
 
 #include "AliLog.h"
 #include "AliTOFHitData.h"
+#include "AliTOFHitDataBuffer.h"
 #include "AliTOFDecoder.h"
+#include "AliTOFGeometry.h"
 
 ClassImp(AliTOFDecoder)
 
@@ -274,8 +291,7 @@ AliTOFDecoder::Decode(UInt_t *rawData, Int_t nWords)
        break;
        
       default:
-       if (fVerbose)
-         AliError(Form("  %02x - 0x%08x [ERROR] Not valid slotID in global header",decodeStatus,*rawData));
+       AliError(Form("  %02x - 0x%08x [ERROR] Not valid slotID in global header",decodeStatus,*rawData));
        return kTRUE;
        break;
        
@@ -333,8 +349,7 @@ AliTOFDecoder::Decode(UInt_t *rawData, Int_t nWords)
        break; 
        
       default:
-       if (fVerbose)
-         AliError(Form("  %02x - 0x%08x [ERROR] Not valid slotID/pattern in global trailer",decodeStatus,*rawData));
+       AliError(Form("  %02x - 0x%08x [ERROR] Not valid slotID/pattern in global trailer",decodeStatus,*rawData));
        return kTRUE;
        break;
       }
@@ -771,3 +786,115 @@ AliTOFDecoder::Spider(AliTOFHitData hitData){
 
   return kFALSE;
 }
+//_____________________________________________________________________________
+void AliTOFDecoder::GetArrayDDL(Int_t* array, Int_t ddl){
+
+  // method that fills array with the
+  // TOF channels indexes corresponding
+  // to DDL iDDL
+
+  AliTOFGeometry *geom = new AliTOFGeometry();
+  Int_t indexDDL = ddl%4;
+  Int_t iSector = Int_t(ddl/4);
+  //AliInfo(Form(" Sector = %i, DDL within sector = %i",iSector, indexDDL));
+  if (fVerbose){
+    AliInfo(Form(" Sector = %i, DDL within sector = %i",iSector, indexDDL));
+  }
+  Int_t volume[5];
+  volume[0]=iSector;
+  Int_t minPlate=0, maxPlate=0, minStrip2=0, maxStrip2=0, minPadz=0, maxPadz=0, minPadx=0, maxPadx=0;
+
+  if (indexDDL==0){
+    minPlate=kMinPlate0;
+    maxPlate=kMaxPlate0;
+    minStrip2=kMinStrip0;
+    maxStrip2=kMaxStrip0;
+    minPadz=kMinPadz0;
+    maxPadz=kMaxPadz0;
+    minPadx=kMinPadx0;
+    maxPadx=kMaxPadx0;
+  }
+
+  else if (indexDDL==1){
+    minPlate=kMinPlate1;
+    maxPlate=kMaxPlate1;
+    minStrip2=kMinStrip1;
+    maxStrip2=kMaxStrip1;
+    minPadz=kMinPadz1;
+    maxPadz=kMaxPadz1;
+    minPadx=kMinPadx1;
+    maxPadx=kMaxPadx1;
+  }
+
+  else if (indexDDL==2){
+    minPlate=kMinPlate2;
+    maxPlate=kMaxPlate2;
+    minStrip2=kMinStrip2;
+    maxStrip2=kMaxStrip2;
+    minPadz=kMinPadz2;
+    maxPadz=kMaxPadz2;
+    minPadx=kMinPadx2;
+    maxPadx=kMaxPadx2;
+  }
+
+  else if (indexDDL==3){
+    minPlate=kMinPlate3;
+    maxPlate=kMaxPlate3;
+    minStrip2=kMinStrip3;
+    maxStrip2=kMaxStrip3;
+    minPadz=kMinPadz3;
+    maxPadz=kMaxPadz3;
+    minPadx=kMinPadx3;
+    maxPadx=kMaxPadx3;
+  }
+
+  Int_t ichTOF=0;
+
+  Int_t minStrip=0;
+  Int_t maxStrip=18;  
+  for (Int_t iPlate=minPlate;iPlate<=maxPlate;iPlate++){
+    if (iPlate==2) {
+      maxStrip = maxStrip2;
+      minStrip = minStrip2;
+    }
+    else {
+      maxStrip = 18;
+      minStrip = 0;
+    }
+    for (Int_t iStrip=minStrip;iStrip<=maxStrip;iStrip++){
+      for (Int_t iPadz=minPadz;iPadz<=maxPadz;iPadz++){
+       for (Int_t iPadx=minPadx;iPadx<=maxPadx;iPadx++){
+         volume[1]=iPlate;
+         volume[2]=iStrip;
+         volume[3]=iPadz;
+         volume[4]=iPadx;
+         if (fVerbose){
+           AliInfo(Form(" volume[0] = %i, volume[1] = %i, volume[2] = %i, volume[3] = %i, volume[4] = %i",volume[0],volume[1],volume[2],volume[3],volume[4]));
+         }
+         if (indexDDL==0 || indexDDL==2){
+           array[ichTOF]=geom->GetIndex(volume);
+           if (fVerbose){
+             AliInfo(Form(" ichTOF = %i, TOFChannel = %i",ichTOF,array[ichTOF]));
+           }
+         }
+         else {
+           array[ichTOF]=geom->GetIndex(volume);
+           if (fVerbose){
+             AliInfo(Form(" ichTOF = %i, TOFChannel = %i",ichTOF,array[ichTOF]));
+           }
+         }
+         ichTOF++;
+       }
+      }
+    }
+  }
+  //AliInfo(Form("ichTOF = %i",ichTOF));
+  if (((indexDDL==0 || indexDDL==2)&ichTOF!=2160) || ((indexDDL==1 || indexDDL==3)&ichTOF!=2208)){
+    AliWarning(Form("Something strange occurred, number of entries in array different from expected! Please, check! ichTOF = %i",ichTOF));
+  }
+  return;
+}
+
+
+
+