]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Last minute changes and new code for event mixing and reconstruction (A.Maevskaia)
authorhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 29 May 2001 12:01:06 +0000 (12:01 +0000)
committerhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 29 May 2001 12:01:06 +0000 (12:01 +0000)
18 files changed:
FMD/AliFMD.cxx
FMD/AliFMD.h
FMD/AliFMDMerger.cxx [new file with mode: 0644]
FMD/AliFMDMerger.h [new file with mode: 0644]
FMD/AliFMDReconstParticles.cxx [new file with mode: 0644]
FMD/AliFMDReconstParticles.h [new file with mode: 0644]
FMD/AliFMDReconstruction.cxx [new file with mode: 0644]
FMD/AliFMDReconstruction.h [new file with mode: 0644]
FMD/AliFMDdigit.h
FMD/AliFMDhit.h
FMD/AliFMDv0.cxx
FMD/AliFMDv1.cxx
FMD/AliFMDv1.h
FMD/FMDLinkDef.h
FMD/FMDMerger.C [new file with mode: 0644]
FMD/Hits2SDigits.C
FMD/Makefile
FMD/TestReconstruction.C [new file with mode: 0644]

index 84ff0b8f7f89a9b1a639e4206e4416f847675e00..36050ee2b022642ad4f395661b948d9567af29c2 100644 (file)
 #include <TTUBE.h>
 #include <TTree.h>
 #include <TNode.h>
+#include <TFile.h>
 
 #include <TClonesArray.h>
 #include <TLorentzVector.h>
 #include "AliFMDv1.h"
 #include "AliRun.h"
 #include "AliMC.h"
+#include "AliDetector.h"
 #include <iostream.h>
 #include <fstream.h>
 #include "AliMagF.h"
 #include "AliFMDhit.h"
 #include "AliFMDdigit.h"
+#include "AliFMDReconstruction.h"
 #include <stdlib.h>
 
 
-ClassImp(AliFMD)
+ClassImp (AliFMD)
   //_____________________________________________________________________________
-  AliFMD::AliFMD(): AliDetector()
+AliFMD::AliFMD ():AliDetector ()
 {
   //
   // Default constructor for class AliFMD
   //
-  fIshunt   = 0;
+  fIshunt = 0;
+  fHits     = 0;
+  fDigits   = 0;
+  fSDigits  = 0;
+  fReconParticles=0; 
 }
+
 //_____________________________________________________________________________
-AliFMD::AliFMD(const char *name, const char *title)
-  : AliDetector(name,title)
+AliFMD::AliFMD (const char *name, const char *title):
+AliDetector (name, title)
 {
   //
   // Standard constructor for Forward Multiplicity Detector
   //
+
   //
   // Initialise Hit array
-  fHits     = new TClonesArray("AliFMDhit", 1000);
+  fHits = new TClonesArray ("AliFMDhit", 1000);
   // Digits for each Si disk
-  fDigits   = new TClonesArray("AliFMDdigit", 1000);
-  fSDigits  = new TClonesArray("AliFMDdigit", 1000) ; 
-  gAlice->AddHitList(fHits);
+  fDigits = new TClonesArray ("AliFMDdigit", 1000);
+  fSDigits = new TClonesArray ("AliFMDdigit", 1000);
+  gAlice->AddHitList (fHits);
 
-  fIshunt     =  0;
-  fIdSens1    =  0;
+  fIshunt = 0;
+  fIdSens1 = 0;
 
-  SetMarkerColor(kRed);
+  SetMarkerColor (kRed);
 }
 
-AliFMD::~AliFMD()
+//-----------------------------------------------------------------------------
+AliFMD::~AliFMD ()
 {
-  if (fHits) {
-      fHits->Delete();
+  if (fHits)
+    {
+      fHits->Delete ();
       delete fHits;
       fHits = 0;
-  }
-  if (fDigits) {
-      fDigits->Delete();
+    }
+  if (fDigits)
+    {
+      fDigits->Delete ();
       delete fDigits;
       fDigits = 0;
-  }
-  if (fSDigits) {
-      fSDigits->Delete();
+    }
+  if (fSDigits)
+    {
+      fSDigits->Delete ();
       delete fSDigits;
       fSDigits = 0;
-  }
-   
+    }
+  if (fReconParticles)
+    {
+      fReconParticles->Delete ();
+      delete fReconParticles;
+      fReconParticles = 0;
+    }
+
 }
+
 //_____________________________________________________________________________
-void AliFMD::AddHit(Int_t track, Int_t *vol, Float_t *hits)
+void AliFMD::AddHit (Int_t track, Int_t * vol, Float_t * hits)
 {
   //
   // Add a hit to the list
   //
-  TClonesArray &lhits = *fHits;
-  new(lhits[fNhits++]) AliFMDhit(fIshunt,track,vol,hits);
+  TClonesArray & lhits = *fHits;
+  new (lhits[fNhits++]) AliFMDhit (fIshunt, track, vol, hits);
 }
+
 //_____________________________________________________________________________
-void AliFMD::AddDigit( Int_t *digits) 
+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);
+  TClonesArray & ldigits = *fDigits;
+  new (ldigits[fNdigits++]) AliFMDdigit (digits);
 
 }
+
 //_____________________________________________________________________________
-void AliFMD::BuildGeometry()
+void AliFMD::BuildGeometry ()
 {
   //
   // Build simple ROOT TNode geometry for event display
   //
   TNode *node, *top;
-  const int kColorFMD  = 7;
+  const int kColorFMD = 7;
   //
-  top=gAlice->GetGeometry()->GetNode("alice");
+  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);
-  top->cd();
-  node = new TNode("FMD0","FMD0","S_FMD0",0,0,64,"");
-  node->SetLineColor(kColorFMD);
-  fNodes->Add(node);
-
-  new TTUBE("S_FMD1","FMD  volume 1","void",23.4,36.,1.5);
-  top->cd();
-  node = new TNode("FMD1","FMD1","S_FMD1",0,0,85,"");
-  node->SetLineColor(kColorFMD);
-  fNodes->Add(node);
-  
-  new TTUBE("S_FMD2","FMD  volume 2","void",4.73,17.7,1.5);
-  top->cd();
-  node = new TNode("FMD2","FMD2","S_FMD2",0,0,-64,"");
-  node->SetLineColor(kColorFMD);
-  fNodes->Add(node);
-
-  new TTUBE("S_FMD3","FMD  volume 3","void",23.4,36.,1.5);
-  top->cd();
-  node = new TNode("FMD3","FMD3","S_FMD3",0,0,-85,"");
-  node->SetLineColor(kColorFMD);
-  fNodes->Add(node);
-
-  new TTUBE("S_FMD4","FMD  volume 4","void",5,15,0.015);
-  top->cd();
-  node = new TNode("FMD4","FMD4","S_FMD4",0,0,-270,"");
-  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);
-
+  new TRotMatrix ("rot901", "rot901", 90, 0, 90, 90, 180, 0);
+
+  new TTUBE ("S_FMD0", "FMD  volume 0", "void", 4.73, 17.7, 1.5);
+  top->cd ();
+  node = new TNode ("FMD0", "FMD0", "S_FMD0", 0, 0, 64, "");
+  node->SetLineColor (kColorFMD);
+  fNodes->Add (node);
+
+  new TTUBE ("S_FMD1", "FMD  volume 1", "void", 23.4, 36., 1.5);
+  top->cd ();
+  node = new TNode ("FMD1", "FMD1", "S_FMD1", 0, 0, 85, "");
+  node->SetLineColor (kColorFMD);
+  fNodes->Add (node);
+
+  new TTUBE ("S_FMD2", "FMD  volume 2", "void", 4.73, 17.7, 1.5);
+  top->cd ();
+  node = new TNode ("FMD2", "FMD2", "S_FMD2", 0, 0, -64, "");
+  node->SetLineColor (kColorFMD);
+  fNodes->Add (node);
+
+  new TTUBE ("S_FMD3", "FMD  volume 3", "void", 23.4, 36., 1.5);
+  top->cd ();
+  node = new TNode ("FMD3", "FMD3", "S_FMD3", 0, 0, -85, "");
+  node->SetLineColor (kColorFMD);
+  fNodes->Add (node);
+
+  new TTUBE ("S_FMD4", "FMD  volume 4", "void", 5, 15, 0.015);
+  top->cd ();
+  //  node = new TNode("FMD4","FMD4","S_FMD4",0,0,-270,"");
+  node = new TNode ("FMD4", "FMD4", "S_FMD4", 0, 0, -270, "");
+  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);
+   */
 }
+
 //_____________________________________________________________________________
-Int_t AliFMD::DistanceToPrimitive(Int_t px, Int_t py)
+Int_t AliFMD::DistanceToPrimitive (Int_t px, Int_t py)
 {
   //
   // Calculate the distance from the mouse to the FMD on the screen
@@ -191,144 +210,289 @@ Int_t AliFMD::DistanceToPrimitive(Int_t px, Int_t py)
   //
   return 9999;
 }
+
 //___________________________________________
-void AliFMD::ResetHits()
+void AliFMD::ResetHits ()
 {
   // Reset number of clusters and the cluster array for this detector
-  AliDetector::ResetHits();
+  AliDetector::ResetHits ();
 }
 
 //____________________________________________
-void AliFMD::ResetDigits()
+void AliFMD::ResetDigits ()
 {
-    //
-    // Reset number of digits and the digits array for this detector
-   AliDetector::ResetHits();
-   //
+  //
+  // Reset number of digits and the digits array for this detector
+  AliDetector::ResetHits ();
+  //
 }
 
 //-------------------------------------------------------------------------
-void AliFMD::Init()
+void  AliFMD::Init ()
 {
   //
   // Initialis the FMD after it has been built
   Int_t i;
-  AliMC* pMC = AliMC::GetMC();
+  AliMC *pMC = AliMC::GetMC ();
   //
-  if(fDebug) {
-    printf("\n%s: ",ClassName());
-    for(i=0;i<35;i++) printf("*");
-    printf(" FMD_INIT ");
-    for(i=0;i<35;i++) printf("*");
-    printf("\n%s: ",ClassName());
-    //
-    // Here the FMD initialisation code (if any!)
-    for(i=0;i<80;i++) printf("*");
-    printf("\n");
-  }
+  if (fDebug)
+    {
+      printf ("\n%s: ", ClassName ());
+      for (i = 0; i < 35; i++)
+       printf ("*");
+      printf (" FMD_INIT ");
+      for (i = 0; i < 35; i++)
+       printf ("*");
+      printf ("\n%s: ", ClassName ());
+      //
+      // Here the FMD initialisation code (if any!)
+      for (i = 0; i < 80; i++)
+       printf ("*");
+      printf ("\n");
+    }
   //
   //
-  if (IsVersion()!=0)
-    fIdSens1=pMC->VolId("GRIN"); //Si sensetive volume
+  if (IsVersion () != 0)
+    fIdSens1 = pMC->VolId ("GRIN");    //Si sensetive volume
   else
-    fIdSens1=pMC->VolId("GFSI"); //Si sensetive volume
+    fIdSens1 = pMC->VolId ("GFSI");    //Si sensetive volume
 
 }
+
 //---------------------------------------------------------------------
-void AliFMD::MakeBranch(Option_t* option, const char *file)
+void AliFMD::MakeBranch (Option_t * option, const char *file)
 {
   // Create Tree branches for the FMD.
-  const Int_t kBufferSize = 4000;
   char branchname[10];
-  sprintf(branchname,"%s",GetName());
+  const Int_t kBufferSize = 16000;
+  sprintf (branchname, "%s", GetName ());
+  
+  AliDetector::MakeBranch (option, file);
+  const char *cD = strstr(option,"D");
+  const char *cR = strstr(option,"R");
+  const char *cS = strstr(option,"S");
+  
+  if (cS){
 
-  AliDetector::MakeBranch(option,file);
+    MakeBranchInTree(gAlice->TreeS(), 
+                    branchname,&fSDigits, 
+                    kBufferSize, file);
+  }
+  if (cD){
 
-  const char *cD = strstr(option,"D");
-  if (cD) {
-    
     MakeBranchInTree(gAlice->TreeD(), 
-                     branchname, &fDigits, kBufferSize, file);
-
-    printf("Making Branch %s for digits\n",branchname);
-    gAlice->TreeD()->Print();
+                    branchname,&fDigits, 
+                    kBufferSize, file);
+  }
+  if (cR){
+    MakeBranchInTree(gAlice->TreeR(), 
+                    branchname,&fReconParticles,
+                    kBufferSize, file);
   }
+  
 }
+
 //_____________________________________________________________________________
-void AliFMD::SetTreeAddress()
+void AliFMD::SetTreeAddress ()
 {
   // Set branch address for the Hits and Digits Tree.
   char branchname[30];
-  AliDetector::SetTreeAddress();
+  AliDetector::SetTreeAddress ();
 
   TBranch *branch;
-  TTree *treeD = gAlice->TreeD();
+  TTree *treeD = gAlice->TreeD ();
 
 
-  if (treeD) {
-       if (fDigits) {
-             branch = treeD->GetBranch(branchname);
-             if (branch) branch->SetAddress(&fDigits);
-        }
-      
-  }
-  if(fSDigits)
-    fSDigits->Clear();
+  if (treeD)
+    {
+      if (fDigits)
+       {
+         branch = treeD->GetBranch (branchname);
+         if (branch)
+           branch->SetAddress (&fDigits);
+       }
 
-  if (gAlice->TreeS()  && fSDigits ) {
-    branch = gAlice->TreeS()->GetBranch("FMD");
-    if (branch) branch->SetAddress(&fSDigits) ;
-  } 
+    }
+  if (fSDigits)
+    fSDigits->Clear ();
+
+  if (gAlice->TreeS () && fSDigits)
+    {
+      branch = gAlice->TreeS ()->GetBranch ("FMD");
+      if (branch)
+       branch->SetAddress (&fSDigits);
+    }
 
+  if(fReconParticles)
+    fReconParticles->Clear();
+  if (gAlice->TreeR()) 
+    {
+      branch = gAlice->TreeR()->GetBranch("FMD"); 
+      if (branch) branch->SetAddress(&fReconParticles) ;
+    } 
 
 }
 
 //---------------------------------------------------------------------
-/*
+
 void AliFMD::SDigits2Digits() 
 {
-     Int_t  ibg=0, bgr=0;
-    Int_t nbgr_ev= 0;
-       
-    if (ibg) {
-         printf("nbgr_ev %d\n",nbgr_ev);
- //        Hit2Digits(nbgr_ev,"Add"," ","galice_bgr.root");
-    } 
-       else {
-   //      Hit2Digits(nbgr_ev,"rien","",""); 
+  cout<<"AliFMD::SDigits2Digits"<<endl; 
+    if (fMerger) {
+      cout<<"AliFMD::SDigits2Digits fMerger"<<fMerger<<endl;
+      fMerger->Init();
+      cout<<"AliFMD::SDigits2Digits Init"<<endl; 
+  
+      fMerger->Digitise();
     }
 
 }
-*/
+//---------------------------------------------------------------------
+void   AliFMD::SetMerger(AliFMDMerger* merger)
+{
+// Set pointer to merger
+    fMerger = merger;
+}
+
+AliFMDMerger*  AliFMD::Merger()
+{
+// Return pointer to merger
+    return fMerger;
+}
+
 //---------------------------------------------------------------------
 
 
 
-void AliFMD::Eta2Radius(Float_t eta, Float_t zDisk, Float_t *radius)
+void
+AliFMD::Eta2Radius (Float_t eta, Float_t zDisk, Float_t * radius)
 {
-  Float_t expEta=TMath::Exp(-eta);
-  Float_t theta=TMath::ATan(expEta);
-  theta=2.*theta;
-  Float_t rad=zDisk*(TMath::Tan(theta));
-  *radius=rad;
-   
-  if(fDebug) printf("%s: eta %f radius %f\n", ClassName(), eta, rad);
+  Float_t expEta = TMath::Exp (-eta);
+  Float_t theta = TMath::ATan (expEta);
+  theta = 2. * theta;
+  Float_t rad = zDisk * (TMath::Tan (theta));
+  *radius = rad;
+
+  if (fDebug)
+    printf ("%s: eta %f radius %f\n", ClassName (), eta, rad);
 }
 
 //---------------------------------------------------------------------
 
-void AliFMD::Hits2SDigits(){
-  if(fDebug) cout << ClassName() << ": ALiFMD::Hits2SDigits> start...\n";
-  //  char * fileSDigits = 0 ;
-  // char * fileHeader=0 ;
-  AliFMDSDigitizer * sd = new AliFMDSDigitizer("mgalice.root","FMD.SDigit.root") ;
-  sd->Exec("") ;
-  sd->Print("");
-  
-  delete sd ;
-}
+void AliFMD::Hits2SDigits ()
+{
+
+  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");
+
+
 
+      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
 
+}
+//-----------------------------------------------------------------------
+
+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,"");
+  delete  reconstruction;
+}
 
index 9b0bff13974c277dc835a071f44b8a4f9c9c1baf..65823219cba7a3e0569746afd09ebf85e717756b 100644 (file)
@@ -9,9 +9,11 @@
  
 #include "AliDetector.h"
 #include "TString.h"
+#include "AliFMDMerger.h" 
  
  class TFile;
  class TTree;
+ class AliFMDMerger;
  class AliFMD : public AliDetector {
  
 public:
@@ -34,13 +36,24 @@ public:
   virtual void   StepManager() {}
   void  Eta2Radius(Float_t, Float_t, Float_t*);
   void Hits2SDigits();//
+  void Digits2Reco(); 
    // Digitisation
   TClonesArray *SDigits() const {return fSDigits;}
 //  virtual void   SDigits2Digits();
-       
+  virtual void   SDigits2Digits();
+  virtual void   SetMerger(AliFMDMerger* merger);
+  virtual AliFMDMerger* Merger();
+  TClonesArray *ReconParticles() const {return fReconParticles;}   
+  Int_t   fNevents ;        // Number of events to digitize
+
  protected:
   Int_t fIdSens1;     //Si sensetive volume
+  AliFMDMerger *fMerger;   // ! pointer to merger
   TClonesArray *fSDigits      ; // List of summable digits
-  ClassDef(AliFMD,2)  //Class for the FMD detector
+  TClonesArray *fReconParticles;
+
+ ClassDef(AliFMD,3)  //Class for the FMD detector
 };
 #endif // AliFMD_H
+
+
diff --git a/FMD/AliFMDMerger.cxx b/FMD/AliFMDMerger.cxx
new file mode 100644 (file)
index 0000000..f5021bf
--- /dev/null
@@ -0,0 +1,215 @@
+/**************************************************************************
+ * Copyright(c) 1998-2000, ALICE Experiment at CERN, All rights reserved. *
+ *                                                                        *
+ * Author: The ALICE Off-line Project.                                    *
+ * Contributors are mentioned in the code where appropriate.              *
+ *                                                                        *
+ * Permission to use, copy, modify and distribute this software and its   *
+ * documentation strictly for non-commercial purposes is hereby granted   *
+ * without fee, provided that the above copyright notice appears in all   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appear in the supporting documentation. The authors make no claims     *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+
+/*
+$Log$
+Revision 1.3  2001/03/05 23:57:44  morsch
+Writing of digit tree moved to macro.
+
+Revision 1.2  2001/03/05 08:40:25  morsch
+Method SortTracks(..) imported from AliMUON.
+
+Revision 1.1  2001/02/02 14:11:53  morsch
+AliMUONMerger prototype to be called by the merge manager.
+
+*/
+
+#include <TTree.h> 
+#include <TVector.h>
+#include <TObjArray.h>
+#include <TFile.h>
+#include <TDirectory.h>
+
+
+#include "AliFMDMerger.h"
+#include "AliFMD.h"
+#include "AliFMDSDigitizer.h"
+#include "AliFMDhit.h"
+#include "AliFMDdigit.h"
+
+#include "AliRun.h"
+#include "AliPDG.h"
+
+#include <stdlib.h>
+#include <iostream.h>
+#include <fstream.h>
+
+ClassImp(AliFMDMerger)
+
+//___________________________________________
+  AliFMDMerger::AliFMDMerger() 
+{
+// Default constructor    
+    fEvNrSig = 0;
+    fEvNrBgr = 0;
+    fMerge =kDigitize;
+    fFnBgr   = 0;
+}
+
+//------------------------------------------------------------------------
+AliFMDMerger::~AliFMDMerger()
+{
+// Destructor
+  if(fSDigits)  {
+    fSDigits->Delete();
+    delete fSDigits ;
+    fSDigits = 0;
+  }
+}
+
+
+
+//------------------------------------------------------------------------
+void AliFMDMerger::Init()
+{
+// Initialisation
+    if (fMerge) fBgrFile = InitBgr();
+    
+}
+
+
+
+//------------------------------------------------------------------------
+TFile* AliFMDMerger::InitBgr()
+{
+// Initialise background event
+    TFile *file = new TFile(fFnBgr);
+// add error checking later
+    printf("\n AliFMDMerger has opened %s file with background event \n", fFnBgr);
+    return file;
+}
+
+//------------------------------------------------------------------------
+void AliFMDMerger::Digitise()
+{
+
+    // keep galice.root for signal and name differently the file for 
+    // background when add! otherwise the track info for signal will be lost !
+
+
+
+#ifdef DEBUG
+  cout<<"ALiFMD::>SDigits2Digits start...\n";
+#endif
+
+  AliFMD * FMD = (AliFMD *) gAlice->GetDetector("FMD") ;
+
+  Int_t chargeSum[10][20][150];
+  Int_t digit[5];
+  Int_t ivol, iSector, iRing;
+
+  TFile *f1 =0;
+  TTree *TK = gAlice->TreeK();
+  if (TK) f1 = TK->GetCurrentFile();
+
+  gAlice->GetEvent(fEvNrSig) ;
+  
+  if(gAlice->TreeD() == 0)     
+    gAlice->MakeTree("D") ;
+  gAlice->TreeD()->Reset();
+
+  //Make branches 
+   ReadDigit( chargeSum, fEvNrSig);
+
+   if(fMerge){ 
+    fBgrFile->cd();
+    // gAlice->TreeS()->Reset();
+    gAlice = (AliRun*)fBgrFile->Get("gAlice");
+    Int_t chargeBgr[10][20][150];
+    ReadDigit( chargeBgr,fEvNrBgr);
+    for ( ivol=1; ivol<=5; ivol++)
+      for ( iSector=1; iSector<=16; iSector++)
+       for (  iRing=1; iRing<=128; iRing++)
+         chargeSum[ivol][iSector][iRing]=
+           chargeBgr[ivol][iSector][iRing]+
+           chargeSum[ivol][iSector][iRing];
+    
+   } //if merge
+
+
+  // Put noise and make ADC signal
+  for ( ivol=1; ivol<=5; ivol++){
+    for ( iSector=1; iSector<=16; iSector++){
+      for ( iRing=1; iRing<=128; iRing++){
+       digit[0]=ivol;
+       digit[1]=iSector;
+       digit[2]=iRing;
+       digit[3]=PutNoise(chargeSum[ivol][iSector][iRing]);
+       if(chargeSum[ivol][iSector][iRing] <= 500) digit[3]=500; 
+
+    //dinamic diapason from MIP(0.155MeV) to 30MIP(4.65MeV)
+    //1024 ADC channels 
+       Float_t channelWidth=(22400*50)/1024;
+       digit[4]=Int_t(digit[3]/channelWidth);
+       if (digit[4]>1024) digit[4]=1024; 
+
+       FMD->AddDigit(digit);
+
+      } //ivol
+    } //iSector
+  } //iRing
+
+  f1->cd();
+   
+  //Make branch for digits
+  FMD->MakeBranch("D");
+
+  gAlice->TreeD()->Reset();
+  gAlice->TreeD()->Fill();
+  
+  fDigits   = FMD->Digits();
+  
+  gAlice->TreeD()->Write(0,TObject::kOverwrite) ;
+  
+  gAlice->ResetDigits();
+
+}
+
+//---------------------------------------------------------------------
+
+void AliFMDMerger::ReadDigit(Int_t chargeSum[][20][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 ij=0; ij<150; ij++)
+       chargeSum[i][j][ij]=0;
+
+  AliFMD * FMD = (AliFMD *) gAlice->GetDetector("FMD") ;
+  
+  gAlice->GetEvent(iEvNum) ;
+  if(gAlice->TreeS()==0) {
+    cout<<" TreeS==0 -> return"<<gAlice->TreeS()<<endl; 
+    return ;}
+  
+  Int_t ndig, k;
+  gAlice->ResetDigits();
+  gAlice->TreeS()->GetEvent(iEvNum);
+  TClonesArray * FMDdigits   = FMD->SDigits();
+  
+  ndig=FMDdigits->GetEntries();
+
+  for (k=0; k<ndig; k++) {
+    fmddigit= (AliFMDdigit*) FMDdigits->UncheckedAt(k);
+
+    Int_t iVolume=fmddigit->Volume();
+    Int_t iNumberOfSector =fmddigit->NumberOfSector();
+    Int_t iNumberOfRing=fmddigit->NumberOfRing();
+    chargeSum[iVolume][iNumberOfSector][iNumberOfRing]=fmddigit->Charge();
+  }
+}
+
+
diff --git a/FMD/AliFMDMerger.h b/FMD/AliFMDMerger.h
new file mode 100644 (file)
index 0000000..29208ac
--- /dev/null
@@ -0,0 +1,58 @@
+#ifndef ALIFMDMERGER_H
+#define ALIFMDMERGER_H
+/* Copyright(c) 1998-2000, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+// #include "AliMerger.h"
+// #include "AliMergable.h"
+#include "TRandom.h"
+#include "AliDetector.h"
+
+typedef enum {kDigitize=0, kMerge = 1} MergeMode_t;
+
+class AliFMDMerger {
+ public:
+  
+  AliFMDMerger();
+  virtual ~AliFMDMerger();
+  
+  
+  // Initialize merging and digitisation
+  virtual void Init();
+  
+  // Do the main work
+  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);
+  
+  // Setters -> Later Communication with gAlice 
+  void SetSignalEventNumber(Int_t i)     {fEvNrSig = i;}
+  void SetBackgroundEventNumber(Int_t i) {fEvNrBgr = i;}    
+  void SetBackgroundFileName(char* file) {fFnBgr = file;}        
+  void SetSignalFileName(char* file)     {fFnSig = file;}        
+  void SetMode(MergeMode_t mode) {fMerge = mode;}
+       
+    enum {kBgTag = -1};
+      
+ private:    
+    // Open the bgr file
+    TFile *InitBgr();
+    
+ private:
+     TClonesArray *fDigits;               // ! array with digits
+    // Int_t fDigits;
+    TClonesArray *fSDigits      ; // List of summable digits
+    Int_t fEvNrSig;                 // signal     event number
+    Int_t fEvNrBgr;                 // background event number    
+    MergeMode_t fMerge;             // merging type kDigitize, kMerge
+    char  *fFnBgr;                  // background file name
+    char  *fFnSig;                  // signal file name
+    TFile *fBgrFile;                // Pointer to background file
+    
+    ClassDef(AliFMDMerger,0)
+};    
+#endif
+
diff --git a/FMD/AliFMDReconstParticles.cxx b/FMD/AliFMDReconstParticles.cxx
new file mode 100644 (file)
index 0000000..9a183f4
--- /dev/null
@@ -0,0 +1,23 @@
+#include "AliFMDReconstParticles.h"
+
+ClassImp(AliFMDReconstParticles)
+
+AliFMDReconstParticles::AliFMDReconstParticles()
+{
+     fNumOfDet=0;
+     fNumOfSector=0;
+     fNumOfRing=0;
+     fNumOfReconstParticles=0;
+}
+AliFMDReconstParticles::AliFMDReconstParticles(Int_t *RecParticles)
+{
+     fNumOfDet=RecParticles[0];
+     fNumOfSector=RecParticles[1];
+     fNumOfRing=RecParticles[2];
+     fNumOfReconstParticles=RecParticles[3];
+}
+Int_t AliFMDReconstParticles::GetVolume(){return fNumOfDet;}
+Int_t AliFMDReconstParticles::GetNumberOfSector() {return fNumOfSector;}
+Int_t AliFMDReconstParticles::GetNumberOfRing() {return fNumOfRing;}
+Int_t AliFMDReconstParticles::GetNumberOfReconstParticles() {return fNumOfReconstParticles;}
+
diff --git a/FMD/AliFMDReconstParticles.h b/FMD/AliFMDReconstParticles.h
new file mode 100644 (file)
index 0000000..c203614
--- /dev/null
@@ -0,0 +1,25 @@
+#ifndef AliFMDReconstParticles_h
+#define AliFMDReconstParticles_h
+
+#include <TClonesArray.h> 
+#include <TObject.h>
+class AliFMDReconstParticles: public TObject
+{
+ //Reconstracted Particles Class
+ private:
+  Int_t fNumOfDet;                       //Number of FMD disk;
+  Int_t fNumOfSector;                    //Number of sector
+  Int_t fNumOfRing;                      //Number of ring
+  Int_t fNumOfReconstParticles;          //Number of reconstructed particles
+
+ public:
+  AliFMDReconstParticles();
+  AliFMDReconstParticles (Int_t *RecParticles);
+  virtual ~AliFMDReconstParticles(){};
+  Int_t GetVolume();                    //Return the number of volume 
+  Int_t GetNumberOfSector();            //Return the number of sector
+  Int_t GetNumberOfRing();              //Return the number of ring 
+  Int_t GetNumberOfReconstParticles();  //Returnthe number of reconstructed particles
+  ClassDef(AliFMDReconstParticles,1)
+};
+#endif
diff --git a/FMD/AliFMDReconstruction.cxx b/FMD/AliFMDReconstruction.cxx
new file mode 100644 (file)
index 0000000..d003ccb
--- /dev/null
@@ -0,0 +1,137 @@
+// --- ROOT system ---
+#include "TTask.h"
+#include "TTree.h"
+#include "TSystem.h"
+#include "TFile.h"
+// --- Standard library ---
+
+// --- AliRoot header files ---
+
+#include "AliFMDdigit.h"
+#include "AliFMDReconstParticles.h"
+#include "AliFMD.h"
+#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)
+
+        
+//____________________________________________________________________________ 
+
+AliFMDReconstruction::AliFMDReconstruction():TTask("AliFMDReconstruction","") 
+{
+  fNevents = 0 ;  // Number of events to rreconnstraction, 0 means all events in current file
+  // add Task to //root/Tasks folder
+  TTask * roottasks = (TTask*)gROOT->GetRootFolder()->FindObject("Tasks") ; 
+  roottasks->Add(this) ; 
+}
+//____________________________________________________________________________ 
+
+AliFMDReconstruction::AliFMDReconstruction(char* HeaderFile, char *ReconstParticlesFile):TTask("AliFMDReconstruction","")
+{
+  fNevents = 0 ;    // Number of events to rreconnstraction, 0 means all events in current file
+  fReconstParticlesFile=ReconstParticlesFile ;
+  fHeadersFile=HeaderFile ;
+  //add Task to //root/Tasks folder
+  TTask * roottasks = (TTask*)gROOT->GetRootFolder()->FindObject("Tasks") ; 
+  roottasks->Add(this) ;     
+}
+
+//____________________________________________________________________________ 
+
+AliFMDReconstruction::~AliFMDReconstruction()
+{
+}
+
+//____________________________________________________________________________
+
+void AliFMDReconstruction::Exec(TClonesArray *fReconParticles,Option_t *option) 
+{ 
+ //Collects all digits in the same active volume into number of particles
+
+  AliFMD * FMD = (AliFMD *) gAlice->GetDetector("FMD");
+  if(fNevents == 0) fNevents=(Int_t)gAlice->TreeD()->GetEntries(); 
+  for(Int_t ievent=0;ievent<fNevents;ievent++)
+    { 
+      gAlice->GetEvent(ievent) ;
+      if(gAlice->TreeH()==0) return; 
+      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 threshold_array_size=sizeof(threshold)/sizeof(threshold[0]);
+      AliFMDdigit  *fmdDigit;
+       
+      if (FMD)
+       {
+         gAlice->TreeD()->GetEvent(0); 
+         TClonesArray *FMDdigits=FMD->Digits();
+         Int_t nDigits=FMDdigits->GetEntries(); 
+          Int_t RecParticles[4];
+          Int_t nRecPart=0 ;
+          for (Int_t digit=0;digit<nDigits;digit++) 
+            {
+             fmdDigit=(AliFMDdigit*)FMDdigits->UncheckedAt(digit);    
+             RecParticles[0] = fmdDigit->Volume();
+             RecParticles[1] = fmdDigit->NumberOfSector();
+             RecParticles[2] = fmdDigit->NumberOfRing();
+             Int_t ADC=fmdDigit->ADCsignal(); 
+             RecParticles[3]=0; //case when fmdDigit->ADCsignal()==0
+             for (int i=0;i<threshold_array_size-1;i++)
+                   {
+                     if(ADC>threshold[i]&&ADC<=threshold[i+1])
+                        RecParticles[3]=i;              
+                   }
+             new((*fReconParticles)[nRecPart++]) AliFMDReconstParticles(RecParticles); 
+            } //digit loop
+        }//if FMD
+       gAlice->TreeR()->Reset();
+       gAlice->TreeR()->Fill(); 
+        gAlice->TreeR()->Write(0,TObject::kOverwrite);
+    } //event loop
+  cout<<"\nAliFMDReconstruction::Exec(TClonesArray *fReconParticles,Option_t *option) finished"<<endl;
+}
+//__________________________________________________________________
+
+void AliFMDReconstruction::SetReconstParticlesFile(char * file )
+{
+   if (!fReconstParticlesFile.IsNull()) 
+    cout<<"\nChanging reconstructed particles file from "<<
+      (char *) fReconstParticlesFile.Data()<< " to "<<file<<endl;
+    fReconstParticlesFile=file;
+}
+//__________________________________________________________________
+void AliFMDReconstruction::Print(Option_t* option)const
+{
+  cout<<"------------------- "<<GetName() <<" -------------"<< endl ;
+  if(fReconstParticlesFile.IsNull())
+    cout<<"\nWriting reconstructed particles to file"<<endl ;
+  else
+    cout<<"\nWriting reconstructed particles to file  "<<
+      (char*) fReconstParticlesFile.Data() << endl ;
+}
+
+
+
+
+
diff --git a/FMD/AliFMDReconstruction.h b/FMD/AliFMDReconstruction.h
new file mode 100644 (file)
index 0000000..40c81e4
--- /dev/null
@@ -0,0 +1,45 @@
+#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 
+{
+ public:
+  AliFMDReconstruction() ; 
+  AliFMDReconstruction(char* HeaderFile,char *SdigitsFile = 0) ; 
+  virtual ~AliFMDReconstruction();
+  char *GetReconstParticlesFile()const{return (char*) fReconstParticlesFile.Data();}  
+  virtual void  Exec(TClonesArray *fReconParticles,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;}   
+
+ private:
+  Int_t   fNevents ;                         // Number of events to digitize
+  TString fReconstParticlesFile;    //output file 
+  TString fHeadersFile ;                     //input file
+  //  TClonesArray *fReconParticles;
+  ClassDef(AliFMDReconstruction,1) 
+};
+#endif
+
+
+
+
+
+
+
+
+
index 6df5275995e1ccc3c451a2011bdc954ca5400d45..fc28cb7e391bdb0432ff73c7f5fefd4565d308e7 100644 (file)
@@ -33,7 +33,7 @@ public:
   Int_t Charge();
   Int_t ADCsignal();
   
-  ClassDef(AliFMDdigit,2)     // Real data digit object for set:ITS
+  ClassDef(AliFMDdigit,1)     // Real data digit object for set:ITS
 };
 inline Int_t AliFMDdigit::Volume(){return fNumOfDet;}
 inline Int_t AliFMDdigit::NumberOfSector() {return fNumOfSector;} 
index c00ec1bd33111693ff24c3b73c053e798c60a47a..90faa38f807fb08e2a59c5cd08467f456e182ebd 100644 (file)
@@ -95,7 +95,7 @@ public:
   Float_t Py();
   Float_t Pz();
   Float_t Time();
-  ClassDef(AliFMDhit,2)  //Hits for detector FMD
+  ClassDef(AliFMDhit,1)  //Hits for detector FMD
 };
 inline Int_t AliFMDhit::Volume(){return fVolume;} 
 inline Int_t AliFMDhit::NumberOfSector(){return fNumberOfSector;} 
index 2825c85733c55d4a93dcbb23b5e1947b461fe8f3..36a6f927f96fb99515274f91f69feb0ff04c65d3 100644 (file)
@@ -35,7 +35,7 @@
 #include "AliMC.h"
 #include <iostream.h>
 #include <fstream.h>
-//#include <AliRandom.h>
+#include "/afs/cern.ch/alice/offline/new/RALICE/AliRandom.h"
 #include "AliMagF.h"
 #include "AliFMDhit.h"
 #include <stdlib.h>
@@ -108,11 +108,10 @@ void AliFMDv0::CreateGeometry()
   for (ifmd =0; ifmd < 6; ifmd++){
 
     sprintf(name,"FMD%d",ifmd);
-    if(fDebug) 
-      printf("%s: %s",ClassName(),name);
+    printf(name);
     
     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]);
     
@@ -121,7 +120,7 @@ void AliFMDv0::CreateGeometry()
     par[2]=zFMD/2;
     gMC->Gsvolu(name,"TUBE", idtmed[3], par, 3);
     
-    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 { 
@@ -218,7 +217,7 @@ void AliFMDv0::Init()
 AliMC* gMC=AliMC::GetMC();
 AliFMD::Init();
 fIdSens1=gMC->VolId("GFSI");
-if(fDebug) printf("%s: *** FMD version 0 initialized ***\n",ClassName());
+printf("*** FMD version 0 initialized ***\n");
 }
 
 //-------------------------------------------------------------------
index 3639c314ba4fa5fb52881d944ff8f4c1c9fb9de5..080559c4f329bf514aec543bb800cfeb0cd6b97b 100644 (file)
@@ -92,9 +92,10 @@ void AliFMDv1::CreateGeometry()
   char name[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[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., -270., -630};
+  Float_t z[6]={64., 85., -64., -85., -240., -630};
   Float_t zDet=0.04;
   Float_t zElectronic=0.75;
   Float_t zSupport=1.;
@@ -109,14 +110,13 @@ void AliFMDv1::CreateGeometry()
   gMC->Gsvolu("GEL ","TUBE", idtmed[4], par, 0);
   gMC->Gsvolu("GSUP","TUBE", idtmed[2], par, 0);
 
-  for (ifmd =0; ifmd < 4; ifmd++){
+  for (ifmd =0; ifmd < 5; ifmd++){
 
     sprintf(name,"FMD%d",ifmd);
-    if(fDebug) 
-      printf("%s: %s",ClassName(),name);
+    printf(name);
     
     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,7 +125,7 @@ void AliFMDv1::CreateGeometry()
     par[2]=zFMD/2;
     gMC->Gsvolu(name,"TUBE", idtmed[3], par, 3);
     
-    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 { 
@@ -228,10 +228,10 @@ void AliFMDv1::Init()
 {
 // Initialises version 0 of the Forward Multiplicity Detector
 //
-  AliMC* gMC=AliMC::GetMC();
-  AliFMD::Init();
-  fIdSens1=gMC->VolId("GRIN");
-  if(fDebug) printf("%s: *** FMD version 1 initialized ***\n",ClassName());
+AliMC* gMC=AliMC::GetMC();
+AliFMD::Init();
+fIdSens1=gMC->VolId("GRIN");
+printf("*** FMD version 1 initialized ***\n");
 }
 
 //-------------------------------------------------------------------
@@ -270,10 +270,12 @@ void AliFMDv1::StepManager()
           vol[1]=copy1;
           gMC->CurrentVolOffID(2,copy2);
           vol[0]=copy2;
+          //      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];
           hits[2]=pos[2];
+          //      printf(" Zpos %f \n",hits[2]);
           gMC->TrackMomentum(mom);
           hits[3]=mom[0];
           hits[4]=mom[1];
@@ -299,6 +301,17 @@ void AliFMDv1::StepManager()
         } // IsTrackExiting()
      }
   }
+//--------------------------------------------------------------------------
+
+void AliFMDv1::Response( Float_t Edep)
+{
+  Float_t I=1.664*0.04*2.33/22400; // = 0.69e-6;
+  Float_t chargeOnly=Edep/I;
+  //Add noise ~500electrons
+  Int_t charge=500;
+  if (Edep>0)
+     charge=Int_t(gRandom->Gaus(chargeOnly,500));      
+ }   
 
 
 
index 2fcc2dcb5c77a27ae3331f25ff272ea3ebb0e0f9..94dfcdf1cc4424c8b4675d276e124f1a185a07c7 100644 (file)
@@ -8,7 +8,6 @@
 ////////////////////////////////////////////////
  
 #include "AliFMD.h"
-#include "AliFMDSDigitizer.h"
  
 class AliFMDv1 : public AliFMD {
   
@@ -22,16 +21,19 @@ public:
   virtual void   Init();
   virtual Int_t  IsVersion() const {return 0;}
   virtual void   StepManager();
+  //  virtual void Hit2Digits(Int_t bgrEvent, Option_t *opt1=" ",
+  //   Option_t *opt2=" ",Text_t *name=" "); // hit to digit for v1 :test  
+ virtual void  Response( Float_t Edep);
+//private:
+ //Int_t fCharge; 
+
 
 protected:
    Int_t fIdSens1; // Sensetive volume  in FMD
    
 // Background event for event mixing
-   Text_t *fFileName;           // ! File with background hits
-   TTree *fTrH1;                // Hits Tree for background event
-   TClonesArray *fHits2;        // List of hits for one track only
   
-   ClassDef(AliFMDv1,2)  //Class for FMD version 0
+  ClassDef(AliFMDv1,2)  //Class for FMD version 0
 };
 
 #endif
index 09b61d4d0faa5835e32193f1a9d627b5e3165438..3fe10ecd23c0be611d137c4c2126ff5237671b46 100644 (file)
@@ -13,6 +13,8 @@
 #pragma link C++ class  AliFMDv1+;
 #pragma link C++ class  AliFMDhit+;
 #pragma link C++ class  AliFMDdigit+;
-#pragma link C++ class  AliFMDSDigitizer+;
+#pragma link C++ class  AliFMDReconstruction+;
+#pragma link C++ class  AliFMDReconstParticles+;
+#pragma link C++ class  AliFMDMerger+;
 
 #endif
diff --git a/FMD/FMDMerger.C b/FMD/FMDMerger.C
new file mode 100644 (file)
index 0000000..cd7bf05
--- /dev/null
@@ -0,0 +1,81 @@
+void FMDMerger (Int_t evNumber1=0, Int_t evNumber2=0, Int_t ibg=0, Int_t bgr=10) 
+{
+// Dynamically link some shared libs
+
+   if (gClassTable->GetID("AliRun") < 0) {
+      gROOT->LoadMacro("loadlibs.C");
+      loadlibs();
+   }
+
+// Connect the Root Galice file containing Geometry, Kine and Hits
+
+   TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject("mgalice.root");
+   if (file) file->Close(); 
+   file = new TFile("mgalice.root","UPDATE");
+   cout<<" Just starting... file "<<file<<endl;
+
+// Get AliRun object from file or create it if not on file
+
+   if (!gAlice) {
+       gAlice = (AliRun*)file->Get("gAlice");
+       if (gAlice) printf("AliRun object found on file\n");
+       if (!gAlice) gAlice = new AliRun("gAlice","Alice test program");
+   }
+   AliFMD *FMD  = (AliFMD*) gAlice->GetModule("FMD");
+  cout<<" FMDMerger:: FMD "<<FMD<<" gAlice "<<gAlice<<endl;
+
+   if (FMD) {
+// creation
+       AliFMDMerger* merger = new AliFMDMerger();
+// configuration
+       if (ibg) {
+        merger->SetMode(ibg);
+        merger->SetBackgroundFileName("bg.root");
+      }
+       // pass
+       //  merger->SetSignalFileName("mgalice.root");
+       FMD->SetMerger(merger);
+   }
+// Action !
+//
+//   Loop over events              
+//
+    for (int nev=evNumber1; nev<= evNumber2; nev++) {
+       Int_t nparticles = gAlice->GetEvent(nev);
+       cout << "nev         " << nev <<endl;
+       cout << "nparticles  " << nparticles <<endl;
+       if (nev < evNumber1) continue;
+       if (nparticles <= 0) return;
+       Int_t nbgr_ev = Int_t(nev*bgr/(evNumber2+1));
+       cout<<" nbgr_ev "<<nbgr_ev<<endl;
+       
+       if (ibg) {
+           merger->SetBackgroundEventNumber(nbgr_ev);
+       }
+
+       gAlice->SDigits2Digits("FMD");
+
+       char hname[30];
+       sprintf(hname,"TreeD%d",nev);
+       //      gAlice->TreeD()->Write(hname);
+       //      cout<<hname<<" was written in file"<<file<<endl;
+       //      gAlice->TreeD()->Print();
+       //reset tree
+       gAlice->TreeD()->Reset();
+
+    }   // event loop 
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
index 553ce7bccbcae43e7969c117d1e159a99730293d..ee298bb95be344f284f040b093626c9e4cd5e3f8 100644 (file)
@@ -3,14 +3,17 @@ void Hits2SDigits(){
     gROOT->LoadMacro("$ALICE_ROOT/macros/loadlibs.C");
     loadlibs();
   }
-   gSystem->Setenv("CONFIG_SPLIT_FILE","1") ;
+  //    gSystem->Setenv("CONFIG_SPLIT_FILE","1") ;
    if (gSystem->Getenv("CONFIG_SPLIT_FILE"))
     cout << "SPLIT" << endl;
    else
     cout << "NO SPLIT" << endl ;
-  TFile * f = new TFile("galice.root","UPDATE");
+  TFile * f = new TFile("mgalice.root","UPDATE");
   gAlice = (AliRun*) f->Get("gAlice") ;
   cout<<"gAlice="<<gAlice<<endl;
   AliFMD* FMD  = (AliFMD *)gAlice->GetDetector("FMD") ;
-  gAlice->Hits2SDigits("FMD") ;
- }
+  cout<<" FMD "<<FMD<<endl;
+  gAlice->GetEvent(0);
+  gAlice->Hits2SDigits() ;
+  gAlice->TreeS()->Write(0,TObject::kOverwrite) ;
+  }
index 1b17fafe17a3e733c804c7fddc3842096eb30f08..41f7d83be30a7f2f8a3df0c4180ec78b15a82b96 100644 (file)
@@ -9,8 +9,7 @@ PACKAGE = FMD
 
 # C++ sources
 
-SRCS          = AliFMD.cxx AliFMDv0.cxx AliFMDv1.cxx AliFMDhit.cxx\
-                AliFMDdigit.cxx AliFMDSDigitizer.cxx
+SRCS          = AliFMD.cxx AliFMDv0.cxx AliFMDv1.cxx AliFMDhit.cxx AliFMDdigit.cxx AliFMDMerger.cxx AliFMDReconstruction.cxx AliFMDReconstParticles.cxx
 
 # C++ Headers
 
@@ -51,6 +50,9 @@ ALIBRARY      = $(LIBDIR)/libFMD.a
 
 default:       $(SLIBRARY)
 
+tst:           Hit2Digits.cxx 
+       g++ -g $(CXXFLAGS) $(SLIBRARY) Hit2Digits.cxx $(ROOTLIBS) -o tst
+
 $(LIBDIR)/libFMD.$(SL):                $(OBJS)
 
 $(DICT):                       $(HDRS)
diff --git a/FMD/TestReconstruction.C b/FMD/TestReconstruction.C
new file mode 100644 (file)
index 0000000..9392748
--- /dev/null
@@ -0,0 +1,19 @@
+void TestReconstruction (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") ;
+}
+