]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TOF/AliTOF.cxx
review on materials and
[u/mrichter/AliRoot.git] / TOF / AliTOF.cxx
index 177b7afe659ac465ca5790425187b9b659d766c7..93407fdb9214e3642d28105dfef7fedd1c935969 100644 (file)
 
 /*
 $Log$
+Revision 1.38  2002/06/13 08:43:46  vicinanz
+Merging added and test macro
+
+Revision 1.37  2002/05/03 07:34:19  vicinanz
+Updated SDigitizer; Added AliTOFanalyzeSDigits.C macro
+
+Revision 1.36  2002/04/19 14:40:51  vicinanz
+Updated SDigitizer
+
+Revision 1.35  2002/03/21 13:52:53  vicinanz
+Minor changes to AliTOF constructor
+
+Revision 1.34  2002/02/20 13:41:38  hristov
+Default arguments set only in the header file
+
+Revision 1.33  2002/02/19 10:39:38  vicinanz
+t0 classes added and material update (steel added)
+
+Revision 1.31  2001/11/22 11:22:51  hristov
+Updated version of TOF digitization, N^2 problem solved (J.Chudoba)
+
+Revision 1.30  2001/10/21 18:30:39  hristov
+Several pointers were set to zero in the default constructors to avoid memory management problems
+
+Revision 1.29  2001/10/17 14:19:24  hristov
+delete replaced by delete []
+
 Revision 1.28  2001/10/05 12:02:01  vicinanz
 Minor improvements on Merger and SDigitizer
 
@@ -113,7 +140,9 @@ Introduction of the Copyright and cvs Log
 
 #include "AliTOF.h"
 #include "AliTOFhit.h"
+#include "AliTOFhitT0.h"
 #include "AliTOFdigit.h"
+#include "AliTOFSDigit.h"
 #include "AliTOFRawSector.h"
 #include "AliTOFRoc.h"
 #include "AliTOFRawDigit.h"
@@ -142,20 +171,23 @@ AliTOF::AliTOF()
   //
   // Default constructor
   //
-  fFGeom = 0;
-  fDTask = 0;
-  fReTask = 0;
+  fFGeom = 0x0;
+  fDTask = 0x0;
+  fReTask = 0x0;
   fIshunt   = 0;
   fSDigits       = 0 ;
+  fNSDigits = 0;
   fDigits        = 0 ;
+  fReconParticles = 0x0;
   fName="TOF";
+  fMerger = 0x0;
 /* fp
   CreateTOFFolders();
 */
 }
  
 //_____________________________________________________________________________
-AliTOF::AliTOF(const char *name, const char *title)
+AliTOF::AliTOF(const char *name, const char *title, Option_t *option)
        : AliDetector(name,title)
 {
   //
@@ -165,12 +197,25 @@ AliTOF::AliTOF(const char *name, const char *title)
   //
 
   // Initialization of hits, sdigits and digits array
-  //
-  fHits   = new TClonesArray("AliTOFhit",  1000);
+  // added option for time zero analysis
+  if (strstr(option,"tzero")){
+    fHits   = new TClonesArray("AliTOFhitT0",  1000);
+    cout << "tzero option requires AliTOFv4T0 as TOF version (check Your Config.C)" << endl;
+  }else{
+    fHits   = new TClonesArray("AliTOFhit",  1000);
+  }
   gAlice->AddHitList(fHits);
   fIshunt  = 0;
-  fSDigits       = new TClonesArray("AliTOFdigit",  1000);
+  fSDigits       = new TClonesArray("AliTOFSDigit",  1000);
   fDigits        = new TClonesArray("AliTOFdigit",  1000);
+  fNSDigits = 0;
+
+  fFGeom = 0x0;
+  fDTask = 0x0;
+  fReTask = 0x0;
+  fReconParticles = 0x0;
+  fMerger = 0x0;
+
   //
   // Digitization parameters
   //
@@ -319,7 +364,18 @@ void AliTOF::AddHit(Int_t track, Int_t *vol, Float_t *hits)
   TClonesArray &lhits = *fHits;
   new(lhits[fNhits++]) AliTOFhit(fIshunt, track, vol, hits);
 }
+
+//_____________________________________________________________________________
+void AliTOF::AddT0Hit(Int_t track, Int_t *vol, Float_t *hits)
+{
+  //
+  // Add a TOF hit
+  // new with placement used
+  //
+  TClonesArray &lhits = *fHits;
+  new(lhits[fNhits++]) AliTOFhitT0(fIshunt, track, vol, hits);
+}
+
 //_____________________________________________________________________________
 void AliTOF::AddDigit(Int_t *tracks, Int_t *vol, Float_t *digits)
 {
@@ -332,7 +388,7 @@ void AliTOF::AddDigit(Int_t *tracks, Int_t *vol, Float_t *digits)
 }
 
 //___________________________________________
-void AliTOF::AddSDigit(Int_t *tracks, Int_t *vol, Float_t *digits)
+void AliTOF::AddSDigit(Int_t tracknum, Int_t *vol, Float_t *digits)
 {
      
 //
@@ -340,7 +396,7 @@ void AliTOF::AddSDigit(Int_t *tracks, Int_t *vol, Float_t *digits)
 //
         
   TClonesArray &lSDigits = *fSDigits;   
-  new(lSDigits[fNSDigits++]) AliTOFdigit(tracks, vol, digits);
+  new(lSDigits[fNSDigits++]) AliTOFSDigit(tracknum, vol, digits);
 }
 
 //_____________________________________________________________________________
@@ -364,7 +420,7 @@ void AliTOF::SetTreeAddress ()
        }
 
     }
-  if (fSDigits)
+//  if (fSDigits)
     //  fSDigits->Clear ();
 
   if (gAlice->TreeS () && fSDigits)
@@ -449,20 +505,21 @@ void AliTOF::CreateMaterials()
 {
   //
   // Defines TOF materials for all versions
-  // Authors :   Maxim Martemianov, Boris Zagreev (ITEP) 
-  //            18/09/98 
-  // Revision: F. Pierella 5-3-2001
-  // Bologna University
+  // Revision: F. Pierella 18-VI-2002
   //
+
   Int_t   isxfld = gAlice->Field()->Integ();
   Float_t sxmgmx = gAlice->Field()->Max();
   //
-  //--- Quartz (SiO2) 
+  //--- Quartz (SiO2) to simulate float glass
+  //    density tuned to have correct float glass 
+  //    radiation length
   Float_t   aq[2] = { 28.0855,15.9994 };
   Float_t   zq[2] = { 14.,8. };
   Float_t   wq[2] = { 1.,2. };
-  Float_t   dq = 2.20;
+  Float_t   dq = 2.55; // std value: 2.2
   Int_t nq = -2;
+
   // --- Freon C2F4H2 (TOF-TDR pagg.)
   // Geant Manual CONS110-1, pag. 43 (Geant, Detector Description and Simulation Tool)
   Float_t afre[3]  = {12.011,18.998,1.007};
@@ -509,12 +566,14 @@ void AliTOF::CreateMaterials()
   Float_t wmatg10[4] = { .259,.288,.248,.205 };
   Float_t densg10  = 1.7;
   Int_t nlmatg10 = -4;
-  // --- DME 
-  Float_t adme[5] = { 12.,1.,16.,19.,79. };
-  Float_t zdme[5] = {  6.,1., 8., 9.,35. };
-  Float_t wmatdme[5] = { .4056,.0961,.2562,.1014,.1407 };
-  Float_t densdme  = .00205;
-  Int_t nlmatdme = 5;
+
+  // plexiglass CH2=C(CH3)CO2CH3
+  Float_t aplex[3] = { 12.,1.,16.};
+  Float_t zplex[3] = {  6.,1., 8.};
+  Float_t wmatplex[3] = {5.,8.,2.};
+  Float_t densplex  =1.16;
+  Int_t nplex = -3;
+
   // ---- ALUMINA (AL203) 
   Float_t aal[2] = { 27.,16.};
   Float_t zal[2] = { 13., 8.};
@@ -527,6 +586,12 @@ void AliTOF::CreateMaterials()
   Float_t wwa[2] = {  2.,  1. };
   Float_t dwa    = 1.0;
   Int_t nwa = -2;
+
+// stainless steel
+  Float_t asteel[4] = { 55.847,51.9961,58.6934,28.0855 };
+  Float_t zsteel[4] = { 26.,24.,28.,14. };
+  Float_t wsteel[4] = { .715,.18,.1,.005 };
+
   //
   //AliMaterial(0, "Vacuum$", 1e-16, 1e-16, 1e-16, 1e16, 1e16);
   AliMaterial( 1, "Air$",14.61,7.3,0.001205,30423.24,67500.);
@@ -534,15 +599,16 @@ void AliTOF::CreateMaterials()
   AliMaterial( 3, "C  $",  12.01,  6.0, 2.265,18.8, 74.4);
   AliMixture ( 4, "Polyethilene$", ape, zpe, dpe, npe, wpe);
   AliMixture ( 5, "G10$", ag10, zg10, densg10, nlmatg10, wmatg10);
-  AliMixture ( 6, "DME ", adme, zdme, densdme, nlmatdme, wmatdme);
+  AliMixture ( 6, "PLE$", aplex, zplex, densplex, nplex, wmatplex);
   AliMixture ( 7, "CO2$", ac, zc, dc, nc, wc);
   AliMixture ( 8, "ALUMINA$", aal, zal, densal, nlmatal, wmatal);
   AliMaterial( 9, "Al $", 26.98, 13., 2.7, 8.9, 37.2);
   AliMaterial(10, "C-TRD$", 12.01, 6., 2.265*18.8/69.282*15./100, 18.8, 74.4); // for 15%
   AliMixture (11, "Mylar$",  amy, zmy, dmy, nmy, wmy);
   AliMixture (12, "Freon$",  afre, zfre, densfre, nfre, wfre);
-  AliMixture (13, "Quartz$", aq, zq, dq, nq, wq);
+  AliMixture (13, "Glass$", aq, zq, dq, nq, wq);
   AliMixture (14, "Water$",  awa, zwa, dwa, nwa, wwa);
+  AliMixture (15, "STAINLESS STEEL$", asteel, zsteel, 7.88, 4, wsteel);
 
   Float_t epsil, stmin, deemax, stemax;
  
@@ -563,7 +629,7 @@ void AliTOF::CreateMaterials()
   AliMedium( 3, "C  $"  ,  3, 0, isxfld, sxmgmx, 10., stemax, deemax, epsil, stmin);
   AliMedium( 4, "Pol$"  ,  4, 0, isxfld, sxmgmx, 10., stemax, deemax, epsil, stmin);
   AliMedium( 5, "G10$"  ,  5, 0, isxfld, sxmgmx, 10., stemax, deemax, epsil, stmin);
-  AliMedium( 6, "DME$"  ,  6, 0, isxfld, sxmgmx, 10., stemax, deemax, epsil, stmin);
+  AliMedium( 6, "PLE$"  ,  6, 0, isxfld, sxmgmx, 10., stemax, deemax, epsil, stmin);
   AliMedium( 7, "CO2$"  ,  7, 0, isxfld, sxmgmx, 10., -.01, -.1, .01, -.01);
   AliMedium( 8,"ALUMINA$", 8, 0, isxfld, sxmgmx, 10., stemax, deemax, epsil, stmin);
   AliMedium( 9,"Al Frame$",9, 0, isxfld, sxmgmx, 10., stemax, deemax, epsil, stmin);
@@ -574,6 +640,7 @@ void AliTOF::CreateMaterials()
   AliMedium(14, "Fre-S$", 12, 1, isxfld, sxmgmx, 10., stemax, deemax, epsil, stmin);
   AliMedium(15, "Glass$", 13, 0, isxfld, sxmgmx, 10., stemax, deemax, epsil, stmin);
   AliMedium(16, "Water$", 14, 0, isxfld, sxmgmx, 10., stemax, deemax, epsil, stmin);
+  AliMedium(17, "STEEL$", 15, 0, isxfld, sxmgmx, 10., stemax, deemax, epsil, stmin);
 }
 
 //_____________________________________________________________________________
@@ -725,118 +792,6 @@ AliTOFMerger*  AliTOF::Merger()
     return fMerger;
 }
 
-//____________________________________________________________________________
-void AliTOF::TOFHits2SDigits()
-{
-//
-// Starting from the Hits Tree (TreeH), this
-// 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 Hits2SDigits.C
-//
-// Simulation of detector response.
-
-   Int_t ver = this->IsVersion();
-   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->GetStrip();
-               vol[3] = tofHit->GetPadx();
-               vol[4] = tofHit->GetPadz();
-
-               // 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;
-
-               // 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
-
-         } // close if TOF switched ON
-
-      gAlice->TreeS()->Fill();
-      gAlice->TreeS()->Print();
-
-    }                          //event loop
-
-}
 
 //---------------------------------------------------------------------
 
@@ -850,9 +805,9 @@ void AliTOF::Hits2SDigits()
   cout<<"ALiTOF::Hits2SDigits> start...\n";
   //#endif
   
-  char * fileSDigits = 0 ;
+  //char * fileSDigits = 0 ;
   char * fileHeader = 0;
-  AliTOFSDigitizer * sd = new AliTOFSDigitizer(fileHeader,fileSDigits) ;
+  AliTOFSDigitizer * sd = new AliTOFSDigitizer(fileHeader) ;
 
   sd->Exec("") ;
   sd->Print("");
@@ -1061,3 +1016,20 @@ void AliTOF::Raw2Digits(Int_t evNumber)
   tD->Write(0,TObject::kOverwrite);
 } 
 
+////////////////////////////////////////////////////////////////////////
+void AliTOF::RecreateSDigitsArray() {
+//
+// delete TClonesArray fSDigits and create it again
+//  needed for backward compatability with PPR test production
+//
+  delete fSDigits;
+  fSDigits       = new TClonesArray("AliTOFSDigit",  1000);
+}
+////////////////////////////////////////////////////////////////////////
+void AliTOF::CreateSDigitsArray() {
+//
+// create TClonesArray fSDigits
+//  needed for backward compatability with PPR test production
+//
+  fSDigits       = new TClonesArray("AliTOFSDigit",  1000);
+}