<!DOCTYPE HTML PUBLIC "-// IETF/DTD HTML 2.0// EN">
<html>
<!--                                             -->
<!-- Author: ROOT team (rootdev@hpsalo.cern.ch)  -->
<!--                                             -->
<!--   Date: Tue Apr  6 15:55:35 1999            -->
<!--                                             -->
<head>
<title>ClusterSystem - source file</title>
<link rev=made href="mailto:rootdev@root.cern.ch">
<meta name="rating" content="General">
<meta name="objecttype" content="Manual">
<meta name="keywords" content="software development, oo, object oriented, unix, x11, motif, windows nt, c++, html, rene brun, fons rademakers">
<meta name="description" content="ROOT - An Object Oriented Framework For Large Scale Data Analysis.">
</head>
<body BGCOLOR="#ffffff" LINK="#0000ff" VLINK="#551a8b" ALINK="#ff0000" TEXT="#000000">
<a name="TopOfPage"></a>
<pre>
#include "<a href="../ClusterSystem.h">ClusterSystem.h</a>"
#include "<a href="../CalHit.h">CalHit.h</a>"

ClassImp(ClusterSystem)

<b>  //////////////////////////////////////////////////////////////////////////</b>
<b>  //                                                                      //</b>
<b>  // <a href=".././ClusterSystem.html">ClusterSystem</a>                                                        //</b>
<b>  //                                                                      //</b>
<b>  // The <a href=".././ClusterSystem.html">ClusterSystem</a> class is used to extract cluster information       //</b>
<b>  // from the GISMO ascii output file and use it to fill the <a href="http://root.cern.ch/root/html/Cluster.html">Cluster</a>      //  </b>
<b>  // class.                                                               //</b>
<b>  //                                                                      //</b>
<b>  //////////////////////////////////////////////////////////////////////////</b>

<b>///_________________________________________________________________________</b>
<a name="ClusterSystem:ClusterSystem"> </a><a href=".././ClusterSystem.html#ClusterSystem:ClusterSystem">ClusterSystem::ClusterSystem</a>(<a href="http://root.cern.ch/root/html/GetParameters.html">GetParameters</a>* gp) {
<b>  // <a href="http://root.cern.ch/root/html/TStyle.html">Default</a> constructor</b>
  <a href=".././ClusterSystem.html#ClusterSystem:m_event">m_event</a> = 0;
  <a href=".././ClusterSystem.html#ClusterSystem:m_parameters">m_parameters</a> = gp;

  <a href=".././ClusterSystem.html#ClusterSystem:m_hitEscale">m_hitEscale</a> = new <a href="../ListOfTypes.html#Float_t">Float_t</a>(4);

  <a href=".././ClusterSystem.html#ClusterSystem:m_hitEscale">m_hitEscale</a>[0] = gp-&gt;getEMEnergyScale();
  <a href=".././ClusterSystem.html#ClusterSystem:m_hitEscale">m_hitEscale</a>[1] = gp-&gt;getHADEnergyScale();
  <a href=".././ClusterSystem.html#ClusterSystem:m_hitEscale">m_hitEscale</a>[2] = gp-&gt;getMUEnergyScale();
  <a href=".././ClusterSystem.html#ClusterSystem:m_hitEscale">m_hitEscale</a>[3] = gp-&gt;getLUMEnergyScale();
  <a href="http://root.cern.ch/root/html/CalHit.html#CalHit:energyScale">CalHit::energyScale</a> = <a href=".././ClusterSystem.html#ClusterSystem:m_hitEscale">m_hitEscale</a>;

  <a href=".././ClusterSystem.html#ClusterSystem:m_hitcosThetaSeg">m_hitcosThetaSeg</a> = new <a href="../ListOfTypes.html#Float_t">Float_t</a>(4);

  <a href=".././ClusterSystem.html#ClusterSystem:m_hitcosThetaSeg">m_hitcosThetaSeg</a>[0] = gp-&gt;getEMcosThetaSeg();
  <a href=".././ClusterSystem.html#ClusterSystem:m_hitcosThetaSeg">m_hitcosThetaSeg</a>[1] = gp-&gt;getHADcosThetaSeg();
  <a href=".././ClusterSystem.html#ClusterSystem:m_hitcosThetaSeg">m_hitcosThetaSeg</a>[2] = gp-&gt;getMUcosThetaSeg();
  <a href=".././ClusterSystem.html#ClusterSystem:m_hitcosThetaSeg">m_hitcosThetaSeg</a>[3] = gp-&gt;getLUMcosThetaSeg();
  <a href="http://root.cern.ch/root/html/CalHit.html#CalHit:cosThetaSeg">CalHit::cosThetaSeg</a> = <a href=".././ClusterSystem.html#ClusterSystem:m_hitcosThetaSeg">m_hitcosThetaSeg</a>;

  <a href=".././ClusterSystem.html#ClusterSystem:m_hitphiSeg">m_hitphiSeg</a> = new <a href="../ListOfTypes.html#Float_t">Float_t</a>(4);
  <a href=".././ClusterSystem.html#ClusterSystem:m_hitphiSeg">m_hitphiSeg</a>[0] = gp-&gt;getEMphiSeg();
  <a href=".././ClusterSystem.html#ClusterSystem:m_hitphiSeg">m_hitphiSeg</a>[1] = gp-&gt;getHADphiSeg();
  <a href=".././ClusterSystem.html#ClusterSystem:m_hitphiSeg">m_hitphiSeg</a>[2] = gp-&gt;getMUphiSeg();
  <a href=".././ClusterSystem.html#ClusterSystem:m_hitphiSeg">m_hitphiSeg</a>[3] = gp-&gt;getLUMphiSeg();
  <a href="http://root.cern.ch/root/html/CalHit.html#CalHit:phiSeg">CalHit::phiSeg</a> = <a href=".././ClusterSystem.html#ClusterSystem:m_hitphiSeg">m_hitphiSeg</a>;

}
<b>///_________________________________________________________________________</b>
<a name="ClusterSystem:FillClusters"> </a><a href="../ListOfTypes.html#void">void</a> <a href=".././ClusterSystem.html#ClusterSystem:FillClusters">ClusterSystem::FillClusters</a>(<a href="http://root.cern.ch/root/html/TObjArray.html">TObjArray</a>* cal_digi){
<b>  // Gets the cluster information from the ascii file</b>
  <a href="../ListOfTypes.html#Int_t">Int_t</a> nhits = cal_digi-&gt;GetEntries();
  <a href="http://root.cern.ch/root/html/TMap.html">TMap</a>* reference = new <a href="http://root.cern.ch/root/html/TMap.html">TMap</a>(17,0);

  for(<a href="../ListOfTypes.html#Int_t">Int_t</a> i=0; i&lt;nhits; i++){
    <a href="http://root.cern.ch/root/html/TObjArray.html">TObjArray</a>* list = ((<a href="http://root.cern.ch/root/html/CalHit.html">CalHit</a>*)cal_digi-&gt;At(i))-&gt;GetMCE();
    <a href="../ListOfTypes.html#Int_t">Int_t</a> nparts = list-&gt;GetEntries();

    for(<a href="../ListOfTypes.html#Int_t">Int_t</a> j=0; j&lt;nparts; j++){
      <a href="../ListOfTypes.html#Int_t">Int_t</a> partindex = ((<a href="http://root.cern.ch/root/html/EDeposit.html">EDeposit</a>*)list-&gt;At(j))-&gt;GetPart();
      <a href="http://root.cern.ch/root/html/McPart.html">McPart</a>* part = (<a href="http://root.cern.ch/root/html/McPart.html">McPart</a>*)<a href=".././ClusterSystem.html#ClusterSystem:m_event">m_event</a>-&gt;<a href="http://root.cern.ch/root/html/Event.html#Event:MCparticles">MCparticles</a>()-&gt;At(partindex);

      if( reference-&gt;FindObject(part)){// Does cluster exist?
	<a href="http://root.cern.ch/root/html/Cluster.html">Cluster</a>* clust = (<a href="http://root.cern.ch/root/html/Cluster.html">Cluster</a>*)(reference-&gt;GetValue(part));
	clust-&gt;IndexList()-&gt;Add(new <a href="http://root.cern.ch/root/html/IntObj.html">IntObj</a>(i));
	clust-&gt;HitList()-&gt;Add((<a href="http://root.cern.ch/root/html/towerID.html">towerID</a>*)((<a href="http://root.cern.ch/root/html/CalHit.html">CalHit</a>*)cal_digi-&gt;At(i))-&gt;GetTower());
	clust-&gt;MCEList()-&gt;Add((<a href="http://root.cern.ch/root/html/EDeposit.html">EDeposit</a>*)list-&gt;At(j));
      }
      else{
	<a href="http://root.cern.ch/root/html/Cluster.html">Cluster</a>* clust = new <a href="http://root.cern.ch/root/html/Cluster.html">Cluster</a>(cal_digi);
	clust-&gt;McList()-&gt;Add(new <a href="http://root.cern.ch/root/html/IntObj.html">IntObj</a>(partindex));
	clust-&gt;IndexList()-&gt;Add(new <a href="http://root.cern.ch/root/html/IntObj.html">IntObj</a>(i));
	clust-&gt;HitList()-&gt;Add((<a href="http://root.cern.ch/root/html/towerID.html">towerID</a>*)((<a href="http://root.cern.ch/root/html/CalHit.html">CalHit</a>*)cal_digi-&gt;At(i))-&gt;GetTower());
	clust-&gt;MCEList()-&gt;Add((<a href="http://root.cern.ch/root/html/EDeposit.html">EDeposit</a>*)list-&gt;At(j));
	reference-&gt;Add(part,clust);
	<a href=".././ClusterSystem.html#ClusterSystem:m_event">m_event</a>-&gt;<a href="http://root.cern.ch/root/html/Event.html#Event:ClusterLst">ClusterLst</a>()-&gt;Add(clust);
      }
    }
  }
}

<b>///_______________________________________________________________________</b>
<a name="ClusterSystem:doit"> </a><a href="../ListOfTypes.html#void">void</a> <a href=".././ClusterSystem.html#ClusterSystem:doit">ClusterSystem::doit</a>(<a href="http://root.cern.ch/root/html/Event.html">Event</a>* event){
<b>  // This function executes cluster cheat system</b>

    <a href=".././ClusterSystem.html#ClusterSystem:m_event">m_event</a> = event;
    <a href="#ClusterSystem:FillClusters">FillClusters</a>(<a href=".././ClusterSystem.html#ClusterSystem:m_event">m_event</a>-&gt;<a href="http://root.cern.ch/root/html/Event.html#Event:EMCAL">EMCAL</a>());
    <a href="#ClusterSystem:FillClusters">FillClusters</a>(<a href=".././ClusterSystem.html#ClusterSystem:m_event">m_event</a>-&gt;<a href="http://root.cern.ch/root/html/Event.html#Event:HADCAL">HADCAL</a>());
    <a href="#ClusterSystem:FillClusters">FillClusters</a>(<a href=".././ClusterSystem.html#ClusterSystem:m_event">m_event</a>-&gt;<a href="http://root.cern.ch/root/html/Event.html#Event:MUCAL">MUCAL</a>());

    <a href="../ListOfTypes.html#Int_t">Int_t</a> nCluster = <a href=".././ClusterSystem.html#ClusterSystem:m_event">m_event</a>-&gt;<a href="http://root.cern.ch/root/html/Event.html#Event:ClusterLst">ClusterLst</a>()-&gt;GetEntries();
    for (<a href="../ListOfTypes.html#int">int</a> i=0; i&lt;nCluster; i++) {
	<a href="http://root.cern.ch/root/html/Cluster.html">Cluster</a>* cls = (<a href="http://root.cern.ch/root/html/Cluster.html">Cluster</a>*)<a href=".././ClusterSystem.html#ClusterSystem:m_event">m_event</a>-&gt;<a href="http://root.cern.ch/root/html/Event.html#Event:ClusterLst">ClusterLst</a>()-&gt;At(i);
	cls-&gt;CalcProperties();
    };
}

<b>///______________________________________________________________________</b>
<a name="ClusterSystem:spew"> </a><a href="../ListOfTypes.html#void">void</a> <a href=".././ClusterSystem.html#ClusterSystem:spew">ClusterSystem::spew</a>(FILE* ofile)const{
<b>  // Output function</b>
  <a href="../ListOfTypes.html#Int_t">Int_t</a> num = <a href=".././ClusterSystem.html#ClusterSystem:m_event">m_event</a>-&gt;<a href="http://root.cern.ch/root/html/Event.html#Event:ClusterLst">ClusterLst</a>()-&gt;GetEntries();
  fprintf(ofile,"Clustersn %in",num);

  for(<a href="../ListOfTypes.html#Int_t">Int_t</a> i=0; i&lt;num; i++){
    <a href="http://root.cern.ch/root/html/Cluster.html">Cluster</a>* clust = (<a href="http://root.cern.ch/root/html/Cluster.html">Cluster</a>*)<a href=".././ClusterSystem.html#ClusterSystem:m_event">m_event</a>-&gt;<a href="http://root.cern.ch/root/html/Event.html#Event:ClusterLst">ClusterLst</a>()-&gt;At(i);
    clust-&gt;Spew(ofile);
  }
  fprintf(ofile,"endn");
}

<b>///______________________________________________________________________</b>
<a name="ClusterSystem:cleanup"> </a><a href="../ListOfTypes.html#void">void</a> <a href=".././ClusterSystem.html#ClusterSystem:cleanup">ClusterSystem::cleanup</a>(){
<b>  // Cleans up loose ends. There aren't any right now.</b>
  <a href=".././ClusterSystem.html#ClusterSystem:m_event">m_event</a> = 0;
}
</pre>

<!--SIGNATURE-->
<br>
<address>
<hr>
<center>
<a href="http://root.cern.ch/root/Welcome.html">ROOT page</a> - <a href="../ClassIndex.html">Class index</a> - <a href="#TopOfPage">Top of the page</a><br>
</center>
<hr>This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to <a href="mailto:rootdev@root.cern.ch">ROOT support</a>, or contact <a href="mailto:rootdev@root.cern.ch">the developers</a> with any questions or problems regarding ROOT.
</address>
</body>
</html>
