File tree Expand file tree Collapse file tree 2 files changed +18
-16
lines changed
Detectors/MUON/MCH/Align/src Expand file tree Collapse file tree 2 files changed +18
-16
lines changed Original file line number Diff line number Diff line change 99// granted to it by virtue of its status as an Intergovernmental Organization
1010// or submit itself to any jurisdiction.
1111#include < filesystem>
12+ #include < sstream>
1213
1314#include " MCHAlign/AlignRecordSpec.h"
1415
@@ -120,14 +121,14 @@ class AlignRecordTask
120121 mImproveCutChi2 = 2 . * trackerParam.sigmaCutForImprovement * trackerParam.sigmaCutForImprovement ;
121122
122123 // Configuration for chamber fixing
123- auto chambers = ic.options ().get <string>(" fix-chamber" );
124- for ( int i = 0 ; i < chambers. length (); ++i) {
125- if (chambers[i] == ' , ' ) {
126- continue ;
127- }
128- int chamber = chambers[i] - ' 0 ' ;
129- LOG (info) << Form (" %s%d" , " Fixing chamber: " , chamber );
130- mAlign .FixChamber (chamber );
124+ auto input_fixchambers = ic.options ().get <string>(" fix-chamber" );
125+ std::stringstream string_chambers (input_fixchambers);
126+ string_chambers >> std::ws;
127+ while (string_chambers. good ()) {
128+ string substr;
129+ std::getline (string_chambers, substr, ' , ' ) ;
130+ LOG (info) << Form (" %s%d" , " Fixing chamber: " , std::stoi (substr) );
131+ mAlign .FixChamber (std::stoi (substr) );
131132 }
132133
133134 // Init for output saving
Original file line number Diff line number Diff line change 2323#include < chrono>
2424#include < iostream>
2525#include < filesystem>
26+ #include < sstream>
2627
2728#include < TCanvas.h>
2829#include < TChain.h>
@@ -222,14 +223,14 @@ class AlignmentTask
222223 mImproveCutChi2 = 2 . * trackerParam.sigmaCutForImprovement * trackerParam.sigmaCutForImprovement ;
223224
224225 // Fix chambers
225- auto chambers = ic.options ().get <string>(" fix-chamber" );
226- for ( int i = 0 ; i < chambers. length (); ++i) {
227- if (chambers[i] == ' , ' ) {
228- continue ;
229- }
230- int chamber = chambers[i] - ' 0 ' ;
231- LOG (info) << Form (" %s%d" , " Fixing chamber: " , chamber );
232- mAlign .FixChamber (chamber );
226+ auto input_fixchambers = ic.options ().get <string>(" fix-chamber" );
227+ std::stringstream string_chambers (input_fixchambers);
228+ string_chambers >> std::ws;
229+ while (string_chambers. good ()) {
230+ string substr;
231+ std::getline (string_chambers, substr, ' , ' ) ;
232+ LOG (info) << Form (" %s%d" , " Fixing chamber: " , std::stoi (substr) );
233+ mAlign .FixChamber (std::stoi (substr) );
233234 }
234235
235236 doMatched = ic.options ().get <bool >(" matched" );
You can’t perform that action at this time.
0 commit comments