]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - FMD/AliFMDInput.cxx
Added to new container structures AliHLTPHOSRcuCellEnergyData.h and AliHLTPHOSModuleC...
[u/mrichter/AliRoot.git] / FMD / AliFMDInput.cxx
index a6592640e24ac8526a7f30dcf1f4bf51d8742eae..8d10fa2cd51edcdf5b9c210107da19efd204dfd4 100644 (file)
  * about the suitability of this software for any purpose. It is          *
  * provided "as is" without express or implied warranty.                  *
  **************************************************************************/
-
 /* $Id$ */
-
+/** @file    AliFMDInput.cxx
+    @author  Christian Holm Christensen <cholm@nbi.dk>
+    @date    Mon Mar 27 12:42:40 2006
+    @brief   FMD utility classes for reading FMD data
+*/
 //___________________________________________________________________
 //
 // The classes defined here, are utility classes for reading in data
@@ -35,6 +38,7 @@
 #include "AliFMD.h"             // ALIFMD_H
 #include "AliFMDHit.h"         // ALIFMDHIT_H
 #include "AliFMDDigit.h"       // ALIFMDDigit_H
+#include "AliFMDSDigit.h"      // ALIFMDDigit_H
 #include "AliFMDRecPoint.h"    // ALIFMDRECPOINT_H
 #include "AliFMDRawReader.h"    // ALIFMDRAWREADER_H
 #include <AliESD.h>
@@ -51,7 +55,7 @@
 #include <TGeoManager.h>        // ROOT_TGeoManager 
 #include <TSystemDirectory.h>   // ROOT_TSystemDirectory
 #include <Riostream.h>         // ROOT_Riostream
-
+#include <TFile.h>              // ROOT_TFile
 //____________________________________________________________________
 ClassImp(AliFMDInput)
 #if 0
@@ -75,6 +79,7 @@ AliFMDInput::AliFMDInput()
     fTreeD(0),
     fTreeS(0),
     fTreeR(0), 
+    fTreeA(0), 
     fChainE(0),
     fArrayE(0),
     fArrayH(0),
@@ -82,6 +87,7 @@ AliFMDInput::AliFMDInput()
     fArrayS(0), 
     fArrayR(0), 
     fArrayA(0), 
+    fGeoManager(0),
     fTreeMask(0), 
     fIsInit(kFALSE)
 {
@@ -109,6 +115,7 @@ AliFMDInput::AliFMDInput(const char* gAliceFile)
     fTreeD(0),
     fTreeS(0),
     fTreeR(0), 
+    fTreeA(0), 
     fChainE(0),
     fArrayE(0),
     fArrayH(0),
@@ -116,6 +123,7 @@ AliFMDInput::AliFMDInput(const char* gAliceFile)
     fArrayS(0), 
     fArrayR(0), 
     fArrayA(0), 
+    fGeoManager(0),
     fTreeMask(0), 
     fIsInit(kFALSE)
 {
@@ -179,9 +187,13 @@ AliFMDInput::Init()
   // Optionally, get the ESD files
   if (TESTBIT(fTreeMask, kESD)) {
     fChainE = new TChain("esdTree");
-    TSystemDirectory dir;
+    TSystemDirectory dir(".",".");
     TList*           files = dir.GetListOfFiles();
-    TSystemFile*     file;
+    TSystemFile*     file = 0;
+    if (!files) {
+      AliError("No files");
+      return kFALSE;
+    }
     files->Sort();
     TIter            next(files);
     while ((file = static_cast<TSystemFile*>(next()))) {
@@ -224,7 +236,7 @@ AliFMDInput::Init()
          AliAlignObjAngles* a = static_cast<AliAlignObjAngles*>(array->At(i));
          if (!a->ApplyToGeometry()) {
            AliWarning(Form("Failed to apply alignment to %s", 
-                           a->GetVolPath()));
+                           a->GetSymName()));
          }
        }
       }
@@ -272,7 +284,13 @@ AliFMDInput::Begin(Int_t event)
     AliInfo("Getting FMD digits");
     if (fFMDLoader->LoadDigits()) return kFALSE;
     fTreeD = fFMDLoader->TreeD();
-    if (!fArrayD) fArrayD = fFMD->Digits();
+    if (fTreeD) {
+      if (!fArrayD) fArrayD = fFMD->Digits();
+    }
+    else {
+      fArrayD = 0;
+      AliWarning(Form("Failed to load FMD Digits"));
+    } 
   }
   // Possibly load FMD Sdigit information 
   if (TESTBIT(fTreeMask, kSDigits)) {
@@ -295,6 +313,16 @@ AliFMDInput::Begin(Int_t event)
     if (read <= 0) return kFALSE;
     fESD = fMainESD->GetFMDData();
     if (!fESD) return kFALSE;
+    TFile* f = fChainE->GetFile();
+    if (f) {
+      TObject* o = f->GetStreamerInfoList()->FindObject("AliFMDMap");
+      if (o) {
+       TStreamerInfo* info = static_cast<TStreamerInfo*>(o);
+       std::cout << "AliFMDMap class version read is " 
+                 <<  info->GetClassVersion() << std::endl;
+      }
+    }
+    // fESD->CheckNeedUShort(fChainE->GetFile());
   }
   // Possibly load FMD Digit information 
   if (TESTBIT(fTreeMask, kRaw)) {
@@ -332,7 +360,7 @@ AliFMDInput::Event()
   if (TESTBIT(fTreeMask, kRecPoints)) 
     if (!ProcessRecPoints()) return kFALSE;
   if (TESTBIT(fTreeMask, kESD))
-    if (!ProcessESD(fESD)) return kFALSE;
+    if (!ProcessESDs()) return kFALSE;
   
   return kTRUE;
 }
@@ -341,6 +369,8 @@ AliFMDInput::Event()
 Bool_t 
 AliFMDInput::ProcessHits()
 {
+  // Read the hit tree, and pass each hit to the member function
+  // ProcessHit.
   if (!fTreeH) {
     AliError("No hit tree defined");
     return kFALSE;
@@ -447,6 +477,31 @@ AliFMDInput::ProcessRecPoints()
   return kTRUE;
 }
 
+//____________________________________________________________________
+Bool_t 
+AliFMDInput::ProcessESDs()
+{
+  // Process event summary data
+  if (!fESD) return kFALSE;
+  for (UShort_t det = 1; det <= 3; det++) {
+    Char_t rings[] = { 'I', (det == 1 ? '\0' : 'O'), '\0' };
+    for (Char_t* rng = rings; *rng != '\0'; rng++) {
+      UShort_t nsec = (*rng == 'I' ?  20 :  40);
+      UShort_t nstr = (*rng == 'I' ? 512 : 256);
+      for (UShort_t sec = 0; sec < nsec; sec++) {
+       for (UShort_t str = 0; str < nstr; str++) {
+         Float_t eta  = fESD->Eta(det,*rng,sec,str);
+         Float_t mult = fESD->Multiplicity(det,*rng,sec,str);
+         if (!fESD->IsAngleCorrected()) 
+           mult *= TMath::Abs(TMath::Cos(2.*TMath::ATan(TMath::Exp(-eta))));
+         if (!ProcessESD(det, *rng, sec, str, eta, mult)) continue;
+       }
+      }
+    }
+  }
+  return kTRUE;
+}
+
 //____________________________________________________________________
 Bool_t
 AliFMDInput::End()
@@ -511,30 +566,6 @@ AliFMDInput::Run()
   return retval;
 }
 
-//====================================================================
-ClassImp(AliFMDInputHits)
-#if 0
-  ;
-#endif
-
-
-//====================================================================
-ClassImp(AliFMDInputDigits)
-#if 0
-  ;
-#endif
-
-//====================================================================
-ClassImp(AliFMDInputSDigits)
-#if 0
-  ;
-#endif
-
-//====================================================================
-ClassImp(AliFMDInputRecPoints)
-#if 0
-  ;
-#endif
 
 //____________________________________________________________________
 //