diff --git a/macros/CCEScan/deplTool.h b/macros/CCEScan/deplTool.h index 9bb6566..2051235 100755 --- a/macros/CCEScan/deplTool.h +++ b/macros/CCEScan/deplTool.h @@ -37,7 +37,15 @@ runMap[2472] = 111267; runMap[2797] = 120006; runMap[3108] = 129494; - runMap[3478] = 135605; + runMap[3478] = 135605;//TO BE UPDATED!! + runMap[3820] = 153583; + runMap[3960] = 156887; + runMap[4518] = 166262; + runMap[4638] = 168092; + runMap[4643] = 168257; + runMap[4856] = 173040; + runMap[5162] = 181247; + runMap[5448] = 185508; return runMap; } std::map zeroRunMap = zeroRunOfFill(); @@ -48,15 +56,35 @@ // Calibration step residual -> time step (i.e. step%6) static std::map createTimeMap(){ std::map timeMap; + timeMap[0] = 0.0; timeMap[1] = -60.0; timeMap[2] = -30.0; timeMap[3] = 30.0; timeMap[4] = 60.0; timeMap[5] = 90.0; + return timeMap; } std::map timeMap = createTimeMap(); + + + //Added by Michele Atzeni to take into account the changes in the timing steps after fill 2252 + // Calibration step residual -> time step (i.e. step%6) + static std::map createTimeMap_post(){ + std::map timeMap_post; + + timeMap_post[0] = 0.0; + timeMap_post[1] = -90.0; + timeMap_post[2] = -45.0; + timeMap_post[3] = 45.0; + timeMap_post[4] = 90.0; + timeMap_post[5] = 135.0; + + return timeMap_post; + } + std::map timeMap_post = createTimeMap_post(); + // Calibration step residual -> TT voltage in volts (i.e. step/6) static std::map createVoltMapTT(){ @@ -113,23 +141,38 @@ // Returns time step for a given calibration step - double GetTimeStep(int step){ + //Modified to take into account the change in the time steps used + double GetTimeStep(int step, int fill){ if (step<0) { Error("GetTimeStep","Calibration step is smaller than zero, returning NaN"); return sqrt(-1); } - return timeMap[step%6]; + if( fill > 2252){ + return timeMap_post[step%6]; + } + else{ + return timeMap[step%6]; + } + } // Returns time in ns for a given calibration step - double GetTime(int step){ + //Modified to take into account the change in the time steps used + double GetTime(int step, int fill){ if (step<0) { Error("GetTime","Calibration step is smaller than zero, returning NaN"); return sqrt(-1); } - return timeMap[step%6]*timestep; + + if( fill > 2252){ + return timeMap_post[step%6]*timestep; + } + else{ + return timeMap[step%6]*timestep; + } } - + + // Returns TT voltage in V for a given calibration step double GetTTVoltage(int step){ if (step<0 || step/6>12) { @@ -149,10 +192,19 @@ } // Return calibration step for a given time step and TT voltage - int GetTTCalibStep(double time, double voltage){ - std::map::const_iterator timeEnd = timeMap.end(); + int GetTTCalibStep(double time, double voltage, int fill){ + + std::map timeMap_sw; + if(fill>2252){ + timeMap_sw = timeMap_post; + } + else{ + timeMap_sw = timeMap; + } + + std::map::const_iterator timeEnd = timeMap_sw.end(); std::map::const_iterator voltEnd = voltMapTT.end(); - for (std::map::const_iterator itTime = timeMap.begin(); + for (std::map::const_iterator itTime = timeMap_sw.begin(); itTime != timeEnd; itTime++) { for (std::map::const_iterator itVolt = voltMapTT.begin(); itVolt != voltEnd; itVolt++) { @@ -166,10 +218,19 @@ } // Return calibration step for a given time step and IT voltage - int GetITCalibStep(double time, double voltage){ - std::map::const_iterator timeEnd = timeMap.end(); + int GetITCalibStep(double time, double voltage, int fill){ + + std::map timeMap_sw; + if(fill>2252){ + timeMap_sw = timeMap_post; + } + else{ + timeMap_sw = timeMap; + } + + std::map::const_iterator timeEnd = timeMap_sw.end(); std::map::const_iterator voltEnd = voltMapIT.end(); - for (std::map::const_iterator itTime = timeMap.begin(); + for (std::map::const_iterator itTime = timeMap_sw.begin(); itTime != timeEnd; itTime++) { for (std::map::const_iterator itVolt = voltMapIT.begin(); itVolt != voltEnd; itVolt++) { @@ -457,4 +518,4 @@ -}; \ No newline at end of file + }; diff --git a/macros/CCEScan/landauFit.C b/macros/CCEScan/landauFit.C index d56c4bb..a6b322c 100755 --- a/macros/CCEScan/landauFit.C +++ b/macros/CCEScan/landauFit.C @@ -144,7 +144,7 @@ int voltStep = caliStep/6; int timeStep = caliStep%6; - double time = STTool::GetTime(caliStep); + double time = STTool::GetTime(caliStep, fill); double volt = 0.0; @@ -180,7 +180,7 @@ sector,fill,(int)radius, (int)caliStep)); } - // Printf("ci so, 0"); + Printf("ci so, 0"); // Set the radius to an irrelevant value if (radius<0.0) { @@ -216,12 +216,12 @@ lay.Data())); - // Printf("ci so, 1"); + Printf("ci so, 1"); TFile* f_data = TFile::Open(fn_data.Data()); - // Printf("ci so, 2"); + Printf("ci so, 2"); if (!f_data) { Error("landauFit","Data file does not exist!"); @@ -243,7 +243,7 @@ return EXIT_FAILURE; } - // Printf("ci so, 3"); + Printf("ci so, 3"); TH1F* h_sig = new TH1F("h_sig","Signal histo", @@ -269,12 +269,14 @@ // Get full selection for signal tracks/hits including radius TCut cu_sig = cu_bkg && cu_sel && TCut(Form("(TMath::Sqrt(xHit*xHit+yHit*yHit)<%f)",radius)); - // Printf("ci so, 4"); + Printf("ci so, 4"); // Fill Histograms - t_sig->Draw(Form("val%d>>h_sig",val),cu_sig,"goff"); - t_bkg->Draw(Form("val%d>>h_bkg",val),cu_bkg,"goff"); - + + t_sig->Draw(Form("val%d>>h_sig",val),cu_sig,"goff"); + t_bkg->Draw(Form("val%d>>h_bkg",val),cu_bkg,"goff"); + + delete t_sig; delete t_bkg; @@ -291,6 +293,8 @@ h_sig->GetXaxis()->GetXmax(), "ADC value"); + + // RooFit histograms RooDataHist* hr_bkg = new RooDataHist("hr_bkg","Histogram of raw noise", *adc,RooFit::Import(*h_bkg)); @@ -310,7 +314,7 @@ RooArgList(*nG1,*nG2), RooArgList(*nFrac)); - //Printf("ci so, 5"); + Printf("ci so, 5"); // Fit and plot noise sample @@ -418,11 +422,12 @@ sPDF->plotOn(sFrame,RooFit::Components(*nG),RooFit::LineColor(kBlue),RooFit::LineStyle(kDashed)); sPDF->plotOn(sFrame,RooFit::Components(*landauConv),RooFit::LineColor(kRed),RooFit::LineStyle(9)); sPDF->plotOn(sFrame,RooFit::Components(*landauConvPhoto),RooFit::LineColor(kRed),RooFit::LineStyle(kDashed)); - + Info("landauFit","Results: "); Printf(" MPV: %5.2f+/-%5.2f ADC counts",v_res(0),v_res(1)); Printf(" Noise: %5.2f+/-%5.2f ADC counts",v_res(2),v_res(3)); + if (nRes->status()==0) { Info("landauFit","Signal fit status: %d",nRes->status()); diff --git a/macros/CCEScan/pulseFit.C b/macros/CCEScan/pulseFit.C index c3d2593..65f0e20 100755 --- a/macros/CCEScan/pulseFit.C +++ b/macros/CCEScan/pulseFit.C @@ -147,7 +147,7 @@ - double time = STTool::GetTime(caliStep); + double time = STTool::GetTime(caliStep, fill); // Get the correct voltage value @@ -227,7 +227,7 @@ Warning("pulseFit","Vector %s not available",vn_input.Data()); continue; } - Printf(" %8.2f ns: %8.4f+/-%8.4f",STTool::GetTime(i),(*v_input)(0),(*v_input)(1)); + Printf(" %8.2f ns: %8.4f+/-%8.4f",STTool::GetTime(i,fill),(*v_input)(0),(*v_input)(1)); if (i==6*caliStep) { v_res(6) = (*v_input)(0); v_res(7) = (*v_input)(1); @@ -241,7 +241,7 @@ v_adc_val.push_back((*v_input)(0)); v_adc_err.push_back((*v_input)(1)); - v_time_val.push_back(STTool::GetTime(i)); + v_time_val.push_back(STTool::GetTime(i,fill)); v_time_err.push_back(0.0); } @@ -269,11 +269,12 @@ Info("pulseFit","#chi^{2}/ndf: %6.2f/%d",fu_pulse->GetChisquare(),fu_pulse->GetNDF()); // Make PDG-like correction of the uncertainties + /*Michele if (chi2ndf>1.0) { Info("pulseFit","scaling"); vr_adc_err*=TMath::Sqrt(chi2ndf); } - + //Michele*/ TMultiGraph* mg_pulse = new TMultiGraph("mg_pulse","Pulse multigraph"); ge_pulse = new TGraphErrors(vr_time_val,vr_adc_val,vr_time_err,vr_adc_err); diff --git a/macros/CCEScan/voltageFit_spline.C b/macros/CCEScan/voltageFit_spline.C index 726ccaa..946fd24 100755 --- a/macros/CCEScan/voltageFit_spline.C +++ b/macros/CCEScan/voltageFit_spline.C @@ -378,11 +378,15 @@ // Scale them Info("voltageFit_spline","#chi^{2}/ndf: %6.2f/%d",fu_volt->GetChisquare(),fu_volt->GetNDF()); + + /*Michele if (chi2ndf>0.00) { Info("voltageFit_spline","scaling"); - vr_adc_err_corr*=TMath::Sqrt(chi2ndf); + vr_adc_err_corr*=TMath::Sqrt(chi2ndf); } + //Michele*/ + // Get new graph ge_volt = new TGraphErrors(vr_volt_val_corr,vr_adc_val_corr,vr_volt_err_corr,vr_adc_err_corr);