]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - STEER/AliLego.cxx
Geom. volume data class. Can be used during lego run for debugging.
[u/mrichter/AliRoot.git] / STEER / AliLego.cxx
index 69bae9843ec88e5c930124be44214f55f9ac092d..100341940bb87c44ce11423512e2318c0930255e 100644 (file)
 
 /*
 $Log$
+Revision 1.20  2000/11/30 07:12:48  alibrary
+Introducing new Rndm and QA classes
+
+Revision 1.19  2000/10/26 14:13:05  morsch
+- Change from coordinates theta, phi to general coordinates Coor1 and Coor2.
+- Lego generator instance can be passed in constructor.
+
+Revision 1.18  2000/10/02 21:28:14  fca
+Removal of useless dependecies via forward declarations
+
 Revision 1.17  2000/07/12 08:56:25  fca
 Coding convention correction and warning removal
 
@@ -85,7 +95,6 @@ Introduction of the Copyright and cvs Log
 
 #include "AliLego.h"
 #include "AliLegoGenerator.h"
-#include "AliRun.h"
 #include "AliConst.h"
 #include "AliMC.h"
 #include "TH2.h"
@@ -106,31 +115,47 @@ AliLego::AliLego()
 }
 
 //___________________________________________
-AliLego::AliLego(const char *title, Int_t ntheta, Float_t themin, 
-                Float_t themax, Int_t nphi, Float_t phimin, Float_t phimax,
+AliLego::AliLego(const char *title, Int_t ntheta, Float_t thetamin, 
+                Float_t thetamax, Int_t nphi, Float_t phimin, Float_t phimax,
                 Float_t rmin, Float_t rmax, Float_t zmax)
   : TNamed("Lego Generator",title)
 {
   //
   // specify the angular limits and the size of the rectangular box
   //
-   fGener = new AliLegoGenerator(ntheta, themin, themax,
+   fGener = new AliLegoGenerator(ntheta, thetamin, thetamax,
                       nphi, phimin, phimax, rmin, rmax, zmax);
    
-   gAlice->ResetGenerator(fGener);
-
-   Float_t etamin = -TMath::Log(TMath::Tan(TMath::Min((Double_t)themax*kDegrad/2,TMath::Pi()/2-1.e-10)));
-   Float_t etamax = -TMath::Log(TMath::Tan(TMath::Max((Double_t)themin*kDegrad/2,              1.e-10)));
 
+   
    fHistRadl = new TH2F("hradl","Radiation length map",    
-                       nphi,phimin,phimax,ntheta,themin,themax);
+                       ntheta,thetamin,thetamax,nphi,phimin,phimax);
    fHistAbso = new TH2F("habso","Interaction length map",  
-                       nphi,phimin,phimax,ntheta,themin,themax);
+                       ntheta,thetamin,thetamax,nphi,phimin,phimax);
    fHistGcm2 = new TH2F("hgcm2","g/cm2 length map",        
-                       nphi,phimin,phimax,ntheta,themin,themax);
-   fHistReta = new TH2F("hetar","Radiation length vs. eta",
-                       nphi,phimin,phimax,ntheta,etamin,etamax);
+                       ntheta,thetamin,thetamax,nphi,phimin,phimax);
+}
 
+AliLego::AliLego(const char *title, AliLegoGenerator* generator)
+  : TNamed("Lego Generator",title)
+{
+  //
+  // specify the angular limits and the size of the rectangular box
+  //
+   fGener = generator;
+   Float_t c1min, c1max, c2min, c2max;
+   Int_t n1 = fGener->NCoor1();
+   Int_t n2 = fGener->NCoor2();
+   
+   fGener->Coor1Range(c1min, c1max);
+   fGener->Coor2Range(c2min, c2max);   
+
+   fHistRadl = new TH2F("hradl","Radiation length map",    
+                       n2, c2min, c2max, n1, c1min, c1max);
+   fHistAbso = new TH2F("habso","Interaction length map",  
+                       n2, c2min, c2max, n1, c1min, c1max);
+   fHistGcm2 = new TH2F("hgcm2","g/cm2 length map",        
+                       n2, c2min, c2max, n1, c1min, c1max);
 }
 
 //___________________________________________
@@ -142,8 +167,6 @@ AliLego::~AliLego()
   delete fHistRadl;
   delete fHistAbso;
   delete fHistGcm2;
-  delete fHistReta;
-  gAlice->ResetGenerator(0);
   delete fGener;
 }
 
@@ -164,17 +187,12 @@ void AliLego::FinishEvent()
   //
   // Finish the event and update the histos
   //
-  Double_t thed, phid, eta;
-  thed = fGener->CurTheta()*kRaddeg;
-  phid = fGener->CurPhi()*kRaddeg;
-  eta  = -TMath::Log(TMath::Tan(TMath::Max(
-            TMath::Min((Double_t)(fGener->CurTheta())/2,
-                       TMath::Pi()/2-1.e-10),1.e-10)));
-
-  fHistRadl->Fill(phid,thed,fTotRadl);
-  fHistAbso->Fill(phid,thed,fTotAbso);
-  fHistGcm2->Fill(phid,thed,fTotGcm2);
-  fHistReta->Fill(phid,eta,fTotRadl);
+  Double_t c1, c2;
+  c1 = fGener->CurCoor1();
+  c2 = fGener->CurCoor2();
+  fHistRadl->Fill(c2,c1,fTotRadl);
+  fHistAbso->Fill(c2,c1,fTotAbso);
+  fHistGcm2->Fill(c2,c1,fTotGcm2);
 }
 
 //___________________________________________
@@ -186,14 +204,11 @@ void AliLego::FinishRun()
   fHistRadl->Write();
   fHistAbso->Write();
   fHistGcm2->Write();
-  fHistReta->Write();
 
   // Delete histograms from memory
   fHistRadl->Delete(); fHistRadl=0;
   fHistAbso->Delete(); fHistAbso=0;
   fHistGcm2->Delete(); fHistGcm2=0;
-  fHistReta->Delete(); fHistReta=0;
-
 }
 
 //___________________________________________
@@ -234,6 +249,12 @@ void AliLego::StepManager()
        fTotAbso += t/absl;
        fTotRadl += t/radl;
        fTotGcm2 += t*dens;
+//       Int_t copy;
+//       Int_t id = gMC->CurrentVolID(copy);
+//       char* vol = gMC->VolName(id);
+       
+//       printf("\n %f %f %f %f %s  ", fTotRadl, vect[0], vect[1], vect[2], vol);
+
      }
      gMC->StopTrack();
      return;
@@ -251,6 +272,14 @@ void AliLego::StepManager()
      fTotAbso += step/absl;
      fTotRadl += step/radl;
      fTotGcm2 += step*dens;
+//     Int_t copy;
+//     Int_t id = gMC->CurrentVolID(copy);
+//     char* vol = gMC->VolName(id);
+//     printf("\n %f %f %f %f %s %f ", fTotRadl, vect[0], vect[1], vect[2], vol, t);
    }
 }
 
+
+
+
+