コード例 #1
0
void makePlots() {
  
  //Pt
  if( 1 ) {
    
    float dx = 0.05;
    float kfactor = 0.05;

    for ( int k = 0; k < 10; ++k ) {
      makePlots("recoPt", "recoPt > 0.0", "40,0,200", 0.0, 100, kfactor);
      kfactor += dx * float(k);
    }
    
  }
  
  //Eta
  if ( 0 ) { 
    makePlots("recoEta", "recoPt > 0.0", "20,-5.0, 5.0", 0.0, 100);
  }
  
  if( 0 ) {
    
    makePlots("recoPt", "recoPt > 0.0", "20,0,70", 0.0, 10.0);
    makePlots("recoPt", "recoPt > 0.0", "20,0,70", 10.0, 25.0);
    makePlots("recoPt", "recoPt > 0.0", "40,0,200", 25.0, 50.0);
    
    makePlots("recoEta", "recoPt > 0.0 && abs(recoEta) < 3.0", "20,-3.0, 3.0", 0.0, 10.0);
    makePlots("recoEta", "recoPt > 0.0 && abs(recoEta) < 3.0", "20,-3.0, 3.0", 10.0, 25.0);
    makePlots("recoEta", "recoPt > 0.0 && abs(recoEta) < 3.0", "20,-5.0, 5.0", 25.0, 50.0);
    
  }

}
コード例 #2
0
void makePlots() {

  if( 1 ) {
    makePlots("15,0,75", 1000.0 );
  }

}
コード例 #3
0
void singlePeCalMin() {

    vector<inputValues>  b; // Blank runs
    vector<inputValues>  t; // Total runs
    vector<outputValues> o;
    vector<string> cutString(cut_b.size(), "Min > ");

    // Create strings to perform cuts 
    for (int i = 0; i < cut_b.size(); i++) { cutString[i].append(to_string(cut_b[i])); }

    // Get input and output values from .root spectra
    for (int i = 0; i < fileNames_b.size(); i++) {
        b.push_back(getInputValues(fileNames_b[i], pulseWidths_b[i], cutString[i]));

        for (int j = 0; j < fileNames_t.size(); j++) {
            t.push_back(getInputValues(fileNames_t[j], pulseWidths_t[j], cutString[i]));
            o.push_back(getOutputValues(b[i], t[j]));
        }
    }
    makePlots(b, t, o, cut_b[0]);

    // Debugging
    cout << "BG E[T}: " << b[0].e << "  BG a/n: " << b[0].a / b[0].n << endl;
    cout << setw(12) << "a/n  " << setw(12) << "E[L]  " << setw(12) 
         << "E[Psi]" << setw(12) << "E[T]" << endl;
    for ( int i = 0; i < t.size(); i++) {
        cout << setw(12) << (float)t[i].a / t[i].n << setw(12) << o[i].eL << setw(12)
             << o[i].ePsi << setw(12) << t[i].e << endl;
    }
}
コード例 #4
0
void makePlots() 
{
  
  gROOT->SetStyle("Plain");
  gROOT->SetBatch(false);
  // --- Use the CMS TDR style
  gROOT->ProcessLine(".L tdrStyle.C");
  setTDRStyle();
  tdrStyle->SetErrorX(0.5);
  tdrStyle->SetPadLeftMargin(0.10);
  tdrStyle->SetPadRightMargin(0.08);
  tdrStyle->SetPadTopMargin(0.10);
  tdrStyle->SetLegendBorderSize(0);
  tdrStyle->SetTitleYOffset(0.8);
  tdrStyle->SetOptStat(0);
  tdrStyle->SetOptFit(0);
  tdrStyle->SetTitleFontSize(0.08);
  tdrStyle->SetStatStyle(0);
  tdrStyle->cd();


  //makePlots("ModelA","0","./root_files/ModelA/output_ModelA_SetI.root", "SetI");

  //makePlots("ModelA","0","./root_files/ModelA/output_ModelA_SetII.root", "SetII");

  //makePlots("EarthB","0","./root_files/EarthB/output_EarthB_SetI_Fine.root","SetI");

  makePlots("EarthB","0","./root_files/EarthB/output_EarthB_SetII_Fine.root","SetII");

  
  
}
コード例 #5
0
ファイル: stack_zmm2hlt.C プロジェクト: Andrej-CMS/cmssw
void stack_zmm2hlt() {


TCut cut_zGolden("zGoldenDau1Pt> 20 && zGoldenDau2Pt>20 && zGoldenDau1TrkIso< 3.0 && zGoldenDau1TrkIso < 3.0 && abs(zGoldenDau1Eta)<2.1 &&  abs(zGoldenDau2Eta)<2.1 && zGoldenDau1Chi2<10 && zGoldenDau2Chi2<10 && abs(zGoldenDau1dxyFromBS)<0.2 && abs(zGoldenDau2dxyFromBS)<0.2 && zGoldenDau1NofStripHits>9 && zGoldenDau1NofPixelHits>0 && zGoldenDau2NofStripHits>9 &&  zGoldenDau2NofPixelHits>0 && zGoldenDau1NofMuonHits>0 && zGoldenDau2NofMuonHits>0 && zGoldenDau1NofMuMatches>1 && zGoldenDau2NofMuMatches>1 && zGoldenDau1TrackerMuonBit==1 && zGoldenDau2TrackerMuonBit==1 && (zGoldenDau1HLTBit==1 && zGoldenDau2HLTBit==1) ");

 makePlots("zGoldenMass", "", cut_zGolden, 5, "zGolden2hlt",  0.001, 200, 0 ,200, true);
}
コード例 #6
0
void singlePeVaryMode() {

    vector<inputValues> b; // Blank runs
    vector<inputValues> t; // Total runs
    vector<outputValues> o;
    vector<string> cutString(cut_b.size(), "Charge > ");
    
    // Create strings to perform cuts - I would be able to use to_string if C++11 worked 
    for (int i = 0; i < cut_b.size(); i++) {
        ostringstream ss;
        ss << cut_b[i];
        cutString[i].append(ss.str());
    }
    
    // Get input and output values from .root spectra
    for (int i = 0; i < fileNames_b.size(); i++) {
        b.push_back(getInputValues(fileNames_b[i], pulseWidths_b[i], useChargeMode_b[i], cutString[i]));
        
        for (int j = 0; j < fileNames_t.size(); j++) {
            if (useChargeMode_t[j] == useChargeMode_b[i]) {
                t.push_back(getInputValues(fileNames_t[j], pulseWidths_t[j], useChargeMode_t[j], cutString[i]));
                o.push_back(getOutputValues(b[i], t[j]));
            }
        }
    }
    makePlots(b, t, o);
}
コード例 #7
0
ファイル: stack_zMuTrkMu.C プロジェクト: Andrej-CMS/cmssw
void stack_zMuTrkMu() {

  /// cuts common....
  TCut kin_common("zMuTrkMuDau1Pt> 20 && zMuTrkMuDau2Pt>20 && zMuTrkMuDau1Iso03SumPt<3.0 && zMuTrkMuDau2Iso03SumPt < 3.0 && abs(zMuTrkMuDau1Eta)<2.4 &&  abs(zMuTrkMuDau2Eta)<2.4  && (zMuTrkMuDau1HLTBit==1 || zMuTrkMuDau2HLTBit==1) &&  abs(zMuTrkMuDau1dxyFromBS)<0.2 &&  abs(zMuTrkMuDau2dxyFromBS)<0.2");





  TCut dau1Loose("zMuTrkMuDau1GlobalMuonBit==0 && zMuTrkMuDau1TrkChi2<10  && (zMuTrkMuDau1TrkNofStripHits + zMuTrkMuDau1TrkNofPixelHits)>10 && zMuTrkMuDau1TrkNofPixelHits > 0");
  TCut dau2Loose("zMuTrkMuDau2GlobalMuonBit==0 && zMuTrkMuDau2TrkChi2<10  && (zMuTrkMuDau2TrkNofStripHits + zMuTrkMuDau2TrkNofPixelHits)>10 && zMuTrkMuDau2TrkNofPixelHits > 0");

  TCut dau1TightWP2_hltAlso("zMuTrkMuDau1GlobalMuonBit==1 && zMuTrkMuDau1Chi2<10  && (zMuTrkMuDau1NofStripHits + zMuTrkMuDau1NofPixelHits)>10  && zMuTrkMuDau1NofMuonHits>0 && zMuTrkMuDau1NofMuMatches>1   && zMuTrkMuDau1TrackerMuonBit==1 && zMuTrkMuDau1HLTBit==1");
  TCut dau2TightWP2_hltAlso("zMuTrkMuDau2GlobalMuonBit==1 && zMuTrkMuDau2Chi2<10  && (zMuTrkMuDau2NofStripHits + zMuTrkMuDau2NofPixelHits)>10  && zMuTrkMuDau2NofMuonHits>0   &&  zMuTrkMuDau2NofMuMatches>1 && zMuTrkMuDau2TrackerMuonBit==1 && zMuTrkMuDau2HLTBit==1");

 
  TCut massCut("zMuTrkMuMass>60 && zMuTrkMuMass<120 ");




  makePlots("zMuTrkMuMass", "", kin_common + (( dau1TightWP2_hltAlso &&  dau2Loose ) || (dau2TightWP2_hltAlso +  dau1Loose)), 5, "zMuTrkMu",  0.0001, 200, 0 ,200, true, true);

  //  makePlots("zMuTrkMuMass", "", kin_common + dau1TightWP1_hltAlso , 5, "zMuTrkMu",  0.001, 200, 0 ,200, true);

    //makePlots("zMuTrkMuMass", "", kin_common, 5, "zMuTrkMu",  0.001, 200, 0 ,200, true);


}
コード例 #8
0
ファイル: stack_zmm1hlt.C プロジェクト: Andrej-CMS/cmssw
void stack_zmm1hlt() {


TCut cut_zGolden("zGoldenDau1Pt> 20 && zGoldenDau2Pt>20 && zGoldenDau1Iso03SumPt< 3.0 && zGoldenDau2Iso03SumPt < 3.0 && abs(zGoldenDau1Eta)<2.1 &&  abs(zGoldenDau2Eta)<2.1 && zGoldenDau1Chi2<10 && zGoldenDau2Chi2<10 && abs(zGoldenDau1dxyFromBS)<0.2 && abs(zGoldenDau2dxyFromBS)<0.2 && ( zGoldenDau1NofStripHits + zGoldenDau1NofPixelHits)>10 && zGoldenDau1NofPixelHits>0 && (zGoldenDau2NofStripHits+ zGoldenDau2NofPixelHits)>10 &&  zGoldenDau2NofPixelHits>0 && zGoldenDau1NofMuonHits>0 && zGoldenDau2NofMuonHits>0 && zGoldenDau1NofMuMatches>1 && zGoldenDau2NofMuMatches>1 && zGoldenDau1TrackerMuonBit==1 && zGoldenDau2TrackerMuonBit==1 && (zGoldenDau1HLTBit==0 || zGoldenDau2HLTBit==0) ");

 makePlots("zGoldenMass", "", cut_zGolden, 5, "zGolden1hlt",  0.001, 200, 0 ,200, true, false);
}
コード例 #9
0
void plotAtriRunStatistics(char *fileName){
  chain = new TChain("runStatsTree");
  chain->Add(fileName);
  chain->SetBranchAddress("stationId", &stationId);
  chain->GetEntry(0);
  getGraphs();
  makePlots();

}
コード例 #10
0
ファイル: extractPlots.C プロジェクト: IbrahimHany/GEMCode
void makeAll(){

	makePlots("GLBMuonAnalyzer_5GeV.root","GLBMuonAnalyzerWithGEMs_5GeV.root","plots_5GeV.root");
	makePlots("GLBMuonAnalyzer_10GeV.root","GLBMuonAnalyzerWithGEMs_10GeV.root","plots_10GeV.root");
	makePlots("GLBMuonAnalyzer_50GeV.root","GLBMuonAnalyzerWithGEMs_50GeV.root","plots_50GeV.root");
	makePlots("GLBMuonAnalyzer_100GeV.root","GLBMuonAnalyzerWithGEMs_100GeV.root","plots_100GeV.root");
	makePlots("GLBMuonAnalyzer_200GeV.root","GLBMuonAnalyzerWithGEMs_200GeV.root","plots_200GeV.root");
	makePlots("GLBMuonAnalyzer_500GeV.root","GLBMuonAnalyzerWithGEMs_500GeV.root","plots_500GeV.root");
	makePlots("GLBMuonAnalyzer_1000GeV.root","GLBMuonAnalyzerWithGEMs_1000GeV.root","plots_1000GeV.root");

}
コード例 #11
0
void plotAtriRunStatistics(char *baseName, Int_t runLow, Int_t runHigh){
  chain = new TChain("runStatsTree");
  char fileName[256];
  for(Int_t runNo=runLow;runNo<=runHigh;runNo++){
    sprintf(fileName, "%s_run%i.root", baseName, runNo);
    printf("Adding %s\n", fileName);
    chain->Add(fileName);
  }
  chain->SetBranchAddress("stationId", &stationId);
  chain->GetEntry(0);
  getGraphs();
  makePlots();
  

}
コード例 #12
0
ファイル: UnitPlotter.cpp プロジェクト: acelik/PhysicsPlotter
// Main function to normalize histograms
void UnitPlotter (string inRootFilePath, string configFileList, string configFilePath, string saveHistosPath)

{

  // use ATLAS style
  gROOT->LoadMacro("src/cmsStyle.C");
  SetcmsStyle();

  // Store global variables
  inputRootFilePath = inRootFilePath; 
  readConfigFile (configFileList, configFilePath);
  readConfigPlotStyle (configFilePath); 

  getHistoInfo ();
  makePlots(configFilePath);
}
コード例 #13
0
void stack_zGoldenDauEtaNotTriggered() {


  //TCut cut_zGolden("zGoldenMass>60 && zGoldenMass<120 && zGoldenDau1Pt> 0 && zGoldenDau2Pt>0 && zGoldenDau1TrkIso< 3.0 && zGoldenDau1TrkIso < 3.0 && abs(zGoldenDau1Eta)<2.4 &&  abs(zGoldenDau2Eta)<2.4 && zGoldenDau1Chi2<10 && zGoldenDau2Chi2<10 && abs(zGoldenDau1dxyFromBS)<0.2 && abs(zGoldenDau2dxyFromBS)<0.2 && (zGoldenDau1NofStripHits + zGoldenDau1NofPixelHits )>9 && zGoldenDau1NofPixelHits>0 && (zGoldenDau2NofStripHits + zGoldenDau2NofPixelHits) >9 &&  zGoldenDau2NofPixelHits>0 && zGoldenDau1NofMuonHits>0 && zGoldenDau2NofMuonHits>0 && zGoldenDau1NofMuMatches>1 && zGoldenDau2NofMuMatches>1   && zGoldenDau1TrackerMuonBit==1 && zGoldenDau2TrackerMuonBit==1 && (zGoldenDau1HLTBit==1 || zGoldenDau2HLTBit==1) ");
  



  makePlots("zGoldenDau1Eta", "zGoldenDau2Eta", massCut + kin_common + ( (dau2TightWP1 && dau1TightWP1_hltAlso  && "zGoldenDau2HLTBit==0") || ( dau2TightWP1_hltAlso && dau1TightWP1 && "zGoldenDau1HLTBit==0" )),  1, "zGoldenDauEtaNotTriggered",  0.001, 18, -2.7 ,2.7, true);
  hs->GetXaxis()->SetTitle("#eta_{#mu}");
  string yTag = "events/(0.1)"; // use the correct rebin
  hs->GetYaxis()->SetTitle(yTag.c_str());
  c1->SaveAs("zGoldenDauEtaNotTriggered.eps");
  c1->SaveAs("zGoldenDauEtaNotTriggered.gif");
  //  c1->SaveAs("zGoldenDauPt.pdf");
}
コード例 #14
0
ファイル: stack_zGoldenDauPt.C プロジェクト: Andrej-CMS/cmssw
void stack_zGoldenDauPt() {


  //TCut cut_zGolden("zGoldenMass>60 && zGoldenMass<120 && zGoldenDau1Pt> 0 && zGoldenDau2Pt>0 && zGoldenDau1TrkIso< 3.0 && zGoldenDau1TrkIso < 3.0 && abs(zGoldenDau1Eta)<2.4 &&  abs(zGoldenDau2Eta)<2.4 && zGoldenDau1Chi2<10 && zGoldenDau2Chi2<10 && abs(zGoldenDau1dxyFromBS)<0.2 && abs(zGoldenDau2dxyFromBS)<0.2 && (zGoldenDau1NofStripHits + zGoldenDau1NofPixelHits )>9 && zGoldenDau1NofPixelHits>0 && (zGoldenDau2NofStripHits + zGoldenDau2NofPixelHits) >9 &&  zGoldenDau2NofPixelHits>0 && zGoldenDau1NofMuonHits>0 && zGoldenDau2NofMuonHits>0 && zGoldenDau1NofMuMatches>1 && zGoldenDau2NofMuMatches>1   && zGoldenDau1TrackerMuonBit==1 && zGoldenDau2TrackerMuonBit==1 && (zGoldenDau1HLTBit==1 || zGoldenDau2HLTBit==1) ");
  TCut kin_common_woPt("zGoldenDau1Iso03SumPt< 3.0 && zGoldenDau2Iso03SumPt < 3.0 && abs(zGoldenDau1Eta)<2.4 &&  abs(zGoldenDau2Eta)<2.4  && (zGoldenDau1HLTBit==1 || zGoldenDau2HLTBit==1)  && abs(zGoldenDau1dxyFromBS)<0.2 && abs(zGoldenDau2dxyFromBS)<0.2 ");



  makePlots("zGoldenDau1Pt", "zGoldenDau2Pt", massCut + kin_common_woPt + ( ( dau1Loose  && dau2TightWP1_hltAlso ) || ( dau2Loose  && dau1TightWP1_hltAlso )),  2, "zGoldenDauPt",  0.01, 100, 0 ,100, true);
  hs->GetXaxis()->SetTitle("p_{T #mu} (GeV/c)");
  string yTag = "events/(5 GeV/c)"; // use the correct rebin
  hs->GetYaxis()->SetTitle(yTag.c_str());
  c1->SaveAs("zGoldenDauPt.eps");
  c1->SaveAs("zGoldenDauPtLin_r2.gif");
  c1->SaveAs("zGoldenDauPt.pdf");
}
コード例 #15
0
void plotAtriRunStatistics(char *baseName, Int_t runLow, Int_t runHigh, Int_t numWeeks){
  chain = new TChain("runStatsTree");
  char fileName[256];
  for(Int_t runNo=runLow;runNo<=runHigh;runNo++){
    sprintf(fileName, "%s_run%i.root", baseName, runNo);
    printf("Adding %s\n", fileName);
    chain->Add(fileName);
  }
  
  chain->SetBranchAddress("stationId", &stationId);
  chain->GetEntry(0);
  getGraphs();
  TTimeStamp *timeThen = new TTimeStamp();
  timeThen->Add(-7*24*60*60*numWeeks);
  makePlots(timeThen->GetSec());
}
コード例 #16
0
void stack_zGoldenDauTrkIso() {
  //TCut cut_zGolden("zGoldenMass>60 && zGoldenMass<120 && zGoldenDau1Pt> 20 && zGoldenDau2Pt>20 && zGoldenDau1TrkIso< 3000.0 && zGoldenDau1TrkIso < 3000.0 && abs(zGoldenDau1Eta)<2.4 &&  abs(zGoldenDau2Eta)<2.4 && zGoldenDau1Chi2<10 && zGoldenDau2Chi2<10 && abs(zGoldenDau1dxyFromBS)<0.2 && abs(zGoldenDau2dxyFromBS)<0.2  && ( zGoldenDau1NofStripHits + zGoldenDau1NofPixelHits)>9 && zGoldenDau1NofPixelHits>0 && ( zGoldenDau2NofStripHits + zGoldenDau2NofPixelHits)>9 &&  zGoldenDau2NofPixelHits>0 && zGoldenDau1NofMuonHits>0 && zGoldenDau2NofMuonHits>0 && zGoldenDau1NofMuMatches>1 && zGoldenDau2NofMuMatches>1  && zGoldenDau1TrackerMuonBit==1 && zGoldenDau2TrackerMuonBit==1 && (zGoldenDau1HLTBit==1 || zGoldenDau2HLTBit==1) ");

TCut kin_common_woIso("zGoldenDau1Pt>20 && zGoldenDau2Pt>20 && abs(zGoldenDau1Eta)<2.4 &&  abs(zGoldenDau2Eta)<2.4  && (zGoldenDau1HLTBit==1 || zGoldenDau2HLTBit==1)  && abs(zGoldenDau1dxyFromBS)<0.2 && abs(zGoldenDau2dxyFromBS)<0.2 ");



 makePlots("zGoldenDau1Iso03SumPt", "zGoldenDau2Iso03SumPt",  massCut + kin_common_woIso + ( ( dau1Loose  && dau2TightWP1_hltAlso) || ( dau2Loose  && dau1TightWP1_hltAlso )) , 1, "zGoldenDauTrkIso",  0.01, 25, 0 ,5, true, false);
  hs->GetXaxis()->SetTitle("#sum pt [GeV] (tracker)");
  string yTag = "events/ .2 GeV "; // use the correct rebin
  hs->GetYaxis()->SetTitle(yTag.c_str());
  hs->GetYaxis()->SetTitleOffset(1.2);
  c1->SaveAs("zGoldenDauTrkIso.eps");
  c1->SaveAs("zGoldenDauTrkIso.gif");
  //  c1->SaveAs("zGoldenDauTrkIso.pdf");
}
コード例 #17
0
void stack_zGoldenDauNofStripHits() {
  //TCut cut_zGolden("zGoldenMass>60 && zGoldenMass<120 && zGoldenDau1Pt> 20 && zGoldenDau2Pt>20 && zGoldenDau1TrkIso< 3.0 && zGoldenDau1TrkIso < 3.0 && abs(zGoldenDau1Eta)<2.4 &&  abs(zGoldenDau2Eta)<2.4 && zGoldenDau1Chi2<10 && zGoldenDau2Chi2<10 && abs(zGoldenDau1dxyFromBS)<0.2 && abs(zGoldenDau2dxyFromBS)<0.2 && zGoldenDau1NofStripHits>0 && zGoldenDau1NofPixelHits>0 && zGoldenDau2NofStripHits>0 &&  zGoldenDau2NofPixelHits>0 && zGoldenDau1NofMuonHits>0 && zGoldenDau2NofMuonHits>0 && zGoldenDau1NofMuMatches>1 && zGoldenDau2NofMuMatches>1 && zGoldenDau1TrackerMuonBit==1 && zGoldenDau2TrackerMuonBit==1 && (zGoldenDau1HLTBit==1 || zGoldenDau2HLTBit==1) ");

  makePlots("zGoldenDau1NofStripHits +zGoldenDau1NofPixelHits ", "zGoldenDau2NofStripHits + zGoldenDau2NofPixelHits",  massCut + kin_common,  1, "zGoldenDauNofTrkHits",  0.001, 40, -0.5 ,39.5, true, false);
  hs->GetXaxis()->SetTitle("# of tracker hits");
  string yTag = "events"; // use the correct rebin
  hs->GetYaxis()->SetTitle(yTag.c_str());
  c1->SaveAs("zGoldenDauNofTrkHits.eps");
  c1->SaveAs("zGoldenDauNofTrkHits.gif");
  //  c1->SaveAs("zGoldenDauNofTrkHits.pdf");

  //  TCut Ncut("zGoldenMass>60 && zGoldenMass<120 && zGoldenDau1Pt> 20 && zGoldenDau2Pt>20 && zGoldenDau1TrkIso< 3.0 && zGoldenDau1TrkIso < 3.0 && abs(zGoldenDau1Eta)<2.4 &&  abs(zGoldenDau2Eta)<2.4 && zGoldenDau1Chi2<10 && zGoldenDau2Chi2<10 && abs(zGoldenDau1dxyFromBS)<0.2 && abs(zGoldenDau2dxyFromBS)<0.2 && ( zGoldenDau1NofStripHits + zGoldenDau1NofPixelHits)>10 && (zGoldenDau2NofStripHits + zGoldenDau2NofPixelHits)>10  && zGoldenDau1NofPixelHits>0  && zGoldenDau2NofPixelHits>0 && zGoldenDau1NofMuonHits>0 && zGoldenDau2NofMuonHits>0 && zGoldenDau1NofMuMatches>1 && zGoldenDau2NofMuMatches>1 && zGoldenDau1TrackerMuonBit==1 && zGoldenDau2TrackerMuonBit==1 && (zGoldenDau1HLTBit==1 || zGoldenDau2HLTBit==1) ");

  // evalEff("zGoldenDau1NofStripHits +zGoldenDau1NofPixelHits ", "zGoldenDau2NofStripHits + zGoldenDau2NofPixelHits", cut_zGolden, Ncut,  40, -0.5, 39.5); 

  evalEff("zGoldenDau1NofStripHits +zGoldenDau1NofPixelHits ", "zGoldenDau2NofStripHits + zGoldenDau2NofPixelHits", massCut + kin_common , massCut + kin_common + "(zGoldenDau1NofStripHits +zGoldenDau1NofPixelHits) > 10  && (zGoldenDau2NofStripHits +zGoldenDau2NofPixelHits)>10  " ,  40, -0.5, 39.5); 

}
コード例 #18
0
void stack_zGolden_ttbarEnhanced() {



  std::cout<< "combIso " << std::endl;

  //  makePlots("zGoldenMass", "", kin_common + dau1TightWP1_notChi2AndTrackerMuon  + dau2TightWP1_notChi2AndTrackerMuon + cut_1Iso + cut_2Iso + antiCosmicCut + "abs(zGoldenDau1Eta)<2.1 && abs(zGoldenDau2Eta)<2.1" + "numJets>0 && metPt>-1", "" ,1, "zGoldenLog_b1_0-200_njetm0",  0.1, 200, 0 ,200, true, true, true);
  //  makePlots("zGoldenMass", "", kin_common + dau1TightWP1_notChi2AndTrackerMuon  + dau2TightWP1_notChi2AndTrackerMuon + cut_1Iso + cut_2Iso + antiCosmicCut + "abs(zGoldenDau1Eta)<2.1 && abs(zGoldenDau2Eta)<2.1" + "numJets>1 && metPt>-1", "" ,1, "zGoldenLog_b1_0-200_njetm1",  0.1, 200, 0 ,200, true, true, true);

  // evalEff("zGoldenMass", "",  kin_common + massCut, kin_common + massCut + ( ( dau1Loose  && dau2TightWP1_hltAlso ) || ( dau2Loose  && dau1TightWP1_hltAlso )) ,200, 0, 200); 


  std::cout<< "trkIso " << std::endl;

  makePlots("numJets", "", "zGoldenMass>60 && zGoldenMass<120" +  kin_common + dau1TightWP1_notChi2AndTrackerMuon  + dau2TightWP1_notChi2AndTrackerMuon + cut_Trk1Iso + cut_Trk2Iso + antiCosmicCut + "abs(zGoldenDau1Eta)<2.1 && abs(zGoldenDau2Eta)<2.1"   , "" ,1, "numJets",  0.1, 10, -0.5 ,9.5, true, true, true);



}
コード例 #19
0
void makePlots() 
{
  gROOT->SetStyle("Plain");
  gROOT->SetBatch(false);
  // --- Use the CMS TDR style
  gROOT->ProcessLine(".L tdrStyle.C");
  setTDRStyle();
  tdrStyle->SetErrorX(0.5);
  tdrStyle->SetPadLeftMargin(0.10);
  tdrStyle->SetPadRightMargin(0.10);

  tdrStyle->SetPadTopMargin(0.20);
  tdrStyle->SetPadBottomMargin(0.20);

  tdrStyle->SetLegendBorderSize(0);
  tdrStyle->SetTitleYOffset(0.8);
  tdrStyle->SetOptStat(0);
  tdrStyle->SetOptFit(0);
  tdrStyle->SetTitleFontSize(0.08);
  tdrStyle->SetStatStyle(0);
  tdrStyle->cd();

  //Figure 4 - these plots go into paper
  //Star -> Vacuum -> Surface of Earth

  makePlots("Vacuum", "SetI",
            "./root_files/ModelA/output_ModelA_SetI.root", 
            "./root_files/ModelB/output_ModelB_SetI.root", 
            "./root_files/ZeroPt/output_ZeroPt_SetI.root");

  //makePlots("Vacuum", "SetII",
  //          "./root_files/ModelA/output_ModelA_SetII.root", 
  //          "./root_files/ModelB/output_ModelB_SetII.root", 
  //          "./root_files/ZeroPt/output_ZeroPt_SetII.root");
  
}
コード例 #20
0
void makePlots() 
{
  gROOT->SetStyle("Plain");
  gROOT->SetBatch(false);
  // --- Use the CMS TDR style
  gROOT->ProcessLine(".L tdrStyle.C");
  setTDRStyle();
  tdrStyle->SetErrorX(0.5);
  tdrStyle->SetPadLeftMargin(0.10);
  tdrStyle->SetPadRightMargin(0.08);
  tdrStyle->SetPadTopMargin(0.10);
  tdrStyle->SetLegendBorderSize(0);
  tdrStyle->SetTitleYOffset(0.8);
  tdrStyle->SetOptStat(0);
  tdrStyle->SetOptFit(0);
  tdrStyle->SetTitleFontSize(0.08);
  tdrStyle->SetStatStyle(0);
  tdrStyle->cd();

  makePlots("./root_files/Earth/output-earthA-x2.root",
            "./root_files/Earth/output-earthB-x2.root",
            "X2");
    
}
コード例 #21
0
void stack_zmm0neLess2p4() {
  makePlots("goodZToMuMuOnlyOneMuonWithEtaLessThan2p11HLTPlots/zMass",  1, "zmm1hltEta24", 0.0001);
}
コード例 #22
0
void makePlots() 
{
  gROOT->SetStyle("Plain");
  gROOT->SetBatch(false);
  // --- Use the CMS TDR style
  gROOT->ProcessLine(".L tdrStyle.C");
  setTDRStyle();
  tdrStyle->SetErrorX(0.5);
  tdrStyle->SetPadLeftMargin(0.10);
  tdrStyle->SetPadRightMargin(0.10);
  tdrStyle->SetLegendBorderSize(0);
  tdrStyle->SetTitleYOffset(0.8);
  tdrStyle->SetOptStat(0);
  tdrStyle->SetOptFit(0);
  tdrStyle->SetTitleFontSize(0.08);
  tdrStyle->SetStatStyle(0);
  tdrStyle->cd();

  //Figure 3
  //Star - These plots go into the paper01


  //. SET I
  
  makePlots("ModelA",
            "ModelB",
            "ModelC", 
            "0",
            "SetI",
            "./root_files/Ratios/output_ModelA_SetI.root",
            "./root_files/Ratios/output_ModelB_SetI.root",
            "./root_files/Ratios/output_ModelC_SetI.root",
            "./root_files/Ratios/output_ZeroPt_SetI.root");
  
  /*
    
    //. SET I - Fine DX
    
    makePlots("ModelA",
    "ModelB",
    "ModelC", 
    "0",
    "SetI",
    "./root_files/ModelA/output_ModelA_SetI_FineDX.root", 
    "./root_files/ModelB/output_ModelB_SetI_FineDX.root",
    "./root_files/ModelC/output_ModelC_SetI_FineDX.root",
    "./root_files/ZeroPt/output_ZeroPt_SetI_FineDX.root");
      
  */
  
  
  /* 
     
     //. SET II 
     
     makePlots("ModelA",
     "ModelB", 
     "ModelC", 
     "0", 
     "SetII",
     "./root_files/ModelA/output_ModelA_SetII.root", 
     "./root_files/ModelB/output_ModelB_SetII.root",
     "./root_files/ModelC/output_ModelC_SetII.root",
     "./root_files/ZeroPt/output_ZeroPt_SetII.root");
     
  */
  
  
}
コード例 #23
0
ファイル: dynamix.cpp プロジェクト: andyras/GAlib-mpi
int dynamixMain (int argc, char * argv[]) {



  //// DECLARING VARIABLES


  // Struct of parameters
  PARAMETERS p;
  // CVode variables
  void * cvode_mem = NULL;			// pointer to block of CVode memory
  N_Vector y, yout;			// arrays of populations

  // arrays for energetic parameters
  realtype ** V = NULL;				// pointer to k-c coupling constants
  realtype * Vbridge = NULL;			// pointer to array of bridge coupling constants.
  // first element [0] is Vkb1, last [Nb] is VcbN
  realtype * Vnobridge = NULL;			// coupling constant when there is no bridge

  //// Setting defaults for parameters to be read from input
  //// done setting defaults

  int flag;
  realtype * k_pops = NULL;				// pointers to arrays of populations
  realtype * l_pops = NULL;
  realtype * c_pops = NULL;
  realtype * b_pops = NULL;
  realtype * ydata = NULL;				// pointer to ydata (contains all populations)
  realtype * wavefunction = NULL;			// (initial) wavefunction
  realtype * dm = NULL;					// density matrix
  realtype * dmt = NULL;				// density matrix in time
  realtype * wfnt = NULL;				// density matrix in time
  realtype * k_energies = NULL;				// pointers to arrays of energies
  realtype * c_energies = NULL;
  realtype * b_energies = NULL;
  realtype * l_energies = NULL;
  realtype t0 = 0.0;				// initial time
  realtype t = 0;
  realtype tret = 0;					// time returned by the solver
  time_t startRun;				// time at start of log
  time_t endRun;					// time at end of log
  struct tm * currentTime = NULL;			// time structure for localtime
#ifdef DEBUG
  FILE * realImaginary;				// file containing real and imaginary parts of the wavefunction
#endif
  FILE * log;					// log file with run times
  realtype * tkprob = NULL; 				// total probability in k, l, c, b states at each timestep
  realtype * tlprob = NULL;
  realtype * tcprob = NULL;
  realtype * tbprob = NULL;
  double ** allprob = NULL;				// populations in all states at all times
  realtype * times = NULL;
  realtype * qd_est = NULL;
  realtype * qd_est_diag = NULL;
  std::string inputFile = "ins/parameters.in";			// name of input file
  std::string cEnergiesInput = "ins/c_energies.in";
  std::string cPopsInput = "ins/c_pops.in";
  std::string bEnergiesInput = "ins/b_energies.in";
  std::string VNoBridgeInput = "ins/Vnobridge.in";
  std::string VBridgeInput = "ins/Vbridge.in";
  std::map<const std::string, bool> outs;	// map of output file names to bool

  // default output directory
  p.outputDir = "outs/";

  double summ = 0;			// sum variable

  // ---- process command line flags ---- //
  opterr = 0;
  int c;
  std::string insDir;
  /* process command line options */
  while ((c = getopt(argc, argv, "i:o:")) != -1) {
    switch (c) {
      case 'i':
	// check that it ends in a slash
	std::cerr << "[dynamix]: assigning input directory" << std::endl;
	insDir = optarg;
	if (strcmp(&(insDir.at(insDir.length() - 1)), "/")) {
	  std::cerr << "ERROR: option -i requires argument ("
	            << insDir << ") to have a trailing slash (/)." << std::endl;
	  return 1;
	}
	else {
	  // ---- assign input files ---- //
	  inputFile = insDir + "parameters.in";
	  cEnergiesInput = insDir + "c_energies.in";
	  cPopsInput = insDir + "c_pops.in";
	  bEnergiesInput = insDir + "b_energies.in";
	  VNoBridgeInput = insDir + "Vnobridge.in";
	  VBridgeInput = insDir + "Vbridge.in";
	}
	break;
      case 'o':
	std::cerr << "[dynamix]: assigning output directory" << std::endl;
	p.outputDir = optarg;
	break;
      case '?':
	if (optopt == 'i') {
	  fprintf(stderr, "Option -%c requires a directory argument.\n", optopt);
	}
	else if (isprint(optopt)) {
	  fprintf(stderr, "Unknown option -%c.\n", optopt);
	}
	else {
	  fprintf(stderr, "Unknown option character `\\x%x'.\n", optopt);
	}
	return 1;
      default:
	continue;
    }
  }
  optind = 1;	// reset global variable counter for the next time this is run

  std::cerr << "[dynamix]: ARGUMENTS" << std::endl;
  for (int ii = 0; ii < argc; ii++) {
    std::cerr << "[dynamix]: " << argv[ii] << std::endl;
  }

  //// ASSIGN PARAMETERS FROM INPUT FILE


  // ---- TODO create output directory if it does not exist ---- //
  flag = mkdir(p.outputDir.c_str(), 0755);

  std::cerr << "Looking for inputs in all the " << inputFile << " places" << std::endl;
  assignParams(inputFile.c_str(), &p);

  // Decide which output files to make
#ifdef DEBUG
  std::cout << "Assigning outputs as specified in " << inputFile << "\n";
#endif
  assignOutputs(inputFile.c_str(), outs, &p);

#ifdef DEBUG
  // print out which outputs will be made
  for (std::map<const std::string, bool>::iterator it = outs.begin(); it != outs.end(); it++) {
    std::cout << "Output file: " << it->first << " will be created.\n";
  }
#endif

  // OPEN LOG FILE; PUT IN START TIME //
  if (isOutput(outs, "log.out")) {
    log = fopen("log.out", "w");			// note that this file is closed at the end of the program
  }
  time(&startRun);
  currentTime = localtime(&startRun);
  if (isOutput(outs, "log.out")) {
    fprintf(log, "Run started at %s\n", asctime(currentTime));
  }

  if (isOutput(outs, "log.out")) {
    // make a note about the laser intensity.
    fprintf(log,"The laser intensity is %.5e W/cm^2.\n\n",pow(p.pumpAmpl,2)*3.5094452e16);
  }


  //// READ DATA FROM INPUTS


  p.Nc = numberOfValuesInFile(cEnergiesInput.c_str());
  p.Nb = numberOfValuesInFile(bEnergiesInput.c_str());
  k_pops = new realtype [p.Nk];
  c_pops = new realtype [p.Nc];
  b_pops = new realtype [p.Nb];
  l_pops = new realtype [p.Nl];
  k_energies = new realtype [p.Nk];
  c_energies = new realtype [p.Nc];
  b_energies = new realtype [p.Nb];
  l_energies = new realtype [p.Nl];
  if (numberOfValuesInFile(cPopsInput.c_str()) != p.Nc) {
    fprintf(stderr, "ERROR [Inputs]: c_pops and c_energies not the same length.\n");
    return -1;
  }
  readArrayFromFile(c_energies, cEnergiesInput.c_str(), p.Nc);
  if (p.bridge_on) {
    if (p.bridge_on && (p.Nb < 1)) {
      std::cerr << "\nERROR: bridge_on but no bridge states.  The file b_energies.in is probably empty.\n";
      return -1;
    }
    p.Vbridge.resize(p.Nb+1);
    readArrayFromFile(b_energies, bEnergiesInput.c_str(), p.Nb);
    readVectorFromFile(p.Vbridge, VBridgeInput.c_str(), p.Nb + 1);
#ifdef DEBUG
    std::cout << "COUPLINGS:";
    for (int ii = 0; ii < p.Nb+1; ii++) {
      std::cout << " " << p.Vbridge[ii];
    }
    std::cout << std::endl;
#endif
  }
  else {
    p.Nb = 0;
    p.Vnobridge.resize(1);
    readVectorFromFile(p.Vnobridge, VNoBridgeInput.c_str(), 1);
  }

#ifdef DEBUG
  std::cout << "\nDone reading things from inputs.\n";
#endif


  //// PREPROCESS DATA FROM INPUTS


  // check torsion parameters, set up torsion spline
  if (p.torsion) {
#ifdef DEBUG
    std::cout << "Torsion is on." << std::endl;
#endif

    // error checking
    if (p.torsionSite > p.Nb) {
      std::cerr << "ERROR: torsion site (" << p.torsionSite
	<< ") is larger than number of bridge sites (" << p.Nb << ")." << std::endl;
      exit(-1);
    }
    else if (p.torsionSite < 0) {
      std::cerr << "ERROR: torsion site is less than zero." << std::endl;
      exit(-1);
    }

    if (!fileExists(p.torsionFile)) {
      std::cerr << "ERROR: torsion file " << p.torsionFile << " does not exist." << std::endl;
    }

    // create spline
    p.torsionV = new Spline(p.torsionFile.c_str());
    if (p.torsionV->getFirstX() != 0.0) {
      std::cerr << "ERROR: time in " << p.torsionFile << " should start at 0.0." << std::endl;
      exit(-1);
    }
    if (p.torsionV->getLastX() < p.tout) {
      std::cerr << "ERROR: time in " << p.torsionFile << " should be >= tout." << std::endl;
      exit(-1);
    }
  }


  // set number of processors for OpenMP
  //omp_set_num_threads(p.nproc);
  mkl_set_num_threads(p.nproc);

  p.NEQ = p.Nk+p.Nc+p.Nb+p.Nl;				// total number of equations set
  p.NEQ2 = p.NEQ*p.NEQ;				// number of elements in DM
#ifdef DEBUG
  std::cout << "\nTotal number of states: " << p.NEQ << std::endl;
  std::cout << p.Nk << " bulk, " << p.Nc << " QD, " << p.Nb << " bridge, " << p.Nl << " bulk VB.\n";
#endif
  tkprob = new realtype [p.numOutputSteps+1];	// total population on k, b, c at each timestep
  tcprob = new realtype [p.numOutputSteps+1];
  tbprob = new realtype [p.numOutputSteps+1];
  tlprob = new realtype [p.numOutputSteps+1];
  allprob = new double * [p.numOutputSteps+1];
  for (int ii = 0; ii <= p.numOutputSteps; ii++) {
    allprob[ii] = new double [p.NEQ];
  }
  // assign times.
  p.times.resize(p.numOutputSteps+1);
  for (int ii = 0; ii <= p.numOutputSteps; ii++) {
    p.times[ii] = float(ii)/p.numOutputSteps*p.tout;
  }
  qd_est = new realtype [p.numOutputSteps+1];
  qd_est_diag = new realtype [p.numOutputSteps+1];
  p.Ik = 0;					// set index start positions for each type of state
  p.Ic = p.Nk;
  p.Ib = p.Ic+p.Nc;
  p.Il = p.Ib+p.Nb;

  // assign bulk conduction and valence band energies
  // for RTA, bulk and valence bands have parabolic energies
  if (p.rta) {
    buildParabolicBand(k_energies, p.Nk, p.kBandEdge, CONDUCTION, &p);
    buildParabolicBand(l_energies, p.Nl, p.lBandTop, VALENCE, &p);
  }
  else {
    buildContinuum(k_energies, p.Nk, p.kBandEdge, p.kBandTop);
    buildContinuum(l_energies, p.Nl, p.kBandEdge - p.valenceBand - p.bulk_gap, p.kBandEdge - p.bulk_gap);
  }
  // calculate band width
  p.kBandWidth = k_energies[p.Nk - 1] - k_energies[0];


  //// BUILD INITIAL WAVEFUNCTION


  // bridge states (empty to start)
  initializeArray(b_pops, p.Nb, 0.0);

  // coefficients in bulk and other states depend on input conditions in bulk
  if (!p.rta) {
#ifdef DEBUG
    std::cout << "\ninitializing k_pops\n";
#endif
    if (p.bulk_constant) {
      initializeArray(k_pops, p.Nk, 0.0);
#ifdef DEBUG
      std::cout << "\ninitializing k_pops with constant probability in range of states\n";
#endif
      initializeArray(k_pops+p.Nk_first-1, p.Nk_final-p.Nk_first+1, 1.0);
      initializeArray(l_pops, p.Nl, 0.0);		// populate l states (all 0 to start off)
      initializeArray(c_pops, p.Nc, 0.0);		// QD states empty to start
    }
    else if (p.bulk_Gauss) {
      buildKPopsGaussian(k_pops, k_energies, p.kBandEdge,
	  p.bulkGaussSigma, p.bulkGaussMu, p.Nk);   // populate k states with FDD
      initializeArray(l_pops, p.Nl, 0.0);		// populate l states (all 0 to start off)
      initializeArray(c_pops, p.Nc, 0.0);		// QD states empty to start
    }
    else if (p.qd_pops) {
      readArrayFromFile(c_pops, cPopsInput.c_str(), p.Nc);	// QD populations from file
      initializeArray(l_pops, p.Nl, 0.0);		// populate l states (all 0 to start off)
      initializeArray(k_pops, p.Nk, 0.0);             // populate k states (all zero to start off)
    }
    else {
      initializeArray(k_pops, p.Nk, 0.0);             // populate k states (all zero to start off)
      initializeArray(l_pops, p.Nl, 1.0);		// populate l states (all populated to start off)
      initializeArray(c_pops, p.Nc, 0.0);		// QD states empty to start
    }
#ifdef DEBUG
    std::cout << "\nThis is k_pops:\n";
    for (int ii = 0; ii < p.Nk; ii++) {
      std::cout << k_pops[ii] << std::endl;
    }
    std::cout << "\n";
#endif
  }
  // with RTA, use different set of switches
  else {
    // bulk valence band
    if (p.VBPopFlag == POP_EMPTY) {
#ifdef DEBUG
      std::cout << "Initializing empty valence band" << std::endl;
#endif
      initializeArray(l_pops, p.Nl, 0.0);
    }
    else if (p.VBPopFlag == POP_FULL) {
#ifdef DEBUG
      std::cout << "Initializing full valence band" << std::endl;
#endif
      initializeArray(l_pops, p.Nl, 1.0);
    }
    else {
      std::cerr << "ERROR: unrecognized VBPopFlag " << p.VBPopFlag << std::endl;
    }

    // bulk conduction band
    if (p.CBPopFlag == POP_EMPTY) {
#ifdef DEBUG
      std::cout << "Initializing empty conduction band" << std::endl;
#endif
      initializeArray(k_pops, p.Nk, 0.0);
    }
    else if (p.CBPopFlag == POP_FULL) {
#ifdef DEBUG
      std::cout << "Initializing full conduction band" << std::endl;
#endif
      initializeArray(k_pops, p.Nk, 1.0);
    }
    else if (p.CBPopFlag == POP_CONSTANT) {
#ifdef DEBUG
      std::cout << "Initializing constant distribution in conduction band" << std::endl;
#endif
      initializeArray(k_pops, p.Nk, 0.0);
      initializeArray(k_pops, p.Nk, 1e-1); // FIXME
      initializeArray(k_pops+p.Nk_first-1, p.Nk_final-p.Nk_first+1, 1.0);
    }
    else if (p.CBPopFlag == POP_GAUSSIAN) {
#ifdef DEBUG
      std::cout << "Initializing Gaussian in conduction band" << std::endl;
#endif
      buildKPopsGaussian(k_pops, k_energies, p.kBandEdge,
	  p.bulkGaussSigma, p.bulkGaussMu, p.Nk);
    }
    else {
      std::cerr << "ERROR: unrecognized CBPopFlag " << p.CBPopFlag << std::endl;
    }

    //// QD
    if (p.QDPopFlag == POP_EMPTY) {
      initializeArray(c_pops, p.Nc, 0.0);
    }
    else if (p.QDPopFlag == POP_FULL) {
      initializeArray(c_pops, p.Nc, 1.0);
    }
    else {
      std::cerr << "ERROR: unrecognized QDPopFlag " << p.QDPopFlag << std::endl;
    }
  }

  // create empty wavefunction
  wavefunction = new realtype [2*p.NEQ];
  initializeArray(wavefunction, 2*p.NEQ, 0.0);

  // assign real parts of wavefunction coefficients (imaginary are zero)
  for (int ii = 0; ii < p.Nk; ii++) {
    wavefunction[p.Ik + ii] = k_pops[ii];
  }
  for (int ii = 0; ii < p.Nc; ii++) {
    wavefunction[p.Ic + ii] = c_pops[ii];
  }
  for (int ii = 0; ii < p.Nb; ii++) {
    wavefunction[p.Ib + ii] = b_pops[ii];
  }
  for (int ii = 0; ii < p.Nl; ii++) {
    wavefunction[p.Il + ii] = l_pops[ii];
  }

  if (isOutput(outs, "psi_start.out")) {
    outputWavefunction(wavefunction, p.NEQ);
  }

  // Give all coefficients a random phase
  if (p.random_phase) {
    float phi;
    // set the seed
    if (p.random_seed == -1) { srand(time(NULL)); }
    else { srand(p.random_seed); }
    for (int ii = 0; ii < p.NEQ; ii++) {
      phi = 2*3.1415926535*(float)rand()/(float)RAND_MAX;
      wavefunction[ii] = wavefunction[ii]*cos(phi);
      wavefunction[ii + p.NEQ] = wavefunction[ii + p.NEQ]*sin(phi);
    }
  }

#ifdef DEBUG
  // print out details of wavefunction coefficients
  std::cout << std::endl;
  for (int ii = 0; ii < p.Nk; ii++) {
    std::cout << "starting wavefunction: Re[k(" << ii << ")] = " << wavefunction[p.Ik + ii] << std::endl;
  }
  for (int ii = 0; ii < p.Nc; ii++) {
    std::cout << "starting wavefunction: Re[c(" << ii << ")] = " << wavefunction[p.Ic + ii] << std::endl;
  }
  for (int ii = 0; ii < p.Nb; ii++) {
    std::cout << "starting wavefunction: Re[b(" << ii << ")] = " << wavefunction[p.Ib + ii] << std::endl;
  }
  for (int ii = 0; ii < p.Nl; ii++) {
    std::cout << "starting wavefunction: Re[l(" << ii << ")] = " << wavefunction[p.Il + ii] << std::endl;
  }
  for (int ii = 0; ii < p.Nk; ii++) {
    std::cout << "starting wavefunction: Im[k(" << ii << ")] = " << wavefunction[p.Ik + ii + p.NEQ] << std::endl;
  }
  for (int ii = 0; ii < p.Nc; ii++) {
    std::cout << "starting wavefunction: Im[c(" << ii << ")] = " << wavefunction[p.Ic + ii + p.NEQ] << std::endl;
  }
  for (int ii = 0; ii < p.Nb; ii++) {
    std::cout << "starting wavefunction: Im[b(" << ii << ")] = " << wavefunction[p.Ib + ii + p.NEQ] << std::endl;
  }
  for (int ii = 0; ii < p.Nl; ii++) {
    std::cout << "starting wavefunction: Im[l(" << ii << ")] = " << wavefunction[p.Il + ii + p.NEQ] << std::endl;
  }
  std::cout << std::endl;
  summ = 0;
  for (int ii = 0; ii < 2*p.NEQ; ii++) {
    summ += pow(wavefunction[ii],2);
  }
  std::cout << "\nTotal population is " << summ << "\n\n";
#endif


  //// ASSEMBLE ARRAY OF ENERGIES


  // TODO TODO
  p.energies.resize(p.NEQ);
  for (int ii = 0; ii < p.Nk; ii++) {
    p.energies[p.Ik + ii] = k_energies[ii];
  }
  for (int ii = 0; ii < p.Nc; ii++) {
    p.energies[p.Ic + ii] = c_energies[ii];
  }
  for (int ii = 0; ii < p.Nb; ii++) {
    p.energies[p.Ib + ii] = b_energies[ii];
  }
  for (int ii = 0; ii < p.Nl; ii++) {
    p.energies[p.Il + ii] = l_energies[ii];
  }

#ifdef DEBUG
  for (int ii = 0; ii < p.NEQ; ii++) {
    std::cout << "p.energies[" << ii << "] is " << p.energies[ii] << "\n";
  }
#endif


  //// ASSIGN COUPLING CONSTANTS


  V = new realtype * [p.NEQ];
  for (int ii = 0; ii < p.NEQ; ii++) {
    V[ii] = new realtype [p.NEQ];
  }
  buildCoupling(V, &p, outs);

  if (isOutput(outs, "log.out")) {
    // make a note in the log about system timescales
    double tau = 0;		// fundamental system timescale
    if (p.Nk == 1) {
      fprintf(log, "\nThe timescale (tau) is undefined (Nk == 1).\n");
    }
    else {
      if (p.bridge_on) {
	if (p.scale_bubr) {
	  tau = 1.0/(2*p.Vbridge[0]*M_PI);
	}
	else {
	  tau = ((p.kBandTop - p.kBandEdge)/(p.Nk - 1))/(2*pow(p.Vbridge[0],2)*M_PI);
	}
      }
      else {
	if (p.scale_buqd) {
	  tau = 1.0/(2*p.Vnobridge[0]*M_PI);
	}
	else {
	  tau = ((p.kBandTop - p.kBandEdge)/(p.Nk - 1))/(2*pow(p.Vnobridge[0],2)*M_PI);
	}
      }
      fprintf(log, "\nThe timescale (tau) is %.9e a.u.\n", tau);
    }
  }

  //// CREATE DENSITY MATRIX
  if (! p.wavefunction) {
    // Create the initial density matrix
    dm = new realtype [2*p.NEQ2];
    initializeArray(dm, 2*p.NEQ2, 0.0);
#pragma omp parallel for
    for (int ii = 0; ii < p.NEQ; ii++) {
      // diagonal part
      dm[p.NEQ*ii + ii] = pow(wavefunction[ii],2) + pow(wavefunction[ii + p.NEQ],2);
      if (p.coherent) {
	// off-diagonal part
	for (int jj = 0; jj < ii; jj++) {
	  // real part of \rho_{ii,jj}
	  dm[p.NEQ*ii + jj] = wavefunction[ii]*wavefunction[jj] + wavefunction[ii+p.NEQ]*wavefunction[jj+p.NEQ];
	  // imaginary part of \rho_{ii,jj}
	  dm[p.NEQ*ii + jj + p.NEQ2] = wavefunction[ii]*wavefunction[jj+p.NEQ] - wavefunction[jj]*wavefunction[ii+p.NEQ];
	  // real part of \rho_{jj,ii}
	  dm[p.NEQ*jj + ii] = dm[p.NEQ*ii + jj];
	  // imaginary part of \rho_{jj,ii}
	  dm[p.NEQ*jj + ii + p.NEQ2] = -1*dm[p.NEQ*ii + jj + p.NEQ*p.NEQ];
	}
      }
    }

    // Create the array to store the density matrix in time
    dmt = new realtype [2*p.NEQ2*(p.numOutputSteps+1)];
    initializeArray(dmt, 2*p.NEQ2*(p.numOutputSteps+1), 0.0);

#ifdef DEBUG2
    // print out density matrix
    std::cout << "\nDensity matrix without normalization:\n\n";
    for (int ii = 0; ii < p.NEQ; ii++) {
      for (int jj = 0; jj < p.NEQ; jj++) {
	fprintf(stdout, "(%+.1e,%+.1e) ", dm[p.NEQ*ii + jj], dm[p.NEQ*ii + jj + p.NEQ2]);
      }
      fprintf(stdout, "\n");
    }
#endif

    // Normalize the DM so that populations add up to 1.
    // No normalization if RTA is on.
    if (!p.rta) {
      summ = 0.0;
      for (int ii = 0; ii < p.NEQ; ii++) {
	// assume here that diagonal elements are all real
	summ += dm[p.NEQ*ii + ii];
      }
      if ( summ == 0.0 ) {
	std::cerr << "\nFATAL ERROR [populations]: total population is 0!\n";
	return -1;
      }
      if (summ != 1.0) {
	// the variable 'summ' is now a multiplicative normalization factor
	summ = 1.0/summ;
	for (int ii = 0; ii < 2*p.NEQ2; ii++) {
	  dm[ii] *= summ;
	}
      }
#ifdef DEBUG
      std::cout << "\nThe normalization factor for the density matrix is " << summ << "\n\n";
#endif
    }

    // Error checking for total population; recount population first
    summ = 0.0;
    for (int ii = 0; ii < p.NEQ; ii++) {
      summ += dm[p.NEQ*ii + ii];
    }
    if ( fabs(summ-1.0) > 1e-12  && (!p.rta)) {
      std::cerr << "\nWARNING [populations]: After normalization, total population is not 1, it is " << summ << "!\n";
    }
#ifdef DEBUG
    std::cout << "\nAfter normalization, the sum of the populations in the density matrix is " << summ << "\n\n";
#endif
    // Add initial DM to parameters.
    p.startDM.resize(2*p.NEQ2);
    memcpy(&(p.startDM[0]), &(dm[0]), 2*p.NEQ2*sizeof(double));
  }
  // wavefunction
  else {

    // Create the array to store the wavefunction in time
    wfnt = new realtype [2*p.NEQ*(p.numOutputSteps+1)];
    initializeArray(wfnt, 2*p.NEQ*(p.numOutputSteps+1), 0.0);

    // normalize
    summ = 0.0;
    for (int ii = 0; ii < p.NEQ; ii++) {
      summ += pow(wavefunction[ii],2) + pow(wavefunction[ii+p.NEQ],2);
    }
#ifdef DEBUG
    std::cout << "Before normalization, the total population is " << summ << std::endl;
#endif
    summ = 1.0/sqrt(summ);
    for (int ii = 0; ii < 2*p.NEQ; ii++) {
      wavefunction[ii] *= summ;
    }

    // check total population
    summ = 0.0;
    for (int ii = 0; ii < p.NEQ; ii++) {
      summ += pow(wavefunction[ii],2) + pow(wavefunction[ii+p.NEQ],2);
    }
#ifdef DEBUG
    std::cout << "After normalization, the total population is " << summ << std::endl;
#endif
    if (fabs(summ - 1.0) > 1e-12) {
      std::cerr << "WARNING: wavefunction not normalized!  Total density is " << summ << std::endl;
    }

    // Add initial wavefunction to parameters.
    p.startWfn.resize(2*p.NEQ);
    memcpy(&(p.startWfn[0]), &(wavefunction[0]), 2*p.NEQ*sizeof(double));
  }


  //// BUILD HAMILTONIAN


  // //TODO TODO
#ifdef DEBUG
  fprintf(stderr, "Building Hamiltonian.\n");
#endif
  realtype * H = NULL;
  H = new realtype [p.NEQ2];
  for (int ii = 0; ii < p.NEQ2; ii++) {
    H[ii] = 0.0;
  }
  buildHamiltonian(H, p.energies, V, &p);
  // add Hamiltonian to p
  p.H.resize(p.NEQ2);
  for (int ii = 0; ii < p.NEQ2; ii++) {
    p.H[ii] = H[ii];
  }
  // create sparse version of H
  p.H_sp.resize(p.NEQ2);
  p.H_cols.resize(p.NEQ2);
  p.H_rowind.resize(p.NEQ2 + 1);
  int job [6] = {0, 0, 0, 2, p.NEQ2, 1};
  int info = 0;

  mkl_ddnscsr(&job[0], &(p.NEQ), &(p.NEQ), &(p.H)[0], &(p.NEQ), &(p.H_sp)[0],
      &(p.H_cols)[0], &(p.H_rowind)[0], &info);


  //// SET UP CVODE VARIABLES


#ifdef DEBUG
  std::cout << "\nCreating N_Vectors.\n";
  if (p.wavefunction) {
    std::cout << "\nProblem size is " << 2*p.NEQ << " elements.\n";
  }
  else {
    std::cout << "\nProblem size is " << 2*p.NEQ2 << " elements.\n";
  }
#endif
  // Creates N_Vector y with initial populations which will be used by CVode//
  if (p.wavefunction) {
    y = N_VMake_Serial(2*p.NEQ, wavefunction);
  }
  else {
    y = N_VMake_Serial(2*p.NEQ2, dm);
  }
  // put in t = 0 information
  if (! p.wavefunction) {
    updateDM(y, dmt, 0, &p);
  }
  else {
    updateWfn(y, wfnt, 0, &p);
  }
  // the vector yout has the same dimensions as y
  yout = N_VClone(y);

#ifdef DEBUG
  realImaginary = fopen("real_imaginary.out", "w");
#endif

  // Make plot files
  makePlots(outs, &p);

  // only do propagation if not just making plots
  if (! p.justPlots) {
    // Make outputs independent of time propagation
    computeGeneralOutputs(outs, &p);

    // create CVode object
    // this is a stiff problem, I guess?
#ifdef DEBUG
    std::cout << "\nCreating cvode_mem object.\n";
#endif
    cvode_mem = CVodeCreate(CV_BDF, CV_NEWTON);
    flag = CVodeSetUserData(cvode_mem, (void *) &p);

#ifdef DEBUG
    std::cout << "\nInitializing CVode solver.\n";
#endif
    // initialize CVode solver //

    if (p.wavefunction) {
      //flag = CVodeInit(cvode_mem, &RHS_WFN, t0, y);
      flag = CVodeInit(cvode_mem, &RHS_WFN_SPARSE, t0, y);
    }
    else {
      if (p.kinetic) {
	flag = CVodeInit(cvode_mem, &RHS_DM_RELAX, t0, y);
      }
      else if (p.rta) {
	flag = CVodeInit(cvode_mem, &RHS_DM_RTA, t0, y);
	//flag = CVodeInit(cvode_mem, &RHS_DM_RTA_BLAS, t0, y);
      }
      else if (p.dephasing) {
	flag = CVodeInit(cvode_mem, &RHS_DM_dephasing, t0, y);
      }
      else {
	//flag = CVodeInit(cvode_mem, &RHS_DM, t0, y);
	flag = CVodeInit(cvode_mem, &RHS_DM_BLAS, t0, y);
      }
    }

#ifdef DEBUG
    std::cout << "\nSpecifying integration tolerances.\n";
#endif
    // specify integration tolerances //
    flag = CVodeSStolerances(cvode_mem, p.reltol, p.abstol);

#ifdef DEBUG
    std::cout << "\nAttaching linear solver module.\n";
#endif
    // attach linear solver module //
    if (p.wavefunction) {
      flag = CVDense(cvode_mem, 2*p.NEQ);
    }
    else {
      // Diagonal approximation to the Jacobian saves memory for large systems
      flag = CVDiag(cvode_mem);
    }

    //// CVODE TIME PROPAGATION


#ifdef DEBUG
    std::cout << "\nAdvancing the solution in time.\n";
#endif
    for (int ii = 1; ii <= p.numsteps; ii++) {
      t = (p.tout*((double) ii)/((double) p.numsteps));
      flag = CVode(cvode_mem, t, yout, &tret, 1);
#ifdef DEBUGf
      std::cout << std::endl << "CVode flag at step " << ii << ": " << flag << std::endl;
#endif
      if ((ii % (p.numsteps/p.numOutputSteps) == 0) || (ii == p.numsteps)) {
	// show progress in stdout
	if (p.progressStdout) {
	  fprintf(stdout, "\r%-.2lf percent done", ((double)ii/((double)p.numsteps))*100);
	  fflush(stdout);
	}
	// show progress in a file
	if (p.progressFile) {
	  std::ofstream progressFile("progress.tmp");
	  progressFile << ((double)ii/((double)p.numsteps))*100 << " percent done." << std::endl;
	  progressFile.close();
	}
	if (p.wavefunction) {
	  updateWfn(yout, wfnt, ii*p.numOutputSteps/p.numsteps, &p);
	}
	else {
	  updateDM(yout, dmt, ii*p.numOutputSteps/p.numsteps, &p);
	}
      }
    }

#ifdef DEBUG
    fclose(realImaginary);
#endif


    //// MAKE FINAL OUTPUTS


    // finalize log file //
    time(&endRun);
    currentTime = localtime(&endRun);
    if (isOutput(outs, "log.out")) {
      fprintf(log, "Final status of 'flag' variable: %d\n\n", flag);
      fprintf(log, "Run ended at %s\n", asctime(currentTime));
      fprintf(log, "Run took %.3g seconds.\n", difftime(endRun, startRun));
      fclose(log);					// note that the log file is opened after variable declaration
    }
    if (p.progressStdout) {
      printf("\nRun took %.3g seconds.\n", difftime(endRun, startRun));
    }

    // Compute density outputs.
#ifdef DEBUG
    std::cout << "Computing outputs..." << std::endl;
#endif
    if (p.wavefunction) {
      computeWfnOutput(wfnt, outs, &p);
    }
    else {
      computeDMOutput(dmt, outs, &p);
    }
#ifdef DEBUG
    std::cout << "done computing outputs" << std::endl;
#endif

    // do analytical propagation
    if (p.analytical && (! p.bridge_on)) {
      computeAnalyticOutputs(outs, &p);
    }
  }


  //// CLEAN UP


#ifdef DEBUG
  fprintf(stdout, "Deallocating N_Vectors.\n");
#endif
  // deallocate memory for N_Vectors //
  N_VDestroy_Serial(y);
  N_VDestroy_Serial(yout);

#ifdef DEBUG
  fprintf(stdout, "Freeing CVode memory.\n");
#endif
  // free solver memory //
  CVodeFree(&cvode_mem);

#ifdef DEBUG
  fprintf(stdout, "Freeing memory in main.\n");
#endif
  // delete all these guys
  delete [] tkprob;
  delete [] tlprob;
  delete [] tcprob;
  delete [] tbprob;
  for (int ii = 0; ii <= p.numOutputSteps; ii++) {
    delete [] allprob[ii];
  }
  delete [] allprob;
  delete [] k_pops;
  delete [] c_pops;
  delete [] b_pops;
  delete [] l_pops;
  if (p.bridge_on) {
    delete [] Vbridge;
  }
  else {
    delete [] Vnobridge;
  }
  delete [] k_energies;
  delete [] c_energies;
  delete [] b_energies;
  delete [] l_energies;
  delete [] wavefunction;
  delete [] H;
  for (int ii = 0; ii < p.NEQ; ii++) {
    delete [] V[ii];
  }
  delete [] V;
  if (p.wavefunction) {
    delete [] wfnt;
  }
  else {
    delete [] dm;
    delete [] dmt;
  }
  delete [] times;
  delete [] qd_est;
  delete [] qd_est_diag;

  std::cout << "whoo" << std::endl;

  return 0;
}
コード例 #24
0
ファイル: Interpolate.C プロジェクト: abaty/pPbFragFunction
//main execution starts here
void makeFF(int v)
{ 
  TH1D::SetDefaultSumw2();
  TH2D::SetDefaultSumw2();

  //initializing histograms for analysis
  loadHistos(v);

  for(int i = 0; i < FF_Bins; i++)
  {
    //pPb direction
    pp2TeV_data[i] = getFF_pp(FF_Bound[i],FF_Bound[i+1],Form("pp2TeV_data_%d_%d",(int)FF_Bound[i],(int)FF_Bound[i+1]),0);
    pp7TeV_data[i] = getFF_pp(FF_Bound[i],FF_Bound[i+1],Form("pp7TeV_data_%d_%d",(int)FF_Bound[i],(int)FF_Bound[i+1]),1);
    pPb5TeV_data[i]= getFF_pp(FF_Bound[i],FF_Bound[i+1],Form("pPb5TeV_data_%d_%d",(int)FF_Bound[i],(int)FF_Bound[i+1]),2);

    //Pbpdirection
    pp2TeV_reverse_data[i] = getFF_pp(FF_Bound[i],FF_Bound[i+1],Form("pp2TeV_reverse_data_%d_%d",(int)FF_Bound[i],(int)FF_Bound[i+1]),31);
    pp7TeV_reverse_data[i] = getFF_pp(FF_Bound[i],FF_Bound[i+1],Form("pp7TeV_reverse_data_%d_%d",(int)FF_Bound[i],(int)FF_Bound[i+1]),32);
    Pbp5TeV_data[i]= getFF_pp(FF_Bound[i],FF_Bound[i+1],Form("Pbp5TeV_data_%d_%d",(int)FF_Bound[i],(int)FF_Bound[i+1]),3);
    
    //Reco MC
    pp2TeV_recoMC[i] = getFF_pp(FF_Bound[i],FF_Bound[i+1],Form("pp2TeV_recoMC_%d_%d",(int)FF_Bound[i],(int)FF_Bound[i+1]),4);
    pp7TeV_recoMC[i] = getFF_pp(FF_Bound[i],FF_Bound[i+1],Form("pp7TeV_recoMC_%d_%d",(int)FF_Bound[i],(int)FF_Bound[i+1]),5);
    pPb5TeV_recoMC[i]= getFF_pp(FF_Bound[i],FF_Bound[i+1],Form("pPb5TeV_recoMC_%d_%d",(int)FF_Bound[i],(int)FF_Bound[i+1]),6);
    pp5TeV_recoMC[i] = getFF_pp(FF_Bound[i],FF_Bound[i+1],Form("pp5TeV_recoMC_%d_%d",(int)FF_Bound[i],(int)FF_Bound[i+1]),11);
    
    //Gen MC
    pp2TeV_genMC[i] = getFF_pp(FF_Bound[i],FF_Bound[i+1],Form("pp2TeV_genMC_%d_%d",(int)FF_Bound[i],(int)FF_Bound[i+1]),7);
    pp7TeV_genMC[i] = getFF_pp(FF_Bound[i],FF_Bound[i+1],Form("pp7TeV_genMC_%d_%d",(int)FF_Bound[i],(int)FF_Bound[i+1]),8);
    pPb5TeV_genMC[i]= getFF_pp(FF_Bound[i],FF_Bound[i+1],Form("pPb5TeV_genMC_%d_%d",(int)FF_Bound[i],(int)FF_Bound[i+1]),9);    
    pp5TeV_genMC[i] = getFF_pp(FF_Bound[i],FF_Bound[i+1],Form("pp5TeV_genMC_%d_%d",(int)FF_Bound[i],(int)FF_Bound[i+1]),10); 

    //Reco Gen Combinations
    pp2TeV_rJgTMC[i] = getFF_pp(FF_Bound[i],FF_Bound[i+1],Form("pp2TeV_rJgTMC_%d_%d",(int)FF_Bound[i],(int)FF_Bound[i+1]),33);
    pp7TeV_rJgTMC[i] = getFF_pp(FF_Bound[i],FF_Bound[i+1],Form("pp7TeV_rJgTMC_%d_%d",(int)FF_Bound[i],(int)FF_Bound[i+1]),34);
    pPb5TeV_rJgTMC[i]= getFF_pp(FF_Bound[i],FF_Bound[i+1],Form("pPb5TeV_rJgTMC_%d_%d",(int)FF_Bound[i],(int)FF_Bound[i+1]),35);
    pp5TeV_rJgTMC[i] = getFF_pp(FF_Bound[i],FF_Bound[i+1],Form("pp5TeV_rJgTMC_%d_%d",(int)FF_Bound[i],(int)FF_Bound[i+1]),36);
    pp2TeV_gJrTMC[i] = getFF_pp(FF_Bound[i],FF_Bound[i+1],Form("pp2TeV_gJrTMC_%d_%d",(int)FF_Bound[i],(int)FF_Bound[i+1]),37);
    pp7TeV_gJrTMC[i] = getFF_pp(FF_Bound[i],FF_Bound[i+1],Form("pp7TeV_gJrTMC_%d_%d",(int)FF_Bound[i],(int)FF_Bound[i+1]),38);
    pPb5TeV_gJrTMC[i]= getFF_pp(FF_Bound[i],FF_Bound[i+1],Form("pPb5TeV_gJrTMC_%d_%d",(int)FF_Bound[i],(int)FF_Bound[i+1]),39);
    pp5TeV_gJrTMC[i] = getFF_pp(FF_Bound[i],FF_Bound[i+1],Form("pp5TeV_gJrTMC_%d_%d",(int)FF_Bound[i],(int)FF_Bound[i+1]),40); 

    //reco MC Q/G study
    pp2TeV_recoMC_Q[i] = getFF_pp(FF_Bound[i],FF_Bound[i+1],Form("pp2TeV_recoMC_Q_%d_%d",(int)FF_Bound[i],(int)FF_Bound[i+1]),12);
    pp2TeV_recoMC_G[i] = getFF_pp(FF_Bound[i],FF_Bound[i+1],Form("pp2TeV_recoMC_G_%d_%d",(int)FF_Bound[i],(int)FF_Bound[i+1]),13);
    pp7TeV_recoMC_Q[i] = getFF_pp(FF_Bound[i],FF_Bound[i+1],Form("pp7TeV_recoMC_Q_%d_%d",(int)FF_Bound[i],(int)FF_Bound[i+1]),14);
    pp7TeV_recoMC_G[i] = getFF_pp(FF_Bound[i],FF_Bound[i+1],Form("pp7TeV_recoMC_G_%d_%d",(int)FF_Bound[i],(int)FF_Bound[i+1]),15);
    pPb5TeV_recoMC_Q[i] = getFF_pp(FF_Bound[i],FF_Bound[i+1],Form("pPb5TeV_recoMC_Q_%d_%d",(int)FF_Bound[i],(int)FF_Bound[i+1]),16);
    pPb5TeV_recoMC_G[i] = getFF_pp(FF_Bound[i],FF_Bound[i+1],Form("pPb5TeV_recoMC_G_%d_%d",(int)FF_Bound[i],(int)FF_Bound[i+1]),17);
    pp5TeV_recoMC_Q[i] = getFF_pp(FF_Bound[i],FF_Bound[i+1],Form("pp5TeV_recoMC_Q_%d_%d",(int)FF_Bound[i],(int)FF_Bound[i+1]),18);
    pp5TeV_recoMC_G[i] = getFF_pp(FF_Bound[i],FF_Bound[i+1],Form("pp5TeV_recoMC_G_%d_%d",(int)FF_Bound[i],(int)FF_Bound[i+1]),19);

    //gen MC Q/G study
    pp2TeV_genMC_Q[i] = getFF_pp(FF_Bound[i],FF_Bound[i+1],Form("pp2TeV_genMC_Q_%d_%d",(int)FF_Bound[i],(int)FF_Bound[i+1]),20);
    pp2TeV_genMC_G[i] = getFF_pp(FF_Bound[i],FF_Bound[i+1],Form("pp2TeV_genMC_G_%d_%d",(int)FF_Bound[i],(int)FF_Bound[i+1]),21);
    pp7TeV_genMC_Q[i] = getFF_pp(FF_Bound[i],FF_Bound[i+1],Form("pp7TeV_genMC_Q_%d_%d",(int)FF_Bound[i],(int)FF_Bound[i+1]),22);
    pp7TeV_genMC_G[i] = getFF_pp(FF_Bound[i],FF_Bound[i+1],Form("pp7TeV_genMC_G_%d_%d",(int)FF_Bound[i],(int)FF_Bound[i+1]),23);
    pPb5TeV_genMC_Q[i] = getFF_pp(FF_Bound[i],FF_Bound[i+1],Form("pPb5TeV_genMC_Q_%d_%d",(int)FF_Bound[i],(int)FF_Bound[i+1]),24);
    pPb5TeV_genMC_G[i] = getFF_pp(FF_Bound[i],FF_Bound[i+1],Form("pPb5TeV_genMC_G_%d_%d",(int)FF_Bound[i],(int)FF_Bound[i+1]),25);
    pp5TeV_genMC_Q[i] = getFF_pp(FF_Bound[i],FF_Bound[i+1],Form("pp5TeV_genMC_Q_%d_%d",(int)FF_Bound[i],(int)FF_Bound[i+1]),26);
    pp5TeV_genMC_G[i] = getFF_pp(FF_Bound[i],FF_Bound[i+1],Form("pp5TeV_genMC_G_%d_%d",(int)FF_Bound[i],(int)FF_Bound[i+1]),27);

    //full data set
    pPb5Pbp5TeV_fulldata[i]=getFF_pp(FF_Bound[i],FF_Bound[i+1],Form("pPb5Pbp5TeV_fulldata_%d_%d",(int)FF_Bound[i],(int)FF_Bound[i+1]),28);
    pp2TeV_fulldata[i]=getFF_pp(FF_Bound[i],FF_Bound[i+1],Form("pp2TeV_fulldata_%d_%d",(int)FF_Bound[i],(int)FF_Bound[i+1]),29);
    pp7TeV_fulldata[i] = getFF_pp(FF_Bound[i],FF_Bound[i+1],Form("pp7TeV_fulldata_%d_%d",(int)FF_Bound[i],(int)FF_Bound[i+1]),30);

    //interpolations
    pPb5TeV_data_interp[i]    = getInterpolation(FF_Bound[i],FF_Bound[i+1],"pPb5TeV_data_interp",2,pp2TeV_data[i],pp7TeV_data[i],0);
    Pbp5TeV_data_interp[i]    = getInterpolation(FF_Bound[i],FF_Bound[i+1],"Pbp5TeV_data_interp",3,pp2TeV_reverse_data[i],pp7TeV_reverse_data[i],0);
    pPb5Pb5TeV_data_interp[i] = getInterpolation(FF_Bound[i],FF_Bound[i+1],"pPb5Pbp5TeV_data_interp",28,pp2TeV_fulldata[i],pp7TeV_fulldata[i],0);
    pPb5TeV_recoMC_interp[i]  = getInterpolation(FF_Bound[i],FF_Bound[i+1],"pPb5TeV_recoMC_interp",6,pp2TeV_recoMC[i],pp7TeV_recoMC[i],0);
    pPb5TeV_genMC_interp[i]   = getInterpolation(FF_Bound[i],FF_Bound[i+1],"pPb5TeV_genMC_interp",9,pp2TeV_genMC[i],pp7TeV_genMC[i],1);
    pPb5TeV_rJgTMC_interp[i]    = getInterpolation(FF_Bound[i],FF_Bound[i+1],"pPb5TeV_rJgTMC_interp",35,pp2TeV_rJgTMC[i],pp7TeV_rJgTMC[i],0);
    pPb5TeV_gJrTMC_interp[i]    = getInterpolation(FF_Bound[i],FF_Bound[i+1],"pPb5TeV_gJrTMC_interp",39,pp2TeV_gJrTMC[i],pp7TeV_gJrTMC[i],1);
  }
 
  for(int i = 0; i < FF_Bins; i++)
  {
    pPb_FF[i] = (TH1D*) pPb5TeV_data[i]->Clone(Form("pPb_FF_%d_%d",(int)FF_Bound[i],(int)FF_Bound[i+1]));
    pPb_FF[i]->Divide(pPb5TeV_data_interp[i][0]);
    Pbp_FF[i] = (TH1D*) Pbp5TeV_data[i]->Clone(Form("Pbp_FF_%d_%d",(int)FF_Bound[i],(int)FF_Bound[i+1]));
    Pbp_FF[i]->Divide(Pbp5TeV_data_interp[i][0]);
    pPb_FF_recoMC[i] = (TH1D*) pPb5TeV_recoMC[i]->Clone(Form("pPb_FF_recoMC_%d_%d",(int)FF_Bound[i],(int)FF_Bound[i+1]));
    pPb_FF_recoMC[i]->Divide(pPb5TeV_recoMC_interp[i][0]);
    pPb_FF_genMC[i] = (TH1D*) pPb5TeV_genMC[i]->Clone(Form("pPb_FF_genMC_%d_%d",(int)FF_Bound[i],(int)FF_Bound[i+1]));
    pPb_FF_genMC[i]->Divide(pPb5TeV_genMC_interp[i][0]);
    pPbPbp_FF[i] = (TH1D*) pPb5Pbp5TeV_fulldata[i]->Clone(Form("pPbPbp_FF_%d_%d",(int)FF_Bound[i],(int)FF_Bound[i+1]));
    pPbPbp_FF[i]->Divide(pPb5Pb5TeV_data_interp[i][0]); 
    pPb_FF_rJgTMC[i] = (TH1D*) pPb5TeV_rJgTMC[i]->Clone(Form("pPb_FF_rJgTMC_%d_%d",(int)FF_Bound[i],(int)FF_Bound[i+1]));
    pPb_FF_rJgTMC[i]->Divide(pPb5TeV_rJgTMC_interp[i][0]);
    pPb_FF_gJrTMC[i] = (TH1D*) pPb5TeV_gJrTMC[i]->Clone(Form("pPb_FF_gJrTMC_%d_%d",(int)FF_Bound[i],(int)FF_Bound[i+1]));
    pPb_FF_gJrTMC[i]->Divide(pPb5TeV_gJrTMC_interp[i][0]);
  }
 
  TFile * outfile = new TFile(Form("FragmentationFunctions%sUE3.root",variationTag[v]),"recreate");
  for(int i = 0; i < FF_Bins; i++)
  {
    pp2TeV_data[i]->Write();
    pp7TeV_data[i]->Write();
    pPb5TeV_data[i]->Write();
    pp2TeV_reverse_data[i]->Write();
    pp7TeV_reverse_data[i]->Write();
    Pbp5TeV_data[i]->Write();
    pPb5Pbp5TeV_fulldata[i]->Write();
    pp2TeV_fulldata[i]->Write();
    pp7TeV_fulldata[i]->Write();

    pp2TeV_recoMC[i]->Write();
    pp7TeV_recoMC[i]->Write();
    pPb5TeV_recoMC[i]->Write();
    pp5TeV_recoMC[i]->Write();

    pp2TeV_rJgTMC[i]->Write();
    pp7TeV_rJgTMC[i]->Write();
    pPb5TeV_rJgTMC[i]->Write();
    pp5TeV_rJgTMC[i]->Write();
    pp2TeV_gJrTMC[i]->Write();
    pp7TeV_gJrTMC[i]->Write();
    pPb5TeV_gJrTMC[i]->Write();
    pp5TeV_gJrTMC[i]->Write();
 
    pp2TeV_recoMC_Q[i]->Write();
    pp2TeV_recoMC_G[i]->Write();
    pp7TeV_recoMC_Q[i]->Write();
    pp7TeV_recoMC_G[i]->Write();
    pPb5TeV_recoMC_Q[i]->Write();
    pPb5TeV_recoMC_G[i]->Write();
    pp5TeV_recoMC_Q[i]->Write();
    pp5TeV_recoMC_G[i]->Write();

    pp2TeV_genMC[i]->Write();
    pp7TeV_genMC[i]->Write();
    pPb5TeV_genMC[i]->Write();
    pp5TeV_genMC[i]->Write(); 
    pp2TeV_genMC_Q[i]->Write();
    pp2TeV_genMC_G[i]->Write();
    pp7TeV_genMC_Q[i]->Write();
    pp7TeV_genMC_G[i]->Write();
    pPb5TeV_genMC_Q[i]->Write();
    pPb5TeV_genMC_G[i]->Write();
    pp5TeV_genMC_Q[i]->Write();
    pp5TeV_genMC_G[i]->Write();

    for(int indx = 0; indx<3; indx++)
    {
      pPb5TeV_data_interp[i][indx]->Write();
      Pbp5TeV_data_interp[i][indx]->Write();
      pPb5Pb5TeV_data_interp[i][indx]->Write();
      pPb5TeV_recoMC_interp[i][indx]->Write();
      pPb5TeV_genMC_interp[i][indx]->Write();
      pPb5TeV_rJgTMC_interp[i][indx]->Write();
      pPb5TeV_gJrTMC_interp[i][indx]->Write();
    } 

    pPb_FF[i]->Write();
    Pbp_FF[i]->Write();  
    pPbPbp_FF[i]->Write(); 
    pPb_FF_recoMC[i]->Write();
    pPb_FF_genMC[i]->Write();
    pPb_FF_rJgTMC[i]->Write();
    pPb_FF_gJrTMC[i]->Write();
  }
  //handing it over to a plotting macro
  makePlots(variationTag[v]); 
  plotGluonFraction(variationTag[v]); 
}
コード例 #25
0
void makePlots() 
{
  gROOT->SetStyle("Plain");
  gROOT->SetBatch(false);
  // --- Use the CMS TDR style
  gROOT->ProcessLine(".L tdrStyle.C");
  setTDRStyle();
  tdrStyle->SetErrorX(0.5);
  tdrStyle->SetPadLeftMargin(0.14);
  tdrStyle->SetPadRightMargin(0.08);
  tdrStyle->SetPadTopMargin(0.10);
  tdrStyle->SetPadBottomMargin(0.14);
  tdrStyle->SetLegendBorderSize(0);
  tdrStyle->SetTitleYOffset(0.8);
  tdrStyle->SetOptStat(0);
  tdrStyle->SetOptFit(0);
  tdrStyle->SetTitleFontSize(0.08);
  tdrStyle->SetStatStyle(0);
  tdrStyle->SetStatStyle(0);
  tdrStyle->SetFrameLineWidth(2);
  tdrStyle->cd();

  bool plotSetII = true;
  
  TString inputFile_SetI("detection_Models_SetI_RvsSin2Q13.root");

  TString inputFile_SetII("detection_Models_SetII_RvsSin2Q13.root");

  TString inputFile_ModelA_SetI("detection_ModelA_SetI_RvsSin2Q13.root");

  TString inputFile_ModelA_SetII("detection_ModelA_SetII_RvsSin2Q13.root");
  
  
  if( 0 ) { 
    makePlots("ModelA", "EarthB", "Vacuum", "SetI", inputFile_SetI.Data() );
  }

  //... AO: Replacement due to bump

  makePlots("ModelA", "EarthB", "Vacuum", "SetI", inputFile_ModelA_SetI.Data() );

  makePlots("ModelB", "EarthB", "Vacuum", "SetI", inputFile_SetI.Data() );
  
  makePlots("ModelC", "EarthB", "Vacuum", "SetI", inputFile_SetI.Data() );
  
  if( plotSetII ) 
  {
    
    if( 0 ) {
      makePlots("ModelA", "EarthB", "Vacuum", "SetII", inputFile_SetII.Data() );
    }

    //... AO: Replacement due to bump

    makePlots("ModelA", "EarthB", "Vacuum", "SetII", inputFile_ModelA_SetII.Data() );

    makePlots("ModelB", "EarthB", "Vacuum", "SetII", inputFile_SetII.Data() );
    
    makePlots("ModelC", "EarthB", "Vacuum", "SetII", inputFile_SetII.Data() );

  }
  
  makePlots("StdPicture", "EarthB", "Vacuum", "SetI", "detection_StdPicture_SetI_RvsSin2Q13.root");

  
}
コード例 #26
0
//main execution starts here
void makeFF(int v, int UEtype=3)
{ 
  TH1D::SetDefaultSumw2();
  TH2D::SetDefaultSumw2();

  //initializing histograms for analysis
  loadHistos(v,UEtype);

  for(int i = 0; i < 2*FF_Bins; i++)
  {
    //pPb direction
    pPb5TeV_data[i]= getFF_pp(FF_Bound[i%FF_Bins],FF_Bound[i%FF_Bins+1],Form("pPb5TeV_data_%d_%d",(int)FF_Bound[i%FF_Bins],(int)FF_Bound[i%FF_Bins+1]),2,i>=FF_Bins);

    //Pbpdirection
    Pbp5TeV_data[i]= getFF_pp(FF_Bound[i%FF_Bins],FF_Bound[i%FF_Bins+1],Form("Pbp5TeV_data_%d_%d",(int)FF_Bound[i%FF_Bins],(int)FF_Bound[i%FF_Bins+1]),3,i>=FF_Bins);

    ppref5TeV_data[i]= getFF_pp(FF_Bound[i%FF_Bins],FF_Bound[i%FF_Bins+1],Form("ppref5TeV_data_%d_%d",(int)FF_Bound[i%FF_Bins],(int)FF_Bound[i%FF_Bins+1]),4,i>=FF_Bins);
    
    //Reco MC
    pPb5TeV_recoMC[i]= getFF_pp(FF_Bound[i%FF_Bins],FF_Bound[i%FF_Bins+1],Form("pPb5TeV_recoMC_%d_%d",(int)FF_Bound[i%FF_Bins],(int)FF_Bound[i%FF_Bins+1]),6,i>=FF_Bins);
    Pbp5TeV_recoMC[i]= getFF_pp(FF_Bound[i%FF_Bins],FF_Bound[i%FF_Bins+1],Form("Pbp5TeV_recoMC_%d_%d",(int)FF_Bound[i%FF_Bins],(int)FF_Bound[i%FF_Bins+1]),51,i>=FF_Bins);
    pPb5Pbp5TeV_recoMC[i]= getFF_pp(FF_Bound[i%FF_Bins],FF_Bound[i%FF_Bins+1],Form("pPb5Pbp5TeV_recoMC_%d_%d",(int)FF_Bound[i%FF_Bins],(int)FF_Bound[i%FF_Bins+1]),59,i>=FF_Bins);
    pp5TeV_recoMC[i] = getFF_pp(FF_Bound[i%FF_Bins],FF_Bound[i%FF_Bins+1],Form("pp5TeV_recoMC_%d_%d",(int)FF_Bound[i%FF_Bins],(int)FF_Bound[i%FF_Bins+1]),11,i>=FF_Bins);
    
    //Gen MC
    pPb5TeV_genMC[i]= getFF_pp(FF_Bound[i%FF_Bins],FF_Bound[i%FF_Bins+1],Form("pPb5TeV_genMC_%d_%d",(int)FF_Bound[i%FF_Bins],(int)FF_Bound[i%FF_Bins+1]),9,i>=FF_Bins);    
    Pbp5TeV_genMC[i]= getFF_pp(FF_Bound[i%FF_Bins],FF_Bound[i%FF_Bins+1],Form("Pbp5TeV_genMC_%d_%d",(int)FF_Bound[i%FF_Bins],(int)FF_Bound[i%FF_Bins+1]),52,i>=FF_Bins);    
    pPb5Pbp5TeV_genMC[i]= getFF_pp(FF_Bound[i%FF_Bins],FF_Bound[i%FF_Bins+1],Form("pPb5Pbp5TeV_genMC_%d_%d",(int)FF_Bound[i%FF_Bins],(int)FF_Bound[i%FF_Bins+1]),60,i>=FF_Bins);    
    pp5TeV_genMC[i] = getFF_pp(FF_Bound[i%FF_Bins],FF_Bound[i%FF_Bins+1],Form("pp5TeV_genMC_%d_%d",(int)FF_Bound[i%FF_Bins],(int)FF_Bound[i%FF_Bins+1]),10,i>=FF_Bins); 

    //Reco Gen Combinations
    pPb5TeV_rJgTMC[i]= getFF_pp(FF_Bound[i%FF_Bins],FF_Bound[i%FF_Bins+1],Form("pPb5TeV_rJgTMC_%d_%d",(int)FF_Bound[i%FF_Bins],(int)FF_Bound[i%FF_Bins+1]),35,i>=FF_Bins);
    Pbp5TeV_rJgTMC[i]= getFF_pp(FF_Bound[i%FF_Bins],FF_Bound[i%FF_Bins+1],Form("Pbp5TeV_rJgTMC_%d_%d",(int)FF_Bound[i%FF_Bins],(int)FF_Bound[i%FF_Bins+1]),53,i>=FF_Bins);
    pPb5Pbp5TeV_rJgTMC[i]= getFF_pp(FF_Bound[i%FF_Bins],FF_Bound[i%FF_Bins+1],Form("pPb5Pbp5TeV_rJgTMC_%d_%d",(int)FF_Bound[i%FF_Bins],(int)FF_Bound[i%FF_Bins+1]),61,i>=FF_Bins);
    pp5TeV_rJgTMC[i] = getFF_pp(FF_Bound[i%FF_Bins],FF_Bound[i%FF_Bins+1],Form("pp5TeV_rJgTMC_%d_%d",(int)FF_Bound[i%FF_Bins],(int)FF_Bound[i%FF_Bins+1]),36,i>=FF_Bins);
    pPb5TeV_gJrTMC[i]= getFF_pp(FF_Bound[i%FF_Bins],FF_Bound[i%FF_Bins+1],Form("pPb5TeV_gJrTMC_%d_%d",(int)FF_Bound[i%FF_Bins],(int)FF_Bound[i%FF_Bins+1]),39,i>=FF_Bins);
    Pbp5TeV_gJrTMC[i]= getFF_pp(FF_Bound[i%FF_Bins],FF_Bound[i%FF_Bins+1],Form("Pbp5TeV_gJrTMC_%d_%d",(int)FF_Bound[i%FF_Bins],(int)FF_Bound[i%FF_Bins+1]),54,i>=FF_Bins);
    pPb5Pbp5TeV_gJrTMC[i]= getFF_pp(FF_Bound[i%FF_Bins],FF_Bound[i%FF_Bins+1],Form("pPb5Pbp5TeV_gJrTMC_%d_%d",(int)FF_Bound[i%FF_Bins],(int)FF_Bound[i%FF_Bins+1]),62,i>=FF_Bins);
    pp5TeV_gJrTMC[i] = getFF_pp(FF_Bound[i%FF_Bins],FF_Bound[i%FF_Bins+1],Form("pp5TeV_gJrTMC_%d_%d",(int)FF_Bound[i%FF_Bins],(int)FF_Bound[i%FF_Bins+1]),40,i>=FF_Bins); 



    //full data set
    pPb5Pbp5TeV_fulldata[i]=getFF_pp(FF_Bound[i%FF_Bins],FF_Bound[i%FF_Bins+1],Form("pPb5Pbp5TeV_fulldata_%d_%d",(int)FF_Bound[i%FF_Bins],(int)FF_Bound[i%FF_Bins+1]),28,i>=FF_Bins);

    //2 and 7 tev pp FF's with no reweighting

    //interpolations
  }
 
  for(int i = 0; i < 2*FF_Bins; i++)
  {
    std::string isXi = "";
    if(i>=FF_Bins) isXi = "_xi";
    pPb_FF[i] = (TH1D*) pPb5TeV_data[i]->Clone(Form("pPb_FF_%d_%d%s",(int)FF_Bound[i%FF_Bins],(int)FF_Bound[i%FF_Bins+1],isXi.data()));
    pPb_FF[i]->Divide(ppref5TeV_data[i]);
    Pbp_FF[i] = (TH1D*) Pbp5TeV_data[i]->Clone(Form("Pbp_FF_%d_%d%s",(int)FF_Bound[i%FF_Bins],(int)FF_Bound[i%FF_Bins+1],isXi.data()));
    Pbp_FF[i]->Divide(ppref5TeV_data[i]);
    pPbPbp_FF[i] = (TH1D*) pPb5Pbp5TeV_fulldata[i]->Clone(Form("pPbPbp_FF_%d_%d%s",(int)FF_Bound[i%FF_Bins],(int)FF_Bound[i%FF_Bins+1],isXi.data()));
    pPbPbp_FF[i]->Divide(ppref5TeV_data[i]); 

    pPb_FF_recoMC[i] = (TH1D*) pPb5TeV_recoMC[i]->Clone(Form("pPb_FF_recoMC_%d_%d%s",(int)FF_Bound[i%FF_Bins],(int)FF_Bound[i%FF_Bins+1],isXi.data()));
    pPb_FF_recoMC[i]->Divide(pp5TeV_recoMC[i]);
    pPb_FF_genMC[i] = (TH1D*) pPb5TeV_genMC[i]->Clone(Form("pPb_FF_genMC_%d_%d%s",(int)FF_Bound[i%FF_Bins],(int)FF_Bound[i%FF_Bins+1],isXi.data()));
    pPb_FF_genMC[i]->Divide(pp5TeV_genMC[i]);
    pPb_FF_rJgTMC[i] = (TH1D*) pPb5TeV_rJgTMC[i]->Clone(Form("pPb_FF_rJgTMC_%d_%d%s",(int)FF_Bound[i%FF_Bins],(int)FF_Bound[i%FF_Bins+1],isXi.data()));
    pPb_FF_rJgTMC[i]->Divide(pp5TeV_rJgTMC[i]);
    pPb_FF_gJrTMC[i] = (TH1D*) pPb5TeV_gJrTMC[i]->Clone(Form("pPb_FF_gJrTMC_%d_%d%s",(int)FF_Bound[i%FF_Bins],(int)FF_Bound[i%FF_Bins+1],isXi.data()));
    pPb_FF_gJrTMC[i]->Divide(pp5TeV_gJrTMC[i]);

    Pbp_FF_recoMC[i] = (TH1D*) Pbp5TeV_recoMC[i]->Clone(Form("Pbp_FF_recoMC_%d_%d%s",(int)FF_Bound[i%FF_Bins],(int)FF_Bound[i%FF_Bins+1],isXi.data()));
    Pbp_FF_recoMC[i]->Divide(pp5TeV_recoMC[i]);
    Pbp_FF_genMC[i] = (TH1D*) Pbp5TeV_genMC[i]->Clone(Form("Pbp_FF_genMC_%d_%d%s",(int)FF_Bound[i%FF_Bins],(int)FF_Bound[i%FF_Bins+1],isXi.data()));
    Pbp_FF_genMC[i]->Divide(pp5TeV_genMC[i]);
    Pbp_FF_rJgTMC[i] = (TH1D*) Pbp5TeV_rJgTMC[i]->Clone(Form("Pbp_FF_rJgTMC_%d_%d%s",(int)FF_Bound[i%FF_Bins],(int)FF_Bound[i%FF_Bins+1],isXi.data()));
    Pbp_FF_rJgTMC[i]->Divide(pp5TeV_rJgTMC[i]);
    Pbp_FF_gJrTMC[i] = (TH1D*) Pbp5TeV_gJrTMC[i]->Clone(Form("Pbp_FF_gJrTMC_%d_%d%s",(int)FF_Bound[i%FF_Bins],(int)FF_Bound[i%FF_Bins+1],isXi.data()));
    Pbp_FF_gJrTMC[i]->Divide(pp5TeV_gJrTMC[i]);

    pPbPbp_FF_recoMC[i] = (TH1D*) pPb5Pbp5TeV_recoMC[i]->Clone(Form("pPbPbp_FF_recoMC_%d_%d%s",(int)FF_Bound[i%FF_Bins],(int)FF_Bound[i%FF_Bins+1],isXi.data()));
    pPbPbp_FF_recoMC[i]->Divide(pp5TeV_recoMC[i]);
    pPbPbp_FF_genMC[i] = (TH1D*) pPb5Pbp5TeV_genMC[i]->Clone(Form("pPbPbp_FF_genMC_%d_%d%s",(int)FF_Bound[i%FF_Bins],(int)FF_Bound[i%FF_Bins+1],isXi.data()));
    pPbPbp_FF_genMC[i]->Divide(pp5TeV_genMC[i]);
    pPbPbp_FF_rJgTMC[i] = (TH1D*) pPb5Pbp5TeV_rJgTMC[i]->Clone(Form("pPbPbp_FF_rJgTMC_%d_%d%s",(int)FF_Bound[i%FF_Bins],(int)FF_Bound[i%FF_Bins+1],isXi.data()));
    pPbPbp_FF_rJgTMC[i]->Divide(pp5TeV_rJgTMC[i]);
    pPbPbp_FF_gJrTMC[i] = (TH1D*) pPb5Pbp5TeV_gJrTMC[i]->Clone(Form("pPbPbp_FF_gJrTMC_%d_%d%s",(int)FF_Bound[i%FF_Bins],(int)FF_Bound[i%FF_Bins+1],isXi.data()));
    pPbPbp_FF_gJrTMC[i]->Divide(pp5TeV_gJrTMC[i]);

    pp5_FF_recoMC[i] = (TH1D*) pp5TeV_recoMC[i]->Clone(Form("pp5_FF_recoMC_%d_%d%s",(int)FF_Bound[i%FF_Bins],(int)FF_Bound[i%FF_Bins+1],isXi.data()));
    pp5_FF_recoMC[i]->Divide(pp5TeV_recoMC[i]);
    pp5_FF_genMC[i] = (TH1D*) pp5TeV_genMC[i]->Clone(Form("pp5_FF_genMC_%d_%d%s",(int)FF_Bound[i%FF_Bins],(int)FF_Bound[i%FF_Bins+1],isXi.data()));
    pp5_FF_genMC[i]->Divide(pp5TeV_genMC[i]);
  }
 
  TFile * outfile = new TFile(Form("FragmentationFunctions%sUE%d.root",variationTag[v],UEtype),"recreate");
  for(int i = 0; i < 2*FF_Bins; i++)
  {
    pPb5TeV_data[i]->Write();
    Pbp5TeV_data[i]->Write();
    ppref5TeV_data[i]->Write();
    pPb5Pbp5TeV_fulldata[i]->Write();

    pPb5TeV_recoMC[i]->Write();
    Pbp5TeV_recoMC[i]->Write();
    pPb5Pbp5TeV_recoMC[i]->Write();
    pp5TeV_recoMC[i]->Write();

    pPb5TeV_rJgTMC[i]->Write();
    Pbp5TeV_rJgTMC[i]->Write();
    pPb5Pbp5TeV_rJgTMC[i]->Write();
    pp5TeV_rJgTMC[i]->Write();
    pPb5TeV_gJrTMC[i]->Write();
    Pbp5TeV_gJrTMC[i]->Write();
    pPb5Pbp5TeV_gJrTMC[i]->Write();
    pp5TeV_gJrTMC[i]->Write();
 

    pPb5TeV_genMC[i]->Write();
    Pbp5TeV_genMC[i]->Write();
    pPb5Pbp5TeV_genMC[i]->Write();
    pp5TeV_genMC[i]->Write(); 


    pPb_FF[i]->Write();
    Pbp_FF[i]->Write();  
    pPbPbp_FF[i]->Write(); 
    pPb_FF_recoMC[i]->Write();
    pPb_FF_genMC[i]->Write();
    pPb_FF_rJgTMC[i]->Write();
    pPb_FF_gJrTMC[i]->Write();

    Pbp_FF_recoMC[i]->Write();
    Pbp_FF_genMC[i]->Write();
    Pbp_FF_rJgTMC[i]->Write();
    Pbp_FF_gJrTMC[i]->Write();

    pPbPbp_FF_recoMC[i]->Write();
    pPbPbp_FF_genMC[i]->Write();
    pPbPbp_FF_rJgTMC[i]->Write();
    pPbPbp_FF_gJrTMC[i]->Write();
  }
  //handing it over to a plotting macro
  if(FF_Bins==1){ outfile->Close(); return;}
  makePlots(variationTag[v],UEtype); 
  outfile->Close(); 
}