28 #include "FairRootManager.h"
29 #include "TStopwatch.h"
31 #include "TClonesArray.h"
51 , fModulesGeometryArray()
52 , fDigiFile(digiFileName)
74 std::cout <<
"CbmMuchClustering::Init" << std::endl;
77 TFile* oldfile = gFile;
79 TObjArray* stations = (TObjArray*) file->Get(
"stations");
99 cout <<
"-I- " << GetName() <<
"::Exec: No digis found, event skipped. "
115 std::cout <<
"CbmMuchClustering: time " << timer.RealTime()
120 std::cout <<
"CbmMuchClustering::Finish" << std::endl;
124 FairRootManager* ioman = FairRootManager::Instance();
125 assert(ioman != NULL);
128 fCluster =
new TClonesArray(
"CbmMuchCluster", 1000);
129 ioman->Register(
"MuchCluster",
132 IsOutputBranchPersistent(
"MuchCluster"));
133 fHit =
new TClonesArray(
"CbmMuchPixelHit", 1000);
134 ioman->Register(
"MuchPixelHit",
137 IsOutputBranchPersistent(
"MuchPixelHit"));
149 for (Int_t iL = 0; iL < nLayers; iL++) {
154 for (Int_t iMod = 0; iMod < nModules; iMod++) {
165 for (Int_t iMod = 0; iMod < nModules; iMod++) {
173 std::cout <<
"Layer " << iL <<
" geometry created successful.\n";
175 std::cout <<
"Station " << iSt <<
" geometry created successful.\n";
188 iPad, muchDigi->
GetAdc());
232 std::cout <<
"CbmMuchClustering: Error! Algorithm not tested\n";
237 <<
"CbmMuchClustering: Error! Wrong version of the algorithm.\n";
253 vector<Int_t> digiIndices;
256 Double_t sumq = 0, sumx = 0, sumy = 0, sumt = 0, sumdx2 = 0, sumdy2 = 0,
257 sumdxy2 = 0, sumdt2 = 0;
258 Double_t q = 0,
x = 0,
y = 0, t = 0, z = 0, dx = 0, dy = 0, dxy = 0, dt = 0;
260 x = clustersA1->
GetX0(iCl);
261 y = clustersA1->
GetY0(iCl);
266 for (Int_t iPad = 0; iPad < clustersA1->
GetNofPads(iCl); iPad++) {
274 digiIndices.push_back(iDigi);
276 pad = m2->
GetPad(channelId);
278 if (tmin < 0) tmin = t;
279 if (tmin < t) tmin = t;
287 sumdx2 += q * q * dx * dx;
288 sumdy2 += q * q * dy * dy;
289 sumdxy2 += q * q * dxy * dxy;
290 sumdt2 += q * q * dt * dt;
293 dx =
sqrt(sumdx2 / 12) / sumq;
294 dy =
sqrt(sumdy2 / 12) / sumq;
295 dxy =
sqrt(sumdxy2 / 12) / sumq;
296 dt =
sqrt(sumdt2) / sumq;
297 Int_t nCluster =
fCluster->GetEntriesFast();
300 Int_t nHit =
fHit->GetEntriesFast();
302 address,
x,
y, z, dx, dy, 0, dxy, nCluster, planeId, t, dt);
317 vector<Int_t> digiIndices;
320 Double_t sumq = 0, sumx = 0, sumy = 0, sumt = 0, sumdx2 = 0, sumdy2 = 0,
321 sumdxy2 = 0, sumdt2 = 0;
322 Double_t q = 0,
x = 0,
y = 0, t = 0, z = 0, dx = 0, dy = 0, dxy = 0, dt = 0;
324 x = clustersSL->
GetX0(iCl);
325 y = clustersSL->
GetY0(iCl);
330 for (Int_t iPad = 0; iPad < clustersSL->
GetNofPads(iCl); iPad++) {
338 digiIndices.push_back(iDigi);
340 pad = m2->
GetPad(channelId);
342 if (tmin < 0) tmin = t;
343 if (tmin < t) tmin = t;
351 sumdx2 += q * q * dx * dx;
352 sumdy2 += q * q * dy * dy;
353 sumdxy2 += q * q * dxy * dxy;
354 sumdt2 += q * q * dt * dt;
357 dx =
sqrt(sumdx2 / 12) / sumq;
358 dy =
sqrt(sumdy2 / 12) / sumq;
359 dxy =
sqrt(sumdxy2 / 12) / sumq;
360 dt =
sqrt(sumdt2) / sumq;
361 Int_t nCluster =
fCluster->GetEntriesFast();
364 Int_t nHit =
fHit->GetEntriesFast();
366 address,
x,
y, z, dx, dy, 0, dxy, nCluster, planeId, t, dt);
376 for (Int_t iCl = 0; iCl < clustersWard->
GetNofClusters(); iCl++) {
378 vector<Int_t> digiIndices;
382 Double_t sumq = 0, sumx = 0, sumy = 0, sumt = 0, sumdx2 = 0, sumdy2 = 0,
383 sumdxy2 = 0, sumdt2 = 0;
384 Double_t q = 0,
x = 0,
y = 0, t = 0, z = 0, dx = 0, dy = 0, dxy = 0, dt = 0;
386 x = clustersWard->
GetX0(iCl);
387 y = clustersWard->
GetY0(iCl);
392 for (Int_t iPad = 0; iPad < clustersWard->
GetNofPads(iCl); iPad++) {
397 digiIndices.push_back(iDigi);
401 pad = m2->
GetPad(channelId);
416 sumdx2 += q * q * dx * dx;
417 sumdy2 += q * q * dy * dy;
418 sumdxy2 += q * q * dxy * dxy;
419 sumdt2 += q * q * dt * dt;
424 dx =
sqrt(sumdx2 / 12) / sumq;
425 dy =
sqrt(sumdy2 / 12) / sumq;
426 dxy =
sqrt(sumdxy2 / 12) / sumq;
427 dt =
sqrt(sumdt2) / sumq;
429 Int_t nCluster =
fCluster->GetEntriesFast();
436 Int_t nHit =
fHit->GetEntriesFast();
437 std::cout <<
"\nCluster: " << nHit <<
"; detId: " << detId
438 <<
"; NofPads: " << clustersWard->
GetNofPads(iCl) <<
"\n";
439 std::cout <<
"x: " <<
x <<
"; y: " <<
y <<
"; z: " << z <<
"\n";
440 std::cout <<
"dx: " << dx <<
"; dy: " << dy <<
"; dxy: " << dxy <<
"\n";
441 std::cout <<
"planeId: " << planeId <<
"; t: " << t <<
"; dt: " << dt
443 std::cout <<
"-------\n";
446 CbmMuchPixelHit(detId,
x,
y, z, dx, dy, 0, dxy, nCluster, planeId, t, dt);