int HFMLTriggerHepMCTrigger::InitRun(PHCompositeNode* topNode)
{
  m_Geneventmap = findNode::getClass<PHHepMCGenEventMap>(topNode, "PHHepMCGenEventMap");
  if (!m_Geneventmap)
  {
    std::cout << PHWHERE << " - Fatal error - missing node PHHepMCGenEventMap" << std::endl;
    return Fun4AllReturnCodes::ABORTRUN;
  }

  PHNodeIterator iter(topNode);

  PHCompositeNode* dstNode = dynamic_cast<PHCompositeNode*>(iter.findFirst("PHCompositeNode", "DST"));
  if (!dstNode)
  {
    cout << PHWHERE << "DST Node missing, doing nothing." << std::endl;
    throw std::runtime_error(
        "Failed to find DST node in RawTowerBuilder::CreateNodes");
  }

  m_Flags = findNode::getClass<PdbParameterMap>(dstNode, "HFMLTrigger_HepMCTriggerFlags");
  if (m_Flags == nullptr)
  {
    m_Flags = new PdbParameterMap();

    dstNode->addNode(new PHDataNode<PHObject>(m_Flags, "HFMLTrigger_HepMCTriggerFlags", "PHObject"));
  }

  return Fun4AllReturnCodes::EVENT_OK;
}
int BbcVertexFastSimReco::CreateNodes(PHCompositeNode *topNode) {

  PHNodeIterator iter(topNode);

  // Looking for the DST node
  PHCompositeNode *dstNode = dynamic_cast<PHCompositeNode*>(iter.findFirst("PHCompositeNode","DST"));
  if (!dstNode) {
    cout << PHWHERE << "DST Node missing, doing nothing." << endl;
    return Fun4AllReturnCodes::ABORTRUN;
  }

  // store the BBC stuff under a sub-node directory
  PHCompositeNode* bbcNode = dynamic_cast<PHCompositeNode*>(iter.findFirst("PHCompositeNode","BBC"));
  if (!bbcNode) {
    bbcNode = new PHCompositeNode("BBC");
    dstNode->addNode(bbcNode);
  }

  // create the BbcVertexMap
  BbcVertexMap *vertexes = findNode::getClass<BbcVertexMap>(topNode,"BbcVertexMap");
  if (!vertexes) {
    vertexes = new BbcVertexMap_v1();
    PHIODataNode<PHObject> *VertexMapNode = new PHIODataNode<PHObject>(vertexes,"BbcVertexMap","PHObject");
    bbcNode->addNode(VertexMapNode);
  } else {
    cout << PHWHERE << "::ERROR - BbcVertexMap pre-exists, but should not if running FastSim" << endl;
    exit(-1);
  }
  
  return Fun4AllReturnCodes::EVENT_OK;
}
//! global initialization
int saModuleSingleMuonAN::init(PHCompositeNode *topNode, sa_hist_mangager_ptr hm)
{
	//set_fitparam(2);

	//add a new node to output DST
	// make the flag node which is syncronized with cut on picodst_object
	PHCompositeNode* dstNode = NULL;
	PHNodeIterator nodeItr(topNode);
	dstNode = static_cast<PHCompositeNode*>(nodeItr.findFirst("PHCompositeNode",
				"DST"));
	if (!dstNode)
	{
		dstNode = new PHCompositeNode("DST");
		topNode->addNode(dstNode);
	}
	saFlagC *flags = new saFlagC();
	if (flags)
	{
		// make a new flag node called DST/SimpleDimuonFlag
		PHIODataNode<PHObject> * node = new PHIODataNode<PHObject>(flags,
				"SinglemuonFlag", "PHObject");

		if (!node)
		{
			cout
				<< "saModuleSimpleDimuon::Init failed to create saEventProperty Node"
				<< endl;
			return ABORTRUN;
		}
		else
		{
			dstNode->addNode(node);
			cout << "saFlag Node is added with version " << flags->ClassName()
				<< " as " << node->getName() << endl;
		}
	}
	else
	{
		cout << "saModuleSingleMuonAN::Init failed to create saEventProperty"
			<< endl;
		return ABORTRUN;
	}

	//
	// --- define user histograms ----
	//
	_v_sahist.clear();

	_sah_pT_phi_MuM_phi_N_LG4  = makesaHist_pT_phi(hm,makeTHist_pT_phi("_sah_pT_phi_MuM_phi_N_LG4", "North, Last Gap = 4"));
        _sah_pT_phi_MuM_phi_N_LG23 = makesaHist_pT_phi(hm,makeTHist_pT_phi("_sah_pT_phi_MuM_phi_N_LG23","North, Last Gap = 23"));
        _sah_pT_phi_MuM_phi_S_LG4  = makesaHist_pT_phi(hm,makeTHist_pT_phi("_sah_pT_phi_MuM_phi_S_LG4", "South, Last Gap = 4"));
        _sah_pT_phi_MuM_phi_S_LG23 = makesaHist_pT_phi(hm,makeTHist_pT_phi("_sah_pT_phi_MuM_phi_S_LG23","South, Last Gap = 23"));
	return EVENT_OK;
}
int PHG4TrackKalmanFitter::CreateNodes(PHCompositeNode *topNode) {
	// create nodes...
	PHNodeIterator iter(topNode);

	PHCompositeNode *dstNode = static_cast<PHCompositeNode*>(iter.findFirst(
			"PHCompositeNode", "DST"));
	if (!dstNode) {
		cerr << PHWHERE << "DST Node missing, doing nothing." << endl;
		return Fun4AllReturnCodes::ABORTEVENT;
	}
  PHNodeIterator iter_dst(dstNode);

	// Create the SVTX node
	PHCompositeNode* tb_node = dynamic_cast<PHCompositeNode*>(iter_dst.findFirst(
			"PHCompositeNode", "SVTX"));
	if (!tb_node) {
		tb_node = new PHCompositeNode("SVTX");
		dstNode->addNode(tb_node);
		if (verbosity > 0)
			cout << "SVTX node added" << endl;
	}

	if (_output_mode == MakeNewNode || _output_mode == DebugMode) {
		_trackmap_refit = new SvtxTrackMap_v1;
		PHIODataNode<PHObject>* tracks_node = new PHIODataNode<PHObject>(
				_trackmap_refit, "SvtxTrackMapRefit", "PHObject");
		tb_node->addNode(tracks_node);
		if (verbosity > 0)
			cout << "Svtx/SvtxTrackMapRefit node added" << endl;
	}

	if (_fit_primary_tracks) {
		_primary_trackmap = new SvtxTrackMap_v1;
		PHIODataNode<PHObject>* primary_tracks_node =
				new PHIODataNode<PHObject>(_primary_trackmap, "PrimaryTrackMap",
						"PHObject");
		tb_node->addNode(primary_tracks_node);
		if (verbosity > 0)
			cout << "Svtx/PrimaryTrackMap node added" << endl;
	}

	_vertexmap_refit = new SvtxVertexMap_v1;
	PHIODataNode<PHObject>* vertexes_node = new PHIODataNode<PHObject>(
			_vertexmap_refit, "SvtxVertexMapRefit", "PHObject");
	tb_node->addNode(vertexes_node);
	if (verbosity > 0)
		cout << "Svtx/SvtxVertexMapRefit node added" << endl;

	return Fun4AllReturnCodes::EVENT_OK;
}
int PHG4SvtxBeamSpotReco::InitRun(PHCompositeNode* topNode) {

  // clear for new run
  _pca.Clear();

  // Looking for the PAR node
  PHNodeIterator iter(topNode);
  
  PHCompositeNode *parNode 
    = dynamic_cast<PHCompositeNode*>(iter.findFirst("PHCompositeNode","PAR"));
  if (!parNode) {
    cout << PHWHERE << "PAR Node missing, doing nothing." << endl;
    return Fun4AllReturnCodes::ABORTRUN;
  }

  PHNodeIterator pariter(parNode);
  
  // Create the SVX node if required
  PHCompositeNode* svxNode 
    = dynamic_cast<PHCompositeNode*>(pariter.findFirst("PHCompositeNode","SVTX"));
  if (!svxNode) {
    svxNode = new PHCompositeNode("SVTX");
    parNode->addNode(svxNode);
  }
  
  // Create the SvtxBeamSpot node if required
  _beamspot = findNode::getClass<SvtxBeamSpot>(topNode,"SvtxBeamSpot");
  if (!_beamspot) {
    _beamspot = new SvtxBeamSpot();
    PHIODataNode<PHObject> *SvtxBeamSpotNode =
      new PHIODataNode<PHObject>(_beamspot, "SvtxBeamSpot", "PHObject");
    svxNode->addNode(SvtxBeamSpotNode);
  }

  // Pull the reconstructed track information off the node tree...
  _vertexes = findNode::getClass<SvtxVertexMap>(topNode, "SvtxVertexMap");
  if(!_vertexes) {
    cerr << PHWHERE << " ERROR: Can't find SvtxVertexMap." << endl;
    return Fun4AllReturnCodes::ABORTEVENT;
  }
  
  if (verbosity >= 0) {
    cout << "=================== PHG4SvtxBeamSpotReco::InitRun() =======================" << endl;
    cout << " CVS Version: $Id: PHG4SvtxBeamSpotReco.C,v 1.5 2015/04/21 23:47:09 pinkenbu Exp $" << endl;
    cout << " Storing cumulative beam spot location under PAR/SVTX/SvtxBeamSpot" << endl;
    cout << "===========================================================================" << endl;
  }

  return Fun4AllReturnCodes::EVENT_OK;
}
Beispiel #6
0
int PHPythia8::create_node_tree(PHCompositeNode *topNode) {

  PHCompositeNode *dstNode;
  PHNodeIterator iter(topNode);

  dstNode = dynamic_cast<PHCompositeNode*>(iter.findFirst("PHCompositeNode", "DST"));
  if (!dstNode) {
    cout << PHWHERE << "DST Node missing doing nothing" << endl;
    return Fun4AllReturnCodes::ABORTRUN;
  }

  _phhepmcevt = new PHHepMCGenEvent();
  PHObjectNode_t *newNode = new PHObjectNode_t(_phhepmcevt,_node_name.c_str(),"PHObject");
  dstNode->addNode(newNode);

  return Fun4AllReturnCodes::EVENT_OK;
}
int PHG4HoughTransform::CreateNodes(PHCompositeNode* topNode) {
  // create nodes...
  PHNodeIterator iter(topNode);

  PHCompositeNode* dstNode =
    static_cast<PHCompositeNode*>(iter.findFirst("PHCompositeNode", "DST"));
  if (!dstNode) {
    cerr << PHWHERE << "DST Node missing, doing nothing." << endl;
    return Fun4AllReturnCodes::ABORTEVENT;
  }
  PHNodeIterator iter_dst(dstNode);

  // Create the SVTX node
  PHCompositeNode* tb_node =
    dynamic_cast<PHCompositeNode*>(iter_dst.findFirst("PHCompositeNode", "SVTX"));
  if (!tb_node) {
    tb_node = new PHCompositeNode("SVTX");
    dstNode->addNode(tb_node);
    if (verbosity > 0) cout << "SVTX node added" << endl;
  }

  _g4tracks = new SvtxTrackMap_v1;
  PHIODataNode<PHObject>* tracks_node =
    new PHIODataNode<PHObject>(_g4tracks, "SvtxTrackMap", "PHObject");
  tb_node->addNode(tracks_node);
  if (verbosity > 0) cout << "Svtx/SvtxTrackMap node added" << endl;

  _g4vertexes = new SvtxVertexMap_v1;
  PHIODataNode<PHObject>* vertexes_node =
    new PHIODataNode<PHObject>(_g4vertexes, "SvtxVertexMap", "PHObject");
  tb_node->addNode(vertexes_node);
  if (verbosity > 0) cout << "Svtx/SvtxVertexMap node added" << endl;

  /*
  PHG4CylinderGeomContainer* geoms =
    findNode::getClass<PHG4CylinderGeomContainer>(topNode, "CYLINDERGEOM_SVTX");
  if (!geoms) {
    cerr << PHWHERE << " ERROR: Can't find CYLINDERGEOM_SVTX Node." << endl;
    return Fun4AllReturnCodes::ABORTEVENT;
  }
  */

  return InitializeGeometry(topNode);
}
Beispiel #8
0
int PHPythia8::CreateNodeTree(PHCompositeNode *topNode)
{

  PHCompositeNode *dstNode;
  PHNodeIterator iter(topNode);

  dstNode = dynamic_cast<PHCompositeNode*>(iter.findFirst("PHCompositeNode", "DST"));
  if (!dstNode)
    {
      cout << PHWHERE << "DST Node missing doing nothing" << endl;
      return -1;
    }

  if(_isHepMC)
    {
      //PHIODataNode<HepMC::GenEvent> *newNode = new PHIODataNode<>(phhepmcevt,"HEPMC","GenEvent");
      phhepmcevt = new PHHepMCGenEvent();
      PHObjectNode_t *newNode = new PHObjectNode_t(phhepmcevt,"PHHepMCGenEvent","PHObject");
      dstNode->addNode(newNode);
    }
  else{
        
    //-* pythia header information
    phpythiaheader = new PHPythiaHeaderV2();
    PHObjectNode_t *PHPythiaHeaderNode = new PHObjectNode_t(phpythiaheader, "PHPythiaHeader", "PHObject");
    dstNode->addNode(PHPythiaHeaderNode);
    
    //-* pythia particle information
    phpythia = new PHPythiaContainerV2(true);
    PHObjectNode_t *PHPythiaNode = new PHObjectNode_t(phpythia, "PHPythia", "PHObject");
    dstNode->addNode(PHPythiaNode);
  } 


  return 0;
}
Beispiel #9
0
int CaloTriggerSim::CreateNode(PHCompositeNode *topNode)
{
  PHNodeIterator iter(topNode);

  // Looking for the DST node
  PHCompositeNode *dstNode = dynamic_cast<PHCompositeNode *>(iter.findFirst("PHCompositeNode", "DST"));
  if (!dstNode)
  {
    std::cout << PHWHERE << "DST Node missing, doing nothing." << std::endl;
    return Fun4AllReturnCodes::ABORTRUN;
  }

  // store the trigger stuff under a sub-node directory
  PHCompositeNode *trigNode = dynamic_cast<PHCompositeNode *>(iter.findFirst("PHCompositeNode", "TRIG"));
  if (!trigNode)
  {
    trigNode = new PHCompositeNode("TRIG");
    dstNode->addNode(trigNode);
  }

  // create the CaloTriggerInfo
  CaloTriggerInfo *triggerinfo = findNode::getClass<CaloTriggerInfo>(topNode, !_emulate_truncation ? "CaloTriggerInfo" : "CaloTriggerInfo_Truncate" );
  if (!triggerinfo)
  {
    triggerinfo = new CaloTriggerInfo_v1();
    PHIODataNode<PHObject> *TriggerNode = new PHIODataNode<PHObject>(triggerinfo, !_emulate_truncation ? "CaloTriggerInfo" : "CaloTriggerInfo_Truncate", "PHObject");
    trigNode->addNode(TriggerNode);
  }
  else
  {
    std::cout << PHWHERE << "::ERROR - CaloTriggerInfo pre-exists, but should not" << std::endl;
    exit(-1);
  }

  return Fun4AllReturnCodes::EVENT_OK;
}
Beispiel #10
0
//_______________________________________
void
CaloCalibration::CreateNodeTree(PHCompositeNode *topNode)
{
  PHNodeIterator iter(topNode);

  PHCompositeNode *dstNode = dynamic_cast<PHCompositeNode*>(iter.findFirst(
      "PHCompositeNode", "DST"));
  if (!dstNode)
    {
      std::cerr << Name() << "::" << detector << "::" << __PRETTY_FUNCTION__
          << "DST Node missing, doing nothing." << std::endl;
      throw std::runtime_error(
          "Failed to find DST node in RawTowerCalibration::CreateNodes");
    }

  RawTowerNodeName = "TOWER_" + _raw_tower_node_prefix + "_" + detector;
  _raw_towers = findNode::getClass<RawTowerContainer>(dstNode,
      RawTowerNodeName.c_str());
  if (!_raw_towers)
    {
      std::cerr << Name() << "::" << detector << "::" << __PRETTY_FUNCTION__
          << " " << RawTowerNodeName << " Node missing, doing bail out!"
          << std::endl;
      throw std::runtime_error(
          "Failed to find " + RawTowerNodeName
              + " node in RawTowerCalibration::CreateNodes");
    }

  // Create the tower nodes on the tree
  PHNodeIterator dstiter(dstNode);
  PHCompositeNode *DetNode = dynamic_cast<PHCompositeNode*>(dstiter.findFirst(
      "PHCompositeNode", detector));
  if (!DetNode)
    {
      DetNode = new PHCompositeNode(detector);
      dstNode->addNode(DetNode);
    }

  // Be careful as a previous calibrator may have been registered for this detector
  CaliTowerNodeName = "TOWER_" + _calib_tower_node_prefix + "_" + detector;
  _calib_towers = findNode::getClass<RawTowerContainer>(DetNode,
      CaliTowerNodeName.c_str());
  if (!_calib_towers)
    {
      _calib_towers = new RawTowerContainer(_raw_towers->getCalorimeterID());
      PHIODataNode<PHObject> *towerNode = new PHIODataNode<PHObject>(
          _calib_towers, CaliTowerNodeName.c_str(), "PHObject");
      DetNode->addNode(towerNode);
    }

  // update the parameters on the node tree
  PHCompositeNode *parNode = dynamic_cast<PHCompositeNode*>(iter.findFirst(
      "PHCompositeNode", "RUN"));
  assert(parNode);
  const string paramnodename = string("Calibration_") + detector;

  //   this step is moved to after detector construction
  //   save updated persistant copy on node tree
  _calib_params.SaveToNodeTree(parNode, paramnodename);

}
//! global initialization
int
saModuleSngmuonMing::init(PHCompositeNode *topNode, sa_hist_mangager_ptr hm)
{

  //add a new node to output DST
  // make the flag node which is syncronized with cut on picodst_object
  PHCompositeNode* dstNode = NULL;
  PHNodeIterator nodeItr(topNode);
  dstNode = static_cast<PHCompositeNode*>(nodeItr.findFirst("PHCompositeNode",
      "DST"));
  if (!dstNode)
    {
      dstNode = new PHCompositeNode("DST");
      topNode->addNode(dstNode);
    }
  saFlagC *flags = new saFlagC();
  if (flags)
    {
      // make a new flag node called DST/SimpleDimuonFlag
      PHIODataNode<PHObject> * node = new PHIODataNode<PHObject>(flags,
          "SngmuonFlag", "PHObject");

      if (!node)
        {
          cout
              << "saModuleSngmuon::Init failed to create saEventProperty Node"
              << endl;
          return ABORTRUN;
        }
      else
        {
          dstNode->addNode(node);
          cout << "saFlag Node is added with version " << flags->ClassName()
              << " as " << node->getName() << endl;
        }
    }
  else
    {
      cout << "saModuleSngmuonMing::Init failed to create saEventProperty"
          << endl;
      return ABORTRUN;
    }


  // --- define user hisotgrams ---

  //
  // -- general event and/or track quality histograms 
  //

  TH1F * h_ST1Z_N = new TH1F("SngMuon_ST1Z_N", "Single muon St1-Z; ", 400, 180, 200);
  _h_ST1Z_N = new saHist(
      //
      h_ST1Z_N, //the template histogram, any TH1 and derivatives is accepted
      saHist::EVENT_PROPERTY, // flags
      Verbosity() // verbosity
      );
  hm.get()->registerHisto(_h_ST1Z_N);

  TH1F * h_ST1Z_S = new TH1F("SngMuon_ST1Z_S", "Single muon St1-Z; ", 400, -200, -180);
  _h_ST1Z_S = new saHist(
      //
      h_ST1Z_S, //the template histogram, any TH1 and derivatives is accepted
      saHist::EVENT_PROPERTY, // flags
      Verbosity() // verbosity
      );
  hm.get()->registerHisto(_h_ST1Z_S);



  // ST-1 multiple scatering angle 
  TH1F * h_dA = new TH1F("SngMuon_dA", "Single muon dA; ", 100, -1, 1);
  _h_dA = new saHist(
      //
      h_dA, //the template histogram, any TH1 and derivatives is accepted
      saHist::EVENT_PROPERTY | saHist::FILL_PROPERTY, // flags
      Verbosity() // verbosity
      );
  hm.get()->registerHisto(_h_dA);

  TH2F * h2_dA = new TH2F("SngMuon_dA2", "Single muon dA vs pz; ", 200, -50, 50, 100, 0.0, 0.5);
  _h2_dA = new saHist(
      //
      h2_dA, //the template histogram, any TH1 and derivatives is accepted
      saHist::EVENT_PROPERTY | saHist::FILL_PROPERTY, // flags
      Verbosity() // verbosity
      );
  hm.get()->registerHisto(_h2_dA);

  // ST-1 <phi-1>
  TH1F * h_phi_1N = new TH1F("SngMuon_phi_1N", "North Single muon ST-1 Phi; ", 200, -4, 4);
  _h_phi_1N = new saHist(
      //
      h_phi_1N, //the template histogram, any TH1 and derivatives is accepted
      saHist::EVENT_PROPERTY | saHist::FILL_PROPERTY, // flags
      Verbosity() // verbosity
      );
  hm.get()->registerHisto(_h_phi_1N);

  TH1F * h_phi_1S = new TH1F("SngMuon_phi_1S", "South Single muon ST-1 Phi; ", 200, -4, 4);
  _h_phi_1S = new saHist(
      //
      h_phi_1S, //the template histogram, any TH1 and derivatives is accepted
      saHist::EVENT_PROPERTY | saHist::FILL_PROPERTY, // flags
      Verbosity() // verbosity
      );
  hm.get()->registerHisto(_h_phi_1S);



  // ST-2 <phi-2>
  TH1F * h_phi_2N = new TH1F("SngMuon_phi_2N", "North Single muon ST-2 Phi; ", 200, -4, 4);
  _h_phi_2N = new saHist(
      //
      h_phi_2N, //the template histogram, any TH1 and derivatives is accepted
      saHist::EVENT_PROPERTY | saHist::FILL_PROPERTY, // flags
      Verbosity() // verbosity
      );
  hm.get()->registerHisto(_h_phi_2N);

  TH1F * h_phi_2S = new TH1F("SngMuon_phi_2S", "South Single muon ST-2 Phi; ", 200, -4, 4);
  _h_phi_2S = new saHist(
      //
      h_phi_2S, //the template histogram, any TH1 and derivatives is accepted
      saHist::EVENT_PROPERTY | saHist::FILL_PROPERTY, // flags
      Verbosity() // verbosity
      );
  hm.get()->registerHisto(_h_phi_2S);


  // ST-3 <phi-3>
  TH1F * h_phi_3N = new TH1F("SngMuon_phi_3N", "North Single muon ST-3 Phi; ", 200, -4, 4);
  _h_phi_3N = new saHist(
      //
      h_phi_3N, //the template histogram, any TH1 and derivatives is accepted
      saHist::EVENT_PROPERTY | saHist::FILL_PROPERTY, // flags
      Verbosity() // verbosity
      );
  hm.get()->registerHisto(_h_phi_3N);

  TH1F * h_phi_3S = new TH1F("SngMuon_phi_3S", "North Single muon ST-3 Phi; ", 200, -4, 4);
  _h_phi_3S = new saHist(
      //
      h_phi_3S, //the template histogram, any TH1 and derivatives is accepted
      saHist::EVENT_PROPERTY | saHist::FILL_PROPERTY, // flags
      Verbosity() // verbosity
      );
  hm.get()->registerHisto(_h_phi_3S);



  // ST-1-3 <phi-1-3>
  TH1F * h_phi_13N = new TH1F("SngMuon_phi_13N", "North Single muon ST-13 dPhi; ", 100, -0.5, 0.5);
  _h_phi_13N = new saHist(
      //
      h_phi_13N, //the template histogram, any TH1 and derivatives is accepted
      saHist::EVENT_PROPERTY | saHist::FILL_PROPERTY, // flags
      Verbosity() // verbosity
      );
  hm.get()->registerHisto(_h_phi_13N);

  TH1F * h_phi_13S = new TH1F("SngMuon_phi_13S", "South Single muon ST-13 dPhi; ", 100, -0.5, 0.5);
  _h_phi_13S = new saHist(
      //
      h_phi_13S, //the template histogram, any TH1 and derivatives is accepted
      saHist::EVENT_PROPERTY | saHist::FILL_PROPERTY, // flags
      Verbosity() // verbosity
      );
  hm.get()->registerHisto(_h_phi_13S);


  // ST-2-3 <phi-2-3>
  TH1F * h_phi_23N = new TH1F("SngMuon_phi_23N", "North Single muon ST-23 dPhi; ", 100, -0.5, 0.5);
  _h_phi_23N = new saHist(
      //
      h_phi_23N, //the template histogram, any TH1 and derivatives is accepted
      saHist::EVENT_PROPERTY | saHist::FILL_PROPERTY, // flags
      Verbosity() // verbosity
      );
  hm.get()->registerHisto(_h_phi_23N);

  TH1F * h_phi_23S = new TH1F("SngMuon_phi_23S", "South Single muon ST-23 dPhi; ", 100, -0.5, 0.5);
  _h_phi_23S = new saHist(
      //
      h_phi_23S, //the template histogram, any TH1 and derivatives is accepted
      saHist::EVENT_PROPERTY | saHist::FILL_PROPERTY, // flags
      Verbosity() // verbosity
      );
  hm.get()->registerHisto(_h_phi_23S);


  // -- 2D plots vs pZ ST-1-3
  TH2F * h2_phi_13N = new TH2F("SngMuon_phi_13N2", "North Single muon pZ*dPhi-13 vs pZ; ", 200, -50, 50,  100, 0, 5);
  _h2_phi_13N = new saHist(
      //
      h2_phi_13N, //the template histogram, any TH1 and derivatives is accepted
      saHist::EVENT_PROPERTY | saHist::FILL_PROPERTY, // flags
      Verbosity() // verbosity
      );
  hm.get()->registerHisto(_h2_phi_13N);

  TH2F * h2_phi_13S = new TH2F("SngMuon_phi_13S2", "South Single muon pZ*dPhi-13  vs pZ; ", 200, -50, 50,  100, 0, 5);
  _h2_phi_13S = new saHist(
      //
      h2_phi_13S, //the template histogram, any TH1 and derivatives is accepted
      saHist::EVENT_PROPERTY | saHist::FILL_PROPERTY, // flags
      Verbosity() // verbosity
      );
  hm.get()->registerHisto(_h2_phi_13S);

  // -- 2D plots vs pZ ST-2-3
  TH2F * h2_phi_23N = new TH2F("SngMuon_phi_23N2", "North Single muon pZ*dPhi-23 vs pZ; ", 200, -50, 50,  100, 0, 5);
  _h2_phi_23N = new saHist(
      //
      h2_phi_23N, //the template histogram, any TH1 and derivatives is accepted
      saHist::EVENT_PROPERTY | saHist::FILL_PROPERTY, // flags
      Verbosity() // verbosity
      );
  hm.get()->registerHisto(_h2_phi_23N);

  TH2F * h2_phi_23S = new TH2F("SngMuon_phi_23S2", "South Single muon pZ*dPhi-23 vs pZ; ", 200, -50, 50,  100, 0, 5);
  _h2_phi_23S = new saHist(
      //
      h2_phi_23S, //the template histogram, any TH1 and derivatives is accepted
      saHist::EVENT_PROPERTY | saHist::FILL_PROPERTY, // flags
      Verbosity() // verbosity
      );
  hm.get()->registerHisto(_h2_phi_23S);




  // -- RPC1
  TH1F * h_Rpc1DCA_N = new TH1F("SngMuonRPC1_DCA_N", "Single muon North RPC1 DCA; ", 150, -5, 10);
  _h_Rpc1DCA_N = new saHist(
      //
      h_Rpc1DCA_N, //the template histogram, any TH1 and derivatives is accepted
      saHist::EVENT_PROPERTY | saHist::FILL_PROPERTY, // flags
      Verbosity() // verbosity
      );
  hm.get()->registerHisto(_h_Rpc1DCA_N);

  TH1F * h_Rpc1DCA_S = new TH1F("SngMuonRPC1_DCA_S", "Single muon South RPC1 DCA; ", 150, -5, 10);
  _h_Rpc1DCA_S = new saHist(
      //
      h_Rpc1DCA_S, //the template histogram, any TH1 and derivatives is accepted
      saHist::EVENT_PROPERTY | saHist::FILL_PROPERTY, // flags
      Verbosity() // verbosity
      );
  hm.get()->registerHisto(_h_Rpc1DCA_S);

  // --- RPC3 
  TH1F * h_Rpc3DCA_N = new TH1F("SngMuonRPC3_DCA_N", "Single muon North RPC3 DCA; ", 100, -10, 100);
  _h_Rpc3DCA_N = new saHist(
      //
      h_Rpc3DCA_N, //the template histogram, any TH1 and derivatives is accepted
      saHist::EVENT_PROPERTY | saHist::FILL_PROPERTY, // flags
      Verbosity() // verbosity
      );
  hm.get()->registerHisto(_h_Rpc3DCA_N);

  TH1F * h_Rpc3DCA_S = new TH1F("SngMuonRPC3_DCA_S", "Single muon South RPC3 DCA; ", 100, -10, 100);
  _h_Rpc3DCA_S = new saHist(
      //
      h_Rpc3DCA_S, //the template histogram, any TH1 and derivatives is accepted
      saHist::EVENT_PROPERTY | saHist::FILL_PROPERTY, // flags
      Verbosity() // verbosity
      );
  hm.get()->registerHisto(_h_Rpc3DCA_S);


  //
  // --- for comparision with run11/12 style W->muon analysis 
  //

  TH1F * h_dw23N_p = new TH1F("SngMuon_dw23N_p", "North (+) SingleMuon dw23", 100, -1, 1);
  _h_dw23N_p = new saHist(
      //
      h_dw23N_p, //the template histogram, any TH1 and derivatives is accepted
      saHist::EVENT_PROPERTY | saHist::FILL_PROPERTY, // flags
      Verbosity() // verbosity
      );
  hm.get()->registerHisto(_h_dw23N_p);

  TH1F * h_dw23N_m = new TH1F("SngMuon_dw23N_m", "North (-) SingleMuon dw23", 100, -1, 1);
  _h_dw23N_m = new saHist(
      //
      h_dw23N_m, //the template histogram, any TH1 and derivatives is accepted
      saHist::EVENT_PROPERTY | saHist::FILL_PROPERTY, // flags
      Verbosity() // verbosity
      );
  hm.get()->registerHisto(_h_dw23N_m);



  TH1F * h_dw23S_p = new TH1F("SngMuon_dw23S_p", "South (+) SingleMuon dw23", 100, -1, 1);
  _h_dw23S_p = new saHist(
      //
      h_dw23S_p, //the template histogram, any TH1 and derivatives is accepted
      saHist::EVENT_PROPERTY | saHist::FILL_PROPERTY, // flags
      Verbosity() // verbosity
      );
  hm.get()->registerHisto(_h_dw23S_p);

  TH1F * h_dw23S_m = new TH1F("SngMuon_dw23S_m", "South (-) SingleMuon dw23", 100, -1, 1);
  _h_dw23S_m = new saHist(
      //
      h_dw23S_m, //the template histogram, any TH1 and derivatives is accepted
      saHist::EVENT_PROPERTY | saHist::FILL_PROPERTY, // flags
      Verbosity() // verbosity
      );
  hm.get()->registerHisto(_h_dw23S_m);

  // pT > 10 

  TH1F * h_dw23N_PT10_p = new TH1F("SngMuon_dw23N_PT10_p", "North (+) pT> 10 SingleMuon dw23", 100, -1, 1);
  _h_dw23N_PT10_p = new saHist(
      //
      h_dw23N_PT10_p, //the template histogram, any TH1 and derivatives is accepted
      saHist::EVENT_PROPERTY | saHist::FILL_PROPERTY, // flags
      Verbosity() // verbosity
      );
  hm.get()->registerHisto(_h_dw23N_PT10_p);

  TH1F * h_dw23N_PT10_m = new TH1F("SngMuon_dw23N_PT10_m", "North (-) pT> 10 SingleMuon dw23", 100, -1, 1);
  _h_dw23N_PT10_m = new saHist(
      //
      h_dw23N_PT10_m, //the template histogram, any TH1 and derivatives is accepted
      saHist::EVENT_PROPERTY | saHist::FILL_PROPERTY, // flags
      Verbosity() // verbosity
      );
  hm.get()->registerHisto(_h_dw23N_PT10_m);



  TH1F * h_dw23S_PT10_p = new TH1F("SngMuon_dw23S_PT10_p", "South (+) pT> 10 SingleMuon dw23", 100, -1, 1);
  _h_dw23S_PT10_p = new saHist(
      //
      h_dw23S_PT10_p, //the template histogram, any TH1 and derivatives is accepted
      saHist::EVENT_PROPERTY | saHist::FILL_PROPERTY, // flags
      Verbosity() // verbosity
      );
  hm.get()->registerHisto(_h_dw23S_PT10_p);

  TH1F * h_dw23S_PT10_m = new TH1F("SngMuon_dw23S_PT10_m", "South (-) pT>10 SingleMuon dw23", 100, -1, 1);
  _h_dw23S_PT10_m = new saHist(
      //
      h_dw23S_PT10_m, //the template histogram, any TH1 and derivatives is accepted
      saHist::EVENT_PROPERTY | saHist::FILL_PROPERTY, // flags
      Verbosity() // verbosity
      );
  hm.get()->registerHisto(_h_dw23S_PT10_m);

  // pT > 15 

  TH1F * h_dw23N_PT15_p = new TH1F("SngMuon_dw23N_PT15_p", "North (+) pT> 10 SingleMuon dw23", 100, -1, 1);
  _h_dw23N_PT15_p = new saHist(
      //
      h_dw23N_PT15_p, //the template histogram, any TH1 and derivatives is accepted
      saHist::EVENT_PROPERTY | saHist::FILL_PROPERTY, // flags
      Verbosity() // verbosity
      );
  hm.get()->registerHisto(_h_dw23N_PT15_p);

  TH1F * h_dw23N_PT15_m = new TH1F("SngMuon_dw23N_PT15_m", "North (-) pT> 10 SingleMuon dw23", 100, -1, 1);
  _h_dw23N_PT15_m = new saHist(
      //
      h_dw23N_PT15_m, //the template histogram, any TH1 and derivatives is accepted
      saHist::EVENT_PROPERTY | saHist::FILL_PROPERTY, // flags
      Verbosity() // verbosity
      );
  hm.get()->registerHisto(_h_dw23N_PT15_m);



  TH1F * h_dw23S_PT15_p = new TH1F("SngMuon_dw23S_PT15_p", "South (+) pT> 10 SingleMuon dw23", 100, -1, 1);
  _h_dw23S_PT15_p = new saHist(
      //
      h_dw23S_PT15_p, //the template histogram, any TH1 and derivatives is accepted
      saHist::EVENT_PROPERTY | saHist::FILL_PROPERTY, // flags
      Verbosity() // verbosity
      );
  hm.get()->registerHisto(_h_dw23S_PT15_p);

  TH1F * h_dw23S_PT15_m = new TH1F("SngMuon_dw23S_PT15_m", "South (-) pT>10 SingleMuon dw23", 100, -1, 1);
  _h_dw23S_PT15_m = new saHist(
      //
      h_dw23S_PT15_m, //the template histogram, any TH1 and derivatives is accepted
      saHist::EVENT_PROPERTY | saHist::FILL_PROPERTY, // flags
      Verbosity() // verbosity
      );
  hm.get()->registerHisto(_h_dw23S_PT15_m);

  // pT > 20 

  TH1F * h_dw23N_PT20_p = new TH1F("SngMuon_dw23N_PT20_p", "North (+) pT> 10 SingleMuon dw23", 100, -1, 1);
  _h_dw23N_PT20_p = new saHist(
      //
      h_dw23N_PT20_p, //the template histogram, any TH1 and derivatives is accepted
      saHist::EVENT_PROPERTY | saHist::FILL_PROPERTY, // flags
      Verbosity() // verbosity
      );
  hm.get()->registerHisto(_h_dw23N_PT20_p);

  TH1F * h_dw23N_PT20_m = new TH1F("SngMuon_dw23N_PT20_m", "North (-) pT> 10 SingleMuon dw23", 100, -1, 1);
  _h_dw23N_PT20_m = new saHist(
      //
      h_dw23N_PT20_m, //the template histogram, any TH1 and derivatives is accepted
      saHist::EVENT_PROPERTY | saHist::FILL_PROPERTY, // flags
      Verbosity() // verbosity
      );
  hm.get()->registerHisto(_h_dw23N_PT20_m);



  TH1F * h_dw23S_PT20_p = new TH1F("SngMuon_dw23S_PT20_p", "South (+) pT> 10 SingleMuon dw23", 100, -1, 1);
  _h_dw23S_PT20_p = new saHist(
      //
      h_dw23S_PT20_p, //the template histogram, any TH1 and derivatives is accepted
      saHist::EVENT_PROPERTY | saHist::FILL_PROPERTY, // flags
      Verbosity() // verbosity
      );
  hm.get()->registerHisto(_h_dw23S_PT20_p);

  TH1F * h_dw23S_PT20_m = new TH1F("SngMuon_dw23S_PT20_m", "South (-) pT>10 SingleMuon dw23", 100, -1, 1);
  _h_dw23S_PT20_m = new saHist(
      //
      h_dw23S_PT20_m, //the template histogram, any TH1 and derivatives is accepted
      saHist::EVENT_PROPERTY | saHist::FILL_PROPERTY, // flags
      Verbosity() // verbosity
      );
  hm.get()->registerHisto(_h_dw23S_PT20_m);




  //
  // --- histograms for spin asymmetry study ----
  //

  //-- Single Muon pT (+,-) 
  TH1F * h_pT = new TH1F("SngMuonPT", "Single muon pT; pT (GeV)", 20, 1, 10);
  _h_pT = new saHist(
      //
      h_pT, //the template histogram, any TH1 and derivatives is accepted
      saHist::DEFAULT_FLAG | saHist::RUN_PROPERTY | saHist::FILL_PROPERTY
          | saHist::CROSSING_CHECKS, // flags
      Verbosity() // verbosity
      );
  hm.get()->registerHisto(_h_pT);

  // --- north ---
  TH1F * h_pT_n = new TH1F("SngMuonPTN", "North Single Muon pT; pT (GeV)", 20, 1, 10);
  _h_pT_n = new saHist(
      //
      h_pT_n, //the template histogram, any TH1 and derivatives is accepted
      saHist::DEFAULT_FLAG | saHist::RUN_PROPERTY | saHist::FILL_PROPERTY
          | saHist::CROSSING_CHECKS, // flags
      Verbosity() // verbosity
      );
  hm.get()->registerHisto(_h_pT_n);

  // --- south ---
  TH1F * h_pT_s = new TH1F("SngMuonPTS", "South Single Muon pT; pT (GeV)", 20, 1, 10);
  _h_pT_s = new saHist(
      //
      h_pT_s, //the template histogram, any TH1 and derivatives is accepted
      saHist::DEFAULT_FLAG | saHist::RUN_PROPERTY | saHist::FILL_PROPERTY
          | saHist::CROSSING_CHECKS, // flags
      Verbosity() // verbosity
      );
  hm.get()->registerHisto(_h_pT_s);


  //-- Single Muon pT (+)
  TH1F * h_pT_p = new TH1F("SngMuonPTp", "Single muon (+) pT; pT (GeV)", 20, 1, 10);
  _h_pT_p = new saHist(
      //
      h_pT_p, //the template histogram, any TH1 and derivatives is accepted
      saHist::DEFAULT_FLAG | saHist::RUN_PROPERTY | saHist::FILL_PROPERTY
          | saHist::CROSSING_CHECKS, // flags
      Verbosity() // verbosity
      );
  hm.get()->registerHisto(_h_pT_p);

  // --- north ---
  TH1F * h_pT_p_n = new TH1F("SngMuonPTpN", "North Single Muon (+)pT; pT (GeV)", 20, 1, 10);
  _h_pT_p_n = new saHist(
      //
      h_pT_p_n, //the template histogram, any TH1 and derivatives is accepted
      saHist::DEFAULT_FLAG | saHist::RUN_PROPERTY | saHist::FILL_PROPERTY
          | saHist::CROSSING_CHECKS, // flags
      Verbosity() // verbosity
      );
  hm.get()->registerHisto(_h_pT_p_n);

  // --- south ---
  TH1F * h_pT_p_s = new TH1F("SngMuonPTpS", "South Single Muon (+)pT; pT (GeV)", 20, 1, 10);
  _h_pT_p_s = new saHist(
      //
      h_pT_p_s, //the template histogram, any TH1 and derivatives is accepted
      saHist::DEFAULT_FLAG | saHist::RUN_PROPERTY | saHist::FILL_PROPERTY
          | saHist::CROSSING_CHECKS, // flags
      Verbosity() // verbosity
      );
  hm.get()->registerHisto(_h_pT_p_s);


  //-- Single Muon pT (-)
  TH1F * h_pT_m = new TH1F("SngMuonPTm", "Single muon (-) pT; pT (GeV)", 20, 1, 10);
  _h_pT_m = new saHist(
      //
      h_pT_m, //the template histogram, any TH1 and derivatives is accepted
      saHist::DEFAULT_FLAG | saHist::RUN_PROPERTY | saHist::FILL_PROPERTY
          | saHist::CROSSING_CHECKS, // flags
      Verbosity() // verbosity
      );
  hm.get()->registerHisto(_h_pT_m);

  // --- north ---
  TH1F * h_pT_m_n = new TH1F("SngMuonPTmN", "North Single Muon (-)pT; pT (GeV)", 20, 1, 10);
  _h_pT_m_n = new saHist(
      //
      h_pT_m_n, //the template histogram, any TH1 and derivatives is accepted
      saHist::DEFAULT_FLAG | saHist::RUN_PROPERTY | saHist::FILL_PROPERTY
          | saHist::CROSSING_CHECKS, // flags
      Verbosity() // verbosity
      );
  hm.get()->registerHisto(_h_pT_m_n);

  // --- south ---
  TH1F * h_pT_m_s = new TH1F("SngMuonPTmS", "South Single Muon (-)pT; pT (GeV)", 20, 1, 10);
  _h_pT_m_s = new saHist(
      //
      h_pT_m_s, //the template histogram, any TH1 and derivatives is accepted
      saHist::DEFAULT_FLAG | saHist::RUN_PROPERTY | saHist::FILL_PROPERTY
          | saHist::CROSSING_CHECKS, // flags
      Verbosity() // verbosity
      );
  hm.get()->registerHisto(_h_pT_m_s);


  //
  //--- stopped hadrons -------------------------------
  //


  //-- Stoped Hadron pT (+,-) 
  TH1F * h_pTH = new TH1F("SngHadronPT", "Single hadron pT; pT (GeV)", 20, 1, 10);
  _h_pTH = new saHist(
      //
      h_pTH, //the template histogram, any TH1 and derivatives is accepted
      saHist::DEFAULT_FLAG | saHist::RUN_PROPERTY | saHist::FILL_PROPERTY
          | saHist::CROSSING_CHECKS, // flags
      Verbosity() // verbosity
      );
  hm.get()->registerHisto(_h_pTH);

  // --- north ---
  TH1F * h_pTH_n = new TH1F("SngHadronPTN", "North Single Hadron pT; pT (GeV)", 20, 1, 10);
  _h_pTH_n = new saHist(
      //
      h_pTH_n, //the template histogram, any TH1 and derivatives is accepted
      saHist::DEFAULT_FLAG | saHist::RUN_PROPERTY | saHist::FILL_PROPERTY
          | saHist::CROSSING_CHECKS, // flags
      Verbosity() // verbosity
      );
  hm.get()->registerHisto(_h_pTH_n);

  // --- south ---
  TH1F * h_pTH_s = new TH1F("SngHadronPTS", "South Single Hadron pT; pT (GeV)", 20, 1, 10);
  _h_pTH_s = new saHist(
      //
      h_pTH_s, //the template histogram, any TH1 and derivatives is accepted
      saHist::DEFAULT_FLAG | saHist::RUN_PROPERTY | saHist::FILL_PROPERTY
          | saHist::CROSSING_CHECKS, // flags
      Verbosity() // verbosity
      );
  hm.get()->registerHisto(_h_pTH_s);


  //-- Single Hadron pT (+)
  TH1F * h_pTH_p = new TH1F("SngHadronPTp", "Single Hadron (+) pT; pT (GeV)", 20, 1, 10);
  _h_pTH_p = new saHist(
      //
      h_pTH_p, //the template histogram, any TH1 and derivatives is accepted
      saHist::DEFAULT_FLAG | saHist::RUN_PROPERTY | saHist::FILL_PROPERTY
          | saHist::CROSSING_CHECKS, // flags
      Verbosity() // verbosity
      );
  hm.get()->registerHisto(_h_pTH_p);

  // --- north ---
  TH1F * h_pTH_p_n = new TH1F("SngHadronPTpN", "North Single Hadron (+)pT; pT (GeV)", 20, 1, 10);
  _h_pTH_p_n = new saHist(
      //
      h_pTH_p_n, //the template histogram, any TH1 and derivatives is accepted
      saHist::DEFAULT_FLAG | saHist::RUN_PROPERTY | saHist::FILL_PROPERTY
          | saHist::CROSSING_CHECKS, // flags
      Verbosity() // verbosity
      );
  hm.get()->registerHisto(_h_pTH_p_n);

  // --- south ---
  TH1F * h_pTH_p_s = new TH1F("SngHadronPTpS", "South Single Hadron (+)pT; pT (GeV)", 20, 1, 10);
  _h_pTH_p_s = new saHist(
      //
      h_pTH_p_s, //the template histogram, any TH1 and derivatives is accepted
      saHist::DEFAULT_FLAG | saHist::RUN_PROPERTY | saHist::FILL_PROPERTY
          | saHist::CROSSING_CHECKS, // flags
      Verbosity() // verbosity
      );
  hm.get()->registerHisto(_h_pTH_p_s);


  //-- Single Hadron pT (-)
  TH1F * h_pTH_m = new TH1F("SngHadronPTm", "Single Hadron (-) pT; pT (GeV)", 20, 1, 10);
  _h_pTH_m = new saHist(
      //
      h_pTH_m, //the template histogram, any TH1 and derivatives is accepted
      saHist::DEFAULT_FLAG | saHist::RUN_PROPERTY | saHist::FILL_PROPERTY
          | saHist::CROSSING_CHECKS, // flags
      Verbosity() // verbosity
      );
  hm.get()->registerHisto(_h_pTH_m);

  // --- north ---
  TH1F * h_pTH_m_n = new TH1F("SngHadronPTmN", "North Single Hadron (-)pT; pT (GeV)", 20, 1, 10);
  _h_pTH_m_n = new saHist(
      //
      h_pTH_m_n, //the template histogram, any TH1 and derivatives is accepted
      saHist::DEFAULT_FLAG | saHist::RUN_PROPERTY | saHist::FILL_PROPERTY
          | saHist::CROSSING_CHECKS, // flags
      Verbosity() // verbosity
      );
  hm.get()->registerHisto(_h_pTH_m_n);

  // --- south ---
  TH1F * h_pTH_m_s = new TH1F("SngHadronPTmS", "South Single Hadron (-)pT; pT (GeV)", 20, 1, 10);
  _h_pTH_m_s = new saHist(
      //
      h_pTH_m_s, //the template histogram, any TH1 and derivatives is accepted
      saHist::DEFAULT_FLAG | saHist::RUN_PROPERTY | saHist::FILL_PROPERTY
          | saHist::CROSSING_CHECKS, // flags
      Verbosity() // verbosity
      );
  hm.get()->registerHisto(_h_pTH_m_s);


  //
  // -------  single muon  rapidity --------
  //

  TH1F * h_eta = new TH1F("SngMuonEta", "Single Muon (+,-) Eta;  ", 12, -3, 3);
  _h_eta = new saHist(
      //
      h_eta, //the template histogram, any TH1 and derivatives is accepted
      saHist::DEFAULT_FLAG | saHist::RUN_PROPERTY | saHist::FILL_PROPERTY
          | saHist::CROSSING_CHECKS, // flags
      Verbosity() // verbosity
      );
  hm.get()->registerHisto(_h_eta);


  TH1F * h_eta_p = new TH1F("SngMuonEtap", "Single Muon (+) Eta; ", 12, -3, 3);
  _h_eta_p = new saHist(
      //
      h_eta_p, //the template histogram, any TH1 and derivatives is accepted
      saHist::DEFAULT_FLAG | saHist::RUN_PROPERTY | saHist::FILL_PROPERTY
          | saHist::CROSSING_CHECKS, // flags
      Verbosity() // verbosity
      );
  hm.get()->registerHisto(_h_eta_p);

  TH1F * h_eta_m = new TH1F("SngMuonEtam", "Single Muon (-) Eta;  ", 12, -3, 3);
  _h_eta_m = new saHist(
      //
      h_eta_m, //the template histogram, any TH1 and derivatives is accepted
      saHist::DEFAULT_FLAG | saHist::RUN_PROPERTY | saHist::FILL_PROPERTY
          | saHist::CROSSING_CHECKS, // flags
      Verbosity() // verbosity
      );
  hm.get()->registerHisto(_h_eta_m);

  //
  // ----  rapidity for W->muon pT > 10 GeV ---
  //

  TH1F * h_etaW10 = new TH1F("SngMuonEtaW10", "Single Muon (+,-) Eta, pT>10;  ", 12, -3, 3);
  _h_etaW10 = new saHist(
      //
      h_etaW10, //the template histogram, any TH1 and derivatives is accepted
      saHist::DEFAULT_FLAG | saHist::RUN_PROPERTY | saHist::FILL_PROPERTY
          | saHist::CROSSING_CHECKS, // flags
      Verbosity() // verbosity
      );
  hm.get()->registerHisto(_h_etaW10);


  TH1F * h_etaW10_p = new TH1F("SngMuonEtaW10p", "Single Muon (+) Eta; pT>10", 12, -3, 3);
  _h_etaW10_p = new saHist(
      //
      h_etaW10_p, //the template histogram, any TH1 and derivatives is accepted
      saHist::DEFAULT_FLAG | saHist::RUN_PROPERTY | saHist::FILL_PROPERTY
          | saHist::CROSSING_CHECKS, // flags
      Verbosity() // verbosity
      );
  hm.get()->registerHisto(_h_etaW10_p);

  TH1F * h_etaW10_m = new TH1F("SngMuonEtaW10m", "Single Muon (-) Eta; pT>10 ", 12, -3, 3);
  _h_etaW10_m = new saHist(
      //
      h_etaW10_m, //the template histogram, any TH1 and derivatives is accepted
      saHist::DEFAULT_FLAG | saHist::RUN_PROPERTY | saHist::FILL_PROPERTY
          | saHist::CROSSING_CHECKS, // flags
      Verbosity() // verbosity
      );
  hm.get()->registerHisto(_h_etaW10_m);

  // --- W->muon rapidity , pT>15 
  TH1F * h_etaW15 = new TH1F("SngMuonEtaW15", "Single Muon (+,-) Eta, pT>15;  ", 12, -3, 3);
  _h_etaW15 = new saHist(
      //
      h_etaW15, //the template histogram, any TH1 and derivatives is accepted
      saHist::DEFAULT_FLAG | saHist::RUN_PROPERTY | saHist::FILL_PROPERTY
          | saHist::CROSSING_CHECKS, // flags
      Verbosity() // verbosity
      );
  hm.get()->registerHisto(_h_etaW15);


  TH1F * h_etaW15_p = new TH1F("SngMuonEtaW15p", "Single Muon (+) Eta; pT>15", 12, -3, 3);
  _h_etaW15_p = new saHist(
      //
      h_etaW15_p, //the template histogram, any TH1 and derivatives is accepted
      saHist::DEFAULT_FLAG | saHist::RUN_PROPERTY | saHist::FILL_PROPERTY
          | saHist::CROSSING_CHECKS, // flags
      Verbosity() // verbosity
      );
  hm.get()->registerHisto(_h_etaW15_p);

  TH1F * h_etaW15_m = new TH1F("SngMuonEtaW15m", "Single Muon (-) Eta; pT>15 ", 12, -3, 3);
  _h_etaW15_m = new saHist(
      //
      h_etaW15_m, //the template histogram, any TH1 and derivatives is accepted
      saHist::DEFAULT_FLAG | saHist::RUN_PROPERTY | saHist::FILL_PROPERTY
          | saHist::CROSSING_CHECKS, // flags
      Verbosity() // verbosity
      );
  hm.get()->registerHisto(_h_etaW15_m);

  // --- W->muon rapidity , pT>20 
  TH1F * h_etaW20 = new TH1F("SngMuonEtaW20", "Single Muon (+,-) Eta, pT>20;  ", 12, -3, 3);
  _h_etaW20 = new saHist(
      //
      h_etaW20, //the template histogram, any TH1 and derivatives is accepted
      saHist::DEFAULT_FLAG | saHist::RUN_PROPERTY | saHist::FILL_PROPERTY
          | saHist::CROSSING_CHECKS, // flags
      Verbosity() // verbosity
      );
  hm.get()->registerHisto(_h_etaW20);


  TH1F * h_etaW20_p = new TH1F("SngMuonEtaW20p", "Single Muon (+) Eta; pT>20", 12, -3, 3);
  _h_etaW20_p = new saHist(
      //
      h_etaW20_p, //the template histogram, any TH1 and derivatives is accepted
      saHist::DEFAULT_FLAG | saHist::RUN_PROPERTY | saHist::FILL_PROPERTY
          | saHist::CROSSING_CHECKS, // flags
      Verbosity() // verbosity
      );
  hm.get()->registerHisto(_h_etaW20_p);

  TH1F * h_etaW20_m = new TH1F("SngMuonEtaW20m", "Single Muon (-) Eta; pT>20 ", 12, -3, 3);
  _h_etaW20_m = new saHist(
      //
      h_etaW20_m, //the template histogram, any TH1 and derivatives is accepted
      saHist::DEFAULT_FLAG | saHist::RUN_PROPERTY | saHist::FILL_PROPERTY
          | saHist::CROSSING_CHECKS, // flags
      Verbosity() // verbosity
      );
  hm.get()->registerHisto(_h_etaW20_m);

  //
  // --- stopped hadron rapidity ---
  //

  TH1F * h_etaH = new TH1F("SngHadronEta", "Single Hadron (+,-) Eta;  ", 12, -3, 3);
  _h_etaH = new saHist(
      //
      h_etaH, //the template histogram, any TH1 and derivatives is accepted
      saHist::DEFAULT_FLAG | saHist::RUN_PROPERTY | saHist::FILL_PROPERTY
          | saHist::CROSSING_CHECKS, // flags
      Verbosity() // verbosity
      );
  hm.get()->registerHisto(_h_etaH);


  TH1F * h_etaH_p = new TH1F("SngHadronEtap", "Single Hadron (+) Eta; ", 12, -3, 3);
  _h_etaH_p = new saHist(
      //
      h_etaH_p, //the template histogram, any TH1 and derivatives is accepted
      saHist::DEFAULT_FLAG | saHist::RUN_PROPERTY | saHist::FILL_PROPERTY
          | saHist::CROSSING_CHECKS, // flags
      Verbosity() // verbosity
      );
  hm.get()->registerHisto(_h_etaH_p);

  TH1F * h_etaH_m = new TH1F("SngHadronEtam", "Single Hadron (-) Eta;  ", 12, -3, 3);
  _h_etaH_m = new saHist(
      //
      h_etaH_m, //the template histogram, any TH1 and derivatives is accepted
      saHist::DEFAULT_FLAG | saHist::RUN_PROPERTY | saHist::FILL_PROPERTY 
          | saHist::CROSSING_CHECKS, // flags
      Verbosity() // verbosity
      );
  hm.get()->registerHisto(_h_etaH_m);



  return EVENT_OK;
}
//! global initialization
int saModuleDimuonDYDarshana::init(PHCompositeNode *topNode, sa_hist_mangager_ptr hm)
{
//-------------------------------------------------------------------
	TH1F * h_pT_os_N = new TH1F("pT_os_sig_n","opposite sign, signal region, north", 2, _pT_bins);
	_h_pT_os_N = new saHist(h_pT_os_N,saHist::DEFAULT_FLAG | saHist::RUN_PROPERTY | 
        saHist::FILL_PROPERTY| saHist::CROSSING_CHECKS,Verbosity());
	hm.get()->registerHisto(_h_pT_os_N);

	TH1F * h_pT_os_S = new TH1F("pT_os_sig_s","opposite sign, signal region, south", 2, _pT_bins);
	_h_pT_os_S = new saHist(h_pT_os_S,saHist::DEFAULT_FLAG | saHist::RUN_PROPERTY | 
        saHist::FILL_PROPERTY| saHist::CROSSING_CHECKS,Verbosity());
	hm.get()->registerHisto(_h_pT_os_S);

	TH1F * h_pT_sm_N = new TH1F("pT_ss_n","same sign, signal region, north", 2, _pT_bins);
	_h_pT_sm_N = new saHist(h_pT_sm_N,saHist::DEFAULT_FLAG | saHist::RUN_PROPERTY | 
        saHist::FILL_PROPERTY| saHist::CROSSING_CHECKS,Verbosity());
	hm.get()->registerHisto(_h_pT_sm_N);

	TH1F * h_pT_sm_S = new TH1F("pT_ss_s","same sign, signal region, south", 2, _pT_bins);
	_h_pT_sm_S = new saHist(h_pT_sm_S,saHist::DEFAULT_FLAG | saHist::RUN_PROPERTY | 
        saHist::FILL_PROPERTY| saHist::CROSSING_CHECKS,Verbosity());
	hm.get()->registerHisto(_h_pT_sm_S);

/*	TH1F * h_pT_al_os = new TH1F("pT_os_all","opposite sign, all ", 3, _pT_bins);
	_h_pT_al_os = new saHist(h_pT_al_os,saHist::DEFAULT_FLAG | saHist::RUN_PROPERTY | 
        saHist::FILL_PROPERTY| saHist::CROSSING_CHECKS,Verbosity());
	hm.get()->registerHisto(_h_pT_al_os);

	TH1F * h_pT_al_ss = new TH1F("pT_ss_all","same sign, all ", 3, _pT_bins);
	_h_pT_al_ss = new saHist(h_pT_al_ss,saHist::DEFAULT_FLAG | saHist::RUN_PROPERTY | 
        saHist::FILL_PROPERTY| saHist::CROSSING_CHECKS,Verbosity());
	hm.get()->registerHisto(_h_pT_al_ss);

*//*
	TH1F * h_MS_os_N = new TH1F("Ms_os_sig_n","opposite sign, north arm",2,_MS_bins);
	_h_MS_os_N = new saHist(h_MS_os_N,saHist::DEFAULT_FLAG | saHist::RUN_PROPERTY | 
        saHist::FILL_PROPERTY| saHist::CROSSING_CHECKS,Verbosity());
	hm.get()->registerHisto(_h_MS_os_N);

	TH1F * h_MS_os_S = new TH1F("Ms_os_sig_s","opposite sign, south arm",2,_MS_bins);
	_h_MS_os_S = new saHist(h_MS_os_S,saHist::DEFAULT_FLAG | saHist::RUN_PROPERTY | 
        saHist::FILL_PROPERTY| saHist::CROSSING_CHECKS,Verbosity());
	hm.get()->registerHisto(_h_MS_os_S);

	TH1F * h_MS_sm_N = new TH1F("Ms_ss_n","same sign, north arm",2,_MS_bins);
	_h_MS_sm_N = new saHist(h_MS_sm_N,saHist::DEFAULT_FLAG | saHist::RUN_PROPERTY | 
        saHist::FILL_PROPERTY| saHist::CROSSING_CHECKS,Verbosity());
	hm.get()->registerHisto(_h_MS_sm_N);

	TH1F * h_MS_sm_S = new TH1F("Ms_ss_s","same sign, south arm",2,_MS_bins);
	_h_MS_sm_S = new saHist(h_MS_sm_S,saHist::DEFAULT_FLAG | saHist::RUN_PROPERTY | 
        saHist::FILL_PROPERTY| saHist::CROSSING_CHECKS,Verbosity());
	hm.get()->registerHisto(_h_MS_sm_S);*/
/*
	TH1F * h_MS_al_os = new TH1F("Ms_os_all","opposite sign, all",2,4, 8);
	_h_MS_al_os = new saHist(h_MS_al_os,saHist::DEFAULT_FLAG | saHist::RUN_PROPERTY | 
        saHist::FILL_PROPERTY| saHist::CROSSING_CHECKS,Verbosity());
	hm.get()->registerHisto(_h_MS_al_os);

	TH1F * h_MS_al_ss = new TH1F("Ms_ss_all","same sign, all", 2,4, 8);
	_h_MS_al_ss = new saHist(h_MS_al_ss,saHist::DEFAULT_FLAG | saHist::RUN_PROPERTY | 
        saHist::FILL_PROPERTY| saHist::CROSSING_CHECKS,Verbosity());
	hm.get()->registerHisto(_h_MS_al_ss);
*/

//-------------------------------------------------------------------


 /* // make a simple histogram //the template histogram, any TH1 and derivatives is accepted
  TH1F * h_mass = new TH1F("InvMass", "Invariant Mass;Invariant Mass (GeV)", 2,4, 8);
  _h_mass = new saHist(h_mass, saHist::DEFAULT_FLAG | saHist::RUN_PROPERTY | 
  saHist::FILL_PROPERTY| saHist::CROSSING_CHECKS,Verbosity());
  hm.get()->registerHisto(_h_mass);
*/
  // make the flag node which is syncronized with cut on picodst_object
  PHCompositeNode* dstNode = NULL;
  PHNodeIterator nodeItr(topNode);
  dstNode = static_cast<PHCompositeNode*>(nodeItr.findFirst("PHCompositeNode","DST"));
  if (!dstNode)
    {
      dstNode = new PHCompositeNode("DST");
      topNode->addNode(dstNode);
    }
  saFlagC *flags = new saFlagC();
  if (flags)
    {

      // make a new flag node called DST/SimpleDimuonFlag
      PHIODataNode<PHObject> * node = new PHIODataNode<PHObject>(flags,
          "SimpleDimuonFlag", "PHObject");

      if (!node)
        {

          cout
              << "saModuleDimuonDYDarshana::Init failed to create saEventProperty Node"
              << endl;
          return ABORTRUN;

        }
      else
        {

          dstNode->addNode(node);
          cout << "saFlag Node is added with version " << flags->ClassName()
              << " as " << node->getName() << endl;
        }
    }
  else
    {
      cout << "saModuleDimuonDYDarshana::Init failed to create saEventProperty"
          << endl;
      return ABORTRUN;
    }

  return EVENT_OK;
}
int PHG4SvtxClusterizer::InitRun(PHCompositeNode* topNode) {

  // get node containing the digitized hits
  _hits = findNode::getClass<SvtxHitMap>(topNode,"SvtxHitMap");
  if (!_hits) {
    cout << PHWHERE << "ERROR: Can't find node SvtxHitMap" << endl;
    return Fun4AllReturnCodes::ABORTRUN;
  }
  
  //-----------------
  // Add Cluster Node
  //-----------------

  PHNodeIterator iter(topNode);

  // Looking for the DST node
  PHCompositeNode *dstNode 
    = dynamic_cast<PHCompositeNode*>(iter.findFirst("PHCompositeNode","DST"));
  if (!dstNode) {
    cout << PHWHERE << "DST Node missing, doing nothing." << endl;
    return Fun4AllReturnCodes::ABORTRUN;
  }
    
  // Create the SVX node if required
  PHCompositeNode* svxNode 
    = dynamic_cast<PHCompositeNode*>(iter.findFirst("PHCompositeNode","SVTX"));
  if (!svxNode) {
    svxNode = new PHCompositeNode("SVTX");
    dstNode->addNode(svxNode);
  }
  
  // Create the Cluster node if required
  SvtxClusterMap *svxclusters 
    = findNode::getClass<SvtxClusterMap>(topNode,"SvtxClusterMap");
  if (!svxclusters) {
    svxclusters = new SvtxClusterMap();
    PHIODataNode<PHObject> *SvtxClusterMapNode =
      new PHIODataNode<PHObject>(svxclusters, "SvtxClusterMap", "PHObject");
    svxNode->addNode(SvtxClusterMapNode);
  }

  //---------------------
  // Calculate Thresholds
  //---------------------
  
  CalculateCylinderThresholds(topNode);
  CalculateLadderThresholds(topNode);

  //----------------
  // Report Settings
  //----------------

  if (verbosity >= 0) {
    cout << "====================== PHG4SvtxClusterizer::InitRun() =====================" << endl;
    cout << " CVS Version: $Id: PHG4SvtxClusterizer.C,v 1.15 2015/04/21 23:47:09 pinkenbu Exp $" << endl;
    cout << " Fraction of expected thickness MIP energy = " << _fraction_of_mip << endl;
    for (std::map<int,float>::iterator iter = _thresholds_by_layer.begin();
	 iter != _thresholds_by_layer.end();
	 ++iter) {
      cout << " Cluster Threshold in Layer #" << iter->first << " = " << 1.0e6*iter->second << " keV" << endl;
    }
    for (std::map<int,bool>::iterator iter = _make_z_clustering.begin();
	 iter != _make_z_clustering.end();
	 ++iter) {
      cout << " Z-dimension Clustering in Layer #" << iter->first << " = " << boolalpha << iter->second << noboolalpha << endl;
    }
    for (std::map<int,bool>::iterator iter = _make_e_weights.begin();
	 iter != _make_e_weights.end();
	 ++iter) {
      cout << " Energy weighting clusters in Layer #" << iter->first << " = " << boolalpha << iter->second << noboolalpha << endl;
    }
    cout << "===========================================================================" << endl;
  }

  return Fun4AllReturnCodes::EVENT_OK;
}
int PHG4TPCClusterizer::process_event(PHCompositeNode* topNode) {

  PHNodeIterator iter(topNode);

  PHCompositeNode* dstNode =
      static_cast<PHCompositeNode*>(iter.findFirst("PHCompositeNode", "DST"));
  if (!dstNode) {
    cout << PHWHERE << "DST Node missing, doing nothing." << endl;
    return Fun4AllReturnCodes::ABORTRUN;
  }
  PHNodeIterator iter_dst(dstNode);

  SvtxHitMap* hits = findNode::getClass<SvtxHitMap>(dstNode, "SvtxHitMap");
  if (!hits) {
    cout << PHWHERE << "ERROR: Can't find node SvtxHitMap" << endl;
    return Fun4AllReturnCodes::ABORTRUN;
  }

  PHCompositeNode* svxNode =
      dynamic_cast<PHCompositeNode*>(iter_dst.findFirst("PHCompositeNode", "SVTX"));
  if (!svxNode) {
    svxNode = new PHCompositeNode("SVTX");
    dstNode->addNode(svxNode);
  }

  SvtxClusterMap* svxclusters =
      findNode::getClass<SvtxClusterMap>(dstNode, "SvtxClusterMap");
  if (!svxclusters) {
    svxclusters = new SvtxClusterMap_v1();
    PHIODataNode<PHObject>* SvtxClusterMapNode =
        new PHIODataNode<PHObject>(svxclusters, "SvtxClusterMap", "PHObject");
    svxNode->addNode(SvtxClusterMapNode);
  }

  PHG4CylinderCellGeomContainer* geom_container =
    findNode::getClass<PHG4CylinderCellGeomContainer>(topNode,"CYLINDERCELLGEOM_SVTX");
  if (!geom_container) return Fun4AllReturnCodes::ABORTRUN;

  PHG4CylinderCellContainer* cells =  findNode::getClass<PHG4CylinderCellContainer>(dstNode,"G4CELL_SVTX");
  if (!cells) return Fun4AllReturnCodes::ABORTRUN;

  std::vector<std::vector<const SvtxHit*> > layer_sorted;
  PHG4CylinderCellGeomContainer::ConstRange layerrange = geom_container->get_begin_end();
  for (PHG4CylinderCellGeomContainer::ConstIterator layeriter = layerrange.first;
       layeriter != layerrange.second;
       ++layeriter) {
    // We only need TPC layers here, so skip the layers below _min_layer
    // This if statement is needed because although the maps ladder layers are not included in the cylinder cell geom container, 
    // the cylinder Svx layers are, so they have to be dropped here if they are present
    if( (unsigned int) layeriter->second->get_layer() < _min_layer)
      continue;
    layer_sorted.push_back(std::vector<const SvtxHit*>());
  }
  for (SvtxHitMap::Iter iter = hits->begin(); iter != hits->end(); ++iter) {
    SvtxHit* hit = iter->second;
    if( (unsigned int) hit->get_layer() < _min_layer)
      continue;
    layer_sorted[hit->get_layer() - _min_layer].push_back(hit);
  }
  
  for (PHG4CylinderCellGeomContainer::ConstIterator layeriter =
           layerrange.first;
       layeriter != layerrange.second; ++layeriter) {

    unsigned int layer = (unsigned int)layeriter->second->get_layer();
    
    // exit on the MAPS layers...
    // needed in case cylinder svtx layers are present      
    if (layer < _min_layer) continue;
    if (layer > _max_layer) continue;
    
    PHG4CylinderCellGeom* geo = geom_container->GetLayerCellGeom(layer);
    const int nphibins = layeriter->second->get_phibins();
    const int nzbins = layeriter->second->get_zbins();

    nhits.clear();
    nhits.assign(nzbins, 0);
    amps.clear();
    amps.assign(nphibins * nzbins, 0.);
    cellids.clear();
    cellids.assign(nphibins * nzbins, 0);

    for (unsigned int i = 0; i < layer_sorted[layer - _min_layer].size(); ++i) {

      const SvtxHit* hit = layer_sorted[layer - _min_layer][i];
      if (hit->get_e() <= 0.) continue;
      
      PHG4CylinderCell* cell = cells->findCylinderCell(hit->get_cellid());
      int phibin = cell->get_binphi();
      int zbin = cell->get_binz();
      nhits[zbin] += 1;
      amps[zbin * nphibins + phibin] += hit->get_e();
      cellids[zbin * nphibins + phibin] = hit->get_id();
    }

    int nhits_tot = 0;
    for (int zbin = 0; zbin < nzbins; ++zbin) {
      nhits_tot += nhits[zbin];
    }

    while (nhits_tot > 0) {

      for (int zbin = 0; zbin < nzbins; ++zbin) {

        if (nhits[zbin] <= 0) continue;

        for (int phibin = 0; phibin < nphibins; ++phibin) {

          if (is_local_maximum(amps, nphibins, nzbins, phibin, zbin) == false) {
            continue;
          }

          float phi = 0.;
          float z = 0.;
          float e = 0.;

          fit_cluster(amps, nphibins, nzbins, nhits_tot, nhits, phibin, zbin,
                      geo, phi, z, e);

          if ((layer > 2) && (e < energy_cut)) {
            continue;
          }

          SvtxCluster_v1 clus;
          clus.set_layer(layer);
          clus.set_e(e);
          double radius = geo->get_radius() + 0.5*geo->get_thickness();
          clus.set_position(0, radius * cos(phi));
          clus.set_position(1, radius * sin(phi));
          clus.set_position(2, z);
	  
          clus.insert_hit(cellids[zbin * nphibins + phibin]);

	  float invsqrt12 = 1.0/sqrt(12.);
      
	  TMatrixF DIM(3,3);
	  DIM[0][0] = 0.0;//pow(0.0*0.5*thickness,2);
	  DIM[0][1] = 0.0;
	  DIM[0][2] = 0.0;
	  DIM[1][0] = 0.0;
	  DIM[1][1] = pow(0.5*0.011,2);
	  DIM[1][2] = 0.0;
	  DIM[2][0] = 0.0;
	  DIM[2][1] = 0.0;
	  DIM[2][2] = pow(0.5*0.03,2);

	  TMatrixF ERR(3,3);
	  ERR[0][0] = 0.0;//pow(0.0*0.5*thickness*invsqrt12,2);
	  ERR[0][1] = 0.0;
	  ERR[0][2] = 0.0;
	  ERR[1][0] = 0.0;
	  ERR[1][1] = pow(0.5*0.011*invsqrt12,2);
	  ERR[1][2] = 0.0;
	  ERR[2][0] = 0.0;
	  ERR[2][1] = 0.0;
	  ERR[2][2] = pow(0.5*0.03*invsqrt12,2);

	  TMatrixF ROT(3,3);
	  ROT[0][0] = cos(phi);
	  ROT[0][1] = -sin(phi);
	  ROT[0][2] = 0.0;
	  ROT[1][0] = sin(phi);
	  ROT[1][1] = cos(phi);
	  ROT[1][2] = 0.0;
	  ROT[2][0] = 0.0;
	  ROT[2][1] = 0.0;
	  ROT[2][2] = 1.0;

	  TMatrixF ROT_T(3,3);
	  ROT_T.Transpose(ROT);
      
	  TMatrixF COVAR_DIM(3,3);
	  COVAR_DIM = ROT * DIM * ROT_T;
	  
	  clus.set_size( 0 , 0 , COVAR_DIM[0][0] );
	  clus.set_size( 0 , 1 , COVAR_DIM[0][1] );
	  clus.set_size( 0 , 2 , COVAR_DIM[0][2] );
	  clus.set_size( 1 , 0 , COVAR_DIM[1][0] );
	  clus.set_size( 1 , 1 , COVAR_DIM[1][1] );
	  clus.set_size( 1 , 2 , COVAR_DIM[1][2] );
	  clus.set_size( 2 , 0 , COVAR_DIM[2][0] );
	  clus.set_size( 2 , 1 , COVAR_DIM[2][1] );
	  clus.set_size( 2 , 2 , COVAR_DIM[2][2] );

	  TMatrixF COVAR_ERR(3,3);
	  COVAR_ERR = ROT * ERR * ROT_T;
	  
	  clus.set_error( 0 , 0 , COVAR_ERR[0][0] );
	  clus.set_error( 0 , 1 , COVAR_ERR[0][1] );
	  clus.set_error( 0 , 2 , COVAR_ERR[0][2] );
	  clus.set_error( 1 , 0 , COVAR_ERR[1][0] );
	  clus.set_error( 1 , 1 , COVAR_ERR[1][1] );
	  clus.set_error( 1 , 2 , COVAR_ERR[1][2] );
	  clus.set_error( 2 , 0 , COVAR_ERR[2][0] );
	  clus.set_error( 2 , 1 , COVAR_ERR[2][1] );
	  clus.set_error( 2 , 2 , COVAR_ERR[2][2] );
      
          svxclusters->insert(&clus);
        }
      }
    }
  }

  reset();
  return Fun4AllReturnCodes::EVENT_OK;
}