changes for TTask implementation, some other small editing
authorjchudoba <jchudoba@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 4 Oct 2001 20:01:54 +0000 (20:01 +0000)
committerjchudoba <jchudoba@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 4 Oct 2001 20:01:54 +0000 (20:01 +0000)
MUON/AliMUONDigitizer.cxx
MUON/AliMUONDigitizer.h

index dbf902d0159f75d330676a05b3ce1c22d52f0ffc..0cb7e0a6ab14a0ccb58a416fe0909e2a06bc64d9 100644 (file)
@@ -15,6 +15,9 @@
 
 /*
 $Log$
+Revision 1.2  2001/07/28 10:46:04  hristov
+AliRunDigitizer.h included; typos corrected
+
 Revision 1.1  2001/07/27 15:41:01  jchudoba
 merging/digitization classes
 
@@ -47,7 +50,7 @@ ClassImp(AliMUONDigitizer)
 AliMUONDigitizer::AliMUONDigitizer() :AliDigitizer()
 {
 // Default ctor - don't use it
-  cerr<<"Error: AliMUONDigitizer default ctor must not be used"<<endl;
+  ;
 }
 
 //___________________________________________
@@ -55,14 +58,13 @@ AliMUONDigitizer::AliMUONDigitizer(AliRunDigitizer* manager)
     :AliDigitizer(manager)
 {
 // ctor which should be used
-  fManager = manager;
   fHitMap  = 0;
   fTDList  = 0;
-  fTrH1    = 0;
   fHits    = 0;
-  fPadHits    = 0;
-  fTrList     = 0;
-  fAddress    = 0; 
+  fPadHits = 0;
+  fTrList  = 0;
+  fAddress = 0;
+  fDebug   = 0; 
   if (GetDebug()>2) 
     cerr<<"AliMUONDigitizer::AliMUONDigitizer"
        <<"(AliRunDigitizer* manager) was processed"<<endl;
@@ -72,7 +74,6 @@ AliMUONDigitizer::AliMUONDigitizer(AliRunDigitizer* manager)
 AliMUONDigitizer::~AliMUONDigitizer()
 {
 // Destructor
-  if (fTrH1)       delete fTrH1;
   if (fHits)       delete fHits;
   if (fPadHits)    delete fPadHits;
   if (fHitMap)     delete fHitMap;
@@ -160,12 +161,15 @@ Bool_t AliMUONDigitizer::Init()
 
 
 //------------------------------------------------------------------------
-void AliMUONDigitizer::Digitize()
+//void AliMUONDigitizer::Digitize()
+void AliMUONDigitizer::Exec(Option_t* option)
 {
 
-  // keep galice.root for signal and name differently the file for 
-  // background when add! otherwise the track info for signal will be lost !
-  
+  TString optionString = option;
+  if (optionString.Data() == "deb") {
+    cout<<"AliMUONDigitizer::Exec: called with option deb "<<endl;
+    fDebug = 3;
+  }
   AliMUONChamber*   iChamber;
   AliSegmentation*  segmentation;
   
@@ -207,8 +211,8 @@ void AliMUONDigitizer::Digitize()
         inputFile++) {
 // Connect MUON branches
 
-      TBranch *branch = 0;
-      TBranch *branch2 = 0;
+      TBranch *branchHits = 0;
+      TBranch *branchPadHits = 0;
       TTree *treeH = fManager->GetInputTreeH(inputFile);
       if (GetDebug()>2) {
        cerr<<"   inputFile , cathode = "<<inputFile<<" "
@@ -216,24 +220,24 @@ void AliMUONDigitizer::Digitize()
        cerr<<"   treeH, fHits "<<treeH<<" "<<fHits<<endl;
       }
       if (treeH && fHits) {
-       branch = treeH->GetBranch("MUON");
-       if (branch) {
+       branchHits = treeH->GetBranch("MUON");
+       if (branchHits) {
          fHits->Clear();
-         branch->SetAddress(&fHits);
+         branchHits->SetAddress(&fHits);
        }
        else
          Error("Digitize","branch MUON was not found");
       }
-      if (GetDebug()>2) cerr<<"   branch = "<<branch<<endl;
+      if (GetDebug()>2) cerr<<"   branchHits = "<<branchHits<<endl;
 
       if (treeH && fPadHits) {
-       branch2 = treeH->GetBranch("MUONCluster");
-       if (branch2
-         branch2->SetAddress(&fPadHits);
+       branchPadHits = treeH->GetBranch("MUONCluster");
+       if (branchPadHits
+         branchPadHits->SetAddress(&fPadHits);
        else
          Error("Digitize","branch MUONCluster was not found");
       }
-      if (GetDebug()>2) cerr<<"   branch2 = "<<branch2<<endl;
+      if (GetDebug()>2) cerr<<"   branchPadHits = "<<branchPadHits<<endl;
 
 //
 //   Loop over tracks
@@ -244,8 +248,9 @@ void AliMUONDigitizer::Digitize()
       for (fTrack = 0; fTrack < ntracks; fTrack++) {
        if (GetDebug()>2) cerr<<"   fTrack = "<<fTrack<<endl;
        fHits->Clear();
-       cerr<<" branch->GetEntry(fTrack) "<<branch->GetEntry(fTrack)<<endl;
-       cerr<<" branch2->GetEntry(fTrack) "<<branch2->GetEntry(fTrack)<<endl;
+       fPadHits->Clear();
+       branchHits->GetEntry(fTrack);
+       branchPadHits->GetEntry(fTrack);
        
 //
 //   Loop over hits
@@ -343,7 +348,7 @@ void AliMUONDigitizer::Digitize()
 
       // this was changed to accomodate the real number of tracks
 
-      if (nptracks > 10) {
+      if (nptracks > 10 && GetDebug() >0) {
        cerr<<"Attention - nptracks > 10 "<<nptracks<<endl;
        nptracks = 10;
       }
@@ -392,20 +397,19 @@ void AliMUONDigitizer::Digitize()
     delete [] nmuon;    
   } //end loop over cathodes
   if (GetDebug()>2) 
-    cerr<<"DDDDD: writing the TreeD: "
+    cerr<<"AliMUONDigitizer::Exec: writing the TreeD: "
        <<fManager->GetTreeD()->GetName()<<endl;
-  fManager->GetTreeD()->Write();
+  fManager->GetTreeD()->Write(0,TObject::kOverwrite);
   delete [] fHitMap;
   delete fTDList;
     
   if (fAddress)    fAddress->Delete();
   if (fHits)    fHits->Delete();
   if (fPadHits) fPadHits->Delete();
-  // gObjectTable->Print();
 }
 
 
-
+//------------------------------------------------------------------------
 void AliMUONDigitizer::SortTracks(Int_t *tracks,Int_t *charges,Int_t ntr)
 {
   //
@@ -459,30 +463,3 @@ void AliMUONDigitizer::SortTracks(Int_t *tracks,Int_t *charges,Int_t ntr)
     }
   }
 }
-
-
-/*
-void AliMUONDigitizer::MixWith(char* HeaderFile, char* SDigitsFile){
-//
-
-  if(HeaderFile == 0){
-    cout << "Specify  header file to merge"<< endl;
-    return;
-  }
-  
-  Int_t inputs;
-  for(inputs = 0; inputs < fNinputs ; inputs++){
-    if(strcmp(((TObjString *)fHeaderFiles->At(inputs))->GetString(),HeaderFile) == 0 ){
-      cout << "Entry already exists, do not add" << endl ;
-      return ;
-    }
-  }  
-  
-  fHeaderFiles->Expand(fNinputs+1) ;
-  new((*fHeaderFiles)[fNinputs]) TObjString(HeaderFile) ;
-
-  TFile * file ;
-  file = new TFile(((TObjString *) fHeaderFiles->At(fNinputs))->GetString()) ;  
-  file->cd() ;
-
-*/
index 340ac53182ef6d1a6657ffe435566c1389cf9264..dff153c0cf9ebf410cc256a7eebd37df0f4b0069 100644 (file)
@@ -4,7 +4,7 @@
  * See cxx source for full Copyright notice                               */
 
 /* $Id$ */
-#include "../STEER/AliDigitizer.h"
+#include "AliDigitizer.h"
 
 class AliRunDigitizer;
 class AliMUONPadHit;
@@ -28,32 +28,28 @@ class AliMUONDigitizer : public AliDigitizer {
     virtual Bool_t Init();
 
     // Do the main work
-    void Digitize() ;
+    virtual void Exec(Option_t* option=0);
     
+    Int_t GetDebug() {return fDebug;}             // get debug level
+    void SetDebug(Int_t level){fDebug = level;}   // set debug level    
     enum {kBgTag = -1};
     
  private:    
     void SortTracks(Int_t *tracks,Int_t *charges,Int_t ntr);
     
  private:
-    AliRunDigitizer *fManager;      // ! pointer to the AliRunDigitizer object
-    TTree *fTrH1;                   // ! Hits Tree
-    TClonesArray *fHits;            // ! List of hits for one track only
-    TClonesArray *fPadHits;         // ! List of clusters for one track only
-    AliHitMap **fHitMap;            // ! pointer to array of pointers to hitmaps
-    Int_t fNch;                     // ! chamber nr (loop variable)
-    Int_t fTrack;                   // ! track nr (loop variable)
-    TObjArray *fTDList;             // ! list of AliMUONTransientDigits
-    TObjArray *fTrList;             // ! list of tracks
-    TClonesArray *fAddress;         // ! pointer to TClonesArray of TVectors with trackinfo
-    Int_t fCounter;                 // ! nr. of AliMUONTransientDigit
-    Int_t fCountadr;                // ! counter for trinfo
-    Int_t fDigits[6];               // ! array with digits
-    Int_t fEvNrSig;                 // signal     event number
-    Int_t fEvNrBgr;                 // background event number    
-    TClonesArray * fHeaderFiles ;   // Names of files with headers to merge
-    Bool_t fInitialized;            // if first file already read
-    
+    TClonesArray *fHits;            //! List of hits for one track only
+    TClonesArray *fPadHits;         //! List of clusters for one track only
+    AliHitMap **fHitMap;            //! pointer to array of pointers to hitmaps
+    Int_t fNch;                     //! chamber nr (loop variable)
+    Int_t fTrack;                   //! track nr (loop variable)
+    TObjArray *fTDList;             //! list of AliMUONTransientDigits
+    TObjArray *fTrList;             //! list of tracks
+    TClonesArray *fAddress;         //! pointer to TClonesArray of TVectors with trackinfo
+    Int_t fCounter;                 //! nr. of AliMUONTransientDigit
+    Int_t fCountadr;                //! counter for trinfo
+    Int_t fDigits[6];               //! array with digits
+    Int_t fDebug;                   //! debug level
     ClassDef(AliMUONDigitizer,1)
 };    
 #endif