]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TOF/TOFda.cxx
Update the mult corr histograms
[u/mrichter/AliRoot.git] / TOF / TOFda.cxx
index b63749bed8e9834d75583e253a56f99333bf6203..f0957c7d763f618f7f362c842ffec63ec6379927 100644 (file)
@@ -24,6 +24,7 @@ Event types used: PHYSICS_EVENT
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <errno.h>
 
 //AliRoot
 #include "TROOT.h"
@@ -102,7 +103,7 @@ main(int argc, char **argv)
   /* constants */
   const Int_t nChannels = 157248;
   Int_t noiseCheckTrigger = 10; /* first noise check after 10 events */
-        Float_t meanChannelRate = (Float_t)meanMultiplicity / (Float_t)nChannels; /* average expected channel rate (hits/event) */
+  Float_t meanChannelRate = (Float_t)meanMultiplicity / (Float_t)nChannels; /* average expected channel rate (hits/event) */
   Float_t noiseThreshold = 10. * meanChannelRate; /* noise threshold (hits/event) */
   Int_t minNoiseHits = 10; /* min number of channel hits to check noise */
   /* counters and flags */
@@ -218,15 +219,21 @@ main(int argc, char **argv)
       break; /* end of monitoring file has been reached */
     }
     if (ret != 0) {
-      printf("monitorGetEventDynamic() failed : %s\n",monitorDecodeError(ret));
+      printf("monitorGetEventDynamic() failed (ret=%d errno=%d): %s\n", ret, errno, monitorDecodeError(ret));
       break;
     }
     /* retry if got no event */
     if (event==NULL) continue;
     /* check event type */
-    if (event->eventType != PHYSICS_EVENT && event->eventType != CALIBRATION_EVENT) continue;
+    if (event->eventType != PHYSICS_EVENT && event->eventType != CALIBRATION_EVENT) {
+      free(event);
+      continue;
+    }
     /* check inhibit collection */
-    if (event->eventType == PHYSICS_EVENT && inhibitCollection) continue;
+    if (event->eventType == PHYSICS_EVENT && inhibitCollection) {
+      free(event);
+      continue;
+    }
     /* increment number of physics events */
     if (event->eventType == PHYSICS_EVENT) nPhysicsEvents++;
     /* increment number of calib events */
@@ -360,8 +367,10 @@ main(int argc, char **argv)
     return -2;
 
   /* scale calib hit histo by number of calib events */
+  printf("found %d calibration events\n", nCalibEvents);
   hCalibHit->Sumw2();
-  hCalibHit->Scale(1. / nCalibEvents);
+  if (nCalibEvents > 0)
+    hCalibHit->Scale(1. / nCalibEvents);
   
   /* write calib hit histo on CALIB file */
   fileOutCalib->cd();