@@ -504,8 +504,6 @@ void create_val_file_rooutil(std::string filename, std::string outfilename) {
504504 TH1F * h_calodigis_peakpos_ = new TH1F ("h_calodigis_peakpos_" , "" , 100 ,0 ,100 );
505505 TH1F * h_calodigis_caloRecoDigiIdx_ = new TH1F ("h_calodigis_caloRecoDigiIdx_" , "" , 100 ,0 ,100 );
506506
507- TH1F * h_triginfo = new TH1F ("h_triginfo" , "" , mu2e ::TrigInfo ::ntrig_ ,0 ,mu2e ::TrigInfo ::ntrig_ );
508-
509507 TH1F * h_mcsteps_virtualdetector_vid = new TH1F ("h_mcsteps_virtualdetector_vid" , "" , 150 ,0 ,150 );
510508 TH1F * h_mcsteps_virtualdetector_sid = new TH1F ("h_mcsteps_virtualdetector_sid" , "" , 100 ,0 ,100 );
511509 TH1F * h_mcsteps_virtualdetector_iinter = new TH1F ("h_mcsteps_virtualdetector_iinter" , "" , 100 ,0 ,100 );
@@ -526,6 +524,8 @@ void create_val_file_rooutil(std::string filename, std::string outfilename) {
526524
527525 // Grab the first event to name the bins
528526 const auto& evt = util .GetEvent (0 );
527+ int max_triginfo_bin = evt .trigger .NameToIndexMap ().size ();
528+ TH1F * h_triginfo = new TH1F ("h_triginfo" , "" , max_triginfo_bin ,0 ,max_triginfo_bin );
529529 for (const auto pair : evt .trigger .NameToIndexMap ()) {
530530 h_triginfo -> GetXaxis ()- > SetBinLabel (pair .second + 1 , pair .first .c_str ());
531531 }
@@ -1168,7 +1168,7 @@ void create_val_file_rooutil(std::string filename, std::string outfilename) {
11681168
11691169 // Creating triginfo histogram
11701170 std ::cout << "Creating triginfo histogram" << std ::endl ;
1171- for (int i_trig = 0 ; i_trig < mu2e :: TrigInfo :: ntrig_ ; ++ i_trig ) {
1171+ for (int i_trig = 0 ; i_trig < max_triginfo_bin ; ++ i_trig ) {
11721172 h_triginfo -> AddBinContent (i_trig + 1 , event .triginfo ._triggerArray [i_trig ]);
11731173 }
11741174
0 commit comments