]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - START/AliSTARTDigitizer.cxx
Delete the run loader before creating a new getter
[u/mrichter/AliRoot.git] / START / AliSTARTDigitizer.cxx
index b9b4b6ea3e5debab4d3972ec433abf9072e895da..18dbd7836dec8a2f2a4efc02fbdd0ec27ca93b35 100644 (file)
@@ -23,6 +23,7 @@
 #include <TRandom.h>
 #include <TArrayI.h>
 #include <TH1.h>
+#include <TError.h>
 
 
 #include "AliSTARTDigitizer.h"
@@ -148,7 +149,7 @@ void AliSTARTDigitizer::Exec(Option_t* /*option*/)
     inRL = AliRunLoader::GetRunLoader(fManager->GetInputFolderName(inputFile));
     ingime = inRL->GetLoader("STARTLoader");
     ingime->LoadHits("READ");//probably it is necessary to load them before
-    ingime->LoadDigits("UPDATE");//probably it is necessary to load them before
+    outgime->LoadDigits("UPDATE");//probably it is necessary to load them before
     //use if Cherenkov photons
     //  TClonesArray *STARThitsPhotons = START->Photons ();
     TClonesArray *fHits = START->Hits ();
@@ -195,10 +196,14 @@ void AliSTARTDigitizer::Exec(Option_t* /*option*/)
       //  cout<<" brHits hits "<<nhits<<endl;
       for (hit=0;hit<nhits;hit++) {
        startHit   = (AliSTARThit*) fHits->UncheckedAt(hit);
-       pmt=startHit->fPmt;
-       volume = startHit->fVolume;
+       if (!startHit) {
+         ::Error("Exec","The unchecked hit doesn't exist");
+         break;
+       }
+       pmt=startHit->Pmt();
+       volume = startHit->Volume();
        if(volume==1){
-         timeright[pmt] = startHit->fTime;
+         timeright[pmt] = startHit->Time();
          if(timeright[pmt]<besttimeright)
            //&&CountEr[pmt-1]>thresholdAmpl)
            {
@@ -206,7 +211,7 @@ void AliSTARTDigitizer::Exec(Option_t* /*option*/)
          } //timeright
        }//time for right shoulder
        if(volume==2){            
-         timeleft[pmt] = startHit->fTime;
+         timeleft[pmt] = startHit->Time();
          if(timeleft[pmt]<besttimeleft)
            //&&CountEl[pmt-1]>thresholdAmpl) 
            {
@@ -288,26 +293,12 @@ void AliSTARTDigitizer::Exec(Option_t* /*option*/)
 
 // trick to find out output dir:
 
-
-/*
-   // trick to find out output dir:
-    TTree *outTree = fManager->GetTreeD();
-    if (!outTree) {
-      cerr<<"something wrong with output...."<<endl;
-      exit(111);
-    }
-
     Char_t nameDigits[20];
+    sprintf(nameDigits,"START_D_%d",fManager->GetOutputEventNr());
     TDirectory *wd = gDirectory;
-    outTree->GetDirectory()->cd();
+    outgime->GetDigitsDataLoader()->GetDirectory()->cd();
     fdigits->Write(nameDigits);
-    cout<<nameDigits<<endl;
     wd->cd();
-*/  
-
-     Char_t nameDigits[20];
-    sprintf(nameDigits,"START_D_%d",fManager->GetOutputEventNr());
-    fdigits->Write(nameDigits);
 
     //    outgime->WriteDigits("OVERWRITE");
   }