[Rivet-svn] r2573 - trunk/src/Analyses

blackhole at projects.hepforge.org blackhole at projects.hepforge.org
Fri Jul 9 16:09:51 BST 2010


Author: hoeth
Date: Fri Jul  9 16:09:59 2010
New Revision: 2573

Log:
Fix segfault in ALEPH_2004_S5765862 at 200 GeV. Using non-existing histograms is a bad idea.

Modified:
   trunk/src/Analyses/ALEPH_2004_S5765862.cc
   trunk/src/Analyses/Makefile.am

Modified: trunk/src/Analyses/ALEPH_2004_S5765862.cc
==============================================================================
--- trunk/src/Analyses/ALEPH_2004_S5765862.cc	Fri Jul  9 15:07:31 2010	(r2572)
+++ trunk/src/Analyses/ALEPH_2004_S5765862.cc	Fri Jul  9 16:09:59 2010	(r2573)
@@ -76,16 +76,18 @@
       // Durham n->m jet resolutions
       _h_y_Durham[0] = bookHistogram1D(offset+149, 1, 1);   // y12 d149 ... d156
       _h_y_Durham[1] = bookHistogram1D(offset+157, 1, 1);   // y23 d157 ... d164
-      _h_y_Durham[2] = bookHistogram1D(offset+165, 1, 1);   // y34 d165 ... d172
-      if (offset<6) { // there is no y45 and y56 for 200 gev
+      if (offset<6) { // there is no y34, y45 and y56 for 200 gev
+        _h_y_Durham[2] = bookHistogram1D(offset+165, 1, 1); // y34 d165 ... d172, but not 171
         _h_y_Durham[3] = bookHistogram1D(offset+173, 1, 1); // y45 d173 ... d179
         _h_y_Durham[4] = bookHistogram1D(offset+180, 1, 1); // y56 d180 ... d186
       }
       else if (offset==6) {
+        _h_y_Durham[2] = NULL;
         _h_y_Durham[3] = NULL;
         _h_y_Durham[4] = NULL;
       }
       else if (offset==7) {
+        _h_y_Durham[2] = bookHistogram1D(172, 1, 1);
         _h_y_Durham[3] = bookHistogram1D(179, 1, 1);
         _h_y_Durham[4] = bookHistogram1D(186, 1, 1);
       }
@@ -128,8 +130,10 @@
       // jet rates
       const FastJets& durjet = applyProjection<FastJets>(e, "DurhamJets");
       if (durjet.clusterSeq()) {
-        for (int i=0; i<5; ++i) {
-          _h_y_Durham[i]->fill(-log(durjet.clusterSeq()->exclusive_ymerge_max(i+1)), weight);
+        for (size_t i=0; i<5; ++i) {
+          if (_h_y_Durham[i]) {
+            _h_y_Durham[i]->fill(-log(durjet.clusterSeq()->exclusive_ymerge_max(i+1)), weight);
+          }
         }
       }
     }
@@ -153,7 +157,7 @@
       for (int N=1; N<7; ++N) {
         // calculate the N jet fraction from the jet resolution histograms
 
-        for (int i = 0; i < _h_R_Durham[N-1]->size(); ++i) {
+        for (size_t i = 0; i < _h_R_Durham[N-1]->size(); ++i) {
           IDataPoint* dp = _h_R_Durham[N-1]->point(i);
           // get ycut at which the njet-fraction is to be calculated
           /// @todo HepData has binwidths here, which doesn't make sense at all
@@ -163,13 +167,15 @@
           // sum all >=N jet events
           double sigmaNinclusive = 0.0;
           if (N>1) {
-            AIDA::IHistogram1D* y_Nminus1_N = _h_y_Durham[N-2];
-            // watch out, y_NM is negatively binned
-            int cutbin=y_Nminus1_N->coordToIndex(-ycut);
-            if (cutbin==AIDA::IAxis::UNDERFLOW_BIN) cutbin=0;
-            if (cutbin==AIDA::IAxis::OVERFLOW_BIN) cutbin=y_Nminus1_N->axis().bins()-1;
-            for (int ibin=0; ibin<cutbin; ++ibin) {
-              sigmaNinclusive += y_Nminus1_N->binHeight(ibin);
+            if (_h_y_Durham[N-2]) {
+              AIDA::IHistogram1D* y_Nminus1_N = _h_y_Durham[N-2];
+              // watch out, y_NM is negatively binned
+              int cutbin=y_Nminus1_N->coordToIndex(-ycut);
+              if (cutbin==AIDA::IAxis::UNDERFLOW_BIN) cutbin=0;
+              if (cutbin==AIDA::IAxis::OVERFLOW_BIN) cutbin=y_Nminus1_N->axis().bins()-1;
+              for (int ibin=0; ibin<cutbin; ++ibin) {
+                sigmaNinclusive += y_Nminus1_N->binHeight(ibin);
+              }
             }
           }
           else sigmaNinclusive = sumOfWeights();
@@ -177,13 +183,15 @@
           // sum all >=N+1 jet events
           double sigmaNplus1inclusive = 0.0;
           if (N<6) {
-            AIDA::IHistogram1D* y_N_Nplus1 = _h_y_Durham[N-1];
-            // watch out, y_NM is negatively binned
-            int cutbin=y_N_Nplus1->coordToIndex(-ycut);
-            if (cutbin==AIDA::IAxis::UNDERFLOW_BIN) cutbin=0;
-            if (cutbin==AIDA::IAxis::OVERFLOW_BIN) cutbin=y_N_Nplus1->axis().bins();
-            for (int ibin=0; ibin<cutbin; ++ibin) {
-              sigmaNplus1inclusive += y_N_Nplus1->binHeight(ibin);
+            if (_h_y_Durham[N-1]) {
+              AIDA::IHistogram1D* y_N_Nplus1 = _h_y_Durham[N-1];
+              // watch out, y_NM is negatively binned
+              int cutbin=y_N_Nplus1->coordToIndex(-ycut);
+              if (cutbin==AIDA::IAxis::UNDERFLOW_BIN) cutbin=0;
+              if (cutbin==AIDA::IAxis::OVERFLOW_BIN) cutbin=y_N_Nplus1->axis().bins();
+              for (int ibin=0; ibin<cutbin; ++ibin) {
+                sigmaNplus1inclusive += y_N_Nplus1->binHeight(ibin);
+              }
             }
           }
 
@@ -195,7 +203,9 @@
 
 
       for (size_t n = 0; n < 5; ++n) {
-        scale(_h_y_Durham[n], 1.0/sumOfWeights());
+        if (_h_y_Durham[n]) {
+          scale(_h_y_Durham[n], 1.0/sumOfWeights());
+        }
       }
 
     }

Modified: trunk/src/Analyses/Makefile.am
==============================================================================
--- trunk/src/Analyses/Makefile.am	Fri Jul  9 15:07:31 2010	(r2572)
+++ trunk/src/Analyses/Makefile.am	Fri Jul  9 16:09:59 2010	(r2573)
@@ -44,7 +44,9 @@
 
 lib_LTLIBRARIES += RivetATLASAnalyses.la
 RivetATLASAnalyses_la_SOURCES = \
-    ATLAS_2010_S8591806.cc
+    ATLAS_2010_S8591806.cc \
+    ATLAS_900_UE.cc \
+    ATLAS_7000_UE.cc
 
 
 lib_LTLIBRARIES += RivetCDFAnalyses.la


More information about the Rivet-svn mailing list