lcsim/src/org/lcsim/digisim
diff -u -r1.18 -r1.19
--- DigiSimDriver.java 18 Jan 2006 20:37:42 -0000 1.18
+++ DigiSimDriver.java 20 Jan 2006 23:36:30 -0000 1.19
@@ -16,7 +16,7 @@
* both parameters and events from the framework.
*
* @author Guilherme Lima
- * @version $Id: DigiSimDriver.java,v 1.18 2006/01/18 20:37:42 lima Exp $
+ * @version $Id: DigiSimDriver.java,v 1.19 2006/01/20 23:36:30 lima Exp $
*/
public class DigiSimDriver extends Driver implements ConditionsListener {
@@ -97,6 +97,9 @@
_digitizers.add( digitizer );
// initialize this digitizer
+ if(this.getHistogramLevel()>0) digitizer.fillHistograms(true);
+ else digitizer.fillHistograms(false);
+
digitizer.init( configSection );
}
break; // go for next active
lcsim/src/org/lcsim/digisim
diff -u -r1.14 -r1.15
--- Digitizer.java 14 Jan 2006 00:08:53 -0000 1.14
+++ Digitizer.java 20 Jan 2006 23:36:30 -0000 1.15
@@ -26,7 +26,7 @@
* simulation process for a specific subdetector.
*
* @author Guilherme Lima
- * @version $Id: Digitizer.java,v 1.14 2006/01/14 00:08:53 lima Exp $
+ * @version $Id: Digitizer.java,v 1.15 2006/01/20 23:36:30 lima Exp $
*/
class Digitizer {
@@ -321,13 +321,14 @@
*/
private void initialize(Vector<ModifierParameters> modifiers) {
-// System.out.println("\n*** Digitizer "+_name+": init() called");
assert modifiers.size()>0 : "No modifiers provided.";
- _aida = AIDA.defaultInstance();
- _tree = _aida.tree();
- _tree.mkdirs( "DigiSim/"+this.getName() );
- _tree.cd( "DigiSim/"+this.getName() );
+ if(_fillHistos) {
+ _aida = AIDA.defaultInstance();
+ _tree = _aida.tree();
+ _tree.mkdirs( "DigiSim/"+this.getName() );
+ _tree.cd( "DigiSim/"+this.getName() );
+ }
_nRun = 0;
_nEvt = 0;
@@ -355,15 +356,17 @@
newmod.setDebug( 0 );
// book clouds for this modifier
- String cname = ((AbstractCalHitModifier)newmod).getName();
- ICloud1D[] clouds = new ICloud1D[2];
- clouds[0] = _aida.cloud1D(cname+"Energy");
- clouds[1] = _aida.cloud1D(cname+"Time");
- cloudMap.put(cname, clouds);
+ if(_fillHistos) {
+ String cname = ((AbstractCalHitModifier)newmod).getName();
+ ICloud1D[] clouds = new ICloud1D[2];
+ clouds[0] = _aida.cloud1D(cname+"Energy");
+ clouds[1] = _aida.cloud1D(cname+"Time");
+ cloudMap.put(cname, clouds);
+ }
++i;
}
- _tree.cd( "../.." );
+ if(_fillHistos) _tree.cd( "../.." );
}
// /** Called for every run.
@@ -402,18 +405,20 @@
//*** Call processHits method for each modifier
// _tree.cd( "DigiSim/"+this.getName() );
for( CalHitModifier modifier : _modifs ) {
- // modifier processing
- modifier.processHits( tmpHits );
+ // modifier processing
+ modifier.processHits( tmpHits );
+ if(_fillHistos) {
// fill clouds with energy and time
String cname = ((AbstractCalHitModifier)modifier).getName();
ICloud1D[] clouds = cloudMap.get(cname);
for( long cellid : tmpHits.keySet() ) {
- TempCalHit hit = tmpHits.get(cellid);
- // fill clouds
- clouds[0].fill( Math.log(hit.getTotalEnergy())*lntolog10 );
- clouds[1].fill( Math.log(hit.getPrimaryTime())*lntolog10 );
+ TempCalHit hit = tmpHits.get(cellid);
+ // fill clouds
+ clouds[0].fill( Math.log(hit.getTotalEnergy())*lntolog10 );
+ clouds[1].fill( Math.log(hit.getPrimaryTime())*lntolog10 );
}
+ }
}
// _tree.cd("../..");
@@ -466,6 +471,10 @@
return _name;
}
+ public void fillHistograms(boolean fill) {
+ _fillHistos = fill;
+ }
+
// *** FIELDS ***
/** Run number */
@@ -487,6 +496,7 @@
private CellSelector _selector;
/** histograms container */
+ boolean _fillHistos = false;
private Map<String,ICloud1D[]> cloudMap = new HashMap<String,ICloud1D[]>();
AIDA _aida = AIDA.defaultInstance();
ITree _tree = null;