diff --git a/Alignment/TrackerAlignment/macros/CosmicRateTool_CosmicRates.C b/Alignment/TrackerAlignment/macros/CosmicRateTool_CosmicRates.C index 3f5b8abbff9d5..5299a464e65a6 100644 --- a/Alignment/TrackerAlignment/macros/CosmicRateTool_CosmicRates.C +++ b/Alignment/TrackerAlignment/macros/CosmicRateTool_CosmicRates.C @@ -5,536 +5,683 @@ #include #include -void CosmicRateTool_CosmicRates(const char* fileName, unsigned int runLow=0, unsigned int runUp=0) -{ - TString InputFile= Form("%s",fileName); - TFile *file = new TFile(InputFile); - - bool IsFileExist; - IsFileExist = file->IsZombie(); - if(IsFileExist) - { - cout<Get("cosmicRateAnalyzer/Run"); - - FILE * pFile; - pFile = fopen ("tracksInfo.txt","w"); - - double run_time; - unsigned int runnum; - int number_of_events; - int number_of_tracks; - int number_of_tracks_PIX; - int number_of_tracks_FPIX; - int number_of_tracks_BPIX; - int number_of_tracks_TID; - int number_of_tracks_TIDM; - int number_of_tracks_TIDP; - int number_of_tracks_TIB; - int number_of_tracks_TEC; - int number_of_tracks_TECP; - int number_of_tracks_TECM; - int number_of_tracks_TOB; - - tree->SetBranchAddress("run_time", &run_time); - tree->SetBranchAddress("runnum", &runnum); - tree->SetBranchAddress("number_of_events", &number_of_events); - tree->SetBranchAddress("number_of_tracks", &number_of_tracks); - tree->SetBranchAddress("number_of_tracks_PIX", &number_of_tracks_PIX); - tree->SetBranchAddress("number_of_tracks_FPIX", &number_of_tracks_FPIX); - tree->SetBranchAddress("number_of_tracks_BPIX", &number_of_tracks_BPIX); - tree->SetBranchAddress("number_of_tracks_TID", &number_of_tracks_TID); - tree->SetBranchAddress("number_of_tracks_TIDM", &number_of_tracks_TIDM); - tree->SetBranchAddress("number_of_tracks_TIDP", &number_of_tracks_TIDP); - tree->SetBranchAddress("number_of_tracks_TIB", &number_of_tracks_TIB); - tree->SetBranchAddress("number_of_tracks_TEC", &number_of_tracks_TEC); - tree->SetBranchAddress("number_of_tracks_TECP", &number_of_tracks_TECP); - tree->SetBranchAddress("number_of_tracks_TECM", &number_of_tracks_TECM); - tree->SetBranchAddress("number_of_tracks_TOB", &number_of_tracks_TOB); - -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -// Various Rates Declerations -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - - Long64_t n = tree->GetEntriesFast(); - - vector event_rate ; - vector event_rate_err ; - vector track_rate ; - vector track_rate_err ; - vector runNumber ; - vector runNumber_err ; - vector track_rate_PIX ; - vector track_rate_PIX_err ; - vector track_rate_FPIX ; - vector track_rate_FPIX_err ; - vector track_rate_BPIX ; - vector track_rate_BPIX_err ; - vector track_rate_TOB ; - vector track_rate_TOB_err ; - vector track_rate_TIB ; - vector track_rate_TIB_err ; - vector track_rate_TID ; - vector track_rate_TID_err ; - vector track_rate_TEC ; - vector track_rate_TEC_err ; - vector track_rate_TECP ; - vector track_rate_TECP_err ; - vector track_rate_TECM ; - vector track_rate_TECM_err ; - vector tracks ; - vector tracks_err ; - vector tracks_bpix ; - vector tracks_fpix ; - vector tracks_pix ; - vector tracks_tec ; - vector weight ; - - - string Bar_Xtitle[8] = {"Event","Track","FPIX","BPIX","TIB","TID","TOB","TEC"}; - double Bar_Ytitle[8] = {0}; - - - int j=0; - double total_tracks = 0; - double bpix_tracks = 0; - double fpix_tracks = 0; - double pix_tracks = 0; - double tracks_TECoff = 0; - - cout<GetEntry(jentry); - if (run_time == 0 ) continue; - - if (runLow != 0 && runUp != 0 ) - { - if (runnum < runLow) continue; - if (runnum > runUp) break; - } - - event_rate .push_back( number_of_events/run_time ); - runNumber .push_back( runnum ); - track_rate .push_back( number_of_tracks/run_time ); - track_rate_PIX .push_back( number_of_tracks_PIX/run_time ); - track_rate_FPIX .push_back( number_of_tracks_FPIX/run_time ); - track_rate_BPIX .push_back( number_of_tracks_BPIX/run_time ); - track_rate_TOB .push_back( number_of_tracks_TOB/run_time ); - track_rate_TIB .push_back( number_of_tracks_TIB/run_time ); - track_rate_TID .push_back( number_of_tracks_TID/run_time ); - track_rate_TEC .push_back( number_of_tracks_TEC/run_time ); - track_rate_TECP .push_back( number_of_tracks_TECP/run_time ); - track_rate_TECM .push_back( number_of_tracks_TECM/run_time ); - tracks .push_back( number_of_tracks ); - tracks_bpix .push_back( number_of_tracks_BPIX ); - tracks_fpix .push_back( number_of_tracks_FPIX ); - tracks_pix .push_back( number_of_tracks_PIX ); - tracks_tec .push_back( number_of_tracks_TECM ); - total_tracks += tracks[j]; - bpix_tracks += tracks_bpix[j]; - fpix_tracks += tracks_fpix[j]; - pix_tracks += tracks_pix[j]; - - - fprintf(pFile,"runnum :%-7.0lf, # of tracks :%-10.0lf, track rates :%-10.2lf\n",runNumber.at(j),tracks.at(j),track_rate.at(j)); - track_rate_err .push_back( sqrt(float(number_of_tracks))/run_time ); - event_rate_err .push_back( sqrt(float(number_of_events))/run_time ); - track_rate_PIX_err .push_back( sqrt(float(number_of_tracks_PIX))/run_time ); - track_rate_FPIX_err .push_back( sqrt(float(number_of_tracks_FPIX))/run_time ); - track_rate_BPIX_err .push_back( sqrt(float(number_of_tracks_BPIX))/run_time ); - track_rate_TOB_err .push_back( sqrt(float(number_of_tracks_TOB))/run_time ); - track_rate_TIB_err .push_back( sqrt(float(number_of_tracks_TIB))/run_time ); - track_rate_TID_err .push_back( sqrt(float(number_of_tracks_TID))/run_time ); - track_rate_TEC_err .push_back( sqrt(float(number_of_tracks_TEC))/run_time ); - track_rate_TECP_err .push_back( sqrt(float(number_of_tracks_TECP))/run_time ); - track_rate_TECM_err .push_back( sqrt(float(number_of_tracks_TECM))/run_time ); - - runNumber_err.push_back(0); - if (number_of_tracks_TECM == 0){ - tracks_TECoff += tracks.at(j);} - - j++; - - - - } - - fprintf(pFile,"\n\n"); - fprintf(pFile,"##################################################\n"); - fprintf(pFile," Some information on total number of tracks \n"); - fprintf(pFile,"##################################################\n"); - fprintf(pFile,"Total # of tracks : %-10.0lf\n",total_tracks); - fprintf(pFile,"# of tracks in BPIX : %-10.0lf\n",bpix_tracks); - fprintf(pFile,"# of tracks in FPIX : %-10.0lf\n",fpix_tracks); - fprintf(pFile,"# of tracks in PIX : %-10.0lf\n",pix_tracks); - fprintf(pFile,"\n\n"); - - fclose (pFile); - -//+++++++++++++++++++++++++++++ Make Directories +++++++++++++++++++++++++++++++++++++ - - gSystem->Exec("mkdir -p Rate_Plots"); - -//---------------------------------------------------------------------------------------------- - - - TCanvas c("c","c",800,600); // Declare canvas - - TVectorD event_rate_VecD ; - TVectorD event_rate_err_VecD ; - TVectorD track_rate_VecD ; - TVectorD track_rate_err_VecD ; - TVectorD runNumber_VecD ; - TVectorD runNumber_err_VecD ; - TVectorD track_rate_PIX_VecD ; - TVectorD track_rate_PIX_err_VecD ; - TVectorD track_rate_FPIX_VecD ; - TVectorD track_rate_FPIX_err_VecD ; - TVectorD track_rate_BPIX_VecD ; - TVectorD track_rate_BPIX_err_VecD ; - TVectorD track_rate_TOB_VecD ; - TVectorD track_rate_TOB_err_VecD ; - TVectorD track_rate_TIB_VecD ; - TVectorD track_rate_TIB_err_VecD ; - TVectorD track_rate_TID_VecD ; - TVectorD track_rate_TID_err_VecD ; - TVectorD track_rate_TEC_VecD ; - TVectorD track_rate_TEC_err_VecD ; - TVectorD track_rate_TECP_VecD ; - TVectorD track_rate_TECP_err_VecD ; - TVectorD track_rate_TECM_VecD ; - TVectorD track_rate_TECM_err_VecD ; - - - runNumber_VecD.Use(runNumber.size(),&(runNumber[0])); - runNumber_err_VecD.Use(runNumber_err.size(),&(runNumber_err[0])); - event_rate_VecD.Use(event_rate.size(),&(event_rate[0])); - event_rate_err_VecD.Use(event_rate_err.size(),&(event_rate_err[0])); - - track_rate_VecD.Use(track_rate.size(),&(track_rate[0])); - track_rate_err_VecD.Use(track_rate_err.size(),&(track_rate_err[0])); - - track_rate_PIX_VecD.Use(track_rate_PIX.size(),&(track_rate_PIX[0])); - track_rate_PIX_err_VecD.Use(track_rate_PIX_err.size(),&(track_rate_PIX_err[0])); - track_rate_FPIX_VecD.Use(track_rate_FPIX.size(),&(track_rate_FPIX[0])); - track_rate_FPIX_err_VecD.Use(track_rate_FPIX_err.size(),&(track_rate_FPIX_err[0])); - track_rate_BPIX_VecD.Use(track_rate_BPIX.size(),&(track_rate_BPIX[0])); - track_rate_BPIX_err_VecD.Use(track_rate_BPIX_err.size(),&(track_rate_BPIX_err[0])); - track_rate_TOB_VecD.Use(track_rate_TOB.size(),&(track_rate_TOB[0])); - track_rate_TOB_err_VecD.Use(track_rate_TOB_err.size(),&(track_rate_TOB_err[0])); - track_rate_TIB_VecD.Use(track_rate_TIB.size(),&(track_rate_TIB[0])); - track_rate_TIB_err_VecD.Use(track_rate_TIB_err.size(),&(track_rate_TIB_err[0])); - track_rate_TID_VecD.Use(track_rate_TID.size(),&(track_rate_TID[0])); - track_rate_TID_err_VecD.Use(track_rate_TID_err.size(),&(track_rate_TID_err[0])); - track_rate_TEC_VecD.Use(track_rate_TEC.size(),&(track_rate_TEC[0])); - track_rate_TEC_err_VecD.Use(track_rate_TEC_err.size(),&(track_rate_TEC_err[0])); - track_rate_TECP_VecD.Use(track_rate_TECP.size(),&(track_rate_TECP[0])); - track_rate_TECP_err_VecD.Use(track_rate_TECP_err.size(),&(track_rate_TECP_err[0])); - track_rate_TECM_VecD.Use(track_rate_TECM.size(),&(track_rate_TECM[0])); - track_rate_TECM_err_VecD.Use(track_rate_TECM_err.size(),&(track_rate_TECM_err[0])); - - -//+++++++++++++++++++++++++++++ Overall event event rate +++++++++++++++++++++++++++++++++++++ - - TGraphErrors gr_event_rate(runNumber_VecD,event_rate_VecD,runNumber_err_VecD,event_rate_err_VecD); - gr_event_rate.GetXaxis()->SetTitle("Run Number"); - gr_event_rate.GetXaxis()->SetLabelSize(0.03); - gr_event_rate.GetXaxis()->SetNoExponent(); - gr_event_rate.GetYaxis()->SetTitle("Event Rate (in Hz)"); - gr_event_rate.SetMarkerStyle(20); - gr_event_rate.SetMarkerSize(1.2); - gr_event_rate.SetMarkerColor(kBlue); - gr_event_rate.SetTitle("Event Rate"); - gr_event_rate.GetYaxis()->SetRangeUser(0,7); - gr_event_rate.Draw("AP"); - c.SetGrid(); - c.SaveAs("event_rate.png"); - c.Clear(); - gSystem->Exec("mv event_rate.png Rate_Plots"); - -//----------------------------------------------------------------------------------------------- - - -//++++++++++++++++++++++++++++++ Overall track rate +++++++++++++++++++++++++++++++++++++++++++ - - TGraphErrors gr_track_rate(runNumber_VecD,track_rate_VecD,runNumber_err_VecD,track_rate_err_VecD); - gr_track_rate.GetXaxis()->SetTitle("Run Number"); - gr_track_rate.GetXaxis()->SetLabelSize(0.03); - gr_track_rate.GetXaxis()->SetNoExponent(); - gr_track_rate.GetYaxis()->SetTitle("Track Rate (in Hz)"); - gr_track_rate.SetMarkerStyle(20); - gr_track_rate.SetMarkerSize(1.2); - gr_track_rate.SetMarkerColor(kBlue); - gr_track_rate.SetTitle("Track Rate"); - gr_track_rate.GetYaxis()->SetRangeUser(0,5); - gr_track_rate.Draw("AP"); - c.SetGrid(); - c.SaveAs("track_rate.png"); - c.Clear(); - gSystem->Exec("mv track_rate.png Rate_Plots"); - -//----------------------------------------------------------------------------------------------- - -//+++++++++++++++++++++++++++++++ Total Pixel track rate +++++++++++++++++++++++++++++++++++++++ - - TGraphErrors gr_track_rate_PIX(runNumber_VecD,track_rate_PIX_VecD,runNumber_err_VecD,track_rate_PIX_err_VecD); - gr_track_rate_PIX.GetXaxis()->SetTitle("Run Number"); - gr_track_rate_PIX.GetXaxis()->SetLabelSize(0.03); - gr_track_rate_PIX.GetXaxis()->SetNoExponent(); - gr_track_rate_PIX.GetYaxis()->SetTitle("Track Rate (in Hz)"); - gr_track_rate_PIX.SetMarkerStyle(20); - gr_track_rate_PIX.SetMarkerSize(1.2); - gr_track_rate_PIX.SetMarkerColor(kBlue); - gr_track_rate_PIX.SetTitle("Pixel Track Rate"); - gr_track_rate_PIX.Draw("AP"); - c.SetGrid(); - c.SaveAs("pixel_track_rate.png"); - c.Clear(); - gSystem->Exec("mv pixel_track_rate.png Rate_Plots"); - -//----------------------------------------------------------------------------------------------- - -//++++++++++++++++++++++++++++++++ FPIX track rate ++++++++++++++++++++++++++++++++++++++++++++ - - TGraphErrors gr_track_rate_FPIX(runNumber_VecD,track_rate_FPIX_VecD,runNumber_err_VecD,track_rate_FPIX_err_VecD); - gr_track_rate_FPIX.GetXaxis()->SetTitle("Run Number"); - gr_track_rate_FPIX.GetXaxis()->SetLabelSize(0.03); - gr_track_rate_FPIX.GetXaxis()->SetNoExponent(); - gr_track_rate_FPIX.GetYaxis()->SetTitle("Track Rate (in Hz)"); - gr_track_rate_FPIX.SetMarkerStyle(20); - gr_track_rate_FPIX.SetMarkerSize(1.2); - gr_track_rate_FPIX.SetMarkerColor(kBlue); - gr_track_rate_FPIX.SetTitle("FPIX Track Rate"); - gr_track_rate_FPIX.Draw("AP"); - c.SetGrid(); - c.SaveAs("fpix_track_rate.png"); - c.Clear(); - gSystem->Exec("mv fpix_track_rate.png Rate_Plots"); -//----------------------------------------------------------------------------------------------- - - -//++++++++++++++++++++++++++++++++ BPIX track rate ++++++++++++++++++++++++++++++++++++++++++++ - - TGraphErrors gr_track_rate_BPIX(runNumber_VecD,track_rate_BPIX_VecD,runNumber_err_VecD,track_rate_BPIX_err_VecD); - gr_track_rate_BPIX.GetXaxis()->SetTitle("Run Number"); - gr_track_rate_BPIX.GetXaxis()->SetLabelSize(0.03); - gr_track_rate_BPIX.GetXaxis()->SetNoExponent(); - gr_track_rate_BPIX.GetYaxis()->SetTitle("Track Rate (in Hz)"); - gr_track_rate_BPIX.SetMarkerStyle(20); - gr_track_rate_BPIX.SetMarkerSize(1.2); - gr_track_rate_BPIX.SetMarkerColor(kBlue); - gr_track_rate_BPIX.SetTitle("BPIX Track Rate"); - gr_track_rate_BPIX.Draw("AP"); - c.SetGrid(); - c.SaveAs("bpix_track_rate.png"); - c.Clear(); - gSystem->Exec("mv bpix_track_rate.png Rate_Plots"); - -//----------------------------------------------------------------------------------------------- - - -//++++++++++++++++++++++++++++++++ TOB track rate ++++++++++++++++++++++++++++++++++++++++++++ - - TGraphErrors gr_track_rate_TOB(runNumber_VecD,track_rate_TOB_VecD,runNumber_err_VecD,track_rate_TOB_err_VecD); - gr_track_rate_TOB.GetXaxis()->SetTitle("Run Number"); - gr_track_rate_TOB.GetXaxis()->SetLabelSize(0.03); - gr_track_rate_TOB.GetXaxis()->SetNoExponent(); - gr_track_rate_TOB.GetYaxis()->SetTitle("Track Rate (in Hz)"); - gr_track_rate_TOB.SetMarkerStyle(20); - gr_track_rate_TOB.SetMarkerSize(1.2); - gr_track_rate_TOB.SetMarkerColor(kBlue); - gr_track_rate_TOB.SetTitle("TOB Track Rate"); - gr_track_rate_TOB.Draw("AP"); - c.SetGrid(); - c.SaveAs("tob_track_rate.png"); - c.Clear(); - gSystem->Exec("mv tob_track_rate.png Rate_Plots"); - -//----------------------------------------------------------------------------------------------- - - -//++++++++++++++++++++++++++++++++ TIB track rate ++++++++++++++++++++++++++++++++++++++++++++ - - TGraphErrors gr_track_rate_TIB(runNumber_VecD,track_rate_TIB_VecD,runNumber_err_VecD,track_rate_TIB_err_VecD); - gr_track_rate_TIB.GetXaxis()->SetTitle("Run Number"); - gr_track_rate_TIB.GetXaxis()->SetLabelSize(0.03); - gr_track_rate_TIB.GetXaxis()->SetNoExponent(); - gr_track_rate_TIB.GetYaxis()->SetTitle("Track Rate (in Hz)"); - gr_track_rate_TIB.SetMarkerStyle(20); - gr_track_rate_TIB.SetMarkerSize(1.2); - gr_track_rate_TIB.SetMarkerColor(kBlue); - gr_track_rate_TIB.SetTitle("TIB Track Rate"); - gr_track_rate_TIB.Draw("AP"); - c.SetGrid(); - c.SaveAs("tib_track_rate.png"); - c.Clear(); - gSystem->Exec("mv tib_track_rate.png Rate_Plots"); - -//----------------------------------------------------------------------------------------------- - - -//++++++++++++++++++++++++++++++++ TID track rate ++++++++++++++++++++++++++++++++++++++++++++ - - TGraphErrors gr_track_rate_TID(runNumber_VecD,track_rate_TID_VecD,runNumber_err_VecD,track_rate_TID_err_VecD); - gr_track_rate_TID.GetXaxis()->SetTitle("Run Number"); - gr_track_rate_TID.GetXaxis()->SetLabelSize(0.03); - gr_track_rate_TID.GetXaxis()->SetNoExponent(); - gr_track_rate_TID.GetYaxis()->SetTitle("Track Rate (in Hz)"); - gr_track_rate_TID.SetMarkerStyle(20); - gr_track_rate_TID.SetMarkerSize(1.2); - gr_track_rate_TID.SetMarkerColor(kBlue); - gr_track_rate_TID.SetTitle("TID Track Rate"); - gr_track_rate_TID.Draw("AP"); - c.SetGrid(); - c.SaveAs("tid_track_rate.png"); - c.Clear(); - gSystem->Exec("mv tid_track_rate.png Rate_Plots"); - -//----------------------------------------------------------------------------------------------- - - -//++++++++++++++++++++++++++++++++ Total TEC track rate ++++++++++++++++++++++++++++++++++++++++++++ - - TGraphErrors gr_track_rate_TEC(runNumber_VecD,track_rate_TEC_VecD,runNumber_err_VecD,track_rate_TEC_err_VecD); - gr_track_rate_TEC.GetXaxis()->SetTitle("Run Number"); - gr_track_rate_TEC.GetXaxis()->SetLabelSize(0.03); - gr_track_rate_TEC.GetXaxis()->SetNoExponent(); - gr_track_rate_TEC.GetYaxis()->SetTitle("Track Rate (in Hz)"); - gr_track_rate_TEC.SetMarkerStyle(20); - gr_track_rate_TEC.SetMarkerSize(1.2); - gr_track_rate_TEC.SetMarkerColor(kBlue); - gr_track_rate_TEC.SetTitle("TEC Track Rate"); - gr_track_rate_TEC.Draw("AP"); - c.SetGrid(); - c.SaveAs("tec_track_rate.png"); - c.Clear(); - gSystem->Exec("mv tec_track_rate.png Rate_Plots"); - -//----------------------------------------------------------------------------------------------- - - -//++++++++++++++++++++++++++++++++ TEC+/- track rate ++++++++++++++++++++++++++++++++++++++++++++ - TMultiGraph mg("track rate","TRack Rate TEC+/-"); // Multigraph decleration - - TGraphErrors *gr_track_rate_TECP = new TGraphErrors(runNumber_VecD,track_rate_TECP_VecD,runNumber_err_VecD,track_rate_TECP_err_VecD); - gr_track_rate_TECP->SetMarkerStyle(20); - gr_track_rate_TECP->SetMarkerSize(1.2); - gr_track_rate_TECP->SetMarkerColor(kBlack); - - TGraphErrors *gr_track_rate_TECM = new TGraphErrors(runNumber_VecD,track_rate_TECM_VecD,runNumber_err_VecD,track_rate_TECM_err_VecD); - gr_track_rate_TECM->SetMarkerStyle(20); - gr_track_rate_TECM->SetMarkerSize(1.2); - gr_track_rate_TECM->SetMarkerColor(kRed); - - mg.Add(gr_track_rate_TECP); - mg.Add(gr_track_rate_TECM); - mg.Draw("AP"); - mg.GetXaxis()->SetTitle("Run Number"); - mg.GetXaxis()->SetNoExponent(); - mg.GetXaxis()->SetLabelSize(0.03); - mg.GetYaxis()->SetTitle("Track Rate (in Hz)"); - - TLegend leg(0.8,0.8,0.94,0.92); // Legend for TEC+/- - leg.AddEntry(gr_track_rate_TECP, "TEC+","p"); - leg.AddEntry(gr_track_rate_TECM, "TEC-","p"); - leg.SetBorderSize(1); - leg.SetShadowColor(0); - leg.SetFillColor(0); - leg.Draw(); - c.SetGrid(); - c.SaveAs("tec_track_ratePM.png"); - c.Clear(); - gSystem->Exec("mv tec_track_ratePM.png Rate_Plots"); - -//----------------------------------------------------------------------------------------------- - - - -//----------------------------------------------------------------------------------------------- -// Weighted Mean calculation -//----------------------------------------------------------------------------------------------- - - - double total_weight = 0; - double weighted_mean_track_rate; - double weighted_mean_track_rate_TEC; - double weighted_mean_track_rate_TOB; - double weighted_mean_track_rate_TIB; - double weighted_mean_track_rate_TID; - double weighted_mean_track_rate_FPIX; - double weighted_mean_track_rate_BPIX; - double weighted_mean_event_rate; - - for (int k = 0; k < j; k++) - { - weight.push_back( tracks.at(k)/total_tracks ); - } - - - for (int a = 0; a < j ; a++) - { - weighted_mean_track_rate += track_rate.at(a) * weight.at(a) ; - weighted_mean_track_rate_TEC += track_rate_TEC.at(a) * weight.at(a) ; - weighted_mean_track_rate_TOB += track_rate_TOB.at(a) * weight.at(a) ; - weighted_mean_track_rate_TIB += track_rate_TIB.at(a) * weight.at(a) ; - weighted_mean_track_rate_TID += track_rate_TID.at(a) * weight.at(a) ; - weighted_mean_track_rate_FPIX += track_rate_FPIX.at(a)* weight.at(a) ; - weighted_mean_track_rate_BPIX += track_rate_BPIX.at(a)* weight.at(a) ; - weighted_mean_event_rate += event_rate.at(a) * weight.at(a) ; - total_weight += weight.at(a) ; - } - -//----------------------------------------------------------------------------------------------- -// Summary Plot for track rate in each Subdetector -//----------------------------------------------------------------------------------------------- - - TH1F h1b("h1b","rate summary",8,0,8); - h1b.SetFillColor(4); - h1b.SetBarWidth(0.3); - h1b.SetBarOffset(0.35); - h1b.SetStats(0); - - Bar_Ytitle[0] = weighted_mean_event_rate; - Bar_Ytitle[1] = weighted_mean_track_rate; - Bar_Ytitle[2] = weighted_mean_track_rate_FPIX; - Bar_Ytitle[3] = weighted_mean_track_rate_BPIX; - Bar_Ytitle[4] = weighted_mean_track_rate_TIB; - Bar_Ytitle[5] = weighted_mean_track_rate_TID; - Bar_Ytitle[6] = weighted_mean_track_rate_TOB; - Bar_Ytitle[7] = weighted_mean_track_rate_TEC; - - for (int i=1; i<=8; i++) - { - h1b.SetBinContent(i, Bar_Ytitle[i-1]); - h1b.GetXaxis()->SetBinLabel(i,Bar_Xtitle[i-1].c_str()); - } - - gStyle->SetPaintTextFormat("1.4f"); - h1b.LabelsOption("d"); - h1b.SetLabelSize(0.04); - h1b.GetYaxis()->SetTitle("Average Rate (Hz)"); - h1b.Draw("bTEXT"); - c.SaveAs("Summary_Chart.png"); - c.Close(); - gSystem->Exec("mv Summary_Chart.png Rate_Plots"); +void CosmicRateTool_CosmicRates(const char *fileName, unsigned int runLow = 0, unsigned int runUp = 0) { + TString InputFile = Form("%s", fileName); + TFile *file = new TFile(InputFile); + + bool IsFileExist; + IsFileExist = file->IsZombie(); + if (IsFileExist) { + cout << endl + << "=====================================================================================================" + << endl; + cout << fileName << " is not found. Check the file!" << endl; + cout << "=====================================================================================================" + << endl + << endl; + exit(EXIT_FAILURE); + } + + TTree *tree; + tree = (TTree *)file->Get("cosmicRateAnalyzer/Run"); + + FILE *pFile; + pFile = fopen("tracksInfo.txt", "w"); + + double run_time; + unsigned int runnum; + int number_of_events; + int number_of_tracks; + int number_of_tracks_PIX; + int number_of_tracks_FPIX; + int number_of_tracks_BPIX; + int number_of_tracks_TID; + int number_of_tracks_TIDM; + int number_of_tracks_TIDP; + int number_of_tracks_TIB; + int number_of_tracks_TEC; + int number_of_tracks_TECP; + int number_of_tracks_TECM; + int number_of_tracks_TOB; + + tree->SetBranchAddress("run_time", &run_time); + tree->SetBranchAddress("runnum", &runnum); + tree->SetBranchAddress("number_of_events", &number_of_events); + tree->SetBranchAddress("number_of_tracks", &number_of_tracks); + tree->SetBranchAddress("number_of_tracks_PIX", &number_of_tracks_PIX); + tree->SetBranchAddress("number_of_tracks_FPIX", &number_of_tracks_FPIX); + tree->SetBranchAddress("number_of_tracks_BPIX", &number_of_tracks_BPIX); + tree->SetBranchAddress("number_of_tracks_TID", &number_of_tracks_TID); + tree->SetBranchAddress("number_of_tracks_TIDM", &number_of_tracks_TIDM); + tree->SetBranchAddress("number_of_tracks_TIDP", &number_of_tracks_TIDP); + tree->SetBranchAddress("number_of_tracks_TIB", &number_of_tracks_TIB); + tree->SetBranchAddress("number_of_tracks_TEC", &number_of_tracks_TEC); + tree->SetBranchAddress("number_of_tracks_TECP", &number_of_tracks_TECP); + tree->SetBranchAddress("number_of_tracks_TECM", &number_of_tracks_TECM); + tree->SetBranchAddress("number_of_tracks_TOB", &number_of_tracks_TOB); + + //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + // Various Rates Declerations + //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + + vector event_rate; + vector event_rate_err; + vector track_rate; + vector track_rate_err; + vector runNumber; + vector runNumber_err; + vector track_rate_PIX; + vector track_rate_PIX_err; + vector track_rate_FPIX; + vector track_rate_FPIX_err; + vector track_rate_BPIX; + vector track_rate_BPIX_err; + vector track_rate_TOB; + vector track_rate_TOB_err; + vector track_rate_TIB; + vector track_rate_TIB_err; + vector track_rate_TID; + vector track_rate_TID_err; + vector track_rate_TEC; + vector track_rate_TEC_err; + vector track_rate_TECP; + vector track_rate_TECP_err; + vector track_rate_TECM; + vector track_rate_TECM_err; + vector tracks; + vector tracks_err; + vector tracks_bpix; + vector tracks_fpix; + vector tracks_pix; + vector tracks_tec; + vector weight; + + string Bar_Xtitle[8] = {"Event", "Track", "FPIX", "BPIX", "TIB", "TID", "TOB", "TEC"}; + double Bar_Ytitle[8] = {0}; + + int j = 0; + double total_tracks = 0; + double bpix_tracks = 0; + double fpix_tracks = 0; + double pix_tracks = 0; + double tracks_TECoff = 0; + int nTotalEvents = 0, nTotalTracks = 0; + + fprintf(pFile, "##################################################\n"); + fprintf(pFile, " Track rate for each run number \n"); + fprintf(pFile, "##################################################\n"); + + Long64_t n = tree->GetEntriesFast(); + std::cout << "Total Runs in this file: " << n << endl; + for (Long64_t jentry = 0; jentry < n; jentry++) // Loop over Runs + { + tree->GetEntry(jentry); + if (run_time == 0 || run_time < 0) + continue; + + if (runLow != 0 && runUp != 0) { + if (runnum < runLow) + continue; + if (runnum > runUp) + break; + } + + event_rate.push_back(number_of_events / run_time); + runNumber.push_back(runnum); + track_rate.push_back(number_of_tracks / run_time); + track_rate_PIX.push_back(number_of_tracks_PIX / run_time); + track_rate_FPIX.push_back(number_of_tracks_FPIX / run_time); + track_rate_BPIX.push_back(number_of_tracks_BPIX / run_time); + track_rate_TOB.push_back(number_of_tracks_TOB / run_time); + track_rate_TIB.push_back(number_of_tracks_TIB / run_time); + track_rate_TID.push_back(number_of_tracks_TID / run_time); + track_rate_TEC.push_back(number_of_tracks_TEC / run_time); + track_rate_TECP.push_back(number_of_tracks_TECP / run_time); + track_rate_TECM.push_back(number_of_tracks_TECM / run_time); + tracks.push_back(number_of_tracks); + tracks_bpix.push_back(number_of_tracks_BPIX); + tracks_fpix.push_back(number_of_tracks_FPIX); + tracks_pix.push_back(number_of_tracks_PIX); + tracks_tec.push_back(number_of_tracks_TECM); + total_tracks += tracks[j]; + bpix_tracks += tracks_bpix[j]; + fpix_tracks += tracks_fpix[j]; + pix_tracks += tracks_pix[j]; + nTotalEvents += number_of_events; + nTotalTracks += number_of_tracks; + + fprintf(pFile, + "runnum :%-7.0lf, # of tracks :%-10.0lf, track rates :%-10.2lf\n", + runNumber.at(j), + tracks.at(j), + track_rate.at(j)); + track_rate_err.push_back(sqrt(float(number_of_tracks)) / run_time); + event_rate_err.push_back(sqrt(float(number_of_events)) / run_time); + track_rate_PIX_err.push_back(sqrt(float(number_of_tracks_PIX)) / run_time); + track_rate_FPIX_err.push_back(sqrt(float(number_of_tracks_FPIX)) / run_time); + track_rate_BPIX_err.push_back(sqrt(float(number_of_tracks_BPIX)) / run_time); + track_rate_TOB_err.push_back(sqrt(float(number_of_tracks_TOB)) / run_time); + track_rate_TIB_err.push_back(sqrt(float(number_of_tracks_TIB)) / run_time); + track_rate_TID_err.push_back(sqrt(float(number_of_tracks_TID)) / run_time); + track_rate_TEC_err.push_back(sqrt(float(number_of_tracks_TEC)) / run_time); + track_rate_TECP_err.push_back(sqrt(float(number_of_tracks_TECP)) / run_time); + track_rate_TECM_err.push_back(sqrt(float(number_of_tracks_TECM)) / run_time); + + runNumber_err.push_back(0); + if (number_of_tracks_TECM == 0) { + tracks_TECoff += tracks.at(j); + } + + j++; + } //Loop over runs closed + std::cout << "Total Events: " << nTotalEvents << std::endl; + std::cout << "Total Tracks: " << nTotalTracks << std::endl; + + fprintf(pFile, "\n\n"); + fprintf(pFile, "##################################################\n"); + fprintf(pFile, " Some information on total number of tracks \n"); + fprintf(pFile, "##################################################\n"); + fprintf(pFile, "Total # of tracks : %-10.0lf\n", total_tracks); + fprintf(pFile, "# of tracks in BPIX : %-10.0lf\n", bpix_tracks); + fprintf(pFile, "# of tracks in FPIX : %-10.0lf\n", fpix_tracks); + fprintf(pFile, "# of tracks in PIX : %-10.0lf\n", pix_tracks); + fprintf(pFile, "\n\n"); + + fclose(pFile); + + //+++++++++++++++++++++++++++++ Make Directories +++++++++++++++++++++++++++++++++++++ + + gSystem->Exec("mkdir -p Rate_Plots"); + + //---------------------------------------------------------------------------------------------- + + TCanvas c("c1", "c1", 604, 82, 856, 836); // Declare canvas + gStyle->SetOptStat(0); + c.Range(298434.4, -0.2989256, 299381.3, 2.010954); + c.SetFillColor(0); + c.SetBorderMode(0); + c.SetBorderSize(2); + c.SetTickx(1); + c.SetTicky(1); + c.SetGrid(); + c.SetLeftMargin(0.1883886); + c.SetRightMargin(0.03909953); + c.SetTopMargin(0.0875817); + c.SetBottomMargin(0.1294118); + c.SetFrameLineWidth(3); + c.SetFrameBorderMode(0); + + //============ Text =============// + TLatex top_right_Title = TLatex(); + top_right_Title.SetTextFont(42); + top_right_Title.SetTextSize(0.03717); + + TLatex detector = TLatex(); + detector.SetTextFont(62); + detector.SetTextSize(0.047); + + //============ Declaring TVectors for TGraphs =============// + TVectorD event_rate_VecD; + TVectorD event_rate_err_VecD; + TVectorD track_rate_VecD; + TVectorD track_rate_err_VecD; + TVectorD runNumber_VecD; + TVectorD runNumber_err_VecD; + TVectorD track_rate_PIX_VecD; + TVectorD track_rate_PIX_err_VecD; + TVectorD track_rate_FPIX_VecD; + TVectorD track_rate_FPIX_err_VecD; + TVectorD track_rate_BPIX_VecD; + TVectorD track_rate_BPIX_err_VecD; + TVectorD track_rate_TOB_VecD; + TVectorD track_rate_TOB_err_VecD; + TVectorD track_rate_TIB_VecD; + TVectorD track_rate_TIB_err_VecD; + TVectorD track_rate_TID_VecD; + TVectorD track_rate_TID_err_VecD; + TVectorD track_rate_TEC_VecD; + TVectorD track_rate_TEC_err_VecD; + TVectorD track_rate_TECP_VecD; + TVectorD track_rate_TECP_err_VecD; + TVectorD track_rate_TECM_VecD; + TVectorD track_rate_TECM_err_VecD; + + runNumber_VecD.Use(runNumber.size(), &(runNumber[0])); + runNumber_err_VecD.Use(runNumber_err.size(), &(runNumber_err[0])); + event_rate_VecD.Use(event_rate.size(), &(event_rate[0])); + event_rate_err_VecD.Use(event_rate_err.size(), &(event_rate_err[0])); + + track_rate_VecD.Use(track_rate.size(), &(track_rate[0])); + track_rate_err_VecD.Use(track_rate_err.size(), &(track_rate_err[0])); + + track_rate_PIX_VecD.Use(track_rate_PIX.size(), &(track_rate_PIX[0])); + track_rate_PIX_err_VecD.Use(track_rate_PIX_err.size(), &(track_rate_PIX_err[0])); + track_rate_FPIX_VecD.Use(track_rate_FPIX.size(), &(track_rate_FPIX[0])); + track_rate_FPIX_err_VecD.Use(track_rate_FPIX_err.size(), &(track_rate_FPIX_err[0])); + track_rate_BPIX_VecD.Use(track_rate_BPIX.size(), &(track_rate_BPIX[0])); + track_rate_BPIX_err_VecD.Use(track_rate_BPIX_err.size(), &(track_rate_BPIX_err[0])); + track_rate_TOB_VecD.Use(track_rate_TOB.size(), &(track_rate_TOB[0])); + track_rate_TOB_err_VecD.Use(track_rate_TOB_err.size(), &(track_rate_TOB_err[0])); + track_rate_TIB_VecD.Use(track_rate_TIB.size(), &(track_rate_TIB[0])); + track_rate_TIB_err_VecD.Use(track_rate_TIB_err.size(), &(track_rate_TIB_err[0])); + track_rate_TID_VecD.Use(track_rate_TID.size(), &(track_rate_TID[0])); + track_rate_TID_err_VecD.Use(track_rate_TID_err.size(), &(track_rate_TID_err[0])); + track_rate_TEC_VecD.Use(track_rate_TEC.size(), &(track_rate_TEC[0])); + track_rate_TEC_err_VecD.Use(track_rate_TEC_err.size(), &(track_rate_TEC_err[0])); + track_rate_TECP_VecD.Use(track_rate_TECP.size(), &(track_rate_TECP[0])); + track_rate_TECP_err_VecD.Use(track_rate_TECP_err.size(), &(track_rate_TECP_err[0])); + track_rate_TECM_VecD.Use(track_rate_TECM.size(), &(track_rate_TECM[0])); + track_rate_TECM_err_VecD.Use(track_rate_TECM_err.size(), &(track_rate_TECM_err[0])); + + //+++++++++++++++++++++++++++++ Overall event event rate +++++++++++++++++++++++++++++++++++++ + + TGraphErrors gr_event_rate(runNumber_VecD, event_rate_VecD, runNumber_err_VecD, event_rate_err_VecD); + gr_event_rate.GetXaxis()->SetTitle("Run Number"); + gr_event_rate.GetXaxis()->SetLabelSize(0.04); + gr_event_rate.GetXaxis()->SetNoExponent(); + gr_event_rate.GetXaxis()->SetNdivisions(5); + gr_event_rate.GetYaxis()->SetTitle("Event Rate (Hz)"); + gr_event_rate.GetXaxis()->SetTitleSize(0.05); + gr_event_rate.GetYaxis()->SetLabelSize(0.05); + gr_event_rate.GetYaxis()->SetTitleSize(0.05); + gr_event_rate.SetMarkerStyle(20); + gr_event_rate.SetMarkerSize(1.4); + gr_event_rate.SetMarkerColor(kRed); + gr_event_rate.SetTitle(""); + //gr_event_rate.GetYaxis()->SetRangeUser(0,7); + gr_event_rate.Draw("AP"); + top_right_Title.DrawLatexNDC(0.79, 0.94, "cosmic rays"); + detector.DrawLatexNDC(0.23, 0.83, "Event Rate"); + c.SetGrid(); + c.SaveAs("event_rate.png"); + c.SaveAs("event_rate.pdf"); + c.SaveAs("event_rate.C"); + c.Clear(); + gSystem->Exec("mv event_rate.png Rate_Plots"); + gSystem->Exec("mv event_rate.pdf Rate_Plots"); + gSystem->Exec("mv event_rate.C Rate_Plots"); + + //----------------------------------------------------------------------------------------------- + + //++++++++++++++++++++++++++++++ Overall track rate +++++++++++++++++++++++++++++++++++++++++++ + + TGraphErrors gr_track_rate(runNumber_VecD, track_rate_VecD, runNumber_err_VecD, track_rate_err_VecD); + gr_track_rate.GetXaxis()->SetTitle("Run Number"); + gr_track_rate.GetXaxis()->SetLabelSize(0.04); + gr_track_rate.GetXaxis()->SetNoExponent(); + gr_track_rate.GetXaxis()->SetNdivisions(5); + gr_track_rate.GetYaxis()->SetTitle("Track Rate (Hz)"); + gr_track_rate.GetXaxis()->SetTitleSize(0.05); + gr_track_rate.GetYaxis()->SetLabelSize(0.05); + gr_track_rate.GetYaxis()->SetTitleSize(0.05); + gr_track_rate.SetMarkerStyle(20); + gr_track_rate.SetMarkerSize(1.4); + gr_track_rate.SetMarkerColor(kRed); + gr_track_rate.SetTitle(""); + gr_track_rate.Draw("AP"); + top_right_Title.DrawLatexNDC(0.79, 0.94, "cosmic rays"); + detector.DrawLatexNDC(0.23, 0.83, "Track Rate"); + c.SetGrid(); + c.SaveAs("track_rate.png"); + c.SaveAs("track_rate.pdf"); + c.SaveAs("track_rate.C"); + c.Clear(); + gSystem->Exec("mv track_rate.png Rate_Plots"); + gSystem->Exec("mv track_rate.pdf Rate_Plots"); + gSystem->Exec("mv track_rate.C Rate_Plots"); + + //----------------------------------------------------------------------------------------------- + + //+++++++++++++++++++++++++++++++ Total Pixel track rate +++++++++++++++++++++++++++++++++++++++ + + TGraphErrors gr_track_rate_PIX(runNumber_VecD, track_rate_PIX_VecD, runNumber_err_VecD, track_rate_PIX_err_VecD); + gr_track_rate_PIX.GetXaxis()->SetTitle("Run Number"); + gr_track_rate_PIX.GetXaxis()->SetLabelSize(0.04); + gr_track_rate_PIX.GetXaxis()->SetNoExponent(); + gr_track_rate_PIX.GetXaxis()->SetNdivisions(5); + gr_track_rate_PIX.GetYaxis()->SetTitle("Track Rate (Hz)"); + gr_track_rate_PIX.GetXaxis()->SetTitleSize(0.05); + gr_track_rate_PIX.GetYaxis()->SetLabelSize(0.05); + gr_track_rate_PIX.GetYaxis()->SetTitleSize(0.05); + gr_track_rate_PIX.SetMarkerStyle(20); + gr_track_rate_PIX.SetMarkerSize(1.4); + gr_track_rate_PIX.SetMarkerColor(2); + gr_track_rate_PIX.SetTitle(""); + gr_track_rate_PIX.Draw("AP"); + top_right_Title.DrawLatexNDC(0.79, 0.94, "cosmic rays"); + detector.DrawLatexNDC(0.23, 0.83, "PIXEL"); + c.SetGrid(); + c.SaveAs("pixel_track_rate.png"); + c.SaveAs("pixel_track_rate.pdf"); + c.SaveAs("pixel_track_rate.C"); + c.Clear(); + gSystem->Exec("mv pixel_track_rate.png Rate_Plots"); + gSystem->Exec("mv pixel_track_rate.pdf Rate_Plots"); + gSystem->Exec("mv pixel_track_rate.C Rate_Plots"); + + //----------------------------------------------------------------------------------------------- + + //++++++++++++++++++++++++++++++++ FPIX track rate ++++++++++++++++++++++++++++++++++++++++++++ + + TGraphErrors gr_track_rate_FPIX(runNumber_VecD, track_rate_FPIX_VecD, runNumber_err_VecD, track_rate_FPIX_err_VecD); + gr_track_rate_FPIX.GetXaxis()->SetTitle("Run Number"); + gr_track_rate_FPIX.GetXaxis()->SetLabelSize(0.04); + gr_track_rate_FPIX.GetXaxis()->SetNoExponent(); + gr_track_rate_FPIX.GetXaxis()->SetNdivisions(5); + gr_track_rate_FPIX.GetYaxis()->SetTitle("Track Rate (Hz)"); + gr_track_rate_FPIX.GetXaxis()->SetTitleSize(0.05); + gr_track_rate_FPIX.GetYaxis()->SetLabelSize(0.05); + gr_track_rate_FPIX.GetYaxis()->SetTitleSize(0.05); + gr_track_rate_FPIX.SetMarkerStyle(20); + gr_track_rate_FPIX.SetMarkerSize(1.4); + gr_track_rate_FPIX.SetMarkerColor(kRed); + gr_track_rate_FPIX.SetTitle(""); + gr_track_rate_FPIX.Draw("AP"); + top_right_Title.DrawLatexNDC(0.79, 0.94, "cosmic rays"); + detector.DrawLatexNDC(0.23, 0.83, "FPIX"); + c.SetGrid(); + c.SaveAs("fpix_track_rate.png"); + c.SaveAs("fpix_track_rate.pdf"); + c.SaveAs("fpix_track_rate.C"); + c.Clear(); + gSystem->Exec("mv fpix_track_rate.png Rate_Plots"); + gSystem->Exec("mv fpix_track_rate.pdf Rate_Plots"); + gSystem->Exec("mv fpix_track_rate.C Rate_Plots"); + + //----------------------------------------------------------------------------------------------- + + //++++++++++++++++++++++++++++++++ BPIX track rate ++++++++++++++++++++++++++++++++++++++++++++ + + TGraphErrors gr_track_rate_BPIX(runNumber_VecD, track_rate_BPIX_VecD, runNumber_err_VecD, track_rate_BPIX_err_VecD); + gr_track_rate_BPIX.GetXaxis()->SetTitle("Run Number"); + gr_track_rate_BPIX.GetXaxis()->SetLabelSize(0.04); + gr_track_rate_BPIX.GetXaxis()->SetNoExponent(); + gr_track_rate_BPIX.GetXaxis()->SetNdivisions(5); + gr_track_rate_BPIX.GetYaxis()->SetTitle("Track Rate (Hz)"); + gr_track_rate_BPIX.GetXaxis()->SetTitleSize(0.05); + gr_track_rate_BPIX.GetYaxis()->SetLabelSize(0.05); + gr_track_rate_BPIX.GetYaxis()->SetTitleSize(0.05); + gr_track_rate_BPIX.SetMarkerStyle(20); + gr_track_rate_BPIX.SetMarkerSize(1.4); + gr_track_rate_BPIX.SetMarkerColor(2); + gr_track_rate_BPIX.SetTitle(""); + gr_track_rate_BPIX.Draw("AP"); + top_right_Title.DrawLatexNDC(0.79, 0.94, "cosmic rays"); + detector.DrawLatexNDC(0.23, 0.83, "BPIX"); + c.SetGrid(); + c.SaveAs("bpix_track_rate.png"); + c.SaveAs("bpix_track_rate.pdf"); + c.SaveAs("bpix_track_rate.C"); + c.Clear(); + gSystem->Exec("mv bpix_track_rate.png Rate_Plots"); + gSystem->Exec("mv bpix_track_rate.pdf Rate_Plots"); + gSystem->Exec("mv bpix_track_rate.C Rate_Plots"); + + //----------------------------------------------------------------------------------------------- + + //++++++++++++++++++++++++++++++++ TOB track rate ++++++++++++++++++++++++++++++++++++++++++++ + + TGraphErrors gr_track_rate_TOB(runNumber_VecD, track_rate_TOB_VecD, runNumber_err_VecD, track_rate_TOB_err_VecD); + gr_track_rate_TOB.GetXaxis()->SetTitle("Run Number"); + gr_track_rate_TOB.GetXaxis()->SetLabelSize(0.04); + gr_track_rate_TOB.GetXaxis()->SetNoExponent(); + gr_track_rate_TOB.GetXaxis()->SetNdivisions(5); + gr_track_rate_TOB.GetYaxis()->SetTitle("Track Rate (Hz)"); + gr_track_rate_TOB.GetXaxis()->SetTitleSize(0.05); + gr_track_rate_TOB.GetYaxis()->SetLabelSize(0.05); + gr_track_rate_TOB.GetYaxis()->SetTitleSize(0.05); + gr_track_rate_TOB.SetMarkerStyle(20); + gr_track_rate_TOB.SetMarkerSize(1.4); + gr_track_rate_TOB.SetMarkerColor(2); + gr_track_rate_TOB.SetTitle(""); + gr_track_rate_TOB.Draw("AP"); + top_right_Title.DrawLatexNDC(0.79, 0.94, "cosmic rays"); + detector.DrawLatexNDC(0.23, 0.83, "TOB"); + c.SetGrid(); + c.SaveAs("tob_track_rate.png"); + c.SaveAs("tob_track_rate.pdf"); + c.SaveAs("tob_track_rate.C"); + c.Clear(); + gSystem->Exec("mv tob_track_rate.png Rate_Plots"); + gSystem->Exec("mv tob_track_rate.C Rate_Plots"); + gSystem->Exec("mv tob_track_rate.pdf Rate_Plots"); + + //----------------------------------------------------------------------------------------------- + + //++++++++++++++++++++++++++++++++ TIB track rate ++++++++++++++++++++++++++++++++++++++++++++ + + TGraphErrors gr_track_rate_TIB(runNumber_VecD, track_rate_TIB_VecD, runNumber_err_VecD, track_rate_TIB_err_VecD); + gr_track_rate_TIB.GetXaxis()->SetTitle("Run Number"); + gr_track_rate_TIB.GetXaxis()->SetLabelSize(0.04); + gr_track_rate_TIB.GetXaxis()->SetNoExponent(); + gr_track_rate_TIB.GetXaxis()->SetNdivisions(5); + gr_track_rate_TIB.GetYaxis()->SetTitle("Track Rate (Hz)"); + gr_track_rate_TIB.GetXaxis()->SetTitleSize(0.05); + gr_track_rate_TIB.GetYaxis()->SetLabelSize(0.05); + gr_track_rate_TIB.GetYaxis()->SetTitleSize(0.05); + gr_track_rate_TIB.SetMarkerStyle(20); + gr_track_rate_TIB.SetMarkerSize(1.4); + gr_track_rate_TIB.SetMarkerColor(2); + gr_track_rate_TIB.SetTitle(""); + gr_track_rate_TIB.Draw("AP"); + top_right_Title.DrawLatexNDC(0.79, 0.94, "cosmic rays"); + detector.DrawLatexNDC(0.23, 0.83, "TIB"); + c.SetGrid(); + c.SaveAs("tib_track_rate.png"); + c.SaveAs("tib_track_rate.pdf"); + c.SaveAs("tib_track_rate.C"); + c.Clear(); + gSystem->Exec("mv tib_track_rate.png Rate_Plots"); + gSystem->Exec("mv tib_track_rate.pdf Rate_Plots"); + gSystem->Exec("mv tib_track_rate.C Rate_Plots"); + + //----------------------------------------------------------------------------------------------- + + //++++++++++++++++++++++++++++++++ TID track rate ++++++++++++++++++++++++++++++++++++++++++++ + + TGraphErrors gr_track_rate_TID(runNumber_VecD, track_rate_TID_VecD, runNumber_err_VecD, track_rate_TID_err_VecD); + gr_track_rate_TID.GetXaxis()->SetTitle("Run Number"); + gr_track_rate_TID.GetXaxis()->SetLabelSize(0.04); + gr_track_rate_TID.GetXaxis()->SetNoExponent(); + gr_track_rate_TID.GetXaxis()->SetNdivisions(5); + gr_track_rate_TID.GetYaxis()->SetTitle("Track Rate (Hz)"); + gr_track_rate_TID.GetXaxis()->SetTitleSize(0.05); + gr_track_rate_TID.GetYaxis()->SetLabelSize(0.05); + gr_track_rate_TID.GetYaxis()->SetTitleSize(0.05); + gr_track_rate_TID.SetMarkerStyle(20); + gr_track_rate_TID.SetMarkerSize(1.4); + gr_track_rate_TID.SetMarkerColor(2); + gr_track_rate_TID.SetTitle(""); + gr_track_rate_TID.Draw("AP"); + top_right_Title.DrawLatexNDC(0.79, 0.94, "cosmic rays"); + detector.DrawLatexNDC(0.23, 0.83, "TID"); + c.SetGrid(); + c.SaveAs("tid_track_rate.png"); + c.SaveAs("tid_track_rate.pdf"); + c.SaveAs("tid_track_rate.C"); + c.Clear(); + gSystem->Exec("mv tid_track_rate.png Rate_Plots"); + gSystem->Exec("mv tid_track_rate.pdf Rate_Plots"); + gSystem->Exec("mv tid_track_rate.C Rate_Plots"); + + //----------------------------------------------------------------------------------------------- + + //++++++++++++++++++++++++++++++++ Total TEC track rate ++++++++++++++++++++++++++++++++++++++++++++ + + TGraphErrors gr_track_rate_TEC(runNumber_VecD, track_rate_TEC_VecD, runNumber_err_VecD, track_rate_TEC_err_VecD); + gr_track_rate_TEC.GetXaxis()->SetTitle("Run Number"); + gr_track_rate_TEC.GetXaxis()->SetLabelSize(0.04); + gr_track_rate_TEC.GetXaxis()->SetNoExponent(); + gr_track_rate_TEC.GetXaxis()->SetNdivisions(5); + gr_track_rate_TEC.GetYaxis()->SetTitle("Track Rate (Hz)"); + gr_track_rate_TEC.GetXaxis()->SetTitleSize(0.05); + gr_track_rate_TEC.GetYaxis()->SetLabelSize(0.05); + gr_track_rate_TEC.GetYaxis()->SetTitleSize(0.05); + gr_track_rate_TEC.SetMarkerStyle(20); + gr_track_rate_TEC.SetMarkerSize(1.4); + gr_track_rate_TEC.SetMarkerColor(kRed); + gr_track_rate_TEC.SetTitle(""); + gr_track_rate_TEC.Draw("AP"); + top_right_Title.DrawLatexNDC(0.79, 0.94, "cosmic rays"); + detector.DrawLatexNDC(0.23, 0.83, "TEC"); + c.SetGrid(); + c.SaveAs("tec_track_rate.png"); + c.SaveAs("tec_track_rate.pdf"); + c.SaveAs("tec_track_rate.C"); + c.Clear(); + gSystem->Exec("mv tec_track_rate.png Rate_Plots"); + gSystem->Exec("mv tec_track_rate.pdf Rate_Plots"); + gSystem->Exec("mv tec_track_rate.C Rate_Plots"); + + //----------------------------------------------------------------------------------------------- + + //++++++++++++++++++++++++++++++++ TEC+/- track rate ++++++++++++++++++++++++++++++++++++++++++++ + TMultiGraph mg("track rate", "Track Rate TEC+/-"); // Multigraph decleration + + TGraphErrors *gr_track_rate_TECP = + new TGraphErrors(runNumber_VecD, track_rate_TECP_VecD, runNumber_err_VecD, track_rate_TECP_err_VecD); + gr_track_rate_TECP->SetMarkerStyle(20); + gr_track_rate_TECP->SetMarkerSize(1.4); + gr_track_rate_TECP->SetMarkerColor(kBlack); + + TGraphErrors *gr_track_rate_TECM = + new TGraphErrors(runNumber_VecD, track_rate_TECM_VecD, runNumber_err_VecD, track_rate_TECM_err_VecD); + gr_track_rate_TECM->SetMarkerStyle(20); + gr_track_rate_TECM->SetMarkerSize(1.4); + gr_track_rate_TECM->SetMarkerColor(kGreen); + + mg.Add(gr_track_rate_TECP); + mg.Add(gr_track_rate_TECM); + mg.Draw("AP"); + mg.GetXaxis()->SetTitle("Run Number"); + mg.GetXaxis()->SetNoExponent(); + mg.GetXaxis()->SetNdivisions(5); + mg.GetXaxis()->SetLabelSize(0.04); + mg.GetXaxis()->SetTitleSize(0.05); + mg.GetYaxis()->SetLabelSize(0.05); + mg.GetYaxis()->SetTitleSize(0.05); + mg.GetYaxis()->SetTitle("Track Rate (Hz)"); + + TLegend leg(0.76, 0.76, 0.92, 0.90); // Legend for TEC+/- + leg.AddEntry(gr_track_rate_TECP, "TEC+", "p"); + leg.AddEntry(gr_track_rate_TECM, "TEC-", "p"); + leg.SetBorderSize(1); + leg.SetShadowColor(0); + leg.SetFillColor(0); + leg.Draw(); + c.SetGrid(); + c.SaveAs("tec_track_ratePM.png"); + c.Clear(); + gSystem->Exec("mv tec_track_ratePM.png Rate_Plots"); + + //----------------------------------------------------------------------------------------------- + + c.Close(); + + //----------------------------------------------------------------------------------------------- + // Weighted Mean calculation + //----------------------------------------------------------------------------------------------- + + double total_weight = 0; + double weighted_mean_track_rate; + double weighted_mean_track_rate_TEC; + double weighted_mean_track_rate_TOB; + double weighted_mean_track_rate_TIB; + double weighted_mean_track_rate_TID; + double weighted_mean_track_rate_FPIX; + double weighted_mean_track_rate_BPIX; + double weighted_mean_event_rate; + + for (int k = 0; k < j; k++) // Loop over all runs used(j) to allot weight to each run number + { + weight.push_back(tracks.at(k) / total_tracks); + } + + for (int a = 0; a < j; a++) // Loop over all runs used(j) to evaluate weighted mean for each subdetector + { + weighted_mean_track_rate += track_rate.at(a) * weight.at(a); + weighted_mean_track_rate_TEC += track_rate_TEC.at(a) * weight.at(a); + weighted_mean_track_rate_TOB += track_rate_TOB.at(a) * weight.at(a); + weighted_mean_track_rate_TIB += track_rate_TIB.at(a) * weight.at(a); + weighted_mean_track_rate_TID += track_rate_TID.at(a) * weight.at(a); + weighted_mean_track_rate_FPIX += track_rate_FPIX.at(a) * weight.at(a); + weighted_mean_track_rate_BPIX += track_rate_BPIX.at(a) * weight.at(a); + weighted_mean_event_rate += event_rate.at(a) * weight.at(a); + total_weight += weight.at(a); + } + + std::cout << " Weighted mean Event Rate : " << weighted_mean_event_rate << std::endl; + std::cout << " Weighted mean Total Track Rate : " << weighted_mean_track_rate << std::endl; + std::cout << " Weighted mean Track Rate BPIX: " << weighted_mean_track_rate_BPIX << std::endl; + std::cout << " Weighted mean Track Rate FPIX : " << weighted_mean_track_rate_FPIX << std::endl; + std::cout << " Weighted mean Track Rate TIB: " << weighted_mean_track_rate_TIB << std::endl; + std::cout << " Weighted mean Track Rate TOB: " << weighted_mean_track_rate_TOB << std::endl; + std::cout << " Weighted mean Track Rate TID: " << weighted_mean_track_rate_TID << std::endl; + std::cout << " Weighted mean Track Rate TEC: " << weighted_mean_track_rate_TEC << std::endl; + + //----------------------------------------------------------------------------------------------- + // Summary Plot for track rate in each Subdetector + //----------------------------------------------------------------------------------------------- + + TCanvas *canvas = new TCanvas("canvas", "canvas", 324, 57, 953, 866); + canvas->SetFillColor(0); + canvas->SetBorderMode(0); + canvas->SetBorderSize(2); + canvas->SetGridx(); + canvas->SetGridy(); + canvas->SetTickx(1); + canvas->SetTicky(1); + canvas->SetLeftMargin(0.1608833); + canvas->SetRightMargin(0.05152471); + canvas->SetFrameLineWidth(3); + canvas->SetFrameBorderMode(0); + canvas->SetFrameLineWidth(3); + canvas->SetFrameBorderMode(0); + + TH1F h1b("h1b", "Track Rate Summary", 8, 0, 8); + h1b.SetFillColor(kRed); + h1b.SetBarWidth(0.6); + h1b.SetBarOffset(0.25); + h1b.SetStats(0); + h1b.GetXaxis()->SetLabelFont(42); + h1b.GetXaxis()->SetLabelOffset(0.012); + h1b.GetXaxis()->SetLabelSize(0.06); + h1b.GetXaxis()->SetTitleSize(0.05); + h1b.GetXaxis()->SetTitleFont(42); + h1b.GetYaxis()->SetTitle("Average Track Rate (Hz)"); + h1b.GetYaxis()->SetLabelFont(42); + h1b.GetYaxis()->SetLabelSize(0.05); + h1b.GetYaxis()->SetTitleSize(0.05); + h1b.GetYaxis()->SetTitleOffset(0); + + Bar_Ytitle[0] = weighted_mean_event_rate; + Bar_Ytitle[1] = weighted_mean_track_rate; + Bar_Ytitle[2] = weighted_mean_track_rate_FPIX; + Bar_Ytitle[3] = weighted_mean_track_rate_BPIX; + Bar_Ytitle[4] = weighted_mean_track_rate_TIB; + Bar_Ytitle[5] = weighted_mean_track_rate_TID; + Bar_Ytitle[6] = weighted_mean_track_rate_TOB; + Bar_Ytitle[7] = weighted_mean_track_rate_TEC; + + for (int i = 1; i <= 8; i++) { + h1b.SetBinContent(i, Bar_Ytitle[i - 1]); + h1b.GetXaxis()->SetBinLabel(i, Bar_Xtitle[i - 1].c_str()); + } + + gStyle->SetPaintTextFormat("1.3f"); + h1b.LabelsOption("d"); + h1b.Draw("bTEXT"); + // --------- Saving Summary Chart in pdf,png & C formats ------- // + TString summary_chart_title = "SummaryChart"; + TString Format[3] = {"png", "pdf", "C"}; + for (int i = 0; i < 3; i++) { + TString filename = summary_chart_title + "." + Format[i]; + canvas->SaveAs(filename.Data()); + TString mv_cmd = "mv " + filename + " Rate_Plots"; + gSystem->Exec(mv_cmd.Data()); } - - - - - - + canvas->Clear(); + canvas->Close(); +} diff --git a/Alignment/TrackerAlignment/macros/CosmicRateTool_Kinematics.C b/Alignment/TrackerAlignment/macros/CosmicRateTool_Kinematics.C index caa9f3c566bb2..893a36e138740 100644 --- a/Alignment/TrackerAlignment/macros/CosmicRateTool_Kinematics.C +++ b/Alignment/TrackerAlignment/macros/CosmicRateTool_Kinematics.C @@ -5,237 +5,190 @@ #include #include -void CosmicRateTool_Kinematics(const char* fileName) -{ - - TString InputFile= Form("%s",fileName); - TFile *file = new TFile(InputFile); - - bool IsFileExist; - IsFileExist = file->IsZombie(); - if(IsFileExist) - { - cout<Get("cosmicRateAnalyzer/Event"); - - vector *pt; - vector *charge; - vector *chi2; - vector *chi2_ndof; - vector *eta; - vector *theta; - vector *phi; - vector *p; - vector *d0; - vector *dz; - vector *nvh; - vector *v_ntrk; - - pt = 0; - charge = 0; - chi2 = 0; - chi2_ndof = 0; - eta = 0; - theta = 0; - phi = 0; - p = 0; - d0 = 0; - dz = 0; - nvh = 0; - - tree->SetBranchAddress("pt", &pt); - tree->SetBranchAddress("charge", &charge); - tree->SetBranchAddress("chi2", &chi2); - tree->SetBranchAddress("chi2_ndof", &chi2_ndof); - tree->SetBranchAddress("eta", &eta); - tree->SetBranchAddress("theta", &theta); - tree->SetBranchAddress("phi", &phi); - tree->SetBranchAddress("p", &p); - tree->SetBranchAddress("d0", &d0); - tree->SetBranchAddress("dz", &dz); - tree->SetBranchAddress("nvh", &nvh); -// tree->SetBranchAddress("v_ntrk", &v_ntrk); - - Long64_t n = tree->GetEntriesFast(); - -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -// Various Kinematical Histograms Declerations -//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - - TH1D h_pt ("h_pt","h_pt",200,0,200); - TH1D h_charge ("h_charge","h_charge",10,-5,5); - TH1D h_chi2 ("h_chi2","h_chi2",200,0,100); - TH1D h_chi2_ndof ("h_chi2_ndof","h_chi2_ndof",200,0,20); - TH1D h_eta ("h_eta","h_eta",500,-3,3); - TH1D h_theta ("h_theta","h_theta",500,-3,3); - TH1D h_phi ("h_phi","h_phi",400,-3.5,3.5); - TH1D h_d0 ("h_d0","h_d0",1000,-85,85); - TH1D h_dz ("h_dz","h_dz",1500,-350,350); -// TH1D *h_ntrk = new TH1D("h_ntrk","h_ntrk",20,0,20); - -//---------------------------------------------------------------------------------------------------------------- - - - for (Long64_t jentry=0; jentryGetEntry(jentry); - - for (int k = 0; k < pt->size() ; k++) // Loop to calculate Kinematical distributions - { - h_pt.Fill(pt->at(k)); - h_charge.Fill(charge->at(k)); - h_chi2.Fill(chi2->at(k)); - h_chi2_ndof.Fill(chi2_ndof->at(k)); - h_eta.Fill(eta->at(k)); - h_theta.Fill(theta->at(k)); - h_phi.Fill(phi->at(k)); - h_d0.Fill(d0->at(k)); - h_dz.Fill(dz->at(k)); - - - } // Loop Closed to calculate Kinematical distributions - } // Loop Closed to calculate rates - - -//++++++++++++++++++++++++++++++++++ Make Directory ++++++++++++++++++++++++++++++++++++++ - - gSystem->Exec("mkdir -p Kinematical_Plots"); - -//--------------------------------------------------------------------------------------------------- - - TCanvas c("c","c",800,600); // Declare canvas - -//+++++++++++++++++++++++++++++++ pT Distribution ++++++++++++++++++++++++++++++++++++++++ - h_pt.SetLineColor(kBlue); - h_pt.SetLineWidth(2); - h_pt.SetTitle("pT distribution"); - h_pt.SetXTitle("pT (in GeV)"); - h_pt.Draw(); - h_pt.SetStats(); - c.SetGrid(); - c.SaveAs("pt.png"); - c.Clear(); - gSystem->Exec("mv pt.png Kinematical_Plots"); -//--------------------------------------------------------------------------------------------------- - - -//+++++++++++++++++++++++++++++++ charge Distribution ++++++++++++++++++++++++++++++++++++++++ - - h_charge.SetLineColor(kBlue); - h_charge.SetLineWidth(2); - h_charge.SetTitle("charge"); - h_charge.SetXTitle(""); - h_charge.Draw(); - c.SetGrid(); - c.SaveAs("charge.png"); - c.Clear(); - gSystem->Exec("mv charge.png Kinematical_Plots"); -//--------------------------------------------------------------------------------------------------- - - -//+++++++++++++++++++++++++++++++ chi2 Distribution ++++++++++++++++++++++++++++++++++++++++ - - h_chi2.SetLineColor(kBlue); - h_chi2.SetLineWidth(2); - h_chi2.SetTitle("chi2 distribution"); - h_chi2.SetXTitle(""); - h_chi2.Draw(); - c.SetGrid(); - c.SaveAs("chi2.png"); - c.Clear(); - gSystem->Exec("mv chi2.png Kinematical_Plots"); -//--------------------------------------------------------------------------------------------------- - - -//+++++++++++++++++++++++++++++++ chi2/ndof Distribution ++++++++++++++++++++++++++++++++++++++++ - - h_chi2_ndof.SetLineColor(kBlue); - h_chi2_ndof.SetLineWidth(2); - h_chi2_ndof.SetTitle("chi2 per ndof"); - h_chi2_ndof.SetXTitle(""); - h_chi2_ndof.Draw(); - c.SetGrid(); - c.SaveAs("chi2_ndof.png"); c.Clear(); - c.Clear(); - gSystem->Exec("mv chi2_ndof.png Kinematical_Plots"); -//--------------------------------------------------------------------------------------------------- - - -//+++++++++++++++++++++++++++++++ eta Distribution ++++++++++++++++++++++++++++++++++++++++ - - h_eta.SetLineColor(kBlue); - h_eta.SetLineWidth(2); - h_eta.SetTitle("eta Distribution"); - h_eta.SetXTitle("#eta"); - h_eta.Draw(); - c.SetGrid(); - c.SaveAs("eta.png"); - c.Clear(); - gSystem->Exec("mv eta.png Kinematical_Plots"); -//--------------------------------------------------------------------------------------------------- - - -//+++++++++++++++++++++++++++++++ theta Distribution ++++++++++++++++++++++++++++++++++++++++ - - h_theta.SetLineColor(kBlue); - h_theta.SetLineWidth(2); - h_theta.SetTitle("theta distribution"); - h_theta.SetXTitle("#theta"); - h_theta.Draw(); - c.SetGrid(); - c.SaveAs("theta.png"); - c.Clear(); - gSystem->Exec("mv theta.png Kinematical_Plots"); -//--------------------------------------------------------------------------------------------------- - - -//+++++++++++++++++++++++++++++++ phi Distribution ++++++++++++++++++++++++++++++++++++++++ - - h_phi.SetLineColor(kBlue); - h_phi.SetLineWidth(2); - h_phi.SetTitle("phi distribution"); - h_phi.SetXTitle("#phi"); - h_phi.Draw(); - c.SetGrid(); - c.SaveAs("phi.png"); - c.Clear(); - gSystem->Exec("mv phi.png Kinematical_Plots"); -//--------------------------------------------------------------------------------------------------- - - -//+++++++++++++++++++++++++++++++ d0 Distribution ++++++++++++++++++++++++++++++++++++++++ - - h_d0.SetLineColor(kBlue); - h_d0.SetLineWidth(2); - h_d0.SetTitle("d0 distribution"); - h_d0.SetXTitle("d0"); - h_d0.Draw(); - c.SetGrid(); - c.SaveAs("d0.png"); - c.Clear(); - gSystem->Exec("mv d0.png Kinematical_Plots"); -//--------------------------------------------------------------------------------------------------- - - -//+++++++++++++++++++++++++++++++ dz Distribution ++++++++++++++++++++++++++++++++++++++++ - - h_dz.SetLineColor(kBlue); - h_dz.SetLineWidth(2); - h_dz.SetTitle("dz distribution"); - h_dz.SetXTitle("dz"); - h_dz.Draw(); - c.SetGrid(); - c.SaveAs("dz.png"); - c.Close(); - gSystem->Exec("mv dz.png Kinematical_Plots"); -//--------------------------------------------------------------------------------------------------- - +void Get_Plot(TH1D, TString); + +void CosmicRateTool_Kinematics(const char *fileName) { + TString InputFile = Form("%s", fileName); + TFile *file = new TFile(InputFile); + + bool IsFileExist; + IsFileExist = file->IsZombie(); + if (IsFileExist) { + cout << endl + << "=====================================================================================================" + << endl; + cout << fileName << " is not found. Check the file!" << endl; + cout << "=====================================================================================================" + << endl + << endl; + exit(EXIT_FAILURE); + } + + TTree *tree = (TTree *)file->Get("cosmicRateAnalyzer/Event"); + + vector *pt; + vector *charge; + vector *chi2; + vector *chi2_ndof; + vector *eta; + vector *theta; + vector *phi; + vector *p; + vector *d0; + vector *dz; + + pt = 0; + charge = 0; + chi2 = 0; + chi2_ndof = 0; + eta = 0; + theta = 0; + phi = 0; + p = 0; + d0 = 0; + dz = 0; + + tree->SetBranchAddress("pt", &pt); + tree->SetBranchAddress("charge", &charge); + tree->SetBranchAddress("chi2", &chi2); + tree->SetBranchAddress("chi2_ndof", &chi2_ndof); + tree->SetBranchAddress("eta", &eta); + tree->SetBranchAddress("theta", &theta); + tree->SetBranchAddress("phi", &phi); + tree->SetBranchAddress("p", &p); + tree->SetBranchAddress("d0", &d0); + tree->SetBranchAddress("dz", &dz); + + //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + // Various Kinematical Histograms Declerations + //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + + TH1D h_pt("h_pt", "h_pt", 100, 0, 100); + TH1D h_charge("h_charge", "h_charge", 10, -5, 5); + TH1D h_chi2("h_chi2", "h_chi2", 200, 0, 100); + TH1D h_chi2_ndof("h_chi2_ndof", "h_chi2_ndof", 100, 0, 10); + TH1D h_eta("h_eta", "h_eta", 500, -3, 3); + TH1D h_theta("h_theta", "h_theta", 500, -3, 3); + TH1D h_phi("h_phi", "h_phi", 400, -3.5, 3.5); + TH1D h_d0("h_d0", "h_d0", 1000, -85, 85); + TH1D h_dz("h_dz", "h_dz", 1500, -350, 350); + + //---------------------------------------------------------------------------------------------------------------- + + int nTotalEvents = 0, nTotalTracks = 0; + Long64_t n = tree->GetEntriesFast(); + for (Long64_t jentry = 0; jentry < n; jentry++) // Loop over events + { + tree->GetEntry(jentry); + + for (int k = 0; k < pt->size(); k++) // Loop over tracks + { + h_pt.Fill(pt->at(k)); + h_charge.Fill(charge->at(k)); + h_chi2.Fill(chi2->at(k)); + h_chi2_ndof.Fill(chi2_ndof->at(k)); + h_eta.Fill(eta->at(k)); + h_theta.Fill(theta->at(k)); + h_phi.Fill(phi->at(k)); + h_d0.Fill(d0->at(k)); + h_dz.Fill(dz->at(k)); + + nTotalTracks++; + } // Tracks Loop + + nTotalEvents++; + } // Event Loop + + std::cout << "Total Events: " << nTotalEvents << std::endl; + std::cout << "Total Tracks: " << nTotalTracks << std::endl; + + //++++++++++++++++++++++++++++++++++ Make Directory ++++++++++++++++++++++++++++++++++++++ + gSystem->Exec("mkdir -p Kinematical_Plots"); + + //++++++++++++++++++++++++++++++++++ Plotting ++++++++++++++++++++++++++++++++++++++ + Get_Plot(h_pt, "pt"); + Get_Plot(h_eta, "eta"); + Get_Plot(h_phi, "phi"); + Get_Plot(h_theta, "theta"); + Get_Plot(h_d0, "d0"); + Get_Plot(h_dz, "dz"); + Get_Plot(h_chi2, "chi2"); + Get_Plot(h_chi2_ndof, "chi2_ndof"); + Get_Plot(h_charge, "charge"); } - +void Get_Plot(TH1D h1, TString variable) { + TCanvas c("c", "c", 556, 214, 661, 641); + gStyle->SetOptStat(0); // Dont show statistics + gStyle->SetOptTitle(0); // Dont show Title + c.Range(-7.156863, -810349, 5.764706, 4951034); + c.SetFillColor(0); + c.SetBorderMode(0); + c.SetBorderSize(3); + c.SetGridx(); + c.SetGridy(); + c.SetTickx(1); + c.SetTicky(1); + c.SetLeftMargin(0.1669196); + c.SetRightMargin(0.05918058); + c.SetTopMargin(0.08233276); + c.SetBottomMargin(0.1406518); + c.SetFrameLineWidth(3); + c.SetFrameBorderMode(0); + c.SetFrameLineWidth(3); + c.SetFrameBorderMode(0); + + TGaxis::SetMaxDigits(3); + + h1.SetLineColor(kRed); + h1.SetLineWidth(3); + + //---- X-axis Titles -----// + TString TempEta = "eta", TempChi2 = "chi2"; + if (variable.Contains("pt")) { + h1.SetXTitle("Track p_{T} (GeV)"); + } else if (variable.Contains("charge")) { + h1.SetXTitle("Track charge (e)"); + } else if (variable.Data() == TempEta) { + h1.SetXTitle("Track #eta"); + } else if (variable.Contains("phi")) { + h1.SetXTitle("Track #phi (rad)"); + } else if (variable.Contains("theta")) { + h1.SetXTitle("Track #theta (rad)"); + } else if (variable.Contains("d0")) { + h1.SetXTitle("Track d_{0} (cm)"); + } else if (variable.Contains("dz")) { + h1.SetXTitle("Track d_{z} (cm)"); + } else if (variable.Data() == TempChi2) { + h1.SetXTitle("Track #chi^{2}"); + } else if (variable.Contains("ndof")) { + h1.SetXTitle("Track #chi^{2} per NDF"); + } else { + std::cout << "Title does not match anything in the categories defined!" << std::endl; + } + + h1.SetYTitle("Tracks (#)"); + h1.SetLabelSize(0.05); + h1.GetXaxis()->SetLabelSize(0.05); + h1.GetXaxis()->SetTitleSize(0.05); + h1.GetYaxis()->SetLabelSize(0.05); + h1.GetYaxis()->SetTitleSize(0.06); + h1.GetXaxis()->SetTitleOffset(1.12); + h1.Draw(); + + // Text on upper right corner of plot // + TLatex Title = TLatex(); + Title.SetTextFont(42); + Title.SetTextSize(0.039); + Title.DrawLatexNDC(0.76, 0.94, "cosmic rays"); //Bv1 + + //============== Saving as PDF, png and C ============= // + TString PlotFormat[] = {"png", "pdf", "C"}; + for (int k = 0; k < 3; k++) { + TString Format = variable + "." + PlotFormat[k]; + c.SaveAs(Format.Data()); + TString mv_folder_string = "mv " + Format + " Kinematical_Plots"; + gSystem->Exec(mv_folder_string.Data()); + } + c.Close(); +} diff --git a/Alignment/TrackerAlignment/macros/CosmicRateTool_PIXEL_HitRates.C b/Alignment/TrackerAlignment/macros/CosmicRateTool_PIXEL_HitRates.C new file mode 100644 index 0000000000000..f974c06ac9285 --- /dev/null +++ b/Alignment/TrackerAlignment/macros/CosmicRateTool_PIXEL_HitRates.C @@ -0,0 +1,1108 @@ +void CosmicRateTool_PIXEL_HitRates(const char *fileName, unsigned int runLow = 0, unsigned int runUp = 0) { + TString InputFile = Form("%s", fileName); + TFile *file = new TFile(InputFile); + + bool IsFileExist; + IsFileExist = file->IsZombie(); + if (IsFileExist) { + cout << endl + << "=====================================================================================================" + << endl; + cout << fileName << " not found. Check the file!" << endl; + cout << "=====================================================================================================" + << endl + << endl; + exit(EXIT_FAILURE); + } + + TTree *tree = (TTree *)file->Get("cosmicRateAnalyzer/Run"); + + double run_time; + unsigned int runnum; + int number_of_events; + int number_of_tracks; + int number_of_hits_Total; + int number_of_hits_PIX; + int number_of_hits_BPIX; + int number_of_hits_BPIX_layer1; + int number_of_hits_BPIX_layer2; + int number_of_hits_BPIX_layer3; + int number_of_hits_BPIX_layer4; + int number_of_hits_FPIX; + int number_of_hits_FPIX_disk1; + int number_of_hits_FPIX_disk2; + int number_of_hits_FPIX_disk3; + int number_of_hits_FPIX_disk1_plus; + int number_of_hits_FPIX_disk1_minus; + int number_of_hits_FPIX_disk2_plus; + int number_of_hits_FPIX_disk2_minus; + int number_of_hits_FPIX_disk3_plus; + int number_of_hits_FPIX_disk3_minus; + + tree->SetBranchAddress("run_time", &run_time); + tree->SetBranchAddress("runnum", &runnum); + tree->SetBranchAddress("number_of_events", &number_of_events); + tree->SetBranchAddress("number_of_tracks", &number_of_tracks); + tree->SetBranchAddress("number_of_hits_Total", &number_of_hits_Total); + tree->SetBranchAddress("number_of_hits_PIX", &number_of_hits_PIX); + tree->SetBranchAddress("number_of_hits_BPIX", &number_of_hits_BPIX); + tree->SetBranchAddress("number_of_hits_BPIX_layer1", &number_of_hits_BPIX_layer1); + tree->SetBranchAddress("number_of_hits_BPIX_layer2", &number_of_hits_BPIX_layer2); + tree->SetBranchAddress("number_of_hits_BPIX_layer3", &number_of_hits_BPIX_layer3); + tree->SetBranchAddress("number_of_hits_BPIX_layer4", &number_of_hits_BPIX_layer4); + tree->SetBranchAddress("number_of_hits_FPIX", &number_of_hits_FPIX); + tree->SetBranchAddress("number_of_hits_FPIX_disk1", &number_of_hits_FPIX_disk1); + tree->SetBranchAddress("number_of_hits_FPIX_disk2", &number_of_hits_FPIX_disk2); + tree->SetBranchAddress("number_of_hits_FPIX_disk3", &number_of_hits_FPIX_disk3); + tree->SetBranchAddress("number_of_hits_FPIX_disk1_plus", &number_of_hits_FPIX_disk1_plus); + tree->SetBranchAddress("number_of_hits_FPIX_disk1_minus", &number_of_hits_FPIX_disk1_minus); + tree->SetBranchAddress("number_of_hits_FPIX_disk2_plus", &number_of_hits_FPIX_disk2_plus); + tree->SetBranchAddress("number_of_hits_FPIX_disk2_minus", &number_of_hits_FPIX_disk2_minus); + tree->SetBranchAddress("number_of_hits_FPIX_disk3_plus", &number_of_hits_FPIX_disk3_plus); + tree->SetBranchAddress("number_of_hits_FPIX_disk3_minus", &number_of_hits_FPIX_disk3_minus); + + //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + // Various Rates Declerations + //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + + vector events; + vector event_rate; + vector event_rate_err; + vector track_rate; + vector track_rate_err; + vector runNumber; + vector runNumber_err; + vector tracks; + vector tracks_err; + vector weight; + + vector hits; + vector hit_rate_Total; + vector hit_rate_Total_err; + vector hit_rate_PIX; + vector hit_rate_PIX_err; + vector hit_rate_BPIX; + vector hit_rate_BPIX_err; + vector hit_rate_BPIX_layer1; + vector hit_rate_BPIX_layer1_err; + vector hit_rate_BPIX_layer2; + vector hit_rate_BPIX_layer2_err; + vector hit_rate_BPIX_layer3; + vector hit_rate_BPIX_layer3_err; + vector hit_rate_BPIX_layer4; + vector hit_rate_BPIX_layer4_err; + vector hit_rate_FPIX; + vector hit_rate_FPIX_err; + vector hit_rate_FPIX_disk1; + vector hit_rate_FPIX_disk1_err; + vector hit_rate_FPIX_disk2; + vector hit_rate_FPIX_disk2_err; + vector hit_rate_FPIX_disk3; + vector hit_rate_FPIX_disk3_err; + vector hit_rate_FPIX_disk1_plus; + vector hit_rate_FPIX_disk1_plus_err; + vector hit_rate_FPIX_disk1_minus; + vector hit_rate_FPIX_disk1_minus_err; + vector hit_rate_FPIX_disk2_plus; + vector hit_rate_FPIX_disk2_plus_err; + vector hit_rate_FPIX_disk2_minus; + vector hit_rate_FPIX_disk2_minus_err; + vector hit_rate_FPIX_disk3_plus; + vector hit_rate_FPIX_disk3_plus_err; + vector hit_rate_FPIX_disk3_minus; + vector hit_rate_FPIX_disk3_minus_err; + + string Bar_Xtitle_BPIX[6] = {"PIXEL", "BPIX", "BPIX_1", "BPIX_2", "BPIX_3", "BPIX_4"}; + string Bar_Xtitle_FPIX[11] = { + "PIXEL", "FPIX", "FPIX_1", "FPIX_1+", "FPIX_1-", "FPIX_2", "FPIX_2+", "FPIX_2-", "FPIX_3", "FPIX_3+", "FPIX_3-"}; + string Bar_Xtitle_PIXEL[10] = { + "PIXEL", "BPIX", "BPIX_1", "BPIX_2", "BPIX_3", "BPIX_4", "FPIX", "FPIX_1", "FPIX_2", "FPIX_3"}; + double Bar_Ytitle_BPIX[6] = {0}; + double Bar_Ytitle_FPIX[11] = {0}; + double Bar_Ytitle_PIXEL[10] = {0}; + + int j = 0; + double total_tracks = 0, nTotalEvents = 0, nTotalTracks = 0, nTotalHits = 0, nZeroRunTimeRuns = 0; + + Long64_t n = tree->GetEntriesFast(); + for (Long64_t jentry = 0; jentry < n; jentry++) { + tree->GetEntry(jentry); + if (run_time == 0 || run_time < 0) { + nZeroRunTimeRuns++; + continue; + } + + if (runLow != 0 && runUp != 0) { + if (runnum < runLow) + continue; + if (runnum > runUp) + break; + } + + events.push_back(number_of_events); + event_rate.push_back(number_of_events / run_time); + runNumber.push_back(runnum); + track_rate.push_back(number_of_tracks / run_time); + tracks.push_back(number_of_tracks); + + nTotalEvents += number_of_events; + nTotalTracks += number_of_tracks; + nTotalHits += number_of_hits_Total; + + hits.push_back(number_of_hits_Total); + hit_rate_Total.push_back(number_of_hits_Total / run_time); + hit_rate_Total_err.push_back(sqrt(float(number_of_hits_Total)) / run_time); + hit_rate_PIX.push_back(number_of_hits_PIX / run_time); + hit_rate_PIX_err.push_back(sqrt(float(number_of_hits_PIX)) / run_time); + hit_rate_BPIX.push_back(number_of_hits_BPIX / run_time); + hit_rate_BPIX_err.push_back(sqrt(float(number_of_hits_BPIX)) / run_time); + hit_rate_BPIX_layer1.push_back(number_of_hits_BPIX_layer1 / run_time); + hit_rate_BPIX_layer1_err.push_back(sqrt(float(number_of_hits_BPIX_layer1)) / run_time); + hit_rate_BPIX_layer2.push_back(number_of_hits_BPIX_layer2 / run_time); + hit_rate_BPIX_layer2_err.push_back(sqrt(float(number_of_hits_BPIX_layer2)) / run_time); + hit_rate_BPIX_layer3.push_back(number_of_hits_BPIX_layer3 / run_time); + hit_rate_BPIX_layer3_err.push_back(sqrt(float(number_of_hits_BPIX_layer3)) / run_time); + hit_rate_BPIX_layer4.push_back(number_of_hits_BPIX_layer4 / run_time); + hit_rate_BPIX_layer4_err.push_back(sqrt(float(number_of_hits_BPIX_layer4)) / run_time); + hit_rate_FPIX.push_back(number_of_hits_FPIX / run_time); + hit_rate_FPIX_err.push_back(sqrt(float(number_of_hits_FPIX)) / run_time); + hit_rate_FPIX_disk1.push_back(number_of_hits_FPIX_disk1 / run_time); + hit_rate_FPIX_disk1_err.push_back(sqrt(float(number_of_hits_FPIX_disk1)) / run_time); + hit_rate_FPIX_disk2.push_back(number_of_hits_FPIX_disk2 / run_time); + hit_rate_FPIX_disk2_err.push_back(sqrt(float(number_of_hits_FPIX_disk2)) / run_time); + hit_rate_FPIX_disk3.push_back(number_of_hits_FPIX_disk3 / run_time); + hit_rate_FPIX_disk3_err.push_back(sqrt(float(number_of_hits_FPIX_disk3)) / run_time); + hit_rate_FPIX_disk1_plus.push_back(number_of_hits_FPIX_disk1_plus / run_time); + hit_rate_FPIX_disk1_plus_err.push_back(sqrt(float(number_of_hits_FPIX_disk1_plus)) / run_time); + hit_rate_FPIX_disk1_minus.push_back(number_of_hits_FPIX_disk1_minus / run_time); + hit_rate_FPIX_disk1_minus_err.push_back(sqrt(float(number_of_hits_FPIX_disk1_minus)) / run_time); + hit_rate_FPIX_disk2_plus.push_back(number_of_hits_FPIX_disk2_plus / run_time); + hit_rate_FPIX_disk2_plus_err.push_back(sqrt(float(number_of_hits_FPIX_disk2_plus)) / run_time); + hit_rate_FPIX_disk2_minus.push_back(number_of_hits_FPIX_disk2_minus / run_time); + hit_rate_FPIX_disk2_minus_err.push_back(sqrt(float(number_of_hits_FPIX_disk2_minus)) / run_time); + hit_rate_FPIX_disk3_plus.push_back(number_of_hits_FPIX_disk3_plus / run_time); + hit_rate_FPIX_disk3_plus_err.push_back(sqrt(float(number_of_hits_FPIX_disk3_plus)) / run_time); + hit_rate_FPIX_disk3_minus.push_back(number_of_hits_FPIX_disk3_minus / run_time); + hit_rate_FPIX_disk3_minus_err.push_back(sqrt(float(number_of_hits_FPIX_disk3_minus)) / run_time); + + track_rate_err.push_back(sqrt(float(number_of_tracks)) / run_time); + event_rate_err.push_back(sqrt(float(number_of_events)) / run_time); + runNumber_err.push_back(0); + + j++; + } + std::cout << "Total Runs in this files: " << n << endl; + std::cout << "Runs with negative or 0 runtime: " << nZeroRunTimeRuns << endl; + std::cout << "Total Events: " << nTotalEvents << std::endl; + std::cout << "Total Tracks: " << nTotalTracks << std::endl; + std::cout << "Total Hits: " << nTotalHits << std::endl; + std::cout << "Runs without 0 or negative runtime actually used in plotting & evaluation(j value): " << j << std::endl; + + //+++++++++++++++++++++++++++++ Make Directory +++++++++++++++++++++++++++++++++++++ + gSystem->Exec("mkdir -p Hit_Rate_Plots"); + + //----------------------------------- PLOTTING ------------------------------------------- + TCanvas c("c1", "c1", 604, 82, 856, 836); // Declare canvas + gStyle->SetOptStat(0); + c.Range(298434.4, -0.2989256, 299381.3, 2.010954); + c.SetFillColor(0); + c.SetBorderMode(0); + c.SetBorderSize(2); + c.SetTickx(1); + c.SetTicky(1); + c.SetGrid(); + c.SetLeftMargin(0.1883886); + c.SetRightMargin(0.03909953); + c.SetTopMargin(0.0875817); + c.SetBottomMargin(0.1294118); + c.SetFrameLineWidth(3); + c.SetFrameBorderMode(0); + + //============ Text =============// + TLatex top_right_Title = TLatex(); + top_right_Title.SetTextFont(42); + top_right_Title.SetTextSize(0.03717); + + TLatex detector = TLatex(); + detector.SetTextFont(62); + detector.SetTextSize(0.047); + + //-------- TVectors to be taken as input in TGraphs for plotting ---------// + TVectorD event_rate_VecD; + TVectorD event_rate_err_VecD; + TVectorD track_rate_VecD; + TVectorD track_rate_err_VecD; + TVectorD runNumber_VecD; + TVectorD runNumber_err_VecD; + TVectorD hit_rate_VecD; + TVectorD hit_rate_err_VecD; + TVectorD hit_rate_PIX_VecD; + TVectorD hit_rate_PIX_err_VecD; + TVectorD hit_rate_BPIX_VecD; + TVectorD hit_rate_BPIX_err_VecD; + TVectorD hit_rate_BPIX_layer1_VecD; + TVectorD hit_rate_BPIX_layer1_err_VecD; + TVectorD hit_rate_BPIX_layer2_VecD; + TVectorD hit_rate_BPIX_layer2_err_VecD; + TVectorD hit_rate_BPIX_layer3_VecD; + TVectorD hit_rate_BPIX_layer3_err_VecD; + TVectorD hit_rate_BPIX_layer4_VecD; + TVectorD hit_rate_BPIX_layer4_err_VecD; + TVectorD hit_rate_FPIX_VecD; + TVectorD hit_rate_FPIX_err_VecD; + TVectorD hit_rate_FPIX_disk1_VecD; + TVectorD hit_rate_FPIX_disk1_err_VecD; + TVectorD hit_rate_FPIX_disk2_VecD; + TVectorD hit_rate_FPIX_disk2_err_VecD; + TVectorD hit_rate_FPIX_disk3_VecD; + TVectorD hit_rate_FPIX_disk3_err_VecD; + TVectorD hit_rate_FPIX_disk1_plus_VecD; + TVectorD hit_rate_FPIX_disk1_plus_err_VecD; + TVectorD hit_rate_FPIX_disk1_minus_VecD; + TVectorD hit_rate_FPIX_disk1_minus_err_VecD; + TVectorD hit_rate_FPIX_disk2_plus_VecD; + TVectorD hit_rate_FPIX_disk2_plus_err_VecD; + TVectorD hit_rate_FPIX_disk2_minus_VecD; + TVectorD hit_rate_FPIX_disk2_minus_err_VecD; + TVectorD hit_rate_FPIX_disk3_plus_VecD; + TVectorD hit_rate_FPIX_disk3_plus_err_VecD; + TVectorD hit_rate_FPIX_disk3_minus_VecD; + TVectorD hit_rate_FPIX_disk3_minus_err_VecD; + + runNumber_VecD.Use(runNumber.size(), &(runNumber[0])); + runNumber_err_VecD.Use(runNumber_err.size(), &(runNumber_err[0])); + event_rate_VecD.Use(event_rate.size(), &(event_rate[0])); + event_rate_err_VecD.Use(event_rate_err.size(), &(event_rate_err[0])); + track_rate_VecD.Use(track_rate.size(), &(track_rate[0])); + track_rate_err_VecD.Use(track_rate_err.size(), &(track_rate_err[0])); + hit_rate_VecD.Use(hit_rate_Total.size(), &(hit_rate_Total[0])); + hit_rate_err_VecD.Use(hit_rate_Total_err.size(), &(hit_rate_Total_err[0])); + hit_rate_PIX_VecD.Use(hit_rate_PIX.size(), &(hit_rate_PIX[0])); + hit_rate_PIX_err_VecD.Use(hit_rate_PIX_err.size(), &(hit_rate_PIX_err[0])); + hit_rate_BPIX_VecD.Use(hit_rate_BPIX.size(), &(hit_rate_BPIX[0])); + hit_rate_BPIX_err_VecD.Use(hit_rate_BPIX_err.size(), &(hit_rate_BPIX_err[0])); + hit_rate_BPIX_layer1_VecD.Use(hit_rate_BPIX_layer1.size(), &(hit_rate_BPIX_layer1[0])); + hit_rate_BPIX_layer1_err_VecD.Use(hit_rate_BPIX_layer1_err.size(), &(hit_rate_BPIX_layer1_err[0])); + hit_rate_BPIX_layer2_VecD.Use(hit_rate_BPIX_layer2.size(), &(hit_rate_BPIX_layer2[0])); + hit_rate_BPIX_layer2_err_VecD.Use(hit_rate_BPIX_layer2_err.size(), &(hit_rate_BPIX_layer2_err[0])); + hit_rate_BPIX_layer3_VecD.Use(hit_rate_BPIX_layer3.size(), &(hit_rate_BPIX_layer3[0])); + hit_rate_BPIX_layer3_err_VecD.Use(hit_rate_BPIX_layer3_err.size(), &(hit_rate_BPIX_layer3_err[0])); + hit_rate_BPIX_layer4_VecD.Use(hit_rate_BPIX_layer4.size(), &(hit_rate_BPIX_layer4[0])); + hit_rate_BPIX_layer4_err_VecD.Use(hit_rate_BPIX_layer4_err.size(), &(hit_rate_BPIX_layer4_err[0])); + hit_rate_FPIX_VecD.Use(hit_rate_FPIX.size(), &(hit_rate_FPIX[0])); + hit_rate_FPIX_err_VecD.Use(hit_rate_FPIX_err.size(), &(hit_rate_FPIX_err[0])); + hit_rate_FPIX_disk1_VecD.Use(hit_rate_FPIX_disk1.size(), &(hit_rate_FPIX_disk1[0])); + hit_rate_FPIX_disk1_err_VecD.Use(hit_rate_FPIX_disk1_err.size(), &(hit_rate_FPIX_disk1_err[0])); + hit_rate_FPIX_disk2_VecD.Use(hit_rate_FPIX_disk2.size(), &(hit_rate_FPIX_disk2[0])); + hit_rate_FPIX_disk2_err_VecD.Use(hit_rate_FPIX_disk2_err.size(), &(hit_rate_FPIX_disk2_err[0])); + hit_rate_FPIX_disk3_VecD.Use(hit_rate_FPIX_disk3.size(), &(hit_rate_FPIX_disk3[0])); + hit_rate_FPIX_disk3_err_VecD.Use(hit_rate_FPIX_disk3_err.size(), &(hit_rate_FPIX_disk3_err[0])); + hit_rate_FPIX_disk1_plus_VecD.Use(hit_rate_FPIX_disk1_plus.size(), &(hit_rate_FPIX_disk1_plus[0])); + hit_rate_FPIX_disk1_plus_err_VecD.Use(hit_rate_FPIX_disk1_plus_err.size(), &(hit_rate_FPIX_disk1_plus_err[0])); + hit_rate_FPIX_disk1_minus_VecD.Use(hit_rate_FPIX_disk1_minus.size(), &(hit_rate_FPIX_disk1_minus[0])); + hit_rate_FPIX_disk1_minus_err_VecD.Use(hit_rate_FPIX_disk1_minus_err.size(), &(hit_rate_FPIX_disk1_minus_err[0])); + hit_rate_FPIX_disk2_plus_VecD.Use(hit_rate_FPIX_disk2_plus.size(), &(hit_rate_FPIX_disk2_plus[0])); + hit_rate_FPIX_disk2_plus_err_VecD.Use(hit_rate_FPIX_disk2_plus_err.size(), &(hit_rate_FPIX_disk2_plus_err[0])); + hit_rate_FPIX_disk2_minus_VecD.Use(hit_rate_FPIX_disk2_minus.size(), &(hit_rate_FPIX_disk2_minus[0])); + hit_rate_FPIX_disk2_minus_err_VecD.Use(hit_rate_FPIX_disk2_minus_err.size(), &(hit_rate_FPIX_disk2_minus_err[0])); + hit_rate_FPIX_disk3_plus_VecD.Use(hit_rate_FPIX_disk3_plus.size(), &(hit_rate_FPIX_disk3_plus[0])); + hit_rate_FPIX_disk3_plus_err_VecD.Use(hit_rate_FPIX_disk3_plus_err.size(), &(hit_rate_FPIX_disk3_plus_err[0])); + hit_rate_FPIX_disk3_minus_VecD.Use(hit_rate_FPIX_disk3_minus.size(), &(hit_rate_FPIX_disk3_minus[0])); + hit_rate_FPIX_disk3_minus_err_VecD.Use(hit_rate_FPIX_disk3_minus_err.size(), &(hit_rate_FPIX_disk3_minus_err[0])); + + //+++++++++++++++++++++++++++++ Overall event rate +++++++++++++++++++++++++++++++++++++ + + TGraphErrors gr_event_rate(runNumber_VecD, event_rate_VecD, runNumber_err_VecD, event_rate_err_VecD); + gr_event_rate.GetXaxis()->SetTitle("Run Number"); + gr_event_rate.GetXaxis()->SetLabelSize(0.04); + gr_event_rate.GetXaxis()->SetNoExponent(); + gr_event_rate.GetXaxis()->SetNdivisions(5); + gr_event_rate.GetYaxis()->SetTitle("Event Rate (Hz)"); + gr_event_rate.GetXaxis()->SetTitleSize(0.05); + gr_event_rate.GetYaxis()->SetLabelSize(0.05); + gr_event_rate.GetYaxis()->SetTitleSize(0.05); + gr_event_rate.SetMarkerStyle(20); + gr_event_rate.SetMarkerSize(1.4); + gr_event_rate.SetMarkerColor(kRed); + gr_event_rate.SetTitle(""); + gr_event_rate.Draw("AP"); + top_right_Title.DrawLatexNDC(0.79, 0.94, "cosmic rays"); + detector.DrawLatexNDC(0.23, 0.83, "Event Rate"); + c.SetGrid(); + c.SaveAs("event_rate.png"); + c.SaveAs("event_rate.pdf"); + c.SaveAs("event_rate.C"); + c.Clear(); + gSystem->Exec("mv event_rate.png Hit_Rate_Plots"); + gSystem->Exec("mv event_rate.pdf Hit_Rate_Plots"); + gSystem->Exec("mv event_rate.C Hit_Rate_Plots"); + //----------------------------------------------------------------------------------------------- + + //++++++++++++++++++++++++++++++ Overall track rate +++++++++++++++++++++++++++++++++++++++++++ + + TGraphErrors gr_track_rate(runNumber_VecD, track_rate_VecD, runNumber_err_VecD, track_rate_err_VecD); + gr_track_rate.GetXaxis()->SetTitle("Run Number"); + gr_track_rate.GetXaxis()->SetLabelSize(0.04); + gr_track_rate.GetXaxis()->SetNoExponent(); + gr_track_rate.GetXaxis()->SetNdivisions(5); + gr_track_rate.GetYaxis()->SetTitle("Track Rate (Hz)"); + gr_track_rate.GetXaxis()->SetTitleSize(0.05); + gr_track_rate.GetYaxis()->SetLabelSize(0.05); + gr_track_rate.GetYaxis()->SetTitleSize(0.05); + gr_track_rate.SetMarkerStyle(20); + gr_track_rate.SetMarkerSize(1.4); + gr_track_rate.SetMarkerColor(kRed); + gr_track_rate.SetTitle(""); + gr_track_rate.Draw("AP"); + top_right_Title.DrawLatexNDC(0.79, 0.94, "cosmic rays"); + detector.DrawLatexNDC(0.23, 0.83, "Track Rate"); + c.SetGrid(); + c.SaveAs("track_rate.png"); + c.SaveAs("track_rate.pdf"); + c.SaveAs("track_rate.C"); + c.Clear(); + gSystem->Exec("mv track_rate.png Hit_Rate_Plots"); + gSystem->Exec("mv track_rate.pdf Hit_Rate_Plots"); + gSystem->Exec("mv track_rate.C Hit_Rate_Plots"); + + //----------------------------------------------------------------------------------------------- + + //++++++++++++++++++++++++++++++ Overall hit rate +++++++++++++++++++++++++++++++++++++++++++ + + TGraphErrors gr_hit_rate(runNumber_VecD, hit_rate_VecD, runNumber_err_VecD, hit_rate_err_VecD); + gr_hit_rate.GetXaxis()->SetTitle("Run Number"); + gr_hit_rate.GetXaxis()->SetLabelSize(0.04); + gr_hit_rate.GetXaxis()->SetNoExponent(); + gr_hit_rate.GetXaxis()->SetNdivisions(5); + gr_hit_rate.GetYaxis()->SetTitle("Hit Rate (Hz)"); + gr_hit_rate.GetXaxis()->SetTitleSize(0.05); + gr_hit_rate.GetYaxis()->SetLabelSize(0.05); + gr_hit_rate.GetYaxis()->SetTitleSize(0.05); + gr_hit_rate.SetMarkerStyle(20); + gr_hit_rate.SetMarkerSize(1.4); + gr_hit_rate.SetMarkerColor(kRed); + gr_hit_rate.SetTitle(""); + gr_hit_rate.Draw("AP"); + top_right_Title.DrawLatexNDC(0.79, 0.94, "cosmic rays"); + detector.DrawLatexNDC(0.23, 0.83, "Hit Rate"); + c.SetGrid(); + c.SaveAs("hit_rate.png"); + c.SaveAs("hit_rate.pdf"); + c.SaveAs("hit_rate.C"); + c.Clear(); + gSystem->Exec("mv hit_rate.png Hit_Rate_Plots"); + gSystem->Exec("mv hit_rate.pdf Hit_Rate_Plots"); + gSystem->Exec("mv hit_rate.C Hit_Rate_Plots"); + + //----------------------------------------------------------------------------------------------- + + //+++++++++++++++++++++++++++++++ Total Pixel hit rate +++++++++++++++++++++++++++++++++++++++ + + TGraphErrors gr_hit_rate_PIX(runNumber_VecD, hit_rate_PIX_VecD, runNumber_err_VecD, hit_rate_PIX_err_VecD); + gr_hit_rate_PIX.GetXaxis()->SetTitle("Run Number"); + gr_hit_rate_PIX.GetXaxis()->SetLabelSize(0.04); + gr_hit_rate_PIX.GetXaxis()->SetNoExponent(); + gr_hit_rate_PIX.GetXaxis()->SetNdivisions(5); + gr_hit_rate_PIX.GetYaxis()->SetTitle("Hit Rate (Hz)"); + gr_hit_rate_PIX.GetXaxis()->SetTitleSize(0.05); + gr_hit_rate_PIX.GetYaxis()->SetLabelSize(0.05); + gr_hit_rate_PIX.GetYaxis()->SetTitleSize(0.05); + gr_hit_rate_PIX.SetMarkerStyle(20); + gr_hit_rate_PIX.SetMarkerSize(1.4); + gr_hit_rate_PIX.SetMarkerColor(2); + gr_hit_rate_PIX.SetTitle(""); + gr_hit_rate_PIX.Draw("AP"); + top_right_Title.DrawLatexNDC(0.79, 0.94, "cosmic rays"); + detector.DrawLatexNDC(0.23, 0.83, "PIXEL"); + c.SetGrid(); + c.SaveAs("pixel_hit_rate.png"); + c.SaveAs("pixel_hit_rate.pdf"); + c.SaveAs("pixel_hit_rate.C"); + c.Clear(); + gSystem->Exec("mv pixel_hit_rate.png Hit_Rate_Plots"); + gSystem->Exec("mv pixel_hit_rate.pdf Hit_Rate_Plots"); + gSystem->Exec("mv pixel_hit_rate.C Hit_Rate_Plots"); + + //----------------------------------------------------------------------------------------------- + + //++++++++++++++++++++++++++++++++ FPIX hit rate ++++++++++++++++++++++++++++++++++++++++++++ + + TGraphErrors gr_hit_rate_FPIX(runNumber_VecD, hit_rate_FPIX_VecD, runNumber_err_VecD, hit_rate_FPIX_err_VecD); + gr_hit_rate_FPIX.GetXaxis()->SetTitle("Run Number"); + gr_hit_rate_FPIX.GetXaxis()->SetLabelSize(0.04); + gr_hit_rate_FPIX.GetXaxis()->SetNoExponent(); + gr_hit_rate_FPIX.GetXaxis()->SetNdivisions(5); + gr_hit_rate_FPIX.GetYaxis()->SetTitle("Hit Rate (Hz)"); + gr_hit_rate_FPIX.GetXaxis()->SetTitleSize(0.05); + gr_hit_rate_FPIX.GetYaxis()->SetLabelSize(0.05); + gr_hit_rate_FPIX.GetYaxis()->SetTitleSize(0.05); + gr_hit_rate_FPIX.SetMarkerStyle(20); + gr_hit_rate_FPIX.SetMarkerSize(1.4); + gr_hit_rate_FPIX.SetMarkerColor(kRed); + gr_hit_rate_FPIX.SetTitle(""); + gr_hit_rate_FPIX.Draw("AP"); + top_right_Title.DrawLatexNDC(0.79, 0.94, "cosmic rays"); + detector.DrawLatexNDC(0.23, 0.83, "FPIX"); + c.SetGrid(); + c.SaveAs("fpix_hit_rate.png"); + c.SaveAs("fpix_hit_rate.pdf"); + c.SaveAs("fpix_hit_rate.C"); + c.Clear(); + gSystem->Exec("mv fpix_hit_rate.png Hit_Rate_Plots"); + gSystem->Exec("mv fpix_hit_rate.pdf Hit_Rate_Plots"); + gSystem->Exec("mv fpix_hit_rate.C Hit_Rate_Plots"); + //----------------------------------------------------------------------------------------------- + + //++++++++++++++++++++++++++++++++ FPIX Disk1 hit rate ++++++++++++++++++++++++++++++++++++++++++++ + + TGraphErrors gr_hit_rate_FPIX_disk1( + runNumber_VecD, hit_rate_FPIX_disk1_VecD, runNumber_err_VecD, hit_rate_FPIX_disk1_err_VecD); + gr_hit_rate_FPIX_disk1.GetXaxis()->SetTitle("Run Number"); + gr_hit_rate_FPIX_disk1.GetXaxis()->SetLabelSize(0.04); + gr_hit_rate_FPIX_disk1.GetXaxis()->SetNoExponent(); + gr_hit_rate_FPIX_disk1.GetXaxis()->SetNdivisions(5); + gr_hit_rate_FPIX_disk1.GetYaxis()->SetTitle("Hit Rate (Hz)"); + gr_hit_rate_FPIX_disk1.GetXaxis()->SetTitleSize(0.05); + gr_hit_rate_FPIX_disk1.GetYaxis()->SetLabelSize(0.05); + gr_hit_rate_FPIX_disk1.GetYaxis()->SetTitleSize(0.05); + gr_hit_rate_FPIX_disk1.SetMarkerStyle(20); + gr_hit_rate_FPIX_disk1.SetMarkerSize(1.4); + gr_hit_rate_FPIX_disk1.SetMarkerColor(kRed); + gr_hit_rate_FPIX_disk1.SetTitle(""); + gr_hit_rate_FPIX_disk1.Draw("AP"); + top_right_Title.DrawLatexNDC(0.79, 0.94, "cosmic rays"); + detector.DrawLatexNDC(0.23, 0.83, "FPIX disk 1"); + c.SetGrid(); + c.SaveAs("fpix_hit_rate_disk1.png"); + c.SaveAs("fpix_hit_rate_disk1.pdf"); + c.SaveAs("fpix_hit_rate_disk1.C"); + c.Clear(); + gSystem->Exec("mv fpix_hit_rate_disk1.png Hit_Rate_Plots"); + gSystem->Exec("mv fpix_hit_rate_disk1.pdf Hit_Rate_Plots"); + gSystem->Exec("mv fpix_hit_rate_disk1.C Hit_Rate_Plots"); + //----------------------------------------------------------------------------------------------- + + //++++++++++++++++++++++++++++++++ FPIX Disk2 hit rate ++++++++++++++++++++++++++++++++++++++++++++ + + TGraphErrors gr_hit_rate_FPIX_disk2( + runNumber_VecD, hit_rate_FPIX_disk2_VecD, runNumber_err_VecD, hit_rate_FPIX_disk2_err_VecD); + gr_hit_rate_FPIX_disk2.GetXaxis()->SetTitle("Run Number"); + gr_hit_rate_FPIX_disk2.GetXaxis()->SetLabelSize(0.04); + gr_hit_rate_FPIX_disk2.GetXaxis()->SetNoExponent(); + gr_hit_rate_FPIX_disk2.GetXaxis()->SetNdivisions(5); + gr_hit_rate_FPIX_disk2.GetYaxis()->SetTitle("Hit Rate (Hz)"); + gr_hit_rate_FPIX_disk2.GetXaxis()->SetTitleSize(0.05); + gr_hit_rate_FPIX_disk2.GetYaxis()->SetLabelSize(0.05); + gr_hit_rate_FPIX_disk2.GetYaxis()->SetTitleSize(0.05); + gr_hit_rate_FPIX_disk2.SetMarkerStyle(20); + gr_hit_rate_FPIX_disk2.SetMarkerSize(1.4); + gr_hit_rate_FPIX_disk2.SetMarkerColor(kRed); + gr_hit_rate_FPIX_disk2.SetTitle(""); + gr_hit_rate_FPIX_disk2.Draw("AP"); + top_right_Title.DrawLatexNDC(0.79, 0.94, "cosmic rays"); + detector.DrawLatexNDC(0.23, 0.83, "FPIX disk 2"); + c.SetGrid(); + c.SaveAs("fpix_hit_rate_disk2.png"); + c.SaveAs("fpix_hit_rate_disk2.pdf"); + c.SaveAs("fpix_hit_rate_disk2.C"); + c.Clear(); + gSystem->Exec("mv fpix_hit_rate_disk2.png Hit_Rate_Plots"); + gSystem->Exec("mv fpix_hit_rate_disk2.pdf Hit_Rate_Plots"); + gSystem->Exec("mv fpix_hit_rate_disk2.C Hit_Rate_Plots"); + //----------------------------------------------------------------------------------------------- + + //++++++++++++++++++++++++++++++++ FPIX Disk3 hit rate ++++++++++++++++++++++++++++++++++++++++++++ + + TGraphErrors gr_hit_rate_FPIX_disk3( + runNumber_VecD, hit_rate_FPIX_disk3_VecD, runNumber_err_VecD, hit_rate_FPIX_disk3_err_VecD); + gr_hit_rate_FPIX_disk3.GetXaxis()->SetTitle("Run Number"); + gr_hit_rate_FPIX_disk3.GetXaxis()->SetLabelSize(0.04); + gr_hit_rate_FPIX_disk3.GetXaxis()->SetNoExponent(); + gr_hit_rate_FPIX_disk3.GetXaxis()->SetNdivisions(5); + gr_hit_rate_FPIX_disk3.GetYaxis()->SetTitle("Hit Rate (Hz)"); + gr_hit_rate_FPIX_disk3.GetXaxis()->SetTitleSize(0.05); + gr_hit_rate_FPIX_disk3.GetYaxis()->SetLabelSize(0.05); + gr_hit_rate_FPIX_disk3.GetYaxis()->SetTitleSize(0.05); + gr_hit_rate_FPIX_disk3.SetMarkerStyle(20); + gr_hit_rate_FPIX_disk3.SetMarkerSize(1.4); + gr_hit_rate_FPIX_disk3.SetMarkerColor(kRed); + gr_hit_rate_FPIX_disk3.SetTitle(""); + gr_hit_rate_FPIX_disk3.Draw("AP"); + top_right_Title.DrawLatexNDC(0.79, 0.94, "cosmic rays"); + detector.DrawLatexNDC(0.23, 0.83, "FPIX disk 3"); + c.SetGrid(); + c.SaveAs("fpix_hit_rate_disk3.png"); + c.SaveAs("fpix_hit_rate_disk3.pdf"); + c.SaveAs("fpix_hit_rate_disk3.C"); + c.Clear(); + gSystem->Exec("mv fpix_hit_rate_disk3.png Hit_Rate_Plots"); + gSystem->Exec("mv fpix_hit_rate_disk3.pdf Hit_Rate_Plots"); + gSystem->Exec("mv fpix_hit_rate_disk3.C Hit_Rate_Plots"); + //----------------------------------------------------------------------------------------------- + + //++++++++++++++++++++++++++++++++ FPIX Disk1+ hit rate ++++++++++++++++++++++++++++++++++++++++++++ + + TGraphErrors gr_hit_rate_FPIX_disk1_plus( + runNumber_VecD, hit_rate_FPIX_disk1_plus_VecD, runNumber_err_VecD, hit_rate_FPIX_disk1_plus_err_VecD); + gr_hit_rate_FPIX_disk1_plus.GetXaxis()->SetTitle("Run Number"); + gr_hit_rate_FPIX_disk1_plus.GetXaxis()->SetLabelSize(0.04); + gr_hit_rate_FPIX_disk1_plus.GetXaxis()->SetNoExponent(); + gr_hit_rate_FPIX_disk1_plus.GetXaxis()->SetNdivisions(5); + gr_hit_rate_FPIX_disk1_plus.GetYaxis()->SetTitle("Hit Rate (Hz)"); + gr_hit_rate_FPIX_disk1_plus.GetXaxis()->SetTitleSize(0.05); + gr_hit_rate_FPIX_disk1_plus.GetYaxis()->SetLabelSize(0.05); + gr_hit_rate_FPIX_disk1_plus.GetYaxis()->SetTitleSize(0.05); + gr_hit_rate_FPIX_disk1_plus.SetMarkerStyle(20); + gr_hit_rate_FPIX_disk1_plus.SetMarkerSize(1.4); + gr_hit_rate_FPIX_disk1_plus.SetMarkerColor(kRed); + gr_hit_rate_FPIX_disk1_plus.SetTitle(""); + gr_hit_rate_FPIX_disk1_plus.Draw("AP"); + top_right_Title.DrawLatexNDC(0.79, 0.94, "cosmic rays"); + detector.DrawLatexNDC(0.23, 0.83, "FPIX disk 1+"); + c.SetGrid(); + c.SaveAs("fpix_hit_rate_disk1_plus.png"); + c.SaveAs("fpix_hit_rate_disk1_plus.C"); + c.SaveAs("fpix_hit_rate_disk1_plus.pdf"); + c.Clear(); + gSystem->Exec("mv fpix_hit_rate_disk1_plus.png Hit_Rate_Plots"); + gSystem->Exec("mv fpix_hit_rate_disk1_plus.pdf Hit_Rate_Plots"); + gSystem->Exec("mv fpix_hit_rate_disk1_plus.C Hit_Rate_Plots"); + //----------------------------------------------------------------------------------------------- + + //++++++++++++++++++++++++++++++++ FPIX Disk1- hit rate ++++++++++++++++++++++++++++++++++++++++++++ + + TGraphErrors gr_hit_rate_FPIX_disk1_minus( + runNumber_VecD, hit_rate_FPIX_disk1_minus_VecD, runNumber_err_VecD, hit_rate_FPIX_disk1_minus_err_VecD); + gr_hit_rate_FPIX_disk1_minus.GetXaxis()->SetTitle("Run Number"); + gr_hit_rate_FPIX_disk1_minus.GetXaxis()->SetLabelSize(0.04); + gr_hit_rate_FPIX_disk1_minus.GetXaxis()->SetNoExponent(); + gr_hit_rate_FPIX_disk1_minus.GetXaxis()->SetNdivisions(5); + gr_hit_rate_FPIX_disk1_minus.GetYaxis()->SetTitle("Hit Rate (Hz)"); + gr_hit_rate_FPIX_disk1_minus.GetXaxis()->SetTitleSize(0.05); + gr_hit_rate_FPIX_disk1_minus.GetYaxis()->SetLabelSize(0.05); + gr_hit_rate_FPIX_disk1_minus.GetYaxis()->SetTitleSize(0.05); + gr_hit_rate_FPIX_disk1_minus.SetMarkerStyle(20); + gr_hit_rate_FPIX_disk1_minus.SetMarkerSize(1.4); + gr_hit_rate_FPIX_disk1_minus.SetMarkerColor(kRed); + gr_hit_rate_FPIX_disk1_minus.SetTitle(""); + gr_hit_rate_FPIX_disk1_minus.Draw("AP"); + top_right_Title.DrawLatexNDC(0.79, 0.94, "cosmic rays"); + detector.DrawLatexNDC(0.23, 0.83, "FPIX disk 1-"); + c.SetGrid(); + c.SaveAs("fpix_hit_rate_disk1_minus.png"); + c.SaveAs("fpix_hit_rate_disk1_minus.pdf"); + c.SaveAs("fpix_hit_rate_disk1_minus.C"); + c.Clear(); + gSystem->Exec("mv fpix_hit_rate_disk1_minus.png Hit_Rate_Plots"); + gSystem->Exec("mv fpix_hit_rate_disk1_minus.pdf Hit_Rate_Plots"); + gSystem->Exec("mv fpix_hit_rate_disk1_minus.C Hit_Rate_Plots"); + //----------------------------------------------------------------------------------------------- + + //++++++++++++++++++++++++++++++++ FPIX Disk2+ hit rate ++++++++++++++++++++++++++++++++++++++++++++ + + TGraphErrors gr_hit_rate_FPIX_disk2_plus( + runNumber_VecD, hit_rate_FPIX_disk2_plus_VecD, runNumber_err_VecD, hit_rate_FPIX_disk2_plus_err_VecD); + gr_hit_rate_FPIX_disk2_plus.GetXaxis()->SetTitle("Run Number"); + gr_hit_rate_FPIX_disk2_plus.GetXaxis()->SetLabelSize(0.04); + gr_hit_rate_FPIX_disk2_plus.GetXaxis()->SetNoExponent(); + gr_hit_rate_FPIX_disk2_plus.GetXaxis()->SetNdivisions(5); + gr_hit_rate_FPIX_disk2_plus.GetYaxis()->SetTitle("Hit Rate (Hz)"); + gr_hit_rate_FPIX_disk2_plus.GetXaxis()->SetTitleSize(0.05); + gr_hit_rate_FPIX_disk2_plus.GetYaxis()->SetLabelSize(0.05); + gr_hit_rate_FPIX_disk2_plus.GetYaxis()->SetTitleSize(0.05); + gr_hit_rate_FPIX_disk2_plus.SetMarkerStyle(20); + gr_hit_rate_FPIX_disk2_plus.SetMarkerSize(1.4); + gr_hit_rate_FPIX_disk2_plus.SetMarkerColor(kRed); + gr_hit_rate_FPIX_disk2_plus.SetTitle(""); + gr_hit_rate_FPIX_disk2_plus.Draw("AP"); + top_right_Title.DrawLatexNDC(0.79, 0.94, "cosmic rays"); + detector.DrawLatexNDC(0.23, 0.83, "FPIX disk 2+"); + c.SetGrid(); + c.SaveAs("fpix_hit_rate_disk2_plus.png"); + c.SaveAs("fpix_hit_rate_disk2_plus.pdf"); + c.SaveAs("fpix_hit_rate_disk2_plus.C"); + c.Clear(); + gSystem->Exec("mv fpix_hit_rate_disk2_plus.png Hit_Rate_Plots"); + gSystem->Exec("mv fpix_hit_rate_disk2_plus.pdf Hit_Rate_Plots"); + gSystem->Exec("mv fpix_hit_rate_disk2_plus.C Hit_Rate_Plots"); + //----------------------------------------------------------------------------------------------- + + //++++++++++++++++++++++++++++++++ FPIX Disk2- hit rate ++++++++++++++++++++++++++++++++++++++++++++ + + TGraphErrors gr_hit_rate_FPIX_disk2_minus( + runNumber_VecD, hit_rate_FPIX_disk2_minus_VecD, runNumber_err_VecD, hit_rate_FPIX_disk2_minus_err_VecD); + gr_hit_rate_FPIX_disk2_minus.GetXaxis()->SetTitle("Run Number"); + gr_hit_rate_FPIX_disk2_minus.GetXaxis()->SetLabelSize(0.04); + gr_hit_rate_FPIX_disk2_minus.GetXaxis()->SetNoExponent(); + gr_hit_rate_FPIX_disk2_minus.GetXaxis()->SetNdivisions(5); + gr_hit_rate_FPIX_disk2_minus.GetYaxis()->SetTitle("Hit Rate (Hz)"); + gr_hit_rate_FPIX_disk2_minus.GetXaxis()->SetTitleSize(0.05); + gr_hit_rate_FPIX_disk2_minus.GetYaxis()->SetLabelSize(0.05); + gr_hit_rate_FPIX_disk2_minus.GetYaxis()->SetTitleSize(0.05); + gr_hit_rate_FPIX_disk2_minus.SetMarkerStyle(20); + gr_hit_rate_FPIX_disk2_minus.SetMarkerSize(1.4); + gr_hit_rate_FPIX_disk2_minus.SetMarkerColor(2); + gr_hit_rate_FPIX_disk2_minus.SetTitle(""); + gr_hit_rate_FPIX_disk2_minus.Draw("AP"); + top_right_Title.DrawLatexNDC(0.79, 0.94, "cosmic rays"); + detector.DrawLatexNDC(0.23, 0.83, "FPIX disk 2-"); + c.SetGrid(); + c.SaveAs("fpix_hit_rate_disk2_minus.png"); + c.SaveAs("fpix_hit_rate_disk2_minus.pdf"); + c.SaveAs("fpix_hit_rate_disk2_minus.C"); + c.Clear(); + gSystem->Exec("mv fpix_hit_rate_disk2_minus.png Hit_Rate_Plots"); + gSystem->Exec("mv fpix_hit_rate_disk2_minus.pdf Hit_Rate_Plots"); + gSystem->Exec("mv fpix_hit_rate_disk2_minus.C Hit_Rate_Plots"); + //----------------------------------------------------------------------------------------------- + + //++++++++++++++++++++++++++++++++ FPIX Disk3+ hit rate ++++++++++++++++++++++++++++++++++++++++++++ + + TGraphErrors gr_hit_rate_FPIX_disk3_plus( + runNumber_VecD, hit_rate_FPIX_disk3_plus_VecD, runNumber_err_VecD, hit_rate_FPIX_disk3_plus_err_VecD); + gr_hit_rate_FPIX_disk3_plus.GetXaxis()->SetTitle("Run Number"); + gr_hit_rate_FPIX_disk3_plus.GetXaxis()->SetLabelSize(0.04); + gr_hit_rate_FPIX_disk3_plus.GetXaxis()->SetNoExponent(); + gr_hit_rate_FPIX_disk3_plus.GetXaxis()->SetNdivisions(5); + gr_hit_rate_FPIX_disk3_plus.GetYaxis()->SetTitle("Hit Rate (Hz)"); + gr_hit_rate_FPIX_disk3_plus.GetXaxis()->SetTitleSize(0.05); + gr_hit_rate_FPIX_disk3_plus.GetYaxis()->SetLabelSize(0.05); + gr_hit_rate_FPIX_disk3_plus.GetYaxis()->SetTitleSize(0.05); + gr_hit_rate_FPIX_disk3_plus.SetMarkerStyle(20); + gr_hit_rate_FPIX_disk3_plus.SetMarkerSize(1.4); + gr_hit_rate_FPIX_disk3_plus.SetMarkerColor(kRed); + gr_hit_rate_FPIX_disk3_plus.SetTitle(""); + gr_hit_rate_FPIX_disk3_plus.Draw("AP"); + top_right_Title.DrawLatexNDC(0.79, 0.94, "cosmic rays"); + detector.DrawLatexNDC(0.23, 0.83, "FPIX disk 3+"); + c.SetGrid(); + c.SaveAs("fpix_hit_rate_disk3_plus.png"); + c.SaveAs("fpix_hit_rate_disk3_plus.pdf"); + c.SaveAs("fpix_hit_rate_disk3_plus.C"); + c.Clear(); + gSystem->Exec("mv fpix_hit_rate_disk3_plus.png Hit_Rate_Plots"); + gSystem->Exec("mv fpix_hit_rate_disk3_plus.pdf Hit_Rate_Plots"); + gSystem->Exec("mv fpix_hit_rate_disk3_plus.C Hit_Rate_Plots"); + //----------------------------------------------------------------------------------------------- + + //++++++++++++++++++++++++++++++++ FPIX Disk3- hit rate ++++++++++++++++++++++++++++++++++++++++++++ + + TGraphErrors gr_hit_rate_FPIX_disk3_minus( + runNumber_VecD, hit_rate_FPIX_disk3_minus_VecD, runNumber_err_VecD, hit_rate_FPIX_disk3_minus_err_VecD); + gr_hit_rate_FPIX_disk3_minus.GetXaxis()->SetTitle("Run Number"); + gr_hit_rate_FPIX_disk3_minus.GetXaxis()->SetLabelSize(0.04); + gr_hit_rate_FPIX_disk3_minus.GetXaxis()->SetNoExponent(); + gr_hit_rate_FPIX_disk3_minus.GetXaxis()->SetNdivisions(5); + gr_hit_rate_FPIX_disk3_minus.GetYaxis()->SetTitle("Hit Rate (Hz)"); + gr_hit_rate_FPIX_disk3_minus.GetXaxis()->SetTitleSize(0.05); + gr_hit_rate_FPIX_disk3_minus.GetYaxis()->SetLabelSize(0.05); + gr_hit_rate_FPIX_disk3_minus.GetYaxis()->SetTitleSize(0.05); + gr_hit_rate_FPIX_disk3_minus.SetMarkerStyle(20); + gr_hit_rate_FPIX_disk3_minus.SetMarkerSize(1.4); + gr_hit_rate_FPIX_disk3_minus.SetMarkerColor(2); + gr_hit_rate_FPIX_disk3_minus.SetTitle(""); + gr_hit_rate_FPIX_disk3_minus.Draw("AP"); + top_right_Title.DrawLatexNDC(0.79, 0.94, "cosmic rays"); + detector.DrawLatexNDC(0.23, 0.83, "FPIX disk 3-"); + c.SetGrid(); + c.SaveAs("fpix_hit_rate_disk3_minus.png"); + c.SaveAs("fpix_hit_rate_disk3_minus.pdf"); + c.SaveAs("fpix_hit_rate_disk3_minus.C"); + c.Clear(); + gSystem->Exec("mv fpix_hit_rate_disk3_minus.png Hit_Rate_Plots"); + gSystem->Exec("mv fpix_hit_rate_disk3_minus.pdf Hit_Rate_Plots"); + gSystem->Exec("mv fpix_hit_rate_disk3_minus.C Hit_Rate_Plots"); + //----------------------------------------------------------------------------------------------- + + //++++++++++++++++++++++++++++++++ BPIX hit rate ++++++++++++++++++++++++++++++++++++++++++++ + + TGraphErrors gr_hit_rate_BPIX(runNumber_VecD, hit_rate_BPIX_VecD, runNumber_err_VecD, hit_rate_BPIX_err_VecD); + gr_hit_rate_BPIX.GetXaxis()->SetTitle("Run Number"); + gr_hit_rate_BPIX.GetXaxis()->SetLabelSize(0.04); + gr_hit_rate_BPIX.GetXaxis()->SetNoExponent(); + gr_hit_rate_BPIX.GetXaxis()->SetNdivisions(5); + gr_hit_rate_BPIX.GetYaxis()->SetTitle("Hit Rate (Hz)"); + gr_hit_rate_BPIX.GetXaxis()->SetTitleSize(0.05); + gr_hit_rate_BPIX.GetYaxis()->SetLabelSize(0.05); + gr_hit_rate_BPIX.GetYaxis()->SetTitleSize(0.05); + gr_hit_rate_BPIX.SetMarkerStyle(20); + gr_hit_rate_BPIX.SetMarkerSize(1.4); + gr_hit_rate_BPIX.SetMarkerColor(2); + gr_hit_rate_BPIX.SetTitle(""); + gr_hit_rate_BPIX.Draw("AP"); + top_right_Title.DrawLatexNDC(0.79, 0.94, "cosmic rays"); + detector.DrawLatexNDC(0.23, 0.83, "BPIX"); + c.SetGrid(); + c.SaveAs("bpix_hit_rate.png"); + c.SaveAs("bpix_hit_rate.pdf"); + c.SaveAs("bpix_hit_rate.C"); + c.Clear(); + gSystem->Exec("mv bpix_hit_rate.png Hit_Rate_Plots"); + gSystem->Exec("mv bpix_hit_rate.pdf Hit_Rate_Plots"); + gSystem->Exec("mv bpix_hit_rate.C Hit_Rate_Plots"); + + //----------------------------------------------------------------------------------------------- + + //++++++++++++++++++++++++++++++++ BPIX layer 1 hit rate ++++++++++++++++++++++++++++++++++++++++++++ + + TGraphErrors gr_hit_rate_BPIX_layer1( + runNumber_VecD, hit_rate_BPIX_layer1_VecD, runNumber_err_VecD, hit_rate_BPIX_layer1_err_VecD); + gr_hit_rate_BPIX_layer1.GetXaxis()->SetTitle("Run Number"); + gr_hit_rate_BPIX_layer1.GetXaxis()->SetLabelSize(0.04); + gr_hit_rate_BPIX_layer1.GetXaxis()->SetNoExponent(); + gr_hit_rate_BPIX_layer1.GetXaxis()->SetNdivisions(5); + gr_hit_rate_BPIX_layer1.GetYaxis()->SetTitle("Hit Rate (Hz)"); + gr_hit_rate_BPIX_layer1.GetXaxis()->SetTitleSize(0.05); + gr_hit_rate_BPIX_layer1.GetYaxis()->SetLabelSize(0.05); + gr_hit_rate_BPIX_layer1.GetYaxis()->SetTitleSize(0.05); + gr_hit_rate_BPIX_layer1.SetMarkerStyle(20); + gr_hit_rate_BPIX_layer1.SetMarkerSize(1.4); + gr_hit_rate_BPIX_layer1.SetMarkerColor(2); + gr_hit_rate_BPIX_layer1.SetTitle(""); + gr_hit_rate_BPIX_layer1.Draw("AP"); + top_right_Title.DrawLatexNDC(0.79, 0.94, "cosmic rays"); + detector.DrawLatexNDC(0.23, 0.83, "BPIX layer 1"); + c.SetGrid(); + c.SaveAs("bpix_layer1_hit_rate.png"); + c.SaveAs("bpix_layer1_hit_rate.pdf"); + c.SaveAs("bpix_layer1_hit_rate.C"); + c.Clear(); + gSystem->Exec("mv bpix_layer1_hit_rate.png Hit_Rate_Plots"); + gSystem->Exec("mv bpix_layer1_hit_rate.pdf Hit_Rate_Plots"); + gSystem->Exec("mv bpix_layer1_hit_rate.C Hit_Rate_Plots"); + + //----------------------------------------------------------------------------------------------- + + //++++++++++++++++++++++++++++++++ BPIX layer 2 hit rate ++++++++++++++++++++++++++++++++++++++++++++ + + TGraphErrors gr_hit_rate_BPIX_layer2( + runNumber_VecD, hit_rate_BPIX_layer2_VecD, runNumber_err_VecD, hit_rate_BPIX_layer2_err_VecD); + gr_hit_rate_BPIX_layer2.GetXaxis()->SetTitle("Run Number"); + gr_hit_rate_BPIX_layer2.GetXaxis()->SetLabelSize(0.04); + gr_hit_rate_BPIX_layer2.GetXaxis()->SetNoExponent(); + gr_hit_rate_BPIX_layer2.GetXaxis()->SetNdivisions(5); + gr_hit_rate_BPIX_layer2.GetYaxis()->SetTitle("Hit Rate (Hz)"); + gr_hit_rate_BPIX_layer2.GetXaxis()->SetTitleSize(0.05); + gr_hit_rate_BPIX_layer2.GetYaxis()->SetLabelSize(0.05); + gr_hit_rate_BPIX_layer2.GetYaxis()->SetTitleSize(0.05); + gr_hit_rate_BPIX_layer2.SetMarkerStyle(20); + gr_hit_rate_BPIX_layer2.SetMarkerSize(1.4); + gr_hit_rate_BPIX_layer2.SetMarkerColor(2); + gr_hit_rate_BPIX_layer2.SetTitle(""); + gr_hit_rate_BPIX_layer2.Draw("AP"); + top_right_Title.DrawLatexNDC(0.79, 0.94, "cosmic rays"); + detector.DrawLatexNDC(0.23, 0.83, "BPIX layer 2"); + c.SetGrid(); + c.SaveAs("bpix_layer2_hit_rate.png"); + c.SaveAs("bpix_layer2_hit_rate.pdf"); + c.SaveAs("bpix_layer2_hit_rate.C"); + c.Clear(); + gSystem->Exec("mv bpix_layer2_hit_rate.png Hit_Rate_Plots"); + gSystem->Exec("mv bpix_layer2_hit_rate.pdf Hit_Rate_Plots"); + gSystem->Exec("mv bpix_layer2_hit_rate.C Hit_Rate_Plots"); + + //----------------------------------------------------------------------------------------------- + + //++++++++++++++++++++++++++++++++ BPIX layer 3 hit rate ++++++++++++++++++++++++++++++++++++++++++++ + + TGraphErrors gr_hit_rate_BPIX_layer3( + runNumber_VecD, hit_rate_BPIX_layer3_VecD, runNumber_err_VecD, hit_rate_BPIX_layer3_err_VecD); + gr_hit_rate_BPIX_layer3.GetXaxis()->SetTitle("Run Number"); + gr_hit_rate_BPIX_layer3.GetXaxis()->SetLabelSize(0.04); + gr_hit_rate_BPIX_layer3.GetXaxis()->SetNoExponent(); + gr_hit_rate_BPIX_layer3.GetXaxis()->SetNdivisions(5); + gr_hit_rate_BPIX_layer3.GetYaxis()->SetTitle("Hit Rate (Hz)"); + gr_hit_rate_BPIX_layer3.GetXaxis()->SetTitleSize(0.05); + gr_hit_rate_BPIX_layer3.GetYaxis()->SetLabelSize(0.05); + gr_hit_rate_BPIX_layer3.GetYaxis()->SetTitleSize(0.05); + gr_hit_rate_BPIX_layer3.SetMarkerStyle(20); + gr_hit_rate_BPIX_layer3.SetMarkerSize(1.4); + gr_hit_rate_BPIX_layer3.SetMarkerColor(2); + gr_hit_rate_BPIX_layer3.SetTitle(""); + gr_hit_rate_BPIX_layer3.Draw("AP"); + top_right_Title.DrawLatexNDC(0.79, 0.94, "cosmic rays"); + detector.DrawLatexNDC(0.23, 0.83, "BPIX layer 3"); + c.SetGrid(); + c.SaveAs("bpix_layer3_hit_rate.png"); + c.SaveAs("bpix_layer3_hit_rate.pdf"); + c.SaveAs("bpix_layer3_hit_rate.C"); + c.Clear(); + gSystem->Exec("mv bpix_layer3_hit_rate.png Hit_Rate_Plots"); + gSystem->Exec("mv bpix_layer3_hit_rate.pdf Hit_Rate_Plots"); + gSystem->Exec("mv bpix_layer3_hit_rate.C Hit_Rate_Plots"); + + //----------------------------------------------------------------------------------------------- + + //++++++++++++++++++++++++++++++++ BPIX layer 4 hit rate ++++++++++++++++++++++++++++++++++++++++++++ + + TGraphErrors gr_hit_rate_BPIX_layer4( + runNumber_VecD, hit_rate_BPIX_layer4_VecD, runNumber_err_VecD, hit_rate_BPIX_layer4_err_VecD); + gr_hit_rate_BPIX_layer4.GetXaxis()->SetTitle("Run Number"); + gr_hit_rate_BPIX_layer4.GetXaxis()->SetLabelSize(0.04); + gr_hit_rate_BPIX_layer4.GetXaxis()->SetNoExponent(); + gr_hit_rate_BPIX_layer4.GetXaxis()->SetNdivisions(5); + gr_hit_rate_BPIX_layer4.GetYaxis()->SetTitle("Hit Rate (Hz)"); + gr_hit_rate_BPIX_layer4.GetXaxis()->SetTitleSize(0.05); + gr_hit_rate_BPIX_layer4.GetYaxis()->SetLabelSize(0.05); + gr_hit_rate_BPIX_layer4.GetYaxis()->SetTitleSize(0.05); + gr_hit_rate_BPIX_layer4.SetMarkerStyle(20); + gr_hit_rate_BPIX_layer4.SetMarkerSize(1.4); + gr_hit_rate_BPIX_layer4.SetMarkerColor(2); + gr_hit_rate_BPIX_layer4.SetTitle(""); + gr_hit_rate_BPIX_layer4.Draw("AP"); + top_right_Title.DrawLatexNDC(0.79, 0.94, "cosmic rays"); + detector.DrawLatexNDC(0.23, 0.83, "BPIX layer 4"); + c.SetGrid(); + c.SaveAs("bpix_layer4_hit_rate.png"); + c.SaveAs("bpix_layer4_hit_rate.pdf"); + c.SaveAs("bpix_layer4_hit_rate.C"); + c.Clear(); + gSystem->Exec("mv bpix_layer4_hit_rate.png Hit_Rate_Plots"); + gSystem->Exec("mv bpix_layer4_hit_rate.pdf Hit_Rate_Plots"); + gSystem->Exec("mv bpix_layer4_hit_rate.C Hit_Rate_Plots"); + + //----------------------------------------------------------------------------------------------- + + c.Close(); + + //----------------------------------------------------------------------------------------------- + // Weighted Mean calculation - Hit Rate + //----------------------------------------------------------------------------------------------- + + double total_weight = 0; + double weighted_mean_hit_rate; + double weighted_mean_hit_rate_PIX; + double weighted_mean_hit_rate_BPIX; + double weighted_mean_hit_rate_BPIX_layer1; + double weighted_mean_hit_rate_BPIX_layer2; + double weighted_mean_hit_rate_BPIX_layer3; + double weighted_mean_hit_rate_BPIX_layer4; + double weighted_mean_hit_rate_FPIX; + double weighted_mean_hit_rate_FPIX_disk1; + double weighted_mean_hit_rate_FPIX_disk2; + double weighted_mean_hit_rate_FPIX_disk3; + double weighted_mean_hit_rate_FPIX_disk1_plus; + double weighted_mean_hit_rate_FPIX_disk2_plus; + double weighted_mean_hit_rate_FPIX_disk3_plus; + double weighted_mean_hit_rate_FPIX_disk1_minus; + double weighted_mean_hit_rate_FPIX_disk2_minus; + double weighted_mean_hit_rate_FPIX_disk3_minus; + + // ---------- Weighted Hit Rate Calculation ------------// + for (int k = 0; k < j; k++) // Loop over all runs(without 0 or negative runtime) to get weight per run + { + weight.push_back(hits.at(k) / nTotalHits); + } + + for (int a = 0; a < j; + a++) // Loop over runs(without 0 or negative runtime) to calculate the weighted mean hit rate per PIXEL Layer + { + weighted_mean_hit_rate_PIX += hit_rate_PIX.at(a) * weight.at(a); + weighted_mean_hit_rate_BPIX += hit_rate_BPIX.at(a) * weight.at(a); + weighted_mean_hit_rate_BPIX_layer1 += hit_rate_BPIX_layer1.at(a) * weight.at(a); + weighted_mean_hit_rate_BPIX_layer2 += hit_rate_BPIX_layer2.at(a) * weight.at(a); + weighted_mean_hit_rate_BPIX_layer3 += hit_rate_BPIX_layer3.at(a) * weight.at(a); + weighted_mean_hit_rate_BPIX_layer4 += hit_rate_BPIX_layer4.at(a) * weight.at(a); + weighted_mean_hit_rate_FPIX += hit_rate_FPIX.at(a) * weight.at(a); + weighted_mean_hit_rate_FPIX_disk1 += hit_rate_FPIX_disk1.at(a) * weight.at(a); + weighted_mean_hit_rate_FPIX_disk2 += hit_rate_FPIX_disk2.at(a) * weight.at(a); + weighted_mean_hit_rate_FPIX_disk3 += hit_rate_FPIX_disk3.at(a) * weight.at(a); + weighted_mean_hit_rate_FPIX_disk1_plus += hit_rate_FPIX_disk1_plus.at(a) * weight.at(a); + weighted_mean_hit_rate_FPIX_disk2_plus += hit_rate_FPIX_disk2_plus.at(a) * weight.at(a); + weighted_mean_hit_rate_FPIX_disk3_plus += hit_rate_FPIX_disk3_plus.at(a) * weight.at(a); + weighted_mean_hit_rate_FPIX_disk1_minus += hit_rate_FPIX_disk1_minus.at(a) * weight.at(a); + weighted_mean_hit_rate_FPIX_disk2_minus += hit_rate_FPIX_disk2_minus.at(a) * weight.at(a); + weighted_mean_hit_rate_FPIX_disk3_minus += hit_rate_FPIX_disk3_minus.at(a) * weight.at(a); + } + + //----------------------------------------------------------------------------------------------- + // Summary Plot for hit rate in BPIX + //----------------------------------------------------------------------------------------------- + TCanvas *canvas = new TCanvas("canvas", "canvas", 324, 57, 953, 866); + canvas->SetFillColor(0); + canvas->SetBorderMode(0); + canvas->SetBorderSize(2); + canvas->SetGridx(); + canvas->SetGridy(); + canvas->SetTickx(1); + canvas->SetTicky(1); + canvas->SetLeftMargin(0.1608833); + canvas->SetRightMargin(0.05152471); + + canvas->SetFrameLineWidth(3); + canvas->SetFrameBorderMode(0); + canvas->SetFrameLineWidth(3); + canvas->SetFrameBorderMode(0); + + TLatex tex; + tex.DrawLatexNDC(0.4, 0.8, "Rate Summary"); + tex.SetLineWidth(2); + tex.SetTextFont(62); + tex.Draw(); + + TH1F hb_BPIX("hb_BPIX", "Rate Summary BPIX", 6, 0, 6); + hb_BPIX.SetFillColor(6); + hb_BPIX.SetBarWidth(0.6); + hb_BPIX.SetBarOffset(0.25); + hb_BPIX.SetStats(0); + hb_BPIX.GetXaxis()->SetLabelFont(42); + hb_BPIX.GetXaxis()->SetLabelOffset(0.012); + hb_BPIX.GetXaxis()->SetLabelSize(0.06); + hb_BPIX.GetXaxis()->SetTitleSize(0.05); + hb_BPIX.GetXaxis()->SetTitleFont(42); + hb_BPIX.GetYaxis()->SetTitle("Average Hit Rate (Hz)"); + hb_BPIX.GetYaxis()->SetLabelFont(42); + hb_BPIX.GetYaxis()->SetLabelSize(0.05); + hb_BPIX.GetYaxis()->SetTitleSize(0.05); + hb_BPIX.GetYaxis()->SetTitleOffset(0); + + gStyle->SetPaintTextFormat("1.3f"); + + tex.DrawLatexNDC(0.4, 0.8, "Rate Summary BPIX"); + tex.SetLineWidth(2); + tex.SetTextFont(62); + tex.Draw(); + + Bar_Ytitle_BPIX[0] = weighted_mean_hit_rate_PIX; + Bar_Ytitle_BPIX[1] = weighted_mean_hit_rate_BPIX; + Bar_Ytitle_BPIX[2] = weighted_mean_hit_rate_BPIX_layer1; + Bar_Ytitle_BPIX[3] = weighted_mean_hit_rate_BPIX_layer2; + Bar_Ytitle_BPIX[4] = weighted_mean_hit_rate_BPIX_layer3; + Bar_Ytitle_BPIX[5] = weighted_mean_hit_rate_BPIX_layer4; + + for (int i = 1; i <= 6; i++) { + hb_BPIX.SetBinContent(i, Bar_Ytitle_BPIX[i - 1]); + hb_BPIX.GetXaxis()->SetBinLabel(i, Bar_Xtitle_BPIX[i - 1].c_str()); + } + + TString summary_chart_title; + TString Format[3] = {"png", "pdf", "C"}; + + hb_BPIX.Draw("bTEXT"); + summary_chart_title = "SummaryChart_HitRate_BPIX"; + + for (int i = 0; i < 3; i++) { + TString filename = summary_chart_title + "." + Format[i]; + canvas->SaveAs(filename.Data()); + TString mv_cmd = "mv " + filename + " Hit_Rate_Plots"; + gSystem->Exec(mv_cmd.Data()); + } + canvas->Clear(); + + //----------------------------------------------------------------------------------------------- + // Summary Plot for hit rate in FPIX + //----------------------------------------------------------------------------------------------- + + TH1F hb_FPIX("hb_FPIX", "Rate Summary FPIX", 11, 0, 11); + hb_FPIX.SetFillColor(6); + hb_FPIX.SetBarWidth(0.6); + hb_FPIX.SetBarOffset(0.25); + hb_FPIX.SetStats(0); + hb_FPIX.GetXaxis()->SetLabelFont(42); + hb_FPIX.GetXaxis()->SetLabelOffset(0.012); + hb_FPIX.GetXaxis()->SetLabelSize(0.04); + hb_FPIX.GetXaxis()->SetTitleSize(0.05); + hb_FPIX.GetXaxis()->SetTitleFont(42); + hb_FPIX.GetYaxis()->SetTitle("Average Hit Rate (Hz)"); + hb_FPIX.GetYaxis()->SetLabelFont(42); + hb_FPIX.GetYaxis()->SetLabelSize(0.05); + hb_FPIX.GetYaxis()->SetTitleSize(0.05); + hb_FPIX.GetYaxis()->SetTitleOffset(0); + + gStyle->SetPaintTextFormat("1.3f"); + + Bar_Ytitle_FPIX[0] = weighted_mean_hit_rate_PIX; + Bar_Ytitle_FPIX[1] = weighted_mean_hit_rate_FPIX; + Bar_Ytitle_FPIX[2] = weighted_mean_hit_rate_FPIX_disk1; + Bar_Ytitle_FPIX[3] = weighted_mean_hit_rate_FPIX_disk1_plus; + Bar_Ytitle_FPIX[4] = weighted_mean_hit_rate_FPIX_disk1_minus; + Bar_Ytitle_FPIX[5] = weighted_mean_hit_rate_FPIX_disk2; + Bar_Ytitle_FPIX[6] = weighted_mean_hit_rate_FPIX_disk2_plus; + Bar_Ytitle_FPIX[7] = weighted_mean_hit_rate_FPIX_disk2_minus; + Bar_Ytitle_FPIX[8] = weighted_mean_hit_rate_FPIX_disk3; + Bar_Ytitle_FPIX[9] = weighted_mean_hit_rate_FPIX_disk3_plus; + Bar_Ytitle_FPIX[10] = weighted_mean_hit_rate_FPIX_disk3_minus; + + for (int i = 1; i <= 11; i++) { + hb_FPIX.SetBinContent(i, Bar_Ytitle_FPIX[i - 1]); + hb_FPIX.GetXaxis()->SetBinLabel(i, Bar_Xtitle_FPIX[i - 1].c_str()); + } + + hb_FPIX.Draw("bTEXT"); + summary_chart_title = "SummaryChart_HitRate_FPIX"; + + for (int i = 0; i < 3; i++) { + TString filename = summary_chart_title + "." + Format[i]; + canvas->SaveAs(filename.Data()); + TString mv_cmd = "mv " + filename + " Hit_Rate_Plots"; + gSystem->Exec(mv_cmd.Data()); + } + canvas->Clear(); + + //----------------------------------------------------------------------------------------------- + // Summary Plot for hit rate in PIXEL + //----------------------------------------------------------------------------------------------- + + TH1F hb_PIXEL("hb_PIXEL", "Rate Summary PIXEL", 10, 0, 10); + hb_PIXEL.SetFillColor(6); + hb_PIXEL.SetBarWidth(0.6); + hb_PIXEL.SetBarOffset(0.25); + hb_PIXEL.SetStats(0); + hb_PIXEL.GetXaxis()->SetLabelFont(42); + hb_PIXEL.GetXaxis()->SetLabelOffset(0.012); + hb_PIXEL.GetXaxis()->SetLabelSize(0.05); + hb_PIXEL.GetXaxis()->SetTitleSize(0.05); + hb_PIXEL.GetXaxis()->SetTitleFont(42); + hb_PIXEL.GetYaxis()->SetTitle("Average Hit Rate (Hz)"); + hb_PIXEL.GetYaxis()->SetLabelFont(42); + hb_PIXEL.GetYaxis()->SetLabelSize(0.05); + hb_PIXEL.GetYaxis()->SetTitleSize(0.05); + hb_PIXEL.GetYaxis()->SetTitleOffset(0); + + gStyle->SetPaintTextFormat("1.3f"); + + Bar_Ytitle_PIXEL[0] = weighted_mean_hit_rate_PIX; + Bar_Ytitle_PIXEL[1] = weighted_mean_hit_rate_BPIX; + Bar_Ytitle_PIXEL[2] = weighted_mean_hit_rate_BPIX_layer1; + Bar_Ytitle_PIXEL[3] = weighted_mean_hit_rate_BPIX_layer2; + Bar_Ytitle_PIXEL[4] = weighted_mean_hit_rate_BPIX_layer3; + Bar_Ytitle_PIXEL[5] = weighted_mean_hit_rate_BPIX_layer4; + Bar_Ytitle_PIXEL[6] = weighted_mean_hit_rate_FPIX; + Bar_Ytitle_PIXEL[7] = weighted_mean_hit_rate_FPIX_disk1; + Bar_Ytitle_PIXEL[8] = weighted_mean_hit_rate_FPIX_disk2; + Bar_Ytitle_PIXEL[9] = weighted_mean_hit_rate_FPIX_disk3; + + for (int i = 1; i <= 10; i++) { + hb_PIXEL.SetBinContent(i, Bar_Ytitle_PIXEL[i - 1]); + hb_PIXEL.GetXaxis()->SetBinLabel(i, Bar_Xtitle_PIXEL[i - 1].c_str()); + } + + hb_PIXEL.Draw("bTEXT"); + summary_chart_title = "SummaryChart_HitRate_PIXEL"; + + for (int i = 0; i < 3; i++) { + TString filename = summary_chart_title + "." + Format[i]; + canvas->SaveAs(filename.Data()); + TString mv_cmd = "mv " + filename + " Hit_Rate_Plots"; + gSystem->Exec(mv_cmd.Data()); + } + canvas->Clear(); + canvas->Close(); + + std::cout << " Weighted mean PIX: " << weighted_mean_hit_rate_PIX << std::endl; + std::cout << " Weighted mean BPIX: " << weighted_mean_hit_rate_BPIX << std::endl; + std::cout << " Weighted mean BPIX layer 1: " << weighted_mean_hit_rate_BPIX_layer1 << std::endl; + std::cout << " Weighted mean BPIX layer 2 : " << weighted_mean_hit_rate_BPIX_layer2 << std::endl; + std::cout << " Weighted mean BPIX layer 3: " << weighted_mean_hit_rate_BPIX_layer3 << std::endl; + std::cout << " Weighted mean BPIX layer 4: " << weighted_mean_hit_rate_BPIX_layer4 << std::endl; + std::cout << " Weighted mean FPIX : " << weighted_mean_hit_rate_FPIX << std::endl; + std::cout << " Weighted mean FPIX disk 1: " << weighted_mean_hit_rate_FPIX_disk1 << std::endl; + std::cout << " Weighted mean FPIX disk 2: " << weighted_mean_hit_rate_FPIX_disk2 << std::endl; + std::cout << " Weighted mean FPIX disk 3: " << weighted_mean_hit_rate_FPIX_disk3 << std::endl; + std::cout << " Weighted mean FPIX disk 1+: " << weighted_mean_hit_rate_FPIX_disk1_plus << std::endl; + std::cout << " Weighted mean FPIX disk 2+: " << weighted_mean_hit_rate_FPIX_disk2_plus << std::endl; + std::cout << " Weighted mean FPIX disk 3+: " << weighted_mean_hit_rate_FPIX_disk3_plus << std::endl; + std::cout << " Weighted mean FPIX disk 1-: " << weighted_mean_hit_rate_FPIX_disk1_minus << std::endl; + std::cout << " Weighted mean FPIX disk 2-: " << weighted_mean_hit_rate_FPIX_disk2_minus << std::endl; + std::cout << " Weighted mean FPIX disk 3-: " << weighted_mean_hit_rate_FPIX_disk3_minus << std::endl; +} \ No newline at end of file diff --git a/Alignment/TrackerAlignment/plugins/CosmicRateAnalyzer.cc b/Alignment/TrackerAlignment/plugins/CosmicRateAnalyzer.cc index 7fc188304a817..1c60b428addd0 100644 --- a/Alignment/TrackerAlignment/plugins/CosmicRateAnalyzer.cc +++ b/Alignment/TrackerAlignment/plugins/CosmicRateAnalyzer.cc @@ -106,6 +106,8 @@ class CosmicRateAnalyzer : public edm::one::EDAnalyzer v_ntrk; int ntrk; int ntrk_runnum; + //---------- Branch Variables in tree Run ----------// + // a) Track Rate int number_of_tracks; int number_of_tracks_PIX; int number_of_tracks_FPIX; @@ -138,6 +161,27 @@ class CosmicRateAnalyzer : public edm::one::EDAnalyzer pt; std::vector charge; std::vector chi2; @@ -150,12 +194,20 @@ class CosmicRateAnalyzer : public edm::one::EDAnalyzer dz; std::vector nvh; std::vector DTtime; + std::vector nh_PIXEL; std::vector nh_BPIX; std::vector nh_FPIX; std::vector nh_TIB; std::vector nh_TOB; std::vector nh_TID; std::vector nh_TEC; + + //------ Temporary variables to store Hits per track till the Event tree is filled -------// + //FPIX+/-, BPIX+/-,TEC+/-, TID+/- can also be added similar way in case required + int nHits_PIXEL; + + //------ Variables to keep track of total events and tracks ------// + int nTotalTracks, nTotalEvents; }; // @@ -183,6 +235,9 @@ CosmicRateAnalyzer::CosmicRateAnalyzer(const edm::ParameterSet& iConfig) treeEvent = fs->make("Event", ""); treeRun = fs->make("Run", ""); treeCluster = fs->make("Cluster", ""); + + nTotalTracks = 0; + nTotalEvents = 0; } CosmicRateAnalyzer::~CosmicRateAnalyzer() { @@ -206,6 +261,7 @@ void CosmicRateAnalyzer::ClearInEventLoop() { dz.clear(); nvh.clear(); DTtime.clear(); + nh_PIXEL.clear(); nh_BPIX.clear(); nh_FPIX.clear(); nh_TIB.clear(); @@ -258,6 +314,8 @@ void CosmicRateAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup nh_TID.push_back(itTrack1->hitPattern().numberOfValidStripTIDHits()); nh_TEC.push_back(itTrack1->hitPattern().numberOfValidStripTECHits()); + nHits_PIXEL = 0; + int nhitinBPIX = 0; int nhitinFPIX = 0; int nhitinPIXEL = 0; @@ -274,15 +332,35 @@ void CosmicRateAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup for (auto const& hit1 : itTrack1->recHits()) { const DetId detId1(hit1->geographicalId()); const int subdetId1 = detId1.subdetId(); + uint32_t detid_db = detId1.rawId(); if (!hit1->isValid()) continue; // only real hits count as in itTrack1->numberOfValidHits() + hit_Total++; /////////////////////////////////////////////////////////////////////////////////////////////////// // Hit information in PixelBarrel // /////////////////////////////////////////////////////////////////////////////////////////////////// if (PixelSubdetector::PixelBarrel == subdetId1) { - ++nhitinBPIX; - ++nhitinPIXEL; + ++nhitinBPIX; //for cosmic track rate evaluation + ++nhitinPIXEL; //for cosmic track rate evaluation + ++nHits_PIXEL; // for PIXEL hits per track in Event Tree + ++hit_PIX; // for cosmic PIXEL hit rates per layer + ++hit_BPIX; // for cosmic PIXEL hit rates per layer + + int BPIX_layer = (tTopo->pxbLayer(detid_db)); + if (BPIX_layer == 1) { + ++hit_BPIX_layer1; // for cosmic PIXEL hit rates per layer + } else if (BPIX_layer == 2) { + ++hit_BPIX_layer2; // for cosmic PIXEL hit rates per layer + } else if (BPIX_layer == 3) { + ++hit_BPIX_layer3; // for cosmic PIXEL hit rates per layer + } else if (BPIX_layer == 4) { + ++hit_BPIX_layer4; // for cosmic PIXEL hit rates per layer + } else { + std::cout << "CAUTION : Check Phase! BPIX layer not in {1,2,3}!" << std::endl; + std::cout << "Layer is : " << BPIX_layer << std::endl; + } + } /////////////////////////////////////////////////////////////////////////////////////////////////// // Hit information in PixelEndcap // @@ -290,6 +368,41 @@ void CosmicRateAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup else if (PixelSubdetector::PixelEndcap == subdetId1) { ++nhitinFPIX; ++nhitinPIXEL; + + ++nHits_PIXEL; + ++hit_PIX; // for cosmic PIXEL hit rates per layer + ++hit_FPIX; // for cosmic PIXEL hit rates per layer + + int FPIX_side = (tTopo->pxfSide(detid_db)); + int FPIX_disk = (tTopo->pxfDisk(detid_db)); + + if (FPIX_disk == 1) { + ++hit_FPIX_disk1; // for cosmic PIXEL hit rates per layer + } else if (FPIX_disk == 2) { + ++hit_FPIX_disk2; // for cosmic PIXEL hit rates per layer + } else if (FPIX_disk == 3) { + ++hit_FPIX_disk3; // for cosmic PIXEL hit rates per layer + } else { + std::cout << "CAUTION : Check Phase! FPIX disk not in {1,2}!" << std::endl; + std::cout << "Disk is : " << FPIX_disk << std::endl; + } + + if (FPIX_disk == 1 && FPIX_side == 1) { + ++hit_FPIX_disk1_minus; // for cosmic PIXEL hit rates per layer + } else if (FPIX_disk == 1 && FPIX_side == 2) { + ++hit_FPIX_disk1_plus; // for cosmic PIXEL hit rates per layer + } else if (FPIX_disk == 2 && FPIX_side == 1) { + ++hit_FPIX_disk2_minus; // for cosmic PIXEL hit rates per layer + } else if (FPIX_disk == 2 && FPIX_side == 2) { + ++hit_FPIX_disk2_plus; // for cosmic PIXEL hit rates per layer + } else if (FPIX_disk == 3 && FPIX_side == 1) { + ++hit_FPIX_disk3_minus; // for cosmic PIXEL hit rates per layer + } else if (FPIX_disk == 3 && FPIX_side == 2) { + ++hit_FPIX_disk3_plus; // for cosmic PIXEL hit rates per layer + } else { + std::cout << "CAUTION : FPIX side not in {1,2}!" << std::endl; + } + } ////////////////////////////////////////////////////////////////////////////////////////////////// // Hit information in TEC // @@ -331,6 +444,8 @@ void CosmicRateAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup countHit++; } // for Loop over Hits + nh_PIXEL.push_back(nHits_PIXEL); + if (nhitinBPIX > 0) { track_BPIX++; } @@ -367,6 +482,7 @@ void CosmicRateAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup ntrk++; ntrk_runnum++; + nTotalTracks++; } // for Loop over TrackCollection events++; @@ -388,13 +504,16 @@ void CosmicRateAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup time = mt0.timeAtIpInOut; DTtime.push_back(time); } + treeEvent->Fill(); ClearInEventLoop(); + nTotalEvents++; } //Event Loop // ------------ method called once each job just before starting event loop ------------ void CosmicRateAnalyzer::beginJob() { + //--- Event tree ---// treeEvent->Branch("pt", &pt); treeEvent->Branch("charge", &charge); treeEvent->Branch("chi2", &chi2); @@ -407,6 +526,7 @@ void CosmicRateAnalyzer::beginJob() { treeEvent->Branch("dz", &dz); treeEvent->Branch("nvh", &nvh); treeEvent->Branch("ntrk", &ntrk); + treeEvent->Branch("nHitsPIXEL", &nh_PIXEL); treeEvent->Branch("nHitsBPIX", &nh_BPIX); treeEvent->Branch("nHitsFPIX", &nh_FPIX); treeEvent->Branch("nHitsTIB", &nh_TIB); @@ -415,8 +535,11 @@ void CosmicRateAnalyzer::beginJob() { treeEvent->Branch("nHitsTEC", &nh_TEC); treeEvent->Branch("DTtime", &DTtime); treeEvent->Branch("magField", &magField); + + //--- Run tree ---// treeRun->Branch("run_time", &run_time); treeRun->Branch("runnum", &runnum); + // a) For track Rate Calculation treeRun->Branch("number_of_events", &number_of_events); treeRun->Branch("number_of_tracks", &number_of_tracks); treeRun->Branch("number_of_tracks_PIX", &number_of_tracks_PIX); @@ -430,11 +553,34 @@ void CosmicRateAnalyzer::beginJob() { treeRun->Branch("number_of_tracks_TECP", &number_of_tracks_TECP); treeRun->Branch("number_of_tracks_TECM", &number_of_tracks_TECM); treeRun->Branch("number_of_tracks_TOB", &number_of_tracks_TOB); + // a) For PIXEL Hit Rate Calculation + treeRun->Branch("number_of_hits_Total", &number_of_hits_Total); + treeRun->Branch("number_of_hits_PIX", &number_of_hits_PIX); + treeRun->Branch("number_of_hits_BPIX", &number_of_hits_BPIX); + treeRun->Branch("number_of_hits_BPIX_layer1", &number_of_hits_BPIX_layer1); + treeRun->Branch("number_of_hits_BPIX_layer2", &number_of_hits_BPIX_layer2); + treeRun->Branch("number_of_hits_BPIX_layer3", &number_of_hits_BPIX_layer3); + treeRun->Branch("number_of_hits_BPIX_layer4", &number_of_hits_BPIX_layer4); + treeRun->Branch("number_of_hits_FPIX", &number_of_hits_FPIX); + treeRun->Branch("number_of_hits_FPIX_disk1", &number_of_hits_FPIX_disk1); + treeRun->Branch("number_of_hits_FPIX_disk2", &number_of_hits_FPIX_disk2); + treeRun->Branch("number_of_hits_FPIX_disk3", &number_of_hits_FPIX_disk3); + treeRun->Branch("number_of_hits_FPIX_disk1_plus", &number_of_hits_FPIX_disk1_plus); + treeRun->Branch("number_of_hits_FPIX_disk1_minus", &number_of_hits_FPIX_disk1_minus); + treeRun->Branch("number_of_hits_FPIX_disk2_plus", &number_of_hits_FPIX_disk2_plus); + treeRun->Branch("number_of_hits_FPIX_disk2_minus", &number_of_hits_FPIX_disk2_minus); + treeRun->Branch("number_of_hits_FPIX_disk3_plus", &number_of_hits_FPIX_disk3_plus); + treeRun->Branch("number_of_hits_FPIX_disk3_minus", &number_of_hits_FPIX_disk3_minus); + + //--- Cluster tree ---// treeCluster->Branch("DetID", &DetectorID); } // ------------ method called once each job just after ending the event loop ------------ -void CosmicRateAnalyzer::endJob() {} +void CosmicRateAnalyzer::endJob() { + std::cout << "Total Events: " << nTotalEvents << std::endl; + std::cout << "TotalTracks: " << nTotalTracks << std::endl; +} // ------------ method called when starting to processes a run ------------ void CosmicRateAnalyzer::beginRun(edm::Run const&, edm::EventSetup const&) { @@ -442,6 +588,7 @@ void CosmicRateAnalyzer::beginRun(edm::Run const&, edm::EventSetup const&) { lastrunnum = 0.0; ntrk_runnum = 0.0; events = 0.0; + // a) for Track rate track_BPIX = 0.0; track_FPIX = 0.0; track_PIXEL = 0.0; @@ -453,6 +600,25 @@ void CosmicRateAnalyzer::beginRun(edm::Run const&, edm::EventSetup const&) { track_TID = 0.0; track_TIDM = 0.0; track_TIDP = 0.0; + + // b) for PIXEL hit rate + hit_Total = 0.0; + hit_PIX = 0.0; + hit_BPIX = 0.0; + hit_BPIX_layer1 = 0.0; + hit_BPIX_layer2 = 0.0; + hit_BPIX_layer3 = 0.0; + hit_BPIX_layer4 = 0.0; + hit_FPIX = 0.0; + hit_FPIX_disk1 = 0.0; + hit_FPIX_disk2 = 0.0; + hit_FPIX_disk3 = 0.0; + hit_FPIX_disk1_plus = 0.0; + hit_FPIX_disk1_minus = 0.0; + hit_FPIX_disk2_plus = 0.0; + hit_FPIX_disk2_minus = 0.0; + hit_FPIX_disk3_plus = 0.0; + hit_FPIX_disk3_minus = 0.0; } // ------------ method called when ending the processing of a run ------------ @@ -461,6 +627,7 @@ void CosmicRateAnalyzer::endRun(edm::Run const&, edm::EventSetup const&) { number_of_tracks = ntrk_runnum; run_time = lastruntime; runnum = lastrunnum; + // a) for Track Rate number_of_tracks_PIX = track_PIXEL; number_of_tracks_FPIX = track_FPIX; number_of_tracks_BPIX = track_BPIX; @@ -473,6 +640,25 @@ void CosmicRateAnalyzer::endRun(edm::Run const&, edm::EventSetup const&) { number_of_tracks_TIDM = track_TIDM; number_of_tracks_TIDP = track_TIDP; number_of_events = events; + // b) for PIXEL Hit Rate + number_of_hits_Total = hit_Total; + number_of_hits_PIX = hit_PIX; + number_of_hits_BPIX = hit_BPIX; + number_of_hits_BPIX_layer1 = hit_BPIX_layer1; + number_of_hits_BPIX_layer2 = hit_BPIX_layer2; + number_of_hits_BPIX_layer3 = hit_BPIX_layer3; + number_of_hits_BPIX_layer4 = hit_BPIX_layer4; + number_of_hits_FPIX = hit_FPIX; + number_of_hits_FPIX_disk1 = hit_FPIX_disk1; + number_of_hits_FPIX_disk2 = hit_FPIX_disk2; + number_of_hits_FPIX_disk3 = hit_FPIX_disk3; + number_of_hits_FPIX_disk1_plus = hit_FPIX_disk1_plus; + number_of_hits_FPIX_disk1_minus = hit_FPIX_disk1_minus; + number_of_hits_FPIX_disk2_plus = hit_FPIX_disk2_plus; + number_of_hits_FPIX_disk2_minus = hit_FPIX_disk2_minus; + number_of_hits_FPIX_disk3_plus = hit_FPIX_disk3_plus; + number_of_hits_FPIX_disk3_minus = hit_FPIX_disk3_minus; + treeRun->Fill(); } diff --git a/Alignment/TrackerAlignment/scripts/runListID.sh b/Alignment/TrackerAlignment/scripts/runListID.sh index d5f08915f6cd4..7821dad268fc5 100755 --- a/Alignment/TrackerAlignment/scripts/runListID.sh +++ b/Alignment/TrackerAlignment/scripts/runListID.sh @@ -13,5 +13,5 @@ FILE=\"$CWD/$INPUTFILE\" if [ "$#" == 1 ] then -root -l -b -q "$CMSSW_BASE/src/CosmicRateTool/TrackAnalyzer/macros/CosmicRateTool_MakeIdList.C(${FILE})" +root -l -b -q "$CMSSW_BASE/src/Alignment/TrackerAlignment/macros/CosmicRateTool_MakeIdList.C(${FILE})" fi diff --git a/Alignment/TrackerAlignment/scripts/runPlotter.sh b/Alignment/TrackerAlignment/scripts/runPlotter.sh index e9a98b313854b..7e816706a8dee 100755 --- a/Alignment/TrackerAlignment/scripts/runPlotter.sh +++ b/Alignment/TrackerAlignment/scripts/runPlotter.sh @@ -13,13 +13,15 @@ FILE=\"$CWD/$INPUTFILE\" if [ "$#" == 1 ] then - root -l -b -q "$CMSSW_BASE/src/CosmicRateTool/TrackAnalyzer/macros/CosmicRateTool_CosmicRates.C(${FILE})" + root -l -b -q "$CMSSW_BASE/src/Alignment/TrackerAlignment/macros/CosmicRateTool_CosmicRates.C(${FILE})" + root -l -b -q "$CMSSW_BASE/src/Alignment/TrackerAlignment/macros/CosmicRateTool_PIXEL_HitRates.C(${FILE})" fi runMin=$2 runMax=$3 if [ "$#" -gt 2 ] then - root -l -b -q "$CMSSW_BASE/src/CosmicRateTool/TrackAnalyzer/macros/CosmicRateTool_CosmicRates.C(${FILE},$runMin,$runMax)" + root -l -b -q "$CMSSW_BASE/src/Alignment/TrackerAlignment/macros/CosmicRateTool_CosmicRates.C(${FILE},$runMin,$runMax)" + root -l -b -q "$CMSSW_BASE/src/Alignment/TrackerAlignment/macros/CosmicRateTool_PIXEL_HitRates.C(${FILE},$runMin,$runMax)" fi -root -l -b -q "$CMSSW_BASE/src/CosmicRateTool/TrackAnalyzer/macros/CosmicRateTool_Kinematics.C(${FILE})" +root -l -b -q "$CMSSW_BASE/src/Alignment/TrackerAlignment/macros/CosmicRateTool_Kinematics.C(${FILE})"