#include <TTree.h>
+#include <TFile.h>
#include <TObjArray.h>
#include <TParticle.h>
#include <TMath.h>
,fDigitFreelistBptrLast(0)
,fPartFreelistBptr(0)
,fCandFreelistBptr(0)
+#ifdef _ClusterTopology_
+ ,fTreeTopology(0)
+ ,fFileTopology(0)
+ ,fTopology(0)
+ ,fMinCol(0)
+ ,fMinRow(0)
+#endif //_ClusterTopology_
{
SetUniqueID(0);
// c-tor
}
delete[] fPartFreelistBptr;
delete[] fCandFreelistBptr;
+ //
+#ifdef _ClusterTopology_
+ SaveTopologyTree();
+#endif //_ClusterTopology_
}
//______________________________________________________________________________
double x=0,z=0,xmn=1e9,xmx=-1e9,zmn=1e9,zmx=-1e9,px=0,pz=0;
float cx,cz;
int charge=0;
+ //
for (AliITSUClusterizerClusterDigit *idigit=cand->fFirstDigit;idigit;idigit=idigit->fNext) {
AliITSdigit* dig = idigit->fDigit;
fSegm->DetToLocal(dig->GetCoord2(),dig->GetCoord1(),cx,cz); // center of pixel
// Set Volume id
cluster->SetVolumeId(fVolID);
// printf("mod %d: (%.4lf,%.4lf)cm\n",fVolID,x,z);
+ //
+#ifdef _ClusterTopology_
+ FillClusterTopology(cand);
+#endif //_ClusterTopology_
+ //
}
//______________________________________________________________________________
AliITSUClusterizerClusterPart *iPrevRow=0;
AliITSUClusterizerClusterPart *iNextRow=0;
Int_t lastV=0;
+ //
while (iDigit) {
if (iDigit->fDigit->GetCoord2()!=lastV) {
// NEW ROW
}
//
}
+
+//------------------------------------------------------------------------
+
+#ifdef _ClusterTopology_
+//
+//______________________________________________________________________
+void AliITSUClusterizer::FillClusterTopology(AliITSUClusterizerClusterCand *cand)
+{
+ // fill special tree with cluster topology bit pattern
+ //
+ enum {kMaxColSpan=30,kMaxRowSpan=30};
+ //
+ Int_t mnCol=999999,mxCol=0,mnRow=999999,mxRow=0;
+ for (AliITSUClusterizerClusterDigit *idigit=cand->fFirstDigit;idigit;idigit=idigit->fNext) {
+ AliITSdigit* dig = idigit->fDigit;
+ if (mnCol>dig->GetCoord1()) mnCol = dig->GetCoord1();
+ if (mxCol<dig->GetCoord1()) mxCol = dig->GetCoord1();
+ if (mnRow>dig->GetCoord2()) mnRow = dig->GetCoord2();
+ if (mxRow<dig->GetCoord2()) mxRow = dig->GetCoord2();
+ }
+ int nColSpan = mxCol-mnCol+1;
+ int nRowSpan = mxRow-mnRow+1;
+ if (nColSpan<kMaxColSpan && nRowSpan<kMaxRowSpan) {
+ fTopology.Clear();
+ fTopology.SetBitNumber(nColSpan*nRowSpan-1,kFALSE); // set the size
+ fTopology.SetUniqueID( (nRowSpan<<8) + nColSpan );
+ for (AliITSUClusterizerClusterDigit *idigit=cand->fFirstDigit;idigit;idigit=idigit->fNext) {
+ AliITSdigit* dig = idigit->fDigit;
+ fTopology.SetBitNumber( (dig->GetCoord2()-mnRow)*nColSpan + (dig->GetCoord1()-mnCol) );
+ }
+ if (!fTreeTopology) InitTopologyTree();
+ AliInfo(Form("Fill Topology, lr %d",fLayerID));
+ fMinCol = mnCol;
+ fMinRow = mnRow;
+ fTreeTopology->Fill();
+ }
+ //
+}
+
+//______________________________________________________________________
+void AliITSUClusterizer::InitTopologyTree()
+{
+ // create output tree for the topology stydy
+ if (fFileTopology || fTreeTopology) AliFatal("Topology structures are already created");
+ TDirectory* cdr = gDirectory;
+ fFileTopology = TFile::Open("clusterTopology.root","recreate");
+ fFileTopology->cd();
+ fTreeTopology = new TTree("clTop","ClusterTopology");
+ fTreeTopology->Branch("tp","TBits",&fTopology);
+ fTreeTopology->Branch("volID",&fVolID);
+ fTreeTopology->Branch("mnCol",&fMinCol);
+ fTreeTopology->Branch("mnRow",&fMinRow);
+ cdr->cd();
+}
+
+//______________________________________________________________________
+void AliITSUClusterizer::SaveTopologyTree()
+{
+ // write output tree for the topology stydy
+ AliInfo("Storing cluster topology tree");
+ if (!fFileTopology || !fTreeTopology) {AliError("Topology structures are not created"); return;}
+ fFileTopology->cd();
+ fTreeTopology->Write();
+ delete fTreeTopology;
+ fFileTopology->Close();
+ delete fFileTopology;
+ fTreeTopology = 0;
+ fFileTopology = 0;
+}
+
+#endif //_ClusterTopology_
#define ALIITSUCLUSTERIZER_H\r
\r
#include <TClonesArray.h>\r
+\r
+//#define _ClusterTopology_ // uncomment this to produce the tree with cluster topology\r
+\r
class TTree;\r
class TObjAray;\r
class AliITSUSegmentationPix;\r
class AliCluster;\r
class AliITSUClusterPix;\r
class AliITSURecoParam;\r
+//\r
+#ifdef _ClusterTopology_\r
+#include <TBits.h>\r
+class TFile;\r
+#endif //_ClusterTopology_\r
+\r
\r
class AliITSUClusterizer : public TObject \r
{\r
AliITSUClusterizerClusterPart *fPartFreelistBptr ; //! pointer in the pool\r
AliITSUClusterizerClusterCand *fCandFreelistBptr ; //!pointer in the pool\r
//\r
+#ifdef _ClusterTopology_\r
+ TTree* fTreeTopology; // output tree for the cluster topology in the special mode\r
+ TFile* fFileTopology; // output file for the cluster topology in the special mode\r
+ TBits fTopology; // container for the clusters topology pattern\r
+ UShort_t fMinCol; // min col number\r
+ UShort_t fMinRow; // min row number\r
+ void InitTopologyTree();\r
+ void SaveTopologyTree();\r
+ void FillClusterTopology(AliITSUClusterizerClusterCand *cand);\r
+#endif //_ClusterTopology_\r
private:\r
AliITSUClusterizer(const AliITSUClusterizer&); //Not implemented\r
AliITSUClusterizer& operator=(const AliITSUClusterizer&); //Not implemented\r