From 5d1339b0dcc7639c9dda3c38e224e56c8d809520 Mon Sep 17 00:00:00 2001
From: Marc Pelizaeus <marc@sleipnir.(none)>
Date: Wed, 8 Feb 2012 19:23:15 +0100
Subject: [PATCH] Modify MJpsiGamKlKsKKApp

---
 Examples/JpsiGamKsKlKK/MJpsiGamKlKsKKApp.cc | 55 +++++++++++----------
 1 file changed, 29 insertions(+), 26 deletions(-)

diff --git a/Examples/JpsiGamKsKlKK/MJpsiGamKlKsKKApp.cc b/Examples/JpsiGamKsKlKK/MJpsiGamKlKsKKApp.cc
index d29a0554..2669fd8f 100644
--- a/Examples/JpsiGamKsKlKK/MJpsiGamKlKsKKApp.cc
+++ b/Examples/JpsiGamKsKlKK/MJpsiGamKlKsKKApp.cc
@@ -222,6 +222,35 @@ int main(int __argc,char *__argv[]){
 
     JpsiGamKsKlKKHist theHist(theLhPtr, theStartparams);
     
+    if(theAppParams.massIndependentFit()){
+      //calculate intensity contributions
+      JpsiGamKsKlKKProdLh* contrLh = new JpsiGamKsKlKKProdLh(theJpsiGamKsKlKKEventListPtr, hypMap);
+      contrLh->massIndependentFit( theAppParams.massIndependentFit() );
+      contrLh->useCommonProductionPhase( theAppParams.useCommonProductionPhases() );
+      
+      boost::shared_ptr<const EvtDataBaseList> theEvtList=contrLh->getEventList();
+      const std::vector<EvtData*> mcList=theEvtList->getMcVecs();
+      const std::vector<EvtData*> dataList=theEvtList->getDataVecs();
+
+      std::map<const std::string, bool>::const_iterator hypo= hypMap.begin();
+      while(hypo !=hypMap.end()){
+	if( hypo->second ){
+	  
+	  std::vector<EvtData*>::const_iterator it=mcList.begin();
+	  double integral=0.0;
+	  while(it!=mcList.end()){
+	    integral+=contrLh->calcComponentIntensity( *it, theStartparams, hypo->first );
+	    it++;
+	  }
+	  double scale = (1.*dataList.size()) / (1.*mcList.size()) ;
+	  Info << "Scale factor: " << scale << endmsg;
+	  integral*=scale;
+	  Info << "Events for component " << hypo->first << ": " << integral << endmsg;
+	}
+	hypo++;
+      }
+    }
+        
     end= clock();
     double cpuTime= (end-start)/ (CLOCKS_PER_SEC);
     Info << "cpuTime:\t" << cpuTime << "\tsec" << endmsg;
@@ -262,32 +291,6 @@ int main(int __argc,char *__argv[]){
   const std::vector<double> finalParamVec=finalUsrParameters.Params();
  
   fitParams finalFitParams=theFitParamBase->getFitParamVal(finalParamVec);
-
-  
-  //calculate intensity contributions
-  JpsiGamKsKlKKProdLh* contrLh = new JpsiGamKsKlKKProdLh(theJpsiGamKsKlKKEventListPtr, hypMap);
-  contrLh->massIndependentFit( theAppParams.massIndependentFit() );
-  contrLh->useCommonProductionPhase( theAppParams.useCommonProductionPhases() );
-  
-  boost::shared_ptr<const EvtDataBaseList> theEvtList=contrLh->getEventList();
-  const std::vector<EvtData*> mcList=theEvtList->getDataVecs();
-  
-  std::map<const std::string, bool>::const_iterator hypo= hypMap.begin();
-  while(hypo !=hypMap.end()){
-    if( hypo->second ){
-      
-      std::vector<EvtData*>::const_iterator it=mcList.begin();
-      double integral=0.0;
-      while(it!=mcList.end()){
-	integral+=contrLh->calcComponentIntensity( *it, finalFitParams, hypo->first );
-	//integral+= theLhPtr->calcComponentIntensity( *it, finalFitParams, "etacHyp" );
-	it++;
-      }
-      Info << "Events for component " << hypo->first << ": " << integral << endmsg;
-    }
-    hypo++;
-  }
-  
   
   JpsiGamKsKlKKHist theHist(theLhPtr, finalFitParams);
 
-- 
GitLab