File indexing completed on 2024-04-06 11:58:25
0001 #ifndef vDriftHistos_H
0002 #define vDriftHistos_H
0003
0004 #include "TH1.h"
0005 #include "TString.h"
0006 #include "TFile.h"
0007 #include "DTTMax.h"
0008 #include <string>
0009
0010
0011 class h4DSegm {
0012 public:
0013 h4DSegm(std::string name_) {
0014 TString N = name_.c_str();
0015 name = name_.c_str();
0016 h4DSegmXPosInCham = new TH1F(N + "_h4DSegmXPosInCham", "4D Segment x position (cm) in Chamber RF", 200, -200, 200);
0017 h4DSegmYPosInCham = new TH1F(N + "_h4DSegmYPosInCham", "4D Segment y position (cm) in Chamber RF", 200, -200, 200);
0018 h4DSegmPhiAngleInCham =
0019 new TH1F(N + "_h4DSegmPhiAngleInCham", "4D Segment phi angle (rad) in Chamber RF", 180, -180, 180);
0020 h4DSegmThetaAngleInCham =
0021 new TH1F(N + "_h4DSegmThetaAngleInCham", "4D Segment theta angle (rad) in Chamber RF", 180, -180, 180);
0022 h4DSegmImpactAngleInCham =
0023 new TH1F(N + "_h4DSegmImpactAngleInCham", "4D Segment impact angle (rad) in Chamber RF", 180, -180, 180);
0024 }
0025 h4DSegm(const TString &name_, TFile *file) {
0026 name = name_;
0027 h4DSegmXPosInCham = (TH1F *)file->Get(name + "_h4DSegmXPosInCham");
0028 h4DSegmYPosInCham = (TH1F *)file->Get(name + "_h4DSegmYPosInCham");
0029 h4DSegmPhiAngleInCham = (TH1F *)file->Get(name + "_h4DSegmPhiAngleInCham");
0030 h4DSegmThetaAngleInCham = (TH1F *)file->Get(name + "_h4DSegmThetaAngleInCham");
0031 h4DSegmImpactAngleInCham = (TH1F *)file->Get(name + "_h4DSegmImpactAngleInCham");
0032 }
0033 ~h4DSegm() {
0034 delete h4DSegmXPosInCham;
0035 delete h4DSegmYPosInCham;
0036 delete h4DSegmPhiAngleInCham;
0037 delete h4DSegmThetaAngleInCham;
0038 delete h4DSegmImpactAngleInCham;
0039 }
0040 void Fill(float x, float y, float phi, float theta, float impact) {
0041 h4DSegmXPosInCham->Fill(x);
0042 h4DSegmYPosInCham->Fill(y);
0043 h4DSegmPhiAngleInCham->Fill(phi);
0044 h4DSegmThetaAngleInCham->Fill(theta);
0045 h4DSegmImpactAngleInCham->Fill(impact);
0046 }
0047 void Fill(float x, float phi) {
0048 h4DSegmXPosInCham->Fill(x);
0049 h4DSegmPhiAngleInCham->Fill(phi);
0050 }
0051 void Write() {
0052 h4DSegmXPosInCham->Write();
0053 h4DSegmYPosInCham->Write();
0054 h4DSegmPhiAngleInCham->Write();
0055 h4DSegmThetaAngleInCham->Write();
0056 h4DSegmImpactAngleInCham->Write();
0057 }
0058
0059 public:
0060 TH1F *h4DSegmXPosInCham;
0061 TH1F *h4DSegmYPosInCham;
0062 TH1F *h4DSegmPhiAngleInCham;
0063 TH1F *h4DSegmThetaAngleInCham;
0064 TH1F *h4DSegmImpactAngleInCham;
0065
0066 TString name;
0067 };
0068
0069
0070 class h2DSegm {
0071 public:
0072 h2DSegm(std::string name_) {
0073 TString N = name_.c_str();
0074 name = name_.c_str();
0075 h2DSegmPosInCham = new TH1F(N + "_h2DSegmPosInCham", "2D Segment position (cm) in Chamber RF", 200, -200, 200);
0076 h2DSegmAngleInCham = new TH1F(N + "_h2DSegmAngleInCham", "2D Segment angle (rad) in Chamber RF", 200, -2, 2);
0077 h2DSegmCosAngleInCham = new TH1F(N + "_h2DSegmCosAngleInCham", "2D Segment cos(angle) in Chamber RF", 200, -2, 2);
0078 }
0079 h2DSegm(const TString &name_, TFile *file) {
0080 name = name_;
0081
0082 h2DSegmPosInCham = (TH1F *)file->Get(name + "_h2DSegmPosInCham");
0083 h2DSegmAngleInCham = (TH1F *)file->Get(name + "_h2DSegmAngleInCham");
0084 h2DSegmCosAngleInCham = (TH1F *)file->Get(name + "_h2DSegmCosAngleInCham");
0085 }
0086 ~h2DSegm() {
0087 delete h2DSegmPosInCham;
0088 delete h2DSegmAngleInCham;
0089 delete h2DSegmCosAngleInCham;
0090 }
0091 void Fill(float pos, float localAngle) {
0092 h2DSegmPosInCham->Fill(pos);
0093 h2DSegmAngleInCham->Fill(atan(localAngle));
0094 h2DSegmCosAngleInCham->Fill(cos(atan(localAngle)));
0095 }
0096 void Write() {
0097 h2DSegmPosInCham->Write();
0098 h2DSegmAngleInCham->Write();
0099 h2DSegmCosAngleInCham->Write();
0100 }
0101
0102 public:
0103 TH1F *h2DSegmPosInCham;
0104 TH1F *h2DSegmAngleInCham;
0105 TH1F *h2DSegmCosAngleInCham;
0106
0107 TString name;
0108 };
0109
0110
0111 class hTMaxCell {
0112 public:
0113 hTMaxCell(const TString &name_) {
0114 name = name_;
0115
0116
0117 hTmax123 = new TH1F(name + "_Tmax123", "Tmax123 value", 2000, -1000., 1000.);
0118 hTmax124s72 = new TH1F(name + "_Tmax124_s72", "Tmax124 sigma=sqrt(7/2) value", 2000, -1000., 1000.);
0119 hTmax124s78 = new TH1F(name + "_Tmax124_s78", "Tmax124 sigma=sqrt(7/8) value", 2000, -1000., 1000.);
0120 hTmax134s72 = new TH1F(name + "_Tmax134_s72", "Tmax134 sigma=sqrt(7/2) value", 2000, -1000., 1000.);
0121 hTmax134s78 = new TH1F(name + "_Tmax134_s78", "Tmax134 sigma=sqrt(7/8) value", 2000, -1000., 1000.);
0122 hTmax234 = new TH1F(name + "_Tmax234", "Tmax234 value", 2000, -1000., 1000.);
0123 hTmax_3t0 = new TH1F(name + "_3t0", "Tmax+3*Delta(t0)", 2000, -1000., 1000.);
0124 hTmax_3t0_0 = new TH1F(name + "_3t0_0", "Tmax+3*Delta(t0); 3 hits", 2000, -1000., 1000.);
0125 hTmax_3t0_1 = new TH1F(name + "_3t0_1", "Tmax+3*Delta(t0); one t<5ns", 2000, -1000., 1000.);
0126 hTmax_3t0_2 = new TH1F(name + "_3t0_2", "Tmax+3*Delta(t0); one t<10ns", 2000, -1000., 1000.);
0127 hTmax_3t0_3 = new TH1F(name + "_3t0_3", "Tmax+3*Delta(t0); one t<20ns", 2000, -1000., 1000.);
0128 hTmax_3t0_4 = new TH1F(name + "_3t0_4", "Tmax+3*Delta(t0); one t<50ns", 2000, -1000., 1000.);
0129 hTmax_3t0_5 = new TH1F(name + "_3t0_5", "Tmax+3*Delta(t0); all t>50ns", 2000, -1000., 1000.);
0130 hTmax_2t0 = new TH1F(name + "_2t0", "Tmax+2*Delta(t0)", 2000, -1000., 1000.);
0131 hTmax_2t0_0 = new TH1F(name + "_2t0_0", "Tmax+2*Delta(t0); 3 hits", 2000, -1000., 1000.);
0132 hTmax_2t0_1 = new TH1F(name + "_2t0_1", "Tmax+2*Delta(t0); one t<5ns", 2000, -1000., 1000.);
0133 hTmax_2t0_2 = new TH1F(name + "_2t0_2", "Tmax+2*Delta(t0); one t<10ns", 2000, -1000., 1000.);
0134 hTmax_2t0_3 = new TH1F(name + "_2t0_3", "Tmax+2*Delta(t0); one t<20ns", 2000, -1000., 1000.);
0135 hTmax_2t0_4 = new TH1F(name + "_2t0_4", "Tmax+2*Delta(t0); one t<50ns", 2000, -1000., 1000.);
0136 hTmax_2t0_5 = new TH1F(name + "_2t0_5", "Tmax+2*Delta(t0); all t>50ns", 2000, -1000., 1000.);
0137 hTmax_t0 = new TH1F(name + "_t0", "Tmax+Delta(t0)", 2000, -1000., 1000.);
0138 hTmax_t0_0 = new TH1F(name + "_t0_0", "Tmax+Delta(t0); 3 hits", 2000, -1000., 1000.);
0139 hTmax_t0_1 = new TH1F(name + "_t0_1", "Tmax+Delta(t0); one t<5ns", 2000, -1000., 1000.);
0140 hTmax_t0_2 = new TH1F(name + "_t0_2", "Tmax+Delta(t0); one t<10ns", 2000, -1000., 1000.);
0141 hTmax_t0_3 = new TH1F(name + "_t0_3", "Tmax+Delta(t0); one t<20ns", 2000, -1000., 1000.);
0142 hTmax_t0_4 = new TH1F(name + "_t0_4", "Tmax+Delta(t0); one t<50ns", 2000, -1000., 1000.);
0143 hTmax_t0_5 = new TH1F(name + "_t0_5", "Tmax+Delta(t0); all t>50ns", 2000, -1000., 1000.);
0144 hTmax_0 = new TH1F(name + "_0", "Tmax", 2000, -1000., 1000.);
0145 }
0146
0147 hTMaxCell(const TString &name_, TFile *file) {
0148 name = name_;
0149 hTmax123 = (TH1F *)file->Get(name + "_Tmax123");
0150 hTmax124s72 = (TH1F *)file->Get(name + "_Tmax124_s72");
0151 hTmax124s78 = (TH1F *)file->Get(name + "_Tmax124_s78");
0152 hTmax134s72 = (TH1F *)file->Get(name + "_Tmax134_s72");
0153 hTmax134s78 = (TH1F *)file->Get(name + "_Tmax134_s78");
0154 hTmax234 = (TH1F *)file->Get(name + "_Tmax234");
0155 hTmax_3t0 = (TH1F *)file->Get(name + "_3t0");
0156 hTmax_3t0_0 = (TH1F *)file->Get(name + "_3t0_0");
0157 hTmax_3t0_1 = (TH1F *)file->Get(name + "_3t0_1");
0158 hTmax_3t0_2 = (TH1F *)file->Get(name + "_3t0_2");
0159 hTmax_3t0_3 = (TH1F *)file->Get(name + "_3t0_3");
0160 hTmax_3t0_4 = (TH1F *)file->Get(name + "_3t0_4");
0161 hTmax_3t0_5 = (TH1F *)file->Get(name + "_3t0_5");
0162 hTmax_2t0 = (TH1F *)file->Get(name + "_2t0");
0163 hTmax_2t0_0 = (TH1F *)file->Get(name + "_2t0_0");
0164 hTmax_2t0_1 = (TH1F *)file->Get(name + "_2t0_1");
0165 hTmax_2t0_2 = (TH1F *)file->Get(name + "_2t0_2");
0166 hTmax_2t0_3 = (TH1F *)file->Get(name + "_2t0_3");
0167 hTmax_2t0_4 = (TH1F *)file->Get(name + "_2t0_4");
0168 hTmax_2t0_5 = (TH1F *)file->Get(name + "_2t0_5");
0169 hTmax_t0 = (TH1F *)file->Get(name + "_t0");
0170 hTmax_t0_1 = (TH1F *)file->Get(name + "_t0_1");
0171 hTmax_t0_2 = (TH1F *)file->Get(name + "_t0_2");
0172 hTmax_t0_3 = (TH1F *)file->Get(name + "_t0_3");
0173 hTmax_t0_4 = (TH1F *)file->Get(name + "_t0_4");
0174 hTmax_t0_5 = (TH1F *)file->Get(name + "_t0_5");
0175 hTmax_0 = (TH1F *)file->Get(name + "_0");
0176 }
0177
0178 ~hTMaxCell() {
0179 delete hTmax123;
0180 delete hTmax124s72;
0181 delete hTmax124s78;
0182 delete hTmax134s72;
0183 delete hTmax134s78;
0184 delete hTmax234;
0185 delete hTmax_3t0;
0186 delete hTmax_3t0_0;
0187 delete hTmax_3t0_1;
0188 delete hTmax_3t0_2;
0189 delete hTmax_3t0_3;
0190 delete hTmax_3t0_4;
0191 delete hTmax_3t0_5;
0192 delete hTmax_2t0;
0193 delete hTmax_2t0_0;
0194 delete hTmax_2t0_1;
0195 delete hTmax_2t0_2;
0196 delete hTmax_2t0_3;
0197 delete hTmax_2t0_4;
0198 delete hTmax_2t0_5;
0199 delete hTmax_t0;
0200 delete hTmax_t0_0;
0201 delete hTmax_t0_1;
0202 delete hTmax_t0_2;
0203 delete hTmax_t0_3;
0204 delete hTmax_t0_4;
0205 delete hTmax_t0_5;
0206 delete hTmax_0;
0207 }
0208
0209 void Fill(float tmax123,
0210 float tmax124,
0211 float tmax134,
0212 float tmax234,
0213 dttmaxenums::SigmaFactor s124,
0214 dttmaxenums::SigmaFactor s134,
0215 unsigned t0_123,
0216 unsigned t0_124,
0217 unsigned t0_134,
0218 unsigned t0_234,
0219 unsigned hSubGroup
0220 ) {
0221 if (tmax123 > 0.) {
0222 hTmax123->Fill(tmax123);
0223 if (t0_123 == 1) {
0224 hTmax_t0->Fill(tmax123);
0225 switch (hSubGroup) {
0226 case 0:
0227 hTmax_t0_0->Fill(tmax123);
0228 break;
0229 case 1:
0230 hTmax_t0_1->Fill(tmax123);
0231 break;
0232 case 2:
0233 hTmax_t0_2->Fill(tmax123);
0234 break;
0235 case 3:
0236 hTmax_t0_3->Fill(tmax123);
0237 break;
0238 case 4:
0239 hTmax_t0_4->Fill(tmax123);
0240 break;
0241 case 99:
0242 hTmax_t0_5->Fill(tmax123);
0243 break;
0244 }
0245 } else {
0246 hTmax_2t0->Fill(tmax123);
0247 switch (hSubGroup) {
0248 case 0:
0249 hTmax_2t0_0->Fill(tmax123);
0250 break;
0251 case 1:
0252 hTmax_2t0_1->Fill(tmax123);
0253 break;
0254 case 2:
0255 hTmax_2t0_2->Fill(tmax123);
0256 break;
0257 case 3:
0258 hTmax_2t0_3->Fill(tmax123);
0259 break;
0260 case 4:
0261 hTmax_2t0_4->Fill(tmax123);
0262 break;
0263 case 99:
0264 hTmax_2t0_5->Fill(tmax123);
0265 break;
0266 }
0267 }
0268 }
0269 if (tmax124 > 0.) {
0270 (s124 == dttmaxenums::r72) ? hTmax124s72->Fill(tmax124) : hTmax124s78->Fill(tmax124);
0271 if (t0_124 == 0)
0272 hTmax_0->Fill(tmax124);
0273 else if (t0_124 == 1) {
0274 hTmax_t0->Fill(tmax124);
0275 switch (hSubGroup) {
0276 case 0:
0277 hTmax_t0_0->Fill(tmax124);
0278 break;
0279 case 1:
0280 hTmax_t0_1->Fill(tmax124);
0281 break;
0282 case 2:
0283 hTmax_t0_2->Fill(tmax124);
0284 break;
0285 case 3:
0286 hTmax_t0_3->Fill(tmax124);
0287 break;
0288 case 4:
0289 hTmax_t0_4->Fill(tmax124);
0290 break;
0291 case 99:
0292 hTmax_t0_5->Fill(tmax124);
0293 break;
0294 }
0295 } else if (t0_124 == 2) {
0296 hTmax_2t0->Fill(tmax124);
0297 switch (hSubGroup) {
0298 case 0:
0299 hTmax_2t0_0->Fill(tmax124);
0300 break;
0301 case 1:
0302 hTmax_2t0_1->Fill(tmax124);
0303 break;
0304 case 2:
0305 hTmax_2t0_2->Fill(tmax124);
0306 break;
0307 case 3:
0308 hTmax_2t0_3->Fill(tmax124);
0309 break;
0310 case 4:
0311 hTmax_2t0_4->Fill(tmax124);
0312 break;
0313 case 99:
0314 hTmax_2t0_5->Fill(tmax124);
0315 break;
0316 }
0317 } else if (t0_124 == 3) {
0318 hTmax_3t0->Fill(tmax124);
0319 switch (hSubGroup) {
0320 case 0:
0321 hTmax_3t0_0->Fill(tmax124);
0322 break;
0323 case 1:
0324 hTmax_3t0_1->Fill(tmax124);
0325 break;
0326 case 2:
0327 hTmax_3t0_2->Fill(tmax124);
0328 break;
0329 case 3:
0330 hTmax_3t0_3->Fill(tmax124);
0331 break;
0332 case 4:
0333 hTmax_3t0_4->Fill(tmax124);
0334 break;
0335 case 99:
0336 hTmax_3t0_5->Fill(tmax124);
0337 break;
0338 }
0339 }
0340 }
0341 if (tmax134 > 0.) {
0342 (s134 == dttmaxenums::r72) ? hTmax134s72->Fill(tmax134) : hTmax134s78->Fill(tmax134);
0343 if (t0_134 == 0)
0344 hTmax_0->Fill(tmax134);
0345 else if (t0_134 == 1) {
0346 hTmax_t0->Fill(tmax134);
0347 switch (hSubGroup) {
0348 case 0:
0349 hTmax_t0_0->Fill(tmax134);
0350 break;
0351 case 1:
0352 hTmax_t0_1->Fill(tmax134);
0353 break;
0354 case 2:
0355 hTmax_t0_2->Fill(tmax134);
0356 break;
0357 case 3:
0358 hTmax_t0_3->Fill(tmax134);
0359 break;
0360 case 4:
0361 hTmax_t0_4->Fill(tmax134);
0362 break;
0363 case 99:
0364 hTmax_t0_5->Fill(tmax134);
0365 break;
0366 }
0367 } else if (t0_134 == 2) {
0368 hTmax_2t0->Fill(tmax134);
0369 switch (hSubGroup) {
0370 case 0:
0371 hTmax_2t0_0->Fill(tmax134);
0372 break;
0373 case 1:
0374 hTmax_2t0_1->Fill(tmax134);
0375 break;
0376 case 2:
0377 hTmax_2t0_2->Fill(tmax134);
0378 break;
0379 case 3:
0380 hTmax_2t0_3->Fill(tmax134);
0381 break;
0382 case 4:
0383 hTmax_2t0_4->Fill(tmax134);
0384 break;
0385 case 99:
0386 hTmax_2t0_5->Fill(tmax134);
0387 break;
0388 }
0389 } else if (t0_134 == 3) {
0390 hTmax_3t0->Fill(tmax134);
0391 switch (hSubGroup) {
0392 case 0:
0393 hTmax_3t0_0->Fill(tmax134);
0394 break;
0395 case 1:
0396 hTmax_3t0_1->Fill(tmax134);
0397 break;
0398 case 2:
0399 hTmax_3t0_2->Fill(tmax134);
0400 break;
0401 case 3:
0402 hTmax_3t0_3->Fill(tmax134);
0403 break;
0404 case 4:
0405 hTmax_3t0_4->Fill(tmax134);
0406 break;
0407 case 99:
0408 hTmax_3t0_5->Fill(tmax134);
0409 break;
0410 }
0411 }
0412 }
0413 if (tmax234 > 0.) {
0414 hTmax234->Fill(tmax234);
0415 if (t0_234 == 1) {
0416 hTmax_t0->Fill(tmax234);
0417 switch (hSubGroup) {
0418 case 0:
0419 hTmax_t0_0->Fill(tmax234);
0420 break;
0421 case 1:
0422 hTmax_t0_1->Fill(tmax234);
0423 break;
0424 case 2:
0425 hTmax_t0_2->Fill(tmax234);
0426 break;
0427 case 3:
0428 hTmax_t0_3->Fill(tmax234);
0429 break;
0430 case 4:
0431 hTmax_t0_4->Fill(tmax234);
0432 break;
0433 case 99:
0434 hTmax_t0_5->Fill(tmax234);
0435 break;
0436 }
0437 } else {
0438 hTmax_2t0->Fill(tmax234);
0439 switch (hSubGroup) {
0440 case 0:
0441 hTmax_2t0_0->Fill(tmax234);
0442 break;
0443 case 1:
0444 hTmax_2t0_1->Fill(tmax234);
0445 break;
0446 case 2:
0447 hTmax_2t0_2->Fill(tmax234);
0448 break;
0449 case 3:
0450 hTmax_2t0_3->Fill(tmax234);
0451 break;
0452 case 4:
0453 hTmax_2t0_4->Fill(tmax234);
0454 break;
0455 case 99:
0456 hTmax_2t0_5->Fill(tmax234);
0457 break;
0458 }
0459 }
0460 }
0461 }
0462
0463 void Write() {
0464
0465 hTmax123->Write();
0466 hTmax124s72->Write();
0467 hTmax124s78->Write();
0468 hTmax134s72->Write();
0469 hTmax134s78->Write();
0470 hTmax234->Write();
0471 hTmax_3t0->Write();
0472 hTmax_3t0_0->Write();
0473 hTmax_3t0_1->Write();
0474 hTmax_3t0_2->Write();
0475 hTmax_3t0_3->Write();
0476 hTmax_3t0_4->Write();
0477 hTmax_3t0_5->Write();
0478 hTmax_2t0->Write();
0479 hTmax_2t0_0->Write();
0480 hTmax_2t0_1->Write();
0481 hTmax_2t0_2->Write();
0482 hTmax_2t0_3->Write();
0483 hTmax_2t0_4->Write();
0484 hTmax_2t0_5->Write();
0485 hTmax_t0->Write();
0486 hTmax_t0_0->Write();
0487 hTmax_t0_1->Write();
0488 hTmax_t0_2->Write();
0489 hTmax_t0_3->Write();
0490 hTmax_t0_4->Write();
0491 hTmax_t0_5->Write();
0492 hTmax_0->Write();
0493 }
0494
0495 int GetT0Factor(TH1F *hist) {
0496 unsigned t0 = 999;
0497
0498 if (hist == hTmax_3t0)
0499 t0 = 3;
0500 else if (hist == hTmax_2t0)
0501 t0 = 2;
0502 else if (hist == hTmax_t0)
0503 t0 = 1;
0504 else if (hist == hTmax_0)
0505 t0 = 0;
0506
0507 return t0;
0508 }
0509
0510 TH1F *hTmax123;
0511 TH1F *hTmax124s72;
0512 TH1F *hTmax124s78;
0513 TH1F *hTmax134s72;
0514 TH1F *hTmax134s78;
0515 TH1F *hTmax234;
0516 TH1F *hTmax_3t0;
0517 TH1F *hTmax_3t0_0;
0518 TH1F *hTmax_3t0_1;
0519 TH1F *hTmax_3t0_2;
0520 TH1F *hTmax_3t0_3;
0521 TH1F *hTmax_3t0_4;
0522 TH1F *hTmax_3t0_5;
0523 TH1F *hTmax_2t0;
0524 TH1F *hTmax_2t0_0;
0525 TH1F *hTmax_2t0_1;
0526 TH1F *hTmax_2t0_2;
0527 TH1F *hTmax_2t0_3;
0528 TH1F *hTmax_2t0_4;
0529 TH1F *hTmax_2t0_5;
0530 TH1F *hTmax_t0;
0531 TH1F *hTmax_t0_0;
0532 TH1F *hTmax_t0_1;
0533 TH1F *hTmax_t0_2;
0534 TH1F *hTmax_t0_3;
0535 TH1F *hTmax_t0_4;
0536 TH1F *hTmax_t0_5;
0537 TH1F *hTmax_0;
0538
0539 TString name;
0540 };
0541
0542 #endif