This commit was generated by cvs2svn to compensate for changes in r15986,
authorhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 29 Nov 2006 16:02:06 +0000 (16:02 +0000)
committerhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 29 Nov 2006 16:02:06 +0000 (16:02 +0000)
which included commits to RCS files with non-trunk default branches.

71 files changed:
T0/.rootrc [new file with mode: 0644]
T0/AliT0.cxx [new file with mode: 0644]
T0/AliT0.h [new file with mode: 0644]
T0/AliT0Calc.cxx [new file with mode: 0644]
T0/AliT0Calc.h [new file with mode: 0644]
T0/AliT0CalibData.cxx [new file with mode: 0644]
T0/AliT0CalibData.h [new file with mode: 0644]
T0/AliT0DataDCS.cxx [new file with mode: 0644]
T0/AliT0DataDCS.h [new file with mode: 0644]
T0/AliT0Digitizer.cxx [new file with mode: 0644]
T0/AliT0Digitizer.h [new file with mode: 0644]
T0/AliT0Dqclass.cxx [new file with mode: 0644]
T0/AliT0Dqclass.h [new file with mode: 0644]
T0/AliT0Hist.cxx [new file with mode: 0644]
T0/AliT0Hist.h [new file with mode: 0644]
T0/AliT0Loader.cxx [new file with mode: 0644]
T0/AliT0Loader.h [new file with mode: 0644]
T0/AliT0Parameters.cxx [new file with mode: 0644]
T0/AliT0Parameters.h [new file with mode: 0644]
T0/AliT0Preprocessor.cxx [new file with mode: 0644]
T0/AliT0Preprocessor.h [new file with mode: 0644]
T0/AliT0RawData.cxx [new file with mode: 0644]
T0/AliT0RawData.h [new file with mode: 0644]
T0/AliT0RawReader.cxx [new file with mode: 0644]
T0/AliT0RawReader.h [new file with mode: 0644]
T0/AliT0RecPoint.cxx [new file with mode: 0644]
T0/AliT0RecPoint.h [new file with mode: 0644]
T0/AliT0Reconstructor.cxx [new file with mode: 0644]
T0/AliT0Reconstructor.h [new file with mode: 0644]
T0/AliT0SetCDB.C [new file with mode: 0644]
T0/AliT0Trigger.cxx [new file with mode: 0644]
T0/AliT0Trigger.h [new file with mode: 0644]
T0/AliT0digit.cxx [new file with mode: 0644]
T0/AliT0digit.h [new file with mode: 0644]
T0/AliT0hit.cxx [new file with mode: 0644]
T0/AliT0hit.h [new file with mode: 0644]
T0/AliT0hitPhoton.cxx [new file with mode: 0644]
T0/AliT0hitPhoton.h [new file with mode: 0644]
T0/AliT0v0.cxx [new file with mode: 0644]
T0/AliT0v0.h [new file with mode: 0644]
T0/AliT0v1.cxx [new file with mode: 0644]
T0/AliT0v1.h [new file with mode: 0644]
T0/AliT0v2.cxx [new file with mode: 0644]
T0/AliT0v2.h [new file with mode: 0644]
T0/Align/Data/Run0_10_v0_s0.root [new file with mode: 0644]
T0/Align/Data/Run0_99999_v0_s1.root [new file with mode: 0644]
T0/Calib/Gain_TimeDelay_Slewing_Walk/Run0_10_v0_s0.root [new file with mode: 0644]
T0/DAQfile.root [new file with mode: 0644]
T0/DigitMaker.C [new file with mode: 0644]
T0/DrawT0.C [new file with mode: 0644]
T0/MakeT0FullMisAlignment.C [new file with mode: 0644]
T0/MakeT0ResMisAlignment.C [new file with mode: 0644]
T0/PMTefficiency.root [new file with mode: 0644]
T0/T0Digit.C [new file with mode: 0644]
T0/T0baseLinkDef.h [new file with mode: 0644]
T0/T0recLinkDef.h [new file with mode: 0644]
T0/T0shuttleLinkDef.h [new file with mode: 0644]
T0/T0simLinkDef.h [new file with mode: 0644]
T0/TestPreprocessor.C [new file with mode: 0644]
T0/VertexMaker.C [new file with mode: 0644]
T0/ViewT0.C [new file with mode: 0644]
T0/esdAna.C [new file with mode: 0644]
T0/esdAna.h [new file with mode: 0644]
T0/libT0base.pkg [new file with mode: 0644]
T0/libT0rec.pkg [new file with mode: 0644]
T0/libT0shuttle.pkg [new file with mode: 0644]
T0/libT0sim.pkg [new file with mode: 0644]
T0/readDigits.C [new file with mode: 0644]
T0/readRec.C [new file with mode: 0644]
T0/readVertex.C [new file with mode: 0644]
T0/vertex.C [new file with mode: 0644]

diff --git a/T0/.rootrc b/T0/.rootrc
new file mode 100644 (file)
index 0000000..6d6636b
--- /dev/null
@@ -0,0 +1,7 @@
+
+Unix.*.Root.MacroPath:      .:$(ALICE_ROOT)/macros:$(ALICE_ROOT)
+
+Root.Html.OutputDir: $(ALICE_ROOT)/html/roothtml/T0
+Root.Html.SourceDir: ./
+Root.Html.Author:  Rene Brun
+Root.Html.Root:  http://root.cern.ch/root/html
diff --git a/T0/AliT0.cxx b/T0/AliT0.cxx
new file mode 100644 (file)
index 0000000..7020921
--- /dev/null
@@ -0,0 +1,359 @@
+/**************************************************************************
+ * 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.                  *
+ **************************************************************************/
+
+/* $Id$ */
+
+///////////////////////////////////////////////////////////////////////////////
+//                                                                           //
+//  T0 (T-Zero) Detector                                            //
+//  This class contains the base procedures for the T0     //
+//  detector                                                                 //
+//                                                                           //
+//Begin_Html
+/*
+<img src="gif/AliT0Class.gif">
+</pre>
+<br clear=left>
+<font size=+2 color=red>
+<p>The responsible person for this module is
+<a href="mailto:Alla.Maevskaia@cern.ch">Alla Maevskaia</a>.
+</font>
+<pre>
+*/
+//End_Html
+//                                                                           //
+//                                                                           //
+///////////////////////////////////////////////////////////////////////////////
+
+#include <Riostream.h>
+
+#include <TFile.h>
+#include <TGeometry.h>
+#include <TMath.h>
+#include <TNode.h>
+#include <TParticle.h>
+#include <TRandom.h>
+#include <TTUBE.h>
+#include <TVirtualMC.h>
+#include <AliESD.h>
+
+#include "AliLog.h"
+#include "AliMC.h"
+#include "AliLoader.h"
+#include "AliRun.h"
+#include "TClonesArray.h"
+#include "AliT0.h"
+#include "AliT0Loader.h"
+#include "AliT0digit.h"
+#include "AliT0hit.h"
+#include "AliT0Digitizer.h"
+#include "AliT0RawData.h"
+#include "AliT0RecPoint.h"
+#include "AliLog.h"
+
+ClassImp(AliT0)
+
+  //static  AliT0digit *digits; 
+
+//_____________________________________________________________________________
+AliT0::AliT0()
+  : AliDetector(), fIdSens(0), fDigits(NULL), fRecPoints(NULL)
+{
+  //
+  // Default constructor for class AliT0
+  //
+  fIshunt   = 1;
+  fHits     = 0;
+  fDigits   = 0;
+  fRecPoints = 0;
+}
+//_____________________________________________________________________________
+AliT0::AliT0(const char *name, const char *title)
+  : AliDetector(name,title), fIdSens(0), fDigits(new AliT0digit()), fRecPoints(new AliT0RecPoint())
+{
+  //
+  // Standard constructor for T0 Detector
+  //
+
+  
+  //
+  // Initialise Hit array
+  fHits       = new TClonesArray("AliT0hit",  405);
+  gAlice->GetMCApp()->AddHitList(fHits);
+  //  fDigits    = new AliT0digit();
+  //  fRecPoints = new AliT0RecPoint();
+  fIshunt     =  1;
+  //  fIdSens   =  0;
+  //PH  SetMarkerColor(kRed);
+}
+
+//_____________________________________________________________________________
+AliT0::~AliT0() {
+  
+  if (fHits) {
+    fHits->Delete();
+    delete fHits;
+  }
+  /*
+  if (fDigits) {
+    fDigits->Delete();
+    delete fDigits;
+    cout<<" delete fDigits; "<<endl;
+  }
+  if (fRecPoints) {
+   fRecPoints ->Delete();
+    delete fRecPoints;
+    cout<<" delete fRecPoints; "<<endl;
+  }
+  */ 
+}
+
+//_____________________________________________________________________________
+void AliT0::AddHit(Int_t track, Int_t *vol, Float_t *hits)
+{
+  //
+  // Add a T0 hit
+  //
+  TClonesArray &lhits = *fHits;
+  new(lhits[fNhits++]) AliT0hit(fIshunt,track,vol,hits);
+}
+
+
+//_____________________________________________________________________________
+
+void AliT0::AddDigit(Int_t besttimeright, Int_t besttimeleft, Int_t meantime, 
+                       Int_t timediff, Int_t sumMult,
+                       TArrayI *time, TArrayI *adc, TArrayI *timeAmp, TArrayI *adcAmp)
+{
+  
+  //  Add a T0 digit to the list.
+ //
+  
+  if (!fDigits) {
+    fDigits = new AliT0digit();
+  }
+  fDigits-> SetTimeBestRight(besttimeright);
+  fDigits->SetTimeBestLeft(besttimeleft);
+  fDigits-> SetMeanTime(meantime);
+  fDigits-> SetDiffTime(timediff);
+  fDigits-> SetSumMult(sumMult);
+  fDigits->SetTime(*time);
+  fDigits->SetTimeAmp(*timeAmp);
+  fDigits->SetADC(*adc);
+  fDigits->SetADCAmp(*adcAmp);
+}
+
+
+//_____________________________________________________________________________
+void AliT0::BuildGeometry()
+{
+  //
+  // Build simple ROOT TNode geometry for event display
+  //
+  TNode *node, *top;
+  const int kColorT0  = 19;
+
+  top=gAlice->GetGeometry()->GetNode("alice");
+
+  // T0 define the different volumes
+  new TRotMatrix("rotx999","rot999",  90,0,90,90,180,0);
+
+  new TTUBE("S_0ST1","T0  volume 1","void",5.,10.7,5.3);
+  top->cd();
+  node = new TNode("0ST1","0ST01","S_0ST1",0,0,-69.7,"");
+  node->SetLineColor(kColorT0);
+  fNodes->Add(node);
+
+  new TTUBE("S_0ST2","T0 volume 2","void",5.,10.7,5.3);
+  top->cd();
+  node = new TNode("0ST2","0ST2","S_0ST2",0,0,350,"rotx999");
+  node->SetLineColor(kColorT0);
+  fNodes->Add(node);
+}
+//_____________________________________________________________________________
+Int_t AliT0::DistanceToPrimitive(Int_t /*px*/, Int_t /*py*/)
+{
+  //
+  // Calculate the distance from the mouse to the T0 on the screen
+  // Dummy routine
+  //
+  return 9999;
+}
+//-------------------------------------------------------------------------
+void AliT0::Init()
+{
+  //
+  // Initialis the T0 after it has been built
+  Int_t i;
+  //
+  if(AliLog::GetGlobalDebugLevel()>0) {
+    printf("\n%s: ",ClassName());
+    for(i=0;i<35;i++) printf("*");
+    printf(" T0_INIT ");
+    for(i=0;i<35;i++) printf("*");
+    printf("\n%s: ",ClassName());
+    //
+    // Here the T0 initialisation code (if any!)
+    for(i=0;i<80;i++) printf("*");
+    printf("\n");
+  }
+}
+
+//---------------------------------------------------------------------------
+void AliT0::MakeBranch(Option_t* option)
+{
+  //
+// Create Tree branches for the T0.
+
+ // Options:
+  //
+  //    H          Make a branch of TClonesArray of AliT0Hit's
+  //    D          Make a branch of TClonesArray of AliT0Digit's
+  //
+  //    R         Make a branch of  AliT0RecPoints
+  //
+  char branchname[20];
+  sprintf(branchname,"%s",GetName());
+
+  const char *cH = strstr(option,"H");
+  const char *cD = strstr(option,"D");
+  const char *cR = strstr(option,"R");
+
+    if (cH && fLoader->TreeH())
+  {
+     if (fHits == 0x0) fHits  = new TClonesArray("AliT0hit",  405);
+     AliDetector::MakeBranch(option);
+  } 
+    
+    
+  if (cD && fLoader->TreeD())
+    {
+      if (fDigits == 0x0) fDigits  = new AliT0digit();
+      //     MakeBranchInTree(fLoader->TreeD(), branchname,
+      //                      &fDigits, 405, 0);
+      fLoader->TreeD()->Branch(branchname,"AliT0digit",&fDigits,405,1);
+      //   fLoader->TreeD()->Print();
+    } 
+  if (cR && fLoader->TreeR())
+    {
+      if (fRecPoints == 0x0) fRecPoints  = new AliT0RecPoint();
+      MakeBranchInTree(fLoader->TreeR(), branchname,
+                      &fRecPoints, 405, 0);
+    } 
+  
+}    
+
+//_____________________________________________________________________________
+void AliT0::ResetHits()
+{
+  AliDetector::ResetHits();
+  
+}
+//____________________________________________________________________
+void AliT0::ResetDigits()
+{
+  //
+  // Reset number of digits and the digits array for this detector
+  //
+  if (fDigits) fDigits->Clear();
+}
+
+//_____________________________________________________________________________
+void AliT0::SetTreeAddress()
+{
+
+  TTree    *treeH;
+  treeH = TreeH();
+  
+  if (treeH)
+    {
+      if (fHits == 0x0) fHits  = new TClonesArray("AliT0hit",  405);
+    }
+    
+  AliDetector::SetTreeAddress();
+  TTree *treeD = fLoader->TreeD();
+  if (treeD) {
+    if (fDigits == 0x0)  fDigits  = new AliT0digit();
+    TBranch* branch = treeD->GetBranch ("T0");
+    if (branch) branch->SetAddress(&fDigits);
+  }
+
+  TTree *treeR = fLoader->TreeR();
+  if (treeR) {
+    if (fRecPoints == 0x0) fRecPoints  = new  AliT0RecPoint()  ;
+    TBranch* branch = treeR->GetBranch ("T0");
+    if (branch) branch->SetAddress(&fRecPoints);
+  }
+}
+
+
+//_____________________________________________________________________________
+void AliT0::MakeBranchInTreeD(TTree *treeD, const char *file)
+{
+    //
+    // Create TreeD branches for the FMD
+    //
+    const Int_t kBufferSize = 4000;
+    char branchname[20];
+    sprintf(branchname,"%s",GetName());
+    if(treeD)
+     {
+       MakeBranchInTree(treeD,  branchname,&fDigits, kBufferSize, file);
+     }
+}
+
+//_____________________________________________________________________________
+AliDigitizer* AliT0::CreateDigitizer(AliRunDigitizer* manager) const
+{
+  return new AliT0Digitizer(manager);
+}
+//____________________________________________________________________________
+void AliT0::Digits2Raw()
+{
+//
+// Starting from the T0 digits, writes the Raw Data objects
+//
+//  AliT0Loader* pStartLoader = (AliT0Loader*)fLoader;
+  fLoader ->LoadDigits("read");
+  TTree* treeD = fLoader->TreeD();
+  if (!treeD) {
+    AliError("no digits tree");
+    return;
+  }
+  if (fDigits == 0x0)  fDigits  = new AliT0digit();
+  
+  TBranch *branch = treeD->GetBranch("T0");
+  if (branch) {
+    branch->SetAddress(&fDigits);
+  }else{
+    AliError("Branch T0 DIGIT not found");
+    exit(111);
+  } 
+  AliT0RawData rawWriter;
+  rawWriter.SetVerbose(0);
+  
+  AliDebug(2,Form(" Formatting raw data for T0 "));
+  branch->GetEntry(0);
+  //  rawWriter.RawDataT0(treeD->GetBranch("T0"));
+  rawWriter.RawDataT0(fDigits);
+  
+  
+  fLoader->UnloadDigits();
+  
+}
diff --git a/T0/AliT0.h b/T0/AliT0.h
new file mode 100644 (file)
index 0000000..dd674b0
--- /dev/null
@@ -0,0 +1,106 @@
+#ifndef ALIT0_H
+#define ALIT0_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+////////////////////////////////////////////////
+//  Manager and hits classes for set:T0     //
+////////////////////////////////////////////////
+#include <AliDetector.h>
+#include <TTree.h>
+#include <TClonesArray.h>
+#include "AliT0RecPoint.h"
+#include "AliT0digit.h"
+#include "AliT0Trigger.h"
+
+class TDirectory;
+class TFile;
+class AliESD;
+R__EXTERN TDirectory *  gDirectory;
+class AliT0 : public AliDetector {
+
+
+
+public:
+   AliT0();
+   AliT0(const char *name, const char *title);
+   virtual       ~AliT0();
+   virtual void   AddHit(Int_t track, Int_t *vol, Float_t *hits);
+   virtual void AddDigit(Int_t *, Int_t *) {};
+   virtual void   AddDigit(Int_t besttimeright, Int_t besttimeleft, Int_t meantime, 
+                       Int_t timediff, Int_t sumMult,
+                          TArrayI *time, TArrayI *adc, TArrayI *timeAmp, TArrayI *adcAmp);
+   virtual void   BuildGeometry();
+   virtual void   CreateGeometry(){}
+   virtual void   CreateMaterials(){} 
+   virtual Int_t  DistanceToPrimitive(Int_t px, Int_t py);
+   virtual void   DrawDetector(){}
+   virtual Int_t  IsVersion()const {return 0;}
+   virtual void   Init();
+   virtual void SetHitsAddressBranch(TBranch *b1)
+     {b1->SetAddress(&fHits);}
+   virtual void   MakeBranch(Option_t *opt=" ");
+   virtual void   StepManager(){}
+   virtual void   ResetHits();
+   virtual void   ResetDigits();
+    virtual void   SetTreeAddress();
+   virtual void   MakeBranchInTreeD(TTree *treeD, const char *file=0);
+   // virtual AliLoader* MakeLoader(const char* topfoldername);
+   virtual AliDigitizer* CreateDigitizer(AliRunDigitizer* manager) const;
+   void  Digits2Raw ();
+   virtual AliTriggerDetector* CreateTriggerDetector() const 
+     { return new  AliT0Trigger(); }
+
+
+protected:
+   Int_t fIdSens;    // Sensetive Cherenkov photocathode
+   AliT0digit *fDigits;
+   AliT0RecPoint *fRecPoints;
+
+ private:
+   AliT0(const AliT0&);
+   AliT0& operator=(const AliT0&);
+  ClassDef(AliT0,4)  //Base class for the T0 aka T0 detector
+};
+
+typedef AliT0 AliSTART; // for backward compatibility
+
+//_____________________________________________________________________________
+#endif
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/T0/AliT0Calc.cxx b/T0/AliT0Calc.cxx
new file mode 100644 (file)
index 0000000..d3f6908
--- /dev/null
@@ -0,0 +1,89 @@
+#include <iostream>
+#include <fstream>
+#include <iomanip>
+#include <string>
+#include <TCanvas.h>
+
+#include "AliT0Calc.h"
+#include "TObjArray.h"
+#include "TGraph.h"
+#include "TFile.h"
+#include "AliLog.h"
+#include "TObjString.h"
+
+#include "TAxis.h"
+#include "TH2F.h"
+
+
+ClassImp(AliT0Calc)
+
+AliT0Calc::AliT0Calc() 
+{
+ //
+ //    fGraphs.SetOwner(1);
+}
+
+AliT0Calc::AliT0Calc(const char* name)
+{
+       TString namst = "Calib_";
+       namst += name;
+       SetName(namst.Data());
+       SetTitle(namst.Data());
+//     fGraphs.SetOwner(1);
+       Reset();
+                         
+}
+
+//________________________________________________________________
+AliT0Calc::AliT0Calc(const AliT0Calc& calibdata) : TNamed(calibdata)
+{ 
+// copy constructor
+    SetName(calibdata.GetName());
+    SetTitle(calibdata.GetName());
+        
+
+}
+
+//________________________________________________________________
+AliT0Calc &AliT0Calc::operator =(const AliT0Calc& calibdata)
+{
+// assignment operator
+     SetName(calibdata.GetName());
+     SetTitle(calibdata.GetName());
+
+     return *this;
+}
+
+//________________________________________________________________
+AliT0Calc::~AliT0Calc()
+{
+//
+}
+
+void AliT0Calc::Reset()
+{
+    memset(fTime,1,24*sizeof(Float_t));
+   
+}
+
+void AliT0Calc::SetTime(Float_t* daqtime, Float_t* time_shift)
+{ 
+       for(Int_t i=0;i<24;i++){
+               if (time_shift[i] != 0.)
+                 fTime[i] = daqtime[i]-time_shift[i];
+               else 
+                 fTime[i] = daqtime[i];
+               }
+}
+
+
+void AliT0Calc::Print(const Option_t*) const
+{
+       for(Int_t i=0;i<24;i++){
+               printf("Total time %d = %.2f\n",i,fTime[i]);
+       }
+}
+
+
+
diff --git a/T0/AliT0Calc.h b/T0/AliT0Calc.h
new file mode 100644 (file)
index 0000000..4e27a66
--- /dev/null
@@ -0,0 +1,29 @@
+#ifndef AliT0Calc_H
+#define AliT0Calc_H
+
+#include "TNamed.h"
+
+class AliT0Calc: public TNamed {
+
+ public:
+   AliT0Calc();
+   AliT0Calc(const char* name);
+   AliT0Calc(const AliT0Calc &calibdata);
+   AliT0Calc& operator= (const AliT0Calc &calibdata);
+   virtual ~AliT0Calc();
+   void Reset();
+   void Print(const Option_t* option="") const;
+   Float_t GetDelay(int channel) {return fTime[channel];}
+   
+   void SetTime(Float_t* daqtime, Float_t* dcstime);
+  
+ protected:
+//   TMap fGraphs;
+   Float_t fTime[24];
+
+ ClassDef(AliT0Calc,4)
+};
+
+typedef AliT0Calc AliSTARTCalc; // for backward compatibility
+
+#endif
diff --git a/T0/AliT0CalibData.cxx b/T0/AliT0CalibData.cxx
new file mode 100644 (file)
index 0000000..68c952f
--- /dev/null
@@ -0,0 +1,199 @@
+/**************************************************************************
+ * 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.                  *
+ **************************************************************************/
+
+/* $Id$ */
+
+///////////////////////////////////////////////////////////////////////////////
+//                                                                           //
+// class for T0 calibration                       TM-AC-AM_6-02-2006         //
+//                                                                           //
+///////////////////////////////////////////////////////////////////////////////
+
+#include <iostream>
+#include <fstream>
+#include <iomanip>
+#include <string>
+#include <TCanvas.h>
+
+#include "AliT0CalibData.h"
+#include "TObjArray.h"
+#include "TGraph.h"
+#include "TFile.h"
+#include "AliLog.h"
+#include "TObjString.h"
+
+#include "TAxis.h"
+#include "TH2F.h"
+
+
+
+ClassImp(AliT0CalibData)
+
+//________________________________________________________________
+  AliT0CalibData::AliT0CalibData():   TNamed()
+
+{
+  //
+}
+
+//________________________________________________________________
+AliT0CalibData::AliT0CalibData(const char* name):TNamed(),fTimeDelayTVD(0),fWalk(),fSlewingLED(),fSlewingRec()
+{
+  TString namst = "Calib_";
+  namst += name;
+  SetName(namst.Data());
+  SetTitle(namst.Data());
+
+}
+
+//________________________________________________________________
+AliT0CalibData::AliT0CalibData(const AliT0CalibData& calibda) :
+  TNamed(calibda),fTimeDelayTVD(0),fWalk(),fSlewingLED(),fSlewingRec()
+{
+// copy constructor
+  SetName(calibda.GetName());
+  SetTitle(calibda.GetName());
+
+
+}
+
+//________________________________________________________________
+AliT0CalibData &AliT0CalibData::operator =(const AliT0CalibData& calibda)
+{
+// assignment operator
+  SetName(calibda.GetName());
+  SetTitle(calibda.GetName());
+  return *this;
+}
+
+//________________________________________________________________
+AliT0CalibData::~AliT0CalibData()
+{
+
+}
+//________________________________________________________________
+void AliT0CalibData::Reset()
+{
+    memset(fTimeDelayCFD,1,24*sizeof(Float_t));
+    memset(fTimeDelayLED,1,24*sizeof(Float_t));
+    memset(fGain,1,24*sizeof(Float_t));
+}
+
+
+//________________________________________________________________
+void  AliT0CalibData::Print(Option_t*) const
+{
+
+  printf("\n   ----    PM Arrays       ----\n\n");
+  printf(" Time delay CFD \n");
+  for (Int_t i=0; i<24; i++) printf("  %f",fTimeDelayCFD[i]);
+  printf(" \n LED \n");
+  for (Int_t i=0; i<24; i++) printf("  %f",fTimeDelayLED[i]);
+  printf(" \n Gain \n");
+  for (Int_t i=0; i<24; i++) printf("  %f",fGain[i]);
+  printf(" \n");
+} 
+
+
+
+//________________________________________________________________
+void AliT0CalibData::SetTimeDelayCFD(Float_t* TimeDelay)
+{
+  if(TimeDelay) for(int t=0; t<24; t++) fTimeDelayCFD[t] = TimeDelay[t];
+  //  else for(int t=0; t<24; t++) fTimeDelay[t] = 0.;
+}
+//________________________________________________________________
+void AliT0CalibData::SetTimeDelayLED(Float_t* TimeDelay)
+{
+  if(TimeDelay) for(int t=0; t<24; t++) fTimeDelayLED[t] = TimeDelay[t];
+  //  else for(int t=0; t<24; t++) fTimeDelay[t] = 0.;
+}
+
+//________________________________________________________________
+void AliT0CalibData::SetGain(Float_t* Gain)
+{
+  if(Gain) for(int t=0; t<24; t++) fGain[t] = Gain[t];
+  // else for(int t=0; t<24; t++) fGain[t] = 0.;
+}
+
+
+//________________________________________________________________
+void AliT0CalibData::SetWalk(Int_t ipmt, const Char_t *filename)
+{
+
+  TFile *file = new TFile(filename);
+  char funcname[256];
+  sprintf(funcname,"CFD%i",ipmt+1);
+  TF1* gr = (TF1*)file->Get(funcname);
+  fWalk.AddAtAndExpand(gr,ipmt);
+  file->Close();
+}
+
+
+//________________________________________________________________
+
+void AliT0CalibData::SetSlewingLED(Int_t ipmt,const Char_t *filename)
+{
+  Float_t mv, ps; 
+  Float_t x[100], y[100];
+  string buffer;
+  
+  ifstream inFile(filename);
+  if(!inFile) {AliError(Form("Cannot open file %s !",filename));}
+  
+  inFile >> mv>>ps;
+  Int_t i=0;
+  
+  while(getline(inFile,buffer)){
+    x[i]=mv; y[i]=ps;  
+    inFile >> mv >> ps;
+    i++;
+  }
+  inFile.close();
+  TGraph* gr = new TGraph(i,x,y);
+  fSlewingLED.AddAtAndExpand(gr,ipmt);
+   
+}
+
+//________________________________________________________________
+
+void AliT0CalibData::SetSlewingRec(Int_t ipmt,const Char_t *filename)
+{
+  Float_t mv, ps; 
+  Float_t x[100], y[100];
+  string buffer;
+  
+  ifstream inFile(filename);
+  if(!inFile) {AliError(Form("Cannot open file %s !",filename));}
+  
+  inFile >> mv>>ps;
+  Int_t i=0;
+  
+  while(getline(inFile,buffer)){
+    x[i]=mv; y[i]=ps;  
+    inFile >> mv >> ps;
+    i++;
+  }
+  inFile.close();
+  Float_t y1[100], x1[100];
+  for (Int_t ir=0; ir<i; ir++){
+    y1[ir]=y[i-ir]; x1[ir]=x[i-ir];}
+  TGraph* gr = new TGraph(i,y1,x1);
+  fSlewingRec.AddAtAndExpand(gr,ipmt);
+  
+}
+
+
diff --git a/T0/AliT0CalibData.h b/T0/AliT0CalibData.h
new file mode 100644 (file)
index 0000000..29a4e3a
--- /dev/null
@@ -0,0 +1,78 @@
+#ifndef AliT0CalibData_H
+#define AliT0CalibData_H
+
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+////////////////////////////////////////////////
+//  class for T0 calibration                 //
+////////////////////////////////////////////////
+
+#include "TNamed.h"
+#include "TF1.h"
+#include "AliT0CalibData.h"
+#include "TMap.h"
+#include "TGraph.h"
+#include "TString.h"
+#include "TObjArray.h"
+#include "AliT0.h"
+
+class AliT0CalibData: public TNamed {
+
+ public:
+  AliT0CalibData();
+  AliT0CalibData(const char* name);
+  AliT0CalibData(const AliT0CalibData &calibda);
+  AliT0CalibData& operator= (const AliT0CalibData &calibda);
+  virtual ~AliT0CalibData();
+  void Reset();
+  
+  virtual void  Print(Option_t* option= "") const; 
+  Float_t  GetTimeDelayCFD(Int_t channel) const {return fTimeDelayCFD[channel];}
+  Float_t* GetTimeDelayCFD()  const  {return(float*) fTimeDelayCFD;}
+  Float_t  GetTimeDelayLED(Int_t channel) const {return fTimeDelayLED[channel];}
+  Float_t* GetTimeDelayLED()  const  {return(float*) fTimeDelayLED;}
+
+  Float_t   GetGain(Int_t channel) const {return fGain[channel];}
+  Float_t*  GetGain()  const {return (float*)fGain;}
+  void     SetGain(Float_t val, Int_t channel)  {fGain[channel]=val;}
+  void     SetGain(Float_t* Gain);
+  
+  Float_t  GetWalk(Int_t ipmt, Float_t mv )  const {return ((TF1*)fWalk.At(ipmt))->Eval(mv);}
+  void SetWalk(Int_t ipmt, const Char_t *filename="calibr/re.root") ;
+
+   TGraph *  GetSlew(Int_t ipmt) const   {return (TGraph*)fSlewingLED.At(ipmt);}
+  Float_t  GetSlewingLED(Int_t ipmt, Float_t mv)  const 
+      {return((TGraph*)fSlewingLED.At(ipmt))->Eval(mv);}
+   TGraph *  GetSlewRec(Int_t ipmt) const   {return (TGraph*)fSlewingRec.At(ipmt);}
+  Float_t  GetSlewingRec(Int_t ipmt, Float_t mv)  const 
+      {return((TGraph*)fSlewingRec.At(ipmt))->Eval(mv);}
+
+  void SetSlewingLED(Int_t ipmt, const Char_t *filename) ;
+  void SetSlewingRec(Int_t ipmt, const Char_t *filename) ;
+
+  void     SetTimeDelayCFD(Float_t val, Int_t channel) {fTimeDelayCFD[channel]=val;}
+  void     SetTimeDelayCFD(Float_t* TimeDelay);
+  void     SetTimeDelayLED(Float_t val, Int_t channel) {fTimeDelayLED[channel]=val;}
+  void     SetTimeDelayLED(Float_t* TimeDelay);
+
+  void SetTimeDelayTVD(Int_t r=150)   { fTimeDelayTVD = r; };
+  Float_t GetTimeDelayTVD()   { return fTimeDelayTVD; }
+
+ protected:
+
+  Float_t  fTimeDelayCFD[24]; // Coeff. for time delay (24 different cables & CFD )
+  Float_t  fTimeDelayLED[24]; // Coeff. for time delay (24 different cables & CFD )
+  Float_t  fGain[24]; // Coeff. for gain (24 different cables & CFD )
+  Float_t fTimeDelayTVD; //time delay for TVD (vertex trigger channel)
+  TObjArray fWalk;  //time - amp. walk
+  TObjArray fSlewingLED;  //time - amp.LED slew
+  TObjArray fSlewingRec;  //time - amp. LED slew for reconstruction
+  //
+  ClassDef(AliT0CalibData,1)    // T0 Sensor Calibration data
+};
+
+typedef AliT0CalibData AliSTARTCalibData; // for backward compatibility
+
+#endif
+
diff --git a/T0/AliT0DataDCS.cxx b/T0/AliT0DataDCS.cxx
new file mode 100644 (file)
index 0000000..4b57970
--- /dev/null
@@ -0,0 +1,195 @@
+#include "AliT0DataDCS.h"
+
+#include "AliCDBMetaData.h"
+#include "AliDCSValue.h"
+#include "AliLog.h"
+
+#include <TTimeStamp.h>
+#include <TObjString.h>
+#include <TH2F.h>
+#include <TProfile.h>
+#include <TGraph.h>
+#include <TDatime.h>
+#include <TStyle.h>
+#include <TCanvas.h>
+
+ClassImp(AliT0DataDCS)
+
+//---------------------------------------------------------------
+AliT0DataDCS::AliT0DataDCS():
+       TObject(),
+       fRun(0),
+       fStartTime(0),
+       fEndTime(0),
+       fGraphs("TGraph",kNGraphs),
+       fIsProcessed(kFALSE)
+{
+       for(int i=0;i<kNHistos;i++) fHv[i]=0x0;
+        fFunc = 0;
+}
+
+//---------------------------------------------------------------
+AliT0DataDCS::AliT0DataDCS(Int_t nRun, UInt_t startTime, UInt_t endTime):
+       TObject(),
+       fRun(nRun),
+       fStartTime(startTime),
+       fEndTime(endTime),
+       fGraphs("TGraph",kNGraphs),
+       fIsProcessed(kFALSE)
+{
+       AliInfo(Form("\n\tRun %d \n\tStartTime %s \n\tEndTime %s", nRun,
+       TTimeStamp(startTime).AsString(),
+       TTimeStamp(endTime).AsString()));
+
+        fFunc = 0;
+       Init();
+
+}
+
+//---------------------------------------------------------------
+AliT0DataDCS::~AliT0DataDCS() {
+
+       for(int i=0;i<kNHistos;i++) {delete fHv[i]; fHv[i]=0;}
+       fGraphs.Clear("C");
+       fFunc=0;
+}
+
+//---------------------------------------------------------------
+void AliT0DataDCS::ProcessData(TMap& aliasMap){
+
+       if(!(fHv[0])) Init();
+
+       TObjArray *aliasArr;
+       AliDCSValue* aValue;
+       for(int j=0; j<kNAliases; j++){
+               aliasArr = (TObjArray*) aliasMap.GetValue(fAliasNames[j].Data());
+               if(!aliasArr){
+                       AliError(Form("Alias %s not found!", fAliasNames[j].Data()));
+                       continue;
+               }
+               Introduce(j, aliasArr);
+
+               if(aliasArr->GetEntries()<2){
+                       AliError(Form("Alias %s has just %d entries!",
+                                       fAliasNames[j].Data(),aliasArr->GetEntries()));
+                       continue;
+               }
+
+               TIter iterarray(aliasArr);
+
+               Double_t *time = new Double_t[aliasArr->GetEntries()];
+               Double_t *val = new Double_t[aliasArr->GetEntries()];
+
+               UInt_t ne=0;
+               while ((aValue = (AliDCSValue*) iterarray.Next())) {
+
+               val[ne] = aValue->GetFloat();
+               time[ne] = (Double_t) (aValue->GetTimeStamp());
+               // fill histos (alias 0-2)
+               if(j < 3) fHv[j]->Fill(val[ne]);
+               ne++;
+               }
+               // fill graphs (alias 3-5)
+               if(j >= 3) CreateGraph(j, aliasArr->GetEntries(), time, val);
+               delete[] val;
+               delete[] time;
+       }
+
+       // calculate mean and rms of the first two histos
+       for(int i=0;i<kNHistos;i++){
+               fMean[i] = fHv[i]->GetMean();
+               fWidth[i] = fHv[i]->GetRMS();
+       }
+
+       // pol1 fit of the first graph
+       if(fGraphs.GetEntries() > 0){
+               ((TGraph*) fGraphs.UncheckedAt(0))->Fit("pol1");
+               fFunc = ((TGraph*) fGraphs.UncheckedAt(0))->GetFunction("pol1");
+       }
+
+       fIsProcessed=kTRUE;
+
+
+}
+
+//---------------------------------------------------------------
+void AliT0DataDCS::Init(){
+
+       TH1::AddDirectory(kFALSE);
+
+       fGraphs.SetOwner(1);
+
+       for(int i=0;i<kNAliases;i++){
+               fAliasNames[i] = "DCSAlias";
+               fAliasNames[i] += i;
+       }
+
+       for(int i=0;i<kNHistos;i++){
+               fHv[i] = new TH1F(fAliasNames[i].Data(),fAliasNames[i].Data(), 20, kHvMin, kHvMax);
+               fHv[i]->GetXaxis()->SetTitle("Hv");
+       }
+}
+
+//---------------------------------------------------------------
+void AliT0DataDCS::Introduce(UInt_t numAlias, const TObjArray* aliasArr){
+
+       int entries=aliasArr->GetEntries();
+       AliInfo(Form("************ Alias: %s **********",fAliasNames[numAlias].Data()));
+       AliInfo(Form("          %d DP values collected",entries));
+
+}
+
+//---------------------------------------------------------------
+void AliT0DataDCS::CreateGraph(int i, int dim, const Double_t *x, const Double_t *y)
+{
+
+       TGraph *gr = new(fGraphs[fGraphs.GetEntriesFast()]) TGraph(dim, x, y);
+
+       gr->GetXaxis()->SetTimeDisplay(1);
+       gr->SetTitle(fAliasNames[i].Data());
+
+       AliInfo(Form("Array entries: %d",fGraphs.GetEntriesFast()));
+
+
+}
+
+//---------------------------------------------------------------
+void AliT0DataDCS::Draw(const Option_t* /*option*/)
+{
+// Draw all histos and graphs
+
+  if(!fIsProcessed) return;
+
+  TCanvas *ch;
+  TString canvasHistoName="Histos";
+  ch=new TCanvas(canvasHistoName,canvasHistoName,20,20,600,600);
+  ch->Divide(2,2);
+  ch->cd(1);
+  fHv[0]->Draw();
+  ch->cd(2);
+  fHv[1]->Draw();
+  ch->cd(3);
+  fHv[2]->Draw();
+
+
+  if(fGraphs.GetEntries() == 0) return;
+
+  TCanvas *cg;
+  TString canvasGraphName="Graphs";
+  cg=new TCanvas(canvasGraphName,canvasGraphName,40,40,600,600);
+  cg->Divide(2,2);
+  cg->cd(1);
+  ((TGraph*) fGraphs.UncheckedAt(0))->Draw("alp");
+  
+  cg->cd(2);
+  ((TGraph*) fGraphs.UncheckedAt(1))->Draw("alp");
+  cg->cd(3);
+  ((TGraph*) fGraphs.UncheckedAt(2))->Draw("alp");
+
+  if(fFunc){
+       cg->cd(4);
+       fFunc->Draw("l");
+  }
+}
+
diff --git a/T0/AliT0DataDCS.h b/T0/AliT0DataDCS.h
new file mode 100644 (file)
index 0000000..ae261ec
--- /dev/null
@@ -0,0 +1,69 @@
+#ifndef AliT0DataDCS_H
+#define AliT0DataDCS_H
+
+#include <TMap.h>
+#include <TClonesArray.h>
+#include <TH2F.h>
+#include <TGraph.h>
+#include <TF1.h>
+
+class AliT0DataDCS : public TObject {
+public:
+       enum {kNAliases=6, kNHistos=3, kNGraphs=3, kNFunctions=2};
+       enum {kHvMin=0, kHvMax=20};
+
+       AliT0DataDCS();
+       AliT0DataDCS(Int_t nRun, UInt_t startTime, UInt_t endTime);
+       ~AliT0DataDCS();
+
+       void SetRun(Int_t run) {fRun = run;}
+       void SetStartTime(Int_t startTime) {fStartTime = startTime;}
+       void SetEndTime(Int_t endTime) {fEndTime = endTime;}
+       Int_t GetRun() {return fRun;}
+       Int_t GetStartTime() {return fStartTime;}
+       Int_t GetEndTime() {return fEndTime;}
+
+       void ProcessData(TMap& aliasMap);
+
+       const char* GetAliasName(UInt_t pos)
+                       {return pos<kNAliases ? fAliasNames[pos].Data() : 0;}
+       const TH1F* GetHisto(UInt_t pos) 
+                       {return pos<kNHistos ? fHv[pos] : 0;}
+
+       Float_t GetMean(UInt_t pos) {return pos<kNHistos ? fMean[pos] : 0;}
+       Float_t GetWidth(UInt_t pos) {return pos<kNHistos ? fWidth[pos] : 0;}
+
+       const TGraph* GetGraph(UInt_t pos)
+                       {return pos<kNGraphs ? ((TGraph*) fGraphs.UncheckedAt(pos)) : 0;}
+
+       const TF1* GetFunction() {return fFunc;}
+
+       Double_t Eval(int pos, Double_t time)
+                       {return pos<kNGraphs ? ((TGraph*) fGraphs.UncheckedAt(pos))->Eval(time) : -1;}
+
+       void Draw(const Option_t* option);
+
+
+private:
+       void Init();
+       void Introduce(UInt_t numAlias, const TObjArray* aliasArr);
+       void CreateGraph(int i, int dim, const Double_t *x, const Double_t *y);
+
+       Int_t fRun;
+       UInt_t fStartTime;
+       UInt_t fEndTime;
+
+       Float_t fMean[kNHistos];
+       Float_t fWidth[kNHistos];
+
+       TString fAliasNames[kNAliases];
+       TH1F *fHv[kNHistos];
+       TClonesArray fGraphs;
+       TF1 *fFunc;
+
+       Bool_t fIsProcessed;
+
+       ClassDef(AliT0DataDCS, 2);
+};
+
+#endif
diff --git a/T0/AliT0Digitizer.cxx b/T0/AliT0Digitizer.cxx
new file mode 100644 (file)
index 0000000..55a2213
--- /dev/null
@@ -0,0 +1,359 @@
+
+/**************************************************************************
+ * 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 <TFile.h>
+#include <TDirectory.h>
+#include <TRandom.h>
+#include <TArrayI.h>
+#include <TError.h>
+#include <TH1F.h>
+#include <TGraph.h>
+
+#include "AliLog.h"
+#include "AliT0Digitizer.h"
+#include "AliT0.h"
+#include "AliT0hit.h"
+#include "AliT0digit.h"
+#include "AliRunDigitizer.h"
+#include <AliDetector.h>
+#include "AliRun.h"
+#include <AliLoader.h>
+#include <AliRunLoader.h>
+#include <stdlib.h>
+#include <Riostream.h>
+#include <Riostream.h>
+#include "AliT0Parameters.h"
+#include "AliCDBLocal.h"
+#include "AliCDBStorage.h"
+#include "AliCDBManager.h"
+#include "AliCDBEntry.h"
+
+ClassImp(AliT0Digitizer)
+
+//___________________________________________
+  AliT0Digitizer::AliT0Digitizer()  :AliDigitizer()
+{
+// Default ctor - don't use it
+  ;
+}
+
+//___________________________________________
+AliT0Digitizer::AliT0Digitizer(AliRunDigitizer* manager) 
+  :AliDigitizer(manager),
+   fT0(0),
+   fHits(0),
+   fdigits(0),
+   ftimeCFD(0),
+   ftimeLED(0),
+   fADC(0),
+   fADC0(0)
+{
+// ctor which should be used
+
+  AliDebug(1,"processed");
+
+  fT0 = 0;
+  fHits = 0;
+  fdigits = 0;
+
+  ftimeCFD = new TArrayI(24); 
+  fADC = new TArrayI(24); 
+  ftimeLED = new TArrayI(24); 
+  fADC0 = new TArrayI(24); 
+  
+
+}
+
+//------------------------------------------------------------------------
+AliT0Digitizer::~AliT0Digitizer()
+{
+// Destructor
+
+  AliDebug(1,"T0");
+
+  delete ftimeCFD;
+  delete fADC;
+  delete ftimeLED;
+  delete  fADC0;
+}
+
+ //------------------------------------------------------------------------
+Bool_t AliT0Digitizer::Init()
+{
+// Initialization
+  AliDebug(1," Init");
+ return kTRUE;
+}
+
+//---------------------------------------------------------------------
+
+void AliT0Digitizer::Exec(Option_t* /*option*/)
+{
+
+  /*
+    Produde digits from hits
+        digits is TObject and includes
+       We are writing array if left & right  TDC
+       left & right  ADC (will need for slow simulation)
+       TOF first particle left & right
+       mean time and time difference (vertex position)
+       
+  */
+
+  //output loader 
+  AliRunLoader *outRL = AliRunLoader::GetRunLoader(fManager->GetOutputFolderName());
+  AliLoader * pOutStartLoader = outRL->GetLoader("T0Loader");
+
+  AliDebug(1,"start...");
+  //input loader
+  //
+  // From hits to digits
+  //
+ Int_t hit, nhits;
+  Int_t countE[24];
+  Int_t volume, pmt, trCFD, trLED; 
+  Float_t sl, qt;
+  Int_t  bestRightTDC, bestLeftTDC, qtCh;
+  Float_t time[24], besttime[24], timeGaus[24] ;
+    //Q->T-> coefficients !!!! should be asked!!!
+  Float_t gain[24],timeDelayCFD[24], timeDelayLED[24];
+  Int_t threshold =50; //photoelectrons
+  Float_t zdetA, zdetC;
+   Int_t sumMultCoeff = 100;
+  TObjArray slewingLED;
+  TObjArray slewingRec;
+  AliT0Parameters* param = AliT0Parameters::Instance();
+  param->Init();
+
+  Int_t ph2Mip = param->GetPh2Mip();     
+  Int_t channelWidth = param->GetChannelWidth() ;  
+  Float_t delayVertex = param->GetTimeDelayTVD();
+  for (Int_t i=0; i<24; i++){
+    timeDelayCFD[i] = param->GetTimeDelayCFD(i);
+    timeDelayLED[i] = param->GetTimeDelayLED(i);
+    gain[i] = param->GetGain(i);
+    TGraph* gr = param ->GetSlew(i);
+    slewingLED.AddAtAndExpand(gr,i);
+
+    TGraph* gr1 = param ->GetSlewRec(i);
+    slewingRec.AddAtAndExpand(gr1,i);
+
+    TGraph* grEff = param ->GetPMTeff(i);
+    fEffPMT.AddAtAndExpand(grEff,i);
+  }
+  zdetC = param->GetZposition(0);
+  zdetA = param->GetZposition(1);
+  
+  AliT0hit  *startHit;
+  TBranch *brHits=0;
+  
+  Int_t nFiles=fManager->GetNinputs();
+  for (Int_t inputFile=0; inputFile<nFiles;  inputFile++) {
+    if (inputFile < nFiles-1) {
+       AliWarning(Form("ignoring input stream %d", inputFile));
+       continue;
+       
+    }
+    
+    Float_t besttimeright=99999.;
+    Float_t besttimeleft=99999.;
+    Int_t pmtBestRight=9999;
+    Int_t pmtBestLeft=9999;
+    Int_t timeDiff=999, meanTime=0;
+    Int_t sumMult =0;   fSumMult=0;
+    bestRightTDC = 99999;  bestLeftTDC = 99999;
+    ftimeCFD -> Reset();
+    fADC -> Reset();
+    fADC0 -> Reset();
+    ftimeLED ->Reset();
+    for (Int_t i0=0; i0<24; i0++)
+      {
+       time[i0]=besttime[i0]=timeGaus[i0]=99999; countE[i0]=0;
+      }
+    AliRunLoader * inRL = AliRunLoader::GetRunLoader(fManager->GetInputFolderName(inputFile));
+    AliLoader * pInStartLoader = inRL->GetLoader("T0Loader");
+    if (!inRL->GetAliRun()) inRL->LoadgAlice();
+    AliT0 *fT0  = (AliT0*)inRL ->GetAliRun()->GetDetector("T0");
+
+       //read Hits 
+    pInStartLoader->LoadHits("READ");//probably it is necessary to load them before
+    TClonesArray *fHits = fT0->Hits ();
+    TTree *th = pInStartLoader->TreeH();
+    brHits = th->GetBranch("T0");
+    if (brHits) {
+      fT0->SetHitsAddressBranch(brHits);
+    }else{
+      AliError("Branch T0 hit not found");
+      exit(111);
+    } 
+    Int_t ntracks    = (Int_t) th->GetEntries();
+    
+    if (ntracks<=0) return;
+    // Start loop on tracks in the hits containers
+    for (Int_t track=0; track<ntracks;track++) {
+      brHits->GetEntry(track);
+      nhits = fHits->GetEntriesFast();
+      for (hit=0;hit<nhits;hit++) 
+       {
+         startHit   = (AliT0hit*) fHits->UncheckedAt(hit);
+         if (!startHit) {
+           AliError("The unchecked hit doesn't exist");
+           break;
+         }
+         pmt=startHit->Pmt();
+         Int_t numpmt=pmt-1;
+         Double_t e=startHit->Etot();
+         volume = startHit->Volume();
+         
+         //      if(e>0 && RegisterPhotoE(numpmt,e)) {
+         if(e>0 ) {
+           countE[numpmt]++;
+           besttime[numpmt] = startHit->Time();
+           if(besttime[numpmt]<time[numpmt])
+             {
+               time[numpmt]=besttime[numpmt];
+             }
+         } //photoelectron accept 
+       } //hits loop
+    } //track loop
+    
+    //spread time right&left by 25ps   && besttime
+    Float_t c = 0.0299792; // cm/ps
+    
+    Float_t koef=(zdetA-zdetC)/c; //correction position difference by cable
+    for (Int_t ipmt=0; ipmt<12; ipmt++){
+      if(countE[ipmt] > threshold) {
+       timeGaus[ipmt]=gRandom->Gaus(time[ipmt],25)+koef;
+       if(timeGaus[ipmt]<besttimeleft){
+         besttimeleft=timeGaus[ipmt]; //timeleft
+         pmtBestLeft=ipmt;}
+     }
+    }
+     for ( Int_t ipmt=12; ipmt<24; ipmt++){
+      if(countE[ipmt] > threshold) {
+       timeGaus[ipmt]=gRandom->Gaus(time[ipmt],25); 
+       if(timeGaus[ipmt]<besttimeright) {
+         besttimeright=timeGaus[ipmt]; //timeright
+         pmtBestRight=ipmt;}
+      }        
+    }
+   //folding with alignmentz position distribution  
+    if( besttimeleft > 10000. && besttimeleft <15000)
+      bestLeftTDC=Int_t ((besttimeleft+1000*timeDelayCFD[pmtBestLeft])
+                        /channelWidth);
+    if( besttimeright > 10000. && besttimeright <15000)
+      bestRightTDC=Int_t ((besttimeright+1000*timeDelayCFD[pmtBestRight])
+                       /channelWidth);
+
+    if (bestRightTDC < 99999 && bestLeftTDC < 99999)
+      {
+       timeDiff=Int_t (((besttimeleft-besttimeright)+1000*delayVertex)
+                       /channelWidth);
+       meanTime=Int_t (((besttimeright+1000*timeDelayCFD[pmtBestLeft]+
+                         besttimeleft+1000*timeDelayCFD[pmtBestLeft])/2.)
+                       /channelWidth);
+      }
+       AliDebug(10,Form(" time right& left %i %i  time diff && mean time in channels %i %i",bestRightTDC,bestLeftTDC, timeDiff, meanTime));
+    for (Int_t i=0; i<24; i++)
+      {
+               Float_t  al = countE[i]; 
+       if (al>threshold && timeGaus[i]<50000 ) {
+         //fill ADC
+         // QTC procedure:
+         // phe -> mV 0.3; 1MIP ->500phe -> ln (amp (mV)) = 5;
+         // max 200ns, HIJING  mean 50000phe -> 15000mv -> ln = 15 (s zapasom)
+         // channel 25ps
+         qt= 50.*al*gain[i]/ph2Mip;  // 50mv/Mip amp in mV 
+         //  fill TDC
+         trCFD = Int_t (timeGaus[i] + 1000.*timeDelayCFD[i])/channelWidth; 
+         trLED= Int_t (timeGaus[i] + 1000.*timeDelayLED[i]); 
+         sl = ((TGraph*)slewingLED.At(i))->Eval(qt);
+         trLED = Int_t(( trLED + 1000*sl )/channelWidth);
+         qtCh=Int_t (1000.*TMath::Log(qt)) / channelWidth;
+         fADC0->AddAt(0,i);
+         fADC->AddAt(qtCh,i);
+         ftimeCFD->AddAt(Int_t (trCFD),i);
+         ftimeLED->AddAt(trLED,i); 
+         //      sumMult += Int_t ((al*gain[i]/ph2Mip)*50) ;
+         sumMult += Int_t (qt/sumMultCoeff)  ;
+        
+       AliDebug(10,Form("  pmt %i : time in ns %f time in channels %i   ",
+                       i, timeGaus[i],trCFD ));
+       AliDebug(10,Form(" qt in mV %f qt in ns %f qt in channels %i   ",qt, 
+                       TMath::Log(qt), qtCh));
+       }
+      } //pmt loop
+
+    if (sumMult > threshold){
+      fSumMult =  Int_t (1000.* TMath::Log(Double_t(sumMult) / Double_t(sumMultCoeff))
+                        /channelWidth);
+      AliDebug(10,Form("summult mv %i   mult  in chammens %i in ps %i ", 
+                     sumMult, fSumMult, fSumMult*channelWidth));
+    }
+    //     if (  besttimeright<99999 || besttimeleft < 99999) {
+
+      fT0->AddDigit(bestRightTDC,bestLeftTDC,meanTime,timeDiff,fSumMult,
+                      ftimeCFD,fADC,ftimeLED,fADC0);
+      //     } 
+     
+      AliDebug(10,Form(" Digits wrote bestRightTDC %i bestLeftTDC %i  meanTime %i  timeDiff %i fSumMult %i ", bestRightTDC,bestLeftTDC,meanTime,timeDiff,fSumMult ));
+    pOutStartLoader->UnloadHits();
+  } //input streams loop
+  
+    //load digits    
+    pOutStartLoader->LoadDigits("UPDATE");
+    TTree *treeD  = pOutStartLoader->TreeD();
+    if (treeD == 0x0) {
+      pOutStartLoader->MakeTree("D");
+      treeD = pOutStartLoader->TreeD();
+    }
+    treeD->Reset();
+    fT0  = (AliT0*)outRL ->GetAliRun()->GetDetector("T0");
+    // Make a branch in the tree 
+    fT0->MakeBranch("D");
+     treeD->Fill();
+  
+     pOutStartLoader->WriteDigits("OVERWRITE");
+     
+     fT0->ResetDigits();
+     pOutStartLoader->UnloadDigits();
+     
+}
+
+
+//------------------------------------------------------------------------
+Bool_t AliT0Digitizer::RegisterPhotoE(Int_t ipmt,Double_t energy)
+{
+
+  
+  //  Float_t hc=197.326960*1.e6; //mev*nm
+  Double_t hc=1.973*1.e-6; //gev*nm
+  Float_t lambda=hc/energy;
+  Float_t eff = ((TGraph*) fEffPMT.At(ipmt))->Eval(lambda);
+  Double_t  p = gRandom->Rndm();
+
+  if (p > eff)
+    return kFALSE;
+  
+  return kTRUE;
+}
+
+//----------------------------------------------------------------------------
diff --git a/T0/AliT0Digitizer.h b/T0/AliT0Digitizer.h
new file mode 100644 (file)
index 0000000..cf2a2f6
--- /dev/null
@@ -0,0 +1,55 @@
+#ifndef ALIT0DIGITIZER_H
+#define ALIT0DIGITIZER_H
+/* Copyright(c) 1998-2000, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+#include <AliDigitizer.h>
+#include <AliLoader.h>
+#include <AliRunLoader.h>
+
+#include <AliRunDigitizer.h>
+class AliT0;
+class AliT0hit;
+class AliT0digit;
+
+class AliT0Digitizer : public AliDigitizer {
+ public:
+  
+  AliT0Digitizer();
+  AliT0Digitizer(AliRunDigitizer * manager);
+  virtual ~AliT0Digitizer();
+  virtual Bool_t Init();
+  TClonesArray *Hits() const {return fHits;}
+  TArrayI *timeCFD() {return ftimeCFD;}
+  TArrayI *timeLED() {return ftimeLED;}
+  TArrayI * ADC() {return fADC;} 
+   TArrayI * ADC0() {return fADC0;} 
+
+  // Do the main work
+  void Exec (Option_t* /*option=0*/) ;
+  Bool_t RegisterPhotoE(Int_t impt, Double_t energy);
+  enum {kBgTag = -1};
+private:
+
+  AliT0 *fT0;          //!
+  TClonesArray *fHits      ; //! List of hits
+  AliT0digit *fdigits   ; //! digits
+  TArrayI *ftimeCFD    ; //! array of CFD signal 
+  TArrayI *ftimeLED    ; //! array of (LED-GFD) time (amplitude)
+  TArrayI *fADC     ;//! array of QTC signals (main amplitude)
+  TArrayI *fADC0     ;//! array of QTC signals (main amplitude)
+  Int_t fSumMult; // multiplicity
+  TObjArray fEffPMT; //pmt registration effeicincy
+
+  AliT0Digitizer(const AliT0Digitizer&);
+  AliT0Digitizer& operator=(const AliT0Digitizer);
+
+  
+    ClassDef(AliT0Digitizer,1)
+};    
+
+typedef AliT0Digitizer AliSTARTDigitizer; // for backward compatibility
+
+#endif
+
diff --git a/T0/AliT0Dqclass.cxx b/T0/AliT0Dqclass.cxx
new file mode 100644 (file)
index 0000000..9b33618
--- /dev/null
@@ -0,0 +1,68 @@
+/**************************************************************************
+ * 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.                  *
+ **************************************************************************/
+
+/* $Id$ */
+
+///////////////////////////////////////////////////////////////////////////////
+//                                                                           //
+// Output of T0 DAQ                                                         //
+//                                                                           //
+///////////////////////////////////////////////////////////////////////////////
+
+#include "AliT0Dqclass.h"
+
+ClassImp(AliT0Dqclass)
+
+//________________________________________________________________
+AliT0Dqclass::AliT0Dqclass()
+{
+//  fHistMeanPed=0;
+  Reset();
+}
+
+//________________________________________________________________
+AliT0Dqclass::AliT0Dqclass(const char* name)
+{
+  // Constructor
+  TString namst = "Calib_";
+  namst += name;
+  SetName(namst.Data());
+  SetTitle(namst.Data());
+//  fHistMeanPed=0;
+  Reset();
+}
+
+
+//________________________________________________________________
+AliT0Dqclass::~AliT0Dqclass()
+{
+//  CleanHistos();
+}
+
+//________________________________________________________________
+void AliT0Dqclass::Reset()
+{
+  // Reset
+  memset(fTime,0,24*sizeof(Float_t));
+  memset(fAmplitude,0,24*sizeof(Float_t));
+}                                                                                       
+
+
+//________________________________________________________________
+void  AliT0Dqclass::Print(Option_t *) const
+{
+
+} 
+
diff --git a/T0/AliT0Dqclass.h b/T0/AliT0Dqclass.h
new file mode 100644 (file)
index 0000000..522541a
--- /dev/null
@@ -0,0 +1,44 @@
+#ifndef DAQ
+#define DAQ
+
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+////////////////////////////////////////////////
+//  class for T0 DAQ output                   //
+////////////////////////////////////////////////
+
+#include "TNamed.h"
+
+
+class AliT0Dqclass: public TNamed {
+
+ public:
+  AliT0Dqclass( );
+  AliT0Dqclass(const char* name);
+  virtual ~AliT0Dqclass();
+  void Reset();
+  virtual void  Print(Option_t *) const; 
+  //
+
+  Float_t  GetTime(Int_t channel)         const {return fTime[channel];}
+  Float_t* GetTime()                      const {return (float*)fTime;}
+  Float_t  GetAmplitude(Int_t channel)     const {return fAmplitude[channel];}
+  Float_t* GetAmplitude()                 const {return (float*)fAmplitude;}
+
+  void  SetTime(Int_t channel, Float_t val) {fTime[channel]=val;}
+  void  SetAmplitude(Int_t channel, Float_t val) {fAmplitude[channel]=val;}
+
+
+ protected:
+  // --- Pedestals
+  Float_t  fTime[24];            // Mean pedestal values 
+  Float_t  fAmplitude[24];      // Mean pedestal values 
+  Float_t  fTotTime[24];
+
+  ClassDef(AliT0Dqclass,1)      // DAQ data
+};
+
+typedef AliT0Dqclass AliSTARTDqclass; // for backward compatibility
+
+#endif
diff --git a/T0/AliT0Hist.cxx b/T0/AliT0Hist.cxx
new file mode 100644 (file)
index 0000000..76b4da9
--- /dev/null
@@ -0,0 +1,111 @@
+#include "AliT0RawReader.h"
+#include "AliT0RawData.h"
+#include "/home/alla/AliRoot/verynew/RAW/AliRawReaderFile.h"
+
+
+#include <Riostream.h>
+#include "TMath.h"
+#include "TH1F.h"
+#include "TH2F.h"
+#include "TArrayI.h"
+#include "AliT0Hist.h"  
+#include "AliRunLoader.h"
+#include "AliLoader.h"
+#include "/home/alla/AliRoot/verynew/RAW/AliRawReader.h"
+#include "/home/alla/AliRoot/verynew/RAW/AliRawReaderFile.h"
+#include "AliT0RawReader.h"
+ClassImp(AliT0Hist)
+
+  AliT0Hist::AliT0Hist() : TObject()
+{
+  fhADCR = new TH1F("hADCR","ADC right",100,1.,500);
+  fhADCL = new TH1F("hADCL","ADC right",100,1.,500);
+  fhTimeR = new TH1F("hTimeR","Time Right",100,400,1000);
+  fhTimeL = new TH1F("hTimeL","Time Left",100,10,500);
+  fhBestTimeR = new TH1F("hBestTimeR","Time Right",100,400,1000);
+  fhBestTimeL = new TH1F("hBestTimeL","Time Left",100,0,500);
+  fhADCDet = new TH1F("hADCDet","ADC vs Ndet",30,0.,30);
+  fhTimeDet = new TH1F("hTimeDet","Time vs Ndet",30,0,30);
+  fhTimeDiff = new TH1F("hTimeDiff"," Time diff",100,350,450);
+  fhMeanTime = new TH1F("hMeanTime"," Mean Time ",100,250,350);
+  fhT0detR = new TH1F("hT0detR"," T0 vs Ndet right ",15,0,15);
+  fhT0detL = new TH1F("hT0detL"," T0 vs Ndet left ",15,0,15);
+  fhTimevsADCL = new TH2F("hTimevsADCL","time vs ADC left",100,0,500,100,1,500);
+  fhTimevsADCR = new TH2F("hTimevsADCR","time vs ADC right",100,0,500,100,400,1000);
+}
+
+
+  AliT0Hist::~AliT0Hist()
+{
+  /*
+  delete fhADCR;
+  delete fhADCL;
+  delete fhTimeR;
+  delete fhTimeL;
+  delete fhBestTimeR;
+  delete fhBestTimeL;
+  delete fhADCDet;
+  delete fhTimeDet;
+  delete fhTimeDiff;
+  delete fhMeanTime;
+  delete fhT0detR;
+  delete fhT0detL;
+  delete fhTimevsADCL;
+  */
+}
+
+void AliT0Hist::FillHist(AliRunLoader* runLoader, 
+                           AliRawReader* rawReader) const 
+{
+
+   TArrayI *fTime= new TArrayI(24);
+   TArrayI *fADC = new TArrayI(24);
+   AliT0RawReader myrawreader;
+   
+
+   
+  Int_t iEvent = 0;
+  while (rawReader->NextEvent()) {
+      runLoader->GetEvent(iEvent++);
+      
+      myrawreader.NextThing( rawReader);
+      myrawreader.GetTime(*fTime);
+      myrawreader.GetADC(*fADC);
+      
+      Int_t besttimeleft=99999;
+      Int_t besttimeright=99999;
+      Int_t ibestR=999; Int_t ibestL=999;
+      for (Int_t i=0; i<12; i++ )
+       {
+         Int_t timel=fTime->At(i);
+         if(timel<besttimeleft && timel!=0) { besttimeleft=timel; ibestL=i;}
+         fhTimeL->Fill(timel);
+         fhTimeDet->Fill(i,timel);
+         Int_t adcl=fADC->At(i);
+         fhADCL->Fill(adcl);
+         fhADCDet->Fill(i,adcl);
+         Int_t timer=fTime->At(i+12);
+         if(timer<besttimeright && timer!=0){ besttimeright=timer; ibestR=i;}
+         fhTimeDet->Fill(i+12,timer);
+         fhTimeR->Fill(timer);
+         Int_t adcr=fADC->At(i+12);
+         fhADCR->Fill(adcr);
+         fhADCDet->Fill(i+12,adcr);
+         fhTimevsADCL->Fill(adcl,timel);
+         fhTimevsADCR->Fill(adcr,timer);
+
+       }
+      
+      fhBestTimeR->Fill(besttimeright);
+      fhBestTimeL->Fill(besttimeleft);
+      Int_t timeDiff1=besttimeright-besttimeleft;
+      Float_t meanTime=(besttimeright+besttimeleft)/2.;
+      fhTimeDiff->Fill(timeDiff1);
+      fhMeanTime->Fill(meanTime);
+      //     Float_t  timeDiff2=((besttimeright-besttimeleft)-(350.-69.7))/2;
+      fhT0detR->Fill(ibestR); fhT0detL->Fill(ibestL);
+  }
+}
+
+
+
diff --git a/T0/AliT0Hist.h b/T0/AliT0Hist.h
new file mode 100644 (file)
index 0000000..2f9dbcf
--- /dev/null
@@ -0,0 +1,56 @@
+#ifndef ALIT0HIST_H
+#define ALIT0HIST_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+/* $Id$ */
+
+#include "TH1F.h"
+#include "TH2F.h"
+#include "TArrayI.h"
+#include "AliRunLoader.h"
+#include "/home/alla/AliRoot/verynew/RAW/AliRawReader.h"
+
+class AliT0Hist: public TObject
+{
+ public:
+  AliT0Hist();
+  virtual ~AliT0Hist();
+  void  FillHist(AliRunLoader* runLoader,
+                AliRawReader* rawReader) const;
+   TH1F * hTimeR() {return fhTimeR;} 
+   TH1F * hTimeL() {return fhTimeL;}
+   TH1F *hADCR()   {return fhADCL;}
+   TH1F *hADCL() {return fhADCR;} 
+   TH1F * hBestTimeR() {return fhBestTimeR;} 
+   TH1F * hBestTimeL() {return fhBestTimeL;}
+   TH1F * hTimeDet() {return fhTimeDet;} 
+   TH1F * hADCDet() {return fhADCDet;}
+   TH1F * hTimeDiff() {return fhTimeDiff;} 
+   TH1F * hMeanTime() {return fhMeanTime;}
+   TH1F * hT0detL() {return   fhT0detL;}
+   TH1F * hT0detR() {return   fhT0detR;}
+   TH2F * hTimevsADCR() {return fhTimevsADCR;}
+   TH2F * hTimevsADCL() {return fhTimevsADCL;}
+   
+ private:
+   TH1F *fhTimeR;
+   TH1F *fhTimeL;
+   TH1F *fhADCL;
+   TH1F *fhADCR;
+   TH1F *fhBestTimeR;
+   TH1F *fhBestTimeL;
+   TH1F *fhADCDet;
+   TH1F *fhTimeDet;
+   TH1F *fhMeanTime;
+   TH1F *fhTimeDiff;
+   TH1F * fhT0detL;
+   TH1F * fhT0detR;
+   TH2F  *fhTimevsADCR;
+   TH2F  *fhTimevsADCL;
+   
+   ClassDef(AliT0Hist, 0)   // class for the T0 reconstruction
+
+};
+
+#endif
diff --git a/T0/AliT0Loader.cxx b/T0/AliT0Loader.cxx
new file mode 100644 (file)
index 0000000..5852b09
--- /dev/null
@@ -0,0 +1,39 @@
+//////////////////////////////////////////////////////////////////////////////
+//                                                                          //
+// Loader for T0 digits and RecPoints inherit from AliBaseDataLoader     //
+// T0Digits is TObject  consists time flight signal from each PMTtube,   //
+// mean time right and left array (start signal) and time differnce         //
+// (vertex z position)                                                      // 
+// T0 RecPoints is TObject with mean time (start signal)                 // 
+// and evrtex position  (cm)                                                //
+/////////////////////////////////////////////////////////////////////////////
+#include "AliT0Loader.h"
+#include "AliConfig.h"
+#include "AliRunLoader.h"
+
+
+ClassImp(AliT0Loader)
+
+/*****************************************************************************/ 
+void AliT0Loader::InitObjectLoaders()
+{
+// use an object instead of a tree for digits and rec points
+
+  // D I G I T S  
+  if (fDataLoaders->At(kDigits)) {
+    delete fDataLoaders->Remove(fDataLoaders->At(kDigits));
+  }
+  AliDataLoader* dl = new AliDataLoader(fDetectorName + ".Digits.root","T0_D", "Digits","O");//we want to have object data not tree
+  AliTaskLoader* tl = new AliTaskLoader(fDetectorName + AliConfig::Instance()->GetDigitizerTaskName(),dl,AliRunLoader::GetRunDigitizer(),kTRUE);
+  dl->SetBaseTaskLoader(tl);
+  fDataLoaders->AddAt(dl,kDigits);
+
+  // R E C O N S T R U C T E D   P O I N T S, here: V E R T E X
+  if (fDataLoaders->At(kRecPoints)) {
+    delete fDataLoaders->Remove(fDataLoaders->At(kRecPoints));
+  }
+  dl = new AliDataLoader(fDetectorName + ".RecPoints.root","T0_V", "Reconstructed Points","O");//we want to have object data not tree
+  tl = new AliTaskLoader(fDetectorName + AliConfig::Instance()->GetReconstructionerTaskName(),dl,AliRunLoader::GetRunReconstructioner(),kTRUE);
+  dl->SetBaseTaskLoader(tl);
+  fDataLoaders->AddAt(dl,kRecPoints);  
+}
diff --git a/T0/AliT0Loader.h b/T0/AliT0Loader.h
new file mode 100644 (file)
index 0000000..51a9e4d
--- /dev/null
@@ -0,0 +1,32 @@
+#ifndef ALIT0LOADER_H
+#define ALIT0LOADER_H
+
+#include "AliLoader.h"
+#include "AliObjectLoader.h"
+
+class AliT0digit;
+
+
+class AliT0Loader: public AliLoader {
+ public:
+   AliT0Loader() : AliLoader() {};
+   AliT0Loader(const Char_t *detname,const Char_t *eventfoldername) : 
+     AliLoader(detname, eventfoldername) {InitObjectLoaders();};
+   AliT0Loader(const Char_t *detname,TFolder* eventfolder) :
+     AliLoader(detname, eventfolder) {InitObjectLoaders();};
+
+   // Digits
+   AliT0digit*  Digits(){ return (AliT0digit*) GetDigitsDataLoader()->GetBaseDataLoader()->Get();} // returns a pointer to the tree of  RawClusters
+
+ private:
+   void InitObjectLoaders();
+
+   ClassDef(AliT0Loader,1)
+};
+
+typedef AliT0Loader AliSTARTLoader; // for backward compatibility
+#endif
+
+
+
diff --git a/T0/AliT0Parameters.cxx b/T0/AliT0Parameters.cxx
new file mode 100644 (file)
index 0000000..52b2240
--- /dev/null
@@ -0,0 +1,239 @@
+/**************************************************************************
+ * 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.                  *
+ **************************************************************************/
+
+/* $Id:  */
+
+//____________________________________________________________________
+//                                                                          
+// T0 - T0. 
+//
+// This class is a singleton that handles various parameters of
+// the T0 detectors.  
+// Eventually, this class will use the Conditions DB to get the
+// various parameters, which code can then request from here.
+//                                                       
+#include "AliLog.h"              
+#include "AliT0Parameters.h"     
+#include "AliT0CalibData.h"   
+#include <AliCDBManager.h>        
+#include <AliCDBEntry.h>          
+#include <AliCDBStorage.h>         
+#include <Riostream.h>
+
+AliT0CalibData* AliT0Parameters::fgCalibData = 0;
+//====================================================================
+ClassImp(AliT0Parameters)
+#if 0
+  ; // This is here to keep Emacs for indenting the next line
+#endif
+
+//____________________________________________________________________
+AliT0Parameters* AliT0Parameters::fgInstance = 0;
+//____________________________________________________________________
+AliT0Parameters* 
+AliT0Parameters::Instance() 
+{
+  // Get static instance 
+  if (!fgInstance) fgInstance = new AliT0Parameters;
+  return fgInstance;
+}
+
+//____________________________________________________________________
+AliT0Parameters::AliT0Parameters()
+  :fIsInit(kFALSE),fPh2Mip(0),fmV2Mip(0),fChannelWidth(0),fmV2Channel(0),fQTmin(0),fQTmax(0),fFixedGain(0),fSlewingLED(),fSlewingRec(),fPMTeff(),fTimeDelayLED(0),fTimeDelayCFD(0),fTimeDelayTVD(0),fCalibentry() 
+{
+  // Default constructor 
+
+  for (Int_t ipmt=0; ipmt<24; ipmt++)
+    {
+      SetTimeDelayCablesCFD(ipmt);
+      SetTimeDelayCablesLED(ipmt);
+      SetTimeDelayElectronicCFD(ipmt);
+      SetTimeDelayElectronicLED(ipmt);
+      SetTimeDelayPMT(ipmt);
+       SetVariableDelayLine(ipmt);
+      SetSlewingLED(ipmt);
+      SetSlewingRec(ipmt);
+      SetPh2Mip();      
+      SetmV2Mip();      
+      SetChannelWidth();
+      SetmV2channel();
+      SetGain();
+      SetQTmin();
+      SetQTmax();
+      SetPMTeff(ipmt);
+   }
+  SetTimeDelayTVD();
+  SetZposition();
+  
+}
+
+//__________________________________________________________________
+void
+AliT0Parameters::Init()
+{
+  // Initialize the parameters manager.  We need to get stuff from the
+  // CDB here. 
+  //   if (fIsInit) return;
+  
+  AliCDBManager* cdb      = AliCDBManager::Instance();
+  //  AliCDBStorage *stor = cdb->GetStorage("local://$ALICE_ROOT");
+  fCalibentry  = cdb->Get("T0/Calib/Gain_TimeDelay_Slewing_Walk");
+  if (fCalibentry){
+   fgCalibData  = (AliT0CalibData*)fCalibentry->GetObject();
+  }
+
+  fIsInit = kTRUE;
+}
+
+
+//__________________________________________________________________
+Float_t
+AliT0Parameters::GetGain(Int_t ipmt) const
+{
+  // Returns the calibrated gain for each PMT 
+  // 
+
+  if (!fCalibentry) 
+    return fFixedGain;
+   
+  return fgCalibData->GetGain(ipmt);
+}
+
+//__________________________________________________________________
+Float_t
+AliT0Parameters::GetTimeDelayLED(Int_t ipmt) 
+{
+  // return time delay for LED channel
+  // 
+  if (!fCalibentry) {
+    fTimeDelayLED = fTimeDelayCablesLED[ipmt] + fTimeDelayElectronicLED[ipmt] + fTimeDelayPMT[ipmt];
+    return  fTimeDelayLED;
+  } 
+  return fgCalibData ->GetTimeDelayLED(ipmt);
+}
+//__________________________________________________________________
+Float_t
+AliT0Parameters::GetTimeDelayCFD(Int_t ipmt) 
+{
+  // return time delay for CFD channel
+   // 
+  if (!fCalibentry) 
+    {
+      fTimeDelayCFD = fTimeDelayCablesCFD[ipmt] + fTimeDelayElectronicCFD[ipmt] + fTimeDelayPMT[ipmt] + fVariableDelayLine[ipmt];
+      return fTimeDelayCFD+37;
+    }
+   
+  return fgCalibData->GetTimeDelayCFD(ipmt);
+}
+
+//__________________________________________________________________
+
+void 
+AliT0Parameters::SetSlewingLED(Int_t ipmt)
+{
+  //  Set Slweing Correction for LED channel 
+     Float_t mv[23] = {25, 30,40,60, 80,100,150,200,250,300,
+                      400,500,600,800,1000,1500, 2000, 3000, 4000, 5500,
+                      6000, 7000,8000};
+      Float_t y[23] = {5044, 4719, 3835, 3224, 2847, 2691,2327, 2067, 1937, 1781,
+                      1560, 1456 ,1339, 1163.5, 1027, 819, 650, 520, 370.5, 234,
+                      156, 78, 0};
+      
+      TGraph* gr = new TGraph(23,mv,y);
+      fSlewingLED.AddAtAndExpand(gr,ipmt);
+  }
+//__________________________________________________________________
+
+Float_t AliT0Parameters::GetSlewingLED(Int_t ipmt, Float_t mv) const
+{
+  if (!fCalibentry) {
+    return ((TGraph*)fSlewingLED.At(ipmt))->Eval(mv); 
+  } 
+  return fgCalibData->GetSlewingLED(ipmt, mv) ;
+}
+
+
+//__________________________________________________________________
+
+TGraph *AliT0Parameters::GetSlew(Int_t ipmt) const
+{
+  if (!fCalibentry) {
+    return  (TGraph*)fSlewingLED.At(ipmt); 
+  } 
+  return fgCalibData -> GetSlew(ipmt) ;
+}
+
+//__________________________________________________________________
+
+
+void 
+AliT0Parameters::SetSlewingRec(Int_t ipmt)
+{
+  //  Set Slweing Correction for LED channel 
+      Float_t mv[23] = {25, 30, 40,60, 80,100,150,200,250,300,
+                       400,500,600,800,1000,1500, 2000, 3000, 4000, 5500,
+                       6000, 7000,8000};
+      Float_t y[23] = {5044, 4719, 3835, 3224, 2847, 2691,2327, 2067, 1937, 1781, 
+                      1560, 1456 ,1339, 1163.5, 1027, 819, 650, 520, 370.5, 234, 
+                      156, 78, 0};
+      Float_t y1[23], mv1[23];
+      for (Int_t i=0; i<23; i++){
+       y1[i] = y[22-i]; mv1[i] = mv[22-i];}
+
+      TGraph* gr = new TGraph(23,y1,mv1);
+      fSlewingRec.AddAtAndExpand(gr,ipmt);
+
+}
+//__________________________________________________________________
+
+Float_t AliT0Parameters::GetSlewingRec(Int_t ipmt, Float_t mv) const
+{
+  if (!fCalibentry) {
+    return ((TGraph*)fSlewingRec.At(ipmt))->Eval(mv); 
+  } 
+  return fgCalibData -> GetSlewingRec(ipmt, mv) ;
+}
+
+//__________________________________________________________________
+
+TGraph *AliT0Parameters::GetSlewRec(Int_t ipmt) const
+{
+  if (!fCalibentry) {
+    return  (TGraph*)fSlewingRec.At(ipmt); 
+  } 
+  return fgCalibData -> GetSlewRec(ipmt) ;
+}
+
+//__________________________________________________________________
+void 
+AliT0Parameters::SetPMTeff(Int_t ipmt)
+{
+  Float_t lambda[50];
+  Float_t eff[50 ] = {0,        0,       0.23619,  0.202909, 0.177913, 
+                   0.175667, 0.17856, 0.190769, 0.206667, 0.230286,
+                   0.252276, 0.256267,0.26,     0.27125,  0.281818,
+                   0.288118, 0.294057,0.296222, 0.301622, 0.290421, 
+                   0.276615, 0.2666,  0.248,    0.23619,  0.227814, 
+                   0.219818, 0.206667,0.194087, 0.184681, 0.167917, 
+                   0.154367, 0.1364,  0.109412, 0.0834615,0.0725283, 
+                   0.0642963,0.05861, 0.0465,   0.0413333,0.032069, 
+                   0.0252203,0.02066, 0.016262, 0.012,    0.00590476,
+                   0.003875, 0.00190, 0,        0,        0          } ;
+  for (Int_t i=0; i<50; i++) lambda[i]=200+10*i; 
+
+  TGraph* gr = new TGraph(50,lambda,eff);
+  fPMTeff.AddAtAndExpand(gr,ipmt);
+}
diff --git a/T0/AliT0Parameters.h b/T0/AliT0Parameters.h
new file mode 100644 (file)
index 0000000..92b7f58
--- /dev/null
@@ -0,0 +1,143 @@
+#ifndef ALIT0PARAMETERS_H
+#define ALIT0PARAMETERS_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights
+ * reserved. 
+ *
+ * Latest changes by Christian Holm Christensen <cholm@nbi.dk>
+ *
+ * See cxx source for full Copyright notice                               
+ */
+
+//____________________________________________________________________
+//
+//  Singleton class to handle various parameters of the
+//  T0 - T0
+//  Should get data fromm Conditions DB.
+//
+# include <TNamed.h>
+# include <TF1.h>
+# include <TGraph.h>
+#include <TObjArray.h>
+class AliT0CalibData;
+class AliCDBEntry;
+
+class AliT0Parameters : public TNamed
+{
+public:
+  static AliT0Parameters* Instance();
+
+  void Init();  
+  // Set various `Fixed' parameters 
+  void SetPh2Mip(Int_t r=300)          { fPh2Mip = r; }
+  void SetmV2Mip(Int_t r=50)          { fmV2Mip = r; }
+  void SetChannelWidth(Int_t s=25)   { fChannelWidth = s;}
+  void SetmV2channel(Int_t size=320) { fmV2Channel = size; }
+  void SetQTmin(Int_t qt=13) {fQTmin = qt;}
+  void SetQTmax(Int_t qt=125) {fQTmax = qt;}
+  void SetGain(Int_t size=1) { fFixedGain = size; }
+  void SetZposition( Float_t valueC=69.7, Float_t valueA=373) {
+    fT0zPosition[0]=valueC, fT0zPosition[1]=valueA;}
+  void SetPMTeff(Int_t ipmt);  
+
+  void SetTimeDelayTVD(Float_t r=150)   { fTimeDelayTVD = r; };
+  Float_t GetTimeDelayTVD()   { return fTimeDelayTVD; }
+
+  // Set various variable parameter defaults
+  void SetTimeDelayCablesCFD(Int_t ipmt,Float_t r=150)   
+  { fTimeDelayCablesCFD[ipmt] = r;}
+  void SetTimeDelayCablesLED(Int_t ipmt,Float_t r=150)    
+  { fTimeDelayCablesLED[ipmt] = r;}
+  void SetTimeDelayPMT(Int_t ipmt,Float_t r=5)    
+  { fTimeDelayPMT[ipmt] = r;}
+  void SetTimeDelayElectronicCFD(Int_t ipmt,Float_t r=8)    
+  { fTimeDelayElectronicCFD[ipmt] = r;}
+  void SetTimeDelayElectronicLED(Int_t ipmt,Float_t r=10)  
+  { fTimeDelayElectronicLED[ipmt] = r;}
+  void SetVariableDelayLine(Int_t ipmt, Int_t v=0)  
+  { fVariableDelayLine[ipmt] = v;}
+  void SetSlewingLED(Int_t ipmt); 
+  void SetSlewingRec(Int_t ipmt); 
+
+  // Get `Fixed' various parameters
+  Int_t GetPh2Mip()          const { return fPh2Mip; }
+  Int_t GetmV2Mip()          const { return fmV2Mip; }
+  Int_t GetChannelWidth()     const { return fChannelWidth; }
+  Int_t GetmV2channel()     const { return fmV2Channel; }
+  Int_t GetQTmin() const {return fQTmin;}
+  Int_t GetQTmax() const {return fQTmax;}
+  Float_t  GetGain(Int_t ipmt)        const;
+  Float_t GetZposition(Int_t i) const {return fT0zPosition[i];}
+  TGraph *  GetPMTeff(Int_t ipmt) const  
+  {return (TGraph*)fPMTeff.At(ipmt);}
+  Float_t GetpmtEFF(Int_t ipmt, Float_t lambda) const
+  {return((TGraph*)fPMTeff.At(ipmt))->Eval(lambda);} 
+
+  Float_t  GetTimeDelayCablesCFD(Int_t ipmt) const 
+  {return fTimeDelayCablesCFD[ipmt]; } 
+  Float_t  GetTimeDelayCablesLED(Int_t ipmt) const 
+  {return fTimeDelayCablesLED[ipmt]; } ; 
+
+  Float_t  GetTimeDelayElectronicLED(Int_t ipmt) const 
+  {return fTimeDelayElectronicLED[ipmt]; } ; 
+  Float_t  GetTimeDelayElectronicCFD(Int_t ipmt) const 
+  {return fTimeDelayElectronicCFD[ipmt]; } ; 
+  Int_t GetVariableDelayLine(Int_t ipmt) const 
+  {return fVariableDelayLine[ipmt];}
+
+  Float_t GetSlewingLED(Int_t ipmt, Float_t mv) const;
+  //  {return((TGraph*)fSlewingLED.At(ipmt))->Eval(mv);} 
+  TGraph *  GetSlew(Int_t ipmt) const ; 
+  //  {return (TGraph*)fSlewingLED.At(ipmt);}
+  TGraph *  GetSlewRec(Int_t ipmt) const;  
+  //  {return (TGraph*)fSlewingRec.At(ipmt);}
+  Float_t GetSlewingRec(Int_t ipmt, Float_t mv) const;
+  //  {return((TGraph*)fSlewingRec.At(ipmt))->Eval(mv);} 
+
+  Float_t GetTimeDelayCFD(Int_t ipmt);
+  Float_t GetTimeDelayLED(Int_t ipmt);
+
+protected:
+  AliT0Parameters();
+  virtual ~AliT0Parameters() {}
+  static AliT0Parameters* fgInstance; // Static singleton instance
+  
+  Bool_t fIsInit;                // Whether we've been initialised
+  Float_t  fT0zPosition[2] ;  // z-position of the two T0s
+  Int_t   fPh2Mip;            // # photoelectrons per MIP in radiator
+  Int_t   fmV2Mip;            // # mV per MIP in radiator
+  Int_t        fChannelWidth;          // channel width in ns   
+  Int_t        fmV2Channel;     // ADC mv  2  channel # (200000ps/(25*25).
+  Int_t fQTmin;                 //min  time for QTC
+  Int_t fQTmax;                 //max  time fro QTC 
+  Int_t         fFixedGain;       //
+  Float_t fTimeDelayCablesCFD[24];       //! time delay in cables
+  Float_t fTimeDelayCablesLED[24];       //! time delay in cables
+  Float_t fTimeDelayElectronicCFD[24];       //! time delay in electronic
+  Float_t fTimeDelayElectronicLED[24];       //! time delay in electronic
+  Float_t fTimeDelayPMT[24];       //! time delay in PMT
+  Int_t fVariableDelayLine[24];      //time delay in VDL for trigger equvalizing
+  TObjArray fSlewingLED;  //array of slewing correction for each PMT
+  TObjArray fSlewingRec;  //array of slewing correction for Reconstruction
+  TObjArray fPMTeff; //array PMT registration efficiency
+  
+  Float_t fTimeDelayLED;  //  sum time delay for LED channel
+  Float_t fTimeDelayCFD;  // sum time delay for CFD channel
+  Float_t  fTimeDelayTVD;  //time delay for TVD (vertex trigger channel)
+  
+  static AliT0CalibData * fgCalibData; // singleton for Calibration data
+
+  AliCDBEntry*   fCalibentry ;  // pointer to T0 calibration object
+
+  ClassDef(AliT0Parameters,2)
+private:
+  AliT0Parameters(const  AliT0Parameters&);
+  AliT0Parameters& operator=(const AliT0Parameters&);
+
+};
+
+typedef AliT0Parameters AliSTARTParameters; // for backward compatibility
+
+#endif
+//____________________________________________________________________
+
diff --git a/T0/AliT0Preprocessor.cxx b/T0/AliT0Preprocessor.cxx
new file mode 100644 (file)
index 0000000..751575f
--- /dev/null
@@ -0,0 +1,88 @@
+#include "AliT0Preprocessor.h"
+
+#include "AliCDBMetaData.h"
+#include "AliDCSValue.h"
+#include "AliLog.h"
+#include "AliT0Calc.h"
+
+#include <TTimeStamp.h>
+#include <TFile.h>
+#include <TNamed.h>
+#include "AliT0Dqclass.h"
+
+ClassImp(AliT0Preprocessor)
+
+//____________________________________________________
+AliT0Preprocessor::AliT0Preprocessor(const char* detector, AliShuttleInterface* shuttle) :
+  AliPreprocessor(detector, shuttle)
+{
+
+}
+
+AliT0Preprocessor::~AliT0Preprocessor()
+{
+
+}
+
+UInt_t AliT0Preprocessor::Process(TMap* dcsAliasMap )
+{
+
+       if(!dcsAliasMap) return 0;
+
+        TObjArray *aliasArr;
+       // AliDCSValue *aValue;
+        Float_t hv[24]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
+
+        for(int j=0; j<24; j++){
+               TString aliasName =Form("T0HV%d",j);
+                // printf("aliasname: %s\n",aliasName.Data());
+                aliasArr = dynamic_cast<TObjArray*> (dcsAliasMap->GetValue(aliasName.Data()));
+                if(!aliasArr){
+                        AliError(Form("Alias %s not found!", aliasName.Data()));
+                        continue;
+                }
+                AliDCSValue *aValue=dynamic_cast<AliDCSValue*> (aliasArr->At(0));
+                // printf("I'm here! %f %x\n", aValue->GetFloat(), aValue->GetTimeStamp());
+               hv[j]= aValue->GetFloat()*100;
+              //Float_t timestamp= (Float_t) (aValue->GetTimeStamp());
+               // printf("hello! hv = %f timestamp = %f\n" ,hv[j], timestamp);
+
+       }
+       Float_t numbers[24];
+
+       AliT0Calc *calibdata = new AliT0Calc(); 
+       
+       const char* TimefileName = GetFile(kDAQ, "TIME", "LDC0");
+       
+       
+       if(TimefileName){
+               TFile *file = TFile::Open(TimefileName);
+               if(!file || !file->IsOpen()) 
+               {
+                 printf("File from DAQ does not exist.");
+                 return 0;
+               } 
+               AliT0Dqclass *tempdata = dynamic_cast<AliT0Dqclass*> (file->Get("Time"));
+               for(Int_t i=0;i<24;i++){
+                       numbers[i] = tempdata->GetTime(i);
+               //      printf("\nnumbers: %f\n",numbers[i]);
+               }
+               file->Close();
+               delete tempdata;
+       }
+       else {return 0;}
+       calibdata->SetTime(numbers, hv);
+       calibdata->Print();        
+
+       AliCDBMetaData metaData;
+       metaData.SetBeamPeriod(0);
+       metaData.SetResponsible("Tomek&Michal");
+       metaData.SetComment("This preprocessor returns time to be used for reconstruction.");
+       
+       UInt_t result = Store("Calib","Data", calibdata, &metaData);
+       delete calibdata;
+       return result;
+
+}
+
+       
diff --git a/T0/AliT0Preprocessor.h b/T0/AliT0Preprocessor.h
new file mode 100644 (file)
index 0000000..817d88e
--- /dev/null
@@ -0,0 +1,28 @@
+#ifndef ALI_T0_PREPROCESSOR_H
+#define ALI_T0_PREPRECESSOR_H
+
+#include "AliPreprocessor.h"
+
+//
+//// Example of a Shuttle Preprocessor
+////
+//
+class AliT0Preprocessor: public AliPreprocessor 
+{
+  public:
+        AliT0Preprocessor(const char* detector, AliShuttleInterface* shuttle);
+       virtual ~AliT0Preprocessor();
+  
+  protected:
+//        virtual void Initialize(Int_t run, UInt_t startTime, UInt_t endTime);
+       virtual UInt_t Process(TMap* dcsAliasMap);
+
+  private:
+       //AliT0Calc *fData;
+       
+       ClassDef(AliT0Preprocessor, 1)
+};
+
+typedef AliT0Preprocessor AliSTARTPreprocessor; // for backward compatibility
+
+#endif
diff --git a/T0/AliT0RawData.cxx b/T0/AliT0RawData.cxx
new file mode 100644 (file)
index 0000000..3ced034
--- /dev/null
@@ -0,0 +1,495 @@
+/**************************************************************************
+ * 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.                  *
+ **************************************************************************/
+
+/* $Id$ */
+
+///////////////////////////////////////////////////////////////////////////////
+//                                                                           //
+//  T0 raw data conversion class                                            //
+//                                                                           //
+///////////////////////////////////////////////////////////////////////////////
+
+#include <Riostream.h>
+#include <TTree.h>
+
+#include "AliT0.h"
+#include "AliT0RawData.h"
+#include "AliT0digit.h"
+#include "AliBitPacking.h"
+#include "AliRawDataHeader.h"
+#include "AliRawDataHeaderSim.h"
+#include "AliBitPacking.h"
+#include "AliFstream.h"
+#include "AliRunLoader.h"
+
+ClassImp(AliT0RawData)
+
+//_____________________________________________________________________________
+AliT0RawData::AliT0RawData():TObject()
+{
+  /*
+-  48 channels (2 words each as in TOF DDL) for :
+word 1 :0-5bit number of PMT; word 2: 0-7 error sign, 8-31 TDC
+and the same but for amplified signal. Now I wrote the same time because
+CDF are not ready and differences didn't measured yet.
+
+-  48 channel for amplitude: very preliminary, QTC features are not
+known now, preliminary i put as T1 time signal for this PMT in first
+channel and T1+A in second, where A=Log(Amplitude);
+and the same for amplified but A=Log(10*Amplitude).
+
+- T0-A and T0-C 2 channels
+- T0A-T0C vertex information
+- Time Meaner where T0C TOF increase to the T0A TOF distance
+- 6 multiplicity signals the same way as amplitude and with the same
+uncertances
+  */
+
+  fIndex=-1;
+  fDigits = NULL;
+
+  fTimeCFD = new TArrayI(24);
+  fADC1 = new TArrayI(24);
+  fTimeLED = new TArrayI(24);
+  fADC0 = new TArrayI(24);
+  fFile = NULL;
+  fDataHeaderPos = 0;
+  fDRMDataHeaderPos = 0; 
+  memset(fBuffer,0,512*sizeof(UInt_t));
+
+  //open the output file
+  char fileName[15];
+  sprintf(fileName,"T0_%d.ddl", 0xd00);
+  fFile = new AliFstream(fileName);
+  //get event number 
+  AliRunLoader *runloader = AliRunLoader::GetRunLoader();
+  if (runloader) {
+    fEventNumber = runloader->GetEventNumber();
+  }
+}
+
+//_____________________________________________________________________________
+AliT0RawData::AliT0RawData(const AliT0RawData &r):TObject()
+{
+  //
+  // AliT0rawData copy constructor
+  //
+
+  ((AliT0RawData &) r).Copy(*this);
+
+}
+
+//_____________________________________________________________________________
+AliT0RawData::~AliT0RawData()
+{
+  //
+  // Destructor
+  //
+  if (fDigits) {
+    delete fDigits;
+    fDigits = NULL;
+  }
+  delete fTimeCFD;
+  delete fADC1;
+  delete fTimeLED;
+  delete fADC0;
+}
+
+//_____________________________________________________________________________
+AliT0RawData &AliT0RawData::operator=(const AliT0RawData &r)
+{
+  //
+  // Assignment operator
+  //
+
+  if (this != &r) ((AliT0RawData &) r).Copy(*this);
+  return *this;
+
+}
+
+//_____________________________________________________________________________
+void AliT0RawData::GetDigits(AliT0digit *fDigits)
+{
+  //This method packs the T0 digits in a proper 32 bits structure
+
+  //read T0 digits and fill TDC and ADC arrays
+
+
+  //  Int_t error=0;
+  Int_t time,  positionOfTRMHeader;
+
+    // Get the digits array
+
+  fDigits->GetTime(*fTimeCFD);
+  fDigits->GetADC(*fADC1);
+  fDigits->GetTimeAmp(*fTimeLED);
+  fDigits->GetADCAmp(*fADC0);
+  Int_t meantime = fDigits->MeanTime(); 
+  Int_t timediff = fDigits->TimeDiff(); 
+  Int_t mult0=fDigits->SumMult();
+  Int_t mult1=fDigits->SumMult();
+  Int_t timeA = fDigits->BestTimeLeft();
+  Int_t timeC = fDigits->BestTimeRight();
+
+
+  TArrayI  *allData = new TArrayI(107);
+  Int_t i=0;
+  for (i=0; i<24; i++) {
+    allData->AddAt(fTimeLED->At(i),i);
+    allData->AddAt(fTimeCFD->At(i),i+24);
+    allData->AddAt(fADC0->At(i),i+54);
+    allData->AddAt(fADC1->At(i),i+78);
+  }
+    allData->AddAt(meantime,48);
+    allData->AddAt(timediff,49);
+    allData->AddAt(timediff,102); //trigger vertex
+    allData->AddAt(timeA,50);
+    allData->AddAt(timeA,103); //trigger T0A
+    allData->AddAt(timeC,51);
+    allData->AddAt(timeC,104); //trigger T0C
+    allData->AddAt(mult0,52);
+    allData->AddAt(mult1,105); //trigger central
+    allData->AddAt(mult1,53);
+    allData->AddAt(mult1,106); //trigger semi-central
+  //space for DRM header
+  fIndex += 4;
+
+  //space for 1st TRM header
+  fIndex ++;
+  positionOfTRMHeader= fIndex;
+
+  //space for chain  header
+  fIndex ++;
+
+  // Loop through all PMT
+  Int_t chain=0; 
+  Int_t iTDC = 0;
+  Int_t channel=0;
+  Int_t trm1words=0;
+  Int_t fWordsIn1stTRM=0;
+  //LED
+  for (Int_t det = 0; det < 54; det++) {
+    time = allData->At(det);
+
+    if (time >0) { 
+      FillTime(channel,  iTDC,  time); 
+      trm1words++;   
+     }
+    if (channel < 6) channel +=2;
+    else {
+      channel = 0; 
+      iTDC++;
+      if (iTDC>15) { chain++; iTDC=0;}
+    }
+  }
+  
+  WriteTrailer(0,0,fEventNumber,1); // 1st chain trailer
+  WriteTrailer(15,0,fEventNumber,5); // 1st TRM trailer
+  fWordsIn1stTRM = trm1words + 4;
+  WriteTRMDataHeader(3, trm1words , positionOfTRMHeader);
+
+
+  //space for 2st TRM header
+  fIndex ++;
+  positionOfTRMHeader= fIndex;
+
+  //space for chain  header
+  fIndex ++;
+
+
+  chain=0; 
+  iTDC = 0;
+  channel=0;
+  Int_t trm2words=0;
+  for (Int_t det = 54; det < 107; det++) {
+    time = allData->At(det);
+
+    if (time >0) { 
+      FillTime(channel,  iTDC,  time); 
+      trm2words++;}
+    if (channel < 6) channel +=2;
+    else {
+      channel = 0; 
+      iTDC++;
+      if (iTDC>15) { chain++; iTDC=0;}
+    }
+  }
+
+  WriteTrailer(0,0,fEventNumber,1); // 1st chain trailer
+  WriteTrailer(15,0,fEventNumber,5); // 1st TRM trailer
+  WriteTRMDataHeader(5,trm2words,positionOfTRMHeader);
+
+  WriteTrailer(1,fEventNumber,0,5); //DRM trailer
+  WriteDRMDataHeader();
+
+}
+//------------------------------------------------------------------------------
+void AliT0RawData::PackWord(UInt_t &BaseWord, UInt_t Word, Int_t StartBit, Int_t StopBit)
+{
+  
+  // Build mask
+  Int_t len=StopBit-StartBit+1;
+  UInt_t mask=0;
+  for(Int_t jb=0; jb<len; mask|=1<<jb++);
+  // Check consistency
+  if(Word > mask){
+    Error("PackWord", "Word to be filled is not within desired length\n"
+          "Word:%d Start bit:%d Stop Bit:%d",Word,StartBit,StopBit);
+    return;
+  }
+  BaseWord=(BaseWord&~(mask<<StartBit))|Word<<StartBit;
+
+}
+
+
+//_____________________________________________________________________________
+
+void  AliT0RawData::WriteDRMDataHeader()
+{
+//Write a (dummy or real) DDL DRM  data header, 
+//set the compression bit if compressed
+//  UInt_t drmheader[4];  
+  UInt_t word;
+  UInt_t baseWord=0;
+  //fill DRM headers
+  //DRM Global Header
+  word = 1;
+  PackWord(baseWord,word,0, 3); // 0001 
+  word = fIndex ;
+
+  PackWord(baseWord,word,4, 20); // event words 
+  word=124;
+  PackWord(baseWord,word,21,27); // DRM ID for T0 - 124
+  word=4;
+  PackWord(baseWord,word,28,31); // 0100 marks header
+  fBuffer[0]=  baseWord;
+
+  //DRM status header 1
+  word = 1;
+  PackWord(baseWord,word,0, 3); // 0001 
+  word = 1;
+  PackWord(baseWord,word,4, 14); // slotID now 0000000001
+  word = 1;
+  PackWord(baseWord,word,15, 15); //if 1  LHC clock is coorectly recieved from CPDM 
+  word=0;
+  PackWord(baseWord,word,16,27); // reserve for future use
+  word=4;
+  PackWord(baseWord,word,28,31); // 0100 marks header
+   fBuffer[1] = baseWord;
+
+  word=0;
+  baseWord=0;
+
+    //DRM status header 2
+    word = 1;
+    PackWord(baseWord,word, 0, 3); // 0001 
+    word = 3;
+    PackWord(baseWord,word, 4, 14); //enable slotID now 00000000011
+    word = 0;
+    PackWord(baseWord,word, 15, 15); // something
+    word=0;
+    PackWord(baseWord,word, 16, 27); // fault ID for simulation 0
+    word=4;
+    PackWord(baseWord,word,28,31); // 0100 marks header
+    fBuffer[2]=  baseWord;
+
+    
+    word=0;
+    baseWord=0;
+    //DRM status header 3
+    word = 1;
+    PackWord(baseWord,word,0, 3); // 0001 
+    word = 0;
+    PackWord(baseWord,word,4, 27); // TTC event counter
+    word=4;
+    PackWord(baseWord,word,28,31); // 0100 marks header
+    fBuffer[3]=  baseWord;
+
+
+    word=0;
+    baseWord=0;
+    
+}
+  
+//_____________________________________________________________________________
+
+void  AliT0RawData::WriteTRMDataHeader(UInt_t slotID, Int_t nWordsInTRM,
+                                         Int_t  positionOfTRMHeader)
+{
+//Write a (dummy or real) DDL TRM  data header, 
+//set the compression bit if compressed
+//  UInt_t trmheader;  
+  UInt_t word;
+  UInt_t baseWord=0;
+  //fill TRM headers
+  //TRM Global Header
+  word = slotID;
+  PackWord(baseWord,word,0, 3); // slotID
+  word = nWordsInTRM;
+ //+this word - DRM header 
+
+  PackWord(baseWord,word,4, 16); // event words 
+  word=0;
+  PackWord(baseWord,word,17,18); // ACQ
+  word=0;
+  PackWord(baseWord,word,19,19); //  L SEY inside LUT
+  word=0;
+  PackWord(baseWord,word,20,27); //  MBZ
+  word=4;
+  PackWord(baseWord,word,28,31); // 0100 marks header
+  fBuffer[positionOfTRMHeader] =  baseWord;
+   
+  word=0; 
+  baseWord=0;
+     
+}
+
+//_____________________________________________________________________________
+
+void  AliT0RawData::WriteChainDataHeader(UInt_t chainNumber,UInt_t slotID)
+{
+//Write a (dummy or real) DDL Chain  data header, 
+//set the compression bit if compressed
+//  chainNumber 00 or 10
+  UInt_t word;
+  UInt_t baseWord=0;
+  //fill TRM headers
+  //TRM Global Header
+  word = slotID; // ask Tatiana 7 or 9 
+  PackWord(baseWord,word,0, 3); // slotID
+  word = 0;
+  PackWord(baseWord,word,4, 15); // bunchID
+  word=0;
+  PackWord(baseWord,word,16,23); // PB24 temperature
+  word=0;
+  PackWord(baseWord,word,24,26); //  PB24 ID
+  word=0;
+  PackWord(baseWord,word,27,27); //  TS
+  word=chainNumber;
+  PackWord(baseWord,word,28,31); // 0100 marks header
+  fBuffer[4] =  baseWord;
+
+  word=0;
+  baseWord=0;     
+  
+}
+//_____________________________________________________________________________
+
+void  AliT0RawData::WriteDataHeader(Bool_t dummy, Bool_t compressed)
+{
+//Write a (dummy or real) DDL data header, 
+//set the compression bit if compressed
+
+  AliRawDataHeaderSim header;
+  
+  if (dummy) {
+    //if size=0 it means that this data header is a dummy data header
+    fDataHeaderPos = fFile->Tellp();
+    fFile->WriteBuffer((char*)(&header), sizeof(header));
+  } else {
+    UInt_t currentFilePos = fFile->Tellp();
+    fFile->Seekp(fDataHeaderPos);
+    header.fSize = currentFilePos-fDataHeaderPos;
+    header.SetAttribute(0);  // valid data
+    if (compressed) header.SetAttribute(1); 
+    fFile->WriteBuffer((char*)(&header), sizeof(header));
+    fFile->Seekp(currentFilePos);
+  }
+  
+}
+
+//___ __________________________________________________________________________
+
+
+void  AliT0RawData::WriteTrailer(UInt_t slot, Int_t word1, UInt_t word2, UInt_t word3)
+{
+
+  UInt_t word;
+  UInt_t baseWord=0;
+  word = slot;
+  PackWord(baseWord,word,0, 3); // 0001 
+  word=word1;
+  PackWord(baseWord,word,4, 15); // CRC ?
+  word = word2;
+  PackWord(baseWord,word,16,27); // event counter
+  word=word3;
+  PackWord(baseWord,word,28,31); //  marks trailer
+  fIndex++;
+  fBuffer[fIndex] =  baseWord;
+  
+  word=0;
+  baseWord=0;
+
+}
+
+//---------------------------------------------------------------------------------------
+//---------------------------------------------------------------------------------------
+void  AliT0RawData::FillTime(Int_t ch, Int_t iTDC, Int_t time)
+{
+  UInt_t word;
+  UInt_t baseWord=0;
+
+  word=time;
+  PackWord(baseWord,word, 0, 20); // Time 
+
+  word=ch;
+  PackWord(baseWord,word, 21, 23); // number of channel 
+  word=iTDC;
+  PackWord(baseWord,word, 24, 27); // TDC ID
+
+  word=0;
+  PackWord(baseWord,word, 28, 28); // E = 0 in simulation
+  word=0;
+  PackWord(baseWord,word, 29, 30); // PS bit data 00
+  word=1;
+  PackWord(baseWord,word, 31, 31); // 1
+  fIndex++;
+  fBuffer[fIndex]=baseWord;
+  word=0;
+  baseWord=0;
+       
+}
+//---------------------------------------------------------------------------------------
+
+Int_t AliT0RawData::RawDataT0(AliT0digit *fDigits)
+{
+   //This method creates the Raw data files for T0 detector
+
+
+  // const Int_t kSize=512; //2*AliTOFGeometry::NpadXSector() 
+                          //max number of digits per DDL file times 2
+  //  UInt_t fBuffer[kSize];
+  //  UInt_t baseWord;
+  // UInt_t word;
+
+  fIndex=-1;
+  AliRawDataHeaderSim header;
+  //loop over TOF DDL files
+    //write Dummy DATA HEADER
+   WriteDataHeader(kTRUE, kFALSE);
+  GetDigits(fDigits);
+  //write packing digits
+  fFile->WriteBuffer((char*) fBuffer,((fIndex+1)*sizeof(UInt_t)));
+  //write real data header on its place
+   WriteDataHeader(kFALSE, kFALSE);
+  
+  
+  //end for
+  
+  return 0;  
+  
+}
diff --git a/T0/AliT0RawData.h b/T0/AliT0RawData.h
new file mode 100644 (file)
index 0000000..fd3ed44
--- /dev/null
@@ -0,0 +1,89 @@
+#ifndef ALIT0RAWDATA_H
+#define ALIT0RAWDATA_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+/* $Id$ */
+
+///////////////////////////////////////////////////////////////////////////////
+//                                                                           //
+//  Converts T0 digits into a raw data stream                               //
+//                                                                           //
+///////////////////////////////////////////////////////////////////////////////
+
+#include "TObject.h"
+
+class AliT0;
+class AliT0digit;
+class AliFstream;
+class TFile;
+//class TBranch;
+class AliRawDataHeaderSim;
+class AliT0RawData : public TObject {
+
+ public:
+
+  AliT0RawData();                                         // default constructor
+  AliT0RawData(const AliT0RawData &r);                 // copy constructor
+  virtual ~AliT0RawData();                                // destructor
+  AliT0RawData &operator=(const AliT0RawData &r);      // ass. op.
+
+   Int_t RawDataT0 (AliT0digit *fDigits); 
+  // This method generates the files with the TOF detector data
+  void SetVerbose(Int_t Verbose){fVerbose=Verbose;}
+  // To set the verbose level
+  void  GetDigits(AliT0digit *fDigits);
+  //This method formats and stores in buf all the digits of a TOF module
+
+   void  PackWord(UInt_t &BaseWord, UInt_t Word, Int_t StartBit, Int_t StopBit);
+  //This method stores the value of the variable Word of StopBit-StartBit+1 bits 
+  //in BaseWord, starting from the bit StartBit
+
+   void  WriteDataHeader(Bool_t dummy, Bool_t compressed);
+   void  WriteDRMDataHeader();
+   void  WriteTRMDataHeader(UInt_t slotID, Int_t nWords, Int_t positionOfTRMHeader);
+   //this method is used to write the data header
+   void  WriteTrailer(UInt_t slot, Int_t word1, UInt_t word2, UInt_t word3); 
+   void  WriteChainDataHeader(UInt_t chainNumber,UInt_t slotID);
+   void  FillTime(Int_t ch, Int_t iTDC, Int_t time);
+
+ //T0 digits arrays
+
+
+  TArrayI *TimeLED() {return fTimeLED;}
+  TArrayI *ADC1() {return fADC1;}
+  TArrayI *TimeCFD() {return fTimeCFD;}
+  TArrayI *ADC0() {return fADC0;}
+
+  
+ protected:
+
+  Int_t fVerbose;            //Verbose level (0:no msg, 1:msg, 2:digits in txt files)
+  UInt_t fBuffer[512];       // buffer for writing rawdata
+  Int_t fIndex;              //number of 32 words to be stored into the output file
+  Int_t fEventNumber;        // current event number
+
+  Int_t fTimeDiff     ; //time difference 
+  Int_t fMeanTime      ; // average time - ALICE start signal 
+  Int_t fBestTimeLeft;   //first particle on the left
+  Int_t fBestTimeRight;  //first particle on the right
+  Int_t fSumMult;        // sum multiplicity
+  TArrayI * fTimeCFD;        //TDC on the each PMT
+  TArrayI *  fADC1;           //QTC (ADC) on the each PMT
+  TArrayI * fTimeLED;    // TDC with amplified signal
+  TArrayI *  fADC0;        //QTC amplified
+  AliFstream* fFile;    //logical name of the I/O file
+ UInt_t fDataHeaderPos;//Data header position
+ UInt_t fDRMDataHeaderPos;//Data DRM header position
+ UInt_t fTRMDataHeaderPos;//Data TRM header position
+ Int_t fWordsIn1stTRM; // Number of word in 1st TRM
+  AliT0digit *fDigits;  //! The T0 digits manager
+
+  ClassDef(AliT0RawData,1)             //  T0 raw data class
+
+};
+
+typedef AliT0RawData AliSTARTRawData; // for backward compatibility
+
+#endif
diff --git a/T0/AliT0RawReader.cxx b/T0/AliT0RawReader.cxx
new file mode 100644 (file)
index 0000000..1b33d15
--- /dev/null
@@ -0,0 +1,210 @@
+#include "AliT0RawReader.h"
+#include "AliT0RawData.h"
+#include "AliT0digit.h"
+#include "AliBitPacking.h"
+#include "TBits.h"
+
+#include <Riostream.h>
+#include "TMath.h"
+#include "TH1F.h"
+#include "TArrayI.h"
+#include "AliLog.h"
+ClassImp(AliT0RawReader)
+  
+  AliT0RawReader::AliT0RawReader (AliRawReader *rawReader, TTree* tree)
+    :  TTask("T0RawReader","read raw T0 data"),
+       fDigits(NULL),
+       fTree(tree),
+       fRawReader(rawReader),
+       fData(NULL),
+       fPosition(0)
+{
+  //
+// create an object to read T0raw digits
+  AliDebug(1,"Start ");
+  if (fDigits == 0x0) fDigits = new AliT0digit(); 
+  fTree->Branch("T0","AliT0digit",&fDigits,405,1);
+  fRawReader->Reset();
+  fRawReader->Select("T0");
+}
+ AliT0RawReader::~AliT0RawReader ()
+{
+  // 
+}
+
+Bool_t  AliT0RawReader::Next()
+{
+// read the next raw digit
+// returns kFALSE if there is no digit left
+//"LookUpTable":
+// Amplitude LED TRM=0; chain=0; TDC 0 -5        channel 0,2,4,6
+// Time CFD      TRM=0; chain=0; TDC 6 - 11      channel 0,2,4,6
+// mean time     TRM=0; chain=0; TDC 12          channel 0
+// T0A           TRM=0; chain=0; TDC 12          channel 2
+// T0C           TRM=0; chain=0; TDC 12          channel 4
+// vertex        TRM=0; chain=0; TDC 12          channel 6
+// mult QTC0        TRM=0; chain=0; TDC 13          channel 0
+// mult QTC1        TRM=0; chain=0; TDC 13          channel 2
+
+// Charge QTC0   TRM=1; chain=0; TDC 0 -5        channel 0,2,4,6
+// Charge QTC1   TRM=1; chain=0; TDC 6 - 11      channel 0,2,4,6
+// T0A trigger          TRM=1; chain=0; TDC 12          channel 0
+// T0C trigger          TRM=1; chain=0; TDC 12          channel 2
+// vertex trigger       TRM=1; chain=0; TDC 12          channel 4
+// trigger central      TRM=1; chain=0; TDC 13          channel 0
+// tigger semicenral    TRM=1; chain=0; TDC 13          channel 2
+//
+// allData array collect data from all channels in one :
+// allData[0] - allData[23] 24 CFD channels
+// allData[24] -   allData[47] 24 LED channels
+//  allData[48]  mean (T0) signal  
+// allData[49]   time difference (vertex)
+
+  UInt_t word;
+  Int_t time=0,  itdc=0, ichannel=0; 
+  Int_t numberOfWordsInTRM=0, iTRM=0;
+  Int_t tdcTime, koef, meanTime, timeDiff ;
+  Int_t allData[107];
+
+  TArrayI *timeTDC1 = new TArrayI(24);
+  TArrayI * chargeTDC1 = new TArrayI(24);
+  TArrayI *timeTDC2 = new TArrayI(24);
+  TArrayI *chargeTDC2 = new TArrayI(24);
+   
+  for ( Int_t k=0; k<107; k++)  allData[k]=0;
+  do {
+    if (!fRawReader->ReadNextData(fData)) return kFALSE;
+  } while (fRawReader->GetDataSize() == 0);
+  
+  //  fPosition = GetPosition();
+  fPosition = 0;
+
+  //DRM header
+  for (Int_t i=0; i<4; i++) {
+    word = GetNextWord();
+  }
+  //TRMheader  
+   word = GetNextWord();
+   numberOfWordsInTRM=AliBitPacking::UnpackWord(word,4,16);
+   iTRM=AliBitPacking::UnpackWord(word,0,3);
+
+   //chain header
+   word = GetNextWord();
+  
+   for (Int_t i=0; i<numberOfWordsInTRM; i++) {
+     word = GetNextWord();
+     tdcTime =  AliBitPacking::UnpackWord(word,31,31);   
+
+     if ( tdcTime == 1)
+       {
+        itdc=AliBitPacking::UnpackWord(word,24,27);
+        ichannel=AliBitPacking::UnpackWord(word,21,23);
+        time=AliBitPacking::UnpackWord(word,0,20);
+        koef = itdc*4 + ichannel/2;
+        allData[koef]=time;
+       }
+   }
+   word = GetNextWord(); //chain trailer
+   word = GetNextWord(); //TRM trailer
+     
+  //TRMheader  
+   word = GetNextWord();
+   numberOfWordsInTRM=AliBitPacking::UnpackWord(word,4,16);
+   iTRM=AliBitPacking::UnpackWord(word,0,3);
+   //chain header
+   word = GetNextWord();
+   
+   for (Int_t iword=0; iword<numberOfWordsInTRM; iword++) {
+     word = GetNextWord();
+     tdcTime =  AliBitPacking::UnpackWord(word,31,31);   
+
+     if ( tdcTime == 1)
+       {
+        itdc=AliBitPacking::UnpackWord(word,24,27);
+        ichannel=AliBitPacking::UnpackWord(word,21,23);
+        time=AliBitPacking::UnpackWord(word,0,20);
+        koef = itdc*4 + ichannel/2;
+        allData[koef+54]=time;
+       }
+   }
+      
+   for (Int_t in=0; in<24; in++)
+     {
+       timeTDC1->AddAt(allData[in],in);
+       timeTDC2->AddAt(allData[in+24],in);
+       chargeTDC1->AddAt(allData[in+54],in);
+       chargeTDC2->AddAt(allData[in+78],in);
+     }      
+
+   meanTime = allData[48];  // T0 !!!!!!
+   timeDiff = allData[49];
+
+   word = GetNextWord();
+   word = GetNextWord();
+   
+   fDigits->SetTime(*timeTDC2);
+   fDigits->SetADC(*chargeTDC1);
+   
+   fDigits->SetTimeAmp(*timeTDC1);
+   fDigits->SetADCAmp(*chargeTDC2);
+
+   fDigits->SetMeanTime(meanTime);
+   fDigits->SetDiffTime(timeDiff);
+   fTree->Fill();
+   
+   delete timeTDC1 ;
+   delete chargeTDC1;
+   delete timeTDC2 ;
+   delete chargeTDC2;
+   
+   return kTRUE;
+}
+//_____________________________________________________________________________
+/*
+void AliT0RawReader::UnpackTime(Int_t outTime, Int_t outCh)
+{
+      UInt_t word=0;
+      UInt_t unpackword=0;
+    
+      word = GetNextWord();
+      unpackword=AliBitPacking::UnpackWord(word,0,12);
+      outTime=unpackword;
+      unpackword= AliBitPacking::UnpackWord(word,21,27);
+      outCh=unpackword;  
+ }
+ */
+//_____________________________________________________________________________
+Int_t AliT0RawReader::GetPosition()
+{
+  // Sets the position in the
+  // input stream
+  if (((fRawReader->GetDataSize() * 8) % 32) != 0)
+    AliFatal(Form("Incorrect raw data size ! %d words are found !",fRawReader->GetDataSize()));
+  return (fRawReader->GetDataSize() * 8) / 32;
+}
+//_____________________________________________________________________________
+UInt_t AliT0RawReader::GetNextWord()
+{
+  // Read the next 32 bit word in backward direction
+  // The input stream access is given by fData and fPosition
+
+
+  //   fPosition--;
+  Int_t iBit = fPosition * 32;
+  Int_t iByte = iBit / 8;
+
+  UInt_t word = 0;
+  word  = fData[iByte+3]<<24;
+  word |= fData[iByte+2]<<16;
+  word |= fData[iByte+1]<<8;
+  word |= fData[iByte];
+   fPosition++;
+
+  return word;
+
+}
+
diff --git a/T0/AliT0RawReader.h b/T0/AliT0RawReader.h
new file mode 100644 (file)
index 0000000..144edbe
--- /dev/null
@@ -0,0 +1,38 @@
+#ifndef ALIT0RAWREADER_H
+#define ALIT0RAWREADER_H
+#include <TTask.h>
+#include <Riostream.h>
+#include "TTree.h"
+#include "AliT0digit.h"
+#include "AliRawReader.h"
+class AliT0RawReader : public TTask {
+  public :
+
+  AliT0RawReader(AliRawReader *rawReader, TTree* tree) ;
+
+  virtual  ~AliT0RawReader();
+
+
+  Bool_t  Next(); //read next raw digit
+  Int_t            GetPosition();
+  // void UnpackTime(Int_t outTime, Int_t outCh);
+  UInt_t         GetNextWord();
+  
+  protected :
+
+  AliT0digit* fDigits;
+  TTree*        fTree;
+  AliRawReader*    fRawReader;    // object for reading the raw data
+
+  UChar_t*         fData;         // raw data
+  Int_t            fPosition;     // current (32 bit) position in fData
+
+  
+ ClassDef(AliT0RawReader, 0) //class for reading T0 Raw data
+};
+
+typedef AliT0RawReader AliSTARTRawReader; // for backward compatibility
+#endif
diff --git a/T0/AliT0RecPoint.cxx b/T0/AliT0RecPoint.cxx
new file mode 100644 (file)
index 0000000..a9348f0
--- /dev/null
@@ -0,0 +1,47 @@
+/**************************************************************************
+ * 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.                  *
+ **************************************************************************/
+
+/* $Id$ */
+/////////////////////////////////////////////////////////////////////////
+//  Class AliT0RecPoint for T0 time and ADC signals
+//  fTimeRight  - right side TOF signal
+//  fTimeLeft  - left side TOF signal
+//  fTimeBestRight - TOF first particle on the right side
+//  TimeBestLeft - TOF first particle on the left side
+//  fTimeAverage = (fTimeBestRight + TimeBestLeft ) /2. T0 signal
+//  fVertex - vertex position 
+//
+///////////////////////////////////////////////////////////////////////
+
+
+
+#include "AliT0RecPoint.h"
+#include <Riostream.h>
+
+ClassImp(AliT0RecPoint)
+
+//------------------------------------
+  AliT0RecPoint::AliT0RecPoint() : TObject(), fTimeAverage(0),fVertexPosition(0),fTimeBestRight(0),fTimeBestLeft(0),fMultC(0),fMultA(0)
+{
+  //ctor
+  fTimeAverage=99999;
+  fTimeBestRight=99999;
+  fTimeBestLeft=99999;
+  fVertexPosition=99999;
+  fMultA=0;
+  fMultC=0;
+  for (Int_t i=0; i<24; i++) { fTime[i]=0; fADC[i]=0; fADCLED[i]=0;}
+}
diff --git a/T0/AliT0RecPoint.h b/T0/AliT0RecPoint.h
new file mode 100644 (file)
index 0000000..c561b35
--- /dev/null
@@ -0,0 +1,59 @@
+#ifndef ALIT0RECPOINT_H
+#define ALIT0RECPOINT_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+/* $Id$ */
+#include <TObject.h>
+
+
+//___________________________________________
+class AliT0RecPoint: public TObject  {
+////////////////////////////////////////////////////////////////////////
+ public:
+    AliT0RecPoint();
+    virtual ~AliT0RecPoint() {}
+    Int_t  GetMeanTime() {return fTimeAverage;}
+    Int_t  GetBestTimeRight() {return fTimeBestRight ;}
+    Int_t  GetBestTimeLeft() {return fTimeBestLeft ;}
+    Int_t GetMultC() {return fMultC;}
+    Int_t GetMultA() {return fMultA;}
+    Float_t  GetVertex() {return fVertexPosition;}
+
+
+    void SetMeanTime(Int_t time) {fTimeAverage=time;}
+    void SetTimeBestRight( Int_t time) {fTimeBestRight = time;}
+    void SetTimeBestLeft( Int_t time) {fTimeBestLeft = time;}
+    void SetVertex( Float_t vertex) {fVertexPosition= vertex;}
+    void SetMultC(Int_t mult) {fMultC = mult;}
+    void SetMultA(Int_t mult) {fMultA = mult;}
+
+    void SetTime (Int_t ipmt, Float_t time) { fTime[ipmt] = time;}
+    Float_t GetTime (Int_t ipmt) { return fTime[ipmt];}
+   void SetAmp (Int_t ipmt, Float_t adc) { fADC[ipmt] = adc;}
+    Float_t GetAmp (Int_t ipmt) { return fADC[ipmt];}
+   void SetAmpLED (Int_t ipmt, Float_t adc) { fADCLED[ipmt] = adc;}
+    Float_t AmpLED (Int_t ipmt) { return fADCLED[ipmt];}
+
+  private: 
+    Int_t fTimeAverage;     // Average time
+    Float_t fVertexPosition;     // Diffrence time between left and right
+    Int_t fTimeBestRight;   //TOF first particle on the right
+    Int_t fTimeBestLeft;    //TOF first particle on the left
+    Int_t fMultC; // multiplicity on the 
+    Int_t fMultA; // multiplicity on the 
+    Float_t fTime[24];    // array's TDC
+    Float_t fADC[24];    // array's amplitude
+    Float_t fADCLED[24];    // array's LED amplitude
+
+
+    ClassDef(AliT0RecPoint,3)  //Digit (Header) object for set:T0
+};
+
+typedef AliT0RecPoint AliSTARTRecPoint; // for backward compatibility
+
+#endif
+
+
+
diff --git a/T0/AliT0Reconstructor.cxx b/T0/AliT0Reconstructor.cxx
new file mode 100644 (file)
index 0000000..9fbca54
--- /dev/null
@@ -0,0 +1,220 @@
+/**************************************************************************
+ * 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.                  *
+ **************************************************************************/
+
+/* $Id$ */
+
+#include <Riostream.h>
+
+#include <TDirectory.h>
+
+#include "AliRunLoader.h"
+#include "AliRun.h"
+#include <AliESD.h>
+#include "AliLog.h"
+#include <TClonesArray.h>
+#include "AliT0RecPoint.h"
+#include "AliRawReader.h"
+#include "AliT0RawReader.h"
+#include "AliT0Loader.h"
+#include "AliT0digit.h"
+#include "AliT0Reconstructor.h"
+#include "AliT0Parameters.h"
+#include "AliCDBLocal.h"
+#include "AliCDBStorage.h"
+#include "AliCDBManager.h"
+#include "AliCDBEntry.h"
+
+#include <TArrayI.h>
+#include <TGraph.h>
+
+ClassImp(AliT0Reconstructor)
+
+  void  AliT0Reconstructor::ConvertDigits(AliRawReader* rawReader, TTree* digitsTree) const
+{
+  //T0 raw data-> digits conversion
+ // reconstruct time information from raw data
+  AliT0RawReader myrawreader(rawReader,digitsTree);
+  if (!myrawreader.Next())
+    AliDebug(1,Form(" no raw data found!! %i", myrawreader.Next()));
+}
+void AliT0Reconstructor::Reconstruct(TTree*digitsTree, TTree*clustersTree) const
+{
+// T0 digits reconstruction
+// T0RecPoint writing 
+
+    //Q->T-> coefficients !!!! should be asked!!!
+  //  Float_t ph2MIP=500;
+  Float_t gain[24], timeDelayCFD[24], timeDelayLED[24];
+  Float_t zdetA,zdetC;
+  TObjArray slewingLED;
+    
+  TArrayI * fADC = new TArrayI(24); 
+  TArrayI * fTimeCFD = new TArrayI(24); 
+  TArrayI * fADCLED = new TArrayI(24); 
+  TArrayI * fTimeLED = new TArrayI(24); 
+
+  AliT0Parameters* param = AliT0Parameters::Instance();
+  param->Init();
+
+  Int_t mV2Mip = param->GetmV2Mip();     
+  //mV2Mip = param->GetmV2Mip();     
+  Int_t channelWidth = param->GetChannelWidth() ;  
+  
+  for (Int_t i=0; i<24; i++){
+    timeDelayCFD[i] = param->GetTimeDelayCFD(i);
+    timeDelayLED[i] = param->GetTimeDelayLED(i);
+    gain[i] = param->GetGain(i);
+    //gain[i] = 1;
+    slewingLED.AddAtAndExpand(param->GetSlew(i),i);
+  }
+  zdetC = param->GetZposition(0);
+  zdetA  = param->GetZposition(1);
+    
+  AliDebug(1,Form("Start DIGITS reconstruction "));
+  TBranch *brDigits=digitsTree->GetBranch("T0");
+  AliT0digit *fDigits = new AliT0digit();
+  if (brDigits) {
+    brDigits->SetAddress(&fDigits);
+  }else{
+    cerr<<"EXEC Branch T0 digits not found"<<endl;
+    return;
+  }
+  brDigits->GetEntry(0);
+  fDigits->GetTime(*fTimeCFD);
+  fDigits->GetADC(*fADC);
+  fDigits->GetTimeAmp(*fTimeLED);
+  fDigits->GetADCAmp(*fADCLED);
+
+  Float_t besttimeright=999999;
+  Float_t besttimeleft=999999;
+  Int_t pmtBestRight=99999;
+  Int_t pmtBestLeft=99999;
+  Float_t timeDiff=999999, meanTime=0;
+  
+  AliT0RecPoint* frecpoints= new AliT0RecPoint ();
+  clustersTree->Branch( "T0", "AliT0RecPoint" ,&frecpoints, 405,1);
+
+  Float_t time[24], adc[24];
+  for (Int_t ipmt=0; ipmt<24; ipmt++) {
+      
+    if(fTimeCFD->At(ipmt)>0 ){
+      time[ipmt] = channelWidth *( fTimeCFD->At(ipmt)) - 1000*timeDelayCFD[ipmt];
+      Float_t adc_digPs = channelWidth * Float_t (fADCLED->At(ipmt)) ;
+      adc[ipmt] = TMath::Exp(adc_digPs/1000) /gain[ipmt];
+      AliDebug(1,Form(" time %f ps,  adc %f mv in MIP %i\n ",
+                     time[ipmt], adc[ipmt], Int_t (adc[ipmt]/mV2Mip +0.5)));
+      frecpoints->SetTime(ipmt,time[ipmt]);
+      frecpoints->SetAmp(ipmt,adc[ipmt]);
+    }
+    else {
+      time[ipmt] = 0;
+      adc[ipmt] = 0;
+    }
+  }
+  for (Int_t ipmt=0; ipmt<12; ipmt++){
+    if(time[ipmt] > 1 ) {
+      if(time[ipmt]<besttimeleft){
+       besttimeleft=time[ipmt]; //timeleft
+       pmtBestLeft=ipmt;
+      }
+    }
+  }
+  for ( Int_t ipmt=12; ipmt<24; ipmt++){
+    if(time[ipmt] > 1) {
+      if(time[ipmt]<besttimeright) {
+       besttimeright=time[ipmt]; //timeright
+        pmtBestRight=ipmt;}
+    }
+  }
+  if(besttimeright !=999999)  frecpoints->SetTimeBestRight(Int_t(besttimeright));
+  if( besttimeleft != 999999 ) frecpoints->SetTimeBestLeft(Int_t(besttimeleft));
+  AliDebug(1,Form(" besttimeA %f ps,  besttimeC %f ps",besttimeright, besttimeleft));
+  Float_t c = 0.0299792; // cm/ps
+  Float_t vertex = 0;
+  if(besttimeright !=999999 && besttimeleft != 999999 ){
+    timeDiff = besttimeleft - besttimeright;
+    meanTime = (besttimeright + besttimeleft)/2.;
+    vertex = c*(timeDiff)/2.; //-(lenr-lenl))/2;
+    AliDebug(1,Form("  timeDiff %f ps,  meanTime %f ps, vertex %f cm",timeDiff, meanTime,vertex ));
+    frecpoints->SetVertex(vertex);
+    frecpoints->SetMeanTime(Int_t(meanTime));
+    
+  }
+  clustersTree->Fill();
+}
+
+
+void AliT0Reconstructor::FillESD(AliRunLoader* runLoader, AliESD *pESD) const
+{
+
+  /***************************************************
+  Resonstruct digits to vertex position
+  ****************************************************/
+  
+  
+  if (!runLoader) {
+    AliError("Reconstruct >> No run loader");
+    return;
+  }
+  
+  AliDebug(1,Form("Start FillESD T0"));
+
+  AliT0Loader* pStartLoader = (AliT0Loader*) runLoader->GetLoader("T0Loader");
+  pStartLoader->LoadRecPoints("READ");
+
+  TTree *treeR = pStartLoader->TreeR();
+  
+   AliT0RecPoint* frecpoints= new AliT0RecPoint ();
+    if (!frecpoints) {
+    AliError("Reconstruct Fill ESD >> no recpoints found");
+    return;
+  }
+  
+  AliDebug(1,Form("Start FillESD T0"));
+  TBranch *brRec = treeR->GetBranch("T0");
+  if (brRec) {
+    brRec->SetAddress(&frecpoints);
+  }else{
+    cerr<<"EXEC Branch T0 rec not found"<<endl;
+    // exit(111);
+    return;
+  } 
+    
+    brRec->GetEntry(0);
+    Float_t timeStart, Zposition, amp[24], time[24];
+    Int_t i;
+    Zposition = frecpoints -> GetVertex();
+    timeStart = frecpoints -> GetMeanTime();
+    for ( i=0; i<24; i++) {
+       time[i] = Float_t (frecpoints -> GetTime(i)) / 1000.; // ps to ns
+      amp[i] = frecpoints -> GetAmp(i);
+    }
+    pESD->SetT0zVertex(Zposition); //vertex Z position 
+    pESD->SetT0(timeStart);        // interaction time 
+    pESD->SetT0time(time);         // best TOF on each PMT 
+    pESD->SetT0amplitude(amp);     // number of particles(MIPs) on each PMT
+    cout<<" ESD >> "<<Zposition<<" "<<timeStart<<endl;
+
+    pStartLoader->UnloadRecPoints();
+   
+} // vertex in 3 sigma
+
+
+
+
+
+
diff --git a/T0/AliT0Reconstructor.h b/T0/AliT0Reconstructor.h
new file mode 100644 (file)
index 0000000..265a748
--- /dev/null
@@ -0,0 +1,41 @@
+#ifndef ALIT0RECONSTRUCTOR_H
+#define ALIT0RECONSTRUCTOR_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+/* $Id$ */
+
+#include "AliReconstructor.h"
+#include "AliT0digit.h"
+class AliRunLoader;
+
+class AliT0Reconstructor: public AliReconstructor {
+public:
+  AliT0Reconstructor(): AliReconstructor() {};
+  virtual ~AliT0Reconstructor() {};
+  virtual  void   ConvertDigits( AliRawReader* rawReader, TTree* fdigits) const;
+  virtual  void   Reconstruct(TTree* fdigits, TTree * frecpoints) const ;
+  virtual  void   Reconstruct(AliRunLoader* , AliRawReader*   ) const {};
+  virtual  void   Reconstruct(AliRawReader* ) const {};
+  virtual  void   Reconstruct(AliRawReader* , TTree*) const {};
+  virtual  void   Reconstruct(AliRunLoader* ) const {};
+  
+  virtual void         FillESD(AliRunLoader* runLoader, AliESD* esd) const;
+  virtual void         FillESD(AliRunLoader* , AliRawReader*, AliESD* ) const  {};
+  virtual void         FillESD(  AliRawReader*,  TTree*, AliESD* ) const  {};
+  virtual void         FillESD( TTree*,  TTree*, AliESD* ) const  {};
+  virtual Bool_t       HasLocalReconstruction() const {return kTRUE;};
+  virtual Bool_t       HasDigitConversion() const {return kTRUE;};
+ public:
+  AliT0digit *fdigits   ; // digits
+  Float_t fZposition; // vertex position
+
+  ClassDef(AliT0Reconstructor, 0)   // class for the T0 reconstruction
+
+};
+
+typedef AliT0Reconstructor AliSTARTReconstructor; // for backward compatibility
+
+#endif
diff --git a/T0/AliT0SetCDB.C b/T0/AliT0SetCDB.C
new file mode 100644 (file)
index 0000000..ea89c20
--- /dev/null
@@ -0,0 +1,176 @@
+/* $Id$ */
+
+// Script to create calibration parameters and store them into CDB
+// Two sets of calibration parameters can be created:
+// 1) equal parameters
+// 2) randomly distributed parameters for decalibrated detector silumations
+
+#if !defined(__CINT__)
+#include "TControlBar.h"
+#include "TString.h"
+#include "TRandom.h"
+#include "TH1F.h"
+#include "TF1.h"
+#include "TCanvas.h"
+
+#include "AliRun.h"
+#include "AliT0CalibData.h"
+#include "AliT0AlignData.h"
+#include "AliCDBMetaData.h"
+#include "AliCDBId.h"
+#include "AliCDBEntry.h"
+#include "AliCDBManager.h"
+#include "AliCDBStorage.h"
+#endif
+
+
+void AliT0SetCDB()
+{
+  TControlBar *menu = new TControlBar("vertical","T0 CDB");
+  menu->AddButton("Set Calib","SetCC()",
+                 "Set calibration coefficients");
+  menu->AddButton("Set Align","SetAC()",
+                 "Set alignment coefficients");
+  menu->AddButton("Read calibration CC","GetCC()",
+                 "Read calibration  coefficients");
+  menu->AddButton("Read alignment CC","GetAC()",
+                 "Read face detector position ");
+  menu->Show();
+}
+
+
+//------------------------------------------------------------------------
+void SetAC()
+{
+  // Writing alignment coefficients into the Condition DB
+  // Arguments:
+  
+  TString DBFolder;
+  Int_t firstRun   =  0;
+  Int_t lastRun    = 10;
+  Int_t beamPeriod =  1;
+  char* objFormat  = "";
+
+  DBFolder  ="local://Align";
+  firstRun  =  0;
+  lastRun   =  10;
+  objFormat = "T0 array Z positions";
+
+  
+  AliT0AlignData *alignda=new AliT0AlignData("T0");
+  alignda-> SetZposition (67.9,373);
+  alignda->Print();
+  
+  //Store calibration data into database
+  AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT");
+   AliCDBManager::Instance()->SetSpecificStorage("T0",DBFolder.Data());
+  
+  AliCDBMetaData md;
+  md.SetComment(objFormat);
+  md.SetBeamPeriod(beamPeriod);
+  md.SetResponsible("Alla");
+  TString fPath="T0/Align/Positions";
+
+
+  //  AliCDBStorage* storage = AliCDBManager::Instance()->GetSpecificStorage("T0");
+  AliCDBStorage* storage = AliCDBManager::Instance()->GetDefaultStorage();
+ if(storage) {
+   AliCDBId id(fPath.Data(),firstRun,lastRun);
+
+   storage->Put(alignda, id, &md);
+ }
+}
+//------------------------------------------------------------------------
+void SetCC()
+{
+  // Writing calibration coefficients into the Calibration DB
+  // Arguments:
+
+  TString DBFolder;
+  Int_t firstRun   =  0;
+  Int_t lastRun    = 10;
+  Int_t beamPeriod =  1;
+  char* objFormat  = "";
+
+  DBFolder  ="local://Calib";
+  firstRun  =  0;
+  lastRun   =  10;
+  objFormat = "T0 initial gain factors, time delay, slewnig";
+
+  AliT0CalibData *calibda=new AliT0CalibData("T0");
+  
+  Float_t fGain = 1;
+  Float_t fTimeDelay  = 200;
+  
+  TRandom rn;
+  
+  for(Int_t ipmt=0; ipmt<24; ipmt++) {
+    calibda->SetGain (fGain,ipmt);
+    calibda->SetTimeDelayCFD(fTimeDelay,ipmt);
+    calibda->SetTimeDelayLED(fTimeDelay,ipmt);
+    calibda->SetWalk(ipmt,"data/re.root");
+    calibda->SetSlewingLED(ipmt,"data/CFD-LED.txt");
+    calibda->SetSlewingRec(ipmt,"data/CFD-LED.txt");
+    Double_t value=calibda->GetSlewingLED(ipmt,300);
+    Double_t rec= calibda->GetSlewingRec(ipmt, value);
+    cout<<" in "<<value<<" out "<<rec<<endl;
+  }
+  calibda->Print();
+  //Store calibration data into database
+  AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT");
+
+  //  AliCDBManager::Instance()->SetSpecificStorage("T0",DBFolder.Data());
+  
+  AliCDBMetaData md;
+  md.SetComment(objFormat);
+  md.SetBeamPeriod(beamPeriod);
+  md.SetResponsible("Alla");
+  TString fPath="T0/Calib/Gain_TimeDelay_Slewing_Walk";
+
+
+  // AliCDBStorage* storage = AliCDBManager::Instance()->GetSpecificStorage("T0");
+  AliCDBStorage* storage = AliCDBManager::Instance()->GetDefaultStorage();
+  if(storage) {
+    AliCDBId id(fPath.Data(),firstRun,lastRun);
+    storage->Put(calibda, id, &md);
+  }
+}
+
+//------------------------------------------------------------------------
+void GetCC()
+{
+  // Read calibration coefficients into the Calibration DB
+  // Arguments:
+  
+  TString DBFolder;
+  
+  DBFolder  ="local://Calib";
+  Int_t nRun=gAlice->GetRunNumber();
+  
+  AliCDBManager *man = AliCDBManager::Instance();
+  AliCDBStorage *stor2 = man->GetStorage("local://Calib");
+  AliCDBEntry *entry;
+  entry = stor2->Get("T0/Calib/Gain_TimeDelay_Slewing_Walk");
+   
+  AliT0CalibData *clb = (AliT0CalibData*)entry->GetObject();
+  clb->Print();
+}
+//------------------------------------------------------------------------
+void GetAC()
+{
+  // Read align coefficients into the Calibration DB
+  // Arguments:
+  
+  TString DBFolder;
+  
+  DBFolder  ="local://Align";
+  Int_t nRun=gAlice->GetRunNumber();
+  
+  AliCDBManager *man = AliCDBManager::Instance();
+  AliCDBStorage *stor2 = man->GetStorage("local://Align");
+  AliCDBEntry *entry;
+  entry = stor2->Get("T0/Align/Positions", nRun);
+   
+  AliT0AlignData *aln = (AliT0AlignData*)entry->GetObject();
+  aln->Print();
+}
diff --git a/T0/AliT0Trigger.cxx b/T0/AliT0Trigger.cxx
new file mode 100644 (file)
index 0000000..1450f01
--- /dev/null
@@ -0,0 +1,91 @@
+/**************************************************************************
+ * 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.                  *
+ **************************************************************************/
+
+/* $Id$ */
+
+#include <Riostream.h>
+#include "AliLog.h"
+#include "AliRun.h"
+#include "AliRunLoader.h"
+#include "AliTriggerInput.h"
+
+#include "AliT0.h"
+#include "AliT0Loader.h"
+#include "AliT0digit.h"
+#include "AliT0Trigger.h"
+
+//----------------------------------------------------------------------
+ClassImp(AliT0Trigger)
+
+//----------------------------------------------------------------------
+AliT0Trigger::AliT0Trigger()
+  : AliTriggerDetector() 
+{
+   SetName("T0");
+   CreateInputs();
+}
+
+//----------------------------------------------------------------------
+void AliT0Trigger::CreateInputs()
+{
+   // inputs 
+   
+   // Do not create inputs again!!
+   if( fInputs.GetEntriesFast() > 0 ) return;
+   
+   fInputs.AddLast( new AliTriggerInput( "START_A_L0", "Signal on T0-A",  0x0100 ) );
+   fInputs.AddLast( new AliTriggerInput( "START_C_L0", "Signal on T0-C", 0x0200 ) );
+   fInputs.AddLast( new AliTriggerInput( "START_Vertex_L0", " Vertex T0-C&T0-A ", 0x0400 ) );
+   fInputs.AddLast( new AliTriggerInput( "START_Centr_L0", "Centrality central",  0x0800 ) );
+   fInputs.AddLast( new AliTriggerInput( "START_SemiCentral_L0", "Centrality semicentral",  0x1000 ) );
+}
+
+//----------------------------------------------------------------------
+void AliT0Trigger::Trigger()
+{
+   AliRunLoader* runLoader = gAlice->GetRunLoader();
+   AliLoader * fT0Loader = runLoader->GetLoader("T0Loader");
+   //   AliT0digit *fDigits; 
+   fT0Loader->LoadDigits("READ");
+   // Creating T0 data container
+
+   TTree* treeD = fT0Loader->TreeD();
+  if (!treeD) {
+    AliError("no digits tree");
+    return;
+  }
+  AliT0digit *fDigits = new AliT0digit();
+
+  TBranch *brDigits = treeD->GetBranch("T0");
+  if (brDigits) {
+    brDigits->SetAddress(&fDigits);
+  }else{
+    AliError("Branch T0 DIGIT not found");
+    return;
+  } 
+  brDigits->GetEntry(0);
+  Int_t   besttimeright = fDigits->BestTimeRight();
+  Int_t   besttimeleft = fDigits->BestTimeLeft();
+  Int_t   timeDiff = fDigits->TimeDiff();
+  Int_t    sumMult=   fDigits->SumMult();
+
+  if (besttimeright > 0 && besttimeright <99999  )  SetInput("START_A_L0");
+  if (besttimeleft>0  && besttimeleft<99999)   SetInput("START_C_L0"); 
+  if (timeDiff >5500 && timeDiff < 6500)       SetInput("START_Vertex_L0");
+  if (sumMult > 175)                           SetInput("START_Centr_L0");
+  if (sumMult>155 && sumMult <= 175)           SetInput("START_SemiCentral_L0");;
+
+   
+}
diff --git a/T0/AliT0Trigger.h b/T0/AliT0Trigger.h
new file mode 100644 (file)
index 0000000..b3fe457
--- /dev/null
@@ -0,0 +1,45 @@
+#ifndef ALIT0TRIGGER_H
+#define ALIT0TRIGGER_H
+
+/// \ingroup sim
+/// \class AliT0Trigger
+/// \brief T0 trigger class
+///
+/////////////////////////////////////////////////
+///  T0 Trigger Detector Class               //
+/////////////////////////////////////////////////
+
+#include "AliTriggerDetector.h"
+class AliT0;
+
+class AliT0Trigger : public AliTriggerDetector
+{
+ public:
+  AliT0Trigger();  // constructor
+  virtual ~AliT0Trigger(){}  // destructor
+  virtual void    CreateInputs();
+  virtual void    Trigger();
+  
+ private:
+  
+  AliT0 *fT0;          //!
+  AliT0digit *fDigits   ; //! digits
+
+  AliT0Trigger(const AliT0Trigger&);
+  AliT0Trigger& operator=(const AliT0Trigger&);
+
+  
+  ClassDef(AliT0Trigger,1)  // T0 Trigger Detector class
+};
+
+typedef AliT0Trigger AliSTARTTrigger; // for backward compatibility
+
+#endif
+
+
+
+
+
+
+
+
diff --git a/T0/AliT0digit.cxx b/T0/AliT0digit.cxx
new file mode 100644 (file)
index 0000000..62b96e1
--- /dev/null
@@ -0,0 +1,145 @@
+/**************************************************************************
+ * 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.                  *
+ **************************************************************************/
+
+/* $Id$ */
+/////////////////////////////////////////////////////////////////////////
+//  Class AliT0digit for T0 digits
+//  fTimeRight  - right side TOF signal
+//  fTimeLeft  - left side TOF signal
+//  fTimeBestRight - TOF first particle on the right side
+//  TimeBestLeft - TOF first particle on the left side
+//  fTimeAverage = (fTimeBestRight + TimeBestLeft ) /2. T0 signal
+//  fTimeDiff = fTimeBestRight - TimeBestLeft  
+//
+///////////////////////////////////////////////////////////////////////
+
+#include "AliT0digit.h"
+#include "TArrayI.h"
+
+ClassImp(AliT0digit)
+
+//-----------------------------------------------
+  AliT0digit::AliT0digit() :TObject()
+{
+
+  fTimeAverage   = 99999;
+  fTimeDiff      = 99999;
+  fBestTimeRight = 99999;
+  fBestTimeLeft  = 99999;
+
+  fTime = new TArrayI(24);
+  fADC  = new TArrayI(24);
+  fTimeAmp = new TArrayI(24);
+  fADCAmp  = new TArrayI(24);
+}
+
+//-----------------------------------
+AliT0digit::~AliT0digit() {
+  // destructor
+  delete fTime;
+  delete fADC;
+  delete fTimeAmp;
+  delete fADCAmp;
+}
+//-----------------------------------
+void AliT0digit::SetTime (TArrayI &o)
+{
+  ////////////////////////////////////////
+  fTime = new TArrayI(24);
+
+  Int_t i;
+  for (i=0; i<24; i++)
+    {
+      Int_t buf=o.At(i);
+      fTime->AddAt(buf,i);
+    }
+}
+//--------------------------------------------
+void AliT0digit::GetTime (TArrayI &o)
+{
+  //
+  Int_t i;
+  for (i=0; i<24; i++)
+    {
+      o[i]=fTime->At(i);
+    }
+}
+//--------------------------------------------
+void AliT0digit::GetADC (TArrayI &o)
+{
+  //
+  Int_t i;
+  for (i=0; i<24; i++)
+    {
+      o[i]=fADC->At(i);
+    }
+}
+//--------------------------------------------
+void AliT0digit::SetADC (TArrayI &o)
+{
+  //
+  fADC  = new TArrayI(24);
+  Int_t i;
+  for (i=0; i<24; i++)
+    {
+      Int_t buf=(o.At(i));
+      fADC->AddAt(buf,i);
+    }
+}
+//-----------------------------------
+void AliT0digit::SetTimeAmp (TArrayI &o)
+{
+  ////////////////////////////////////////
+  fTimeAmp = new TArrayI(24);
+
+  Int_t i;
+  for (i=0; i<24; i++)
+    {
+      Int_t buf=o.At(i);
+      fTimeAmp->AddAt(buf,i);
+    }
+}
+//--------------------------------------------
+void AliT0digit::GetTimeAmp (TArrayI &o)
+{
+  //
+  Int_t i;
+  for (i=0; i<24; i++)
+    {
+      o[i]=fTimeAmp->At(i);
+    }
+}
+//--------------------------------------------
+void AliT0digit::GetADCAmp (TArrayI &o)
+{
+  //
+  Int_t i;
+  for (i=0; i<24; i++)
+    {
+      o[i]=fADCAmp->At(i);
+    }
+}
+//--------------------------------------------
+void AliT0digit::SetADCAmp (TArrayI &o)
+{
+  //
+  fADCAmp  = new TArrayI(24);
+  Int_t i;
+  for (i=0; i<24; i++)
+    {
+      Int_t buf=(o.At(i));
+      fADCAmp->AddAt(buf,i);
+    }
+}
diff --git a/T0/AliT0digit.h b/T0/AliT0digit.h
new file mode 100644 (file)
index 0000000..1d41108
--- /dev/null
@@ -0,0 +1,61 @@
+#ifndef ALIT0DIGIT_H
+#define ALIT0DIGIT_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+/* $Id$ */
+#include <TObject.h>
+class TClonesArray;
+class TArrayI;
+
+//___________________________________________
+class AliT0digit: public TObject {
+  ////////////////////////////////////////////////////////////////////////
+ public:
+  AliT0digit();
+  virtual ~AliT0digit();
+  Int_t BestTimeRight() {return fBestTimeRight;}
+  Int_t BestTimeLeft() {return fBestTimeLeft;}
+  Int_t MeanTime() {return fTimeAverage;}
+  Int_t TimeDiff() {return fTimeDiff;}
+  Int_t SumMult() {return fSumMult;}
+  void SetTimeBestRight( Int_t time) {fBestTimeRight = time;}
+  void SetTimeBestLeft( Int_t time) {fBestTimeLeft = time;}
+  void SetMeanTime(Int_t time) {fTimeAverage=time;}
+  void SetDiffTime(Int_t time) {fTimeDiff=time;}
+  void SetSumMult(Int_t time) {fSumMult=time;}
+  
+  virtual void SetTime (TArrayI &o);
+  virtual void GetTime (TArrayI &o);
+  virtual void SetADC (TArrayI &o);
+  virtual void GetADC (TArrayI &o);
+  
+  virtual void SetTimeAmp (TArrayI &o);
+  virtual void GetTimeAmp (TArrayI &o);
+  virtual void SetADCAmp (TArrayI &o);
+  virtual void GetADCAmp (TArrayI &o);
+ private: 
+
+  Int_t fBestTimeRight;        // TOF first particle on the right 
+  Int_t fBestTimeLeft;         // TOF first particle on the left
+  Int_t fTimeAverage;             // mean time (start signal)
+  Int_t fTimeDiff;             // time difference (vertex position)
+
+  TArrayI *fTime;    // array's TDC
+  TArrayI *fADC;    // array's ADC
+  TArrayI *fTimeAmp;    // array's TDC
+  TArrayI *fADCAmp;    // array's ADC
+  Int_t fSumMult;   //multiplisity
+  AliT0digit( const AliT0digit& );
+  AliT0digit& operator=(const AliT0digit&); 
+  
+  ClassDef(AliT0digit,4)  //Digit (Header) object for set:T0
+};
+
+typedef AliT0digit AliSTARTdigit; // for backward compatibility
+
+#endif
+
+
+
+
diff --git a/T0/AliT0hit.cxx b/T0/AliT0hit.cxx
new file mode 100644 (file)
index 0000000..6b51a15
--- /dev/null
@@ -0,0 +1,84 @@
+/**************************************************************************
+ * 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.                  *
+ **************************************************************************/
+
+/* $Id$ */
+// AliT0hit is the hit class for the T0. Hits are the information
+// that comes from a Monte Carlo at each step as a particle mass through
+// sensitive detector elements as particles are transported through a
+// detector.
+//
+// Data members:
+//
+// Int_t fTrack
+//     See AliHit for a full description. The track number of the track
+// that made this hit.
+//
+// Float_t fX
+//     See AliHit for a full description. The global x position of the
+// hit (in the standard units of the Monte Carlo).
+//
+// Float_t fY
+//     See AliHit for a full description. The global y position of the
+// hit (in the standard units of the Monte Carlo).
+//
+// Float_t fZ
+//     See AliHit for a full description. The global z position of the
+// hit (in the standard units of the Monte Carlo).
+//
+// Int_t fStatus
+//     The track status flag. This flag indicates the track status
+// at the time of creating this hit. It is made up of the following 8
+// status bits from highest order to lowest order bits
+// 0           :  IsTrackAlive():    IsTrackStop():IsTrackDisappeared():
+// IsTrackOut():IsTrackExiting():IsTrackEntering():IsTrackInside()     .
+// See AliMC for a description of these functions. If the function is
+// true then the bit is set to one, otherwise it is zero.
+//
+// Int_t fVolume
+//     The number of the T0 detector that contains this hit.
+//     0 - right array; 1 - left array 
+// Int_t fPmt 
+// the number of PMT tube that contains hit
+// Float_t fEdep
+//     The energy lost by the particle during the step ending in this
+// hit. The units are those determined by the Monte Carlo.
+//
+// Float_t fTime
+//     The time of flight associated with the particle  in this
+// hit. The time is typically measured from the point of creation of the
+// original particle (if this particle is a daughter).  The units
+// are those determined by the Monte Carlo.
+///////////////////////////////////////////////////////////////////////
+  
+
+#include "AliT0hit.h"
+
+ClassImp(AliT0hit)
+
+AliT0hit::AliT0hit(Int_t shunt, Int_t track, Int_t *vol, Float_t *hits):
+  AliHit(shunt, track)
+{
+//Normal T0 hit ctor
+  
+   fVolume = vol[0];
+   fPmt=vol[1];
+   fX=hits[0];
+   fY=hits[1];
+   fZ=hits[2];
+   fEtot=Double_t (hits[3]);
+   fParticle=Int_t (hits[4]);
+   fTime=hits[5];
+}
diff --git a/T0/AliT0hit.h b/T0/AliT0hit.h
new file mode 100644 (file)
index 0000000..482720d
--- /dev/null
@@ -0,0 +1,37 @@
+#ifndef ALIT0hit_H
+#define ALIT0hit_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+/* $Id$ */
+////////////////////////////////////////////////
+//  Manager and hits classes for set:T0     //
+////////////////////////////////////////////////
+#include "AliHit.h"
+class AliT0hit : public AliHit {
+public:
+  AliT0hit(){}//Empty ctor
+  AliT0hit(Int_t shunt, Int_t track, Int_t *vol, Float_t *hits);
+  virtual ~AliT0hit(){}//Empty virtual dtor
+  Int_t Volume() const {return fVolume;}
+  Int_t Pmt() const {return fPmt;}
+  Float_t Particle() const {return fParticle;} 
+  Double_t Etot() const {return fEtot;}
+  Float_t Time() const {return fTime;}
+
+private:
+  Int_t      fVolume;   //T0 arm mark
+  Int_t      fPmt;      //PMT number in the arm  
+  Int_t      fParticle; //Primary particle ID
+  Double_t    fEtot;     //Energy of primary particle at the entrance to radiator 
+  Float_t    fTime;     //Primary particle TOF 
+  
+   ClassDef(AliT0hit,2)  //Hits for detector T0
+};
+
+typedef AliT0hit AliSTARThit; // for backward compatibility
+
+#endif//ALIT0hit_H
diff --git a/T0/AliT0hitPhoton.cxx b/T0/AliT0hitPhoton.cxx
new file mode 100644 (file)
index 0000000..bb8e3a4
--- /dev/null
@@ -0,0 +1,32 @@
+/**************************************************************************
+ * Copyright(c) 2001, 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 "AliT0hitPhoton.h"
+
+ClassImp(AliT0hitPhoton)
+//___________________________________________
+AliT0hitPhoton::AliT0hitPhoton(Int_t shunt, Int_t track, Int_t *vol, Float_t *hit)
+  :AliHit(shunt, track)
+{
+// Constructor for object AliT0Cerenkov
+    fArray  = vol[0];
+    fPmt    = vol[1];
+    fRadius = hit[0];
+    fMomX   = hit[1];
+    fMomY   = hit[2];
+    fMomZ   = hit[3];
+    fTime   = hit[4];
+    fEtot   = hit[5];
+}
diff --git a/T0/AliT0hitPhoton.h b/T0/AliT0hitPhoton.h
new file mode 100644 (file)
index 0000000..68e3b92
--- /dev/null
@@ -0,0 +1,29 @@
+#ifndef ALIT0HITPHOTON_H
+#define ALIT0HITPHOTON_H
+
+#include "AliHit.h"
+//------------------------------------------------
+// Cerenkov's photon  object
+//------------------------------------------------
+
+class AliT0hitPhoton: public AliHit {
+ public:
+    Int_t      fArray;         // Array number
+    Int_t      fPmt;           // PMT number in the array
+    Float_t    fTime;          // Time convention in photoelectron
+    Float_t    fEtot;          // Energy photon
+    Float_t    fMomX;          // Local Momentum
+    Float_t    fMomY;          // Local Momentum
+    Float_t    fMomZ;          // Local Momentum
+    Float_t    fRadius;        // Distance from axis of radiatar
+ public:
+    AliT0hitPhoton() {}
+    AliT0hitPhoton(Int_t fIshunt, Int_t track, Int_t *vol, Float_t *hit);
+    virtual ~AliT0hitPhoton() {}
+    
+    ClassDef(AliT0hitPhoton,1)  //Cerenkov's photons object for set:T0
+};
+#endif
diff --git a/T0/AliT0v0.cxx b/T0/AliT0v0.cxx
new file mode 100644 (file)
index 0000000..6c42855
--- /dev/null
@@ -0,0 +1,586 @@
+/**************************************************************************
+ * 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.                  *
+ **************************************************************************/
+
+/* $Id$ */
+
+/////////////////////////////////////////////////////////////////////
+//                                                                 //
+// T0 ( T-zero) detector  version 0                        //
+//
+//Begin Html       
+/*
+<img src="gif/AliT0v0Class.gif">
+*/
+//End Html
+//                                                                  //
+//                                                                  //
+//////////////////////////////////////////////////////////////////////
+
+#include <Riostream.h>
+#include <stdlib.h>
+
+#include <TGeometry.h>
+#include <TLorentzVector.h>
+#include <TMath.h>
+#include <TNode.h>
+#include <TTUBE.h>
+#include <TVirtualMC.h>
+
+#include "AliLog.h"
+#include "AliMagF.h"
+#include "AliRun.h"
+#include "AliT0hit.h"
+#include "AliT0v0.h"
+#include "AliLog.h"
+
+ClassImp(AliT0v0)
+
+//--------------------------------------------------------------------
+AliT0v0::AliT0v0(const char *name, const char *title):
+ AliT0(name,title)
+{
+  //
+  // Standart constructor for T0 Detector version 0
+  //
+  fIdSens1=0;
+//  setBufferSize(128000);
+}
+//-------------------------------------------------------------------------
+void AliT0v0::CreateGeometry()
+{
+  //
+  // Create the geometry of T0 Detector version 0
+  // Full geometry with support structure according T0 prototype
+  //
+  // begin Html
+  /*
+   <img src="gif/AliT0v0.gif">
+  */
+  //
+
+
+
+  Int_t *idtmed = fIdtmed->GetArray();
+  
+  Int_t is;
+  Int_t idrotm[999];
+  Float_t x,y,z;
+ Float_t pstartR[18]={0., 360., 5., 
+                      -76.5+0.00+69.7, 4.25, 10.,
+                      -76.5+6.05+69.7, 4.5, 10., 
+                      -76.5+8.05+69.7, 4.5, 10.,
+                      -76.5+8.05+69.7, 5.1, 10.,
+                      -62.9+0.00+69.7, 5.1, 10.};
+  
+  Float_t pstart[3]={4.3, 12.,6.8};
+  Float_t pinstart[3]={0.,1.6,6.5};
+  Float_t ppmt[3]={0.,1.5,3.5};
+
+  Float_t preg[3]={0.,0.875,0.005}; //dobavil bogdanov
+
+  Float_t pdivider[3]={0.,1.2,1.75};
+  Float_t pdiv2[3]={0.,1.2,1.25};
+  Float_t pdiv1[3]={0.6,1.2,0.5};
+  //  Float_t ptop[3]={0.,1.3,1.5};
+  Float_t ptop[3]={0.,1.0,1.5};
+  Float_t pbot[3]={0.6,1.2,0.1};
+  Float_t pglass[3]={1.2,1.3,2.};
+  Float_t pcer[3]={0.9,1.1,0.09};
+  Float_t psteel[3]={0.9,1.1,0.01};
+  Float_t ppins[3]={0.6,1.2,0.014};
+  Float_t phole[3]={0.6,1.2,0.015};
+  Float_t pknob[3]={0.5,0.6,0.4};
+  Float_t pknob_vac[3]={0.,0.5,0.4};
+  Float_t pknob_bot[3]={0.,0.6,0.05};
+  Float_t pribber[3] = {0.,1.2,2.413/2.};
+  Float_t presist[3] = {0.,1.2,0.087/2.};
+  Float_t psupport1[3] = {4.51,4.6,4.0};//C kozhuh vnutri
+  Float_t psupport2[3] = {9.4,9.5,4.0};// snaruzhi  C
+  Float_t psupport3[3] = {4.51,9.5,0.05};//kryshki  C
+   Float_t psupport5[3] = {1.44,1.5,6.5}; // stakanchik dlai feu  C
+  Float_t psupport6[3] = {0,1.5,0.05}; //kryshechka stakanchika  Al
+  Float_t psupport7[3] = {1.5,1.6,0.6}; //kolechko snaruzhu stakanchika Al
+  // Mother Volume katushka dlia krepezha vokrug truby k Absorbru
+    AliMatrix(idrotm[901], 90., 0., 90., 90., 180., 0.);
+  Float_t ppcon[70]; 
+    ppcon[0]  =   0;
+    ppcon[1]  = 360;
+    ppcon[2]  =  13;
+//  1: 
+    ppcon[3]  =  14.1/2;
+    ppcon[4]  =   4.4;
+    ppcon[5]  =   4.5;
+//  2
+    ppcon[6]  = ppcon[3]+1.;
+    ppcon[7]  =   4.4;
+    ppcon[8]  =   4.5;
+//  3
+    ppcon[9]  = ppcon[6];
+    ppcon[10] =   4.4;
+    ppcon[11] =   5.1;
+
+//  4
+
+    ppcon[12]  = ppcon[9]+0.1;
+    ppcon[13] =   4.4;
+    ppcon[14] =   5.1;
+//  5
+
+    ppcon[15]  = ppcon[12];
+    ppcon[16] =   4.9;
+    ppcon[17] =   5.1;
+    
+//  6
+    ppcon[18]  = ppcon[15]+7.05;
+    ppcon[19] =   4.9;
+    ppcon[20] =   5.1;
+    
+//  7
+    ppcon[21]  = ppcon[18];
+    ppcon[22] =   4.9;
+    ppcon[23] =   5.1;
+
+/// 8
+    ppcon[24]  = ppcon[21]+0.01;
+    ppcon[25] =   3.15;
+    ppcon[26] =   3.25;
+    
+/// 9
+    ppcon[27]  = ppcon[24];
+    ppcon[28] =   3.15;
+    ppcon[29] =   3.25;
+    
+//  10
+    ppcon[30]  = ppcon[27]+4.5;
+    ppcon[31] =   3.15;
+    ppcon[32] =   3.25;
+
+//  11
+    ppcon[33] = ppcon[30];
+    ppcon[34] =   3.15;
+    ppcon[35] =   3.25;
+
+//  12
+    ppcon[36]  = ppcon[33];
+    ppcon[37] =   3.15;
+    ppcon[38] =   7.6;
+
+//  13
+    ppcon[39]  = ppcon[33]+0.4;
+    ppcon[40] =   3.15;
+    ppcon[41] =   7.6;
+
+//  14
+//    ppcon[39]  = ppcon[36];
+//    ppcon[40] =   3.15;
+//    ppcon[41] =   7.6;
+
+    gMC->Gsvolu("0SUP", "PCON", idtmed[kAir], ppcon,42);
+    z=-69.7;//-14.1/2;
+    gMC->Gspos("0SUP",1,"ALIC",0.,0.,z,idrotm[901],"ONLY");
+
+
+   Float_t zdetRight=69.7,zdetLeft=350;
+ //-------------------------------------------------------------------
+ //  T0 volume 
+ //-------------------------------------------------------------------
+  
+    
+    gMC->Gsvolu("0STR","PCON",idtmed[kAir],pstartR,18);
+    gMC->Gsvolu("0STL","TUBE",idtmed[kAir],pstart,3);
+    gMC->Gspos("0STR",1,"ALIC",0.,0.,-zdetRight-pstart[2],idrotm[901],"ONLY");
+    gMC->Gspos("0STL",1,"ALIC",0.,0.,zdetLeft+pstart[2],0,"ONLY");
+
+//T0 interior
+    gMC->Gsvolu("0INS","TUBE",idtmed[kAir],pinstart,3);
+    gMC->Gsvolu("0PMT","TUBE",idtmed[kOpAir],ppmt,3);     
+    gMC->Gsvolu("0DIV","TUBE",idtmed[kVac],pdivider,3);     
+    gMC->Gsvolu("0SU1","TUBE",idtmed[kC],psupport1,3);//C kozhuh vnutri
+    gMC->Gsvolu("0SU2","TUBE",idtmed[kC],psupport2,3);// snaruzhi  C
+    gMC->Gsvolu("0SU3","TUBE",idtmed[kC],psupport3,3);//kryshka perednaiai  C
+    gMC->Gsvolu("0SU4","TUBE",idtmed[kC],psupport3,3);//kryshka zadnaiai  C
+    //    gMC->Gsvolu("0SU5","TUBE",idtmed[kAir],psupport4,3);// dyrki dlia feu v zadnej kryshke Air
+    gMC->Gsvolu("0SU6","TUBE",idtmed[kC],psupport5,3);// stakanchik dlai feu  C
+    gMC->Gsvolu("0SU7","TUBE",idtmed[kAl],psupport6,3);//kryshechka stakanchika  Al
+    gMC->Gsvolu("0SU8","TUBE",idtmed[kAl],psupport7,3);//kolechko snaruzhu stakanchika Al
+       
+// first ring: 12 units of Scintillator+PMT+divider
+  Float_t  theta  = (180 / TMath::Pi()) * TMath::ATan(6.5 / zdetRight);
+  Float_t angle  = 2 * TMath::Pi() / 12;
+  Float_t phi[3];
+    
+   for (is=0; is<12; is++)
+      {  
+
+       x = 6.5 * TMath::Sin(is * angle);
+       y = 6.5 * TMath::Cos(is * angle);
+       
+       phi[0] = -30 * is;
+       phi[1] = 90 - is * 30;
+       phi[2] = 90 - is * 30;
+       for (Int_t j = 0; j < 3; j++)
+         if (phi[j] < 0)  phi[j] += 360;
+       
+       AliMatrix (idrotm[902 + is], 90.,         phi[0],
+                  90. + theta, phi[1],
+                  theta,       phi[2]);  
+       z=-pstart[2]+pinstart[2]+0.2;
+       gMC->Gspos ("0INS", is + 1, "0STR", x, y, z, idrotm[902 + is], "ONLY");
+       gMC->Gspos ("0INS", is + 13, "0STL", x, y, z, 0, "ONLY");
+       
+       x = 9 * TMath::Sin(angle/2+is * angle);
+       y = 9 * TMath::Cos(angle/2+is * angle);
+
+       gMC->Gspos ("0INS", is + 25, "0STL", x, y, z, 0, "ONLY");
+               
+      }        
+   
+      
+   x=0;
+   y=0;
+   z=-pinstart[2]+ppmt[2]+2.*psupport6[2]+0.1;
+   gMC->Gspos("0PMT",1,"0INS",x,y,z,0,"ONLY");
+   z=z+pdivider[2]+ppmt[2];
+   gMC->Gspos("0DIV",1,"0INS",x,y,z,0,"ONLY");
+   
+   // PMT
+   
+   // Entry window (glass)
+   gMC->Gsvolu("0TOP","TUBE",idtmed[kOpGlass],ptop,3); //glass
+   //   gMC->Gsvolu("0TOP","TUBE",idtmed[12],ptop,3); //lucite
+   z=-ppmt[2]+ptop[2];
+   gMC->Gspos("0TOP",1,"0PMT",0,0,z,0,"ONLY");
+   
+   //Fotokatod
+   
+   gMC->Gsvolu ("0REG", "TUBE", idtmed[kOpGlass], preg, 3); //photocathode dobavil bogdanov(AliT0v2)
+   z = -ppmt[2] + 2 * ptop[2] + preg[2]; //photocathode dobavil bogdanov 
+   gMC->Gspos ("0REG", 1, "0PMT", 0, 0, z, 0, "ONLY"); //photocathode dobavil bogdanov(AliT0v2)
+   
+   // Bottom glass
+   gMC->Gsvolu("0BOT","TUBE",idtmed[kGlass],pbot,3);
+   z=ppmt[2]-pbot[2];
+   AliDebugClass(1,Form(" Z bottom %f\n",z));
+   gMC->Gspos("0BOT",1,"0PMT",0,0,z,0,"ONLY");
+   // Side cylinder glass
+   gMC->Gsvolu("0OUT","TUBE",idtmed[kGlass],pglass,3);
+   z=ppmt[2]-pglass[2];
+   gMC->Gspos("0OUT",1,"0PMT",0,0,z,0,"ONLY");
+   //PMT electrodes support structure
+   gMC->Gsvolu("0CER","TUBE",idtmed[kCer],pcer,3);
+   gMC->Gsvolu("0STE","TUBE",idtmed[kSteel],psteel,3);
+   z=-ppmt[2]+2*ptop[2]+0.3;;
+   for (is=1; is<=15; is++)
+     {
+       z=z+psteel[2]+pcer[2];
+       gMC->Gspos("0CER",is,"0PMT",0,0,z,0,"ONLY");
+       z=z+psteel[2]+pcer[2];
+       gMC->Gspos("0STE",is,"0PMT",0,0,z,0,"ONLY");
+     }
+   
+   // Divider
+   // Knob at the bottom of PMT baloon
+   
+   gMC->Gsvolu("0NB","TUBE",idtmed[6],pknob,3);
+   z=-pdivider[2]+pknob[2];
+   gMC->Gspos("0NB",1,"0DIV",0,0,z,0,"ONLY");
+   gMC->Gsvolu("0KB","TUBE",idtmed[kGlass],pknob_bot,3);
+   z=-pdivider[2]+2*pknob[2]+pknob_bot[2];
+   gMC->Gspos("0KB",1,"0DIV ",0,0,z,0,"ONLY");
+   gMC->Gsvolu("0VAC","TUBE",idtmed[kVac],pknob_vac,3);
+   z=-pdivider[2]+pknob_vac[2];
+   gMC->Gspos("0VAC",1,"0DIV",0,0,z,0,"ONLY");
+   //Steel pins + pin holes
+   gMC->Gsvolu("0PIN","TUBE",idtmed[kSteel],ppins,3);
+   z=-pdivider[2]+ppins[2];
+   gMC->Gspos("0PIN",1,"0DIV",0,0,z,0,"ONLY");
+   gMC->Gsvolu("0HOL","TUBE",idtmed[kBrass],phole,3);
+   z=-pdivider[2]+2*ppins[2]+phole[2];
+   gMC->Gspos("0HOL",1,"0DIV",0,0,z,0,"ONLY");
+   
+   //Socket
+   gMC->Gsvolu("0V1","TUBE",idtmed[kCer],pdiv1,3);
+   z=-pdivider[2]+pdiv1[2];
+   gMC->Gspos("0V1",1,"0DIV",0,0,z,0,"ONLY");
+   //Resistors
+   gMC->Gsvolu("0V2","TUBE",idtmed[kAir],pdiv2,3);
+   z=pdivider[2]-pdiv2[2];
+   gMC->Gspos("0V2",1,"0DIV",0,0,z,0,"ONLY");
+   gMC->Gsvolu("0RS","TUBE",idtmed[kCer],presist,3);
+   z=-pdiv2[2]+presist[2];
+   gMC->Gspos("0RS",1,"0V2",0,0,z,0,"ONLY");
+   gMC->Gsvolu("0RB","TUBE",idtmed[kRibber],pribber,3);
+   z=pdiv2[2]-pribber[2];
+   gMC->Gspos("0RB",1,"0V2",0,0,z,0,"ONLY");
+   
+   
+   //Support  left side
+   /*   
+   z=-pstart[2]+psupport1[2];
+   gMC->Gspos("0SU1",2,"0STL",0,0,z,0,"ONLY"); //C kozhuh snaruzhi
+   gMC->Gspos("0SU2",2,"0STL",0,0,z,0,"ONLY"); //C kozhuh vnutri
+   z=-pstart[2]+psupport3[2];
+   gMC->Gspos("0SU3",2,"0STL",0,0,z,0,"ONLY"); //peredniaia kryshka
+   z=-pstart[2]+2.*psupport1[2];
+   gMC->Gspos("0SU4",2,"0STL",0,0,z,0,"MANY"); //zadnaiai kryshka
+   */
+   z=-pstart[2]+psupport1[2]+0.1;
+   gMC->Gspos("0SU1",1,"0STR",0,0,z,0,"ONLY"); //C kozhuh snaruzhi
+   gMC->Gspos("0SU2",1,"0STR",0,0,z,0,"ONLY"); //C kozhuh vnutri
+   z=-pstart[2]+psupport3[2]+0.1;
+   gMC->Gspos("0SU3",1,"0STR",0,0,z,0,"ONLY"); //peredniaia kryshka
+   z=-pstart[2]+2.*psupport1[2]+0.1;
+   gMC->Gspos("0SU4",1,"0STR",0,0,z,0,"MANY"); //zadnaiai kryshka
+   gMC->Gspos("0SU6",1,"0INS",0,0,0,0,"ONLY");//C stakanchik dlia feu 
+   z=-pinstart[2]+psupport6[2];
+   gMC->Gspos("0SU7",1,"0INS",0,0,z,0,"ONLY"); //Al kryshechka 
+   
+   z=pinstart[2]-psupport7[2];
+   gMC->Gspos("0SU8",1,"0INS",0,0,z,0,"ONLY"); //Al kolechko
+   
+   
+   Float_t par[3];
+   par[0]=4.4;
+   par[1]=4.5;
+   par[2]=0.5;
+   gMC->Gsvolu("0SC0","TUBE",idtmed[kC],par,3);
+   z=ppcon[3]+par[2];
+   gMC->Gspos("0SC0",1,"0SUP",0,0,z,0,"ONLY"); 
+   z += par[2];
+   par[0]=4.4;
+   par[1]=5.1;
+   par[2]=0.05;
+   gMC->Gsvolu("0SC1","TUBE",idtmed[kC],par,3);
+   z += par[2];
+   gMC->Gspos("0SC1",1,"0SUP",0,0,z,0,"ONLY"); 
+   z=z+par[2];
+   par[0]=4.9;
+   par[1]=5.0;
+   par[2]=6.9/2;
+    gMC->Gsvolu("0SC2","TUBE",idtmed[kC],par,3);
+    z += par[2];
+    gMC->Gspos("0SC2",1,"0SUP",0,0,z,0,"ONLY"); 
+    z += par[2];
+    /*
+    Float_t parC[5];
+    parC[0]=0.25;
+    parC[1]=5.1;
+    parC[2]=5.2;
+    parC[3]=5.5;
+    parC[4]=5.6;
+    gMC->Gsvolu("0SC3","CONE",idtmed[kC],parC,5);
+    z += parC[0];
+    gMC->Gspos("0SC3",1,"0SUP",0,0,z,0,"ONLY"); 
+    z += parC[0];
+    par[0]=5.5;
+    par[1]=5.6;
+    par[2]=1.2/2;
+    gMC->Gsvolu("0SC4","TUBE",idtmed[kC],par,3);
+    z += par[2];
+    gMC->Gspos("0SC4",1,"0SUP",0,0,z,0,"ONLY"); 
+    par[0]=5.1;
+    par[1]=5.5;
+    par[2]=1.2/2;
+    gMC->Gsvolu("0SA0","TUBE",idtmed[kAl],par,3);
+    gMC->Gspos("0SA0",1,"0SUP",0,0,z,0,"ONLY"); 
+    //gvozdi dlia skruchivaniia Al i C parts
+    par[0]=5.75; 
+    par[1]=5.78;
+    gMC->Gsvolu("0SN1","TUBE",idtmed[kSteel],par,3);
+    gMC->Gspos("0SN1",1,"0SUP",0,0,z,0,"ONLY"); 
+    z += par[2];
+    */
+    par[0]=3.15;
+    par[1]=4.9;
+    par[2]=0.1/2;
+    gMC->Gsvolu("0SA1","TUBE",idtmed[kAl],par,3);
+    
+    z += par[2];
+    gMC->Gspos("0SA1",1,"0SUP",0,0,z,0,"ONLY"); 
+    z=z+par[2];
+    par[0]=3.15;
+    par[1]=3.16;
+    par[2]=4.5/2;
+    gMC->Gsvolu("0SA2","TUBE",idtmed[kAl],par,3);
+    z += par[2];
+    gMC->Gspos("0SA2",1,"0SUP",0,0,z,0,"ONLY"); 
+    z=z+par[2];
+    par[0]=3.16; // eta chast' prikruchena k absorberu
+    par[1]=7.5;
+    par[2]=0.2;
+    gMC->Gsvolu("0SA3","TUBE",idtmed[kAl],par,3);
+    z += par[2];
+    gMC->Gspos("0SA3",1,"0SUP",0,0,z,0,"ONLY"); 
+    par[0]=3.16; // gvozdi eta chast' prikruchena k absorberu
+    par[1]=7.5;
+    par[2]=0.01;
+    gMC->Gsvolu("0SN2","TUBE",idtmed[kSteel],par,3);
+    gMC->Gspos("0SN2",1,"0SUP",0,0,z,0,"ONLY"); 
+    
+}    
+
+//------------------------------------------------------------------------
+void AliT0v0::CreateMaterials()
+{
+   Int_t isxfld   = gAlice->Field()->Integ();
+   Float_t sxmgmx = gAlice->Field()->Max();
+   Float_t a,z,d,radl,absl,buf[1];
+   Int_t nbuf;
+
+// Scintillator CH
+   Float_t ascin[2]={1.01,12.01};
+   Float_t zscin[2]={1,6};
+   Float_t wscin[2]={1,1};
+   Float_t denscin=1.03;
+//Lucite C(CH3)CO2CH3
+   Float_t alucite[3]={1.01,12.01,15.999};
+   Float_t zlucite[3]={1,6,8};
+   Float_t wlucite[3]={8,5,2};
+   Float_t denlucite=1.16;
+ // PMT glass SiO2
+   Float_t aglass[2]={28.0855,15.9994};
+   Float_t zglass[2]={14.,8.};
+   Float_t wglass[2]={1.,2.};
+   Float_t dglass=2.65;
+// Ceramic   97.2% Al2O3 , 2.8% SiO2
+   Float_t acer[2],zcer[2],wcer[2]={0.972,0.028};
+   Float_t aal2o3[2]  = { 26.981539,15.9994 };
+   Float_t zal2o3[2]  = { 13.,8. };
+   Float_t wal2o3[2]  = { 2.,3. };
+   Float_t denscer  = 3.6;
+
+// Brass 80% Cu, 20% Zn
+   Float_t abrass[2] = {63.546,65.39};
+   Float_t zbrass[2] = {29,30};
+   Float_t wbrass[2] = {0.8,0.2};
+   Float_t denbrass=8.96;
+
+//Ribber C6H12S
+   Float_t aribber[3] = {12.,1.,32.};
+   Float_t zribber[3] = {6.,1.,16.};
+   Float_t wribber[3] = {6.,12.,1.};
+   Float_t denribber=0.8;
+// Support inside 
+   Float_t asupport[2] = {12.,1.};
+   Float_t zsupport[2] = {6.,1.};
+   Float_t wsupport[2] = {1.,1.};
+   Float_t densupport=0.1;
+// AIR
+   Float_t aAir[4]={12.0107,14.0067,15.9994,39.948};
+   Float_t zAir[4]={6.,7.,8.,18.};
+   Float_t wAir[4]={0.000124,0.755267,0.231781,0.012827};
+   Float_t dAir = 1.20479E-3;
+     
+//*** Definition Of avaible T0 materials ***
+   AliMaterial(0, "T0 Steel$", 55.850,26.,7.87,1.76,999);
+   AliMaterial(1, "T0 Vacuum$", 1.e-16,1.e-16,1.e-16,1.e16,999);
+   AliMixture(2, "T0 Air$", aAir, zAir, dAir,4,wAir);
+
+   AliMaterial(10, "CarbonPlastic$", 12.01, 6.0, 2.26, 18.8,999); 
+   AliMaterial(11, "Aliminium$", 26.98, 13.0, 2.7, 8.9,999); 
+
+   AliMixture( 3, "Al2O3   $", aal2o3, zal2o3, denscer, -2, wal2o3);
+   AliMixture( 4, "PMT glass   $",aglass,zglass,dglass,-2,wglass);
+   char namate[21]="";
+   gMC->Gfmate((*fIdmate)[3], namate, a, z, d, radl, absl, buf, nbuf);
+   acer[0]=a;
+   zcer[0]=z;
+   gMC->Gfmate((*fIdmate)[4], namate, a, z, d, radl, absl, buf, nbuf);
+   acer[1]=a;
+   zcer[1]=z;
+   
+   AliMixture( 9, "Ceramic    $", acer, zcer, denscer, 2, wcer);
+   AliMixture( 5, "Scintillator$",ascin,zscin,denscin,-2,wscin);
+   AliMixture( 6, "Brass    $", abrass, zbrass, denbrass, 2, wbrass);
+   
+   AliMixture( 7, "Ribber $",aribber,zribber,denribber,-3,wribber);
+   AliMixture( 8, "Lucite$",alucite,zlucite,denlucite,-3,wlucite);
+   AliMixture( 9, "Penoplast$",asupport,zsupport,densupport,-2,wsupport);
+   
+   AliMedium(1, "T0 Air$", 2, 0, isxfld, sxmgmx, 10., .1, 1., .003, .003);
+   AliMedium(2, "Scintillator$", 5, 1, isxfld, sxmgmx, 10., .01, 1., .003, .003);
+   AliMedium(3, "Vacuum$", 1, 0, isxfld, sxmgmx, 10., .01, .1, .003, .003);
+   AliMedium(4, "Ceramic$", 9, 0, isxfld, sxmgmx, 10., .01, .1, .003, .003);
+   AliMedium(6, "Glass$", 4, 1, isxfld, sxmgmx, 10., .01, .1, .003, .003);
+   AliMedium(8, "Steel$", 0, 0, isxfld, sxmgmx, 1., .001, 1., .001, .001);
+   AliMedium(9, "Ribber  $", 7, 0, isxfld, sxmgmx, 10., .01, .1, .003, .003);
+   AliMedium(11, "Brass  $", 6, 0, isxfld, sxmgmx, 10., .01, .1, .003, .003);
+   AliMedium(12, "Lucite$", 8, 1, isxfld, sxmgmx, 10., .01, 1., .003, .003);  
+   AliMedium(13, "CarbonPlastic$", 10, 0, isxfld, sxmgmx, 10., .01, 1., .003, .003);  
+   AliMedium(14, "PenoPlast$", 9, 0, isxfld, sxmgmx, 10., .01, 1., .003, .003);  
+   AliMedium(15, "Aluminium$", 11, 0, isxfld, sxmgmx, 10., .01, 1., .003, .003);  
+
+   AliDebugClass(1,": ++++++++++++++Medium set++++++++++");
+
+}
+//---------------------------------------------------------------------
+void AliT0v0::DrawModule() const
+{
+//
+// Draw a shaded view of the Forward multiplicity detector version 0
+//
+  
+  //Set ALIC mother transparent
+  gMC->Gsatt("ALIC","SEEN",0);
+  //
+  //Set volumes visible
+  gMC->Gsatt("0STA","SEEN",0);
+  gMC->Gsatt("0PMT","SEEN",1);
+  gMC->Gsatt("0DIV","SEEN",1);
+  //
+  gMC->Gdopt("hide","on");
+  gMC->Gdopt("shad","on");
+  gMC->SetClipBox(".");
+  gMC->SetClipBox("*",0,1000,-1000,1000,-1000,1000);
+  gMC->DefaultRange();
+  gMC->Gdraw("alic",40,30,0,12,9.5,.7,0.7);
+  gMC->Gdhead(1111,"T-Zero detector");
+  gMC->Gdopt("hide","off");
+}
+
+//-------------------------------------------------------------------
+void AliT0v0::Init()
+{
+// Initialises version 0 of the Forward Multiplicity Detector
+//
+//Int_t *idtmed  = gAlice->Idtmed();
+  AliT0::Init();
+  fIdSens1=gMC->VolId("0TOP");
+  AliDebug(1,Form("%s: *** T0 version 0 initialized ***\n",ClassName()));
+  
+}
+
+//-------------------------------------------------------------------
+
+void AliT0v0::StepManager()
+{
+  //
+  // Called for every step in the T0 Detector
+  // See AliT0v1
+
+}
+//---------------------------------------------------------------------
+
+
+
+
+
+
+
+
+
+
diff --git a/T0/AliT0v0.h b/T0/AliT0v0.h
new file mode 100644 (file)
index 0000000..74daa28
--- /dev/null
@@ -0,0 +1,41 @@
+#ifndef T0V0_H
+#define T0V0_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+/* $Id$ */
+
+////////////////////////////////////////////////
+//  Manager and hits classes for set:T0     //
+////////////////////////////////////////////////
+#include "AliT0.h"
+class AliT0v0 : public AliT0 {
+public:
+
+
+  enum constants {kAir=1, kSc=2, kVac=3, kCer=4, kGlass=6, kSteel=8, kRibber=9, kBrass=11, kLucite=12, kC=13, kPP=14, kAl=15, kOpGlass=16, kOpAir=17};
+
+  AliT0v0() {};
+  AliT0v0(const char *name, const char *title);
+  virtual       ~AliT0v0() {}
+  virtual void   CreateGeometry();
+  virtual void   CreateMaterials();
+  virtual void   DrawModule() const;
+  virtual void   Init();
+  virtual Int_t  IsVersion() const {return 0;}
+  virtual void   StepManager();
+  
+protected:
+   Int_t fIdSens1; // Sensetive volume  in T0
+  ClassDef(AliT0v0,1)  //Class for T0 version 0
+};
+
+typedef AliT0v0 AliSTARTv0; // for backward compatibility
+
+#endif
+
+
diff --git a/T0/AliT0v1.cxx b/T0/AliT0v1.cxx
new file mode 100644 (file)
index 0000000..8e21330
--- /dev/null
@@ -0,0 +1,735 @@
+/**************************************************************************
+ * 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.                  *
+ **************************************************************************/
+
+/* $Id$ */
+
+/////////////////////////////////////////////////////////////////////
+//                                                                 //
+// T0 ( T-zero) detector  version 1                             //
+//
+//Begin Html       
+/*
+<img src="gif/AliT0v1Class.gif">
+*/
+//End Html
+//                                                                  //
+//                                                                  //
+//////////////////////////////////////////////////////////////////////
+
+#include <Riostream.h>
+#include <stdlib.h>
+
+#include <TGeometry.h>
+#include <TLorentzVector.h>
+#include <TMath.h>
+#include <TNode.h>
+#include <TTUBE.h>
+#include <TVirtualMC.h>
+#include "TGeoManager.h"
+#include "TGeoPgon.h"
+#include "TGeoTube.h"
+#include "TGeoCompositeShape.h"
+#include <TGraph.h>
+
+#include "AliLog.h"
+#include "AliMagF.h"
+#include "AliRun.h"
+
+#include "AliT0hit.h"
+#include "AliT0v1.h"
+#include "AliT0Parameters.h"
+
+#include "AliMC.h"
+#include "AliCDBLocal.h"
+#include "AliCDBStorage.h"
+#include "AliCDBManager.h"
+#include "AliCDBEntry.h"
+
+ClassImp(AliT0v1)
+
+//--------------------------------------------------------------------
+AliT0v1::AliT0v1(const char *name, const char *title):
+  AliT0(name,title),
+  fIdSens1(0)
+{
+  //
+  // Standart constructor for T0 Detector version 0
+  //
+  fIshunt = 2;
+  AliT0Parameters* param = AliT0Parameters::Instance();
+  for (Int_t i=0; i<24; i++){
+    TGraph* grEff = param ->GetPMTeff(i);
+    fEffPMT.AddAtAndExpand(grEff,i);
+  }
+}
+//_____________________________________________________________________________
+
+AliT0v1::~AliT0v1() 
+{
+  // desctructor  
+}
+
+//-------------------------------------------------------------------------
+void AliT0v1::CreateGeometry()
+{
+  //
+  // Create the geometry of T0 Detector version 0
+  //
+  // begin Html
+  /*
+   <img src="gif/AliT0v0.gif">
+  */
+  //
+
+
+   Int_t *idtmed = fIdtmed->GetArray();
+   /*
+   AliT0Parameters* param = AliT0Parameters::Instance();
+   param->Init();
+  Float_t zdetC = param->GetZposition(0);
+  Float_t zdetA = param->GetZposition(1);
+   */
+   Float_t zdetC = 69.7;
+   Float_t zdetA = 373.;
+
+  Int_t is;
+  Int_t idrotm[999];
+  Float_t x,y,z;
+  //C T0 mother volume
+  Float_t pstartR[18]={0., 360., 5., 
+                      -6.8, 4.25, 10., //-76.5+0.00+69.7
+                      -0.75 , 4.5, 10.,  // -76.5+6.05+69.7
+                      1.25   , 4.5, 10.,  //-76.5+8.05+69.7
+                      1.25 , 5.1, 10., //-76.5+8.05+69.7 
+                      6.8 , 5.1, 10.};  //-62.9+0.00+69.7
+  
+  Float_t pstart[3]={4., 12.5,6.8};
+  Float_t pinstart[3]={0.,1.6,6.5};
+  Float_t ppmt[3]={0.,1.5,3.5};
+  Float_t ptop[3]={0.,1.,1.0};
+  Float_t preg[3]={0., 1.0, 0.005}; //photcathode dobavil bogdanov
+  Float_t ptopout[3]={1.,1.01, 1.};  //metal air around raiator for photos reflection 
+  Float_t pbot[3]={0.6,1.2,0.1};
+  Float_t pglass[3]={1.2,1.3,2.};
+  Float_t pcer[3]={0.9,1.1,1.35};
+  Float_t psteel[3]={0.9,1.1,0.15};
+  Float_t psupport1[3] = {4.51,4.6,4.0};//C kozhuh vnutri
+  Float_t psupport2[3] = {9.4,9.5,4.0};// snaruzhi  C
+  Float_t psupport3[3] = {4.51,9.5,0.05};//kryshki  C
+  Float_t psupport5[3] = {1.44,1.5,6.5}; // stakanchik dlai feu  C
+  Float_t psupport6[3] = {0,1.4,0.04}; //kryshechka stakanchika  Al
+  Float_t psupport7[3] = {1.5,1.6,0.4}; //kolechko snaruzhu stakanchika Al
+   
+  // Mother Volume katushka dlia krepezha vokrug truby k Absorbru
+    AliMatrix(idrotm[901], 90., 0., 90., 90., 180., 0.);
+  Float_t ppcon[70]; 
+    ppcon[0]  =   0;
+    ppcon[1]  = 360;
+    ppcon[2]  =  13;
+//  1: 
+    ppcon[3]  =  7.2;
+    ppcon[4]  =   4.4;
+    ppcon[5]  =   4.5;
+//  2
+    ppcon[6]  = 8.2;
+    ppcon[7]  = 4.4;
+    ppcon[8]  = 4.5;
+//  3
+    ppcon[9]  = 8.2;
+    ppcon[10] = 4.4;
+    ppcon[11] = 5.1;
+
+//  4
+
+    ppcon[12] = 8.3; 
+    ppcon[13] = 4.4;
+    ppcon[14] = 5.1;
+//  5
+
+    ppcon[15] = 8.3;
+    ppcon[16] = 4.9;
+    ppcon[17] = 5.1;
+    
+//  6
+    ppcon[18] = 15.; 
+    ppcon[19] = 4.9;
+    ppcon[20] = 5.1;
+    
+//  7
+    ppcon[21] = 15.; 
+    ppcon[22] = 3.15  ;
+    ppcon[23] = 5.1;
+
+/// 8
+    ppcon[24] = 15.01; 
+    ppcon[25] = 3.15;
+    ppcon[26] = 5.1;
+
+/// 9
+    ppcon[27] = 15.01; 
+    ppcon[28] = 3.15;
+    ppcon[29] = 3.25;
+
+    
+/// 9
+     ppcon[30] = 19.71;
+     ppcon[31] = 3.15;
+     ppcon[32] = 3.25; 
+//  10
+    ppcon[33] = 19.8; 
+    ppcon[34] = 3.15;
+    ppcon[35] = 3.25;
+    //  11
+    ppcon[36] = 19.8;
+    ppcon[37] = 3.15;
+    ppcon[38] = 7.6;
+        
+   //  14
+
+    ppcon[39] =  19.91;
+    ppcon[40] =  3.15;
+    ppcon[41] =  7.6;
+
+
+    gMC->Gsvolu("0SUP", "PCON", idtmed[kAir], ppcon,42);
+    z = -zdetC;
+    gMC->Gspos("0SUP",1,"ALIC",0.,0.,z,idrotm[901],"ONLY");
+   
+//-------------------------------------------------------------------
+ //  T0 volume 
+ //-------------------------------------------------------------------
+  
+    
+    gMC->Gsvolu("0STR","PCON",idtmed[kAir],pstartR,18);
+    gMC->Gsvolu("0STL","TUBE",idtmed[kAir],pstart,3);
+    gMC->Gspos("0STR",1,"ALIC",0.,0.,-zdetC+pstartR[3],idrotm[901],"ONLY");
+    // gMC->Gspos("0STL",1,"ALIC",0.,0.,zdetA+pstart[2],0,"ONLY");
+
+//T0 interior
+   gMC->Gsvolu("0INS","TUBE",idtmed[kAir],pinstart,3);
+   gMC->Gsvolu("0PMT","TUBE",idtmed[kAir],ppmt,3);     
+          
+    gMC->Gsvolu("0SU1","TUBE",idtmed[kC],psupport1,3);//C kozhuh vnutri
+    gMC->Gsvolu("0SU2","TUBE",idtmed[kC],psupport2,3);// snaruzhi  C
+    gMC->Gsvolu("0SU3","TUBE",idtmed[kC],psupport3,3);//kryshka perednaiai  C
+    gMC->Gsvolu("0SU4","TUBE",idtmed[kC],psupport3,3);//kryshka zadnaiai  C
+    //    gMC->Gsvolu("0SU5","TUBE",idtmed[kAir],psupport4,3);// dyrki dlia feu v zadnej kryshke Air
+    gMC->Gsvolu("0SU6","TUBE",idtmed[kC],psupport5,3);// stakanchik dlai feu  C
+    gMC->Gsvolu("0SU7","TUBE",idtmed[kAl],psupport6,3);//kryshechka stakanchika  Al
+    gMC->Gsvolu("0SU8","TUBE",idtmed[kAl],psupport7,3);//kolechko snaruzhu stakanchika Al
+   
+
+   //non-absorber side support  and T0A !!!!!!!!
+    
+    TGeoPgon * supPgon = new TGeoPgon("supPgon",0.,360.,360,4);
+    supPgon->DefineSection(0, 0, 4.1, 5.5);
+    supPgon->DefineSection(1, 10.5 , 4.1, 5.5);
+    supPgon->DefineSection(2, 10.5 , 4.1, 4.9);
+    supPgon->DefineSection(3, 12.5 , 4.1, 4.9);
+    TGeoTranslation *trPgon = new TGeoTranslation("trPgon",0,0,0);
+    trPgon->RegisterYourself();
+    TGeoVolumeAssembly * stlin = new TGeoVolumeAssembly("OSTL");//empty segment
+    TGeoVolume *ins = gGeoManager->GetVolume("0INS");
+
+    Double_t phimin = TMath::ACos((16-4.8)/16.) * (180 / TMath::Pi()) ;
+    //  TGeoTubeSeg *hole = new TGeoTubeSeg("hole", 0, 1.6, 0, -phimin+90, phimin+90);
+    TGeoTube*hole = new TGeoTube("hole", 0, 1.61, 6.5);
+    TGeoTranslation *tr [12];
+    Float_t angle  = 2 * TMath::Pi() / 12;
+    Char_t nameTr[4];
+    for (Int_t itr=0; itr<12; itr++) {
+      sprintf (nameTr,"tr%i",itr+1);
+      x = 6.5 * TMath::Sin(itr * angle);
+      y = 6.5 * TMath::Cos(itr * angle);
+      tr[itr] = new TGeoTranslation(nameTr,x,y,6.5);
+      tr[itr]->RegisterYourself();
+       stlin->AddNode(ins,itr+13,tr[itr]);
+    }
+    TGeoCompositeShape *supsh = new TGeoCompositeShape("supsh","supPgon:trPgon-(hole:tr1+hole:tr2+hole:tr3+hole:tr4+hole:tr5+hole:tr6+hole:tr7+hole:tr8+hole:tr9+hole:tr10+hole:tr11+hole:tr12)");
+  
+    TGeoMedium *medal = gGeoManager->GetMedium("T0_Aluminium$");
+    TGeoVolume *supA = new TGeoVolume("0SUA",supsh,medal);
+    stlin->AddNode(supA,1,new TGeoTranslation(0,0,0));
+    TGeoVolume *alice = gGeoManager->GetVolume("ALIC");
+    alice->AddNode(stlin,1,new TGeoTranslation(0,0, zdetA ));
+            
+    // T0A finished
+
+    //T0C 
+// first ring: 12 units of Scintillator+PMT+divider
+  Float_t  theta  = (180 / TMath::Pi()) * TMath::ATan(6.5 / zdetC);
+  Float_t phi[3];
+   for (is=0; is<12; is++)
+      {  
+
+       x = 6.5 * TMath::Sin(is * angle);
+       y = 6.5 * TMath::Cos(is * angle);
+       
+       phi[0] = -30 * is;
+       phi[1] = 90 - is * 30;
+       phi[2] = 90 - is * 30;
+       for (Int_t j = 0; j < 3; j++)
+         if (phi[j] < 0)  phi[j] += 360;
+       
+       AliMatrix (idrotm[902 + is], 90.,         phi[0],
+                  90. + theta, phi[1],
+                  theta,       phi[2]);  
+       z=-pstart[2]+pinstart[2]+0.2;
+       gMC->Gspos ("0INS", is + 1, "0STR", x, y, z, idrotm[902 + is], "ONLY");
+  }    
+     
+   x=0;
+   y=0;
+    z=-pinstart[2]+ppmt[2]+psupport6[2]*2;
+   gMC->Gspos("0PMT",1,"0INS",x,y,z,0,"ONLY");
+   // PMT
+   
+   // Entry window (glass)
+   gMC->Gsvolu("0TOP","TUBE",idtmed[kOpGlass],ptop,3); //glass
+   z=-ppmt[2]+ptop[2];
+   gMC->Gspos("0TOP",1,"0PMT",0,0,z,0,"ONLY");
+   //"metal" air volume to simulate reclection  
+   gMC->Gsvolu("0TOO","TUBE",idtmed[kOpAir],ptopout,3); 
+   gMC->Gspos("0TOO",1,"0PMT",0,0,z,0,"ONLY");
+
+   //Fotokatod
+   gMC->Gsvolu ("0REG", "TUBE", idtmed[kOpGlassCathode], preg, 3); 
+   z = -ppmt[2] + 2 * ptop[2] + preg[2]; 
+   gMC->Gspos ("0REG", 1, "0PMT", 0, 0, z, 0, "ONLY"); 
+  // Bottom glass
+   gMC->Gsvolu("0BOT","TUBE",idtmed[kGlass],pbot,3);
+   z=ppmt[2]-pbot[2];
+   gMC->Gspos("0BOT",1,"0PMT",0,0,z,0,"ONLY");
+   // Side cylinder glass
+   gMC->Gsvolu("0OUT","TUBE",idtmed[kGlass],pglass,3);
+   z=ppmt[2]-pglass[2];
+   gMC->Gspos("0OUT",1,"0PMT",0,0,z,0,"ONLY");
+   //PMT electrodes support structure
+   gMC->Gsvolu("0CER","TUBE",idtmed[kCer],pcer,3);
+   gMC->Gsvolu("0STE","TUBE",idtmed[kSteel],psteel,3);
+   z=-ppmt[2]+2*ptop[2]+0.3 + pcer[2];
+   gMC->Gspos("0CER",1,"0PMT",0,0,z,0,"ONLY");
+   z +=psteel[2]+pcer[2];
+   gMC->Gspos("0STE",1,"0PMT",0,0,z,0,"ONLY");
+    
+   //Support absorber (C) side
+   z=-pstart[2]+psupport1[2]+0.1;
+   gMC->Gspos("0SU1",1,"0STR",0,0,z,0,"ONLY"); //C kozhuh snaruzhi
+   gMC->Gspos("0SU2",1,"0STR",0,0,z,0,"ONLY"); //C kozhuh vnutri
+   z=-pstart[2]+psupport3[2]+0.1;
+   gMC->Gspos("0SU3",1,"0STR",0,0,z,0,"ONLY"); //peredniaia kryshka
+   z=-pstart[2]+2.*psupport1[2]-0.05;//+0.1;
+   gMC->Gspos("0SU4",1,"0STR",0,0,z,0,"MANY"); //zadnaiai kryshka
+   gMC->Gspos("0SU6",1,"0INS",0,0,0,0,"ONLY");//C stakanchik dlia feu 
+   z=-pinstart[2]+psupport6[2];
+   gMC->Gspos("0SU7",1,"0INS",0,0,z,0,"ONLY"); //Al kryshechka 
+   
+   z=pinstart[2]-psupport7[2];
+   gMC->Gspos("0SU8",1,"0INS",0,0,z,0,"ONLY"); //Al kolechko
+   
+   
+   Float_t par[3];
+   par[0]=4.4;
+   par[1]=4.5;
+   par[2]=0.5;
+   gMC->Gsvolu("0SC0","TUBE",idtmed[kC],par,3);
+   z=ppcon[3]+par[2];
+   gMC->Gspos("0SC0",1,"0SUP",0,0,z,0,"ONLY"); 
+   z += par[2];
+   par[0]=4.4;
+   par[1]=5.1;
+   par[2]=0.05;
+   gMC->Gsvolu("0SC1","TUBE",idtmed[kC],par,3);
+   z += par[2];
+   gMC->Gspos("0SC1",1,"0SUP",0,0,z,0,"ONLY"); 
+   z=z+par[2];
+   par[0]=4.9;
+   par[1]=5.0;
+   par[2]=6.7/2;
+    gMC->Gsvolu("0SC2","TUBE",idtmed[kC],par,3);
+    z += par[2];
+    gMC->Gspos("0SC2",1,"0SUP",0,0,z,0,"ONLY"); 
+    z += par[2];
+   
+    par[0]=3.15;
+    par[1]=4.9;
+    par[2]=0.1/2;
+    gMC->Gsvolu("0SA1","TUBE",idtmed[kAl],par,3);
+    
+    z += par[2];
+    cout<<" z 0SA1 "<<z<<endl;
+    gMC->Gspos("0SA1",1,"0SUP",0,0,z,0,"ONLY"); 
+    z=z+par[2];
+    par[0]=3.15;
+    par[1]=3.16;
+    par[2]=4.7/2;
+    cout<<" z 0SA2 "<<z<<endl;
+    gMC->Gsvolu("0SA2","TUBE",idtmed[kAl],par,3);
+    z += par[2];
+    gMC->Gspos("0SA2",1,"0SUP",0,0,z,0,"ONLY"); 
+    z=z+par[2];
+    par[0]=3.16; // eta chast' prikruchena k absorberu
+    par[1]=7.5;
+    par[2]=0.1;
+    cout<<" z 0SA23"<<z<<endl;
+    gMC->Gsvolu("0SA3","TUBE",idtmed[kAl],par,3);
+    z += par[2];
+    gMC->Gspos("0SA3",1,"0SUP",0,0,z,0,"ONLY"); 
+    par[0]=3.16; // gvozdi eta chast' prikruchena k absorberu
+    par[1]=7.5;
+    par[2]=0.01;
+    cout<<" z 0SN2 "<<z<<endl;
+    gMC->Gsvolu("0SN2","TUBE",idtmed[kSteel],par,3);
+    gMC->Gspos("0SN2",1,"0SUP",0,0,z,0,"ONLY"); 
+   
+
+}    
+//------------------------------------------------------------------------
+void AliT0v1::AddAlignableVolumes() const
+{
+  //
+  // Create entries for alignable volumes associating the symbolic volume
+  // name with the corresponding volume path. Needs to be syncronized with
+  // eventual changes in the geometry.
+  //
+
+  TString volPath;
+  TString symName, sn;
+
+  TString vpA  = "/ALIC_1/0STL_1/0INS_";
+  TString vpC  = "/ALIC_1/0STR_1/0INS_";
+  TString vpInside  = "/0PMT_1/0TOP_1";
+
+
+  for (Int_t imod=0; imod<24; imod++)
+    {
+      if (imod < 12) 
+       {volPath  = vpC; sn="T0/C/PMT";}
+      else  
+       {volPath  = vpA; sn="T0/A/PMT";}
+      volPath += imod+1;
+      volPath += vpInside;
+      
+      symName = sn;
+      symName += imod+1;
+      
+      AliDebug(2,"--------------------------------------------");
+      AliDebug(2,Form("Alignable object %d", imod));
+      AliDebug(2,Form("volPath=%s\n",volPath.Data()));
+      AliDebug(2,Form("symName=%s\n",symName.Data()));
+      AliDebug(2,"--------------------------------------------");
+      gGeoManager->SetAlignableEntry(symName.Data(),volPath.Data());
+      // if(!gGeoManager->SetAlignableEntry(symName.Data(),volPath.Data()))
+      //       AliFatal(Form("Alignable entry %s not created. Volume path %s not valid", 
+      //             symName.Data(),volPath.Data()));
+      
+    }
+}   
+//------------------------------------------------------------------------
+void AliT0v1::CreateMaterials()
+{
+   Int_t isxfld   = gAlice->Field()->Integ();
+   Float_t sxmgmx = gAlice->Field()->Max();
+   //   Float_t a,z,d,radl,absl,buf[1];
+   // Int_t nbuf;
+   Int_t *idtmed = fIdtmed->GetArray();
+
+// AIR
+                                                                                
+   Float_t aAir[4]={12.0107,14.0067,15.9994,39.948};
+   Float_t zAir[4]={6.,7.,8.,18.};
+   Float_t wAir[4]={0.000124,0.755267,0.231781,0.012827};
+   Float_t dAir = 1.20479E-3;
+                                                                                
+// Scintillator CH
+   Float_t ascin[2]={1.01,12.01};
+   Float_t zscin[2]={1,6};
+   Float_t wscin[2]={1,1};
+   Float_t denscin=1.03;
+//Lucite C(CH3)CO2CH3
+   Float_t alucite[3]={1.01,12.01,15.999};
+   Float_t zlucite[3]={1,6,8};
+   Float_t wlucite[3]={8,5,2};
+   Float_t denlucite=1.16;
+ // PMT glass SiO2
+   Float_t aglass[2]={28.0855,15.9994};
+   Float_t zglass[2]={14.,8.};
+   Float_t wglass[2]={1.,2.};
+   Float_t dglass=2.65;
+// Ceramic   97.2% Al2O3 , 2.8% SiO2
+   // Float_t wcer[2]={0.972,0.028};
+   Float_t aCeramic[2]  = { 26.981539,15.9994 };
+   Float_t zCeramic[2]  = { 13.,8. };
+   Float_t wCeramic[2]  = { 2.,3. };
+   Float_t denscer  = 3.6;
+
+// Brass 80% Cu, 20% Zn
+   Float_t abrass[2] = {63.546,65.39};
+   Float_t zbrass[2] = {29,30};
+   Float_t wbrass[2] = {0.8,0.2};
+   Float_t denbrass=8.96;
+
+//Ribber C6H12S
+   Float_t aribber[3] = {12.,1.,32.};
+   Float_t zribber[3] = {6.,1.,16.};
+   Float_t wribber[3] = {6.,12.,1.};
+   Float_t denribber=0.8;
+// Support inside 
+   Float_t asupport[2] = {12.,1.};
+   Float_t zsupport[2] = {6.,1.};
+   Float_t wsupport[2] = {1.,1.};
+   Float_t densupport=0.1;
+    
+//*** Definition Of avaible T0 materials ***
+   AliMaterial(0, "Steel$", 55.850,26.,7.87,1.76,999);
+   AliMaterial(1, "Vacuum$", 1.e-16,1.e-16,1.e-16,1.e16,999);
+   AliMixture(2, "Air$", aAir, zAir, dAir,4,wAir);
+   AliMaterial(10, "CarbonPlastic$", 12.01, 6.0, 2.26, 18.8,999); 
+   AliMaterial(11, "Aliminium$", 26.98, 13.0, 2.7, 8.9,999); 
+
+   AliMixture( 3, "Ceramic  $",aCeramic, zCeramic, denscer, -2, wCeramic);
+   AliMixture( 4, "PMT glass   $",aglass,zglass,dglass,-2,wglass);
+   /* 
+  char namate[21]="";
+  
+   gMC->Gfmate((*fIdmate)[3], namate, a, z, d, radl, absl, buf, nbuf);
+   acer[0]=a;  
+
+   zcer[0]=z;
+   gMC->Gfmate((*fIdmate)[4], namate, a, z, d, radl, absl, buf, nbuf);
+   acer[1]=a;
+   zcer[1]=z;
+   AliMixture( 11, "Ceramic    $", acer, zcer, denscer, 2, wcer);
+   */ 
+    AliMixture( 5, "Scintillator$",ascin,zscin,denscin,-2,wscin);
+   AliMixture( 6, "Brass    $", abrass, zbrass, denbrass, 2, wbrass);
+   AliMixture( 7, "Ribber $",aribber,zribber,denribber,-3,wribber);
+   AliMixture( 8, "Lucite$",alucite,zlucite,denlucite,-3,wlucite);
+   AliMixture( 9, "Penoplast$",asupport,zsupport,densupport,-2,wsupport);
+   AliMixture( 21, "PMT Optical glass   $",aglass,zglass,dglass,-2,wglass);
+   AliMixture( 24, "PMT Optical glass cathode $",aglass,zglass,dglass,-2,wglass);
+    AliMixture(22, "T0 Opt Air$", aAir, zAir, dAir,4,wAir);
+   AliMixture(23, "T0 Opt Air Next$", aAir, zAir, dAir,4,wAir);
+   
+   AliMedium(1, "T0 Air$", 2, 0, isxfld, sxmgmx, 10., .1, 1., .003, .003);
+   AliMedium(2, "Scintillator$", 5, 1, isxfld, sxmgmx, 10., .01, 1., .003, .003);
+   AliMedium(3, "Vacuum$", 1, 0, isxfld, sxmgmx, 10., .01, .1, .003, .003);
+   AliMedium(4, "Ceramic$", 3, 0, isxfld, sxmgmx, 10., .01, .1, .003, .003);
+   AliMedium(6, "Glass$", 4, 1, isxfld, sxmgmx, 10., .01, .1, .003, .003);
+   AliMedium(8, "Steel$", 0, 0, isxfld, sxmgmx, 1., .001, 1., .001, .001);
+   AliMedium(9, "Ribber  $", 7, 0, isxfld, sxmgmx, 10., .01, .1, .003, .003);
+   AliMedium(11, "Brass  $", 6, 0, isxfld, sxmgmx, 10., .01, .1, .003, .003);
+   AliMedium(12, "Lucite$", 8, 1, isxfld, sxmgmx, 10., .01, 1., .003, .003);  
+   AliMedium(13, "CarbonPlastic$", 10, 0, isxfld, sxmgmx, 10., .01, 1., .003, .003);  
+   AliMedium(14, "PenoPlast$", 9, 0, isxfld, sxmgmx, 10., .01, 1., .003, .003);  
+   AliMedium(15, "Aluminium$", 11, 0, isxfld, sxmgmx, 10., .01, 1., .003, .003);  
+   AliMedium(16, "OpticalGlass$", 21, 1, isxfld, sxmgmx, 10., .01, .1, .003, .003);
+   AliMedium(17, "T0 OpAir$", 22, 0, isxfld, sxmgmx, 10., .1, 1., .003, .003);
+   AliMedium(18, "T0 OpAirNext$", 23, 0, isxfld, sxmgmx, 10., .1, 1., .003, .003);
+    AliMedium(19, "OpticalGlassCathode$", 24, 1, isxfld, sxmgmx, 10., .01, .1, .003, .003);
+
+
+// Definition Cherenkov parameters
+   int i;
+   const Int_t kNbins=31;
+   
+   Float_t rindexSiO2[kNbins],  efficAll[kNbins], rindexAir[kNbins], absorAir[kNbins],rindexCathodeNext[kNbins], absorbCathodeNext[kNbins];
+            
+   // quartz 20mm
+   Float_t aAbsSiO2[kNbins]={29.0, 28.6, 28.3, 27.7, 27.3, 26.7, 26.4, 
+                            25.9, 25.3, 24.9, 24.5, 23.7, 
+                            23.2, 22.8, 22.4, 21.8, 21.3,
+                            22.8, 22.1, 21.7, 21.2, 20.5, 
+                            19.9, 19.3, 18.7, 18.0, 17.1, 
+                            16.3, 15.3, 14.3, 14.3   };
+          
+   Float_t aPckov[kNbins]  ={3.87, 3.94, 4.02, 4.11, 4.19, 4.29, 4.38,
+                            4.48, 4.58, 4.69, 4.81, 4.93, 
+                            5.05, 5.19, 5.33, 5.48, 5.63,
+                            5.8,  5.97, 6.16, 6.36, 6.57, 
+                            6.8,  7.04, 7.3,  7.58, 7.89, 
+                            8.22, 8.57, 8.97, 9.39 };  
+   /*     
+   Float_t effCathode[kNbins]={0.11, 0.13, 0.15, 0.16, 0.18, 0.19, 0.20,
+                             0.21, 0.22, 0.23, 0.24, 0.26, 
+                             0.27, 0.29, 0.30, 0.29, 0.29, 
+                             0.28, 0.28, 0.27, 0.26, 0.25, 
+                             0.25, 0.23, 0.20, 0.19, 0.17,
+                             0.17, 0.17, 0.2, 0.23};
+   */     
+   //  Float_t aAbsSiO2[kNbins]; //quartz 30mm
+  for(i=0;i<kNbins;i++)
+    {
+      aPckov[i]=aPckov[i]*1e-9;//Photons energy bins 4 eV - 8.5 eV step 0.1 eV   
+      rindexAir[i]=0;
+      rindexSiO2[i]=1.458; //refractive index for qwarts
+      rindexCathodeNext[i]=0;
+      efficAll[i]=1.;
+
+      //      aAbsSiO2[i]=28.5; //quartz 30mm
+      absorAir[i]=0.3;      
+      absorbCathodeNext[i]=0;
+
+    }
+  
+  
+   gMC->SetCerenkov (idtmed[kOpGlass], kNbins, aPckov, aAbsSiO2, efficAll, rindexSiO2 );
+   // gMC->SetCerenkov (idtmed[kOpGlassCathode], kNbins, aPckov, aAbsSiO2, effCathode, rindexSiO2 );
+   gMC->SetCerenkov (idtmed[kOpGlassCathode], kNbins, aPckov, aAbsSiO2,efficAll , rindexSiO2 );
+  gMC->SetCerenkov (idtmed[kOpAir], kNbins, aPckov,absorAir , efficAll,rindexAir );
+   gMC->SetCerenkov (idtmed[kOpAirNext], kNbins, aPckov,absorbCathodeNext , efficAll, rindexCathodeNext);
+   
+   AliDebugClass(1,": ++++++++++++++Medium set++++++++++");
+   
+   
+}
+//---------------------------------------------------------------------
+void AliT0v1::DrawDetector()
+{
+//
+// Draw a shaded view of the Forward multiplicity detector version 0
+//
+  
+  //Set ALIC mother transparent
+  gMC->Gsatt("ALIC","SEEN",0);
+  //
+  //Set volumes visible
+  //  gMC->Gsatt("0STR","SEEN",0);
+  //  gMC->Gsatt("0INS","SEEN",0);
+  // gMC->Gsatt("0PMT","SEEN",1);
+  // gMC->Gsatt("0DIV","SEEN",1);
+  //
+  gMC->Gdopt("hide","off");
+  gMC->Gdopt("shad","on");
+  gMC->SetClipBox(".");
+  gMC->SetClipBox("*",0,1000,-1000,1000,-1000,1000);
+  gMC->DefaultRange();
+  gMC->Gdraw("alic",90,0,0,-35,9.5,.6,0.6);
+  //gMC->Gdraw("alic",0,0,0,10,9.5,.8,0.8); //other side view
+  gMC->Gdhead(1111,"T-Zero detector");
+  gMC->Gdopt("hide","off");
+}
+
+//-------------------------------------------------------------------
+void AliT0v1::Init()
+{
+// Initialises version 0 of the Forward Multiplicity Detector
+//
+//Int_t *idtmed  = gAlice->Idtmed();
+  AliT0::Init();
+  fIdSens1=gMC->VolId("0REG");
+
+   AliDebug(1,Form("%s: *** T0 version 1 initialized ***\n",ClassName()));
+
+}
+
+//-------------------------------------------------------------------
+
+void AliT0v1::StepManager()
+{
+  //
+  // Called for every step in the T0 Detector
+  //
+  Int_t id,copy,copy1;
+  static Float_t hits[6];
+  static Int_t vol[2];
+  TLorentzVector pos;
+  
+  //   TClonesArray &lhits = *fHits;
+  
+  if(!gMC->IsTrackAlive()) return; // particle has disappeared
+  
+  
+    // If particles is photon then ...
+  
+ if (gMC->TrackPid() == 50000050)
+  {
+      id=gMC->CurrentVolID(copy);
+      
+      
+      // Check the sensetive volume
+      if(id==fIdSens1 ) { 
+       if(gMC->IsTrackEntering()) {
+           gMC->CurrentVolOffID(2,copy);
+           vol[1]=copy;
+           gMC->CurrentVolOffID(3,copy1);
+           vol[0]=copy1;
+           gMC->TrackPosition(pos);
+           hits[0] = pos[0];
+           hits[1] = pos[1];
+           hits[2] = pos[2];
+           if(pos[2]<0) vol[0]=2;
+           if(pos[2]>=0) vol[0]=1; 
+           
+           Float_t etot=gMC->Etot();
+           hits[3]=etot;
+           Int_t iPart= gMC->TrackPid();
+           Int_t partID=gMC->IdFromPDG(iPart);
+           hits[4]=partID;
+           Float_t ttime=gMC->TrackTime();
+           hits[5]=ttime*1e12;
+           if(RegisterPhotoE(vol[1]-1,hits[3])) 
+             AddHit(fIshunt,vol,hits);
+           
+         }
+         //  cout<< gAlice->GetMCApp()->GetCurrentTrackNumber()<<" hit added "<<endl;
+       
+       /*              
+               printf("track(%i) alive(%i) disap(%i) enter(%i) exit(%i) inside(%i) out(%i) stop(%i) new(%i) \n",
+                      gAlice->GetMCApp()->GetCurrentTrackNumber(),
+              gMC->IsTrackAlive(),
+              gMC->IsTrackDisappeared(),
+              gMC->IsTrackEntering(),
+              gMC->IsTrackExiting(),
+              gMC->IsTrackInside(),
+              gMC->IsTrackOut(),
+              gMC->IsTrackStop(),
+              gMC->IsNewTrack());
+       */              
+      } //sensitive
+  } //photon
+}
+
+
+
+//------------------------------------------------------------------------
+Bool_t AliT0v1::RegisterPhotoE(Int_t ipmt,Double_t energy)
+{
+
+  
+  //  Float_t hc=197.326960*1.e6; //mev*nm
+  Double_t hc=1.973*1.e-6; //gev*nm
+  Float_t lambda=hc/energy;
+  Float_t eff = ((TGraph*) fEffPMT.At(ipmt))->Eval(lambda);
+  Double_t  p = gRandom->Rndm();
+
+  if (p > eff)
+    return kFALSE;
+  
+  return kTRUE;
+}
+
+//----------------------------------------------------------------------------
+
+
+
+
+
+
diff --git a/T0/AliT0v1.h b/T0/AliT0v1.h
new file mode 100644 (file)
index 0000000..dc16289
--- /dev/null
@@ -0,0 +1,44 @@
+#ifndef T0V1_H
+#define T0V1_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+/* $Id$ */
+////////////////////////////////////////////////
+//  Manager and hits classes for set:T0     //
+////////////////////////////////////////////////
+#include "AliT0.h"
+class AliT0v1 : public AliT0 {
+  
+public:
+
+  enum constants {kAir=1, kSc=2, kVac=3, kCer=4, kGlass=6, kSteel=8, kRibber=9, kBrass=11, kLucite=12, kC=13, kPP=14, kAl=15, kOpGlass=16, kOpAir=17, kOpAirNext=18, kOpGlassCathode=19};
+
+  AliT0v1() {};
+  AliT0v1(const char *name, const char *title);
+  virtual       ~AliT0v1();
+  virtual void   CreateGeometry();
+  virtual void   AddAlignableVolumes() const;
+  virtual void   CreateMaterials();
+  virtual void   DrawDetector();
+  virtual void   Init();
+  virtual Int_t  IsVersion() const {return 0;}
+  Bool_t RegisterPhotoE(Int_t impt, Double_t energy);
+  virtual void   StepManager();
+
+
+protected:
+  Int_t fIdSens1; // Sensetive volume  in T0
+  TObjArray fEffPMT; //pmt registration effeicincy
+  ClassDef(AliT0v1,2)  //Class for T0 version 1
+};
+
+typedef AliT0v1 AliSTARTv1; // for backward compatibility
+
+#endif
+
+
diff --git a/T0/AliT0v2.cxx b/T0/AliT0v2.cxx
new file mode 100644 (file)
index 0000000..826a643
--- /dev/null
@@ -0,0 +1,447 @@
+/**************************************************************************
+ * 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.                  *
+ **************************************************************************/
+
+/* $Id$ */
+
+/////////////////////////////////////////////////////////////////////
+//                                                                 //
+// T0 ( T-zero) detector  version 0                        //
+//
+//Begin Html       
+/*
+<img src="gif/AliT0v2Class.gif">
+*/
+//End Html
+//                                                                  //
+//                                                                  //
+//////////////////////////////////////////////////////////////////////
+
+#define RIGHT_ARRAY            1
+#define LEFT_ARRAY             2
+
+#include <Riostream.h>
+#include <stdlib.h>
+
+#include <TGeometry.h>
+#include <TLorentzVector.h>
+#include <TMath.h>
+#include <TNode.h>
+#include <TTUBE.h>
+#include <TVirtualMC.h>
+
+#include "AliMagF.h"
+#include "AliRun.h"
+#include "AliT0hit.h"
+#include "AliT0v2.h"
+#include "AliMC.h"
+//#include "AliT0hitPhoton.h"
+//#include "TGeant3.h"
+
+ClassImp(AliT0v2)
+
+
+//////////////////////////////////////////////////////////////////////
+// Standart constructor for T0 Detector version 2
+//////////////////////////////////////////////////////////////////////
+AliT0v2::AliT0v2(const char *name, const char *title):
+ AliT0(name,title)
+{
+  fIdSens1 = 0;
+//  setBufferSize(128000);
+}
+
+
+//////////////////////////////////////////////////////////////////////
+// Create the geometry of T0 Detector version 2
+//////////////////////////////////////////////////////////////////////
+void AliT0v2::CreateGeometry()
+{
+  /*
+     <img src="gif/AliT0v2.gif">
+  */
+
+  Int_t        *idtmed;
+  Int_t        idrotm[999];
+  Int_t        i, j;
+  Float_t      x, y, z;
+  Float_t      zRight;
+  Float_t      zLeft;
+  Float_t      phi[3];
+  Float_t      theta;
+  Double_t     angel;
+  
+  Float_t      pstart[3]       = {4.5,  10.7,   5.3};
+  Float_t      pinstart[3]     = {0.,    1.31,  5.25};
+  Float_t      ppmt[3]         = {0.,    1.31,  3.5};
+  Float_t      ptop[3]         = {0.,    1.3,   1.5};
+//  Float_t    preg[3]         = {0.,    1.3,   0.005};
+  Float_t      preg[3]         = {0.,    0.875, 0.005};
+  Float_t      pdes[3]         = {0.875, 1.3,   0.005};
+
+
+  zRight = 75.;
+  zLeft  = 350.;
+  theta  = (180 / TMath::Pi()) * TMath::ATan(6.5 / zRight);
+  angel  = 2 * TMath::Pi() / 12;
+  idtmed = fIdtmed->GetArray();
+    
+
+  AliMatrix (idrotm[901], 90., 0., 90., 90., 180., 0.);
+    
+  gMC->Gsvolu ("0RST", "TUBE", idtmed[3], pstart, 3);
+  gMC->Gsvolu ("0LST", "TUBE", idtmed[3], pstart, 3);
+  gMC->Gspos ("0RST", 1, "ALIC", 0., 0., -zRight, 0, "ONLY");
+  gMC->Gspos ("0LST", 1, "ALIC", 0., 0., zLeft, idrotm[901], "ONLY");
+
+//  12 unit: PMT + divider
+  gMC->Gsvolu("0INS", "TUBE", idtmed[3], pinstart, 3);   
+  z = 0;
+  for (i = 0; i < 12; i++)
+  {
+     x = 6.5 * TMath::Sin(i * angel);
+     y = 6.5 * TMath::Cos(i * angel);
+       
+     phi[0] = -30 * i;
+     phi[1] = 90 - i * 30;
+     phi[2] = 90 - i * 30;
+     for (j = 0; j < 3; j++)
+       if (phi[j] < 0)  phi[j] += 360;
+       
+     AliMatrix (idrotm[902 + i], 90.,         phi[0],
+                                90. + theta, phi[1],
+                                theta,       phi[2]);  
+
+     gMC->Gspos ("0INS", i + 1, "0RST", x, y, z, idrotm[902 + i], "ONLY");
+     gMC->Gspos ("0INS", i + 13, "0LST", x, y, z, 0, "ONLY");
+  }
+
+  gMC->Gsvolu ("0PMT", "TUBE", idtmed[1], ppmt, 3);     
+  x = y = 0;      
+  z = -pinstart[2] + ppmt[2];
+  gMC->Gspos ("0PMT", 1, "0INS", x, y, z, 0, "ONLY");
+    
+// PMT
+  // Entry window (glass)
+  gMC->Gsvolu ("0TOP", "TUBE", idtmed[6], ptop, 3);
+  z = -ppmt[2] + ptop[2];
+  gMC->Gspos ("0TOP", 1, "0PMT", 0, 0, z, 0, "ONLY");
+
+  gMC->Gsvolu ("0REG", "TUBE", idtmed[6], preg, 3);
+  z = -ppmt[2] + 2 * ptop[2] + preg[2];
+  gMC->Gspos ("0REG", 1, "0PMT", 0, 0, z, 0, "ONLY");
+
+  gMC->Gsvolu ("0DES", "TUBE", idtmed[6], pdes, 3);
+  z = -ppmt[2] + 2 * ptop[2] + preg[2];
+  gMC->Gspos ("0DES", 1, "0PMT", 0, 0, z, 0, "ONLY");
+}   
+
+//////////////////////////////////////////////////////////////////////
+// Definition of avaible T0 materials
+//////////////////////////////////////////////////////////////////////
+void AliT0v2::CreateMaterials()
+{
+   Int_t isxfld   = gAlice->Field()->Integ();
+   Float_t sxmgmx = gAlice->Field()->Max();
+   
+   Float_t a, z, d, radl, absl, buf[1];
+   Int_t nbuf;
+
+// Scintillator CH
+   Float_t     ascin[2] = {1.01, 12.01};
+   Float_t     zscin[2] = {1.,    6.};
+   Float_t     wscin[2] = {1.,    1.};
+   Float_t     denscin  = 1.03;
+   
+// PMT glass SiO2
+   Float_t     aglass[2] = {28.0855, 15.9994};
+   Float_t     zglass[2] = {14.,      8.};
+   Float_t     wglass[2] = { 1.,      2.};
+   Float_t     dglass    = 2.65;
+   
+// Ceramic   97.2% Al2O3 , 2.8% SiO2
+   Float_t     acer[2], zcer[2];
+   Float_t     wcer[2]    = { 0.972,     0.028};
+   Float_t     aal2o3[2]  = {26.981539, 15.9994 };
+   Float_t     zal2o3[2]  = {13.,        8.};
+   Float_t     wal2o3[2]  = { 2.,        3.};
+   Float_t     denscer    = 3.6;
+
+// Brass 80% Cu, 20% Zn
+   Float_t abrass[2] = {63.546, 65.39};
+   Float_t zbrass[2] = {29.,    30.};
+   Float_t wbrass[2] = { 0.8,    0.2};
+   Float_t denbrass  = 8.96;
+
+//Ribber C6H12S
+   Float_t aribber[3] = {12.,  1., 32.};
+   Float_t zribber[3] = { 6.,  1., 16.};
+   Float_t wribber[3] = { 6., 12.,  1.};
+   Float_t denribber  = 0.8;
+   
+// Definition Cherenkov parameters
+  const Int_t NUMENTRIES = 32;
+
+  Float_t ppckov[NUMENTRIES] =
+            { 2.034E-9, 2.068E-9, 2.103E-9, 2.139E-9,
+              2.177E-9, 2.216E-9, 2.256E-9, 2.298E-9,
+              2.341E-9, 2.386E-9, 2.433E-9, 2.481E-9,
+              2.532E-9, 2.585E-9, 2.640E-9, 2.697E-9,
+              2.757E-9, 2.820E-9, 2.885E-9, 2.954E-9,
+              3.026E-9, 3.102E-9, 3.181E-9, 3.265E-9,
+              3.353E-9, 3.446E-9, 3.545E-9, 3.649E-9,
+              3.760E-9, 3.877E-9, 4.002E-9, 4.136E-9 };
+
+  Float_t rindex_qwarz[NUMENTRIES] =
+            { 1.458, 1.458, 1.458, 1.458, 1.458, 1.458, 1.458,
+              1.458, 1.458, 1.458, 1.458, 1.458, 1.458, 1.458,
+              1.458, 1.458, 1.458, 1.458, 1.458, 1.458, 1.458,
+              1.458, 1.458, 1.458, 1.458, 1.458, 1.458, 1.458,
+              1.458, 1.458, 1.458, 1.458 };
+
+  Float_t rindex_air[NUMENTRIES] =
+            { 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.,
+              1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.,
+              1., 1., 1., 1. };
+
+  Float_t effic_all[NUMENTRIES] =
+            { 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.,
+              1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.,
+              1., 1., 1., 1. };
+              
+  Float_t absor_qwarz[NUMENTRIES] =
+           { 2000., 2000., 2000., 2000., 2000., 2000., 2000., 
+             2000., 2000., 2000., 2000., 2000., 2000., 2000.,
+             2000., 2000., 2000., 2000., 2000., 2000., 2000.,
+             2000., 2000., 2000., 2000., 2000., 2000., 2000.,
+             2000., 2000., 2000., 2000. };
+
+  Float_t absor_air[NUMENTRIES] =
+           { 200., 200., 200., 200., 200., 200., 200., 
+             200., 200., 200., 200., 200., 200., 200.,
+             200., 200., 200., 200., 200., 200., 200.,
+             200., 200., 200., 200., 200., 200., 200.,
+             200., 200., 200., 200. };
+   
+  Int_t *idtmed = fIdtmed->GetArray();
+
+    
+   AliMaterial (0, "T0 Steel$", 55.850, 26., 7.87, 1.76, 999);
+   AliMaterial (1, "T0 Vacuum$", 1.e-16, 1.e-16, 1.e-16, 1.e16, 999);
+   AliMaterial (2, "T0 Air$", 14.61, 7.3, .001205, 30423., 999); 
+   
+   AliMixture (3, "Al2O3   $", aal2o3, zal2o3, denscer, -2, wal2o3);
+   AliMixture (4, "PMT glass   $", aglass, zglass, dglass, -2, wglass);
+   char namate[21]="";
+   gMC->Gfmate ((*fIdmate)[3], namate, a, z, d, radl, absl, buf, nbuf);
+   acer[0] = a;
+   zcer[0] = z;
+   gMC->Gfmate ((*fIdmate)[4], namate, a, z, d, radl, absl, buf, nbuf);
+   acer[1] = a;
+   zcer[1] = z;
+   
+   AliMixture (5, "Scintillator$",ascin,zscin,denscin,-2,wscin);
+   AliMixture (6, "Brass    $", abrass, zbrass, denbrass, 2, wbrass);
+   AliMixture (7, "Ribber $",aribber,zribber,denribber,-3,wribber);
+   AliMixture (9, "Ceramic    $", acer, zcer, denscer, 2, wcer);
+   
+   AliMedium (1, "T0 Air$", 2, 0, isxfld, sxmgmx, 10., .1, 1., .003, .003);
+   AliMedium (2, "Scintillator$", 5, 1, isxfld, sxmgmx, 10., .01, 1., .003, .003);
+   AliMedium (3, "Vacuum$", 1, 0, isxfld, sxmgmx, 10., .01, .1, .003, .003);
+   AliMedium (4, "Ceramic$", 9, 0, isxfld, sxmgmx, 10., .01, .1, .003, .003);
+   AliMedium (6, "Glass$", 4, 0, isxfld, sxmgmx, 10., .01, .1, .003, .003);
+   AliMedium (8, "Steel$", 0, 0, isxfld, sxmgmx, 1., .001, 1., .001, .001);
+   AliMedium (9, "Ribber  $", 7, 0, isxfld, sxmgmx, 10., .01, .1, .003, .003);
+   AliMedium(11, "Brass  $", 6, 0, isxfld, sxmgmx, 10., .01, .1, .003, .003);
+
+   gMC->SetCerenkov (idtmed[6], NUMENTRIES, ppckov, absor_qwarz, effic_all, rindex_qwarz);
+   gMC->SetCerenkov (idtmed[1], NUMENTRIES, ppckov, absor_air, effic_all, rindex_air);
+}
+
+
+//////////////////////////////////////////////////////////////////////
+// Draw a shaded view of the Forward multiplicity detector version 2
+//////////////////////////////////////////////////////////////////////
+void AliT0v2::DrawModule() const
+{  
+  //Set ALIC mother transparent
+  gMC->Gsatt ("ALIC", "SEEN", 0);
+
+  //Set volumes visible
+  gMC->Gsatt ("0STA", "SEEN", 0);
+  gMC->Gsatt ("0PMT", "SEEN", 1);
+  gMC->Gsatt ("0DIV", "SEEN", 1);
+
+  gMC->Gdopt ("hide", "on");
+  gMC->Gdopt ("shad", "on");
+  gMC->SetClipBox (".");
+  gMC->SetClipBox ("*", 0, 1000, -1000, 1000, -1000, 1000);
+  gMC->DefaultRange();
+  gMC->Gdraw ("alic", 40, 30, 0, 12, 9.5, 0.7, 0.7);
+  gMC->Gdhead (1111, "T-Zero detector");
+  gMC->Gdopt ("hide", "off");
+}
+
+
+//////////////////////////////////////////////////////////////////////
+// Initialises version 2 of the Forward Multiplicity Detector
+//////////////////////////////////////////////////////////////////////
+void AliT0v2::Init()
+{
+//Int_t *idtmed  = gAlice->Idtmed();
+
+  AliT0::Init();
+  fIdSens1 = gMC->VolId ("0REG");
+
+  printf ("*** T0 version 2 initialized ***\n");
+}
+
+
+//////////////////////////////////////////////////////////////////////
+// Called for every step in the T0 Detector
+//////////////////////////////////////////////////////////////////////
+void AliT0v2::StepManager()
+{
+  Int_t                        id;
+  Int_t                                copy;
+//  Int_t                              copy1;
+  Float_t                      xyz[3];
+  Float_t                      XYZ[3];
+  Float_t                      hitPhoton[6];
+  static Float_t               hits[7];
+  static Float_t               edep;
+  static Int_t                         vol[2];
+  TLorentzVector               pos;
+  TLorentzVector               mom;
+  
+  
+  if(!gMC->IsTrackAlive()) return; // particle has disappeared
+
+//  TGeant3  *g3 = (TGeant3*) gMC;
+//  g3->Gpcxyz();
+
+  TClonesArray         &lhits = *fHits;
+
+
+///////////////////////////////////////////////
+// If particles is photon then ...
+
+  if (gMC->TrackPid() == 50000050)
+  {
+     id = gMC->CurrentVolID(copy);
+
+     // Check the sensetive volume
+     if (id == fIdSens1) 
+     {
+       if (gMC->IsTrackEntering()) 
+       {
+          gMC->CurrentVolOffID(2,copy);
+          if (copy < 13) 
+            {
+              vol[0] = RIGHT_ARRAY;
+              vol[1] = copy;
+            }
+          else 
+            {
+              vol[0] = LEFT_ARRAY;
+              vol[1] = copy - 12;
+            }
+
+          gMC->TrackPosition(pos);
+          gMC->TrackMomentum(mom);
+          XYZ[0] = pos[0];
+          XYZ[1] = pos[1];
+          XYZ[2] = pos[2];
+          gMC->Gmtod (XYZ, xyz, 1);
+
+          hitPhoton[0] = sqrt (xyz[0] * xyz[0] + xyz[1] * xyz[1]);
+          hitPhoton[1] = mom[0];
+          hitPhoton[2] = mom[1];
+          hitPhoton[3] = mom[2];
+          hitPhoton[4] = 1e9 * gMC->TrackTime();
+          hitPhoton[5] = 1e9 * gMC->Etot();
+          
+          AddHitPhoton (gAlice->GetMCApp()->GetCurrentTrackNumber(), vol, hitPhoton);
+       }
+       gMC->StopTrack();
+     }
+     else  
+       if (id == gMC->VolId ("0DES"))  gMC->StopTrack();
+  }
+
+// end photon particalary
+///////////////////////////////////////////////
+
+
+///////////////////////////////////////////////
+// If particles is charge then ...
+  // Float_t charge = gMC->TrackCharge();
+  //  if(TMath::Abs(charge) <= 0.) return;
+  id = gMC->CurrentVolID(copy);
+
+  
+  //  printf("gMC->ckine->ipart %d",gMC->ckine->ipart);
+  // Check the sensetive volume
+  if(id==gMC->VolId("0TOP") ) {
+    if(gMC->IsTrackEntering()) {
+      gMC->CurrentVolOffID(2,copy);
+      if (copy < 13) 
+       {
+         vol[0] = RIGHT_ARRAY;
+         vol[1] = copy;
+       }
+      else 
+       {
+         vol[0] = LEFT_ARRAY;
+         vol[1] = copy - 12;
+       }
+      
+      gMC->TrackPosition(pos);
+      hits[0] = pos[0];
+      hits[1] = pos[1];
+      hits[2] = pos[2];
+      Float_t etot = gMC->Etot();
+      hits[4] = etot;
+      Int_t part = gMC->TrackPid();
+      hits[5] = part;
+      Float_t ttime = gMC->TrackTime();
+      hits[6] = ttime*1e9;
+      edep = 0;
+    }
+    if(gMC->IsTrackInside())   {
+      Float_t de = gMC->Edep(); 
+      edep = edep + de;
+      //       printf ("E deposition %f\n",edep);
+      //    for (i=0; i<=6; i++){
+      //    printf(" HITS on T0 inside %f\n",hits[i]); } 
+    }
+    if(gMC->IsTrackExiting())  {
+      Float_t de = gMC->Edep(); 
+      edep = edep + de;
+      hits[3] = edep * 1e3;
+
+      //       for (i=0; i<=6; i++){
+      //        printf(" HITS on T0 Exit %f\n",hits[i]); } 
+      //for (i=0; i<=1; i++) { printf("T0 vol %d\n",vol[i]);}
+     
+      new(lhits[fNhits++]) AliT0hit(fIshunt,gAlice->GetMCApp()->GetCurrentTrackNumber(),vol,hits);      
+    }
+  }
+
+// end charge particles particalary
+///////////////////////////////////////////////
+
+}
diff --git a/T0/AliT0v2.h b/T0/AliT0v2.h
new file mode 100644 (file)
index 0000000..3925ba5
--- /dev/null
@@ -0,0 +1,37 @@
+#ifndef T0V2_H
+#define T0V2_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+/* $Id$ */
+
+////////////////////////////////////////////////
+//  Manager and hits classes for set:T0     //
+////////////////////////////////////////////////
+#include "AliT0.h"
+class AliT0v2 : public AliT0 {
+  
+public:
+  AliT0v2() {};
+  AliT0v2(const char *name, const char *title);
+  virtual       ~AliT0v2() {}
+  virtual void   CreateGeometry();
+  virtual void   CreateMaterials();
+  virtual void   DrawModule() const;
+  virtual void   Init();
+  virtual Int_t  IsVersion() const {return 0;}
+  virtual void   StepManager();
+  virtual void SetHitsAddressBranch(TBranch *b1,TBranch *b2)
+    {b1->SetAddress(&fHits); b2->SetAddress(&fPhotons);}
+   
+protected:
+   Int_t fIdSens1; // Sensetive volume  in T0
+  ClassDef(AliT0v2, 1)  //Class for T0 version 0
+};
+
+#endif
+
+
diff --git a/T0/Align/Data/Run0_10_v0_s0.root b/T0/Align/Data/Run0_10_v0_s0.root
new file mode 100644 (file)
index 0000000..29d796e
Binary files /dev/null and b/T0/Align/Data/Run0_10_v0_s0.root differ
diff --git a/T0/Align/Data/Run0_99999_v0_s1.root b/T0/Align/Data/Run0_99999_v0_s1.root
new file mode 100644 (file)
index 0000000..012988c
Binary files /dev/null and b/T0/Align/Data/Run0_99999_v0_s1.root differ
diff --git a/T0/Calib/Gain_TimeDelay_Slewing_Walk/Run0_10_v0_s0.root b/T0/Calib/Gain_TimeDelay_Slewing_Walk/Run0_10_v0_s0.root
new file mode 100644 (file)
index 0000000..7d369e7
Binary files /dev/null and b/T0/Calib/Gain_TimeDelay_Slewing_Walk/Run0_10_v0_s0.root differ
diff --git a/T0/DAQfile.root b/T0/DAQfile.root
new file mode 100644 (file)
index 0000000..4931290
Binary files /dev/null and b/T0/DAQfile.root differ
diff --git a/T0/DigitMaker.C b/T0/DigitMaker.C
new file mode 100644 (file)
index 0000000..ddecd2b
--- /dev/null
@@ -0,0 +1,75 @@
+void DigitMaker (Int_t evNumber=1) 
+{
+  /////////////////////////////////////////////////////////////////////////
+  //   This macro is a small example of a ROOT macro
+  //   illustrating how to read the output of GALICE
+  //   and fill some histograms.
+  //   
+  //     Root > .L anal.C   //this loads the macro in memory
+  //     Root > anal();     //by default process first event   
+  //     Root > anal(2);    //process third event
+  //Begin_Html
+  /*
+    <img src="gif/anal.gif">
+  */
+  //End_Html
+  /////////////////////////////////////////////////////////////////////////
+  
+  
+  // 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 = 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");
+  }
+
+  TParticle *particle;
+  AliT0hit  *startHit;
+
+  Int_t buffersize=256;
+  Int_t split=1;
+
+  digits= new AliT0digit();
+  TBranch *bDig=0;
+  printf("Branch\n");
+
+  
+  AliT0 *T0  = (AliT0*) gAlice->GetDetector("T0");
+  
+ // Event ------------------------- LOOP  
+  
+  for (j=0; j<evNumber; j++){
+
+   
+    T0->Hit2digit(j); 
+
+  }// event loop
+
+  file->Write();
+  file->Close();
+
+}//endmacro
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/T0/DrawT0.C b/T0/DrawT0.C
new file mode 100644 (file)
index 0000000..bc5ae00
--- /dev/null
@@ -0,0 +1,17 @@
+void DrawT0()
+{
+   gMC->Gsatt("*", "seen", -1);
+   gMC->Gsatt("alic", "seen", 0);
+   gROOT->LoadMacro("ViewT0.C");
+   gInterpreter->ProcessLine("ViewT0()");
+   gMC->Gdopt("hide", "on");
+   gMC->Gdopt("shad", "on");
+   gMC->Gsatt("*", "fill", 7);
+   gMC->SetClipBox(".");
+   //  gMC->SetClipBox("*", 0, 1000, -1000, 1000, -1000, 1000);
+   gMC->DefaultRange();
+   //gMC->Gdraw("alic", 40, 30, 0, -8, 2, 1, 1);
+   gMC->Gdraw("alic", 40, 30, 0, 10, 9, 1., 1.);
+   gMC->Gdhead(1111, "T0 Detector");
+   //  gMC->Gdman(13, 9, "MAN");
+}
diff --git a/T0/MakeT0FullMisAlignment.C b/T0/MakeT0FullMisAlignment.C
new file mode 100644 (file)
index 0000000..0adebfb
--- /dev/null
@@ -0,0 +1,69 @@
+void MakeT0FullMisAlignment(){
+  // Create TClonesArray of full misalignment objects for T0
+  //
+  TClonesArray *array = new TClonesArray("AliAlignObjAngles",10);
+  TClonesArray &alobj = *array;
+
+  if(!gGeoManager) TGeoManager::Import("geometry.root");
+
+  AliAlignObjAngles a;
+
+  Double_t dx, dy, dz, dpsi, dtheta, dphi;
+  TRandom *rnd   = new TRandom(4321);
+  Double_t sigmatr = 0.05; // max shift in cm w.r.t. RS
+  Double_t sigmarot = 0.3; // max rot in degrees w.r.t. RS
+
+  // null shifts and rotations
+
+  const char *T0right="/ALIC_1/0STR_1";
+  const char *T0left="/ALIC_1/0STL_1";
+
+  Int_t iIndex=0; //let all modules have index=0 in a layer with no LUT
+  AliAlignObj::ELayerID iLayer = AliAlignObj::kInvalidLayer;
+  UShort_t volid = AliAlignObj::LayerToVolUID(iLayer,iIndex);
+
+  dx = rnd->Gaus(0.,sigmatr);
+  dy = rnd->Gaus(0.,sigmatr);
+  dz = rnd->Gaus(0.,sigmatr);
+  dpsi = rnd->Gaus(0.,sigmarot);
+  dtheta = rnd->Gaus(0.,sigmarot);
+  dphi = rnd->Gaus(0.,sigmarot);
+  cout<<dx<<"  "<<dy<<"  "<<dz<<"  "<<dpsi<<"  "<<dtheta<<"  "<<dphi<<"\n";
+  new(alobj[0]) AliAlignObjAngles(T0right, volid, dx, dy, dz, dpsi, dtheta, dphi, kFALSE);
+  dx = rnd->Gaus(0.,sigmatr);
+  dy = rnd->Gaus(0.,sigmatr);
+  dz = rnd->Gaus(0.,sigmatr);
+  dpsi = rnd->Gaus(0.,sigmarot);
+  dtheta = rnd->Gaus(0.,sigmarot);
+  dphi = rnd->Gaus(0.,sigmarot);
+  cout<<dx<<"  "<<dy<<"  "<<dz<<"  "<<dpsi<<"  "<<dtheta<<"  "<<dphi<<"\n";
+  new(alobj[1]) AliAlignObjAngles(T0left, volid, dx, dy, dz, dpsi, dtheta, dphi, kFALSE);
+
+  // just save in a file you will send me
+  // or you will put in your afs public dir ...
+
+  if(!gSystem->Getenv("$TOCDB")){
+    // save on file
+    TFile f("T0fullMisalignment.root","RECREATE");
+    if(!f) cerr<<"cannot open file for output\n";
+    f.cd();
+    f.WriteObject(array,"T0FullObjs ","kSingleKey");
+    f.Close();
+  }else{
+    // save in CDB storage
+    const char* Storage = gSystem->Getenv("$STORAGE");
+    // save in CDB storage
+    AliCDBManager* cdb = AliCDBManager::Instance();
+    AliCDBStorage* storage = cdb->GetStorage(Storage);
+    AliCDBMetaData* md = new AliCDBMetaData();
+    md->SetResponsible("Tomasz Malkiewicz");
+    md->SetComment("Full misalignment for T0, produced with sigmatr=0.05 and sigmarot=0.3 in the local RS");
+    md->SetAliRootVersion(gSystem->Getenv("$ARVERSION"));
+    AliCDBId id("T0/Align/Data",0,9999999);
+    storage->Put(array,id,md);
+  }
+
+  array->Delete();
+
+}
+
diff --git a/T0/MakeT0ResMisAlignment.C b/T0/MakeT0ResMisAlignment.C
new file mode 100644 (file)
index 0000000..c86428b
--- /dev/null
@@ -0,0 +1,64 @@
+void MakeT0ResMisAlignment(){
+  // Create TClonesArray of residual misalignment objects for T0
+  //
+  TClonesArray *array = new TClonesArray("AliAlignObjAngles",10);
+  TClonesArray &alobj = *array;
+
+  if(!gGeoManager) TGeoManager::Import("geometry.root");
+  // needed for the constructors with local coordinates not to fail
+
+  AliAlignObjAngles a;
+
+  Double_t dx, dy, dz, dpsi, dtheta, dphi;
+  TRandom *rnd   = new TRandom(4321);
+  Double_t sigmatr = 0.05; // max shift in cm
+  Double_t sigmarot = 0.3; // max rot in degrees
+
+  const char *T0right="/ALIC_1/0STR_1";
+  const char *T0left="/ALIC_1/0STL_1";
+
+  Int_t iIndex=0;
+  AliAlignObj::ELayerID iLayer = AliAlignObj::kInvalidLayer;
+  UShort_t volid = AliAlignObj::LayerToVolUID(iLayer,iIndex);
+
+  dx = rnd->Gaus(0.,sigmatr);
+  dy = rnd->Gaus(0.,sigmatr);
+  dz = rnd->Gaus(0.,sigmatr);
+  dpsi = rnd->Gaus(0.,sigmarot);
+  dtheta = rnd->Gaus(0.,sigmarot);
+  dphi = rnd->Gaus(0.,sigmarot);
+  cout<<dx<<"  "<<dy<<"  "<<dz<<"  "<<dpsi<<"  "<<dtheta<<"  "<<dphi<<"\n";
+  new(alobj[0]) AliAlignObjAngles(T0right, volid, dx, dy, dz, dpsi, dtheta, dphi, kFALSE);
+  dx = rnd->Gaus(0.,sigmatr);
+  dy = rnd->Gaus(0.,sigmatr);
+  dz = rnd->Gaus(0.,sigmatr);
+  dpsi = rnd->Gaus(0.,sigmarot);
+  dtheta = rnd->Gaus(0.,sigmarot);
+  dphi = rnd->Gaus(0.,sigmarot);
+  cout<<dx<<"  "<<dy<<"  "<<dz<<"  "<<dpsi<<"  "<<dtheta<<"  "<<dphi<<"\n";
+  new(alobj[1]) AliAlignObjAngles(T0left, volid, dx, dy, dz, dpsi, dtheta, dphi, kFALSE);
+
+  if(!gSystem->Getenv("$TOCDB")){
+    // save on file
+    TFile f("T0residualMisalignment.root","RECREATE");
+    if(!f) cerr<<"cannot open file for output\n";
+    f.cd();
+    f.WriteObject(array,"T0ResidualObjs ","kSingleKey");
+    f.Close();
+  }else{
+    // save in CDB storage
+    const char* Storage = gSystem->Getenv("$STORAGE");
+    AliCDBManager* cdb = AliCDBManager::Instance();
+    AliCDBStorage* storage = cdb->GetStorage(Storage);
+    AliCDBMetaData* md = new AliCDBMetaData();
+    md->SetResponsible("Tomasz Malkiewicz");
+    md->SetComment("Residual misalignment for T0, produced with sigmatr=0.05 and sigmarot=0.3 in the local RS");
+    md->SetAliRootVersion(gSystem->Getenv("$ARVERSION"));
+    AliCDBId id("T0/Align/Data",0,9999999);
+    storage->Put(array,id,md);
+  }
+
+  array->Delete();
+
+}
+
diff --git a/T0/PMTefficiency.root b/T0/PMTefficiency.root
new file mode 100644 (file)
index 0000000..9648598
Binary files /dev/null and b/T0/PMTefficiency.root differ
diff --git a/T0/T0Digit.C b/T0/T0Digit.C
new file mode 100644 (file)
index 0000000..50325ff
--- /dev/null
@@ -0,0 +1,29 @@
+void T0Digit () 
+{
+// Dynamically link some shared libs
+
+   if (gClassTable->GetID("AliRun") < 0) {
+      gROOT->LoadMacro("loadlibs.C");
+      loadlibs();
+   }
+
+  AliRunDigitizer * manager = new AliRunDigitizer(1,1);
+  manager->SetInputStream(0,"galice.root");
+  //  manager->SetOutputFile("digits.root");
+  AliT0Digitizer *T0 = new AliT0Digitizer(manager);
+  manager->Exec("");
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/T0/T0baseLinkDef.h b/T0/T0baseLinkDef.h
new file mode 100644 (file)
index 0000000..4427108
--- /dev/null
@@ -0,0 +1,23 @@
+#ifdef __CINT__
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+/* $Id$ */
+
+#pragma link off all globals;
+#pragma link off all classes;
+#pragma link off all functions;
+#pragma link C++ typedef  AliSTARTdigit;
+#pragma link C++ typedef  AliSTARTLoader;
+#pragma link C++ typedef  AliSTARTTrigger;
+#pragma link C++ typedef  AliSTARTCalibData;
+#pragma link C++ typedef  AliSTARTParameters;
+#pragma link C++ class  AliT0digit+;
+#pragma link C++ class  AliT0Loader+;
+#pragma link C++ class  AliT0Trigger+;
+#pragma link C++ class  AliT0CalibData+;
+#pragma link C++ class  AliT0Parameters+;
+
+#endif
diff --git a/T0/T0recLinkDef.h b/T0/T0recLinkDef.h
new file mode 100644 (file)
index 0000000..2ecb187
--- /dev/null
@@ -0,0 +1,19 @@
+#ifdef __CINT__
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+/* $Id$ */
+
+#pragma link off all globals;
+#pragma link off all classes;
+#pragma link off all functions;
+#pragma link C++ typedef  AliSTARTRecPoint;
+#pragma link C++ typedef  AliSTARTReconstructor;
+#pragma link C++ typedef  AliSTARTRawReader;
+#pragma link C++ class  AliT0RecPoint+;
+#pragma link C++ class  AliT0Reconstructor+;
+#pragma link C++ class  AliT0RawReader+;
+
+#endif
diff --git a/T0/T0shuttleLinkDef.h b/T0/T0shuttleLinkDef.h
new file mode 100644 (file)
index 0000000..4e2eff2
--- /dev/null
@@ -0,0 +1,15 @@
+#ifdef __CINT__
+
+#pragma link off all globals;
+#pragma link off all classes;
+#pragma link off all functions;
+
+#pragma link C++ typedef  AliSTARTCalc;
+#pragma link C++ typedef  AliSTARTPreprocessor;
+#pragma link C++ typedef  AliSTARTDqclass;
+
+#pragma link C++ class  AliT0Calc+;
+#pragma link C++ class  AliT0Preprocessor+;
+#pragma link C++ class  AliT0Dqclass+;
+
+#endif
diff --git a/T0/T0simLinkDef.h b/T0/T0simLinkDef.h
new file mode 100644 (file)
index 0000000..88135bf
--- /dev/null
@@ -0,0 +1,25 @@
+#ifdef __CINT__
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+/* $Id$ */
+
+#pragma link off all globals;
+#pragma link off all classes;
+#pragma link off all functions;
+#pragma link C++ typedef  AliSTART;
+#pragma link C++ typedef  AliSTARTv0;
+#pragma link C++ typedef  AliSTARTv1;
+#pragma link C++ typedef  AliSTARThit;
+#pragma link C++ typedef  AliSTARTDigitizer;
+#pragma link C++ typedef  AliSTARTRawData;
+#pragma link C++ class  AliT0+;
+#pragma link C++ class  AliT0v0+;
+#pragma link C++ class  AliT0v1+;
+#pragma link C++ class  AliT0hit+;
+#pragma link C++ class  AliT0Digitizer+;
+#pragma link C++ class  AliT0RawData+;
+
+#endif
diff --git a/T0/TestPreprocessor.C b/T0/TestPreprocessor.C
new file mode 100644 (file)
index 0000000..a766f19
--- /dev/null
@@ -0,0 +1,79 @@
+void TestPreprocessor()
+{
+  gSystem->Load("libT0shuttle.so");
+  gSystem->Load("$ALICE_ROOT/SHUTTLE/TestShuttle/libTestShuttle.so");
+
+
+  AliCDBManager::Instance()->SetDefaultStorage("local://./TestCDB");
+
+  AliTestShuttle* shuttle = new AliTestShuttle(0, 0, 1);
+
+  TMap* dcsAliasMap = CreateDCSAliasMap();
+
+  shuttle->SetDCSInput(dcsAliasMap);
+
+  shuttle->AddInputFile(AliTestShuttle::kDAQ, "T00", "TIME", "LDC0", "DAQfile.root");
+
+  AliPreprocessor* start = new AliT0Preprocessor("T00", shuttle);
+
+  shuttle->Process();
+
+  AliCDBEntry* entry = AliCDBManager::Instance()->Get("T00/Calib/Data", 0);
+  if (!entry)
+  {
+    printf("The file is not there. Something went wrong.\n");
+    return;
+  }
+
+  AliT0Calc* output = dynamic_cast<AliT0Calc*> (entry->GetObject());
+
+   // output->Print();
+}
+
+TMap* CreateDCSAliasMap()
+{
+  TMap* aliasMap = new TMap;
+  aliasMap->SetOwner(1);
+
+  for(int nAlias=0;nAlias<24;nAlias++)
+  {
+    TObjArray* valueSet = new TObjArray;
+    valueSet->SetOwner(1);
+
+    TString aliasName="T0HV";
+    aliasName += nAlias;
+
+    for (int timeStamp=0;timeStamp<1;timeStamp++)
+    {
+      AliDCSValue* dcsVal = new AliDCSValue((Float_t) nAlias, timeStamp);
+      valueSet->Add(dcsVal);
+//    printf("hello! dcsVal= %d %d\n" ,dcsVal->GetFloat(), dcsVal->GetTimeStamp());
+    }
+    aliasMap->Add(new TObjString(aliasName), valueSet);
+  }
+
+  return aliasMap;
+}
+
+TMap* ReadDCSAliasMap()
+{
+  AliCDBEntry *entry = AliCDBManager::Instance()->Get("DET/DCS/Data", 0);
+  return dynamic_cast<TMap*> (entry->GetObject());
+}
+
+void WriteDCSAliasMap()
+{
+  TMap* dcsAliasMap = CreateDCSAliasMap();
+
+  AliCDBMetaData metaData;
+       metaData.SetBeamPeriod(0);
+       metaData.SetResponsible("Responsible person");
+       metaData.SetComment("Test object for TestPreprocessor.C");
+
+  AliCDBId id("DET/DCS/Data", 0, 0);
+
+  // initialize location of CDB
+  AliCDBManager::Instance()->SetDefaultStorage("local://./TestCDB");
+
+  AliCDBManager::Instance()->Put(dcsAliasMap, id, &metaData);
+}
diff --git a/T0/VertexMaker.C b/T0/VertexMaker.C
new file mode 100644 (file)
index 0000000..c9f3821
--- /dev/null
@@ -0,0 +1,50 @@
+void VertexMaker(Int_t evNumber=1) 
+{
+  
+  // Dynamically link some shared libs
+  if (gClassTable->GetID("AliRun") < 0) {
+    gROOT->LoadMacro("loadlibs.C");
+    loadlibs();
+  }
+
+  char filename[100];
+  sprintf(filename,"galice.root");
+  AliRunLoader* rl = AliRunLoader::Open("galice.root",AliConfig::GetDefaultEventFolderName(),"read");
+  if (rl == 0x0)
+   {
+     cerr<<"Can not open session for file galice.root\n";
+     return;
+   }
+
+  rl->LoadgAlice();
+  gAlice = rl->GetAliRun();
+  
+  AliT0* T0  = (AliT0 *)gAlice->GetDetector("T0");
+  /*  
+  rl->LoadHeader();
+  
+  rl->LoadKinematics("READ");
+  Int_t retval;
+  AliLoader* lstart = rl->GetLoader("T0Loader");
+  lstart->LoadDigits("READ");
+  //  lstart->Dump();
+  //  lstart->LoadRecPoints("UPDATE");
+  */  
+  vertex= new AliT0vertex();
+  TBranch *bRec=0;
+  vertex->Dump();
+  
+ // Event ------------------------- LOOP  
+  //     Int_t iNevents=rl->GetNumberOfEvents();
+  // cout<<"  nevents   "<<iNevents<<endl;
+
+  // for (Int_t j=0; j<iNevents; j++){
+  //  lstart->LoadDigits("READ");
+    vertex->Reconstruct();
+    //  }
+
+} // end of macro
+
+
+
+
diff --git a/T0/ViewT0.C b/T0/ViewT0.C
new file mode 100644 (file)
index 0000000..baa5fba
--- /dev/null
@@ -0,0 +1,9 @@
+void ViewT0()
+{
+  //   gMC->Gsatt("STRT","seen",0);
+   gMC->Gsatt("0IN","seen",0);
+   gMC->Gsatt("0PM","seen",1);
+   gMC->Gsatt("0DI","seen",1);
+}
+
+
diff --git a/T0/esdAna.C b/T0/esdAna.C
new file mode 100644 (file)
index 0000000..1ee64d5
--- /dev/null
@@ -0,0 +1,114 @@
+#define esdAna_cxx
+// The class definition in esdAna.h has been generated automatically
+// by the ROOT utility TTree::MakeSelector(). This class is derived
+// from the ROOT class TSelector. For more information on the TSelector
+// framework see $ROOTSYS/README/README.SELECTOR or the ROOT User Manual.
+
+// The following methods are defined in this file:
+//    Begin():        called everytime a loop on the tree starts,
+//                    a convenient place to create your histograms.
+//    SlaveBegin():   called after Begin(), when on PROOF called only on the
+//                    slave servers.
+//    Process():      called for each event, in this function you decide what
+//                    to read and fill your histograms.
+//    SlaveTerminate: called at the end of the loop on the tree, when on PROOF
+//                    called only on the slave servers.
+//    Terminate():    called at the end of the loop on the tree,
+//                    a convenient place to draw/fit your histograms.
+//
+// To use this file, try the following session on your Tree T:
+//
+// Root > T->Process("esdAna.C")
+// Root > T->Process("esdAna.C","some options")
+// Root > T->Process("esdAna.C+")
+//
+
+#include "esdAna.h"
+#include <TH1.h>
+
+void esdAna::Begin(TTree *)
+{
+   // The Begin() function is called at the start of the query.
+   // When running with PROOF Begin() is only called on the client.
+   // The tree argument is deprecated (on PROOF 0 is passed).
+  
+   h1 = new TH1F("hRealVertex","Primary vertex",100,-20,20);
+   h3 = new TH1F("hT0vertex","T0vertex",100,-20,20);
+   h2 = new TH1F("hT0start","T0 start time",100,12400,12600);
+ TString option = GetOption();   
+}
+
+void esdAna::SlaveBegin(TTree *tree)
+{
+   // The SlaveBegin() function is called after the Begin() function.
+   // When running with PROOF SlaveBegin() is called on each slave server.
+   // The tree argument is deprecated (on PROOF 0 is passed).
+
+  
+     Init(tree);
+
+   TString option = GetOption();
+
+}
+
+Bool_t esdAna::Process(Long64_t entry)
+{
+
+   // The Process() function is called for each entry in the tree (or possibly
+   // keyed object in the case of PROOF) to be processed. The entry argument
+   // specifies which entry in the currently loaded tree is to be processed.
+   // It can be passed to either TTree::GetEntry() or TBranch::GetEntry()
+   // to read either all or the required parts of the data. When processing
+   // keyed objects with PROOF, the object is already loaded and is available
+   // via the fObject pointer.
+   //
+   // This function should contain the "body" of the analysis. It can contain
+   // simple or elaborate selection criteria, run algorithms on the data
+   // of the event and typically fill histograms.
+
+   // WARNING when a selector is used with a TChain, you must use
+   //  the pointer to the current TTree to call GetEntry(entry).
+   //  The entry is always the local entry number in the current tree.
+   //  Assuming that fChain is the pointer to the TChain being processed,
+   //  use fChain->GetTree()->GetEntry(entry).
+  //  fChain->GetTree()->GetEntry(entry);
+  b_ESD_fEventNumber->GetEvent(entry);
+  b_ESD_fPrimaryVertex_fPosition->GetEntry(entry);
+  b_ESD_fT0zVertex->GetEntry(entry);
+   b_ESD_fT0timeStart->GetEntry(entry);
+   printf("Processing Entry %lld %d  %f %f %f \n",entry,fEventNumber,fT0zVertex,fPrimaryVertex_fPosition[2], fT0timeStart );
+
+   h2->Fill(fT0timeStart);
+   h1->Fill(fPrimaryVertex_fPosition[2]);
+   h3->Fill(fT0zVertex/2.);
+   
+
+   return kTRUE;
+}
+
+void esdAna::SlaveTerminate()
+{
+   // The SlaveTerminate() function is called after all entries or objects
+   // have been processed. When running with PROOF SlaveTerminate() is called
+   // on each slave server.
+   fOutput->Add(h1) ;
+   fOutput->Add(h2) ;
+   fOutput->Add(h3) ;
+}
+
+void esdAna::Terminate()
+{
+   // The Terminate() function is the last function to be called during
+   // a query. It always runs on the client, it can be used to present
+   // the results graphically or save the results to file.
+  Float_t mean = h2->GetMean();
+  printf ("mean time T0 ps %f ",mean);
+  if (mean >  12600 || mean <12400 ) 
+    printf (" !!!!!!!!!!-----events sample is WRONG - T0 unreal -------");  
+   hfile = TFile::Open("esdAna.root","RECREATE");
+   TFile * file = TFile::Open("esdAna.root", "RECREATE");
+   h1->Write();
+   h2->Write();
+   h3->Write();
+   file->Close();
+}
diff --git a/T0/esdAna.h b/T0/esdAna.h
new file mode 100644 (file)
index 0000000..07249e3
--- /dev/null
@@ -0,0 +1,1502 @@
+//////////////////////////////////////////////////////////
+// This class has been automatically generated on
+// Mon Jul 17 18:28:08 2006 by ROOT version 5.11/06
+// from TTree esdTree/Tree with ESD objects
+// found on file: root://lxgate06.cern.ch//alice/cern.ch/user/a/aliprod/psaiz/prod2006/output_pp/1/002/root_archive.zip#AliESDs.root
+//////////////////////////////////////////////////////////
+
+#ifndef esdAna_h
+#define esdAna_h
+
+#include <TROOT.h>
+#include <TChain.h>
+#include <TFile.h>
+#include <TSelector.h>
+#include <TH1F.h>
+   const Int_t kMaxfTracks = 62;
+   const Int_t kMaxfHLTConfMapTracks = 37;
+   const Int_t kMaxfHLTHoughTracks = 1;
+   const Int_t kMaxfMuonTracks = 1;
+   const Int_t kMaxfPmdTracks = 1;
+   const Int_t kMaxfTrdTracks = 1;
+   const Int_t kMaxfV0s = 1;
+   const Int_t kMaxfCascades = 1;
+   const Int_t kMaxfKinks = 1;
+   const Int_t kMaxfV0MIs = 1;
+   const Int_t kMaxfCaloClusters = 45;
+
+class esdAna : public TSelector {
+public :
+   TTree          *fChain;   //!pointer to the analyzed TTree or TChain
+
+   // Declaration of leave types
+// AliESD          *fESD;
+   UInt_t          fUniqueID;
+   UInt_t          fBits;
+   Int_t           fEventNumber;
+   Int_t           fRunNumber;
+   ULong64_t       fTriggerMask;
+   UChar_t         fTriggerCluster;
+   Int_t           fRecoVersion;
+   Float_t         fMagneticField;
+   Float_t         fZDCN1Energy;
+   Float_t         fZDCP1Energy;
+   Float_t         fZDCN2Energy;
+   Float_t         fZDCP2Energy;
+   Float_t         fZDCEMEnergy;
+   Int_t           fZDCParticipants;
+   Float_t         fT0zVertex;
+   UInt_t          fSPDVertex_fUniqueID;
+   UInt_t          fSPDVertex_fBits;
+   TString         fSPDVertex_fName;
+   TString         fSPDVertex_fTitle;
+   Double_t        fSPDVertex_fPosition[3];
+   Double_t        fSPDVertex_fSigma;
+   Int_t           fSPDVertex_fNContributors;
+   Double_t        fSPDVertex_fCovXX;
+   Double_t        fSPDVertex_fCovXY;
+   Double_t        fSPDVertex_fCovYY;
+   Double_t        fSPDVertex_fCovXZ;
+   Double_t        fSPDVertex_fCovYZ;
+   Double_t        fSPDVertex_fCovZZ;
+   Double_t        fSPDVertex_fSNR[3];
+   Double_t        fSPDVertex_fChi2;
+   Double_t        fSPDVertex_fTruePos[3];
+   UInt_t          fPrimaryVertex_fUniqueID;
+   UInt_t          fPrimaryVertex_fBits;
+   TString         fPrimaryVertex_fName;
+   TString         fPrimaryVertex_fTitle;
+   Double_t        fPrimaryVertex_fPosition[3];
+   Double_t        fPrimaryVertex_fSigma;
+   Int_t           fPrimaryVertex_fNContributors;
+   Double_t        fPrimaryVertex_fCovXX;
+   Double_t        fPrimaryVertex_fCovXY;
+   Double_t        fPrimaryVertex_fCovYY;
+   Double_t        fPrimaryVertex_fCovXZ;
+   Double_t        fPrimaryVertex_fCovYZ;
+   Double_t        fPrimaryVertex_fCovZZ;
+   Double_t        fPrimaryVertex_fSNR[3];
+   Double_t        fPrimaryVertex_fChi2;
+   Double_t        fPrimaryVertex_fTruePos[3];
+   UInt_t          fSPDMult_fUniqueID;
+   UInt_t          fSPDMult_fBits;
+   Int_t           fSPDMult_fNtracks;
+   Float_t         fSPDMult_fTh[25];   //[fSPDMult.fNtracks]
+   Float_t         fSPDMult_fPhi[25];   //[fSPDMult.fNtracks]
+   Float_t         fSPDMult_fDeltPhi[25];   //[fSPDMult.fNtracks]
+   Float_t         fT0timeStart;
+   Float_t         fT0time[24];
+   Float_t         fT0amplitude[24];
+   Int_t           fTracks_;
+   UInt_t          fTracks_fUniqueID[kMaxfTracks];   //[fTracks_]
+   UInt_t          fTracks_fBits[kMaxfTracks];   //[fTracks_]
+   Double_t        fTracks_fX[kMaxfTracks];   //[fTracks_]
+   Double_t        fTracks_fAlpha[kMaxfTracks];   //[fTracks_]
+   Double_t        fTracks_fP[kMaxfTracks][5];   //[fTracks_]
+   Double_t        fTracks_fC[kMaxfTracks][15];   //[fTracks_]
+   ULong_t         fTracks_fFlags[kMaxfTracks];   //[fTracks_]
+   Int_t           fTracks_fLabel[kMaxfTracks];   //[fTracks_]
+   Int_t           fTracks_fID[kMaxfTracks];   //[fTracks_]
+   Float_t         fTracks_fTrackLength[kMaxfTracks];   //[fTracks_]
+   Float_t         fTracks_fD[kMaxfTracks];   //[fTracks_]
+   Float_t         fTracks_fZ[kMaxfTracks];   //[fTracks_]
+   Float_t         fTracks_fCdd[kMaxfTracks];   //[fTracks_]
+   Float_t         fTracks_fCdz[kMaxfTracks];   //[fTracks_]
+   Float_t         fTracks_fCzz[kMaxfTracks];   //[fTracks_]
+   Float_t         fTracks_fTrackTime[kMaxfTracks][5];   //[fTracks_]
+   Float_t         fTracks_fR[kMaxfTracks][5];   //[fTracks_]
+   Int_t           fTracks_fStopVertex[kMaxfTracks];   //[fTracks_]
+   Double_t        fTracks_fCchi2[kMaxfTracks];   //[fTracks_]
+   Float_t         fTracks_fITSchi2[kMaxfTracks];   //[fTracks_]
+   Int_t           fTracks_fITSncls[kMaxfTracks];   //[fTracks_]
+   Float_t         fTracks_fITSsignal[kMaxfTracks];   //[fTracks_]
+   Float_t         fTracks_fITSr[kMaxfTracks][5];   //[fTracks_]
+   Int_t           fTracks_fITSLabel[kMaxfTracks];   //[fTracks_]
+   Float_t         fTracks_fITSFakeRatio[kMaxfTracks];   //[fTracks_]
+   Float_t         fTracks_fTPCchi2[kMaxfTracks];   //[fTracks_]
+   Int_t           fTracks_fTPCncls[kMaxfTracks];   //[fTracks_]
+   UShort_t        fTracks_fTPCnclsF[kMaxfTracks];   //[fTracks_]
+   UInt_t          fTracks_fTPCClusterMap_fUniqueID[kMaxfTracks];   //[fTracks_]
+   UInt_t          fTracks_fTPCClusterMap_fBits[kMaxfTracks];   //[fTracks_]
+   UInt_t          fTracks_fTPCClusterMap_fNbits[kMaxfTracks];   //[fTracks_]
+   UInt_t          fTracks_fTPCClusterMap_fNbytes[kMaxfTracks];   //[fTracks_]
+   UChar_t        *fTracks_fTPCClusterMap_fAllBits[kMaxfTracks];   //[fTracks_fTPCClusterMap_fNbytes]
+   Float_t         fTracks_fTPCsignal[kMaxfTracks];   //[fTracks_]
+   UShort_t        fTracks_fTPCsignalN[kMaxfTracks];   //[fTracks_]
+   Float_t         fTracks_fTPCsignalS[kMaxfTracks];   //[fTracks_]
+   Float_t         fTracks_fTPCr[kMaxfTracks][5];   //[fTracks_]
+   Int_t           fTracks_fTPCLabel[kMaxfTracks];   //[fTracks_]
+   Float_t         fTracks_fTPCPoints[kMaxfTracks][4];   //[fTracks_]
+   Int_t           fTracks_fKinkIndexes[kMaxfTracks][3];   //[fTracks_]
+   Int_t           fTracks_fV0Indexes[kMaxfTracks][3];   //[fTracks_]
+   Float_t         fTracks_fTRDchi2[kMaxfTracks];   //[fTracks_]
+   Int_t           fTracks_fTRDncls[kMaxfTracks];   //[fTracks_]
+   Int_t           fTracks_fTRDncls0[kMaxfTracks];   //[fTracks_]
+   Float_t         fTracks_fTRDsignal[kMaxfTracks];   //[fTracks_]
+   Float_t         fTracks_fTRDsignals[kMaxfTracks][6][3];   //[fTracks_]
+   Int_t           fTracks_fTRDTimBin[kMaxfTracks][6];   //[fTracks_]
+   Float_t         fTracks_fTRDr[kMaxfTracks][5];   //[fTracks_]
+   Int_t           fTracks_fTRDLabel[kMaxfTracks];   //[fTracks_]
+   Float_t         fTracks_fTRDQuality[kMaxfTracks];   //[fTracks_]
+   Float_t         fTracks_fTRDBudget[kMaxfTracks];   //[fTracks_]
+   Float_t         fTracks_fTOFchi2[kMaxfTracks];   //[fTracks_]
+   Int_t           fTracks_fTOFindex[kMaxfTracks];   //[fTracks_]
+   Int_t           fTracks_fTOFCalChannel[kMaxfTracks];   //[fTracks_]
+   Float_t         fTracks_fTOFsignal[kMaxfTracks];   //[fTracks_]
+   Float_t         fTracks_fTOFsignalToT[kMaxfTracks];   //[fTracks_]
+   Float_t         fTracks_fTOFr[kMaxfTracks][5];   //[fTracks_]
+   Int_t           fTracks_fTOFLabel[kMaxfTracks][3];   //[fTracks_]
+   Float_t         fTracks_fHMPIDchi2[kMaxfTracks];   //[fTracks_]
+   Int_t           fTracks_fHMPIDncls[kMaxfTracks];   //[fTracks_]
+   Int_t           fTracks_fHMPIDindex[kMaxfTracks];   //[fTracks_]
+   Float_t         fTracks_fHMPIDsignal[kMaxfTracks];   //[fTracks_]
+   Float_t         fTracks_fHMPIDr[kMaxfTracks][5];   //[fTracks_]
+   Float_t         fTracks_fHMPIDtheta[kMaxfTracks];   //[fTracks_]
+   Float_t         fTracks_fHMPIDphi[kMaxfTracks];   //[fTracks_]
+   Float_t         fTracks_fHMPIDdx[kMaxfTracks];   //[fTracks_]
+   Float_t         fTracks_fHMPIDdy[kMaxfTracks];   //[fTracks_]
+   Float_t         fTracks_fHMPIDmipX[kMaxfTracks];   //[fTracks_]
+   Float_t         fTracks_fHMPIDmipY[kMaxfTracks];   //[fTracks_]
+   Int_t           fHLTConfMapTracks_;
+   UInt_t          fHLTConfMapTracks_fUniqueID[kMaxfHLTConfMapTracks];   //[fHLTConfMapTracks_]
+   UInt_t          fHLTConfMapTracks_fBits[kMaxfHLTConfMapTracks];   //[fHLTConfMapTracks_]
+   UShort_t        fHLTConfMapTracks_fNHits[kMaxfHLTConfMapTracks];   //[fHLTConfMapTracks_]
+   Int_t           fHLTConfMapTracks_fMCid[kMaxfHLTConfMapTracks];   //[fHLTConfMapTracks_]
+   UShort_t        fHLTConfMapTracks_fWeight[kMaxfHLTConfMapTracks];   //[fHLTConfMapTracks_]
+   Bool_t          fHLTConfMapTracks_fFromMainVertex[kMaxfHLTConfMapTracks];   //[fHLTConfMapTracks_]
+   Int_t           fHLTConfMapTracks_fRowRange[kMaxfHLTConfMapTracks][2];   //[fHLTConfMapTracks_]
+   UShort_t        fHLTConfMapTracks_fSector[kMaxfHLTConfMapTracks];   //[fHLTConfMapTracks_]
+   Float_t         fHLTConfMapTracks_fFirstPoint[kMaxfHLTConfMapTracks][3];   //[fHLTConfMapTracks_]
+   Float_t         fHLTConfMapTracks_fLastPoint[kMaxfHLTConfMapTracks][3];   //[fHLTConfMapTracks_]
+   Int_t           fHLTConfMapTracks_fQ[kMaxfHLTConfMapTracks];   //[fHLTConfMapTracks_]
+   Float_t         fHLTConfMapTracks_fTanl[kMaxfHLTConfMapTracks];   //[fHLTConfMapTracks_]
+   Float_t         fHLTConfMapTracks_fPsi[kMaxfHLTConfMapTracks];   //[fHLTConfMapTracks_]
+   Float_t         fHLTConfMapTracks_fPt[kMaxfHLTConfMapTracks];   //[fHLTConfMapTracks_]
+   Float_t         fHLTConfMapTracks_fPterr[kMaxfHLTConfMapTracks];   //[fHLTConfMapTracks_]
+   Float_t         fHLTConfMapTracks_fPsierr[kMaxfHLTConfMapTracks];   //[fHLTConfMapTracks_]
+   Float_t         fHLTConfMapTracks_fTanlerr[kMaxfHLTConfMapTracks];   //[fHLTConfMapTracks_]
+   Float_t         fHLTConfMapTracks_fBinX[kMaxfHLTConfMapTracks];   //[fHLTConfMapTracks_]
+   Float_t         fHLTConfMapTracks_fBinY[kMaxfHLTConfMapTracks];   //[fHLTConfMapTracks_]
+   Float_t         fHLTConfMapTracks_fSizeX[kMaxfHLTConfMapTracks];   //[fHLTConfMapTracks_]
+   Float_t         fHLTConfMapTracks_fSizeY[kMaxfHLTConfMapTracks];   //[fHLTConfMapTracks_]
+   Float_t         fHLTConfMapTracks_fPID[kMaxfHLTConfMapTracks];   //[fHLTConfMapTracks_]
+   Int_t           fHLTHoughTracks_;
+   UInt_t          fHLTHoughTracks_fUniqueID[kMaxfHLTHoughTracks];   //[fHLTHoughTracks_]
+   UInt_t          fHLTHoughTracks_fBits[kMaxfHLTHoughTracks];   //[fHLTHoughTracks_]
+   UShort_t        fHLTHoughTracks_fNHits[kMaxfHLTHoughTracks];   //[fHLTHoughTracks_]
+   Int_t           fHLTHoughTracks_fMCid[kMaxfHLTHoughTracks];   //[fHLTHoughTracks_]
+   UShort_t        fHLTHoughTracks_fWeight[kMaxfHLTHoughTracks];   //[fHLTHoughTracks_]
+   Bool_t          fHLTHoughTracks_fFromMainVertex[kMaxfHLTHoughTracks];   //[fHLTHoughTracks_]
+   Int_t           fHLTHoughTracks_fRowRange[kMaxfHLTHoughTracks][2];   //[fHLTHoughTracks_]
+   UShort_t        fHLTHoughTracks_fSector[kMaxfHLTHoughTracks];   //[fHLTHoughTracks_]
+   Float_t         fHLTHoughTracks_fFirstPoint[kMaxfHLTHoughTracks][3];   //[fHLTHoughTracks_]
+   Float_t         fHLTHoughTracks_fLastPoint[kMaxfHLTHoughTracks][3];   //[fHLTHoughTracks_]
+   Int_t           fHLTHoughTracks_fQ[kMaxfHLTHoughTracks];   //[fHLTHoughTracks_]
+   Float_t         fHLTHoughTracks_fTanl[kMaxfHLTHoughTracks];   //[fHLTHoughTracks_]
+   Float_t         fHLTHoughTracks_fPsi[kMaxfHLTHoughTracks];   //[fHLTHoughTracks_]
+   Float_t         fHLTHoughTracks_fPt[kMaxfHLTHoughTracks];   //[fHLTHoughTracks_]
+   Float_t         fHLTHoughTracks_fPterr[kMaxfHLTHoughTracks];   //[fHLTHoughTracks_]
+   Float_t         fHLTHoughTracks_fPsierr[kMaxfHLTHoughTracks];   //[fHLTHoughTracks_]
+   Float_t         fHLTHoughTracks_fTanlerr[kMaxfHLTHoughTracks];   //[fHLTHoughTracks_]
+   Float_t         fHLTHoughTracks_fBinX[kMaxfHLTHoughTracks];   //[fHLTHoughTracks_]
+   Float_t         fHLTHoughTracks_fBinY[kMaxfHLTHoughTracks];   //[fHLTHoughTracks_]
+   Float_t         fHLTHoughTracks_fSizeX[kMaxfHLTHoughTracks];   //[fHLTHoughTracks_]
+   Float_t         fHLTHoughTracks_fSizeY[kMaxfHLTHoughTracks];   //[fHLTHoughTracks_]
+   Float_t         fHLTHoughTracks_fPID[kMaxfHLTHoughTracks];   //[fHLTHoughTracks_]
+   Int_t           fMuonTracks_;
+   UInt_t          fMuonTracks_fUniqueID[kMaxfMuonTracks];   //[fMuonTracks_]
+   UInt_t          fMuonTracks_fBits[kMaxfMuonTracks];   //[fMuonTracks_]
+   Double_t        fMuonTracks_fInverseBendingMomentum[kMaxfMuonTracks];   //[fMuonTracks_]
+   Double_t        fMuonTracks_fThetaX[kMaxfMuonTracks];   //[fMuonTracks_]
+   Double_t        fMuonTracks_fThetaY[kMaxfMuonTracks];   //[fMuonTracks_]
+   Double_t        fMuonTracks_fZ[kMaxfMuonTracks];   //[fMuonTracks_]
+   Double_t        fMuonTracks_fBendingCoor[kMaxfMuonTracks];   //[fMuonTracks_]
+   Double_t        fMuonTracks_fNonBendingCoor[kMaxfMuonTracks];   //[fMuonTracks_]
+   Double_t        fMuonTracks_fChi2[kMaxfMuonTracks];   //[fMuonTracks_]
+   UInt_t          fMuonTracks_fNHit[kMaxfMuonTracks];   //[fMuonTracks_]
+   Bool_t          fMuonTracks_fMatchTrigger[kMaxfMuonTracks];   //[fMuonTracks_]
+   Double_t        fMuonTracks_fChi2MatchTrigger[kMaxfMuonTracks];   //[fMuonTracks_]
+   Int_t           fPmdTracks_;
+   UInt_t          fPmdTracks_fUniqueID[kMaxfPmdTracks];   //[fPmdTracks_]
+   UInt_t          fPmdTracks_fBits[kMaxfPmdTracks];   //[fPmdTracks_]
+   Int_t           fPmdTracks_fDet[kMaxfPmdTracks];   //[fPmdTracks_]
+   Float_t         fPmdTracks_fX[kMaxfPmdTracks];   //[fPmdTracks_]
+   Float_t         fPmdTracks_fY[kMaxfPmdTracks];   //[fPmdTracks_]
+   Float_t         fPmdTracks_fZ[kMaxfPmdTracks];   //[fPmdTracks_]
+   Float_t         fPmdTracks_fCluADC[kMaxfPmdTracks];   //[fPmdTracks_]
+   Float_t         fPmdTracks_fNcell[kMaxfPmdTracks];   //[fPmdTracks_]
+   Float_t         fPmdTracks_fCluPID[kMaxfPmdTracks];   //[fPmdTracks_]
+   Int_t           fTrdTracks_;
+   UInt_t          fTrdTracks_fUniqueID[kMaxfTrdTracks];   //[fTrdTracks_]
+   UInt_t          fTrdTracks_fBits[kMaxfTrdTracks];   //[fTrdTracks_]
+   Float_t         fTrdTracks_fYproj[kMaxfTrdTracks];   //[fTrdTracks_]
+   Float_t         fTrdTracks_fZproj[kMaxfTrdTracks];   //[fTrdTracks_]
+   Float_t         fTrdTracks_fSlope[kMaxfTrdTracks];   //[fTrdTracks_]
+   Int_t           fTrdTracks_fDetector[kMaxfTrdTracks];   //[fTrdTracks_]
+   Int_t           fTrdTracks_fNtracklets[kMaxfTrdTracks];   //[fTrdTracks_]
+   Int_t           fTrdTracks_fNplanes[kMaxfTrdTracks];   //[fTrdTracks_]
+   Int_t           fTrdTracks_fNclusters[kMaxfTrdTracks];   //[fTrdTracks_]
+   Float_t         fTrdTracks_fPt[kMaxfTrdTracks];   //[fTrdTracks_]
+   Float_t         fTrdTracks_fPhi[kMaxfTrdTracks];   //[fTrdTracks_]
+   Float_t         fTrdTracks_fEta[kMaxfTrdTracks];   //[fTrdTracks_]
+   Int_t           fTrdTracks_fLabel[kMaxfTrdTracks];   //[fTrdTracks_]
+   Float_t         fTrdTracks_fPID[kMaxfTrdTracks];   //[fTrdTracks_]
+   Bool_t          fTrdTracks_fIsElectron[kMaxfTrdTracks];   //[fTrdTracks_]
+   Int_t           fV0s_;
+   UInt_t          fV0s_fUniqueID[kMaxfV0s];   //[fV0s_]
+   UInt_t          fV0s_fBits[kMaxfV0s];   //[fV0s_]
+   Int_t           fV0s_fPdgCode[kMaxfV0s];   //[fV0s_]
+   Double_t        fV0s_fEffMass[kMaxfV0s];   //[fV0s_]
+   Double_t        fV0s_fDcaDaughters[kMaxfV0s];   //[fV0s_]
+   Double_t        fV0s_fChi2[kMaxfV0s];   //[fV0s_]
+   Double_t        fV0s_fPos[kMaxfV0s][3];   //[fV0s_]
+   Double_t        fV0s_fPosCov[kMaxfV0s][6];   //[fV0s_]
+   Int_t           fV0s_fNidx[kMaxfV0s];   //[fV0s_]
+   Double_t        fV0s_fNmom[kMaxfV0s][3];   //[fV0s_]
+   Double_t        fV0s_fNmomCov[kMaxfV0s][6];   //[fV0s_]
+   Int_t           fV0s_fPidx[kMaxfV0s];   //[fV0s_]
+   Double_t        fV0s_fPmom[kMaxfV0s][3];   //[fV0s_]
+   Double_t        fV0s_fPmomCov[kMaxfV0s][6];   //[fV0s_]
+   Int_t           fCascades_;
+   UInt_t          fCascades_fUniqueID[kMaxfCascades];   //[fCascades_]
+   UInt_t          fCascades_fBits[kMaxfCascades];   //[fCascades_]
+   Int_t           fCascades_fPdgCode[kMaxfCascades];   //[fCascades_]
+   Double_t        fCascades_fEffMass[kMaxfCascades];   //[fCascades_]
+   Double_t        fCascades_fChi2[kMaxfCascades];   //[fCascades_]
+   Double_t        fCascades_fPos[kMaxfCascades][3];   //[fCascades_]
+   Double_t        fCascades_fPosCov[kMaxfCascades][6];   //[fCascades_]
+   Int_t           fCascades_fV0idx[kMaxfCascades][2];   //[fCascades_]
+   Double_t        fCascades_fV0mom[kMaxfCascades][2][3];   //[fCascades_]
+   Double_t        fCascades_fV0momCov[kMaxfCascades][6];   //[fCascades_]
+   Int_t           fCascades_fBachIdx[kMaxfCascades];   //[fCascades_]
+   Double_t        fCascades_fBachMom[kMaxfCascades][3];   //[fCascades_]
+   Double_t        fCascades_fBachMomCov[kMaxfCascades][6];   //[fCascades_]
+   Int_t           fKinks_;
+   UInt_t          fKinks_fUniqueID[kMaxfKinks];   //[fKinks_]
+   UInt_t          fKinks_fBits[kMaxfKinks];   //[fKinks_]
+   Int_t           fKinks_fID[kMaxfKinks];   //[fKinks_]
+   UInt_t          fKinks_fParamDaughter_fUniqueID[kMaxfKinks];   //[fKinks_]
+   UInt_t          fKinks_fParamDaughter_fBits[kMaxfKinks];   //[fKinks_]
+   Double_t        fKinks_fParamDaughter_fX[kMaxfKinks];   //[fKinks_]
+   Double_t        fKinks_fParamDaughter_fAlpha[kMaxfKinks];   //[fKinks_]
+   Double_t        fKinks_fParamDaughter_fP[kMaxfKinks][5];   //[fKinks_]
+   Double_t        fKinks_fParamDaughter_fC[kMaxfKinks][15];   //[fKinks_]
+   UInt_t          fKinks_fParamMother_fUniqueID[kMaxfKinks];   //[fKinks_]
+   UInt_t          fKinks_fParamMother_fBits[kMaxfKinks];   //[fKinks_]
+   Double_t        fKinks_fParamMother_fX[kMaxfKinks];   //[fKinks_]
+   Double_t        fKinks_fParamMother_fAlpha[kMaxfKinks];   //[fKinks_]
+   Double_t        fKinks_fParamMother_fP[kMaxfKinks][5];   //[fKinks_]
+   Double_t        fKinks_fParamMother_fC[kMaxfKinks][15];   //[fKinks_]
+   Double_t        fKinks_fDist1[kMaxfKinks];   //[fKinks_]
+   Double_t        fKinks_fDist2[kMaxfKinks];   //[fKinks_]
+   Double_t        fKinks_fPdr[kMaxfKinks][3];   //[fKinks_]
+   Double_t        fKinks_fXr[kMaxfKinks][3];   //[fKinks_]
+   Double_t        fKinks_fPm[kMaxfKinks][3];   //[fKinks_]
+   Double_t        fKinks_fAngle[kMaxfKinks][3];   //[fKinks_]
+   Double_t        fKinks_fRr[kMaxfKinks];   //[fKinks_]
+   Int_t           fKinks_fLab[kMaxfKinks][2];   //[fKinks_]
+   Int_t           fKinks_fIndex[kMaxfKinks][2];   //[fKinks_]
+   Char_t          fKinks_fStatus[kMaxfKinks][12];   //[fKinks_]
+   Float_t         fKinks_fTPCdensity[kMaxfKinks][2][2];   //[fKinks_]
+   Float_t         fKinks_fTPCdensity2[kMaxfKinks][2][2];   //[fKinks_]
+   Float_t         fKinks_fShapeFactor[kMaxfKinks];   //[fKinks_]
+   Int_t           fKinks_fRow0[kMaxfKinks];   //[fKinks_]
+   Int_t           fKinks_fMultiple[kMaxfKinks][2];   //[fKinks_]
+   Int_t           fKinks_fTPCncls[kMaxfKinks][2];   //[fKinks_]
+   Int_t           fV0MIs_;
+   UInt_t          fV0MIs_fUniqueID[kMaxfV0MIs];   //[fV0MIs_]
+   UInt_t          fV0MIs_fBits[kMaxfV0MIs];   //[fV0MIs_]
+   Int_t           fV0MIs_fPdgCode[kMaxfV0MIs];   //[fV0MIs_]
+   Double_t        fV0MIs_fEffMass[kMaxfV0MIs];   //[fV0MIs_]
+   Double_t        fV0MIs_fDcaDaughters[kMaxfV0MIs];   //[fV0MIs_]
+   Double_t        fV0MIs_fChi2[kMaxfV0MIs];   //[fV0MIs_]
+   Double_t        fV0MIs_fPos[kMaxfV0MIs][3];   //[fV0MIs_]
+   Double_t        fV0MIs_fPosCov[kMaxfV0MIs][6];   //[fV0MIs_]
+   Int_t           fV0MIs_fNidx[kMaxfV0MIs];   //[fV0MIs_]
+   Double_t        fV0MIs_fNmom[kMaxfV0MIs][3];   //[fV0MIs_]
+   Double_t        fV0MIs_fNmomCov[kMaxfV0MIs][6];   //[fV0MIs_]
+   Int_t           fV0MIs_fPidx[kMaxfV0MIs];   //[fV0MIs_]
+   Double_t        fV0MIs_fPmom[kMaxfV0MIs][3];   //[fV0MIs_]
+   Double_t        fV0MIs_fPmomCov[kMaxfV0MIs][6];   //[fV0MIs_]
+   UInt_t          fV0MIs_fParamP_fUniqueID[kMaxfV0MIs];   //[fV0MIs_]
+   UInt_t          fV0MIs_fParamP_fBits[kMaxfV0MIs];   //[fV0MIs_]
+   Double_t        fV0MIs_fParamP_fX[kMaxfV0MIs];   //[fV0MIs_]
+   Double_t        fV0MIs_fParamP_fAlpha[kMaxfV0MIs];   //[fV0MIs_]
+   Double_t        fV0MIs_fParamP_fP[kMaxfV0MIs][5];   //[fV0MIs_]
+   Double_t        fV0MIs_fParamP_fC[kMaxfV0MIs][15];   //[fV0MIs_]
+   UInt_t          fV0MIs_fParamM_fUniqueID[kMaxfV0MIs];   //[fV0MIs_]
+   UInt_t          fV0MIs_fParamM_fBits[kMaxfV0MIs];   //[fV0MIs_]
+   Double_t        fV0MIs_fParamM_fX[kMaxfV0MIs];   //[fV0MIs_]
+   Double_t        fV0MIs_fParamM_fAlpha[kMaxfV0MIs];   //[fV0MIs_]
+   Double_t        fV0MIs_fParamM_fP[kMaxfV0MIs][5];   //[fV0MIs_]
+   Double_t        fV0MIs_fParamM_fC[kMaxfV0MIs][15];   //[fV0MIs_]
+   Float_t         fV0MIs_fRP[kMaxfV0MIs][5];   //[fV0MIs_]
+   Float_t         fV0MIs_fRM[kMaxfV0MIs][5];   //[fV0MIs_]
+   Int_t           fV0MIs_fID[kMaxfV0MIs];   //[fV0MIs_]
+   Int_t           fV0MIs_fLab[kMaxfV0MIs][2];   //[fV0MIs_]
+   Int_t           fV0MIs_fIndex[kMaxfV0MIs][2];   //[fV0MIs_]
+   Float_t         fV0MIs_fNormDCAPrim[kMaxfV0MIs][2];   //[fV0MIs_]
+   Double_t        fV0MIs_fDist1[kMaxfV0MIs];   //[fV0MIs_]
+   Double_t        fV0MIs_fDist2[kMaxfV0MIs];   //[fV0MIs_]
+   Double_t        fV0MIs_fPP[kMaxfV0MIs][3];   //[fV0MIs_]
+   Double_t        fV0MIs_fPM[kMaxfV0MIs][3];   //[fV0MIs_]
+   Double_t        fV0MIs_fXr[kMaxfV0MIs][3];   //[fV0MIs_]
+   Double_t        fV0MIs_fAngle[kMaxfV0MIs][3];   //[fV0MIs_]
+   Double_t        fV0MIs_fRr[kMaxfV0MIs];   //[fV0MIs_]
+   Int_t           fV0MIs_fStatus[kMaxfV0MIs];   //[fV0MIs_]
+   Int_t           fV0MIs_fRow0[kMaxfV0MIs];   //[fV0MIs_]
+   Int_t           fV0MIs_fOrder[kMaxfV0MIs][3];   //[fV0MIs_]
+   Double_t        fV0MIs_fDistNorm[kMaxfV0MIs];   //[fV0MIs_]
+   Double_t        fV0MIs_fDistSigma[kMaxfV0MIs];   //[fV0MIs_]
+   Float_t         fV0MIs_fCausality[kMaxfV0MIs][4];   //[fV0MIs_]
+   Float_t         fV0MIs_fChi2Before[kMaxfV0MIs];   //[fV0MIs_]
+   Float_t         fV0MIs_fNBefore[kMaxfV0MIs];   //[fV0MIs_]
+   Float_t         fV0MIs_fChi2After[kMaxfV0MIs];   //[fV0MIs_]
+   Float_t         fV0MIs_fNAfter[kMaxfV0MIs];   //[fV0MIs_]
+   Float_t         fV0MIs_fPointAngleFi[kMaxfV0MIs];   //[fV0MIs_]
+   Float_t         fV0MIs_fPointAngleTh[kMaxfV0MIs];   //[fV0MIs_]
+   Double_t        fV0MIs_fPointAngle[kMaxfV0MIs];   //[fV0MIs_]
+   Int_t           fCaloClusters_;
+   UInt_t          fCaloClusters_fUniqueID[kMaxfCaloClusters];   //[fCaloClusters_]
+   UInt_t          fCaloClusters_fBits[kMaxfCaloClusters];   //[fCaloClusters_]
+   Int_t           fCaloClusters_fID[kMaxfCaloClusters];   //[fCaloClusters_]
+   Int_t           fCaloClusters_fClusterType[kMaxfCaloClusters];   //[fCaloClusters_]
+   Bool_t          fCaloClusters_fEMCALCluster[kMaxfCaloClusters];   //[fCaloClusters_]
+   Bool_t          fCaloClusters_fPHOSCluster[kMaxfCaloClusters];   //[fCaloClusters_]
+   Float_t         fCaloClusters_fGlobalPos[kMaxfCaloClusters][3];   //[fCaloClusters_]
+   Float_t         fCaloClusters_fEnergy[kMaxfCaloClusters];   //[fCaloClusters_]
+   Float_t         fCaloClusters_fDispersion[kMaxfCaloClusters];   //[fCaloClusters_]
+   Float_t         fCaloClusters_fChi2[kMaxfCaloClusters];   //[fCaloClusters_]
+   Float_t         fCaloClusters_fPID[kMaxfCaloClusters][10];   //[fCaloClusters_]
+   Int_t           fCaloClusters_fPrimaryIndex[kMaxfCaloClusters];   //[fCaloClusters_]
+   Float_t         fCaloClusters_fM20[kMaxfCaloClusters];   //[fCaloClusters_]
+   Float_t         fCaloClusters_fM02[kMaxfCaloClusters];   //[fCaloClusters_]
+   Float_t         fCaloClusters_fM11[kMaxfCaloClusters];   //[fCaloClusters_]
+   UShort_t        fCaloClusters_fNExMax[kMaxfCaloClusters];   //[fCaloClusters_]
+   Float_t         fCaloClusters_fEmcCpvDistance[kMaxfCaloClusters];   //[fCaloClusters_]
+   Int_t           fCaloClusters_fNumberOfDigits[kMaxfCaloClusters];   //[fCaloClusters_]
+   UShort_t       *fCaloClusters_fDigitAmplitude[kMaxfCaloClusters];   //[fCaloClusters_fNumberOfDigits]
+   UShort_t       *fCaloClusters_fDigitTime[kMaxfCaloClusters];   //[fCaloClusters_fNumberOfDigits]
+   UShort_t       *fCaloClusters_fDigitIndex[kMaxfCaloClusters];   //[fCaloClusters_fNumberOfDigits]
+   Int_t           fEMCALClusters;
+   Int_t           fFirstEMCALCluster;
+   Int_t           fPHOSClusters;
+   Int_t           fFirstPHOSCluster;
+
+   // List of branches
+   TBranch        *b_ESD_fUniqueID;   //!
+   TBranch        *b_ESD_fBits;   //!
+   TBranch        *b_ESD_fEventNumber;   //!
+   TBranch        *b_ESD_fRunNumber;   //!
+   TBranch        *b_ESD_fTriggerMask;   //!
+   TBranch        *b_ESD_fTriggerCluster;   //!
+   TBranch        *b_ESD_fRecoVersion;   //!
+   TBranch        *b_ESD_fMagneticField;   //!
+   TBranch        *b_ESD_fZDCN1Energy;   //!
+   TBranch        *b_ESD_fZDCP1Energy;   //!
+   TBranch        *b_ESD_fZDCN2Energy;   //!
+   TBranch        *b_ESD_fZDCP2Energy;   //!
+   TBranch        *b_ESD_fZDCEMEnergy;   //!
+   TBranch        *b_ESD_fZDCParticipants;   //!
+   TBranch        *b_ESD_fT0zVertex;   //!
+   TBranch        *b_ESD_fSPDVertex_fUniqueID;   //!
+   TBranch        *b_ESD_fSPDVertex_fBits;   //!
+   TBranch        *b_ESD_fSPDVertex_fName;   //!
+   TBranch        *b_ESD_fSPDVertex_fTitle;   //!
+   TBranch        *b_ESD_fSPDVertex_fPosition;   //!
+   TBranch        *b_ESD_fSPDVertex_fSigma;   //!
+   TBranch        *b_ESD_fSPDVertex_fNContributors;   //!
+   TBranch        *b_ESD_fSPDVertex_fCovXX;   //!
+   TBranch        *b_ESD_fSPDVertex_fCovXY;   //!
+   TBranch        *b_ESD_fSPDVertex_fCovYY;   //!
+   TBranch        *b_ESD_fSPDVertex_fCovXZ;   //!
+   TBranch        *b_ESD_fSPDVertex_fCovYZ;   //!
+   TBranch        *b_ESD_fSPDVertex_fCovZZ;   //!
+   TBranch        *b_ESD_fSPDVertex_fSNR;   //!
+   TBranch        *b_ESD_fSPDVertex_fChi2;   //!
+   TBranch        *b_ESD_fSPDVertex_fTruePos;   //!
+   TBranch        *b_ESD_fPrimaryVertex_fUniqueID;   //!
+   TBranch        *b_ESD_fPrimaryVertex_fBits;   //!
+   TBranch        *b_ESD_fPrimaryVertex_fName;   //!
+   TBranch        *b_ESD_fPrimaryVertex_fTitle;   //!
+   TBranch        *b_ESD_fPrimaryVertex_fPosition;   //!
+   TBranch        *b_ESD_fPrimaryVertex_fSigma;   //!
+   TBranch        *b_ESD_fPrimaryVertex_fNContributors;   //!
+   TBranch        *b_ESD_fPrimaryVertex_fCovXX;   //!
+   TBranch        *b_ESD_fPrimaryVertex_fCovXY;   //!
+   TBranch        *b_ESD_fPrimaryVertex_fCovYY;   //!
+   TBranch        *b_ESD_fPrimaryVertex_fCovXZ;   //!
+   TBranch        *b_ESD_fPrimaryVertex_fCovYZ;   //!
+   TBranch        *b_ESD_fPrimaryVertex_fCovZZ;   //!
+   TBranch        *b_ESD_fPrimaryVertex_fSNR;   //!
+   TBranch        *b_ESD_fPrimaryVertex_fChi2;   //!
+   TBranch        *b_ESD_fPrimaryVertex_fTruePos;   //!
+   TBranch        *b_ESD_fSPDMult_fUniqueID;   //!
+   TBranch        *b_ESD_fSPDMult_fBits;   //!
+   TBranch        *b_ESD_fSPDMult_fNtracks;   //!
+   TBranch        *b_fSPDMult_fTh;   //!
+   TBranch        *b_fSPDMult_fPhi;   //!
+   TBranch        *b_fSPDMult_fDeltPhi;   //!
+   TBranch        *b_ESD_fT0timeStart;   //!
+   TBranch        *b_ESD_fT0time;   //!
+   TBranch        *b_ESD_fT0amplitude;   //!
+   TBranch        *b_ESD_fTracks_;   //!
+   TBranch        *b_fTracks_fUniqueID;   //!
+   TBranch        *b_fTracks_fBits;   //!
+   TBranch        *b_fTracks_fX;   //!
+   TBranch        *b_fTracks_fAlpha;   //!
+   TBranch        *b_fTracks_fP;   //!
+   TBranch        *b_fTracks_fC;   //!
+   TBranch        *b_fTracks_fFlags;   //!
+   TBranch        *b_fTracks_fLabel;   //!
+   TBranch        *b_fTracks_fID;   //!
+   TBranch        *b_fTracks_fTrackLength;   //!
+   TBranch        *b_fTracks_fD;   //!
+   TBranch        *b_fTracks_fZ;   //!
+   TBranch        *b_fTracks_fCdd;   //!
+   TBranch        *b_fTracks_fCdz;   //!
+   TBranch        *b_fTracks_fCzz;   //!
+   TBranch        *b_fTracks_fTrackTime;   //!
+   TBranch        *b_fTracks_fR;   //!
+   TBranch        *b_fTracks_fStopVertex;   //!
+   TBranch        *b_fTracks_fCchi2;   //!
+   TBranch        *b_fTracks_fITSchi2;   //!
+   TBranch        *b_fTracks_fITSncls;   //!
+   TBranch        *b_fTracks_fITSsignal;   //!
+   TBranch        *b_fTracks_fITSr;   //!
+   TBranch        *b_fTracks_fITSLabel;   //!
+   TBranch        *b_fTracks_fITSFakeRatio;   //!
+   TBranch        *b_fTracks_fTPCchi2;   //!
+   TBranch        *b_fTracks_fTPCncls;   //!
+   TBranch        *b_fTracks_fTPCnclsF;   //!
+   TBranch        *b_fTracks_fTPCClusterMap_fUniqueID;   //!
+   TBranch        *b_fTracks_fTPCClusterMap_fBits;   //!
+   TBranch        *b_fTracks_fTPCClusterMap_fNbits;   //!
+   TBranch        *b_fTracks_fTPCClusterMap_fNbytes;   //!
+   TBranch        *b_fTracks_fTPCClusterMap_fAllBits;   //!
+   TBranch        *b_fTracks_fTPCsignal;   //!
+   TBranch        *b_fTracks_fTPCsignalN;   //!
+   TBranch        *b_fTracks_fTPCsignalS;   //!
+   TBranch        *b_fTracks_fTPCr;   //!
+   TBranch        *b_fTracks_fTPCLabel;   //!
+   TBranch        *b_fTracks_fTPCPoints;   //!
+   TBranch        *b_fTracks_fKinkIndexes;   //!
+   TBranch        *b_fTracks_fV0Indexes;   //!
+   TBranch        *b_fTracks_fTRDchi2;   //!
+   TBranch        *b_fTracks_fTRDncls;   //!
+   TBranch        *b_fTracks_fTRDncls0;   //!
+   TBranch        *b_fTracks_fTRDsignal;   //!
+   TBranch        *b_fTracks_fTRDsignals;   //!
+   TBranch        *b_fTracks_fTRDTimBin;   //!
+   TBranch        *b_fTracks_fTRDr;   //!
+   TBranch        *b_fTracks_fTRDLabel;   //!
+   TBranch        *b_fTracks_fTRDQuality;   //!
+   TBranch        *b_fTracks_fTRDBudget;   //!
+   TBranch        *b_fTracks_fTOFchi2;   //!
+   TBranch        *b_fTracks_fTOFindex;   //!
+   TBranch        *b_fTracks_fTOFCalChannel;   //!
+   TBranch        *b_fTracks_fTOFsignal;   //!
+   TBranch        *b_fTracks_fTOFsignalToT;   //!
+   TBranch        *b_fTracks_fTOFr;   //!
+   TBranch        *b_fTracks_fTOFLabel;   //!
+   TBranch        *b_fTracks_fHMPIDchi2;   //!
+   TBranch        *b_fTracks_fHMPIDncls;   //!
+   TBranch        *b_fTracks_fHMPIDindex;   //!
+   TBranch        *b_fTracks_fHMPIDsignal;   //!
+   TBranch        *b_fTracks_fHMPIDr;   //!
+   TBranch        *b_fTracks_fHMPIDtheta;   //!
+   TBranch        *b_fTracks_fHMPIDphi;   //!
+   TBranch        *b_fTracks_fHMPIDdx;   //!
+   TBranch        *b_fTracks_fHMPIDdy;   //!
+   TBranch        *b_fTracks_fHMPIDmipX;   //!
+   TBranch        *b_fTracks_fHMPIDmipY;   //!
+   TBranch        *b_ESD_fHLTConfMapTracks_;   //!
+   TBranch        *b_fHLTConfMapTracks_fUniqueID;   //!
+   TBranch        *b_fHLTConfMapTracks_fBits;   //!
+   TBranch        *b_fHLTConfMapTracks_fNHits;   //!
+   TBranch        *b_fHLTConfMapTracks_fMCid;   //!
+   TBranch        *b_fHLTConfMapTracks_fWeight;   //!
+   TBranch        *b_fHLTConfMapTracks_fFromMainVertex;   //!
+   TBranch        *b_fHLTConfMapTracks_fRowRange;   //!
+   TBranch        *b_fHLTConfMapTracks_fSector;   //!
+   TBranch        *b_fHLTConfMapTracks_fFirstPoint;   //!
+   TBranch        *b_fHLTConfMapTracks_fLastPoint;   //!
+   TBranch        *b_fHLTConfMapTracks_fQ;   //!
+   TBranch        *b_fHLTConfMapTracks_fTanl;   //!
+   TBranch        *b_fHLTConfMapTracks_fPsi;   //!
+   TBranch        *b_fHLTConfMapTracks_fPt;   //!
+   TBranch        *b_fHLTConfMapTracks_fPterr;   //!
+   TBranch        *b_fHLTConfMapTracks_fPsierr;   //!
+   TBranch        *b_fHLTConfMapTracks_fTanlerr;   //!
+   TBranch        *b_fHLTConfMapTracks_fBinX;   //!
+   TBranch        *b_fHLTConfMapTracks_fBinY;   //!
+   TBranch        *b_fHLTConfMapTracks_fSizeX;   //!
+   TBranch        *b_fHLTConfMapTracks_fSizeY;   //!
+   TBranch        *b_fHLTConfMapTracks_fPID;   //!
+   TBranch        *b_ESD_fHLTHoughTracks_;   //!
+   TBranch        *b_fHLTHoughTracks_fUniqueID;   //!
+   TBranch        *b_fHLTHoughTracks_fBits;   //!
+   TBranch        *b_fHLTHoughTracks_fNHits;   //!
+   TBranch        *b_fHLTHoughTracks_fMCid;   //!
+   TBranch        *b_fHLTHoughTracks_fWeight;   //!
+   TBranch        *b_fHLTHoughTracks_fFromMainVertex;   //!
+   TBranch        *b_fHLTHoughTracks_fRowRange;   //!
+   TBranch        *b_fHLTHoughTracks_fSector;   //!
+   TBranch        *b_fHLTHoughTracks_fFirstPoint;   //!
+   TBranch        *b_fHLTHoughTracks_fLastPoint;   //!
+   TBranch        *b_fHLTHoughTracks_fQ;   //!
+   TBranch        *b_fHLTHoughTracks_fTanl;   //!
+   TBranch        *b_fHLTHoughTracks_fPsi;   //!
+   TBranch        *b_fHLTHoughTracks_fPt;   //!
+   TBranch        *b_fHLTHoughTracks_fPterr;   //!
+   TBranch        *b_fHLTHoughTracks_fPsierr;   //!
+   TBranch        *b_fHLTHoughTracks_fTanlerr;   //!
+   TBranch        *b_fHLTHoughTracks_fBinX;   //!
+   TBranch        *b_fHLTHoughTracks_fBinY;   //!
+   TBranch        *b_fHLTHoughTracks_fSizeX;   //!
+   TBranch        *b_fHLTHoughTracks_fSizeY;   //!
+   TBranch        *b_fHLTHoughTracks_fPID;   //!
+   TBranch        *b_ESD_fMuonTracks_;   //!
+   TBranch        *b_fMuonTracks_fUniqueID;   //!
+   TBranch        *b_fMuonTracks_fBits;   //!
+   TBranch        *b_fMuonTracks_fInverseBendingMomentum;   //!
+   TBranch        *b_fMuonTracks_fThetaX;   //!
+   TBranch        *b_fMuonTracks_fThetaY;   //!
+   TBranch        *b_fMuonTracks_fZ;   //!
+   TBranch        *b_fMuonTracks_fBendingCoor;   //!
+   TBranch        *b_fMuonTracks_fNonBendingCoor;   //!
+   TBranch        *b_fMuonTracks_fChi2;   //!
+   TBranch        *b_fMuonTracks_fNHit;   //!
+   TBranch        *b_fMuonTracks_fMatchTrigger;   //!
+   TBranch        *b_fMuonTracks_fChi2MatchTrigger;   //!
+   TBranch        *b_ESD_fPmdTracks_;   //!
+   TBranch        *b_fPmdTracks_fUniqueID;   //!
+   TBranch        *b_fPmdTracks_fBits;   //!
+   TBranch        *b_fPmdTracks_fDet;   //!
+   TBranch        *b_fPmdTracks_fX;   //!
+   TBranch        *b_fPmdTracks_fY;   //!
+   TBranch        *b_fPmdTracks_fZ;   //!
+   TBranch        *b_fPmdTracks_fCluADC;   //!
+   TBranch        *b_fPmdTracks_fNcell;   //!
+   TBranch        *b_fPmdTracks_fCluPID;   //!
+   TBranch        *b_ESD_fTrdTracks_;   //!
+   TBranch        *b_fTrdTracks_fUniqueID;   //!
+   TBranch        *b_fTrdTracks_fBits;   //!
+   TBranch        *b_fTrdTracks_fYproj;   //!
+   TBranch        *b_fTrdTracks_fZproj;   //!
+   TBranch        *b_fTrdTracks_fSlope;   //!
+   TBranch        *b_fTrdTracks_fDetector;   //!
+   TBranch        *b_fTrdTracks_fNtracklets;   //!
+   TBranch        *b_fTrdTracks_fNplanes;   //!
+   TBranch        *b_fTrdTracks_fNclusters;   //!
+   TBranch        *b_fTrdTracks_fPt;   //!
+   TBranch        *b_fTrdTracks_fPhi;   //!
+   TBranch        *b_fTrdTracks_fEta;   //!
+   TBranch        *b_fTrdTracks_fLabel;   //!
+   TBranch        *b_fTrdTracks_fPID;   //!
+   TBranch        *b_fTrdTracks_fIsElectron;   //!
+   TBranch        *b_ESD_fV0s_;   //!
+   TBranch        *b_fV0s_fUniqueID;   //!
+   TBranch        *b_fV0s_fBits;   //!
+   TBranch        *b_fV0s_fPdgCode;   //!
+   TBranch        *b_fV0s_fEffMass;   //!
+   TBranch        *b_fV0s_fDcaDaughters;   //!
+   TBranch        *b_fV0s_fChi2;   //!
+   TBranch        *b_fV0s_fPos;   //!
+   TBranch        *b_fV0s_fPosCov;   //!
+   TBranch        *b_fV0s_fNidx;   //!
+   TBranch        *b_fV0s_fNmom;   //!
+   TBranch        *b_fV0s_fNmomCov;   //!
+   TBranch        *b_fV0s_fPidx;   //!
+   TBranch        *b_fV0s_fPmom;   //!
+   TBranch        *b_fV0s_fPmomCov;   //!
+   TBranch        *b_ESD_fCascades_;   //!
+   TBranch        *b_fCascades_fUniqueID;   //!
+   TBranch        *b_fCascades_fBits;   //!
+   TBranch        *b_fCascades_fPdgCode;   //!
+   TBranch        *b_fCascades_fEffMass;   //!
+   TBranch        *b_fCascades_fChi2;   //!
+   TBranch        *b_fCascades_fPos;   //!
+   TBranch        *b_fCascades_fPosCov;   //!
+   TBranch        *b_fCascades_fV0idx;   //!
+   TBranch        *b_fCascades_fV0mom;   //!
+   TBranch        *b_fCascades_fV0momCov;   //!
+   TBranch        *b_fCascades_fBachIdx;   //!
+   TBranch        *b_fCascades_fBachMom;   //!
+   TBranch        *b_fCascades_fBachMomCov;   //!
+   TBranch        *b_ESD_fKinks_;   //!
+   TBranch        *b_fKinks_fUniqueID;   //!
+   TBranch        *b_fKinks_fBits;   //!
+   TBranch        *b_fKinks_fID;   //!
+   TBranch        *b_fKinks_fParamDaughter_fUniqueID;   //!
+   TBranch        *b_fKinks_fParamDaughter_fBits;   //!
+   TBranch        *b_fKinks_fParamDaughter_fX;   //!
+   TBranch        *b_fKinks_fParamDaughter_fAlpha;   //!
+   TBranch        *b_fKinks_fParamDaughter_fP;   //!
+   TBranch        *b_fKinks_fParamDaughter_fC;   //!
+   TBranch        *b_fKinks_fParamMother_fUniqueID;   //!
+   TBranch        *b_fKinks_fParamMother_fBits;   //!
+   TBranch        *b_fKinks_fParamMother_fX;   //!
+   TBranch        *b_fKinks_fParamMother_fAlpha;   //!
+   TBranch        *b_fKinks_fParamMother_fP;   //!
+   TBranch        *b_fKinks_fParamMother_fC;   //!
+   TBranch        *b_fKinks_fDist1;   //!
+   TBranch        *b_fKinks_fDist2;   //!
+   TBranch        *b_fKinks_fPdr;   //!
+   TBranch        *b_fKinks_fXr;   //!
+   TBranch        *b_fKinks_fPm;   //!
+   TBranch        *b_fKinks_fAngle;   //!
+   TBranch        *b_fKinks_fRr;   //!
+   TBranch        *b_fKinks_fLab;   //!
+   TBranch        *b_fKinks_fIndex;   //!
+   TBranch        *b_fKinks_fStatus;   //!
+   TBranch        *b_fKinks_fTPCdensity;   //!
+   TBranch        *b_fKinks_fTPCdensity2;   //!
+   TBranch        *b_fKinks_fShapeFactor;   //!
+   TBranch        *b_fKinks_fRow0;   //!
+   TBranch        *b_fKinks_fMultiple;   //!
+   TBranch        *b_fKinks_fTPCncls;   //!
+   TBranch        *b_ESD_fV0MIs_;   //!
+   TBranch        *b_fV0MIs_fUniqueID;   //!
+   TBranch        *b_fV0MIs_fBits;   //!
+   TBranch        *b_fV0MIs_fPdgCode;   //!
+   TBranch        *b_fV0MIs_fEffMass;   //!
+   TBranch        *b_fV0MIs_fDcaDaughters;   //!
+   TBranch        *b_fV0MIs_fChi2;   //!
+   TBranch        *b_fV0MIs_fPos;   //!
+   TBranch        *b_fV0MIs_fPosCov;   //!
+   TBranch        *b_fV0MIs_fNidx;   //!
+   TBranch        *b_fV0MIs_fNmom;   //!
+   TBranch        *b_fV0MIs_fNmomCov;   //!
+   TBranch        *b_fV0MIs_fPidx;   //!
+   TBranch        *b_fV0MIs_fPmom;   //!
+   TBranch        *b_fV0MIs_fPmomCov;   //!
+   TBranch        *b_fV0MIs_fParamP_fUniqueID;   //!
+   TBranch        *b_fV0MIs_fParamP_fBits;   //!
+   TBranch        *b_fV0MIs_fParamP_fX;   //!
+   TBranch        *b_fV0MIs_fParamP_fAlpha;   //!
+   TBranch        *b_fV0MIs_fParamP_fP;   //!
+   TBranch        *b_fV0MIs_fParamP_fC;   //!
+   TBranch        *b_fV0MIs_fParamM_fUniqueID;   //!
+   TBranch        *b_fV0MIs_fParamM_fBits;   //!
+   TBranch        *b_fV0MIs_fParamM_fX;   //!
+   TBranch        *b_fV0MIs_fParamM_fAlpha;   //!
+   TBranch        *b_fV0MIs_fParamM_fP;   //!
+   TBranch        *b_fV0MIs_fParamM_fC;   //!
+   TBranch        *b_fV0MIs_fRP;   //!
+   TBranch        *b_fV0MIs_fRM;   //!
+   TBranch        *b_fV0MIs_fID;   //!
+   TBranch        *b_fV0MIs_fLab;   //!
+   TBranch        *b_fV0MIs_fIndex;   //!
+   TBranch        *b_fV0MIs_fNormDCAPrim;   //!
+   TBranch        *b_fV0MIs_fDist1;   //!
+   TBranch        *b_fV0MIs_fDist2;   //!
+   TBranch        *b_fV0MIs_fPP;   //!
+   TBranch        *b_fV0MIs_fPM;   //!
+   TBranch        *b_fV0MIs_fXr;   //!
+   TBranch        *b_fV0MIs_fAngle;   //!
+   TBranch        *b_fV0MIs_fRr;   //!
+   TBranch        *b_fV0MIs_fStatus;   //!
+   TBranch        *b_fV0MIs_fRow0;   //!
+   TBranch        *b_fV0MIs_fOrder;   //!
+   TBranch        *b_fV0MIs_fDistNorm;   //!
+   TBranch        *b_fV0MIs_fDistSigma;   //!
+   TBranch        *b_fV0MIs_fCausality;   //!
+   TBranch        *b_fV0MIs_fChi2Before;   //!
+   TBranch        *b_fV0MIs_fNBefore;   //!
+   TBranch        *b_fV0MIs_fChi2After;   //!
+   TBranch        *b_fV0MIs_fNAfter;   //!
+   TBranch        *b_fV0MIs_fPointAngleFi;   //!
+   TBranch        *b_fV0MIs_fPointAngleTh;   //!
+   TBranch        *b_fV0MIs_fPointAngle;   //!
+   TBranch        *b_ESD_fCaloClusters_;   //!
+   TBranch        *b_fCaloClusters_fUniqueID;   //!
+   TBranch        *b_fCaloClusters_fBits;   //!
+   TBranch        *b_fCaloClusters_fID;   //!
+   TBranch        *b_fCaloClusters_fClusterType;   //!
+   TBranch        *b_fCaloClusters_fEMCALCluster;   //!
+   TBranch        *b_fCaloClusters_fPHOSCluster;   //!
+   TBranch        *b_fCaloClusters_fGlobalPos;   //!
+   TBranch        *b_fCaloClusters_fEnergy;   //!
+   TBranch        *b_fCaloClusters_fDispersion;   //!
+   TBranch        *b_fCaloClusters_fChi2;   //!
+   TBranch        *b_fCaloClusters_fPID;   //!
+   TBranch        *b_fCaloClusters_fPrimaryIndex;   //!
+   TBranch        *b_fCaloClusters_fM20;   //!
+   TBranch        *b_fCaloClusters_fM02;   //!
+   TBranch        *b_fCaloClusters_fM11;   //!
+   TBranch        *b_fCaloClusters_fNExMax;   //!
+   TBranch        *b_fCaloClusters_fEmcCpvDistance;   //!
+   TBranch        *b_fCaloClusters_fNumberOfDigits;   //!
+   TBranch        *b_fCaloClusters_fDigitAmplitude;   //!
+   TBranch        *b_fCaloClusters_fDigitTime;   //!
+   TBranch        *b_fCaloClusters_fDigitIndex;   //!
+   TBranch        *b_ESD_fEMCALClusters;   //!
+   TBranch        *b_ESD_fFirstEMCALCluster;   //!
+   TBranch        *b_ESD_fPHOSClusters;   //!
+   TBranch        *b_ESD_fFirstPHOSCluster;   //!
+
+   esdAna(TTree *tree=0) { }
+   virtual ~esdAna() { }
+   virtual Int_t   Version() const { return 1; }
+   virtual void    Begin(TTree *tree);
+   virtual void    SlaveBegin(TTree *tree);
+   virtual void    Init(TTree *tree);
+   virtual Bool_t  Notify();
+   virtual Bool_t  Process(Long64_t entry);
+   virtual void    SetOption(const char *option) { fOption = option; }
+   virtual void    SetObject(TObject *obj) { fObject = obj; }
+   virtual void    SetInputList(TList *input) { fInput = input; }
+   virtual TList  *GetOutputList() const { return fOutput; }
+   virtual void    SlaveTerminate();
+   virtual void    Terminate();
+
+   TH1F* h1;
+   TH1F* h2;
+   TH1F* h3;
+   TFile* hfile;
+   ClassDef(esdAna,0);
+};
+
+#endif
+
+#ifdef esdAna_cxx
+void esdAna::Init(TTree *tree)
+{
+   // The Init() function is called when the selector needs to initialize
+   // a new tree or chain. Typically here the branch addresses of the tree
+   // will be set. It is normaly not necessary to make changes to the
+   // generated code, but the routine can be extended by the user if needed.
+   // Init() will be called many times when running with PROOF.
+
+   // Set branch addresses
+   if (tree == 0) return;
+   fChain = tree;
+   fChain->SetMakeClass(1);
+
+   fChain->SetBranchAddress("fUniqueID",&fUniqueID);
+   fChain->SetBranchAddress("fBits",&fBits);
+   fChain->SetBranchAddress("fEventNumber",&fEventNumber);
+   fChain->SetBranchAddress("fRunNumber",&fRunNumber);
+   fChain->SetBranchAddress("fTriggerMask",&fTriggerMask);
+   fChain->SetBranchAddress("fTriggerCluster",&fTriggerCluster);
+   fChain->SetBranchAddress("fRecoVersion",&fRecoVersion);
+   fChain->SetBranchAddress("fMagneticField",&fMagneticField);
+   fChain->SetBranchAddress("fZDCN1Energy",&fZDCN1Energy);
+   fChain->SetBranchAddress("fZDCP1Energy",&fZDCP1Energy);
+   fChain->SetBranchAddress("fZDCN2Energy",&fZDCN2Energy);
+   fChain->SetBranchAddress("fZDCP2Energy",&fZDCP2Energy);
+   fChain->SetBranchAddress("fZDCEMEnergy",&fZDCEMEnergy);
+   fChain->SetBranchAddress("fZDCParticipants",&fZDCParticipants);
+   fChain->SetBranchAddress("fT0zVertex",&fT0zVertex);
+   fChain->SetBranchAddress("fSPDVertex.fUniqueID",&fSPDVertex_fUniqueID);
+   fChain->SetBranchAddress("fSPDVertex.fBits",&fSPDVertex_fBits);
+   fChain->SetBranchAddress("fSPDVertex.fName",&fSPDVertex_fName);
+   fChain->SetBranchAddress("fSPDVertex.fTitle",&fSPDVertex_fTitle);
+   fChain->SetBranchAddress("fSPDVertex.fPosition[3]",fSPDVertex_fPosition);
+   fChain->SetBranchAddress("fSPDVertex.fSigma",&fSPDVertex_fSigma);
+   fChain->SetBranchAddress("fSPDVertex.fNContributors",&fSPDVertex_fNContributors);
+   fChain->SetBranchAddress("fSPDVertex.fCovXX",&fSPDVertex_fCovXX);
+   fChain->SetBranchAddress("fSPDVertex.fCovXY",&fSPDVertex_fCovXY);
+   fChain->SetBranchAddress("fSPDVertex.fCovYY",&fSPDVertex_fCovYY);
+   fChain->SetBranchAddress("fSPDVertex.fCovXZ",&fSPDVertex_fCovXZ);
+   fChain->SetBranchAddress("fSPDVertex.fCovYZ",&fSPDVertex_fCovYZ);
+   fChain->SetBranchAddress("fSPDVertex.fCovZZ",&fSPDVertex_fCovZZ);
+   fChain->SetBranchAddress("fSPDVertex.fSNR[3]",fSPDVertex_fSNR);
+   fChain->SetBranchAddress("fSPDVertex.fChi2",&fSPDVertex_fChi2);
+   fChain->SetBranchAddress("fSPDVertex.fTruePos[3]",fSPDVertex_fTruePos);
+   fChain->SetBranchAddress("fPrimaryVertex.fUniqueID",&fPrimaryVertex_fUniqueID);
+   fChain->SetBranchAddress("fPrimaryVertex.fBits",&fPrimaryVertex_fBits);
+   fChain->SetBranchAddress("fPrimaryVertex.fName",&fPrimaryVertex_fName);
+   fChain->SetBranchAddress("fPrimaryVertex.fTitle",&fPrimaryVertex_fTitle);
+   fChain->SetBranchAddress("fPrimaryVertex.fPosition[3]",fPrimaryVertex_fPosition);
+   fChain->SetBranchAddress("fPrimaryVertex.fSigma",&fPrimaryVertex_fSigma);
+   fChain->SetBranchAddress("fPrimaryVertex.fNContributors",&fPrimaryVertex_fNContributors);
+   fChain->SetBranchAddress("fPrimaryVertex.fCovXX",&fPrimaryVertex_fCovXX);
+   fChain->SetBranchAddress("fPrimaryVertex.fCovXY",&fPrimaryVertex_fCovXY);
+   fChain->SetBranchAddress("fPrimaryVertex.fCovYY",&fPrimaryVertex_fCovYY);
+   fChain->SetBranchAddress("fPrimaryVertex.fCovXZ",&fPrimaryVertex_fCovXZ);
+   fChain->SetBranchAddress("fPrimaryVertex.fCovYZ",&fPrimaryVertex_fCovYZ);
+   fChain->SetBranchAddress("fPrimaryVertex.fCovZZ",&fPrimaryVertex_fCovZZ);
+   fChain->SetBranchAddress("fPrimaryVertex.fSNR[3]",fPrimaryVertex_fSNR);
+   fChain->SetBranchAddress("fPrimaryVertex.fChi2",&fPrimaryVertex_fChi2);
+   fChain->SetBranchAddress("fPrimaryVertex.fTruePos[3]",fPrimaryVertex_fTruePos);
+   fChain->SetBranchAddress("fSPDMult.fUniqueID",&fSPDMult_fUniqueID);
+   fChain->SetBranchAddress("fSPDMult.fBits",&fSPDMult_fBits);
+   fChain->SetBranchAddress("fSPDMult.fNtracks",&fSPDMult_fNtracks);
+   fChain->SetBranchAddress("fSPDMult.fTh",fSPDMult_fTh);
+   fChain->SetBranchAddress("fSPDMult.fPhi",fSPDMult_fPhi);
+   fChain->SetBranchAddress("fSPDMult.fDeltPhi",fSPDMult_fDeltPhi);
+   fChain->SetBranchAddress("fT0timeStart",&fT0timeStart);
+   fChain->SetBranchAddress("fT0time[24]",fT0time);
+   fChain->SetBranchAddress("fT0amplitude[24]",fT0amplitude);
+   fChain->SetBranchAddress("fTracks",&fTracks_);
+   fChain->SetBranchAddress("fTracks.fUniqueID",fTracks_fUniqueID);
+   fChain->SetBranchAddress("fTracks.fBits",fTracks_fBits);
+   fChain->SetBranchAddress("fTracks.fX",fTracks_fX);
+   fChain->SetBranchAddress("fTracks.fAlpha",fTracks_fAlpha);
+   fChain->SetBranchAddress("fTracks.fP[5]",fTracks_fP);
+   fChain->SetBranchAddress("fTracks.fC[15]",fTracks_fC);
+   fChain->SetBranchAddress("fTracks.fFlags",fTracks_fFlags);
+   fChain->SetBranchAddress("fTracks.fLabel",fTracks_fLabel);
+   fChain->SetBranchAddress("fTracks.fID",fTracks_fID);
+   fChain->SetBranchAddress("fTracks.fTrackLength",fTracks_fTrackLength);
+   fChain->SetBranchAddress("fTracks.fD",fTracks_fD);
+   fChain->SetBranchAddress("fTracks.fZ",fTracks_fZ);
+   fChain->SetBranchAddress("fTracks.fCdd",fTracks_fCdd);
+   fChain->SetBranchAddress("fTracks.fCdz",fTracks_fCdz);
+   fChain->SetBranchAddress("fTracks.fCzz",fTracks_fCzz);
+   fChain->SetBranchAddress("fTracks.fTrackTime[5]",fTracks_fTrackTime);
+   fChain->SetBranchAddress("fTracks.fR[5]",fTracks_fR);
+   fChain->SetBranchAddress("fTracks.fStopVertex",fTracks_fStopVertex);
+   fChain->SetBranchAddress("fTracks.fCchi2",fTracks_fCchi2);
+   fChain->SetBranchAddress("fTracks.fITSchi2",fTracks_fITSchi2);
+   fChain->SetBranchAddress("fTracks.fITSncls",fTracks_fITSncls);
+   fChain->SetBranchAddress("fTracks.fITSsignal",fTracks_fITSsignal);
+   fChain->SetBranchAddress("fTracks.fITSr[5]",fTracks_fITSr);
+   fChain->SetBranchAddress("fTracks.fITSLabel",fTracks_fITSLabel);
+   fChain->SetBranchAddress("fTracks.fITSFakeRatio",fTracks_fITSFakeRatio);
+   fChain->SetBranchAddress("fTracks.fTPCchi2",fTracks_fTPCchi2);
+   fChain->SetBranchAddress("fTracks.fTPCncls",fTracks_fTPCncls);
+   fChain->SetBranchAddress("fTracks.fTPCnclsF",fTracks_fTPCnclsF);
+   fChain->SetBranchAddress("fTracks.fTPCClusterMap.fUniqueID",fTracks_fTPCClusterMap_fUniqueID);
+   fChain->SetBranchAddress("fTracks.fTPCClusterMap.fBits",fTracks_fTPCClusterMap_fBits);
+   fChain->SetBranchAddress("fTracks.fTPCClusterMap.fNbits",fTracks_fTPCClusterMap_fNbits);
+   fChain->SetBranchAddress("fTracks.fTPCClusterMap.fNbytes",fTracks_fTPCClusterMap_fNbytes);
+   fChain->SetBranchAddress("fTracks.fTPCClusterMap.fAllBits",fTracks_fTPCClusterMap_fAllBits);
+   fChain->SetBranchAddress("fTracks.fTPCsignal",fTracks_fTPCsignal);
+   fChain->SetBranchAddress("fTracks.fTPCsignalN",fTracks_fTPCsignalN);
+   fChain->SetBranchAddress("fTracks.fTPCsignalS",fTracks_fTPCsignalS);
+   fChain->SetBranchAddress("fTracks.fTPCr[5]",fTracks_fTPCr);
+   fChain->SetBranchAddress("fTracks.fTPCLabel",fTracks_fTPCLabel);
+   fChain->SetBranchAddress("fTracks.fTPCPoints[4]",fTracks_fTPCPoints);
+   fChain->SetBranchAddress("fTracks.fKinkIndexes[3]",fTracks_fKinkIndexes);
+   fChain->SetBranchAddress("fTracks.fV0Indexes[3]",fTracks_fV0Indexes);
+   fChain->SetBranchAddress("fTracks.fTRDchi2",fTracks_fTRDchi2);
+   fChain->SetBranchAddress("fTracks.fTRDncls",fTracks_fTRDncls);
+   fChain->SetBranchAddress("fTracks.fTRDncls0",fTracks_fTRDncls0);
+   fChain->SetBranchAddress("fTracks.fTRDsignal",fTracks_fTRDsignal);
+   fChain->SetBranchAddress("fTracks.fTRDsignals[6][3]",fTracks_fTRDsignals);
+   fChain->SetBranchAddress("fTracks.fTRDTimBin[6]",fTracks_fTRDTimBin);
+   fChain->SetBranchAddress("fTracks.fTRDr[5]",fTracks_fTRDr);
+   fChain->SetBranchAddress("fTracks.fTRDLabel",fTracks_fTRDLabel);
+   fChain->SetBranchAddress("fTracks.fTRDQuality",fTracks_fTRDQuality);
+   fChain->SetBranchAddress("fTracks.fTRDBudget",fTracks_fTRDBudget);
+   fChain->SetBranchAddress("fTracks.fTOFchi2",fTracks_fTOFchi2);
+   fChain->SetBranchAddress("fTracks.fTOFindex",fTracks_fTOFindex);
+   fChain->SetBranchAddress("fTracks.fTOFCalChannel",fTracks_fTOFCalChannel);
+   fChain->SetBranchAddress("fTracks.fTOFsignal",fTracks_fTOFsignal);
+   fChain->SetBranchAddress("fTracks.fTOFsignalToT",fTracks_fTOFsignalToT);
+   fChain->SetBranchAddress("fTracks.fTOFr[5]",fTracks_fTOFr);
+   fChain->SetBranchAddress("fTracks.fTOFLabel[3]",fTracks_fTOFLabel);
+   fChain->SetBranchAddress("fTracks.fHMPIDchi2",fTracks_fHMPIDchi2);
+   fChain->SetBranchAddress("fTracks.fHMPIDncls",fTracks_fHMPIDncls);
+   fChain->SetBranchAddress("fTracks.fHMPIDindex",fTracks_fHMPIDindex);
+   fChain->SetBranchAddress("fTracks.fHMPIDsignal",fTracks_fHMPIDsignal);
+   fChain->SetBranchAddress("fTracks.fHMPIDr[5]",fTracks_fHMPIDr);
+   fChain->SetBranchAddress("fTracks.fHMPIDtheta",fTracks_fHMPIDtheta);
+   fChain->SetBranchAddress("fTracks.fHMPIDphi",fTracks_fHMPIDphi);
+   fChain->SetBranchAddress("fTracks.fHMPIDdx",fTracks_fHMPIDdx);
+   fChain->SetBranchAddress("fTracks.fHMPIDdy",fTracks_fHMPIDdy);
+   fChain->SetBranchAddress("fTracks.fHMPIDmipX",fTracks_fHMPIDmipX);
+   fChain->SetBranchAddress("fTracks.fHMPIDmipY",fTracks_fHMPIDmipY);
+   fChain->SetBranchAddress("fHLTConfMapTracks",&fHLTConfMapTracks_);
+   fChain->SetBranchAddress("fHLTConfMapTracks.fUniqueID",fHLTConfMapTracks_fUniqueID);
+   fChain->SetBranchAddress("fHLTConfMapTracks.fBits",fHLTConfMapTracks_fBits);
+   fChain->SetBranchAddress("fHLTConfMapTracks.fNHits",fHLTConfMapTracks_fNHits);
+   fChain->SetBranchAddress("fHLTConfMapTracks.fMCid",fHLTConfMapTracks_fMCid);
+   fChain->SetBranchAddress("fHLTConfMapTracks.fWeight",fHLTConfMapTracks_fWeight);
+   fChain->SetBranchAddress("fHLTConfMapTracks.fFromMainVertex",fHLTConfMapTracks_fFromMainVertex);
+   fChain->SetBranchAddress("fHLTConfMapTracks.fRowRange[2]",fHLTConfMapTracks_fRowRange);
+   fChain->SetBranchAddress("fHLTConfMapTracks.fSector",fHLTConfMapTracks_fSector);
+   fChain->SetBranchAddress("fHLTConfMapTracks.fFirstPoint[3]",fHLTConfMapTracks_fFirstPoint);
+   fChain->SetBranchAddress("fHLTConfMapTracks.fLastPoint[3]",fHLTConfMapTracks_fLastPoint);
+   fChain->SetBranchAddress("fHLTConfMapTracks.fQ",fHLTConfMapTracks_fQ);
+   fChain->SetBranchAddress("fHLTConfMapTracks.fTanl",fHLTConfMapTracks_fTanl);
+   fChain->SetBranchAddress("fHLTConfMapTracks.fPsi",fHLTConfMapTracks_fPsi);
+   fChain->SetBranchAddress("fHLTConfMapTracks.fPt",fHLTConfMapTracks_fPt);
+   fChain->SetBranchAddress("fHLTConfMapTracks.fPterr",fHLTConfMapTracks_fPterr);
+   fChain->SetBranchAddress("fHLTConfMapTracks.fPsierr",fHLTConfMapTracks_fPsierr);
+   fChain->SetBranchAddress("fHLTConfMapTracks.fTanlerr",fHLTConfMapTracks_fTanlerr);
+   fChain->SetBranchAddress("fHLTConfMapTracks.fBinX",fHLTConfMapTracks_fBinX);
+   fChain->SetBranchAddress("fHLTConfMapTracks.fBinY",fHLTConfMapTracks_fBinY);
+   fChain->SetBranchAddress("fHLTConfMapTracks.fSizeX",fHLTConfMapTracks_fSizeX);
+   fChain->SetBranchAddress("fHLTConfMapTracks.fSizeY",fHLTConfMapTracks_fSizeY);
+   fChain->SetBranchAddress("fHLTConfMapTracks.fPID",fHLTConfMapTracks_fPID);
+   fChain->SetBranchAddress("fHLTHoughTracks",&fHLTHoughTracks_);
+   fChain->SetBranchAddress("fHLTHoughTracks.fUniqueID",&fHLTHoughTracks_fUniqueID);
+   fChain->SetBranchAddress("fHLTHoughTracks.fBits",&fHLTHoughTracks_fBits);
+   fChain->SetBranchAddress("fHLTHoughTracks.fNHits",&fHLTHoughTracks_fNHits);
+   fChain->SetBranchAddress("fHLTHoughTracks.fMCid",&fHLTHoughTracks_fMCid);
+   fChain->SetBranchAddress("fHLTHoughTracks.fWeight",&fHLTHoughTracks_fWeight);
+   fChain->SetBranchAddress("fHLTHoughTracks.fFromMainVertex",&fHLTHoughTracks_fFromMainVertex);
+   fChain->SetBranchAddress("fHLTHoughTracks.fRowRange[2]",&fHLTHoughTracks_fRowRange);
+   fChain->SetBranchAddress("fHLTHoughTracks.fSector",&fHLTHoughTracks_fSector);
+   fChain->SetBranchAddress("fHLTHoughTracks.fFirstPoint[3]",&fHLTHoughTracks_fFirstPoint);
+   fChain->SetBranchAddress("fHLTHoughTracks.fLastPoint[3]",&fHLTHoughTracks_fLastPoint);
+   fChain->SetBranchAddress("fHLTHoughTracks.fQ",&fHLTHoughTracks_fQ);
+   fChain->SetBranchAddress("fHLTHoughTracks.fTanl",&fHLTHoughTracks_fTanl);
+   fChain->SetBranchAddress("fHLTHoughTracks.fPsi",&fHLTHoughTracks_fPsi);
+   fChain->SetBranchAddress("fHLTHoughTracks.fPt",&fHLTHoughTracks_fPt);
+   fChain->SetBranchAddress("fHLTHoughTracks.fPterr",&fHLTHoughTracks_fPterr);
+   fChain->SetBranchAddress("fHLTHoughTracks.fPsierr",&fHLTHoughTracks_fPsierr);
+   fChain->SetBranchAddress("fHLTHoughTracks.fTanlerr",&fHLTHoughTracks_fTanlerr);
+   fChain->SetBranchAddress("fHLTHoughTracks.fBinX",&fHLTHoughTracks_fBinX);
+   fChain->SetBranchAddress("fHLTHoughTracks.fBinY",&fHLTHoughTracks_fBinY);
+   fChain->SetBranchAddress("fHLTHoughTracks.fSizeX",&fHLTHoughTracks_fSizeX);
+   fChain->SetBranchAddress("fHLTHoughTracks.fSizeY",&fHLTHoughTracks_fSizeY);
+   fChain->SetBranchAddress("fHLTHoughTracks.fPID",&fHLTHoughTracks_fPID);
+   fChain->SetBranchAddress("fMuonTracks",&fMuonTracks_);
+   fChain->SetBranchAddress("fMuonTracks.fUniqueID",&fMuonTracks_fUniqueID);
+   fChain->SetBranchAddress("fMuonTracks.fBits",&fMuonTracks_fBits);
+   fChain->SetBranchAddress("fMuonTracks.fInverseBendingMomentum",&fMuonTracks_fInverseBendingMomentum);
+   fChain->SetBranchAddress("fMuonTracks.fThetaX",&fMuonTracks_fThetaX);
+   fChain->SetBranchAddress("fMuonTracks.fThetaY",&fMuonTracks_fThetaY);
+   fChain->SetBranchAddress("fMuonTracks.fZ",&fMuonTracks_fZ);
+   fChain->SetBranchAddress("fMuonTracks.fBendingCoor",&fMuonTracks_fBendingCoor);
+   fChain->SetBranchAddress("fMuonTracks.fNonBendingCoor",&fMuonTracks_fNonBendingCoor);
+   fChain->SetBranchAddress("fMuonTracks.fChi2",&fMuonTracks_fChi2);
+   fChain->SetBranchAddress("fMuonTracks.fNHit",&fMuonTracks_fNHit);
+   fChain->SetBranchAddress("fMuonTracks.fMatchTrigger",&fMuonTracks_fMatchTrigger);
+   fChain->SetBranchAddress("fMuonTracks.fChi2MatchTrigger",&fMuonTracks_fChi2MatchTrigger);
+   fChain->SetBranchAddress("fPmdTracks",&fPmdTracks_);
+   fChain->SetBranchAddress("fPmdTracks.fUniqueID",&fPmdTracks_fUniqueID);
+   fChain->SetBranchAddress("fPmdTracks.fBits",&fPmdTracks_fBits);
+   fChain->SetBranchAddress("fPmdTracks.fDet",&fPmdTracks_fDet);
+   fChain->SetBranchAddress("fPmdTracks.fX",&fPmdTracks_fX);
+   fChain->SetBranchAddress("fPmdTracks.fY",&fPmdTracks_fY);
+   fChain->SetBranchAddress("fPmdTracks.fZ",&fPmdTracks_fZ);
+   fChain->SetBranchAddress("fPmdTracks.fCluADC",&fPmdTracks_fCluADC);
+   fChain->SetBranchAddress("fPmdTracks.fNcell",&fPmdTracks_fNcell);
+   fChain->SetBranchAddress("fPmdTracks.fCluPID",&fPmdTracks_fCluPID);
+   fChain->SetBranchAddress("fTrdTracks",&fTrdTracks_);
+   fChain->SetBranchAddress("fTrdTracks.fUniqueID",&fTrdTracks_fUniqueID);
+   fChain->SetBranchAddress("fTrdTracks.fBits",&fTrdTracks_fBits);
+   fChain->SetBranchAddress("fTrdTracks.fYproj",&fTrdTracks_fYproj);
+   fChain->SetBranchAddress("fTrdTracks.fZproj",&fTrdTracks_fZproj);
+   fChain->SetBranchAddress("fTrdTracks.fSlope",&fTrdTracks_fSlope);
+   fChain->SetBranchAddress("fTrdTracks.fDetector",&fTrdTracks_fDetector);
+   fChain->SetBranchAddress("fTrdTracks.fNtracklets",&fTrdTracks_fNtracklets);
+   fChain->SetBranchAddress("fTrdTracks.fNplanes",&fTrdTracks_fNplanes);
+   fChain->SetBranchAddress("fTrdTracks.fNclusters",&fTrdTracks_fNclusters);
+   fChain->SetBranchAddress("fTrdTracks.fPt",&fTrdTracks_fPt);
+   fChain->SetBranchAddress("fTrdTracks.fPhi",&fTrdTracks_fPhi);
+   fChain->SetBranchAddress("fTrdTracks.fEta",&fTrdTracks_fEta);
+   fChain->SetBranchAddress("fTrdTracks.fLabel",&fTrdTracks_fLabel);
+   fChain->SetBranchAddress("fTrdTracks.fPID",&fTrdTracks_fPID);
+   fChain->SetBranchAddress("fTrdTracks.fIsElectron",&fTrdTracks_fIsElectron);
+   fChain->SetBranchAddress("fV0s",&fV0s_);
+   fChain->SetBranchAddress("fV0s.fUniqueID",fV0s_fUniqueID);
+   fChain->SetBranchAddress("fV0s.fBits",fV0s_fBits);
+   fChain->SetBranchAddress("fV0s.fPdgCode",fV0s_fPdgCode);
+   fChain->SetBranchAddress("fV0s.fEffMass",fV0s_fEffMass);
+   fChain->SetBranchAddress("fV0s.fDcaDaughters",fV0s_fDcaDaughters);
+   fChain->SetBranchAddress("fV0s.fChi2",fV0s_fChi2);
+   fChain->SetBranchAddress("fV0s.fPos[3]",fV0s_fPos);
+   fChain->SetBranchAddress("fV0s.fPosCov[6]",fV0s_fPosCov);
+   fChain->SetBranchAddress("fV0s.fNidx",fV0s_fNidx);
+   fChain->SetBranchAddress("fV0s.fNmom[3]",fV0s_fNmom);
+   fChain->SetBranchAddress("fV0s.fNmomCov[6]",fV0s_fNmomCov);
+   fChain->SetBranchAddress("fV0s.fPidx",fV0s_fPidx);
+   fChain->SetBranchAddress("fV0s.fPmom[3]",fV0s_fPmom);
+   fChain->SetBranchAddress("fV0s.fPmomCov[6]",fV0s_fPmomCov);
+   fChain->SetBranchAddress("fCascades",&fCascades_);
+   fChain->SetBranchAddress("fCascades.fUniqueID",&fCascades_fUniqueID);
+   fChain->SetBranchAddress("fCascades.fBits",&fCascades_fBits);
+   fChain->SetBranchAddress("fCascades.fPdgCode",&fCascades_fPdgCode);
+   fChain->SetBranchAddress("fCascades.fEffMass",&fCascades_fEffMass);
+   fChain->SetBranchAddress("fCascades.fChi2",&fCascades_fChi2);
+   fChain->SetBranchAddress("fCascades.fPos[3]",&fCascades_fPos);
+   fChain->SetBranchAddress("fCascades.fPosCov[6]",&fCascades_fPosCov);
+   fChain->SetBranchAddress("fCascades.fV0idx[2]",&fCascades_fV0idx);
+   fChain->SetBranchAddress("fCascades.fV0mom[2][3]",&fCascades_fV0mom);
+   fChain->SetBranchAddress("fCascades.fV0momCov[6]",&fCascades_fV0momCov);
+   fChain->SetBranchAddress("fCascades.fBachIdx",&fCascades_fBachIdx);
+   fChain->SetBranchAddress("fCascades.fBachMom[3]",&fCascades_fBachMom);
+   fChain->SetBranchAddress("fCascades.fBachMomCov[6]",&fCascades_fBachMomCov);
+   fChain->SetBranchAddress("fKinks",&fKinks_);
+   fChain->SetBranchAddress("fKinks.fUniqueID",fKinks_fUniqueID);
+   fChain->SetBranchAddress("fKinks.fBits",fKinks_fBits);
+   fChain->SetBranchAddress("fKinks.fID",fKinks_fID);
+   fChain->SetBranchAddress("fKinks.fParamDaughter.fUniqueID",fKinks_fParamDaughter_fUniqueID);
+   fChain->SetBranchAddress("fKinks.fParamDaughter.fBits",fKinks_fParamDaughter_fBits);
+   fChain->SetBranchAddress("fKinks.fParamDaughter.fX",fKinks_fParamDaughter_fX);
+   fChain->SetBranchAddress("fKinks.fParamDaughter.fAlpha",fKinks_fParamDaughter_fAlpha);
+   fChain->SetBranchAddress("fKinks.fParamDaughter.fP[5]",fKinks_fParamDaughter_fP);
+   fChain->SetBranchAddress("fKinks.fParamDaughter.fC[15]",fKinks_fParamDaughter_fC);
+   fChain->SetBranchAddress("fKinks.fParamMother.fUniqueID",fKinks_fParamMother_fUniqueID);
+   fChain->SetBranchAddress("fKinks.fParamMother.fBits",fKinks_fParamMother_fBits);
+   fChain->SetBranchAddress("fKinks.fParamMother.fX",fKinks_fParamMother_fX);
+   fChain->SetBranchAddress("fKinks.fParamMother.fAlpha",fKinks_fParamMother_fAlpha);
+   fChain->SetBranchAddress("fKinks.fParamMother.fP[5]",fKinks_fParamMother_fP);
+   fChain->SetBranchAddress("fKinks.fParamMother.fC[15]",fKinks_fParamMother_fC);
+   fChain->SetBranchAddress("fKinks.fDist1",fKinks_fDist1);
+   fChain->SetBranchAddress("fKinks.fDist2",fKinks_fDist2);
+   fChain->SetBranchAddress("fKinks.fPdr[3]",fKinks_fPdr);
+   fChain->SetBranchAddress("fKinks.fXr[3]",fKinks_fXr);
+   fChain->SetBranchAddress("fKinks.fPm[3]",fKinks_fPm);
+   fChain->SetBranchAddress("fKinks.fAngle[3]",fKinks_fAngle);
+   fChain->SetBranchAddress("fKinks.fRr",fKinks_fRr);
+   fChain->SetBranchAddress("fKinks.fLab[2]",fKinks_fLab);
+   fChain->SetBranchAddress("fKinks.fIndex[2]",fKinks_fIndex);
+   fChain->SetBranchAddress("fKinks.fStatus[12]",fKinks_fStatus);
+   fChain->SetBranchAddress("fKinks.fTPCdensity[2][2]",fKinks_fTPCdensity);
+   fChain->SetBranchAddress("fKinks.fTPCdensity2[2][2]",fKinks_fTPCdensity2);
+   fChain->SetBranchAddress("fKinks.fShapeFactor",fKinks_fShapeFactor);
+   fChain->SetBranchAddress("fKinks.fRow0",fKinks_fRow0);
+   fChain->SetBranchAddress("fKinks.fMultiple[2]",fKinks_fMultiple);
+   fChain->SetBranchAddress("fKinks.fTPCncls[2]",fKinks_fTPCncls);
+   fChain->SetBranchAddress("fV0MIs",&fV0MIs_);
+   fChain->SetBranchAddress("fV0MIs.fUniqueID",fV0MIs_fUniqueID);
+   fChain->SetBranchAddress("fV0MIs.fBits",fV0MIs_fBits);
+   fChain->SetBranchAddress("fV0MIs.fPdgCode",fV0MIs_fPdgCode);
+   fChain->SetBranchAddress("fV0MIs.fEffMass",fV0MIs_fEffMass);
+   fChain->SetBranchAddress("fV0MIs.fDcaDaughters",fV0MIs_fDcaDaughters);
+   fChain->SetBranchAddress("fV0MIs.fChi2",fV0MIs_fChi2);
+   fChain->SetBranchAddress("fV0MIs.fPos[3]",fV0MIs_fPos);
+   fChain->SetBranchAddress("fV0MIs.fPosCov[6]",fV0MIs_fPosCov);
+   fChain->SetBranchAddress("fV0MIs.fNidx",fV0MIs_fNidx);
+   fChain->SetBranchAddress("fV0MIs.fNmom[3]",fV0MIs_fNmom);
+   fChain->SetBranchAddress("fV0MIs.fNmomCov[6]",fV0MIs_fNmomCov);
+   fChain->SetBranchAddress("fV0MIs.fPidx",fV0MIs_fPidx);
+   fChain->SetBranchAddress("fV0MIs.fPmom[3]",fV0MIs_fPmom);
+   fChain->SetBranchAddress("fV0MIs.fPmomCov[6]",fV0MIs_fPmomCov);
+   fChain->SetBranchAddress("fV0MIs.fParamP.fUniqueID",fV0MIs_fParamP_fUniqueID);
+   fChain->SetBranchAddress("fV0MIs.fParamP.fBits",fV0MIs_fParamP_fBits);
+   fChain->SetBranchAddress("fV0MIs.fParamP.fX",fV0MIs_fParamP_fX);
+   fChain->SetBranchAddress("fV0MIs.fParamP.fAlpha",fV0MIs_fParamP_fAlpha);
+   fChain->SetBranchAddress("fV0MIs.fParamP.fP[5]",fV0MIs_fParamP_fP);
+   fChain->SetBranchAddress("fV0MIs.fParamP.fC[15]",fV0MIs_fParamP_fC);
+   fChain->SetBranchAddress("fV0MIs.fParamM.fUniqueID",fV0MIs_fParamM_fUniqueID);
+   fChain->SetBranchAddress("fV0MIs.fParamM.fBits",fV0MIs_fParamM_fBits);
+   fChain->SetBranchAddress("fV0MIs.fParamM.fX",fV0MIs_fParamM_fX);
+   fChain->SetBranchAddress("fV0MIs.fParamM.fAlpha",fV0MIs_fParamM_fAlpha);
+   fChain->SetBranchAddress("fV0MIs.fParamM.fP[5]",fV0MIs_fParamM_fP);
+   fChain->SetBranchAddress("fV0MIs.fParamM.fC[15]",fV0MIs_fParamM_fC);
+   fChain->SetBranchAddress("fV0MIs.fRP[5]",fV0MIs_fRP);
+   fChain->SetBranchAddress("fV0MIs.fRM[5]",fV0MIs_fRM);
+   fChain->SetBranchAddress("fV0MIs.fID",fV0MIs_fID);
+   fChain->SetBranchAddress("fV0MIs.fLab[2]",fV0MIs_fLab);
+   fChain->SetBranchAddress("fV0MIs.fIndex[2]",fV0MIs_fIndex);
+   fChain->SetBranchAddress("fV0MIs.fNormDCAPrim[2]",fV0MIs_fNormDCAPrim);
+   fChain->SetBranchAddress("fV0MIs.fDist1",fV0MIs_fDist1);
+   fChain->SetBranchAddress("fV0MIs.fDist2",fV0MIs_fDist2);
+   fChain->SetBranchAddress("fV0MIs.fPP[3]",fV0MIs_fPP);
+   fChain->SetBranchAddress("fV0MIs.fPM[3]",fV0MIs_fPM);
+   fChain->SetBranchAddress("fV0MIs.fXr[3]",fV0MIs_fXr);
+   fChain->SetBranchAddress("fV0MIs.fAngle[3]",fV0MIs_fAngle);
+   fChain->SetBranchAddress("fV0MIs.fRr",fV0MIs_fRr);
+   fChain->SetBranchAddress("fV0MIs.fStatus",fV0MIs_fStatus);
+   fChain->SetBranchAddress("fV0MIs.fRow0",fV0MIs_fRow0);
+   fChain->SetBranchAddress("fV0MIs.fOrder[3]",fV0MIs_fOrder);
+   fChain->SetBranchAddress("fV0MIs.fDistNorm",fV0MIs_fDistNorm);
+   fChain->SetBranchAddress("fV0MIs.fDistSigma",fV0MIs_fDistSigma);
+   fChain->SetBranchAddress("fV0MIs.fCausality[4]",fV0MIs_fCausality);
+   fChain->SetBranchAddress("fV0MIs.fChi2Before",fV0MIs_fChi2Before);
+   fChain->SetBranchAddress("fV0MIs.fNBefore",fV0MIs_fNBefore);
+   fChain->SetBranchAddress("fV0MIs.fChi2After",fV0MIs_fChi2After);
+   fChain->SetBranchAddress("fV0MIs.fNAfter",fV0MIs_fNAfter);
+   fChain->SetBranchAddress("fV0MIs.fPointAngleFi",fV0MIs_fPointAngleFi);
+   fChain->SetBranchAddress("fV0MIs.fPointAngleTh",fV0MIs_fPointAngleTh);
+   fChain->SetBranchAddress("fV0MIs.fPointAngle",fV0MIs_fPointAngle);
+   fChain->SetBranchAddress("fCaloClusters",&fCaloClusters_);
+   fChain->SetBranchAddress("fCaloClusters.fUniqueID",fCaloClusters_fUniqueID);
+   fChain->SetBranchAddress("fCaloClusters.fBits",fCaloClusters_fBits);
+   fChain->SetBranchAddress("fCaloClusters.fID",fCaloClusters_fID);
+   fChain->SetBranchAddress("fCaloClusters.fClusterType",fCaloClusters_fClusterType);
+   fChain->SetBranchAddress("fCaloClusters.fEMCALCluster",fCaloClusters_fEMCALCluster);
+   fChain->SetBranchAddress("fCaloClusters.fPHOSCluster",fCaloClusters_fPHOSCluster);
+   fChain->SetBranchAddress("fCaloClusters.fGlobalPos[3]",fCaloClusters_fGlobalPos);
+   fChain->SetBranchAddress("fCaloClusters.fEnergy",fCaloClusters_fEnergy);
+   fChain->SetBranchAddress("fCaloClusters.fDispersion",fCaloClusters_fDispersion);
+   fChain->SetBranchAddress("fCaloClusters.fChi2",fCaloClusters_fChi2);
+   fChain->SetBranchAddress("fCaloClusters.fPID[10]",fCaloClusters_fPID);
+   fChain->SetBranchAddress("fCaloClusters.fPrimaryIndex",fCaloClusters_fPrimaryIndex);
+   fChain->SetBranchAddress("fCaloClusters.fM20",fCaloClusters_fM20);
+   fChain->SetBranchAddress("fCaloClusters.fM02",fCaloClusters_fM02);
+   fChain->SetBranchAddress("fCaloClusters.fM11",fCaloClusters_fM11);
+   fChain->SetBranchAddress("fCaloClusters.fNExMax",fCaloClusters_fNExMax);
+   fChain->SetBranchAddress("fCaloClusters.fEmcCpvDistance",fCaloClusters_fEmcCpvDistance);
+   fChain->SetBranchAddress("fCaloClusters.fNumberOfDigits",fCaloClusters_fNumberOfDigits);
+   fChain->SetBranchAddress("fCaloClusters.fDigitAmplitude",fCaloClusters_fDigitAmplitude);
+   fChain->SetBranchAddress("fCaloClusters.fDigitTime",fCaloClusters_fDigitTime);
+   fChain->SetBranchAddress("fCaloClusters.fDigitIndex",fCaloClusters_fDigitIndex);
+   fChain->SetBranchAddress("fEMCALClusters",&fEMCALClusters);
+   fChain->SetBranchAddress("fFirstEMCALCluster",&fFirstEMCALCluster);
+   fChain->SetBranchAddress("fPHOSClusters",&fPHOSClusters);
+   fChain->SetBranchAddress("fFirstPHOSCluster",&fFirstPHOSCluster);
+}
+
+Bool_t esdAna::Notify()
+{
+  static int nfiles=0;
+   // The Notify() function is called when a new file is opened. This
+   // can be either for a new TTree in a TChain or when when a new TTree
+   // is started when using PROOF. Typically here the branch pointers
+   // will be retrieved. It is normaly not necessary to make changes
+   // to the generated code, but the routine can be extended by the
+   // user if needed.
+  nfiles++;
+  if (fChain) {
+    if (fChain->GetCurrentFile()) {
+      Info("Notify","Opening File: %s [%d]", fChain->GetCurrentFile()->GetName(),nfiles);
+    }
+  }
+
+   // Get branch pointers
+   b_ESD_fUniqueID = fChain->GetBranch("fUniqueID");
+   b_ESD_fBits = fChain->GetBranch("fBits");
+   b_ESD_fEventNumber = fChain->GetBranch("fEventNumber");
+   b_ESD_fRunNumber = fChain->GetBranch("fRunNumber");
+   b_ESD_fTriggerMask = fChain->GetBranch("fTriggerMask");
+   b_ESD_fTriggerCluster = fChain->GetBranch("fTriggerCluster");
+   b_ESD_fRecoVersion = fChain->GetBranch("fRecoVersion");
+   b_ESD_fMagneticField = fChain->GetBranch("fMagneticField");
+   b_ESD_fZDCN1Energy = fChain->GetBranch("fZDCN1Energy");
+   b_ESD_fZDCP1Energy = fChain->GetBranch("fZDCP1Energy");
+   b_ESD_fZDCN2Energy = fChain->GetBranch("fZDCN2Energy");
+   b_ESD_fZDCP2Energy = fChain->GetBranch("fZDCP2Energy");
+   b_ESD_fZDCEMEnergy = fChain->GetBranch("fZDCEMEnergy");
+   b_ESD_fZDCParticipants = fChain->GetBranch("fZDCParticipants");
+   b_ESD_fT0zVertex = fChain->GetBranch("fT0zVertex");
+   b_ESD_fSPDVertex_fUniqueID = fChain->GetBranch("fSPDVertex.fUniqueID");
+   b_ESD_fSPDVertex_fBits = fChain->GetBranch("fSPDVertex.fBits");
+   b_ESD_fSPDVertex_fName = fChain->GetBranch("fSPDVertex.fName");
+   b_ESD_fSPDVertex_fTitle = fChain->GetBranch("fSPDVertex.fTitle");
+   b_ESD_fSPDVertex_fPosition = fChain->GetBranch("fSPDVertex.fPosition[3]");
+   b_ESD_fSPDVertex_fSigma = fChain->GetBranch("fSPDVertex.fSigma");
+   b_ESD_fSPDVertex_fNContributors = fChain->GetBranch("fSPDVertex.fNContributors");
+   b_ESD_fSPDVertex_fCovXX = fChain->GetBranch("fSPDVertex.fCovXX");
+   b_ESD_fSPDVertex_fCovXY = fChain->GetBranch("fSPDVertex.fCovXY");
+   b_ESD_fSPDVertex_fCovYY = fChain->GetBranch("fSPDVertex.fCovYY");
+   b_ESD_fSPDVertex_fCovXZ = fChain->GetBranch("fSPDVertex.fCovXZ");
+   b_ESD_fSPDVertex_fCovYZ = fChain->GetBranch("fSPDVertex.fCovYZ");
+   b_ESD_fSPDVertex_fCovZZ = fChain->GetBranch("fSPDVertex.fCovZZ");
+   b_ESD_fSPDVertex_fSNR = fChain->GetBranch("fSPDVertex.fSNR[3]");
+   b_ESD_fSPDVertex_fChi2 = fChain->GetBranch("fSPDVertex.fChi2");
+   b_ESD_fSPDVertex_fTruePos = fChain->GetBranch("fSPDVertex.fTruePos[3]");
+   b_ESD_fPrimaryVertex_fUniqueID = fChain->GetBranch("fPrimaryVertex.fUniqueID");
+   b_ESD_fPrimaryVertex_fBits = fChain->GetBranch("fPrimaryVertex.fBits");
+   b_ESD_fPrimaryVertex_fName = fChain->GetBranch("fPrimaryVertex.fName");
+   b_ESD_fPrimaryVertex_fTitle = fChain->GetBranch("fPrimaryVertex.fTitle");
+   b_ESD_fPrimaryVertex_fPosition = fChain->GetBranch("fPrimaryVertex.fPosition[3]");
+   b_ESD_fPrimaryVertex_fSigma = fChain->GetBranch("fPrimaryVertex.fSigma");
+   b_ESD_fPrimaryVertex_fNContributors = fChain->GetBranch("fPrimaryVertex.fNContributors");
+   b_ESD_fPrimaryVertex_fCovXX = fChain->GetBranch("fPrimaryVertex.fCovXX");
+   b_ESD_fPrimaryVertex_fCovXY = fChain->GetBranch("fPrimaryVertex.fCovXY");
+   b_ESD_fPrimaryVertex_fCovYY = fChain->GetBranch("fPrimaryVertex.fCovYY");
+   b_ESD_fPrimaryVertex_fCovXZ = fChain->GetBranch("fPrimaryVertex.fCovXZ");
+   b_ESD_fPrimaryVertex_fCovYZ = fChain->GetBranch("fPrimaryVertex.fCovYZ");
+   b_ESD_fPrimaryVertex_fCovZZ = fChain->GetBranch("fPrimaryVertex.fCovZZ");
+   b_ESD_fPrimaryVertex_fSNR = fChain->GetBranch("fPrimaryVertex.fSNR[3]");
+   b_ESD_fPrimaryVertex_fChi2 = fChain->GetBranch("fPrimaryVertex.fChi2");
+   b_ESD_fPrimaryVertex_fTruePos = fChain->GetBranch("fPrimaryVertex.fTruePos[3]");
+   b_ESD_fSPDMult_fUniqueID = fChain->GetBranch("fSPDMult.fUniqueID");
+   b_ESD_fSPDMult_fBits = fChain->GetBranch("fSPDMult.fBits");
+   b_ESD_fSPDMult_fNtracks = fChain->GetBranch("fSPDMult.fNtracks");
+   b_fSPDMult_fTh = fChain->GetBranch("fSPDMult.fTh");
+   b_fSPDMult_fPhi = fChain->GetBranch("fSPDMult.fPhi");
+   b_fSPDMult_fDeltPhi = fChain->GetBranch("fSPDMult.fDeltPhi");
+   b_ESD_fT0timeStart = fChain->GetBranch("fT0timeStart");
+   b_ESD_fT0time = fChain->GetBranch("fT0time[24]");
+   b_ESD_fT0amplitude = fChain->GetBranch("fT0amplitude[24]");
+   b_ESD_fTracks_ = fChain->GetBranch("fTracks");
+   b_fTracks_fUniqueID = fChain->GetBranch("fTracks.fUniqueID");
+   b_fTracks_fBits = fChain->GetBranch("fTracks.fBits");
+   b_fTracks_fX = fChain->GetBranch("fTracks.fX");
+   b_fTracks_fAlpha = fChain->GetBranch("fTracks.fAlpha");
+   b_fTracks_fP = fChain->GetBranch("fTracks.fP[5]");
+   b_fTracks_fC = fChain->GetBranch("fTracks.fC[15]");
+   b_fTracks_fFlags = fChain->GetBranch("fTracks.fFlags");
+   b_fTracks_fLabel = fChain->GetBranch("fTracks.fLabel");
+   b_fTracks_fID = fChain->GetBranch("fTracks.fID");
+   b_fTracks_fTrackLength = fChain->GetBranch("fTracks.fTrackLength");
+   b_fTracks_fD = fChain->GetBranch("fTracks.fD");
+   b_fTracks_fZ = fChain->GetBranch("fTracks.fZ");
+   b_fTracks_fCdd = fChain->GetBranch("fTracks.fCdd");
+   b_fTracks_fCdz = fChain->GetBranch("fTracks.fCdz");
+   b_fTracks_fCzz = fChain->GetBranch("fTracks.fCzz");
+   b_fTracks_fTrackTime = fChain->GetBranch("fTracks.fTrackTime[5]");
+   b_fTracks_fR = fChain->GetBranch("fTracks.fR[5]");
+   b_fTracks_fStopVertex = fChain->GetBranch("fTracks.fStopVertex");
+   b_fTracks_fCchi2 = fChain->GetBranch("fTracks.fCchi2");
+   b_fTracks_fITSchi2 = fChain->GetBranch("fTracks.fITSchi2");
+   b_fTracks_fITSncls = fChain->GetBranch("fTracks.fITSncls");
+   b_fTracks_fITSsignal = fChain->GetBranch("fTracks.fITSsignal");
+   b_fTracks_fITSr = fChain->GetBranch("fTracks.fITSr[5]");
+   b_fTracks_fITSLabel = fChain->GetBranch("fTracks.fITSLabel");
+   b_fTracks_fITSFakeRatio = fChain->GetBranch("fTracks.fITSFakeRatio");
+   b_fTracks_fTPCchi2 = fChain->GetBranch("fTracks.fTPCchi2");
+   b_fTracks_fTPCncls = fChain->GetBranch("fTracks.fTPCncls");
+   b_fTracks_fTPCnclsF = fChain->GetBranch("fTracks.fTPCnclsF");
+   b_fTracks_fTPCClusterMap_fUniqueID = fChain->GetBranch("fTracks.fTPCClusterMap.fUniqueID");
+   b_fTracks_fTPCClusterMap_fBits = fChain->GetBranch("fTracks.fTPCClusterMap.fBits");
+   b_fTracks_fTPCClusterMap_fNbits = fChain->GetBranch("fTracks.fTPCClusterMap.fNbits");
+   b_fTracks_fTPCClusterMap_fNbytes = fChain->GetBranch("fTracks.fTPCClusterMap.fNbytes");
+   b_fTracks_fTPCClusterMap_fAllBits = fChain->GetBranch("fTracks.fTPCClusterMap.fAllBits");
+   b_fTracks_fTPCsignal = fChain->GetBranch("fTracks.fTPCsignal");
+   b_fTracks_fTPCsignalN = fChain->GetBranch("fTracks.fTPCsignalN");
+   b_fTracks_fTPCsignalS = fChain->GetBranch("fTracks.fTPCsignalS");
+   b_fTracks_fTPCr = fChain->GetBranch("fTracks.fTPCr[5]");
+   b_fTracks_fTPCLabel = fChain->GetBranch("fTracks.fTPCLabel");
+   b_fTracks_fTPCPoints = fChain->GetBranch("fTracks.fTPCPoints[4]");
+   b_fTracks_fKinkIndexes = fChain->GetBranch("fTracks.fKinkIndexes[3]");
+   b_fTracks_fV0Indexes = fChain->GetBranch("fTracks.fV0Indexes[3]");
+   b_fTracks_fTRDchi2 = fChain->GetBranch("fTracks.fTRDchi2");
+   b_fTracks_fTRDncls = fChain->GetBranch("fTracks.fTRDncls");
+   b_fTracks_fTRDncls0 = fChain->GetBranch("fTracks.fTRDncls0");
+   b_fTracks_fTRDsignal = fChain->GetBranch("fTracks.fTRDsignal");
+   b_fTracks_fTRDsignals = fChain->GetBranch("fTracks.fTRDsignals[6][3]");
+   b_fTracks_fTRDTimBin = fChain->GetBranch("fTracks.fTRDTimBin[6]");
+   b_fTracks_fTRDr = fChain->GetBranch("fTracks.fTRDr[5]");
+   b_fTracks_fTRDLabel = fChain->GetBranch("fTracks.fTRDLabel");
+   b_fTracks_fTRDQuality = fChain->GetBranch("fTracks.fTRDQuality");
+   b_fTracks_fTRDBudget = fChain->GetBranch("fTracks.fTRDBudget");
+   b_fTracks_fTOFchi2 = fChain->GetBranch("fTracks.fTOFchi2");
+   b_fTracks_fTOFindex = fChain->GetBranch("fTracks.fTOFindex");
+   b_fTracks_fTOFCalChannel = fChain->GetBranch("fTracks.fTOFCalChannel");
+   b_fTracks_fTOFsignal = fChain->GetBranch("fTracks.fTOFsignal");
+   b_fTracks_fTOFsignalToT = fChain->GetBranch("fTracks.fTOFsignalToT");
+   b_fTracks_fTOFr = fChain->GetBranch("fTracks.fTOFr[5]");
+   b_fTracks_fTOFLabel = fChain->GetBranch("fTracks.fTOFLabel[3]");
+   b_fTracks_fHMPIDchi2 = fChain->GetBranch("fTracks.fHMPIDchi2");
+   b_fTracks_fHMPIDncls = fChain->GetBranch("fTracks.fHMPIDncls");
+   b_fTracks_fHMPIDindex = fChain->GetBranch("fTracks.fHMPIDindex");
+   b_fTracks_fHMPIDsignal = fChain->GetBranch("fTracks.fHMPIDsignal");
+   b_fTracks_fHMPIDr = fChain->GetBranch("fTracks.fHMPIDr[5]");
+   b_fTracks_fHMPIDtheta = fChain->GetBranch("fTracks.fHMPIDtheta");
+   b_fTracks_fHMPIDphi = fChain->GetBranch("fTracks.fHMPIDphi");
+   b_fTracks_fHMPIDdx = fChain->GetBranch("fTracks.fHMPIDdx");
+   b_fTracks_fHMPIDdy = fChain->GetBranch("fTracks.fHMPIDdy");
+   b_fTracks_fHMPIDmipX = fChain->GetBranch("fTracks.fHMPIDmipX");
+   b_fTracks_fHMPIDmipY = fChain->GetBranch("fTracks.fHMPIDmipY");
+   b_ESD_fHLTConfMapTracks_ = fChain->GetBranch("fHLTConfMapTracks");
+   b_fHLTConfMapTracks_fUniqueID = fChain->GetBranch("fHLTConfMapTracks.fUniqueID");
+   b_fHLTConfMapTracks_fBits = fChain->GetBranch("fHLTConfMapTracks.fBits");
+   b_fHLTConfMapTracks_fNHits = fChain->GetBranch("fHLTConfMapTracks.fNHits");
+   b_fHLTConfMapTracks_fMCid = fChain->GetBranch("fHLTConfMapTracks.fMCid");
+   b_fHLTConfMapTracks_fWeight = fChain->GetBranch("fHLTConfMapTracks.fWeight");
+   b_fHLTConfMapTracks_fFromMainVertex = fChain->GetBranch("fHLTConfMapTracks.fFromMainVertex");
+   b_fHLTConfMapTracks_fRowRange = fChain->GetBranch("fHLTConfMapTracks.fRowRange[2]");
+   b_fHLTConfMapTracks_fSector = fChain->GetBranch("fHLTConfMapTracks.fSector");
+   b_fHLTConfMapTracks_fFirstPoint = fChain->GetBranch("fHLTConfMapTracks.fFirstPoint[3]");
+   b_fHLTConfMapTracks_fLastPoint = fChain->GetBranch("fHLTConfMapTracks.fLastPoint[3]");
+   b_fHLTConfMapTracks_fQ = fChain->GetBranch("fHLTConfMapTracks.fQ");
+   b_fHLTConfMapTracks_fTanl = fChain->GetBranch("fHLTConfMapTracks.fTanl");
+   b_fHLTConfMapTracks_fPsi = fChain->GetBranch("fHLTConfMapTracks.fPsi");
+   b_fHLTConfMapTracks_fPt = fChain->GetBranch("fHLTConfMapTracks.fPt");
+   b_fHLTConfMapTracks_fPterr = fChain->GetBranch("fHLTConfMapTracks.fPterr");
+   b_fHLTConfMapTracks_fPsierr = fChain->GetBranch("fHLTConfMapTracks.fPsierr");
+   b_fHLTConfMapTracks_fTanlerr = fChain->GetBranch("fHLTConfMapTracks.fTanlerr");
+   b_fHLTConfMapTracks_fBinX = fChain->GetBranch("fHLTConfMapTracks.fBinX");
+   b_fHLTConfMapTracks_fBinY = fChain->GetBranch("fHLTConfMapTracks.fBinY");
+   b_fHLTConfMapTracks_fSizeX = fChain->GetBranch("fHLTConfMapTracks.fSizeX");
+   b_fHLTConfMapTracks_fSizeY = fChain->GetBranch("fHLTConfMapTracks.fSizeY");
+   b_fHLTConfMapTracks_fPID = fChain->GetBranch("fHLTConfMapTracks.fPID");
+   b_ESD_fHLTHoughTracks_ = fChain->GetBranch("fHLTHoughTracks");
+   b_fHLTHoughTracks_fUniqueID = fChain->GetBranch("fHLTHoughTracks.fUniqueID");
+   b_fHLTHoughTracks_fBits = fChain->GetBranch("fHLTHoughTracks.fBits");
+   b_fHLTHoughTracks_fNHits = fChain->GetBranch("fHLTHoughTracks.fNHits");
+   b_fHLTHoughTracks_fMCid = fChain->GetBranch("fHLTHoughTracks.fMCid");
+   b_fHLTHoughTracks_fWeight = fChain->GetBranch("fHLTHoughTracks.fWeight");
+   b_fHLTHoughTracks_fFromMainVertex = fChain->GetBranch("fHLTHoughTracks.fFromMainVertex");
+   b_fHLTHoughTracks_fRowRange = fChain->GetBranch("fHLTHoughTracks.fRowRange[2]");
+   b_fHLTHoughTracks_fSector = fChain->GetBranch("fHLTHoughTracks.fSector");
+   b_fHLTHoughTracks_fFirstPoint = fChain->GetBranch("fHLTHoughTracks.fFirstPoint[3]");
+   b_fHLTHoughTracks_fLastPoint = fChain->GetBranch("fHLTHoughTracks.fLastPoint[3]");
+   b_fHLTHoughTracks_fQ = fChain->GetBranch("fHLTHoughTracks.fQ");
+   b_fHLTHoughTracks_fTanl = fChain->GetBranch("fHLTHoughTracks.fTanl");
+   b_fHLTHoughTracks_fPsi = fChain->GetBranch("fHLTHoughTracks.fPsi");
+   b_fHLTHoughTracks_fPt = fChain->GetBranch("fHLTHoughTracks.fPt");
+   b_fHLTHoughTracks_fPterr = fChain->GetBranch("fHLTHoughTracks.fPterr");
+   b_fHLTHoughTracks_fPsierr = fChain->GetBranch("fHLTHoughTracks.fPsierr");
+   b_fHLTHoughTracks_fTanlerr = fChain->GetBranch("fHLTHoughTracks.fTanlerr");
+   b_fHLTHoughTracks_fBinX = fChain->GetBranch("fHLTHoughTracks.fBinX");
+   b_fHLTHoughTracks_fBinY = fChain->GetBranch("fHLTHoughTracks.fBinY");
+   b_fHLTHoughTracks_fSizeX = fChain->GetBranch("fHLTHoughTracks.fSizeX");
+   b_fHLTHoughTracks_fSizeY = fChain->GetBranch("fHLTHoughTracks.fSizeY");
+   b_fHLTHoughTracks_fPID = fChain->GetBranch("fHLTHoughTracks.fPID");
+   b_ESD_fMuonTracks_ = fChain->GetBranch("fMuonTracks");
+   b_fMuonTracks_fUniqueID = fChain->GetBranch("fMuonTracks.fUniqueID");
+   b_fMuonTracks_fBits = fChain->GetBranch("fMuonTracks.fBits");
+   b_fMuonTracks_fInverseBendingMomentum = fChain->GetBranch("fMuonTracks.fInverseBendingMomentum");
+   b_fMuonTracks_fThetaX = fChain->GetBranch("fMuonTracks.fThetaX");
+   b_fMuonTracks_fThetaY = fChain->GetBranch("fMuonTracks.fThetaY");
+   b_fMuonTracks_fZ = fChain->GetBranch("fMuonTracks.fZ");
+   b_fMuonTracks_fBendingCoor = fChain->GetBranch("fMuonTracks.fBendingCoor");
+   b_fMuonTracks_fNonBendingCoor = fChain->GetBranch("fMuonTracks.fNonBendingCoor");
+   b_fMuonTracks_fChi2 = fChain->GetBranch("fMuonTracks.fChi2");
+   b_fMuonTracks_fNHit = fChain->GetBranch("fMuonTracks.fNHit");
+   b_fMuonTracks_fMatchTrigger = fChain->GetBranch("fMuonTracks.fMatchTrigger");
+   b_fMuonTracks_fChi2MatchTrigger = fChain->GetBranch("fMuonTracks.fChi2MatchTrigger");
+   b_ESD_fPmdTracks_ = fChain->GetBranch("fPmdTracks");
+   b_fPmdTracks_fUniqueID = fChain->GetBranch("fPmdTracks.fUniqueID");
+   b_fPmdTracks_fBits = fChain->GetBranch("fPmdTracks.fBits");
+   b_fPmdTracks_fDet = fChain->GetBranch("fPmdTracks.fDet");
+   b_fPmdTracks_fX = fChain->GetBranch("fPmdTracks.fX");
+   b_fPmdTracks_fY = fChain->GetBranch("fPmdTracks.fY");
+   b_fPmdTracks_fZ = fChain->GetBranch("fPmdTracks.fZ");
+   b_fPmdTracks_fCluADC = fChain->GetBranch("fPmdTracks.fCluADC");
+   b_fPmdTracks_fNcell = fChain->GetBranch("fPmdTracks.fNcell");
+   b_fPmdTracks_fCluPID = fChain->GetBranch("fPmdTracks.fCluPID");
+   b_ESD_fTrdTracks_ = fChain->GetBranch("fTrdTracks");
+   b_fTrdTracks_fUniqueID = fChain->GetBranch("fTrdTracks.fUniqueID");
+   b_fTrdTracks_fBits = fChain->GetBranch("fTrdTracks.fBits");
+   b_fTrdTracks_fYproj = fChain->GetBranch("fTrdTracks.fYproj");
+   b_fTrdTracks_fZproj = fChain->GetBranch("fTrdTracks.fZproj");
+   b_fTrdTracks_fSlope = fChain->GetBranch("fTrdTracks.fSlope");
+   b_fTrdTracks_fDetector = fChain->GetBranch("fTrdTracks.fDetector");
+   b_fTrdTracks_fNtracklets = fChain->GetBranch("fTrdTracks.fNtracklets");
+   b_fTrdTracks_fNplanes = fChain->GetBranch("fTrdTracks.fNplanes");
+   b_fTrdTracks_fNclusters = fChain->GetBranch("fTrdTracks.fNclusters");
+   b_fTrdTracks_fPt = fChain->GetBranch("fTrdTracks.fPt");
+   b_fTrdTracks_fPhi = fChain->GetBranch("fTrdTracks.fPhi");
+   b_fTrdTracks_fEta = fChain->GetBranch("fTrdTracks.fEta");
+   b_fTrdTracks_fLabel = fChain->GetBranch("fTrdTracks.fLabel");
+   b_fTrdTracks_fPID = fChain->GetBranch("fTrdTracks.fPID");
+   b_fTrdTracks_fIsElectron = fChain->GetBranch("fTrdTracks.fIsElectron");
+   b_ESD_fV0s_ = fChain->GetBranch("fV0s");
+   b_fV0s_fUniqueID = fChain->GetBranch("fV0s.fUniqueID");
+   b_fV0s_fBits = fChain->GetBranch("fV0s.fBits");
+   b_fV0s_fPdgCode = fChain->GetBranch("fV0s.fPdgCode");
+   b_fV0s_fEffMass = fChain->GetBranch("fV0s.fEffMass");
+   b_fV0s_fDcaDaughters = fChain->GetBranch("fV0s.fDcaDaughters");
+   b_fV0s_fChi2 = fChain->GetBranch("fV0s.fChi2");
+   b_fV0s_fPos = fChain->GetBranch("fV0s.fPos[3]");
+   b_fV0s_fPosCov = fChain->GetBranch("fV0s.fPosCov[6]");
+   b_fV0s_fNidx = fChain->GetBranch("fV0s.fNidx");
+   b_fV0s_fNmom = fChain->GetBranch("fV0s.fNmom[3]");
+   b_fV0s_fNmomCov = fChain->GetBranch("fV0s.fNmomCov[6]");
+   b_fV0s_fPidx = fChain->GetBranch("fV0s.fPidx");
+   b_fV0s_fPmom = fChain->GetBranch("fV0s.fPmom[3]");
+   b_fV0s_fPmomCov = fChain->GetBranch("fV0s.fPmomCov[6]");
+   b_ESD_fCascades_ = fChain->GetBranch("fCascades");
+   b_fCascades_fUniqueID = fChain->GetBranch("fCascades.fUniqueID");
+   b_fCascades_fBits = fChain->GetBranch("fCascades.fBits");
+   b_fCascades_fPdgCode = fChain->GetBranch("fCascades.fPdgCode");
+   b_fCascades_fEffMass = fChain->GetBranch("fCascades.fEffMass");
+   b_fCascades_fChi2 = fChain->GetBranch("fCascades.fChi2");
+   b_fCascades_fPos = fChain->GetBranch("fCascades.fPos[3]");
+   b_fCascades_fPosCov = fChain->GetBranch("fCascades.fPosCov[6]");
+   b_fCascades_fV0idx = fChain->GetBranch("fCascades.fV0idx[2]");
+   b_fCascades_fV0mom = fChain->GetBranch("fCascades.fV0mom[2][3]");
+   b_fCascades_fV0momCov = fChain->GetBranch("fCascades.fV0momCov[6]");
+   b_fCascades_fBachIdx = fChain->GetBranch("fCascades.fBachIdx");
+   b_fCascades_fBachMom = fChain->GetBranch("fCascades.fBachMom[3]");
+   b_fCascades_fBachMomCov = fChain->GetBranch("fCascades.fBachMomCov[6]");
+   b_ESD_fKinks_ = fChain->GetBranch("fKinks");
+   b_fKinks_fUniqueID = fChain->GetBranch("fKinks.fUniqueID");
+   b_fKinks_fBits = fChain->GetBranch("fKinks.fBits");
+   b_fKinks_fID = fChain->GetBranch("fKinks.fID");
+   b_fKinks_fParamDaughter_fUniqueID = fChain->GetBranch("fKinks.fParamDaughter.fUniqueID");
+   b_fKinks_fParamDaughter_fBits = fChain->GetBranch("fKinks.fParamDaughter.fBits");
+   b_fKinks_fParamDaughter_fX = fChain->GetBranch("fKinks.fParamDaughter.fX");
+   b_fKinks_fParamDaughter_fAlpha = fChain->GetBranch("fKinks.fParamDaughter.fAlpha");
+   b_fKinks_fParamDaughter_fP = fChain->GetBranch("fKinks.fParamDaughter.fP[5]");
+   b_fKinks_fParamDaughter_fC = fChain->GetBranch("fKinks.fParamDaughter.fC[15]");
+   b_fKinks_fParamMother_fUniqueID = fChain->GetBranch("fKinks.fParamMother.fUniqueID");
+   b_fKinks_fParamMother_fBits = fChain->GetBranch("fKinks.fParamMother.fBits");
+   b_fKinks_fParamMother_fX = fChain->GetBranch("fKinks.fParamMother.fX");
+   b_fKinks_fParamMother_fAlpha = fChain->GetBranch("fKinks.fParamMother.fAlpha");
+   b_fKinks_fParamMother_fP = fChain->GetBranch("fKinks.fParamMother.fP[5]");
+   b_fKinks_fParamMother_fC = fChain->GetBranch("fKinks.fParamMother.fC[15]");
+   b_fKinks_fDist1 = fChain->GetBranch("fKinks.fDist1");
+   b_fKinks_fDist2 = fChain->GetBranch("fKinks.fDist2");
+   b_fKinks_fPdr = fChain->GetBranch("fKinks.fPdr[3]");
+   b_fKinks_fXr = fChain->GetBranch("fKinks.fXr[3]");
+   b_fKinks_fPm = fChain->GetBranch("fKinks.fPm[3]");
+   b_fKinks_fAngle = fChain->GetBranch("fKinks.fAngle[3]");
+   b_fKinks_fRr = fChain->GetBranch("fKinks.fRr");
+   b_fKinks_fLab = fChain->GetBranch("fKinks.fLab[2]");
+   b_fKinks_fIndex = fChain->GetBranch("fKinks.fIndex[2]");
+   b_fKinks_fStatus = fChain->GetBranch("fKinks.fStatus[12]");
+   b_fKinks_fTPCdensity = fChain->GetBranch("fKinks.fTPCdensity[2][2]");
+   b_fKinks_fTPCdensity2 = fChain->GetBranch("fKinks.fTPCdensity2[2][2]");
+   b_fKinks_fShapeFactor = fChain->GetBranch("fKinks.fShapeFactor");
+   b_fKinks_fRow0 = fChain->GetBranch("fKinks.fRow0");
+   b_fKinks_fMultiple = fChain->GetBranch("fKinks.fMultiple[2]");
+   b_fKinks_fTPCncls = fChain->GetBranch("fKinks.fTPCncls[2]");
+   b_ESD_fV0MIs_ = fChain->GetBranch("fV0MIs");
+   b_fV0MIs_fUniqueID = fChain->GetBranch("fV0MIs.fUniqueID");
+   b_fV0MIs_fBits = fChain->GetBranch("fV0MIs.fBits");
+   b_fV0MIs_fPdgCode = fChain->GetBranch("fV0MIs.fPdgCode");
+   b_fV0MIs_fEffMass = fChain->GetBranch("fV0MIs.fEffMass");
+   b_fV0MIs_fDcaDaughters = fChain->GetBranch("fV0MIs.fDcaDaughters");
+   b_fV0MIs_fChi2 = fChain->GetBranch("fV0MIs.fChi2");
+   b_fV0MIs_fPos = fChain->GetBranch("fV0MIs.fPos[3]");
+   b_fV0MIs_fPosCov = fChain->GetBranch("fV0MIs.fPosCov[6]");
+   b_fV0MIs_fNidx = fChain->GetBranch("fV0MIs.fNidx");
+   b_fV0MIs_fNmom = fChain->GetBranch("fV0MIs.fNmom[3]");
+   b_fV0MIs_fNmomCov = fChain->GetBranch("fV0MIs.fNmomCov[6]");
+   b_fV0MIs_fPidx = fChain->GetBranch("fV0MIs.fPidx");
+   b_fV0MIs_fPmom = fChain->GetBranch("fV0MIs.fPmom[3]");
+   b_fV0MIs_fPmomCov = fChain->GetBranch("fV0MIs.fPmomCov[6]");
+   b_fV0MIs_fParamP_fUniqueID = fChain->GetBranch("fV0MIs.fParamP.fUniqueID");
+   b_fV0MIs_fParamP_fBits = fChain->GetBranch("fV0MIs.fParamP.fBits");
+   b_fV0MIs_fParamP_fX = fChain->GetBranch("fV0MIs.fParamP.fX");
+   b_fV0MIs_fParamP_fAlpha = fChain->GetBranch("fV0MIs.fParamP.fAlpha");
+   b_fV0MIs_fParamP_fP = fChain->GetBranch("fV0MIs.fParamP.fP[5]");
+   b_fV0MIs_fParamP_fC = fChain->GetBranch("fV0MIs.fParamP.fC[15]");
+   b_fV0MIs_fParamM_fUniqueID = fChain->GetBranch("fV0MIs.fParamM.fUniqueID");
+   b_fV0MIs_fParamM_fBits = fChain->GetBranch("fV0MIs.fParamM.fBits");
+   b_fV0MIs_fParamM_fX = fChain->GetBranch("fV0MIs.fParamM.fX");
+   b_fV0MIs_fParamM_fAlpha = fChain->GetBranch("fV0MIs.fParamM.fAlpha");
+   b_fV0MIs_fParamM_fP = fChain->GetBranch("fV0MIs.fParamM.fP[5]");
+   b_fV0MIs_fParamM_fC = fChain->GetBranch("fV0MIs.fParamM.fC[15]");
+   b_fV0MIs_fRP = fChain->GetBranch("fV0MIs.fRP[5]");
+   b_fV0MIs_fRM = fChain->GetBranch("fV0MIs.fRM[5]");
+   b_fV0MIs_fID = fChain->GetBranch("fV0MIs.fID");
+   b_fV0MIs_fLab = fChain->GetBranch("fV0MIs.fLab[2]");
+   b_fV0MIs_fIndex = fChain->GetBranch("fV0MIs.fIndex[2]");
+   b_fV0MIs_fNormDCAPrim = fChain->GetBranch("fV0MIs.fNormDCAPrim[2]");
+   b_fV0MIs_fDist1 = fChain->GetBranch("fV0MIs.fDist1");
+   b_fV0MIs_fDist2 = fChain->GetBranch("fV0MIs.fDist2");
+   b_fV0MIs_fPP = fChain->GetBranch("fV0MIs.fPP[3]");
+   b_fV0MIs_fPM = fChain->GetBranch("fV0MIs.fPM[3]");
+   b_fV0MIs_fXr = fChain->GetBranch("fV0MIs.fXr[3]");
+   b_fV0MIs_fAngle = fChain->GetBranch("fV0MIs.fAngle[3]");
+   b_fV0MIs_fRr = fChain->GetBranch("fV0MIs.fRr");
+   b_fV0MIs_fStatus = fChain->GetBranch("fV0MIs.fStatus");
+   b_fV0MIs_fRow0 = fChain->GetBranch("fV0MIs.fRow0");
+   b_fV0MIs_fOrder = fChain->GetBranch("fV0MIs.fOrder[3]");
+   b_fV0MIs_fDistNorm = fChain->GetBranch("fV0MIs.fDistNorm");
+   b_fV0MIs_fDistSigma = fChain->GetBranch("fV0MIs.fDistSigma");
+   b_fV0MIs_fCausality = fChain->GetBranch("fV0MIs.fCausality[4]");
+   b_fV0MIs_fChi2Before = fChain->GetBranch("fV0MIs.fChi2Before");
+   b_fV0MIs_fNBefore = fChain->GetBranch("fV0MIs.fNBefore");
+   b_fV0MIs_fChi2After = fChain->GetBranch("fV0MIs.fChi2After");
+   b_fV0MIs_fNAfter = fChain->GetBranch("fV0MIs.fNAfter");
+   b_fV0MIs_fPointAngleFi = fChain->GetBranch("fV0MIs.fPointAngleFi");
+   b_fV0MIs_fPointAngleTh = fChain->GetBranch("fV0MIs.fPointAngleTh");
+   b_fV0MIs_fPointAngle = fChain->GetBranch("fV0MIs.fPointAngle");
+   b_ESD_fCaloClusters_ = fChain->GetBranch("fCaloClusters");
+   b_fCaloClusters_fUniqueID = fChain->GetBranch("fCaloClusters.fUniqueID");
+   b_fCaloClusters_fBits = fChain->GetBranch("fCaloClusters.fBits");
+   b_fCaloClusters_fID = fChain->GetBranch("fCaloClusters.fID");
+   b_fCaloClusters_fClusterType = fChain->GetBranch("fCaloClusters.fClusterType");
+   b_fCaloClusters_fEMCALCluster = fChain->GetBranch("fCaloClusters.fEMCALCluster");
+   b_fCaloClusters_fPHOSCluster = fChain->GetBranch("fCaloClusters.fPHOSCluster");
+   b_fCaloClusters_fGlobalPos = fChain->GetBranch("fCaloClusters.fGlobalPos[3]");
+   b_fCaloClusters_fEnergy = fChain->GetBranch("fCaloClusters.fEnergy");
+   b_fCaloClusters_fDispersion = fChain->GetBranch("fCaloClusters.fDispersion");
+   b_fCaloClusters_fChi2 = fChain->GetBranch("fCaloClusters.fChi2");
+   b_fCaloClusters_fPID = fChain->GetBranch("fCaloClusters.fPID[10]");
+   b_fCaloClusters_fPrimaryIndex = fChain->GetBranch("fCaloClusters.fPrimaryIndex");
+   b_fCaloClusters_fM20 = fChain->GetBranch("fCaloClusters.fM20");
+   b_fCaloClusters_fM02 = fChain->GetBranch("fCaloClusters.fM02");
+   b_fCaloClusters_fM11 = fChain->GetBranch("fCaloClusters.fM11");
+   b_fCaloClusters_fNExMax = fChain->GetBranch("fCaloClusters.fNExMax");
+   b_fCaloClusters_fEmcCpvDistance = fChain->GetBranch("fCaloClusters.fEmcCpvDistance");
+   b_fCaloClusters_fNumberOfDigits = fChain->GetBranch("fCaloClusters.fNumberOfDigits");
+   b_fCaloClusters_fDigitAmplitude = fChain->GetBranch("fCaloClusters.fDigitAmplitude");
+   b_fCaloClusters_fDigitTime = fChain->GetBranch("fCaloClusters.fDigitTime");
+   b_fCaloClusters_fDigitIndex = fChain->GetBranch("fCaloClusters.fDigitIndex");
+   b_ESD_fEMCALClusters = fChain->GetBranch("fEMCALClusters");
+   b_ESD_fFirstEMCALCluster = fChain->GetBranch("fFirstEMCALCluster");
+   b_ESD_fPHOSClusters = fChain->GetBranch("fPHOSClusters");
+   b_ESD_fFirstPHOSCluster = fChain->GetBranch("fFirstPHOSCluster");
+
+   return kTRUE;
+}
+
+#endif // #ifdef esdAna_cxx
diff --git a/T0/libT0base.pkg b/T0/libT0base.pkg
new file mode 100644 (file)
index 0000000..cb9aad4
--- /dev/null
@@ -0,0 +1,11 @@
+#-*- Mode: Makefile -*-
+# $Id$
+
+SRCS= AliT0digit.cxx AliT0Loader.cxx AliT0Trigger.cxx \
+      AliT0CalibData.cxx AliT0Parameters.cxx
+
+HDRS= $(SRCS:.cxx=.h)
+
+
+DHDR:= T0baseLinkDef.h
+
diff --git a/T0/libT0rec.pkg b/T0/libT0rec.pkg
new file mode 100644 (file)
index 0000000..5d0d866
--- /dev/null
@@ -0,0 +1,10 @@
+#-*- Mode: Makefile -*-
+# $Id$
+
+SRCS= AliT0RecPoint.cxx AliT0Reconstructor.cxx AliT0RawReader.cxx 
+
+HDRS= $(SRCS:.cxx=.h)
+
+
+DHDR:= T0recLinkDef.h
+
diff --git a/T0/libT0shuttle.pkg b/T0/libT0shuttle.pkg
new file mode 100644 (file)
index 0000000..af9f01c
--- /dev/null
@@ -0,0 +1,9 @@
+#-*- Mode: Makefile -*-
+# $Id$
+
+SRCS = AliT0Calc.cxx AliT0Preprocessor.cxx AliT0Dqclass.cxx
+HDRS:= $(SRCS:.cxx=.h)
+
+DHDR= T0shuttleLinkDef.h
+
+EINCLUDE:=RAW
diff --git a/T0/libT0sim.pkg b/T0/libT0sim.pkg
new file mode 100644 (file)
index 0000000..456f954
--- /dev/null
@@ -0,0 +1,10 @@
+#-*- Mode: Makefile -*-
+# $Id$
+
+SRCS= AliT0.cxx AliT0v0.cxx AliT0v1.cxx AliT0hit.cxx AliT0Digitizer.cxx  AliT0RawData.cxx
+
+HDRS= $(SRCS:.cxx=.h)
+
+
+DHDR:= T0simLinkDef.h
+
diff --git a/T0/readDigits.C b/T0/readDigits.C
new file mode 100644 (file)
index 0000000..2fb2cbc
--- /dev/null
@@ -0,0 +1,97 @@
+void readDigits() 
+{
+  // Dynamically link some shared libs
+  /*  if (gClassTable->GetID("AliRun") < 0) {
+    gROOT->LoadMacro("loadlibs.C");
+    loadlibs();
+  }
+  */
+    Float_t c = 0.0299792; // cm/ps
+    Float_t channelWidth = 25;
+    Float_t timeDelay = 150;
+    char filename[100];
+    sprintf(filename,"galice.root");
+    AliRunLoader* rl = AliRunLoader::Open("galice.root",AliConfig::GetDefaultEventFolderName(),"read");
+    if (rl == 0x0)
+   {
+     cerr<<"Can not open session for file galice.root\n";
+     return;
+   }
+    
+    rl->LoadgAlice();
+    gAlice = rl->GetAliRun();
+    
+    AliT0* T0  = (AliT0 *)gAlice->GetDetector("T0");
+    
+    rl->LoadHeader();
+    Int_t retval;
+    AliLoader* lstart = rl->GetLoader("T0Loader");
+
+  Int_t iNevents=rl->GetNumberOfEvents();
+  cout<<"  nevents   "<<iNevents<<endl;
+
+
+  TH1F *hTimediff = new TH1F("hTimediff","Time difference",100,5950,6050);
+  TH1F *hBestTimeright = new TH1F("hBestTimeright","First time right",
+                                 100,8450.,8650);
+  TH1F *hBestTimeleft = new TH1F("hBestTimeleft","First time left",
+                                100,8450.,8650.);
+  TH1F *hRealVertex = new TH1F("hRealVertex","Real Vertex",100,-15,15);
+  
+  TH1F *hVertex = new TH1F("hVertex","Z position of vertex",   100,-15,15);
+  //  digits = new AliT0digit();
+  AliT0digit *fDigits   ; // digits
+  fDigits = new AliT0digit();
+
+ // Event ------------------------- LOOP  
+  for (Int_t j=0; j<iNevents; j++){
+    rl->GetEvent(j);
+
+    AliHeader *header = gAlice->GetHeader();
+    AliGenEventHeader* genHeader = header->GenEventHeader();
+    TArrayF *o = new TArrayF(3); 
+    genHeader->PrimaryVertex(*o);
+    Float_t zRealVertex=o->At(2);
+    hRealVertex->Fill( zRealVertex);
+
+    lstart->LoadDigits("READ");
+    TTree *digitsTree =  lstart->TreeD();
+    TBranch *brDigits=digitsTree->GetBranch("T0");
+    AliT0digit *fDigits = new AliT0digit();
+    if (brDigits) {
+      brDigits->SetAddress(&fDigits);
+    }else{
+      cerr<<"EXEC Branch T0 digits not found"<<endl;
+      return;
+    }
+    brDigits->GetEntry(0);
+    Int_t   besttimeright = fDigits->BestTimeRight();
+    Int_t   besttimeleft = fDigits->BestTimeLeft();
+    Int_t   timeDiff = fDigits->TimeDiff();
+    Int_t    sumMult=   fDigits->SumMult();
+    hTimediff->Fill(timeDiff);
+    hBestTimeright->Fill(besttimeright);
+    hBestTimeleft->Fill(besttimeleft );
+    Float_t vertex= (timeDiff* channelWidth - timeDelay*1000.)*c;
+    cout<<j<<" "<<besttimeright<<" "<< besttimeleft<<" "<<timeDiff<<" "<<vertex<<endl;
+    hVertex->Fill(vertex);
+  }
+  Hfile = new TFile("Figdigits.root","RECREATE","Histograms for T0 digits");
+  printf("Writting histograms to root file \n");
+  Hfile->cd();
+  //Create a canvas, set the view range, show histograms
+  gStyle->SetOptStat(111111);
+  //  TCanvas *c1 = new TCanvas("c1","Alice T0 Time ",400,10,600,600);
+   hTimediff->Write();
+  hBestTimeright->Write(); 
+  hBestTimeleft ->Write(); 
+  hVertex->Write();
+  hRealVertex->Write();
+    
+} // end of macro
+
+
+
+
diff --git a/T0/readRec.C b/T0/readRec.C
new file mode 100644 (file)
index 0000000..6310f7d
--- /dev/null
@@ -0,0 +1,114 @@
+void readRec() 
+{
+  //read T0 RecPoints and plots histos 
+
+  // Dynamically link some shared libs
+  /*  if (gClassTable->GetID("AliRun") < 0) {
+    gROOT->LoadMacro("loadlibs.C");
+    loadlibs();
+  }
+  */
+    char filename[100];
+    sprintf(filename,"galice.root");
+    AliRunLoader* rl = AliRunLoader::Open("galice.root",AliConfig::GetDefaultEventFolderName(),"read");
+    if (rl == 0x0)
+   {
+     cerr<<"Can not open session for file galice.root\n";
+     return;
+   }
+    
+    rl->LoadgAlice();
+    gAlice = rl->GetAliRun();
+    
+    AliT0* T0  = (AliT0 *)gAlice->GetDetector("T0");
+    
+    rl->LoadHeader();
+    Int_t retval;
+    AliLoader* lstart = rl->GetLoader("T0Loader");
+
+  Int_t iNevents=rl->GetNumberOfEvents();
+  cout<<"  nevents   "<<iNevents<<endl;
+
+
+  TH1F *hBestTimeC = new TH1F("hBestTimeC","First time Cside",
+                                 100,12.,13.);
+  TH1F *hBestTimeA = new TH1F("hBestTimeA","First time Aside",100,12.,13.);
+  TH1F *hMean= new TH1F("hMean"," T0 ",100,12.,13.);
+  TH1F *hAcc = new TH1F("hAcc","rec - real vertex",100,-10,10);
+                                
+  TH1F *hRealVertex = new TH1F("hRealVertex","Real Vertex",100,-15,15);
+  
+  TH1F *hVertex = new TH1F("hVertex","Z position of vertex",   100,-15,15);
+  TH1F *hAmp = new TH1F("hAmp"," amplitude",   100, 10,1000);
+  TH1F *hTime = new TH1F("hTime"," time",   100,12000.,20000);
+
+  TArrayI *amp = new TArrayI(24);  
+  TArrayI *time = new TArrayI(24);  
+
+  AliT0RecPoint *fRec   ; // digits
+  fRec = new AliT0RecPoint();
+
+ // Event ------------------------- LOOP  
+  for (Int_t ievent=0; ievent<iNevents; ievent++){
+    // for (Int_t ievent=0; ievent<990; ievent++){
+    rl->GetEvent(ievent);
+
+    AliHeader *header = gAlice->GetHeader();
+    AliGenEventHeader* genHeader = header->GenEventHeader();
+    TArrayF *o = new TArrayF(3); 
+    genHeader->PrimaryVertex(*o);
+    Float_t zRealVertex=o->At(2);
+    hRealVertex->Fill( zRealVertex);
+
+    lstart->LoadRecPoints("READ");
+    TTree *recTree =  lstart->TreeR();
+    TBranch *brRec=recTree->GetBranch("T0");
+    AliT0RecPoint *fRec = new AliT0RecPoint();
+    if (brRec) {
+      brRec->SetAddress(&fRec);
+    }else{
+      cerr<<"EXEC Branch T0 Recpoints not found"<<endl;
+      return;
+    }
+    brRec->GetEntry(0);
+    Int_t   mean = fRec->GetMeanTime();
+    hMean->Fill(mean/1000.);
+    Int_t   besttimeleft = fRec->GetBestTimeLeft();
+    Int_t   besttimeright = fRec->GetBestTimeRight();
+    hBestTimeC->Fill(0.001 * besttimeright);
+    hBestTimeA->Fill(0.001 * besttimeleft );
+    Float_t vertex= fRec->GetVertex();
+    if(vertex<99){
+    cout<<ievent<<" "<<mean<<" real vertex "<< zRealVertex<<" vertex "<<vertex<<
+      " a "<< besttimeleft<<" c "<< besttimeright<<endl;
+    hAcc->Fill(zRealVertex-vertex);
+    hVertex->Fill(vertex);
+     for (Int_t i=0; i<24; i++){ 
+      hAmp->Fill(fRec->GetAmp(i));
+      hTime->Fill(fRec->GetTime(i));
+      //  cout<<"time "<<fRec->GetTime(i)<<" amp "<<fRec->GetAmp(i)<<endl;
+    } 
+    }
+  }
+  Hfile = new TFile("FigRec.root","RECREATE","Histograms for T0 
+digits");
+  printf("Writting histograms to root file \n");
+  Hfile->cd();
+  //Create a canvas, set the view range, show histograms
+  gStyle->SetOptStat(111111);
+  //  TCanvas *c1 = new TCanvas("c1","Alice T0 Time ",400,10,600,600);
+ //  hTimediff->Write();
+  hBestTimeC->Write(); 
+  hBestTimeA ->Write(); 
+  hVertex->Write();
+  hRealVertex->Write();
+  hAcc->Write();  
+  hMean->Write();
+  hAmp->Write();
+  hTime->Write();
+} // end of macro
+
+
+
+
diff --git a/T0/readVertex.C b/T0/readVertex.C
new file mode 100644 (file)
index 0000000..ba3dc66
--- /dev/null
@@ -0,0 +1,69 @@
+void readVertex(Int_t evNumber=1) 
+{
+  // 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 = new TFile("production.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");
+  }
+  char nameTD[8],nameTR[8];
+
+  TH1F *hVertex = new TH1F("hVertex","Z position of vertex",100,-100,100);
+  TH1F *hRealVertex = new TH1F("hRealVertex","Z position of vertex",
+                              100,-100,100);
+  
+  digits = new AliT0digit();
+  vertex = new AliT0vertex();
+ // Event ------------------------- LOOP  
+  for (Int_t j=0; j<evNumber; j++){
+    
+    sprintf(nameTR,"T0_R_%d",j);
+    printf("%s\n",nameTR);
+    TObject *tr = (TObject*)gDirectory->Get(nameTR);
+    cout<<" tr "<<tr<<endl;
+    vertex->Read(nameTR);
+    
+    hVertex->Fill(vertex->GetVertex());
+    printf(" Z position %f\n",vertex->GetVertex());
+    gAlice->GetEvent(j);
+    AliHeader *header = gAlice->GetHeader();
+    AliGenEventHeader* genHeader = header->GenEventHeader();
+    TArrayF *o = new TArrayF(3); 
+    genHeader->PrimaryVertex(*o);
+    cout<<" o "<<o<<endl;
+    Float_t zRealVertex=o->At(2);
+    cout<<" zRealVertex "<<zRealVertex<<endl;
+    hRealVertex->Fill(zRealVertex);
+       
+  }
+    Hfile = new TFile("figs.root","RECREATE","Histograms for T0 Vertex");
+   printf("Writting histograms to root file \n");
+   Hfile->cd();
+
+ //Create a canvas, set the view range, show histograms
+   
+  gStyle->SetOptStat(111111);
+  hVertex->SetXTitle("vertex position, mm");
+  hVertex->SetYTitle("number of events");
+  hVertex->Write();
+  hRealVertex->SetXTitle("vertex position, mm");
+  hRealVertex->SetYTitle("number of events");
+  hRealVertex->Write();
+
+} // end of macro
+
+
+
+
diff --git a/T0/vertex.C b/T0/vertex.C
new file mode 100644 (file)
index 0000000..964ad9b
--- /dev/null
@@ -0,0 +1,37 @@
+void VertexMaker(Int_t evNumber=1) 
+{
+  
+  // 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 = 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");
+  }
+
+
+  vertex= new AliT0vertex();
+  TBranch *bRec=0;
+
+  
+ // Event ------------------------- LOOP  
+  for (j=0; j<evNumber; j++){
+    vertex->Reconstruct(j);
+  }
+  file->Write();
+  file->Close();
+
+} // end of macro
+
+
+
+