]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - T0/T0Physda.cxx
Corrected declaration
[u/mrichter/AliRoot.git] / T0 / T0Physda.cxx
index 09f71b36733b328dd2784bf32dea16a5e2a79f5d..9cee0c8e0067dfbbfbeff3ff17b922375525e04a 100644 (file)
@@ -43,8 +43,6 @@ SOULD BE CHANGED BACK BEFORE BEAM
 #include "TSpectrum.h"
 #include "TMath.h"
 
-int kbx, kcbx, kt0bx, knpmtA, knpmtC;
-float klx,kmx,kclx,kcmx, kt0lx, kt0hx;
 
 /* Main routine
       Arguments: 
@@ -74,6 +72,8 @@ int main(int argc, char **argv) {
     printf("Input file >>inPhys.dat<< not found !!!\n");
     return -1;
   }
+  int  kcbx, kt0bx, knpmtA, knpmtC;
+  float kclx,kcmx, kt0lx, kt0hx;
   
   while((c=getc(inp))!=EOF) {
     switch(c) {
@@ -122,9 +122,11 @@ int main(int argc, char **argv) {
   // Allocation of histograms - start
 
   TH1F *hCFD1minCFD[24];  
+  TH1F *hCFD[24];  
    
   for(Int_t ic=0; ic<24; ic++) {
     hCFD1minCFD[ic] = new TH1F(Form("CFD1minCFD%d",ic+1),"CFD-CFD",kcbx,kclx,kcmx);
+    hCFD[ic] = new TH1F(Form("CFD%d",ic+1),"CFD",kt0bx,kt0lx,kt0hx);
   }
   TH1F *hVertex = new TH1F("hVertex","T0 time",kt0bx,kt0lx,kt0hx);
   
@@ -161,13 +163,13 @@ int main(int argc, char **argv) {
     
     switch (event->eventType){
       
-      case START_OF_RUN:
-       break;
+    case START_OF_RUN:
+      break;
        
     case END_OF_RUN:
       break;
       
-        case PHYSICS_EVENT:
+    case PHYSICS_EVENT:
          //    case CALIBRATION_EVENT:
       iev++;
       
@@ -183,13 +185,13 @@ int main(int argc, char **argv) {
       AliT0RawReader *start = new AliT0RawReader(reader, kTRUE);
       
       // Read raw data
-      Int_t allData[105][5];
-      for(Int_t i0=0;i0<105;i0++)
+      Int_t allData[110][5];
+      for(Int_t i0=0;i0<107;i0++)
        for(Int_t j0=0;j0<5;j0++)
          allData[i0][j0] = 0;
       
       if(start->Next()){
-       for (Int_t i=0; i<105; i++) {
+       for (Int_t i=0; i<107; i++) {
          for(Int_t iHit=0;iHit<5;iHit++){
            allData[i][iHit]= start->GetData(i,iHit);
          }
@@ -205,11 +207,13 @@ int main(int argc, char **argv) {
         { 
           if(ik<12 && allData[ik+1][0]>0 && allData[knpmtC][0]>0 ){
             hCFD1minCFD[ik]->Fill(allData[ik+1][0]-allData[knpmtC][0]);
+            hCFD[ik]->Fill(allData[ik+1][0]);
           }
           
           if(ik>11 && allData[ik+45][0]>0 && allData[56+knpmtA][0]>0 )
             {
             hCFD1minCFD[ik]->Fill(allData[ik+45][0]-allData[56+knpmtA][0]);
+            hCFD[ik]->Fill(allData[ik+45][0]);
             }
           if(iev == 10000) {   
             meanShift[ik] =  hCFD1minCFD[ik]->GetMean(); 
@@ -243,8 +247,9 @@ int main(int argc, char **argv) {
        }
           
      delete start;
-      start = 0x0;
-      reader->Reset();
+     start = 0x0;
+     delete reader;
+     reader= 0x0;
       // End of fill histograms
       
     }
@@ -262,14 +267,17 @@ int main(int argc, char **argv) {
   printf("After loop, before writing histos\n");
   // write a file with the histograms
 
-  TFile *hist = new TFile(FILE_OUT,"RECREATE");
+  TFile hist(FILE_OUT,"RECREATE");
 
   for(Int_t j=0;j<24;j++){
-     hCFD1minCFD[j]->Write();
-    }
+    hCFD1minCFD[j]->SetDirectory(&hist);
+    hCFD1minCFD[j]->Write();
+    hCFD[j]->Write();
+
+  }
   hVertex->Write();
-  hist->Close();
-  delete hist;
+  hist.Close();
+  //delete hist;
 
   status=0;