]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TRD/AliTRDdigitsManager.cxx
Use of fGeom avoided; function GetGlobalPosition overwritten
[u/mrichter/AliRoot.git] / TRD / AliTRDdigitsManager.cxx
index 8f6de99329c40a3c0568fc27146d16df116752e2..08deda4acc122a33862987f6169dc22c993a0b89 100644 (file)
 
 /*
 $Log$
+Revision 1.11  2001/03/13 09:30:35  cblume
+Update of digitization. Moved digit branch definition to AliTRD
+
+Revision 1.10  2001/01/26 19:56:57  hristov
+Major upgrade of AliRoot code
+
+Revision 1.9  2000/11/02 09:25:53  cblume
+Change also the dictionary to AliTRDdataArray
+
+Revision 1.8  2000/11/01 15:20:13  cblume
+Change AliTRDdataArrayI to AliTRDdataArray in MakeBranch()
+
+Revision 1.7  2000/11/01 14:53:20  cblume
+Merge with TRD-develop
+
+Revision 1.1.2.5  2000/10/17 02:27:34  cblume
+Get rid of global constants
+
+Revision 1.1.2.4  2000/10/15 23:40:01  cblume
+Remove AliTRDconst
+
+Revision 1.1.2.3  2000/10/06 16:49:46  cblume
+Made Getters const
+
+Revision 1.1.2.2  2000/10/04 16:34:58  cblume
+Replace include files by forward declarations
+
+Revision 1.5  2000/06/09 11:10:07  cblume
+Compiler warnings and coding conventions, next round
+
+Revision 1.4  2000/06/08 18:32:58  cblume
+Make code compliant to coding conventions
+
+Revision 1.3  2000/06/07 16:27:01  cblume
+Try to remove compiler warnings on Sun and HP
+
 Revision 1.2  2000/05/08 16:17:27  cblume
 Merge TRD-develop
 
@@ -30,13 +66,28 @@ Add new class AliTRDdigitsManager
 //                                                                           //
 ///////////////////////////////////////////////////////////////////////////////
 
+#include <iostream.h>
+#include <TROOT.h>
+#include <TTree.h>                                                              
+#include <TFile.h>
+
 #include "AliRun.h"
 
 #include "AliTRDdigitsManager.h"
-#include "AliTRDconst.h"
+#include "AliTRDsegmentArray.h"
+#include "AliTRDdataArrayI.h"
+#include "AliTRDdigit.h"
+#include "AliTRDgeometry.h"
+#include "AliTRD.h"
 
 ClassImp(AliTRDdigitsManager)
 
+//_____________________________________________________________________________
+
+  // Number of track dictionary arrays
+  const Int_t AliTRDdigitsManager::fgkNDict = kNDict;
+
 //_____________________________________________________________________________
 AliTRDdigitsManager::AliTRDdigitsManager():TObject()
 {
@@ -46,17 +97,32 @@ AliTRDdigitsManager::AliTRDdigitsManager():TObject()
 
   fIsRaw = kFALSE;
 
-  fDigits = new AliTRDsegmentArray("AliTRDdataArrayI",kNdet);
+  fDigits = new AliTRDsegmentArray("AliTRDdataArrayI",AliTRDgeometry::Ndet());
 
   for (Int_t iDict = 0; iDict < kNDict; iDict++) {
-    fDictionary[iDict] = new AliTRDsegmentArray("AliTRDdataArrayI",kNdet);
+    fDictionary[iDict] = new AliTRDsegmentArray("AliTRDdataArrayI"
+                                               ,AliTRDgeometry::Ndet());
   }
 
 }
 
+//_____________________________________________________________________________
+AliTRDdigitsManager::AliTRDdigitsManager(const AliTRDdigitsManager &m)
+{
+  //
+  // AliTRDdigitsManager copy constructor
+  //
+
+  ((AliTRDdigitsManager &) m).Copy(*this);
+
+}
+
 //_____________________________________________________________________________
 AliTRDdigitsManager::~AliTRDdigitsManager()
 {
+  //
+  // AliTRDdigitsManager destructor
+  //
 
   if (fDigits) {
     fDigits->Delete();
@@ -70,18 +136,31 @@ AliTRDdigitsManager::~AliTRDdigitsManager()
 
 }
 
+//_____________________________________________________________________________
+void AliTRDdigitsManager::Copy(TObject &m)
+{
+  //
+  // Copy function
+  //
+
+  ((AliTRDdigitsManager &) m).fIsRaw = fIsRaw;
+
+  TObject::Copy(m);
+
+}
+
 //_____________________________________________________________________________
 void AliTRDdigitsManager::SetRaw()
 {
 
   fIsRaw = kTRUE;
 
-  fDigits->SetBit(kRawDigit);
+  fDigits->SetBit(AliTRDdigit::RawDigit());
   
 }
 
 //_____________________________________________________________________________
-Bool_t AliTRDdigitsManager::MakeBranch()
+Bool_t AliTRDdigitsManager::MakeBranch(char *file)
 {
   //
   // Creates the branches for the digits and the dictionary in the digits tree
@@ -91,15 +170,20 @@ Bool_t AliTRDdigitsManager::MakeBranch()
 
   Bool_t status = kTRUE;
 
+  //TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject("TRD.Digits.root");
+
+  AliTRD * TRD = (AliTRD *) gAlice->GetDetector("TRD") ;
+
   if (gAlice->TreeD()) {
 
     // Make the branch for the digits
     if (fDigits) {
-      const AliTRDdataArrayI *Digits = 
-           (AliTRDdataArrayI *) fDigits->At(0);
-      if (Digits) {
-        gAlice->TreeD()->Branch("TRDdigits",Digits->IsA()->GetName()
-                                           ,&Digits,buffersize,1);
+      const AliTRDdataArray *kDigits = 
+           (AliTRDdataArray *) fDigits->At(0);
+      if (kDigits) {
+           TRD->MakeBranchInTree(gAlice->TreeD(), 
+                                "TRDdigits", kDigits->IsA()->GetName(),
+                                &kDigits,buffersize, 1,file);
         printf("AliTRDdigitsManager::MakeBranch -- ");
         printf("Making branch TRDdigits\n");
       }
@@ -113,15 +197,15 @@ Bool_t AliTRDdigitsManager::MakeBranch()
 
     // Make the branches for the dictionaries
     for (Int_t iDict = 0; iDict < kNDict; iDict++) {
-
       Char_t branchname[15];
       sprintf(branchname,"TRDdictionary%d",iDict);
       if (fDictionary[iDict]) {
-        const AliTRDdataArrayI *Dictionary = 
-             (AliTRDdataArrayI *) fDictionary[iDict]->At(0);
-        if (Dictionary) {
-          gAlice->TreeD()->Branch(branchname,Dictionary->IsA()->GetName()
-                                            ,&Dictionary,buffersize,1);
+        const AliTRDdataArray *kDictionary = 
+             (AliTRDdataArray *) fDictionary[iDict]->At(0);
+        if (kDictionary) {
+            TRD->MakeBranchInTree(gAlice->TreeD(), 
+                             branchname,kDictionary->IsA()->GetName(),
+                             &kDictionary,buffersize, 1,file);
           printf("AliTRDdigitsManager::MakeBranch -- ");
           printf("Making branch %s\n",branchname);
        }
@@ -146,6 +230,9 @@ Bool_t AliTRDdigitsManager::MakeBranch()
 //_____________________________________________________________________________
 Bool_t AliTRDdigitsManager::ReadDigits()
 {
+  //
+  // Reads the digit information from the input file
+  //
 
   Bool_t status = kTRUE;
 
@@ -157,7 +244,7 @@ Bool_t AliTRDdigitsManager::ReadDigits()
     status = fDictionary[iDict]->LoadArray(branchname);
   }  
 
-  if (fDigits->TestBit(kRawDigit)) {
+  if (fDigits->TestBit(AliTRDdigit::RawDigit())) {
     fIsRaw = kTRUE;
   }
   else {
@@ -177,6 +264,8 @@ Bool_t AliTRDdigitsManager::WriteDigits()
 
   // Create the branches
   if (!(gAlice->TreeD()->GetBranch("TRDdigits"))) { 
+    printf("AliTRDdigitsManager::WriteDigits -- ");
+    printf("Call MakeBranch\n");
     if (!MakeBranch()) return kFALSE;
   }
 
@@ -202,7 +291,7 @@ Bool_t AliTRDdigitsManager::WriteDigits()
 
 //_____________________________________________________________________________
 AliTRDdigit *AliTRDdigitsManager::GetDigit(Int_t row, Int_t col
-                                         , Int_t time, Int_t det)
+                                         , Int_t time, Int_t det) const
 {
   // 
   // Creates a single digit object 
@@ -225,7 +314,7 @@ AliTRDdigit *AliTRDdigitsManager::GetDigit(Int_t row, Int_t col
 //_____________________________________________________________________________
 Int_t AliTRDdigitsManager::GetTrack(Int_t track
                                   , Int_t row, Int_t col, Int_t time
-                                  , Int_t det)
+                                  , Int_t det) const
 {
   // 
   // Returns the MC-track numbers from the dictionary.
@@ -243,3 +332,52 @@ Int_t AliTRDdigitsManager::GetTrack(Int_t track
 
 }
 
+//_____________________________________________________________________________
+AliTRDdataArrayI *AliTRDdigitsManager::GetDigits(Int_t det) const
+{
+  //
+  // Returns the digits array for one detector
+  //
+
+  return (AliTRDdataArrayI *) fDigits->At(det);
+
+}
+
+//_____________________________________________________________________________
+AliTRDdataArrayI *AliTRDdigitsManager::GetDictionary(Int_t det, Int_t i) const
+{
+  //
+  // Returns the dictionary for one detector
+  //
+
+  return (AliTRDdataArrayI *) fDictionary[i]->At(det);
+
+}
+
+//_____________________________________________________________________________
+Int_t AliTRDdigitsManager::GetTrack(Int_t track, AliTRDdigit *Digit) const
+{
+  // 
+  // Returns the MC-track numbers from the dictionary for a given digit
+  //
+
+  Int_t row  = Digit->GetRow();
+  Int_t col  = Digit->GetCol();
+  Int_t time = Digit->GetTime();
+  Int_t det  = Digit->GetDetector();
+
+  return GetTrack(track,row,col,time,det);
+
+}
+
+//_____________________________________________________________________________
+AliTRDdigitsManager &AliTRDdigitsManager::operator=(const AliTRDdigitsManager &m)
+{
+  //
+  // Assignment operator
+  //
+
+  if (this != &m) ((AliTRDdigitsManager &) m).Copy(*this);
+  return *this;
+
+}