]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - EMCAL/AliEMCALv2.cxx
Update to select in centrality (Giacomo)
[u/mrichter/AliRoot.git] / EMCAL / AliEMCALv2.cxx
index 4f93f9fc40300ad856e66a54adc6909f802333e6..0a87fcb44756dd31d4aa32c43643ee70074fe838 100644 (file)
@@ -20,7 +20,7 @@
 //*-- An object of this class does not produce digits
 //*-- It is the one to use if you do want to produce outputs in TREEH 
 //*--                  
-//*-- Author : Aleksei Pavlinov (WSU)
+//*-- Author : Alexei Pavlinov (WSU)
 
 // 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.
@@ -62,7 +62,7 @@ AliEMCALv2::AliEMCALv2(const char *name, const char *title)
 {
     // Standard Creator.
 
-    fHits= new TClonesArray("AliEMCALHit",1000);
+    //fHits= new TClonesArray("AliEMCALHit",1000); //Already done in ctor of v1
     gAlice->GetMCApp()->AddHitList(fHits);
 
     fNhits    = 0;
@@ -76,11 +76,12 @@ AliEMCALv2::AliEMCALv2(const char *name, const char *title)
 AliEMCALv2::~AliEMCALv2(){
     // dtor
 
-    if ( fHits) {
-       fHits->Delete();
-       delete fHits;
-       fHits = 0;
-    }
+  //Already done in dtor of v1
+//  if ( fHits ) {
+//    fHits->Clear();
+//    delete fHits;
+//    fHits = 0;
+//  }
 }
 
 //______________________________________________________________________
@@ -89,9 +90,11 @@ void AliEMCALv2::AddHit(Int_t shunt, Int_t primary, Int_t tracknumber, Int_t ipa
     // Add a hit to the hit list.
     // An EMCAL hit is the sum of all hits in a tower section
     //   originating from the same entering particle 
-    static Int_t hitCounter=0.;
-    static AliEMCALHit *newHit=0, *curHit=0;
-    static Bool_t deja=kFALSE;
+    static Int_t hitCounter;
+    static AliEMCALHit *newHit, *curHit;
+    static Bool_t deja ;
+  
+    deja = kFALSE;
 
     newHit = new AliEMCALHit(shunt, primary, tracknumber, iparent, ienergy, id, hits, p);
     for ( hitCounter = fNhits-1; hitCounter >= 0 && !deja; hitCounter-- ) {
@@ -298,7 +301,7 @@ 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
-  TString g(fGeometry->GetName());
+  TString g(GetGeometry()->GetName());
   g.ToUpper();
   gMC->Gsatt("*", "seen", 0);
 
@@ -329,11 +332,12 @@ void AliEMCALv2::DrawCalorimeterCut(const char *name, int axis, double dcut)
   gMC->Gdopt("shad", optShad);
 
   gROOT->ProcessLine("TGeant3 *g3 = (TGeant3*)gMC");
-  char cmd[200];
-  sprintf(cmd,"g3->Gdrawc(\"XEN1\", %i, %5.1f, 12., 8., %3.2f, %3.2f)\n", axis, dcut, cxy,cxy);
+  const Int_t buffersize = 255;
+  char cmd[buffersize];
+  snprintf(cmd,buffersize,"g3->Gdrawc(\"XEN1\", %i, %5.1f, 12., 8., %3.2f, %3.2f)\n", axis, dcut, cxy,cxy);
   printf("\n%s\n",cmd); gROOT->ProcessLine(cmd);
 
-  sprintf(cmd,"gMC->Gdhead(1111, \"%s\")\n", st.Data());
+  snprintf(cmd,buffersize,"gMC->Gdhead(1111, \"%s\")\n", st.Data());
   printf("%s\n",cmd); gROOT->ProcessLine(cmd);
 }
 
@@ -369,11 +373,12 @@ void AliEMCALv2::DrawSuperModuleCut(const char *name, int axis, double dcut, int
   st += tit[axis-1];;
 
   gROOT->ProcessLine("TGeant3 *g3 = (TGeant3*)gMC");
-  char cmd[200];
-  sprintf(cmd,"g3->Gdrawc(\"SMOD\", %i, %6.3f, %5.1f, %5.1f, %5.3f, %5.3f)\n",axis,dcut,x0,y0,cxy,cxy);
+  const Int_t buffersize = 255;
+  char cmd[buffersize];
+  snprintf(cmd,buffersize,"g3->Gdrawc(\"SMOD\", %i, %6.3f, %5.1f, %5.1f, %5.3f, %5.3f)\n",axis,dcut,x0,y0,cxy,cxy);
   printf("\n%s\n",cmd); gROOT->ProcessLine(cmd);
 
-  sprintf(cmd,"gMC->Gdhead(1111, \"%s\")\n", st.Data());
+  snprintf(cmd,buffersize,"gMC->Gdhead(1111, \"%s\")\n", st.Data());
   printf("%s\n",cmd); gROOT->ProcessLine(cmd);
   // hint for testing
   printf("Begin of super module\n");
@@ -421,15 +426,16 @@ void AliEMCALv2::DrawTowerCut(const char *name, int axis, double dcut, int fill,
   if (mn.Contains("EMOD")) {
     cx = cy = 0.5;
   }
-  char cmd[200];
+  const Int_t buffersize = 255;
+  char cmd[buffersize];
 
   gMC->Gdopt("hide", optShad);
   gMC->Gdopt("shad", optShad);
 
-  sprintf(cmd,"g3->Gdrawc(\"%s\", %i, %6.2f, 10., 10., %5.3f, %5.3f)\n",name, axis,dcut,cx,cy);
+  snprintf(cmd,buffersize,"g3->Gdrawc(\"%s\", %i, %6.2f, 10., 10., %5.3f, %5.3f)\n",name, axis,dcut,cx,cy);
   printf("\n%s\n",cmd); gROOT->ProcessLine(cmd);
 
-  sprintf(cmd,"gMC->Gdhead(1111, \"%s\")\n", st.Data());
+  snprintf(cmd,buffersize,"gMC->Gdhead(1111, \"%s\")\n", st.Data());
   printf("%s\n",cmd); gROOT->ProcessLine(cmd);
 }