Skip to content

Commit

Permalink
Merge pull request cms-sw#10 from jozzez1/Run2HSCP_Jozze
Browse files Browse the repository at this point in the history
Run2 hscp jozze
  • Loading branch information
quertenmont committed Jul 29, 2015
2 parents 24cd989 + a5503d6 commit 3a584af
Show file tree
Hide file tree
Showing 3 changed files with 132 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@

process.MessageLogger.cerr.FwkReport.reportEvery = 5000
process.source = cms.Source("PoolSource",
fileNames = cms.untracked.vstring(
fileNames = cms.untracked.vstring( *(
XXX_INPUT_XXX
)
) )
)

process.options = cms.untracked.PSet( wantSummary = cms.untracked.bool(True) )
Expand Down
84 changes: 68 additions & 16 deletions SUSYBSMAnalysis/HSCP/test/UsefulScripts/DeDxStudy/DeDxStudy.C
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@ struct dEdxStudyObj
TH2D* HIasVsP;
TH2D* HIasVsPM;
TH1D* HIasMIP;
TH2D* IasVsEta_Split;
TH2D* IasVsEta_Unsplit;
TProfile* IasVsEta_ProfileS;
TProfile* IasVsEta_ProfileU;

dEdxStudyObj(string saveName){
Name = saveName;
Expand All @@ -89,25 +93,49 @@ struct dEdxStudyObj


string HistoName;
HistoName = saveName + "_ChargeVsPath"; Charge_Vs_Path = new TH3D( HistoName.c_str(), HistoName.c_str(), P_NBins, P_Min, P_Max, Path_NBins, Path_Min, Path_Max, Charge_NBins, Charge_Min, Charge_Max);
HistoName = saveName + "_MIP"; HdedxMIP = new TH1D( HistoName.c_str(), HistoName.c_str(), 200, 0, isDiscrim?1.0:20);
HistoName = saveName + "_dedxVsPHSCP"; HdedxVsPHSCP = new TH2D( HistoName.c_str(), HistoName.c_str(), 3000, 0, 2000,1500,0, isDiscrim?1.0:15);
HistoName = saveName + "_dedxVsP"; HdedxVsP = new TH2D( HistoName.c_str(), HistoName.c_str(), 3000, 0, 30,1500,0, isDiscrim?1.0:15);
HistoName = saveName + "_dedxVsPM"; HdedxVsPM = new TH2D( HistoName.c_str(), HistoName.c_str(), 3000, 0, 30,1500,0, isDiscrim?1.0:15);
HistoName = saveName + "_dedxVsQP"; HdedxVsQP = new TH2D( HistoName.c_str(), HistoName.c_str(), 6000, -30, 30,1500,0, isDiscrim?1.0:25);
HistoName = saveName + "_Profile"; HdedxVsPProfile = new TProfile(HistoName.c_str(), HistoName.c_str(), 100, 0,100);
HistoName = saveName + "_Eta"; HdedxVsEtaProfile = new TProfile(HistoName.c_str(), HistoName.c_str(), 100,-3, 3);
HistoName = saveName + "_Eta2D"; HdedxVsEta = new TH2D (HistoName.c_str(), HistoName.c_str(), 100,-3, 3, 1000,0, isDiscrim?1.0:5);
HistoName = saveName + "_NOS"; HNOSVsEtaProfile = new TProfile(HistoName.c_str(), HistoName.c_str(), 100,-3, 3);
HistoName = saveName + "_NOM"; HNOMVsEtaProfile = new TProfile(HistoName.c_str(), HistoName.c_str(), 100,-3, 3);
HistoName = saveName + "_NOMS"; HNOMSVsEtaProfile = new TProfile(HistoName.c_str(), HistoName.c_str(), 100,-3, 3);
HistoName = saveName + "_Mass"; HMass = new TH1D( HistoName.c_str(), HistoName.c_str(), 500, 0, 10);
HistoName = saveName + "_P"; HP = new TH1D( HistoName.c_str(), HistoName.c_str(), 500, 0, 100);
HistoName = saveName + "_Hit"; HHit = new TH1D( HistoName.c_str(), HistoName.c_str(), 200, 0, 20);
HistoName = saveName + "_ChargeVsPath"; Charge_Vs_Path = new TH3D( HistoName.c_str(), HistoName.c_str(), P_NBins, P_Min, P_Max, Path_NBins, Path_Min, Path_Max, Charge_NBins, Charge_Min, Charge_Max);
HistoName = saveName + "_MIP"; HdedxMIP = new TH1D( HistoName.c_str(), HistoName.c_str(), 200, 0, isDiscrim?1.0:20);
HistoName = saveName + "_dedxVsPHSCP"; HdedxVsPHSCP = new TH2D( HistoName.c_str(), HistoName.c_str(), 3000, 0, 2000,1500,0, isDiscrim?1.0:15);
HistoName = saveName + "_dedxVsP"; HdedxVsP = new TH2D( HistoName.c_str(), HistoName.c_str(), 3000, 0, 30,1500,0, isDiscrim?1.0:15);
HistoName = saveName + "_dedxVsPM"; HdedxVsPM = new TH2D( HistoName.c_str(), HistoName.c_str(), 3000, 0, 30,1500,0, isDiscrim?1.0:15);
HistoName = saveName + "_dedxVsQP"; HdedxVsQP = new TH2D( HistoName.c_str(), HistoName.c_str(), 6000, -30, 30,1500,0, isDiscrim?1.0:25);
HistoName = saveName + "_Profile"; HdedxVsPProfile = new TProfile(HistoName.c_str(), HistoName.c_str(), 100, 0,100);
HistoName = saveName + "_Eta"; HdedxVsEtaProfile = new TProfile(HistoName.c_str(), HistoName.c_str(), 100,-3, 3);
HistoName = saveName + "_Eta2D"; HdedxVsEta = new TH2D (HistoName.c_str(), HistoName.c_str(), 100,-3, 3, 1000,0, isDiscrim?1.0:5);
HistoName = saveName + "_NOS"; HNOSVsEtaProfile = new TProfile(HistoName.c_str(), HistoName.c_str(), 100,-3, 3);
HistoName = saveName + "_NOM"; HNOMVsEtaProfile = new TProfile(HistoName.c_str(), HistoName.c_str(), 100,-3, 3);
HistoName = saveName + "_NOMS"; HNOMSVsEtaProfile = new TProfile(HistoName.c_str(), HistoName.c_str(), 100,-3, 3);
HistoName = saveName + "_Mass"; HMass = new TH1D( HistoName.c_str(), HistoName.c_str(), 500, 0, 10);
HistoName = saveName + "_P"; HP = new TH1D( HistoName.c_str(), HistoName.c_str(), 500, 0, 100);
HistoName = saveName + "_Hit"; HHit = new TH1D( HistoName.c_str(), HistoName.c_str(), 200, 0, 20);
HistoName = saveName + "_IasVsEta_Split"; IasVsEta_Split = new TH2D( HistoName.c_str(), HistoName.c_str(), 100,-3, 3, 50, 0, 1.0);
HistoName = saveName + "_IasVsEta_Unsplit"; IasVsEta_Unsplit = new TH2D( HistoName.c_str(), HistoName.c_str(), 100,-3, 3, 50, 0, 1.0);
HistoName = saveName + "_IasVsEta_ProfileS"; IasVsEta_ProfileS = new TProfile(HistoName.c_str(), HistoName.c_str(), 100,-3, 3);
HistoName = saveName + "_IasVsEta_ProfileU"; IasVsEta_ProfileU = new TProfile(HistoName.c_str(), HistoName.c_str(), 100,-3, 3);
}
};


void Write_dEdxStudyObj (dEdxStudyObj* Obj){
Obj->Charge_Vs_Path ->Write();
Obj->HdedxMIP ->Write();
Obj->HdedxVsPHSCP ->Write();
Obj->HdedxVsP ->Write();
Obj->HdedxVsPM ->Write();
Obj->HdedxVsQP ->Write();
Obj->HdedxVsPProfile ->Write();
Obj->HdedxVsEtaProfile ->Write();
Obj->HdedxVsEta ->Write();
Obj->HNOSVsEtaProfile ->Write();
Obj->HNOMVsEtaProfile ->Write();
Obj->HNOMSVsEtaProfile ->Write();
Obj->HMass ->Write();
Obj->HP ->Write();
Obj->HHit ->Write();
Obj->IasVsEta_Split ->Write();
Obj->IasVsEta_Unsplit ->Write();
Obj->IasVsEta_ProfileS ->Write();
Obj->IasVsEta_ProfileU ->Write();
}



Expand Down Expand Up @@ -153,6 +181,15 @@ void DeDxStudy(string DIRNAME="COMPILE", string INPUT="dEdx.root", string OUTPUT
if(isData){ dEdxTemplates = loadDeDxTemplate(DIRNAME + "/../../../data/Data7TeV_Deco_SiStripDeDxMip_3D_Rcd.root");
}else{ dEdxTemplates = loadDeDxTemplate(DIRNAME + "/../../../data/MC7TeV_Deco_SiStripDeDxMip_3D_Rcd.root");
}
TH3F* dEdxNewTemplatesSplit = NULL;
TH3F* dEdxNewTemplatesUnsplit = NULL;
if(isData){
dEdxNewTemplatesSplit = loadDeDxTemplate(DIRNAME + "/dEdxVsPath_Data.root", true);
dEdxNewTemplatesUnsplit = loadDeDxTemplate(DIRNAME + "/dEdxVsPath_Data.root", false);
}else{
dEdxNewTemplatesSplit = loadDeDxTemplate(DIRNAME + "/dEdxVsPath_MC.root", true);
dEdxNewTemplatesUnsplit = loadDeDxTemplate(DIRNAME + "/dEdxVsPath_MC.root", false);
}


string studies[] = {"harm2", "trunc40", "harm2_raw", "trunc40_raw", "Ias"};
Expand Down Expand Up @@ -239,6 +276,19 @@ void DeDxStudy(string DIRNAME="COMPILE", string INPUT="dEdx.root", string OUTPUT
results[R]->HNOMSVsEtaProfile->Fill(track->eta(),dedxObj->numberOfMeasurements() - dedxObj->numberOfSaturatedMeasurements() );
}

if (track->p() > 5 && dEdxNewTemplatesSplit && dEdxNewTemplatesUnsplit){
bool useraw = studies[R].find("raw") !=std::string::npos ? true : false,
truncate = studies[R].find("trunc")!=std::string::npos ? true : false;

DeDxData* dedxNewObjS = computedEdx(dedxHits, dEdxSF, dEdxNewTemplatesSplit, false, useClusterCleaning, truncate, false, useraw ? &TrackerGains : NULL);
DeDxData* dedxNewObjU = computedEdx(dedxHits, dEdxSF, dEdxNewTemplatesUnsplit, false, useClusterCleaning, truncate, false, useraw ? &TrackerGains : NULL);

results[R]->IasVsEta_Split ->Fill(track->eta(), dedxNewObjS->dEdx());
results[R]->IasVsEta_ProfileS->Fill(track->eta(), dedxNewObjS->dEdx());
results[R]->IasVsEta_Unsplit ->Fill(track->eta(), dedxNewObjU->dEdx());
results[R]->IasVsEta_ProfileU->Fill(track->eta(), dedxNewObjU->dEdx());
}

if(fabs(track->eta())>2.1)continue;
if((int)dedxObj->numberOfMeasurements()<10)continue;
if(track->p()>5 && track->p()<40){
Expand All @@ -258,6 +308,8 @@ void DeDxStudy(string DIRNAME="COMPILE", string INPUT="dEdx.root", string OUTPUT
}
}
}printf("\n");
for (int study_i = 0; study_i < Nstudies; study_i++)
Write_dEdxStudyObj (results[study_i]);
OutputHisto->Write();
OutputHisto->Close();
}
77 changes: 62 additions & 15 deletions SUSYBSMAnalysis/HSCP/test/UsefulScripts/DeDxStudy/MakePlot.C
Original file line number Diff line number Diff line change
Expand Up @@ -135,27 +135,35 @@ void MakePlot()
TritonLineLeft->SetLineColor(1);
TritonLineLeft->SetLineWidth(2);

TFile* InputFile = new TFile("dEdxHistos_251252.root");
TFile* InputFile = new TFile("dEdxHistosNew.root");
std::vector<string> ObjName;
ObjName.push_back("harm2");
// ObjName.push_back("harm2");
ObjName.push_back("harm2_raw");
// ObjName.push_back("trunc40");
// ObjName.push_back("trunc40_raw");
// ObjName.push_back("Ias");

for(unsigned int i=0;i<ObjName.size();i++){
TH1D* HdedxMIP = (TH1D*) GetObjectFromPath(InputFile, (ObjName[i] + "_MIP" ).c_str() );
TH1D* HMass = (TH1D*) GetObjectFromPath(InputFile, (ObjName[i] + "_Mass" ).c_str() );
TH2D* HdedxVsP = (TH2D*) GetObjectFromPath(InputFile, (ObjName[i] + "_dedxVsP" ).c_str() );
TH2D* HdedxVsQP = (TH2D*) GetObjectFromPath(InputFile, (ObjName[i] + "_dedxVsQP" ).c_str() );
TProfile* HdedxVsPProfile = (TProfile*)GetObjectFromPath(InputFile, (ObjName[i] + "_Profile" ).c_str() );
TH1D* HdedxMIP = (TH1D*) GetObjectFromPath(InputFile, (ObjName[i] + "_MIP" ).c_str() );
TH1D* HMass = (TH1D*) GetObjectFromPath(InputFile, (ObjName[i] + "_Mass" ).c_str() );
TH2D* HdedxVsP = (TH2D*) GetObjectFromPath(InputFile, (ObjName[i] + "_dedxVsP" ).c_str() );
TH2D* HdedxVsQP = (TH2D*) GetObjectFromPath(InputFile, (ObjName[i] + "_dedxVsQP" ).c_str() );
TProfile* HdedxVsPProfile = (TProfile*)GetObjectFromPath(InputFile, (ObjName[i] + "_Profile" ).c_str() );
TProfile* IasVsEta_ProfileS = (TProfile*)GetObjectFromPath(InputFile, (ObjName[i] + "_IasVsEta_ProfileS" ).c_str() );
TProfile* IasVsEta_ProfileU = (TProfile*)GetObjectFromPath(InputFile, (ObjName[i] + "_IasVsEta_ProfileU" ).c_str() );
TH2D* IasVsEta_Split = (TH2D*) GetObjectFromPath(InputFile, (ObjName[i] + "_IasVsEta_Split" ).c_str() );
TH2D* IasVsEta_Unsplit = (TH2D*) GetObjectFromPath(InputFile, (ObjName[i] + "_IasVsEta_Unsplit" ).c_str() );

ExtractConstants(HdedxVsP);

TPaveText* T = new TPaveText(0.05, 0.995, 0.95, 0.945, "NDC");
T->SetTextFont(43); //give the font size in pixel (instead of fraction)
T->SetTextSize(21); //font size
T->SetBorderSize(0);
T->SetFillColor(0);
T->SetFillStyle(0);
T->SetTextAlign(22);
T->AddText("#bf{CMS} Preliminary - 2.74 pb^{-1} - #sqrt{s} = 13 TeV");
TPaveText* T = new TPaveText(0.05, 0.995, 0.95, 0.945, "NDC");
T->SetTextFont(43); //give the font size in pixel (instead of fraction)
T->SetTextSize(21); //font size
T->SetBorderSize(0);
T->SetFillColor(0);
T->SetFillStyle(0);
T->SetTextAlign(22);
T->AddText("#bf{CMS} Preliminary - 2.74 pb^{-1} - #sqrt{s} = 13 TeV");

std::cout << "TESTA\n";
TCanvas* c1 = new TCanvas("c1", "c1", 600,600);
Expand Down Expand Up @@ -221,6 +229,45 @@ void MakePlot()
SaveCanvas(c1, "pictures/", ObjName[i] + "_Profile");
delete c1;

c1 = new TCanvas("c1", "c1", 600,600);
c1->SetLogz(true);
IasVsEta_Split->SetStats(kFALSE);
IasVsEta_Split->GetXaxis()->SetTitle("Eta");
IasVsEta_Split->GetYaxis()->SetTitle("I_{as}");
IasVsEta_Split->SetAxisRange(-2.1,2.1,"X");
IasVsEta_Split->Draw("COLZ");
SaveCanvas(c1, "pictures/", ObjName[i] + "_IasVsEta_Split");
delete c1;

c1 = new TCanvas("c1", "c1", 600,600);
c1->SetLogz(true);
IasVsEta_Unsplit->SetStats(kFALSE);
IasVsEta_Unsplit->GetXaxis()->SetTitle("Eta");
IasVsEta_Unsplit->GetYaxis()->SetTitle("I_{as}");
IasVsEta_Unsplit->SetAxisRange(-2.1,2.1,"X");
IasVsEta_Unsplit->Draw("COLZ");
SaveCanvas(c1, "pictures/", ObjName[i] + "_IasVsEta_Unsplit");
delete c1;

c1 = new TCanvas("c1", "c1", 600,600);
TLegend* leg = new TLegend(0.50, 0.80, 0.80, 0.90);
leg->SetFillColor(0);
leg->SetFillStyle(0);
leg->SetBorderSize(0);
leg->AddEntry (IasVsEta_ProfileU, "Unsplit", "P");
leg->AddEntry (IasVsEta_ProfileS, "Split per module", "P");
IasVsEta_ProfileU->SetStats(kFALSE);
IasVsEta_ProfileS->SetMarkerStyle(23);
IasVsEta_ProfileS->SetMarkerColor(kBlue);
IasVsEta_ProfileU->GetXaxis()->SetTitle("pseudo-rapidity, #eta");
IasVsEta_ProfileU->GetYaxis()->SetTitle("I_{as}");
IasVsEta_ProfileU->Draw("");
IasVsEta_ProfileS->Draw("same");
leg->Draw();
SaveCanvas(c1, "pictures/", ObjName[i] + "_IasVsEta_Profile");
delete leg;
delete c1;

c1 = new TCanvas("c1", "c1", 600,600);
c1->SetLogy(true);
c1->SetGridx(true);
Expand Down

0 comments on commit 3a584af

Please sign in to comment.