21 #include "TClonesArray.h"
22 #include "TObjArray.h"
27 #include "FairRuntimeDb.h"
30 #include "FairEventHeader.h"
31 #include "FairLogger.h"
32 #include "FairMCEventHeader.h"
33 #include "FairRunAna.h"
34 #include "FairRunSim.h"
51 using std::setprecision;
60 , fDiffusionCoefficient()
70 , fCurrentTotalCharge()
71 , fCurrentParticleMass()
72 , fCurrentParticleMomentum()
73 , fCurrentParticlePdg()
82 , fLandauRandom(new TRandom3())
101 , fPixelChargeShort()
102 , fPixelScanAccelerator()
128 <<
"Starting CbmMvdSensorDigitizerTBTask::CbmMvdSensorDigitizerTBTask() ";
162 frand =
new TRandom3(0);
189 if (!sensorData) {
return kERROR; }
219 Int_t nInputs = inputStream->GetEntriesFast();
220 while (nInputs >
i) {
257 for (Int_t iPoint = 0; iPoint <
fInputPoints->GetEntriesFast(); iPoint++) {
262 cout <<
"-W-" <<
GetName() <<
":: Exec:" << endl;
263 cout <<
" -received bad MC-Point. Ignored." << endl;
267 cout <<
"-W-" <<
GetName() <<
":: Exec:" << endl;
268 cout <<
" -received bad MC-Point which doesn't belong here. Ignored."
274 if (TMath::Abs(point->
GetZOut() - point->GetZ()) < 0.9 *
fEpiTh) {
275 LOG(debug) <<
"hit not on chip with thickness "
277 LOG(debug) <<
"hit not on chip with length "
278 << TMath::Abs(point->
GetZOut() - point->GetZ());
282 if (point->
GetPdgCode() > 100000) {
continue; }
315 std::pair<Int_t, Int_t> thispoint =
316 std::make_pair(pixel->
GetX(), pixel->
GetY());
317 std::pair<std::pair<Int_t, Int_t>, Double_t> thisTimePoint =
318 std::make_pair(thispoint, pixel->
GetTime());
343 Double_t& eventTime) {
346 eventNr = FairRootManager::Instance()->GetEntryNr();
349 if (FairRunAna::Instance()) {
350 FairEventHeader*
event = FairRunAna::Instance()->GetEventHeader();
351 inputNr =
event->GetInputFileId();
352 eventTime =
event->GetEventTime();
357 if (!FairRunSim::Instance())
358 LOG(fatal) <<
GetName() <<
": neither SIM nor ANA run.";
372 Double_t globalPositionIn[3] = {point->GetX(), point->GetY(), point->GetZ()};
373 Double_t globalPositionOut[3] = {
376 Double_t localPositionIn[3] = {0, 0, 0};
378 Double_t localPositionOut[3] = {0, 0, 0};
383 Int_t pixelX, pixelY;
388 Double_t entryX = localPositionIn[0];
389 Double_t exitX = localPositionOut[0];
390 Double_t entryY = localPositionIn[1];
391 Double_t exitY = localPositionOut[1];
392 Double_t entryZ = localPositionIn[2];
393 Double_t exitZ = localPositionOut[2];
414 Double_t entryZepi = -
fEpiTh / 2;
415 Double_t exitZepi =
fEpiTh / 2;
418 TVector3 a(entryX, entryY, entryZ);
419 TVector3 b(exitX, exitY, exitZ);
427 Double_t scale1 = (entryZepi - entryZ) / (exitZ - entryZ);
428 Double_t scale2 = (exitZepi - entryZ) / (exitZ - entryZ);
434 TVector3 entryEpiCoord;
435 TVector3 exitEpiCoord;
437 entryEpiCoord =
d + a;
438 exitEpiCoord = e + a;
442 Double_t entryXepi = entryEpiCoord.X();
443 Double_t entryYepi = entryEpiCoord.Y();
444 entryZepi = entryEpiCoord.Z();
447 Double_t exitXepi = exitEpiCoord.X();
448 Double_t exitYepi = exitEpiCoord.Y();
449 exitZepi = exitEpiCoord.Z();
452 Double_t lx = -(entryXepi - exitXepi);
453 Double_t ly = -(entryYepi - exitYepi);
454 Double_t lz = -(entryZepi - exitZepi);
461 sqrt(lx * lx + ly * ly
463 Double_t trackLength = 0;
465 if (rawLength < 1.0e+3) {
466 trackLength = rawLength;
470 cout <<
"-W- " <<
GetName() <<
" : rawlength > 1.0e+3 : " << rawLength
472 trackLength = 1.0e+3;
491 * ((Double_t) trackLength /
fEpiTh);
514 <<
" Length of track in detector (z-direction) is 0!!!" << endl;
518 Double_t
x = 0,
y = 0, z = 0;
520 Double_t xDebug = 0, yDebug = 0, zDebug = 0;
521 Float_t totalSegmentCharge = 0;
526 + ((double) (
i) + 0.5)
530 + ((double) (
i) + 0.5)
536 + ((double) (
i) + 0.5)
550 sPoint->
eloss = dEmean;
560 totalSegmentCharge = totalSegmentCharge + charge;
571 pair<Int_t, Int_t> thispoint;
572 pair<pair<Int_t, Int_t>, Double_t> thisTimePoint;
574 Double_t xCentre, yCentre, sigmaX, sigmaY, xLo, xUp, yLo, yUp;
590 Fatal(
"-E- CbmMvdDigitizer: ",
591 "fNumberOfSegments < 2, this makes no sense, check parameters.");
599 Int_t ixLo, ixUp, iyLo, iyUp;
602 Double_t minCoord[] = {xLo, yLo};
603 Double_t maxCoord[] = {xUp, yUp};
610 if (lowerXArray[0] < 0) lowerXArray[0] = 0;
611 if (lowerYArray[0] < 0) lowerYArray[0] = 0;
615 ixLo = lowerXArray[0];
616 iyLo = lowerYArray[0];
617 ixUp = upperXArray[0];
618 iyUp = upperYArray[0];
635 if (lowerXArray[
i] < 0) lowerXArray[
i] = 0;
636 if (lowerYArray[
i] < 0) lowerYArray[
i] = 0;
641 if (ixLo > lowerXArray[
i]) { ixLo = lowerXArray[
i]; }
642 if (ixUp < upperXArray[
i]) { ixUp = upperXArray[
i]; }
643 if (iyLo > lowerYArray[
i]) { iyLo = lowerYArray[
i]; }
644 if (iyUp < upperYArray[
i]) { iyUp = upperYArray[
i]; }
650 for (ix = ixLo; ix < ixUp + 1; ix++) {
651 for (iy = iyLo; iy < iyUp + 1; iy++) {
656 if (ix < lowerXArray[
i] || iy < lowerYArray[
i] || ix > upperXArray[
i]
657 || iy > upperYArray[
i]) {
673 (((Current[0] - xCentre) * (Current[0] - xCentre))
674 + ((Current[1] - yCentre) * (Current[1] - yCentre)))
678 Float_t totCharge = (numerator / maxCount +
fPar2);
680 if (totCharge < 1) {
continue; }
682 thispoint = std::make_pair(ix, iy);
683 thisTimePoint = std::make_pair(thispoint, ROTime);
686 pixel =
new ((*fPixelCharge)[
fPixelCharge->GetEntriesFast()])
692 (point->GetX() + point->
GetXOut()) / 2,
693 (point->GetY() + point->
GetXOut()) / 2,
708 std::vector<CbmMvdPixelCharge*>::size_type vectorSize =
711 for (ULong64_t
f = 0;
f < vectorSize;
f++) {
715 ((
float) (point->GetX() + point->
GetXOut()) / 2),
716 ((float) (point->GetY() + point->
GetYOut()) / 2),
718 point->GetTrackID());
720 cout << endl <<
"Warning working on broken pixel " << endl;
724 delete[] lowerXArray;
725 delete[] upperXArray;
726 delete[] lowerYArray;
727 delete[] upperYArray;
739 fDigis =
new TClonesArray(
"CbmMvdDigi", 10000);
740 fDigiMatch =
new TClonesArray(
"CbmMatch", 10000);
745 fPixelCharge =
new TClonesArray(
"CbmMvdPixelCharge", 100000);
749 "Fatal error: Init(CbmMvdSensor*) called without valid pointer, "
750 "don't know how to proceed.");