concatenate string and running index into string within a loop
- by user331706
To use a given graphic package I need to define, book and fill histogram.
How can I get the name of the histogram which is a string to concatenate
with 2 integer as a string ( hts_i_j ) in 3 for loop instead.
That has to be done in c++
See the exemple below
to define
TH1F* hts_5_53;
TH1F* hts_5_54;
……
TH1F* hts_5_69;
to book
hts_5_53= HDir.make("hts_5_53")," Title", 100,0.,100.);
hts_5_54-HDir.make("hts_5_54")," Title", 100,0.,100.);
……
hts_16_69-HDir.make("hts_16_69")," Title", 100,0.,100.);
to fill
hts_5_53-Fill(f)
hts_5_54-Fill(f)
……
hts_16_69-Fill(f)
Instead I would like to define, book and fill in 3 for loops.
e.g
.
for(int i=5, i<17, ++i){
for(int j=53, j<70, ++j){
hts_i_j
}
}
how can I get the string hts to concatenate with the
indices ( i,j) in a simple short way while defining,
booking and filling in 3 for loop instead