20 #include <FairLogger.h>
21 #include <FairRuntimeDb.h>
28 #include <TObjArray.h>
70 , fInputFileName(inputFileName.Data())
71 , fDigiFileName(digiFileName.Data())
90 FairRuntimeDb* db = FairRuntimeDb::instance();
91 if (!db) Fatal(
"Init",
"No runtime database");
98 printf(
"\n============================= Inputs segmentation parameters "
99 "================================\n");
101 printf(
"\n==================================================================="
102 "============================\n");
107 if (!
fStations) Fatal(
"Init",
"No input array of MUCH stations.");
109 Fatal(
"Init",
"Incorrect number of stations.");
112 for (Int_t iStation = 0; iStation <
fNStations; ++iStation) {
113 printf(
"Station %i\n", iStation + 1);
114 for (Int_t iRegion = 0; iRegion <
fNRegions[iStation]; ++iRegion)
115 printf(
" Region %i: fAngles=%4.1f\n",
129 for (Int_t iStation = 0; iStation <
fStations->GetEntries(); ++iStation) {
133 for (Int_t iLayer = 0; iLayer < nLayers; ++iLayer) {
135 if (!layer) Fatal(
"SegmentMuch",
"Incomplete layers array.");
137 printf(
"Layer=%d SideF Sectors=%i\n",
140 printf(
"Layer=%d SideB Sectors=%i\n",
144 printf(
"Station %i segmented\n", iStation + 1);
148 TFile* oldfile = gFile;
161 if (!layerSide) Fatal(
"SegmentLayerSide",
"Incomplete layer sides array.");
165 for (Int_t iModule = 0; iModule < nModules; iModule++) {
189 Double_t rMin = 0.0, rMax = 0.0, r0 = 0.0;
209 Double_t dx1 = module->
GetDx1();
210 Double_t dx2 = module->
GetDx2();
211 Double_t dy = module->
GetDy();
215 Double_t t = 2 * dy / (dx2 - dx1);
216 Double_t b = (r0 - dy) - t * dx1;
219 Double_t a = t * t + 1;
223 if (
fDebug) printf(
"Debug: %i %i %i %i\n", iStation, iLayer, iSide, iModule);
226 Double_t angle =
fAngles[iStation][
i] * TMath::DegToRad();
227 while (r2 <
fRadii[iStation][
i] && r2 < rMax) {
228 r2 = r1 + r1 * angle;
229 Double_t dphi = TMath::ASin((-bt +
sqrt(a * r2 * r2 - b2)) / a / r2);
234 detectorId, iSector, r1, r2, phi0 - dphi, phi0 + dphi));
240 if (
fDebug) printf(
" Sectors = %i\n", iSector);
250 if (!infile) { Fatal(
"ReadInputFile",
"Error: Cannot open the input file."); }
258 strs =
Split(str,
' ');
259 index = strs.size() - 1;
261 StrToNum(strs.at(index), nStations);
263 printf(
"Number of stations: \t%i",
fNStations);
267 strs =
Split(str,
' ');
268 printf(
"\nNumber of regions: ");
269 for (Int_t iStation = 0; iStation <
fNStations; ++iStation) {
274 fRadii[iStation].resize(nRegions);
275 fAngles[iStation].resize(nRegions);
279 for (Int_t iStation = 0; iStation <
fNStations; ++iStation) {
282 strs =
Split(str,
' ');
283 printf(
"\nStation %i", iStation + 1);
284 printf(
"\n Region radii [cm]: ");
285 for (Int_t iRegion = 0; iRegion <
fNRegions[iStation]; ++iRegion) {
286 index = strs.size() -
fNRegions[iStation] + iRegion;
288 printf(
"\t%4.2f",
fRadii[iStation][iRegion]);
292 strs =
Split(str,
' ');
293 printf(
"\n Pad angles [deg]: ");
294 for (Int_t iRegion = 0; iRegion <
fNRegions[iStation]; ++iRegion) {
295 index = strs.size() -
fNRegions[iStation] + iRegion;
297 printf(
"\t%4.2f",
fAngles[iStation][iRegion]);
309 for (iChar = length - 1; iChar >= 0; --iChar) {
313 txtfile[iChar + 1] =
'\0';
314 strcat(txtfile,
"txt");
317 outfile = fopen(txtfile,
"w");
326 for (Int_t iStation = 0; iStation <
fStations->GetEntriesFast(); ++iStation) {
328 "=================================================================="
330 fprintf(outfile,
"Station %i\n", iStation + 1);
332 "Sector size, cm Sector position, cm Number of pads Side "
335 "------------------------------------------------------------------"
337 TCanvas* c1 =
new TCanvas(Form(
"station%i", iStation + 1),
338 Form(
"station%i", iStation + 1),
342 c1->Range(-200, -200, 200, 200);
343 c1->Range(-270, -270, 270, 270);
344 c1->Range(-50, -50, 50, 50);
347 for (Int_t iSide = 1; iSide >= 0; iSide--) {
349 for (Int_t iModule = 0; iModule < layerSide->
GetNModules(); ++iModule) {
351 mod->SetFillStyle(0);
356 <<
" Station " << iStation;
359 for (Int_t iSector = 0; iSector < module->
GetNSectors(); ++iSector) {
369 TArc* holeArc =
new TArc(0., 0., station->
GetRmin());
373 for (Int_t iRegion = 0; iRegion <
fNRegions[iStation]; ++iRegion) {
374 TArc* arc =
new TArc(0., 0.,
fRadii[iStation].at(iRegion));
375 arc->SetLineColor(kBlack);
376 arc->SetLineWidth(2);
377 arc->SetFillStyle(0);
383 "%s/station%i.eps", gSystem->DirName(
fDigiFileName), iStation + 1));
385 "%s/station%i.png", gSystem->DirName(
fDigiFileName), iStation + 1));