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

blackhole at projects.hepforge.org blackhole at projects.hepforge.org
Tue Jun 26 15:02:16 BST 2012


Author: hoeth
Date: Tue Jun 26 15:02:16 2012
New Revision: 3772

Log:
whitespace cleanup and new-style plugin hook for ATLAS_2012_I1091481

Modified:
   trunk/src/Analyses/ATLAS_2012_I1091481.cc

Modified: trunk/src/Analyses/ATLAS_2012_I1091481.cc
==============================================================================
--- trunk/src/Analyses/ATLAS_2012_I1091481.cc	Tue Jun 26 14:50:43 2012	(r3771)
+++ trunk/src/Analyses/ATLAS_2012_I1091481.cc	Tue Jun 26 15:02:16 2012	(r3772)
@@ -17,7 +17,7 @@
 
     /// Constructor
     ATLAS_2012_I1091481()
-      : Analysis("ATLAS_2012_I1091481") 
+      : Analysis("ATLAS_2012_I1091481")
     {
     }
 
@@ -34,12 +34,12 @@
       addProjection(cfs5,"CFS5");
 
       // pion mass;
-      pim = 0.1396;     
+      pim = 0.1396;
 
       // collision energy
       isqrts = -1;
-      if (fuzzyEquals(sqrtS(), 900*GeV)) isqrts = 2;       
-      else if (fuzzyEquals(sqrtS(), 7*TeV)) isqrts = 1;       
+      if (fuzzyEquals(sqrtS(), 900*GeV)) isqrts = 2;
+      else if (fuzzyEquals(sqrtS(), 7*TeV)) isqrts = 1;
       assert(isqrts >= 0);
 
       // graphs
@@ -78,38 +78,38 @@
       lb = binEdges(isqrts,2,1).front()-0.5*bw;
       ub = binEdges(isqrts,2,1).back()+0.5*bw;
       for (int j=0; j< nbeta; j++) x_eta[j]=lb+0.5*(2*j+1)*bw;
- 
+
       // histograms
       h_seta_incl = new LWH::Histogram1D(nbeta,lb,ub);
       h_seta_lpte = new LWH::Histogram1D(nbeta,lb,ub);
       h_seta_lptd = new LWH::Histogram1D(nbeta,lb,ub);
-    
+
     }
-    
-    
+
+
     /// Perform the per-event analysis
     void analyze(const Event& event) {
-            
+
       const ChargedFinalState& had = applyProjection<ChargedFinalState>(event, "CFS");
-        
+
       vector<HepMC::GenParticle> hdrs;
-     
+
       double ptmax=0.;
       foreach (const Particle& p, had.particles()) {
         const GenParticle& gp=p.genParticle();
-	if (gp.momentum().perp()>ptmax) ptmax=gp.momentum().perp();
+        if (gp.momentum().perp()>ptmax) ptmax=gp.momentum().perp();
         // eta ordering
-	if (!hdrs.size()) hdrs.push_back(gp);
-	else {
-	  vector<HepMC::GenParticle>::iterator pit=hdrs.begin();
-	  while (pit!=hdrs.end() && (*pit).momentum().eta()>gp.momentum().eta()) pit++;
-	  hdrs.insert(pit,gp);
-	} 
+        if (!hdrs.size()) hdrs.push_back(gp);
+        else {
+          vector<HepMC::GenParticle>::iterator pit=hdrs.begin();
+          while (pit!=hdrs.end() && (*pit).momentum().eta()>gp.momentum().eta()) pit++;
+          hdrs.insert(pit,gp);
+        }
       }
 
       //for (int i=0; i<hdrs.size(); i++) {
-      //	cout <<i << ","<<hdrs[i].momentum().perp()<<","<<hdrs[i].momentum().eta() << endl;
-      //}  
+      //        cout <<i << ","<<hdrs[i].momentum().perp()<<","<<hdrs[i].momentum().eta() << endl;
+      //}
 
       if (ptmax>10. || hdrs.size()<11 ) return;
 
@@ -122,56 +122,56 @@
         setac[i]=0.;
         setas[i]=0.;
       }
-     
+
       int nch = hdrs.size();
 
       double evis=0.;
       for (unsigned int i=0;i<hdrs.size();i++) {
         const GenParticle& gp=hdrs[i];
-        double ap = gp.momentum().perp()/sin(gp.momentum().theta()); 
-	double en = sqrt(ap*ap+pim*pim);
-	evis += 0.5*en;
-	double ph = gp.momentum().phi();
-	double eta = gp.momentum().eta();
-	for (int ii=0;ii<nbe;ii++) {            
-	  sec[ii]+=cos(x_e[ii]*evis-ph);
-	  ses[ii]+=sin(x_e[ii]*evis-ph);
-	}
-	for (int jj=0;jj<nbeta;jj++) {            
-	  setac[jj]+=cos(x_eta[jj]*eta-ph);
-	  setas[jj]+=sin(x_eta[jj]*eta-ph);
-	}
-	evis += 0.5*en;
+        double ap = gp.momentum().perp()/sin(gp.momentum().theta());
+        double en = sqrt(ap*ap+pim*pim);
+        evis += 0.5*en;
+        double ph = gp.momentum().phi();
+        double eta = gp.momentum().eta();
+        for (int ii=0;ii<nbe;ii++) {
+          sec[ii]+=cos(x_e[ii]*evis-ph);
+          ses[ii]+=sin(x_e[ii]*evis-ph);
+        }
+        for (int jj=0;jj<nbeta;jj++) {
+          setac[jj]+=cos(x_eta[jj]*eta-ph);
+          setas[jj]+=sin(x_eta[jj]*eta-ph);
+        }
+        evis += 0.5*en;
       }
 
       for (int i=0;i<nbe;i++) {
-	h_se_incl->fill(x_e[i],(sec[i]*sec[i]+ses[i]*ses[i])/nch-1.);
+        h_se_incl->fill(x_e[i],(sec[i]*sec[i]+ses[i]*ses[i])/nch-1.);
         if (ptmax < 1.) h_se_lpte->fill(x_e[i],(sec[i]*sec[i]+ses[i]*ses[i])/nch-1.);
       }
       for (int j=0;j<nbeta;j++) {
-	h_seta_incl->fill(x_eta[j],(setac[j]*setac[j]+setas[j]*setas[j])/nch-1.);
-	if (ptmax < 1.) h_seta_lpte->fill(x_eta[j],(setac[j]*setac[j]+setas[j]*setas[j])/nch-1.);
+        h_seta_incl->fill(x_eta[j],(setac[j]*setac[j]+setas[j]*setas[j])/nch-1.);
+        if (ptmax < 1.) h_seta_lpte->fill(x_eta[j],(setac[j]*setac[j]+setas[j]*setas[j])/nch-1.);
       }
 
       // low-pT depleted
 
       const ChargedFinalState& had5 = applyProjection<ChargedFinalState>(event, "CFS5");
-        
+
       vector<HepMC::GenParticle> hdrs5;
-     
+
       ptmax=0.;
       foreach (const Particle& p, had5.particles()) {
         const GenParticle& gp=p.genParticle();
-	if (gp.momentum().perp()>ptmax) ptmax=gp.momentum().perp();
+        if (gp.momentum().perp()>ptmax) ptmax=gp.momentum().perp();
         // eta ordering
-	if (!hdrs5.size()) hdrs5.push_back(gp);
-	else {
-	  vector<HepMC::GenParticle>::iterator pit=hdrs5.begin();
-	  while (pit!=hdrs5.end() && (*pit).momentum().eta()>gp.momentum().eta()) pit++;
-	  hdrs5.insert(pit,gp);
-	} 
+        if (!hdrs5.size()) hdrs5.push_back(gp);
+        else {
+          vector<HepMC::GenParticle>::iterator pit=hdrs5.begin();
+          while (pit!=hdrs5.end() && (*pit).momentum().eta()>gp.momentum().eta()) pit++;
+          hdrs5.insert(pit,gp);
+        }
       }
-  
+
       if (ptmax>10. || hdrs5.size()<11 ) return;
 
       for (int i=0;i<nbe;i++) {
@@ -188,35 +188,35 @@
       evis=0.;
       for (unsigned int i=0;i<hdrs5.size();i++) {
         const GenParticle& gp=hdrs5[i];
-        double ap = gp.momentum().perp()/sin(gp.momentum().theta()); 
-	double en = sqrt(ap*ap+pim*pim);
-	evis += 0.5*en;
-	double ph = gp.momentum().phi();
-	double eta = gp.momentum().eta();
-	for (int ii=0;ii<nbe;ii++) {            
-	  sec[ii]+=cos(x_e[ii]*evis-ph);
-	  ses[ii]+=sin(x_e[ii]*evis-ph);
-	}
-	for (int jj=0;jj<nbeta;jj++) {            
-	  setac[jj]+=cos(x_eta[jj]*eta-ph);
-	  setas[jj]+=sin(x_eta[jj]*eta-ph);
-	}
-	evis += 0.5*en;
+        double ap = gp.momentum().perp()/sin(gp.momentum().theta());
+        double en = sqrt(ap*ap+pim*pim);
+        evis += 0.5*en;
+        double ph = gp.momentum().phi();
+        double eta = gp.momentum().eta();
+        for (int ii=0;ii<nbe;ii++) {
+          sec[ii]+=cos(x_e[ii]*evis-ph);
+          ses[ii]+=sin(x_e[ii]*evis-ph);
+        }
+        for (int jj=0;jj<nbeta;jj++) {
+          setac[jj]+=cos(x_eta[jj]*eta-ph);
+          setas[jj]+=sin(x_eta[jj]*eta-ph);
+        }
+        evis += 0.5*en;
       }
 
       for (int i=0;i<nbe;i++) {
-	h_se_lptd->fill(x_e[i],(sec[i]*sec[i]+ses[i]*ses[i])/nch-1.);
+        h_se_lptd->fill(x_e[i],(sec[i]*sec[i]+ses[i]*ses[i])/nch-1.);
       }
       for (int j=0;j<nbeta;j++) {
-	h_seta_lptd->fill(x_eta[j],(setac[j]*setac[j]+setas[j]*setas[j])/nch-1.);
+        h_seta_lptd->fill(x_eta[j],(setac[j]*setac[j]+setas[j]*setas[j])/nch-1.);
       }
 
-      return;  
+      return;
     }
-      
+
     /// Normalise histograms etc., after the run
     void finalize() {
-      
+
       /// @todo Normalise, scale and otherwise manipulate histograms here
 
       // number of events :
@@ -229,39 +229,39 @@
         sec[i]= h_se_incl->binHeight(i)/nev_incl;
         ses[i]= h_se_incl->binError(i)/nev_incl;
       }
-      _se_incl->setCoordinate(1,sec,ses); 
+      _se_incl->setCoordinate(1,sec,ses);
 
       for (int i=0; i<nbeta; i++){
-	setac[i]= h_seta_incl->binHeight(i)/nev_incl;
-	setas[i]= h_seta_incl->binError(i)/nev_incl;
+        setac[i]= h_seta_incl->binHeight(i)/nev_incl;
+        setas[i]= h_seta_incl->binError(i)/nev_incl;
       }
-      _seta_incl->setCoordinate(1,setac,setas); 
+      _seta_incl->setCoordinate(1,setac,setas);
 
       // low-pT enhanced
       for (int i=0; i<nbe; i++) {
         sec[i]= h_se_lpte->binHeight(i)/nev_lpte;
         ses[i]= h_se_lpte->binError(i)/nev_lpte;
       }
-      _se_lpte->setCoordinate(1,sec,ses); 
+      _se_lpte->setCoordinate(1,sec,ses);
 
       for (int i=0; i<nbeta; i++){
-	setac[i]= h_seta_lpte->binHeight(i)/nev_lpte;
-	setas[i]= h_seta_lpte->binError(i)/nev_lpte;
+        setac[i]= h_seta_lpte->binHeight(i)/nev_lpte;
+        setas[i]= h_seta_lpte->binError(i)/nev_lpte;
       }
-      _seta_lpte->setCoordinate(1,setac,setas); 
+      _seta_lpte->setCoordinate(1,setac,setas);
 
       // low-pT depleted
       for (int i=0; i<nbe; i++) {
         sec[i]= h_se_lptd->binHeight(i)/nev_lptd;
         ses[i]= h_se_lptd->binError(i)/nev_lptd;
       }
-      _se_lptd->setCoordinate(1,sec,ses); 
+      _se_lptd->setCoordinate(1,sec,ses);
 
       for (int i=0; i<nbeta; i++){
-	setac[i]= h_seta_lptd->binHeight(i)/nev_lptd;
-	setas[i]= h_seta_lptd->binError(i)/nev_lptd;
+        setac[i]= h_seta_lptd->binHeight(i)/nev_lptd;
+        setas[i]= h_seta_lptd->binError(i)/nev_lptd;
       }
-      _seta_lptd->setCoordinate(1,setac,setas); 
+      _seta_lptd->setCoordinate(1,setac,setas);
 
       // save event counts ?
 
@@ -292,20 +292,20 @@
 
     double pim;
 
-    // arrays 
-    std::vector<float>         x_e; 
-    std::vector<float>         x_eta; 
-
-    std::vector<double>        sec; 
-    std::vector<double>        ses; 
-    std::vector<double>        setac; 
-    std::vector<double>        setas; 
+    // arrays
+    std::vector<float>         x_e;
+    std::vector<float>         x_eta;
+
+    std::vector<double>        sec;
+    std::vector<double>        ses;
+    std::vector<double>        setac;
+    std::vector<double>        setas;
 
   };
 
 
-  // This global object acts as a hook for the plugin system
-  AnalysisBuilder<ATLAS_2012_I1091481> plugin_ATLAS_2012_I1091481;
+  // The hook for the plugin system
+  DECLARE_RIVET_PLUGIN(ATLAS_2012_I1091481);
 
 
 }


More information about the Rivet-svn mailing list