changes for FIT
authoralla <Alla.Maevskaya@cern.ch>
Tue, 18 Feb 2014 11:31:42 +0000 (15:31 +0400)
committerhristov <Peter.Hristov@cern.ch>
Wed, 19 Feb 2014 16:04:15 +0000 (17:04 +0100)
37 files changed:
CMakeLists.txt
FIT/AliFIT.cxx [new file with mode: 0644]
FIT/AliFIT.h [new file with mode: 0644]
FIT/AliFITDigit.cxx [new file with mode: 0644]
FIT/AliFITDigit.h [new file with mode: 0644]
FIT/AliFITDigitizer.cxx [new file with mode: 0644]
FIT/AliFITDigitizer.h [new file with mode: 0644]
FIT/AliFITHits.cxx [new file with mode: 0644]
FIT/AliFITHits.h [new file with mode: 0644]
FIT/AliFITRawData.cxx [new file with mode: 0644]
FIT/AliFITRawData.h [new file with mode: 0644]
FIT/AliFITRawReader.cxx [new file with mode: 0644]
FIT/AliFITRawReader.h [new file with mode: 0644]
FIT/AliFITRecPoint.cxx [new file with mode: 0644]
FIT/AliFITRecPoint.h [new file with mode: 0644]
FIT/AliFITReconstructor.cxx [new file with mode: 0644]
FIT/AliFITReconstructor.h [new file with mode: 0644]
FIT/AliFITv0.cxx [new file with mode: 0644]
FIT/AliFITv0.h [new file with mode: 0644]
FIT/AliFITv1.cxx [new file with mode: 0644]
FIT/AliFITv1.h [new file with mode: 0644]
FIT/CMakeLists.txt [new file with mode: 0644]
FIT/CMakelibFITbase.pkg [new file with mode: 0644]
FIT/CMakelibFITrec.pkg [new file with mode: 0644]
FIT/CMakelibFITsim.pkg [new file with mode: 0644]
FIT/FITbaseLinkDef.h [new file with mode: 0644]
FIT/FITrecLinkDef.h [new file with mode: 0644]
FIT/FITsimLinkDef.h [new file with mode: 0644]
FIT/SetPMTEff.C [new file with mode: 0644]
STEER/ESD/AliESDFIT.cxx [new file with mode: 0644]
STEER/ESD/AliESDFIT.h [new file with mode: 0644]
STEER/STEER/AliGeomManager.cxx
STEER/STEER/AliGeomManager.h
STEER/STEER/AliReconstruction.cxx
STEER/STEER/AliReconstruction.h
STEER/STEER/AliSimulation.cxx
STEER/STEER/AliSimulation.h

index e19f435..3907b48 100644 (file)
@@ -129,7 +129,7 @@ set(BINLIBDIRS "-L${CMAKE_LIBRARY_OUTPUT_DIRECTORY}")
 
 # Standard Modules
 # ------------------------------
-set(ALIROOTMODULES STEER PHOS TRD TPC ZDC MUON PMD FMD TOF ITS AD ACORDE HMPID T0 BCM STRUCT VZERO THijing THbtp EMCAL THerwig TEPEMGEN FASTSIM TPHIC RAW MONITOR ANALYSIS JETAN HLT STAT TTherminator CORRFW DPMJET TDPMjet STARLIGHT PWGPP PWG PWGCF PWGGA PWGHF PWGDQ PWGJE PWGLF PWGUD TRIGGER PYTHIA8 TAmpt OADB MFT TEvtGen)
+set(ALIROOTMODULES STEER PHOS TRD TPC ZDC MUON PMD FMD TOF ITS AD ACORDE HMPID T0 BCM STRUCT VZERO THijing THbtp EMCAL THerwig TEPEMGEN FASTSIM TPHIC RAW MONITOR ANALYSIS JETAN HLT STAT TTherminator CORRFW DPMJET TDPMjet STARLIGHT PWGPP PWG PWGCF PWGGA PWGHF PWGDQ PWGJE PWGLF PWGUD TRIGGER PYTHIA8 TAmpt OADB MFT TEvtGen FIT)
 
 if(THydjet)
   list(APPEND ALIROOTMODULES THydjet)
diff --git a/FIT/AliFIT.cxx b/FIT/AliFIT.cxx
new file mode 100644 (file)
index 0000000..5ec5ceb
--- /dev/null
@@ -0,0 +1,322 @@
+/**************************************************************************
+ * 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.                  *
+ **************************************************************************/
+
+///////////////////////////////////////////////////////////////////////////////
+//                                                                           //
+//  FIT ( Fast Interaction Trigger ) Detector                                            //
+//  This class contains the base procedures for the FIT    //
+//  detector                                                                 //
+//                                                                           //
+//Begin_Html
+/*
+<img src="gif/AliFITClass.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 "TClonesArray.h"
+#include "TString.h"
+
+#include "AliLoader.h"
+#include "AliLog.h"
+#include "AliLog.h"
+#include "AliMC.h"
+#include "AliRun.h"
+#include "AliFIT.h"
+#include "AliFITDigitizer.h"
+#include "AliFITDigit.h"
+#include "AliFITHits.h"
+#include "AliFITRawData.h"
+#include "AliFITRawReader.h"
+
+ClassImp(AliFIT)
+
+  //static  AliFITdigit *digits; 
+
+//_____________________________________________________________________________
+AliFIT::AliFIT()
+  : AliDetector(), 
+  fIdSens(0) 
+    /* , fDigits(NULL)*/
+{
+  //
+  // Default constructor for class AliFIT
+  //
+  fIshunt   = 1;
+  fHits     = 0;
+  fDigits = new TClonesArray("AliFITDigit",100); // from AliDetector
+  fNdigits   = 0;
+}
+//_____________________________________________________________________________
+AliFIT::AliFIT(const char *name, const char *title)
+  : AliDetector(name,title), 
+    fIdSens(0) 
+    /* , fDigits(new AliFITDigit())*/
+{
+  //
+  // Standard constructor for T0 Detector
+  //
+  //
+  // Initialise Hit array
+  AliMC* mc = gAlice->GetMCApp();
+  if( mc && mc->GetHitLists() ) {
+   fHits = new TClonesArray("AliFITHits",100); // from AliDetector
+   mc->AddHitList(fHits);  
+  }
+   fNdigits   = 0;
+ fDigits = new TClonesArray("AliFITDigit",100); // from AliDetector
+  fIshunt     =  1;
+  //  fIdSens   =  0;
+  //PH  SetMarkerColor(kRed);
+}
+
+//_____________________________________________________________________________
+AliFIT::~AliFIT() {
+  
+  //destructor
+  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 AliFIT::AddHit(Int_t track, Int_t *vol, Float_t *hits)
+{
+  //
+  // Add a FIT hit
+  //
+  TClonesArray &lhits = *fHits;
+  new(lhits[fNhits++]) AliFITHits(fIshunt,track,vol,hits);
+}
+
+//____________________________________________________________________________
+void AliFIT::AddDigit(Int_t npmt, 
+                              Int_t timeCFD, Int_t timeLED, Int_t timeQT0,
+                              Int_t timeQT1, Int_t *labels) 
+ { 
+// Adds Digit 
+  TClonesArray &ldigits = *fDigits; 
+   new(ldigits[fNdigits++]) AliFITDigit( npmt,timeCFD, timeLED, timeQT0, timeQT1, labels);
+}
+
+
+//-------------------------------------------------------------------------
+void AliFIT::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(" FIT_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 AliFIT::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  AliT0RecPointUps
+  //
+  //  char branchname[20];
+  // sprintf(branchname,"%s",GetName());
+  //  strncpy(branchname, GetName(), 20);
+  TString branchname = Form("%s", GetName());
+
+  const char *cH = strstr(option,"H");
+  const char *cD = strstr(option,"D");
+  const char *cS = strstr(option,"S");
+
+    if (cH && fLoader->TreeH())
+  {
+     if (fHits == 0x0) fHits  = new TClonesArray("AliFITHits",  405);
+     AliDetector::MakeBranch(option);
+  } 
+  if (cD && fLoader->TreeD())
+    {
+      MakeBranchInTree(fLoader->TreeD(), GetName(),
+                      &fDigits, 100, 0)->SetAddress(&fDigits);
+      //      fLoader->TreeD()->Branch(branchname.Data(),"AliFITDigit",fDigits);   
+    } 
+   if (cS && fLoader->TreeS())
+    {
+      MakeBranchInTree(fLoader->TreeD(), branchname,
+                      &fDigits, 405, 0);
+      // fLoader->TreeS()->Branch(branchname,"AliFITDigit",&fDigits);
+    } 
+  
+}    
+
+//_____________________________________________________________________________
+void AliFIT::ResetHits()
+{
+  //
+  //reset hits
+  //
+  AliDetector::ResetHits();
+  
+}
+//____________________________________________________________________
+void AliFIT::ResetDigits()
+{
+  //
+  // Reset number of digits and the digits array for this detector
+  //
+  if (fDigits) fDigits->Clear();
+  fNdigits = 0;
+}
+
+//_____________________________________________________________________________
+void AliFIT::SetTreeAddress()
+{
+
+  TTree    *treeH = fLoader->TreeH();
+  
+  if (treeH)
+    {
+      if (fHits == 0x0) fHits  = new TClonesArray("AliFITHits",  405);
+    }
+    
+  AliDetector::SetTreeAddress();
+  TTree *treeD = fLoader->TreeD();
+  if (treeD) {
+    if (fDigits == 0x0)  fDigits  = new TClonesArray("AliFITDigit",100);
+    TBranch* branch = treeD->GetBranch ("FIT");
+    if (branch) branch->SetAddress(&fDigits);
+  }
+
+  // SDigitizer for Federico
+  TTree *treeS = fLoader->TreeS();
+  if (treeS) {
+    //    if (fDigits == 0x0)  fDigits  = new AliFITDigit();
+    TBranch* branch = treeS->GetBranch ("FIT");
+    if (branch) branch->SetAddress(&fDigits);
+  }
+}
+
+
+//_____________________________________________________________________________
+AliDigitizer* AliFIT::CreateDigitizer(AliDigitizationInput* digInput) const
+{
+
+  return new AliFITDigitizer(digInput);
+}
+
+//-------------------------------------------------------------------
+void AliFIT::Digits2Raw()
+{
+//
+// Starting from the FIT digits, writes the Raw Data objects
+//
+
+  fLoader ->LoadDigits("read");
+  TTree* treeD = fLoader->TreeD();
+  if (!treeD) {
+    AliError("no digits tree");
+    return;
+  }
+  TBranch *branch = treeD->GetBranch("FIT");
+
+  AliFITRawData rawWriter;
+  rawWriter.SetVerbose(10);
+  
+  AliDebug(2,Form(" Formatting raw data for FIT "));
+  treeD->GetEntry(0);
+   rawWriter.RawDataFIT(branch);
+  
+  
+  fLoader->UnloadDigits();
+  
+}
+
+//____________________________________________________________________________
+void AliFIT::Raw2Digits(AliRawReader *rawReader,TTree* digitsTree)
+{
+
+ //FIT raw data-> digits conversion
+ // reconstruct time information from raw data
+
+  TClonesArray* digits = new TClonesArray ("AliFITDigit", 100);
+  digitsTree->Branch("FIT", &digits);
+
+
+ AliFITRawReader myrawreader(rawReader);
+ if (!myrawreader.Next())
+   AliDebug(1,Form(" no raw data found!! %i", myrawreader.Next()));
+
+ Int_t allData[500];
+  for (Int_t i=0; i<500; i++)  allData[i]=0;
+ for (Int_t i=0; i<500; i++) 
+   if(myrawreader.GetData(i)>0)  allData[i]=myrawreader.GetData(i);
+ Int_t timeCFD, timeLED, timeQT1, timeQT0;
+ for (Int_t ipmt=0; ipmt<160; ipmt++) {
+   if(allData[ipmt]>0) {
+     timeCFD = allData[ipmt];
+     timeLED = allData[ipmt];
+     timeQT0= allData[ipmt+160];
+     timeQT1 = allData[ipmt+320];
+     AddDigit(ipmt,   timeCFD, timeLED, timeQT0,  timeQT1, 0);
+   }
+ }
+
+ digitsTree->Fill(); 
+ GetLoader()->WriteDigits("OVERWRITE");//write out digits
+ ResetDigits();
+ }
diff --git a/FIT/AliFIT.h b/FIT/AliFIT.h
new file mode 100644 (file)
index 0000000..a03af5a
--- /dev/null
@@ -0,0 +1,89 @@
+#ifndef ALIFIT_H
+#define ALIFIT_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: FIT 
+// Alla.Maevskaya@cern.ch 
+////////////////////////////////////////////////
+#include <AliDetector.h>
+#include <TTree.h>
+#include "AliFIT.h"
+#include "AliFITDigit.h"
+#include "AliFITHits.h"
+class TDirectory;
+class TFile;
+class AliFIT: public AliDetector {
+  
+ public:
+  AliFIT();
+  AliFIT(const char *name, const char *title);
+  virtual       ~AliFIT();
+  virtual void   AddHit(Int_t track, Int_t *vol, Float_t *hits);
+  //  virtual void   CreateGeometry() {};
+  // virtual void   CreateMaterials() {};
+   void AddDigit(Int_t npmt, 
+               Int_t timeCFD, Int_t timeLED, Int_t timeQT0, Int_t timeQT1, Int_t *labels) ;
+ virtual Int_t  IsVersion()const {return 0;}
+  virtual void   Init();
+  //  virtual void   DefineOpticalProperties() {};
+  virtual void   MakeBranch(Option_t *opt=" ");
+  virtual void SetHitsAddressBranch(TBranch *b1)
+  {b1->SetAddress(&fHits);}
+  virtual void   StepManager() {};
+  virtual void   ResetHits();
+  virtual void   ResetDigits();
+  virtual void   SetTreeAddress();
+  virtual AliDigitizer* CreateDigitizer(AliDigitizationInput* digInput) const;
+  virtual  void  Digits2Raw ();
+  virtual void  Raw2Digits (AliRawReader *reader,TTree* digitsTree);
+  
+  virtual void  Raw2Digits() {}
+ protected:
+  Int_t           fIdSens;    // Sensetive Cherenkov photocathode
+  //  AliFITDigit     *fDigits;    // pointer to T0digits
+ private:
+  AliFIT(const AliFIT&);
+  AliFIT& operator=(const AliFIT&);
+  
+  ClassDef(AliFIT,1)  //Base class for the FIT detector
+    };
+
+
+//_____________________________________________________________________________
+#endif
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/FIT/AliFITDigit.cxx b/FIT/AliFITDigit.cxx
new file mode 100644 (file)
index 0000000..cd50596
--- /dev/null
@@ -0,0 +1,59 @@
+/**************************************************************************
+ * 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.                  *
+ **************************************************************************/
+
+/////////////////////////////////////////////////////////////////////////
+//  Class AliFITDigits for FIT digits
+//  fTimeCFD, fTimeLED   for PMT fNPMT
+// amplitude start fTimeQT0 and stop fTimeQT1
+///////////////////////////////////////////////////////////////////////
+
+#include "AliFITDigit.h"
+#include "AliFIT.h"
+
+ClassImp(AliFITDigit)
+
+//-----------------------------------------------
+  AliFITDigit::AliFITDigit() :AliDigit(),
+  fTimeCFD(-1),   
+  fTimeLED(-1),   
+  fTimeQT0(-1),   
+  fTimeQT1(-1),
+  fNPMT(-1)
+{
+  // default contructor    
+}
+
+//_____________________________________________________________________________
+AliFITDigit::AliFITDigit(Int_t npmt,  
+                        Int_t timeCFD, Int_t timeLED, Int_t timeQT0, 
+                        Int_t timeQT1 , Int_t *labels):
+  AliDigit(),
+  fTimeCFD(timeCFD),   
+  fTimeLED(timeLED),   
+  fTimeQT0(timeQT0),   
+  fTimeQT1(timeQT1),
+  fNPMT(npmt)
+{
+  // Constructor
+  // Used in the digitizer
+ if (labels)
+    for(Int_t iTrack = 0; iTrack < 3; ++iTrack) fTracks[iTrack] = labels[iTrack];
+}
+
+//_____________________________________________________________________________
+AliFITDigit::~AliFITDigit() {
+  // destructor
+}
diff --git a/FIT/AliFITDigit.h b/FIT/AliFITDigit.h
new file mode 100644 (file)
index 0000000..804ea81
--- /dev/null
@@ -0,0 +1,44 @@
+#ifndef ALIFITDIGIT_H
+#define ALIFITDIGIT_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+/***********************************************************************
+class for FIT Digits object
+ Alla.Maevskaya@cern.ch 
+***********************************************************************/
+#include <AliDigit.h>
+class AliFITDigit: public AliDigit {
+
+ public:
+  AliFITDigit();
+  AliFITDigit(Int_t npmt, 
+             Int_t timeCFD, Int_t timeLED, Int_t timeQT0, Int_t timeQT1 , 
+             Int_t *labels=0);
+  virtual ~AliFITDigit();
+  Int_t TimeCFD() {return fTimeCFD;}
+  Int_t TimeQT0 () {return fTimeQT0;}
+  Int_t TimeQT1 () {return fTimeQT1;}
+  Int_t NPMT ()  {return fNPMT;}
+
+ private: 
+  
+  Int_t fTimeCFD;    // array's CFD
+  Int_t fTimeLED;    // array's LED
+  Int_t fTimeQT0;    // array's QT0 start QTC amplitude
+  Int_t fTimeQT1;    // array's QT1 stop QTC amplitude
+ Int_t fNPMT;       // number of channel [0,79] C side; [80,159] Aside
+  AliFITDigit( const AliFITDigit& );
+  AliFITDigit& operator=(const AliFITDigit&); 
+  
+  ClassDef(AliFITDigit,1)  //Digit (Header) object for set FIT
+};
+
+
+#endif
+
+
+
+
diff --git a/FIT/AliFITDigitizer.cxx b/FIT/AliFITDigitizer.cxx
new file mode 100644 (file)
index 0000000..9addefd
--- /dev/null
@@ -0,0 +1,257 @@
+/**************************************************************************
+ * 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.                  *
+ **************************************************************************/
+
+
+/******************************************************************
+ *    Produde digits from hits
+ *       digits is TObject and includes
+ *     We are writing array if C & A  TDC
+ *     C & A  ADC (will need for slow simulation)
+ *     TOF first particle C & A
+ *     mean time and time difference (vertex position)
+ *
+ *      Alla.Maevskaya@cern.ch 
+ ****************************************************************/
+
+
+#include <TArrayI.h>
+#include <TFile.h>
+#include <TGraph.h>
+#include <TH1F.h>
+#include <TMath.h>
+#include <TRandom.h>
+#include <TTree.h> 
+
+#include "AliLog.h"
+#include "AliFITDigitizer.h"
+#include "AliFIT.h"
+#include "AliFITHits.h"
+#include "AliFITDigit.h"
+#include "AliDigitizationInput.h"
+#include "AliRun.h"
+#include <AliLoader.h>
+#include <AliRunLoader.h>
+#include <stdlib.h>
+
+ClassImp(AliFITDigitizer)
+
+//___________________________________________
+  AliFITDigitizer::AliFITDigitizer()  :AliDigitizer(),
+                                    fFIT(0),
+                                    fHits(0),
+                                    fDigits(0),
+                                     fNdigits(0)
+{
+// Default ctor - don't use it
+
+}
+
+//___________________________________________
+AliFITDigitizer::AliFITDigitizer(AliDigitizationInput* digInput) 
+  :AliDigitizer(digInput),
+   fFIT(0),
+   fHits(0),
+   fDigits(0),
+   fNdigits(0)
+{
+// ctor which should be used
+}
+
+
+//------------------------------------------------------------------------
+AliFITDigitizer::~AliFITDigitizer()
+{
+// Destructor
+
+  AliDebug(1,"FIT");
+
+ }
+
+//------------------------------------------------------------------------
+Bool_t AliFITDigitizer::Init()
+{
+// Initialization
+  AliDebug(1," Init");
+ return kTRUE;
+
+}
+//---------------------------------------------------------------------
+void AliFITDigitizer::Digitize(Option_t* /*option*/)
+{
+
+  /*
+    Produde digits from hits
+    digits is TObject and includes
+    We are writing array if C & A for each channel CFD, LED, QT0 and QT1
+    C & A  ADC (will need for slow simulation)
+  */
+  
+  
+  
+  //output loader 
+  AliDebug(1,"start...");
+  //input loader
+  //
+  // From hits to digits
+  //
+  
+  AliRunLoader *outRL = AliRunLoader::GetRunLoader(fDigInput->GetOutputFolderName());
+  AliLoader * outFitLoader = outRL->GetLoader("FITLoader");
+  
+  fFIT  = static_cast<AliFIT*>(gAlice->GetDetector("FIT"));
+  if (!fFIT) {
+    AliError("Can not get FIT from gAlice");
+    return;
+  }  
+  fFIT->ResetDigits();
+  
+  DigitizeHits();
+  
+  //load digits    
+  outFitLoader->LoadDigits("UPDATE");
+  TTree *treeD  = outFitLoader->TreeD();
+  if (treeD == 0x0) {
+    outFitLoader->MakeTree("D");
+    treeD = outFitLoader->TreeD();
+  }
+  treeD->Reset();
+  fFIT  = (AliFIT*)outRL ->GetAliRun()->GetDetector("FIT");
+  // Make a branch in the tree 
+  fFIT->MakeBranch("D");
+  treeD->Fill();
+  
+  outFitLoader->WriteDigits("OVERWRITE");
+  fFIT->ResetDigits();
+  outFitLoader->UnloadDigits();
+}
+//____________________________________________________________________________
+void AliFITDigitizer::DigitizeHits()
+{
+
+   Int_t hit, nhits;
+  Float_t time[160], besttime[160];
+  Int_t countE[160];
+  Int_t timeCFD, timeLED, timeQT1, timeQT0;
+
+  Int_t threshold = 0; //photoelectrons
+  Int_t ph2Mip = 200;    
+  Float_t mip2qtc=0.005; 
+  Float_t channelWidth = 24.4 ; 
+  Int_t pmt, mcp, volume, qt; 
+  //eqailized distance from IP
+  Float_t zdetC = 82;
+  Float_t zdetA = 375.;
+  Float_t c = 0.0299792458; // cm/ps
+  Float_t eqdistance = (zdetA - zdetC) /c;
+  
+  AliFITHits  *startHit;
+  TBranch *brHits=0;
+  Int_t nFiles=fDigInput->GetNinputs();
+  for (Int_t inputFile=0; inputFile<nFiles;  inputFile++) {
+    if (inputFile < nFiles-1) {
+      AliWarning(Form("ignoring input stream %d", inputFile));
+      continue;
+     }
+
+  for (Int_t i0=0; i0<160; i0++)
+      {
+       time[i0]=besttime[i0]=999999; countE[i0]=0;
+      }
+  AliRunLoader * inRL = AliRunLoader::GetRunLoader(fDigInput->GetInputFolderName(inputFile));
+  AliLoader * fitLoader = inRL->GetLoader("FITLoader");
+  if (!inRL->GetAliRun()) inRL->LoadgAlice();
+  Int_t numpmt;
+  //read Hits 
+  fitLoader->LoadHits("READ");//probably it is necessary to load them before
+  fHits = fFIT->Hits ();
+  TTree *th = fitLoader->TreeH();
+  brHits = th->GetBranch("FIT");
+  if (brHits) {
+    fFIT->SetHitsAddressBranch(brHits);
+  }else{
+    AliWarning("Branch FIT hit not found for this event");
+    continue;      
+  } 
+  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   = (AliFITHits*) fHits->UncheckedAt(hit);
+       if (!startHit) {
+         AliError("The unchecked hit doesn't exist");
+         break;
+       }
+       pmt = startHit->Pmt();
+       mcp = startHit->MCP();
+       volume = startHit->Volume();
+       numpmt= volume*80 +4*(mcp) + (pmt-1);
+       besttime[numpmt] = startHit->Time();
+       if(besttime[numpmt]<time[numpmt]) time[numpmt]=besttime[numpmt];
+       countE[numpmt]++;
+      } //hits loop
+  } //track loop
+  
+  for (Int_t ipmt=0; ipmt<160; ipmt++)
+    {
+      if (countE[ipmt]>threshold && time[ipmt]<50000 && time[ipmt]>0 ) {
+       //fill ADC
+       // QTC procedure:
+       // 1MIP ->200phe  ;
+         qt= countE[ipmt] /*/ph2Mip*/;  // 50mv/Mip amp in mV 
+         //  fill TDC
+         if (ipmt<80) time[ipmt] = time[ipmt] + eqdistance;
+         timeCFD = Int_t (gRandom->Gaus(time[ipmt], 50)/channelWidth ); 
+         timeLED =  Int_t (time[ipmt]/channelWidth );
+         timeQT0 = 0;
+         timeQT1 = Int_t (qt ) ;
+         AliDebug(1,Form("Digits:::::  numpmt %i  time CFD %i QTC  %i :: counts %i \n ",  ipmt, timeCFD, timeQT1,  countE[ipmt]) );
+         fFIT-> AddDigit(ipmt,   timeCFD, timeLED, timeQT0,  timeQT1, 0);
+      } //hitted PMTs
+    } //pmt loop
+  fitLoader->UnloadHits();
+  
+  }
+}
+
+//____________________________________________________________________________
+void AliFITDigitizer::AddSDigit(Int_t npmt,  
+                               Int_t timeCFD, Int_t timeLED, Int_t timeQT0, 
+                               Int_t timeQT1) 
+ { 
+// Adds Digit 
+  TClonesArray &ldigits = *fDigits;  
+        
+  new(ldigits[fNdigits++]) AliFITDigit(npmt,  
+                                      timeCFD, timeLED, timeQT0, timeQT1);
+        
+}
+//____________________________________________________________________________
+void AliFITDigitizer::ResetDigits()
+{
+
+// Clears Digits
+
+  fNdigits = 0;
+  if (fDigits) fDigits->Clear();
+}
diff --git a/FIT/AliFITDigitizer.h b/FIT/AliFITDigitizer.h
new file mode 100644 (file)
index 0000000..39347be
--- /dev/null
@@ -0,0 +1,49 @@
+#ifndef ALIFITDIGITIZER_H
+#define ALIFITDIGITIZER_H
+/* Copyright(c) 1998-2000, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+/******************************************************************
+ *    Produde digits from hits
+ * Alla.Maevskaya@cern.ch 
+ ********************************************************************/
+
+#include <AliDigitizer.h>
+
+#include <AliDigitizationInput.h>
+class AliFIT;
+class AliFITHits;
+class AliFITDigit;
+
+class AliFITDigitizer : public AliDigitizer {
+ public:
+  
+  AliFITDigitizer();
+  AliFITDigitizer(AliDigitizationInput * digInput);
+  virtual ~AliFITDigitizer();
+  virtual Bool_t Init();
+  TClonesArray *Hits() const {return fHits;}
+  TClonesArray *Digits() const {return fDigits;}
+ // Do the main work
+  void Digitize(Option_t* /*option=0*/) ;
+  void AddDigit(Int_t* digits, Int_t*);
+  void AddSDigit(Int_t npmt,
+                Int_t timeCFD, Int_t timeLED, Int_t timeQT0, Int_t timeQT1) ;
+  void ResetDigits();
+  void DigitizeHits();
+private:
+
+  AliFIT *fFIT;            //!
+  TClonesArray *fHits;   //! List of hits
+  TClonesArray *fDigits;   //! digits
+  Int_t    fNdigits;                //! Number of digits
+
+
+  AliFITDigitizer(const AliFITDigitizer&);
+  AliFITDigitizer& operator=(const AliFITDigitizer&);
+
+    ClassDef(AliFITDigitizer,1)
+};    
+
+#endif
+
diff --git a/FIT/AliFITHits.cxx b/FIT/AliFITHits.cxx
new file mode 100644 (file)
index 0000000..5100f24
--- /dev/null
@@ -0,0 +1,104 @@
+/**************************************************************************
+ * 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.cxx 17501 2007-03-19 16:04:02Z alla $ */
+// 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 "AliFITHits.h"
+
+ClassImp(AliFITHits)
+
+
+  AliFITHits::AliFITHits(): AliHit(),
+                       fVolume(999),  
+                       fPmt(999),    
+                       fMCP(999), 
+                       fParticle(0),
+                       fEtot(0),     
+                       fTime(0)  
+  
+{
+  //
+  //  printf(" @@@ default AliFITHits::AliFITHits\n");
+}
+AliFITHits::AliFITHits(Int_t shunt, Int_t track, Int_t *vol, Float_t *hits):
+  AliHit(shunt, track),
+  fVolume(999),  
+  fPmt(999),  
+  fMCP(999),   
+  fParticle(0),
+  fEtot(0),     
+  fTime(0)  
+{
+//Normal T0 hit ctor
+    // printf(" @@@ AliFITHits::AliFITHits constructor \n");
+    fVolume = vol[2];
+    fMCP = vol[1];
+    fPmt=vol[0];
+    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/FIT/AliFITHits.h b/FIT/AliFITHits.h
new file mode 100644 (file)
index 0000000..721b4b9
--- /dev/null
@@ -0,0 +1,51 @@
+#ifndef ALIFITHits_H
+#define ALIFITHits_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:FIT
+//    Alla.Maevskaya@cern.ch    //
+////////////////////////////////////////////////
+#include "AliHit.h"
+class AliFITHits : public AliHit {
+public:
+
+  AliFITHits();//Empty ctor
+  AliFITHits(Int_t shunt, Int_t track, Int_t *vol, Float_t *hits);
+  virtual ~AliFITHits(){}//Empty virtual dtor
+
+  AliFITHits& operator=(const AliFITHits&)  { return *this; }
+  AliFITHits(const AliFITHits& o):AliHit(),
+    fVolume(999),
+    fPmt(999),
+    fMCP(999),
+    fParticle(0),
+    fEtot(0),
+    fTime(0)
+    { ((AliFITHits &) o).Copy(*this);}
+  
+
+  Int_t Volume() const {return fVolume;}
+  Int_t Pmt() const {return fPmt;}
+  Int_t MCP() const {return fMCP;}
+  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 on MCP 
+  Int_t      fMCP;      // # MCP 
+  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(AliFITHits,1)  //Hits for detector T0
+};
+
+
+
+#endif//ALIT0hit_H
diff --git a/FIT/AliFITRawData.cxx b/FIT/AliFITRawData.cxx
new file mode 100644 (file)
index 0000000..9883089
--- /dev/null
@@ -0,0 +1,444 @@
+/**************************************************************************
+ * 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$ */
+
+///////////////////////////////////////////////////////////////////////////////
+//                                                                           //
+//  FIT raw data conversion class                                            //
+//                                                                           //
+///////////////////////////////////////////////////////////////////////////////
+
+//#include <Riostream.h>
+//#include <TTree.h>
+#include <TMap.h>
+#include "AliFIT.h"
+#include "AliFITRawData.h"
+#include "AliFITDigit.h"
+#include "AliBitPacking.h"
+#include "AliRawDataHeader.h"
+#include "AliRawDataHeaderSim.h"
+#include "AliBitPacking.h"
+#include "AliFstream.h"
+#include "AliRunLoader.h"
+#include "AliDAQ.h"
+
+using std::cout;
+using std::endl;
+ClassImp(AliFITRawData)
+
+//_____________________________________________________________________________
+  AliFITRawData::AliFITRawData():TObject(),
+                                fFITdigitArray(NULL),
+                                fVerbose(0),      
+                                fIndex(-1) ,     
+                                fEventNumber(0), 
+                                fDataHeaderPos(0),
+                                fFile(0x0)   
+    
+{
+  /*
+    -  160 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.
+    
+    -  160x2 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).
+    
+    - Or FIT-A and Or FIT-C 2 channels
+    - FITA-FITC vertex information
+    - Time Meaner (FITA+FITC)/2
+    - 4 MPD  multiplicity signals sum amp both sides
+  */
+  //open the output file
+  // char fileName[15];
+  TString fileName = Form("%s",AliDAQ::DdlFileName("FIT",0));
+  fFile = new AliFstream(fileName.Data());
+  memset(fBuffer,0,512*sizeof(UInt_t));
+  
+  //get event number 
+  AliRunLoader *runloader = AliRunLoader::Instance();
+  if (runloader) {
+    fEventNumber = runloader->GetEventNumber();
+  }
+  
+}
+
+//_____________________________________________________________________________
+
+AliFITRawData::AliFITRawData(const AliFITRawData &r):TObject(),
+                                                    fFITdigitArray(NULL),
+                                                    fVerbose(0),      
+                                                    fIndex(-1) ,     
+                                                    fEventNumber(0), 
+                                                    fDataHeaderPos(0),
+                                                    fFile(0x0)  
+{
+  //
+  // AliFITrawData copy constructor
+  //
+  
+  ((AliFITRawData &) r).Copy(*this);
+  
+}
+
+//_____________________________________________________________________________
+AliFITRawData::~AliFITRawData()
+{
+  //
+  // Destructor
+  //
+}
+
+//_____________________________________________________________________________
+AliFITRawData &AliFITRawData::operator=(const AliFITRawData &r)
+{
+  //
+  // Assignment operator
+  //
+  
+  if (this != &r) ((AliFITRawData &) r).Copy(*this);
+  return *this;
+  
+}
+
+//_____________________________________________________________________________
+void AliFITRawData::GetDigits()
+{
+  
+  //This method packs the FIT digits in a proper 32 bits structure
+
+  //read FIT digits and fill TDC and ADC arrays
+  
+  Int_t digit = -1;
+  Int_t ndigits = fFITdigitArray->GetEntries();
+  AliDebug(2, Form(" Number of read digits = %d",ndigits));
+  AliFITDigit *digs;
+  for(Int_t i=0; i<500; i++) fAllData[i]=-1;
+  // loop on FIT digits
+  for (digit=0; digit<ndigits; digit++) {
+    digs = (AliFITDigit*)fFITdigitArray->UncheckedAt(digit);
+    Int_t pmt = digs->NPMT();
+    fAllData[pmt] = digs->TimeCFD();
+    fAllData[pmt+160] = digs->TimeQT0();
+    fAllData[pmt+320] = digs->TimeQT1();
+  }
+  //  Int_t error=0;
+  
+}
+//---------------------------------------------------------------------------------------
+
+Int_t AliFITRawData::RawDataFIT(TBranch* branch)
+{
+  //This method creates the Raw data files for FIT detector
+  
+  
+  //max number of digits per DDL file times 2
+  //  UInt_t fBuffer[kSize];
+  //  UInt_t baseWord;
+  // UInt_t word;
+  cout.setf( ios_base::hex, ios_base::basefield );
+  
+  fIndex=-1;
+  Int_t ch[4] = {0,2,4,6};
+  
+  fFITdigitArray = * (TClonesArray**) branch->GetAddress();
+
+  AliRawDataHeaderSim header;
+  WriteDataHeader(kTRUE, kFALSE);
+  
+  branch->GetEvent();
+  
+  GetDigits();
+  
+  Int_t time,  positionOfTRMHeader, iTDC, channel;
+  //space for DRM header
+  fIndex += 6;
+  Int_t trm1words=0;
+  
+  for (Int_t itrm=0; itrm <4 ; itrm++) {
+    Int_t startTRM=fIndex;
+    //space for 1st TRM header
+    fIndex ++;
+    positionOfTRMHeader= fIndex;
+    
+    for (Int_t chain=0; chain <2 ; chain++) {
+      // space for chain  header
+      fIndex ++;
+      WriteChainDataHeader(chain+1, 1); // 
+      //data TRM 1 chain 1 
+      for (Int_t det = 0; det < 60; det++) {
+       time = fAllData[det + itrm*120 + chain*60];
+       if (time >0 && time !=999999) {
+         fIndex++;
+         iTDC = det / 4;
+         channel = ch[det - iTDC*4];
+         AliDebug(2, Form("det %i  alldata %i trm %i chain %i tdc %i channel %i \n",det, det + itrm*120 + chain*60, itrm, chain, iTDC, det - iTDC*4) );
+         FillTime(channel,iTDC, time);
+       }
+      } 
+      fIndex++;
+      WriteChainDataTrailer (chain+1);
+    }
+    fIndex++;
+    WriteTrailer(15, 0,fEventNumber,5); // 1st TRM trailer
+    
+    trm1words = fIndex - startTRM;
+    WriteTRMDataHeader(itrm, trm1words , positionOfTRMHeader);
+  }
+  
+  //DRM trailer
+  fIndex++;
+  WriteTrailer(1,0,fEventNumber,5);
+  WriteDRMDataHeader();
+  
+  //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;  
+  
+}
+
+//_____________________________________________________________________________
+
+void  AliFITRawData::WriteDRMDataHeader()
+{
+  //Write a (dummy or real) DDL DRM  data header, 
+  //set the compression bit if compressed
+  //  UInt_t drmheader[4];  
+  cout.setf( ios_base::hex, ios_base::basefield );
+  UInt_t word;
+  UInt_t baseWord=0;
+  //fill DRM headers
+  //DRM Global Header
+  word = 1;
+  AliBitPacking::PackWord(word,baseWord,0, 3); // 0001 
+  word = fIndex ;
+  AliBitPacking::PackWord(word,baseWord,4, 20); // event words 
+  word=124;
+  AliBitPacking::PackWord(word,baseWord, 21, 27); // event words 
+  word=4;
+  AliBitPacking::PackWord(word,baseWord,28, 31);// 0100 marks header
+  fBuffer[0]=  baseWord;
+  //DRM status header 1
+  word = 1;
+  AliBitPacking::PackWord(word,baseWord,0, 3); // 0001 
+  word = 1;
+  AliBitPacking::PackWord(word,baseWord,4, 14); // slotID now 0000000001
+  word = 1;
+  AliBitPacking::PackWord(word,baseWord,15, 15); //if 1  LHC clock is coorectly recieved from CPDM 
+  word=0;
+  AliBitPacking::PackWord(word,baseWord,16,27); // reserve for future use
+  word=4;
+  AliBitPacking::PackWord(word,baseWord,28,31); // 0100 marks header
+  fBuffer[1] = baseWord;
+  
+  word=0;
+  baseWord=0;
+  
+  //DRM status header 2
+  word = 1;
+  AliBitPacking::PackWord(word,baseWord, 0, 3); // 0001 
+  word = 3;
+   AliBitPacking::PackWord(word,baseWord, 4, 14); //enable slotID now 00000000011
+   word = 0;
+   AliBitPacking::PackWord(word,baseWord, 15, 15); // something
+   word=0;
+   AliBitPacking::PackWord(word,baseWord, 16, 27); // fault ID for simulation 0
+   word=4;
+   AliBitPacking::PackWord(word,baseWord,28,31); // 0100 marks header
+   fBuffer[2]=  baseWord;
+   
+   word=0;
+   baseWord=0;
+   //DRM status header 3
+   word = 1;
+   AliBitPacking::PackWord(word,baseWord,0, 3); // 0001 
+   word = 0;
+   AliBitPacking::PackWord(word,baseWord,4, 27); // TTC event counter
+   word=4;
+   AliBitPacking::PackWord(word,baseWord,28,31); // 0100 marks header
+   fBuffer[3]=  baseWord;
+    
+   // new DRM format
+   fBuffer[4]=  baseWord;
+   fBuffer[5]=  baseWord;
+   
+   word=0;
+   baseWord=0;
+   
+}
+  
+//_____________________________________________________________________________
+
+void  AliFITRawData::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;
+  AliBitPacking::PackWord(word,baseWord,0, 3); // slotID
+  word = nWordsInTRM;
+ //+this word - DRM header 
+  
+  AliBitPacking::PackWord(word,baseWord,4, 16); // event words 
+  word=0;
+  AliBitPacking::PackWord(word,baseWord,17,18); // ACQ
+  word=0;
+  AliBitPacking::PackWord(word,baseWord,19,19); //  L SEY inside LUT
+  word=0;
+  AliBitPacking::PackWord(word,baseWord,20,27); //  MBZ
+  word=4;
+  AliBitPacking::PackWord(word,baseWord,28,31); // 0100 marks header
+  fBuffer[positionOfTRMHeader] =  baseWord;
+  word=0; 
+  baseWord=0;
+}
+
+//_____________________________________________________________________________
+
+void  AliFITRawData::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 
+  AliBitPacking::PackWord(word,baseWord,0, 3); // slotID
+  word = 0;
+  AliBitPacking::PackWord(word,baseWord,4, 15); // bunchID
+  word=0;
+  AliBitPacking::PackWord(word,baseWord,16,23); // PB24 temperature
+  word=0;
+  AliBitPacking::PackWord(word,baseWord,24,26); //  PB24 ID
+  word=0;
+  AliBitPacking::PackWord(word,baseWord,27,27); //  TS
+  word=chainNumber;
+  AliBitPacking::PackWord(word,baseWord,28,31); // 0100 marks header
+  fBuffer[fIndex] =  baseWord;
+  word=0;
+  baseWord=0;     
+}
+//_____________________________________________________________________________
+
+void  AliFITRawData::WriteChainDataTrailer(UInt_t chainNumber )
+{
+  //Write a (dummy or real) DDL Chain  data trailer 
+  //set the compression bit if compressed
+  //  chainNumber 00 or 10
+  UInt_t word;
+  UInt_t baseWord=0;
+  word = 0; // ask Tatiana 7 or 9 
+  AliBitPacking::PackWord(word,baseWord,0, 3); // status
+  word = 0;
+  AliBitPacking::PackWord(word,baseWord,4, 15); // MBZ
+  word=fEventNumber;
+  AliBitPacking::PackWord(word,baseWord,16,27); // event counter
+  word=chainNumber;
+  AliBitPacking::PackWord(word,baseWord,28,31); // chain number
+ // fIndex++;
+  fBuffer[fIndex] =  baseWord;
+
+  word=0;
+  baseWord=0;       
+}
+//_____________________________________________________________________________
+
+void  AliFITRawData::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  AliFITRawData::WriteTrailer(UInt_t slot, Int_t word1, UInt_t word2, UInt_t word3)
+{
+  //Write a (dummy or real) DDL Chain  data trailer 
+  
+  UInt_t word;
+  UInt_t baseWord=0;
+  word = slot;
+  AliBitPacking::PackWord(word,baseWord,0, 3); // 0001 
+  word=word1;
+  AliBitPacking::PackWord(word,baseWord,4, 15); // CRC ?
+  word = word2;
+  AliBitPacking::PackWord(word,baseWord,16,27); // event counter
+  word=word3;
+  AliBitPacking::PackWord(word,baseWord,28,31); //  marks trailer
+  fBuffer[fIndex] =  baseWord;
+  word=0;
+  baseWord=0;
+  
+}
+
+//---------------------------------------------------------------------------------------
+void  AliFITRawData::FillTime(Int_t ch, Int_t iTDC, Int_t time)
+{
+  //  put all time fields thother in 1 word
+  
+  UInt_t word;
+  UInt_t baseWord=0;
+  
+  word=time;
+  AliBitPacking::PackWord(word,baseWord, 0, 20); // Time 
+  
+  word=ch;
+  AliBitPacking::PackWord(word,baseWord, 21, 23); // number of channel 
+  word=iTDC;
+  AliBitPacking::PackWord(word,baseWord, 24, 27); // TDC ID
+  
+  word=0;
+  AliBitPacking::PackWord(word,baseWord, 28, 28); // E = 0 in simulation
+  word=0;
+  AliBitPacking::PackWord(word,baseWord, 29, 30); // PS bit data 00
+  word=1;
+  AliBitPacking::PackWord(word,baseWord, 31, 31); // 1
+  fBuffer[fIndex]=baseWord;
+  word=0;
+  baseWord=0;
+}
diff --git a/FIT/AliFITRawData.h b/FIT/AliFITRawData.h
new file mode 100644 (file)
index 0000000..113a8ff
--- /dev/null
@@ -0,0 +1,65 @@
+#ifndef ALIFITRAWDATA_H
+#define ALIFITRAWDATA_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+/* $Id$ */
+
+///////////////////////////////////////////////////////////////////////////////
+//                                                                           //
+//  Converts FIT digits into a raw data stream                               //
+//                                                                           //
+///////////////////////////////////////////////////////////////////////////////
+
+#include "TObject.h"
+
+class AliFIT;
+class AliFITDigit;
+class AliFstream;
+class TFile;
+class TMap;
+class AliRawDataHeaderSim;
+class AliFITRawData : public TObject {
+
+ public:
+
+  AliFITRawData();                                   // default constructor
+  AliFITRawData(const AliFITRawData &r);                 // copy constructor
+  virtual ~AliFITRawData();                                // destructor
+  AliFITRawData &operator=(const AliFITRawData &r);      // ass. op.
+
+  Int_t RawDataFIT (TBranch* branch); 
+  // This method generates the files with the FIT detector data
+  void SetVerbose(Int_t Verbose){fVerbose=Verbose;}
+  // To set the verbose level
+  void  GetDigits();
+  //This method formats and stores in buf all the digits of  FIT module
+
+   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  WriteChainDataTrailer(UInt_t chainNumber);
+   void  FillTime(Int_t ch, Int_t iTDC, Int_t time);
+
+  
+ protected:
+
+  TClonesArray *fFITdigitArray;   //Pointer to the FIT digits
+  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 fDataHeaderPos;
+   Int_t fAllData[500];
+  AliFstream* fFile;        //logical name of the I/O file
+  ClassDef(AliFITRawData,1)             //  FIT raw data class
+
+};
+
+
+#endif
diff --git a/FIT/AliFITRawReader.cxx b/FIT/AliFITRawReader.cxx
new file mode 100644 (file)
index 0000000..d92d6df
--- /dev/null
@@ -0,0 +1,236 @@
+/**************************************************************************
+ * 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:  */
+
+//____________________________________________________________________
+//                                                                          
+// FIT 
+// Class for reading FIT RAW data in TOF data format
+//
+#include "AliFITRawReader.h"
+#include "AliBitPacking.h"
+#include "TBits.h"
+
+#include <Riostream.h>
+#include "TMath.h"
+#include "TH1F.h"
+#include "AliLog.h"
+
+using std::cout;
+using std::endl;
+using std::ios_base;
+ClassImp(AliFITRawReader)
+  
+  AliFITRawReader::AliFITRawReader (AliRawReader *rawReader)
+    :  TTask("FITRawReader","read FIT raw  data"),
+       fRawReader(rawReader),
+       fData(NULL),
+       fPosition(0),
+       fBunchID(0),
+       fPrintout(kFALSE)
+    
+{
+  //
+  // create an object to read T0raw digits
+  AliDebug(1,"Start ");
+  
+  fRawReader->Reset();
+  fRawReader->Select("FIT"); 
+  
+}
+//_____________________________________________________________________________
+AliFITRawReader::~AliFITRawReader ()
+{
+  // 
+}
+
+//_____________________________________________________________________________
+
+Bool_t  AliFITRawReader::Next()
+{
+  // read the next raw digit
+  // returns kFALSE if there is no digit left
+// allData array collect data from all channels in one :
+// allData[0] - allData[79]   CFD channels side C
+// allData[80] - allData[159] CFD channels side A
+// allData[160] -   allData[239]  QT0 channels side C
+// allData[240] -   allData[319]  QT0 channels side A
+// allData[320] -   allData[399]  QT1 channels side C
+// allData[400] -   allData[479]  QT1 channels side A
+
+  UInt_t word;
+  Int_t time=0,  itdc=0, ichannel=0, uu; 
+  Int_t numberOfWordsInTRM=0, iTRM=0;
+  Int_t tdcTime, koef;
+  Int_t trm_chain_header =  0x00000000;
+  Int_t  trm_chain_trailer[2] = { 0x10000000, 0x20000000};
+  UInt_t  filler =  0x70000000;
+  Bool_t correct=kTRUE;
+  Int_t header;
+  
+  for ( Int_t k=0; k<500; k++)   fAllData[k] = -1;
+  
+  
+  do {
+    if (!fRawReader->ReadNextData(fData)) return kFALSE;
+  } while (fRawReader->GetDataSize() == 0);
+  
+  fPosition = 0;
+  cout.setf( ios_base::hex, ios_base::basefield );
+  if(fPrintout)
+    cout<<" CDH :: BC ID "<< (fRawReader->GetBCID())<<
+      " Event size"<<fRawReader->GetDataSize()<<
+      " orbit ID "<<fRawReader->GetOrbitID()<< 
+      " event index "<<fRawReader->GetEventIndex()<<
+      " event type " <<fRawReader->GetType()<<endl;
+  //DRM header
+  for (Int_t i=0; i<6; i++) {
+    word = GetNextWord();
+    if(fPrintout && i==0) cout<<" DRM header:: event words "<<AliBitPacking::UnpackWord(word,4, 20)<<endl;;
+    if (fPrintout && i==4 ) cout<<" L0BC ID "<< AliBitPacking::UnpackWord(word,4, 15)<<endl;
+    header = AliBitPacking::UnpackWord(word,28,31);
+    if( header !=4 ) 
+      {
+       AliWarning(Form(" !!!! wrong  DRM header  %x!!!!", word));
+       fRawReader->AddFatalErrorLog(kWrongDRMHeader,Form("w=%x",word));
+       break;
+      }
+  }
+  for (Int_t ntrm=0; ntrm<4; ntrm++)
+    {
+      //TRMheader  
+      word = GetNextWord();
+      header = AliBitPacking::UnpackWord(word,28,31);
+      if ( header != 4 )
+       {
+         AliWarning(Form(" !!!! wrong TRM header  %x!!!!", word));
+         fRawReader->AddMajorErrorLog(kWrongTRMHeader,Form("w=%x",word));
+         break;
+       }
+      numberOfWordsInTRM=AliBitPacking::UnpackWord(word,4,16);
+      if(fPrintout) {
+       cout<<" TRM header :: event words "<<numberOfWordsInTRM;
+       cout<<" ACQ bits "<<AliBitPacking::UnpackWord(word,17,18);
+       cout<<" L bit "<<AliBitPacking::UnpackWord(word,19,19)<<endl;
+      }
+      iTRM=AliBitPacking::UnpackWord(word,0,3);
+      for( Int_t ichain=0; ichain<2; ichain++)
+       {
+         //chain header
+         word = GetNextWord();
+         uu = word & trm_chain_header;
+         if(uu != trm_chain_header) 
+           {
+             AliWarning(Form(" !!!! wrong CHAIN  0  header %x!!!!", word));
+             fRawReader->AddMajorErrorLog(kWrongChain0Header,Form("w=%x",word));
+             break;
+           }
+         fBunchID=AliBitPacking::UnpackWord(word,4,15);
+         if(fPrintout)
+           cout<<" chain "<< ichain<<" header:: BunchID  "<<fBunchID<<endl;
+         word = GetNextWord();
+         tdcTime =  AliBitPacking::UnpackWord(word,31,31);   
+         while(tdcTime==1)
+           {
+             correct = kTRUE;
+             itdc=AliBitPacking::UnpackWord(word,24,27);
+             ichannel=AliBitPacking::UnpackWord(word,21,23);
+             time=AliBitPacking::UnpackWord(word,0,20);
+             
+             koef = GetChannel(iTRM,itdc,ichain,ichannel);
+             if (koef != 0 && fPrintout) 
+               cout<<"RawReader>> "<<"koef "<<koef<<" trm "<<iTRM<<" tdc "<<itdc<<" chain "<<ichain<<              " channel "<<ichannel<<" time "<<time<<endl;
+             if (koef ==-1 ){
+               AliWarning(Form("Incorrect lookup table ! "));
+               fRawReader->AddMajorErrorLog(kIncorrectLUT);
+               correct=kFALSE;
+             }
+             if(correct)   fAllData[koef]=time; 
+             word = GetNextWord();
+               tdcTime =  AliBitPacking::UnpackWord(word,31,31);   
+           }
+           
+         uu = word&trm_chain_trailer[ichain];
+         if(uu != trm_chain_trailer[ichain] )
+           {
+             AliWarning(Form(" !!!! wrong CHAIN %i trailer %x !!!!", ichain, word));
+             fRawReader->AddMajorErrorLog(kWrongChain0Trailer,Form("w=%x",word));
+             break;
+           }
+         if(fPrintout)
+           cout<<" trailer:: event counter "<< AliBitPacking::UnpackWord(word,16,27)<<endl;
+       }
+      
+       word = GetNextWord(); //TRM trailer
+       header = AliBitPacking::UnpackWord(word,28,31);
+       if( header !=5 )
+         {
+           AliWarning(Form(" !!!! wrong TRM GLOBAL trailer  %x!!!!", word));
+           fRawReader->AddMajorErrorLog(kWrongTRMTrailer,Form("w=%x",word));
+           break;
+         }
+       if(fPrintout)
+         cout<<"  TRM trailer :: event counter "<< AliBitPacking::UnpackWord(word,16,27)<<endl;
+    } //TRM loop
+  word = GetNextWord(); //
+  if (word == filler )  word = GetNextWord(); 
+  header = AliBitPacking::UnpackWord(word,28,31);
+  if( header !=5 )
+    {
+      AliWarning(Form(" !!!! wrong DRM GLOBAL trailer  %x!!!!", word));
+      // fRawReader->AddFatalErrorLog(kWrongDRMTrailer,Form("w=%x",word));
+    }
+  if(fPrintout)
+    cout<<" DRM trailer ::event counter "<< AliBitPacking::UnpackWord(word,4,15)<<endl;
+  cout.setf( ios_base::dec, ios_base::basefield );
+  
+  return kTRUE;
+}
+//_____________________________________________________________________________
+Int_t AliFITRawReader::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 AliFITRawReader::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;   
+}
+
+//_____________________________________________________________________________
+UInt_t AliFITRawReader::GetChannel(Int_t iTRM, Int_t iTDC, Int_t iChain, Int_t ichannel)
+{
+  return   iTRM*120 + iChain*60 + iTDC*4 +ichannel;
+}
diff --git a/FIT/AliFITRawReader.h b/FIT/AliFITRawReader.h
new file mode 100644 (file)
index 0000000..6714a3e
--- /dev/null
@@ -0,0 +1,69 @@
+#ifndef ALIFITRAWREADER_H
+#define ALIFITRAWREADER_H
+/***************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights
+ * reserved. 
+ *
+ * Alla Maevskaya INR RAS alla@inr.ru
+ *
+ * See cxx source for full Copyright notice                               
+ ***************************************************************************/
+
+#include <TTask.h>
+#include "AliRawReader.h"
+
+  
+class AliFITRawReader : public TTask {
+  public :
+
+  AliFITRawReader(AliRawReader *rawReader) ;
+
+  virtual  ~AliFITRawReader();
+  AliFITRawReader(const AliFITRawReader& o): TTask(o),
+    fRawReader(0),
+    fData(NULL),
+    fPosition(0),
+    fBunchID(0),
+    fPrintout(kFALSE)
+    {}
+  
+  AliFITRawReader& operator=(const AliFITRawReader&) { return *this; }
+
+
+  Bool_t  Next(); //read next raw digit
+  Int_t            GetPosition();
+  UInt_t         GetNextWord();
+  Int_t GetData( Int_t channel) {return fAllData[channel];}
+
+
+  enum EFITRawReaderError {
+    kIncorrectDataSize = 1,
+    kWrongDRMHeader = 2,
+    kWrongDRMTrailer = 3,
+    kWrongTRMHeader = 4,
+    kWrongTRMTrailer = 5,
+    kWrongChain0Header = 6,
+    kWrongChain0Trailer = 7,
+    kWrongChain1Header = 8,
+    kWrongChain1Trailer = 9,
+    kIncorrectLUT = 10
+  };
+
+   Int_t GetTRMBunchID() {return fBunchID;};
+
+  void SetPrintout(Bool_t pp ) {fPrintout = pp;}
+  UInt_t GetChannel(Int_t iTRM, Int_t iTDC, Int_t iChain, Int_t ichannel);     
+  protected :
+
+  AliRawReader*    fRawReader;    // object for reading the raw data
+  UChar_t*         fData;         // raw data
+  Int_t            fPosition;     // current (32 bit) position in fData
+  Int_t            fBunchID;       //bunchID from TRM chain header
+  Bool_t           fPrintout;      // advanced printout
+  Int_t            fAllData[500]; // container for raw data
+  
+ ClassDef(AliFITRawReader,1) //class for reading T0 Raw data
+};
+
+#endif
diff --git a/FIT/AliFITRecPoint.cxx b/FIT/AliFITRecPoint.cxx
new file mode 100644 (file)
index 0000000..0afc03a
--- /dev/null
@@ -0,0 +1,106 @@
+/**************************************************************************
+ * 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: AliFITRecPointUp.cxx 52436 2011-10-31 14:29:49Z alla $ */
+/////////////////////////////////////////////////////////////////////////
+//  Class AliFITRecPointUp for FIT time and ADC signals
+//  fTimeA  - A side TOF signal
+//  fTimeC  - C side TOF signal
+//  fTimeBestA - TOF first particle on the A side
+//  TimeBestC - TOF first particle on the C side
+//  fTimeAverage = (fTimeBestA + TimeBestLeft ) /2. FIT signal
+//  fVertex - vertex position 
+//
+///////////////////////////////////////////////////////////////////////
+
+
+
+#include "AliFITRecPoint.h"
+#include "AliLog.h"
+
+
+ClassImp(AliFITRecPoint)
+
+//------------------------------------
+  AliFITRecPoint::AliFITRecPoint() : TObject()
+
+  //ctor
+  for (Int_t i=0; i<160; i++) { fTime[i]=0; fADCQTC[i]=0; }
+}
+//_____________________________________________________________________________
+
+AliFITRecPoint::AliFITRecPointUp(const AliFITRecPointUp &r):TObject(){
+  //
+  // AliFITRecPoint copy constructor
+  //
+  for (Int_t i=0; i<160; i++) {
+    fTime[i] = r. fTime[i];
+    fADCQTC[i] = r.fADCQTC[i]; 
+  }
+  //  ((AliFITRecPointUp &) r).Copy(*this);
+
+}
+//_____________________________________________________________________________
+
+/*
+//_____________________________________________________________________________
+
+AliFITRecPointUp& AliFITRecPointUp:: operator=(const AliFITRecPointUp &r)
+{
+  //
+  // assign. operator
+  //
+
+  if (this == &r)
+    return *this;
+  
+  fTimeAverage = r.fTimeAverage;
+  fTimeOnlineMean = r.fTimeOnlineMean;
+  fVertexPosition = r.fVertexPosition;
+  fTimeBestA =  r.fTimeBestA;
+  fTimeBestC = r.fTimeBestC;
+  fMultC = r.fMultC;
+  fMultA = r.fMultA;
+  fFITclock = r.fFITclock;
+  fFITtrig = r.fFITtrig;
+  fPileup = r.fPileup;
+  fSattelite = r.fSattelite;
+  fTime1stA = r.fTime1stA;
+  fTime1stC = r.fTime1stC;
+  for (Int_t i=0; i<160 i++) {
+    fTime[i] = r. fTime[i];
+    fADC[i] = r.fADC[i]; 
+  }
+  
+  return *this;
+}
+
+//_____________________________________________________________________________
+void AliFITRecPoint::SetFITTrig(Bool_t *tr)
+{
+  fFITtrig=0;
+  for (Int_t i=0; i<5; i++) fFITtrig = fFITtrig | (tr[i]?(1<<i):0);
+}
+//_____________________________________________________________________________
+
+void AliFITRecPoint::PrintTriggerSignals(Int_t trig)
+{
+  Bool_t tr[5];
+  for (Int_t i=0; i<5; i++) tr[i] = (trig&(1<<i))!=0;
+
+  AliInfo(Form("FIT triggers tvdc %d orA %d orC %d centr %d semicentral %d",tr[0],tr[1],tr[2],tr[3],tr[4]));
+}
+*/
diff --git a/FIT/AliFITRecPoint.h b/FIT/AliFITRecPoint.h
new file mode 100644 (file)
index 0000000..035b3da
--- /dev/null
@@ -0,0 +1,40 @@
+#ifndef ALIFITRECPOINT_H
+#define ALIFITRECPOINT_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+#include <TObject.h>
+
+
+//___________________________________________
+class AliFITRecPoint: public TObject  {
+////////////////////////////////////////////////////////////////////////
+ public:
+    AliFITRecPoint();
+    AliFITRecPoint(const AliFITRecPoint &o);
+    AliFITRecPoint& operator= (const AliFITRecPoint &) { return *this;}
+    virtual ~AliFITRecPoint() {}
+
+    
+     
+    void    SetTime (Int_t ipmt, Float_t time) { fTime[ipmt] = time;}
+    Float_t GetTime (Int_t ipmt)const { return fTime[ipmt];}
+    void    SetAmp (Int_t ipmt, Float_t adc) { fADCQTC[ipmt] = adc;}
+    Float_t GetAmp (Int_t ipmt) const{ return fADCQTC[ipmt];}
+    
+  private: 
+    Float_t fTime[160];    // array's TDC
+    Float_t fADCQTC[160];    // array's amplitude
+
+    ClassDef(AliFITRecPoint,1)  // RecPoints (Header) object for set:T0
+};
+
+#endif
+
+
+
diff --git a/FIT/AliFITReconstructor.cxx b/FIT/AliFITReconstructor.cxx
new file mode 100644 (file)
index 0000000..f1cfc3a
--- /dev/null
@@ -0,0 +1,209 @@
+/**************************************************************************
+ * 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.                  *
+ **************************************************************************/
+
+/*********************************************************************
+ *  FIT reconstruction and filling ESD
+ *  - reconstruct mean time (interation time) 
+ *  - vertex position
+ *  -  multiplicity
+ ********************************************************************/
+
+#include <AliESDEvent.h>
+#include "AliLog.h"
+#include "AliFITRecPoint.h"
+#include "AliFITDigit.h"
+#include "AliFITReconstructor.h"
+#include "AliESDFIT.h"
+#include "AliLog.h"
+#include "AliESDRun.h"
+#include "AliFITRawReader.h"
+
+#include <TArrayI.h>
+#include <TGraph.h>
+#include <TMath.h>
+#include <Riostream.h>
+
+ClassImp(AliFITReconstructor)
+
+AliFITReconstructor:: AliFITReconstructor(): AliReconstructor(),
+                                            fESD(NULL),
+                                            fESDFIT(NULL)
+
+{
+  //constructor
+  
+   fESDFIT  = new AliESDFIT();
+
+}
+//_____________________________________________________________________________
+void AliFITReconstructor::Init()
+{
+// initializer
+
+  fESDFIT  = new AliESDFIT;
+ }
+
+//______________________________________________________________________
+void AliFITReconstructor::ConvertDigits(AliRawReader* rawReader, TTree* digitsTree) const
+{
+// converts RAW to digits 
+  cout<<" AliFITReconstructor::ConvertDigits "<<rawReader<<" "<<digitsTree<<endl;
+  if (!digitsTree) {
+    AliError("No digits tree!");
+    return;
+  }
+
+  fDigits = new TClonesArray ("AliFITDigit", 100);
+  digitsTree->Branch("FIT", &fDigits);
+
+  AliFITRawReader myrawreader(rawReader);
+  if (myrawreader.Next()) 
+    {
+      Int_t allData[500];
+      for (Int_t i=0; i<500; i++)  allData[i]=0;
+      for (Int_t i=0; i<500; i++) 
+       if(myrawreader.GetData(i)>0)  { 
+         allData[i]=myrawreader.GetData(i);
+       }
+   
+      Int_t timeCFD, timeLED, timeQT1, timeQT0;
+      for (Int_t ipmt=0; ipmt<160; ipmt++) {
+       if(allData[ipmt]>0) {
+         timeCFD = allData[ipmt];
+         timeLED = allData[ipmt];
+         timeQT0= allData[ipmt+160];
+         timeQT1 = allData[ipmt+320];
+         //add digit
+         new((*fDigits)[fDigits->GetEntriesFast()] )
+           AliFITDigit( ipmt,timeCFD, timeLED, timeQT0, timeQT1, 0);
+       }
+      }
+      
+      
+      
+      digitsTree->Fill(); 
+    }
+
+  
+}
+
+ //____________________________________________________________
+void AliFITReconstructor::FillESD(TTree *digitsTree, TTree *clustersTree, AliESDEvent *pESD) const
+{
+  
+  /***************************************************
+  Resonstruct digits to vertex position
+  ****************************************************/
+  
+  AliDebug(1,Form("Start FillESD FIT"));
+  if(!pESD) {
+    AliError("No ESD Event");
+    return;
+  }
+  
+  Float_t channelWidth = 24.4;  
+  Float_t c = 0.0299792458; // cm/ps
+  Float_t currentVertex=0, shift=0;
+  Int_t ncont=-1;
+  /*  const AliESDVertex* vertex = pESD->GetPrimaryVertex();
+  if (!vertex)        vertex = pESD->GetPrimaryVertexSPD();
+  if (!vertex)        vertex = pESD->GetPrimaryVertexTPC();
+  if (!vertex)        vertex = pESD->GetVertex();
+  
+  if (vertex) {
+    AliDebug(2, Form("Got %s (%s) from ESD: %f", 
+                    vertex->GetName(), vertex->GetTitle(), vertex->GetZ()));
+    currentVertex = vertex->GetZ();
+    
+    ncont = vertex->GetNContributors();
+    if(ncont>0 ) {
+      shift = currentVertex/c;
+    }
+  } //vertex
+
+  */
+  // FIT digits reconstruction
+  
+  if (!digitsTree) {
+    AliError("No digits tree!");
+    return;
+  }
+  
+  fDigits = new TClonesArray("AliFITDigit", 100);
+  // digitsTree->Print();
+  TBranch *brDigits=digitsTree->GetBranch("FIT");
+  if (brDigits) 
+    brDigits->SetAddress(&fDigits);
+  else {
+    AliError("no FIT branch");
+    return;
+  }
+  const Float_t max_time = 1e7;
+  Int_t pmt=-1;
+  Float_t  time[160],amp[160];  
+  for(Int_t i=0; i<160; i++)   {  time[i]=max_time; amp[i]=0;}
+  
+  Int_t nEntries = (Int_t)digitsTree->GetEntries();
+  for (Int_t iev=0; iev<nEntries; iev++) {
+    digitsTree->GetEvent(iev,1);
+    brDigits->GetEvent(iev);
+    Int_t nDigits = fDigits->GetEntriesFast(); 
+    for (Int_t dig=0; dig<nDigits; dig++) {    
+      AliFITDigit* digit = (AliFITDigit*) fDigits->At(dig);      
+      pmt = digit->NPMT();
+      time[pmt] = Float_t (digit->TimeCFD() );
+      amp[pmt] = Float_t (digit->TimeQT1() - digit->TimeQT0() );
+    } 
+    fESDFIT->SetFITtime(time);         // best TOF on each PMT 
+    fESDFIT->SetFITamplitude(amp);     // number of particles(MIPs) on each 
+    
+    Float_t firsttime[3] = {max_time,max_time,max_time};
+    
+    Float_t vertexFIT = 9999999;
+    for (Int_t ipmt=0; ipmt<80; ipmt++)//timeC
+         if(time[ipmt]<firsttime[2]) firsttime[2]=time[ipmt]; 
+    
+    for ( Int_t ipmt=80; ipmt<160; ipmt++) 
+         if(time[ipmt]<firsttime[1]) firsttime[1]=time[ipmt]; 
+    
+    
+    AliDebug(5,Form("1stimeA %f , 1sttimeC %f  ",
+                   firsttime[1],
+                   firsttime[2] ) );
+    if (firsttime[1]<max_time && firsttime[2]<max_time)  {
+       firsttime[0] =  channelWidth *(firsttime[1] + firsttime[2])/2;
+       vertexFIT =  c*channelWidth*(firsttime[1] - firsttime[2])/2;
+    }
+      if (firsttime[1]<max_time) 
+       firsttime[1] = firsttime[1] * channelWidth + shift; 
+      
+      if (firsttime[2]<max_time) 
+       firsttime[2] = firsttime[2] * channelWidth - shift; 
+      
+      
+      
+      for(Int_t i=0; i<3; i++) {
+       fESDFIT->SetFITT0(i,firsttime[i]);   // interaction time (ns) 
+      }
+      fESDFIT->SetFITzVertex(vertexFIT); //vertex Z position 
+      
+      
+      AliDebug(1,Form("FIT: SPDshift %f Vertex %f  FITsignal %f ps FITA %f ps FITC %f ps \n",shift, vertexFIT, firsttime[0], firsttime[1],firsttime[2]));
+  }
+  
+   }
diff --git a/FIT/AliFITReconstructor.h b/FIT/AliFITReconstructor.h
new file mode 100644 (file)
index 0000000..1d0700a
--- /dev/null
@@ -0,0 +1,49 @@
+#ifndef ALIFITRECONSTRUCTOR_H
+#define ALIFITRECONSTRUCTOR_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+/******************************************************************** 
+ * header class FIT reconstruction 
+ * Alla Maevskaya INR RAS alla@inr.ru      *
+ * Alla.Maevskaya@cern.ch
+ *******************************************************************/
+
+#include "AliReconstructor.h"
+#include "AliESDFIT.h"
+
+class AliFITReconstructor: public AliReconstructor {
+ public:
+  AliFITReconstructor();
+  virtual ~AliFITReconstructor() {};
+
+  virtual Bool_t HasDigitConversion() const { return kTRUE; }
+  virtual void   ConvertDigits(AliRawReader* rawReader,
+                              TTree* digitsTree) const;
+
+  virtual void Init();
+  virtual  void   Reconstruct(TTree* fdigits, TTree * frecpoints) const {};
+  virtual  void   Reconstruct(AliRawReader*rawReader , TTree* recTree) const {};
+  
+  virtual void     FillESD( AliRawReader*/*rawReader*/,  TTree*clustersTree, AliESDEvent*esd ) const
+  {}
+  virtual void     FillESD( TTree* digitsTree,  TTree*clustersTree, AliESDEvent*esd ) const;
+
+ // static const AliFITRecoParam* GetRecoParam()
+   // { return dynamic_cast<const AliFITRecoParam*>(AliReconstructor::GetRecoParam(11)); } // getting RecoParam obj  TObjArray           fQTC;        // QTC vs #MIPs
+ protected:
+
+   AliESDEvent*             fESD;       // ESD object
+   AliESDFIT*        fESDFIT;       // ESD output object  
+   mutable TClonesArray * fDigits;
+  
+ private:
+  AliFITReconstructor( const AliFITReconstructor&r ); //Not implemented
+  AliFITReconstructor& operator=(const AliFITReconstructor&r); //Not implemented
+
+  ClassDef(AliFITReconstructor, 1)   // class for the T0 reconstruction
+
+};
+
+
+#endif
diff --git a/FIT/AliFITv0.cxx b/FIT/AliFITv0.cxx
new file mode 100644 (file)
index 0000000..4b81d41
--- /dev/null
@@ -0,0 +1,305 @@
+/**************************************************************************
+ * 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: AliT0v1.cxx 50646 2011-07-18 14:40:16Z alla $ */
+
+/////////////////////////////////////////////////////////////////////
+//                                                                 //
+// T0 ( T-zero) detector  version 1                             //
+//
+//Begin Html       
+/*
+<img src="gif/AliT0v1Class.gif">
+*/
+//End Html
+//                                                                  //
+//                                                                  //
+//////////////////////////////////////////////////////////////////////
+
+#include <Riostream.h>
+#include <stdlib.h>
+
+#include "TGeoCompositeShape.h"
+#include "TGeoManager.h"
+#include "TGeoMatrix.h"
+#include "TGeoVolume.h"
+#include "TGeoTube.h"
+#include "TGeoBBox.h"
+#include "TGeoNode.h"
+
+
+#include <TGeoGlobalMagField.h>
+#include <TGraph.h>
+#include <TLorentzVector.h>
+#include <TMath.h>
+#include <TVirtualMC.h>
+#include <TString.h>
+
+#include "AliLog.h"
+#include "AliMagF.h"
+#include "AliRun.h"
+
+#include "AliFITHits.h"
+#include "AliFITv0.h"
+
+#include "AliMC.h"
+#include "AliCDBLocal.h"
+#include "AliCDBStorage.h"
+#include "AliCDBManager.h"
+#include "AliCDBEntry.h"
+#include "AliTrackReference.h"
+
+ClassImp(AliFITv0)
+
+
+//--------------------------------------------------------------------
+AliFITv0::AliFITv0():  AliFIT(),
+                    fIdSens1(0)
+
+{
+  //
+  // Standart constructor for T0 Detector version 0
+}
+//--------------------------------------------------------------------
+AliFITv0::AliFITv0(const char *name, const char *title):
+  AliFIT(name,title),
+  fIdSens1(0)
+{
+  //
+  // Standart constructor for T0 Detector version 0
+  //
+  printf("@@@@@@@@@@@@@@@ AliFITv0::AliFITv0 \n");
+  fIshunt = 2; 
+}
+//_____________________________________________________________________________
+
+AliFITv0::~AliFITv0() 
+{
+  // desctructor  
+}
+
+//-------------------------------------------------------------------------
+void AliFITv0::CreateGeometry()
+{
+  //
+  // Create the geometry of FIT Detector version 1 full geometry
+  //
+  // begin Html
+  //
+
+  printf("@@@@@@@@@@@ AliFITv0::CreateGeometry\n");
+  Int_t *idtmed = fIdtmed->GetArray();
+  /*
+  TGeoMedium* kMedAir = gGeoManager->GetMedium("T0_AIR");
+  TGeoMedium* kMedMCPGlass = gGeoManager->GetMedium("T0_glass");
+  TGeoMedium* kMedOptGlass = gGeoManager->GetMedium("T0_OpticalGlass");
+  TGeoMedium* kMedOptGlassCathode = gGeoManager->GetMedium("T0_OpticalGlassCathode");
+  */
+  Float_t zdetC = 80;
+  Float_t zdetA = 373.;
+  Int_t idrotm[999];
+  Double_t x,y,z;
+  Float_t pstart[3] = {6, 20 ,2.6};
+  Float_t pinstart[3] = {3,3,2.55};
+  Float_t  pmcp[3] = {2.95, 2.95, 1.5}; //MCP
+  Float_t ptop[3] = {1.324, 1.324, 1.};//cherenkov radiator
+  Float_t preg[3] = {1.324, 1.324, 0.05};//photcathode 
+  AliMatrix(idrotm[901], 90., 0., 90., 90., 180., 0.);
+  
+  //-------------------------------------------------------------------
+  //  T0 volume 
+  //-------------------------------------------------------------------
+  
+  Float_t x1[20] = {9,  9, 15 ,15 , 9,  
+                   3, -3,  3, -3, -9, 
+                   -9, -9, -15, -15, -9, 
+                   -3, 3, -3, 3, 9}; 
+  
+  Float_t y1[20] = {3.2, -3.2, 3.2, -3.2, -9.2, 
+                   -9, -9, -15, -15, -9.2,
+                   -3.2, 3.2, -3.2, 3.2, 9.2,
+                   9, 9, 15, 15, 9.2};
+  
+  
+  //mother tube
+   gMC->Gsvolu("0STR","TUBE",idtmed[kAir],pstart,18);
+   gMC->Gspos("0STR",1,"ALIC",0.,0.,-zdetC-pstart[2],idrotm[901],"ONLY");
+   gMC->Gspos("0STR",2,"ALIC",0.,0.,zdetA+pstart[2],0,"ONLY");
+   
+   //T0 interior
+   gMC->Gsvolu("0INS","BOX",idtmed[kAir],pinstart,3);
+    z=-pstart[2]+pinstart[2];
+   for (Int_t is=0; is<20; is++) {
+     gMC->Gspos ("0INS", is + 1, "0STR", x1[is], y1[is], z, 0, "ONLY");
+     gMC->Gspos ("0INS", is + 21, "0STR", x1[is], y1[is], z, 0, "ONLY");
+     printf(" 0INS is %i x %f y %f z %f \n",is, x1[is],y1[is], z);
+   }
+   // 
+  x=y=0;
+  // Entry window (glass)
+  gMC->Gsvolu("0TOP","BOX",idtmed[kAir],ptop,3); //glass
+  gMC->Gsvolu ("0REG", "BOX", idtmed[kSensAir], preg, 3); 
+  gMC->Gsvolu("0MCP","BOX",idtmed[kGlass],pmcp,3); //glass
+  Int_t ntops=0;
+  Float_t xin=0, yin=0;
+  for (Int_t ix=0; ix<4; ix++) {
+    xin = - pinstart[0] + 0.35 + (ix+0.5)*2*ptop[0] ;
+    for (Int_t iy=0; iy<4; iy++) {
+      z = - pinstart[2]+ptop[2];
+      yin = - pinstart[1] + 0.35 + (iy+0.5)*2*ptop[1];
+      ntops++;
+      gMC->Gspos("0TOP",ntops,"0INS",xin,yin,z,0,"ONLY");
+     //   printf(" 0TOP  full x %f y %f z %f \n", xin, yin, z);
+      z = -pinstart[2] + 2 * ptop[2] + preg[2];
+      gMC->Gspos ("0REG",ntops, "0INS", xin, yin, z, 0, "ONLY");
+      printf(" GEOGEO  %i %i %i %f %f %f %f %f %f", ntops, ix, iy,
+            xin,yin,x1[ntops],y1[ntops],x1[ntops]+xin,y1[ntops]+yin);
+    }
+  }
+  
+ // MCP
+ //  TGeoVolume* mcp =  gGeoManager->MakeBox("0MCP",kMedMCPGlass, 2.95, 2.95, 1.5);  
+   z=-pinstart[2] + 2*ptop[2] + 2*preg[2] + pmcp[2];
+   gMC->Gspos("0MCP",1,"0INS",0,0,z,0,"ONLY");
+    
+}    
+//------------------------------------------------------------------------
+void AliFITv0::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.
+  //
+  printf("@@@@@@@@@@@@@@@AliFITv0::AddAlignableVolumes()\n");
+  TString volPath;
+  TString symName, sn;
+  TString vpAalign = "/ALIC_1/0STR_1";
+  TString vpCalign = "/ALIC_1/0STR_2";
+  for (Int_t imod=0; imod<2; imod++)  {
+    if (imod==0) {volPath  = vpCalign; symName="/ALIC_1/0STR_1"; }
+    if (imod==1) {volPath  = vpAalign; symName="/ALIC_1/0STR_2"; }
+    
+    AliDebug(2,"--------------------------------------------");
+    AliDebug(2,Form("volPath=%s\n",volPath.Data()));
+    AliDebug(2,Form("symName=%s\n",symName.Data()));
+    AliDebug(2,"--------------------------------------------");
+    if(!gGeoManager->SetAlignableEntry(symName.Data(),volPath.Data()))
+      AliFatal(Form("Alignable entry %s not created. Volume path %s not valid",
+symName.Data(),volPath.Data()));
+  }
+}   
+//------------------------------------------------------------------------
+void AliFITv0::CreateMaterials()
+{
+
+  printf("@@@@@@@@@@@@AliFITv0::CreateMaterials\n"); 
+   Int_t isxfld   = ((AliMagF*)TGeoGlobalMagField::Instance()->GetField())->Integ();
+   Float_t sxmgmx = ((AliMagF*)TGeoGlobalMagField::Instance()->GetField())->Max();
+   //   Float_t a,z,d,radl,absl,buf[1];
+   // Int_t nbuf;
+// 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;
+   Float_t dAir1 = 1.20479E-11;
+                                                                               
+ // 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;
+
+    
+//*** Definition Of avaible T0 materials ***
+   AliMixture(1, "Vacuum$", aAir, zAir, dAir1,4,wAir);
+   AliMixture(2, "Air$", aAir, zAir, dAir,4,wAir);
+   AliMixture( 4, "PMT glass   $",aglass,zglass,dglass,-2,wglass);
+   
+   AliMedium(1, "FIT_Air$", 2, 0, isxfld, sxmgmx, 10., .1, 1., .003, .003);
+   AliMedium(22, "FIT_AirSens$", 2, 1, isxfld, sxmgmx, 10., .1, 1., .003, .003);
+   AliMedium(3, "FIT_Vacuum$", 1, 0, isxfld, sxmgmx, 10., .01, .1, .003, .003);
+   AliMedium(6, "Glass$", 4, 1, isxfld, sxmgmx, 10., .01, .1, .003, .003);
+    
+   AliDebugClass(1,": ++++++++++++++Medium set++++++++++");
+   
+   
+}
+
+
+//-------------------------------------------------------------------
+void AliFITv0::Init()
+{
+  // Initialises version 0 of the Forward Multiplicity Detector
+  //
+  AliFIT::Init();
+  fIdSens1=gMC->VolId("0REG");
+  
+  AliDebug(1,Form("%s: *** FIT version 0 initialized ***\n",ClassName()));
+}
+
+//-------------------------------------------------------------------
+
+void AliFITv0::StepManager()
+{
+  //
+  // Called for every step in the T0 Detector
+  //
+  Int_t id,copy,copy1;
+  static Float_t hits[6];
+  static Int_t vol[3];
+  TLorentzVector pos;
+  TLorentzVector mom;
+  
+  //   TClonesArray &lhits = *fHits;
+  
+  if(!gMC->IsTrackAlive()) return; // particle has disappeared
+  
+  id=gMC->CurrentVolID(copy);  
+  // Check the sensetive volume
+  if(id==fIdSens1 ) { 
+    if(gMC->IsTrackEntering()) {
+      gMC->CurrentVolOffID(1,copy1);
+      vol[1] = copy1;
+      vol[0]=copy;
+      gMC->TrackPosition(pos);
+      hits[0] = pos[0];
+      hits[1] = pos[1];
+      hits[2] = pos[2];
+      if(pos[2]<0) vol[2] = 0;
+      else vol[2] = 1 ;
+      printf(" volumes pmt %i mcp %i side %i x %f y %f z %f\n",  vol[0], vol[1],  vol[2], hits[0], hits[1], hits[2] );
+      
+      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;
+      AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(),vol,hits);
+      // Create a track reference at the exit of photocatode
+    }
+    
+    //charge particle 
+    if ( gMC->TrackCharge() )
+      AddTrackReference(gAlice->GetMCApp()->GetCurrentTrackNumber(), AliTrackReference::kFIT);
+  } //sensitive
+
+}
+
diff --git a/FIT/AliFITv0.h b/FIT/AliFITv0.h
new file mode 100644 (file)
index 0000000..31d0c5e
--- /dev/null
@@ -0,0 +1,43 @@
+#ifndef FITV0_H
+#define FITV0_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+////////////////////////////////////////////////
+//  simple geometry  classes for set: FIT  
+// Alla.Maevskaya@cern.ch 
+////////////////////////////////////////////////
+#include "AliFIT.h"
+#include "TGraph.h" 
+class AliFITv0 : public AliFIT {
+  
+public:
+
+  enum constants {kAir=1, kVac=3,kGlass=6, kSensAir=22};
+
+  AliFITv0();
+  AliFITv0(const char *name, const char *title);
+  AliFITv0(const AliFITv0& o):AliFIT(),
+    fIdSens1(0) {((AliFITv0 &) o).Copy(*this);}
+  
+  AliFITv0& operator=(const AliFITv0&) { return *this; }
+  virtual       ~AliFITv0();
+  virtual void   CreateGeometry();
+  virtual void   AddAlignableVolumes() const;
+  virtual void   CreateMaterials() ;
+  virtual void   Init();
+  virtual Int_t  IsVersion() const {return 0;}
+  virtual void   StepManager();
+
+protected:
+  Int_t fIdSens1; // Sensetive volume  in T0
+  ClassDef(AliFITv0,1)  //Class for FIT version 1
+};
+
+
+#endif
+
+
diff --git a/FIT/AliFITv1.cxx b/FIT/AliFITv1.cxx
new file mode 100644 (file)
index 0000000..192ec2c
--- /dev/null
@@ -0,0 +1,442 @@
+/**************************************************************************
+ * 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.                  *
+ **************************************************************************/
+
+
+/////////////////////////////////////////////////////////////////////
+//                                                                 //
+// FIT detector full geometry  version 1                             //
+//
+//Begin Html       
+/*
+<img src="gif/AliFITv1Class.gif">
+*/
+//End Html
+//                                                                  //
+//                                                                  //
+//////////////////////////////////////////////////////////////////////
+
+#include <Riostream.h>
+#include <stdlib.h>
+
+#include "TGeoCompositeShape.h"
+#include "TGeoManager.h"
+#include "TGeoMatrix.h"
+#include "TGeoVolume.h"
+#include "TGeoTube.h"
+#include "TGeoBBox.h"
+#include "TGeoNode.h"
+
+
+#include <TGeoGlobalMagField.h>
+#include <TGraph.h>
+#include <TLorentzVector.h>
+#include <TMath.h>
+#include <TVirtualMC.h>
+#include <TString.h>
+
+#include "AliLog.h"
+#include "AliMagF.h"
+#include "AliRun.h"
+
+#include "AliFITHits.h"
+#include "AliFITv1.h"
+
+#include "AliMC.h"
+#include "AliCDBLocal.h"
+#include "AliCDBStorage.h"
+#include "AliCDBManager.h"
+#include "AliCDBEntry.h"
+#include "AliTrackReference.h"
+
+ClassImp(AliFITv1)
+
+
+//--------------------------------------------------------------------
+AliFITv1::AliFITv1():  AliFIT(),
+                    fIdSens1(0),
+                    fPMTeff(0x0)
+
+{
+  //
+  // Standart constructor for T0 Detector version 0
+}
+//--------------------------------------------------------------------
+AliFITv1::AliFITv1(const char *name, const char *title):
+  AliFIT(name,title),
+  fIdSens1(0),
+  fPMTeff(0x0)
+
+{
+  //
+  // Standart constructor for T0 Detector version 0
+  //
+  fIshunt = 2; 
+  SetPMTeff();
+}
+//_____________________________________________________________________________
+
+AliFITv1::~AliFITv1() 
+{
+  // desctructor  
+}
+
+//-------------------------------------------------------------------------
+void AliFITv1::CreateGeometry()
+{
+  //
+  // Create the geometry of FIT Detector version 1 full geometry
+  //
+  // begin Html
+  //
+
+  Int_t *idtmed = fIdtmed->GetArray();
+  Float_t zdetC = 83;
+  Float_t zdetA = 375.;
+  
+  Int_t idrotm[999];
+  Double_t x,y,z;
+  Float_t pstart[3] = {6, 20 ,3};
+  Float_t pinstart[3] = {3,3,2.55};
+  Float_t  pmcp[3] = {2.95, 2.95, 1.5}; //MCP
+  Float_t ptop[3] = {1.324, 1.324, 1.};//cherenkov radiator
+  Float_t preg[3] = {1.324, 1.324, 0.05};//photcathode 
+  AliMatrix(idrotm[901], 90., 0., 90., 90., 180., 0.);
+  
+  //-------------------------------------------------------------------
+  //  T0 volume 
+  //-------------------------------------------------------------------
+  
+  Float_t x1[20] = {9,  9, 15 ,15 , 9,  
+                   3, -3,  3, -3, -9, 
+                   -9, -9, -15, -15, -9, 
+                   -3, 3, -3, 3, 9}; 
+  
+  Float_t y1[20] = {3.2, -3.2, 3.2, -3.2, -9.2, 
+                   -9, -9, -15, -15, -9.2,
+                   -3.2, 3.2, -3.2, 3.2, 9.2,
+                   9, 9, 15, 15, 9.2};
+  
+  
+   
+  TGeoVolumeAssembly * stlin = new TGeoVolumeAssembly("0STL");//empty segment  
+ //T0 interior
+  gMC->Gsvolu("0INS","BOX",idtmed[kAir],pinstart,3);
+  TGeoVolume *ins = gGeoManager->GetVolume("0INS");
+ // 
+  TGeoTranslation *tr [20];
+  TString nameTr;
+  for (Int_t itr=0; itr<20; itr++) {
+    nameTr = Form("0TR%i",itr+1);
+    z=-pstart[2]+pinstart[2];
+    tr[itr] = new TGeoTranslation(nameTr.Data(),x1[itr],y1[itr], z );
+    tr[itr]->RegisterYourself();
+    stlin->AddNode(ins,itr,tr[itr]);
+  }
+  TGeoVolume *alice = gGeoManager->GetVolume("ALIC");
+  alice->AddNode(stlin,1,new TGeoTranslation(0,0, zdetA ) );
+  TGeoRotation * rotC = new TGeoRotation( "rotC",90., 0., 90., 90., 180., 0.);
+   alice->AddNode(stlin,2, new TGeoCombiTrans(0., 0., -zdetC , rotC) );
+  
+  x=0;
+  y=0;
+   
+  // Entry window (glass)
+  gMC->Gsvolu("0TOP","BOX",idtmed[kOpGlass],ptop,3); //glass
+  TGeoVolume *top = gGeoManager->GetVolume("0TOP");
+  gMC->Gsvolu ("0REG", "BOX", idtmed[kOpGlassCathode], preg, 3); 
+  TGeoVolume *cat = gGeoManager->GetVolume("0REG");
+  gMC->Gsvolu("0MCP","BOX",idtmed[kGlass],pmcp,3); //glass
+  TGeoVolume *mcp = gGeoManager->GetVolume("0MCP");
+  Int_t ntops=0;
+   Float_t xin=0, yin=0;
+   for (Int_t ix=0; ix<2; ix++) {
+     xin = - pinstart[0] + 0.35 + (ix+0.5)*2*ptop[0] ;
+     for (Int_t iy=0; iy<2; iy++) {
+       z = - pinstart[2]+ptop[2];
+       yin = - pinstart[1] + 0.35 + (iy+0.5)*2*ptop[1];
+       ntops++;
+       ins->AddNode(top, ntops, new TGeoTranslation(xin,yin,z) );
+       // printf(" 0TOP  full x %f y %f z %f \n", xin, yin, z);
+       z = -pinstart[2] + 2 * ptop[2] + preg[2];
+       ins->AddNode(cat, ntops, new TGeoTranslation(xin,yin,z) );
+
+       // printf(" GEOGEO  %i %i %i %f %f %f %f %f %f \n", ntops, ix, iy,
+       //  xin,yin,x1[ntops],y1[ntops],x1[ntops]+xin,y1[ntops]+yin);
+     }
+   }
+// MCP
+   z=-pinstart[2] + 2*ptop[2] + 2*preg[2] + pmcp[2];
+  ins->AddNode(mcp, 1 , new TGeoTranslation(0,0,z) );
+  
+
+}    
+//------------------------------------------------------------------------
+void AliFITv1::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 vpAalign = "/ALIC_1/0STL_1";
+  TString vpCalign = "/ALIC_1/0STL_2";
+  for (Int_t imod=0; imod<2; imod++)  {
+    if (imod==0) {volPath  = vpCalign; symName="/ALIC_1/0STL_1"; }
+    if (imod==1) {volPath  = vpAalign; symName="/ALIC_1/0STL_2"; }
+    
+    AliDebug(2,"--------------------------------------------");
+    AliDebug(2,Form("volPath=%s\n",volPath.Data()));
+    AliDebug(2,Form("symName=%s\n",symName.Data()));
+    AliDebug(2,"--------------------------------------------");
+    if(!gGeoManager->SetAlignableEntry(symName.Data(),volPath.Data()))
+      AliFatal(Form("Alignable entry %s not created. Volume path %s not valid",
+symName.Data(),volPath.Data()));
+   }
+}   
+//------------------------------------------------------------------------
+void AliFITv1::CreateMaterials()
+{
+
+   Int_t isxfld   = ((AliMagF*)TGeoGlobalMagField::Instance()->GetField())->Integ();
+   Float_t sxmgmx = ((AliMagF*)TGeoGlobalMagField::Instance()->GetField())->Max();
+   //   Float_t a,z,d,radl,absl,buf[1];
+   // Int_t nbuf;
+// 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;
+   Float_t dAir1 = 1.20479E-11;
+ // Radiator  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;
+ // MCP glass SiO2
+   Float_t dglass_mcp=1.3;
+//*** Definition Of avaible T0 materials ***
+   AliMixture(1, "Vacuum$", aAir, zAir, dAir1,4,wAir);
+   AliMixture(2, "Air$", aAir, zAir, dAir,4,wAir);
+   AliMixture( 4, "MCP glass   $",aglass,zglass,dglass_mcp,-2,wglass);
+   AliMixture( 24, "Radiator Optical glass$",aglass,zglass,dglass,-2,wglass);
+   
+   AliMedium(1, "Air$", 2, 0, isxfld, sxmgmx, 10., .1, 1., .003, .003);
+   AliMedium(3, "Vacuum$", 1, 0, isxfld, sxmgmx, 10., .01, .1, .003, .003);
+   AliMedium(6, "Glass$", 4, 0, isxfld, sxmgmx, 10., .01, .1, .003, .003);
+  
+   AliMedium(16, "OpticalGlass$", 24, 1, isxfld, sxmgmx, 10., .01, .1, .003, .003);
+    AliMedium(19, "OpticalGlassCathode$", 24, 1, isxfld, sxmgmx, 10., .01, .1, .003, .003);
+   AliMedium(22, "SensAir$", 2, 1, isxfld, sxmgmx, 10., .1, 1., .003, .003);
+   
+   AliDebugClass(1,": ++++++++++++++Medium set++++++++++");
+   
+   
+}
+
+//-------------------------------------------------------------------
+void AliFITv1::DefineOpticalProperties()
+{
+
+
+// Optical properties definition.
+   Int_t *idtmed = fIdtmed->GetArray();
+// Definition Cherenkov parameters
+   int i;
+   const Int_t kNbins=31;
+   
+   Float_t rindexSiO2[kNbins],  efficAll[kNbins], rindexAir[kNbins], absorAir[kNbins],rindexCathodeNext[kNbins], absorbCathodeNext[kNbins];
+   Double_t efficMet[kNbins], aReflMet[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 };  
+  Double_t dPckov[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
+      dPckov[i]=dPckov[i]*1e-9;//Photons energy bins 4 eV - 8.5 eV step 0.1 eV 
+      //      rindexAir[i]=0.0001;
+      rindexAir[i] = 1.;
+      rindexSiO2[i]=1.458; //refractive index for qwarts
+      rindexCathodeNext[i]=0;
+      efficAll[i]=1.;
+      efficMet[i]=0.;
+      aReflMet[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);
+
+   //Define a boarder for radiator optical properties
+   gMC->DefineOpSurface("surfRd", kUnified /*kGlisur*/,kDielectric_metal,kPolished, 0.);
+   gMC->SetMaterialProperty("surfRd", "EFFICIENCY", kNbins, dPckov, efficMet);
+   gMC->SetMaterialProperty("surfRd", "REFLECTIVITY", kNbins, dPckov, aReflMet);
+
+
+}
+
+//-------------------------------------------------------------------
+void AliFITv1::Init()
+{
+// Initialises version 0 of the Forward Multiplicity Detector
+//
+  AliFIT::Init();
+  fIdSens1=gMC->VolId("0REG");
+
+   AliDebug(1,Form("%s: *** FIT version 1 initialized ***\n",ClassName()));
+}
+
+//-------------------------------------------------------------------
+
+void AliFITv1::StepManager()
+{
+  //
+  // Called for every step in the T0 Detector
+  //
+  Int_t id,copy,copy1;
+  static Float_t hits[6];
+  static Int_t vol[3];
+  TLorentzVector pos;
+  TLorentzVector mom;
+  
+  //   TClonesArray &lhits = *fHits;
+  
+  if(!gMC->IsTrackAlive()) return; // particle has disappeared
+  
+  id=gMC->CurrentVolID(copy);  
+  // Check the sensetive volume
+  if(id==fIdSens1 ) { 
+    if(gMC->IsTrackEntering()) {
+      gMC->CurrentVolOffID(1,copy1);
+      vol[1] = copy1;
+      vol[0]=copy;
+      gMC->TrackPosition(pos);
+      hits[0] = pos[0];
+      hits[1] = pos[1];
+      hits[2] = pos[2];
+      if(pos[2]<0) vol[2] = 0;
+      else vol[2] = 1 ;
+      //      printf(" volumes pmt %i mcp %i side %i x %f y %f z %f\n",  vol[0], vol[1],  vol[2], hits[0], hits[1], hits[2] );
+      
+      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 (gMC->TrackPid() == 50000050)   // If particles is photon then ...
+       {
+         //      if(RegisterPhotoE(vol[1]-1,hits[3])) {
+         if(RegisterPhotoE(hits[3])) {
+           AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(),vol,hits);
+           // Create a track reference at the exit of photocatode
+         }         
+       }
+      
+      //charge particle 
+      if ( gMC->TrackCharge() )
+       AddTrackReference(gAlice->GetMCApp()->GetCurrentTrackNumber(), AliTrackReference::kFIT);
+      
+     }// trck entering         
+  } //sensitive
+  
+}
+
+
+
+//------------------------------------------------------------------------
+Bool_t AliFITv1::RegisterPhotoE(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 = fPMTeff->Eval(lambda);
+  Double_t  p = gRandom->Rndm();
+  
+  if (p > eff)
+    return kFALSE;
+  
+  return kTRUE;
+}
+
+//----------------------------------------------------------------------------
+
+void AliFITv1::SetPMTeff()
+{
+  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; 
+
+  fPMTeff = new TGraph(50,lambda,eff);
+}
+
+
+
+
+
diff --git a/FIT/AliFITv1.h b/FIT/AliFITv1.h
new file mode 100644 (file)
index 0000000..a43189a
--- /dev/null
@@ -0,0 +1,47 @@
+#ifndef FITV1_H
+#define FITV1_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+////////////////////////////////////////////////
+// Full geomrtry  hits classes for detector: FIT    //
+////////////////////////////////////////////////
+#include "AliFIT.h"
+#include "TGraph.h" 
+class AliFITv1 : public AliFIT {
+  
+public:
+
+  enum constants {kAir=1, kVac=3, kGlass=6, kOpGlass=16, kOpGlassCathode=19,kSensAir=22};
+
+  AliFITv1();
+  AliFITv1(const char *name, const char *title);
+  AliFITv1(const AliFITv1& o):AliFIT(),
+    fIdSens1(0),
+    fPMTeff(0x0) {((AliFITv1 &) o).Copy(*this);}
+  
+  AliFITv1& operator=(const AliFITv1&) { return *this; }
+  virtual       ~AliFITv1();
+  virtual void   CreateGeometry();
+  virtual void   DefineOpticalProperties();
+  virtual void   AddAlignableVolumes() const;
+  virtual void   CreateMaterials() ;
+  virtual void   Init();
+  virtual Int_t  IsVersion() const {return 0;}
+  Bool_t RegisterPhotoE(Double_t energy);
+  virtual void   StepManager();
+  void SetPMTeff();
+
+protected:
+  Int_t fIdSens1; // Sensetive volume  in T0
+  TGraph *fPMTeff; //pmt registration effeicincy
+  ClassDef(AliFITv1,1)  //Class for FIT version 1
+};
+
+
+#endif
+
+
diff --git a/FIT/CMakeLists.txt b/FIT/CMakeLists.txt
new file mode 100644 (file)
index 0000000..0ee7406
--- /dev/null
@@ -0,0 +1,10 @@
+# AliRoot Build System CMakeLists for T0
+#
+# Author: Johny Jose m(johny.jose@cern.ch)
+#         Port of previous Makefile build to cmake
+
+cmake_minimum_required(VERSION 2.8.4 FATAL_ERROR)
+
+file(GLOB PACKAGES CMake*.pkg)
+
+ALICE_BuildModule()
diff --git a/FIT/CMakelibFITbase.pkg b/FIT/CMakelibFITbase.pkg
new file mode 100644 (file)
index 0000000..162d2b5
--- /dev/null
@@ -0,0 +1,39 @@
+# -*- mode: CMake -*- 
+#--------------------------------------------------------------------------------#
+# Package File for T0base                                                        #
+# Author : Johny Jose (johny.jose@cern.ch)                                       #
+# Variables Defined :                                                            #
+#                                                                                #
+# SRCS - C++ source files                                                        #
+# HDRS - C++ header files                                                        #
+# DHDR - ROOT Dictionary Linkdef header file                                     #
+# CSRCS - C source files                                                         #
+# CHDRS - C header files                                                         #
+# EINCLUDE - Include directories                                                 #
+# EDEFINE - Compiler definitions                                                 #
+# ELIBS - Extra libraries to link                                                #
+# ELIBSDIR - Extra library directories                                           #
+# PACKFFLAGS - Fortran compiler flags for package                                #
+# PACKCXXFLAGS - C++ compiler flags for package                                  #
+# PACKCFLAGS - C compiler flags for package                                      #
+# PACKSOFLAGS - Shared library linking flags                                     #
+# PACKLDFLAGS - Module linker flags                                              #
+# PACKBLIBS - Libraries to link (Executables only)                               #
+# EXPORT - Header files to be exported                                           #
+# CINTHDRS - Dictionary header files                                             #
+# CINTAUTOLINK - Set automatic dictionary generation                             #
+# ARLIBS - Archive Libraries and objects for linking (Executables only)          #
+# SHLIBS - Shared Libraries and objects for linking (Executables only)           #
+#--------------------------------------------------------------------------------#
+
+set ( SRCS 
+    AliFIT.cxx 
+    AliFITDigit.cxx 
+)
+string ( REPLACE ".cxx" ".h" HDRS "${SRCS}" )
+
+set ( DHDR  FITbaseLinkDef.h)
+
+set ( EINCLUDE  RAW STEER/STEER STEER/CDB STEER/ESD STEER/STEERBase)
+
+set ( EXPORT AliFITDigit.h)
diff --git a/FIT/CMakelibFITrec.pkg b/FIT/CMakelibFITrec.pkg
new file mode 100644 (file)
index 0000000..aac9b6a
--- /dev/null
@@ -0,0 +1,40 @@
+# -*- mode: CMake -*- 
+#--------------------------------------------------------------------------------#
+# Package File for T0base                                                        #
+# Author : Johny Jose (johny.jose@cern.ch)                                       #
+# Variables Defined :                                                            #
+#                                                                                #
+# SRCS - C++ source files                                                        #
+# HDRS - C++ header files                                                        #
+# DHDR - ROOT Dictionary Linkdef header file                                     #
+# CSRCS - C source files                                                         #
+# CHDRS - C header files                                                         #
+# EINCLUDE - Include directories                                                 #
+# EDEFINE - Compiler definitions                                                 #
+# ELIBS - Extra libraries to link                                                #
+# ELIBSDIR - Extra library directories                                           #
+# PACKFFLAGS - Fortran compiler flags for package                                #
+# PACKCXXFLAGS - C++ compiler flags for package                                  #
+# PACKCFLAGS - C compiler flags for package                                      #
+# PACKSOFLAGS - Shared library linking flags                                     #
+# PACKLDFLAGS - Module linker flags                                              #
+# PACKBLIBS - Libraries to link (Executables only)                               #
+# EXPORT - Header files to be exported                                           #
+# CINTHDRS - Dictionary header files                                             #
+# CINTAUTOLINK - Set automatic dictionary generation                             #
+# ARLIBS - Archive Libraries and objects for linking (Executables only)          #
+# SHLIBS - Shared Libraries and objects for linking (Executables only)           #
+#--------------------------------------------------------------------------------#
+
+set ( SRCS 
+    AliFITReconstructor.cxx 
+    AliFITRawReader.cxx
+     )
+
+string ( REPLACE ".cxx" ".h" HDRS "${SRCS}" )
+
+set ( DHDR  FITrecLinkDef.h)
+
+set ( EINCLUDE  RAW STEER/STEER STEER/CDB STEER/ESD STEER/STEERBase)
+
+set ( EXPORT AliFITDigit.h)
diff --git a/FIT/CMakelibFITsim.pkg b/FIT/CMakelibFITsim.pkg
new file mode 100644 (file)
index 0000000..c4521e6
--- /dev/null
@@ -0,0 +1,43 @@
+# -*- mode: CMake -*- 
+#--------------------------------------------------------------------------------#
+# Package File for T0base                                                        #
+# Author : Johny Jose (johny.jose@cern.ch)                                       #
+# Variables Defined :                                                            #
+#                                                                                #
+# SRCS - C++ source files                                                        #
+# HDRS - C++ header files                                                        #
+# DHDR - ROOT Dictionary Linkdef header file                                     #
+# CSRCS - C source files                                                         #
+# CHDRS - C header files                                                         #
+# EINCLUDE - Include directories                                                 #
+# EDEFINE - Compiler definitions                                                 #
+# ELIBS - Extra libraries to link                                                #
+# ELIBSDIR - Extra library directories                                           #
+# PACKFFLAGS - Fortran compiler flags for package                                #
+# PACKCXXFLAGS - C++ compiler flags for package                                  #
+# PACKCFLAGS - C compiler flags for package                                      #
+# PACKSOFLAGS - Shared library linking flags                                     #
+# PACKLDFLAGS - Module linker flags                                              #
+# PACKBLIBS - Libraries to link (Executables only)                               #
+# EXPORT - Header files to be exported                                           #
+# CINTHDRS - Dictionary header files                                             #
+# CINTAUTOLINK - Set automatic dictionary generation                             #
+# ARLIBS - Archive Libraries and objects for linking (Executables only)          #
+# SHLIBS - Shared Libraries and objects for linking (Executables only)           #
+#--------------------------------------------------------------------------------#
+
+set ( SRCS 
+    AliFITHits.cxx 
+    AliFITDigitizer.cxx 
+    AliFITv1.cxx
+    AliFITv0.cxx
+    AliFITRawData.cxx
+     )
+
+string ( REPLACE ".cxx" ".h" HDRS "${SRCS}" )
+
+set ( DHDR  FITsimLinkDef.h)
+
+set ( EINCLUDE  RAW STEER/STEER STEER/CDB STEER/ESD STEER/STEERBase)
+
+set ( EXPORT AliFITDigit.h)
diff --git a/FIT/FITbaseLinkDef.h b/FIT/FITbaseLinkDef.h
new file mode 100644 (file)
index 0000000..76dc48c
--- /dev/null
@@ -0,0 +1,14 @@
+#ifdef __CINT__
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+/* $Id: T0baseLinkDef.h 40168 2010-04-06 09:37:48Z alla $ */
+
+#pragma link off all globals;
+#pragma link off all classes;
+#pragma link off all functions;
+#pragma link C++ class  AliFIT+;
+#pragma link C++ class  AliFITDigit+;
+
+#endif
diff --git a/FIT/FITrecLinkDef.h b/FIT/FITrecLinkDef.h
new file mode 100644 (file)
index 0000000..f3f4aa9
--- /dev/null
@@ -0,0 +1,13 @@
+#ifdef __CINT__
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+/* $Id: T0baseLinkDef.h 40168 2010-04-06 09:37:48Z alla $ */
+
+#pragma link off all globals;
+#pragma link off all classes;
+#pragma link off all functions;
+#pragma link C++ class  AliFITReconstructor+;
+#pragma link C++ class  AliFITRawReader+;
+#endif
diff --git a/FIT/FITsimLinkDef.h b/FIT/FITsimLinkDef.h
new file mode 100644 (file)
index 0000000..48c1309
--- /dev/null
@@ -0,0 +1,17 @@
+#ifdef __CINT__
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+/* $Id: T0baseLinkDef.h 40168 2010-04-06 09:37:48Z alla $ */
+
+#pragma link off all globals;
+#pragma link off all classes;
+#pragma link off all functions;
+#pragma link C++ class  AliFITHits+;
+#pragma link C++ class  AliFITDigitizer+;
+#pragma link C++ class  AliFITv1+;
+#pragma link C++ class  AliFITv0+;
+#pragma link C++ class  AliFITRawData+;
+
+#endif
diff --git a/FIT/SetPMTEff.C b/FIT/SetPMTEff.C
new file mode 100644 (file)
index 0000000..019334d
--- /dev/null
@@ -0,0 +1,18 @@
+void SetPMTEff()
+{
+  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; 
+
+  fEffPMT = new TGraph (50,lambda,eff);
+  //  fPMTeff.AddAtAndExpand(gr,ipmt);
+}
diff --git a/STEER/ESD/AliESDFIT.cxx b/STEER/ESD/AliESDFIT.cxx
new file mode 100644 (file)
index 0000000..501b7e4
--- /dev/null
@@ -0,0 +1,110 @@
+/**************************************************************************
+ * 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.                  *
+ **************************************************************************/
+
+//-------------------------------------------------------------------------
+//                        Implemenation Class AliESDFIT
+//   This is a class that summarizes the FIT data for the ESD   
+//   Origin: Alla Maevskaya Alla.Maevskaya@cern.ch 
+//-------------------------------------------------------------------------
+
+
+
+#include "AliESDFIT.h"
+#include "AliLog.h"
+
+
+ClassImp(AliESDFIT)
+
+//______________________________________________________________________________
+AliESDFIT::AliESDFIT() :
+  TObject(),
+  fFITzVertex(0)
+{
+  for(int i = 0; i<160; i++) {
+    fFITtime[i] = -99999;
+    fFITamplitude[i] = 0;
+  }
+  
+  for(int i = 0;i<3;i++) {
+    fT0[i] = -99999;
+    fT0best[i] = -99999;
+  }
+}
+//______________________________________________________________________________
+AliESDFIT::AliESDFIT(const AliESDFIT &tzero ) :
+  TObject(tzero),  
+  fFITzVertex(tzero.fFITzVertex)
+ {
+  // copy constuctor
+  for(int i = 0;i<3;i++) {
+    fT0[i] = tzero.fT0[i];
+    fT0best[i] = tzero.fT0best[i];
+  }
+}
+//______________________________________________________________________________
+AliESDFIT& AliESDFIT::operator=(const AliESDFIT& tzero){
+  // assigmnent operator
+  if(this!=&tzero) {
+    TObject::operator=(tzero);
+      fFITzVertex = tzero.fFITzVertex;
+     for(int i = 0;i<3;i++) {
+      fT0[i] = tzero.fT0[i];
+      fT0best[i] = tzero.fT0best[i];
+    }
+
+   for(int i=0; i<160; i++){
+      fFITtime[i] = tzero.fFITtime[i]; 
+      fFITamplitude[i] = tzero.fFITamplitude[i];
+     }
+   }
+   
+  return *this;
+}
+//______________________________________________________________________________
+void AliESDFIT::Copy(TObject &obj) const {
+  
+  // this overwrites the virtual TOBject::Copy()
+  // to allow run time copying without casting
+  // in AliESDEvent
+
+  if(this==&obj)return;
+  AliESDFIT *robj = dynamic_cast<AliESDFIT*>(&obj);
+  if(!robj)return; // not an AliESDFIT
+  *robj = *this;
+
+}
+
+
+//______________________________________________________________________________
+void AliESDFIT::Reset()
+{
+  // reset contents
+  fFITzVertex = -9999;  
+  for(int i=0; i<160; i++) {
+    fFITtime[i] = fFITamplitude[i] =  0;
+  }
+  for(int i = 0;i<3;i++) {
+    fT0[i] = -9999;
+    fT0best[i] = -9999;
+  }
+}
+
+//______________________________________________________________________________
+void AliESDFIT::Print(const Option_t *) const
+{
+  // does noting fornow
+  AliInfo(Form(" Vertex %f  T0signal %f ns OrA %f ns OrC %f \n",fFITzVertex,  fT0[0],fT0[1],fT0[2]));
+
+}
diff --git a/STEER/ESD/AliESDFIT.h b/STEER/ESD/AliESDFIT.h
new file mode 100644 (file)
index 0000000..81f122f
--- /dev/null
@@ -0,0 +1,63 @@
+
+// -*- mode: C++ -*- 
+#ifndef ALIESDFIT_H
+#define ALIESDFIT_H
+
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+
+//-------------------------------------------------------------------------
+//                          Class AliESDFIT
+//   This is a class that summarizes the FIT data for the ESD   
+//   Origin: Christian Klein-Boesing, CERN, Christian.Klein-Boesing@cern.ch 
+//-------------------------------------------------------------------------
+
+
+
+#include <TObject.h>
+
+class AliESDFIT: public TObject {
+public:
+  AliESDFIT();
+  AliESDFIT(const AliESDFIT& tzero);
+  AliESDFIT& operator=(const AliESDFIT& tzero);
+  virtual void Copy(TObject &obj) const;
+
+  Float_t GetFITzVertex() const {return fFITzVertex;}
+  void SetFITzVertex(Float_t z) {fFITzVertex=z;}
+  //1st
+  Float_t GetFITT0(Int_t i) const {return fT0[i];}
+  const Float_t * GetFITT0() const {return fT0;}
+  void SetFITT0(Int_t icase, Float_t time) { fT0[icase] = time;}
+  //best
+  Float_t GetT0best(Int_t i) const {return fT0best[i];}
+  const Float_t * GetT0best() const {return fT0best;}
+  void SetT0best(Int_t icase, Float_t time) { fT0best[icase] = time;}
+
+  const Float_t * GetFITtime() const {return fFITtime;}
+  void SetFITtime(Float_t time[160]) {
+    for (Int_t i=0; i<160; i++) fFITtime[i] = time[i];
+  }
+  const Float_t * GetFITamplitude() const {return fFITamplitude;}
+  void SetFITamplitude(Float_t amp[160]) {
+    for (Int_t i=0; i<160; i++) fFITamplitude[i] = amp[i];
+  }
+
+  void    Reset();
+  void    Print(const Option_t *opt=0) const;
+
+
+private:
+
+  Float_t   fT0[3];     // interaction time in ps with 1st time( A&C, A, C)
+  Float_t   fFITzVertex;       // vertex z position estimated by the T0, cm
+  Float_t   fFITtime[160];      // best TOF on each T0 PMT
+  Float_t   fFITamplitude[160]; // number of particles(MIPs) on each T0 PMT
+  Float_t   fT0best[3]; // interaction time in ps ( A&C, A, C) with best time
+  
+  ClassDef(AliESDFIT,1)
+};
+
+
+#endif
index e0d8f3e..f8e3519 100644 (file)
@@ -98,7 +98,8 @@ AliAlignObj** AliGeomManager::fgAlignObjs[kLastLayer - kFirstLayer] = {
   0x0
 };
 
-const char* AliGeomManager::fgkDetectorName[AliGeomManager::fgkNDetectors] = {"GRP","ITS","TPC","TRD","TOF","PHOS","HMPID","EMCAL","MUON","FMD","ZDC","PMD","T0","VZERO","ACORDE","AD","MFT"};
+const char* AliGeomManager::fgkDetectorName[AliGeomManager::fgkNDetectors] =
+{"GRP","ITS","TPC","TRD","TOF","PHOS","HMPID","EMCAL","MUON","FMD","ZDC","PMD","T0","VZERO","ACORDE","AD","MFT","FIT"};
 Int_t AliGeomManager::fgNalignable[fgkNDetectors] = {0,0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
 
 TGeoManager* AliGeomManager::fgGeometry = 0x0;
index 079dc3e..983237a 100644 (file)
@@ -121,7 +121,7 @@ public:
   static const char* fgLayerName[kLastLayer - kFirstLayer]; // Name of layers
   static TGeoPNEntry** fgPNEntry[kLastLayer - kFirstLayer]; // TGeoPNEntries
   static AliAlignObj** fgAlignObjs[kLastLayer - kFirstLayer]; // Alignment objects
-  static const Int_t   fgkNDetectors = 17;              // number of detectors    + AD
+  static const Int_t   fgkNDetectors = 18;              // number of detectors    + AD
   static const char *  fgkDetectorName[fgkNDetectors] ; // name of detectors
   static Int_t       fgNalignable[fgkNDetectors];
 
index 0491320..3dcfe74 100644 (file)
@@ -211,7 +211,9 @@ using std::endl;
 
 //_____________________________________________________________________________
 const char* AliReconstruction::fgkStopEvFName = "_stopEvent_";
-const char* AliReconstruction::fgkDetectorName[AliReconstruction::kNDetectors] = {"ITS", "TPC", "TRD", "TOF", "PHOS", "HMPID", "EMCAL", "MUON", "FMD", "ZDC", "PMD", "T0", "VZERO", "ACORDE","AD","MFT", "HLT"};
+const char* AliReconstruction::fgkDetectorName[AliReconstruction::kNDetectors] = {"ITS", "TPC", "TRD",
+"TOF", "PHOS", 
+"HMPID", "EMCAL", "MUON", "FMD", "ZDC", "PMD", "T0", "VZERO", "ACORDE","AD","FIT","MFT", "HLT"};
 
 //_____________________________________________________________________________
 AliReconstruction::AliReconstruction(const char* gAliceFilename) :
index 50f8819..35548b3 100644 (file)
@@ -170,7 +170,7 @@ public:
   void    SetRunPlaneEff(Bool_t flag=kFALSE)  {fRunPlaneEff = flag;}
 
   enum {
-    kNDetectors = 17   // number of detectors    + AD
+    kNDetectors = 18   // number of detectors    + AD +FIT //alla
   };
   static Int_t   GetDetIndex(const char * detector);
   static const char** GetDetectorNames() { return fgkDetectorName; }
index 40fd900..e7158c9 100644 (file)
@@ -13,7 +13,7 @@
  * provided "as is" without express or implied warranty.                  *
  **************************************************************************/
 
-/* $Id: AliSimulation.cxx 63204 2013-06-26 13:33:28Z rgrosso $ */
+/* $Id: AliSimulation.cxx 64623 2013-10-21 13:38:58Z rgrosso $ */
 
 ///////////////////////////////////////////////////////////////////////////////
 //                                                                           //
@@ -156,7 +156,9 @@ using std::ofstream;
 ClassImp(AliSimulation)
 
 AliSimulation *AliSimulation::fgInstance = 0;
-const char* AliSimulation::fgkDetectorName[AliSimulation::fgkNDetectors] = {"ITS", "TPC", "TRD", "TOF", "PHOS", "HMPID", "EMCAL", "MUON", "FMD", "ZDC", "PMD", "T0", "VZERO", "ACORDE","AD","MFT","HLT"};
+ const char* AliSimulation::fgkDetectorName[AliSimulation::fgkNDetectors] = {"ITS", "TPC", "TRD", 
+ "TOF", "PHOS", "HMPID", "EMCAL", "MUON", "FMD", "ZDC", "PMD", "T0", "VZERO", "ACORDE","AD",
+ "FIT","MFT","HLT"};
 
 //_____________________________________________________________________________
 AliSimulation::AliSimulation(const char* configFileName,
index 93b1473..4d7e1ce 100644 (file)
@@ -206,7 +206,7 @@ private:
   time_t          fTimeEnd;            // EOR time-stamp
   
   //QA stuff
-  static const Int_t   fgkNDetectors = 17 ;             // number of detectors    + AD
+  static const Int_t   fgkNDetectors = 18 ;             // number of detectors   +FIT // alla
   static const char *  fgkDetectorName[fgkNDetectors] ; // names of detectors
   TString              fQADetectors ;                   // list of detectors to be QA'ed       
   TString              fQATasks ;                       // list of QA tasks to be performed