18 #include <FairRootManager.h>
20 #include <FairRuntimeDb.h>
21 #include <TClonesArray.h>
54 if (!strcmp(name,
""))
SetName(name);
59 std::cout <<
"PairFinderTask destructor called." <<
"\n";
84 FairRootManager* ioman = FairRootManager::Instance();
87 std::cout <<
"-E- LmdPairFinder::Init: " <<
"RootManager not instantiated!" <<
"\n";
96 std::cout <<
"-W- LmdPairFinder::Init: " <<
"ERROR, branch name " <<
fInBranchName
97 <<
" could not found!" <<
"\n";
102 std::cout <<
"-W- LmdPairFinder::Init: " <<
"ERROR, branch name " <<
fInRecoBranchName
103 <<
" not found!" <<
"\n";
109 <<
" not found!" <<
"\n";
114 ioman->Register(
"PndLmdHitPair",
"PndLmd",
hitPairArray, kTRUE);
118 std::cout <<
"LmdPairFinder::Init(): Initialization successful." <<
"\n";
123 std::cout <<
"branch names set to " <<
fInBranchName <<
"\n";
135 std::cout <<
"PndLmdPixelClusterTask::SetParContainers() " <<
"\n";
137 ana = FairRun::Instance();
138 rtdb = ana->GetRuntimeDb();
143 Info(
"SetParContainers()",
"AlignLMD The container names list contains %i entries",
144 theAlignLMDContNames->GetEntries());
145 TIter cfAlIter(theAlignLMDContNames);
146 while (TObjString* contname = (TObjString*) cfAlIter()) {
147 TString parsetname = contname->String();
148 Info(
"SetParContainers()",
"%s", parsetname.Data());
174 Int_t nRecos =
recoArray->GetEntriesFast();
176 Int_t storedPairsPerEvent = 0;
179 for (
auto iReco = 0; iReco < nRecos; iReco++) {
180 for (
auto jReco = iReco + 1; jReco < nRecos; jReco++) {
192 if (infoOne.module_side > infoTwo.module_side) {
193 std::swap(hitOne, hitTwo);
199 const TVector3 vecOneGlobal = hitOne->
GetPosition();
200 const TVector3 vecTwoGlobal = hitTwo->
GetPosition();
203 PndLmdHitPair pairCanditate(vecOneGlobal, vecTwoGlobal, id1, id2);
220 pairCanditate.
check();
222 if (!pairCanditate.
isSane()) {
224 cerr <<
"==== WARNING: ====" <<
"\n";
225 cerr <<
"pair seems valid but did not pass sanity check!" <<
"\n";
226 cerr <<
"===============================================" <<
"\n";
238 new ((*hitPairArray)[storedPairsPerEvent])
PndLmdHitPair(pairCanditate);
239 storedPairsPerEvent++;
255 double plane3Percent = ((double) plane3 /
noOfGoodPairs) * 100;
256 double allPlanesPercent = ((double) sumOfAllPlanes /
noOfGoodPairs) * 100;
262 cout <<
"*************************************************************" <<
"\n";
263 cout <<
" pair finder done " <<
"\n";
264 cout <<
"*************************************************************" <<
"\n";
266 cout <<
" counting statistics:" <<
"\n";
271 printf(
"cluster ratio: %.2f %% \n", clusterRatio);
272 printf(
"pixel hits per event: %.2f \n", pixelsPerEvent);
273 printf(
"----------------------------\n");
277 printf(
"----------------------------\n");
279 printf(
"good pairs per event: %.2f \n", goodPairsPerEvent);
280 printf(
"----------------------------\n");
281 printf(
"hits on plane 0: %.2f %% \n", plane0Percent);
282 printf(
"hits on plane 1: %.2f %%\n", plane1Percent);
283 printf(
"hits on plane 2: %.2f %%\n", plane2Percent);
284 printf(
"hits on plane 3: %.2f %%\n", plane3Percent);
285 printf(
"hits on all planes: %.2f %% (should be 100%%!) \n", allPlanesPercent);
287 cout <<
"*************************************************************" <<
"\n";
312 fplane = infoOne.
plane;
330 cerr <<
"WARNING: hit was deemed suitable but plane number is " << fplane <<
"\n";
331 cerr <<
"This should not happen!" <<
"\n";
344 std::vector<pixelCluster> clusters;
349 for (
int iCluster = 0; iCluster < noOfClusters; iCluster++) {
364 if (col < 0 || row < 0) {
389 for (
size_t i = 0;
i < clusters.size();
i++) {
391 for (
size_t j =
i + 1; j < clusters.size(); j++) {
394 if (clusters[
i]._sensorId != clusters[j]._sensorId) {
398 if (clusters[
i].isNeighbour(clusters[j])) {
399 clusters[
i].merge(clusters[j]);
400 clusters.erase(clusters.begin() + j);
408 for (
size_t i = 0;
i < clusters.size();
i++) {
409 clusters[
i].calculateCenter();
411 if (clusters[
i].clusterSize > 1) {
415 clusters.erase(clusters.begin() +
i);
428 return pixelHit(hitSensorId, clusters[0].centerCol, clusters[0].centerRow);
433 int firstSensorId, secondSensorId;
434 firstSensorId = candidate.
getId1();
435 secondSensorId = candidate.
getId2();
438 if (firstSensorId == secondSensorId) {
Int_t GetPixelRow() const
virtual InitStatus ReInit()
printf("RealTime=%f seconds, CpuTime=%f seconds\n", rtime, ctime)
Int_t GetClusterSize() const
Int_t GetSensorID() const
cout<< "-----------------------------------------------> Quarter VOLUME<<endl;name="QuarterShape";QuarterShape=newTGeoArb8(name,dz,vertQuar);name="Quarter4Vol";TStringmedium="air";QuarterVol=newTGeoVolumeAssembly(name);name="SubunitShape";SubunitShape=newTGeoArb8(name,dz,vertSub);TStringmedium="air";name="SubunitVol";name1="SubunitVol1";name2="SubunitVol2";name3="SubunitVol3";name4="SubunitVol4";name5="SubunitVol5";name6="SubunitVol6";name7="SubunitVol7";name8="SubunitVol8";name9="SubunitVol9";SubunitVol=newTGeoVolumeAssembly(name);SubunitVol1=newTGeoVolumeAssembly(name1);SubunitVol2=newTGeoVolumeAssembly(name2);SubunitVol3=newTGeoVolumeAssembly(name3);SubunitVol4=newTGeoVolumeAssembly(name4);SubunitVol5=newTGeoVolumeAssembly(name5);SubunitVol6=newTGeoVolumeAssembly(name6);SubunitVol7=newTGeoVolumeAssembly(name7);SubunitVol8=newTGeoVolumeAssembly(name8);SubunitVol9=newTGeoVolumeAssembly(name9);name="BoxShape";BoxShape=newTGeoArb8(name,dz,vertBox);TStringmedium="air";name="BoxVol";BoxVol=newTGeoVolumeAssembly(name);name1="BoxVol1";name2="BoxVol2";name3="BoxVol3";name4="BoxVol4";BoxVol1=newTGeoVolumeAssembly(name1);BoxVol2=newTGeoVolumeAssembly(name2);BoxVol3=newTGeoVolumeAssembly(name3);BoxVol4=newTGeoVolumeAssembly(name4);for(Int_tb=0;b<kNumOfBoxes;b++){cout<<""<<endl;cout<<"---------------->BOXnumber:"<<b<<endl;if(b==0){trBox=newTGeoTranslation(tr+kSpaceInSub+kAlveoleThickness+0.5*kSpaceInBox,tr+kSpaceInSub+kAlveoleThickness+0.5*kSpaceInBox,0.);rotBox=newTGeoRotation();rotBox.RotateX(0.465518);rotBox.RotateY(-0.465518);}if(b==1){trBox=newTGeoTranslation(-tr-kSpaceInSub-kAlveoleThickness-0.5*kSpaceInBox,-tr-kSpaceInSub-kAlveoleThickness-0.5*kSpaceInBox,0.);rotBox=newTGeoRotation();rotBox.RotateX(-0.465518);rotBox.RotateY(0.465518);}if(b==2){trBox=newTGeoTranslation(tr+kSpaceInSub+kAlveoleThickness+0.5*kSpaceInBox,-tr-kSpaceInSub-kAlveoleThickness-0.5*kSpaceInBox,0.);rotBox=newTGeoRotation();rotBox.RotateX(-0.465518);rotBox.RotateY(-0.465518);}if(b==3){trBox=newTGeoTranslation(-tr-kSpaceInSub-kAlveoleThickness-0.5*kSpaceInBox,tr+kSpaceInSub+kAlveoleThickness+0.5*kSpaceInBox,0.);rotBox=newTGeoRotation();rotBox.RotateX(0.465518);rotBox.RotateY(0.465518);}TGeoCombiTrans*trrotBox=newTGeoCombiTrans(trBox,rotBox);name="BoxVol";name+=b;trrotBox->SetName(name);trrotBox->RegisterYourself();SubunitVol->AddNode(BoxVol,b,trrotBox);if(b==1){name+=b;trrotBox->SetName(name);trrotBox->RegisterYourself();SubunitVol1->AddNode(BoxVol,b,trrotBox);}if(b==2){name+=b;trrotBox->SetName(name);trrotBox->RegisterYourself();SubunitVol2->AddNode(BoxVol1,b,trrotBox);}if(b==0){name+=b;trrotBox-> SetName(name)
TList * GetAlignParNames()
TVector3 GetPosition() const
bool pairDistanceValid(PndLmdHitPair &candidate)
Int_t GetPixelColumn() const
virtual void SetParContainers()
virtual InitStatus Init()
static PndLmdGeometryHelper & getInstance()
void getStatistics(PndLmdHitPair &candidate)
pixelHit getPixelHitFromSdsHit(PndSdsHit *sdsHit)
TClonesArray * clusterCandidateArray
PndLmdGeometryHelper * helper
TString fInRecoBranchName
Int_t GetDigiIndex(Int_t i) const
Double_t getDistance() const
virtual void FinishTask()
Int_t eventMissedAllPlanes
virtual void FinishEvent()
const PndLmdHitLocationInfo & getHitLocationInfo(const std::string &volume_path)
virtual void SetBranchNames()
ClassImp(PndLmdPairFinderTask)
static PndGeoHandling * Instance()
virtual ~PndLmdPairFinderTask()
void setPixelHits(double col1, double row1, double col2, double row2)
void setOverlapId(Int_t overlapId)
Data class to store the digi output of a pixel module.
Int_t GetClusterIndex() const
TString fInClusterCandidates
Int_t GetSensorID() const
int getOverlapIdFromSensorIDs(int id1, int id2)
TClonesArray * hitPairArray
bool candHitsOverlappingArea(const PndLmdHitPair &candidate)
bool isOverlappingArea(const int id1, const int id2)
virtual void Exec(Option_t *opt)