diff --git a/UserTools/FMVEfficiency/FMVEfficiency.cpp b/UserTools/FMVEfficiency/FMVEfficiency.cpp index 5a35a682b..c3b488751 100644 --- a/UserTools/FMVEfficiency/FMVEfficiency.cpp +++ b/UserTools/FMVEfficiency/FMVEfficiency.cpp @@ -217,8 +217,14 @@ bool FMVEfficiency::Execute(){ if (not get_ok) { Log("EventDisplay Tool: Error retrieving MrdDigitChankeys, did you run TimeClustering beforehand",v_error,verbosity); return false;} } - if (isData) m_data->Stores["ANNIEEvent"]->Get("TDCData",TDCData); - else m_data->Stores["ANNIEEvent"]->Get("TDCData",TDCData_MC); + bool get_tdc; + if (isData) get_tdc = m_data->Stores["ANNIEEvent"]->Get("TDCData",TDCData); + else get_tdc = m_data->Stores["ANNIEEvent"]->Get("TDCData",TDCData_MC); + + if (!get_tdc){ + if (verbosity > 0) std::cout <<"FMVEfficiency tool: No TDCData available! Abort"< hit_fmv_detkeys_first, hit_fmv_detkeys_second; - std::vector vector_fmv_times_first, vector_fmv_times_second; + std::vector> vector_fmv_times_first, vector_fmv_times_second; if (isData){ if(TDCData){ @@ -315,27 +321,33 @@ bool FMVEfficiency::Execute(){ hit_fmv_detkeys_first.push_back(detkey); double fmv_time=0; int nhits_fmv=0; + std::vector single_fmv_times; for(auto&& hitsonthismrdpmt : anmrdpmt.second){ fmv_time+=hitsonthismrdpmt.GetTime(); nhits_fmv++; + single_fmv_times.push_back(hitsonthismrdpmt.GetTime()); } if (nhits_fmv!=0) fmv_time/=nhits_fmv; - vector_fmv_times_first.push_back(fmv_time); + vector_fmv_times_first.push_back(single_fmv_times); } else { - /*if (detkey == 14 || detkey == 18 || detkey == 19) continue; + //The following code with channelkey changes was necessary during a period where channels were re-mapped + /*if (detkey == 14 || detkey == 18 || detkey == 19) continue; if (detkey == 23) detkey = 14; else if (detkey == 24) detkey = 18; else if (detkey == 25) detkey = 19;*/ + hit_fmv_detkeys_second.push_back(detkey); + std::vector single_fmv_times; double fmv_time = 0; int nhits_fmv = 0; for(auto&&hitsonthismrdpmt : anmrdpmt.second){ fmv_time+=hitsonthismrdpmt.GetTime(); nhits_fmv++; + single_fmv_times.push_back(hitsonthismrdpmt.GetTime()); } if (nhits_fmv!=0) fmv_time/=nhits_fmv; - vector_fmv_times_second.push_back(fmv_time); + vector_fmv_times_second.push_back(single_fmv_times); } } } @@ -359,23 +371,27 @@ bool FMVEfficiency::Execute(){ hit_fmv_detkeys_first.push_back(detkey); double fmv_time=0; int nhits_fmv=0; + std::vector single_fmv_times; for(auto&& hitsonthismrdpmt : anmrdpmt.second){ fmv_time+=hitsonthismrdpmt.GetTime(); nhits_fmv++; + single_fmv_times.push_back(hitsonthismrdpmt.GetTime()); } if (nhits_fmv!=0) fmv_time/=nhits_fmv; - vector_fmv_times_first.push_back(fmv_time); + vector_fmv_times_first.push_back(single_fmv_times); } else { hit_fmv_detkeys_second.push_back(detkey); double fmv_time = 0; int nhits_fmv = 0; + std::vector single_fmv_times; for(auto&&hitsonthismrdpmt : anmrdpmt.second){ fmv_time+=hitsonthismrdpmt.GetTime(); nhits_fmv++; + single_fmv_times.push_back(hitsonthismrdpmt.GetTime()); } if (nhits_fmv!=0) fmv_time/=nhits_fmv; - vector_fmv_times_second.push_back(fmv_time); + vector_fmv_times_second.push_back(single_fmv_times); } } } @@ -402,11 +418,12 @@ bool FMVEfficiency::Execute(){ if (pmt_cluster){ if (npaddles_Layer1 == 1){ for (unsigned int i_fmv = 0; i_fmv < hit_fmv_detkeys_first.size(); i_fmv++){ - time_diff_tank_Layer1->Fill(vector_fmv_times_first.at(i_fmv)-cluster_time); + for (int i_t = 0; i_t < vector_fmv_times_first.size(); i_t++){ + time_diff_tank_Layer1->Fill(vector_fmv_times_first.at(i_fmv).at(i_t)-cluster_time); if (isData){ - if ((vector_fmv_times_first.at(i_fmv)-cluster_time)<740 || (vector_fmv_times_first.at(i_fmv)-cluster_time)>840) continue; + if ((vector_fmv_times_first.at(i_fmv).at(i_t)-cluster_time)<740 || (vector_fmv_times_first.at(i_fmv).at(i_t)-cluster_time)>840) continue; } else { - if ((vector_fmv_times_first.at(i_fmv)-cluster_time)<-100 || (vector_fmv_times_first.at(i_fmv)-cluster_time)>100) continue; + if ((vector_fmv_times_first.at(i_fmv).at(i_t)-cluster_time)<-100 || (vector_fmv_times_first.at(i_fmv).at(i_t)-cluster_time)>100) continue; } unsigned long detkey_first = hit_fmv_detkeys_first.at(i_fmv); fmv_tank_secondlayer_expected.at(detkey_first)++; @@ -414,15 +431,17 @@ bool FMVEfficiency::Execute(){ fmv_tank_secondlayer_observed.at(detkey_first)++; } } + } } if (npaddles_Layer2 == 1){ for (unsigned int i_fmv = 0; i_fmv < hit_fmv_detkeys_second.size(); i_fmv++){ - time_diff_tank_Layer2->Fill(vector_fmv_times_second.at(i_fmv)-cluster_time); + for (int i_t=0; i_t < vector_fmv_times_second.at(i_fmv).size(); i_t++){ + time_diff_tank_Layer2->Fill(vector_fmv_times_second.at(i_fmv).at(i_t)-cluster_time); if (isData){ - if ((vector_fmv_times_second.at(i_fmv)-cluster_time)<740 || (vector_fmv_times_second.at(i_fmv)-cluster_time)>840) continue; + if ((vector_fmv_times_second.at(i_fmv).at(i_t)-cluster_time)<740 || (vector_fmv_times_second.at(i_fmv).at(i_t)-cluster_time)>840) continue; } else { - if ((vector_fmv_times_second.at(i_fmv)-cluster_time)<-100 || (vector_fmv_times_second.at(i_fmv)-cluster_time)>100) continue; + if ((vector_fmv_times_second.at(i_fmv).at(i_t)-cluster_time)<-100 || (vector_fmv_times_second.at(i_fmv).at(i_t)-cluster_time)>100) continue; } unsigned long detkey_second = hit_fmv_detkeys_second.at(i_fmv); unsigned long detkey_first = detkey_second - n_veto_pmts/2; @@ -431,6 +450,7 @@ bool FMVEfficiency::Execute(){ fmv_tank_firstlayer_observed.at(detkey_first)++; } } + } } } } @@ -438,14 +458,31 @@ bool FMVEfficiency::Execute(){ // -------------------------------- //----Evaluate MRD coincidences----- // -------------------------------- - - //Only use events with one track in the MRD - if (MrdTimeClusters.size()!=1) return true; + //Change: Actually select on one fitted track instead of one subevent (cluster) + + //Get fitted MRD track + int numsubevs, numtracksinev; + m_data->Stores["MRDTracks"]->Get("NumMrdSubEvents",numsubevs); + m_data->Stores["MRDTracks"]->Get("NumMrdTracks",numtracksinev); + m_data->Stores["MRDTracks"]->Get("MRDTracks",theMrdTracks); + if (numsubevs==0) { + if (verbosity > 2) std::cout <<"No subevents! Abort execution of tool"< 2) std::cout <<"Event does not have 1 track. Abort FMVEfficiency tool (Event has "< trackssubev; + m_data->CStore.Get("TracksSubEvs",trackssubev); + + if (verbosity > 2) std::cout <<"trackssubev.size(): "< single_mrdcluster = MrdTimeClusters.at(thiscluster); int numdigits = single_mrdcluster.size(); if (numdigits >=50) return true; //reject noise events @@ -463,11 +500,6 @@ bool FMVEfficiency::Execute(){ } if (n_pmts!=0) mrd_time/=n_pmts; - //Get fitted MRD track - int numsubevs, numtracksinev; - m_data->Stores["MRDTracks"]->Get("NumMrdSubEvents",numsubevs); - m_data->Stores["MRDTracks"]->Get("NumMrdTracks",numtracksinev); - m_data->Stores["MRDTracks"]->Get("MRDTracks",theMrdTracks); BoostStore* thisTrackAsBoostStore = &(theMrdTracks->at(0)); std::vector PMTsHit; @@ -502,15 +534,20 @@ bool FMVEfficiency::Execute(){ //if (npaddles_Layer1 == 1){ if (npaddles_Layer1 >= 1 && npaddles_Layer1 <= padPerLayer){ for (unsigned int i_fmv = 0; i_fmv < hit_fmv_detkeys_first.size(); i_fmv++){ - - time_diff_paddle->Fill(hit_fmv_detkeys_first.at(i_fmv),vector_fmv_times_first.at(i_fmv)-mrd_time); + bool found_coinc = false; + for (int i_t = 0; i_t < vector_fmv_times_first.at(i_fmv).size(); i_t++){ + if (found_coinc) continue; + time_diff_paddle->Fill(hit_fmv_detkeys_first.at(i_fmv),vector_fmv_times_first.at(i_fmv).at(i_t)-mrd_time-100); //Check whether MRD & FMV Layer 1 fired in coincidence (time cut) + if (verbosity > 3) std::cout <<"FMV time: "<Fill(hit_fmv_detkeys_first.at(i_fmv)); - time_diff_Layer1->Fill(vector_fmv_times_first.at(i_fmv)-mrd_time); - if (fabs(vector_fmv_times_first.at(i_fmv)-mrd_time)>100.) continue; + time_diff_Layer1->Fill(vector_fmv_times_first.at(i_fmv).at(i_t)-mrd_time); + if (fabs(vector_fmv_times_first.at(i_fmv).at(i_t)-mrd_time-100)>70.) continue; + found_coinc = true; //Get properties of coincident MRD/FMV Layer 1 hit unsigned long detkey_first = hit_fmv_detkeys_first.at(i_fmv); + if (verbosity > 3) std::cout <<"detkey: "<Fill(x_layer1-fmv_x); track_diff_y_Layer1->Fill(y_layer1-fmv_firstlayer_y.at(detkey_first)); track_diff_xy_Layer1->Fill(x_layer1-fmv_x,y_layer1-fmv_firstlayer_y.at(detkey_first)); @@ -540,31 +577,40 @@ bool FMVEfficiency::Execute(){ vector_observed_loose_layer2.at(detkey_first)->Fill(x_layer1); std::vector::iterator it = std::find(hit_fmv_detkeys_second.begin(),hit_fmv_detkeys_second.end(),detkey_first+n_veto_pmts/2); int index = std::distance(hit_fmv_detkeys_second.begin(),it); - time_diff_paddle_coinc->Fill(detkey_first+n_veto_pmts/2,vector_fmv_times_second.at(index)-vector_fmv_times_first.at(i_fmv)); + for (int i_t2=0; i_t2 < vector_fmv_times_second.at(index).size(); i_t2++){ + time_diff_paddle_coinc->Fill(detkey_first+n_veto_pmts/2,vector_fmv_times_second.at(index).at(i_t2)-vector_fmv_times_first.at(i_fmv).at(i_t)); + } } fmv_secondlayer_observed.at(detkey_first)++; std::vector::iterator it = std::find(hit_fmv_detkeys_second.begin(),hit_fmv_detkeys_second.end(),detkey_first+n_veto_pmts/2); int index = std::distance(hit_fmv_detkeys_second.begin(),it); - time_diff_paddle_simplecoinc->Fill(detkey_first+n_veto_pmts/2,vector_fmv_times_second.at(index)-vector_fmv_times_first.at(i_fmv)); + for (int i_t2=0; i_t2 < vector_fmv_times_second.at(index).size(); i_t2++){ + time_diff_paddle_simplecoinc->Fill(detkey_first+n_veto_pmts/2,vector_fmv_times_second.at(index).at(i_t2)-vector_fmv_times_first.at(i_fmv).at(i_t)); + } if (hit_chankey_layer1 == detkey_first){ vector_observed_strict_layer2.at(detkey_first)->Fill(x_layer1); fmv_secondlayer_observed_track_strict.at(detkey_first)++; } } + } } } //if (npaddles_Layer2 == 1){ if (npaddles_Layer2 >= 1 && npaddles_Layer2 <=padPerLayer){ for (unsigned int i_fmv = 0; i_fmv < hit_fmv_detkeys_second.size(); i_fmv++){ - - time_diff_paddle->Fill(hit_fmv_detkeys_second.at(i_fmv),vector_fmv_times_second.at(i_fmv)-mrd_time-20); + bool found_coinc = false; + for (int i_t=0; i_t < vector_fmv_times_second.at(i_fmv).size(); i_t++){ + if (found_coinc) continue; + time_diff_paddle->Fill(hit_fmv_detkeys_second.at(i_fmv),vector_fmv_times_second.at(i_fmv).at(i_t)-mrd_time-100); //Check whether MRD & FMV Layer 2 fired in coincidence (time cut) - time_diff_Layer2->Fill(vector_fmv_times_second.at(i_fmv)-mrd_time); + time_diff_Layer2->Fill(vector_fmv_times_second.at(i_fmv).at(i_t)-mrd_time); fmv_layer2->Fill(hit_fmv_detkeys_second.at(i_fmv)); - if (fabs(vector_fmv_times_second.at(i_fmv)-mrd_time-20.)>100.) continue; + if (fabs(vector_fmv_times_second.at(i_fmv).at(i_t)-mrd_time-100.)>70.) continue; + found_coinc = true; + //Get properties of coincident MRD/FMV Layer 2 hit unsigned long detkey_second = hit_fmv_detkeys_second.at(i_fmv); unsigned long detkey_first = detkey_second - n_veto_pmts/2; @@ -594,11 +640,15 @@ bool FMVEfficiency::Execute(){ vector_observed_loose_layer1.at(detkey_first)->Fill(x_layer2); std::vector::iterator it = std::find(hit_fmv_detkeys_first.begin(),hit_fmv_detkeys_first.end(),detkey_first); int index = std::distance(hit_fmv_detkeys_first.begin(),it); - time_diff_paddle_coinc->Fill(detkey_first,vector_fmv_times_first.at(index)-vector_fmv_times_second.at(i_fmv)); + for (int i_t2=0; i_t2 < vector_fmv_times_first.at(index).size(); i_t2++){ + time_diff_paddle_coinc->Fill(detkey_first,vector_fmv_times_first.at(index).at(i_t2)-vector_fmv_times_second.at(i_fmv).at(i_t)); + } } std::vector::iterator it = std::find(hit_fmv_detkeys_first.begin(),hit_fmv_detkeys_first.end(),detkey_first); int index = std::distance(hit_fmv_detkeys_first.begin(),it); - time_diff_paddle_simplecoinc->Fill(detkey_first,vector_fmv_times_first.at(index)-vector_fmv_times_second.at(i_fmv)); + for (int i_t2 = 0; i_t2 < vector_fmv_times_first.at(index).size(); i_t2++){ + time_diff_paddle_simplecoinc->Fill(detkey_first,vector_fmv_times_first.at(index).at(i_t2)-vector_fmv_times_second.at(i_fmv).at(i_t)); + } for (int i_first=0; i_first < (int) hit_fmv_detkeys_first.size(); i_first++){ fmv_layer1_layer2->Fill(hit_fmv_detkeys_first.at(i_first),detkey_second); } @@ -608,6 +658,7 @@ bool FMVEfficiency::Execute(){ fmv_firstlayer_observed_track_strict.at(detkey_first)++; } } + } } } diff --git a/UserTools/FindMrdTracks/FindMrdTracks.cpp b/UserTools/FindMrdTracks/FindMrdTracks.cpp index 0c5922926..bf344cafe 100755 --- a/UserTools/FindMrdTracks/FindMrdTracks.cpp +++ b/UserTools/FindMrdTracks/FindMrdTracks.cpp @@ -94,9 +94,18 @@ bool FindMrdTracks::Execute(){ m_data->Stores["ANNIEEvent"]->Get("TriggerNumber",MCTriggernum); m_data->Stores["ANNIEEvent"]->Get("MCEventNum",MCEventNum); if (!isData) m_data->Stores["ANNIEEvent"]->Get("MCParticles",MCParticles); - get_ok = m_data->Stores.at("ANNIEEvent")->Get("MRDTriggerType",MRDTriggertype); - if (not get_ok){ - Log("FindMrdTracks: Did not find MRDTriggerType in ANNIEEvent. Please check the settings in MRDDataDecoder+BuildANNIEEvent/LoadWCSim?",v_error,verbosity); + uint32_t TriggerWord; + get_ok = m_data->Stores["ANNIEEvent"]->Get("TriggerWord",TriggerWord); + if (get_ok){ + if (TriggerWord == 5) MRDTriggertype = "Beam"; + else if (TriggerWord == 36) MRDTriggertype = "Cosmic"; + } else { + Log("FindMrdTracks tool: Triggerword not available! Extract MRD trigger type from loopback",v_warning,verbosity); + get_ok = m_data->Stores.at("ANNIEEvent")->Get("MRDTriggerType",MRDTriggertype); + if (not get_ok){ + Log("FindMrdTracks: Did not find MRDTriggerType in ANNIEEvent. Please check the settings in MRDDataDecoder+BuildANNIEEvent/LoadWCSim?",v_error,verbosity); + m_data->vars.Set("StopLoop",1); + } } Log("FindMrdTracks tool: MRDTriggertype is "+MRDTriggertype+" (from ANNIEEvent store)",v_debug,verbosity); diff --git a/UserTools/LoadANNIEEvent/LoadANNIEEvent.cpp b/UserTools/LoadANNIEEvent/LoadANNIEEvent.cpp index c0185d63d..eca215941 100644 --- a/UserTools/LoadANNIEEvent/LoadANNIEEvent.cpp +++ b/UserTools/LoadANNIEEvent/LoadANNIEEvent.cpp @@ -130,7 +130,13 @@ bool LoadANNIEEvent::Execute() { // Load the contents from the new input file into it std::string input_filename = input_filenames_.at(current_file_); std::cout <<"Reading in current file "<Initialise(input_filename); + bool filename_valid = false; + filename_valid = ProcessedFileStore->Initialise(input_filename); + if (!filename_valid){ + Log("LoadANNIEEvent: Filename "+input_filename+" not found! Proceed to next file",v_error,verbosity_); + current_file_++; + return true; + } m_data->Stores["ProcessedFileStore"]=ProcessedFileStore; // create an ANNIEEvent BoostStore and an OrphanStore BoostStore to load from it @@ -168,7 +174,13 @@ bool LoadANNIEEvent::Execute() { BoostStore *theANNIEEvent = new BoostStore(false, BOOST_STORE_MULTIEVENT_FORMAT); std::string input_filename = input_filenames_.at(current_file_); - theANNIEEvent->Initialise(input_filename); + bool filename_valid = false; + filename_valid = theANNIEEvent->Initialise(input_filename); + if (!filename_valid){ + Log("LoadANNIEEvent: Filename "+input_filename+" not found! Proceed to next file",v_error,verbosity_); + current_file_++; + return true; + } m_data->Stores["ANNIEEvent"] = theANNIEEvent; m_data->Stores.at("ANNIEEvent")->Header->Get("TotalEntries",total_entries_in_file_); if (current_file_==0) { diff --git a/UserTools/MrdPaddleEfficiencyCalc/MrdPaddleEfficiencyCalc.cpp b/UserTools/MrdPaddleEfficiencyCalc/MrdPaddleEfficiencyCalc.cpp index acae70ca3..37a1bc2e2 100644 --- a/UserTools/MrdPaddleEfficiencyCalc/MrdPaddleEfficiencyCalc.cpp +++ b/UserTools/MrdPaddleEfficiencyCalc/MrdPaddleEfficiencyCalc.cpp @@ -17,6 +17,7 @@ bool MrdPaddleEfficiencyCalc::Initialise(std::string configfile, DataModel &data str_inactive = "./configfiles/MrdPaddleEfficiencyCalc/inactive_channels.dat"; mc_chankey_path = "./configfiles/MrdPaddleEfficiencyCalc/MRD_Chankeys_Data_MC.dat"; layer_plots = false; + correction_file = "./configfiles/MrdPaddleEfficiencyCalc/MRDCorrectionFactors.dat"; m_variables.Get("verbosity",verbosity); m_variables.Get("InputFile",str_input); @@ -25,6 +26,7 @@ bool MrdPaddleEfficiencyCalc::Initialise(std::string configfile, DataModel &data m_variables.Get("IsData",isData); m_variables.Get("MCChankeyFile",mc_chankey_path); m_variables.Get("LayerPlots",layer_plots); + m_variables.Get("CorrectionFile",correction_file); int chankey_mc, chankey_data, wcsimid; @@ -45,7 +47,8 @@ bool MrdPaddleEfficiencyCalc::Initialise(std::string configfile, DataModel &data outputfile = new TFile(str_output.c_str(),"RECREATE"); //Define histograms & canvases - eff_chankey = new TH1D("eff_chankey","Efficiency vs. channelkey",310,26,336); + eff_chankey = new TEfficiency("eff_chankey","Efficiency vs. channelkey; chankey;efficiency #varepsilon",310,26,336); + eff_chankey_corrected = new TEfficiency("eff_chankey_corrected","Efficiency vs. channelkey; chankey;efficiency #varepsilon",310,26,336); eff_top = new TH2Poly("eff_top","Efficiency - Top View",1.6,3.,-2,2.); eff_side = new TH2Poly("eff_side","Efficiency - Side View",1.6,3.,-2.,2.); eff_top_side = new TH2Poly("eff_top_side","Efficiency - Side/Top View",1.6,3.,-2.,2.); @@ -55,22 +58,19 @@ bool MrdPaddleEfficiencyCalc::Initialise(std::string configfile, DataModel &data gROOT->cd(); //Label axes of histograms - eff_chankey->GetXaxis()->SetTitle("chankey"); - eff_chankey->GetYaxis()->SetTitle("efficiency #epsilon"); - eff_chankey->SetStats(0); eff_top->GetXaxis()->SetTitle("z [m]"); eff_top->GetYaxis()->SetTitle("x [m]"); eff_side->GetXaxis()->SetTitle("z [m]"); eff_side->GetYaxis()->SetTitle("y [m]"); - eff_top->GetZaxis()->SetTitle("#epsilon"); - eff_side->GetZaxis()->SetTitle("#epsilon"); + eff_top->GetZaxis()->SetTitle("#varepsilon"); + eff_side->GetZaxis()->SetTitle("#varepsilon"); eff_top->SetStats(0); eff_side->SetStats(0); eff_top->GetZaxis()->SetRangeUser(0.000,1); eff_side->GetZaxis()->SetRangeUser(0.000,1); eff_top_side->GetXaxis()->SetTitle("z [m]"); eff_top_side->GetYaxis()->SetTitle("x/y [m]"); - eff_top_side->GetZaxis()->SetTitle("#epsilon"); + eff_top_side->GetZaxis()->SetTitle("#varepsilon"); eff_top_side->SetStats(0); eff_top_side->GetZaxis()->SetRangeUser(0.000,1); eff_crate1->SetStats(0); @@ -201,6 +201,16 @@ bool MrdPaddleEfficiencyCalc::Initialise(std::string configfile, DataModel &data } inactive_file.close(); + unsigned long temp_chkey; + double temp_eff, temp_corr; + ifstream f_correction(correction_file.c_str()); + while (!f_correction.eof()){ + f_correction >> temp_chkey >> temp_eff >> temp_corr; + map_correction.emplace(temp_chkey,temp_corr); + if (f_correction.eof()) break; + } + f_correction.close(); + //Set up color palette Bird_Idx = TColor::CreateGradientColorTable(9, stops, red, green, blue, 255, alpha); std::cout <<"Bird_Idx: "<GetXaxis()->SetTitle("x [m]"); layer_hist2_layer->GetXaxis()->SetTitle("x [m]"); } - layer_hist1->GetYaxis()->SetTitle("Efficiency #epsilon"); - layer_hist2->GetYaxis()->SetTitle("Efficiency #epsilon"); - layer_hist1_layer->GetYaxis()->SetTitle("Efficiency #epsilon"); - layer_hist2_layer->GetYaxis()->SetTitle("Efficiency #epsilon"); + layer_hist1->GetYaxis()->SetTitle("Efficiency #varepsilon"); + layer_hist2->GetYaxis()->SetTitle("Efficiency #varepsilon"); + layer_hist1_layer->GetYaxis()->SetTitle("Efficiency #varepsilon"); + layer_hist2_layer->GetYaxis()->SetTitle("Efficiency #varepsilon"); layer_hist1->SetStats(0); layer_hist2->SetStats(0); layer_hist1_layer->SetStats(0); @@ -320,7 +330,7 @@ bool MrdPaddleEfficiencyCalc::Execute(){ //Get observed/expected histograms TH1D *temp_exp = (TH1D*) inputfile->Get(name_exp_hist.str().c_str()); TH1D *temp_obs = (TH1D*) inputfile->Get(name_obs_hist.str().c_str()); - TH1D *temp_exp_layer=nullptr, *temp_obs_layer=nullptr; + TH1D *temp_exp_layer, *temp_obs_layer; if (layer_plots){ temp_exp_layer = (TH1D*) inputfile->Get(name_exp_hist_layer.str().c_str()); temp_obs_layer = (TH1D*) inputfile->Get(name_obs_hist_layer.str().c_str()); @@ -335,7 +345,12 @@ bool MrdPaddleEfficiencyCalc::Execute(){ TH1D *efficiency_hist = (TH1D*) temp_obs->Clone(name_eff_hist.str().c_str()); efficiency_hist->SetStats(0); efficiency_hist->SetTitle(title_eff_hist.str().c_str()); - TH1D *efficiency_hist_layer; + + //Note that for efficiency_hist_layer, the colors might not be displayed correctly in newer versions of root + //See https://root-forum.cern.ch/t/error-using-tcolor/39149/10 for more details on how to fix it when drawing the canvas from the output file + + TH1D *efficiency_hist_layer, *efficiency_hist_layer_copy; + TEfficiency *temp_teff; if (layer_plots){ efficiency_hist_layer = (TH1D*) temp_obs_layer->Clone(name_eff_hist_layer.str().c_str()); efficiency_hist_layer->SetStats(0); @@ -344,19 +359,27 @@ bool MrdPaddleEfficiencyCalc::Execute(){ if (i_layer%2==0) efficiency_hist->GetXaxis()->SetTitle("y [m]"); else efficiency_hist->GetXaxis()->SetTitle("x [m]"); - efficiency_hist->GetYaxis()->SetTitle("efficiency #epsilon"); + efficiency_hist->GetYaxis()->SetTitle("efficiency #varepsilon"); efficiency_hist->Divide(temp_exp); if (layer_plots){ if (i_layer%2==0) efficiency_hist_layer->GetXaxis()->SetTitle("y [m]"); else efficiency_hist_layer->GetXaxis()->SetTitle("x [m]"); - efficiency_hist_layer->GetYaxis()->SetTitle("efficiency #epsilon"); + efficiency_hist_layer->GetYaxis()->SetTitle("efficiency #varepsilon"); efficiency_hist_layer->Divide(temp_exp_layer); + + temp_teff = new TEfficiency(*temp_obs_layer,*temp_exp_layer); + for (int i_bin=0; i_bin < temp_exp_layer->GetNbinsX(); i_bin++){ + double temp_error = temp_teff->GetEfficiencyErrorUp(i_bin+1); + if (temp_teff->GetEfficiency(i_bin+1) > 0.) efficiency_hist_layer->SetBinError(i_bin+1,temp_error); + else efficiency_hist_layer->SetBinError(i_bin+1,0); + } + + efficiency_hist_layer_copy = (TH1D*) efficiency_hist_layer->Clone(); + efficiency_hist_layer_copy->SetName(name_eff_hist_Layer.str().c_str()); + } + - TH1F *efficiency_hist_layer_copy = (TH1F*) efficiency_hist_layer->Clone(); - efficiency_hist_layer_copy->SetName(name_eff_hist_Layer.str().c_str()); - //if (i_ch < channels_per_layer[i_layer]/2) efficiency_hist_layer_copy->SetLineColor(Bird_palette[int(254*(i_ch/double(channels_per_layer[i_layer]/2)))]); - //else efficiency_hist_layer_copy->SetLineColor(Bird_palette[int(254*((i_ch-channels_per_layer[i_layer]/2)/double(channels_per_layer[i_layer]/2)))]); //Scale down from 10 bins to 1 temp_exp->Rebin(10); @@ -370,10 +393,15 @@ bool MrdPaddleEfficiencyCalc::Execute(){ double efficiency = efficiency_hist_avg->GetBinContent(1); double exp = temp_exp->GetBinContent(1); - double obs = temp_exp->GetBinContent(1); + double obs = temp_obs->GetBinContent(1); double err_eff = 1./exp * sqrt(obs + obs*obs/exp); - eff_chankey->SetBinContent(bins_start[i_layer]+i_ch,efficiency); - eff_chankey->SetBinError(bins_start[i_layer]+i_ch,err_eff); + eff_chankey->SetTotalEvents(bins_start[i_layer]+i_ch,int(exp)); + eff_chankey->SetPassedEvents(bins_start[i_layer]+i_ch,int(obs)); + eff_chankey_corrected->SetTotalEvents(bins_start[i_layer]+i_ch,int(exp)); + double obs_corrected = obs*map_correction[input_chankey]; + if (obs_corrected > exp) obs_corrected = exp; + eff_chankey_corrected->SetPassedEvents(bins_start[i_layer]+i_ch,int(obs_corrected)); + if (i_ch < channels_per_layer[i_layer]/2){ layer_hist1->SetBinContent(i_ch+1,efficiency); @@ -384,17 +412,19 @@ bool MrdPaddleEfficiencyCalc::Execute(){ } canvas_layer1->cd(); efficiency_hist_layer->SetLineColor(Bird_palette[int(254*(i_ch/double(channels_per_layer[i_layer]/2)))]); + efficiency_hist_layer->SetFillColorAlpha(Bird_palette[int(254*(i_ch/double(channels_per_layer[i_layer]/2)))],0.30); + if (i_ch == 0) { efficiency_hist_layer->SetTitle(title_canvas_hist1.str().c_str()); efficiency_hist_layer->GetYaxis()->SetRangeUser(0.000,1); - efficiency_hist_layer->Draw(); + efficiency_hist_layer->Draw("e2"); c_eff_layers->cd(j_layer); - efficiency_hist_layer->Draw(); + efficiency_hist_layer->Draw("e2"); } else { - efficiency_hist_layer->Draw("same"); + efficiency_hist_layer->Draw("e2same"); c_eff_layers->cd(j_layer); - efficiency_hist_layer->Draw("same"); + efficiency_hist_layer->Draw("e2same"); } } } else { @@ -406,17 +436,18 @@ bool MrdPaddleEfficiencyCalc::Execute(){ } canvas_layer2->cd(); efficiency_hist_layer->SetLineColor(Bird_palette[int(254*((i_ch-channels_per_layer[i_layer]/2)/double(channels_per_layer[i_layer]/2)))]); + efficiency_hist_layer->SetFillColor(Bird_palette[int(254*((i_ch-channels_per_layer[i_layer]/2)/double(channels_per_layer[i_layer]/2)))]); if (i_ch == channels_per_layer[i_layer]/2) { efficiency_hist_layer->SetTitle(title_canvas_hist2.str().c_str()); efficiency_hist_layer->GetYaxis()->SetRangeUser(0.000,1); - efficiency_hist_layer->Draw(); + efficiency_hist_layer->Draw("e2"); c_eff_layers->cd(j_layer+1); - efficiency_hist_layer->Draw(); + efficiency_hist_layer->Draw("e2"); } else { - efficiency_hist_layer->Draw("same"); + efficiency_hist_layer->Draw("e2same"); c_eff_layers->cd(j_layer+1); - efficiency_hist_layer->Draw("same"); + efficiency_hist_layer->Draw("e2same"); } } } @@ -461,6 +492,7 @@ bool MrdPaddleEfficiencyCalc::Execute(){ outputfile->cd(); eff_chankey->Write(); + eff_chankey_corrected->Write(); eff_top->Write(); eff_side->Write(); eff_top_side->Write(); diff --git a/UserTools/MrdPaddleEfficiencyCalc/MrdPaddleEfficiencyCalc.h b/UserTools/MrdPaddleEfficiencyCalc/MrdPaddleEfficiencyCalc.h index 2765e5bdc..17fbe829b 100644 --- a/UserTools/MrdPaddleEfficiencyCalc/MrdPaddleEfficiencyCalc.h +++ b/UserTools/MrdPaddleEfficiencyCalc/MrdPaddleEfficiencyCalc.h @@ -8,6 +8,7 @@ #include "TH1D.h" #include "TH2D.h" #include "TH2Poly.h" +#include "TEfficiency.h" #include "TCanvas.h" #include "TBox.h" #include "TROOT.h" @@ -48,13 +49,15 @@ class MrdPaddleEfficiencyCalc: public Tool { std::string mc_chankey_path; std::map chankeymap_MC_data; std::map chankeymap_data_MC; + std::string correction_file; //TFile variables TFile *inputfile = nullptr; TFile *outputfile = nullptr; //Histograms + canvas - TH1D *eff_chankey = nullptr; + TEfficiency *eff_chankey = nullptr; + TEfficiency *eff_chankey_corrected = nullptr; TH2Poly *eff_top = nullptr; TH2Poly *eff_side = nullptr; TH2Poly *eff_top_side = nullptr; @@ -72,6 +75,7 @@ class MrdPaddleEfficiencyCalc: public Tool { int active_channel[2][24]={{0}}; std::map> MRDChannelNumToCrateSpaceMap; Geometry *geom = nullptr; + std::map map_correction; //Layer-by-layer information int channels_per_layer[11] = {26,30,26,34,26,26,26,30,26,30,26}; diff --git a/UserTools/MrdPaddleEfficiencyPreparer/MrdPaddleEfficiencyPreparer.cpp b/UserTools/MrdPaddleEfficiencyPreparer/MrdPaddleEfficiencyPreparer.cpp index 810f05c6a..1b2a81678 100644 --- a/UserTools/MrdPaddleEfficiencyPreparer/MrdPaddleEfficiencyPreparer.cpp +++ b/UserTools/MrdPaddleEfficiencyPreparer/MrdPaddleEfficiencyPreparer.cpp @@ -149,12 +149,17 @@ bool MrdPaddleEfficiencyPreparer::Initialise(std::string configfile, DataModel & } hist_chankey = new TH1F("hist_chankey","MRD Chankeys - Efficiency",340,0,340); + hist_nlayers = new TH1F("hist_nlayers","Number of hit MRD layers",11,0,11); + MissingChannel = new std::vector; + ExpectedChannel = new std::vector; + MissingLayer = new std::vector; //hist_timediff = new TH1F("hist_timediff","Timediff first & last layer",2000,-2000,2000); tree_trackfit = new TTree("tree_trackfit","tree_trackfit"); - tree_trackfit->Branch("EvNum",&EventNumber); - tree_trackfit->Branch("MRDTriggerType",&MRDTriggertype); + tree_trackfit->Branch("RunNum",&RunNumber); + tree_trackfit->Branch("EvNum",&EventNumber); + tree_trackfit->Branch("MRDTriggerType",&MRDTriggertype); tree_trackfit->Branch("NumMrdTracks",&numtracksinev); - tree_trackfit->Branch("MrdTrackID",&MrdTrackID); + tree_trackfit->Branch("MrdTrackID",&MrdTrackID); tree_trackfit->Branch("NPMTsHit",&NPMTsHit); tree_trackfit->Branch("NLayersHit",&NLayersHit); tree_trackfit->Branch("StartVertexX",&StartVertexX); @@ -163,11 +168,17 @@ bool MrdPaddleEfficiencyPreparer::Initialise(std::string configfile, DataModel & tree_trackfit->Branch("StopVertexX",&StopVertexX); tree_trackfit->Branch("StopVertexY",&StopVertexY); tree_trackfit->Branch("StopVertexZ",&StopVertexZ); + tree_trackfit->Branch("IsThrough",&IsThrough); + tree_trackfit->Branch("MissingChannel",&MissingChannel); + tree_trackfit->Branch("ExpectedChannel",&ExpectedChannel); + tree_trackfit->Branch("NumMissingChannel",&NumMissingChannel); + tree_trackfit->Branch("MissingLayer",&MissingLayer); + tree_trackfit->Branch("NumMissingLayer",&NumMissingLayer); m_data->CStore.Get("channelkey_to_mrdpmtid",channelkey_to_mrdpmtid); m_data->CStore.Get("mrd_tubeid_to_channelkey",mrdpmtid_to_channelkey); - numtracksinev = 0; + numtracksinev = 0; return true; @@ -177,12 +188,13 @@ bool MrdPaddleEfficiencyPreparer::Execute(){ // Get all relevant data from ANNIEEvent BoostStore + m_data->Stores["ANNIEEvent"]->Get("RunNumber",RunNumber); m_data->Stores["ANNIEEvent"]->Get("EventNumber",EventNumber); m_data->Stores["ANNIEEvent"]->Get("MRDTriggerType",MRDTriggertype); // In case of a cosmic event, use the fitted track for an efficiency calculation - if (MRDTriggertype == "Cosmic"){ + if (true){ //previously condition for cosmic event, now removed to also investigate beam events // Get MRD track information from MRDTracks BoostStore @@ -193,7 +205,22 @@ bool MrdPaddleEfficiencyPreparer::Execute(){ // Only look at events with a single track (cut may be relaxed in the future) -// if (numtracksinev >= 1) { + MrdTrackID=-1; + NPMTsHit=-1; + NLayersHit=-1; + StartVertexX=-999; + StartVertexY=-999; + StartVertexZ=-999; + StopVertexX=-999; + StopVertexY=-999; + StopVertexZ=-999; + IsThrough=-1; + MissingChannel->clear(); + ExpectedChannel->clear(); + NumMissingChannel=-1; + MissingLayer->clear(); + NumMissingLayer=-1; + if (numtracksinev == 1) { // Get reconstructed tracks @@ -210,11 +237,14 @@ bool MrdPaddleEfficiencyPreparer::Execute(){ //get track properties that are needed for the efficiency analysis + int IsMrdPenetrating; + thisTrackAsBoostStore->Get("StartVertex",StartVertex); thisTrackAsBoostStore->Get("StopVertex",StopVertex); thisTrackAsBoostStore->Get("PMTsHit",PMTsHit); thisTrackAsBoostStore->Get("LayersHit",LayersHit); thisTrackAsBoostStore->Get("MrdTrackID",MrdTrackID); + thisTrackAsBoostStore->Get("IsMrdPenetrating",IsMrdPenetrating); StartVertexX = StartVertex.X(); StartVertexY = StartVertex.Y(); @@ -224,7 +254,14 @@ bool MrdPaddleEfficiencyPreparer::Execute(){ StopVertexZ = StopVertex.Z(); NPMTsHit = (int) PMTsHit.size(); NLayersHit = (int) LayersHit.size(); - tree_trackfit->Fill(); + NumMissingChannel = 0; + MissingChannel->clear(); + + bool long_track = false; + if (StartVertexZ < 3.45 && StopVertexZ > 4.5) long_track = true; + IsThrough = long_track; + + hist_nlayers->Fill(NLayersHit); if (usetruetrack){ std::vector> truetrackvertices; @@ -250,7 +287,7 @@ bool MrdPaddleEfficiencyPreparer::Execute(){ // Minor selection cuts to only select well fit tracks - if (PMTsHit.size() < 50 ){ + if (PMTsHit.size() < 50 && long_track){ for (int i_pmt=0; i_pmt < (int) PMTsHit.size(); i_pmt++){ int mrdid = PMTsHit.at(i_pmt); @@ -265,7 +302,7 @@ bool MrdPaddleEfficiencyPreparer::Execute(){ } }*/ } - + for (int i_layer = 0; i_layer < (int) zLayers.size(); i_layer++){ // Exclude first and layer from efficiency determination @@ -285,6 +322,7 @@ bool MrdPaddleEfficiencyPreparer::Execute(){ if (orientationLayers.at(i_layer) == 0) { expected_MRDHits.at(i_layer).at(hit_chankey)->Fill(y_layer); expected_MRDHits_layer.at(i_layer).at(hit_chankey)->Fill(y_layer); + ExpectedChannel->push_back(hit_chankey); int half_expected_ch = map_chkey_half[hit_chankey]; int mrdid; if (isData) mrdid = channelkey_to_mrdpmtid[hit_chankey]; @@ -293,6 +331,9 @@ bool MrdPaddleEfficiencyPreparer::Execute(){ observed_MRDHits.at(i_layer).at(hit_chankey)->Fill(y_layer); observed_MRDHits_layer.at(i_layer).at(hit_chankey)->Fill(y_layer); + } else { + MissingChannel->push_back(hit_chankey); + MissingLayer->push_back(i_layer+1); } for (unsigned long i = channels_start[i_layer]; i < channels_start[i_layer+1]; i++){ int half_channel = map_chkey_half[i]; @@ -311,6 +352,7 @@ bool MrdPaddleEfficiencyPreparer::Execute(){ else { expected_MRDHits.at(i_layer).at(hit_chankey)->Fill(x_layer); expected_MRDHits_layer.at(i_layer).at(hit_chankey)->Fill(x_layer); + ExpectedChannel->push_back(hit_chankey); int half_expected_ch = map_chkey_half[hit_chankey]; int mrdid; if (isData) mrdid = channelkey_to_mrdpmtid[hit_chankey]; @@ -318,7 +360,11 @@ bool MrdPaddleEfficiencyPreparer::Execute(){ if (std::find(PMTsHit.begin(),PMTsHit.end(),mrdid)!=PMTsHit.end()){ observed_MRDHits.at(i_layer).at(hit_chankey)->Fill(x_layer); observed_MRDHits_layer.at(i_layer).at(hit_chankey)->Fill(x_layer); - } + } else { + MissingChannel->push_back(hit_chankey); + MissingLayer->push_back(i_layer+1); + + } for (unsigned long i = channels_start[i_layer]; i < channels_start[i_layer+1]; i++){ int half_channel = map_chkey_half[i]; if (i==hit_chankey) continue; @@ -337,8 +383,11 @@ bool MrdPaddleEfficiencyPreparer::Execute(){ } } } - } else { + NumMissingChannel = (int) MissingChannel->size(); + NumMissingLayer = (int) MissingLayer->size(); tree_trackfit->Fill(); + } else { + //tree_trackfit->Fill(); } } @@ -351,6 +400,7 @@ bool MrdPaddleEfficiencyPreparer::Finalise(){ hist_file->cd(); hist_chankey->Write(); + hist_nlayers->Write(); tree_trackfit->Write(); for (unsigned int i_layer = 0; i_layer < zLayers.size(); i_layer++){ for (unsigned int i_ch = 0; i_ch < channelsLayers.at(i_layer).size(); i_ch++){ diff --git a/UserTools/MrdPaddleEfficiencyPreparer/MrdPaddleEfficiencyPreparer.h b/UserTools/MrdPaddleEfficiencyPreparer/MrdPaddleEfficiencyPreparer.h index 12ab171a8..332e4c512 100644 --- a/UserTools/MrdPaddleEfficiencyPreparer/MrdPaddleEfficiencyPreparer.h +++ b/UserTools/MrdPaddleEfficiencyPreparer/MrdPaddleEfficiencyPreparer.h @@ -57,6 +57,7 @@ class MrdPaddleEfficiencyPreparer: public Tool { int numsubevs; int numtracksinev; int EventNumber; + int RunNumber; Position StartVertex; Position StopVertex; std::vector PMTsHit; @@ -75,9 +76,16 @@ class MrdPaddleEfficiencyPreparer: public Tool { double StopVertexX = 0.; double StopVertexY = 0.; double StopVertexZ = 0.; + int IsThrough = 0; + std::vector *MissingChannel = nullptr; + std::vector *ExpectedChannel = nullptr; + int NumMissingChannel = 0; + std::vector *MissingLayer = nullptr; + int NumMissingLayer = 0; TFile *hist_file = nullptr; TH1F *hist_chankey = nullptr; + TH1F *hist_nlayers = nullptr; TTree *tree_trackfit = nullptr; std::map> observed_MRDHits; diff --git a/UserTools/TimeClustering/TimeClustering.cpp b/UserTools/TimeClustering/TimeClustering.cpp index 0cb21e8f2..fdb960e6c 100644 --- a/UserTools/TimeClustering/TimeClustering.cpp +++ b/UserTools/TimeClustering/TimeClustering.cpp @@ -32,6 +32,9 @@ bool TimeClustering::Initialise(std::string configfile, DataModel &data){ MakeSingleEventPlots = false; //very verbose, mostly for debugging ModifiedTDCData = false; //Set default values for time-shifted TDC channels + //TDCs in one of the two crates are shifted in time with respect to the channels in the other crate + //--> correct this systematic time offset for cluster finding process + // https://github.com/ANNIEsoft/ToolAnalysis/pull/247 TimeShiftChannels = ""; shifted_channels = {std::make_pair(0,51),std::make_pair(82,107),std::make_pair(142,167),std::make_pair(194,219),std::make_pair(250,275),std::make_pair(306,332)}; diff --git a/configfiles/FMVEfficiency/ClusterFinderConfig b/configfiles/FMVEfficiency/ClusterFinderConfig index 8950a4909..24886023e 100644 --- a/configfiles/FMVEfficiency/ClusterFinderConfig +++ b/configfiles/FMVEfficiency/ClusterFinderConfig @@ -1,7 +1,7 @@ # ClusterFinder Config File HitStore Hits #Either MCHits or Hits (accessed in ANNIEEvent store) -OutputFile R1623S0p3_Clusters +OutputFile R3347_Clusters ClusterFindingWindow 100 # in ns, size of the window used to "clusterize" AcqTimeWindow 70000 # in ns, size of the acquisition window ClusterIntegrationWindow 100 # in ns, all hits with +/- 1/2 of this window are considered in the cluster diff --git a/configfiles/FMVEfficiency/FMVEfficiencyConfig b/configfiles/FMVEfficiency/FMVEfficiencyConfig index 549b02f4c..5df377ad0 100644 --- a/configfiles/FMVEfficiency/FMVEfficiencyConfig +++ b/configfiles/FMVEfficiency/FMVEfficiencyConfig @@ -1,6 +1,7 @@ # FMVEfficiency config file SinglePEGains ./configfiles/FMVEfficiency/ChannelSPEGains_BeamRun20192020.csv verbosity 0 -OutputFile FMVEfficiency_R1623_PMTMRD_p3 +OutputFile FMVEfficiency_R3347 UseTank 1 IsData 1 +PadPerLayer 3 diff --git a/configfiles/FMVEfficiency/FindMrdTracksConfig b/configfiles/FMVEfficiency/FindMrdTracksConfig index 5a54df4c1..5bc9985e7 100644 --- a/configfiles/FMVEfficiency/FindMrdTracksConfig +++ b/configfiles/FMVEfficiency/FindMrdTracksConfig @@ -1,7 +1,7 @@ # FindMrdTracks Config File # all variables retrieved with m_variables.Get() must be defined here! -verbosity 5 +verbosity 0 IsData 1 OutputDirectory . OutputFile MRDTracks_RAWDataR1624S0p99R0S0 diff --git a/configfiles/FMVEfficiency/LoadANNIEEventConfig b/configfiles/FMVEfficiency/LoadANNIEEventConfig index b18e388d4..d19b1c700 100644 --- a/configfiles/FMVEfficiency/LoadANNIEEventConfig +++ b/configfiles/FMVEfficiency/LoadANNIEEventConfig @@ -1,3 +1,3 @@ -verbose 4 +verbose 0 EventOffset 0 FileForListOfInputs ./configfiles/FMVEfficiency/my_inputs.txt diff --git a/configfiles/FMVEfficiency/TimeClusteringConfig b/configfiles/FMVEfficiency/TimeClusteringConfig index 1871df543..3856ddf58 100644 --- a/configfiles/FMVEfficiency/TimeClusteringConfig +++ b/configfiles/FMVEfficiency/TimeClusteringConfig @@ -1,13 +1,12 @@ #TimeClustering config file -verbosity 2 +verbosity 0 MinDigitsForTrack 3 MaxMrdSubEventDuration 30 MinSubeventTimeSep 30 MakeMrdDigitTimePlot 1 LaunchTApplication 0 IsData 1 -#OutputROOTFile TimeClustering_MRDTest28_cluster30ns -OutputROOTFile test +OutputROOTFile TimeClustering_R3347 MapChankey_WCSimID ./configfiles/FindMrdTracks/MRD_Chankey_WCSimID.dat TimeShiftChannels ./configfiles/FMVEfficiency/TimeShiftChannels.txt diff --git a/configfiles/FMVEfficiency/ToolsConfig b/configfiles/FMVEfficiency/ToolsConfig index 7a976c8c8..6c5df31a5 100644 --- a/configfiles/FMVEfficiency/ToolsConfig +++ b/configfiles/FMVEfficiency/ToolsConfig @@ -1,7 +1,5 @@ myLoadGeometry LoadGeometry configfiles/LoadGeometry/LoadGeometryConfig myLoadANNIEEvent LoadANNIEEvent configfiles/FMVEfficiency/LoadANNIEEventConfig -myPhaseIIADCCalibrator PhaseIIADCCalibrator configfiles/FMVEfficiency/PhaseIIADCCalibratorConfig -myPhaseIIADCHitFinder PhaseIIADCHitFinder configfiles/FMVEfficiency/PhaseIIADCHitFinderConfig myClusterFinder ClusterFinder configfiles/FMVEfficiency/ClusterFinderConfig myTimeClustering TimeClustering configfiles/FMVEfficiency/TimeClusteringConfig myFindMrdTracks FindMrdTracks configfiles/FMVEfficiency/FindMrdTracksConfig diff --git a/configfiles/FMVEfficiency/calculate_fmv_efficiency.C b/configfiles/FMVEfficiency/calculate_fmv_efficiency.C index 7d34076fb..d8f2253da 100644 --- a/configfiles/FMVEfficiency/calculate_fmv_efficiency.C +++ b/configfiles/FMVEfficiency/calculate_fmv_efficiency.C @@ -3,76 +3,24 @@ void calculate_fmv_efficiency(std::string inputfile, std::string outputfile, boo TFile *f_out = new TFile(outputfile.c_str(),"RECREATE"); //Define output histograms - TH1D *fmv_eff_layer1 = new TH1D("fmv_eff_layer1","FMV Efficiencies Layer 1",13,0,13); - TH1D *fmv_eff_strict_layer1 = new TH1D("fmv_eff_strict_layer1","FMV Efficiencies Layer 1 (Strict MRD Track)",13,0,13); - TH1D *fmv_eff_strict_avg_layer1 = new TH1D("fmv_eff_strict_avg_layer1","FMV Average Efficiencies Layer 1 (Strict MRD Track)",13,0,13); - TH1D *fmv_eff_loose_layer1 = new TH1D("fmv_eff_loose_layer1","FMV Efficiencies Layer 1 (MRD Track)",13,0,13); - TH1D *fmv_eff_loose_avg_layer1 = new TH1D("fmv_eff_loose_avg_layer1","FMV Average Efficiencies Layer 1 (MRD Track)",13,0,13); - TH1D *fmv_eff_layer2 = new TH1D("fmv_eff_layer2","FMV Efficiencies Layer 2",13,13,26); - TH1D *fmv_eff_strict_layer2 = new TH1D("fmv_eff_strict_layer2","FMV Efficiencies Layer 2 (Strict MRD Track)",13,13,26); - TH1D *fmv_eff_strict_avg_layer2 = new TH1D("fmv_eff_strict_avg_layer2","FMV Average Efficiencies Layer 2 (Strict MRD Track)",13,13,26); - TH1D *fmv_eff_loose_layer2 = new TH1D("fmv_eff_loose_layer2","FMV Efficiencies Layer 2 (MRD Track)",13,13,26); - TH1D *fmv_eff_loose_avg_layer2 = new TH1D("fmv_eff_loose_avg_layer2","FMV Average Efficiencies Layer 2 (MRD Track)",13,13,26); - TH1D *fmv_eff_tank_layer1 = nullptr; - TH1D *fmv_eff_tank_layer2 = nullptr; + TEfficiency *fmv_eff_layer1 = new TEfficiency("fmv_eff_layer1","FMV Efficiencies Layer 1;chankey;efficiency #varepsilon",13,0,13); + TEfficiency *fmv_eff_strict_layer1 = new TEfficiency("fmv_eff_strict_layer1","FMV Efficiencies Layer 1 (Strict MRD Track);chankey;efficiency #varepsilon",13,0,13); + TEfficiency *fmv_eff_strict_avg_layer1 = new TEfficiency("fmv_eff_strict_avg_layer1","FMV Average Efficiencies Layer 1 (Strict MRD Track);chankey;efficiency #varepsilon",13,0,13); + TEfficiency *fmv_eff_loose_layer1 = new TEfficiency("fmv_eff_loose_layer1","FMV Efficiencies Layer 1 (MRD Track);chankey; efficiency #varepsilon",13,0,13); + TEfficiency *fmv_eff_loose_avg_layer1 = new TEfficiency("fmv_eff_loose_avg_layer1","FMV Average Efficiencies Layer 1 (MRD Track);chankey; efficiency #varepsilon",13,0,13); + TEfficiency *fmv_eff_layer2 = new TEfficiency("fmv_eff_layer2","FMV Efficiencies Layer 2; chankey; efficiency #varepsilon",13,13,26); + TEfficiency *fmv_eff_strict_layer2 = new TEfficiency("fmv_eff_strict_layer2","FMV Efficiencies Layer 2 (Strict MRD Track); chankey; efficiency #varepsilon",13,13,26); + TEfficiency *fmv_eff_strict_avg_layer2 = new TEfficiency("fmv_eff_strict_avg_layer2","FMV Average Efficiencies Layer 2 (Strict MRD Track); chankey; efficiency #varepsilon",13,13,26); + TEfficiency *fmv_eff_loose_layer2 = new TEfficiency("fmv_eff_loose_layer2","FMV Efficiencies Layer 2 (MRD Track); chankey; efficiency #varepsilon",13,13,26); + TEfficiency *fmv_eff_loose_avg_layer2 = new TEfficiency("fmv_eff_loose_avg_layer2","FMV Average Efficiencies Layer 2 (MRD Track); chankey; efficiency #varepsilon",13,13,26); + TEfficiency *fmv_eff_tank_layer1 = nullptr; + TEfficiency *fmv_eff_tank_layer2 = nullptr; if (has_tank){ - fmv_eff_tank_layer1 = new TH1D("fmv_eff_tank_layer1","FMV Efficiencies (Tank coincidence) Layer 1",13,0,13); - fmv_eff_tank_layer2 = new TH1D("fmv_eff_tank_layer2","FMV Efficiencies (Tank coincidence) Layer 2",13,13,26); + fmv_eff_tank_layer1 = new TEfficiency("fmv_eff_tank_layer1","FMV Efficiencies (Tank coincidence) Layer 1;chankey; efficiency #varepsilon",13,0,13); + fmv_eff_tank_layer2 = new TEfficiency("fmv_eff_tank_layer2","FMV Efficiencies (Tank coincidence) Layer 2; chankey; efficiency #varepsilon",13,13,26); } - fmv_eff_layer1->SetStats(0); - fmv_eff_strict_layer1->SetStats(0); - fmv_eff_strict_avg_layer1->SetStats(0); - fmv_eff_loose_layer1->SetStats(0); - fmv_eff_loose_avg_layer1->SetStats(0); - fmv_eff_layer2->SetStats(0); - fmv_eff_strict_layer2->SetStats(0); - fmv_eff_strict_avg_layer2->SetStats(0); - fmv_eff_loose_layer2->SetStats(0); - fmv_eff_loose_avg_layer2->SetStats(0); - fmv_eff_layer1->GetXaxis()->SetTitle("chankey"); - fmv_eff_strict_layer1->GetXaxis()->SetTitle("chankey"); - fmv_eff_strict_avg_layer1->GetXaxis()->SetTitle("chankey"); - fmv_eff_loose_layer1->GetXaxis()->SetTitle("chankey"); - fmv_eff_loose_avg_layer1->GetXaxis()->SetTitle("chankey"); - fmv_eff_layer2->GetXaxis()->SetTitle("chankey"); - fmv_eff_strict_layer2->GetXaxis()->SetTitle("chankey"); - fmv_eff_strict_avg_layer2->GetXaxis()->SetTitle("chankey"); - fmv_eff_loose_layer2->GetXaxis()->SetTitle("chankey"); - fmv_eff_loose_avg_layer2->GetXaxis()->SetTitle("chankey"); - fmv_eff_layer1->GetYaxis()->SetTitle("efficiency #epsilon"); - fmv_eff_strict_layer1->GetYaxis()->SetTitle("efficiency #epsilon"); - fmv_eff_strict_avg_layer1->GetYaxis()->SetTitle("efficiency #epsilon"); - fmv_eff_loose_layer1->GetYaxis()->SetTitle("efficiency #epsilon"); - fmv_eff_loose_avg_layer1->GetYaxis()->SetTitle("efficiency #epsilon"); - fmv_eff_layer2->GetYaxis()->SetTitle("efficiency #epsilon"); - fmv_eff_strict_layer2->GetYaxis()->SetTitle("efficiency #epsilon"); - fmv_eff_strict_avg_layer2->GetYaxis()->SetTitle("efficiency #epsilon"); - fmv_eff_loose_layer2->GetYaxis()->SetTitle("efficiency #epsilon"); - fmv_eff_loose_avg_layer2->GetYaxis()->SetTitle("efficiency #epsilon"); - fmv_eff_layer1->GetYaxis()->SetRangeUser(0.,1.); - fmv_eff_strict_layer1->GetYaxis()->SetRangeUser(0.,1.); - fmv_eff_strict_avg_layer1->GetYaxis()->SetRangeUser(0.,1.); - fmv_eff_loose_layer1->GetYaxis()->SetRangeUser(0.,1.); - fmv_eff_loose_avg_layer1->GetYaxis()->SetRangeUser(0.,1.); - fmv_eff_layer2->GetYaxis()->SetRangeUser(0.,1.); - fmv_eff_strict_layer2->GetYaxis()->SetRangeUser(0.,1.); - fmv_eff_strict_avg_layer2->GetYaxis()->SetRangeUser(0.,1.); - fmv_eff_loose_layer2->GetYaxis()->SetRangeUser(0.,1.); - fmv_eff_loose_avg_layer2->GetYaxis()->SetRangeUser(0.,1.); - - if (has_tank){ - fmv_eff_tank_layer1->SetStats(0); - fmv_eff_tank_layer2->SetStats(0); - fmv_eff_tank_layer1->GetXaxis()->SetTitle("chankey"); - fmv_eff_tank_layer2->GetXaxis()->SetTitle("chankey"); - fmv_eff_tank_layer1->GetYaxis()->SetTitle("efficiency #epsilon"); - fmv_eff_tank_layer2->GetYaxis()->SetTitle("efficiency #epsilon"); - fmv_eff_tank_layer1->GetYaxis()->SetRangeUser(0.,1.); - fmv_eff_tank_layer2->GetYaxis()->SetRangeUser(0.,1.); - } - - std::vector eff_hists_strict, eff_hists_loose; + std::vector eff_hists_strict, eff_hists_loose; TFile *f = new TFile(inputfile.c_str(),"READ"); @@ -105,29 +53,22 @@ void calculate_fmv_efficiency(std::string inputfile, std::string outputfile, boo for (int i=0; i< 13; i++){ double obs_counts = obs_layer1->GetBinContent(i+1); double exp_counts = exp_layer1->GetBinContent(i+1); - if (exp_counts == 0) exp_counts = 1; - fmv_eff_layer1->SetBinContent(i+1,obs_counts/exp_counts); - double eff_error = sqrt(obs_counts/exp_counts/exp_counts+obs_counts*obs_counts/exp_counts/exp_counts/exp_counts); - fmv_eff_layer1->SetBinError(i+1,eff_error); + fmv_eff_layer1->SetTotalEvents(i+1,exp_counts); + fmv_eff_layer1->SetPassedEvents(i+1,obs_counts); double obs_counts_strict = obs_track_strict_layer1->GetBinContent(i+1); double exp_counts_strict = exp_track_strict_layer1->GetBinContent(i+1); - if (exp_counts_strict == 0) exp_counts_strict = 1; - fmv_eff_strict_layer1->SetBinContent(i+1,obs_counts_strict/exp_counts_strict); - double eff_error_strict = sqrt(obs_counts_strict/exp_counts_strict/exp_counts_strict+obs_counts_strict*obs_counts_strict/exp_counts_strict/exp_counts_strict/exp_counts_strict); - fmv_eff_strict_layer1->SetBinError(i+1,eff_error_strict); + fmv_eff_strict_layer1->SetTotalEvents(i+1,exp_counts_strict); + fmv_eff_strict_layer1->SetPassedEvents(i+1,obs_counts_strict); double obs_counts_loose = obs_track_loose_layer1->GetBinContent(i+1); double exp_counts_loose = exp_track_loose_layer1->GetBinContent(i+1); - if (exp_counts_loose == 0) exp_counts_loose = 1; - fmv_eff_loose_layer1->SetBinContent(i+1,obs_counts_loose/exp_counts_loose); - double eff_error_loose = sqrt(obs_counts_loose/exp_counts_loose/exp_counts_loose+obs_counts_loose*obs_counts_loose/exp_counts_loose/exp_counts_loose/exp_counts_loose); - fmv_eff_loose_layer1->SetBinError(i+1,eff_error_loose); + fmv_eff_loose_layer1->SetTotalEvents(i+1,exp_counts_loose); + fmv_eff_loose_layer1->SetPassedEvents(i+1,obs_counts_loose); if (has_tank){ double obs_counts_tank = obs_tank_layer1->GetBinContent(i+1); double exp_counts_tank = exp_tank_layer1->GetBinContent(i+1); - if (exp_counts_tank == 0) exp_counts_tank = 1; - fmv_eff_tank_layer1->SetBinContent(i+1,obs_counts_tank/exp_counts_tank); - double eff_error_tank = sqrt(obs_counts_tank/exp_counts_tank/exp_counts_tank+obs_counts_tank*obs_counts_tank/exp_counts_tank/exp_counts_tank/exp_counts_tank); - fmv_eff_tank_layer1->SetBinError(i+1,eff_error_tank); + //if (exp_counts_tank == 0) exp_counts_tank = 1; + fmv_eff_tank_layer1->SetTotalEvents(i+1,exp_counts_tank); + fmv_eff_tank_layer1->SetPassedEvents(i+1,obs_counts_tank); } } @@ -135,29 +76,21 @@ void calculate_fmv_efficiency(std::string inputfile, std::string outputfile, boo for (int i=0; i< 13; i++){ double obs_counts = obs_layer2->GetBinContent(i+1); double exp_counts = exp_layer2->GetBinContent(i+1); - if (exp_counts == 0) exp_counts = 1; - fmv_eff_layer2->SetBinContent(i+1,obs_counts/exp_counts); - double eff_error = sqrt(obs_counts/exp_counts/exp_counts+obs_counts*obs_counts/exp_counts/exp_counts/exp_counts); - fmv_eff_layer2->SetBinError(i+1,eff_error); + fmv_eff_layer2->SetTotalEvents(i+1,exp_counts); + fmv_eff_layer2->SetPassedEvents(i+1,obs_counts); double obs_counts_strict = obs_track_strict_layer2->GetBinContent(i+1); double exp_counts_strict = exp_track_strict_layer2->GetBinContent(i+1); - if (exp_counts_strict == 0) exp_counts_strict = 1; - fmv_eff_strict_layer2->SetBinContent(i+1,obs_counts_strict/exp_counts_strict); - double eff_error_strict = sqrt(obs_counts_strict/exp_counts_strict/exp_counts_strict+obs_counts_strict*obs_counts_strict/exp_counts_strict/exp_counts_strict/exp_counts_strict); - fmv_eff_strict_layer2->SetBinError(i+1,eff_error_strict); + fmv_eff_strict_layer2->SetTotalEvents(i+1,exp_counts_strict); + fmv_eff_strict_layer2->SetPassedEvents(i+1,obs_counts_strict); double obs_counts_loose = obs_track_loose_layer2->GetBinContent(i+1); double exp_counts_loose = exp_track_loose_layer2->GetBinContent(i+1); - if (exp_counts_loose == 0) exp_counts_loose = 1; - fmv_eff_loose_layer2->SetBinContent(i+1,obs_counts_loose/exp_counts_loose); - double eff_error_loose = sqrt(obs_counts_loose/exp_counts_loose/exp_counts_loose+obs_counts_loose*obs_counts_loose/exp_counts_loose/exp_counts_loose/exp_counts_loose); - fmv_eff_loose_layer2->SetBinError(i+1,eff_error_loose); + fmv_eff_loose_layer2->SetTotalEvents(i+1,exp_counts_loose); + fmv_eff_loose_layer2->SetPassedEvents(i+1,obs_counts_loose); if (has_tank){ double obs_counts_tank = obs_tank_layer2->GetBinContent(i+1); double exp_counts_tank = exp_tank_layer2->GetBinContent(i+1); - if (exp_counts_tank == 0) exp_counts_tank = 1; - fmv_eff_tank_layer2->SetBinContent(i+1,obs_counts_tank/exp_counts_tank); - double eff_error_tank = sqrt(obs_counts_tank/exp_counts_tank/exp_counts_tank+obs_counts_tank*obs_counts_tank/exp_counts_tank/exp_counts_tank/exp_counts_tank); - fmv_eff_tank_layer2->SetBinError(i+1,eff_error_tank); + fmv_eff_tank_layer2->SetTotalEvents(i+1,exp_counts_tank); + fmv_eff_tank_layer2->SetPassedEvents(i+1,obs_counts_tank); } } @@ -171,9 +104,9 @@ void calculate_fmv_efficiency(std::string inputfile, std::string outputfile, boo hist_obs_loose_name <<"hist_observed_loose_chankey"<Get(hist_obs_strict_name.str().c_str()); TH1F* hist_exp_strict_temp = (TH1F*) f->Get(hist_exp_strict_name.str().c_str()); TH1F* hist_obs_loose_temp = (TH1F*) f->Get(hist_obs_loose_name.str().c_str()); @@ -181,16 +114,8 @@ void calculate_fmv_efficiency(std::string inputfile, std::string outputfile, boo //Create efficiency histograms f_out->cd(); - TH1D* hist_eff_strict_temp = new TH1D(hist_eff_strict_name.str().c_str(),hist_eff_strict_title.str().c_str(),hist_obs_strict_temp->GetXaxis()->GetNbins()/2,hist_obs_strict_temp->GetXaxis()->GetXmin(),hist_obs_strict_temp->GetXaxis()->GetXmax()); - hist_eff_strict_temp->GetXaxis()->SetTitle("x [m]"); - hist_eff_strict_temp->GetYaxis()->SetTitle("efficiency #epsilon"); - hist_eff_strict_temp->GetYaxis()->SetRangeUser(0.,1.); - hist_eff_strict_temp->SetStats(0); - TH1D* hist_eff_loose_temp = new TH1D(hist_eff_loose_name.str().c_str(),hist_eff_loose_title.str().c_str(),hist_obs_loose_temp->GetXaxis()->GetNbins()/2,hist_obs_loose_temp->GetXaxis()->GetXmin(),hist_obs_loose_temp->GetXaxis()->GetXmax()); - hist_eff_loose_temp->GetXaxis()->SetTitle("x [m]"); - hist_eff_loose_temp->GetYaxis()->SetTitle("efficiency #epsilon"); - hist_eff_loose_temp->GetYaxis()->SetRangeUser(0.,1.); - hist_eff_loose_temp->SetStats(0); + TEfficiency* hist_eff_strict_temp = new TEfficiency(hist_eff_strict_name.str().c_str(),hist_eff_strict_title.str().c_str(),hist_obs_strict_temp->GetXaxis()->GetNbins()/2,hist_obs_strict_temp->GetXaxis()->GetXmin(),hist_obs_strict_temp->GetXaxis()->GetXmax()); + TEfficiency* hist_eff_loose_temp = new TEfficiency(hist_eff_loose_name.str().c_str(),hist_eff_loose_title.str().c_str(),hist_obs_loose_temp->GetXaxis()->GetNbins()/2,hist_obs_loose_temp->GetXaxis()->GetXmin(),hist_obs_loose_temp->GetXaxis()->GetXmax()); TH1F *hist_obs_strict_rebin = (TH1F*) hist_obs_strict_temp->Rebin(2); TH1F *hist_exp_strict_rebin = (TH1F*) hist_exp_strict_temp->Rebin(2); @@ -201,57 +126,53 @@ void calculate_fmv_efficiency(std::string inputfile, std::string outputfile, boo double error_avg_efficiency_strict=0; double avg_efficiency_loose=0; double error_avg_efficiency_loose=0; + int tot_exp_strict=0; + int tot_obs_strict=0; + int tot_exp_loose=0; + int tot_obs_loose=0; int non_zero_bins_strict=0; int non_zero_bins_loose=0; for (int bin=0; binGetXaxis()->GetNbins(); bin++){ double obs_counts = hist_obs_strict_rebin->GetBinContent(bin+1); double exp_counts = hist_exp_strict_rebin->GetBinContent(bin+1); - if (exp_counts == 0) exp_counts = 1; - else non_zero_bins_strict++; - hist_eff_strict_temp->SetBinContent(bin+1,obs_counts/exp_counts); - double eff_error = sqrt(obs_counts/exp_counts/exp_counts+obs_counts*obs_counts/exp_counts/exp_counts/exp_counts); - hist_eff_strict_temp->SetBinError(bin+1,eff_error); + hist_eff_strict_temp->SetTotalEvents(bin+1,exp_counts); + hist_eff_strict_temp->SetPassedEvents(bin+1,obs_counts); double obs_counts_loose = hist_obs_loose_rebin->GetBinContent(bin+1); double exp_counts_loose = hist_exp_loose_rebin->GetBinContent(bin+1); - if (exp_counts_loose == 0) exp_counts_loose = 1; - else non_zero_bins_loose++; - hist_eff_loose_temp->SetBinContent(bin+1,obs_counts_loose/exp_counts_loose); - double eff_loose_error = sqrt(obs_counts_loose/exp_counts_loose/exp_counts_loose+obs_counts_loose*obs_counts_loose/exp_counts_loose/exp_counts_loose/exp_counts_loose); - hist_eff_loose_temp->SetBinError(bin+1,eff_loose_error); + hist_eff_loose_temp->SetTotalEvents(bin+1,exp_counts_loose); + hist_eff_loose_temp->SetPassedEvents(bin+1,obs_counts_loose); if (exp_counts >0){ + tot_exp_strict+=exp_counts; + tot_obs_strict+=obs_counts; avg_efficiency_strict+=(obs_counts/exp_counts); - error_avg_efficiency_strict+=(eff_error*eff_error); } if (exp_counts_loose > 0){ + tot_exp_loose+=exp_counts_loose; + tot_obs_loose+=obs_counts_loose; avg_efficiency_loose+=(obs_counts_loose/exp_counts_loose); - error_avg_efficiency_loose+=(eff_loose_error*eff_loose_error); } } eff_hists_strict.push_back(hist_eff_strict_temp); eff_hists_loose.push_back(hist_eff_loose_temp); - //avg_efficiency_strict/=hist_obs_strict_rebin->GetXaxis()->GetNbins(); - //avg_efficiency_loose/=hist_obs_strict_rebin->GetXaxis()->GetNbins(); avg_efficiency_strict/=non_zero_bins_strict; avg_efficiency_loose/=non_zero_bins_loose; error_avg_efficiency_strict=sqrt(error_avg_efficiency_strict); - //error_avg_efficiency_strict/=hist_obs_strict_rebin->GetXaxis()->GetNbins(); error_avg_efficiency_strict/=non_zero_bins_strict; error_avg_efficiency_loose=sqrt(error_avg_efficiency_loose); - //error_avg_efficiency_loose/=hist_obs_strict_rebin->GetXaxis()->GetNbins(); error_avg_efficiency_loose/=non_zero_bins_loose; if (i < 13) { - fmv_eff_strict_avg_layer1->SetBinContent(i+1,avg_efficiency_strict); - fmv_eff_strict_avg_layer1->SetBinError(i+1,error_avg_efficiency_strict); - fmv_eff_loose_avg_layer1->SetBinContent(i+1,avg_efficiency_loose); - fmv_eff_loose_avg_layer1->SetBinError(i+1,error_avg_efficiency_loose); + fmv_eff_strict_avg_layer1->SetTotalEvents(i+1,tot_exp_strict); + fmv_eff_strict_avg_layer1->SetPassedEvents(i+1,tot_obs_strict); + fmv_eff_loose_avg_layer1->SetTotalEvents(i+1,tot_exp_loose); + fmv_eff_loose_avg_layer1->SetPassedEvents(i+1,tot_obs_loose); } else { - fmv_eff_strict_avg_layer2->SetBinContent(i-13+1,avg_efficiency_strict); - fmv_eff_strict_avg_layer2->SetBinError(i-13+1,error_avg_efficiency_strict); - fmv_eff_loose_avg_layer2->SetBinContent(i-13+1,avg_efficiency_loose); - fmv_eff_loose_avg_layer2->SetBinError(i-13+1,error_avg_efficiency_loose); + fmv_eff_strict_avg_layer2->SetTotalEvents(i-13+1,tot_exp_strict); + fmv_eff_strict_avg_layer2->SetPassedEvents(i-13+1,tot_obs_strict); + fmv_eff_loose_avg_layer2->SetTotalEvents(i-13+1,tot_exp_loose); + fmv_eff_loose_avg_layer2->SetPassedEvents(i-13+1,tot_obs_loose); } } diff --git a/configfiles/FMVEfficiency/my_inputs.txt b/configfiles/FMVEfficiency/my_inputs.txt index 5303c2123..e0f7830dc 100644 --- a/configfiles/FMVEfficiency/my_inputs.txt +++ b/configfiles/FMVEfficiency/my_inputs.txt @@ -1 +1 @@ -/pnfs/annie/persistent/users/pershint/ProcessedData/V0/ProcessedRawData_TankMRDR1623S0p3 +/pnfs/annie/persistent/users/mnieslon/data/processed_hits_improved/R3347/ProcessedRawData_TankAndMRDAndCTC_R3347S0p0 diff --git a/configfiles/MrdPaddleEfficiency/Data/FindMrdTracksConfig b/configfiles/MrdPaddleEfficiency/Data/FindMrdTracksConfig index 3ee9c3547..c9aff4e88 100644 --- a/configfiles/MrdPaddleEfficiency/Data/FindMrdTracksConfig +++ b/configfiles/MrdPaddleEfficiency/Data/FindMrdTracksConfig @@ -1,12 +1,12 @@ # FindMrdTracks Config File # all variables retrieved with m_variables.Get() must be defined here! -verbosity 5 +verbosity 0 IsData 1 OutputDirectory . -OutputFile MRDTracks_RAWDataR1613S0p89R0S0 +OutputFile MRDTracks_RAWDataR3347 DrawTruthTracks 0 # whether to add MC Truth track info for drawing in MrdPaddlePlot Tool ## note you need to run that tool to actually view the tracks! WriteTracksToFile 0 # should the track information be written to a ROOT-file? SelectTriggerType 1 #should the loaded data be filtered by trigger type? -TriggerType Cosmic #options: Cosmic, Beam, NoLoopback +TriggerType Beam #options: Cosmic, Beam, NoLoopback diff --git a/configfiles/MrdPaddleEfficiency/Data/LoadANNIEEventConfig b/configfiles/MrdPaddleEfficiency/Data/LoadANNIEEventConfig index 5d29c32f4..b405b6aef 100644 --- a/configfiles/MrdPaddleEfficiency/Data/LoadANNIEEventConfig +++ b/configfiles/MrdPaddleEfficiency/Data/LoadANNIEEventConfig @@ -1,3 +1,4 @@ -verbose 4 +verbose 1 EventOffset 0 FileForListOfInputs ./configfiles/MrdPaddleEfficiency/Data/my_inputs.txt +GlobalEvNr 1 diff --git a/configfiles/MrdPaddleEfficiency/Data/MrdPaddleEfficiencyPreparerConfig b/configfiles/MrdPaddleEfficiency/Data/MrdPaddleEfficiencyPreparerConfig index 96f7594bb..80f75e7c8 100644 --- a/configfiles/MrdPaddleEfficiency/Data/MrdPaddleEfficiencyPreparerConfig +++ b/configfiles/MrdPaddleEfficiency/Data/MrdPaddleEfficiencyPreparerConfig @@ -1,4 +1,4 @@ #MRDPaddleEfficiencyPreparer Config file -OutputFile RAWDataR1613S0p89R0S0 +OutputFile mrd_observed_new_R3347S0_Beam verbosity 1 diff --git a/configfiles/MrdPaddleEfficiency/Data/MrdPaddlePlotConfig b/configfiles/MrdPaddleEfficiency/Data/MrdPaddlePlotConfig index 3dbfddee3..e463a49e6 100644 --- a/configfiles/MrdPaddleEfficiency/Data/MrdPaddlePlotConfig +++ b/configfiles/MrdPaddleEfficiency/Data/MrdPaddlePlotConfig @@ -21,5 +21,5 @@ saverootfile 1 # save the paddle plots within a rootfile. plotDirectory ./MrdPlots # where to save plot images printTClonesTracks 0 # verbose printout of track information from TClonesArray useTApplication 0 # launch a TApplication to directly show the plots (slow on cluster) -OutputROOTFile MRDPaddlePlots_RAWDataR1613S0p89R0S0 +OutputROOTFile MRDPaddlePlots_R3347_Beam DrawOnlyTracks 1 # should subevents only be drawn if there was a track found? diff --git a/configfiles/MrdPaddleEfficiency/Data/TimeClusteringConfig b/configfiles/MrdPaddleEfficiency/Data/TimeClusteringConfig index 6ad8aafd5..5ab839cd2 100644 --- a/configfiles/MrdPaddleEfficiency/Data/TimeClusteringConfig +++ b/configfiles/MrdPaddleEfficiency/Data/TimeClusteringConfig @@ -1,13 +1,12 @@ #TimeClustering config file -verbosity 2 +verbosity 0 MinDigitsForTrack 4 MaxMrdSubEventDuration 30 MinSubeventTimeSep 30 MakeMrdDigitTimePlot 1 LaunchTApplication 0 IsData 1 -OutputROOTFile TimeClustering_RAWDataR1613S0p89R0S0 +OutputROOTFile TimeClustering_R3347 #OutputROOTFile test MapChankey_WCSimID ./configfiles/MrdPaddleEfficiency/MRD_Chankey_WCSimID.dat - diff --git a/configfiles/MrdPaddleEfficiency/Data/ToolsConfig b/configfiles/MrdPaddleEfficiency/Data/ToolsConfig index 9a8cbdf1a..fc6137983 100644 --- a/configfiles/MrdPaddleEfficiency/Data/ToolsConfig +++ b/configfiles/MrdPaddleEfficiency/Data/ToolsConfig @@ -2,5 +2,5 @@ myLoadGeometry LoadGeometry configfiles/LoadGeometry/LoadGeometryConfig myLoadANNIEEvent LoadANNIEEvent configfiles/MrdPaddleEfficiency/Data/LoadANNIEEventConfig myTimeClustering TimeClustering configfiles/MrdPaddleEfficiency/Data/TimeClusteringConfig myFindMrdTracks FindMrdTracks configfiles/MrdPaddleEfficiency/Data/FindMrdTracksConfig -#myPlotMrdTracks MrdPaddlePlot configfiles/MrdPaddleEfficiency/Data/MrdPaddlePlotConfig myMrdPaddleEfficiencyPreparer MrdPaddleEfficiencyPreparer configfiles/MrdPaddleEfficiency/Data/MrdPaddleEfficiencyPreparerConfig +#myPlotMrdTracks MrdPaddlePlot configfiles/MrdPaddleEfficiency/Data/MrdPaddlePlotConfig diff --git a/configfiles/MrdPaddleEfficiency/Data/my_inputs.txt b/configfiles/MrdPaddleEfficiency/Data/my_inputs.txt index e53ad83ef..e0f7830dc 100644 --- a/configfiles/MrdPaddleEfficiency/Data/my_inputs.txt +++ b/configfiles/MrdPaddleEfficiency/Data/my_inputs.txt @@ -1 +1 @@ -/annie/app/users/mnieslon/MyToolAnalysis5/mrdfiles_complete/RAWDataR1613S0p89R0S0 +/pnfs/annie/persistent/users/mnieslon/data/processed_hits_improved/R3347/ProcessedRawData_TankAndMRDAndCTC_R3347S0p0 diff --git a/configfiles/MrdPaddleEfficiencyCalc/MRDCorrectionFactors.dat b/configfiles/MrdPaddleEfficiencyCalc/MRDCorrectionFactors.dat new file mode 100644 index 000000000..ad3f9e7ed --- /dev/null +++ b/configfiles/MrdPaddleEfficiencyCalc/MRDCorrectionFactors.dat @@ -0,0 +1,254 @@ +52 0.80391 1.18172 +53 0.952744 0.99712 +54 0.941703 1.00881 +55 0.943432 1.00696 +56 0.938404 1.01236 +57 0.957645 0.992017 +58 0.940418 1.01019 +59 0.950881 0.999073 +60 0.951423 0.998504 +61 0.955138 0.994621 +62 0.945138 1.00514 +63 0.937649 1.01317 +64 0.940545 1.01005 +65 0.952832 0.997028 +66 0.808368 1.17521 +67 0.814864 1.16584 +68 0.947312 1.00284 +69 0.945395 1.00487 +70 0.944073 1.00628 +71 0.949777 1.00023 +72 0.957611 0.992052 +73 0.950949 0.999002 +74 0.950759 0.999201 +75 0.942096 1.00839 +76 0.958033 0.991615 +77 0.950011 0.999989 +78 0.945359 1.00491 +79 0.951678 0.998237 +80 0.949135 1.00091 +81 0.820479 1.15786 +82 0.817802 1.16165 +83 0.950717 0.999245 +84 0.94666 1.00353 +85 0.947377 1.00277 +86 0.950039 0.999959 +87 0.944171 1.00617 +88 0.954509 0.995276 +89 0.952074 0.997821 +90 0.951844 0.998062 +91 0.953808 0.996007 +92 0.94691 1.00326 +93 0.949008 1.00105 +94 0.829653 1.14506 +95 0.823042 1.15425 +96 0.945311 1.00496 +97 0.951628 0.998289 +98 0.950327 0.999656 +99 0.948223 1.00187 +100 0.948919 1.00114 +101 0.953145 0.9967 +102 0.949969 1.00003 +103 0.952345 0.997537 +104 0.952788 0.997073 +105 0.951435 0.998492 +106 0.945362 1.00491 +107 0.824502 1.15221 +108 0.834586 1.13829 +109 0.921227 1.03123 +110 0.957263 0.992413 +111 0.934416 1.01668 +112 0.944203 1.00614 +113 0.938131 1.01265 +114 0.961682 0.987853 +115 0.925637 1.02632 +116 0.942566 1.00789 +117 0.936785 1.01411 +118 0.96468 0.984782 +119 0.942529 1.00793 +120 0.946023 1.0042 +121 0.936442 1.01448 +122 0.966227 0.983206 +123 0.930268 1.02121 +124 0.848312 1.11987 +125 0.850613 1.11684 +126 0.92341 1.0288 +127 0.957913 0.991739 +128 0.936958 1.01392 +129 0.946248 1.00397 +130 0.936869 1.01402 +131 0.9539 0.995912 +132 0.935068 1.01597 +133 0.943172 1.00724 +134 0.935719 1.01526 +135 0.957978 0.991672 +136 0.94206 1.00843 +137 0.946826 1.00335 +138 0.933964 1.01717 +139 0.960076 0.989505 +140 0.932721 1.01853 +141 0.838555 1.1329 +142 0.803303 1.18262 +143 0.949556 1.00047 +144 0.950553 0.999418 +145 0.950887 0.999067 +146 0.950345 0.999637 +147 0.946221 1.00399 +148 0.945933 1.0043 +149 0.951311 0.998621 +150 0.945381 1.00489 +151 0.951269 0.998666 +152 0.951068 0.998877 +153 0.946287 1.00392 +154 0.805751 1.17902 +155 0.840818 1.12985 +156 0.949915 1.00009 +157 0.95451 0.995275 +158 0.95173 0.998183 +159 0.949355 1.00068 +160 0.948926 1.00113 +161 0.949581 1.00044 +162 0.947714 1.00241 +163 0.949806 1.0002 +164 0.952179 0.997712 +165 0.951701 0.998212 +166 0.949611 1.00041 +167 0.8172 1.16251 +168 0.867368 1.09527 +169 0.930127 1.02137 +170 0.932755 1.01849 +171 0.916486 1.03657 +172 0.931634 1.01971 +173 0.931696 1.01965 +174 0.918004 1.03485 +175 0.93625 1.01469 +176 0.938732 1.012 +177 0.918579 1.03421 +178 0.932639 1.01861 +179 0.930653 1.02079 +180 0.882071 1.07701 +181 0.867596 1.09498 +182 0.932442 1.01883 +183 0.935267 1.01575 +184 0.914272 1.03908 +185 0.934592 1.01649 +186 0.938501 1.01225 +187 0.914517 1.0388 +188 0.932282 1.019 +189 0.936893 1.01399 +190 0.917047 1.03593 +191 0.942542 1.00791 +192 0.932027 1.01928 +193 0.880896 1.07845 +194 0.811667 1.17043 +195 0.944639 1.00568 +196 0.94527 1.005 +197 0.941622 1.0089 +198 0.948677 1.0014 +199 0.943426 1.00697 +200 0.947262 1.00289 +201 0.95423 0.995567 +202 0.946957 1.00321 +203 0.950908 0.999045 +204 0.945928 1.0043 +205 0.944706 1.0056 +206 0.799076 1.18887 +207 0.83192 1.14194 +208 0.949105 1.00094 +209 0.948345 1.00175 +210 0.944793 1.00551 +211 0.946471 1.00373 +212 0.943518 1.00687 +213 0.950907 0.999046 +214 0.944453 1.00587 +215 0.948604 1.00147 +216 0.949714 1.0003 +217 0.947283 1.00287 +218 0.947239 1.00291 +219 0.804316 1.18113 +220 0.939567 1.0111 +221 0.96581 0.98363 +222 0.955483 0.994261 +223 0.961815 0.987716 +224 0.964592 0.984873 +225 0.962515 0.986998 +226 0.96032 0.989253 +227 0.961643 0.987893 +228 0.962377 0.987139 +229 0.965892 0.983547 +230 0.963556 0.985931 +231 0.957838 0.991817 +232 0.963017 0.986483 +233 0.96625 0.983183 +234 0.955837 0.993893 +235 0.950635 0.999332 +236 0.962358 0.987159 +237 0.959297 0.990308 +238 0.95864 0.990988 +239 0.960107 0.989473 +240 0.960709 0.988853 +241 0.9586 0.991029 +242 0.96241 0.987105 +243 0.95534 0.99441 +244 0.959355 0.990249 +245 0.96189 0.987639 +246 0.960901 0.988655 +247 0.959354 0.99025 +248 0.964264 0.985207 +249 0.948404 1.00168 +250 0.818084 1.16125 +251 0.938474 1.01228 +252 0.9356 1.01539 +253 0.941619 1.0089 +254 0.94223 1.00825 +255 0.93374 1.01741 +256 0.94076 1.00982 +257 0.943653 1.00673 +258 0.939091 1.01162 +259 0.938891 1.01183 +260 0.937743 1.01307 +261 0.9388 1.01193 +262 0.797765 1.19083 +263 0.847662 1.12073 +264 0.93725 1.0136 +265 0.934832 1.01623 +266 0.944593 1.00572 +267 0.93748 1.01336 +268 0.944025 1.00633 +269 0.942083 1.0084 +270 0.9384 1.01236 +271 0.938782 1.01195 +272 0.945399 1.00487 +273 0.934068 1.01706 +274 0.930168 1.02132 +275 0.801948 1.18462 +276 0.914286 1.03906 +277 0.947333 1.00281 +278 0.929174 1.02241 +279 0.941285 1.00926 +280 0.942772 1.00767 +281 0.945406 1.00486 +282 0.946511 1.00369 +283 0.946486 1.00371 +284 0.948953 1.0011 +285 0.950045 0.999953 +286 0.949955 1.00005 +287 0.947913 1.0022 +288 0.939828 1.01082 +289 0.951079 0.998866 +290 0.928101 1.0236 +291 0.92133 1.03112 +292 0.950642 0.999325 +293 0.93256 1.0187 +294 0.933838 1.01731 +295 0.941667 1.00885 +296 0.943423 1.00697 +297 0.941875 1.00863 +298 0.943168 1.00724 +299 0.938417 1.01234 +300 0.936782 1.01411 +301 0.941661 1.00886 +302 0.939305 1.01139 +303 0.937083 1.01378 +304 0.944337 1.006 +305 0.916093 1.03701 diff --git a/configfiles/MrdPaddleEfficiencyCalc/MrdPaddleEfficiencyCalcConfig b/configfiles/MrdPaddleEfficiencyCalc/MrdPaddleEfficiencyCalcConfig index 60ec37108..54f8096bc 100644 --- a/configfiles/MrdPaddleEfficiencyCalc/MrdPaddleEfficiencyCalcConfig +++ b/configfiles/MrdPaddleEfficiencyCalc/MrdPaddleEfficiencyCalcConfig @@ -2,10 +2,11 @@ #InputFile /annie/app/users/mnieslon/MyToolAnalysis8/mrd_paddleeff/R1619_R1624_mrdobserved.root #OutputFile R1619_R1624_mrdefficiency.root -InputFile /annie/app/users/mnieslon/MyToolAnalysis_Efficiency/mrd_observed/mrd_observed_R2135_R2146.root -OutputFile mrd_eff_R2135_R2146_MrdGeometry_09-29-20_LayerPlots.root +InputFile /annie/app/users/mnieslon/MyToolAnalysis_Efficiency/mrd_observed_new_R3845-R3850_Cosmic.root +OutputFile mrd_eff_new_R3845-R3850_Cosmic.root InactiveFile ./configfiles/MrdPaddleEfficiencyCalc/MRD_inactivech_eff.txt IsData 1 #Is this a data or MC file? MCChankeyFile ./configfiles/MrdPaddleEfficiencyCalc/MRD_Chankeys_Data_MC.dat #Needed in MC case verbosity 5 LayerPlots 1 #Should layer-wise plots be produced? +CorrectionFile ./configfiles/MrdPaddleEfficiencyCalc/MRDCorrectionFactors.dat