Adding the correction for wrongly simulated pid TOF signal
authormchojnac <Marek.Chojnacki@cern.ch>
Fri, 7 Mar 2014 15:57:18 +0000 (16:57 +0100)
committermchojnac <Marek.Chojnacki@cern.ch>
Fri, 7 Mar 2014 16:03:55 +0000 (17:03 +0100)
PWGLF/SPECTRA/PiKaPr/TestAOD/AnalysisBoth.C
PWGLF/SPECTRA/PiKaPr/TestAOD/QAPlotsBoth.C

index 21f3e08..f577c23 100644 (file)
@@ -27,6 +27,7 @@ Double_t minptforWD[6]={0.2,100.0,0.3,0.2,100.0,0.3};
 Double_t maxptforWD[6]={1.5,-100.0,2.0,1.5,-100.0,2.0};
 Double_t minRanges[3]={0.3,0.3,0.45};
 Double_t maxRanges[3]={1.5,1.2,2.2};
+Double_t TOFPIDsignalmatching[]={-1.0,-1.0,-1.0};
 Double_t fMaxContaminationPIDMC=0.2;
 
 
@@ -48,7 +49,8 @@ enum {
  knormalizationwithbin0integralsMC=0x200, //in this case reconstructed vertex disitrbution uses z vertex for data, those to options will be use only if knormalizationtoeventspassingPhySel is not set
  kuserangeonfigfile=0x400, // use of config file for dca fit settings
  kskipconcutonspectra=0x800, //do not use conPID<02 cut  useful for syst. studies
- kuseTOFmatchingcorrection=0x1000 // if set tof matching correction is applied.        
+ kuseTOFmatchingcorrection=0x1000, // if set tof matching correction is applied.
+ kuseTOFcorrforPIDsignalmatching=0x2000 // rescale the for spectra by the factor given in config files                 
                                                        
 };     
 
@@ -363,7 +365,11 @@ void AnalysisBoth (UInt_t options=0xF,TString outdate, TString outnamedata, TStr
                        {
                                CleanHisto(spectra[i],-1,100,contPID[i]);
                                CleanHisto(spectraLeonardo[i],-1,100,contPID[i]);
-                       }                               
+                       }
+                       // Apply correction for wrongly simulated TOF signal in MC 
+                       if(options&kuseTOFcorrforPIDsignalmatching)
+                               TOFPIDsignalmatchingApply(spectra[i],TOFPIDsignalmatching[i%3]);
+                                                       
        }
        
        GFCorrection(spectra,tcutsdata->GetPtTOFMatching(),options);
@@ -377,6 +383,7 @@ void AnalysisBoth (UInt_t options=0xF,TString outdate, TString outnamedata, TStr
                etacut=1.6;
 
        }
+
        TH1F* allch=GetSumAllCh(spectra,mass,etacut);
        lout->Add(allch);       
                if(options&kuseTOFmatchingcorrection)
@@ -1375,7 +1382,7 @@ Bool_t ReadConfigFile(TString configfile)
        ifstream infile(configfile.Data());
        if(infile.is_open()==false)
                return false;
-       TString namesofSetting[35]={"CutRangeMin","CutRangeMax","FitRangeMin","FitRangeMax","MinMatPionPlus","MaxMatPionPlus","MinMatKaonPlus","MaxMatKaonPlus","MinMatProtonPlus","MaxMatProtonPlus","MinMatPionMinus","MaxMatPionMinus","MinMatKaonMinus","MaxMatKaonMinus","MinMatProtonMinus","MaxMatProtonMinus","MinWDPionPlus","MaxWDPionPlus","MinWDKaonPlus","MaxWDKaonPlus","MinWDProtonPlus","MaxWDProtonPlus","MinWDPionMinus","MaxWDPionMinus","MinWDKaonMinus","MaxWDKaonMinus","MinWDProtonMinus","MaxWDProtonMinus","MaxContaminationPIDMC","MinPions","MaxPions","MinKaons","MaxKaons","MinProtons","MaxProtons"};     
+       TString namesofSetting[38]={"CutRangeMin","CutRangeMax","FitRangeMin","FitRangeMax","MinMatPionPlus","MaxMatPionPlus","MinMatKaonPlus","MaxMatKaonPlus","MinMatProtonPlus","MaxMatProtonPlus","MinMatPionMinus","MaxMatPionMinus","MinMatKaonMinus","MaxMatKaonMinus","MinMatProtonMinus","MaxMatProtonMinus","MinWDPionPlus","MaxWDPionPlus","MinWDKaonPlus","MaxWDKaonPlus","MinWDProtonPlus","MaxWDProtonPlus","MinWDPionMinus","MaxWDPionMinus","MinWDKaonMinus","MaxWDKaonMinus","MinWDProtonMinus","MaxWDProtonMinus","MaxContaminationPIDMC","MinPions","MaxPions","MinKaons","MaxKaons","MinProtons","MaxProtons","TOFPIDsignalmatchPion","TOFPIDsignalmatchKaon","TOFPIDsignalmatchProton"};   
 
        char buffer[256];
        while (infile.eof()==false)
@@ -1455,7 +1462,13 @@ Bool_t ReadConfigFile(TString configfile)
                        minRanges[2]=(tmpstring.Remove(0,namesofSetting[33].Length()+1)).Atof();
                else if (tmpstring.Contains(namesofSetting[34]))
                        maxRanges[2]=(tmpstring.Remove(0,namesofSetting[34].Length()+1)).Atof();                
-               else
+               else if (tmpstring.Contains(namesofSetting[35]))
+                       TOFPIDsignalmatching[0]=(tmpstring.Remove(0,namesofSetting[35].Length()+1)).Atof();             
+               else if (tmpstring.Contains(namesofSetting[36]))
+                       TOFPIDsignalmatching[1]=(tmpstring.Remove(0,namesofSetting[36].Length()+1)).Atof();
+               else if (tmpstring.Contains(namesofSetting[37]))
+                       TOFPIDsignalmatching[2]=(tmpstring.Remove(0,namesofSetting[37].Length()+1)).Atof();     
+               else  
                        continue;
 
 
@@ -1532,4 +1545,18 @@ void TOFMatchingForNch(TH1* h)
                return;                 
 
 
-}      
+}
+void TOFPIDsignalmatchingApply(TH1* h, Float_t factor)
+{
+       if(factor<0.0)
+               return;
+       for(Int_t ibin=1;ibin<h->GetNbinsX();ibin++)
+       {
+               Float_t ptspectra=h->GetBinCenter(ibin);
+               if(ptspectra<tcutsdata->GetPtTOFMatching())
+                       continue;
+               h->SetBinContent(ibin,(h->GetBinContent(ibin)*factor));
+
+       }
+
+}                      
index 6eb649c..2273f48 100644 (file)
@@ -36,10 +36,10 @@ TString pidmethods[3]={"TPC","TOF","TPCTOF"};
                                Int_t ibin=1;
                                Float_t binsize=nsig_mc->GetXaxis()->GetBinWidth(1);
 
-                               TH1F* maxposdata=(TH1F*)nsig_data->ProjectionX(Form("%s%sdatamaxpos",Particle[ipart].Data(),pidmethods[imethod].Data()),-1,-1));
+                               TH1F* maxposdata=(TH1F*)nsig_data->ProjectionX(Form("%s%sdatamaxpos",Particle[ipart].Data(),pidmethods[imethod].Data()),-1,-1);
                                maxposdata->Reset();
                                maxposdata->SetTitle(";p_{T} (GeV/c);max in (-2,2)");
-                               TH1F* maxposmc=(TH1F*)nsig_data->ProjectionX(Form("%s%smcmaxpos",Particle[ipart].Data(),pidmethods[imethod].Data()),-1,-1));
+                               TH1F* maxposmc=(TH1F*)nsig_data->ProjectionX(Form("%s%smcmaxpos",Particle[ipart].Data(),pidmethods[imethod].Data()),-1,-1);
                                maxposmc->Reset();
                                maxposmc->SetTitle(";p_{T} (GeV/c);max in (-2,2)");
 
@@ -48,8 +48,8 @@ TString pidmethods[3]={"TPC","TOF","TPCTOF"};
                                 {
                                        // TCanvas* c=new TCanvas(Form("canvas%s%s%d",Particle[ipart].Data(),pidmethods[imethod].Data(),ibin),Form("canvas%s%s%d",Particle[ipart].Data(),pidmethods[imethod].Data(),ibin),700,500);
                                        
-                                        TH1F *nsig_data_Proj1=(TH1F*)nsig_data->ProjectionY(Form("%s%sdata[%.2f,%.2f]",Particle[ipart].Data(),pidmethods[imethod].Data(),nsig_data->GetXaxis()->GetBinLowEdge(ibin),nsig_data->GetXaxis()->GetBinUpEdge(ibin)),ibin,ibin));
-                                        TH1F *nsig_mc_Proj1=(TH1F*)nsig_mc->ProjectionY(Form("%s%smc[%.2f,%.2f]",Particle[ipart].Data(),pidmethods[imethod].Data(),nsig_mc->GetXaxis()->GetBinLowEdge(ibin),nsig_mc->GetXaxis()->GetBinUpEdge(ibin)),ibin,ibin));
+                                        TH1F *nsig_data_Proj1=(TH1F*)nsig_data->ProjectionY(Form("%s%sdata[%.2f,%.2f]",Particle[ipart].Data(),pidmethods[imethod].Data(),nsig_data->GetXaxis()->GetBinLowEdge(ibin),nsig_data->GetXaxis()->GetBinUpEdge(ibin)),ibin,ibin);
+                                        TH1F *nsig_mc_Proj1=(TH1F*)nsig_mc->ProjectionY(Form("%s%smc[%.2f,%.2f]",Particle[ipart].Data(),pidmethods[imethod].Data(),nsig_mc->GetXaxis()->GetBinLowEdge(ibin),nsig_mc->GetXaxis()->GetBinUpEdge(ibin)),ibin,ibin);
                                         nsig_data_Proj1->GetXaxis()->SetRangeUser(-3,3);
                                         nsig_data_Proj1->SetLineColor(kRed);
                                         if(nsig_data_Proj1->Integral()<1&&nsig_mc_Proj1->Integral()<1)