+ }
+ }
+}
+
+void SuperimposeBBToTPCSignal(Int_t period /*0=LHC10bc, 1=LHC10d, 2=LHC10h*/,TCanvas* cpid,Int_t set /*see below*/){
+
+ TFile* fBethe=new TFile("BetheBlochTPC.root");
+ if(!fBethe->IsOpen()){
+ TPCBetheBloch(set);
+ fBethe=new TFile("BetheBlochTPC.root");
+ }
+ const Int_t npart=4;
+ TString partnames[npart]={"Kaon","Pion","Electron","Proton"};
+ for(Int_t ipart=0;ipart<npart;ipart++){
+ TString grname=Form("%sP%d",partnames[ipart].Data(),period);
+ TGraph* gr=(TGraph*)fBethe->Get(grname);
+ cpid->cd();
+ gr->SetLineColor(1);
+ gr->SetLineWidth(2);
+ gr->Draw("L");
+ }
+
+ //cpid->SaveAs(Form("%sBB.png",hname.Data()));
+}
+
+//draw and save Bethe Bloch from TPC in different periods
+void TPCBetheBloch(Int_t set){
+ gStyle->SetOptTitle(0);
+ gStyle->SetCanvasColor(0);
+
+ AliTPCPIDResponse *tpcResp=new AliTPCPIDResponse();
+
+ const Int_t npart=4;
+ Double_t masses[npart]={TDatabasePDG::Instance()->GetParticle(321)->Mass()/*Kaon*/,TDatabasePDG::Instance()->GetParticle(211)->Mass()/*Pion*/,TDatabasePDG::Instance()->GetParticle(11)->Mass()/*Electron*/,TDatabasePDG::Instance()->GetParticle(2212)->Mass()/*Proton*/};
+ TString partnames[npart]={"Kaon","Pion","Electron","Proton"};
+ //printf("%s = %.4f,%s = %.4f,%s = %.4f\n",partnames[0].Data(),masses[0],partnames[1].Data(),masses[1],partnames[2].Data(),masses[2]);
+ TCanvas *cBethe=new TCanvas("cBethe","Bethe Bloch K pi e p");
+ Int_t nperiods=4; //LHC10b+c, LHC10d, LHC10h, MC
+ Double_t alephParameters[5]={};
+ Int_t nsets=1/*LHC10bc*/+2/*LHC10de*/+2/*LHC10h*/+3/*MC*/;
+
+ periodsname=new TString[nsets];
+ cout<<"Creating the file of the Bethe Bloch"<<endl;
+ TFile* fout=new TFile("BetheBlochTPC.root","recreate");
+
+ for(Int_t iperiod=0;iperiod<nperiods;iperiod++){
+ cout<<"Period "<<iperiod<<" : ";
+ if(iperiod==0){ //LHC10bc
+
+ alephParameters[0] = 0.0283086/0.97;
+ alephParameters[1] = 2.63394e+01;
+ alephParameters[2] = 5.04114e-11;
+ alephParameters[3] = 2.12543e+00;
+ alephParameters[4] = 4.88663e+00;
+ periodsname[0]="dataLHC10bc";
+ }
+ if(iperiod==1){ //LHC10de,low energy
+ if(set==0){
+ alephParameters[0] = 1.63246/50.;
+ alephParameters[1] = 2.20028e+01;
+ alephParameters[2] = TMath::Exp(-2.48879e+01);
+ alephParameters[3] = 2.39804e+00;
+ alephParameters[4] = 5.12090e+00;
+ periodsname[1]="dataLHC10deold";
+ }
+ if(set==1){
+ alephParameters[0] = 1.34490e+00/50.;
+ alephParameters[1] = 2.69455e+01;
+ alephParameters[2] = TMath::Exp(-2.97552e+01);
+ alephParameters[3] = 2.35339e+00;
+ alephParameters[4] = 5.98079e+00;
+ periodsname[2]="dataLHC10denew";
+ }
+ }