Commit in lcsim/src/org/lcsim/digisim on MAIN
Digitizer.java+30-131.13 -> 1.14
GL: add clouds for time distribution, and one subdir per digitizer

lcsim/src/org/lcsim/digisim
Digitizer.java 1.13 -> 1.14
diff -u -r1.13 -r1.14
--- Digitizer.java	10 Jan 2006 19:30:20 -0000	1.13
+++ Digitizer.java	14 Jan 2006 00:08:53 -0000	1.14
@@ -26,7 +26,7 @@
  * simulation process for a specific subdetector.
  *
  * @author Guilherme Lima
- * @version $Id: Digitizer.java,v 1.13 2006/01/10 19:30:20 tonyj Exp $
+ * @version $Id: Digitizer.java,v 1.14 2006/01/14 00:08:53 lima Exp $
  */
 class Digitizer {
 
@@ -256,7 +256,7 @@
 	  }
 	}
 	if(!found) throw new RuntimeException("Configuration error: requested modifier "+modreq+" not configured properly.\n Please check your DigiSim configuration file.");
-	// trouble?  Check if modifier has been registered in DigiSimMain
+	// trouble?  Check if modifier has been registered in DigiSimDriver
       }
 
       // At this point we should have everything we need!
@@ -323,8 +323,11 @@
 
 //      System.out.println("\n*** Digitizer "+_name+": init() called");
 	assert modifiers.size()>0 : "No modifiers provided.";
-	_tree = AIDA.defaultInstance().tree();
-	_tree.mkdirs( this.getName() );
+
+	_aida = AIDA.defaultInstance();
+	_tree = _aida.tree();
+	_tree.mkdirs( "DigiSim/"+this.getName() );
+	_tree.cd( "DigiSim/"+this.getName() );
 
 	_nRun = 0;
 	_nEvt = 0;
@@ -350,8 +353,17 @@
 
 	  // debugging printout
 	  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);
+
 	  ++i;
 	}
+	_tree.cd( "../.." );
     }
 
 //     /** Called for every run.
@@ -388,19 +400,22 @@
 	Map<Long,TempCalHit> tmpHits = createTempHits( hits );
 
 	//*** Call processHits method for each modifier
-	AIDA aida = AIDA.defaultInstance();
-	_tree.cd( this.getName() );
+// 	_tree.cd( "DigiSim/"+this.getName() );
 	for( CalHitModifier modifier : _modifs ) {
+	    // modifier processing
 	    modifier.processHits( tmpHits );
+
+	    // fill clouds with energy and time
 	    String cname = ((AbstractCalHitModifier)modifier).getName();
-	    ICloud1D cloud = aida.cloud1D(cname);
-	    cloudMap.put(cname, cloud);
+	    ICloud1D[] clouds = cloudMap.get(cname);
 	    for( long cellid : tmpHits.keySet() ) {
 		TempCalHit hit = tmpHits.get(cellid);
-		cloud.fill( Math.log(hit.getTotalEnergy())*lntolog10 );
+		// fill clouds
+		clouds[0].fill( Math.log(hit.getTotalEnergy())*lntolog10 );
+		clouds[1].fill( Math.log(hit.getPrimaryTime())*lntolog10 );
 	    }
 	}
-	_tree.cd("..");
+// 	_tree.cd("../..");
 
 	// create output collections and append them to the LCEvent
 	Vector<RawCalorimeterHit> rawColl = new Vector<RawCalorimeterHit>();
@@ -424,8 +439,9 @@
 	System.out.println("Digitizer::end(): "+_name+":xs processed "
 			   +_nEvt+" events in "+_nRun+" runs ");
 	// normalize clouds
-	for( ICloud1D cloud : cloudMap.values() ) {
-	    cloud.scale( 1/_nEvt );
+	for( ICloud1D[] clouds : cloudMap.values() ) {
+	    clouds[0].scale( 1/_nEvt );
+	    clouds[1].scale( 1/_nEvt );
 	}
     }
 
@@ -471,6 +487,7 @@
     private CellSelector _selector;
 
     /** histograms container */
-    private Map<String,ICloud1D> cloudMap = new HashMap<String,ICloud1D>();
+    private Map<String,ICloud1D[]> cloudMap = new HashMap<String,ICloud1D[]>();
+    AIDA _aida = AIDA.defaultInstance();
     ITree _tree = null;
 }
CVSspam 0.2.8