Updated version of the Bari code to work with the HEAD. A new test macros has also...
[u/mrichter/AliRoot.git] / ITS / SSDrecpointTest.C
index cd88fe7092a1f0f0d05356417249920396c5df5a..f3e9294e420970b8103b30230f9b36d53f9cd370 100644 (file)
@@ -21,6 +21,9 @@ void SSDrecpointTest (Int_t evNumber1=0,Int_t evNumber2=0)
    if (gClassTable->GetID("AliRun") < 0) {
       gROOT->LoadMacro("loadlibs.C");
       loadlibs();
+   } else {
+      delete gAlice;
+      gAlice=0;
    }
 
 // Connect the Root Galice file containing Geometry, Kine and Hits
@@ -47,6 +50,7 @@ void SSDrecpointTest (Int_t evNumber1=0,Int_t evNumber2=0)
             Int_t nxN;
             Int_t hitprim;
             Int_t partcode;
+            Int_t ntrover;
             Float_t x;
             Float_t z;
             Float_t dx;
@@ -62,6 +66,7 @@ void SSDrecpointTest (Int_t evNumber1=0,Int_t evNumber2=0)
             Int_t nxN;
             Int_t noverlaps;
             Int_t noverprim;
+            Int_t ntrover;
             Float_t qclP;
             Float_t qclN;
             Float_t qrec;
@@ -82,6 +87,7 @@ void SSDrecpointTest (Int_t evNumber1=0,Int_t evNumber2=0)
           ntuple->Branch("nxN",&ntuple_st.nxN,"nxN/I");
           ntuple->Branch("hitprim",&ntuple_st.hitprim,"hitprim/I");
           ntuple->Branch("partcode",&ntuple_st.partcode,"partcode/I");
+          ntuple->Branch("ntrover",&ntuple_st.ntrover,"ntrover/I");
           ntuple->Branch("x",&ntuple_st.x,"x/F");
           ntuple->Branch("z",&ntuple_st.z,"z/F");
           ntuple->Branch("dx",&ntuple_st.dx,"dx/F");
@@ -101,6 +107,7 @@ void SSDrecpointTest (Int_t evNumber1=0,Int_t evNumber2=0)
           ntuple1->Branch("dz",&ntuple1_st.dz,"dz/F");
          ntuple1->Branch("noverlaps",&ntuple1_st.noverlaps,"noverlaps/I");
           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");
@@ -135,9 +142,10 @@ void SSDrecpointTest (Int_t evNumber1=0,Int_t evNumber2=0)
    //AliITSgeom *aliitsgeo = ITS->GetITSgeom();
    AliITSgeom *geom = ITS->GetITSgeom();
 
+
    //Int_t cp[8]={0,0,0,0,0,0,0,0};
 
-   cout << "SSD" << endl;
+   //cout << "SSD" << endl;
 
    AliITSDetType *iDetType=ITS->DetType(2);
    AliITSsegmentationSSD *seg2=(AliITSsegmentationSSD*)iDetType->GetSegmentationModel();
@@ -148,13 +156,13 @@ void SSDrecpointTest (Int_t evNumber1=0,Int_t evNumber2=0)
 
    TClonesArray *dig2  = ITS->DigitsAddress(2);
    TClonesArray *recp2  = ITS->ClustersAddress(2);
-   //   AliITSClusterFinderSSD *rec2=new AliITSClusterFinderSSD(seg2,dig2,recp2);
    AliITSClusterFinderSSD *rec2=new AliITSClusterFinderSSD(seg2,dig2);
    ITS->SetReconstructionModel(2,rec2);
+
    // test
-   printf("SSD dimensions %f %f \n",seg2->Dx(),seg2->Dz());
+   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
@@ -230,7 +238,7 @@ void SSDrecpointTest (Int_t evNumber1=0,Int_t evNumber2=0)
 
      // module loop for the SSD
      for (mod=first2; mod<last2+1; mod++) {  // for the "ALL" option
-     //for (mod=0; mod<last2-first2+1; mod++) { //for the "SSD" option
+       //for (mod=0; mod<last2-first2+1; mod++) { //for the "SSD" option
 
        TTree *TR = gAlice->TreeR();
        Int_t nentrec=TR->GetEntries();
@@ -248,8 +256,8 @@ void SSDrecpointTest (Int_t evNumber1=0,Int_t evNumber2=0)
 
        Int_t nrecp = ITSrec->GetEntries();
        totpoints += nrecp;
-       if (nrecp) printf("Found %d rec points for module %d\n",nrecp,mod);
-       //if (!nrecp) continue;
+       //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);
@@ -263,7 +271,7 @@ void SSDrecpointTest (Int_t evNumber1=0,Int_t evNumber2=0)
        //       printf("Mod: %X\n",Mod);
        Int_t nhits = Mod->GetNhits();
        Float_t epart = 0;
-       //cout <<" module,nrecp,nclusters,nhits ="<<mod<<","<<nrecp<<","<<nclusters<<","<<nhits<< endl;
+       cout <<" module,nrecp,nclusters,nhits ="<<mod<<","<<nrecp<<","<<nclusters<<","<<nhits<< endl;
 
        // ---------------- cluster/hit analysis ---------------------
 
@@ -279,6 +287,7 @@ void SSDrecpointTest (Int_t evNumber1=0,Int_t evNumber2=0)
 
         Int_t nxP = itsClu->fMultiplicity;
         Int_t nxN = itsClu->fMultiplicityN;
+        Int_t ntrover = itsClu->fNtracks;
         Float_t qclP = itsClu->fSignalP;     // in ADC
         Float_t qclN = itsClu->fSignalN;     // in ADC
         //Float_t dq = qclP - qclN;
@@ -296,7 +305,6 @@ void SSDrecpointTest (Int_t evNumber1=0,Int_t evNumber2=0)
         Int_t tr2 = itsPnt->GetLabel(ii);
          Int_t ii = 2;
         Int_t tr3 = itsPnt->GetLabel(ii);
-
         // fill ntuple2
             ntuple2_st.nxP = nxP;
              ntuple2_st.nxN = nxN;
@@ -342,7 +350,7 @@ void SSDrecpointTest (Int_t evNumber1=0,Int_t evNumber2=0)
                                                      // vertex
           pmod *= 1.0e+3;
 
-         if(hitstat == 66 && yhit < -146.) {  // entering hit
+         if(hitstat == 66 && yhit < -ylim) {  // entering hit
            xhit0 = xhit;
            yhit0 = yhit;
            zhit0 = zhit;
@@ -359,7 +367,7 @@ void SSDrecpointTest (Int_t evNumber1=0,Int_t evNumber2=0)
 
          // Consider the hits only with the track number equaled to one
          // of the recpoint
-         if(track == tr1) flagtrack = 1;
+         if((track == tr1) || (track == tr2) || (track == tr3)) flagtrack = 1;
 
          if(flagtrack == 1) {     // the hit corresponds to the recpoint
 
@@ -383,7 +391,7 @@ void SSDrecpointTest (Int_t evNumber1=0,Int_t evNumber2=0)
 
 
          // x,z resolution colculation
-          if(hitstat == 68 || hitsat == 33) {
+          if((hitstat == 68 || hitsat == 33) && dray == 0) {
             Float_t xmed = (xhit + xhit0)/2;
             Float_t zmed = (zhit + zhit0)/2;
             Float_t xdif = xmed - xrec;
@@ -395,14 +403,13 @@ void SSDrecpointTest (Int_t evNumber1=0,Int_t evNumber2=0)
            }
             pathInSSD = TMath::Sqrt((xhit0-xhit)*(xhit0-xhit)+(yhit0-yhit)*(yhit0-yhit)+(zhit0-zhit)*(zhit0-zhit));
 
-            //cout<<"lay,pnt,hit,xmed,xrec,xdif,zmed,zrec,zdif ="<<hitlayer<<","<<pnt<<","<<hit<<","<<xmed<<","<<xrec<<","<<xdif<<","<<zmed<<","<<zrec<<","<<zdif<<endl;
-
-        // fill ntuple
+            // fill ntuple
              ntuple_st.lay = hitlayer;
             ntuple_st.nxP = nxP;
              ntuple_st.nxN = nxN;
             ntuple_st.hitprim = hitprim;
              ntuple_st.partcode = partcode;
+             ntuple_st.ntrover = ntrover;
             ntuple_st.x = xrec/1000;
              ntuple_st.z = zrec/1000;
             ntuple_st.dx = xdif;
@@ -413,6 +420,7 @@ void SSDrecpointTest (Int_t evNumber1=0,Int_t evNumber2=0)
              ntuple->Fill();
 
             //if(hitlayer == 5 && qcut < 0.18) {
+             
            if(hitlayer == 5 ) {
              Xres5->Fill(xdif);
              Zres5->Fill(zdif);
@@ -451,6 +459,7 @@ void SSDrecpointTest (Int_t evNumber1=0,Int_t evNumber2=0)
          noverprim -= 1;
          ntuple1_st.noverlaps = noverlaps;
          ntuple1_st.noverprim = noverprim;
+          ntuple1_st.ntrover = ntrover;
 
          //if(qcut < 0.18) ntuple1->Fill();
          ntuple1->Fill();