]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
New version of FMD code (A.Maevskaia)
authorhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 24 Sep 2001 16:41:15 +0000 (16:41 +0000)
committerhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 24 Sep 2001 16:41:15 +0000 (16:41 +0000)
17 files changed:
FMD/AliFMD.cxx
FMD/AliFMD.h
FMD/AliFMDMerger.cxx
FMD/AliFMDMerger.h
FMD/AliFMDReconstruction.cxx
FMD/AliFMDReconstruction.h
FMD/AliFMDSDigitizer.cxx
FMD/AliFMDSDigitizer.h
FMD/AliFMDv0.cxx
FMD/AliFMDv0.h
FMD/AliFMDv1.cxx
FMD/AliFMDv1.h
FMD/FMDMerger.C
FMD/FMDReconstruction.C [new file with mode: 0644]
FMD/FMDReconstructor.C [new file with mode: 0644]
FMD/Hits2SDigits.C
FMD/TestReconstruction.C

index 36050ee2b022642ad4f395661b948d9567af29c2..eae6dba6de82a0b61f74f1012c76bc83d2071a08 100644 (file)
@@ -13,7 +13,7 @@
  * provided "as is" without express or implied warranty.                  *
  **************************************************************************/
  //////////////////////////////////////////////////////////////////////////////
-//                                                                           //
+//                                                                            //
 //  Forward Multiplicity Detector based on Silicon plates                    //
 //  This class contains the base procedures for the Forward Multiplicity     //
 //  detector                                                                 //
@@ -56,6 +56,7 @@
 #include "AliFMDhit.h"
 #include "AliFMDdigit.h"
 #include "AliFMDReconstruction.h"
+#include "AliFMDReconstParticles.h"
 #include <stdlib.h>
 
 
@@ -87,10 +88,15 @@ AliDetector (name, title)
   // Digits for each Si disk
   fDigits = new TClonesArray ("AliFMDdigit", 1000);
   fSDigits = new TClonesArray ("AliFMDdigit", 1000);
+  fReconParticles=new TClonesArray("AliFMDReconstParticles",1000); 
   gAlice->AddHitList (fHits);
 
   fIshunt = 0;
   fIdSens1 = 0;
+  fIdSens2 = 0;
+  fIdSens3 = 0;
+  fIdSens4 = 0;
+  fIdSens5 = 0;
 
   SetMarkerColor (kRed);
 }
@@ -140,13 +146,20 @@ void AliFMD::AddDigit (Int_t * digits)
 {
   // add a real digit - as coming from data
 
-  // printf("AddDigit\n");
 
   TClonesArray & ldigits = *fDigits;
   new (ldigits[fNdigits++]) AliFMDdigit (digits);
 
 }
+//_____________________________________________________________________________
+void AliFMD::AddSDigit (Int_t * digits)
+{
+  // add a real digit - as coming from data
 
+  TClonesArray & ldigits = *fSDigits;
+  new (ldigits[fNdigits++]) AliFMDdigit (digits);
+
+}
 //_____________________________________________________________________________
 void AliFMD::BuildGeometry ()
 {
@@ -154,51 +167,43 @@ void AliFMD::BuildGeometry ()
   // Build simple ROOT TNode geometry for event display
   //
   TNode *node, *top;
-  const int kColorFMD = 7;
+  const int kColorFMD = 5;
   //
   top = gAlice->GetGeometry ()->GetNode ("alice");
 
   // FMD define the different volumes
   new TRotMatrix ("rot901", "rot901", 90, 0, 90, 90, 180, 0);
 
-  new TTUBE ("S_FMD0", "FMD  volume 0", "void", 4.73, 17.7, 1.5);
+  new TTUBE ("S_FMD0", "FMD  volume 0", "void", 3.5, 16.8, 1.5);
   top->cd ();
-  node = new TNode ("FMD0", "FMD0", "S_FMD0", 0, 0, 64, "");
+  node = new TNode ("FMD0", "FMD0", "S_FMD0", 0, 0, 62.8, "");
   node->SetLineColor (kColorFMD);
   fNodes->Add (node);
 
-  new TTUBE ("S_FMD1", "FMD  volume 1", "void", 23.4, 36., 1.5);
+  new TTUBE ("S_FMD1", "FMD  volume 1", "void", 22., 34.9, 1.5);
   top->cd ();
-  node = new TNode ("FMD1", "FMD1", "S_FMD1", 0, 0, 85, "");
+  node = new TNode ("FMD1", "FMD1", "S_FMD1", 0, 0, 75.1, "");
   node->SetLineColor (kColorFMD);
   fNodes->Add (node);
 
-  new TTUBE ("S_FMD2", "FMD  volume 2", "void", 4.73, 17.7, 1.5);
+  new TTUBE ("S_FMD2", "FMD  volume 2", "void", 3.5, 16.8, 1.5);
   top->cd ();
-  node = new TNode ("FMD2", "FMD2", "S_FMD2", 0, 0, -64, "");
+  node = new TNode ("FMD2", "FMD2", "S_FMD2", 0, 0, -62.8, "");
   node->SetLineColor (kColorFMD);
   fNodes->Add (node);
 
-  new TTUBE ("S_FMD3", "FMD  volume 3", "void", 23.4, 36., 1.5);
+  new TTUBE ("S_FMD3", "FMD  volume 3", "void", 22., 34.9, 1.5);
   top->cd ();
-  node = new TNode ("FMD3", "FMD3", "S_FMD3", 0, 0, -85, "");
+  node = new TNode ("FMD3", "FMD3", "S_FMD3", 0, 0, -75.1, "");
   node->SetLineColor (kColorFMD);
   fNodes->Add (node);
 
-  new TTUBE ("S_FMD4", "FMD  volume 4", "void", 5, 15, 0.015);
+  new TTUBE ("S_FMD4", "FMD  volume 4", "void", 3.5, 16.8, 1.5);
   top->cd ();
   //  node = new TNode("FMD4","FMD4","S_FMD4",0,0,-270,"");
-  node = new TNode ("FMD4", "FMD4", "S_FMD4", 0, 0, -270, "");
+  node = new TNode ("FMD4", "FMD4", "S_FMD4", 0, 0, -345, "");
   node->SetLineColor (kColorFMD);
   fNodes->Add (node);
-
-  /* 
-     new TTUBE("S_FMD5","FMD  volume 5","void",5,14,0.015);
-     top->cd();
-     node = new TNode("FMD5","FMD5","S_FMD5",0,0,-630,"");
-     node->SetLineColor(kColorFMD);
-     fNodes->Add(node);
-   */
 }
 
 //_____________________________________________________________________________
@@ -223,7 +228,7 @@ void AliFMD::ResetDigits ()
 {
   //
   // Reset number of digits and the digits array for this detector
-  AliDetector::ResetHits ();
+  AliDetector::ResetDigits ();
   //
 }
 
@@ -252,13 +257,12 @@ void  AliFMD::Init ()
     }
   //
   //
-  if (IsVersion () != 0)
-    fIdSens1 = pMC->VolId ("GRIN");    //Si sensetive volume
-  else
-    fIdSens1 = pMC->VolId ("GFSI");    //Si sensetive volume
+    fIdSens1 = pMC->VolId ("GRN1");    //Si sensetive volume
+    fIdSens2 = pMC->VolId ("GRN2");    //Si sensetive volume
+    fIdSens3 = pMC->VolId ("GRN3");    //Si sensetive volume
+    fIdSens4 = pMC->VolId ("GRN4");    //Si sensetive volume
 
 }
-
 //---------------------------------------------------------------------
 void AliFMD::MakeBranch (Option_t * option, const char *file)
 {
@@ -314,7 +318,7 @@ void AliFMD::SetTreeAddress ()
 
     }
   if (fSDigits)
-    fSDigits->Clear ();
+    //  fSDigits->Clear ();
 
   if (gAlice->TreeS () && fSDigits)
     {
@@ -323,28 +327,45 @@ void AliFMD::SetTreeAddress ()
        branch->SetAddress (&fSDigits);
     }
 
-  if(fReconParticles)
-    fReconParticles->Clear();
-  if (gAlice->TreeR()) 
+  if (gAlice->TreeR() && fReconParticles) 
     {
       branch = gAlice->TreeR()->GetBranch("FMD"); 
       if (branch) branch->SetAddress(&fReconParticles) ;
-    } 
-
+    }   
 }
 
+//---------------------------------------------------------------------
+void AliFMD::SetRingsSi1(Int_t ringsSi1)
+{
+  fRingsSi1=ringsSi1;
+}
+void AliFMD::SetSectorsSi1(Int_t sectorsSi1)
+{
+  fSectorsSi1=sectorsSi1;
+}
+void AliFMD::SetRingsSi2(Int_t ringsSi2)
+{
+  fRingsSi2=ringsSi2;
+}
+void AliFMD::SetSectorsSi2(Int_t sectorsSi2)
+{
+  fSectorsSi2=sectorsSi2;
+}
 //---------------------------------------------------------------------
 
 void AliFMD::SDigits2Digits() 
 {
   cout<<"AliFMD::SDigits2Digits"<<endl; 
     if (fMerger) {
-      cout<<"AliFMD::SDigits2Digits fMerger"<<fMerger<<endl;
+      fMerger ->SetRingsSi1(fRingsSi1);
+      fMerger->SetRingsSi2(fRingsSi2);
+      fMerger ->SetSectorsSi1(fSectorsSi1);
+      fMerger ->SetSectorsSi2(fSectorsSi2);
       fMerger->Init();
       cout<<"AliFMD::SDigits2Digits Init"<<endl; 
-  
       fMerger->Digitise();
-    }
+      cout<<"AliFMD::SDigits2Digits Digitise() "<<endl; 
+     }
 
 }
 //---------------------------------------------------------------------
@@ -382,117 +403,36 @@ AliFMD::Eta2Radius (Float_t eta, Float_t zDisk, Float_t * radius)
 void AliFMD::Hits2SDigits ()
 {
 
-  AliFMD *FMD = (AliFMD *) gAlice->GetDetector ("FMD");
+  //#ifdef DEBUG
+  cout<<"ALiFMD::Hits2SDigits> start...\n";
+  //#endif
+  
+  char * fileSDigits = 0 ;
+  char * fileHeader = 0;
+  AliFMDSDigitizer * sd = new AliFMDSDigitizer(fileHeader,fileSDigits) ;
+  sd->SetRingsSi1(fRingsSi1);
+  sd->SetRingsSi2(fRingsSi2);
+  sd->SetSectorsSi1(fSectorsSi1);
+  sd->SetSectorsSi2(fSectorsSi2);
 
-  if (fNevents == 0)
-    fNevents = (Int_t) gAlice->TreeE ()->GetEntries ();
 
-  for (Int_t ievent = 0; ievent < fNevents; ievent++)
-    {
-      gAlice->GetEvent (ievent);
-      if (gAlice->TreeH () == 0)
-       return;
-      if (gAlice->TreeS () == 0)
-       gAlice->MakeTree ("S");
-
-
-
-      Int_t nSdigits = 0;
-      
-            //Make branches
-      char branchname[20];
-       sprintf (branchname, "%s", FMD->GetName ());
-      //Make branch for digits
-      FMD->MakeBranch ("S");
-          
-    
-       //Now made SDigits from hits, for PHOS it is the same
-      Int_t volume, sector, ring, charge;
-      Float_t e;
-      Float_t de[10][20][150];
-      Int_t ivol, isec, iring;
-      Int_t hit, nbytes;
-      TParticle *particle;
-      AliFMDhit *fmdHit;
-      TClonesArray *FMDhits = FMD->Hits ();
-
-      // Event ------------------------- LOOP  
-
-      for (ivol = 1; ivol <= 5; ivol++)
-       for (isec = 1; isec <= 16; isec++)
-         for (iring = 1; iring <= 128; iring++)
-           de[ivol][isec][iring] = 0;
-
-      if (FMD)
-       {
-         FMDhits = FMD->Hits ();
-         TTree *TH = gAlice->TreeH ();
-         Stat_t ntracks = TH->GetEntries ();
-         for (Int_t track = 0; track < ntracks; track++)
-           {
-             gAlice->ResetHits ();
-             nbytes += TH->GetEvent (track);
-             particle = gAlice->Particle (track);
-             Int_t nhits = FMDhits->GetEntriesFast ();
-
-             for (hit = 0; hit < nhits; hit++)
-               {
-                 fmdHit = (AliFMDhit *) FMDhits->UncheckedAt (hit);
-
-                 volume = fmdHit->Volume ();
-                 sector = fmdHit->NumberOfSector ();
-                 ring = fmdHit->NumberOfRing ();
-                 e = fmdHit->Edep ();
-                 de[volume][sector][ring] = de[volume][sector][ring] + e;
-               }               //hit loop
-           }                   //track loop
-       }                       //if FMD
-
-
-      Int_t digit[5];
-      Float_t I = 1.664 * 0.04 * 2.33 / 22400; // = 0.69e-6;
-      for (ivol = 1; ivol <= 5; ivol++)
-       {
-         for (isec = 1; isec <= 16; isec++)
-           {
-             for (iring = 1; iring <= 128; iring++)
-               {
-                     digit[0] = ivol;
-                     digit[1] = isec;
-                     digit[2] = iring;
-                     charge = Int_t (de[ivol][isec][iring] / I);
-                     digit[3] = charge;
-                     //                      if (charge!=0) cout<<" charge "<<charge<<endl;
-                     //dinamic diapason from MIP(0.155MeV) to 30MIP(4.65MeV)
-                     //1024 ADC channels 
-                     Float_t channelWidth = (22400 * 30) / 1024;
-                     digit[4] = Int_t (digit[3] / channelWidth);
-
-                     new ((*fSDigits)[nSdigits++]) AliFMDdigit (digit);
-
-               }               // iring loop
-           }                   //sector loop
-       }                       // volume loop
-      
-      gAlice->TreeS ()->Fill ();
-      gAlice->TreeS ()->Print ();
-
-    }                          //event loop
+  sd->Exec("") ;
+  sd->Print("");
 
+  delete sd ;
+  
 }
 //-----------------------------------------------------------------------
 
 void AliFMD::Digits2Reco()
 {
-#ifdef DEBUG
-  cout<<"ALiFMD::Digits2Reco> start...";
-#endif
   char * fileReconParticles=0;
   char * fileHeader=0;
   AliFMDReconstruction * reconstruction =
     new AliFMDReconstruction(fileHeader,fileReconParticles) ;
-  fReconParticles=new TClonesArray("AliFMDReconstParticles",1000);
-  reconstruction->Exec(fReconParticles,"");
+  //  fReconParticles=new TClonesArray("AliFMDReconstParticles",1000);
+  reconstruction->Exec("");
   delete  reconstruction;
 }
 
+
index 65823219cba7a3e0569746afd09ebf85e717756b..58f4d5e5dda51b88196b0324dbe25a094802cabd 100644 (file)
@@ -10,7 +10,7 @@
 #include "AliDetector.h"
 #include "TString.h"
 #include "AliFMDMerger.h" 
+#include "AliFMDSDigitizer.h" 
  class TFile;
  class TTree;
  class AliFMDMerger;
@@ -22,6 +22,7 @@ public:
   virtual       ~AliFMD(); 
   virtual void   AddHit(Int_t, Int_t*, Float_t*);
   virtual void   AddDigit(Int_t*);
+  virtual void   AddSDigit(Int_t*);
   virtual void   BuildGeometry();
   virtual void   CreateGeometry() {}
   virtual void   CreateMaterials()=0; 
@@ -34,9 +35,16 @@ public:
   virtual void   ResetDigits();
   virtual void   DrawDetector()=0;
   virtual void   StepManager() {}
+  // Granularity
+  virtual void SetRingsSi1(Int_t ringsSi1);
+  virtual void SetSectorsSi1(Int_t sectorsSi1);
+  virtual void SetRingsSi2(Int_t ringsSi2);
+  virtual void SetSectorsSi2(Int_t sectorsSi2);
+   
   void  Eta2Radius(Float_t, Float_t, Float_t*);
   void Hits2SDigits();//
   void Digits2Reco(); 
+
    // Digitisation
   TClonesArray *SDigits() const {return fSDigits;}
 //  virtual void   SDigits2Digits();
@@ -48,6 +56,17 @@ public:
 
  protected:
   Int_t fIdSens1;     //Si sensetive volume
+  Int_t fIdSens2;     //Si sensetive volume
+  Int_t fIdSens3;     //Si sensetive volume
+  Int_t fIdSens4;     //Si sensetive volume
+  Int_t fIdSens5;     //Si sensetive volume
+ //Granularity
+  Int_t fRingsSi1;       // Number of rings
+  Int_t fSectorsSi1;    // Number of sectors
+  Int_t fRingsSi2;       // Number of rings
+  Int_t fSectorsSi2;    // Number of sectors
+
+
   AliFMDMerger *fMerger;   // ! pointer to merger
   TClonesArray *fSDigits      ; // List of summable digits
   TClonesArray *fReconParticles;
index f5021bff874d57db4288972ceb64d1526d1c7c6d..6be639b59088864102d4814f3b79d74c45512587 100644 (file)
@@ -15,6 +15,9 @@
 
 /*
 $Log$
+Revision 1.1  2001/05/29 12:01:06  hristov
+Last minute changes and new code for event mixing and reconstruction (A.Maevskaia)
+
 Revision 1.3  2001/03/05 23:57:44  morsch
 Writing of digit tree moved to macro.
 
@@ -70,6 +73,24 @@ AliFMDMerger::~AliFMDMerger()
 }
 
 
+//---------------------------------------------------------------------
+void AliFMDMerger::SetRingsSi1(Int_t ringsSi1)
+{
+  fRingsSi1=ringsSi1;
+}
+void AliFMDMerger::SetSectorsSi1(Int_t sectorsSi1)
+{
+  fSectorsSi1=sectorsSi1;
+}
+void AliFMDMerger::SetRingsSi2(Int_t ringsSi2)
+{
+  fRingsSi2=ringsSi2;
+}
+void AliFMDMerger::SetSectorsSi2(Int_t sectorsSi2)
+{
+  fSectorsSi2=sectorsSi2;
+}
+//---------------------------------------------------------------------
 
 //------------------------------------------------------------------------
 void AliFMDMerger::Init()
@@ -101,15 +122,20 @@ void AliFMDMerger::Digitise()
 
 
 #ifdef DEBUG
-  cout<<"ALiFMD::>SDigits2Digits start...\n";
+  cout<<"ALiFMDMerger::>SDigits2Digits start...\n";
 #endif
 
   AliFMD * FMD = (AliFMD *) gAlice->GetDetector("FMD") ;
 
-  Int_t chargeSum[10][20][150];
+  Int_t chargeSum[10][30][150];
   Int_t digit[5];
   Int_t ivol, iSector, iRing;
 
+  Int_t NumberOfRings[5]=
+  {fRingsSi1,fRingsSi2,fRingsSi1,fRingsSi2,fRingsSi1};
+  Int_t NumberOfSectors[5]=
+  {fSectorsSi1,fSectorsSi2,fSectorsSi1,fSectorsSi2,fSectorsSi1};
+
   TFile *f1 =0;
   TTree *TK = gAlice->TreeK();
   if (TK) f1 = TK->GetCurrentFile();
@@ -127,11 +153,11 @@ void AliFMDMerger::Digitise()
     fBgrFile->cd();
     // gAlice->TreeS()->Reset();
     gAlice = (AliRun*)fBgrFile->Get("gAlice");
-    Int_t chargeBgr[10][20][150];
+    Int_t chargeBgr[10][30][150];
     ReadDigit( chargeBgr,fEvNrBgr);
     for ( ivol=1; ivol<=5; ivol++)
-      for ( iSector=1; iSector<=16; iSector++)
-       for (  iRing=1; iRing<=128; iRing++)
+      for ( iSector=1; iSector<=NumberOfSectors[ivol-1]; iSector++)
+       for (  iRing=1; iRing<=NumberOfRings[ivol-1]; iRing++)
          chargeSum[ivol][iSector][iRing]=
            chargeBgr[ivol][iSector][iRing]+
            chargeSum[ivol][iSector][iRing];
@@ -141,8 +167,8 @@ void AliFMDMerger::Digitise()
 
   // Put noise and make ADC signal
   for ( ivol=1; ivol<=5; ivol++){
-    for ( iSector=1; iSector<=16; iSector++){
-      for ( iRing=1; iRing<=128; iRing++){
+    for ( iSector=1; iSector<=NumberOfSectors[ivol-1]; iSector++){
+      for ( iRing=1; iRing<=NumberOfRings[ivol-1]; iRing++){
        digit[0]=ivol;
        digit[1]=iSector;
        digit[2]=iRing;
@@ -179,12 +205,12 @@ void AliFMDMerger::Digitise()
 
 //---------------------------------------------------------------------
 
-void AliFMDMerger::ReadDigit(Int_t chargeSum[][20][150], Int_t iEvNum)
+void AliFMDMerger::ReadDigit(Int_t chargeSum[][30][150], Int_t iEvNum)
 {
   AliFMDdigit *fmddigit;
   
   for (Int_t i=0; i<10; i++)
-    for(Int_t j=0; j<20; j++)
+    for(Int_t j=0; j<30; j++)
       for(Int_t ij=0; ij<150; ij++)
        chargeSum[i][j][ij]=0;
 
index 29208ac9183fcdbf53e5e53c1ad6cefee7eadab5..40ac715ea6fc2d0d3c9189dfd182a5afd1143df8 100644 (file)
@@ -24,9 +24,8 @@ class AliFMDMerger {
   void Digitise() ;
   Int_t PutNoise(Int_t charge){return (Int_t)(gRandom->Gaus(charge,500));}
   TClonesArray *SDigits() const {return fSDigits;}
-  // TClonesArray *Digits() const {return fDigits;}
  
-  void ReadDigit(Int_t a[][20][150], Int_t);
+  void ReadDigit(Int_t a[][30][150], Int_t);
   
   // Setters -> Later Communication with gAlice 
   void SetSignalEventNumber(Int_t i)     {fEvNrSig = i;}
@@ -34,16 +33,26 @@ class AliFMDMerger {
   void SetBackgroundFileName(char* file) {fFnBgr = file;}        
   void SetSignalFileName(char* file)     {fFnSig = file;}        
   void SetMode(MergeMode_t mode) {fMerge = mode;}
+
+  // Granularity
+  virtual void SetRingsSi1(Int_t ringsSi1);
+  virtual void SetSectorsSi1(Int_t sectorsSi1);
+  virtual void SetRingsSi2(Int_t ringsSi2);
+  virtual void SetSectorsSi2(Int_t sectorsSi2);
        
     enum {kBgTag = -1};
       
  private:    
     // Open the bgr file
     TFile *InitBgr();
-    
+  //Granularity
+  Int_t fRingsSi1;       // Number of rings
+  Int_t fSectorsSi1;    // Number of sectors
+  Int_t fRingsSi2;       // Number of rings
+  Int_t fSectorsSi2;    // Number of sectors
+   
  private:
-     TClonesArray *fDigits;               // ! array with digits
-    // Int_t fDigits;
+    TClonesArray *fDigits;               // ! array with digits
     TClonesArray *fSDigits      ; // List of summable digits
     Int_t fEvNrSig;                 // signal     event number
     Int_t fEvNrBgr;                 // background event number    
index d003ccb910ff1dc5787389169dd8fdf7ba126ad5..7e700c346eae1b76be1c0b3d36a201ccd7d1e730 100644 (file)
@@ -1,9 +1,36 @@
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ *                                                                        *
+ * Author: The ALICE Off-line Project.                                    *
+ * Contributors are mentioned in the code where appropriate.              *
+ *                                                                        *
+ * Permission to use, copy, modify and distribute this software and its   *
+ * documentation strictly for non-commercial purposes is hereby granted   *
+ * without fee, provided that the above copyright notice appears in all   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appear in the supporting documentation. The authors make no claims     *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+
+//_________________________________________________________________________
+// This is a TTask that constructs ReconstParticles (reconstructed particles) 
+// out of Digits
+// 
+//-- Authors: Evgeny Karpechev(INR) and Alla Maevsksia
+//////////////////////////////////////////////////////////////////////////////
+
 // --- ROOT system ---
 #include "TTask.h"
 #include "TTree.h"
 #include "TSystem.h"
 #include "TFile.h"
+#include "TROOT.h"
+#include "TFolder.h"
+
 // --- Standard library ---
+#include <stdlib.h>
+#include <iostream.h>
 
 // --- AliRoot header files ---
 
 #include "AliFMDv1.h"
 #include "AliFMDReconstruction.h"
 #include "AliRun.h"
-#include "AliDetector.h"
-
-#include "TROOT.h"
-#include "TFolder.h"
-#include <stdlib.h>
-#include <iostream.h>
-#include <fstream.h>
 
 ClassImp(AliFMDReconstruction)
 
@@ -54,11 +74,12 @@ AliFMDReconstruction::~AliFMDReconstruction()
 
 //____________________________________________________________________________
 
-void AliFMDReconstruction::Exec(TClonesArray *fReconParticles,Option_t *option) 
+void AliFMDReconstruction::Exec(Option_t *option) 
 { 
  //Collects all digits in the same active volume into number of particles
 
   AliFMD * FMD = (AliFMD *) gAlice->GetDetector("FMD");
+  TClonesArray *fReconParticles=FMD->ReconParticles();
   if(fNevents == 0) fNevents=(Int_t)gAlice->TreeD()->GetEntries(); 
   for(Int_t ievent=0;ievent<fNevents;ievent++)
     { 
@@ -67,26 +88,40 @@ void AliFMDReconstruction::Exec(TClonesArray *fReconParticles,Option_t *option)
       if(gAlice->TreeR()==0) gAlice->MakeTree("R");
       //Make branches
       FMD->MakeBranch("R");
-      Int_t threshold[]={   0,   18,  37,  56,   76, 
-                           96, 119, 138, 165,  172, 
-                           218, 231, 238, 277,  304, 
-                           330, 357, 423, 449,  476, 
-                           522, 542, 555, 568,  581, 
-                           614, 624, 657, 674,  687, 
-                           700, 713, 720, 727,  733, 
-                           740, 759, 778, 797,  816, 
-                           834, 853, 872, 891,  910, 
-                           929, 948, 967, 986,  1024};
-                         
+      
+      Int_t threshold[]={ 0,     14,  28,    42,   57, 
+                         72,    89,  104,  124,  129, 
+                         164,  174,  179,  208,  228, 
+                         248,  268,   317,  337,  357, 
+                         392,  407,  416,  426,  436, 
+                         461,  468,  493,  506,  515, 
+                         541,  566,  592,  617,  642, 
+                         668,  693,  719,  744,  770, 
+                         795,  821,  846,  871,  897, 
+                         922,  948,  973,  999, 1024};
+      
+
+      /*
+       Int_t threshold[]={    0,  18,  37,  56,   76, 
+                             96, 119, 138, 165,  172, 
+                                    218, 231, 238, 277,  304, 
+                            330, 357, 423, 449,  476, 
+                            522, 542, 555, 568,  581, 
+                             614, 624, 657, 674,  687, 
+                            700, 713, 720, 727,  733, 
+                            740, 759, 778, 797,  816, 
+                            834, 853, 872, 891,  910, 
+                            929, 948, 967, 986,  1024};
+      */
       
       int threshold_array_size=sizeof(threshold)/sizeof(threshold[0]);
       AliFMDdigit  *fmdDigit;
-       
+      //    cout<<" AliFMDdigit "<<AliFMDdigit<<endl;
       if (FMD)
        {
          gAlice->TreeD()->GetEvent(0); 
          TClonesArray *FMDdigits=FMD->Digits();
-         Int_t nDigits=FMDdigits->GetEntries(); 
+         Int_t nDigits=FMDdigits->GetEntries();
           Int_t RecParticles[4];
           Int_t nRecPart=0 ;
           for (Int_t digit=0;digit<nDigits;digit++) 
@@ -107,9 +142,9 @@ void AliFMDReconstruction::Exec(TClonesArray *fReconParticles,Option_t *option)
         }//if FMD
        gAlice->TreeR()->Reset();
        gAlice->TreeR()->Fill(); 
-        gAlice->TreeR()->Write(0,TObject::kOverwrite);
+       gAlice->TreeR()->Write(0,TObject::kOverwrite);
     } //event loop
-  cout<<"\nAliFMDReconstruction::Exec(TClonesArray *fReconParticles,Option_t *option) finished"<<endl;
+  cout<<"\nAliFMDReconstruction::Exec finished"<<endl;
 }
 //__________________________________________________________________
 
@@ -133,5 +168,23 @@ void AliFMDReconstruction::Print(Option_t* option)const
 
 
 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
 
 
index 40c81e49be96944d16b4cfa09e2e802e1e53f3e5..42ca0106e2ae40736e4823cd430da679aec15d0e 100644 (file)
@@ -1,16 +1,16 @@
+//   Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved.
+//  See cxx source for full Copyright notice                               
+//  AliFMDReconstruction.h 
+//  Task Class for making TreeR in FMD                        
+//-- Authors: Evgeny Karpechev (INR) and Alla Maevskaia (INR)
+
+
 #ifndef AliFMDReconstruction_h
-//#define AliFMDReconstruction_h 1
 #define AliFMDReconstruction_h
 
-// --- ROOT system ---
 #include "TTask.h"
 #include "TString.h"
 #include "AliFMD.h"
-#include "AliDetector.h"
-
-// --- Standard library ---
-
-// --- AliRoot header files ---
 
 class AliFMDReconstruction: public TTask 
 {
@@ -19,19 +19,17 @@ class AliFMDReconstruction: public TTask
   AliFMDReconstruction(char* HeaderFile,char *SdigitsFile = 0) ; 
   virtual ~AliFMDReconstruction();
   char *GetReconstParticlesFile()const{return (char*) fReconstParticlesFile.Data();}  
-  virtual void  Exec(TClonesArray *fReconParticles,Option_t *option); 
+  virtual void  Exec(Option_t *option); 
   void SetNEvents(Int_t Nevents){fNevents = Nevents;}
   Stat_t GetNEvents(){return fNevents;}
   void SetReconstParticlesFile(char * file ) ;
-  virtual void Print(Option_t* option) const ;
-  //TClonesArray *ReconParticles() const {return fReconParticles;}   
+  virtual void Print(Option_t* option) const ;   
 
  private:
-  Int_t   fNevents ;                         // Number of events to digitize
-  TString fReconstParticlesFile;    //output file 
+  Int_t   fNevents ;                         // Number of events
+  TString fReconstParticlesFile;             //output file 
   TString fHeadersFile ;                     //input file
-  //  TClonesArray *fReconParticles;
-  ClassDef(AliFMDReconstruction,1) 
+  ClassDef(AliFMDReconstruction,2) 
 };
 #endif
 
index 8fd5e82b5bb8a6568d07da3ff8e876abb132f8b9..1dcb4be8c26478d256cef45a4e6bea5fe5fbacac 100644 (file)
 #include "AliDetector.h"
 #include "AliMC.h"
 
+#include "TFile.h"
+#include "TTask.h"
+#include "TTree.h"
+#include "TSystem.h"
 #include "TROOT.h"
 #include "TFolder.h"
 #include <stdlib.h>
 
 ClassImp(AliFMDSDigitizer)
 
-           
 //____________________________________________________________________________ 
   AliFMDSDigitizer::AliFMDSDigitizer():TTask("AliFMDSDigitizer","") 
 {
-  fNevents = 0 ;     // Number of events to digitize, 0 means all evens in current file
-  // add Task to //root/Tasks folder
-  TTask * roottasks = (TTask*)gROOT->GetRootFolder()->FindObject("Tasks") ; 
-  roottasks->Add(this) ; 
+  // ctor
+  fNevents = 0 ;     
+  fSDigits = 0 ;
+  fHits = 0 ;
+
 }
+           
 //____________________________________________________________________________ 
-AliFMDSDigitizer::AliFMDSDigitizer(char* HeaderFile, char *SDigitsFile):TTask("AliFMDSDigitizer","")
+  AliFMDSDigitizer::AliFMDSDigitizer(char* HeaderFile,char *SdigitsFile ):TTask("AliFMDSDigitizer","") 
 {
-  // ctor
-  fNevents = 0 ;    // Number of events to digitize, 0 means all events in current file
-  fSDigitsFile = SDigitsFile ;
-  fHeadersFile = HeaderFile ;
-  //add Task to //root/Tasks folder
+  fNevents = 0 ;     // Number of events to digitize, 0 means all evens in current file
+  // add Task to //root/Tasks folder
   TTask * roottasks = (TTask*)gROOT->GetRootFolder()->FindObject("Tasks") ; 
   roottasks->Add(this) ; 
-    
 }
 
 //____________________________________________________________________________ 
@@ -75,143 +76,137 @@ AliFMDSDigitizer::AliFMDSDigitizer(char* HeaderFile, char *SDigitsFile):TTask("A
   // dtor
 }
 
+//---------------------------------------------------------------------
+void AliFMDSDigitizer::SetRingsSi1(Int_t ringsSi1)
+{
+  fRingsSi1=ringsSi1;
+}
+void AliFMDSDigitizer::SetSectorsSi1(Int_t sectorsSi1)
+{
+  fSectorsSi1=sectorsSi1;
+}
+void AliFMDSDigitizer::SetRingsSi2(Int_t ringsSi2)
+{
+  fRingsSi2=ringsSi2;
+}
+void AliFMDSDigitizer::SetSectorsSi2(Int_t sectorsSi2)
+{
+  fSectorsSi2=sectorsSi2;
+}
 
 //____________________________________________________________________________
 void AliFMDSDigitizer::Exec(Option_t *option) { 
-  //Collects all hits in the same active volume into digit
-  TClonesArray * sdigits = new TClonesArray("AliFMDdigit",1000) ;
-  TFile * file = 0;
-
-  AliFMD * FMD = (AliFMD *) gAlice->GetDetector("FMD") ;
-  
-  if(fNevents == 0) 
-    fNevents = (Int_t) gAlice->TreeE()->GetEntries() ; 
-
-  cout<<"AliFMDSDigitizer-> Nevents"<<fNevents<<endl;
-  for(Int_t ievent = 0; ievent < fNevents; ievent++){
-    gAlice->GetEvent(ievent) ;
-    if(gAlice->TreeH()==0) return ;
-
-    if(gAlice->TreeS() == 0)           
-      gAlice->MakeTree("S") ;
-    
-    TClonesArray * FMDhits = FMD->Hits() ;
 
-    
 
-    Int_t nSdigits = 0 ;
-    
-    //Make branches
-    char branchname[20];
-    sprintf(branchname,"%s",FMD->GetName());  
-    
-    Int_t bufferSize = 16000 ;
-    char * file =0;
-    if(!fSDigitsFile.IsNull())
-      file = (char*) fSDigitsFile.Data() ; //ievent ;
-    else
-      if(gSystem->Getenv("CONFIG_SPLIT_FILE")){ //generating file name
-       file = new char[30] ;
-       sprintf(file,"FMD.SDigits.root") ;
-       cout<<"CONFIG_SPLIT_FILE "<<file<<endl; 
-      }
-      else{
-       file = 0 ;
-       cout<<" FILE =0 "<<endl;}
-       cout<<"After CONFIG_SPLIT_FILE "<<file<<endl; 
-    
-    FMD->MakeBranchInTree(gAlice->TreeS(),branchname,&sdigits,bufferSize,file);
-  
-    /*    
-    Int_t splitlevel = 0 ;
-    sprintf(branchname,"AliFMDSDigitizer");   
-    AliFMDSDigitizer * sd = this ;
-    FMD->MakeBranchInTree(gAlice->TreeS(),branchname,"AliFMDSDigitizer",&sd, bufferSize, splitlevel,file); 
-    */
-
-    //Now made SDigits from hits, for PHOS it is the same
-  Int_t volume,sector,ring,charge;
-  Float_t e;
-  Float_t de[10][20][150];
-  Int_t ivol,isec,iring;
-  Int_t hit,nbytes;
-  TParticle *particle;
-  AliFMDhit  *fmdHit;
 
- // Event ------------------------- LOOP  
-  for (ivol=1; ivol<=6; ivol++)
-    for(isec=0; isec<16; isec++)
-      for(iring=0; iring<128; iring++)
-       de[ivol][isec][iring]=0;
+
+  Int_t NumberOfRings[5]=
+  {fRingsSi1,fRingsSi2,fRingsSi1,fRingsSi2,fRingsSi1};
+  Int_t NumberOfSectors[5]=
+  {fSectorsSi1,fSectorsSi2,fSectorsSi1,fSectorsSi2,fSectorsSi1};
+
+  // Initialise Hit array
+  fHits = new TClonesArray ("AliFMDhit", 1000);
+  fSDigits = new TClonesArray ("AliFMDdigit", 1000);
+
+  AliFMD *FMD = (AliFMD *) gAlice->GetDetector ("FMD");
+
+  if (fNevents == 0)
+    fNevents = (Int_t) gAlice->TreeE ()->GetEntries ();
+
+  for (Int_t ievent = 0; ievent < fNevents; ievent++)
+    {
+      gAlice->GetEvent (ievent);
+      if (gAlice->TreeH () == 0)
+       return;
+      if (gAlice->TreeS () == 0)
+       gAlice->MakeTree ("S");
+
+
+
       
-  if (FMD){
-    FMDhits   = FMD->Hits();
-    TTree *TH = gAlice->TreeH();
-    Stat_t ntracks    = TH->GetEntries();
-   for (Int_t track=0; track<ntracks;track++) {
-     gAlice->ResetHits();
-     nbytes += TH->GetEvent(track);
-     particle=gAlice->Particle(track);
-     Int_t nhits =FMDhits->GetEntriesFast();
-     
-     for (hit=0;hit<nhits;hit++) {
-       fmdHit   = (AliFMDhit*)FMDhits->UncheckedAt(hit);
-       
-       volume = fmdHit->Volume();
-       sector = fmdHit->NumberOfSector();
-       ring   = fmdHit->NumberOfRing();
-       e = fmdHit->Edep();
-       de[volume][sector][ring]=de[volume][sector][ring]+e;
-
-     } //hit loop
-   } //track loop
-  }//if FMD
-  Int_t digit[5];
-  Float_t I=1.664*0.04*2.33/22400; // = 0.69e-6;
-  for(ivol=1; ivol<=6; ivol++){
-    for(isec=0; isec<16; isec++){
-      for(iring=0; iring<128; iring++){
-       if(de[ivol][isec][iring]>0.){
-         digit[0]=ivol;
-         digit[1]=isec;
-         digit[2]=iring;
-         charge=Int_t (de[ivol][isec][iring]/I);
-         digit[3]=charge;
-
-         //dinamic diapason from MIP(0.155MeV) to 30MIP(4.65MeV)
-         //1024 ADC channels 
-         Float_t channelWidth=(22400*30)/1024;
-         digit[4]=Int_t(digit[3]/channelWidth);
-
-         new((*sdigits)[nSdigits++]) AliFMDdigit(digit) ;
-         
-       } //de >threshold
-      }// iring loop
-    }//sector loop
-  } // volume loop
-
-
-  
-  
-    gAlice->TreeS()->Fill() ;
-    TFile *f1 = new TFile(file,"RECREATE");
-    f1->cd();
-    gAlice->TreeS()->Write(0,TObject::kOverwrite) ;
-  }
-
-  if (sdigits) {
-    sdigits->Delete();
-    delete sdigits ;
-    sdigits = 0;
-  }
-
-  if(file)
-    file->Close() ;
+            //Make branches
+      char branchname[20];
+       sprintf (branchname, "%s", FMD->GetName ());
+      //Make branch for digits
+        FMD->MakeBranch ("S");
+    
+       //Now made SDigits from hits, for PHOS it is the same
+      Int_t volume, sector, ring, charge;
+      Float_t e;
+      Float_t de[10][50][150];
+      Int_t ivol, isec, iring;
+      Int_t hit, nbytes;
+      TParticle *particle;
+      AliFMDhit *fmdHit;
+      TClonesArray *FMDhits = FMD->Hits ();
+
+      // Event ------------------------- LOOP  
+
+      for (ivol = 0; ivol < 10; ivol++)
+       for (isec = 0; isec < 50; isec++)
+         for (iring = 0; iring < 150; iring++)
+           de[ivol][isec][iring] = 0;
+
+      if (FMD)
+       {
+         FMDhits = FMD->Hits ();
+         TTree *TH = gAlice->TreeH ();
+         Stat_t ntracks = TH->GetEntries ();
+         for (Int_t track = 0; track < ntracks; track++)
+           {
+             gAlice->ResetHits ();
+             nbytes += TH->GetEvent (track);
+             particle = gAlice->Particle (track);
+             Int_t nhits = FMDhits->GetEntriesFast ();
+
+             for (hit = 0; hit < nhits; hit++)
+               {
+                 fmdHit = (AliFMDhit *) FMDhits->UncheckedAt (hit);
+
+                 volume = fmdHit->Volume ();
+                 sector = fmdHit->NumberOfSector ();
+                 ring = fmdHit->NumberOfRing ();
+                 e = fmdHit->Edep ();
+                 de[volume][sector][ring] += e;
+               }               //hit loop
+           }                   //track loop
+       }                       //if FMD
+
+
+      Int_t digit[5];
+      Float_t I = 1.664 * 0.04 * 2.33 / 22400; // = 0.69e-6;
+      for (ivol = 1; ivol < 6; ivol++)
+       { 
+         for (isec = 1; isec <= NumberOfSectors[ivol-1]; isec++)
+           { 
+             for (iring = 1; iring <= NumberOfRings[ivol-1]; iring++)
+               {
+                     digit[0] = ivol;
+                     digit[1] = isec;
+                     digit[2] = iring;
+                     charge = Int_t (de[ivol][isec][iring] / I);
+
+                     digit[3] = charge;
+                     //dinamic diapason from MIP(0.155MeV) to 30MIP(4.65MeV)
+                     //1024 ADC channels 
+                     Float_t channelWidth = (22400 * 30) / 1024;
+
+                     digit[4] = Int_t (digit[3] / channelWidth);
+                     FMD->AddSDigit(digit);
+
+               }               // iring loop
+           }                   //sector loop
+       }                       // volume loop
+      
+      gAlice->TreeS()->Reset();
+      gAlice->TreeS()->Fill();
+      gAlice->TreeS()->Write(0,TObject::kOverwrite) ;
+    }                          //event loop
+
 
 }
 //__________________________________________________________________
 void AliFMDSDigitizer::SetSDigitsFile(char * file ){
   if(!fSDigitsFile.IsNull())
@@ -219,7 +214,8 @@ void AliFMDSDigitizer::SetSDigitsFile(char * file ){
   fSDigitsFile=file ;
 }
 //__________________________________________________________________
-void AliFMDSDigitizer::Print(Option_t* option)const{
+void AliFMDSDigitizer::Print(Option_t* option)const
+{
   cout << "------------------- "<< GetName() << " -------------" << endl ;
   if(fSDigitsFile.IsNull())
     cout << " Writing SDigitis to file galice.root "<< endl ;
index 9a6d8e522e5d9be0d9b95da285f2b4754544f544..c77a2d4c246bbfc30e2dbdc7ae5ffd59035d3e36 100644 (file)
@@ -36,14 +36,30 @@ public:
   Stat_t GetNEvents(){return fNevents;}
   void SetSDigitsFile(char * file ) ;
   virtual void Print(Option_t* option) const ;
+  TClonesArray *SDigits() const {return fSDigits;}
+  TClonesArray *Hits() const {return fHits;}
+  // Granularity
+   virtual void SetRingsSi1(Int_t ringsSi1);
+   virtual void SetSectorsSi1(Int_t sectorsSi1);
+   virtual void SetRingsSi2(Int_t ringsSi2);
+   virtual void SetSectorsSi2(Int_t sectorsSi2);
+
 
 private:
   Int_t   fNevents ;        // Number of events to digitize
   TString fSDigitsFile ;    //output file 
+  TClonesArray *fSDigits      ; // List of summable digits
+  TClonesArray *fHits      ; // List of summable digits
   TString fHeadersFile ;    //input file
+ protected:
+  //Granularity
+   Int_t fRingsSi1;       // Number of rings
+   Int_t fSectorsSi1;    // Number of sectors
+   Int_t fRingsSi2;       // Number of rings
+  Int_t fSectorsSi2;    // Number of sectors
 
 
-  ClassDef(AliFMDSDigitizer,2)  // description 
+  ClassDef(AliFMDSDigitizer,1)  // description 
 
 };
 
index 13ad26bc2573c6e3c55f5feae0c593d046741c70..a47b42084cee1b5d74e44c8f2cdae1a4dca3ec6e 100644 (file)
@@ -51,33 +51,36 @@ AliFMDv0::AliFMDv0(const char *name, const char *title):
   // Standart constructor for Forward Multiplicity Detector version 0
   //
   fIdSens1=0;
+  fIdSens2=0;
+  fIdSens3=0;
+  fIdSens4=0;
+  fIdSens5=0;
 //  setBufferSize(128000);
 }
 //-------------------------------------------------------------------------
+
 void AliFMDv0::CreateGeometry()
 {
  //
   // Create the geometry of Forward Multiplicity Detector version 0
-  //
-  //Detector consists of 6 volumes: 
-  // 1st covered pseudorapidity interval from 3.3 to 2.0
-  // and placed on 65cm in Z-direction;
-  // 2nd - from 2.0 to 1.6 and Z=85 cm;
+  //Detector consists of 5 volumes: 
+  // 1st covered pseudorapidity interval from 3.58 to 2.03
+  // and placed on 62.8cm in Z-direction;
+  // 2nd - from 1.94 to 1.51 and Z=75.2 cm;
   // 3d  - the same pseudorapidity interval as the 1st 
-  // but on the other side from the interaction point z=-65cm;
+  // but on the other side from the interaction point z=-62.8cm;
   // 4th - simmetricaly with the 2nd : 
-  // pseudorapidity from 2.0 to 1.6, Z=-85cm   
-  // 5th - from 3.6 to 4.7, Z=-270cm
-  // 6th - from 4.5 to 5.5 , Z=-630cm.
-  // Each part has 400mkm Si (sensetive area, detector itself),
+  // pseudorapidity from 1.94 to 1.51, Z=-75.2cm   
+  // 5th - from 3.71 to 5.28, Z=-345cm
+  // Each part has 300mkm Si (sensetive area, detector itself),
   // 0.75cm of plastic simulated electronics material,
   // Al support ring 2cm thickness and 1cm width placed on 
   // the outer radius of each Si disk;
-  //    
+   //
   // begin Html
   /*
    <img src="gif/AliFMDv0.gif">
-  */
+   */
   //
 
   Int_t *idtmed = fIdtmed->GetArray();
@@ -85,34 +88,47 @@ void AliFMDv0::CreateGeometry()
   Int_t ifmd;
   Int_t idrotm[999];
   Float_t zfmd,par[3];
-  char name[5];
+  char name[5], nameSi[5], nameSector[5], nameRing[5];
 
   Float_t rin[6], rout[6],zpos;
-  Float_t etain[6]= {3.3, 2.0, 3.3, 2.0, 4.7, 5.5};
-  Float_t etaout[6]={2.0, 1.6, 2.0, 1.6, 3.6, 4.5};
-  Float_t z[6]={64., 85., -64., -85., -270., -630};
+
+  Float_t etain[5]= {3.58, 1.94, 3.58, 1.94, 5.28};
+  Float_t etaout[6]={2.03, 1.51, 2.03, 1.51, 3.71};
+  //  Float_t z[6]={64., 85., -64., -85., -270., -630};
+  Float_t z[6]={62.8, 75.2, -62.8, -75.2, -345.};
+  Float_t zDet=0.03;
+  Float_t zElectronic=0.1;
+  Float_t zSupport=1.;
+  /*
+  Float_t etain[6]= {3.3, 2.0, 3.3, 2.0, 4.5, 5.5};
+  Float_t etaout[6]={2.0, 1.6, 2.0, 1.6, 3.3, 4.5};
+  Float_t z[6]={64., 85., -64., -85., -240., -630};
   Float_t zDet=0.04;
   Float_t zElectronic=0.75;
   Float_t zSupport=1.;
-  Float_t zFMD=3.;
+  */
+
+  Float_t zFMD=1.;
 //-------------------------------------------------------------------
  //  FMD 
  //------------------------------------------------------------------
 
   AliMatrix(idrotm[901], 90, 0, 90, 90, 180, 0);
 
-  gMC->Gsvolu("GFSI","TUBE", idtmed[1], par, 0);
+  //  gMC->Gsvolu("GSI","TUBE", idtmed[1], par, 0);
   gMC->Gsvolu("GEL ","TUBE", idtmed[4], par, 0);
   gMC->Gsvolu("GSUP","TUBE", idtmed[2], par, 0);
 
-  for (ifmd =0; ifmd < 6; ifmd++){
+  for (ifmd =0; ifmd < 5; ifmd++){
 
-    sprintf(name,"FMD%d",ifmd);
-    if (fDebug)
-      printf("%s: %s",ClassName(),name);
+    sprintf(name,"FMD%d",ifmd+1);
+    sprintf(nameSi,"GSI%d",ifmd+1);
+    sprintf(nameSector,"GSC%d",ifmd+1);
+    sprintf(nameRing,"GRN%d",ifmd+1);
+    printf(name,nameSi);
     
     zfmd=TMath::Abs(z[ifmd]);
-    if (fDebug) printf("zfmd %f z[ifmd] %f",zfmd,z[ifmd]);
+    printf("zfmd %f z[ifmd] %f",zfmd,z[ifmd]);
     AliFMD::Eta2Radius(etain[ifmd],zfmd,&rin[ifmd]);
     AliFMD::Eta2Radius(etaout[ifmd],zfmd,&rout[ifmd]);
     
@@ -120,8 +136,10 @@ void AliFMDv0::CreateGeometry()
     par[1]=rout[ifmd];
     par[2]=zFMD/2;
     gMC->Gsvolu(name,"TUBE", idtmed[3], par, 3);
+    //    par[2]=zDet/2;
+    gMC->Gsvolu(nameSi,"TUBE", idtmed[1], par, 0);
     
-    if (fDebug) printf ("rin %f rout %f ZFMD %f\n",par[0],par[1],z[ifmd]);
+    printf ("rin %f rout %f ZFMD %f\n",par[0],par[1],z[ifmd]);
     if (z[ifmd] < 0){  
       gMC->Gspos(name,1,"ALIC",0,0,z[ifmd],0, "ONLY");}
     else { 
@@ -129,7 +147,24 @@ void AliFMDv0::CreateGeometry()
   //Silicon detector
     par[2]=zDet/2;
     zpos=zFMD/2 -par[2];
-    gMC->Gsposp("GFSI",ifmd+1,name,0,0,zpos,0, "ONLY",par,3);
+    gMC->Gsposp(nameSi,ifmd+1,name,0,0,zpos,0, "ONLY",par,3);
+    cout<<" Si "<<nameSi<<" ifmd "<<ifmd<<" rin "<<par[0]<<" rout "<<par[1]<<
+      " zDet "<<par[2]<<endl;
+    //Granularity
+    cout<<"fSectorsSi1 "<<fSectorsSi1<<
+      " fRingsSi1 "<<fRingsSi1<<
+      " fSectorsSi2 "<<fSectorsSi2<<
+      " fRingsSi2 "<<fRingsSi2<<endl;
+   if(ifmd==1||ifmd==3)
+      { 
+       gMC->Gsdvn(nameSector, nameSi , fSectorsSi2, 2);
+       gMC->Gsdvn(nameRing, nameSector, fRingsSi2, 1);
+      }
+    else
+      {
+       gMC->Gsdvn(nameSector, nameSi , fSectorsSi1, 2);
+       gMC->Gsdvn(nameRing, nameSector , fRingsSi1, 1);
+      }
 
     //Plastic slice for electronics
     par[2]=zElectronic/2;
@@ -141,16 +176,14 @@ void AliFMDv0::CreateGeometry()
    par[0]=rout[ifmd]-2;
    par[2]=zSupport/2;
    zpos=zpos-zElectronic/2-par[2];
-   gMC->Gsposp("GSUP",ifmd+1,name,0,0,zpos,0, "ONLY",par,3);
+   //   gMC->Gsposp("GSUP",ifmd+1,name,0,0,zpos,0, "ONLY",par,3);
    
 
   }  
-  //Silicon
-
-  
-    
 
 }    
+
+
 //------------------------------------------------------------------------
 void AliFMDv0::CreateMaterials()
 {
@@ -217,7 +250,11 @@ void AliFMDv0::Init()
 //
 AliMC* gMC=AliMC::GetMC();
 AliFMD::Init();
-fIdSens1=gMC->VolId("GFSI");
+fIdSens1=gMC->VolId("GRN1");
+fIdSens2=gMC->VolId("GRN2");
+fIdSens3=gMC->VolId("GRN3");
+fIdSens4=gMC->VolId("GRN4");
+fIdSens5=gMC->VolId("GRN5");
 if (fDebug) printf("*** FMD version 0 initialized ***\n");
 }
 
@@ -228,58 +265,5 @@ void AliFMDv0::StepManager()
   //
   // Called for every step in the Forward Multiplicity Detector
   //
-  Int_t id,copy;
-  static Float_t hits[9];
-  static Int_t vol[1];
-  static Float_t de;
-  TLorentzVector pos;
-  TLorentzVector mom;
-
-
-  TClonesArray &lhits = *fHits;
-  AliMC* gMC=AliMC::GetMC();
-  if(!gMC->IsTrackAlive()) return; // particle has disappeared
-
-  Float_t charge = gMC->TrackCharge();
-  if(TMath::Abs(charge)<=0.) return; //take only charged particles
-
-  //  ((TGeant3*)gMC)->Gpcxyz();
-
-  id=gMC->CurrentVolID(copy);
-  
-// Check the sensetive volume
-   if(id==fIdSens1)
-     {
-       if(gMC->IsTrackEntering())
-        {
-          vol[0]=copy;
-          gMC->TrackPosition(pos);
-          hits[0]=pos[0];
-          hits[1]=pos[1];
-          hits[2]=pos[2];
-          
-          gMC->TrackMomentum(mom);
-          hits[3]=mom[0];
-          hits[4]=mom[1];
-          hits[5]=mom[2];
-
-          Int_t iPart= gMC->TrackPid();
-          Int_t partId=gMC->IdFromPDG(iPart);
-          hits[7]=partId;
-          hits[8]=1e9*gMC->TrackTime();
-          de=0.;
-        }
-       if(gMC->IsTrackInside()){
-          de=de+1000.*gMC->Edep();
-       }
-       
-       if(gMC->IsTrackExiting()
-         ||gMC->IsTrackDisappeared()||
-         gMC->IsTrackStop())
-        {
-            hits[6]=de+1000.*gMC->Edep();
-    new(lhits[fNhits++]) AliFMDhit(fIshunt,gAlice->CurrentTrack(),vol,hits);
-        } // IsTrackExiting()
-     }
- }
+}
 
index 24f9b5358c28d0031ea77e3928b171b5dfc54182..398339a737791667fe39b93960f5a6ef965aaf60 100644 (file)
@@ -23,9 +23,15 @@ public:
   virtual void   StepManager();
   
 protected:
-   Int_t fIdSens1; // Sensetive volume  in FMD
-  ClassDef(AliFMDv0,1)  //Class for FMD version 0
+  Int_t fIdSens1; // Sensetive volume  in FMD
+  Int_t fIdSens2; // Sensetive volume  in FMD
+  Int_t fIdSens3; // Sensetive volume  in FMD
+  Int_t fIdSens4; // Sensetive volume  in FMD
+  Int_t fIdSens5; // Sensetive volume  in FMD
+   
+
+   
+  ClassDef(AliFMDv0,2)  //Class for FMD version 0
 };
 
 #endif
index 343499d31a0de207f1ad23220f6fa6c6490471d0..126d8312d216e1ac7644d277ab00290132689839 100644 (file)
@@ -35,6 +35,7 @@
 #include <TLorentzVector.h>
 #include <TDirectory.h>
 #include "AliFMDv1.h"
+#include "AliFMDv0.h"
 #include "AliRun.h"
 #include "AliMC.h"
 #include <iostream.h>
@@ -55,6 +56,10 @@ AliFMDv1::AliFMDv1(const char *name, const char *title):
   // Standart constructor for Forward Multiplicity Detector version 0
   //
   fIdSens1=0;
+  fIdSens2=0;
+  fIdSens3=0;
+  fIdSens4=0;
+  fIdSens5=0;
 //  setBufferSize(128000);
 }
 //-------------------------------------------------------------------------
@@ -84,40 +89,45 @@ void AliFMDv1::CreateGeometry()
    */
   //
 
+  
   Int_t *idtmed = fIdtmed->GetArray();
    
   Int_t ifmd;
   Int_t idrotm[999];
   Float_t zfmd,par[3];
-  char name[5];
+  char name[5], nameSi[5], nameSector[5], nameRing[5];
 
   Float_t rin[6], rout[6],zpos;
-  Float_t etain[6]= {3.3, 2.0, 3.3, 2.0, 4.5, 5.5};
-  Float_t etaout[6]={2.0, 1.6, 2.0, 1.6, 3.3, 4.5};
+
+  Float_t etain[5]= {3.58, 1.94, 3.58, 1.94, 5.28};
+  Float_t etaout[6]={2.03, 1.51, 2.03, 1.51, 3.71};
   //  Float_t z[6]={64., 85., -64., -85., -270., -630};
-  Float_t z[6]={64., 85., -64., -85., -240., -630};
-  Float_t zDet=0.04;
-  Float_t zElectronic=0.75;
+  Float_t z[6]={62.8, 75.2, -62.8, -75.2, -345.};
+  Float_t zDet=0.03;
+  Float_t zElectronic=0.1;
   Float_t zSupport=1.;
-  Float_t zFMD=3.;
+
+  Float_t zFMD=1.;
 //-------------------------------------------------------------------
  //  FMD 
  //------------------------------------------------------------------
 
   AliMatrix(idrotm[901], 90, 0, 90, 90, 180, 0);
 
-  gMC->Gsvolu("GFSI","TUBE", idtmed[1], par, 0);
+  //  gMC->Gsvolu("GSI","TUBE", idtmed[1], par, 0);
   gMC->Gsvolu("GEL ","TUBE", idtmed[4], par, 0);
   gMC->Gsvolu("GSUP","TUBE", idtmed[2], par, 0);
 
   for (ifmd =0; ifmd < 5; ifmd++){
 
-    sprintf(name,"FMD%d",ifmd);
-    if (fDebug)
-      printf("%s: %s",ClassName(),name);
+    sprintf(name,"FMD%d",ifmd+1);
+    sprintf(nameSi,"GSI%d",ifmd+1);
+    sprintf(nameSector,"GSC%d",ifmd+1);
+    sprintf(nameRing,"GRN%d",ifmd+1);
+    printf(name,nameSi);
     
     zfmd=TMath::Abs(z[ifmd]);
-    if (fDebug) printf("zfmd %f z[ifmd] %f",zfmd,z[ifmd]);
+    printf("zfmd %f z[ifmd] %f",zfmd,z[ifmd]);
     AliFMD::Eta2Radius(etain[ifmd],zfmd,&rin[ifmd]);
     AliFMD::Eta2Radius(etaout[ifmd],zfmd,&rout[ifmd]);
     
@@ -125,8 +135,10 @@ void AliFMDv1::CreateGeometry()
     par[1]=rout[ifmd];
     par[2]=zFMD/2;
     gMC->Gsvolu(name,"TUBE", idtmed[3], par, 3);
+    //    par[2]=zDet/2;
+    gMC->Gsvolu(nameSi,"TUBE", idtmed[1], par, 0);
     
-    if (fDebug) printf ("rin %f rout %f ZFMD %f\n",par[0],par[1],z[ifmd]);
+    printf ("rin %f rout %f ZFMD %f\n",par[0],par[1],z[ifmd]);
     if (z[ifmd] < 0){  
       gMC->Gspos(name,1,"ALIC",0,0,z[ifmd],0, "ONLY");}
     else { 
@@ -134,8 +146,25 @@ void AliFMDv1::CreateGeometry()
   //Silicon detector
     par[2]=zDet/2;
     zpos=zFMD/2 -par[2];
-    gMC->Gsposp("GFSI",ifmd+1,name,0,0,zpos,0, "ONLY",par,3);
-     
+    gMC->Gsposp(nameSi,ifmd+1,name,0,0,zpos,0, "ONLY",par,3);
+    cout<<" Si "<<nameSi<<" ifmd "<<ifmd<<" rin "<<par[0]<<" rout "<<par[1]<<
+      " zDet "<<par[2]<<endl;
+    //Granularity
+    cout<<"fSectorsSi1 "<<fSectorsSi1<<
+      " fRingsSi1 "<<fRingsSi1<<
+      " fSectorsSi2 "<<fSectorsSi2<<
+      " fRingsSi2 "<<fRingsSi2<<endl;
+   if(ifmd==1||ifmd==3)
+      { 
+       gMC->Gsdvn(nameSector, nameSi , fSectorsSi2, 2);
+       gMC->Gsdvn(nameRing, nameSector, fRingsSi2, 1);
+      }
+    else
+      {
+       gMC->Gsdvn(nameSector, nameSi , fSectorsSi1, 2);
+       gMC->Gsdvn(nameRing, nameSector , fRingsSi1, 1);
+      }
+
     //Plastic slice for electronics
     par[2]=zElectronic/2;
     zpos=zpos-zDet/2-par[2];
@@ -146,25 +175,13 @@ void AliFMDv1::CreateGeometry()
    par[0]=rout[ifmd]-2;
    par[2]=zSupport/2;
    zpos=zpos-zElectronic/2-par[2];
-   gMC->Gsposp("GSUP",ifmd+1,name,0,0,zpos,0, "ONLY",par,3);
+   //   gMC->Gsposp("GSUP",ifmd+1,name,0,0,zpos,0, "ONLY",par,3);
    
 
   }  
-   
-   //Silicon
-
-
-  gMC->Gsdvn("GSEC", "GFSI", 16, 2);
-  gMC->Gsdvn("GRIN", "GSEC", 128, 1); 
-   /*
-      for (Int_t i=0; i<16; i++){
-      sprintf(ring,"GR%d",i);
-      printf(ring);
-      gMC->Gsdvn(ring, "GSEC", 128, 1);
-    }
-      */
 
 }    
+
 //------------------------------------------------------------------------
 void AliFMDv1::CreateMaterials()
 {
@@ -207,7 +224,6 @@ AliMC* pMC = AliMC::GetMC();
 pMC->Gsatt("ALIC","SEEN",0);
 //
 //Set volumes visible
-gMC->Gsatt("FMD0","SEEN",1);
 gMC->Gsatt("FMD1","SEEN",1);
 gMC->Gsatt("FMD2","SEEN",1);
 gMC->Gsatt("FMD3","SEEN",1);
@@ -229,10 +245,14 @@ void AliFMDv1::Init()
 {
 // Initialises version 0 of the Forward Multiplicity Detector
 //
-  AliMC* gMC=AliMC::GetMC();
-  AliFMD::Init();
-  fIdSens1=gMC->VolId("GRIN");
-  if (fDebug) printf("*** FMD version 1 initialized ***\n");
+AliMC* gMC=AliMC::GetMC();
+AliFMD::Init();
+fIdSens1=gMC->VolId("GRN1");
+fIdSens2=gMC->VolId("GRN2");
+fIdSens3=gMC->VolId("GRN3");
+fIdSens4=gMC->VolId("GRN4");
+fIdSens5=gMC->VolId("GRN5");
+printf("*** FMD version 1 initialized ***\n");
 }
 
 //-------------------------------------------------------------------
@@ -259,19 +279,19 @@ void AliFMDv1::StepManager()
 
   //  printf(" in StepManeger \n");
   id=gMC->CurrentVolID(copy);
+  //((TGeant3*)gMC)->Gpcxyz();
   
 // Check the sensetive volume
-   if(id==fIdSens1)
+   if(id==fIdSens1||id==fIdSens2||id==fIdSens3||id==fIdSens4||id==fIdSens5)
      {
        if(gMC->IsTrackEntering())
         {
-          //      ((TGeant3*)gMC)->Gpcxyz();
           vol[2]=copy;
           gMC->CurrentVolOffID(1,copy1);
           vol[1]=copy1;
           gMC->CurrentVolOffID(2,copy2);
           vol[0]=copy2;
-          //      printf("vol0 %d vol1 %d vol2 %d\n",vol[0],vol[1],vol[2]); 
+          //  printf("vol0 %d vol1 %d vol2 %d\n",vol[0],vol[1],vol[2]); 
           gMC->TrackPosition(pos);
           hits[0]=pos[0];
           hits[1]=pos[1];
@@ -287,10 +307,11 @@ void AliFMDv1::StepManager()
           hits[7]=partId;
           hits[8]=1e9*gMC->TrackTime();
           de=0.;
-          //      for(i=0; i<9; i++) printf(" hits %f \n",hits[i]);
         }
        if(gMC->IsTrackInside()){
           de=de+1000.*gMC->Edep();
+          //      cout<<" de "<<de<<endl;
+          // cout<<" step "<<gMC->TrackStep()<<endl;
        }
        
        if(gMC->IsTrackExiting()
@@ -298,7 +319,10 @@ void AliFMDv1::StepManager()
          gMC->IsTrackStop())
         {
             hits[6]=de+1000.*gMC->Edep();
-    new(lhits[fNhits++]) AliFMDhit(fIshunt,gAlice->CurrentTrack(),vol,hits);
+            //     cout<<" idSens "<<id<<endl;
+            //cout<<" hits "<<hits[6]<<endl;
+            //     for(Int_t i=0; i<9; i++) printf(" i %d hits %f \n",i,hits[i]);
+      new(lhits[fNhits++]) AliFMDhit(fIshunt,gAlice->CurrentTrack(),vol,hits);
         } // IsTrackExiting()
      }
   }
index 94dfcdf1cc4424c8b4675d276e124f1a185a07c7..5f7b8f8719df930ab1369639a7739b3a68e20ac0 100644 (file)
@@ -19,7 +19,7 @@ public:
   virtual void   CreateMaterials();
   virtual void   DrawDetector();
   virtual void   Init();
-  virtual Int_t  IsVersion() const {return 0;}
+  virtual Int_t  IsVersion() const {return 1;}
   virtual void   StepManager();
   //  virtual void Hit2Digits(Int_t bgrEvent, Option_t *opt1=" ",
   //   Option_t *opt2=" ",Text_t *name=" "); // hit to digit for v1 :test  
@@ -30,6 +30,10 @@ public:
 
 protected:
    Int_t fIdSens1; // Sensetive volume  in FMD
+   Int_t fIdSens2; // Sensetive volume  in FMD
+   Int_t fIdSens3; // Sensetive volume  in FMD
+   Int_t fIdSens4; // Sensetive volume  in FMD
+   Int_t fIdSens5; // Sensetive volume  in FMD
    
 // Background event for event mixing
   
index cd7bf05ce877bf4e7c1d0c6f0cc9ce7443991f6c..e4ec950a38deb0b17c0ba42931f5dedf8ac5526c 100644 (file)
@@ -9,9 +9,9 @@ void FMDMerger (Int_t evNumber1=0, Int_t evNumber2=0, Int_t ibg=0, Int_t bgr=10)
 
 // Connect the Root Galice file containing Geometry, Kine and Hits
 
-   TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject("mgalice.root");
+   TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject("pipe.root");
    if (file) file->Close(); 
-   file = new TFile("mgalice.root","UPDATE");
+   file = new TFile("galice.root","UPDATE");
    cout<<" Just starting... file "<<file<<endl;
 
 // Get AliRun object from file or create it if not on file
@@ -22,18 +22,25 @@ void FMDMerger (Int_t evNumber1=0, Int_t evNumber2=0, Int_t ibg=0, Int_t bgr=10)
        if (!gAlice) gAlice = new AliRun("gAlice","Alice test program");
    }
    AliFMD *FMD  = (AliFMD*) gAlice->GetModule("FMD");
-  cout<<" FMDMerger:: FMD "<<FMD<<" gAlice "<<gAlice<<endl;
 
    if (FMD) {
 // creation
        AliFMDMerger* merger = new AliFMDMerger();
+       cout<<" merger "<<merger<<endl;
+       /*
+       // granularity
+       merger->SetRingsSi1(128);
+        merger->SetRingsSi2(64);
+        merger->SetSectorsSi1(20);
+        merger->SetSectorsSi2(24);
+       */
 // configuration
        if (ibg) {
         merger->SetMode(ibg);
         merger->SetBackgroundFileName("bg.root");
+        cout<<" background"<<endl;
       }
        // pass
-       //  merger->SetSignalFileName("mgalice.root");
        FMD->SetMerger(merger);
    }
 // Action !
diff --git a/FMD/FMDReconstruction.C b/FMD/FMDReconstruction.C
new file mode 100644 (file)
index 0000000..afd9ec0
--- /dev/null
@@ -0,0 +1,19 @@
+void FMDReconstruction (Int_t evNumber=1) 
+{
+  if (gClassTable->GetID("AliRun") < 0) 
+    {
+      gROOT->LoadMacro("$ALICE_ROOT/macros/loadlibs.C");
+      loadlibs();
+    }
+  if (gSystem->Getenv("CONFIG_SPLIT_FILE"))
+    cout << "SPLIT" << endl;
+  else
+    cout << "NO SPLIT" << endl ;
+  TFile * f = new TFile("mgalice.root","UPDATE");
+  gAlice = (AliRun*) f->Get("gAlice") ;
+  cout<<"gAlice="<<gAlice<<endl;
+  AliFMD* FMD  = (AliFMD *)gAlice->GetDetector("FMD");
+  cout<<"\nFMD="<<FMD<<endl;
+  gAlice->RunReco("FMD") ;
+}
+  
diff --git a/FMD/FMDReconstructor.C b/FMD/FMDReconstructor.C
new file mode 100644 (file)
index 0000000..6151f0e
--- /dev/null
@@ -0,0 +1,17 @@
+void FMDReconstructor (Int_t evNumber=1) 
+{
+  if (gClassTable->GetID("AliRun") < 0) 
+    {
+      gROOT->LoadMacro("$ALICE_ROOT/macros/loadlibs.C");
+      loadlibs();
+    }
+  if (gSystem->Getenv("CONFIG_SPLIT_FILE"))
+    cout << "SPLIT" << endl;
+  else
+    cout << "NO SPLIT" << endl ;
+  TFile * f = new TFile("galice.root","UPDATE");
+  gAlice = (AliRun*) f->Get("gAlice") ;
+  AliFMD* FMD  = (AliFMD *)gAlice->GetDetector("FMD");
+  gAlice->RunReco("FMD") ;
+}
+  
index ee298bb95be344f284f040b093626c9e4cd5e3f8..f61aa2cf0e5b0a62ce810bdbe82e2a5a51909f79 100644 (file)
@@ -8,12 +8,10 @@ void Hits2SDigits(){
     cout << "SPLIT" << endl;
    else
     cout << "NO SPLIT" << endl ;
-  TFile * f = new TFile("mgalice.root","UPDATE");
+  TFile * f = new TFile("galice.root","UPDATE");
   gAlice = (AliRun*) f->Get("gAlice") ;
-  cout<<"gAlice="<<gAlice<<endl;
   AliFMD* FMD  = (AliFMD *)gAlice->GetDetector("FMD") ;
-  cout<<" FMD "<<FMD<<endl;
   gAlice->GetEvent(0);
-  gAlice->Hits2SDigits() ;
+  gAlice->Hits2SDigits("FMD") ;
   gAlice->TreeS()->Write(0,TObject::kOverwrite) ;
   }
index 9392748135f8e185495292f614b522beb72b8a7e..3c38edfc9957acfa2a9278defde960e12f076f2f 100644 (file)
-void TestReconstruction (Int_t evNumber=1
+void  TestReconstruction (Int_t vol=1, const Int_t nRings=128, const Int_t nSectors=20
 {
+  // Dynamically link some shared libs
   if (gClassTable->GetID("AliRun") < 0) 
     {
-      gROOT->LoadMacro("$ALICE_ROOT/macros/loadlibs.C");
+      gROOT->LoadMacro("loadlibs.C");
       loadlibs();
     }
-  if (gSystem->Getenv("CONFIG_SPLIT_FILE"))
-    cout << "SPLIT" << endl;
-  else
-    cout << "NO SPLIT" << endl ;
-  TFile * f = new TFile("mgalice.root","UPDATE");
-  gAlice = (AliRun*) f->Get("gAlice") ;
-  cout<<"gAlice="<<gAlice<<endl;
-  AliFMD* FMD  = (AliFMD *)gAlice->GetDetector("FMD");
-  cout<<"\nFMD="<<FMD<<endl;
-  gAlice->RunReco("FMD") ;
-}
+  // Connect the Root Galice file containing Geometry, Kine and Hits
+  char filename[]="galice.root";
+  TFile *file =  (TFile*)gROOT->GetListOfFiles()->FindObject(filename);
+  if (!file) file = new TFile(filename); 
+  // Get AliRun object from file or create it if not on file
+  if (!gAlice) 
+    {
+      gAlice = (AliRun*)file->Get("gAlice");
+      if (gAlice) printf("\nAliRun object found on file\n");
+      if (!gAlice) gAlice = new AliRun("gAlice","Alice test program");
+    }
+  Int_t nbytes = 0;
+  Int_t ipart;
+  Int_t volume;
+  Int_t np[nRings][nSectors];
   
+  for (int i=0;i<nRings;i++)
+    for(int j=0;j<nSectors;j++)
+      np[i][j]=0;
+  TH1F *hNReal = new TH1F("hNReal","Real number of particles",50,0,50);
+  TH1F *hNRec  = new TH1F("hNRec ","Reconst. number of particles",50,0,50);
+
+  Int_t nparticles = gAlice->GetEvent(0);
+  if (nparticles <= 0) return;
+  printf("\nnparticles=%d\n",nparticles);
+   
+  gAlice->TreeR()->GetEvent(0);   
+  AliFMD *FMD  = (AliFMD*)gAlice->GetDetector("FMD");
+  TClonesArray *Particles = gAlice->Particles();
+  TParticle *particle;
+  AliFMDhit *fmdHit;
+  AliFMDReconstParticles *fmdRP;
+  if (FMD) 
+    {
+      TClonesArray *FMDhits   = FMD->Hits();
+      TClonesArray *FMDrec    = FMD->ReconParticles(); 
+      TTree *TH = gAlice->TreeH();
+      Int_t ntracks    = TH->GetEntries();
+      if (ntracks<=0) return;
+
+      Int_t  nPads=FMDrec->GetEntries();
+       
+
+#ifdef DEBUG
+      cout<<"\n(AliFMDReconstParticles*)FMDrec->UncheckedAt(0)="<<(AliFMDReconstParticles*)FMDrec->UncheckedAt(0);                
+      cout<<"\nFMDrec->UncheckedAt(0)="<<FMDrec->UncheckedAt(0);                  
+#endif
+    
+      for (Int_t track=0; track<ntracks;track++)
+       {
+         gAlice->ResetHits();
+         nbytes += TH->GetEvent(track);//?
+         particle=(TParticle*)Particles->UncheckedAt(track);
+         //      Int_t numpart=particle->GetKF();
+         //Float_t eta=particle->GetEta();
+         
+         Int_t  nhits=FMDhits->GetEntriesFast();
+         for (Int_t hit=0;hit<nhits;hit++) 
+           {
+             fmdHit  = (AliFMDhit*)FMDhits->UncheckedAt(hit);
+             volume=fmdHit->Volume();
+             if(volume==vol)
+               {
+                 np[fmdHit->NumberOfRing()-1][fmdHit->NumberOfSector()-1]++;
+               }  
+           }
+       }
+      //Int_t  nRecPart=FMDrec->GetEntriesFast();      
+      Int_t nDeterm=0; Int_t nReal=0; 
+      for (Int_t pad=0;pad<nPads;pad++) 
+       {
+         fmdRP  = (AliFMDReconstParticles*)FMDrec->UncheckedAt(pad);
+         volume=fmdRP->GetVolume();
+         if(volume==vol)
+           {
+;
+#ifdef DEBUG
+             fmdDigit  = (AliFMDdigit*)FMDdig->UncheckedAt(pad);
+             cout<<"\nfmdDigit->ADCsignal()="<<fmdDigit->ADCsignal();
+             cout<<"\nfmdDigit->NumberOfRing()="<<fmdDigit->NumberOfRing();
+             cout<<"\nfmdDigit->NumberOfSector()="<<fmdDigit->NumberOfSector();    
+#endif  
+             nDeterm+=fmdRP->GetNumberOfReconstParticles();
+            nReal+=np[fmdRP->GetNumberOfRing()-1][fmdRP->GetNumberOfSector()-1]; //-1=?
+             Int_t RecRing=fmdRP->GetNumberOfRing()-1;
+             Int_t RecSector=fmdRP->GetNumberOfSector()-1;
+             hNReal->Fill(np[RecRing][RecSector]);
+             hNRec->Fill(fmdRP->GetNumberOfReconstParticles());
+           }
+        }  
+    }  
+  cout<<"\nReal="<<nReal<<
+    " nDeterm="<<nDeterm<<
+    "\nerror="<<float(nDeterm-nReal)/float(nReal)<<endl;
+
+
+  TCanvas *c1 = new TCanvas("c1","Alice FMD ",400,10,800,800);
+  hNReal->SetFillColor(2);
+  hNReal->Draw();
+  hNRec->SetFillColor(4);
+  hNRec->Draw("same");
+  
+}
+
+
+
+
+
+