]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - EMCAL/AliEMCALv2.cxx
updates for Effective C++ compiler flags
[u/mrichter/AliRoot.git] / EMCAL / AliEMCALv2.cxx
index 4c93835679fb3e184f25d86b1ce8990aefaa040f..abd500b09e07741e217aa4e10a063a218a415d8d 100644 (file)
 // This is done by setting fIShunt =2, and flagging all parents of particles entering the EMCAL.
 
 // --- ROOT system ---
-#include "TParticle.h"
-#include "TVirtualMC.h"
-#include "TBrowser.h"
-#include "TH1.h"
-#include "TH2.h"
+#include <TParticle.h>
+#include <TVirtualMC.h>
+#include <TBrowser.h>
+#include <TH1.h>
+#include <TH2.h>
 
 // --- Standard library ---
 
 #include "AliHeader.h"
 #include "AliMC.h"
 #include "AliPoints.h"
-#include "AliEMCALGetter.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(), 
+    fGeometry(0),
+    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),
+    fGeometry(0),
+    fHDe(0),
+    fHNhits(0)
+{
     // Standard Creator.
 
-  //    fGeant3 = (TGeant3*)gMC;
     fHits= new TClonesArray("AliEMCALHit",1000);
     gAlice->GetMCApp()->AddHitList(fHits);
 
@@ -74,13 +78,24 @@ AliEMCALv2::AliEMCALv2(const char *name, const char *title): AliEMCALv1(name,tit
     if (1){
       TH1::AddDirectory(0);
       fHDe = new TH1F("fHDe","De in EMCAL", 1000, 0., 1.);
-      fHNhits = new TH1F("fHNhits","#hits in EMCAL", 1001, -0.5, 1000.5);
+      fHNhits = new TH1F("fHNhits","#hits in EMCAL", 2001, -0.5, 2000.5);
       fHistograms->Add(fHDe);
       fHistograms->Add(fHNhits);
       TH1::AddDirectory(1);
     }
 }
 
+//______________________________________________________________________
+AliEMCALv2::AliEMCALv2(const AliEMCALv2 & emcal)
+  : AliEMCALv1(emcal),
+    fGeometry(emcal.fGeometry),
+    fHDe(emcal.fHDe),
+    fHNhits(emcal.fHNhits)
+{
+  //copy ctor
+
+}
+
 //______________________________________________________________________
 AliEMCALv2::~AliEMCALv2(){
     // dtor
@@ -137,8 +152,9 @@ void AliEMCALv2::StepManager(void){
   static Float_t ienergy = 0;
   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 char *vn = "SX"; // 15-mar-05
   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; 
@@ -225,24 +241,24 @@ 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) Fatal("StepManager()", "Wrong id ") ;
 
       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
@@ -259,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);
@@ -267,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.;
@@ -276,6 +294,7 @@ Double_t AliEMCALv2::GetDepositEnergy(int print)
     de += hit->GetEnergy();
   }
   if(print>0) {
+    cout<<"AliEMCALv2::GetDepositEnergy() : fHits "<<fHits<<endl; 
     printf(" #hits %i de %f \n", fHits->GetEntries(), de);
     if(print>1) {
       printf(" #primary particles %i\n", gAlice->GetHeader()->GetNprimary()); 
@@ -290,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);
@@ -331,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"};
@@ -395,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());
@@ -461,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();
@@ -511,7 +534,8 @@ 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());
@@ -537,37 +561,3 @@ void AliEMCALv2::TestIndexTransition(int pri, int idmax)
   }
   printf(" Good decoding %i : %i <- #cells \n", nGood, fGeometry->GetNCells());
 }
-
-/* try to draw hits
- gMC->Gsatt("*","seen",0);
- gMC->Gsatt("scm0","seen",5);
- g3->Gdrawc("alic", 1,   2.0, 12., -125, 0.3, 0.3);
-*/
-//void AliEMCALv2::Gdaxis(float x0, float y0, float z0, float <axsiz) {gdaxis_(x0,y0,z0,axsiz);}
-
-/*
-
-void AliEMCALv2::RemapTrackHitIDs(Int_t *map) {
-  // remap track index numbers for primary and parent indices
-  // (Called by AliStack::PurifyKine)
-  if (Hits()==0)
-    return;
-  TIter hit_it(Hits());
-  Int_t i_hit=0;
-  while (AliEMCALHit *hit=dynamic_cast<AliEMCALHit*>(hit_it()) ) {
-    if (map[hit->GetIparent()]==-99)
-      cout << "Remapping, found -99 for parent id " << hit->GetIparent() << ", " << map[hit->GetIparent()] << ", i_hit " << i_hit << endl;
-    hit->SetIparent(map[hit->GetIparent()]);
-    if (map[hit->GetPrimary()]==-99)
-      cout << "Remapping, found -99 for primary id " << hit->GetPrimary() << ", " << map[hit->GetPrimary()] << ", i_hit " << i_hit << endl;
-    hit->SetPrimary(map[hit->GetPrimary()]);
-    i_hit++;
-  }
-}
-
-void AliEMCALv2::FinishPrimary() {
-  fCurPrimary=-1;
-  fCurParent=-1;
-  fCurTrack=-1;
-}
-*/