From 664c92b8d46fc713b1c2ef5ed93cc411d6f5a743 Mon Sep 17 00:00:00 2001 From: barbera Date: Fri, 27 Jul 2001 06:38:46 +0000 Subject: [PATCH] New version from Boris Batyunya working with any statistics --- ITS/SSDrecpointTest.C | 233 ++++++++++++++++++++---------------------- 1 file changed, 108 insertions(+), 125 deletions(-) diff --git a/ITS/SSDrecpointTest.C b/ITS/SSDrecpointTest.C index ed845b6a983..d1a5c5e3886 100644 --- a/ITS/SSDrecpointTest.C +++ b/ITS/SSDrecpointTest.C @@ -27,23 +27,26 @@ void SSDrecpointTest (Int_t evNumber1=0,Int_t evNumber2=0) } // Connect the Root Galice file containing Geometry, Kine and Hits - TString *str = new TString("galice.root"); - TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject(str->Data()); - if (!file) file = new TFile(str->Data(),"UPDATE"); + //TString *str = new TString("galice.root"); + //TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject(str->Data()); + TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject("galice.root"); + //if (!file) file = new TFile(str->Data(),"UPDATE"); + if (!file) file = new TFile("galice.root"); + file->ls(); // Get AliRun object from file or create it if not on file - // if (!gAlice) { + if (!gAlice) { gAlice = (AliRun*)file->Get("gAlice"); if (gAlice) printf("AliRun object found on file\n"); if (!gAlice) gAlice = new AliRun("gAlice","Alice test program"); - //} + } // -------------- Create ntuples -------------------- - // ntuple structures: - + // ntuple structures: + /* struct { Int_t lay; Int_t nxP; @@ -57,6 +60,7 @@ void SSDrecpointTest (Int_t evNumber1=0,Int_t evNumber2=0) Float_t dz; Float_t pmod; } ntuple_st; + */ struct { Int_t lay; @@ -75,6 +79,7 @@ void SSDrecpointTest (Int_t evNumber1=0,Int_t evNumber2=0) Float_t dz; } ntuple1_st; + struct { Int_t nxP; Int_t nxN; @@ -82,6 +87,7 @@ void SSDrecpointTest (Int_t evNumber1=0,Int_t evNumber2=0) Float_t z; } ntuple2_st; + /* ntuple = new TTree("ntuple","Demo ntuple"); ntuple->Branch("lay",&ntuple_st.lay,"lay/I"); ntuple->Branch("nxP",&ntuple_st.nxP,"nxP/I"); @@ -94,6 +100,7 @@ void SSDrecpointTest (Int_t evNumber1=0,Int_t evNumber2=0) ntuple->Branch("dx",&ntuple_st.dx,"dx/F"); ntuple->Branch("dz",&ntuple_st.dz,"dz/F"); ntuple->Branch("pmod",&ntuple_st.pmod,"pmod/F"); + */ ntuple1 = new TTree("ntuple1","Demo ntuple1"); ntuple1->Branch("lay",&ntuple1_st.lay,"lay/I"); @@ -111,6 +118,7 @@ void SSDrecpointTest (Int_t evNumber1=0,Int_t evNumber2=0) ntuple1->Branch("noverprim",&ntuple1_st.noverprim,"noverprim/I"); ntuple1->Branch("ntrover",&ntuple1_st.ntrover,"ntrover/I"); + ntuple2 = new TTree("ntuple2","Demo ntuple2"); ntuple2->Branch("nxP",&ntuple2_st.nxP,"nxP/I"); ntuple2->Branch("nxN",&ntuple2_st.nxN,"nxN/I"); @@ -136,93 +144,47 @@ void SSDrecpointTest (Int_t evNumber1=0,Int_t evNumber2=0) TH2F *adcPadcN6all = new TH2F("adcPadcN6all","adcP/N correlation for lay6",100,0.,200.,100,0.,200.); TH2F *adcPadcN5cut = new TH2F("adcPadcN5cut","adcP/N correlation for lay5 and cut of P-N signas",100,0.,200.,100,0.,200.); TH2F *adcPadcN6cut = new TH2F("adcPadcN6cut","adcP/N correlation for lay6 and cut of P-N signals",100,0.,200.,100,0.,200.); + //----------------------------------------------------------- - - AliITS *ITS = (AliITS*) gAlice->GetModule("ITS"); - if (!ITS) { cout << "no ITS" << endl; return; } - - //AliITSgeom *aliitsgeo = ITS->GetITSgeom(); - AliITSgeom *geom = ITS->GetITSgeom(); - - - //Int_t cp[8]={0,0,0,0,0,0,0,0}; - - //cout << "SSD" << endl; - - AliITSDetType *iDetType=ITS->DetType(2); - AliITSsegmentationSSD *seg2=(AliITSsegmentationSSD*)iDetType->GetSegmentationModel(); - AliITSresponseSSD *res2 = (AliITSresponseSSD*)iDetType->GetResponseModel(); - //res2->SetSigmaSpread(3.,2.); - AliITSsimulationSSD *sim2=new AliITSsimulationSSD(seg2,res2); - ITS->SetSimulationModel(2,sim2); - - TClonesArray *dig2 = ITS->DigitsAddress(2); - TClonesArray *recp2 = ITS->ClustersAddress(2); - AliITSClusterFinderSSD *rec2=new AliITSClusterFinderSSD(seg2,dig2); - ITS->SetReconstructionModel(2,rec2); - - // test - printf("SSD dimensions %f %f %f \n",seg2->Dx(),seg2->Dz(),seg2->Dy()); - printf("SSD nstrips %d %d \n",seg2->Npz(),seg2->Npx()); - Float_t ylim = seg2->Dy()/2 - 12; - // -// Loop over events +// Loop over events // - - - Int_t Nh=0; - Int_t Nh1=0; - for (int nev=0; nev<= evNumber2; nev++) { - Int_t nparticles = 0; - nparticles = gAlice->GetEvent(nev); + for (int nev=0; nev<= evNumber2; nev++) { + Int_t nparticles = gAlice->GetEvent(nev); cout << "nev " << nev <TreeH(); - Int_t nenthit=TH->GetEntries(); - printf("Found %d entries in the Hit tree (must be one per track per event!)\n",nenthit); + Int_t ntracks = TH->GetEntries(); + cout<<"all entries to GEANT(charged and neutral) "<GetTreeC(nev); - TTree *TC=ITS->TreeC(); - Int_t nentclu=TC->GetEntries(); - printf("Found %d entries in the Cluster tree (must be one per module per event!)\n",nentclu); +// Get pointers to Alice detectors and Digits containers + AliITS *ITS = (AliITS*)gAlice->GetModule("ITS"); + TClonesArray *Particles = gAlice->Particles(); - TTree *TR = gAlice->TreeR(); - Int_t nentrec=TR->GetEntries(); - printf("Found %d entries in the RecPoints tree\n",nentrec); - - // Get Pointers to Clusters & Recpoints TClonesArrays + if (ITS) { - TClonesArray *ITSclu = ITS->ClustersAddress(2); - printf ("ITSclu %p \n",ITSclu); - TClonesArray *ITSrec = ITS->RecPoints(); - printf ("ITSrec %p \n",ITSrec); - - // check recpoints + // fill modules with sorted by module hits + Int_t nmodules; + ITS->InitModules(-1,nmodules); + ITS->FillModules(nev,evNumber2,nmodules," "," "); - //Int_t nbytes = 0; - Int_t totpoints = 0; - Int_t totclust = 0; + //get pointer to modules array + TObjArray *ITSmodules = ITS->GetModules(); + AliITShit *itsHit; - // check hits - - Int_t nmodules=0; + // get the Tree for clusters + ITS->GetTreeC(nev); + TTree *TC=ITS->TreeC(); + Int_t nent=TC->GetEntries(); + printf("Found %d entries in the TreeC (full number of the modules)\n",nent); + TTree *TR = gAlice->TreeR(); + Int_t lay, lad, det; + AliITSgeom *geom = ITS->GetITSgeom(); Int_t mod; - - ITS->InitModules(-1,nmodules); - ITS->FillModules(nev,0,nmodules,"",""); - - TObjArray *fITSmodules = ITS->GetModules(); - + Int_t first0 = geom->GetStartDet(0); // SPD Int_t last0 = geom->GetLastDet(0); // SPD Int_t first1 = geom->GetStartDet(1); // SDD @@ -232,56 +194,72 @@ void SSDrecpointTest (Int_t evNumber1=0,Int_t evNumber2=0) // For the SPD: first0 = 0, last0 = 239 (240 modules); // for the SDD: first1 = 240, last1 = 499 (260 modules); - // for the SSD: first2 = 500, last2 = 2269 (1770 modules). + // for the SSD: first2 = 500, last2 = 2197 (1698 modules). printf("det type %d first0, last0 %d %d \n",0,first0,last0); printf("det type %d first1, last1 %d %d \n",1,first1,last1); printf("det type %d first2, last2 %d %d \n",2,first2,last2); - // module loop for the SSD - for (mod=first2; modTreeR(); - Int_t nentrec=TR->GetEntries(); - //printf("Found %d entries in the RecPoints tree\n",nentrec); - - //cout << "CLUSTERS: reset" << endl; - ITS->ResetClusters(); - //cout << "CLUSTERS: get" << endl; - TC->GetEvent(mod); - //cout << "RECPOINTS: reset" << endl; - ITS->ResetRecPoints(); - //cout << "RECPOINTS: get" << endl; - //TR->GetEvent(mod+1); // for the V3.04 AliRoot - TR->GetEvent(mod); // for the V3.05 AliRoot - - Int_t nrecp = ITSrec->GetEntries(); - totpoints += nrecp; - //if (nrecp) printf("Found %d rec points for module %d\n",nrecp,mod); - if (!nrecp) continue; - Int_t nclusters = ITSclu->GetEntries(); - totclust += nclusters; - //if (nclusters) printf("Found %d clusters for module %d\n",nrecc,mod); - - //AliITSmodule *Mod = (AliITSmodule *)fITSmodules->At(mod+first2); + + AliITSDetType *iDetType=ITS->DetType(2); + AliITSsegmentationSSD *seg2=(AliITSsegmentationSSD*)iDetType->GetSegmentationModel(); + //AliITSresponseSSD *res2 = (AliITSresponseSSD*)iDetType->GetResponseModel(); + + printf("SSD dimensions %f %f %f \n",seg2->Dx(),seg2->Dz(),seg2->Dy()); + printf("SSD nstrips %d %d \n",seg2->Npz(),seg2->Npx()); + Float_t ylim = seg2->Dy()/2 - 12; + + + + for (Int_t idettype=0;idettype<3;idettype++) { + + TClonesArray *ITSclu = ITS->ClustersAddress(idettype); + TClonesArray *ITSrec = ITS->RecPoints(); + //printf ("ITSrec %p \n",ITSrec); + //printf ("ITSclu %p \n",ITSclu); + + if (idettype != 2) continue; + + // Module loop + + //for (mod=first2; modAt(mod+first2); // for the "SSD" option - AliITSmodule *Mod = (AliITSmodule *)fITSmodules->At(mod); + //AliITSmodule *Mod = (AliITSmodule *)ITSmodules->At(mod); // for the "ALL" option - // printf("Mod: %X\n",Mod); - Int_t nhits = Mod->GetNhits(); + geom->GetModuleId(mod,lay,lad,det); + + Int_t nhits = Mod->GetNhits(); + //if(nhits) printf("module nhits %d %d\n",mod,nhits); + if(!nhits) continue; + + ITS->ResetClusters(); + TC->GetEvent(mod); + Int_t nclust = ITSclu->GetEntries(); + if (!nclust) continue; + + ITS->ResetRecPoints(); + TR->GetEvent(mod); + Int_t nrecp = ITSrec->GetEntries(); + //if (nrecp) printf("Found %d rec points for module %d\n",nrecp,mod); + if (!nrecp) continue; + + + Float_t epart = 0; - //cout <<" module,nrecp,nclusters,nhits ="<At(pnt); if(!itsPnt) continue; @@ -313,7 +291,7 @@ void SSDrecpointTest (Int_t evNumber1=0,Int_t evNumber2=0) ntuple2_st.x = xrec/1000; ntuple2_st.z = zrec/1000; - //if(qcut < 0.18) ntuple2->Fill(); + ntuple2->Fill(); Int_t noverlaps = 0; Int_t noverprim = 0; @@ -325,7 +303,7 @@ void SSDrecpointTest (Int_t evNumber1=0,Int_t evNumber2=0) Float_t dzprimbest = 1e+7; // Hit loop - for (Int_t hit=0;hitGetHit(hit); @@ -412,6 +390,8 @@ void SSDrecpointTest (Int_t evNumber1=0,Int_t evNumber2=0) if(TMath::Abs(dzprimbest)>TMath::Abs(zdif)) dzprimbest = zdif; } + + /* // fill ntuple ntuple_st.lay = hitlayer; ntuple_st.nxP = nxP; @@ -427,6 +407,7 @@ void SSDrecpointTest (Int_t evNumber1=0,Int_t evNumber2=0) //if(qcut < 0.18) ntuple->Fill(); ntuple->Fill(); + */ //if(hitlayer == 5 && qcut < 0.18) { @@ -446,14 +427,14 @@ void SSDrecpointTest (Int_t evNumber1=0,Int_t evNumber2=0) xhit0 = 1e+7; zhit0 = 1e+7; } // end of hit-recpoint correspondence - } // hit loop + } // hit loop - if(flaghit == 1) { + if(flaghit == 1) { if(noverlaps == 0) noverlaps = 1; // cluster contains one or more // delta rays only - + // fill ntuple1 ntuple1_st.lay = hitlayer; ntuple1_st.lad = hitladder; @@ -474,6 +455,7 @@ void SSDrecpointTest (Int_t evNumber1=0,Int_t evNumber2=0) //if(qcut < 0.18) ntuple1->Fill(); ntuple1->Fill(); + Float_t de = dedx*300./pathInSSD; dEdX->Fill(de); @@ -497,15 +479,16 @@ void SSDrecpointTest (Int_t evNumber1=0,Int_t evNumber2=0) NxN6->Fill(nxN); } } - } // flaghit = 1 - - } //b.b. recpoint loop - } //b.b. module loop - } //b.b. evnt loop + } // flaghit = 1 + } //b.b. recpoint loop + } // module loop + } // detector loop (iDetType) + } // if ITS + } //b.b. evnt loop TFile fhistos("SSD_his.root","RECREATE"); - ntuple->Write(); + //ntuple->Write(); ntuple1->Write(); ntuple2->Write(); NxP5->Write(); -- 2.43.0