LISTSERV mailing list manager LISTSERV 16.5

Help for HPS-SVN Archives


HPS-SVN Archives

HPS-SVN Archives


HPS-SVN@LISTSERV.SLAC.STANFORD.EDU


View:

Message:

[

First

|

Previous

|

Next

|

Last

]

By Topic:

[

First

|

Previous

|

Next

|

Last

]

By Author:

[

First

|

Previous

|

Next

|

Last

]

Font:

Proportional Font

LISTSERV Archives

LISTSERV Archives

HPS-SVN Home

HPS-SVN Home

HPS-SVN  August 2015

HPS-SVN August 2015

Subject:

r3373 - /java/branches/ecal-branch-442/analysis/src/main/java/org/hps/analysis/ecal/FEEClusterPlotter.java

From:

[log in to unmask]

Reply-To:

Notification of commits to the hps svn repository <[log in to unmask]>

Date:

Wed, 19 Aug 2015 14:58:40 -0000

Content-Type:

text/plain

Parts/Attachments:

Parts/Attachments

text/plain (139 lines)

Author: [log in to unmask]
Date: Wed Aug 19 07:58:38 2015
New Revision: 3373

Log:
magical fee cluster plotter

Added:
    java/branches/ecal-branch-442/analysis/src/main/java/org/hps/analysis/ecal/FEEClusterPlotter.java

Added: java/branches/ecal-branch-442/analysis/src/main/java/org/hps/analysis/ecal/FEEClusterPlotter.java
 =============================================================================
--- java/branches/ecal-branch-442/analysis/src/main/java/org/hps/analysis/ecal/FEEClusterPlotter.java	(added)
+++ java/branches/ecal-branch-442/analysis/src/main/java/org/hps/analysis/ecal/FEEClusterPlotter.java	Wed Aug 19 07:58:38 2015
@@ -0,0 +1,123 @@
+package org.hps.analysis.ecal;
+
+import hep.aida.IAnalysisFactory;
+import hep.aida.IPlotter;
+
+import java.io.IOException;
+import java.util.List;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.hps.conditions.database.DatabaseConditionsManager;
+import org.hps.conditions.ecal.EcalChannel;
+import org.hps.conditions.ecal.EcalConditions;
+import org.hps.recon.ecal.triggerbank.AbstractIntData;
+import org.hps.recon.ecal.triggerbank.TIData;
+import org.lcsim.event.CalorimeterHit;
+import org.lcsim.event.Cluster;
+import org.lcsim.event.EventHeader;
+import org.lcsim.event.GenericObject;
+import org.lcsim.geometry.Detector;
+import org.lcsim.util.Driver;
+import org.lcsim.util.aida.AIDA;
+
+
+/**
+*This makes a bunch of plots of the FEE peak per crystal (seed).
+*@author Holly Szumila <[log in to unmask]>
+*/
+
+public class FEEClusterPlotter extends Driver {
+	
+	//private AIDAFrame plotterFrame;
+    private AIDA aida = AIDA.defaultInstance();
+    IPlotter plotter;
+    IAnalysisFactory fac = aida.analysisFactory();
+    private String inputCollection = "EcalClusters";
+    public void setInputCollection(final String inputCollection) {
+        this.inputCollection = inputCollection;
+    }
+    
+    private DatabaseConditionsManager conditionsManager = null;
+    private EcalConditions ecalConditions = null;
+    private String histoNameFormat = "%3d";
+    
+    private String outputPlots = null;
+    
+    @Override
+    protected void detectorChanged(Detector detector) {
+        
+        conditionsManager = DatabaseConditionsManager.getInstance();
+        ecalConditions = conditionsManager.getEcalConditions();
+        
+        aida.tree().cd("/");
+        for (EcalChannel cc : ecalConditions.getChannelCollection()) {
+            aida.histogram1D(getHistoName(cc),200,0.5,1.3);
+        }
+
+    }
+
+    private String getHistoName(EcalChannel cc) {
+        return String.format(histoNameFormat,cc.getChannelId());
+    }
+    
+    public void process(EventHeader event) {
+        aida.tree().cd("/");
+
+        //only keep singles triggers:
+        if (!event.hasCollection(GenericObject.class,"TriggerBank"))
+        	throw new Driver.NextEventException();
+        boolean isSingles=false;
+        for (GenericObject gob : event.get(GenericObject.class,"TriggerBank"))
+        {	
+        	if (!(AbstractIntData.getTag(gob) == TIData.BANK_TAG)) continue;
+        	TIData tid = new TIData(gob);
+        	if (tid.isSingle0Trigger()  || tid.isSingle1Trigger())
+        	{
+        		isSingles=true;
+        		break;
+        	}
+        }
+        
+        if (isSingles){
+        	List<Cluster> clusters = event.get(Cluster.class, inputCollection);
+        	for (Cluster clus : clusters) {
+        		List<CalorimeterHit> hits = clus.getCalorimeterHits();
+        		CalorimeterHit seed = hits.get(0);
+        	
+        		double seedE = seed.getCorrectedEnergy();
+        		double clusE = clus.getEnergy();
+        		double time = seed.getTime();
+        			
+        		if ((seedE/clusE > 0.6) && seedE >0.45 && time>30 && time <70){
+        	
+        			EcalChannel cc = findChannel(seed);
+        			aida.histogram1D(getHistoName(cc)).fill(clusE);
+        		}
+        	}
+        }
+    }
+	
+    public void setOutputPlots(String output) {
+        this.outputPlots = output;
+    }
+   
+    public EcalChannel findChannel(int channel_id) {
+        return ecalConditions.getChannelCollection().findChannel(channel_id);
+    }
+
+    public EcalChannel findChannel(CalorimeterHit hit) {
+        return ecalConditions.getChannelCollection().findGeometric(hit.getCellID());
+    }
+    
+    public void endOfData() {
+        System.out.println("OutputFile");
+        if (outputPlots != null) {
+            try {
+                aida.saveAs("/home/holly/Desktop/outputFEEPlots.root");
+            } catch (IOException ex) {
+                Logger.getLogger(FEEClusterPlotter.class.getName()).log(Level.SEVERE, null, ex);
+            }
+        }
+    }	
+}

Top of Message | Previous Page | Permalink

Advanced Options


Options

Log In

Log In

Get Password

Get Password


Search Archives

Search Archives


Subscribe or Unsubscribe

Subscribe or Unsubscribe


Archives

November 2017
August 2017
July 2017
January 2017
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
December 2013
November 2013

ATOM RSS1 RSS2



LISTSERV.SLAC.STANFORD.EDU

Secured by F-Secure Anti-Virus CataList Email List Search Powered by the LISTSERV Email List Manager

Privacy Notice, Security Notice and Terms of Use