]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PHOS/PHOSGAINda.cxx
minor code cleanup and coding rules
[u/mrichter/AliRoot.git] / PHOS / PHOSGAINda.cxx
index d3e2d3b57a2f50e705e550b1ed1ead6d0a029c98..803281f2c8659764d6d54a8f9605c242e4bce664 100644 (file)
@@ -6,7 +6,7 @@ run type: PHYSICS
 DA type: MON 
 number of events needed: 1000
 input files: Mod0RCU0.data Mod0RCU1.data Mod0RCU2.data Mod0RCU3.data Mod1RCU0.data Mod1RCU1.data Mod1RCU2.data Mod1RCU3.data Mod2RCU0.data Mod2RCU1.data Mod2RCU2.data Mod2RCU3.data Mod3RCU0.data Mod3RCU1.data Mod3RCU2.data Mod3RCU3.data Mod4RCU0.data Mod4RCU1.data Mod4RCU2.data Mod4RCU3.data zs.txt
-Output files: PHOS_ModuleN_Calib.root, where N is the module number (0-5), PHOS_Calib.root 
+Output files: PHOS_Calib_Total.root contains cumulative statistics for a number of runs. 
 Trigger types used: PHYSICS
 */
 
@@ -247,7 +247,7 @@ int main(int argc, char **argv) {
            fitter.Eval(stream.GetSignals(),sigStart,sigLength);
          } // End of NextBunch()
          
-         if (nBunches>1) continue;
+         if (nBunches != 1) continue;
          
          e[cellX][cellZ][caloFlag] = fitter.GetEnergy();
          t[cellX][cellZ][caloFlag] = fitter.GetTime();
@@ -258,7 +258,7 @@ int main(int argc, char **argv) {
        if(dAs[stream.GetModule()])
          dAs[stream.GetModule()]->FillHistograms(e,t);
        else {
-         dAs[stream.GetModule()] = new AliPHOSRcuDA1(stream.GetModule(),-1);
+         dAs[stream.GetModule()] = new AliPHOSRcuDA1(stream.GetModule(),-1,0);
          dAs[stream.GetModule()]->FillHistograms(e,t);
        }
        
@@ -295,44 +295,41 @@ int main(int argc, char **argv) {
   for(Int_t i = 0; i < 20; i++) delete mapping[i];  
   
   /* Be sure that all histograms are saved */
+
+  char h2name[80];
+  char totfile[80];
   
-  for(Int_t iMod=0; iMod<5; iMod++) {
-    if(!dAs[iMod]) continue;
-    
-    printf("DA1 for module %d detected.\n",iMod);
-    
-    dAs[iMod]->UpdateHistoFile();
-    dAs[iMod]->SetWriteToFile(kFALSE);       
-  }
-  
-  const TH2F* h2=0;
-  const TH1F* h1=0;
-  char localfile[128];
-  
-  sprintf(localfile,"PHOS_Calib.root");
-  TFile* f = new TFile(localfile,"recreate");
+  //Write the Total file (accumulated statistics for number of runs)
+  sprintf(totfile,"PHOS_Calib_Total.root");
+  TFile * ftot = new TFile(totfile,"recreate");
   
-  for(Int_t iMod=0; iMod<5; iMod++) {
-    if(!dAs[iMod]) continue;
+//   if (!ftot->IsZombie()){
+//     printf("Updating file %s.\n",ftot->GetName());
+
+//     for(Int_t iMod=0; iMod<5; iMod++) {
+//       if(!dAs[iMod]) continue;
     
-    for(Int_t iX=0; iX<64; iX++) {
-      for(Int_t iZ=0; iZ<56; iZ++) {
-       
-       h1 = dAs[iMod]->GetHgLgRatioHistogram(iX,iZ); // High Gain/Low Gain ratio
-       if(h1) h1->Write(); 
+//       printf("DA1 for module %d detected.\n",iMod);
+    
+//       for(Int_t iX=0; iX<64; iX++) {
+//     for(Int_t iZ=0; iZ<56; iZ++) {
        
-       for(Int_t iGain=0; iGain<2; iGain++) {
-         h2 = dAs[iMod]->GetTimeEnergyHistogram(iX,iZ,iGain); // Time vs Energy
-         if(h2) h2->Write();
-       }
-      }
-    }
-  }
+//       for(Int_t iGain=0; iGain<2; iGain++) {
+//         sprintf(h2name,"%d_%d_%d_%d",iMod,iX,iZ,iGain);
+//         TH2F* h2tot = (TH2F*)ftot->Get(h2name);
+//         const TH2F* h2run = dAs[iMod]->GetTimeEnergyHistogram(iX,iZ,iGain); // Time vs Energy
+//         if(!h2tot && h2run) h2run->Write();
+//         if(h2tot && h2run) { h2tot->Add(h2run); h2tot->Write(h2tot->GetName(),TObject::kWriteDelete); }
+//       }
+//     }
+//       }
+//     }
+//   }
   
-  f->Close();
+  ftot->Close();
   
   /* Store output files to the File Exchange Server */
-  daqDA_FES_storeFile(localfile,"AMPLITUDES");
+  daqDA_FES_storeFile(totfile,"AMPLITUDES");
   
   return status;
 }