]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - T0/AliT0.cxx
minor coverity defect: adding self-assignment protection
[u/mrichter/AliRoot.git] / T0 / AliT0.cxx
index 1d9f9bedef68f8a6b2d3495b4fd58e5e02f42828..46752954b1d8c35ba81425b0ed08fbd97a627324 100644 (file)
@@ -38,6 +38,7 @@
 ///////////////////////////////////////////////////////////////////////////////
 
 #include "TClonesArray.h"
+#include "TString.h"
 
 #include "AliLoader.h"
 #include "AliLog.h"
@@ -50,7 +51,6 @@
 #include "AliT0RecPoint.h"
 #include "AliT0digit.h"
 #include "AliT0hit.h"
-
 ClassImp(AliT0)
 
   //static  AliT0digit *digits; 
@@ -179,12 +179,15 @@ void AliT0::MakeBranch(Option_t* option)
   //
   //    R         Make a branch of  AliT0RecPoints
   //
-  char branchname[20];
-  sprintf(branchname,"%s",GetName());
+  //  char branchname[20];
+  // sprintf(branchname,"%s",GetName());
+  //  strncpy(branchname, GetName(), 20);
+  TString branchname = Form("%s", GetName());
 
   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 (cH && fLoader->TreeH())
   {
@@ -198,14 +201,21 @@ void AliT0::MakeBranch(Option_t* option)
       if (fDigits == 0x0) fDigits  = new AliT0digit();
       //     MakeBranchInTree(fLoader->TreeD(), branchname,
       //                      &fDigits, 405, 0);
-      fLoader->TreeD()->Branch(branchname,"AliT0digit",&fDigits,405,1);
+      fLoader->TreeD()->Branch(branchname.Data(),"AliT0digit",&fDigits);
       //   fLoader->TreeD()->Print();
     } 
   if (cR && fLoader->TreeR())
     {
       if (fRecPoints == 0x0) fRecPoints  = new AliT0RecPoint();
-      MakeBranchInTree(fLoader->TreeR(), branchname,
-                      &fRecPoints, 405, 0);
+      MakeBranchInTree(fLoader->TreeR(), branchname, &fRecPoints);
+    } 
+  if (cS && fLoader->TreeS())
+    {
+      if (fDigits == 0x0) fDigits  = new AliT0digit();
+      //     MakeBranchInTree(fLoader->TreeD(), branchname,
+      //                      &fDigits, 405, 0);
+      fLoader->TreeS()->Branch(branchname,"AliT0digit",&fDigits);
+      //   fLoader->TreeD()->Print();
     } 
   
 }    
@@ -253,6 +263,13 @@ void AliT0::SetTreeAddress()
     TBranch* branch = treeR->GetBranch ("T0");
     if (branch) branch->SetAddress(&fRecPoints);
   }
+  // SDigitizer for Federico
+  TTree *treeS = fLoader->TreeS();
+  if (treeS) {
+    if (fDigits == 0x0)  fDigits  = new AliT0digit();
+    TBranch* branch = treeS->GetBranch ("T0");
+    if (branch) branch->SetAddress(&fDigits);
+  }
  
 }
 
@@ -264,18 +281,20 @@ void AliT0::MakeBranchInTreeD(TTree *treeD, const char *file)
     // Create TreeD branches for the FMD
     //
     const Int_t kBufferSize = 4000;
-    char branchname[20];
-    sprintf(branchname,"%s",GetName());
+    //   char branchname[20];
+    // strncpy(branchname, GetName(), 20);
+    TString branchname = Form("%s", GetName());
+ //   sprintf(branchname,"%s",GetName());
     if(treeD)
      {
-       MakeBranchInTree(treeD,  branchname,&fDigits, kBufferSize, file);
+       MakeBranchInTree(treeD,  branchname.Data(),&fDigits, kBufferSize, file);
      }
 }
 
 //_____________________________________________________________________________
-AliDigitizer* AliT0::CreateDigitizer(AliRunDigitizer* manager) const
+AliDigitizer* AliT0::CreateDigitizer(AliDigitizationInput* digInput) const
 {
-  return new AliT0Digitizer(manager);
+  return new AliT0Digitizer(digInput);
 }
 //____________________________________________________________________________
 void AliT0::Digits2Raw()
@@ -333,7 +352,7 @@ void AliT0::Raw2Digits(AliRawReader *rawReader,TTree* digitsTree)
 
 
    fDigits = new AliT0digit();
-   digitsTree->Branch("T0","AliT0digit",&fDigits,405,1);
+   digitsTree->Branch("T0","AliT0digit",&fDigits);
    
    
    TArrayI *timeLED = new TArrayI(24);