]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - EVE/EveDet/AliEveTOFDigitsInfo.cxx
Update of DAs to use Monitoring Bit,
[u/mrichter/AliRoot.git] / EVE / EveDet / AliEveTOFDigitsInfo.cxx
index 8a91689a41725de413901f63cd326f1ec54b0a68..32a4b1bcac94dee52f68035587c9e6b692fd7f6f 100644 (file)
@@ -1,28 +1,35 @@
-// $Id$
-// Main authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007
-
 /**************************************************************************
  * Copyright(c) 1998-2008, ALICE Experiment at CERN, all rights reserved. *
  * See http://aliceinfo.cern.ch/Offline/AliRoot/License.html for          *
  * full copyright notice.                                                 *
  **************************************************************************/
+
+// $Id$
+// Main authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007
+
 //
-// AliEveTOFDigitsInfo
+// Class to map TOF digit/raw data information
+//
+// Author: A. De Caro (email: decaro@sa.infn.it)
 //
 
-#include "fcntl.h"
-
-#include <TEveTreeTools.h>
+#include <TClonesArray.h>
+#include <TTree.h>
 
-#include "AliEveTOFDigitsInfo.h"
+//#include <TEveTreeTools.h>
 
 #include <AliDAQ.h>
+#include <AliLog.h>
+#include <AliRawReader.h>
 
 #include <AliTOFCableLengthMap.h>
 #include <AliTOFdigit.h>
 #include <AliTOFGeometry.h>
 #include <AliTOFrawData.h>
 #include <AliTOFRawStream.h>
+#include <AliTOFDigitMap.h>
+
+#include "AliEveTOFDigitsInfo.h"
 
 //_________________________________________________________
 
@@ -40,6 +47,7 @@ ClassImp(AliEveTOFDigitsInfo)
 
 AliEveTOFDigitsInfo:: ~AliEveTOFDigitsInfo() 
 {
+  //dtr
 
   delete fGeom;
   delete fTree;
@@ -49,8 +57,12 @@ AliEveTOFDigitsInfo:: ~AliEveTOFDigitsInfo()
 }
 /* ******************************************************* */
 
-void AliEveTOFDigitsInfo::SetTree(TTree* tree)
+void AliEveTOFDigitsInfo::SetTree(TTree * const tree)
 {
+  //
+  // Set fTree global variable
+  //
+
   static const TEveException kEH("AliEveTOFDigitsInfo::SetTree ");
   
   if(fGeom == 0) {
@@ -64,12 +76,14 @@ void AliEveTOFDigitsInfo::SetTree(TTree* tree)
   */
 }
 /* ******************************************************* */
-void AliEveTOFDigitsInfo::ReadRaw(AliRawReader* rawReader, Int_t nEvent, Bool_t newDecoder)
+void AliEveTOFDigitsInfo::ReadRaw(AliRawReader* rawReader, Int_t newDecoder)
 {
+  //
   // Read raw-data. AliTOFdigit is used to
   // store raw-adata for all sub-detectors.
+  //
 
-  AliTOFCableLengthMap *cableLength = new AliTOFCableLengthMap();
+  //AliTOFCableLengthMap *cableLength = new AliTOFCableLengthMap();
 
   //ofstream ftxt;
   //Char_t fileName[100];
@@ -79,7 +93,7 @@ void AliEveTOFDigitsInfo::ReadRaw(AliRawReader* rawReader, Int_t nEvent, Bool_t
   //ftxt << endl;
   //ftxt << "  " << nEvent << endl;
 
-  if (nEvent<0) printf("%3i\n", nEvent); // only to use nEvent variable
+  //if (nEvent<0) printf("%3i\n", nEvent); // only to use nEvent variable
 
   const Int_t kDDL = AliDAQ::NumberOfDdls("TOF");
 
@@ -98,21 +112,22 @@ void AliEveTOFDigitsInfo::ReadRaw(AliRawReader* rawReader, Int_t nEvent, Bool_t
   for (Int_t indexDDL = 0; indexDDL < kDDL; indexDDL++) {
 
     rawReader->Reset();
-    if (!newDecoder) stream.LoadRawData(indexDDL);
-    else stream.LoadRawDataBuffers(indexDDL);
+    if (newDecoder==0) stream.LoadRawData(indexDDL);
+    else if (newDecoder==1) stream.LoadRawDataBuffers(indexDDL);
+    else if (newDecoder==2) stream.LoadRawDataBuffersV2(indexDDL);
 
     clonesRawData = (TClonesArray*)stream.GetRawData();
 
-    if (clonesRawData->GetEntriesFast()) AliDebug(2, Form(" Number of TOF digits in the sector number %2i: 5i", indexDDL, clonesRawData->GetEntriesFast()));
+    if (clonesRawData->GetEntriesFast()) AliDebug(2, Form(" Number of TOF digits in the sector number %2i: %5i", indexDDL, clonesRawData->GetEntriesFast()));
 
     for (Int_t iRawData = 0; iRawData<clonesRawData->GetEntriesFast(); iRawData++) {
 
       AliTOFrawData *tofRawDatum = (AliTOFrawData*)clonesRawData->UncheckedAt(iRawData);
 
-      if (tofRawDatum->GetTOT()==-1 || tofRawDatum->GetTOF()==-1) continue;
+      if (tofRawDatum->GetTOF()==-1) continue;
 
-      Int_t cLenInt = Int_t(cableLength->GetCableTimeShift(indexDDL, tofRawDatum->GetTRM(), tofRawDatum->GetTRMchain(),tofRawDatum->GetTDC())*1000./AliTOFGeometry::TdcBinWidth());
-      digit[0] = tofRawDatum->GetTOF() - cLenInt;
+      //Int_t cLenInt = Int_t(cableLength->GetCableTimeShift(indexDDL, tofRawDatum->GetTRM(), tofRawDatum->GetTRMchain(),tofRawDatum->GetTDC())*1000./AliTOFGeometry::TdcBinWidth());
+      digit[0] = tofRawDatum->GetTOF();// - cLenInt;
       digit[1] = tofRawDatum->GetTOT();
       digit[2] = tofRawDatum->GetTOT();
       digit[3] = -1;
@@ -127,20 +142,19 @@ void AliEveTOFDigitsInfo::ReadRaw(AliRawReader* rawReader, Int_t nEvent, Bool_t
       else                          ftxt << " " << tofRawDatum->GetTDC();
       ftxt << "  " << tofRawDatum->GetTDCchannel();
       */
+
       stream.EquipmentId2VolumeId(indexDDL, tofRawDatum->GetTRM(), tofRawDatum->GetTRMchain(),
                                  tofRawDatum->GetTDC(), tofRawDatum->GetTDCchannel(), detectorIndex);
 
-      if (detectorIndex[0]==0 || detectorIndex[0]==10)
-       AliDebug(2, Form(" %2i %2i %1i %2i %1i --- %2i %1i %2i %1i %2i     %5i -  %4i =  %5i (%f ns)\n",
-                        indexDDL,
-                        tofRawDatum->GetTRM(), tofRawDatum->GetTRMchain(),
-                        tofRawDatum->GetTDC(), tofRawDatum->GetTDCchannel(),
-                        detectorIndex[0], detectorIndex[1],
-                        detectorIndex[2], detectorIndex[3],
-                        detectorIndex[4], tofRawDatum->GetTOF(),
-                        cLenInt, tofRawDatum->GetTOF()-cLenInt,
-                        (tofRawDatum->GetTOF()-cLenInt)*
-                        AliTOFGeometry::TdcBinWidth()/1000.));
+      /* check valid index */
+      if (detectorIndex[0]==-1||detectorIndex[1]==-1||detectorIndex[2]==-1||detectorIndex[3]==-1||detectorIndex[4]==-1) continue;
+
+      // Do not reconstruct anything in the holes
+      if (detectorIndex[0]==13 || detectorIndex[0]==14 || detectorIndex[0]==15 ) { // sectors with holes
+       if (detectorIndex[1]==2) { // plate with holes
+         continue;
+       }
+      }
 
       /*
       if (detectorIndex[0]<10) ftxt  << "  ->  " << detectorIndex[0];
@@ -191,8 +205,7 @@ void AliEveTOFDigitsInfo::ReadRaw(AliRawReader* rawReader, Int_t nEvent, Bool_t
 
   //ftxt.close();
 
-  cableLength = 0x0;
-  delete cableLength;
+  //delete cableLength;
 
 }
 
@@ -200,6 +213,9 @@ void AliEveTOFDigitsInfo::ReadRaw(AliRawReader* rawReader, Int_t nEvent, Bool_t
 /* ******************************************************* */
 void AliEveTOFDigitsInfo::LoadDigits()
 {
+  //
+  // Load TOF digits
+  //
 
   TClonesArray *digitsTOF = 0x0;
   AliTOFdigit *digs;
@@ -236,6 +252,10 @@ void AliEveTOFDigitsInfo::GetDigits(Int_t nSector, Int_t nPlate,
                                    Int_t nStrip, Int_t nPadZ, Int_t nPadX,
                                    Int_t indexDigit[3])
 {
+  //
+  // Get TOF digit indices in the TOF volume
+  // (nSector, nPlate,nStrip,nPadZ,nPadX)
+  //
 
   Int_t vol[5] = {nSector,nPlate,nStrip,nPadX,nPadZ};
 
@@ -248,6 +268,10 @@ void AliEveTOFDigitsInfo::GetDigits(Int_t nSector, Int_t nPlate,
 TClonesArray* AliEveTOFDigitsInfo::GetDigits(Int_t nSector, Int_t nPlate,
                                             Int_t nStrip)
 {
+  //
+  // Get TOF digits in the TOF volume
+  // (nSector, nPlate,nStrip)
+  //
 
   Int_t newCounter = 0;
   Int_t nDigitsInVolume[3] = {-1, -1, -1};
@@ -281,6 +305,7 @@ TClonesArray* AliEveTOFDigitsInfo::GetDigits(Int_t nSector, Int_t nPlate,
          informations[1] = digs->GetAdc();
          informations[2] = digs->GetToT();
          informations[3] = digs->GetTdcND();
+         for(Int_t kk=0; kk<3; kk++) dummy[kk] = digs->GetTrack(kk);
          new (ldigits[newCounter++]) AliTOFdigit(dummy, vol, informations);
        }
 
@@ -304,11 +329,16 @@ TClonesArray* AliEveTOFDigitsInfo::GetDigits(Int_t nSector, Int_t nPlate,
 
 TClonesArray* AliEveTOFDigitsInfo::GetDigits(Int_t nSector)
 {
+  //
+  // Get TOF digits in the TOF SM nSector
+  //
+
+  const Int_t kND = AliTOFDigitMap::kMaxDigitsPerPad;
 
   Int_t newCounter = 0;
-  Int_t nDigitsInVolume[3] = {-1, -1, -1};
-  Int_t dummy[3] = {-1, -1, -1};
-  Int_t informations[4] = {-1, -1, -1, -1};
+  Int_t nDigitsInVolume[kND];
+  Int_t dummy[3];
+  Int_t informations[4];
 
   Int_t nStrips=19;
 
@@ -336,11 +366,16 @@ TClonesArray* AliEveTOFDigitsInfo::GetDigits(Int_t nSector)
        vol[4] = iPadZ;
 
        for(Int_t iPadX=0; iPadX<fGeom->NpadX(); iPadX++) {
+
+         for (Int_t ii=0; ii<4; ii++) informations[ii]=-1;
+         for (Int_t ii=0; ii<3; ii++) dummy[ii]=-1;
+         for (Int_t ii=0; ii<kND; ii++) nDigitsInVolume[ii]=-1;
+
          vol[3] = iPadX;
 
          fTOFdigitMap->GetDigitIndex(vol, nDigitsInVolume);
 
-         for (Int_t ii=0; ii<3; ii++) {
+         for (Int_t ii=0; ii<kND; ii++) {
            //if (ii!=0) continue;
            if (nDigitsInVolume[ii]>=0 ) {
 
@@ -349,6 +384,7 @@ TClonesArray* AliEveTOFDigitsInfo::GetDigits(Int_t nSector)
              informations[1] = digs->GetAdc();
              informations[2] = digs->GetToT();
              informations[3] = digs->GetTdcND();
+             for(Int_t kk=0; kk<3; kk++) dummy[kk] = digs->GetTrack(kk);
              new (ldigits[newCounter++]) AliTOFdigit(dummy, vol, informations);
 
              AliDebug(2,Form(" %2i -> %2i %2i %2i %2i %2i %7i %7i\n",
@@ -360,10 +396,6 @@ TClonesArray* AliEveTOFDigitsInfo::GetDigits(Int_t nSector)
 
          }
 
-         for (Int_t ii=0; ii<4; ii++) informations[ii]=-1;
-         for (Int_t ii=0; ii<3; ii++) dummy[ii]=-1;
-         for (Int_t ii=0; ii<3; ii++) nDigitsInVolume[ii]=-1;
-
        }
       }
     }
@@ -380,6 +412,9 @@ TClonesArray* AliEveTOFDigitsInfo::GetDigits(Int_t nSector)
 
 Int_t AliEveTOFDigitsInfo::GetTOFInfos() const
 {
+  //
+  // Return number of TOF digits
+  //
 
   return fTOFdigitMap->GetFilledCellNumber();
 
@@ -388,6 +423,10 @@ Int_t AliEveTOFDigitsInfo::GetTOFInfos() const
 /* ******************************************************* */
 Int_t AliEveTOFDigitsInfo::IsStripFilled(Int_t iSector, Int_t iPlate, Int_t iStrip)
 {
+  //
+  // Return number of TOF digits
+  // in volume (iSector,iPlate,iStrip)
+  //
 
   Int_t vol[5] = {iSector, iPlate, iStrip, -1, -1};