SDigitizer and Merger added
authorvicinanz <vicinanz@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 27 Sep 2001 10:39:21 +0000 (10:39 +0000)
committervicinanz <vicinanz@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 27 Sep 2001 10:39:21 +0000 (10:39 +0000)
20 files changed:
TOF/AliTOF.cxx
TOF/AliTOF.h
TOF/AliTOFMerger.cxx [new file with mode: 0644]
TOF/AliTOFMerger.h [new file with mode: 0644]
TOF/AliTOFSDigitizer.cxx [new file with mode: 0644]
TOF/AliTOFSDigitizer.h [new file with mode: 0644]
TOF/AliTOFdigit.cxx
TOF/AliTOFv0.cxx
TOF/AliTOFv0.h
TOF/AliTOFv1.cxx
TOF/AliTOFv1.h
TOF/AliTOFv2.cxx
TOF/AliTOFv2.h
TOF/AliTOFv3.cxx
TOF/AliTOFv3.h
TOF/AliTOFv4.cxx
TOF/AliTOFv4.h
TOF/Makefile
TOF/TOFLinkDef.h
TOF/TOFMerger.C [new file with mode: 0644]

index af9b7f8..059b21c 100644 (file)
@@ -15,6 +15,9 @@
 
 /*
 $Log$
+Revision 1.25  2001/09/07 08:37:40  hristov
+Pointers initialised to 0 in the default constructor
+
 Revision 1.24  2001/09/05 16:31:00  hristov
 The deletion of TOF folders temporarily commented out
 
@@ -96,6 +99,8 @@ Introduction of the Copyright and cvs Log
 
 #include <iostream.h>
 #include <strstream.h>
+#include <fstream.h>
+#include <stdlib.h>
 
 #include "AliTOF.h"
 #include "AliTOFhit.h"
@@ -135,7 +140,9 @@ AliTOF::AliTOF()
   fSDigits       = 0 ;
   fDigits        = 0 ;
   fName="TOF";
+/* fp
   CreateTOFFolders();
+*/
 }
  
 //_____________________________________________________________________________
@@ -150,15 +157,11 @@ AliTOF::AliTOF(const char *name, const char *title)
 
   // Initialization of hits, sdigits and digits array
   //
-  fHits   = new TClonesArray("AliTOFhit",  405);
+  fHits   = new TClonesArray("AliTOFhit",  1000);
   gAlice->AddHitList(fHits);
   fIshunt  = 0;
-
-  fSDigits       = new TClonesArray("AliTOFdigit",  405);
-
-  fDigits        = new TClonesArray("AliTOFdigit",  405);
-
-
+  fSDigits       = new TClonesArray("AliTOFdigit",  1000);
+  fDigits        = new TClonesArray("AliTOFdigit",  1000);
   //
   // Digitization parameters
   //
@@ -175,7 +178,7 @@ AliTOF::AliTOF(const char *name, const char *title)
   fZlenC   = 177.5;//cm length of module C
   fZlenB   = 141.0;//cm length of module B
   fZlenA   = 106.0;//cm length of module A
-  fZtof    = 370.5;//cm total semi-length of TOF detector
+  fZtof    = 371.5;//cm total semi-length of TOF detector
 
 // Strip Parameters
   fStripLn = 122.0;//cm  Strip Length
@@ -208,9 +211,10 @@ AliTOF::AliTOF(const char *name, const char *title)
                       // (TARODA)
   fNTdc       = 32;   // number of Tdc (Time to Digital Converter)
   fNPadXRoc   = (Int_t)fPadXSector/fNRoc; // number of pads for each ROC
-
+  /* fp 25 Sept 2001
   // Create TOF Folder Structure
-  CreateTOFFolders(); 
+  CreateTOFFolders();
+  */ 
 }
 
 //_____________________________________________________________________________
@@ -261,13 +265,39 @@ void AliTOF::CreateTOFFolders()
 //_____________________________________________________________________________
 AliTOF::~AliTOF()
 {
-  // remove the alice folder 
+  // dtor:
+  // it remove also the alice folder 
   // and task that TOF creates instead of AliRun
   /* PH Temporarily commented because of problems
   TFolder * alice = (TFolder*)gROOT->GetListOfBrowsables()->FindObject("FPAlice") ;
   delete alice;
   alice = 0;
   */
+  if (fHits)
+    {
+      fHits->Delete ();
+      delete fHits;
+      fHits = 0;
+    }
+  if (fDigits)
+    {
+      fDigits->Delete ();
+      delete fDigits;
+      fDigits = 0;
+    }
+  if (fSDigits)
+    {
+      fSDigits->Delete ();
+      delete fSDigits;
+      fSDigits = 0;
+    }
+  if (fReconParticles)
+    {
+      fReconParticles->Delete ();
+      delete fReconParticles;
+      fReconParticles = 0;
+    }
+
 }
 
 //_____________________________________________________________________________
@@ -292,6 +322,55 @@ void AliTOF::AddDigit(Int_t *tracks, Int_t *vol, Float_t *digits)
   new (ldigits[fNdigits++]) AliTOFdigit(tracks, vol, digits);
 }
 
+//___________________________________________
+void AliTOF::AddSDigit(Int_t *tracks, Int_t *vol, Float_t *digits)
+{
+     
+//
+// Add a TOF sdigit
+//
+        
+  TClonesArray &lSDigits = *fSDigits;   
+  new(lSDigits[fNSDigits++]) AliTOFdigit(tracks, vol, digits);
+}
+
+//_____________________________________________________________________________
+void AliTOF::SetTreeAddress ()
+{
+  // Set branch address for the Hits and Digits Tree.
+  char branchname[30];
+  AliDetector::SetTreeAddress ();
+
+  TBranch *branch;
+  TTree *treeD = gAlice->TreeD ();
+
+
+  if (treeD)
+    {
+      if (fDigits)
+       {
+         branch = treeD->GetBranch (branchname);
+         if (branch)
+           branch->SetAddress (&fDigits);
+       }
+
+    }
+  if (fSDigits)
+    //  fSDigits->Clear ();
+
+  if (gAlice->TreeS () && fSDigits)
+    {
+      branch = gAlice->TreeS ()->GetBranch ("TOF");
+      if (branch)
+       branch->SetAddress (&fSDigits);
+    }
+
+  if (gAlice->TreeR() && fReconParticles) 
+    {
+      branch = gAlice->TreeR()->GetBranch("TOF"); 
+      if (branch) branch->SetAddress(&fReconParticles) ;
+    }   
+}
 
 //_____________________________________________________________________________
 void AliTOF::CreateGeometry()
@@ -496,7 +575,22 @@ Int_t AliTOF::DistancetoPrimitive(Int_t , Int_t ) const
   //
   return 9999;
 }
+
+//___________________________________________
+void AliTOF::ResetHits ()
+{
+  // Reset number of clusters and the cluster array for this detector
+  AliDetector::ResetHits ();
+}
+
+//____________________________________________
+void AliTOF::ResetDigits ()
+{
+  //
+  // Reset number of digits and the digits array for this detector
+  AliDetector::ResetDigits ();
+  //
+} 
 //_____________________________________________________________________________
 void AliTOF::Init()
 {
@@ -514,9 +608,9 @@ void AliTOF::MakeBranch(Option_t* option, const char *file)
  //
  // Initializes the Branches of the TOF inside the 
  // trees written for each event. 
- //  AliDetector::MakeBranch initializes just the 
+ // AliDetector::MakeBranch initializes just the 
  // Branch inside TreeH. Here we add the branches in 
- // TreeD and TreeS.
+ // TreeD, TreeS and TreeR.
  //
   AliDetector::MakeBranch(option,file);
 
@@ -526,6 +620,7 @@ void AliTOF::MakeBranch(Option_t* option, const char *file)
   
   const char *oD = strstr(option,"D");
   const char *oS = strstr(option,"S");
+  const char *oR = strstr(option,"R");
 
   if (oD)
   //
@@ -549,6 +644,17 @@ void AliTOF::MakeBranch(Option_t* option, const char *file)
                               branchname, &fSDigits,buffersize, file) ;
   }
 
+  if (oR)
+  //
+  // one branch for TOF reconstructed particles
+  //
+
+
+  if (fReconParticles && gAlice->TreeR() && oR){
+             MakeBranchInTree(gAlice->TreeR(),
+                              branchname, &fReconParticles,buffersize, file) ;
+  }
+
 }
 
 //____________________________________________________________________________
@@ -576,132 +682,175 @@ void AliTOF::FinishEvent()
 void AliTOF::SDigits2Digits()
 {
 //
-// Generate digits
+// Generate digits performing merging
 //
+  /*
     int nparticles = gAlice->GetNtrack();
     cout << "Particles       :" <<nparticles<<endl;
     if (nparticles > 0 ) {
+      
       AliTOF::Hits2Digits();
+      
     }
+  */
+  cout<<"AliTOF::SDigits2Digits"<<endl; 
+    if (fMerger) {
+      fMerger->Init();
+      cout<<"AliTOF::SDigits2Digits Init"<<endl; 
+      fMerger->Digitise();
+      cout<<"AliTOF::SDigits2Digits Digitise() "<<endl; 
+     }
+}
+
+//---------------------------------------------------------------------
+void   AliTOF::SetMerger(AliTOFMerger* merger)
+{
+// Set pointer to merger
+    fMerger = merger;
+}
+
+//---------------------------------------------------------------------
+AliTOFMerger*  AliTOF::Merger()
+{
+// Return pointer to merger
+    return fMerger;
 }
 
 //____________________________________________________________________________
-void AliTOF::Hits2Digits()
+void AliTOF::TOFHits2SDigits()
 {
 //
 // Starting from the Hits Tree (TreeH), this
-// function writes the TOF Digits Branch in the Tree (TreeD) storing 
+// function writes the TOF SDigits Branch in the TreeS storing 
 // the digits informations.
 // It has to be called just at the end of an event or 
 // at the end of a whole run.
 // It could  also be called by AliTOF::Finish Event()
 // Just for MC events. 
 //
-// Called by the ROOT script Hits2Digits.C
+// Called by the ROOT script Hits2SDigits.C
 //
 // Simulation of detector response.
 
    Int_t ver = this->IsVersion();
-   if(ver==0) return; // no digits for AliTOFv0
+   if(ver==0) return; // no sdigits for AliTOFv0
+
+  AliTOF *TOF = (AliTOF *) gAlice->GetDetector ("TOF");
+
+  if (fNevents == 0)
+    fNevents = (Int_t) gAlice->TreeE ()->GetEntries ();
+
+       cout << "nevents found on file " << fNevents << endl;
+      // Start Event ------------------------- LOOP
+
+  for (Int_t ievent = 0; ievent < fNevents; ievent++)
+    {
+      gAlice->GetEvent (ievent);
+      if (gAlice->TreeH () == 0)
+       return; // no hits stored 
+      if (gAlice->TreeS () == 0)
+       gAlice->MakeTree ("S");
+
+
+      Int_t nSdigits = 0;
+      
+            //Make branches
+      char branchname[20];
+       sprintf (branchname, "%s", TOF->GetName ());
+      //Make branch for TOF sdigits
+      TOF->MakeBranch ("S");
+
+      Int_t    tracks[3];    // track info
+      Int_t    vol[5];       // location for a digit
+      Float_t  digit[2];     // TOF digit variables
+      Int_t hit, nbytes;
+      TParticle *particle;
+      AliTOFhit *tofHit;
+      TClonesArray *TOFhits = TOF->Hits();
+
+
+      if (TOF)
+       {
+         TOFhits = TOF->Hits();             // pointer to the TClonesArray of TOF hits
+         TTree *TH = gAlice->TreeH();       // pointer to the current TreeH
+         Stat_t ntracks = TH->GetEntries(); // number of tracks for the current event
+         for (Int_t track = 0; track < ntracks; track++)
+           {
+             gAlice->ResetHits ();
+             nbytes += TH->GetEvent(track);
+             particle = gAlice->Particle(track);
+             Int_t nhits = TOFhits->GetEntriesFast(); // number of hits for the current track
+
+             for (hit = 0; hit < nhits; hit++)
+               {
+               tofHit = (AliTOFhit*) TOFhits->UncheckedAt(hit);
+               vol[0] = tofHit->GetSector();
+               vol[1] = tofHit->GetPlate();
+               vol[2] = tofHit->GetPadx();
+               vol[3] = tofHit->GetPadz();
+               vol[4] = tofHit->GetStrip();
+
+               // 95% of efficiency to be inserted here
+               // edge effect to be inserted here
+               // cross talk  to be inserted here
+
+               Float_t idealtime = tofHit->GetTof(); // unit s
+               idealtime *= 1.E+12;  // conversion from s to ps
+                              // fTimeRes is given usually in ps
+               Float_t tdctime   = gRandom->Gaus(idealtime, fTimeRes); 
+               digit[0] = tdctime;
 
-  Int_t nhits = 0;       // total number of hits for the current track
-  Int_t evNumber = 0;    // evnumber
-  Int_t    tracks[3];    // track info
-  Int_t    vol[5];       // dummy location for digit
-  Float_t  digit[2];     // TOF digit variables
-  
+               // typical Landau Distribution to be inserted here
+               // instead of Gaussian Distribution
+               Float_t idealcharge = tofHit->GetEdep();
+               Float_t adccharge = gRandom->Gaus(idealcharge, fChrgRes);
+               digit[1] = adccharge;
+               Int_t tracknum = tofHit->GetTrack();
+               tracks[0] = tracknum;
+               tracks[1] = 0;
+               tracks[2] = 0;
 
-  // Get pointers to Alice detectors and Hits containers
-  AliDetector* TOF  = gAlice->GetDetector("TOF");
+               // check if two digit are on the same pad; in that case we sum
+               // the two or more digits
+               Bool_t overlap = CheckOverlap(vol, digit, tracknum);
+               if(!overlap) 
+                       new ((*fSDigits)[nSdigits++]) AliTOFdigit(tracks, vol, digit);
+               //cout << "nSdigits" << endl; 
+               } // end loop on hits for the current track
 
+            } // end loop on ntracks
 
-  TTree*  tD = gAlice->TreeD();
+         } // close if TOF switched ON
 
-  TTree* tH = gAlice->TreeH(); // pointer to the hits tree
-  Stat_t ntracks = tH->GetEntries();
+      gAlice->TreeS()->Fill();
+      gAlice->TreeS()->Print();
 
-  cout << "Total number of processed tracks in event " << gAlice->GetEvNumber() <<
-  " :" << ntracks << endl;
+    }                          //event loop
 
-  // do nothing if no tracked particles
+}
 
-  if( ntracks > 0){
+//---------------------------------------------------------------------
 
-  // ptr to the current TOF hit
-  AliTOFhit* tofHit;
+void AliTOF::Hits2SDigits()
+{
+//
+// Use the TOF SDigitizer to make TOF SDigits
+//
+//
+  //#ifdef DEBUG
+  cout<<"ALiTOF::Hits2SDigits> start...\n";
+  //#endif
   
-  // Start loop on tracks in the hits containers
-  // check for the total number of processed hits
-  Int_t totnhits   =0;
-  Int_t totndigits =0;
+  char * fileSDigits = 0 ;
+  char * fileHeader = 0;
+  AliTOFSDigitizer * sd = new AliTOFSDigitizer(fileHeader,fileSDigits) ;
 
-  if(TOF) {
+  sd->Exec("") ;
+  sd->Print("");
 
-  for (Int_t track=0; track<ntracks;track++) {
+  delete sd ;
   
-      // loop on all hits for the current track
-
-      for(tofHit=(AliTOFhit*)TOF->FirstHit(track); tofHit; tofHit=(AliTOFhit*)TOF->NextHit()) {
-        ++nhits;  
-        ++totnhits;
-
-        vol[0] = tofHit->GetSector();
-        vol[1] = tofHit->GetPlate();
-        vol[2] = tofHit->GetPadx();
-        vol[3] = tofHit->GetPadz();
-        vol[4] = tofHit->GetStrip();
-
-        // 95% of efficiency to be inserted here
-        // edge effect to be inserted here
-        // cross talk  to be inserted here
-
-        Float_t idealtime = tofHit->GetTof(); // unit s
-        idealtime *= 1.E+12;  // conversion from s to ps
-                              // fTimeRes is given usually in ps
-        Float_t tdctime   = gRandom->Gaus(idealtime, fTimeRes);        
-        digit[0] = tdctime;
-
-        // typical Landau Distribution to be inserted here
-        // instead of Gaussian Distribution
-        Float_t idealcharge = tofHit->GetEdep();
-        Float_t adccharge = gRandom->Gaus(idealcharge, fChrgRes);
-        digit[1] = adccharge;
-        Int_t tracknum = tofHit -> GetTrack();
-        tracks[0] = tracknum;
-       tracks[1] = 0;
-       tracks[2] = 0;
-
-        Bool_t overlap = CheckOverlap(vol, digit, tracknum);
-        if(!overlap) 
-        AddDigit(tracks, vol, digit);
-        ++totndigits;
-        } // end loop on hits for the current track
-
-     } // end loop on ntracks
-
-  // some statistics concerning digitization
-  cout << "Total number of processed TOF hits: " << totnhits   << endl;
-  cout << "Total number of created TOF digits: " << totndigits << endl;
-
-  } // close if TOF switched ON
-
-} // close if( ntracks > 0)
-
-
-// fill and write the branch
-
-   evNumber = gAlice->GetEvNumber();
-   char hname[30];
-   sprintf(hname,"TreeD%d",evNumber);
-
-   tD->Fill();
-
-   tD->Write(hname,TObject::kOverwrite);
-
-   // reset tree
-   gAlice->TreeD()->Reset();
 }
-
 //___________________________________________________________________________
 Bool_t AliTOF::CheckOverlap(Int_t* vol, Float_t* digit,Int_t Track)
 {
@@ -709,30 +858,54 @@ Bool_t AliTOF::CheckOverlap(Int_t* vol, Float_t* digit,Int_t Track)
 // Checks if 2 or more hits belong to the same pad.
 // In this case the data assigned to the digit object
 // are the ones of the first hit in order of Time.
-//
-// Called only by Hits2Digits.
+// 2 hits from the same track on the same pad are collected.
+// Called only by Hits2SDigits.
+// This procedure has to be optimized in the next TOF release.
 //
 
-        Bool_t overlap = 0;
+//        Bool_t overlap = 0;
+        Bool_t overlap = kFALSE;
         Int_t  vol2[5];
 
-        for (Int_t ndig=0; ndig<fNdigits; ndig++){
-          AliTOFdigit* currentDigit = (AliTOFdigit*)(fDigits->UncheckedAt(ndig));
+        for (Int_t ndig=0; ndig<fSDigits->GetEntries(); ndig++){
+          AliTOFdigit* currentDigit = (AliTOFdigit*)(fSDigits->UncheckedAt(ndig));
            currentDigit->GetLocation(vol2);
-           Bool_t idem=1;
+//           Bool_t idem=1;
+           Bool_t idem= kTRUE;
+          // check on digit volume
            for (Int_t i=0;i<=4;i++){
-               if (vol[i]!=vol2[i]) idem=0;}
-           if (idem){
+              if (!idem) break;
+               if (vol[i]!=vol2[i]) idem=kFALSE;}
+
+           if (idem){  // same pad fired
              Float_t tdc2 = digit[0];
               Float_t tdc1 = currentDigit->GetTdc();
-              if (tdc1>tdc2){
-                  currentDigit->SetTdc(tdc2); 
-                  currentDigit->SetAdc(digit[1]);
-              }
-              currentDigit->AddTrack(Track);
-              overlap = 1;
-           }
-        }
+
+             // we separate two digits on the same pad if
+             // they are separated in time by at least 25 ns
+             // remember that tdc time is given in ps
+
+              if (TMath::Abs(tdc1-tdc2)<25000){
+                 // in case of overlap we take the earliest
+                 if (tdc1>tdc2){
+                   currentDigit->SetTdc(tdc2); 
+                   currentDigit->SetAdc(digit[1]);
+                 }
+                 else {
+                  currentDigit->SetTdc(tdc1);
+                  currentDigit->SetAdc(digit[1]);
+                 }
+                  currentDigit->AddTrack(Track); // add track number in the track array
+//               cout << "found overlap" << endl;
+//                  overlap = 1;
+                  overlap = kTRUE;
+
+              } // if (TMath:: ...)
+
+           } // close if (idem) -> two digits on the same TOF pad
+
+        } // end loop on existing sdigits
+
         return overlap;
 }
 
index 04b4ef9..1228d8e 100644 (file)
@@ -22,17 +22,20 @@ class TDirectory;
 class TString ;  
 class TTask ;
 class TFolder ;
+class AliTOFMerger;
 
 #include "TObject.h"
 #include "TTree.h" 
 #include "AliDetector.h"
 #include <iostream.h>
+#include "AliTOFMerger.h"
+#include "AliTOFSDigitizer.h"
+
 
 class AliTOF : public AliDetector {
 public:
   AliTOF(); 
   AliTOF(const char *name, const char *title);
-//  virtual        ~AliTOF() {} 
   virtual ~AliTOF() ;
 // getters for AliTOF object status
   Int_t GetNStripA() const {return fNStripA;}
@@ -41,13 +44,18 @@ public:
   Int_t GetNpadX()   const {return fNpadX;}
   Int_t GetNpadZ()   const {return fNpadZ;}
   Int_t GetPadXStr() const {return fPadXStr;}
+  Float_t GetTimeRes() const {return fTimeRes;}
+  Float_t GetChrgRes() const {return fChrgRes;}
 
+  virtual void    SetTreeAddress();
   virtual void    AddHit(Int_t track, Int_t* vol, Float_t* hits);
   virtual void    AddDigit(Int_t* tracks, Int_t* vol, Float_t* digits);
+  virtual void    AddSDigit(Int_t* tracks, Int_t* vol, Float_t* digits);
   virtual void    CreateGeometry();
   virtual void    CreateMaterials();
   virtual void    Init();
-  virtual void    MakeBranch(Option_t* option, const char *file=0);
+//  virtual void    MakeBranch(Option_t* option, const char *file=0);
+  virtual void    MakeBranch(Option_t *opt=" ",const char *file=0);
   virtual void    Makehits(Bool_t hits=1);
   virtual void    FinishEvent();
   virtual Int_t   IsVersion() const =0;
@@ -56,19 +64,35 @@ public:
   virtual void    TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC,
                         Float_t zlenB, Float_t zlenA, Float_t ztof0){}
   virtual void    DrawModule() const;
+  virtual void    DrawDetectorModules()=0;
+  virtual void    DrawDetectorStrips()=0;
+//  virtual void   DrawDetectorModulesinFrame()=0;
+//  virtual void   DrawDetectorStripsinFrame()=0;
           void    CreateTOFFolders();
+  Bool_t    CheckOverlap(Int_t* vol, Float_t* digit, Int_t Track);
   virtual void    SDigits2Digits();
-  virtual void    Hits2Digits();   
-  virtual void    Hits2SDigits(){cout << "AliTOF::Hits2SDigits() dummy function called" << endl;}
+  virtual void    SetMerger(AliTOFMerger* merger);
+  virtual AliTOFMerger* Merger();
+//  virtual void    Hits2Digits();   
+  virtual void    TOFHits2SDigits();
+  virtual void    Hits2SDigits();
   virtual void    Digits2Reco() {cout << "AliTOF::Digits2Reco()  dummy function called" << endl;}
           void    Digits2Raw (Int_t evNumber=0);
           void    Raw2Digits (Int_t evNumber=0);
+  virtual void    ResetHits();
+  virtual void    ResetDigits();
+  TClonesArray *SDigits() const {return fSDigits;}
+  TClonesArray *ReconParticles() const {return fReconParticles;}
+  Int_t   fNevents ;        // Number of events to digitize
 
 protected:
   TFolder* fFGeom ;       //  Folder that holds the Geometry definition
   TTask*   fDTask ;       //  TOF Digitizer container
   TTask*   fReTask;       //  TOF Reconstructioner container
   TClonesArray* fSDigits; // List of summable digits
+  Int_t    fNSDigits;           // Number of sdigits
+  TClonesArray* fReconParticles; // List of reconstructed particles
+  AliTOFMerger *fMerger;   // ! pointer to merger
   Int_t   fNTof;  // number of TOF sectors
   Float_t fRmax;  // upper bound for radial extension of TOF detector
   Float_t fRmin;  // lower bound for radial extension of TOF detector
@@ -101,9 +125,8 @@ protected:
   Int_t   fIdSens;     // the unique numeric identifier for sensitive volume FPAD 
 
 private:
-  Bool_t    CheckOverlap(Int_t* vol, Float_t* digit, Int_t Track);
 
-  ClassDef(AliTOF,2)  // Time Of Flight base class
+  ClassDef(AliTOF,3)  // Time Of Flight base class
 };
  
 #endif /* ALITOF_H */
diff --git a/TOF/AliTOFMerger.cxx b/TOF/AliTOFMerger.cxx
new file mode 100644 (file)
index 0000000..14f8c74
--- /dev/null
@@ -0,0 +1,88 @@
+/**************************************************************************
+ * Copyright(c) 1998-2000, ALICE Experiment at CERN, All rights reserved. *
+ *                                                                        *
+ * Author: The ALICE Off-line Project.                                    *
+ * Contributors are mentioned in the code where appropriate.              *
+ *                                                                        *
+ * Permission to use, copy, modify and distribute this software and its   *
+ * documentation strictly for non-commercial purposes is hereby granted   *
+ * without fee, provided that the above copyright notice appears in all   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appear in the supporting documentation. The authors make no claims     *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+
+
+#include <TTree.h> 
+#include <TVector.h>
+#include <TObjArray.h>
+#include <TFile.h>
+#include <TDirectory.h>
+
+
+#include "AliTOFMerger.h"
+#include "AliTOF.h"
+#include "AliTOFSDigitizer.h"
+#include "AliTOFhit.h"
+#include "AliTOFdigit.h"
+
+#include "AliRun.h"
+#include "AliPDG.h"
+
+#include <stdlib.h>
+#include <iostream.h>
+#include <fstream.h>
+
+ClassImp(AliTOFMerger)
+
+//___________________________________________
+  AliTOFMerger::AliTOFMerger() 
+{
+// Default constructor    
+    fEvNrSig = 0;
+    fEvNrBgr = 0;
+    fMerge =kDigitize;
+    fFnBgr   = 0;
+}
+
+//------------------------------------------------------------------------
+AliTOFMerger::~AliTOFMerger()
+{
+// Destructor
+  if(fSDigits)  {
+    fSDigits->Delete();
+    delete fSDigits ;
+    fSDigits = 0;
+  }
+}
+
+
+//------------------------------------------------------------------------
+void AliTOFMerger::Init()
+{
+// Initialisation
+    if (fMerge) fBgrFile = InitBgr();
+    
+}
+
+
+
+//------------------------------------------------------------------------
+TFile* AliTOFMerger::InitBgr()
+{
+// Initialise background event
+    TFile *file = new TFile(fFnBgr);
+// add error checking later
+    printf("\n AliTOFMerger has opened %s file with background event \n", fFnBgr);
+    return file;
+}
+
+//------------------------------------------------------------------------
+void AliTOFMerger::Digitise()
+{
+
+#ifdef DEBUG
+  cout<<"ALiTOFMerger::>SDigits2Digits start...\n";
+#endif
+}
diff --git a/TOF/AliTOFMerger.h b/TOF/AliTOFMerger.h
new file mode 100644 (file)
index 0000000..5114908
--- /dev/null
@@ -0,0 +1,60 @@
+#ifndef ALITOFMERGER_H
+#define ALITOFMERGER_H
+/* Copyright(c) 1998-2000, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+// #include "AliMerger.h"
+// #include "AliMergable.h"
+#include "TRandom.h"
+#include "AliDetector.h"
+
+typedef enum {kDigitize=0, kMerge = 1} MergeMode_t;
+
+class AliTOFMerger {
+ public:
+  
+  AliTOFMerger();
+  virtual ~AliTOFMerger();
+  
+  
+  // Initialize merging and digitisation
+  virtual void Init();
+  
+  // Do the main work
+  void Digitise() ;
+  //  Int_t PutEdgeEffect(Int_t charge){return (Int_t)(gRandom->Gaus(charge,500));}
+  TClonesArray *SDigits() const {return fSDigits;}
+  //  void ReadDigit(Int_t a[][30][150], Int_t);
+  
+  // Setters -> Later Communication with gAlice 
+  void SetSignalEventNumber(Int_t i)     {fEvNrSig = i;}
+  void SetBackgroundEventNumber(Int_t i) {fEvNrBgr = i;}    
+  void SetBackgroundFileName(char* file) {fFnBgr = file;}        
+  void SetSignalFileName(char* file)     {fFnSig = file;}        
+  void SetMode(MergeMode_t mode) {fMerge = mode;}
+
+       
+    enum {kBgTag = -1};
+      
+ private:    
+    // Open the bgr file
+    TFile *InitBgr();
+
+   
+ private:
+    TClonesArray *fDigits;               // ! array with digits
+    TClonesArray *fSDigits      ; // List of summable digits
+    Int_t fEvNrSig;                 // signal     event number
+    Int_t fEvNrBgr;                 // background event number    
+    MergeMode_t fMerge;             // merging type kDigitize, kMerge
+    char  *fFnBgr;                  // background file name
+    char  *fFnSig;                  // signal file name
+    TFile *fBgrFile;                // Pointer to background file
+    
+    ClassDef(AliTOFMerger,0)
+};    
+#endif
+
+
+
diff --git a/TOF/AliTOFSDigitizer.cxx b/TOF/AliTOFSDigitizer.cxx
new file mode 100644 (file)
index 0000000..94a8a6b
--- /dev/null
@@ -0,0 +1,253 @@
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ *                                                                        *
+ * Author: The ALICE Off-line Project.                                    *
+ * Contributors are mentioned in the code where appropriate.              *
+ *                                                                        *
+ * Permission to use, copy, modify and distribute this software and its   *
+ * documentation strictly for non-commercial purposes is hereby granted   *
+ * without fee, provided that the above copyright notice appears in all   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appear in the supporting documentation. The authors make no claims     *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+
+//_________________________________________________________________________
+// This is a TTask that constructs SDigits out of Hits
+// A Summable Digits is the sum of all hits in a pad
+// 
+//
+//-- Author: F. Pierella
+//////////////////////////////////////////////////////////////////////////////
+
+
+#include "TTask.h"
+#include "TTree.h"
+#include "TSystem.h"
+#include "TFile.h"
+
+#include "AliTOFdigit.h"
+#include "AliTOFhit.h"
+#include "AliTOF.h"
+#include "AliTOFv1.h"
+#include "AliTOFv2.h"
+#include "AliTOFv3.h"
+#include "AliTOFv4.h"
+#include "AliTOFSDigitizer.h"
+#include "AliRun.h"
+#include "AliDetector.h"
+#include "AliMC.h"
+
+#include "TFile.h"
+#include "TTask.h"
+#include "TTree.h"
+#include "TSystem.h"
+#include "TROOT.h"
+#include "TFolder.h"
+#include <stdlib.h>
+#include <iostream.h>
+#include <fstream.h>
+
+ClassImp(AliTOFSDigitizer)
+
+//____________________________________________________________________________ 
+  AliTOFSDigitizer::AliTOFSDigitizer():TTask("AliTOFSDigitizer","") 
+{
+  // ctor
+  fNevents = 0 ;     
+  fSDigits = 0 ;
+  fHits = 0 ;
+
+}
+           
+//____________________________________________________________________________ 
+  AliTOFSDigitizer::AliTOFSDigitizer(char* HeaderFile,char *SdigitsFile ):TTask("AliTOFSDigitizer","") 
+{
+  fNevents = 0 ;     // Number of events to digitize, 0 means all evens in current file
+  // add Task to //root/Tasks folder
+  TTask * roottasks = (TTask*)gROOT->GetRootFolder()->FindObject("Tasks") ; 
+  roottasks->Add(this) ; 
+}
+
+//____________________________________________________________________________ 
+  AliTOFSDigitizer::~AliTOFSDigitizer()
+{
+  // dtor
+}
+
+//____________________________________________________________________________
+void AliTOFSDigitizer::Exec(Option_t *option) { 
+
+
+  // Initialise Hit array
+  fHits = new TClonesArray ("AliTOFhit", 1000);
+  fSDigits = new TClonesArray ("AliTOFdigit", 1000);
+
+  AliTOF *TOF = (AliTOF *) gAlice->GetDetector ("TOF");
+
+  if (fNevents == 0)
+    fNevents = (Int_t) gAlice->TreeE ()->GetEntries ();
+
+  for (Int_t ievent = 0; ievent < fNevents; ievent++)
+    {
+      gAlice->GetEvent (ievent);
+      if (gAlice->TreeH () == 0)
+       return;
+      if (gAlice->TreeS () == 0)
+       gAlice->MakeTree ("S");
+
+      
+            //Make branches
+      char branchname[20];
+       sprintf (branchname, "%s", TOF->GetName ());
+      //Make branch for digits
+        TOF->MakeBranch ("S");
+    
+       //Now made SDigits from hits
+
+      Int_t    tracks[3];    // track info
+      Int_t    vol[5];       // location for a digit
+      Float_t  digit[2];     // TOF digit variables
+      Int_t hit, nbytes;
+      TParticle *particle;
+      AliTOFhit *tofHit;
+      TClonesArray *TOFhits = TOF->Hits();
+
+
+      // Event ------------------------- LOOP  
+
+
+      if (TOF)
+       {
+         TOFhits = TOF->Hits ();
+         TTree *TH = gAlice->TreeH ();
+         Stat_t ntracks = TH->GetEntries ();
+         for (Int_t track = 0; track < ntracks; track++)
+           {
+             gAlice->ResetHits ();
+             nbytes += TH->GetEvent (track);
+             particle = gAlice->Particle (track);
+             Int_t nhits = TOFhits->GetEntriesFast ();
+
+             for (hit = 0; hit < nhits; hit++)
+               {
+                 tofHit = (AliTOFhit *) TOFhits->UncheckedAt(hit);
+               vol[0] = tofHit->GetSector();
+               vol[1] = tofHit->GetPlate();
+               vol[2] = tofHit->GetPadx();
+               vol[3] = tofHit->GetPadz();
+               vol[4] = tofHit->GetStrip();
+
+               // 95% of efficiency to be inserted here
+               // edge effect to be inserted here
+               // cross talk  to be inserted here
+
+               Float_t idealtime = tofHit->GetTof(); // unit s
+               idealtime *= 1.E+12;  // conversion from s to ps
+                              // fTimeRes is given usually in ps
+//             Float_t tdctime   = gRandom->Gaus(idealtime, fTimeRes); 
+               Float_t tdctime   = gRandom->Gaus(idealtime, TOF->GetTimeRes());        
+               digit[0] = tdctime;
+
+               // typical Landau Distribution to be inserted here
+               // instead of Gaussian Distribution
+               Float_t idealcharge = tofHit->GetEdep();
+//             Float_t adccharge = gRandom->Gaus(idealcharge, fChrgRes);
+               Float_t adccharge = gRandom->Gaus(idealcharge, TOF->GetChrgRes());
+               digit[1] = adccharge;
+               Int_t tracknum = tofHit->GetTrack();
+               tracks[0] = tracknum;
+               tracks[1] = 0;
+               tracks[2] = 0;
+
+               // check if two digit are on the same pad; in that case we sum
+               // the two or more digits
+//             Bool_t overlap = AliTOF::CheckOverlap(vol, digit, tracknum);
+               Bool_t overlap = TOF->CheckOverlap(vol, digit, tracknum);
+               if(!overlap) 
+                 //                    new ((*fSDigits)[nSdigits++]) AliTOFdigit(tracks, vol, digit);
+                 TOF->AddSDigit(tracks, vol, digit);
+               cout << "nSdigits" << endl; 
+               } // end loop on hits for the current track
+
+            } // end loop on ntracks
+
+         } // close if TOF switched ON
+      
+      gAlice->TreeS()->Reset();
+      gAlice->TreeS()->Fill();
+      gAlice->TreeS()->Write(0,TObject::kOverwrite) ;
+    }                          //event loop
+
+
+}
+//__________________________________________________________________
+void AliTOFSDigitizer::SetSDigitsFile(char * file ){
+  if(!fSDigitsFile.IsNull())
+    cout << "Changing SDigits file from " <<(char *)fSDigitsFile.Data() << " to " << file << endl ;
+  fSDigitsFile=file ;
+}
+//__________________________________________________________________
+void AliTOFSDigitizer::Print(Option_t* option)const
+{
+  cout << "------------------- "<< GetName() << " -------------" << endl ;
+  if(fSDigitsFile.IsNull())
+    cout << " Writing SDigitis to file galice.root "<< endl ;
+  else
+    cout << "    Writing SDigitis to file  " << (char*) fSDigitsFile.Data() << endl ;
+
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/TOF/AliTOFSDigitizer.h b/TOF/AliTOFSDigitizer.h
new file mode 100644 (file)
index 0000000..3e49bba
--- /dev/null
@@ -0,0 +1,52 @@
+#ifndef ALITOFSDigitizer_H
+#define ALITOFSDigitizer_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+
+//_________________________________________________________________________
+//  Task Class for making SDigits in TOF      
+//                  
+//-- Author: F. Pierella
+
+
+#include "TTask.h"
+#include "TString.h"
+#include "AliTOF.h"
+#include "AliDetector.h"
+
+class AliTOFSDigitizer: public TTask {
+
+public:
+  AliTOFSDigitizer() ;          // ctor
+  AliTOFSDigitizer(char* HeaderFile,char *SdigitsFile = 0) ; 
+
+  virtual ~AliTOFSDigitizer() ; // dtor
+  // Int_t    Digitize(Float_t Energy);
+
+  char *GetSDigitsFile()const{return (char*) fSDigitsFile.Data();}  
+  virtual void  Exec(Option_t *option); 
+  void SetNEvents(Int_t Nevents){fNevents = Nevents;}
+  Stat_t GetNEvents(){return fNevents;}
+  void SetSDigitsFile(char * file ) ;
+  virtual void Print(Option_t* option) const ;
+  TClonesArray *SDigits() const {return fSDigits;}
+  TClonesArray *Hits() const {return fHits;}
+
+
+
+private:
+  Int_t   fNevents ;        // Number of events to digitize
+  TString fSDigitsFile ;    //output file 
+  TClonesArray *fSDigits      ; // List of summable digits
+  TClonesArray *fHits      ; // List of summable digits
+  TString fHeadersFile ;    //input file
+
+ protected:
+
+
+  ClassDef(AliTOFSDigitizer,1)  // description 
+
+};
+
+#endif // AliTOFSDigitizer_H
index 32362f4..98352d5 100644 (file)
@@ -146,16 +146,16 @@ Int_t AliTOFdigit::GetTotPad() const
 void AliTOFdigit::AddTrack(Int_t track)
 {
 //
-// Add a track to the digit 
-//
-
-  if (fTracks[1]==0){
-     fTracks[1] = track;
-  }else if (fTracks[2]==0){
-     fTracks[2] = track;
-  }else{
-  //   printf("AliTOFdigit::AddTrack ERROR: Too many Tracks (>3) \n");
-  }
+// Add a new and different track to the digit 
+//
+  if (track==fTracks[0] || track==fTracks[1] || track==fTracks[2]) return;
+   if (fTracks[1]==0){
+      fTracks[1] = track;
+   }else if (fTracks[2]==0){
+      fTracks[2] = track;
+   }else{
+   // printf("AliTOFdigit::AddTrack ERROR: Too many Tracks (>3) \n");
+   }
 }
 
 // Overloading of Streaming, Sum and Comparison operators
index af29861..d0561ef 100644 (file)
@@ -15,6 +15,9 @@
 
 /*
 $Log$
+Revision 1.22  2001/09/20 15:54:22  vicinanz
+Updated Strip Structure (Double Stack)
+
 Revision 1.21  2001/08/28 08:45:59  vicinanz
 TTask and TFolder structures implemented
 
@@ -133,31 +136,7 @@ AliTOFv0::AliTOFv0(const char *name, const char *title)
 }
 
 //____________________________________________________________________________
-AliTOFv0::~AliTOFv0()
-{
-  // destructor
-
-  if ( fHits) {
-    fHits->Delete() ; 
-    delete fHits ;
-    fHits = 0 ; 
-  }
 
-  if ( fSDigits) {
-    fSDigits->Delete() ; 
-    delete fSDigits ;
-    fSDigits = 0 ; 
-  }
-
-  if ( fDigits) {
-    fDigits->Delete() ; 
-    delete fDigits ;
-    fDigits = 0 ; 
-  }
-  
-}
-
-//_____________________________________________________________________________
 void AliTOFv0::BuildGeometry()
 {
   //
@@ -733,7 +712,7 @@ fp */
 void AliTOFv0::DrawModule() const
 {
   //
-  // Draw a shaded view of the Time Of Flight version 1
+  // Draw a shaded view of the Time Of Flight version 0
   //
   // Set everything unseen
   gMC->Gsatt("*", "seen", -1);
@@ -777,6 +756,195 @@ void AliTOFv0::DrawModule() const
   gMC->Gdman(18, 4, "MAN");
   gMC->Gdopt("hide","off");
 }
+//_____________________________________________________________________________
+void AliTOFv0::DrawDetectorModules()
+{
+//
+// Draw a shaded view of the TOF detector version 0
+//
+ AliMC* pMC = AliMC::GetMC();
+//Set ALIC mother transparent
+ pMC->Gsatt("ALIC","SEEN",0);
+
+//
+//Set volumes visible
+// 
+//=====> Level 1
+  // Level 1 for TOF volumes
+  gMC->Gsatt("B077","seen",0);
+//==========> Level 2
+  // Level 2
+  gMC->Gsatt("B076","seen",-1); // all B076 sub-levels skipped -
+  gMC->Gsatt("B071","seen",0);
+  gMC->Gsatt("B074","seen",0);
+  gMC->Gsatt("B075","seen",0);
+  gMC->Gsatt("B080","seen",0); // B080 does not has sub-level                
+
+
+  // Level 2 of B071
+  gMC->Gsatt("B063","seen",-1); // all B063 sub-levels skipped   -
+  gMC->Gsatt("B065","seen",-1); // all B065 sub-levels skipped   -
+  gMC->Gsatt("B067","seen",-1); // all B067 sub-levels skipped   -
+  gMC->Gsatt("B069","seen",-1); // all B069 sub-levels skipped   -
+  gMC->Gsatt("B056","seen",0);  // B056 does not has sub-levels  -
+  gMC->Gsatt("B059","seen",-1); // all B059 sub-levels skipped   -
+  gMC->Gsatt("B072","seen",-1); // all B072 sub-levels skipped   -
+  gMC->Gsatt("BTR1","seen",0);  // BTR1 do not have sub-levels   -
+  gMC->Gsatt("BTO1","seen",0);
+
+  // Level 2 of B074
+  gMC->Gsatt("BTR2","seen",0); // BTR2 does not has sub-levels -
+  gMC->Gsatt("BTO2","seen",0);
+
+  // Level 2 of B075
+  gMC->Gsatt("BTR3","seen",0); // BTR3 do not have sub-levels -
+  gMC->Gsatt("BTO3","seen",0);
+
+// ==================> Level 3
+  // Level 3 of B071 / Level 2 of BTO1
+  gMC->Gsatt("FTOC","seen",-2);
+  gMC->Gsatt("FTOB","seen",-2);
+  gMC->Gsatt("FTOA","seen",-2);
+  // Level 3 of B074 / Level 2 of BTO2
+  // -> cfr previous settings
+  // Level 3 of B075 / Level 2 of BTO3
+  // -> cfr previous settings
+
+  gMC->Gdopt("hide","on");
+  gMC->Gdopt("shad","on");
+  gMC->Gsatt("*", "fill", 5);
+  gMC->SetClipBox(".");
+  gMC->SetClipBox("*", 0, 1000, 0, 1000, 0, 1000);
+  gMC->DefaultRange();
+  gMC->Gdraw("alic", 45, 40, 0, 10, 10, .015, .015);
+  gMC->Gdhead(1111,"TOF detector V1");
+  gMC->Gdman(18, 4, "MAN");
+  gMC->Gdopt("hide","off");
+}                                 
+
+//_____________________________________________________________________________
+void AliTOFv0::DrawDetectorStrips()
+{
+//
+// Draw a shaded view of the TOF strips for version 0
+//
+ AliMC* pMC = AliMC::GetMC();
+//Set ALIC mother transparent
+ pMC->Gsatt("ALIC","SEEN",0);
+
+//
+//Set volumes visible 
+//=====> Level 1
+  // Level 1 for TOF volumes
+  gMC->Gsatt("B077","seen",0);
+  
+//==========> Level 2
+  // Level 2
+  gMC->Gsatt("B076","seen",-1); // all B076 sub-levels skipped -
+  gMC->Gsatt("B071","seen",0);
+  gMC->Gsatt("B074","seen",0);
+  gMC->Gsatt("B075","seen",0);
+  gMC->Gsatt("B080","seen",0); // B080 does not has sub-level
+
+  // Level 2 of B071
+  gMC->Gsatt("B063","seen",-1); // all B063 sub-levels skipped   -
+  gMC->Gsatt("B065","seen",-1); // all B065 sub-levels skipped   -
+  gMC->Gsatt("B067","seen",-1); // all B067 sub-levels skipped   -
+  gMC->Gsatt("B069","seen",-1); // all B069 sub-levels skipped   -
+  gMC->Gsatt("B056","seen",0);  // B056 does not has sub-levels  -
+  gMC->Gsatt("B059","seen",-1); // all B059 sub-levels skipped   -
+  gMC->Gsatt("B072","seen",-1); // all B072 sub-levels skipped   -
+  gMC->Gsatt("BTR1","seen",0);  // BTR1 do not have sub-levels   -
+  gMC->Gsatt("BTO1","seen",0);
+
+// ==================> Level 3
+  // Level 3 of B071 / Level 2 of BTO1
+  gMC->Gsatt("FTOC","seen",0);
+  gMC->Gsatt("FTOB","seen",0);
+  gMC->Gsatt("FTOA","seen",0);
+  // Level 3 of B074 / Level 2 of BTO2
+  // -> cfr previous settings
+  // Level 3 of B075 / Level 2 of BTO3
+  // -> cfr previous settings
+
+
+// ==========================> Level 4
+  // Level 4 of B071 / Level 3 of BTO1 / Level 2 of FTOC
+  gMC->Gsatt("FLTC","seen",0);
+  // Level 4 of B071 / Level 3 of BTO1 / Level 2 of FTOB
+  gMC->Gsatt("FLTB","seen",0);
+  // Level 4 of B071 / Level 3 of BTO1 / Level 2 of FTOA
+  gMC->Gsatt("FLTA","seen",0);
+  // Level 4 of B074 / Level 3 of BTO2 / Level 2 of FTOC
+  // -> cfr previous settings
+  // Level 4 of B074 / Level 3 of BTO2 / Level 2 of FTOB
+  // -> cfr previous settings
+  // Level 4 of B075 / Level 3 of BTO3 / Level 2 of FTOC
+  // -> cfr previous settings
+
+//======================================> Level 5
+  // Level 5 of B071 / Level 4 of BTO1 / Level 3 of FTOC / Level 2 of FLTC
+  gMC->Gsatt("FALC","seen",0); // no children for FALC
+  gMC->Gsatt("FSTR","seen",-2);
+  gMC->Gsatt("FPEC","seen",0); // no children for FPEC
+  gMC->Gsatt("FECC","seen",0); // no children for FECC
+  gMC->Gsatt("FWAC","seen",0); // no children for FWAC
+  gMC->Gsatt("FAIC","seen",0); // no children for FAIC
+
+  // Level 5 of B071 / Level 4 of BTO1 / Level 3 of FTOB / Level 2 of FLTB
+  gMC->Gsatt("FALB","seen",0); // no children for FALB
+//-->  gMC->Gsatt("FSTR","seen",-2);
+
+
+  // -> cfr previous settings
+  gMC->Gsatt("FPEB","seen",0); // no children for FPEB
+  gMC->Gsatt("FECB","seen",0); // no children for FECB
+  gMC->Gsatt("FWAB","seen",0); // no children for FWAB
+  gMC->Gsatt("FAIB","seen",0); // no children for FAIB
+  // Level 5 of B071 / Level 4 of BTO1 / Level 3 of FTOA / Level 2 of FLTA
+  gMC->Gsatt("FALA","seen",0); // no children for FALB
+//-->  gMC->Gsatt("FSTR","seen",-2);
+  // -> cfr previous settings
+  gMC->Gsatt("FPEA","seen",0); // no children for FPEA
+  gMC->Gsatt("FECA","seen",0); // no children for FECA
+  gMC->Gsatt("FWAA","seen",0); // no children for FWAA
+  gMC->Gsatt("FAIA","seen",0); // no children for FAIA
+
+  // Level 2 of B074
+  gMC->Gsatt("BTR2","seen",0); // BTR2 does not has sub-levels -
+  gMC->Gsatt("BTO2","seen",0);
+
+  // Level 2 of B075
+  gMC->Gsatt("BTR3","seen",0); // BTR3 do not have sub-levels -
+  gMC->Gsatt("BTO3","seen",0);
+
+// for others Level 5, cfr. previous settings
+
+  gMC->Gdopt("hide","on");
+  gMC->Gdopt("shad","on");
+  gMC->Gsatt("*", "fill", 5);
+  gMC->SetClipBox(".");
+  gMC->SetClipBox("*", 0, 1000, 0, 1000, 0, 1000);
+  gMC->DefaultRange();
+  gMC->Gdraw("alic", 45, 40, 0, 10, 10, .015, .015);
+  gMC->Gdhead(1111,"TOF Strips V1");
+  gMC->Gdman(18, 4, "MAN");
+  gMC->Gdopt("hide","off");
+}
 
 //_____________________________________________________________________________
 void AliTOFv0::CreateMaterials()
index 92e15ec..b1650a7 100644 (file)
@@ -20,7 +20,7 @@ class AliTOFv0 : public AliTOF {
 public:
   AliTOFv0();
   AliTOFv0(const char *name, const char *title);
-  virtual ~AliTOFv0(void) ;
+  virtual ~AliTOFv0() {}
   virtual void   BuildGeometry();
   virtual void   CreateGeometry();
   virtual void   CreateMaterials();
@@ -30,6 +30,10 @@ public:
                        Float_t zlenA,Float_t ztof0);
   virtual void   StepManager();
   virtual void   DrawModule() const;
+  virtual void   DrawDetectorModules();
+  virtual void   DrawDetectorStrips();
+//  virtual void   DrawDetectorModulesinFrame();
+//  virtual void   DrawDetectorStripsinFrame();
 
 private:
   Int_t fIdFTOA; // FTOA volume identifier (outer plate A)
index 3629c09..c2aa56b 100644 (file)
@@ -15,6 +15,9 @@
 
 /*
 $Log$
+Revision 1.23  2001/09/20 15:54:22  vicinanz
+Updated Strip Structure (Double Stack)
+
 Revision 1.22  2001/08/28 08:45:59  vicinanz
 TTask and TFolder structures implemented
 
@@ -142,31 +145,7 @@ AliTOFv1::AliTOFv1(const char *name, const char *title)
 }
 
 //____________________________________________________________________________
-AliTOFv1::~AliTOFv1()
-{
-  // destructor
-
-  if ( fHits) {
-    fHits->Delete() ; 
-    delete fHits ;
-    fHits = 0 ; 
-  }
 
-  if ( fSDigits) {
-    fSDigits->Delete() ; 
-    delete fSDigits ;
-    fSDigits = 0 ; 
-  }
-
-  if ( fDigits) {
-    fDigits->Delete() ; 
-    delete fDigits ;
-    fDigits = 0 ; 
-  }
-  
-}
-
-//_____________________________________________________________________________
 void AliTOFv1::BuildGeometry()
 {
   //
@@ -792,6 +771,195 @@ void AliTOFv1::DrawModule() const
   gMC->Gdman(18, 4, "MAN");
   gMC->Gdopt("hide","off");
 }
+//_____________________________________________________________________________
+void AliTOFv1::DrawDetectorModules()
+{
+//
+// Draw a shaded view of the TOF detector version 1
+//
+ AliMC* pMC = AliMC::GetMC();
+//Set ALIC mother transparent
+ pMC->Gsatt("ALIC","SEEN",0);
+
+//
+//Set volumes visible
+// 
+//=====> Level 1
+  // Level 1 for TOF volumes
+  gMC->Gsatt("B077","seen",0);
+//==========> Level 2
+  // Level 2
+  gMC->Gsatt("B076","seen",-1); // all B076 sub-levels skipped -
+  gMC->Gsatt("B071","seen",0);
+  gMC->Gsatt("B074","seen",0);
+  gMC->Gsatt("B075","seen",0);
+  gMC->Gsatt("B080","seen",0); // B080 does not has sub-level                
+
+
+  // Level 2 of B071
+  gMC->Gsatt("B063","seen",-1); // all B063 sub-levels skipped   -
+  gMC->Gsatt("B065","seen",-1); // all B065 sub-levels skipped   -
+  gMC->Gsatt("B067","seen",-1); // all B067 sub-levels skipped   -
+  gMC->Gsatt("B069","seen",-1); // all B069 sub-levels skipped   -
+  gMC->Gsatt("B056","seen",0);  // B056 does not has sub-levels  -
+  gMC->Gsatt("B059","seen",-1); // all B059 sub-levels skipped   -
+  gMC->Gsatt("B072","seen",-1); // all B072 sub-levels skipped   -
+  gMC->Gsatt("BTR1","seen",0);  // BTR1 do not have sub-levels   -
+  gMC->Gsatt("BTO1","seen",0);
+
+  // Level 2 of B074
+  gMC->Gsatt("BTR2","seen",0); // BTR2 does not has sub-levels -
+  gMC->Gsatt("BTO2","seen",0);
+
+  // Level 2 of B075
+  gMC->Gsatt("BTR3","seen",0); // BTR3 do not have sub-levels -
+  gMC->Gsatt("BTO3","seen",0);
+
+// ==================> Level 3
+  // Level 3 of B071 / Level 2 of BTO1
+  gMC->Gsatt("FTOC","seen",-2);
+  gMC->Gsatt("FTOB","seen",-2);
+  gMC->Gsatt("FTOA","seen",-2);
+  // Level 3 of B074 / Level 2 of BTO2
+  // -> cfr previous settings
+  // Level 3 of B075 / Level 2 of BTO3
+  // -> cfr previous settings
+
+  gMC->Gdopt("hide","on");
+  gMC->Gdopt("shad","on");
+  gMC->Gsatt("*", "fill", 5);
+  gMC->SetClipBox(".");
+  gMC->SetClipBox("*", 0, 1000, 0, 1000, 0, 1000);
+  gMC->DefaultRange();
+  gMC->Gdraw("alic", 45, 40, 0, 10, 10, .015, .015);
+  gMC->Gdhead(1111,"TOF detector V1");
+  gMC->Gdman(18, 4, "MAN");
+  gMC->Gdopt("hide","off");
+}                                 
+
+//_____________________________________________________________________________
+void AliTOFv1::DrawDetectorStrips()
+{
+//
+// Draw a shaded view of the TOF strips for version 1
+//
+ AliMC* pMC = AliMC::GetMC();
+//Set ALIC mother transparent
+ pMC->Gsatt("ALIC","SEEN",0);
+
+//
+//Set volumes visible 
+//=====> Level 1
+  // Level 1 for TOF volumes
+  gMC->Gsatt("B077","seen",0);
+  
+//==========> Level 2
+  // Level 2
+  gMC->Gsatt("B076","seen",-1); // all B076 sub-levels skipped -
+  gMC->Gsatt("B071","seen",0);
+  gMC->Gsatt("B074","seen",0);
+  gMC->Gsatt("B075","seen",0);
+  gMC->Gsatt("B080","seen",0); // B080 does not has sub-level
+
+  // Level 2 of B071
+  gMC->Gsatt("B063","seen",-1); // all B063 sub-levels skipped   -
+  gMC->Gsatt("B065","seen",-1); // all B065 sub-levels skipped   -
+  gMC->Gsatt("B067","seen",-1); // all B067 sub-levels skipped   -
+  gMC->Gsatt("B069","seen",-1); // all B069 sub-levels skipped   -
+  gMC->Gsatt("B056","seen",0);  // B056 does not has sub-levels  -
+  gMC->Gsatt("B059","seen",-1); // all B059 sub-levels skipped   -
+  gMC->Gsatt("B072","seen",-1); // all B072 sub-levels skipped   -
+  gMC->Gsatt("BTR1","seen",0);  // BTR1 do not have sub-levels   -
+  gMC->Gsatt("BTO1","seen",0);
+
+// ==================> Level 3
+  // Level 3 of B071 / Level 2 of BTO1
+  gMC->Gsatt("FTOC","seen",0);
+  gMC->Gsatt("FTOB","seen",0);
+  gMC->Gsatt("FTOA","seen",0);
+  // Level 3 of B074 / Level 2 of BTO2
+  // -> cfr previous settings
+  // Level 3 of B075 / Level 2 of BTO3
+  // -> cfr previous settings
+
+
+// ==========================> Level 4
+  // Level 4 of B071 / Level 3 of BTO1 / Level 2 of FTOC
+  gMC->Gsatt("FLTC","seen",0);
+  // Level 4 of B071 / Level 3 of BTO1 / Level 2 of FTOB
+  gMC->Gsatt("FLTB","seen",0);
+  // Level 4 of B071 / Level 3 of BTO1 / Level 2 of FTOA
+  gMC->Gsatt("FLTA","seen",0);
+  // Level 4 of B074 / Level 3 of BTO2 / Level 2 of FTOC
+  // -> cfr previous settings
+  // Level 4 of B074 / Level 3 of BTO2 / Level 2 of FTOB
+  // -> cfr previous settings
+  // Level 4 of B075 / Level 3 of BTO3 / Level 2 of FTOC
+  // -> cfr previous settings
+
+//======================================> Level 5
+  // Level 5 of B071 / Level 4 of BTO1 / Level 3 of FTOC / Level 2 of FLTC
+  gMC->Gsatt("FALC","seen",0); // no children for FALC
+  gMC->Gsatt("FSTR","seen",-2);
+  gMC->Gsatt("FPEC","seen",0); // no children for FPEC
+  gMC->Gsatt("FECC","seen",0); // no children for FECC
+  gMC->Gsatt("FWAC","seen",0); // no children for FWAC
+  gMC->Gsatt("FAIC","seen",0); // no children for FAIC
+
+  // Level 5 of B071 / Level 4 of BTO1 / Level 3 of FTOB / Level 2 of FLTB
+  gMC->Gsatt("FALB","seen",0); // no children for FALB
+//-->  gMC->Gsatt("FSTR","seen",-2);
+
+
+  // -> cfr previous settings
+  gMC->Gsatt("FPEB","seen",0); // no children for FPEB
+  gMC->Gsatt("FECB","seen",0); // no children for FECB
+  gMC->Gsatt("FWAB","seen",0); // no children for FWAB
+  gMC->Gsatt("FAIB","seen",0); // no children for FAIB
+  // Level 5 of B071 / Level 4 of BTO1 / Level 3 of FTOA / Level 2 of FLTA
+  gMC->Gsatt("FALA","seen",0); // no children for FALB
+//-->  gMC->Gsatt("FSTR","seen",-2);
+  // -> cfr previous settings
+  gMC->Gsatt("FPEA","seen",0); // no children for FPEA
+  gMC->Gsatt("FECA","seen",0); // no children for FECA
+  gMC->Gsatt("FWAA","seen",0); // no children for FWAA
+  gMC->Gsatt("FAIA","seen",0); // no children for FAIA
+
+  // Level 2 of B074
+  gMC->Gsatt("BTR2","seen",0); // BTR2 does not has sub-levels -
+  gMC->Gsatt("BTO2","seen",0);
+
+  // Level 2 of B075
+  gMC->Gsatt("BTR3","seen",0); // BTR3 do not have sub-levels -
+  gMC->Gsatt("BTO3","seen",0);
+
+// for others Level 5, cfr. previous settings
+
+  gMC->Gdopt("hide","on");
+  gMC->Gdopt("shad","on");
+  gMC->Gsatt("*", "fill", 5);
+  gMC->SetClipBox(".");
+  gMC->SetClipBox("*", 0, 1000, 0, 1000, 0, 1000);
+  gMC->DefaultRange();
+  gMC->Gdraw("alic", 45, 40, 0, 10, 10, .015, .015);
+  gMC->Gdhead(1111,"TOF Strips V1");
+  gMC->Gdman(18, 4, "MAN");
+  gMC->Gdopt("hide","off");
+}
 
 //_____________________________________________________________________________
 void AliTOFv1::CreateMaterials()
index 3417a43..5f65832 100644 (file)
@@ -20,7 +20,7 @@ class AliTOFv1 : public AliTOF {
 public:
   AliTOFv1();
   AliTOFv1(const char *name, const char *title);
-  virtual ~AliTOFv1(void) ;
+  virtual ~AliTOFv1() {}
   virtual void   BuildGeometry();
   virtual void   CreateGeometry();
   virtual void   CreateMaterials();
@@ -30,6 +30,10 @@ public:
                        Float_t zlenA,Float_t ztof0);
   virtual void   StepManager();
   virtual void   DrawModule() const;
+  virtual void   DrawDetectorModules();
+  virtual void   DrawDetectorStrips();
+//  virtual void   DrawDetectorModulesinFrame();
+//  virtual void   DrawDetectorStripsinFrame();
 
 private:
   Int_t fIdFTOA; // FTOA volume identifier (outer plate A)
index 283170e..6080894 100644 (file)
@@ -15,6 +15,9 @@
 
 /*
 $Log$
+Revision 1.22  2001/09/20 15:54:22  vicinanz
+Updated Strip Structure (Double Stack)
+
 Revision 1.21  2001/08/28 08:45:59  vicinanz
 TTask and TFolder structures implemented
 
@@ -137,31 +140,7 @@ AliTOFv2::AliTOFv2(const char *name, const char *title)
 }
 
 //____________________________________________________________________________
-AliTOFv2::~AliTOFv2()
-{
-  // destructor
-
-  if ( fHits) {
-    fHits->Delete() ; 
-    delete fHits ;
-    fHits = 0 ; 
-  }
 
-  if ( fSDigits) {
-    fSDigits->Delete() ; 
-    delete fSDigits ;
-    fSDigits = 0 ; 
-  }
-
-  if ( fDigits) {
-    fDigits->Delete() ; 
-    delete fDigits ;
-    fDigits = 0 ; 
-  }
-  
-}
-
-//_____________________________________________________________________________
 void AliTOFv2::BuildGeometry()
 {
   //
@@ -758,7 +737,7 @@ fp */
 void AliTOFv2::DrawModule() const
 {
   //
-  // Draw a shaded view of the Time Of Flight version 1
+  // Draw a shaded view of the Time Of Flight version 2
   //
   // Set everything unseen
   gMC->Gsatt("*", "seen", -1);
@@ -802,6 +781,195 @@ void AliTOFv2::DrawModule() const
   gMC->Gdman(18, 4, "MAN");
   gMC->Gdopt("hide","off");
 }
+//_____________________________________________________________________________
+void AliTOFv2::DrawDetectorModules()
+{
+//
+// Draw a shaded view of the TOF detector version 2
+//
+ AliMC* pMC = AliMC::GetMC();
+//Set ALIC mother transparent
+ pMC->Gsatt("ALIC","SEEN",0);
+
+//
+//Set volumes visible
+// 
+//=====> Level 1
+  // Level 1 for TOF volumes
+  gMC->Gsatt("B077","seen",0);
+//==========> Level 2
+  // Level 2
+  gMC->Gsatt("B076","seen",-1); // all B076 sub-levels skipped -
+  gMC->Gsatt("B071","seen",0);
+  gMC->Gsatt("B074","seen",0);
+  gMC->Gsatt("B075","seen",0);
+  gMC->Gsatt("B080","seen",0); // B080 does not has sub-level                
+
+
+  // Level 2 of B071
+  gMC->Gsatt("B063","seen",-1); // all B063 sub-levels skipped   -
+  gMC->Gsatt("B065","seen",-1); // all B065 sub-levels skipped   -
+  gMC->Gsatt("B067","seen",-1); // all B067 sub-levels skipped   -
+  gMC->Gsatt("B069","seen",-1); // all B069 sub-levels skipped   -
+  gMC->Gsatt("B056","seen",0);  // B056 does not has sub-levels  -
+  gMC->Gsatt("B059","seen",-1); // all B059 sub-levels skipped   -
+  gMC->Gsatt("B072","seen",-1); // all B072 sub-levels skipped   -
+  gMC->Gsatt("BTR1","seen",0);  // BTR1 do not have sub-levels   -
+  gMC->Gsatt("BTO1","seen",0);
+
+  // Level 2 of B074
+  gMC->Gsatt("BTR2","seen",0); // BTR2 does not has sub-levels -
+  gMC->Gsatt("BTO2","seen",0);
+
+  // Level 2 of B075
+  gMC->Gsatt("BTR3","seen",0); // BTR3 do not have sub-levels -
+  gMC->Gsatt("BTO3","seen",0);
+
+// ==================> Level 3
+  // Level 3 of B071 / Level 2 of BTO1
+  gMC->Gsatt("FTOC","seen",-2);
+  gMC->Gsatt("FTOB","seen",-2);
+  gMC->Gsatt("FTOA","seen",-2);
+  // Level 3 of B074 / Level 2 of BTO2
+  // -> cfr previous settings
+  // Level 3 of B075 / Level 2 of BTO3
+  // -> cfr previous settings
+
+  gMC->Gdopt("hide","on");
+  gMC->Gdopt("shad","on");
+  gMC->Gsatt("*", "fill", 5);
+  gMC->SetClipBox(".");
+  gMC->SetClipBox("*", 0, 1000, 0, 1000, 0, 1000);
+  gMC->DefaultRange();
+  gMC->Gdraw("alic", 45, 40, 0, 10, 10, .015, .015);
+  gMC->Gdhead(1111,"TOF detector V1");
+  gMC->Gdman(18, 4, "MAN");
+  gMC->Gdopt("hide","off");
+}                                 
+
+//_____________________________________________________________________________
+void AliTOFv2::DrawDetectorStrips()
+{
+//
+// Draw a shaded view of the TOF strips for version 2
+//
+ AliMC* pMC = AliMC::GetMC();
+//Set ALIC mother transparent
+ pMC->Gsatt("ALIC","SEEN",0);
+
+//
+//Set volumes visible 
+//=====> Level 1
+  // Level 1 for TOF volumes
+  gMC->Gsatt("B077","seen",0);
+  
+//==========> Level 2
+  // Level 2
+  gMC->Gsatt("B076","seen",-1); // all B076 sub-levels skipped -
+  gMC->Gsatt("B071","seen",0);
+  gMC->Gsatt("B074","seen",0);
+  gMC->Gsatt("B075","seen",0);
+  gMC->Gsatt("B080","seen",0); // B080 does not has sub-level
+
+  // Level 2 of B071
+  gMC->Gsatt("B063","seen",-1); // all B063 sub-levels skipped   -
+  gMC->Gsatt("B065","seen",-1); // all B065 sub-levels skipped   -
+  gMC->Gsatt("B067","seen",-1); // all B067 sub-levels skipped   -
+  gMC->Gsatt("B069","seen",-1); // all B069 sub-levels skipped   -
+  gMC->Gsatt("B056","seen",0);  // B056 does not has sub-levels  -
+  gMC->Gsatt("B059","seen",-1); // all B059 sub-levels skipped   -
+  gMC->Gsatt("B072","seen",-1); // all B072 sub-levels skipped   -
+  gMC->Gsatt("BTR1","seen",0);  // BTR1 do not have sub-levels   -
+  gMC->Gsatt("BTO1","seen",0);
+
+// ==================> Level 3
+  // Level 3 of B071 / Level 2 of BTO1
+  gMC->Gsatt("FTOC","seen",0);
+  gMC->Gsatt("FTOB","seen",0);
+  gMC->Gsatt("FTOA","seen",0);
+  // Level 3 of B074 / Level 2 of BTO2
+  // -> cfr previous settings
+  // Level 3 of B075 / Level 2 of BTO3
+  // -> cfr previous settings
+
+
+// ==========================> Level 4
+  // Level 4 of B071 / Level 3 of BTO1 / Level 2 of FTOC
+  gMC->Gsatt("FLTC","seen",0);
+  // Level 4 of B071 / Level 3 of BTO1 / Level 2 of FTOB
+  gMC->Gsatt("FLTB","seen",0);
+  // Level 4 of B071 / Level 3 of BTO1 / Level 2 of FTOA
+  gMC->Gsatt("FLTA","seen",0);
+  // Level 4 of B074 / Level 3 of BTO2 / Level 2 of FTOC
+  // -> cfr previous settings
+  // Level 4 of B074 / Level 3 of BTO2 / Level 2 of FTOB
+  // -> cfr previous settings
+  // Level 4 of B075 / Level 3 of BTO3 / Level 2 of FTOC
+  // -> cfr previous settings
+
+//======================================> Level 5
+  // Level 5 of B071 / Level 4 of BTO1 / Level 3 of FTOC / Level 2 of FLTC
+  gMC->Gsatt("FALC","seen",0); // no children for FALC
+  gMC->Gsatt("FSTR","seen",-2);
+  gMC->Gsatt("FPEC","seen",0); // no children for FPEC
+  gMC->Gsatt("FECC","seen",0); // no children for FECC
+  gMC->Gsatt("FWAC","seen",0); // no children for FWAC
+  gMC->Gsatt("FAIC","seen",0); // no children for FAIC
+
+  // Level 5 of B071 / Level 4 of BTO1 / Level 3 of FTOB / Level 2 of FLTB
+  gMC->Gsatt("FALB","seen",0); // no children for FALB
+//-->  gMC->Gsatt("FSTR","seen",-2);
+
+
+  // -> cfr previous settings
+  gMC->Gsatt("FPEB","seen",0); // no children for FPEB
+  gMC->Gsatt("FECB","seen",0); // no children for FECB
+  gMC->Gsatt("FWAB","seen",0); // no children for FWAB
+  gMC->Gsatt("FAIB","seen",0); // no children for FAIB
+  // Level 5 of B071 / Level 4 of BTO1 / Level 3 of FTOA / Level 2 of FLTA
+  gMC->Gsatt("FALA","seen",0); // no children for FALB
+//-->  gMC->Gsatt("FSTR","seen",-2);
+  // -> cfr previous settings
+  gMC->Gsatt("FPEA","seen",0); // no children for FPEA
+  gMC->Gsatt("FECA","seen",0); // no children for FECA
+  gMC->Gsatt("FWAA","seen",0); // no children for FWAA
+  gMC->Gsatt("FAIA","seen",0); // no children for FAIA
+
+  // Level 2 of B074
+  gMC->Gsatt("BTR2","seen",0); // BTR2 does not has sub-levels -
+  gMC->Gsatt("BTO2","seen",0);
+
+  // Level 2 of B075
+  gMC->Gsatt("BTR3","seen",0); // BTR3 do not have sub-levels -
+  gMC->Gsatt("BTO3","seen",0);
+
+// for others Level 5, cfr. previous settings
+
+  gMC->Gdopt("hide","on");
+  gMC->Gdopt("shad","on");
+  gMC->Gsatt("*", "fill", 5);
+  gMC->SetClipBox(".");
+  gMC->SetClipBox("*", 0, 1000, 0, 1000, 0, 1000);
+  gMC->DefaultRange();
+  gMC->Gdraw("alic", 45, 40, 0, 10, 10, .015, .015);
+  gMC->Gdhead(1111,"TOF Strips V1");
+  gMC->Gdman(18, 4, "MAN");
+  gMC->Gdopt("hide","off");
+}
 
 //_____________________________________________________________________________
 void AliTOFv2::CreateMaterials()
index 7fdd3ef..68516ea 100644 (file)
@@ -20,7 +20,7 @@ class AliTOFv2 : public AliTOF {
 public:
   AliTOFv2();
   AliTOFv2(const char *name, const char *title);
-  virtual ~AliTOFv2(void) ;
+  virtual ~AliTOFv2() {}
   virtual void   BuildGeometry();
   virtual void   CreateGeometry();
   virtual void   CreateMaterials();
@@ -30,6 +30,10 @@ public:
                        Float_t zlenA,Float_t ztof0);
   virtual void   StepManager();
   virtual void   DrawModule() const;
+  virtual void   DrawDetectorModules();
+  virtual void   DrawDetectorStrips();
+//  virtual void   DrawDetectorModulesinFrame();
+//  virtual void   DrawDetectorStripsinFrame();
 
 private:
   Int_t fIdFTOA; // FTOA volume identifier (outer plate A)
index ff2125d..a818eac 100644 (file)
@@ -15,6 +15,9 @@
 
 /*
 $Log$
+Revision 1.22  2001/09/20 15:54:22  vicinanz
+Updated Strip Structure (Double Stack)
+
 Revision 1.21  2001/08/28 08:45:59  vicinanz
 TTask and TFolder structures implemented
 
@@ -136,31 +139,7 @@ AliTOFv3::AliTOFv3(const char *name, const char *title)
 }
 
 //____________________________________________________________________________
-AliTOFv3::~AliTOFv3()
-{
-  // destructor
-
-  if ( fHits) {
-    fHits->Delete() ; 
-    delete fHits ;
-    fHits = 0 ; 
-  }
 
-  if ( fSDigits) {
-    fSDigits->Delete() ; 
-    delete fSDigits ;
-    fSDigits = 0 ; 
-  }
-
-  if ( fDigits) {
-    fDigits->Delete() ; 
-    delete fDigits ;
-    fDigits = 0 ; 
-  }
-  
-}
-
-//_____________________________________________________________________________
 void AliTOFv3::BuildGeometry()
 {
   //
@@ -745,7 +724,7 @@ fp */
 void AliTOFv3::DrawModule() const
 {
   //
-  // Draw a shaded view of the Time Of Flight version 1
+  // Draw a shaded view of the Time Of Flight version 3
   //
   // Set everything unseen
   gMC->Gsatt("*", "seen", -1);
@@ -789,6 +768,195 @@ void AliTOFv3::DrawModule() const
   gMC->Gdman(18, 4, "MAN");
   gMC->Gdopt("hide","off");
 }
+//_____________________________________________________________________________
+void AliTOFv3::DrawDetectorModules()
+{
+//
+// Draw a shaded view of the TOF detector version 3
+//
+ AliMC* pMC = AliMC::GetMC();
+//Set ALIC mother transparent
+ pMC->Gsatt("ALIC","SEEN",0);
+
+//
+//Set volumes visible
+// 
+//=====> Level 1
+  // Level 1 for TOF volumes
+  gMC->Gsatt("B077","seen",0);
+//==========> Level 2
+  // Level 2
+  gMC->Gsatt("B076","seen",-1); // all B076 sub-levels skipped -
+  gMC->Gsatt("B071","seen",0);
+  gMC->Gsatt("B074","seen",0);
+  gMC->Gsatt("B075","seen",0);
+  gMC->Gsatt("B080","seen",0); // B080 does not has sub-level                
+
+
+  // Level 2 of B071
+  gMC->Gsatt("B063","seen",-1); // all B063 sub-levels skipped   -
+  gMC->Gsatt("B065","seen",-1); // all B065 sub-levels skipped   -
+  gMC->Gsatt("B067","seen",-1); // all B067 sub-levels skipped   -
+  gMC->Gsatt("B069","seen",-1); // all B069 sub-levels skipped   -
+  gMC->Gsatt("B056","seen",0);  // B056 does not has sub-levels  -
+  gMC->Gsatt("B059","seen",-1); // all B059 sub-levels skipped   -
+  gMC->Gsatt("B072","seen",-1); // all B072 sub-levels skipped   -
+  gMC->Gsatt("BTR1","seen",0);  // BTR1 do not have sub-levels   -
+  gMC->Gsatt("BTO1","seen",0);
+
+  // Level 2 of B074
+  gMC->Gsatt("BTR2","seen",0); // BTR2 does not has sub-levels -
+  gMC->Gsatt("BTO2","seen",0);
+
+  // Level 2 of B075
+  gMC->Gsatt("BTR3","seen",0); // BTR3 do not have sub-levels -
+  gMC->Gsatt("BTO3","seen",0);
+
+// ==================> Level 3
+  // Level 3 of B071 / Level 2 of BTO1
+  gMC->Gsatt("FTOC","seen",-2);
+  gMC->Gsatt("FTOB","seen",-2);
+  gMC->Gsatt("FTOA","seen",-2);
+  // Level 3 of B074 / Level 2 of BTO2
+  // -> cfr previous settings
+  // Level 3 of B075 / Level 2 of BTO3
+  // -> cfr previous settings
+
+  gMC->Gdopt("hide","on");
+  gMC->Gdopt("shad","on");
+  gMC->Gsatt("*", "fill", 5);
+  gMC->SetClipBox(".");
+  gMC->SetClipBox("*", 0, 1000, 0, 1000, 0, 1000);
+  gMC->DefaultRange();
+  gMC->Gdraw("alic", 45, 40, 0, 10, 10, .015, .015);
+  gMC->Gdhead(1111,"TOF detector V1");
+  gMC->Gdman(18, 4, "MAN");
+  gMC->Gdopt("hide","off");
+}                                 
+
+//_____________________________________________________________________________
+void AliTOFv3::DrawDetectorStrips()
+{
+//
+// Draw a shaded view of the TOF strips for version 3
+//
+ AliMC* pMC = AliMC::GetMC();
+//Set ALIC mother transparent
+ pMC->Gsatt("ALIC","SEEN",0);
+
+//
+//Set volumes visible 
+//=====> Level 1
+  // Level 1 for TOF volumes
+  gMC->Gsatt("B077","seen",0);
+  
+//==========> Level 2
+  // Level 2
+  gMC->Gsatt("B076","seen",-1); // all B076 sub-levels skipped -
+  gMC->Gsatt("B071","seen",0);
+  gMC->Gsatt("B074","seen",0);
+  gMC->Gsatt("B075","seen",0);
+  gMC->Gsatt("B080","seen",0); // B080 does not has sub-level
+
+  // Level 2 of B071
+  gMC->Gsatt("B063","seen",-1); // all B063 sub-levels skipped   -
+  gMC->Gsatt("B065","seen",-1); // all B065 sub-levels skipped   -
+  gMC->Gsatt("B067","seen",-1); // all B067 sub-levels skipped   -
+  gMC->Gsatt("B069","seen",-1); // all B069 sub-levels skipped   -
+  gMC->Gsatt("B056","seen",0);  // B056 does not has sub-levels  -
+  gMC->Gsatt("B059","seen",-1); // all B059 sub-levels skipped   -
+  gMC->Gsatt("B072","seen",-1); // all B072 sub-levels skipped   -
+  gMC->Gsatt("BTR1","seen",0);  // BTR1 do not have sub-levels   -
+  gMC->Gsatt("BTO1","seen",0);
+
+// ==================> Level 3
+  // Level 3 of B071 / Level 2 of BTO1
+  gMC->Gsatt("FTOC","seen",0);
+  gMC->Gsatt("FTOB","seen",0);
+  gMC->Gsatt("FTOA","seen",0);
+  // Level 3 of B074 / Level 2 of BTO2
+  // -> cfr previous settings
+  // Level 3 of B075 / Level 2 of BTO3
+  // -> cfr previous settings
+
+
+// ==========================> Level 4
+  // Level 4 of B071 / Level 3 of BTO1 / Level 2 of FTOC
+  gMC->Gsatt("FLTC","seen",0);
+  // Level 4 of B071 / Level 3 of BTO1 / Level 2 of FTOB
+  gMC->Gsatt("FLTB","seen",0);
+  // Level 4 of B071 / Level 3 of BTO1 / Level 2 of FTOA
+  gMC->Gsatt("FLTA","seen",0);
+  // Level 4 of B074 / Level 3 of BTO2 / Level 2 of FTOC
+  // -> cfr previous settings
+  // Level 4 of B074 / Level 3 of BTO2 / Level 2 of FTOB
+  // -> cfr previous settings
+  // Level 4 of B075 / Level 3 of BTO3 / Level 2 of FTOC
+  // -> cfr previous settings
+
+//======================================> Level 5
+  // Level 5 of B071 / Level 4 of BTO1 / Level 3 of FTOC / Level 2 of FLTC
+  gMC->Gsatt("FALC","seen",0); // no children for FALC
+  gMC->Gsatt("FSTR","seen",-2);
+  gMC->Gsatt("FPEC","seen",0); // no children for FPEC
+  gMC->Gsatt("FECC","seen",0); // no children for FECC
+  gMC->Gsatt("FWAC","seen",0); // no children for FWAC
+  gMC->Gsatt("FAIC","seen",0); // no children for FAIC
+
+  // Level 5 of B071 / Level 4 of BTO1 / Level 3 of FTOB / Level 2 of FLTB
+  gMC->Gsatt("FALB","seen",0); // no children for FALB
+//-->  gMC->Gsatt("FSTR","seen",-2);
+
+
+  // -> cfr previous settings
+  gMC->Gsatt("FPEB","seen",0); // no children for FPEB
+  gMC->Gsatt("FECB","seen",0); // no children for FECB
+  gMC->Gsatt("FWAB","seen",0); // no children for FWAB
+  gMC->Gsatt("FAIB","seen",0); // no children for FAIB
+  // Level 5 of B071 / Level 4 of BTO1 / Level 3 of FTOA / Level 2 of FLTA
+  gMC->Gsatt("FALA","seen",0); // no children for FALB
+//-->  gMC->Gsatt("FSTR","seen",-2);
+  // -> cfr previous settings
+  gMC->Gsatt("FPEA","seen",0); // no children for FPEA
+  gMC->Gsatt("FECA","seen",0); // no children for FECA
+  gMC->Gsatt("FWAA","seen",0); // no children for FWAA
+  gMC->Gsatt("FAIA","seen",0); // no children for FAIA
+
+  // Level 2 of B074
+  gMC->Gsatt("BTR2","seen",0); // BTR2 does not has sub-levels -
+  gMC->Gsatt("BTO2","seen",0);
+
+  // Level 2 of B075
+  gMC->Gsatt("BTR3","seen",0); // BTR3 do not have sub-levels -
+  gMC->Gsatt("BTO3","seen",0);
+
+// for others Level 5, cfr. previous settings
+
+  gMC->Gdopt("hide","on");
+  gMC->Gdopt("shad","on");
+  gMC->Gsatt("*", "fill", 5);
+  gMC->SetClipBox(".");
+  gMC->SetClipBox("*", 0, 1000, 0, 1000, 0, 1000);
+  gMC->DefaultRange();
+  gMC->Gdraw("alic", 45, 40, 0, 10, 10, .015, .015);
+  gMC->Gdhead(1111,"TOF Strips V1");
+  gMC->Gdman(18, 4, "MAN");
+  gMC->Gdopt("hide","off");
+}
 
 //_____________________________________________________________________________
 void AliTOFv3::CreateMaterials()
index 6627b3b..c3a6820 100644 (file)
@@ -20,7 +20,7 @@ class AliTOFv3 : public AliTOF {
 public:
   AliTOFv3();
   AliTOFv3(const char *name, const char *title);
-  virtual ~AliTOFv3(void) ;
+  virtual ~AliTOFv3() {}
   virtual void   BuildGeometry();
   virtual void   CreateGeometry();
   virtual void   CreateMaterials();
@@ -30,6 +30,10 @@ public:
                        Float_t zlenA,Float_t ztof0);
   virtual void   StepManager();
   virtual void   DrawModule() const;
+  virtual void   DrawDetectorModules();
+  virtual void   DrawDetectorStrips();
+//  virtual void   DrawDetectorModulesinFrame();
+//  virtual void   DrawDetectorStripsinFrame();
 
 private:
   Int_t fIdFTOA; // FTOA volume identifier (outer plate A) 
index 062b82c..74c4774 100644 (file)
@@ -15,6 +15,9 @@
 
 /*
 $Log$
+Revision 1.12  2001/09/20 15:54:22  vicinanz
+Updated Strip Structure (Double Stack)
+
 Revision 1.11  2001/08/28 08:45:59  vicinanz
 TTask and TFolder structures implemented
 
@@ -136,31 +139,7 @@ AliTOFv4::AliTOFv4(const char *name, const char *title)
 }
 
 //____________________________________________________________________________
-AliTOFv4::~AliTOFv4()
-{
-  // destructor
-
-  if ( fHits) {
-    fHits->Delete() ; 
-    delete fHits ;
-    fHits = 0 ; 
-  }
 
-  if ( fSDigits) {
-    fSDigits->Delete() ; 
-    delete fSDigits ;
-    fSDigits = 0 ; 
-  }
-
-  if ( fDigits) {
-    fDigits->Delete() ; 
-    delete fDigits ;
-    fDigits = 0 ; 
-  }
-  
-}
-
-//_____________________________________________________________________________
 void AliTOFv4::BuildGeometry()
 {
   //
@@ -743,7 +722,7 @@ fp */
 void AliTOFv4::DrawModule() const
 {
   //
-  // Draw a shaded view of the Time Of Flight version 1
+  // Draw a shaded view of the Time Of Flight version 4
   //
   // Set everything unseen
   gMC->Gsatt("*", "seen", -1);
@@ -787,6 +766,195 @@ void AliTOFv4::DrawModule() const
   gMC->Gdman(18, 4, "MAN");
   gMC->Gdopt("hide","off");
 }
+//_____________________________________________________________________________
+void AliTOFv4::DrawDetectorModules()
+{
+//
+// Draw a shaded view of the TOF detector version 4
+//
+ AliMC* pMC = AliMC::GetMC();
+//Set ALIC mother transparent
+ pMC->Gsatt("ALIC","SEEN",0);
+
+//
+//Set volumes visible
+// 
+//=====> Level 1
+  // Level 1 for TOF volumes
+  gMC->Gsatt("B077","seen",0);
+//==========> Level 2
+  // Level 2
+  gMC->Gsatt("B076","seen",-1); // all B076 sub-levels skipped -
+  gMC->Gsatt("B071","seen",0);
+  gMC->Gsatt("B074","seen",0);
+  gMC->Gsatt("B075","seen",0);
+  gMC->Gsatt("B080","seen",0); // B080 does not has sub-level                
+
+
+  // Level 2 of B071
+  gMC->Gsatt("B063","seen",-1); // all B063 sub-levels skipped   -
+  gMC->Gsatt("B065","seen",-1); // all B065 sub-levels skipped   -
+  gMC->Gsatt("B067","seen",-1); // all B067 sub-levels skipped   -
+  gMC->Gsatt("B069","seen",-1); // all B069 sub-levels skipped   -
+  gMC->Gsatt("B056","seen",0);  // B056 does not has sub-levels  -
+  gMC->Gsatt("B059","seen",-1); // all B059 sub-levels skipped   -
+  gMC->Gsatt("B072","seen",-1); // all B072 sub-levels skipped   -
+  gMC->Gsatt("BTR1","seen",0);  // BTR1 do not have sub-levels   -
+  gMC->Gsatt("BTO1","seen",0);
+
+  // Level 2 of B074
+  gMC->Gsatt("BTR2","seen",0); // BTR2 does not has sub-levels -
+  gMC->Gsatt("BTO2","seen",0);
+
+  // Level 2 of B075
+  gMC->Gsatt("BTR3","seen",0); // BTR3 do not have sub-levels -
+  gMC->Gsatt("BTO3","seen",0);
+
+// ==================> Level 3
+  // Level 3 of B071 / Level 2 of BTO1
+  gMC->Gsatt("FTOC","seen",-2);
+  gMC->Gsatt("FTOB","seen",-2);
+  gMC->Gsatt("FTOA","seen",-2);
+  // Level 3 of B074 / Level 2 of BTO2
+  // -> cfr previous settings
+  // Level 3 of B075 / Level 2 of BTO3
+  // -> cfr previous settings
+
+  gMC->Gdopt("hide","on");
+  gMC->Gdopt("shad","on");
+  gMC->Gsatt("*", "fill", 5);
+  gMC->SetClipBox(".");
+  gMC->SetClipBox("*", 0, 1000, 0, 1000, 0, 1000);
+  gMC->DefaultRange();
+  gMC->Gdraw("alic", 45, 40, 0, 10, 10, .015, .015);
+  gMC->Gdhead(1111,"TOF detector V1");
+  gMC->Gdman(18, 4, "MAN");
+  gMC->Gdopt("hide","off");
+}                                 
+
+//_____________________________________________________________________________
+void AliTOFv4::DrawDetectorStrips()
+{
+//
+// Draw a shaded view of the TOF strips for version 4
+//
+ AliMC* pMC = AliMC::GetMC();
+//Set ALIC mother transparent
+ pMC->Gsatt("ALIC","SEEN",0);
+
+//
+//Set volumes visible 
+//=====> Level 1
+  // Level 1 for TOF volumes
+  gMC->Gsatt("B077","seen",0);
+  
+//==========> Level 2
+  // Level 2
+  gMC->Gsatt("B076","seen",-1); // all B076 sub-levels skipped -
+  gMC->Gsatt("B071","seen",0);
+  gMC->Gsatt("B074","seen",0);
+  gMC->Gsatt("B075","seen",0);
+  gMC->Gsatt("B080","seen",0); // B080 does not has sub-level
+
+  // Level 2 of B071
+  gMC->Gsatt("B063","seen",-1); // all B063 sub-levels skipped   -
+  gMC->Gsatt("B065","seen",-1); // all B065 sub-levels skipped   -
+  gMC->Gsatt("B067","seen",-1); // all B067 sub-levels skipped   -
+  gMC->Gsatt("B069","seen",-1); // all B069 sub-levels skipped   -
+  gMC->Gsatt("B056","seen",0);  // B056 does not has sub-levels  -
+  gMC->Gsatt("B059","seen",-1); // all B059 sub-levels skipped   -
+  gMC->Gsatt("B072","seen",-1); // all B072 sub-levels skipped   -
+  gMC->Gsatt("BTR1","seen",0);  // BTR1 do not have sub-levels   -
+  gMC->Gsatt("BTO1","seen",0);
+
+// ==================> Level 3
+  // Level 3 of B071 / Level 2 of BTO1
+  gMC->Gsatt("FTOC","seen",0);
+  gMC->Gsatt("FTOB","seen",0);
+  gMC->Gsatt("FTOA","seen",0);
+  // Level 3 of B074 / Level 2 of BTO2
+  // -> cfr previous settings
+  // Level 3 of B075 / Level 2 of BTO3
+  // -> cfr previous settings
+
+
+// ==========================> Level 4
+  // Level 4 of B071 / Level 3 of BTO1 / Level 2 of FTOC
+  gMC->Gsatt("FLTC","seen",0);
+  // Level 4 of B071 / Level 3 of BTO1 / Level 2 of FTOB
+  gMC->Gsatt("FLTB","seen",0);
+  // Level 4 of B071 / Level 3 of BTO1 / Level 2 of FTOA
+  gMC->Gsatt("FLTA","seen",0);
+  // Level 4 of B074 / Level 3 of BTO2 / Level 2 of FTOC
+  // -> cfr previous settings
+  // Level 4 of B074 / Level 3 of BTO2 / Level 2 of FTOB
+  // -> cfr previous settings
+  // Level 4 of B075 / Level 3 of BTO3 / Level 2 of FTOC
+  // -> cfr previous settings
+
+//======================================> Level 5
+  // Level 5 of B071 / Level 4 of BTO1 / Level 3 of FTOC / Level 2 of FLTC
+  gMC->Gsatt("FALC","seen",0); // no children for FALC
+  gMC->Gsatt("FSTR","seen",-2);
+  gMC->Gsatt("FPEC","seen",0); // no children for FPEC
+  gMC->Gsatt("FECC","seen",0); // no children for FECC
+  gMC->Gsatt("FWAC","seen",0); // no children for FWAC
+  gMC->Gsatt("FAIC","seen",0); // no children for FAIC
+
+  // Level 5 of B071 / Level 4 of BTO1 / Level 3 of FTOB / Level 2 of FLTB
+  gMC->Gsatt("FALB","seen",0); // no children for FALB
+//-->  gMC->Gsatt("FSTR","seen",-2);
+
+
+  // -> cfr previous settings
+  gMC->Gsatt("FPEB","seen",0); // no children for FPEB
+  gMC->Gsatt("FECB","seen",0); // no children for FECB
+  gMC->Gsatt("FWAB","seen",0); // no children for FWAB
+  gMC->Gsatt("FAIB","seen",0); // no children for FAIB
+  // Level 5 of B071 / Level 4 of BTO1 / Level 3 of FTOA / Level 2 of FLTA
+  gMC->Gsatt("FALA","seen",0); // no children for FALB
+//-->  gMC->Gsatt("FSTR","seen",-2);
+  // -> cfr previous settings
+  gMC->Gsatt("FPEA","seen",0); // no children for FPEA
+  gMC->Gsatt("FECA","seen",0); // no children for FECA
+  gMC->Gsatt("FWAA","seen",0); // no children for FWAA
+  gMC->Gsatt("FAIA","seen",0); // no children for FAIA
+
+  // Level 2 of B074
+  gMC->Gsatt("BTR2","seen",0); // BTR2 does not has sub-levels -
+  gMC->Gsatt("BTO2","seen",0);
+
+  // Level 2 of B075
+  gMC->Gsatt("BTR3","seen",0); // BTR3 do not have sub-levels -
+  gMC->Gsatt("BTO3","seen",0);
+
+// for others Level 5, cfr. previous settings
+
+  gMC->Gdopt("hide","on");
+  gMC->Gdopt("shad","on");
+  gMC->Gsatt("*", "fill", 5);
+  gMC->SetClipBox(".");
+  gMC->SetClipBox("*", 0, 1000, 0, 1000, 0, 1000);
+  gMC->DefaultRange();
+  gMC->Gdraw("alic", 45, 40, 0, 10, 10, .015, .015);
+  gMC->Gdhead(1111,"TOF Strips V1");
+  gMC->Gdman(18, 4, "MAN");
+  gMC->Gdopt("hide","off");
+}
 
 //_____________________________________________________________________________
 void AliTOFv4::CreateMaterials()
index d421d49..0e03213 100644 (file)
@@ -20,7 +20,7 @@ class AliTOFv4 : public AliTOF {
 public:
   AliTOFv4();
   AliTOFv4(const char *name, const char *title);
-  virtual ~AliTOFv4(void) ;
+  virtual ~AliTOFv4() {}
   virtual void   BuildGeometry();
   virtual void   CreateGeometry();
   virtual void   CreateMaterials();
@@ -30,6 +30,10 @@ public:
                        Float_t zlenA,Float_t ztof0);
   virtual void   StepManager();
   virtual void   DrawModule() const;
+  virtual void   DrawDetectorModules();
+  virtual void   DrawDetectorStrips();
+//  virtual void   DrawDetectorModulesinFrame();
+//  virtual void   DrawDetectorStripsinFrame();
 
 private:
   Int_t fIdFTOA; // FTOA volume identifier (outer plate A)
index 7d0fc68..e3579ba 100644 (file)
@@ -9,7 +9,7 @@ PACKAGE = TOF
 
 # C++ sources
 
-SRCS  = AliTOF.cxx  AliTOFv0.cxx  AliTOFv1.cxx  AliTOFv2.cxx  AliTOFv3.cxx  AliTOFv4.cxx AliTOFhit.cxx  AliTOFdigit.cxx AliTOFRawSector.cxx  AliTOFRoc.cxx  AliTOFRawDigit.cxx AliTOFDigitizer.cxx
+SRCS  = AliTOF.cxx  AliTOFv0.cxx  AliTOFv1.cxx  AliTOFv2.cxx  AliTOFv3.cxx  AliTOFv4.cxx AliTOFhit.cxx  AliTOFdigit.cxx AliTOFRawSector.cxx  AliTOFRoc.cxx  AliTOFRawDigit.cxx AliTOFDigitizer.cxx AliTOFSDigitizer.cxx AliTOFMerger.cxx
 
 # C++ Headers
 
index f5226b8..f9b7c24 100644 (file)
@@ -22,5 +22,7 @@
 #pragma link C++ class  AliTOFRawSector+;
 #pragma link C++ class  AliTOFRawDigit+;
 #pragma link C++ class  AliTOFDigitizer+;
+#pragma link C++ class  AliTOFSDigitizer+;
+#pragma link C++ class  AliTOFMerger+;
 
 #endif
diff --git a/TOF/TOFMerger.C b/TOF/TOFMerger.C
new file mode 100644 (file)
index 0000000..8dd216c
--- /dev/null
@@ -0,0 +1,79 @@
+void TOFMerger (Int_t evNumber1=0, Int_t evNumber2=0, Int_t ibg=0, Int_t bgr=10) 
+{
+// Dynamically link some shared libs
+
+   if (gClassTable->GetID("AliRun") < 0) {
+      gROOT->LoadMacro("loadlibs.C");
+      loadlibs();
+   }
+
+// Connect the Root Galice file containing Geometry, Kine and Hits
+
+   TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject("galice.root");
+   if (file) file->Close(); 
+   file = new TFile("galice.root","UPDATE");
+
+// Get AliRun object from file or create it if not on file
+
+   if (!gAlice) {
+       gAlice = (AliRun*)file->Get("gAlice");
+       if (gAlice) printf("AliRun object found on file\n");
+       if (!gAlice) gAlice = new AliRun("gAlice","Alice test program");
+   }
+   AliTOF *TOF  = (AliTOF*) gAlice->GetModule("TOF");
+  cout<<" TOFMerger:: TOF "<<TOF<<" gAlice "<<gAlice<<endl;
+
+   if (TOF) {
+// ctor invocation
+       AliTOFMerger* merger = new AliTOFMerger();
+// configuration
+       if (ibg) {
+        merger->SetMode(ibg);
+        merger->SetBackgroundFileName("bg.root");
+      }
+       // pass signal filename
+       //  merger->SetSignalFileName("galice.root");
+       TOF->SetMerger(merger);
+   }
+
+//   Loop over events              
+//
+    for (int nev=evNumber1; nev<= evNumber2; nev++) {
+       Int_t nparticles = gAlice->GetEvent(nev);
+       cout << "nev         " << nev <<endl;
+       cout << "nparticles  " << nparticles <<endl;
+       if (nev < evNumber1) continue;
+       if (nparticles <= 0) return;
+       Int_t nbgr_ev = Int_t(nev*bgr/(evNumber2+1));
+       cout<<" nbgr_ev "<<nbgr_ev<<endl;
+       
+       if (ibg) {
+           merger->SetBackgroundEventNumber(nbgr_ev);
+       }
+
+       gAlice->SDigits2Digits("TOF");
+
+       char hname[30];
+       sprintf(hname,"TreeD%d",nev);
+       //      gAlice->TreeD()->Write(hname);
+       //      cout<<hname<<" was written in file"<<file<<endl;
+       //      gAlice->TreeD()->Print();
+       //reset tree
+       gAlice->TreeD()->Reset();
+
+    }   // event loop 
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+