| 1 |
mocchiut |
1.1 |
typedef struct Levels { |
| 2 |
|
|
Int_t calo; |
| 3 |
|
|
Int_t calol2; |
| 4 |
|
|
Int_t tof; |
| 5 |
|
|
Int_t track; |
| 6 |
|
|
Int_t track2; |
| 7 |
|
|
Int_t s4; |
| 8 |
|
|
Int_t ac; |
| 9 |
|
|
Int_t nd; |
| 10 |
|
|
} level; |
| 11 |
|
|
|
| 12 |
|
|
typedef struct Variables { |
| 13 |
|
|
Float_t sfx; // scale factor x |
| 14 |
|
|
Float_t sfy; // scale factor y |
| 15 |
|
|
Float_t xxvc; // x coordinate of the x-view |
| 16 |
|
|
Float_t yxvc; // y coordinate of the x-view |
| 17 |
|
|
Float_t xyvc; // x coordinate of the y-view |
| 18 |
|
|
Float_t yyvc; // y coordinate of the y-view |
| 19 |
|
|
Float_t xcat; // x coordinate of the cat view |
| 20 |
|
|
Float_t ycat; // y coordinate of the cat view |
| 21 |
|
|
Float_t nds4; // scaling factor for ND and S4 |
| 22 |
|
|
Float_t rig; // rigidity from the tracker (track number 1) |
| 23 |
|
|
Float_t chi2; // chi2 of the fitted track (track number 1) |
| 24 |
|
|
Float_t sbase[2][22][96]; // calorimeter old baselines |
| 25 |
|
|
Float_t DSPsig_par[12][3072]; //tracker sigma calibration data |
| 26 |
|
|
Float_t s4sig; // S4 calibrated signal |
| 27 |
|
|
Float_t beta[5]; // TOF beta infos |
| 28 |
|
|
Int_t bw; // black and white flag |
| 29 |
|
|
Int_t nosig; // flag to show only detectors and no signals |
| 30 |
|
|
Int_t etime; // time of the event (OBT) |
| 31 |
|
|
Int_t headc; // event number |
| 32 |
|
|
Int_t nstrip; // strip hit, info from CALO |
| 33 |
|
|
Int_t qtot; // total energy (MIP), info from CALO |
| 34 |
|
|
Int_t nclx; // number of cluster in the x view, info from TRK |
| 35 |
|
|
Int_t ncly; // number of cluster in the y view, info from TRK |
| 36 |
|
|
Int_t trup; // number of neutron upper half, info from ND |
| 37 |
|
|
Int_t bkup; // number of background neutron upper half, info from ND |
| 38 |
|
|
Int_t bkbo; // number of background neutron lower half, info from ND |
| 39 |
|
|
Int_t hcas; // number of hit in cas, info from AC |
| 40 |
|
|
Int_t hcat; // number of hit in cat, info from AC |
| 41 |
|
|
Int_t hcard;// number of hit in card, info from AC |
| 42 |
|
|
Int_t tracknds4; // flag to display the track in ND and S4 |
| 43 |
|
|
Int_t i; // event number |
| 44 |
|
|
Int_t doflag; //going forward or backward? |
| 45 |
|
|
Int_t jumpto; // event number to jump to |
| 46 |
|
|
Int_t lastevno; // last event number |
| 47 |
|
|
Int_t firstevno; // first event number |
| 48 |
|
|
Long64_t nevents; // number of events in the ntuple |
| 49 |
|
|
} var; |
| 50 |
|
|
|
| 51 |
|
|
Int_t WhatToDoEV(Variables & var, const char *file, TString outDir, TString figty, TCanvas &figure) { |
| 52 |
|
|
char *bw; |
| 53 |
|
|
if ( var.bw ){ |
| 54 |
|
|
bw = "bw"; |
| 55 |
|
|
} else { |
| 56 |
|
|
bw = ""; |
| 57 |
|
|
}; |
| 58 |
|
|
var.jumpto = 0; |
| 59 |
|
|
stringstream input; |
| 60 |
|
|
stringstream input2; |
| 61 |
|
|
stringstream input3; |
| 62 |
|
|
char tellme[256]; |
| 63 |
|
|
char tellme2[256]; |
| 64 |
|
|
char tellme3[256]; |
| 65 |
|
|
stringstream out; |
| 66 |
|
|
out.str("x"); |
| 67 |
|
|
input2.str("zzzzzzzzzzzzzz"); |
| 68 |
|
|
input3.str("z"); |
| 69 |
|
|
input << out.str().c_str(); |
| 70 |
|
|
stringstream stc; |
| 71 |
|
|
stringstream stc2; |
| 72 |
|
|
while ( !strcmp(input.str().c_str(),out.str().c_str()) ) { |
| 73 |
|
|
printf("\nPress <enter> to continue, b<enter> to go backward, j<enter> to jump,\np<enter> to save the figure, o<enter> for more options, q<enter> to quit: \n"); |
| 74 |
|
|
cin.getline(tellme,256); |
| 75 |
|
|
// |
| 76 |
|
|
input.str(""); |
| 77 |
|
|
input << tellme; |
| 78 |
|
|
out << "y"; |
| 79 |
|
|
// |
| 80 |
|
|
stc.str("o"); |
| 81 |
|
|
// |
| 82 |
|
|
if ( !strcmp(input.str().c_str(),stc.str().c_str()) ) { |
| 83 |
|
|
stringstream input4; |
| 84 |
|
|
char tellme4[256]; |
| 85 |
|
|
stringstream out4; |
| 86 |
|
|
out4.str("a"); |
| 87 |
|
|
input4 << out4.str().c_str(); |
| 88 |
|
|
while ( !strcmp(input4.str().c_str(),out4.str().c_str()) ) { |
| 89 |
|
|
printf("\nPress <enter> to go back to previous menu, c<enter> to toggle B/W visualization,\nt<enter> to toggle track visualization in S4 and ND: \n"); |
| 90 |
|
|
cin.getline(tellme4,256); |
| 91 |
|
|
input4.str(""); |
| 92 |
|
|
input4 << tellme4; |
| 93 |
|
|
out4.str("1"); |
| 94 |
|
|
out.str(""); |
| 95 |
|
|
out << input.str().c_str(); |
| 96 |
|
|
// |
| 97 |
|
|
stc2.str("c"); |
| 98 |
|
|
if ( !strcmp(input4.str().c_str(),stc2.str().c_str()) ) { |
| 99 |
|
|
if ( !var.bw ){ |
| 100 |
|
|
printf("\n --> B/W visualization\n"); |
| 101 |
|
|
var.bw = 1; |
| 102 |
|
|
} else { |
| 103 |
|
|
printf("\n --> colour visualization\n"); |
| 104 |
|
|
var.bw = 0; |
| 105 |
|
|
}; |
| 106 |
|
|
var.i--; |
| 107 |
|
|
out.str("1"); |
| 108 |
|
|
}; |
| 109 |
|
|
// |
| 110 |
|
|
stc2.str("t"); |
| 111 |
|
|
if ( !strcmp(input4.str().c_str(),stc2.str().c_str()) ) { |
| 112 |
|
|
if ( !var.tracknds4 ){ |
| 113 |
|
|
printf("\n --> track visualization in S4 and ND\n"); |
| 114 |
|
|
var.tracknds4 = 1; |
| 115 |
|
|
} else { |
| 116 |
|
|
printf("\n --> no track visualization in S4 and ND\n"); |
| 117 |
|
|
var.tracknds4 = 0; |
| 118 |
|
|
}; |
| 119 |
|
|
var.i--; |
| 120 |
|
|
out.str("1"); |
| 121 |
|
|
}; |
| 122 |
|
|
}; |
| 123 |
|
|
}; |
| 124 |
|
|
// |
| 125 |
|
|
stc.str("b"); |
| 126 |
|
|
// |
| 127 |
|
|
if ( !strcmp(input.str().c_str(),stc.str().c_str()) ) { |
| 128 |
|
|
if ( var.i > 0 ) { |
| 129 |
|
|
printf("WARNING: going backward!\n\n"); |
| 130 |
|
|
var.doflag = 2; |
| 131 |
|
|
} else { |
| 132 |
|
|
printf("This is the first event, you can't go backward! \n"); |
| 133 |
|
|
out.str(""); |
| 134 |
|
|
out << input.str().c_str(); |
| 135 |
|
|
}; |
| 136 |
|
|
}; |
| 137 |
|
|
// |
| 138 |
|
|
stc.str("j"); |
| 139 |
|
|
// |
| 140 |
|
|
if ( !strcmp(input.str().c_str(),stc.str().c_str()) ) { |
| 141 |
|
|
printf("\n Do you want to jump to a progressive number [p] or to an event number [e]? "); |
| 142 |
|
|
cin.getline(tellme3,256); |
| 143 |
|
|
input3.str(""); |
| 144 |
|
|
input3 << tellme3; |
| 145 |
|
|
// |
| 146 |
|
|
stc2.str("p"); |
| 147 |
|
|
if ( !strcmp(input3.str().c_str(),stc2.str().c_str()) ) { |
| 148 |
|
|
printf("\n Enter the progressive number you want to jump to: "); |
| 149 |
|
|
cin.getline(tellme2,256); |
| 150 |
|
|
input2.str(""); |
| 151 |
|
|
input2 << tellme2; |
| 152 |
|
|
Int_t j; |
| 153 |
|
|
j = atoi(input2.str().c_str()); |
| 154 |
|
|
if ( j < 1 || j > var.nevents+1 ) { |
| 155 |
|
|
printf("\n You can choose between 1 and %i \n",(int)var.nevents+1); |
| 156 |
|
|
out.str(""); |
| 157 |
|
|
out << input.str().c_str(); |
| 158 |
|
|
} else { |
| 159 |
|
|
printf("\n Jumping to progressive number %i\n\n",j); |
| 160 |
|
|
var.i = j-2; |
| 161 |
|
|
}; |
| 162 |
|
|
}; |
| 163 |
|
|
// |
| 164 |
|
|
stc2.str("e"); |
| 165 |
|
|
if ( !strcmp(input3.str().c_str(),stc2.str().c_str()) ) { |
| 166 |
|
|
printf("\n Enter the event number you want to jump to: "); |
| 167 |
|
|
cin.getline(tellme2,256); |
| 168 |
|
|
input2.str(""); |
| 169 |
|
|
input2 << tellme2; |
| 170 |
|
|
Int_t j; |
| 171 |
|
|
j = atoi(input2.str().c_str()); |
| 172 |
|
|
if ( j < var.firstevno || j > var.lastevno ) { |
| 173 |
|
|
printf("\n You can choose between %i and %i \n",var.firstevno,var.lastevno); |
| 174 |
|
|
out.str(""); |
| 175 |
|
|
out << input.str().c_str(); |
| 176 |
|
|
} else { |
| 177 |
|
|
printf("\n Jumping to event number %i\n\n",j); |
| 178 |
|
|
var.jumpto = j; |
| 179 |
|
|
var.i = -1; |
| 180 |
|
|
}; |
| 181 |
|
|
}; |
| 182 |
|
|
// |
| 183 |
|
|
stc.str("p"); |
| 184 |
|
|
stc2.str("e"); |
| 185 |
|
|
if ( strcmp(input3.str().c_str(),stc2.str().c_str()) && strcmp(input3.str().c_str(),stc.str().c_str()) ) { |
| 186 |
|
|
printf(" You must type or \"p\" or \"e\"\n"); |
| 187 |
|
|
out.str(""); |
| 188 |
|
|
out << input.str().c_str(); |
| 189 |
|
|
}; |
| 190 |
|
|
}; |
| 191 |
|
|
// |
| 192 |
|
|
stc.str("q"); |
| 193 |
|
|
stc2.str(".q"); |
| 194 |
|
|
// |
| 195 |
|
|
if ( !strcmp(input.str().c_str(),stc.str().c_str()) || !strcmp(input.str().c_str(),stc2.str().c_str()) ) { |
| 196 |
|
|
printf("Exiting...\n"); |
| 197 |
|
|
return(1); |
| 198 |
|
|
}; |
| 199 |
|
|
// |
| 200 |
|
|
stc.str("p"); |
| 201 |
|
|
// |
| 202 |
|
|
if ( !strcmp(input.str().c_str(),stc.str().c_str()) ) { |
| 203 |
|
|
printf("Enter a file extension recognized by ROOT (ps, eps, gif,...):\n"); |
| 204 |
|
|
cin.getline(tellme2,256); |
| 205 |
|
|
input2.str(""); |
| 206 |
|
|
input2 << tellme2; |
| 207 |
|
|
out.str(""); |
| 208 |
|
|
out << input.str().c_str(); |
| 209 |
|
|
// |
| 210 |
|
|
TString filename = file; |
| 211 |
|
|
const string fil = (const char*)filename; |
| 212 |
|
|
Int_t posiz = fil.find("dw_"); |
| 213 |
|
|
if ( posiz == -1 ) posiz = fil.find("DW_"); |
| 214 |
|
|
Int_t posiz2 = posiz+13; |
| 215 |
|
|
TString file2; |
| 216 |
|
|
stringcopy(file2,filename,posiz,posiz2); |
| 217 |
|
|
const char *figrec = file2; |
| 218 |
|
|
const char *outdir = outDir; |
| 219 |
|
|
stringstream figsave; |
| 220 |
|
|
const char *ty = figty; |
| 221 |
|
|
figsave.str(""); |
| 222 |
|
|
figsave << outdir << "/"; |
| 223 |
|
|
figsave << ty << "_"; |
| 224 |
|
|
figsave << (var.i+1) << "_"; |
| 225 |
|
|
figsave << figrec; |
| 226 |
|
|
figsave << bw << "."; |
| 227 |
|
|
figsave << input2.str().c_str(); |
| 228 |
|
|
figure.SaveAs(figsave.str().c_str()); |
| 229 |
|
|
printf("\n"); |
| 230 |
|
|
}; |
| 231 |
|
|
}; |
| 232 |
|
|
return(0); |
| 233 |
|
|
} |