Example #1
0
//! global termination
int saModuleSingleMuonAN::end(PHCompositeNode *topNode, sa_hist_mangager_ptr hm)
{

	fout.close();

	BOOST_FOREACH( saHist* h, _v_sahist )
	{
		h->CalcAsymmetry(hm.get()->getHisto_DefaultLumi(),saHist::BbcVertexCut);
		//hm.get()->registerHisto(h->CalcAsymmetry_Chi2Fit(false));

                h->CalcSingleSpinAsymmetry(hm.get()->getHisto_DefaultLumi(),saHist::BbcVertexCut);
	}
//! global termination
int saModuleDimuonDYDarshana::end(PHCompositeNode *topNode, sa_hist_mangager_ptr hm)
{

  //calculate asymmetry with relative lumi of BbcNoCutPHENIX
  //_h_mass->CalcAsymmetry(hm.get()->getHisto_DefaultLumi(),saHist::BbcNoCutPHENIX);
  //calculate asymmetry with relative lumi of BbcNoCutPHENIX
  _h_pT_os_N->CalcAsymmetry(hm.get()->getHisto_DefaultLumi(),saHist::BbcVertexCut);
  _h_pT_os_S->CalcAsymmetry(hm.get()->getHisto_DefaultLumi(),saHist::BbcVertexCut);

  _h_pT_sm_N->CalcAsymmetry(hm.get()->getHisto_DefaultLumi(),saHist::BbcVertexCut);
  _h_pT_sm_S->CalcAsymmetry(hm.get()->getHisto_DefaultLumi(),saHist::BbcVertexCut);

//  _h_pT_al_os->CalcAsymmetry(hm.get()->getHisto_DefaultLumi(),saHist::BbcNoCutPHENIX);
//  _h_pT_al_ss->CalcAsymmetry(hm.get()->getHisto_DefaultLumi(),saHist::BbcNoCutPHENIX);


/*  _h_MS_os_N->CalcAsymmetry(hm.get()->getHisto_DefaultLumi(),saHist::BbcVertexCut);
  _h_MS_os_S->CalcAsymmetry(hm.get()->getHisto_DefaultLumi(),saHist::BbcVertexCut);

  _h_MS_sm_N->CalcAsymmetry(hm.get()->getHisto_DefaultLumi(),saHist::BbcVertexCut);
  _h_MS_sm_S->CalcAsymmetry(hm.get()->getHisto_DefaultLumi(),saHist::BbcVertexCut);*/
/*
  _h_MS_os_N->CalcAsymmetry(hm.get()->getHisto_DefaultLumi(),saHist::BbcNoCutPHENIX);
  _h_MS_os_S->CalcAsymmetry(hm.get()->getHisto_DefaultLumi(),saHist::BbcNoCutPHENIX);

  _h_MS_sm_N->CalcAsymmetry(hm.get()->getHisto_DefaultLumi(),saHist::BbcNoCutPHENIX);
  _h_MS_sm_S->CalcAsymmetry(hm.get()->getHisto_DefaultLumi(),saHist::BbcNoCutPHENIX);
*/
 /* _h_MS_al_os->CalcAsymmetry(hm.get()->getHisto_DefaultLumi(),saHist::BbcNoCutPHENIX);
  _h_MS_al_ss->CalcAsymmetry(hm.get()->getHisto_DefaultLumi(),saHist::BbcNoCutPHENIX);

  hm.get()->registerHisto(_h_pT_os_N->CalcAsymmetry_Chi2Fit(false));
  hm.get()->registerHisto(_h_pT_os_S->CalcAsymmetry_Chi2Fit(false));

  hm.get()->registerHisto(_h_pT_sm_N->CalcAsymmetry_Chi2Fit(false));
  hm.get()->registerHisto(_h_pT_sm_S->CalcAsymmetry_Chi2Fit(false));

  hm.get()->registerHisto(_h_pT_al_os->CalcAsymmetry_Chi2Fit(false));
  hm.get()->registerHisto(_h_pT_al_ss->CalcAsymmetry_Chi2Fit(false));

  hm.get()->registerHisto(_h_MS_os_N->CalcAsymmetry_Chi2Fit(false));
  hm.get()->registerHisto(_h_MS_os_S->CalcAsymmetry_Chi2Fit(false));

  hm.get()->registerHisto(_h_MS_sm_N->CalcAsymmetry_Chi2Fit(false));
  hm.get()->registerHisto(_h_MS_sm_S->CalcAsymmetry_Chi2Fit(false));

  hm.get()->registerHisto(_h_MS_al_os->CalcAsymmetry_Chi2Fit(false));
  hm.get()->registerHisto(_h_MS_al_ss->CalcAsymmetry_Chi2Fit(false));
*/
  return EVENT_OK;
}
//! 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 termination
int
saModuleSngmuonMing::end(PHCompositeNode *topNode, sa_hist_mangager_ptr hm)
{
  //
  //calculate asymmetry with relative lumi of BbcNoCutPHENIX
  //

  // --- pT: Muons --- 
  _h_pT->CalcAsymmetry(hm.get()->getHisto_DefaultLumi(),
      saHist::BbcNoCutPHENIX);
  _h_pT_n->CalcAsymmetry(hm.get()->getHisto_DefaultLumi(),
      saHist::BbcNoCutPHENIX);
  _h_pT_s->CalcAsymmetry(hm.get()->getHisto_DefaultLumi(),
      saHist::BbcNoCutPHENIX);

  _h_pT_p->CalcAsymmetry(hm.get()->getHisto_DefaultLumi(),
      saHist::BbcNoCutPHENIX);
  _h_pT_p_n->CalcAsymmetry(hm.get()->getHisto_DefaultLumi(),
      saHist::BbcNoCutPHENIX);
  _h_pT_p_s->CalcAsymmetry(hm.get()->getHisto_DefaultLumi(),
      saHist::BbcNoCutPHENIX);

  _h_pT_m->CalcAsymmetry(hm.get()->getHisto_DefaultLumi(),
      saHist::BbcNoCutPHENIX);
  _h_pT_m_n->CalcAsymmetry(hm.get()->getHisto_DefaultLumi(),
      saHist::BbcNoCutPHENIX);
  _h_pT_m_s->CalcAsymmetry(hm.get()->getHisto_DefaultLumi(),
      saHist::BbcNoCutPHENIX);

  // --- pT: Hadron --- 

  _h_pTH->CalcAsymmetry(hm.get()->getHisto_DefaultLumi(),
      saHist::BbcNoCutPHENIX);
  _h_pTH_n->CalcAsymmetry(hm.get()->getHisto_DefaultLumi(),
      saHist::BbcNoCutPHENIX);
  _h_pTH_s->CalcAsymmetry(hm.get()->getHisto_DefaultLumi(),
      saHist::BbcNoCutPHENIX);

  _h_pTH_p->CalcAsymmetry(hm.get()->getHisto_DefaultLumi(),
      saHist::BbcNoCutPHENIX);
  _h_pTH_p_n->CalcAsymmetry(hm.get()->getHisto_DefaultLumi(),
      saHist::BbcNoCutPHENIX);
  _h_pTH_p_s->CalcAsymmetry(hm.get()->getHisto_DefaultLumi(),
      saHist::BbcNoCutPHENIX);

  _h_pTH_m->CalcAsymmetry(hm.get()->getHisto_DefaultLumi(),
      saHist::BbcNoCutPHENIX);
  _h_pTH_m_n->CalcAsymmetry(hm.get()->getHisto_DefaultLumi(),
      saHist::BbcNoCutPHENIX);
  _h_pTH_m_s->CalcAsymmetry(hm.get()->getHisto_DefaultLumi(),
      saHist::BbcNoCutPHENIX);


  // -- eta: Muons and Hadrons ---

  _h_eta->CalcAsymmetry(hm.get()->getHisto_DefaultLumi(),
      saHist::BbcNoCutPHENIX);
  _h_eta_p->CalcAsymmetry(hm.get()->getHisto_DefaultLumi(),
      saHist::BbcNoCutPHENIX);
  _h_eta_m->CalcAsymmetry(hm.get()->getHisto_DefaultLumi(),
      saHist::BbcNoCutPHENIX);

  _h_etaH->CalcAsymmetry(hm.get()->getHisto_DefaultLumi(),
      saHist::BbcNoCutPHENIX);
  _h_etaH_p->CalcAsymmetry(hm.get()->getHisto_DefaultLumi(),
      saHist::BbcNoCutPHENIX);
  _h_etaH_m->CalcAsymmetry(hm.get()->getHisto_DefaultLumi(),
      saHist::BbcNoCutPHENIX);

  // -- eta: W ->Muons ---

  _h_etaW10->CalcAsymmetry(hm.get()->getHisto_DefaultLumi(),
      saHist::BbcNoCutPHENIX);
  _h_etaW10_p->CalcAsymmetry(hm.get()->getHisto_DefaultLumi(),
      saHist::BbcNoCutPHENIX);
  _h_etaW10_m->CalcAsymmetry(hm.get()->getHisto_DefaultLumi(),
      saHist::BbcNoCutPHENIX);

  _h_etaW15->CalcAsymmetry(hm.get()->getHisto_DefaultLumi(),
      saHist::BbcNoCutPHENIX);
  _h_etaW15_p->CalcAsymmetry(hm.get()->getHisto_DefaultLumi(),
      saHist::BbcNoCutPHENIX);
  _h_etaW15_m->CalcAsymmetry(hm.get()->getHisto_DefaultLumi(),
      saHist::BbcNoCutPHENIX);

  _h_etaW20->CalcAsymmetry(hm.get()->getHisto_DefaultLumi(),
      saHist::BbcNoCutPHENIX);
  _h_etaW20_p->CalcAsymmetry(hm.get()->getHisto_DefaultLumi(),
      saHist::BbcNoCutPHENIX);
  _h_etaW20_m->CalcAsymmetry(hm.get()->getHisto_DefaultLumi(),
      saHist::BbcNoCutPHENIX);


  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;
}
//! global initialization
int
saModSimpleHist::init(PHCompositeNode *topNode, sa_hist_mangager_ptr hm)
{

  TH2F * h_vtx = new TH2F("VTX_XY",
      "Vertex Transverse Distribution;VTX X (cm);VTX Y (cm)", //
      300, -.3, .3, 300, -.3, .3);
  _h_vtx = new saHist(h_vtx, //the template histogram, any TH1 and derivatives is accepted
      saHist::EVENT_PROPERTY | saHist::RUN_PROPERTY | saHist::FILL_PROPERTY, // flags
      Verbosity() // verbosity
      );
  hm.get()->registerHisto(_h_vtx);

  TH2F * h_vtx_xz = new TH2F("VTX_XZ",
      "Vertex Distribution;VTX Z (cm);VTX X (cm)", //
      300, -15, 15, 300, -.3, .3);
  _h_vtx_xz = new saHist(h_vtx_xz, //the template histogram, any TH1 and derivatives is accepted
      saHist::EVENT_PROPERTY | saHist::RUN_PROPERTY | saHist::FILL_PROPERTY, // flags
      Verbosity() // verbosity
      );
  hm.get()->registerHisto(_h_vtx_xz);

  TH2F * h_vtx_yz = new TH2F("VTX_YZ",
      "Vertex Distribution;VTX Z (cm);VTX Y (cm)", //
      300, -15, 15, 300, -.3, .3);
  _h_vtx_yz = new saHist(h_vtx_yz, //the template histogram, any TH1 and derivatives is accepted
      saHist::EVENT_PROPERTY | saHist::RUN_PROPERTY | saHist::FILL_PROPERTY, // flags
      Verbosity() // verbosity
      );
  hm.get()->registerHisto(_h_vtx_yz);

  static const double DCA_lim = 1;
  static const int DCA_bin = 500;
  static const double Phi_lim = TMath::Pi();
  static const int Phi_bin = 64;

  //
  TH3F * DCA_Phi_z_Arm0 = new TH3F("DCA_Phi_z_Arm0",
      "DCA VS Phi;DCA (cm);Phi (rad);z (cm)", //
      DCA_bin, -DCA_lim, DCA_lim, //
      Phi_bin, -Phi_lim, Phi_lim, //
      4, -10, 10);
  _h_DCA_Phi_z_Arm0 = new saHist(DCA_Phi_z_Arm0, //the template histogram, any TH1 and derivatives is accepted
      saHist::EVENT_PROPERTY | saHist::FILL_PROPERTY, // flags
      Verbosity() // verbosity
      );
  hm.get()->registerHisto(_h_DCA_Phi_z_Arm0);

  //
  TH3F * DCA_Phi_z_Arm1 = new TH3F("DCA_Phi_z_Arm1",
      "DCA VS Phi;DCA (cm);Phi (rad);z (cm)", //
      DCA_bin, -DCA_lim, DCA_lim, //
      Phi_bin, -Phi_lim, Phi_lim, //
      4, -10, 10);
  _h_DCA_Phi_z_Arm1 = new saHist(DCA_Phi_z_Arm1, //the template histogram, any TH1 and derivatives is accepted
      saHist::EVENT_PROPERTY | saHist::FILL_PROPERTY, // flags
      Verbosity() // verbosity
      );
  hm.get()->registerHisto(_h_DCA_Phi_z_Arm1);

  //
  TH3F * h_DCA_Pz_Arm = new TH3F("DCA_Pz_Arm",
      "DCA VS Phi;DCA (cm);Pz (GeV/c);Arm", //
      DCA_bin, -DCA_lim, DCA_lim, //
      40, 2, 100, //
      4, -.5, 3.5);
  _h_DCA_Pz_Arm = new saHist(h_DCA_Pz_Arm, //the template histogram, any TH1 and derivatives is accepted
      saHist::EVENT_PROPERTY | saHist::FILL_PROPERTY, // flags
      Verbosity() // verbosity
      );
  hm.get()->registerHisto(_h_DCA_Pz_Arm);

  //
  TH3F * h_DCA_Phi_Arm = new TH3F("DCA_Phi_Arm",
      "DCA VS Phi;DCA (cm);Phi (rad);Arm", //
      DCA_bin, -DCA_lim, DCA_lim, //
      Phi_bin, -Phi_lim, Phi_lim, //
      4, -.5, 3.5);
  _h_DCA_Phi_Arm = new saHist(h_DCA_Phi_Arm, //the template histogram, any TH1 and derivatives is accepted
      saHist::EVENT_PROPERTY | saHist::FILL_PROPERTY, // flags
      Verbosity() // verbosity
      );
  hm.get()->registerHisto(_h_DCA_Phi_Arm);
  //
  TH3F * h_FVTX_DCA_Phi_Arm = new TH3F("FVTX_DCA_Phi_Arm",
      "DCA VS Phi;DCA (cm);Phi (rad);Arm", //
      DCA_bin, -DCA_lim, DCA_lim, //
      Phi_bin, -Phi_lim, Phi_lim, //
      4, -.5, 3.5);
  _h_fvtx_DCA_Phi_Arm = new saHist(h_FVTX_DCA_Phi_Arm, //the template histogram, any TH1 and derivatives is accepted
      saHist::EVENT_PROPERTY | saHist::FILL_PROPERTY, // flags
      Verbosity() // verbosity
      );
  hm.get()->registerHisto(_h_fvtx_DCA_Phi_Arm);
  //
  h_DCA_Pz_Arm = new TH3F("FVTX_DCA_Pz_Arm",
      "DCA VS Phi;DCA (cm);Pz (GeV/c);Arm", //
      DCA_bin, -DCA_lim, DCA_lim, //
      40, 2, 100, //
      4, -.5, 3.5);
  _h_fvtx_DCA_Pz_Arm = new saHist(h_DCA_Pz_Arm, //the template histogram, any TH1 and derivatives is accepted
      saHist::EVENT_PROPERTY | saHist::FILL_PROPERTY, // flags
      Verbosity() // verbosity
      );
  hm.get()->registerHisto(_h_fvtx_DCA_Pz_Arm);

  //
  TH1D * Normalization = new TH1D("Normalization", "Normalization;Item", 10,
      0.5, 10.5);
  Normalization->GetXaxis()->SetBinLabel(1, "Event");
  Normalization->GetXaxis()->SetBinLabel(2, "Vertex Cut");
  Normalization->GetXaxis()->SetBinLabel(3, "Single Muon");
  Normalization->GetXaxis()->SetBinLabel(4, "Single Muon J/Psi");
  Normalization->GetXaxis()->SetBinLabel(5, "Single Muon J/Psi good_muID_muon");
  Normalization->GetXaxis()->SetBinLabel(6, "Single Muon pz4 good_muID_muon");
//  Normalization->GetXaxis()->SetBinLabel(7, "Dimuon");
  Normalization->GetXaxis()->LabelsOption("v");
  _h_Normalization = new saHist(Normalization, //the template histogram, any TH1 and derivatives is accepted
      saHist::EVENT_PROPERTY | saHist::RUN_PROPERTY | saHist::FILL_PROPERTY, // flags
      Verbosity() // verbosity
      );

  hm.get()->registerHisto(_h_Normalization);

  if (Verbosity())
    cout << "saModSimpleHist::init - N beam position records = "
        << _beam_pos_xy.position.size() << endl;

  return EVENT_OK;
}