]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ITS/SSDrecpointTest.C
The macros was working only in SSD mode. Now it works il All mode
[u/mrichter/AliRoot.git] / ITS / SSDrecpointTest.C
index 525cfee83a5cf4adc737a3abdb4e34e965d3eec2..1306102be209769d83581975efdf85dff7d4920e 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");
@@ -229,7 +236,8 @@ void SSDrecpointTest (Int_t evNumber1=0,Int_t evNumber2=0)
      printf("det type %d first2, last2 %d %d \n",2,first2,last2);
 
      // module loop for the SSD
-     for (mod=first2; mod<last2+1; mod++) {
+     //for (mod=first2; mod<last2+1; mod++) {  // for the "ALL" option
+     for (mod=0; mod<last2-first2+1; mod++) { //for the "SSD" option
 
        TTree *TR = gAlice->TreeR();
        Int_t nentrec=TR->GetEntries();
@@ -248,16 +256,21 @@ 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) 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);
+       // for the "SSD" option
+
        AliITSmodule *Mod = (AliITSmodule *)fITSmodules->At(mod);
+       // for the "ALL" option
+
        //       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 ---------------------
 
@@ -273,6 +286,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;
@@ -290,7 +304,7 @@ 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);
-
+        //cout<<"pnt,ntrover,tr1,tr2,tr3 ="<<pnt<<","<<ntrover<<","<<tr1<<","<<tr2<<","<<tr3<<endl;
         // fill ntuple2
             ntuple2_st.nxP = nxP;
              ntuple2_st.nxN = nxN;
@@ -332,6 +346,7 @@ void SSDrecpointTest (Int_t evNumber1=0,Int_t evNumber2=0)
    //  partcode (pdgCode): 11 - e-, 13 - mu-, 22 - gamma, 111 - pi0, 211 - i+
    //  310 - K0s, 321 - K+, 2112 - n, 2212 - p, 3122 - lambda
 
+          //cout<<"hit,hitstat,track,partcode,parent ="<<hit<<","<<hitstat<<","<<track<<","<<partcode<<","<<parent<<endl;
            Float_t pmod = itsHit->GetParticle()->P(); // the momentum at the
                                                      // vertex
           pmod *= 1.0e+3;
@@ -353,7 +368,8 @@ 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;
+         //cout<<"!!Ok: track,tr1,tr2,tr3 ="<<track<<","<<tr1<<","<<tr2<<","<<tr3<<endl;
 
          if(flagtrack == 1) {     // the hit corresponds to the recpoint
 
@@ -377,39 +393,45 @@ void SSDrecpointTest (Int_t evNumber1=0,Int_t evNumber2=0)
 
 
          // x,z resolution colculation
-          if((hitstat == 68 || hitsat == 33) && parent < 0)  {
+          if((hitstat == 68 || hitsat == 33) && dray == 0) {
             Float_t xmed = (xhit + xhit0)/2;
             Float_t zmed = (zhit + zhit0)/2;
             Float_t xdif = xmed - xrec;
             Float_t zdif = zmed - zrec;
 
-            hitprim = 1; // hitprim=1 for the primery particles
-
-            noverprim += 1;
-
+            if(parent < 0)  {
+             hitprim = 1; // hitprim=1 for the primery particles
+             noverprim += 1;
+           }
             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;
              ntuple_st.dz = zdif;
              ntuple_st.pmod = pmod;
 
-             if(qcut < 0.18) ntuple->Fill();
+             //if(qcut < 0.18) ntuple->Fill();
+             ntuple->Fill();
 
-           if(hitlayer == 5 && qcut < 0.18) {
+            //if(hitlayer == 5 && qcut < 0.18) {
+             
+           if(hitlayer == 5 ) {
              Xres5->Fill(xdif);
              Zres5->Fill(zdif);
              Path5->Fill(pathInSSD);
-            }
-            if(hitlayer == 6 && qcut < 0.18) {
+           }
+            //if(hitlayer == 6 && qcut < 0.18) {
+            if(hitlayer == 6) {
              Xres6->Fill(xdif);
              Zres6->Fill(zdif);
              Path6->Fill(pathInSSD);
@@ -441,8 +463,10 @@ 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();
+         //if(qcut < 0.18) ntuple1->Fill();
+         ntuple1->Fill();
 
           Float_t de = dedx*300./pathInSSD;
           dEdX->Fill(de);