X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=ITS%2FAliITSclustererV2.cxx;h=a4e86a060d515c4abafa96c2a198e1cc182cb9ba;hb=c61a7285011faf50a1f39c6a49e0c3fdeeff6260;hp=767099ceb1de0c383fd35509776f8d4b71f0ff1f;hpb=b66f90a056fd979ef397d26e826c0a0f21ceda00;p=u%2Fmrichter%2FAliRoot.git diff --git a/ITS/AliITSclustererV2.cxx b/ITS/AliITSclustererV2.cxx index 767099ceb1d..a4e86a060d5 100644 --- a/ITS/AliITSclustererV2.cxx +++ b/ITS/AliITSclustererV2.cxx @@ -3,8 +3,7 @@ // // Origin: Iouri Belikov, CERN, Jouri.Belikov@cern.ch //------------------------------------------------------------------------- -//uncomment the line below for running with V1 cluster finder classes -//#define V1 + #include "AliRun.h" @@ -19,7 +18,7 @@ #include #include #include -#include "AliITSgeom.h" +#include "AliITSgeomTGeo.h" #include "AliITSdigitSPD.h" #include "AliITSdigitSDD.h" #include "AliITSdigitSSD.h" @@ -29,39 +28,75 @@ ClassImp(AliITSclustererV2) extern AliRun *gAlice; -AliITSclustererV2::AliITSclustererV2(const AliITSgeom *geom) { +AliITSclustererV2::AliITSclustererV2(): +fNModules(0), +fEvent(0), +fI(0), +fLastSPD1(0), +fNySPD(0), +fNzSPD(0), +fYpitchSPD(0), +fZ1pitchSPD(0), +fZ2pitchSPD(0), +fHwSPD(0), +fHlSPD(0), +fNySDD(0), +fNzSDD(0), +fYpitchSDD(0), +fZpitchSDD(0), +fHwSDD(0), +fHlSDD(0), +fYoffSDD(0), +fLastSSD1(0), +fYpitchSSD(0), +fHwSSD(0), +fHlSSD(0), +fTanP(0), +fTanN(0){ + //default constructor + } +AliITSclustererV2::AliITSclustererV2(const Char_t *geom): +fNModules(AliITSgeomTGeo::GetNModules()), +fEvent(0), +fI(0), +fLastSPD1(AliITSgeomTGeo::GetModuleIndex(2,1,1)-1), +fNySPD(256), +fNzSPD(160), +fYpitchSPD(0.0050), +fZ1pitchSPD(0.0425), +fZ2pitchSPD(0.0625), +fHwSPD(0.64), +fHlSPD(3.48), +fNySDD(256), +fNzSDD(256), +fYpitchSDD(0.01825), +fZpitchSDD(0.02940), +fHwSDD(3.5085), +fHlSDD(3.7632), +fYoffSDD(0.0425), +fLastSSD1(AliITSgeomTGeo::GetModuleIndex(6,1,1)-1), +fYpitchSSD(0.0095), +fHwSSD(3.65), +fHlSSD(2.00), +fTanP(0.0275), +fTanN(0.0075) { //------------------------------------------------------------ // Standard constructor //------------------------------------------------------------ - AliITSgeom *g=(AliITSgeom*)geom; - - fEvent=0; - fI=0; - - Int_t mmax=geom->GetIndexMax(); - if (mmax>2200) { - Fatal("AliITSclustererV2","Too many ITS subdetectors !"); + if (geom) { + AliWarning("\"geom\" is actually a dummy argument !"); } Int_t m; - for (m=0; mGetModuleId(m,lay,lad,det); - Float_t x,y,z; g->GetTrans(lay,lad,det,x,y,z); - Double_t rot[9]; g->GetRotMatrix(lay,lad,det,rot); - Double_t alpha=TMath::ATan2(rot[1],rot[0])+TMath::Pi(); - Double_t ca=TMath::Cos(alpha), sa=TMath::Sin(alpha); - fYshift[m] = x*ca + y*sa; - fZshift[m] = (Double_t)z; - fNdet[m] = (lad-1)*g->GetNdetectors(lay) + (det-1); + for (m=0; mInverse()).GetTranslation()[1]; + fZshift[m] = (tm->Inverse()).GetTranslation()[2]; + fNdet[m] = (lad-1)*AliITSgeomTGeo::GetNDetectors(lay) + (det-1); fNlayer[m] = lay-1; } - fNModules = g->GetIndexMax(); //SPD geometry - fLastSPD1=g->GetModuleIndex(2,1,1)-1; - fNySPD=256; fNzSPD=160; - fYpitchSPD=0.0050; - fZ1pitchSPD=0.0425; fZ2pitchSPD=0.0625; - fHwSPD=0.64; fHlSPD=3.48; fYSPD[0]=0.5*fYpitchSPD; for (m=1; mGetModuleIndex(6,1,1)-1; - fYpitchSSD=0.0095; - fHwSSD=3.65; - fHlSSD=2.00; - fTanP=0.0275; - fTanN=0.0075; - } @@ -203,17 +223,19 @@ void AliITSclustererV2::Digits2Clusters(AliRawReader* rawReader) { // write all clusters to the tree Int_t nClusters = 0; + TClonesArray *emptyArray=new TClonesArray("AliITSclusterV2"); for (Int_t iModule = 0; iModule < fNModules; iModule++) { array = clusters[iModule]; if (!array) { Error("Digits2Clusters", "data for module %d missing!", iModule); - array = new TClonesArray("AliITSclusterV2"); + array = emptyArray; } cTree->SetBranchAddress("Clusters", &array); cTree->Fill(); nClusters += array->GetEntriesFast(); - delete array; } + delete emptyArray; + itsLoader->WriteRecPoints("OVERWRITE"); delete[] clusters; @@ -236,27 +258,32 @@ static void CheckLabels(Int_t lab[3]) { //------------------------------------------------------------ // Tries to find mother's labels //------------------------------------------------------------ + AliRunLoader *rl = AliRunLoader::GetRunLoader(); + TTree *trK=(TTree*)rl->TreeK(); + + if(trK){ Int_t label=lab[0]; if (label>=0) { - TParticle *part=(TParticle*)gAlice->GetMCApp()->Particle(label); - label=-3; - while (part->P() < 0.005) { - Int_t m=part->GetFirstMother(); - if (m<0) { - Info("CheckLabels","Primary momentum: %f",part->P()); - break; - } - if (part->GetStatusCode()>0) { - Info("CheckLabels","Primary momentum: %f",part->P()); - break; - } - label=m; - part=(TParticle*)gAlice->GetMCApp()->Particle(label); - } - if (lab[1]<0) lab[1]=label; - else if (lab[2]<0) lab[2]=label; - else ;//cerr<<"CheckLabels : No empty labels !\n"; + TParticle *part=(TParticle*)gAlice->GetMCApp()->Particle(label); + label=-3; + while (part->P() < 0.005) { + Int_t m=part->GetFirstMother(); + if (m<0) { + Info("CheckLabels","Primary momentum: %f",part->P()); + break; + } + if (part->GetStatusCode()>0) { + Info("CheckLabels","Primary momentum: %f",part->P()); + break; + } + label=m; + part=(TParticle*)gAlice->GetMCApp()->Particle(label); + } + if (lab[1]<0) lab[1]=label; + else if (lab[2]<0) lab[2]=label; + else ;//cerr<<"CheckLabels : No empty labels !\n"; } + } } /* @@ -291,17 +318,21 @@ static void CheckLabels2(Int_t lab[10]) { //------------------------------------------------------------ // Tries to find mother's labels //------------------------------------------------------------ - Int_t nlabels =0; - for (Int_t i=0;i<10;i++) if (lab[i]>=0) nlabels++; - if(nlabels == 0) return; // In case of no labels just exit + AliRunLoader *rl = AliRunLoader::GetRunLoader(); + TTree *trK=(TTree*)rl->TreeK(); - Int_t ntracks = gAlice->GetMCApp()->GetNtrack(); + if(trK){ + Int_t nlabels =0; + for (Int_t i=0;i<10;i++) if (lab[i]>=0) nlabels++; + if(nlabels == 0) return; // In case of no labels just exit - for (Int_t i=0;i<10;i++){ - Int_t label = lab[i]; - if (label>=0 && labelGetMCApp()->Particle(label); - if (part->P() < 0.02) { + Int_t ntracks = gAlice->GetMCApp()->GetNtrack(); + + for (Int_t i=0;i<10;i++){ + Int_t label = lab[i]; + if (label>=0 && labelGetMCApp()->Particle(label); + if (part->P() < 0.02) { Int_t m=part->GetFirstMother(); if (m<0) { continue; @@ -310,63 +341,69 @@ static void CheckLabels2(Int_t lab[10]) { continue; } lab[i]=m; + } + else + if (part->P() < 0.12 && nlabels>3) { + lab[i]=-2; + nlabels--; + } } - else - if (part->P() < 0.12 && nlabels>3) { + else{ + if ( (label>ntracks||label <0) && nlabels>3) { lab[i]=-2; nlabels--; } - } - else{ - if ( (label>ntracks||label <0) && nlabels>3) { - lab[i]=-2; - nlabels--; - } - } - } - if (nlabels>3){ - for (Int_t i=0;i<10;i++){ - if (nlabels>3){ - Int_t label = lab[i]; - if (label>=0 && labelGetMCApp()->Particle(label); - if (part->P() < 0.1) { - lab[i]=-2; - nlabels--; + } + } + if (nlabels>3){ + for (Int_t i=0;i<10;i++){ + if (nlabels>3){ + Int_t label = lab[i]; + if (label>=0 && labelGetMCApp()->Particle(label); + if (part->P() < 0.1) { + lab[i]=-2; + nlabels--; + } } } } } - } - //compress labels -- if multi-times the same - Int_t lab2[10]; - for (Int_t i=0;i<10;i++) lab2[i]=-2; - for (Int_t i=0;i<10 ;i++){ - if (lab[i]<0) continue; - for (Int_t j=0;j<10 &&lab2[j]!=lab[i];j++){ - if (lab2[j]<0) { - lab2[j]= lab[i]; - break; + //compress labels -- if multi-times the same + Int_t lab2[10]; + for (Int_t i=0;i<10;i++) lab2[i]=-2; + for (Int_t i=0;i<10 ;i++){ + if (lab[i]<0) continue; + for (Int_t j=0;j<10 &&lab2[j]!=lab[i];j++){ + if (lab2[j]<0) { + lab2[j]= lab[i]; + break; + } } } + for (Int_t j=0;j<10;j++) lab[j]=lab2[j]; } - for (Int_t j=0;j<10;j++) lab[j]=lab2[j]; - } static void AddLabel(Int_t lab[10], Int_t label) { +// add label of the particle in the kine tree which originates this cluster +// (used for reconstruction of MC data only, for comparison purposes) + AliRunLoader *rl = AliRunLoader::GetRunLoader(); + TTree *trK=(TTree*)rl->TreeK(); - if(label<0) return; // In case of no label just exit + if(trK){ + if(label<0) return; // In case of no label just exit - Int_t ntracks = gAlice->GetMCApp()->GetNtrack(); - if (label>ntracks) return; - for (Int_t i=0;i<10;i++){ - // if (label<0) break; - if (lab[i]==label) break; - if (lab[i]<0) { - lab[i]= label; - break; + Int_t ntracks = gAlice->GetMCApp()->GetNtrack(); + if (label>ntracks) return; + for (Int_t i=0;i<10;i++){ + // if (label<0) break; + if (lab[i]==label) break; + if (lab[i]<0) { + lab[i]= label; + break; + } } } } @@ -382,9 +419,9 @@ void AliITSclustererV2::RecPoints2Clusters for (Int_t i=0; iUncheckedAt(i); Float_t lp[5]; - lp[0]=-(-p->GetX()+fYshift[idx]); if (idx<=fLastSPD1) lp[0]*=-1; //SPD1 + lp[0]=-(-p->GetDetLocalX()+fYshift[idx]); if (idx<=fLastSPD1) lp[0]*=-1; //SPD1 lp[1]= -p->GetZ()+fZshift[idx]; - lp[2]=p->GetSigmaX2(); + lp[2]=p->GetSigmaDetLocX2(); lp[3]=p->GetSigmaZ2(); lp[4]=p->GetQ()*36./23333.; //electrons -> ADC Int_t lab[4]; @@ -398,7 +435,6 @@ void AliITSclustererV2::RecPoints2Clusters //*********************************** -#ifndef V1 void AliITSclustererV2:: FindCluster(Int_t k,Int_t maxz,AliBin *bins,Int_t &n,Int_t *idx) { @@ -825,10 +861,6 @@ FindClustersSDD(AliBin* bins[2], Int_t nMaxBin, Int_t nzBins, } */ - c.SetSigmaY2(0.0030*0.0030); - c.SetSigmaZ2(0.0020*0.0020); - c.SetDetectorIndex(fNdet[fI]); - Float_t y=c.GetY(),z=c.GetZ(), q=c.GetQ(); y/=q; z/=q; // @@ -847,12 +879,11 @@ FindClustersSDD(AliBin* bins[2], Int_t nMaxBin, Int_t nzBins, y=-(-y+fYshift[fI]); z= -z+fZshift[fI]; - c.SetY(y); - c.SetZ(z); - c.SetNy(maxj-minj+1); - c.SetNz(maxi-mini+1); - c.SetType(npeaks); - c.SetQ(q/12.7); //to be consistent with the SSD charges + + q/=12.7; //this WAS consistent with SSD. To be reassessed + // 23-MAR-2007 + Float_t hit[5] = {y, z, 0.0030*0.0030, 0.0020*0.0020, q}; + Int_t info[3] = {maxj-minj+1, maxi-mini+1, fNlayer[fI]}; if (c.GetQ() < 20.) continue; //noise cluster @@ -866,13 +897,13 @@ FindClustersSDD(AliBin* bins[2], Int_t nMaxBin, Int_t nzBins, //lab[2]=(d->GetTracks())[2]; //CheckLabels(lab); CheckLabels2(milab); - c.SetLabel(milab[0],0); - c.SetLabel(milab[1],1); - c.SetLabel(milab[2],2); - c.SetLayer(fNlayer[fI]); } } - new (cl[ncl]) AliITSclusterV2(c); ncl++; + milab[3]=fNdet[fI]; + + AliITSclusterV2 *cc = new (cl[ncl]) AliITSclusterV2(milab,hit,info); + cc->SetType(npeaks); + ncl++; } } } @@ -1657,79 +1688,3 @@ void AliITSclustererV2::FindClustersSSD(AliITSRawStream* input, Info("FindClustersSSD", "found clusters in ITS SSD: %d", nClustersSSD); } -#else //V1 - -#include "AliITSDetType.h" -#include "AliITS.h" -#include "AliITSsegmentationSPD.h" -#include "AliITSClusterFinderSPD.h" - -#include "AliITSresponseSDD.h" -#include "AliITSsegmentationSDD.h" -#include "AliITSClusterFinderSDD.h" - -#include "AliITSsegmentationSSD.h" -#include "AliITSClusterFinderSSD.h" - - -void AliITSclustererV2:: -FindClustersSPD(const TClonesArray *digits, TClonesArray *clusters) { - //------------------------------------------------------------ - // Actual SPD cluster finding based on AliITSClusterFinderSPD - //------------------------------------------------------------ - static AliITS *its=(AliITS*)gAlice->GetModule("ITS"); - static TClonesArray *points=its->RecPoints(); - static AliITSsegmentationSPD *seg= - (AliITSsegmentationSPD *)its->DetType(0)->GetSegmentationModel(); - static AliITSClusterFinderSPD cf(seg, (TClonesArray*)digits, points); - - cf.FindRawClusters(fI); - RecPoints2Clusters(points, fI, clusters); - its->ResetRecPoints(); - -} - -void AliITSclustererV2:: -FindClustersSDD(const TClonesArray *digits, TClonesArray *clusters) { - //------------------------------------------------------------ - // Actual SDD cluster finding based on AliITSClusterFinderSDD - //------------------------------------------------------------ - static AliITS *its=(AliITS*)gAlice->GetModule("ITS"); - static TClonesArray *points=its->RecPoints(); - static AliITSresponseSDD *resp= - (AliITSresponseSDD *)its->DetType(1)->GetResponseModel(); - static AliITSsegmentationSDD *seg= - (AliITSsegmentationSDD *)its->DetType(1)->GetSegmentationModel(); - static AliITSClusterFinderSDD - cf(seg,resp,(TClonesArray*)digits,its->ClustersAddress(1)); - - cf.FindRawClusters(fI); - Int_t nc=points->GetEntriesFast(); - while (nc--) { //To be consistent with the SSD cluster charges - AliITSRecPoint *p=(AliITSRecPoint*)points->UncheckedAt(nc); - p->SetQ(p->GetQ()/12.); - } - RecPoints2Clusters(points, fI, clusters); - its->ResetClusters(1); - its->ResetRecPoints(); - -} - -void AliITSclustererV2:: -FindClustersSSD(const TClonesArray *digits, TClonesArray *clusters) { - //------------------------------------------------------------ - // Actual SSD cluster finding based on AliITSClusterFinderSSD - //------------------------------------------------------------ - static AliITS *its=(AliITS*)gAlice->GetModule("ITS"); - static TClonesArray *points=its->RecPoints(); - static AliITSsegmentationSSD *seg= - (AliITSsegmentationSSD *)its->DetType(2)->GetSegmentationModel(); - static AliITSClusterFinderSSD cf(seg,(TClonesArray*)digits); - - cf.FindRawClusters(fI); - RecPoints2Clusters(points, fI, clusters); - its->ResetRecPoints(); - -} - -#endif