7 #include "FairLogger.h"
8 #include "TClonesArray.h"
36 , fPixelChargeHistos(NULL)
37 , fTotalChargeInNpixelsArray(NULL)
38 , fResolutionHistoX(NULL)
39 , fResolutionHistoY(NULL)
40 , fResolutionHistoCleanX(NULL)
41 , fResolutionHistoCleanY(NULL)
42 , fResolutionHistoMergedX(NULL)
43 , fResolutionHistoMergedY(NULL)
47 , fGausArrayLimit(5000)
55 , fFullClusterHisto(NULL)
68 , fLayerRadiusInner(0.)
76 , fBranchName(
"MvdHit")
77 , fAddNoise(kFALSE) {}
104 "SinglePointResolution_X",
109 "SinglePointResolution_Y",
114 "SinglePointResolution_X_Clean",
119 "SinglePointResolution_Y_Clean",
124 "SinglePointResolution_X_Merged",
129 "SinglePointResolution_Y_Merged",
134 "BadHits",
"Hits above 0.003cm", 1000, -2.5, 2.5, 1000, -2.5, 2.5);
136 new TH1F(
"ChargeOfAllPixels",
"ChargeOfAllPixels", 12000, 0, 12000);
140 TH1F* histoTotalCharge;
141 char* histoName =
new char[20];
142 char* histoTotalChargeName =
new char[50];
146 for (Int_t
i = 0;
i < 49;
i++) {
147 sprintf(histoName,
"ChargePixel%i",
i + 1);
148 histo =
new TH1F(histoName, histoName, 200, 0, 200);
153 for (Int_t
i = 0;
i < 49;
i++) {
154 sprintf(histoTotalChargeName,
"totalChargeInNPixels%i",
i + 1);
156 new TH1F(histoTotalChargeName, histoTotalChargeName, 12000, 0, 12000);
161 histo =
new TH1F(
"ChargePixelSeed",
"ChargePixelSeed", 200, 0, 14000);
164 histo =
new TH1F(
"ChargePixel9of49",
"ChargePixel 9 Of 49", 200, 0, 14000);
168 new TH1F(
"ChargePixel25of49",
"ChargePixel 25 Of 49", 200, 0, 14000);
172 new TH1F(
"ChargePixel49of49",
"ChargePixel 49 Of 49", 200, 0, 14000);
176 "ChargePixel9of49Sorted",
"ChargePixel 9 Of 49 Sorted", 200, 0, 14000);
180 "ChargePixel25of49Sorted",
"ChargePixel 25 Of 49 Sorted", 200, 0, 14000);
184 "ChargePixel49of49Sorted",
"ChargePixel 49 Of 49 Sorted", 49, 0.5, 49.5);
194 <<
"CbmMvdSensorClusterfinderTask::ReInt---------------" << endl;
208 vector<Int_t>* clusterArray =
new vector<Int_t>;
217 cout <<
"-E- : CbmMvdSensorFindHitTask - Fatal: No Digits found in this "
226 TArrayS* pixelUsed =
new TArrayS(nDigis);
228 for (iDigi = 0; iDigi < nDigis; iDigi++) {
229 pixelUsed->AddAt(0, iDigi);
234 for (Int_t k = 0; k < nDigis; k++) {
239 LOG(fatal) <<
"RefID of this digi is -1 this should not happend ";
256 for (iDigi = 0; iDigi < nDigis; iDigi++) {
258 if (gDebug > 0 && iDigi % 10000 == 0) {
259 cout <<
"-I- " <<
GetName() <<
" Digi:" << iDigi << endl;
278 <<
"CbmMvdSensorFindHitTask: Checking for seed pixels..." << endl;
282 && (pixelUsed->At(iDigi) == kFALSE)) {
283 clusterArray->clear();
284 clusterArray->push_back(iDigi);
286 pixelUsed->AddAt(1, iDigi);
292 for (ULong64_t iCluster = 0; iCluster < clusterArray->size();
297 <<
" CbmMvdSensorClusterfinderTask: Calling method "
298 "CheckForNeighbours()..."
310 pair<Int_t, Int_t> pixelCoords;
311 Int_t clusterSize = clusterArray->size();
318 for (
i = 0;
i < clusterSize;
i++) {
322 pixelCoords = std::make_pair(digiInCluster->
GetPixelX(),
324 pixelCharge = digiInCluster->
GetCharge();
339 clusterArray->clear();
351 vector<Int_t>* clusterArray,
353 TArrayS* pixelUsed) {
362 pair<Int_t, Int_t> a(channelX, channelY);
366 a = std::make_pair(channelX + 1, channelY);
373 clusterArray->push_back(
i);
375 pixelUsed->AddAt(1,
i);
379 a = std::make_pair(channelX - 1, channelY);
386 clusterArray->push_back(
i);
387 pixelUsed->AddAt(1,
i);
391 a = std::make_pair(channelX, channelY - 1);
397 clusterArray->push_back(
i);
398 pixelUsed->AddAt(1,
i);
402 a = std::make_pair(channelX, channelY + 1);
409 clusterArray->push_back(
i);
410 pixelUsed->AddAt(1,
i);
438 Int_t seedIndexX = 0, seedIndexY = 0;
439 Float_t seedCharge = 0.;
441 std::map<std::pair<Int_t, Int_t>, Int_t> clusterMap = cluster->
GetPixelMap();
445 chargeArray3D[k][j] = gRandom->Gaus(0,
fSigmaNoise);
448 for (std::map<std::pair<Int_t, Int_t>, Int_t>::iterator iter =
450 iter != clusterMap.end();
452 if (iter->second > seedCharge) {
453 seedCharge = iter->second;
454 seedIndexX = iter->first.first;
455 seedIndexY = iter->first.second;
459 for (std::map<std::pair<Int_t, Int_t>, Int_t>::iterator iter =
461 iter != clusterMap.end();
464 Int_t relativeX = iter->first.first + seedPixelOffset - seedIndexX;
465 Int_t relativeY = iter->first.second + seedPixelOffset - seedIndexY;
468 cout << relativeX <<
" " << relativeY <<
" " << iter->first.first <<
" "
469 << seedIndexX << endl;
472 if (relativeX >= 0 && relativeX < fChargeArraySize && relativeY >= 0
474 chargeArray3D[relativeX][relativeY] = iter->second;
477 if ((relativeX - seedPixelOffset == 0)
478 && (relativeY - seedPixelOffset == 0)) {
485 cout << chargeArray3D[
i][j] <<
" ";
498 Int_t qSeed = chargeArray3D[seedPixelOffset][seedPixelOffset];
501 for (Int_t k = seedPixelOffset - 1; k < seedPixelOffset + 1; k++) {
502 for (Int_t j = seedPixelOffset - 1; j < seedPixelOffset + 1; j++) {
503 q9 = q9 + chargeArray3D[k][j];
521 for (Int_t k = seedPixelOffset - 2; k < seedPixelOffset + 2; k++) {
522 for (Int_t j = seedPixelOffset - 2; j < seedPixelOffset + 2; j++) {
523 q25 = q25 + chargeArray3D[k][j];
528 for (Int_t k = seedPixelOffset - 3; k < seedPixelOffset + 3; k++) {
529 for (Int_t j = seedPixelOffset - 3; j < seedPixelOffset + 3; j++) {
530 q49 = q49 + chargeArray3D[k][j];
550 for (Int_t
i = 0;
i < 9;
i++) {
551 qSort += chargeArray[orderArray[
i]];
555 for (Int_t
i = 9;
i < 25;
i++) {
556 qSort += chargeArray[orderArray[
i]];
560 TH1F* histoTotalCharge;
563 qSort += chargeArray[orderArray[
i]];
566 histoTotalCharge->Fill(qSort);
574 cout <<
"\n============================================================"
577 <<
"::Finish: Total events skipped: " <<
fCounter << endl;
578 cout <<
"============================================================"
580 cout <<
"-I- Parameters used" << endl;
581 cout <<
"Gaussian noise [electrons] : " <<
fSigmaNoise << endl;
582 cout <<
"Noise simulated [Bool] : " <<
fAddNoise << endl;
585 cout <<
"ADC - Bits : " <<
fAdcBits << endl;
586 cout <<
"ADC - Dynamic [electrons] : " <<
fAdcDynamic << endl;
587 cout <<
"ADC - Offset [electrons] : " <<
fAdcOffset << endl;
588 cout <<
"============================================================"
593 TH2F* clusterShapeHistogram;
594 TCanvas* canvas2 =
new TCanvas(
"HitFinderCharge",
"HitFinderCharge");
595 canvas2->Divide(2, 2);
598 clusterShapeHistogram =
new TH2F(
"MvdClusterShape",
608 Float_t charge = histo->GetMean();
613 clusterShapeHistogram->Fill(
617 clusterShapeHistogram->Draw(
"Lego2");