]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - FMD/AliFMD.cxx
Violations fixed
[u/mrichter/AliRoot.git] / FMD / AliFMD.cxx
index 5c0a72405599275ab608666cd9dccc515e906e62..0c21558482f0e72aae4fff6c0a54678300213a60 100644 (file)
  * about the suitability of this software for any purpose. It is          *
  * provided "as is" without express or implied warranty.                  *
  **************************************************************************/
+
+/* $Id$ */
+
  //////////////////////////////////////////////////////////////////////////////
 //                                                                            //
 //  Forward Multiplicity Detector based on Silicon plates                    //
 //  This class contains the base procedures for the Forward Multiplicity     //
 //  detector                                                                 //
-//  Detector consists of 6 Si volumes covered pseudorapidity interval         //
-//  from 1.6 to 6.0.                                                         //
+//  Detector consists of 5 Si volumes covered pseudorapidity interval         //
+//  from 1.7 to 5.1.                                                         //
 //                                                                           //
 //Begin_Html
 /*
 ///////////////////////////////////////////////////////////////////////////////
 
 #define DEBUG
-#include <TMath.h>
+
+#include <Riostream.h>
+#include <stdlib.h>
+
+#include <TClonesArray.h>
+#include <TFile.h>
 #include <TGeometry.h>
+#include <TNode.h>
 #include <TTUBE.h>
 #include <TTree.h>
-#include <TNode.h>
-#include <TFile.h>
+#include <TVirtualMC.h>
 
-#include <TClonesArray.h>
-#include <TLorentzVector.h>
+#include "AliDetector.h"
+#include "AliFMDReconstParticles.h"
+#include "AliFMDdigit.h"
+#include "AliFMDhit.h"
 #include "AliFMDv1.h"
+#include "AliLoader.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 "AliFMDReconstParticles.h"
-#include <stdlib.h>
-
+#include "AliFMDDigitizer.h"
 
 ClassImp (AliFMD)
   //_____________________________________________________________________________
@@ -70,7 +72,6 @@ AliFMD::AliFMD ():AliDetector ()
   fIshunt = 0;
   fHits     = 0;
   fDigits   = 0;
-  fSDigits  = 0;
   fReconParticles=0; 
 }
 
@@ -87,16 +88,10 @@ AliDetector (name, title)
   fHits = new TClonesArray ("AliFMDhit", 1000);
   // Digits for each Si disk
   fDigits = new TClonesArray ("AliFMDdigit", 1000);
-  fSDigits = new TClonesArray ("AliFMDdigit", 1000);
   fReconParticles=new TClonesArray("AliFMDReconstParticles",1000); 
-  gAlice->AddHitList (fHits);
+  gAlice->GetMCApp()->AddHitList (fHits);
 
   fIshunt = 0;
-  fIdSens1 = 0;
-  fIdSens2 = 0;
-  fIdSens3 = 0;
-  fIdSens4 = 0;
-  fIdSens5 = 0;
   //  fMerger = 0;
   SetMarkerColor (kRed);
 }
@@ -104,6 +99,7 @@ AliDetector (name, title)
 //-----------------------------------------------------------------------------
 AliFMD::~AliFMD ()
 {
+  //destructor for base class AliFMD
   if (fHits)
     {
       fHits->Delete ();
@@ -116,13 +112,7 @@ AliFMD::~AliFMD ()
       delete fDigits;
       fDigits = 0;
     }
-  if (fSDigits)
-    {
-      fSDigits->Delete ();
-      delete fSDigits;
-      fSDigits = 0;
-    }
-  if (fReconParticles)
+   if (fReconParticles)
     {
       fReconParticles->Delete ();
       delete fReconParticles;
@@ -146,20 +136,11 @@ void AliFMD::AddDigit (Int_t * digits)
 {
   // add a real digit - as coming from data
 
-
+  if (fDigits == 0x0) fDigits = new TClonesArray ("AliFMDdigit", 1000);  
   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 ()
 {
@@ -176,38 +157,37 @@ void AliFMD::BuildGeometry ()
 
   new TTUBE ("S_FMD0", "FMD  volume 0", "void", 4.2, 17.2, 1.5);
   top->cd ();
-  node = new TNode ("FMD0", "FMD0", "S_FMD0", 0, 0, 62.8, "");
+  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", 15.4, 28.4, 1.5);
   top->cd ();
-  node = new TNode ("FMD1", "FMD1", "S_FMD1", 0, 0, 75.2, "");
+  node = new TNode ("FMD1", "FMD1", "S_FMD1", 0, 0, -75.2, "");
   node->SetLineColor (kColorFMD);
   fNodes->Add (node);
 
   new TTUBE ("S_FMD2", "FMD  volume 2", "void", 4.2, 17.2, 1.5);
   top->cd ();
-  node = new TNode ("FMD2", "FMD2", "S_FMD2", 0, 0, -83.2, "");
+  node = new TNode ("FMD2", "FMD2", "S_FMD2", 0, 0, 83.2, "");
   node->SetLineColor (kColorFMD);
   fNodes->Add (node);
 
   new TTUBE ("S_FMD3", "FMD  volume 3", "void", 15.4, 28.4, 1.5);
   top->cd ();
-  node = new TNode ("FMD3", "FMD3", "S_FMD3", 0, 0, -75.2, "");
+  node = new TNode ("FMD3", "FMD3", "S_FMD3", 0, 0, 75.2, "");
   node->SetLineColor (kColorFMD);
   fNodes->Add (node);
 
   new TTUBE ("S_FMD4", "FMD  volume 4", "void", 4.2, 17.2, 1.5);
   top->cd ();
-  //  node = new TNode("FMD4","FMD4","S_FMD4",0,0,-270,"");
-  node = new TNode ("FMD4", "FMD4", "S_FMD4", 0, 0, -340, "");
+  node = new TNode ("FMD4", "FMD4", "S_FMD4", 0, 0, 340, "");
   node->SetLineColor (kColorFMD);
   fNodes->Add (node);
 }
 
 //_____________________________________________________________________________
-Int_t AliFMD::DistanceToPrimitive (Int_t px, Int_t py)
+const Int_t AliFMD::DistanceToPrimitive (Int_t /*px*/, Int_t /*py*/)
 {
   //
   // Calculate the distance from the mouse to the FMD on the screen
@@ -238,7 +218,6 @@ void  AliFMD::Init ()
   //
   // Initialis the FMD after it has been built
   Int_t i;
-  AliMC *pMC = AliMC::GetMC ();
   //
   if (fDebug)
     {
@@ -257,42 +236,33 @@ void  AliFMD::Init ()
     }
   //
   //
-    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)
+void AliFMD::MakeBranch (Option_t * option)
 {
   // Create Tree branches for the FMD.
   char branchname[10];
   const Int_t kBufferSize = 16000;
   sprintf (branchname, "%s", GetName ());
   
-  AliDetector::MakeBranch (option, file);
+  const char *cH = strstr(option,"H");
   const char *cD = strstr(option,"D");
   const char *cR = strstr(option,"R");
-  const char *cS = strstr(option,"S");
   
-  if (cS){
+  if (cH && (fHits == 0x0)) fHits = new TClonesArray ("AliFMDhit", 1000);
 
-    MakeBranchInTree(gAlice->TreeS(), 
-                    branchname,&fSDigits, 
-                    kBufferSize, file);
-  }
+  AliDetector::MakeBranch (option);
+  
   if (cD){
-
-    MakeBranchInTree(gAlice->TreeD(), 
-                    branchname,&fDigits, 
-                    kBufferSize, file);
-    cout<<" tree "<<gAlice->TreeD()<<" "<<branchname<<" "<<&fDigits<<endl;
+    if (fDigits == 0x0) fDigits = new TClonesArray ("AliFMDdigit", 1000);  
+    MakeBranchInTree(fLoader->TreeD(), branchname,&fDigits, kBufferSize, 0);
   }
+
   if (cR){
-    MakeBranchInTree(gAlice->TreeR(), 
-                    branchname,&fReconParticles,
-                    kBufferSize, file);
+    if (fReconParticles == 0x0) 
+      fReconParticles=new TClonesArray("AliFMDReconstParticles",1000); 
+    MakeBranchInTree(fLoader->TreeR(), branchname,&fReconParticles, kBufferSize, 0);
   }
   
 }
@@ -302,162 +272,52 @@ void AliFMD::SetTreeAddress ()
 {
   // Set branch address for the Hits and Digits Tree.
   char branchname[30];
+
+  if (fLoader->TreeH() && (fHits == 0x0)) 
+    fHits = new TClonesArray ("AliFMDhit", 1000);  
+
   AliDetector::SetTreeAddress ();
 
   TBranch *branch;
-  TTree *treeD = gAlice->TreeD ();
-
+  TTree *treeD = fLoader->TreeD();
 
   if (treeD)
     {
-      if (fDigits)
-       {
-         branch = treeD->GetBranch (branchname);
-         if (branch)
-           branch->SetAddress (&fDigits);
-       }
-
-    }
-  if (fSDigits)
-    //  fSDigits->Clear ();
-
-  if (gAlice->TreeS () && fSDigits)
-    {
-      branch = gAlice->TreeS ()->GetBranch ("FMD");
+      if (fDigits == 0x0) fDigits = new TClonesArray ("AliFMDdigit", 1000);
+      branch = treeD->GetBranch (branchname);
       if (branch)
-       branch->SetAddress (&fSDigits);
+       branch->SetAddress (&fDigits);
     }
-
-  if (gAlice->TreeR() && fReconParticles) 
+  
+  if (fLoader->TreeR() && fReconParticles) 
     {
-      branch = gAlice->TreeR()->GetBranch("FMD"); 
+      if (fReconParticles == 0x0) 
+        fReconParticles=new TClonesArray("AliFMDReconstParticles",1000); 
+      branch = fLoader->TreeR()->GetBranch("FMD"); 
       if (branch) branch->SetAddress(&fReconParticles) ;
     }   
 }
 
-//---------------------------------------------------------------------
-
-void AliFMD::SetRingsSi1(Int_t ringsSi1=256)
-{
-  //  fRingsSi1=ringsSi1;
-  fRingsSi1=256;
-}
-void AliFMD::SetSectorsSi1(Int_t sectorsSi1=20)
-{
-  fSectorsSi1=20;
-}
-void AliFMD::SetRingsSi2(Int_t ringsSi2=128)
-{
-  fRingsSi2=128;
-}
-void AliFMD::SetSectorsSi2(Int_t sectorsSi2=40)
-{
-  fSectorsSi2=40;
-}
-
-//---------------------------------------------------------------------
-/*
-void AliFMD::SDigits2Digits() 
-{
-  cout<<"AliFMD::SDigits2Digits"<<endl; 
-    if (!fMerger) {
-      fMerger = new AliFMDMerger();
-    }
-    
-    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; 
-
-    }
-
-    //---------------------------------------------------------------------
-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)
-{
-  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 ()
-{
-
-  //#ifdef DEBUG
-  cout<<"ALiFMD::Hits2SDigits> start...\n";
-  //#endif
-  
-  char * fileSDigits = "FMD.SDigits.root";
-  char * fileHeader = 0;
-  AliFMDSDigitizer * sd = new AliFMDSDigitizer(fileHeader,fileSDigits) ;
-  sd->SetRingsSi1(fRingsSi1);
-  sd->SetRingsSi2(fRingsSi2);
-  sd->SetSectorsSi1(fSectorsSi1);
-  sd->SetSectorsSi2(fSectorsSi2);
-  //  sd->SetEventNumber(fEvNrSig);
-  sd->Exec("") ;
-  
-  delete sd ;
-  
-}
-//-----------------------------------------------------------------------
-
-void AliFMD::Digits2Reco()
-{
-  char * fileReconParticles=0;
-  char * fileHeader=0;
-  AliFMDReconstruction * reconstruction =
-    new AliFMDReconstruction(fileHeader,fileReconParticles) ;
-  //  fReconParticles=new TClonesArray("AliFMDReconstParticles",1000);
-  reconstruction->Exec("");
-  delete  reconstruction;
-}
 //-----------------------------------------------------------------------
 
 void AliFMD::MakeBranchInTreeD(TTree *treeD, const char *file)
 {
     //
-    // Create TreeD branches for the MUON.
+    // Create TreeD branches for the FMD
     //
-
     const Int_t kBufferSize = 4000;
     char branchname[20];
-    
-
     sprintf(branchname,"%s",GetName());        
-    if(treeD){
-    MakeBranchInTree(treeD, 
-                    branchname,&fDigits, 
-                    kBufferSize, file);
-    }
+    if(treeD)
+     {
+       MakeBranchInTree(treeD,  branchname,&fDigits, kBufferSize, file);
+     }
 }
 
+//____________________________________________________________________________
+AliDigitizer* AliFMD::CreateDigitizer(AliRunDigitizer* manager) const
+{
+  return new AliFMDDigitizer(manager);
+}