new slow simulation up to RawData
authoralla <alla@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 8 Sep 2004 08:05:05 +0000 (08:05 +0000)
committeralla <alla@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 8 Sep 2004 08:05:05 +0000 (08:05 +0000)
13 files changed:
START/AliSTART.cxx
START/AliSTART.h
START/AliSTARTDigitizer.cxx
START/AliSTARTDigitizer.h
START/AliSTARTRawData.cxx [new file with mode: 0644]
START/AliSTARTRawData.h [new file with mode: 0644]
START/AliSTARTdigit.h
START/AliSTARThit.cxx
START/AliSTARThit.h
START/AliSTARTv0.cxx
START/AliSTARTv0.h
START/AliSTARTv1.cxx
START/AliSTARTv1.h

index eecdddab06a962bed24c53574f9996dd32f052e6..ca20910629ed71caa5f36d9741467bc07295200b 100755 (executable)
 #include <TVirtualMC.h>
 #include <AliESD.h>
 
+#include "AliLog.h"
+#include "AliMC.h"
 #include "AliLoader.h"
 #include "AliRun.h"
+
 #include "AliSTART.h"
 #include "AliSTARTLoader.h"
 #include "AliSTARTdigit.h"
 #include "AliSTARThit.h"
-#include "AliSTARThitPhoton.h"
-#include "AliMC.h"
 #include "AliSTARTDigitizer.h"
+#include "AliSTARTRawData.h"
 
 ClassImp(AliSTART)
 
-static  AliSTARTdigit *digits; 
+  //static  AliSTARTdigit *digits; 
 
 //_____________________________________________________________________________
 AliSTART::AliSTART()
@@ -72,7 +74,6 @@ AliSTART::AliSTART()
   fIshunt   = 1;
   fHits     = 0;
   fDigits   = 0;
-  fPhotons  = 0;
 }
  
 //_____________________________________________________________________________
@@ -88,13 +89,8 @@ AliSTART::AliSTART(const char *name, const char *title)
   // Initialise Hit array
   fHits       = new TClonesArray("AliSTARThit",  405);
   gAlice->GetMCApp()->AddHitList(fHits);
-
-  fPhotons  = new TClonesArray("AliSTARThitPhoton", 10000);
-  gAlice->GetMCApp()->AddHitList (fPhotons);
-  if (GetDebug()>2) cout<<" Debug "<<endl;
   fIshunt     =  1;
   fIdSens   =  0;
-  fNPhotons =  0;
   SetMarkerColor(kRed);
 }
 
@@ -104,10 +100,6 @@ AliSTART::~AliSTART() {
     fHits->Delete();
     delete fHits;
   }
-  if (fPhotons) {
-    fPhotons->Delete();
-    delete fPhotons;
-  }
 }
  
 //_____________________________________________________________________________
@@ -120,14 +112,6 @@ void AliSTART::AddHit(Int_t track, Int_t *vol, Float_t *hits)
   new(lhits[fNhits++]) AliSTARThit(fIshunt,track,vol,hits);
 }
 
-//_____________________________________________________________________________
-void AliSTART::AddHitPhoton(Int_t track, Int_t *vol, Float_t *hits)
-{
-  //  Add a START hit of photons
-  
-  TClonesArray &lhits = *fPhotons;
-  new(lhits[fNPhotons++]) AliSTARThitPhoton(fIshunt,track,vol,hits);
-}
 
 //_____________________________________________________________________________
 
@@ -202,28 +186,17 @@ void AliSTART::MakeBranch(Option_t* option)
   // Specific START branches
   //
   // Create Tree branches for the START.
-  Int_t buffersize = 4000;
   char branchname[20];
   sprintf(branchname,"%s",GetName());
 
-
-  const char *cD = strstr(option,"D");
   const char *cH = strstr(option,"H");
   
   if (cH && fLoader->TreeH())
   {
-     if (fPhotons == 0x0) fPhotons  = new TClonesArray("AliSTARThitPhoton", 10000);
-     sprintf (branchname, "%shitPhoton", GetName());
-     MakeBranchInTree (fLoader->TreeH(), branchname, &fPhotons, 50000, 0);
      if (fHits == 0x0) fHits  = new TClonesArray("AliSTARThit",  405);
   } 
   
   AliDetector::MakeBranch(option);
-
-  if (cD) {
-    digits = new AliSTARTdigit();
-    MakeBranchInTree(fLoader->TreeD(), branchname, "AliSTARTdigit", digits, buffersize, 1, 0);
-  } 
 }    
 
 //_____________________________________________________________________________
@@ -231,24 +204,17 @@ void AliSTART::ResetHits()
 {
   AliDetector::ResetHits();
   
-  fNPhotons = 0;
-  if (fPhotons)  fPhotons->Clear();
 }
 
 //_____________________________________________________________________________
 void AliSTART::SetTreeAddress()
 {
-  TBranch  *branch;
+
   TTree    *treeH;
-  
   treeH = TreeH();
   
   if (treeH)
     {
-      if (fPhotons == 0x0) fPhotons  = new TClonesArray("AliSTARThitPhoton", 10000);
-      branch = treeH->GetBranch("STARThitPhoton");
-      if (branch)  branch->SetAddress(&fPhotons);
       if (fHits == 0x0) fHits  = new TClonesArray("AliSTARThit",  405);
     }
     
@@ -259,7 +225,8 @@ void AliSTART::SetTreeAddress()
 //______________________________________________________________________
 AliLoader* AliSTART::MakeLoader(const char* topfoldername)
 { 
-  Info("MakeLoader", "Creating AliSTARTLoader. Top folder is %s.", topfoldername);
+
+  AliDebug(2,Form(" Creating AliSTARTLoader "));
   fLoader = new AliSTARTLoader(GetName(), topfoldername);
   return fLoader;
 }
@@ -269,3 +236,22 @@ AliDigitizer* AliSTART::CreateDigitizer(AliRunDigitizer* manager) const
 {
   return new AliSTARTDigitizer(manager);
 }
+//____________________________________________________________________________
+void AliSTART::Digits2Raw()
+{
+//
+// Starting from the START digits, writes the Raw Data objects
+//
+  AliSTARTLoader* pStartLoader = (AliSTARTLoader*)fLoader;
+  pStartLoader ->LoadDigits();
+  AliSTARTdigit* fDigits=pStartLoader->Digits();
+  AliSTARTRawData rawWriter;
+  rawWriter.SetVerbose(0);
+
+  AliDebug(2,Form(" Formatting raw data for START "));
+  
+  rawWriter.RawDataSTART (fDigits);
+
+   pStartLoader->UnloadDigits();
+
+}
index d5310b90a3f79601452f1a4e9c12b5c7aa4f9413..bfd27af9740fb399845221edb971077827aa4384 100755 (executable)
@@ -26,7 +26,6 @@ public:
    AliSTART(const char *name, const char *title);
    virtual       ~AliSTART();
    virtual void   AddHit(Int_t track, Int_t *vol, Float_t *hits);
-   virtual void   AddHitPhoton(Int_t track, Int_t *vol, Float_t *hits);
    virtual void   AddDigit(Int_t *tracks, Int_t *digits);
    virtual void   BuildGeometry();
    virtual void   CreateGeometry(){}
@@ -35,24 +34,19 @@ public:
    virtual void   DrawDetector(){}
    virtual Int_t  IsVersion()const {return 0;}
    virtual void   Init();
-   virtual void SetHitsAddressBranch(TBranch *b1,TBranch *b2)
-     {b1->SetAddress(&fHits); b2=0;}
+   virtual void SetHitsAddressBranch(TBranch *b1)
+     {b1->SetAddress(&fHits);}
    virtual void   MakeBranch(Option_t *opt=" ");
    virtual void   StepManager(){}
    virtual void   ResetHits();
    virtual void   SetTreeAddress();
    virtual AliLoader* MakeLoader(const char* topfoldername);
-  
-  TClonesArray   *Photons() {return fPhotons;}
-
    virtual AliDigitizer* CreateDigitizer(AliRunDigitizer* manager) const;
+   void  Digits2Raw ();
 
 protected:
    Int_t fIdSens;    // Sensetive Cherenkov radiator
-   Int_t       fNPhotons;   // Number of photons plan to photokatod
-
-   TClonesArray     *fPhotons;   //! List of photons
-
 private:
   ClassDef(AliSTART,3)  //Base class for the T0 aka START detector
 };
index 1f9f8f93c182e91d63bbe4f98df7215602a0f84b..0566cbe724f4476c48b230dccaab33db8c856244 100644 (file)
 #include <TRandom.h>
 #include <TArrayI.h>
 #include <TError.h>
+#include <TH1F.h>
 
-
+#include "AliLog.h"
 #include "AliSTARTDigitizer.h"
 #include "AliSTART.h"
 #include "AliSTARThit.h"
-#include "AliSTARThitPhoton.h"
 #include "AliSTARTdigit.h"
 #include "AliRunDigitizer.h"
 #include <AliDetector.h>
@@ -52,32 +52,28 @@ AliSTARTDigitizer::AliSTARTDigitizer(AliRunDigitizer* manager)
 {
   //   cout<<"AliSTARTDigitizer::AliSTARTDigitizer"<<endl;
 // ctor which should be used
-//  fDebug =0;
-  if (GetDebug())
-    Info("(AliRunDigitizer* manager)" ,"processed");
-
-  ftimeRightTDC = new TArrayI(12); 
-  ftimeLeftTDC = new TArrayI(12); 
-  fRightADC = new TArrayI(12); 
-  fLeftADC = new TArrayI(12); 
+
+  AliDebug(1,"processed");
+
+  ftimeTDC = new TArrayI(24); 
+  fADC = new TArrayI(24); 
 }
 
 //------------------------------------------------------------------------
 AliSTARTDigitizer::~AliSTARTDigitizer()
 {
 // Destructor
-  if(GetDebug()) Info("dtor","START"); 
-  delete ftimeRightTDC;
-  delete ftimeLeftTDC;
-  delete fRightADC;
-  delete fLeftADC;
+
+  AliDebug(1,"START"); 
+  delete ftimeTDC;
+  delete fADC;
 }
 
  //------------------------------------------------------------------------
 Bool_t AliSTARTDigitizer::Init()
 {
 // Initialization
-// cout<<"AliSTARTDigitizer::Init"<<endl;
+  AliDebug(1," Init");
  return kTRUE;
 }
  
@@ -103,28 +99,24 @@ void AliSTARTDigitizer::Exec(Option_t* /*option*/)
   outRL = AliRunLoader::GetRunLoader(fManager->GetOutputFolderName());
   pOutStartLoader = outRL->GetLoader("STARTLoader");
 
-#ifdef DEBUG
-  cout<<"AliSTARTDigitizer::>Hits2Digits start...\n";
-#endif
+  AliDebug(1,"start...");
+
   //
   // From hits to digits
   //
   Int_t hit, nhits;
   Float_t meanTime;
-  Int_t countEr[13],countEl[13];
-  Int_t volume,pmt,tr,tl,sumRight;
-  Int_t  bestRightADC,bestLeftADC;
-  Float_t besttimeleftGaus, besttimerightGaus;
-  Float_t timeright[13]={13*0};
-  Float_t timeleft[13]={13*0};
-  Float_t channelWidth=2.5; //ps
-  Int_t channelWidthADC=1; //ps
-  //  Int_t thresholdAmpl=10;
-
+  Int_t countE[24];
+  Int_t volume,pmt,tr,sumRight;
+  Int_t  bestRightTDC,bestLeftTDC;
+  Float_t time[24]={24*0};
+  Float_t besttime[24]={24*0};
+  Float_t timeGaus[37]={24*0};
+  Float_t channelWidth=25.; //ps
   
   AliSTARThit  *startHit;
   TBranch *brHits=0;
-  TBranch *brHitPhoton=0;
+
   pOutStartLoader->LoadDigits("UPDATE");//probably it is necessary to load them before
   fdigits= new AliSTARTdigit();
   pOutStartLoader->GetDigitsDataLoader()->GetBaseLoader(0)->Post(fdigits);
@@ -132,20 +124,18 @@ void AliSTARTDigitizer::Exec(Option_t* /*option*/)
   Int_t nFiles=fManager->GetNinputs();
   for (Int_t inputFile=0; inputFile<nFiles;  inputFile++) {
     if (inputFile < nFiles-1) {
-      Warning("Exec", "ignoring input stream %d", inputFile);
+      AliWarning(Form("ignoring input stream %d", inputFile));
       continue;
+
     }
 
     Float_t besttimeright=9999.;
     Float_t besttimeleft=9999.;
-    Int_t iTimeDiff=0;
-    Int_t iTimeAv=0;
-    Float_t timeDiff,timeAv; 
+    Float_t timeDiff;
     sumRight=0;
-    for (Int_t i0=0; i0<13; i0++)
+    for (Int_t i0=0; i0<24; i0++)
       {
-       timeright[i0]=0; timeleft[i0]=0;
-       countEr[i0]=0;   countEl[i0]=0;
+       time[i0]=9999;  besttime[i0]=9999;      countE[i0]=0;
       }
 
     inRL = AliRunLoader::GetRunLoader(fManager->GetInputFolderName(inputFile));
@@ -157,127 +147,122 @@ void AliSTARTDigitizer::Exec(Option_t* /*option*/)
 
     TTree *th = pInStartLoader->TreeH();
     brHits = th->GetBranch("START");
-    brHitPhoton = th->GetBranch("STARThitPhoton");
     if (brHits) {
-      fSTART->SetHitsAddressBranch(brHits,brHitPhoton);
+      fSTART->SetHitsAddressBranch(brHits);
     }else{
-      cerr<<"EXEC Branch START hit not found"<<endl;
+       AliError("Branch START hit not found");
       exit(111);
     } 
     Int_t ntracks    = (Int_t) th->GetEntries();
-#ifdef DEBUG
-   Info("Digitizer",ntracks);
-#endif
-     if (ntracks<=0) return;
+
+    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   = (AliSTARThit*) fHits->UncheckedAt(hit);
-       if (!startHit) {
-         ::Error("Exec","The unchecked hit doesn't exist");
-         break;
-       }
-       pmt=startHit->Pmt();
-       volume = startHit->Volume();
-       if(volume==1){
-         timeright[pmt] = startHit->Time();
-         if(timeright[pmt]<besttimeright)
-           {
-             besttimeright=timeright[pmt];
-         } //timeright
-       }//time for right shoulder
-       if(volume==2){            
-         timeleft[pmt] = startHit->Time();
-         if(timeleft[pmt]<besttimeleft)
+       for (hit=0;hit<nhits;hit++) 
+       {
+         startHit   = (AliSTARThit*) fHits->UncheckedAt(hit);
+         if (!startHit) {
+           AliError("The unchecked hit doesn't exist");
+           break;
+         }
+         pmt=startHit->Pmt();
+         Int_t numpmt=pmt-1;
+         Float_t e=startHit->Etot();
+         volume = startHit->Volume();
+         if(RegisterPhotoE(e)) countE[numpmt]++;
+         besttime[numpmt] = startHit->Time();
+         if(besttime[numpmt]<time[numpmt])
            {
-             besttimeleft=timeleft[pmt];
-           
-         } //timeleftbest
-       }//time for left shoulder
-      } //hit loop
+             time[numpmt]=besttime[numpmt];
+           }
+         
+       } //hits loop
     } //track loop
-  
-    // z position
-
+    
+    //best time right&left   
+    for (Int_t ipmt=0; ipmt<12; ipmt++)
+      {
+       timeGaus[ipmt]=gRandom->Gaus(time[ipmt],0.025);
+       if(timeGaus[ipmt]<besttimeleft) besttimeleft=timeGaus[ipmt]; //timeleft
+      }
+    for ( Int_t ipmt=12; ipmt<24; ipmt++)
+      {
+       timeGaus[ipmt]=gRandom->Gaus(time[ipmt],0.025);
+       if(timeGaus[ipmt]<besttimeright)  besttimeright=timeGaus[ipmt]; //timeright
+      }// besttime
+       
     //folding with experimental time distribution
+      Float_t c = 29.9792; // mm/ns
+    Float_t koef=(350.-69.7)/c;
+    Float_t  besttimeleftR= besttimeleft;
+    besttimeleft=koef+besttimeleft;
+    bestLeftTDC=Int_t (besttimeleftR*1000/channelWidth);
+    bestRightTDC=Int_t (besttimeright*1000/channelWidth);
+    timeDiff=(c*(besttimeright-besttimeleftR)-(350.-69.7))/(2*c);
+    meanTime=(besttimeright+besttimeleftR)/2.;
+    Float_t ds=(c*(besttimeright-besttimeleftR)-(350.-69.7))/2;
+    AliDebug(2,Form(" timediff in ns %f  z= %f real point%f",timeDiff,timeDiff*c,ds));
+
+    // Time to TDC signal
+    Int_t iTimeAv=Int_t (meanTime*1000/channelWidth); 
+    // time  channel numbres 
+    //       fill digits
+    fdigits->SetTimeBestLeft(bestLeftTDC);
+    fdigits->SetTimeBestRight(bestRightTDC);
+    fdigits->SetMeanTime(iTimeAv);
     
-    Float_t koef=69.7/350.;
-    besttimeright=koef*besttimeright;
-    besttimeleftGaus=gRandom->Gaus(besttimeleft,0.05);
-    bestLeftADC=Int_t (besttimeleftGaus*1000/channelWidth);
-    besttimerightGaus=gRandom->Gaus(besttimeright,0.05);
-    bestRightADC=Int_t (besttimerightGaus*1000/channelWidth);
-    timeDiff=besttimerightGaus-besttimeleftGaus;
-#ifdef DEBUG
-    cout<<" timediff in ns "<<timeDiff<<" z= "<<timeDiff*30<<endl;
-#endif
-    meanTime=(besttimerightGaus+besttimeleftGaus)/2.;
-    if ( TMath::Abs(timeDiff)<TMath::Abs(0.3) ) 
+    //ADC features
+  
+    for (Int_t i=0; i<24; i++)
       {
-       Float_t t1=1000.*besttimeleftGaus;
-       Float_t t2=1000.*besttimerightGaus;
-       t1=t1/channelWidth;   //time in ps to channelWidth
-       t2=t2/channelWidth;   //time in ps to channelWidth
-       timeAv=(t1+t2)/2.;// time  channel numbres
+
+       //  fill TDC
+       tr= Int_t (timeGaus[i]*1000/channelWidth); 
+       if(timeGaus[i]>100) tr=0;
+       ftimeTDC->AddAt(tr,i);
        
-       // Time to TDC signal
-       // 256 channels for timediff, range 1ns
-       iTimeAv=(Int_t)timeAv; 
-       timeDiff= 512+1000*timeDiff/channelWidth; // time  channel numbres 
-       iTimeDiff=(Int_t)timeDiff;
-       //       fill digits
-       fdigits->SetTimeBestLeft(bestLeftADC);
-       fdigits->SetTimeBestRight(bestRightADC);
-       fdigits->SetMeanTime(iTimeAv);
-       fdigits->SetTimeDiff(iTimeDiff);
-       for (Int_t i=0; i<12; i++)
-         {
-           //  fill TDC
-           timeright[i+1]=gRandom->Gaus(timeright[i+1],0.05);
-           timeleft[i+1]=gRandom->Gaus(timeleft[i+1],0.05);
-           tr= Int_t (timeright[i+1]*1000/channelWidth); 
-           if(tr<200) tr=0;
-           tl= Int_t (timeleft[i+1]*1000/channelWidth); 
-           if(tl<1000) tl=0;
-           
-           ftimeRightTDC->AddAt(tr,i);
-           ftimeLeftTDC->AddAt(tl,i);
-           //fill ADC
-           Int_t al=( Int_t ) countEl[i+1]/ channelWidthADC;
-           Int_t ar=( Int_t ) countEr[i+1]/ channelWidthADC;
-           fRightADC->AddAt(ar,i);
-           fLeftADC ->AddAt(al,i);
-           sumRight+=countEr[i+1];
-         }
-       fdigits->SetTimeRight(*ftimeRightTDC);
-       fdigits->SetTimeLeft(*ftimeLeftTDC);
-       fdigits->SetADCRight(*fRightADC);
-       fdigits->SetADCLeft(*fLeftADC);
-       fdigits->SetSumADCRight(sumRight);
-      }
-    else
-      {timeAv=999999; timeDiff=99999;}
+       //fill ADC
+               Int_t al= countE[i]; //1024 - channel width shoul be change
+       fADC->AddAt(al,i);
+      } //pmt loop
 
+    fdigits->SetTime(*ftimeTDC);
+    fdigits->SetADC(*fADC);
+     
     pInStartLoader->UnloadHits();
+    
   } //input streams loop
-
+     
   pOutStartLoader->WriteDigits("OVERWRITE");
   pOutStartLoader->UnloadDigits();
 }
 
 
 //------------------------------------------------------------------------
-Bool_t AliSTARTDigitizer::RegisterPhotoE(/*AliSTARThitPhoton *hit*/)
+Bool_t AliSTARTDigitizer::RegisterPhotoE(Float_t e)
 {
-    Double_t    pP = 0.2;    
-    Double_t    p;
-    
-    p = gRandom->Rndm();
-    if (p > pP)
-      return kFALSE;
-    
-    return kTRUE;
+
+  
+  //  Float_t hc=197.326960*1.e6; //mev*nm
+  Float_t hc=1.973*1.e-6; //gev*nm
+  Float_t lambda=hc/e;
+  Char_t filename[80];
+  TH1F *hEff;
+  Char_t *dirname=getenv("ALICE_ROOT");
+  sprintf(filename,"%s/START/PMTefficiency.root",dirname);
+  TFile *file= new TFile(filename);
+  file->cd();
+  hEff =  (TH1F*)file->Get("hEff");
+  Int_t bin=  hEff->GetXaxis()->FindBin(lambda);
+  Float_t eff=hEff->GetBinContent(bin);
+  file->Close();
+  Double_t  p = gRandom->Rndm();
+  if (p > eff)
+    return kFALSE;
+  
+  return kTRUE;
 }
 //----------------------------------------------------------------------------
index c0e4e3804a41a4b5974f43813d8316a668ddf8a6..06b22c61ec1acbfb8b43ca885d62c23c34760d18 100644 (file)
@@ -10,7 +10,6 @@
 #include <AliRunDigitizer.h>
 class AliSTART;
 class AliSTARThit;
-class AliSTARThitPhoton;
 class AliSTARTdigit;
 
 class AliSTARTDigitizer : public AliDigitizer {
@@ -21,15 +20,11 @@ class AliSTARTDigitizer : public AliDigitizer {
   virtual ~AliSTARTDigitizer();
   virtual Bool_t Init();
   TClonesArray *Hits() const {return fHits;}
-  TClonesArray *Photons() const {return fPhotons;}
-  TArrayI *timeRightTDC() {return ftimeRightTDC;} //for slow simulation
-  TArrayI *timeLeftTDC() {return ftimeLeftTDC;}
-  TArrayI *RightADC() {return fRightADC;} //for slow simulation
-  TArrayI *LeftADC() {return fLeftADC;}
+  TArrayI *timeTDC() {return ftimeTDC;}
+  TArrayI * ADC() {return fADC;} //for slow simulation
   // Do the main work
   void Exec (Option_t* /*option=0*/) ;
-  Bool_t RegisterPhotoE(/*AliSTARThitPhoton *hit*/);//!!!
-  Bool_t GetDebug() const {return fManager->GetDebug();}
+  Bool_t RegisterPhotoE(Float_t e);
   enum {kBgTag = -1};
 
 private:
@@ -38,10 +33,8 @@ private:
   TClonesArray *fPhotons   ; //Number of Cherenkov photons                   
   TClonesArray *fHits      ; // List of hits
   AliSTARTdigit *fdigits   ; // digits
-  TArrayI *ftimeRightTDC    ; //array of TDC signal from right sida
-  TArrayI *ftimeLeftTDC     ; ////array of TDC signal from left side
-  TArrayI *fRightADC    ;   //array of ADC signal from right sida 
-  TArrayI *fLeftADC     ;//array of ADC signal from left sida
+  TArrayI *ftimeTDC    ; //array of TDC signal from right side
+  TArrayI *fADC     ;//array of ADC signal from left sida
   
     ClassDef(AliSTARTDigitizer,0)
 };    
diff --git a/START/AliSTARTRawData.cxx b/START/AliSTARTRawData.cxx
new file mode 100644 (file)
index 0000000..8792783
--- /dev/null
@@ -0,0 +1,370 @@
+/**************************************************************************
+ * 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$ */
+
+///////////////////////////////////////////////////////////////////////////////
+//                                                                           //
+//  START raw data conversion class                                            //
+//                                                                           //
+///////////////////////////////////////////////////////////////////////////////
+
+#include <Riostream.h>
+
+#include "AliSTART.h"
+#include "AliSTARTRawData.h"
+#include "AliSTARTdigit.h"
+#include "AliSTARTLoader.h"
+
+#include <AliLoader.h>
+#include <AliRunLoader.h>
+#include "/home/alla/AliRoot/verynew/RAW/AliRawDataHeader.h"
+#include "/home/alla/AliRoot/verynew/RAW/AliRawData.h"
+
+ClassImp(AliSTARTRawData)
+
+//_____________________________________________________________________________
+AliSTARTRawData::AliSTARTRawData():TObject()
+{
+
+
+  fIndex=-1;
+  fDigits = NULL;
+  
+  ftimeTDC = new TArrayI(24); 
+   fADC = new TArrayI(24); 
+   
+  this->Dump();
+  
+}
+
+//_____________________________________________________________________________
+AliSTARTRawData::AliSTARTRawData(const AliSTARTRawData &r):TObject()
+{
+  //
+  // AliSTARTrawData copy constructor
+  //
+
+  ((AliSTARTRawData &) r).Copy(*this);
+
+}
+
+//_____________________________________________________________________________
+AliSTARTRawData::~AliSTARTRawData()
+{
+  //
+  // Destructor
+  //
+
+  if (fDigits) {
+    delete fDigits;
+    fDigits = NULL;
+    delete ftimeTDC;
+    delete fADC;
+  }
+
+}
+
+//_____________________________________________________________________________
+AliSTARTRawData &AliSTARTRawData::operator=(const AliSTARTRawData &r)
+{
+  //
+  // Assignment operator
+  //
+
+  if (this != &r) ((AliSTARTRawData &) r).Copy(*this);
+  return *this;
+
+}
+
+//_____________________________________________________________________________
+void AliSTARTRawData::GetDigits(AliSTARTdigit *fDigits, UInt_t *buf)
+{
+  //This method packs the START digits in a proper 32 bits structure
+
+  //read START digits and fill TDC and ADC arrays
+
+  cout<<"GetDigits(AliSTARTdigit *fDigits, UInt_t *buf) "<<endl;
+  UInt_t word;
+  UInt_t baseWord=0;
+  Int_t error=0;
+
+    fDigits->Print();
+
+   // Get the digits array
+
+      fDigits->GetTime(*ftimeTDC);
+      fDigits->GetADC(*fADC);
+      fBestTimeRight=fDigits->GetBestTimeRight();
+      fBestTimeLeft=fDigits->GetBestTimeLeft();
+      fMeanTime = fDigits-> GetMeanTime();
+
+     
+  // Loop through all PMT
+
+  for (Int_t det = 0; det < 24; det++) {
+    Int_t time=ftimeTDC->At(det);
+    Int_t ADC=fADC->At(det);
+    printf(" right det %x time %x ADC %x \n",det,time,ADC);
+    //conver ADC to time (preliminary algorithm)
+
+
+     // DDL 1 0-5 -#PMT, 6-31 - empty
+
+     word=det;;
+     PackWord(baseWord,word, 0, 5); 
+     fIndex++;
+     buf[fIndex]=baseWord;
+
+     word=0;
+     baseWord=0;
+
+     //TDC   
+     word=error;
+     PackWord(baseWord,word,0, 7); // Error flag
+     word=time;
+     PackWord(baseWord,word,8,31); // time-of-flight
+     fIndex++;
+     buf[fIndex]=baseWord;
+     word=0;
+     baseWord=0;
+    
+    // DDL2 2 0-5 -#PMT, 6-31 - empty
+     word=det;;
+     PackWord(baseWord,word, 0, 5); // number of PMT on the right side
+     fIndex++;
+     buf[fIndex]=baseWord;
+     word=0;
+     baseWord=0;
+
+     //  amplified TDC    
+     word=error;
+     PackWord(baseWord,word,0, 7); // Error flag
+     word=time;
+     PackWord(baseWord,word,8,31); // time-of-flight
+     fIndex++;
+     buf[fIndex]=baseWord;
+     word=0;
+     baseWord=0;
+
+     // DDL 3
+     word=det;;
+     PackWord(baseWord,word, 0, 5); // number of PMT on the right side
+     fIndex++;
+     buf[fIndex]=baseWord;
+     word=0;
+     baseWord=0;
+
+     // ADC -> TDC     
+     word=error;
+     PackWord(baseWord,word,0, 7); // Error flag
+     word=ADC;
+     PackWord(baseWord,word,8,31); // time-of-flight
+     fIndex++;
+     buf[fIndex]=baseWord;
+
+     //Amplified  ADC -> TDC 
+     word=0;
+     baseWord=0;
+
+     word=det;;
+     PackWord(baseWord,word, 0, 5); // number of PMT on the right side
+     fIndex++;
+     buf[fIndex]=baseWord;
+     baseWord=0;
+     word=error;
+     PackWord(baseWord,word,0, 7); // Error flag
+     word=ADC;
+     PackWord(baseWord,word,8,31); // time-of-flight
+     fIndex++;
+     buf[fIndex]=baseWord;
+     word=0;
+     baseWord=0;
+
+
+ }
+  /*
+  //timemean
+  fIndex++;
+  buf[fIndex]=baseWord;
+  word=25;
+  PackWord(baseWord,word, 0, 5); // number of PMT on the right side
+  word=fMeanTime;
+  PackWord(baseWord,word, 6, 31); // TDC on the right side from Marin
+  printf("meantime buf[%i]=%x\n",fIndex,buf[fIndex]);
+  
+  fIndex++;
+  buf[fIndex]=baseWord;
+  
+  baseWord=0;
+  
+  word=error;
+  PackWord(baseWord,word,0, 7); // Error flag
+  word=fMeanTime;
+  PackWord(baseWord,word,8,31); // time-of-flight
+  
+  fIndex++;
+  buf[fIndex]=baseWord;
+  
+  printf("meantime buf[%i]=%x\n",fIndex,buf[fIndex]);
+
+     
+  // besttime right & left
+  fIndex++;
+  cout<<" left "<<fBestTimeLeft<<" right "<<fBestTimeRight<<endl;
+  buf[fIndex]=baseWord;
+  word=26;
+  PackWord(baseWord,word, 0, 5); // number of PMT on the right side
+  word=fBestTimeRight;
+  PackWord(baseWord,word, 6, 31); // TDC on the right side from Marin
+  printf("best buf[%i]=%x\n",fIndex,buf[fIndex]);
+  
+  fIndex++;
+  buf[fIndex]=baseWord;
+  
+  baseWord=0;
+  
+  word=error;
+  PackWord(baseWord,word,0, 7); // Error flag
+  word=fBestTimeRight;
+  PackWord(baseWord,word,8,31); // time-of-flight
+  
+  fIndex++;
+  buf[fIndex]=baseWord;
+  
+  printf("4 right buf[%i]=%x\n",fIndex,buf[fIndex]);
+  
+  word=27;
+  PackWord(baseWord,word, 0, 5); // number of PMT on the right side
+  word=fBestTimeLeft;
+  PackWord(baseWord,word, 6, 31); // TDC on the right side from Marin
+  printf("5 left buf[%i]=%x\n",fIndex,buf[fIndex]);
+  
+  fIndex++;
+  buf[fIndex]=baseWord;
+  
+  baseWord=0;
+  
+  word=error;
+  PackWord(baseWord,word,0, 7); // Error flag
+  word=fBestTimeLeft;
+  PackWord(baseWord,word,8,31); // time-of-flight
+  
+  fIndex++;
+  buf[fIndex]=baseWord;
+  
+  printf("5 left buf[%i]=%x\n",fIndex,buf[fIndex]);
+  */   
+  word=0;
+  baseWord=0;
+   
+}
+
+//-------------------------------------------------------------------------------------
+
+void AliSTARTRawData::PackWord(UInt_t &BaseWord, UInt_t Word, Int_t StartBit, Int_t StopBit)
+{
+  //This method packs a word into the Baseword buffer starting form the "StartBit" 
+  //and tacking StopBit-StartBit+1 bits
+  UInt_t dummyWord,offSet;
+  Int_t  length;
+  UInt_t sum;
+  //The BaseWord is being filled with 1 from StartBit to StopBit
+  length=StopBit-StartBit+1;
+  sum=(UInt_t)TMath::Power(2,length)-1;
+
+  if(Word > sum){
+    Error("PackWord", "Word to be filled is not within desired length\n"
+         "Word:%d Start bit:%d Stop Bit:%d",Word,StartBit,StopBit);
+    return;
+  }
+  offSet=sum;
+  offSet<<=StartBit;
+  BaseWord=BaseWord|offSet;
+
+  //The Word to be filled is shifted to the position StartBit
+  //and the remaining  Left and Right bits are filled with 1
+  sum=(UInt_t)TMath::Power(2,StartBit)-1;
+  dummyWord=0xFFFFFFFF<<length;
+  dummyWord +=Word;
+  dummyWord<<=StartBit;
+  dummyWord+=sum;
+  BaseWord=BaseWord&dummyWord;
+
+  return;
+}
+//---------------------------------------------------------------------------------------
+
+Int_t AliSTARTRawData::RawDataSTART(AliSTARTdigit *fDigits){
+  
+  //This method creates the Raw data files for TOF detector
+  const Int_t kSize=512; //2*AliTOFGeometry::NpadXSector() 
+                          //max number of digits per DDL file times 2
+  UInt_t buf[kSize];
+  UInt_t baseWord;
+  UInt_t word;
+
+  fIndex=-1;
+
+  char fileName[15];
+  ofstream outfile;         // logical name of the output file 
+  AliRawDataHeader header;
+  cout<<" AliRawDataHeader header; start "<<endl;
+  //loop over TOF DDL files
+     sprintf(fileName,"START_0xd00.ddl"); //The name of the output file
+#ifndef __DECCXX
+    outfile.open(fileName,ios::binary);
+#else
+    outfile.open(fileName);
+#endif
+    //write Dummy DATA HEADER
+    UInt_t dataHeaderPosition=outfile.tellp();
+    outfile.write((char*)(&header),sizeof(header));
+
+    baseWord=0;
+    word=0;
+    PackWord(baseWord,word,0, 31); // Number of DDL file
+
+    fIndex++;
+    buf[fIndex]=baseWord;
+
+    //   branch->GetEvent();
+
+    //For each DDL file, buf contains the array of data words in Binary format
+    //fIndex gives the number of 32 bits words in the buffer for each DDL file
+    cout<<" AliSTARTRawData::RawDataSTART "<<fDigits<<endl;
+
+    GetDigits(fDigits,buf);
+    cout<<"REAL DATA "<<fIndex<<endl;
+   outfile.write((char *)buf,((fIndex+1)*sizeof(UInt_t)));
+    for(Int_t ii=0;ii<(fIndex+1);ii++) buf[ii]=0;
+     fIndex=-1;
+    
+    //Write REAL DATA HEADER
+    UInt_t currentFilePosition=outfile.tellp();
+    outfile.seekp(dataHeaderPosition);
+    header.fSize=currentFilePosition-dataHeaderPosition;
+    header.SetAttribute(0);  // valid data
+    outfile.write((char*)(&header),sizeof(header));
+    outfile.close();
+
+ //end for
+   
+  return 0;  
+  
+}
diff --git a/START/AliSTARTRawData.h b/START/AliSTARTRawData.h
new file mode 100644 (file)
index 0000000..b74a1d1
--- /dev/null
@@ -0,0 +1,63 @@
+#ifndef ALISTARTRAWDATA_H
+#define ALISTARTRAWDATA_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+/* $Id$ */
+
+///////////////////////////////////////////////////////////////////////////////
+//                                                                           //
+//  Converts START digits into a raw data stream                               //
+//                                                                           //
+///////////////////////////////////////////////////////////////////////////////
+
+#include "TObject.h"
+#include "TArrayI.h"
+class AliSTART;
+class AliSTARTdigit;
+//class AliRawDataHeader;
+class AliSTARTRawData : public TObject {
+
+ public:
+
+  AliSTARTRawData();                                         // default constructor
+  AliSTARTRawData(const AliSTARTRawData &r);                 // copy constructor
+  virtual ~AliSTARTRawData();                                // destructor
+  AliSTARTRawData &operator=(const AliSTARTRawData &r);      // ass. op.
+
+   Int_t RawDataSTART (AliSTARTdigit *fDigits); 
+  // This method generates the files with the TOF detector data
+  void SetVerbose(Int_t Verbose){fVerbose=Verbose;}
+  // To set the verbose level
+  void  GetDigits(AliSTARTdigit *fDigits, UInt_t *buf);
+  //This method formats and stores in buf all the digits of a TOF module
+
+  void  PackWord(UInt_t &BaseWord, UInt_t Word, Int_t StartBit, Int_t StopBit);
+  //This method stores the value of the variable Word of StopBit-StartBit+1 bits 
+  //in BaseWord, starting from the bit StartBit
+
+
+ //START digits arrays
+
+  AliSTARTdigit *fDigits;  //! The START digits manager
+
+  TArrayI *timeTDC() {return ftimeTDC;} 
+  TArrayI *ADC() {return fADC;} 
+  
+  
+ protected:
+
+  Int_t fVerbose;            //Verbose level (0:no msg, 1:msg, 2:digits in txt files)
+  Int_t fIndex;              //number of 32 words to be stored into the output file
+
+  Int_t fBestTimeRight      ; //smallest time on the right side
+  Int_t fBestTimeLeft      ; //smallest time on the left side
+  Int_t fTimeDiff     ; //time difference 
+  Int_t fMeanTime      ; // average time - ALICE start signal 
+  TArrayI *ftimeTDC    ; //array of TDC signal from right side
+  TArrayI *fADC    ;   //array of ADC signal from right sida 
+
+  ClassDef(AliSTARTRawData,1)             //  START raw data class
+
+};
+#endif
index 5fcb2a88380f257504c23d6c0154d9542a1dc47e..97cc24b075c9e668a6cfa947d2ab321f46162bfe 100644 (file)
@@ -13,38 +13,28 @@ class AliSTARTdigit: public TObject  {
  public:
     AliSTARTdigit();
     virtual ~AliSTARTdigit() {}
-    void SetTimeDiff(Int_t time) {fTimeDiff=time;}
     void SetMeanTime(Int_t time) {fTimeAverage=time;}
-    Int_t  GetTimeDiff() {return fTimeDiff;}
     Int_t  GetMeanTime() {return fTimeAverage;}
     Int_t  GetBestTimeRight() {return fTimeBestRight ;}
     Int_t  GetBestTimeLeft() {return fTimeBestLeft ;}
     Int_t  GetSumADCRight() {return fSumADCRight ;}
-    void Print(); 
     void SetTimeBestRight( Int_t time) {fTimeBestRight = time;}
     void SetTimeBestLeft( Int_t time) {fTimeBestLeft = time;}
     void SetSumADCRight( Int_t ADC) {fSumADCRight = ADC;}
     //    void SetProcessKoef( Float_t pp) {fProcessKoef = pp;}
-    virtual void SetTimeRight (TArrayI &o);
-    virtual void SetTimeLeft (TArrayI &o);
-    virtual void GetTimeRight (TArrayI &o);
-    virtual void GetTimeLeft (TArrayI &o);
-    virtual void SetADCRight (TArrayI &o);
-    virtual void SetADCLeft (TArrayI &o);
-    virtual void GetADCRight (TArrayI &o);
-    virtual void GetADCLeft (TArrayI &o);
-    virtual const char* GetName() const {return "START_D";}
+    virtual void SetTime (TArrayI &o);
+    virtual void GetTime (TArrayI &o);
+    virtual void SetADC (TArrayI &o);
+    virtual void GetADC (TArrayI &o);
+     virtual const char* GetName() const {return "START_D";}
   private: 
     //    Float_t fProcessKoef;  // for pp fProcessKoef=1 ; for Pb-Pb - 0.001
     Int_t fTimeAverage;     // Average time
-    Int_t fTimeDiff;        // Time difference
     Int_t fTimeBestRight;   //TOF first particle on the right
     Int_t fTimeBestLeft;    //TOF first particle on the left
     Int_t fSumADCRight;    // multiplicity on the right side
-    TArrayI *fTimeRight;    // right array's TDC
-    TArrayI *fTimeLeft;     // left arraya's TDC
-    TArrayI *fADCRight;    // right array's ADC
-    TArrayI *fADCLeft;     // left arraya's ADC
+    TArrayI *fTime;    // array's TDC
+    TArrayI *fADC;    // array's ADC
 
     ClassDef(AliSTARTdigit,1)  //Digit (Header) object for set:START
 };
index badbccee80d8dfc8d1abe564ac70a58e80b90a1b..534fe0014381b70d75d33fbaf38520bb2eccb1f5 100644 (file)
@@ -77,9 +77,8 @@ AliSTARThit::AliSTARThit(Int_t shunt, Int_t track, Int_t *vol, Float_t *hits):
    fX=hits[0];
    fY=hits[1];
    fZ=hits[2];
-   fEdep=hits[3];
-   fEtot=hits[4];
-   fParticle=Int_t (hits[5]);
-   fTime=hits[6];
+   fEtot=hits[3];
+   fParticle=Int_t (hits[4]);
+   fTime=hits[5];
 }
  
index 706712e857048a9786077483bbaa0d3286b59f41..139ecf99da6827b9ff007df60cebee32b02b2e77 100644 (file)
@@ -18,7 +18,6 @@ public:
   Int_t Volume() const {return fVolume;}
   Int_t Pmt() const {return fPmt;}
   Float_t Particle() const {return fParticle;} 
-  Float_t Edep() const {return fEdep;}
   Float_t Etot() const {return fEtot;}
   Float_t Time() const {return fTime;}
 
@@ -26,7 +25,6 @@ private:
   Int_t      fVolume;   //T0 arm mark
   Int_t      fPmt;      //PMT number in the arm  
   Int_t      fParticle; //Primary particle ID
-  Float_t    fEdep;     //Energy deposition
   Float_t    fEtot;     //Energy of primary particle at the entrance to radiator 
   Float_t    fTime;     //Primary particle TOF 
  
index a93f936623e53536a16edc8b321026c2da38d9f2..e3a86bf6a3b7ba1a1beaedd026ff2b168cb3604b 100755 (executable)
@@ -38,6 +38,7 @@
 #include <TTUBE.h>
 #include <TVirtualMC.h>
 
+#include "AliLog.h"
 #include "AliMagF.h"
 #include "AliRun.h"
 #include "AliSTARThit.h"
@@ -75,14 +76,24 @@ void AliSTARTv0::CreateGeometry()
   Int_t is;
   Int_t idrotm[999];
   Float_t x,y,z;
-
-  Float_t pstart[3]={4.5,10.,4.0};
+ Float_t pstartR[18]={0., 360., 5., 
+                      -76.5+0.00+69.7, 4.25, 10.,
+                      -76.5+6.05+69.7, 4.5, 10., 
+                      -76.5+8.05+69.7, 4.5, 10.,
+                      -76.5+8.05+69.7, 5.1, 10.,
+                      -62.9+0.00+69.7, 5.1, 10.};
+  
+  Float_t pstart[3]={4.3, 12.,6.8};
   Float_t pinstart[3]={0.,1.6,6.5};
-  Float_t ppmt[3]={0.,1.3,3.5};
+  Float_t ppmt[3]={0.,1.5,3.5};
+
+  Float_t preg[3]={0.,0.875,0.005}; //dobavil bogdanov
+
   Float_t pdivider[3]={0.,1.2,1.75};
   Float_t pdiv2[3]={0.,1.2,1.25};
   Float_t pdiv1[3]={0.6,1.2,0.5};
-  Float_t ptop[3]={0.,1.3,1.5};
+  //  Float_t ptop[3]={0.,1.3,1.5};
+  Float_t ptop[3]={0.,1.0,1.5};
   Float_t pbot[3]={0.6,1.2,0.1};
   Float_t pglass[3]={1.2,1.3,2.};
   Float_t pcer[3]={0.9,1.1,0.09};
@@ -94,19 +105,18 @@ void AliSTARTv0::CreateGeometry()
   Float_t pknob_bot[3]={0.,0.6,0.05};
   Float_t pribber[3] = {0.,1.2,2.413/2.};
   Float_t presist[3] = {0.,1.2,0.087/2.};
-  Float_t psupport1[3] = {4.5,4.6,4.0};//C kozhuh vnutri
+  Float_t psupport1[3] = {4.51,4.6,4.0};//C kozhuh vnutri
   Float_t psupport2[3] = {9.4,9.5,4.0};// snaruzhi  C
-  Float_t psupport3[3] = {4.5,9.5,0.05};//kryshki  C
-  Float_t psupport4[3] = {0,1.6,0.05};// dyrki dlia feu v zadnej kryshke Air
-  Float_t psupport5[3] = {1.44,1.5,6.5}; // stakanchik dlai feu  C
+  Float_t psupport3[3] = {4.51,9.5,0.05};//kryshki  C
+   Float_t psupport5[3] = {1.44,1.5,6.5}; // stakanchik dlai feu  C
   Float_t psupport6[3] = {0,1.5,0.05}; //kryshechka stakanchika  Al
   Float_t psupport7[3] = {1.5,1.6,0.6}; //kolechko snaruzhu stakanchika Al
   // Mother Volume katushka dlia krepezha vokrug truby k Absorbru
-  AliMatrix(idrotm[901], 90., 0., 90., 90., 180., 0.);
+    AliMatrix(idrotm[901], 90., 0., 90., 90., 180., 0.);
   Float_t ppcon[70]; 
     ppcon[0]  =   0;
     ppcon[1]  = 360;
-    ppcon[2]  =  15;
+    ppcon[2]  =  13;
 //  1: 
     ppcon[3]  =  14.1/2;
     ppcon[4]  =   4.4;
@@ -118,274 +128,251 @@ void AliSTARTv0::CreateGeometry()
 //  3
     ppcon[9]  = ppcon[6];
     ppcon[10] =   4.4;
-    ppcon[11] =   5.3;
+    ppcon[11] =   5.1;
 
 //  4
 
     ppcon[12]  = ppcon[9]+0.1;
     ppcon[13] =   4.4;
-    ppcon[14] =   5.3;
+    ppcon[14] =   5.1;
 //  5
 
     ppcon[15]  = ppcon[12];
-    ppcon[16] =   5.1;
-    ppcon[17] =   5.3;
+    ppcon[16] =   4.9;
+    ppcon[17] =   5.1;
     
 //  6
-    ppcon[18]  = ppcon[12]+5.8;
-    ppcon[19] =   5.1;
-    ppcon[20] =   5.3;
+    ppcon[18]  = ppcon[15]+7.05;
+    ppcon[19] =   4.9;
+    ppcon[20] =   5.1;
     
 //  7
     ppcon[21]  = ppcon[18];
-    ppcon[22] =   5.1;
-    ppcon[23] =   5.9;
-    
-//  8
-    ppcon[24]  = ppcon[21]+1.5;
-    ppcon[25] =   5.1;
-    ppcon[26] =   5.9;
-//  9
-    ppcon[27]  = ppcon[24]+0.5;
-    ppcon[28] =   5.1;
-    ppcon[29] =   5.9;
+    ppcon[22] =   4.9;
+    ppcon[23] =   5.1;
 
+/// 8
+    ppcon[24]  = ppcon[21]+0.01;
+    ppcon[25] =   3.15;
+    ppcon[26] =   3.25;
+    
+/// 9
+    ppcon[27]  = ppcon[24];
+    ppcon[28] =   3.15;
+    ppcon[29] =   3.25;
+    
 //  10
-    ppcon[30]  = ppcon[24]+0.5;
+    ppcon[30]  = ppcon[27]+4.5;
     ppcon[31] =   3.15;
-    ppcon[32] =   5.9;
+    ppcon[32] =   3.25;
 
 //  11
-    ppcon[33]  = ppcon[30];
+    ppcon[33] = ppcon[30];
     ppcon[34] =   3.15;
-    ppcon[35] =   5.9;
+    ppcon[35] =   3.25;
+
 //  12
-    ppcon[36]  = ppcon[30];
+    ppcon[36]  = ppcon[33];
     ppcon[37] =   3.15;
-    ppcon[38] =   3.25;
-    
+    ppcon[38] =   7.6;
+
 //  13
-    ppcon[39]  = ppcon[36]+4.5;
+    ppcon[39]  = ppcon[33]+0.4;
     ppcon[40] =   3.15;
-    ppcon[41] =   3.25;
+    ppcon[41] =   7.6;
+
 //  14
-    ppcon[42]  = ppcon[36]+4.5;
-    ppcon[43] =   3.15;
-    ppcon[44] =   7.6;
-//  15
-    ppcon[45]  = ppcon[42]+0.9;
-    ppcon[46] =   3.15;
-    ppcon[47] =   7.6;
-    
-    gMC->Gsvolu("0SUP", "PCON", idtmed[kAir], ppcon,48);
-    z=69.7; //+14.1/2;
-    gMC->Gspos("0SUP",1, "ALIC", 0,0,z,idrotm[901],"ONLY");
+//    ppcon[39]  = ppcon[36];
+//    ppcon[40] =   3.15;
+//    ppcon[41] =   7.6;
 
-  Float_t zdetRight=69.7,zdetLeft=350;
+    gMC->Gsvolu("0SUP", "PCON", idtmed[kAir], ppcon,42);
+    z=-69.7;//-14.1/2;
+    gMC->Gspos("0SUP",1,"ALIC",0.,0.,z,idrotm[901],"ONLY");
+
+
+   Float_t zdetRight=69.7,zdetLeft=350;
  //-------------------------------------------------------------------
  //  START volume 
  //-------------------------------------------------------------------
   
     
-    /*<<<<<<< AliSTARTv0.cxx
-    gMC->Gsvolu("0STR","TUBE",idtmed[kAir],pstart,3);
+    gMC->Gsvolu("0STR","PCON",idtmed[kAir],pstartR,18);
     gMC->Gsvolu("0STL","TUBE",idtmed[kAir],pstart,3);
-    gMC->Gspos("0STR",1,"ALIC",0.,0.,zdetRight+pstart[2],0,"ONLY");
-    gMC->Gspos("0STL",1,"ALIC",0.,0.,-zdetLeft-pstart[2],idrotm[901],"ONLY");
-    =======*/
-    gMC->Gsvolu("0STR","TUBE",idtmed[1],pstart,3);
-    gMC->Gsvolu("0STL","TUBE",idtmed[1],pstart,3);
     gMC->Gspos("0STR",1,"ALIC",0.,0.,-zdetRight-pstart[2],idrotm[901],"ONLY");
     gMC->Gspos("0STL",1,"ALIC",0.,0.,zdetLeft+pstart[2],0,"ONLY");
-    //>>>>>>> 1.19
 
 //START interior
     gMC->Gsvolu("0INS","TUBE",idtmed[kAir],pinstart,3);
-    gMC->Gsvolu("0PMT","TUBE",idtmed[kVac],ppmt,3);     
+    gMC->Gsvolu("0PMT","TUBE",idtmed[kOpAir],ppmt,3);     
     gMC->Gsvolu("0DIV","TUBE",idtmed[kVac],pdivider,3);     
     gMC->Gsvolu("0SU1","TUBE",idtmed[kC],psupport1,3);//C kozhuh vnutri
     gMC->Gsvolu("0SU2","TUBE",idtmed[kC],psupport2,3);// snaruzhi  C
     gMC->Gsvolu("0SU3","TUBE",idtmed[kC],psupport3,3);//kryshka perednaiai  C
     gMC->Gsvolu("0SU4","TUBE",idtmed[kC],psupport3,3);//kryshka zadnaiai  C
-    gMC->Gsvolu("0SU5","TUBE",idtmed[kAir],psupport4,3);// dyrki dlia feu v zadnej kryshke Air
-    cout<<" 0Su6 >> "<<psupport5[0]<<" "<<psupport5[1]<<" "<<psupport5[2]<<endl;
+    //    gMC->Gsvolu("0SU5","TUBE",idtmed[kAir],psupport4,3);// dyrki dlia feu v zadnej kryshke Air
     gMC->Gsvolu("0SU6","TUBE",idtmed[kC],psupport5,3);// stakanchik dlai feu  C
     gMC->Gsvolu("0SU7","TUBE",idtmed[kAl],psupport6,3);//kryshechka stakanchika  Al
     gMC->Gsvolu("0SU8","TUBE",idtmed[kAl],psupport7,3);//kolechko snaruzhu stakanchika Al
        
 // first ring: 12 units of Scintillator+PMT+divider
   Float_t  theta  = (180 / TMath::Pi()) * TMath::ATan(6.5 / zdetRight);
-  Float_t angel  = 2 * TMath::Pi() / 12;
+  Float_t angle  = 2 * TMath::Pi() / 12;
   Float_t phi[3];
+    
    for (is=0; is<12; is++)
       {  
 
-       x = 6.5 * TMath::Sin(is * angel);
-       y = 6.5 * TMath::Cos(is * angel);
+       x = 6.5 * TMath::Sin(is * angle);
+       y = 6.5 * TMath::Cos(is * angle);
        
-     phi[0] = -30 * is;
-     phi[1] = 90 - is * 30;
-     phi[2] = 90 - is * 30;
-     for (Int_t j = 0; j < 3; j++)
-       if (phi[j] < 0)  phi[j] += 360;
+       phi[0] = -30 * is;
+       phi[1] = 90 - is * 30;
+       phi[2] = 90 - is * 30;
+       for (Int_t j = 0; j < 3; j++)
+         if (phi[j] < 0)  phi[j] += 360;
        
-     AliMatrix (idrotm[902 + is], 90.,         phi[0],
-                                90. + theta, phi[1],
-                                theta,       phi[2]);  
+       AliMatrix (idrotm[902 + is], 90.,         phi[0],
+                  90. + theta, phi[1],
+                  theta,       phi[2]);  
        z=-pstart[2]+pinstart[2]+0.2;
-     gMC->Gspos ("0INS", is + 1, "0STR", x, y, z, idrotm[902 + is], "ONLY");
-     gMC->Gspos ("0INS", is + 13, "0STL", x, y, z, 0, "ONLY");
-      }        
+       gMC->Gspos ("0INS", is + 1, "0STR", x, y, z, idrotm[902 + is], "ONLY");
+       gMC->Gspos ("0INS", is + 13, "0STL", x, y, z, 0, "ONLY");
+       
+       x = 9 * TMath::Sin(angle/2+is * angle);
+       y = 9 * TMath::Cos(angle/2+is * angle);
 
+       gMC->Gspos ("0INS", is + 25, "0STL", x, y, z, 0, "ONLY");
+               
+      }        
    
-      x=0;
-    y=0;
-    z=-pinstart[2]+ppmt[2]+2.*psupport6[2];
-    gMC->Gspos("0PMT",1,"0INS",x,y,z,0,"ONLY");
-    z=z+pdivider[2]+ppmt[2];
-    gMC->Gspos("0DIV",1,"0INS",x,y,z,0,"ONLY");
-      
-// PMT
       
-    // Entry window (glass)
-    gMC->Gsvolu("0TOP","TUBE",idtmed[kGlass],ptop,3); //glass
-     //   gMC->Gsvolu("0TOP","TUBE",idtmed[12],ptop,3); //lucite
-     z=-ppmt[2]+ptop[2];
-    gMC->Gspos("0TOP",1,"0PMT",0,0,z,0,"ONLY");
-    //     printf("Z PTOP %f -ppmt[2] %f ptop[2] %f\n",z,-ppmt[2],ptop[2]);
-    
-    // Bottom glass
-    gMC->Gsvolu("0BOT","TUBE",idtmed[kGlass],pbot,3);
-    z=ppmt[2]-pbot[2];
-    if(fDebug) printf("%s: Z bottom %f\n",ClassName(),z);
-    gMC->Gspos("0BOT",1,"0PMT",0,0,z,0,"ONLY");
-    // Side cylinder glass
-    gMC->Gsvolu("0OUT","TUBE",idtmed[kGlass],pglass,3);
-    z=ppmt[2]-pglass[2];
-    //      printf("Z glass %f\n",z);
-    gMC->Gspos("0OUT",1,"0PMT",0,0,z,0,"ONLY");
-    //PMT electrodes support structure
-    gMC->Gsvolu("0CER","TUBE",idtmed[kCer],pcer,3);
-    gMC->Gsvolu("0STE","TUBE",idtmed[kSteel],psteel,3);
-    z=-ppmt[2]+2*ptop[2]+0.3;;
-    //      printf("Z Cer 1 %f\n",z);
-    for (is=1; is<=15; is++)
-      {
-       z=z+psteel[2]+pcer[2];
-       gMC->Gspos("0CER",is,"0PMT",0,0,z,0,"ONLY");
-       z=z+psteel[2]+pcer[2];
-       gMC->Gspos("0STE",is,"0PMT",0,0,z,0,"ONLY");
-      }
-    
-    // Divider
-    // Knob at the bottom of PMT baloon
-    
-    gMC->Gsvolu("0NB","TUBE",idtmed[6],pknob,3);
-    z=-pdivider[2]+pknob[2];
-    //      printf("zknob %f\n",z);
-    gMC->Gspos("0NB",1,"0DIV",0,0,z,0,"ONLY");
-    gMC->Gsvolu("0KB","TUBE",idtmed[kGlass],pknob_bot,3);
-    z=-pdivider[2]+2*pknob[2]+pknob_bot[2];
-    //      printf(knobbot %f\n",z);
-    gMC->Gspos("0KB",1,"0DIV ",0,0,z,0,"ONLY");
-    gMC->Gsvolu("0VAC","TUBE",idtmed[kVac],pknob_vac,3);
-    z=-pdivider[2]+pknob_vac[2];
-    //      printf("knobvac %f\n",z);
-    gMC->Gspos("0VAC",1,"0DIV",0,0,z,0,"ONLY");
-    //Steel pins + pin holes
-    gMC->Gsvolu("0PIN","TUBE",idtmed[kSteel],ppins,3);
-    z=-pdivider[2]+ppins[2];
-    gMC->Gspos("0PIN",1,"0DIV",0,0,z,0,"ONLY");
-    gMC->Gsvolu("0HOL","TUBE",idtmed[kBrass],phole,3);
-    z=-pdivider[2]+2*ppins[2]+phole[2];
-    gMC->Gspos("0HOL",1,"0DIV",0,0,z,0,"ONLY");
-    
-    //Socket
-    gMC->Gsvolu("0V1","TUBE",idtmed[kCer],pdiv1,3);
-    z=-pdivider[2]+pdiv1[2];
-    gMC->Gspos("0V1",1,"0DIV",0,0,z,0,"ONLY");
-    //Resistors
-    gMC->Gsvolu("0V2","TUBE",idtmed[kAir],pdiv2,3);
-    z=pdivider[2]-pdiv2[2];
-    gMC->Gspos("0V2",1,"0DIV",0,0,z,0,"ONLY");
-    gMC->Gsvolu("0RS","TUBE",idtmed[kCer],presist,3);
-    z=-pdiv2[2]+presist[2];
-    gMC->Gspos("0RS",1,"0V2",0,0,z,0,"ONLY");
-    gMC->Gsvolu("0RB","TUBE",idtmed[kRibber],pribber,3);
-    z=pdiv2[2]-pribber[2];
-    gMC->Gspos("0RB",1,"0V2",0,0,z,0,"ONLY");
-
-
-    //Support  left side
-
-    z=-pstart[2]+psupport1[2];
-    gMC->Gspos("0SU1",2,"0STL",0,0,z,0,"ONLY"); //C kozhuh snaruzhi
-    gMC->Gspos("0SU2",2,"0STL",0,0,z,0,"ONLY"); //C kozhuh vnutri
-    z=-pstart[2]+psupport3[2];
-    gMC->Gspos("0SU3",2,"0STL",0,0,z,0,"ONLY"); //peredniaia kryshka
-    z=-pstart[2]+2.*psupport1[2];
-    gMC->Gspos("0SU4",2,"0STL",0,0,z,0,"ONLY"); //zadnaiai kryshka
-    //Dyrki dlia feu v zadnej kryshke
-    z=0;
-    
-    for (is=1; is<=12; is++)
-      {  
-       x=6.5*TMath::Sin(is*angel);
-       y=6.5 *TMath::Cos(is*angel);
-       gMC->Gspos("0SU5",is+12,"0SU4",x,y,z,0,"ONLY");
-
-      }        
-
-    //Support  right side
-
-    z=-pstart[2]+psupport1[2];
-    gMC->Gspos("0SU1",1,"0STR",0,0,z,0,"ONLY"); //C kozhuh snaruzhi
-    gMC->Gspos("0SU2",1,"0STR",0,0,z,0,"ONLY"); //C kozhuh vnutri
-    z=-pstart[2]+psupport3[2];
-    gMC->Gspos("0SU3",1,"0STR",0,0,z,0,"ONLY"); //peredniaia kryshka
-    z=-pstart[2]+2.*psupport1[2];
-    gMC->Gspos("0SU4",1,"0STR",0,0,z,0,"ONLY"); //zadnaiai kryshka
-    //Dyrki dlia feu v zadnej kryshke
-    z=0;
-    
-    for (is=1; is<=12; is++)
-      {  
-       x=(6.5+7.8*TMath::Tan(5.4*3.1415/180)) *TMath::Sin(is*angel);
-       y=(6.5+7.8*TMath::Tan(5.4*3.1415/180)) *TMath::Cos(is*angel);
-       gMC->Gspos("0SU5",is,"0SU4",x,y,z,0,"ONLY");
-
-      }        
-
-    gMC->Gspos("0SU6",1,"0INS",0,0,0,0,"ONLY");//C stakanchik dlia feu 
-    z=-pinstart[2]+psupport6[2];
-    gMC->Gspos("0SU7",1,"0INS",0,0,z,0,"ONLY"); //Al kryshechka 
-    
-    z=pinstart[2]-psupport7[2];
-    gMC->Gspos("0SU8",1,"0INS",0,0,z,0,"ONLY"); //Al kolechko
-    
-
-    Float_t par[3];
-    par[0]=4.4;
-    par[1]=4.5;
-    par[2]=0.5;
-    gMC->Gsvolu("0SC0","TUBE",idtmed[kC],par,3);
-    z=ppcon[3]+par[2];
-    gMC->Gspos("0SC0",1,"0SUP",0,0,z,0,"ONLY"); 
-    z += par[2];
-    par[0]=4.4;
-    par[1]=5.1;
-    par[2]=0.05;
-    gMC->Gsvolu("0SC1","TUBE",idtmed[kC],par,3);
-    z += par[2];
-    gMC->Gspos("0SC1",1,"0SUP",0,0,z,0,"ONLY"); 
-    z=z+par[2];
-    par[0]=5.1;
-    par[1]=5.2;
-    par[2]=5.8/2;
+   x=0;
+   y=0;
+   z=-pinstart[2]+ppmt[2]+2.*psupport6[2]+0.1;
+   gMC->Gspos("0PMT",1,"0INS",x,y,z,0,"ONLY");
+   z=z+pdivider[2]+ppmt[2];
+   gMC->Gspos("0DIV",1,"0INS",x,y,z,0,"ONLY");
+   
+   // PMT
+   
+   // Entry window (glass)
+   gMC->Gsvolu("0TOP","TUBE",idtmed[kOpGlass],ptop,3); //glass
+   //   gMC->Gsvolu("0TOP","TUBE",idtmed[12],ptop,3); //lucite
+   z=-ppmt[2]+ptop[2];
+   gMC->Gspos("0TOP",1,"0PMT",0,0,z,0,"ONLY");
+   
+   //Fotokatod
+   
+   gMC->Gsvolu ("0REG", "TUBE", idtmed[kOpGlass], preg, 3); //photocathode dobavil bogdanov(AliSTARTv2)
+   z = -ppmt[2] + 2 * ptop[2] + preg[2]; //photocathode dobavil bogdanov 
+   gMC->Gspos ("0REG", 1, "0PMT", 0, 0, z, 0, "ONLY"); //photocathode dobavil bogdanov(AliSTARTv2)
+   
+   // Bottom glass
+   gMC->Gsvolu("0BOT","TUBE",idtmed[kGlass],pbot,3);
+   z=ppmt[2]-pbot[2];
+   if(fDebug) printf("%s: Z bottom %f\n",ClassName(),z);
+   gMC->Gspos("0BOT",1,"0PMT",0,0,z,0,"ONLY");
+   // Side cylinder glass
+   gMC->Gsvolu("0OUT","TUBE",idtmed[kGlass],pglass,3);
+   z=ppmt[2]-pglass[2];
+   gMC->Gspos("0OUT",1,"0PMT",0,0,z,0,"ONLY");
+   //PMT electrodes support structure
+   gMC->Gsvolu("0CER","TUBE",idtmed[kCer],pcer,3);
+   gMC->Gsvolu("0STE","TUBE",idtmed[kSteel],psteel,3);
+   z=-ppmt[2]+2*ptop[2]+0.3;;
+   for (is=1; is<=15; is++)
+     {
+       z=z+psteel[2]+pcer[2];
+       gMC->Gspos("0CER",is,"0PMT",0,0,z,0,"ONLY");
+       z=z+psteel[2]+pcer[2];
+       gMC->Gspos("0STE",is,"0PMT",0,0,z,0,"ONLY");
+     }
+   
+   // Divider
+   // Knob at the bottom of PMT baloon
+   
+   gMC->Gsvolu("0NB","TUBE",idtmed[6],pknob,3);
+   z=-pdivider[2]+pknob[2];
+   gMC->Gspos("0NB",1,"0DIV",0,0,z,0,"ONLY");
+   gMC->Gsvolu("0KB","TUBE",idtmed[kGlass],pknob_bot,3);
+   z=-pdivider[2]+2*pknob[2]+pknob_bot[2];
+   gMC->Gspos("0KB",1,"0DIV ",0,0,z,0,"ONLY");
+   gMC->Gsvolu("0VAC","TUBE",idtmed[kVac],pknob_vac,3);
+   z=-pdivider[2]+pknob_vac[2];
+   gMC->Gspos("0VAC",1,"0DIV",0,0,z,0,"ONLY");
+   //Steel pins + pin holes
+   gMC->Gsvolu("0PIN","TUBE",idtmed[kSteel],ppins,3);
+   z=-pdivider[2]+ppins[2];
+   gMC->Gspos("0PIN",1,"0DIV",0,0,z,0,"ONLY");
+   gMC->Gsvolu("0HOL","TUBE",idtmed[kBrass],phole,3);
+   z=-pdivider[2]+2*ppins[2]+phole[2];
+   gMC->Gspos("0HOL",1,"0DIV",0,0,z,0,"ONLY");
+   
+   //Socket
+   gMC->Gsvolu("0V1","TUBE",idtmed[kCer],pdiv1,3);
+   z=-pdivider[2]+pdiv1[2];
+   gMC->Gspos("0V1",1,"0DIV",0,0,z,0,"ONLY");
+   //Resistors
+   gMC->Gsvolu("0V2","TUBE",idtmed[kAir],pdiv2,3);
+   z=pdivider[2]-pdiv2[2];
+   gMC->Gspos("0V2",1,"0DIV",0,0,z,0,"ONLY");
+   gMC->Gsvolu("0RS","TUBE",idtmed[kCer],presist,3);
+   z=-pdiv2[2]+presist[2];
+   gMC->Gspos("0RS",1,"0V2",0,0,z,0,"ONLY");
+   gMC->Gsvolu("0RB","TUBE",idtmed[kRibber],pribber,3);
+   z=pdiv2[2]-pribber[2];
+   gMC->Gspos("0RB",1,"0V2",0,0,z,0,"ONLY");
+   
+   
+   //Support  left side
+   /*   
+   z=-pstart[2]+psupport1[2];
+   gMC->Gspos("0SU1",2,"0STL",0,0,z,0,"ONLY"); //C kozhuh snaruzhi
+   gMC->Gspos("0SU2",2,"0STL",0,0,z,0,"ONLY"); //C kozhuh vnutri
+   z=-pstart[2]+psupport3[2];
+   gMC->Gspos("0SU3",2,"0STL",0,0,z,0,"ONLY"); //peredniaia kryshka
+   z=-pstart[2]+2.*psupport1[2];
+   gMC->Gspos("0SU4",2,"0STL",0,0,z,0,"MANY"); //zadnaiai kryshka
+   */
+   z=-pstart[2]+psupport1[2]+0.1;
+   gMC->Gspos("0SU1",1,"0STR",0,0,z,0,"ONLY"); //C kozhuh snaruzhi
+   gMC->Gspos("0SU2",1,"0STR",0,0,z,0,"ONLY"); //C kozhuh vnutri
+   z=-pstart[2]+psupport3[2]+0.1;
+   gMC->Gspos("0SU3",1,"0STR",0,0,z,0,"ONLY"); //peredniaia kryshka
+   z=-pstart[2]+2.*psupport1[2]+0.1;
+   gMC->Gspos("0SU4",1,"0STR",0,0,z,0,"MANY"); //zadnaiai kryshka
+   gMC->Gspos("0SU6",1,"0INS",0,0,0,0,"ONLY");//C stakanchik dlia feu 
+   z=-pinstart[2]+psupport6[2];
+   gMC->Gspos("0SU7",1,"0INS",0,0,z,0,"ONLY"); //Al kryshechka 
+   
+   z=pinstart[2]-psupport7[2];
+   gMC->Gspos("0SU8",1,"0INS",0,0,z,0,"ONLY"); //Al kolechko
+   
+   
+   Float_t par[3];
+   par[0]=4.4;
+   par[1]=4.5;
+   par[2]=0.5;
+   gMC->Gsvolu("0SC0","TUBE",idtmed[kC],par,3);
+   z=ppcon[3]+par[2];
+   gMC->Gspos("0SC0",1,"0SUP",0,0,z,0,"ONLY"); 
+   z += par[2];
+   par[0]=4.4;
+   par[1]=5.1;
+   par[2]=0.05;
+   gMC->Gsvolu("0SC1","TUBE",idtmed[kC],par,3);
+   z += par[2];
+   gMC->Gspos("0SC1",1,"0SUP",0,0,z,0,"ONLY"); 
+   z=z+par[2];
+   par[0]=4.9;
+   par[1]=5.0;
+   par[2]=6.9/2;
     gMC->Gsvolu("0SC2","TUBE",idtmed[kC],par,3);
     z += par[2];
     gMC->Gspos("0SC2",1,"0SUP",0,0,z,0,"ONLY"); 
     z += par[2];
+    /*
     Float_t parC[5];
     parC[0]=0.25;
     parC[1]=5.1;
@@ -413,23 +400,25 @@ void AliSTARTv0::CreateGeometry()
     gMC->Gsvolu("0SN1","TUBE",idtmed[kSteel],par,3);
     gMC->Gspos("0SN1",1,"0SUP",0,0,z,0,"ONLY"); 
     z += par[2];
+    */
     par[0]=3.15;
-    par[1]=5.5;
-    par[2]=0.1;
+    par[1]=4.9;
+    par[2]=0.1/2;
     gMC->Gsvolu("0SA1","TUBE",idtmed[kAl],par,3);
+    
     z += par[2];
     gMC->Gspos("0SA1",1,"0SUP",0,0,z,0,"ONLY"); 
     z=z+par[2];
     par[0]=3.15;
     par[1]=3.16;
-    par[2]=4.7/2;
+    par[2]=4.5/2;
     gMC->Gsvolu("0SA2","TUBE",idtmed[kAl],par,3);
     z += par[2];
     gMC->Gspos("0SA2",1,"0SUP",0,0,z,0,"ONLY"); 
     z=z+par[2];
     par[0]=3.16; // eta chast' prikruchena k absorberu
     par[1]=7.5;
-    par[2]=0.3;
+    par[2]=0.2;
     gMC->Gsvolu("0SA3","TUBE",idtmed[kAl],par,3);
     z += par[2];
     gMC->Gspos("0SA3",1,"0SUP",0,0,z,0,"ONLY"); 
@@ -438,9 +427,10 @@ void AliSTARTv0::CreateGeometry()
     par[2]=0.01;
     gMC->Gsvolu("0SN2","TUBE",idtmed[kSteel],par,3);
     gMC->Gspos("0SN2",1,"0SUP",0,0,z,0,"ONLY"); 
-       
+    
  
 }    
+
 //------------------------------------------------------------------------
 void AliSTARTv0::CreateMaterials()
 {
@@ -569,8 +559,8 @@ void AliSTARTv0::Init()
 //Int_t *idtmed  = gAlice->Idtmed();
   AliSTART::Init();
   fIdSens1=gMC->VolId("0TOP");
-  printf("*** START version 0 initialized ***\n");
+  AliDebug(1,Form("%s: *** START version 0 initialized ***\n",ClassName()));
+  
 }
 
 //-------------------------------------------------------------------
index 25ce3ed86ac856b4c96367cf4efa0f6ea2f1bce1..c1f872ba9ddfa1e4075194bc596ff345994677f0 100755 (executable)
@@ -15,7 +15,8 @@ class AliSTARTv0 : public AliSTART {
  
 public:
 
-  enum constants {kAir=1, kSc=2, kVac=3, kCer=4, kGlass=6, kSteel=8, kRibber=9, kBrass=11, kLucite=12, kC=13, kPP=14, kAl=15};
+
+  enum constants {kAir=1, kSc=2, kVac=3, kCer=4, kGlass=6, kSteel=8, kRibber=9, kBrass=11, kLucite=12, kC=13, kPP=14, kAl=15, kOpGlass=16, kOpAir=17};
 
   AliSTARTv0() {};
   AliSTARTv0(const char *name, const char *title);
index 3cdd912fa655da48c9b51d10845431aa4927cedc..4ac1455ea5c751be75eb1633eccee29e6b86952b 100755 (executable)
@@ -37,6 +37,7 @@
 #include <TTUBE.h>
 #include <TVirtualMC.h>
 
+#include "AliLog.h"
 #include "AliMagF.h"
 #include "AliRun.h"
 #include "AliSTARThit.h"
@@ -53,6 +54,7 @@ AliSTARTv1::AliSTARTv1(const char *name, const char *title):
   // Standart constructor for START Detector version 0
   //
   fIdSens1=0;
+  fIshunt = 2;
 //  setBufferSize(128000);
 }
 //-------------------------------------------------------------------------
@@ -81,17 +83,17 @@ void AliSTARTv1::CreateGeometry()
                       -76.5+8.05+69.7, 5.1, 10.,
                       -62.9+0.00+69.7, 5.1, 10.};
   
-  Float_t pstart[3]={4.3, 10.,6.8};
+  Float_t pstart[3]={4.3, 12.,6.8};
   Float_t pinstart[3]={0.,1.6,6.5};
-  Float_t ppmt[3]={0.,1.3,3.5};
+  Float_t ppmt[3]={0.,1.5,3.5};
 
   Float_t preg[3]={0.,0.875,0.005}; //dobavil bogdanov
-  //  Float_t pdes[3]={0.875,1.3,0.005}; //dobavil bogdanov
 
   Float_t pdivider[3]={0.,1.2,1.75};
   Float_t pdiv2[3]={0.,1.2,1.25};
   Float_t pdiv1[3]={0.6,1.2,0.5};
-  Float_t ptop[3]={0.,1.3,1.5};
+  //  Float_t ptop[3]={0.,1.3,1.5};
+  Float_t ptop[3]={0.,1.0,1.5};
   Float_t pbot[3]={0.6,1.2,0.1};
   Float_t pglass[3]={1.2,1.3,2.};
   Float_t pcer[3]={0.9,1.1,0.09};
@@ -106,8 +108,7 @@ void AliSTARTv1::CreateGeometry()
   Float_t psupport1[3] = {4.51,4.6,4.0};//C kozhuh vnutri
   Float_t psupport2[3] = {9.4,9.5,4.0};// snaruzhi  C
   Float_t psupport3[3] = {4.51,9.5,0.05};//kryshki  C
-  Float_t psupport4[3] = {0,1.6,0.05};// dyrki dlia feu v zadnej kryshke Air
-  Float_t psupport5[3] = {1.44,1.5,6.5}; // stakanchik dlai feu  C
+   Float_t psupport5[3] = {1.44,1.5,6.5}; // stakanchik dlai feu  C
   Float_t psupport6[3] = {0,1.5,0.05}; //kryshechka stakanchika  Al
   Float_t psupport7[3] = {1.5,1.6,0.6}; //kolechko snaruzhu stakanchika Al
   // Mother Volume katushka dlia krepezha vokrug truby k Absorbru
@@ -203,28 +204,27 @@ void AliSTARTv1::CreateGeometry()
 
 //START interior
     gMC->Gsvolu("0INS","TUBE",idtmed[kAir],pinstart,3);
-    gMC->Gsvolu("0PMT","TUBE",idtmed[kAir],ppmt,3);     
+    gMC->Gsvolu("0PMT","TUBE",idtmed[kOpAir],ppmt,3);     
     gMC->Gsvolu("0DIV","TUBE",idtmed[kVac],pdivider,3);     
     gMC->Gsvolu("0SU1","TUBE",idtmed[kC],psupport1,3);//C kozhuh vnutri
     gMC->Gsvolu("0SU2","TUBE",idtmed[kC],psupport2,3);// snaruzhi  C
     gMC->Gsvolu("0SU3","TUBE",idtmed[kC],psupport3,3);//kryshka perednaiai  C
     gMC->Gsvolu("0SU4","TUBE",idtmed[kC],psupport3,3);//kryshka zadnaiai  C
-    gMC->Gsvolu("0SU5","TUBE",idtmed[kAir],psupport4,3);// dyrki dlia feu v zadnej kryshke Air
-    cout<<" 0Su6 >> "<<psupport5[0]<<" "<<psupport5[1]<<" "<<psupport5[2]<<endl;
+    //    gMC->Gsvolu("0SU5","TUBE",idtmed[kAir],psupport4,3);// dyrki dlia feu v zadnej kryshke Air
     gMC->Gsvolu("0SU6","TUBE",idtmed[kC],psupport5,3);// stakanchik dlai feu  C
     gMC->Gsvolu("0SU7","TUBE",idtmed[kAl],psupport6,3);//kryshechka stakanchika  Al
     gMC->Gsvolu("0SU8","TUBE",idtmed[kAl],psupport7,3);//kolechko snaruzhu stakanchika Al
        
 // first ring: 12 units of Scintillator+PMT+divider
   Float_t  theta  = (180 / TMath::Pi()) * TMath::ATan(6.5 / zdetRight);
-  Float_t angel  = 2 * TMath::Pi() / 12;
+  Float_t angle  = 2 * TMath::Pi() / 12;
   Float_t phi[3];
     
    for (is=0; is<12; is++)
       {  
 
-       x = 6.5 * TMath::Sin(is * angel);
-       y = 6.5 * TMath::Cos(is * angel);
+       x = 6.5 * TMath::Sin(is * angle);
+       y = 6.5 * TMath::Cos(is * angle);
        
        phi[0] = -30 * is;
        phi[1] = 90 - is * 30;
@@ -238,6 +238,12 @@ void AliSTARTv1::CreateGeometry()
        z=-pstart[2]+pinstart[2]+0.2;
        gMC->Gspos ("0INS", is + 1, "0STR", x, y, z, idrotm[902 + is], "ONLY");
        gMC->Gspos ("0INS", is + 13, "0STL", x, y, z, 0, "ONLY");
+       /*      
+       x = 9 * TMath::Sin(angle/2+is * angle);
+       y = 9 * TMath::Cos(angle/2+is * angle);
+
+       gMC->Gspos ("0INS", is + 25, "0STL", x, y, z, 0, "ONLY");
+       */      
       }        
    
       
@@ -251,17 +257,16 @@ void AliSTARTv1::CreateGeometry()
    // PMT
    
    // Entry window (glass)
-   gMC->Gsvolu("0TOP","TUBE",idtmed[kGlass],ptop,3); //glass
+   gMC->Gsvolu("0TOP","TUBE",idtmed[kOpGlass],ptop,3); //glass
    //   gMC->Gsvolu("0TOP","TUBE",idtmed[12],ptop,3); //lucite
    z=-ppmt[2]+ptop[2];
    gMC->Gspos("0TOP",1,"0PMT",0,0,z,0,"ONLY");
-   //     printf("Z PTOP %f -ppmt[2] %f ptop[2] %f\n",z,-ppmt[2],ptop[2]);
    
    //Fotokatod
    
-   gMC->Gsvolu ("0REG", "TUBE", idtmed[kGlass], preg, 3); //dobavil bogdanov(AliSTARTv2)
-   z = -ppmt[2] + 2 * ptop[2] + preg[2]; //dobavil bogdanov(AliSTARTv2)
-   gMC->Gspos ("0REG", 1, "0PMT", 0, 0, z, 0, "ONLY"); //dobavil bogdanov(AliSTARTv2)
+   gMC->Gsvolu ("0REG", "TUBE", idtmed[kOpGlass], preg, 3); //photocathode dobavil bogdanov(AliSTARTv2)
+   z = -ppmt[2] + 2 * ptop[2] + preg[2]; //photocathode dobavil bogdanov 
+   gMC->Gspos ("0REG", 1, "0PMT", 0, 0, z, 0, "ONLY"); //photocathode dobavil bogdanov(AliSTARTv2)
    
    // Bottom glass
    gMC->Gsvolu("0BOT","TUBE",idtmed[kGlass],pbot,3);
@@ -271,13 +276,11 @@ void AliSTARTv1::CreateGeometry()
    // Side cylinder glass
    gMC->Gsvolu("0OUT","TUBE",idtmed[kGlass],pglass,3);
    z=ppmt[2]-pglass[2];
-   //      printf("Z glass %f\n",z);
    gMC->Gspos("0OUT",1,"0PMT",0,0,z,0,"ONLY");
    //PMT electrodes support structure
    gMC->Gsvolu("0CER","TUBE",idtmed[kCer],pcer,3);
    gMC->Gsvolu("0STE","TUBE",idtmed[kSteel],psteel,3);
    z=-ppmt[2]+2*ptop[2]+0.3;;
-   //      printf("Z Cer 1 %f\n",z);
    for (is=1; is<=15; is++)
      {
        z=z+psteel[2]+pcer[2];
@@ -291,15 +294,12 @@ void AliSTARTv1::CreateGeometry()
    
    gMC->Gsvolu("0NB","TUBE",idtmed[6],pknob,3);
    z=-pdivider[2]+pknob[2];
-   //      printf("zknob %f\n",z);
    gMC->Gspos("0NB",1,"0DIV",0,0,z,0,"ONLY");
    gMC->Gsvolu("0KB","TUBE",idtmed[kGlass],pknob_bot,3);
    z=-pdivider[2]+2*pknob[2]+pknob_bot[2];
-   //      printf(knobbot %f\n",z);
    gMC->Gspos("0KB",1,"0DIV ",0,0,z,0,"ONLY");
    gMC->Gsvolu("0VAC","TUBE",idtmed[kVac],pknob_vac,3);
    z=-pdivider[2]+pknob_vac[2];
-   //      printf("knobvac %f\n",z);
    gMC->Gspos("0VAC",1,"0DIV",0,0,z,0,"ONLY");
    //Steel pins + pin holes
    gMC->Gsvolu("0PIN","TUBE",idtmed[kSteel],ppins,3);
@@ -326,45 +326,22 @@ void AliSTARTv1::CreateGeometry()
    
    
    //Support  left side
-   
+   /*   
    z=-pstart[2]+psupport1[2];
    gMC->Gspos("0SU1",2,"0STL",0,0,z,0,"ONLY"); //C kozhuh snaruzhi
    gMC->Gspos("0SU2",2,"0STL",0,0,z,0,"ONLY"); //C kozhuh vnutri
    z=-pstart[2]+psupport3[2];
    gMC->Gspos("0SU3",2,"0STL",0,0,z,0,"ONLY"); //peredniaia kryshka
    z=-pstart[2]+2.*psupport1[2];
-   gMC->Gspos("0SU4",2,"0STL",0,0,z,0,"ONLY"); //zadnaiai kryshka
-   //Dyrki dlia feu v zadnej kryshke
-   z=0;
-   
-   for (is=1; is<=12; is++)
-     {  
-       x=6.5*TMath::Sin(is*angel);
-       y=6.5 *TMath::Cos(is*angel);
-       gMC->Gspos("0SU5",is+12,"0SU4",x,y,z,0,"ONLY");
-       
-     } 
-   
-   //Support  right side
-   
+   gMC->Gspos("0SU4",2,"0STL",0,0,z,0,"MANY"); //zadnaiai kryshka
+   */
    z=-pstart[2]+psupport1[2]+0.1;
    gMC->Gspos("0SU1",1,"0STR",0,0,z,0,"ONLY"); //C kozhuh snaruzhi
    gMC->Gspos("0SU2",1,"0STR",0,0,z,0,"ONLY"); //C kozhuh vnutri
    z=-pstart[2]+psupport3[2]+0.1;
    gMC->Gspos("0SU3",1,"0STR",0,0,z,0,"ONLY"); //peredniaia kryshka
    z=-pstart[2]+2.*psupport1[2]+0.1;
-   gMC->Gspos("0SU4",1,"0STR",0,0,z,0,"ONLY"); //zadnaiai kryshka
-   //Dyrki dlia feu v zadnej kryshke
-   z=0;
-   
-   for (is=1; is<=12; is++)
-     {  
-       x=(6.5+7.8*TMath::Tan(5.4*3.1415/180)) *TMath::Sin(is*angel);
-       y=(6.5+7.8*TMath::Tan(5.4*3.1415/180)) *TMath::Cos(is*angel);
-       gMC->Gspos("0SU5",is,"0SU4",x,y,z,0,"ONLY");
-       
-     } 
-
+   gMC->Gspos("0SU4",1,"0STR",0,0,z,0,"MANY"); //zadnaiai kryshka
    gMC->Gspos("0SU6",1,"0INS",0,0,0,0,"ONLY");//C stakanchik dlia feu 
    z=-pinstart[2]+psupport6[2];
    gMC->Gspos("0SU7",1,"0INS",0,0,z,0,"ONLY"); //Al kryshechka 
@@ -406,8 +383,7 @@ void AliSTARTv1::CreateGeometry()
     z += parC[0];
     gMC->Gspos("0SC3",1,"0SUP",0,0,z,0,"ONLY"); 
     z += parC[0];
-    par[0]=5
-.5;
+    par[0]=5.5;
     par[1]=5.6;
     par[2]=1.2/2;
     gMC->Gsvolu("0SC4","TUBE",idtmed[kC],par,3);
@@ -487,9 +463,9 @@ void AliSTARTv1::CreateMaterials()
    Float_t dglass=2.65;
 // Ceramic   97.2% Al2O3 , 2.8% SiO2
    Float_t acer[2],zcer[2],wcer[2]={0.972,0.028};
-   Float_t aal2o3[2]  = { 26.981539,15.9994 };
-   Float_t zal2o3[2]  = { 13.,8. };
-   Float_t wal2o3[2]  = { 2.,3. };
+   Float_t aCeramic[2]  = { 26.981539,15.9994 };
+   Float_t zCeramic[2]  = { 13.,8. };
+   Float_t wCeramic[2]  = { 2.,3. };
    Float_t denscer  = 3.6;
 
 // Brass 80% Cu, 20% Zn
@@ -516,7 +492,7 @@ void AliSTARTv1::CreateMaterials()
    AliMaterial(10, "CarbonPlastic$", 12.01, 6.0, 2.26, 18.8,999); 
    AliMaterial(11, "Aliminium$", 26.98, 13.0, 2.7, 8.9,999); 
 
-   AliMixture( 3, "Al2O3   $", aal2o3, zal2o3, denscer, -2, wal2o3);
+   AliMixture( 3, "Ceramic  $",aCeramic, zCeramic, denscer, -2, wCeramic);
    AliMixture( 4, "PMT glass   $",aglass,zglass,dglass,-2,wglass);
    char namate[21]="";
    gMC->Gfmate((*fIdmate)[3], namate, a, z, d, radl, absl, buf, nbuf);
@@ -526,58 +502,13 @@ void AliSTARTv1::CreateMaterials()
    acer[1]=a;
    zcer[1]=z;
 
-// Definition Cherenkov parameters
-  const Int_t NUMENTRIES = 32;
-
- Float_t ppckov[NUMENTRIES] =
-            { 2.034E-9, 2.068E-9, 2.103E-9, 2.139E-9,
-              2.177E-9, 2.216E-9, 2.256E-9, 2.298E-9,
-              2.341E-9, 2.386E-9, 2.433E-9, 2.481E-9,
-              2.532E-9, 2.585E-9, 2.640E-9, 2.697E-9,
-              2.757E-9, 2.820E-9, 2.885E-9, 2.954E-9,
-              3.026E-9, 3.102E-9, 3.181E-9, 3.265E-9,
-              3.353E-9, 3.446E-9, 3.545E-9, 3.649E-9,
-              3.760E-9, 3.877E-9, 4.002E-9, 4.136E-9 };
-
- Float_t rindex_qwarz[NUMENTRIES] =
-            { 1.458, 1.458, 1.458, 1.458, 1.458, 1.458, 1.458,
-              1.458, 1.458, 1.458, 1.458, 1.458, 1.458, 1.458,
-              1.458, 1.458, 1.458, 1.458, 1.458, 1.458, 1.458,
-              1.458, 1.458, 1.458, 1.458, 1.458, 1.458, 1.458,
-              1.458, 1.458, 1.458, 1.458 };
-
- Float_t rindex_air[NUMENTRIES] =
-            { 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.,
-              1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.,
-              1., 1., 1., 1. };
-
-    Float_t effic_all[NUMENTRIES] =
-            { 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.,
-              1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.,
-              1., 1., 1., 1. };
-
- Float_t absor_air[NUMENTRIES] =
-           { 200., 200., 200., 200., 200., 200., 200., 
-             200., 200., 200., 200., 200., 200., 200.,
-             200., 200., 200., 200., 200., 200., 200.,
-             200., 200., 200., 200., 200., 200., 200.,
-             200., 200., 200., 200. };
    
- Float_t absor_qwarz[NUMENTRIES] =
-           { 2000., 2000., 2000., 2000., 2000., 2000., 2000., 
-             2000., 2000., 2000., 2000., 2000., 2000., 2000.,
-             2000., 2000., 2000., 2000., 2000., 2000., 2000.,
-             2000., 2000., 2000., 2000., 2000., 2000., 2000.,
-             2000., 2000., 2000., 2000. };
-
    AliMixture( 9, "Ceramic    $", acer, zcer, denscer, 2, wcer);
    AliMixture( 5, "Scintillator$",ascin,zscin,denscin,-2,wscin);
    AliMixture( 6, "Brass    $", abrass, zbrass, denbrass, 2, wbrass);
-   
    AliMixture( 7, "Ribber $",aribber,zribber,denribber,-3,wribber);
    AliMixture( 8, "Lucite$",alucite,zlucite,denlucite,-3,wlucite);
    AliMixture( 9, "Penoplast$",asupport,zsupport,densupport,-2,wsupport);
    
    AliMedium(1, "START Air$", 2, 0, isxfld, sxmgmx, 10., .1, 1., .003, .003);
    AliMedium(2, "Scintillator$", 5, 1, isxfld, sxmgmx, 10., .01, 1., .003, .003);
@@ -591,10 +522,37 @@ void AliSTARTv1::CreateMaterials()
    AliMedium(13, "CarbonPlastic$", 10, 0, isxfld, sxmgmx, 10., .01, 1., .003, .003);  
    AliMedium(14, "PenoPlast$", 9, 0, isxfld, sxmgmx, 10., .01, 1., .003, .003);  
    AliMedium(15, "Aluminium$", 11, 0, isxfld, sxmgmx, 10., .01, 1., .003, .003);  
+   AliMedium(16, "OpticalGlass$", 4, 1, isxfld, sxmgmx, 10., .01, .1, .003, .003);
+   AliMedium(17, "START OpAir$", 2, 0, isxfld, sxmgmx, 10., .1, 1., .003, .003);
 
-  
-   gMC->SetCerenkov (idtmed[kGlass], NUMENTRIES, ppckov, absor_qwarz, effic_all, rindex_qwarz);
-   gMC->SetCerenkov (idtmed[kAir], NUMENTRIES, ppckov, absor_air, effic_all, rindex_air);
+// Definition Cherenkov parameters
+   int i;
+   const Int_t kNbins=30;
+   
+   Float_t aPckov[kNbins]; 
+   Float_t aRindexSiO2[kNbins], rindexAir[kNbins], efficAll[kNbins], absorAir[kNbins];
+   
+   Float_t aAbsSiO2[kNbins]={//New values from A.DiMauro 28.10.03 total 31
+     34.4338, 30.5424, 30.2584, 31.4928, 31.7868, 17.8397, 9.3410, 6.4492, 6.1128, 5.8128,
+     5.5589,  5.2877,  5.0162,  4.7999,  4.5734,  4.2135, 3.7471, 2.6033, 1.5223, 0.9658,
+     0.4242,  0.2500,  0.1426,  0.0863,  0.0793,  0.0724, 0.0655, 0.0587, 0.0001, 0.0001};
+   
+
+ //  Float_t aAbsSiO2[kNbins]={30*2000.};
+  for(i=0;i<kNbins;i++)
+    {
+      aPckov[i]=(0.1*i+5.5)*1e-9;//Photons energy bins 5.5 eV - 8.5 eV step 0.1 eV   
+      aRindexSiO2[i]=1.458; //refractive index for qwarts
+      rindexAir[i]=1.;
+      efficAll[i]=1.;
+      
+      absorAir[i]=1.e-5;
+    }
+   gMC->SetCerenkov (idtmed[kOpGlass], kNbins, aPckov, aAbsSiO2, efficAll, aRindexSiO2 );
+   gMC->SetCerenkov (idtmed[kOpAir], kNbins , aPckov, absorAir, efficAll, 
+rindexAir);
    if(fDebug) cout<<ClassName()<<": ++++++++++++++Medium set++++++++++"<<endl;
 
 }
@@ -609,10 +567,10 @@ void AliSTARTv1::DrawDetector()
   gMC->Gsatt("ALIC","SEEN",0);
   //
   //Set volumes visible
-  //  gMC->Gsatt("0ST","SEEN",0);
-  gMC->Gsatt("0INS","SEEN",0);
-  gMC->Gsatt("0PMT","SEEN",1);
-  gMC->Gsatt("0DIV","SEEN",1);
+  //  gMC->Gsatt("0STR","SEEN",0);
+  //  gMC->Gsatt("0INS","SEEN",0);
+  // gMC->Gsatt("0PMT","SEEN",1);
+  // gMC->Gsatt("0DIV","SEEN",1);
   //
   gMC->Gdopt("hide","off");
   gMC->Gdopt("shad","on");
@@ -633,8 +591,9 @@ void AliSTARTv1::Init()
 //Int_t *idtmed  = gAlice->Idtmed();
   AliSTART::Init();
   fIdSens1=gMC->VolId("0REG");
-  if(fDebug) printf("%s: *** START version 0 initialized ***\n",ClassName());
+
+   AliDebug(1,Form("%s: *** START version 1 initialized ***\n",ClassName()));
+
 }
 
 //-------------------------------------------------------------------
@@ -645,64 +604,51 @@ void AliSTARTv1::StepManager()
   // Called for every step in the START Detector
   //
   Int_t id,copy,copy1;
-  static Float_t hits[7];
-  static Float_t edep;
+  static Float_t hits[6];
   static Int_t vol[2];
   TLorentzVector pos;
   
   TClonesArray &lhits = *fHits;
   
   if(!gMC->IsTrackAlive()) return; // particle has disappeared
-  //  Float_t charge = gMC->TrackCharge();
-  //  if(TMath::Abs(charge)<=0.) return; //take only charged particles
 
 // If particles is photon then ...
 
   if (gMC->TrackPid() == 50000050)
-  {
-  id=gMC->CurrentVolID(copy);
-  
-  
-   // Check the sensetive volume
-  if(id==fIdSens1 ) {
-    if(gMC->IsTrackEntering()) {
-      gMC->CurrentVolOffID(2,copy);
-      vol[1]=copy;
-      gMC->CurrentVolOffID(3,copy1);
-      vol[0]=copy1;
-
-      gMC->TrackPosition(pos);
-      hits[0] = pos[0];
-      hits[1] = pos[1];
-      hits[2] = pos[2];
-      if(pos[2]<0) vol[0]=2;
-      if(pos[2]>=0) vol[0]=1;
-     
-      Float_t etot=gMC->Etot();
-      hits[4]=etot;
-      Int_t iPart= gMC->TrackPid();
-      Int_t partID=gMC->IdFromPDG(iPart);
-      hits[5]=partID;
-      Float_t ttime=gMC->TrackTime();
-      hits[6]=ttime*1e9;
-      edep=0;
-    }
-    if(gMC->IsTrackInside())   {
-      Float_t de=gMC->Edep(); 
-      edep=edep+de;
-    } 
-  
-    if(gMC->IsTrackExiting())  {
-      Float_t de=gMC->Edep(); 
-      edep=edep+de;
-      hits[3]=edep*1e3; 
-
-
-      //      cout<<"partID"<<hits[5]<<endl;
-      new(lhits[fNhits++]) AliSTARThit(fIshunt,gAlice->GetMCApp()->GetCurrentTrackNumber(),vol,hits);      
+    {
+      id=gMC->CurrentVolID(copy);
+      
+      
+      // Check the sensetive volume
+      if(id==fIdSens1 ) {
+       if(gMC->IsTrackEntering()) {
+         gMC->CurrentVolOffID(2,copy);
+         vol[1]=copy;
+         gMC->CurrentVolOffID(3,copy1);
+         vol[0]=copy1;
+         
+         gMC->TrackPosition(pos);
+         hits[0] = pos[0];
+         hits[1] = pos[1];
+         hits[2] = pos[2];
+         if(pos[2]<0) vol[0]=2;
+         if(pos[2]>=0) vol[0]=1;
+         
+         Float_t etot=gMC->Etot();
+         hits[3]=etot;
+         Int_t iPart= gMC->TrackPid();
+         Int_t partID=gMC->IdFromPDG(iPart);
+         hits[4]=partID;
+         //     if (partID!=50) cout<<partID<<endl;
+         Float_t ttime=gMC->TrackTime();
+         hits[5]=ttime*1e9;
+       }
+       
+       if(gMC->IsTrackExiting())       
+         new(lhits[fNhits++]) AliSTARThit(fIshunt,gAlice->GetMCApp()->GetCurrentTrackNumber(),vol,hits);      
+       
+      }
     }
-   }
-  }
 //---------------------------------------------------------------------
 }
 
index 82baaf95df744a70f38362db18818b78fdd940a6..ae7d61546746d17eb5896cb5a71fec2bc45a4590 100644 (file)
@@ -14,7 +14,7 @@ class AliSTARTv1 : public AliSTART {
   
 public:
 
-  enum constants {kAir=1, kSc=2, kVac=3, kCer=4, kGlass=6, kSteel=8, kRibber=9, kBrass=11, kLucite=12, kC=13, kPP=14, kAl=15};
+  enum constants {kAir=1, kSc=2, kVac=3, kCer=4, kGlass=6, kSteel=8, kRibber=9, kBrass=11, kLucite=12, kC=13, kPP=14, kAl=15, kOpGlass=16, kOpAir=17};
 
  
   AliSTARTv1() {};