Protection against crash when attempting to fit empty histos
authorcoppedis <coppedis@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 8 Jul 2009 12:11:43 +0000 (12:11 +0000)
committercoppedis <coppedis@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 8 Jul 2009 12:11:43 +0000 (12:11 +0000)
ZDC/ZDCPEDESTALda.cxx

index 56a7808..347ed9f 100644 (file)
@@ -264,8 +264,8 @@ int main(int argc, char **argv) {
             //printf("\t STANDALONE_PEDESTAL RUN raw data found\n");
          }
          else{
-            printf("ZDCPEDESTALda.cxx -> NO STANDALONE_PEDESTAL RUN raw data found\n");
-            return -1;
+            //printf("ZDCPEDESTALda.cxx -> NO STANDALONE_PEDESTAL RUN raw data found\n");
+            //return -1;
          }
         }
         else{
@@ -403,6 +403,10 @@ int main(int argc, char **argv) {
   // --- Out-of-time pedestals
   TF1 *ADCootfunchg[kNChannels];
   for(Int_t i=0; i<kNChannels; i++){
+     if(hPedOutOfTimehg[i]->GetEntries() == 0){
+       printf("\n WARNING! Empty histos -> ending DA WITHOUT writing output\n\n");
+       return -1;
+     } 
      hPedOutOfTimehg[i]->Fit("gaus","Q");
      ADCootfunchg[i] = hPedOutOfTimehg[i]->GetFunction("gaus");
      MeanPedOOT[i] = (Double_t)  ADCootfunchg[i]->GetParameter(1);