]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - EMCAL/AliEMCALv2.cxx
Load pythia libraries.
[u/mrichter/AliRoot.git] / EMCAL / AliEMCALv2.cxx
index 7a07521e46389c65407f9d39559fedd00df0ff42..941ec8739e17006bea7da86d084e7564f58d9b65 100644 (file)
 // This Class not stores information on all particles prior to EMCAL entry - in order to facilitate analysis.
 // This is done by setting fIShunt =2, and flagging all parents of particles entering the EMCAL.
 
+#include <cassert>
 // --- ROOT system ---
-#include "TParticle.h"
-#include "TVirtualMC.h"
-#include "TBrowser.h"
-#include "TH1.h"
-#include "TH2.h"
+#include <TBrowser.h>
+#include <TClonesArray.h>
+#include <TH1.h>
+#include <TH2.h>
+#include <TParticle.h>
+#include <TROOT.h>
+#include <TVirtualMC.h>
 
 // --- Standard library ---
 
 #include "AliRun.h"
 #include "AliHeader.h"
 #include "AliMC.h"
+#include "AliStack.h"
 #include "AliPoints.h"
-// for TRD1,2 case
+// for TRD1 case only; May 31,2006
 
 ClassImp(AliEMCALv2)
 
-  //extern "C" void gdaxis_(float &x0, float &y0, float &z0, float &axsiz);
-
-
 //______________________________________________________________________
-AliEMCALv2::AliEMCALv2():AliEMCALv1(), fGeometry(0){
+AliEMCALv2::AliEMCALv2()
+  : AliEMCALv1(), 
+    fHDe(0),
+    fHNhits(0)
+{
   // ctor
-
 }
 
 //______________________________________________________________________
-AliEMCALv2::AliEMCALv2(const char *name, const char *title): AliEMCALv1(name,title) {
+AliEMCALv2::AliEMCALv2(const char *name, const char *title)
+  : AliEMCALv1(name,title),
+    fHDe(0),
+    fHNhits(0)
+{
     // Standard Creator.
 
     fHits= new TClonesArray("AliEMCALHit",1000);
@@ -71,7 +79,7 @@ AliEMCALv2::AliEMCALv2(const char *name, const char *title): AliEMCALv1(name,tit
     //    if (gDebug>0){
     if (1){
       TH1::AddDirectory(0);
-      fHDe = new TH1F("fHDe","De in EMCAL", 1000, 0., 1.);
+      fHDe    = new TH1F("fHDe","De in EMCAL", 1000, 0., 10.);
       fHNhits = new TH1F("fHNhits","#hits in EMCAL", 2001, -0.5, 2000.5);
       fHistograms->Add(fHDe);
       fHistograms->Add(fHNhits);
@@ -130,13 +138,13 @@ void AliEMCALv2::StepManager(void){
   // position wrt MRS and energy deposited
   static Float_t        xyzte[5]={0.,0.,0.,0.,0.};// position wrt MRS, time and energy deposited
   static Float_t        pmom[4]={0.,0.,0.,0.};
-  static TLorentzVector pos; // Lorentz vector of the track current position.
-  static TLorentzVector mom; // Lorentz vector of the track current momentum.
-  static Float_t ienergy = 0;
+  static TLorentzVector pos;  // Lorentz vector of the track current position.
+  static TLorentzVector mom;  // Lorentz vector of the track current momentum.
+  static Float_t ienergy = 0; // part->Energy();
   static TString curVolName;
   static int supModuleNumber, moduleNumber, yNumber, xNumber, absid;
-  static int keyGeom=0;
-  static char *vn = "SX"; // 15-mar-05
+  static int keyGeom=1;
+  static char *vn = "SCMX"; // Apr 13, 2006 - only TRD1 case now
   static int nSMOP[7]={1,3,5,7,9,11}; // 30-mar-05
   static int nSMON[7]={2,4,6,8,10,12};
   static Float_t depositedEnergy=0.0; 
@@ -154,8 +162,7 @@ void AliEMCALv2::StepManager(void){
   Int_t tracknumber =  gAlice->GetMCApp()->GetCurrentTrackNumber();
 
   curVolName = gMC->CurrentVolName();
-  if(curVolName.Contains(vn)) { // We are in a scintillator layer
-    //    printf(" keyGeom %i : Sensetive volume %s (%s) \n", keyGeom, curVolName.Data(), vn); 
+  if(curVolName.Contains(vn) || curVolName.Contains("SCX")) { // We are in a scintillator layer; SCX for 3X3
     
     if( ((depositedEnergy = gMC->Edep()) > 0.)  && (gMC->TrackTime() < fTimeCut)){// Track is inside a scintillator and deposits some energy
       //       Info("StepManager "," entry %i DE %f",++ientry, depositedEnergy); // for testing
@@ -208,12 +215,19 @@ void AliEMCALv2::StepManager(void){
       
       //      if(ientry%200 > 0) return; // testing
       supModuleNumber = moduleNumber = yNumber = xNumber = absid = 0;
-      if(keyGeom >= 1) { // old style
+      if(keyGeom >= 1) { // TRD1 case now
         gMC->CurrentVolOffID(4, supModuleNumber);
         gMC->CurrentVolOffID(3, moduleNumber);
         gMC->CurrentVolOffID(1, yNumber);
         gMC->CurrentVolOffID(0, xNumber); // really x number now
         if(strcmp(gMC->CurrentVolOffName(4),"SM10")==0) supModuleNumber += 10; // 13-oct-05
+       // Nov 10,2006
+        if(strcmp(gMC->CurrentVolOffName(0),vn) != 0) { // 3X3 case
+          if     (strcmp(gMC->CurrentVolOffName(0),"SCX1")==0) xNumber=1;
+          else if(strcmp(gMC->CurrentVolOffName(0),"SCX2")==0) xNumber=2;
+          else if(strcmp(gMC->CurrentVolOffName(0),"SCX3")==0) xNumber=3;
+          else Fatal("StepManager()", "Wrong name of sensetive volume in 3X3 case : %s ", gMC->CurrentVolOffName(0));
+       }
       } else {
         gMC->CurrentVolOffID(5, supModuleNumber);
         gMC->CurrentVolOffID(4, moduleNumber);
@@ -223,24 +237,28 @@ void AliEMCALv2::StepManager(void){
         else if(strcmp(gMC->CurrentVolOffName(5),"SMON")==0) supModuleNumber = nSMON[supModuleNumber-1];
         else   assert(0); // something wrong
       }
-      absid = fGeometry->GetAbsCellId(supModuleNumber, moduleNumber, yNumber, xNumber);
+      absid = fGeometry->GetAbsCellId(supModuleNumber-1, moduleNumber-1, yNumber-1, xNumber-1);
     
-      if (absid == -1) Fatal("StepManager()", "Wrong id ") ;
+      if (absid < 0) {
+        printf(" supModuleNumber %i : moduleNumber %i : yNumber %i : xNumber %i \n",
+        supModuleNumber, moduleNumber, yNumber, xNumber); 
+       Fatal("StepManager()", "Wrong id : %i ", absid) ; 
+      }
 
       Float_t lightYield =  depositedEnergy ;
       // Apply Birk's law (copied from G3BIRK)
 
       if (gMC->TrackCharge()!=0) { // Check
-         Float_t BirkC1_mod = 0;
+         Float_t birkC1Mod = 0;
        if (fBirkC0==1){ // Apply correction for higher charge states
-         if (TMath::Abs(gMC->TrackCharge())>=2) BirkC1_mod=fBirkC1*7.2/12.6;
-         else                                    BirkC1_mod=fBirkC1;
+         if (TMath::Abs(gMC->TrackCharge())>=2) birkC1Mod = fBirkC1*7.2/12.6;
+         else                                   birkC1Mod = fBirkC1;
        }
 
        Float_t dedxcm;
        if (gMC->TrackStep()>0)  dedxcm=1000.*gMC->Edep()/gMC->TrackStep();
        else                     dedxcm=0;
-       lightYield=lightYield/(1.+BirkC1_mod*dedxcm+fBirkC2*dedxcm*dedxcm);
+       lightYield=lightYield/(1.+birkC1Mod*dedxcm+fBirkC2*dedxcm*dedxcm);
       } 
 
       // use sampling fraction to get original energy --HG
@@ -257,7 +275,8 @@ void AliEMCALv2::StepManager(void){
 }
 
 void AliEMCALv2::FinishEvent()
-{ // 26-may-05
+{ 
+  // Calculate deposit energy and fill control histogram; 26-may-05
   static double de=0.;
   fHNhits->Fill(double(fHits->GetEntries()));
   de = GetDepositEnergy(0);
@@ -265,7 +284,8 @@ void AliEMCALv2::FinishEvent()
 }
 
 Double_t AliEMCALv2::GetDepositEnergy(int print)
-{ // 23-mar-05 - for testing
+{ 
+  // 23-mar-05 - for testing
   if(fHits == 0) return 0.;
   AliEMCALHit  *hit=0;
   Double_t de=0.;
@@ -289,7 +309,8 @@ void AliEMCALv2::Browse(TBrowser* b)
 }
 
 void AliEMCALv2::DrawCalorimeterCut(const char *name, int axis, double dcut)
-{ // Size of tower is 5.6x5.6x24.8 (25.0); cut on Z axiz
+{ 
+  // Size of tower is 5.6x5.6x24.8 (25.0); cut on Z axiz
   TString g(fGeometry->GetName());
   g.ToUpper();
   gMC->Gsatt("*", "seen", 0);
@@ -330,7 +351,8 @@ void AliEMCALv2::DrawCalorimeterCut(const char *name, int axis, double dcut)
 }
 
 void AliEMCALv2::DrawSuperModuleCut(const char *name, int axis, double dcut, int fill)
-{ // Size of tower is 5.6x5.6x24.8 (25.0); cut on Z axiz
+{ 
+ // Size of tower is 5.6x5.6x24.8 (25.0); cut on Z axiz
   TString sn(GetGeometry()->GetName());
   sn.ToUpper();
   char *tit[3]={"xcut", "ycut", "zcut"};
@@ -394,7 +416,8 @@ void AliEMCALv2::DrawSuperModuleCut(const char *name, int axis, double dcut, int
 }
 
 void AliEMCALv2::DrawTowerCut(const char *name, int axis, double dcut, int fill, char *optShad)
-{ // Size of tower is 5.6x5.6x24.8 (25.0); cut on Z axiz
+{ 
+  // Size of tower is 5.6x5.6x24.8 (25.0); cut on Z axiz
   if(axis<1) axis=1; if(axis>3) axis=3;
   TString mn(name); mn.ToUpper();
   TString sn(GetGeometry()->GetName());
@@ -460,7 +483,8 @@ void AliEMCALv2::DrawTowerCut(const char *name, int axis, double dcut, int fill,
 }
   
 void AliEMCALv2::DrawAlicWithHits(int mode)
-{ // 20-sep-04; does not work now
+{ 
+ // 20-sep-04; does not work now
   static TH2F *h2;
   if(h2==0) h2 = new TH2F("h2","test fo hits", 60,0.5,60.5, 28,0.5,28.5);
   else      h2->Reset();
@@ -474,7 +498,7 @@ void AliEMCALv2::DrawAlicWithHits(int mode)
   }
 
   TClonesArray *hits = Hits();
-  Int_t nhits = hits->GetEntries(), absId, nSupMod, nTower, nIphi, nIeta, iphi, ieta;
+  Int_t nhits = hits->GetEntries(), absId, nSupMod, nModule, nIphi, nIeta, iphi, ieta;
   AliEMCALHit *hit = 0;
   Double_t de, des=0.;
   for(Int_t i=0; i<nhits; i++) {
@@ -482,11 +506,11 @@ void AliEMCALv2::DrawAlicWithHits(int mode)
     absId = hit->GetId();
     de    = hit->GetEnergy();
     des += de;
-    if(fGeometry->GetCellIndex(absId, nSupMod, nTower, nIphi, nIeta)){
+    if(fGeometry->GetCellIndex(absId, nSupMod, nModule, nIphi, nIeta)){
       //      printf(" de %f abs id %i smod %i tower %i | cell iphi %i : ieta %i\n",
-      // de, absId, nSupMod, nTower, nIphi, nIeta); 
+      // de, absId, nSupMod, nModule, nIphi, nIeta); 
       if(nSupMod==3) {
-        fGeometry->GetCellPhiEtaIndexInSModule(nSupMod,nTower,nIphi,nIeta, iphi,ieta);
+        fGeometry->GetCellPhiEtaIndexInSModule(nSupMod,nModule,nIphi,nIeta, iphi,ieta);
         // printf(" iphi %i : ieta %i\n", iphi,ieta);
         h2->Fill(double(ieta),double(iphi), de);
       }
@@ -510,25 +534,26 @@ void AliEMCALv2::SetVolumeAttributes(const char *name, int seen, int color, int
 } 
 
 void AliEMCALv2::TestIndexTransition(int pri, int idmax)
-{ // for EMCAL_SHISH geometry
+{ 
+ // Test for EMCAL_SHISH geometry
   TString sn(fGeometry->GetName());
   if(!sn.Contains("SHISH")) {
     printf("Wrong geometry |%s| ! Bye \n", sn.Data());
     return; 
   }
 
-  Int_t nSupMod, nTower, nIphi, nIeta, idNew, nGood=0;
+  Int_t nSupMod, nModule, nIphi, nIeta, idNew, nGood=0;
   if(idmax==0) idmax = fGeometry->GetNCells();
   for(Int_t id=1; id<=idmax; id++) {
-    if(!fGeometry->GetCellIndex(id, nSupMod, nTower, nIphi, nIeta)){
+    if(!fGeometry->GetCellIndex(id, nSupMod, nModule, nIphi, nIeta)){
       printf(" Wrong abs ID %i : #cells %i\n", id, fGeometry->GetNCells());
       break;  
     }
-    idNew = fGeometry->GetAbsCellId(nSupMod, nTower, nIphi, nIeta);
+    idNew = fGeometry->GetAbsCellId(nSupMod, nModule, nIphi, nIeta);
     if(id != idNew || pri>0) {
       printf(" ID %i : %i <- new id\n", id, idNew);
       printf(" nSupMod   %i ",  nSupMod);
-      printf(" nTower    %i ", nTower);
+      printf(" nModule    %i ", nModule);
       printf(" nIphi     %i ", nIphi);
       printf(" nIeta     %i \n", nIeta);