]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
AliTOFanalyzeMatching.C macro added and minor changes to the AliTOF code
authorvicinanz <vicinanz@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 8 May 2002 13:24:50 +0000 (13:24 +0000)
committervicinanz <vicinanz@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 8 May 2002 13:24:50 +0000 (13:24 +0000)
13 files changed:
TOF/AliTOFPID.cxx
TOF/AliTOFReconstructioner.cxx
TOF/AliTOFSDigit.cxx
TOF/AliTOFSDigit.h
TOF/AliTOFSDigitizer.cxx
TOF/AliTOFanalyzeMatching.C [new file with mode: 0644]
TOF/AliTOFv0.cxx
TOF/AliTOFv1.cxx
TOF/AliTOFv2.cxx
TOF/AliTOFv2FHoles.cxx
TOF/AliTOFv3.cxx
TOF/AliTOFv4.cxx
TOF/AliTOFv4T0.cxx

index d2a1ff3d6d3fcb3755824141128c2b4ec557e26f..e8d8154b2c3f55225c876922d71fd5832ad0bc5d 100644 (file)
@@ -344,18 +344,18 @@ void AliTOFPID::Exec(const Option_t *eventType, const Option_t *outputmode, cons
   Float_t katrack=0, kamag=0, kageom=0;
   Float_t prtrack=0, prmag=0, prgeom=0;
   Float_t pif=0, kaf=0, prf=0, pin=0, kan=0, prn=0;
-  Float_t px, py, pz, x, y, z, pdgcode, mass;
-  Int_t event, matc, imam;
+  Float_t px, py, pz, x, y, z, mass;
+  Int_t event, matc, imam, pdgcode;
   Int_t indexOfFile=0, numfile=0;
   //////// Loop over tracks (particles)///////////////////////
   
   for (Int_t i=0; i < nparticles; i++) {
     fNtuple->GetEvent(i);
-    event=fNtuple->GetLeaf("event")->GetValue();
-    pdgcode=fNtuple->GetLeaf("ipart")->GetValue();
+    event=(Int_t)(fNtuple->GetLeaf("event")->GetValue());
+    pdgcode=(Int_t)(fNtuple->GetLeaf("ipart")->GetValue());
     mass=fNtuple->GetLeaf("mext")->GetValue(0);
-    matc=fNtuple->GetLeaf("matc")->GetValue(0);
-    imam=fNtuple->GetLeaf("imam")->GetValue(0);
+    matc=(Int_t)(fNtuple->GetLeaf("matc")->GetValue(0));
+    imam=(Int_t)(fNtuple->GetLeaf("imam")->GetValue(0));
     px=fNtuple->GetLeaf("pxvtx")->GetValue(0);
     py=fNtuple->GetLeaf("pyvtx")->GetValue(0);
     pz=fNtuple->GetLeaf("pzvtx")->GetValue(0);
index 4d471bbdbcf943261504dd0e9faa84fb04602aa1..3a00c8669c28090ebed60526129408060c1faba3 100644 (file)
 //////////////////////////////////////////////////////////////////////////////
 
 
-#include "TTask.h"
-#include "TBenchmark.h"
-#include "TTree.h"
-#include "TSystem.h"
-#include "TFile.h"
-#include "TParticle.h"
-
 #include "AliConst.h"
 #include "AliRun.h"
 #include "AliTOFConstants.h"
 #include "AliDetector.h"
 #include "AliMC.h"
 
+#include "TTask.h"
+#include "TBenchmark.h"
+#include "TTree.h"
+#include "TSystem.h"
+#include "TFile.h"
+#include "TParticle.h"
 #include <TClonesArray.h>
 #include "../TGeant3/TGeant3.h"
-#include "TFile.h"
 #include <TF1.h>
 #include <TF2.h>
-#include "TTask.h"
-#include "TTree.h"
-#include "TSystem.h"
 #include "TROOT.h"
 #include "TFolder.h"
 #include "TNtuple.h"
@@ -1655,15 +1650,18 @@ void AliTOFReconstructioner::ReadTOFHits(Int_t ntracks, TTree* treehits, TClones
        Float_t x = tofHit->X(); tofpos[0]=x;
        Float_t y = tofHit->Y(); tofpos[1]=y;
        Float_t z = tofHit->Z(); tofpos[2]=z;
-       
+       /* var used for QA
        Float_t tofradius = TMath::Sqrt(x*x+y*y); // radius cilindrical coordinate of the TOF hit
+       */
        // momentum components (cosine) when striking the TOF
        Float_t pxtof = tofHit->GetPx();
        Float_t pytof = tofHit->GetPy();
        Float_t pztof = tofHit->GetPz();
        // scalar product indicating the direction of the particle when striking the TOF 
+       /* var used for QA
        // (>0 for outgoing particles)
        Float_t isGoingOut = (x*pxtof+y*pytof+z*pztof)/TMath::Sqrt(x*x+y*y+z*z);
+       */
        Float_t momtof = tofHit->GetMom();
        // now momentum components when striking the TOF
        pxtof *= momtof;
@@ -1954,7 +1952,7 @@ void AliTOFReconstructioner::AddNoiseFromOuter(Option_t *option, Int_t ***MapPix
        }
       }
 
-      istrip=(Int_t)(zNoise-zLen[iplate-1])/((zLen[iplate]-zLen[iplate-1])/zStrips[iplate-1]); //the strip number in the plate
+      istrip=(Int_t)((zNoise-zLen[iplate-1])/((zLen[iplate]-zLen[iplate-1])/zStrips[iplate-1])); //the strip number in the plate
       istrip++;
 
       ipadAlongX = (Int_t)(AliTOFConstants::fgkNpadX*gRandom->Rndm())+1;
@@ -2349,27 +2347,33 @@ void AliTOFReconstructioner::Matching(AliTOFTrack* trackArray, AliTOFRecHit* hit
     Float_t x=trackArray[itrack-1].GetRxTPC();
     Float_t y=trackArray[itrack-1].GetRyTPC();
     Float_t z=trackArray[itrack-1].GetRzTPC();
+    /* vars used for QA
     Float_t RxTPC=x;
     Float_t RyTPC=y;
     Float_t RzTPC=z;
+    */
     Float_t Wx=x;
     Float_t Wy=y;
     Float_t Wz=z;
     Float_t px=trackArray[itrack-1].GetPxTPC();
     Float_t py=trackArray[itrack-1].GetPyTPC();
     Float_t pz=trackArray[itrack-1].GetPzTPC();
+    /* vars used for QA
     Float_t pxTPC=px;
     Float_t pyTPC=py;
     Float_t pzTPC=pz;
-
+    */
     Float_t p = TMath::Sqrt(px*px+py*py+pz*pz);
+    /* var used for QA
     Float_t pTPC=p;
-
+    */
     Float_t rho = TMath::Sqrt(x*x+y*y);
     Float_t phi=0.;
     if(TMath::Abs(x)>0. || TMath::Abs(y)>0.) phi=TMath::ATan2(y,x);
     if(phi<0.) phi=phi+2.*TMath::Pi();
+    /* var used for QA
     Float_t phiTPC=phi*kRaddeg;
+    */
     if(fSigmavsp) {
       if(p==0) printf(" p=%f in g=0.022/p\n",p);
       g=0.022/p;
@@ -2382,7 +2386,9 @@ void AliTOFReconstructioner::Matching(AliTOFTrack* trackArray, AliTOFRecHit* hit
     }
     x=rho*TMath::Cos(phi);
     y=rho*TMath::Sin(phi);
+    /* var used for QA
     Float_t zTPC=z;
+    */
     if(fSigmavsp) {
       if(p==0) printf(" p=%f in g=0.0275/p\n",p);
       g=0.0275/p;
index f4b7b345610c2d5808da9b08e8e25809672b11b2..5d34990a4ec27a66034091f52d47a850b02c4225 100644 (file)
@@ -132,16 +132,16 @@ void AliTOFSDigit::GetLocation(Int_t *Loc) const
 }
 
 ////////////////////////////////////////////////////////////////////////
-void AliTOFSDigit::Update(Int_t tdc, Int_t adc, Int_t track)
+void AliTOFSDigit::Update(Float_t tdcbin, Int_t tdc, Int_t adc, Int_t track)
 {
   //
   // Add charge and track
   //
   
   Int_t sameTime = -1;
-  
+  Float_t tdcwindow=((Float_t)AliTOFConstants::fgkTimeDiff)/tdcbin;
   for (Int_t i = 0; i < fNDigits; i++) {
-    if (TMath::Abs(tdc-fTdc->At(i)) < AliTOFConstants::fgkTimeDiff) {
+    if (TMath::Abs(tdc-fTdc->At(i)) < tdcwindow) {
       sameTime = i;
       break;
     }
@@ -198,33 +198,24 @@ Int_t AliTOFSDigit::GetTotPad() const
   // starting from the digits data.
   //
   
-  AliTOF* tof;
-  
-  if(gAlice){
-    tof =(AliTOF*) gAlice->GetDetector("TOF");
-  }else{
-    printf("AliTOFSDigit::GetTotPad - No AliRun object present, exiting");
-    return 0;
-  }
-  
-  Int_t pad = fPadx+tof->GetNpadX()*(fPadz-1);
+  Int_t pad = fPadx+AliTOFConstants::fgkNpadX*(fPadz-1);
   Int_t before=0;
   
   switch(fPlate){ 
   case 1: before = 0;
     break;
-  case 2: before = tof->GetNStripC();
+  case 2: before = AliTOFConstants::fgkNStripC;
     break;
-  case 3: before = tof->GetNStripB() + tof->GetNStripC();
+  case 3: before = AliTOFConstants::fgkNStripB + AliTOFConstants::fgkNStripC;
     break;
-  case 4: before = tof->GetNStripA() + tof->GetNStripB() + tof->GetNStripC();
+  case 4: before = AliTOFConstants::fgkNStripA + AliTOFConstants::fgkNStripB + AliTOFConstants::fgkNStripC;
     break;
-  case 5: before = tof->GetNStripA() + 2*tof->GetNStripB() + tof->GetNStripC();
+  case 5: before = AliTOFConstants::fgkNStripA + 2*AliTOFConstants::fgkNStripB + AliTOFConstants::fgkNStripC;
     break;
   }
   
   Int_t strip = fStrip+before;
-  Int_t padTot = tof->GetPadXStr()*(strip-1)+pad;
+  Int_t padTot = AliTOFConstants::fgkPadXStrip*(strip-1)+pad;
   return padTot;
 }
 
index d92bfdc990f91ab5da079cb742f269beeed4bdbc..ed81213440ac2df8919054c764979516e28574a7 100644 (file)
@@ -38,7 +38,7 @@ class AliTOFSDigit : public TObject {
   void            GetLocation(Int_t* Loc) const;
   Int_t           GetTotPad() const;
 
-  void Update(Int_t tdc, Int_t adc, Int_t track);
+  void Update(Float_t tdcbin, Int_t tdc, Int_t adc, Int_t track);
 
 // getters for AliTOFSDigit object 
   Int_t   GetNDigits() const    {return fNDigits;}
index 66d1198c2bee036d5109372073d47a61fe563788..b33fc4f4cdf5daec50965d4515b412a5be4ee76b 100644 (file)
@@ -271,9 +271,9 @@ void AliTOFSDigitizer::Exec(Option_t *verboseOption, Option_t *allEvents) {
          
          Bool_t isCloneOfThePrevious=dummy && ((vol[3]==previousPadX) && (vol[4]==previousPadZ));
          
-         // much stronger check to be inserted here
+         Bool_t isNeighOfThePrevious=dummy && ((((vol[3]==previousPadX-1) || (vol[3]==previousPadX+1)) && (vol[4]==previousPadZ)) || ((vol[3]==previousPadX) && ((vol[4]==previousPadZ+1) || (vol[4]==previousPadZ-1))));
          
-         if(!isCloneOfThePrevious){
+         if(!isCloneOfThePrevious && !isNeighOfThePrevious){
            // update "previous" values
            // in fact, we are yet in the future, so the present is past
            previousTrack=tracknum;
@@ -311,7 +311,7 @@ void AliTOFSDigitizer::Exec(Option_t *verboseOption, Option_t *allEvents) {
                  
                  if(timediff>=0.2) nlargeTofDiff++;
                  
-                 digit[0] = (Int_t) ((tofAfterSimul[indexOfPad]*1.e+03)/fTdcBin); // TDC bin number (each bin -> 25. ps)
+                 digit[0] = (Int_t) ((tofAfterSimul[indexOfPad]*1.e+03)/fTdcBin); // TDC bin number (each bin -> 50. ps)
                  
                  Float_t landauFactor = gRandom->Landau(fAdcMean, fAdcRms); 
                  digit[1] = (Int_t) (qInduced[indexOfPad] * landauFactor); // ADC bins (each bin -> 0.25 (or 0.03) pC)
@@ -328,7 +328,7 @@ void AliTOFSDigitizer::Exec(Option_t *verboseOption, Option_t *allEvents) {
                    AliTOFSDigit *sdig = static_cast<AliTOFSDigit*>(hitMap->GetHit(vol));
                    Int_t tdctime = (Int_t) digit[0];
                    Int_t adccharge = (Int_t) digit[1];
-                   sdig->Update(tdctime,adccharge,tracknum);
+                   sdig->Update(fTdcBin,tdctime,adccharge,tracknum);
                    ntotalupdatesinEv++;
                    ntotalupdates++;
                  } else {
diff --git a/TOF/AliTOFanalyzeMatching.C b/TOF/AliTOFanalyzeMatching.C
new file mode 100644 (file)
index 0000000..5f2268e
--- /dev/null
@@ -0,0 +1,164 @@
+void AliTOFanalyzeMatching(const char* datafile)
+{
+
+  //
+  // Matching efficiency and contamination
+  // for different particle species
+  // (pions, kaons and protons).
+  // All histos are saved into a separate file
+  // datafile is assumed to be the file name containing
+  // the results of the matching in TNtuple format.
+  //
+  // Author: F. Pierella | pierella@bo.infn.it
+  //
+  // Use case:
+  // start root
+  // root[0] .L AliTOFanalyzeMatching.C
+  // root[1] AliTOFanalyzeMatching("matchingNtuple.root")
+
+  // output (histos!) filename
+  char outFileName[100];
+  strcpy(outFileName,"histo");
+  strcat(outFileName,datafile);
+  
+  // dummy histos (for normalization)
+  TH1F* hpitot= new TH1F("hpitot","",12,0.,3.);
+  TH1F* hkatot= new TH1F("hkatot","",12,0.,3.);
+  TH1F* hprtot= new TH1F("hprtot","",12,0.,3.);
+  
+  TH1F* hpimatched= new TH1F("hpimatched","",12,0.,3.);
+  TH1F* hkamatched= new TH1F("hkamatched","",12,0.,3.);
+  TH1F* hprmatched= new TH1F("hprmatched","",12,0.,3.);
+  
+  
+  // matching efficiency histos
+  TH1F* hpimatcheff= new TH1F("hpimatcheff","Matching efficiency for pions",12,0.,3.);
+  TH1F* hkamatcheff= new TH1F("hkamatcheff","Matching efficiency for kaons",12,0.,3.);
+  TH1F* hprmatcheff= new TH1F("hprmatcheff","Matching efficiency for protons",12,0.,3.);
+
+  // matching contamination histos
+  TH1F* hpimatchcon= new TH1F("hpimatchcon","Matching contamination for pions",12,0.,3.);
+  TH1F* hkamatchcon= new TH1F("hkamatchcon","Matching contamination for kaons",12,0.,3.);
+  TH1F* hprmatchcon= new TH1F("hprmatchcon","Matching contamination for protons",12,0.,3.);
+  
+  
+  TFile *file = TFile::Open(datafile,"old");
+  TNtuple* fNtuple= (TNtuple*)file->Get("Ntuple"); // get ntuple from file
+  Int_t nvar = fNtuple->GetNvar(); cout <<"N of var.="<< nvar << endl;
+  fNtuple->GetEvent(0);
+  
+  file->cd();
+  Int_t nparticles = (Int_t)fNtuple->GetEntries();
+  
+  for (Int_t i=0; i < nparticles; i++) {
+    fNtuple->GetEvent(i);
+    Int_t event=fNtuple->GetLeaf("event")->GetValue();   
+    Int_t pdgcode=fNtuple->GetLeaf("ipart")->GetValue(); 
+    Int_t matc=fNtuple->GetLeaf("matc")->GetValue(0);
+    Float_t px=fNtuple->GetLeaf("pxvtx")->GetValue(0);
+    Float_t py=fNtuple->GetLeaf("pyvtx")->GetValue(0);
+    Float_t pz=fNtuple->GetLeaf("pzvtx")->GetValue(0);
+    
+    Float_t pvtx=TMath::Sqrt(px*px+py*py+pz*pz);  
+    Float_t ptvtx=TMath::Sqrt(px*px+py*py);
+    Int_t abspdgcode=TMath::Abs(pdgcode);
+    
+
+    // N (1+2+3+4+(-4)) cases
+    if(matc>=1 || matc==-4){
+      switch(abspdgcode){
+      case 211:
+       hpitot->Fill(pvtx);
+       break;
+      case 321:
+       hkatot->Fill(pvtx);
+       break;
+      case 2212:
+       hprtot->Fill(pvtx);
+       break;
+      }
+    }
+
+
+    // N_matched (3+4) cases
+    if(matc==3 || matc==4){
+      switch(abspdgcode){
+      case 211:
+       hpimatched->Fill(pvtx);
+       break;
+      case 321:
+       hkamatched->Fill(pvtx);
+       break;
+      case 2212:
+       hprmatched->Fill(pvtx);
+       break;
+      }
+    }
+
+
+    // N_t (3) case
+    if(matc==3){
+      switch(abspdgcode){
+      case 211:
+       hpimatcheff->Fill(pvtx);
+       break;
+      case 321:
+       hkamatcheff->Fill(pvtx);
+       break;
+      case 2212:
+       hprmatcheff->Fill(pvtx);
+       break;
+      }
+    }
+
+    // N_w (4) case
+    if(matc==4){
+      switch(abspdgcode){
+      case 211:
+       hpimatchcon->Fill(pvtx);
+       break;
+      case 321:
+       hkamatchcon->Fill(pvtx);
+       break;
+      case 2212:
+       hprmatchcon->Fill(pvtx);
+       break;
+      }
+    }
+
+  }
+
+  // histo normalization
+  // efficiency
+  hpimatcheff->Divide(hpitot);
+  hkamatcheff->Divide(hkatot);
+  hprmatcheff->Divide(hprtot);
+
+  // contamination
+  hpimatchcon->Divide(hpimatched);
+  hkamatchcon->Divide(hkamatched);
+  hprmatchcon->Divide(hprmatched);
+
+
+  TFile *houtfile = new TFile(outFileName,"recreate");
+  houtfile->cd();
+
+  hpitot->Write();
+  hkatot->Write();
+  hprtot->Write();
+    
+  hpimatched->Write();
+  hkamatched->Write();
+  hprmatched->Write();
+    
+  hpimatcheff->Write();
+  hkamatcheff->Write();
+  hprmatcheff->Write();
+
+  hpimatchcon->Write();
+  hkamatchcon->Write();
+  hprmatchcon->Write();
+  houtfile->Close();   
+
+  cout << "File " << outFileName << " with histos has been created" << endl;
+}
index 194d21f25f5430c4931a633a0b3d4f308a0d765a..05c3f11441f05720f3562c89752fea9354c68717 100644 (file)
@@ -15,6 +15,9 @@
 
 /*
 $Log$
+Revision 1.25  2001/11/22 11:22:51  hristov
+Updated version of TOF digitization, N^2 problem solved (J.Chudoba)
+
 Revision 1.23  2001/09/27 10:39:20  vicinanz
 SDigitizer and Merger added
 
@@ -479,7 +482,7 @@ void AliTOFv0::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC,
   
   Float_t t = zFLTC+zFLTB+zFLTA*0.5+ 2*db;//Half Width of Barrel
 
-  Float_t gap  = fGapA; //cm  distance between the strip axis
+  Float_t gap  = fGapA+0.5; //cm  updated distance between the strip axis
   Float_t zpos = 0;
   Float_t ang  = 0;
   Int_t i=1,j=1;
@@ -577,8 +580,10 @@ void AliTOFv0::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC,
      ang *= kRaddeg;
      AliMatrix (idrotm[nrot], 90., 0., 90.-ang,90.,ang, 270.);
      ang /= kRaddeg;
-     ycoor = -hTof*0.5+ kspace ; //2 cm over front plate
-     ycoor += (1-(upDown+1)/2)*gap;
+     Float_t deltaSpaceinB=-0.5; // [cm] to avoid overlaps with the end of freon frame
+     Float_t deltaGapinB=0.5;    // [cm] to avoid overlaps in between initial strips
+     ycoor = -hTof*0.5+ kspace+deltaSpaceinB ; //2 cm over front plate
+     ycoor += (1-(upDown+1)/2)*(gap+deltaGapinB);
      zcoor = zpos+(zFLTA*0.5+zFLTB*0.5+db); // Moves to the system of the modulus FLTB
      gMC->Gspos("FSTR",i, "FLTB", 0., ycoor, zcoor,idrotm[nrot], "ONLY");
 
@@ -592,6 +597,9 @@ void AliTOFv0::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC,
 
   ycoor = -hTof*0.5+ kspace ; //2 cm over front plate
   zpos = zpos - zSenStrip/TMath::Cos(ang);
+  // this avoid overlaps in between outer strips in plate B
+  Float_t deltaMovingUp=0.8;    // [cm]
+  Float_t deltaMovingDown=-0.5; // [cm]
 
   do {
      ang = atan(zpos/radius);
@@ -599,7 +607,8 @@ void AliTOFv0::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC,
      AliMatrix (idrotm[nrot], 90., 0., 90.-ang,90.,ang, 270.);
      ang /= kRaddeg;
      zcoor = zpos+(zFLTB/2+zFLTA/2+db);
-     gMC->Gspos("FSTR",i, "FLTB", 0., ycoor, zcoor,idrotm[nrot], "ONLY");
+     gMC->Gspos("FSTR",i, "FLTB", 0., ycoor+deltaMovingDown+deltaMovingUp, zcoor,idrotm[nrot], "ONLY");
+     deltaMovingUp+=0.8; // update delta moving toward the end of the plate
      zpos = zpos - zSenStrip/TMath::Cos(ang);
      printf("%f,  St. %2i, Pl.4 ",ang*kRaddeg,i); 
      printf("y = %f,  z = %f, zpos = %f \n",ycoor,zcoor,zpos);
@@ -616,7 +625,8 @@ void AliTOFv0::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC,
 
   nrot = 0;
   i=0;
-  ycoor= -hTof*0.5+kspace+gap;
+  Float_t deltaGap=-2.5; // [cm] update distance from strip center and plate
+  ycoor= -hTof*0.5+kspace+gap+deltaGap;
 
   do {
      i++;
index cd4e0a76c6e43c9a52a76ea224d9c6651a2b47ac..c01a547a4f6b9894801b79c867a41205c6ac87fd 100644 (file)
@@ -15,6 +15,9 @@
 
 /*
 $Log$
+Revision 1.27  2001/11/22 11:22:51  hristov
+Updated version of TOF digitization, N^2 problem solved (J.Chudoba)
+
 
 Revision 1.26  2001/11/13 14:36:40  vicinanz
 Updated check for ppad[1] range
@@ -496,7 +499,7 @@ void AliTOFv1::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC,
   
   Float_t t = zFLTC+zFLTB+zFLTA*0.5+ 2*db;//Half Width of Barrel
 
-  Float_t gap  = fGapA; //cm  distance between the strip axis
+  Float_t gap  = fGapA+0.5; //cm  updated distance between the strip axis
   Float_t zpos = 0;
   Float_t ang  = 0;
   Int_t i=1,j=1;
@@ -595,8 +598,10 @@ void AliTOFv1::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC,
      ang *= kRaddeg;
      AliMatrix (idrotm[nrot], 90., 0., 90.-ang,90.,ang, 270.);
      ang /= kRaddeg;
-     ycoor = -hTof*0.5+ kspace ; //2 cm over front plate
-     ycoor += (1-(upDown+1)/2)*gap;
+     Float_t deltaSpaceinB=-0.5; // [cm] to avoid overlaps with the end of freon frame
+     Float_t deltaGapinB=0.5;    // [cm] to avoid overlaps in between initial strips
+     ycoor = -hTof*0.5+ kspace+deltaSpaceinB ; //2 cm over front plate
+     ycoor += (1-(upDown+1)/2)*(gap+deltaGapinB);
      zcoor = zpos+(zFLTA*0.5+zFLTB*0.5+db); // Moves to the system of the modulus FLTB
      gMC->Gspos("FSTR",i, "FLTB", 0., ycoor, zcoor,idrotm[nrot], "ONLY");
 
@@ -610,6 +615,9 @@ void AliTOFv1::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC,
 
   ycoor = -hTof*0.5+ kspace ; //2 cm over front plate
   zpos = zpos - zSenStrip/TMath::Cos(ang);
+  // this avoid overlaps in between outer strips in plate B
+  Float_t deltaMovingUp=0.8;    // [cm]
+  Float_t deltaMovingDown=-0.5; // [cm]
 
   do {
      ang = atan(zpos/radius);
@@ -617,7 +625,8 @@ void AliTOFv1::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC,
      AliMatrix (idrotm[nrot], 90., 0., 90.-ang,90.,ang, 270.);
      ang /= kRaddeg;
      zcoor = zpos+(zFLTB/2+zFLTA/2+db);
-     gMC->Gspos("FSTR",i, "FLTB", 0., ycoor, zcoor,idrotm[nrot], "ONLY");
+     gMC->Gspos("FSTR",i, "FLTB", 0., ycoor+deltaMovingDown+deltaMovingUp, zcoor,idrotm[nrot], "ONLY");
+     deltaMovingUp+=0.8; // update delta moving toward the end of the plate
      zpos = zpos - zSenStrip/TMath::Cos(ang);
      printf("%f,  St. %2i, Pl.4 ",ang*kRaddeg,i); 
      printf("y = %f,  z = %f, zpos = %f \n",ycoor,zcoor,zpos);
@@ -635,7 +644,8 @@ void AliTOFv1::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC,
 
   nrot = 0;
   i=0;
-  ycoor= -hTof*0.5+kspace+gap;
+  Float_t deltaGap=-2.5; // [cm] update distance from strip center and plate
+  ycoor= -hTof*0.5+kspace+gap+deltaGap;
 
   do {
      i++;
index dea8bb3ac47f744f69823ad82fd6be747cf8876a..817e21ca22da538a4eb9e6905cf7cacce45eb243 100644 (file)
@@ -15,6 +15,9 @@
 
 /*
 $Log$
+Revision 1.25  2001/11/22 11:22:51  hristov
+Updated version of TOF digitization, N^2 problem solved (J.Chudoba)
+
 Revision 1.23  2001/09/27 10:39:20  vicinanz
 SDigitizer and Merger added
 
@@ -488,7 +491,7 @@ void AliTOFv2::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC,
   
   Float_t t = zFLTC+zFLTB+zFLTA*0.5+ 2*db;//Half Width of Barrel
 
-  Float_t gap  = fGapA; //cm  distance between the strip axis
+  Float_t gap  = fGapA+0.5; //cm  updated distance between the strip axis
   Float_t zpos = 0;
   Float_t ang  = 0;
   Int_t i=1,j=1;
@@ -595,8 +598,10 @@ void AliTOFv2::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC,
      ang *= kRaddeg;
      AliMatrix (idrotm[nrot], 90., 0., 90.-ang,90.,ang, 270.);
      ang /= kRaddeg;
-     ycoor = -hTof*0.5+ kspace ; //2 cm over front plate
-     ycoor += (1-(upDown+1)/2)*gap;
+     Float_t deltaSpaceinB=-0.5; // [cm] to avoid overlaps with the end of freon frame
+     Float_t deltaGapinB=0.5;    // [cm] to avoid overlaps in between initial strips
+     ycoor = -hTof*0.5+ kspace+deltaSpaceinB ; //2 cm over front plate
+     ycoor += (1-(upDown+1)/2)*(gap+deltaGapinB);
      zcoor = zpos+(zFLTA*0.5+zFLTB*0.5+db); // Moves to the system of the modulus FLTB
      gMC->Gspos("FSTR",i, "FLTB", 0., ycoor, zcoor,idrotm[nrot], "ONLY");
 
@@ -612,6 +617,9 @@ void AliTOFv2::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC,
 
   ycoor = -hTof*0.5+ kspace ; //2 cm over front plate
   zpos = zpos - zSenStrip/TMath::Cos(ang);
+  // this avoid overlaps in between outer strips in plate B
+  Float_t deltaMovingUp=0.8;    // [cm]
+  Float_t deltaMovingDown=-0.5; // [cm]
 
   do {
      ang = atan(zpos/radius);
@@ -619,7 +627,8 @@ void AliTOFv2::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC,
      AliMatrix (idrotm[nrot], 90., 0., 90.-ang,90.,ang, 270.);
      ang /= kRaddeg;
      zcoor = zpos+(zFLTB/2+zFLTA/2+db);
-     gMC->Gspos("FSTR",i, "FLTB", 0., ycoor, zcoor,idrotm[nrot], "ONLY");
+     gMC->Gspos("FSTR",i, "FLTB", 0., ycoor+deltaMovingDown+deltaMovingUp, zcoor,idrotm[nrot], "ONLY");
+     deltaMovingUp+=0.8; // update delta moving toward the end of the plate
      zpos = zpos - zSenStrip/TMath::Cos(ang);
      if(fDebug) {
        printf("%s: %f,  St. %2i, Pl.4 ",ClassName(),ang*kRaddeg,i);
@@ -639,7 +648,8 @@ void AliTOFv2::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC,
 
   nrot = 0;
   i=0;
-  ycoor= -hTof*0.5+kspace+gap;
+  Float_t deltaGap=-2.5; // [cm] update distance from strip center and plate
+  ycoor= -hTof*0.5+kspace+gap+deltaGap;
 
   do {
      i++;
index 460d926ae1b4b203fd27c6f67155dafbe37f91b0..2509ff288b0ecc4954336eba1ba41c1e1369c8e4 100644 (file)
@@ -443,9 +443,8 @@ void AliTOFv2FHoles::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC,
   
   Float_t t = zFLTC+zFLTB+zFLTA*0.5+ 2*db;//Half Width of Barrel
 
-  //  Float_t gap  = fGapA; //cm  distance between the strip axis
-  // to avoid overlaps
-  Float_t gap  = fGapA+1.; //cm  distance between the strip axis
+  Float_t gap  = fGapA+1.; //cm  updated distance between the strip axis
+  // 1 cm is a special value exclusively for AliTOFv2FHoles geometry
   Float_t zpos = 0;
   Float_t ang  = 0;
   Int_t i=1,j=1;
@@ -572,16 +571,18 @@ void AliTOFv2FHoles::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC,
 
   ycoor = -hTof*0.5+ kspace ; //2 cm over front plate
   zpos = zpos - zSenStrip/TMath::Cos(ang);
-
+  // this avoid overlaps in between outer strips in plate B
+  Float_t deltaMovingUp=0.8;    // [cm]
+  //Float_t deltaMovingDown=-0.0; // [cm] special value for AliTOFv2FHoles
+  
   do {
-    ycoor+=0.6; // fp to avoid overlaps
      ang = atan(zpos/radius);
      ang *= kRaddeg;
      AliMatrix (idrotm[nrot], 90., 0., 90.-ang,90.,ang, 270.);
      ang /= kRaddeg;
-     //     zcoor = zpos+(zFLTB/2+zFLTA/2+db)+1.; // fp to avoid overlaps
      zcoor = zpos+(zFLTB/2+zFLTA/2+db);
-     gMC->Gspos("FSTR",i, "FLTB", 0., ycoor, zcoor,idrotm[nrot], "ONLY");
+     gMC->Gspos("FSTR",i, "FLTB", 0., ycoor+deltaMovingUp, zcoor,idrotm[nrot], "ONLY");
+     deltaMovingUp+=0.8; // update delta moving toward the end of the plate
      zpos = zpos - zSenStrip/TMath::Cos(ang);
      if(fDebug) {
        printf("%s: %f,  St. %2i, Pl.4 ",ClassName(),ang*kRaddeg,i);
@@ -590,7 +591,7 @@ void AliTOFv2FHoles::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC,
      i++;
 
   }  while (zpos-stripWidth*0.5/TMath::Cos(ang)>-t+zFLTC+db);
-
+  
   // Plate  C
   
   zpos = zpos + zSenStrip/TMath::Cos(ang);
@@ -601,7 +602,8 @@ void AliTOFv2FHoles::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC,
 
   nrot = 0;
   i=0;
-  ycoor= -hTof*0.5+kspace+gap;
+  Float_t deltaGap=-2.5; // [cm] update distance from strip center and plate
+  ycoor= -hTof*0.5+kspace+gap+deltaGap;
 
   do {
      i++;
index 7a7b87a778f8c8490d92107de1040b7691bbe454..1589ca74125e99a4f4f1cbb1fd3095f26175d5b3 100644 (file)
@@ -15,6 +15,9 @@
 
 /*
 $Log$
+Revision 1.25  2001/11/22 11:22:51  hristov
+Updated version of TOF digitization, N^2 problem solved (J.Chudoba)
+
 Revision 1.23  2001/09/27 10:39:20  vicinanz
 SDigitizer and Merger added
 
@@ -487,7 +490,7 @@ void AliTOFv3::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC,
   
   Float_t t = zFLTC+zFLTB+zFLTA*0.5+ 2*db;//Half Width of Barrel
 
-  Float_t gap  = fGapA; //cm  distance between the strip axis
+  Float_t gap  = fGapA+0.5; //cm  updated distance between the strip axis
   Float_t zpos = 0;
   Float_t ang  = 0;
   Int_t i=1,j=1;
@@ -586,8 +589,10 @@ void AliTOFv3::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC,
      ang *= kRaddeg;
      AliMatrix (idrotm[nrot], 90., 0., 90.-ang,90.,ang, 270.);
      ang /= kRaddeg;
-     ycoor = -hTof*0.5+ kspace ; //2 cm over front plate
-     ycoor += (1-(upDown+1)/2)*gap;
+     Float_t deltaSpaceinB=-0.5; // [cm] to avoid overlaps with the end of freon frame
+     Float_t deltaGapinB=0.5;    // [cm] to avoid overlaps in between initial strips
+     ycoor = -hTof*0.5+ kspace+deltaSpaceinB ; //2 cm over front plate
+     ycoor += (1-(upDown+1)/2)*(gap+deltaGapinB);
      zcoor = zpos+(zFLTA*0.5+zFLTB*0.5+db); // Moves to the system of the modulus FLTB
      gMC->Gspos("FSTR",i, "FLTB", 0., ycoor, zcoor,idrotm[nrot], "ONLY");
      if(fDebug) { 
@@ -601,6 +606,9 @@ void AliTOFv3::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC,
 
   ycoor = -hTof*0.5+ kspace ; //2 cm over front plate
   zpos = zpos - zSenStrip/TMath::Cos(ang);
+  // this avoid overlaps in between outer strips in plate B
+  Float_t deltaMovingUp=0.8;    // [cm]
+  Float_t deltaMovingDown=-0.5; // [cm]
 
   do {
      ang = atan(zpos/radius);
@@ -608,7 +616,8 @@ void AliTOFv3::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC,
      AliMatrix (idrotm[nrot], 90., 0., 90.-ang,90.,ang, 270.);
      ang /= kRaddeg;
      zcoor = zpos+(zFLTB/2+zFLTA/2+db);
-     gMC->Gspos("FSTR",i, "FLTB", 0., ycoor, zcoor,idrotm[nrot], "ONLY");
+     gMC->Gspos("FSTR",i, "FLTB", 0., ycoor+deltaMovingDown+deltaMovingUp, zcoor,idrotm[nrot], "ONLY");
+     deltaMovingUp+=0.8; // update delta moving toward the end of the plate
      zpos = zpos - zSenStrip/TMath::Cos(ang);
      if(fDebug) { 
        printf("%s: %f,  St. %2i, Pl.4 ",ClassName(),ang*kRaddeg,i);
@@ -628,7 +637,8 @@ void AliTOFv3::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC,
 
   nrot = 0;
   i=0;
-  ycoor= -hTof*0.5+kspace+gap;
+  Float_t deltaGap=-2.5; // [cm] update distance from strip center and plate
+  ycoor= -hTof*0.5+kspace+gap+deltaGap;
 
   do {
      i++;
index cfe5ff735dcd4a68e5bab96aa4b37aa09d19164c..48ea4bf86bb96cb24de7cf8cb7b5ef279d6f1ff7 100644 (file)
@@ -15,6 +15,9 @@
 
 /*
 $Log$
+Revision 1.15  2001/11/22 11:22:51  hristov
+Updated version of TOF digitization, N^2 problem solved (J.Chudoba)
+
 Revision 1.13  2001/09/27 10:39:21  vicinanz
 SDigitizer and Merger added
 
@@ -485,7 +488,7 @@ void AliTOFv4::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC,
   
   Float_t t = zFLTC+zFLTB+zFLTA*0.5+ 2*db;//Half Width of Barrel
 
-  Float_t gap  = fGapA; //cm  distance between the strip axis
+  Float_t gap  = fGapA+0.5; //cm  updated distance between the strip axis
   Float_t zpos = 0;
   Float_t ang  = 0;
   Int_t i=1,j=1;
@@ -584,8 +587,10 @@ void AliTOFv4::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC,
      ang *= kRaddeg;
      AliMatrix (idrotm[nrot], 90., 0., 90.-ang,90.,ang, 270.);
      ang /= kRaddeg;
-     ycoor = -hTof*0.5+ kspace ; //2 cm over front plate
-     ycoor += (1-(upDown+1)/2)*gap;
+     Float_t deltaSpaceinB=-0.5; // [cm] to avoid overlaps with the end of freon frame
+     Float_t deltaGapinB=0.5;    // [cm] to avoid overlaps in between initial strips
+     ycoor = -hTof*0.5+ kspace+deltaSpaceinB ; //2 cm over front plate
+     ycoor += (1-(upDown+1)/2)*(gap+deltaGapinB);
      zcoor = zpos+(zFLTA*0.5+zFLTB*0.5+db); // Moves to the system of the modulus FLTB
      gMC->Gspos("FSTR",i, "FLTB", 0., ycoor, zcoor,idrotm[nrot], "ONLY");
      if(fDebug) {
@@ -599,6 +604,9 @@ void AliTOFv4::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC,
 
   ycoor = -hTof*0.5+ kspace ; //2 cm over front plate
   zpos = zpos - zSenStrip/TMath::Cos(ang);
+  // this avoid overlaps in between outer strips in plate B
+  Float_t deltaMovingUp=0.8;    // [cm]
+  Float_t deltaMovingDown=-0.5; // [cm]
 
   do {
      ang = atan(zpos/radius);
@@ -606,7 +614,8 @@ void AliTOFv4::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC,
      AliMatrix (idrotm[nrot], 90., 0., 90.-ang,90.,ang, 270.);
      ang /= kRaddeg;
      zcoor = zpos+(zFLTB/2+zFLTA/2+db);
-     gMC->Gspos("FSTR",i, "FLTB", 0., ycoor, zcoor,idrotm[nrot], "ONLY");
+     gMC->Gspos("FSTR",i, "FLTB", 0., ycoor+deltaMovingDown+deltaMovingUp, zcoor,idrotm[nrot], "ONLY");
+     deltaMovingUp+=0.8; // update delta moving toward the end of the plate
      zpos = zpos - zSenStrip/TMath::Cos(ang);
      if(fDebug) {
        printf("%s: %f,  St. %2i, Pl.4 ",ClassName(),ang*kRaddeg,i);
@@ -626,7 +635,8 @@ void AliTOFv4::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC,
 
   nrot = 0;
   i=0;
-  ycoor= -hTof*0.5+kspace+gap;
+  Float_t deltaGap=-2.5; // [cm] update distance from strip center and plate
+  ycoor= -hTof*0.5+kspace+gap+deltaGap;
 
   do {
      i++;
index 5235a2221d035c446ad195f855e7dbdbd5bd44c5..248f3d441533996acef7741f0e859f49cd6706e5 100644 (file)
@@ -428,7 +428,7 @@ void AliTOFv4T0::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC,
   
   Float_t t = zFLTC+zFLTB+zFLTA*0.5+ 2*db;//Half Width of Barrel
 
-  Float_t gap  = fGapA; //cm  distance between the strip axis
+  Float_t gap  = fGapA+0.5; //cm  updated distance between the strip axis
   Float_t zpos = 0;
   Float_t ang  = 0;
   Int_t i=1,j=1;
@@ -527,8 +527,10 @@ void AliTOFv4T0::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC,
      ang *= kRaddeg;
      AliMatrix (idrotm[nrot], 90., 0., 90.-ang,90.,ang, 270.);
      ang /= kRaddeg;
-     ycoor = -hTof*0.5+ kspace ; //2 cm over front plate
-     ycoor += (1-(upDown+1)/2)*gap;
+     Float_t deltaSpaceinB=-0.5; // [cm] to avoid overlaps with the end of freon frame
+     Float_t deltaGapinB=0.5;    // [cm] to avoid overlaps in between initial strips
+     ycoor = -hTof*0.5+ kspace+deltaSpaceinB ; //2 cm over front plate
+     ycoor += (1-(upDown+1)/2)*(gap+deltaGapinB);
      zcoor = zpos+(zFLTA*0.5+zFLTB*0.5+db); // Moves to the system of the modulus FLTB
      gMC->Gspos("FSTR",i, "FLTB", 0., ycoor, zcoor,idrotm[nrot], "ONLY");
      if(fDebug) {
@@ -542,6 +544,9 @@ void AliTOFv4T0::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC,
 
   ycoor = -hTof*0.5+ kspace ; //2 cm over front plate
   zpos = zpos - zSenStrip/TMath::Cos(ang);
+  // this avoid overlaps in between outer strips in plate B
+  Float_t deltaMovingUp=0.8;    // [cm]
+  Float_t deltaMovingDown=-0.5; // [cm]
 
   do {
      ang = atan(zpos/radius);
@@ -549,7 +554,8 @@ void AliTOFv4T0::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC,
      AliMatrix (idrotm[nrot], 90., 0., 90.-ang,90.,ang, 270.);
      ang /= kRaddeg;
      zcoor = zpos+(zFLTB/2+zFLTA/2+db);
-     gMC->Gspos("FSTR",i, "FLTB", 0., ycoor, zcoor,idrotm[nrot], "ONLY");
+     gMC->Gspos("FSTR",i, "FLTB", 0., ycoor+deltaMovingDown+deltaMovingUp, zcoor,idrotm[nrot], "ONLY");
+     deltaMovingUp+=0.8; // update delta moving toward the end of the plate
      zpos = zpos - zSenStrip/TMath::Cos(ang);
      if(fDebug) {
        printf("%s: %f,  St. %2i, Pl.4 ",ClassName(),ang*kRaddeg,i);
@@ -569,7 +575,8 @@ void AliTOFv4T0::TOFpc(Float_t xtof, Float_t ytof, Float_t zlenC,
 
   nrot = 0;
   i=0;
-  ycoor= -hTof*0.5+kspace+gap;
+  Float_t deltaGap=-2.5; // [cm] update distance from strip center and plate
+  ycoor= -hTof*0.5+kspace+gap+deltaGap;
 
   do {
      i++;