]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TOF/AliTOFSDigitizer.cxx
Energy calibration object takes into account the beam energy
[u/mrichter/AliRoot.git] / TOF / AliTOFSDigitizer.cxx
index aeaaffc7e9cf4b9d74476934bfb34266e34080a6..e1a02e1e80d5000fbb898b9d10a6547380dec9e4 100644 (file)
@@ -314,7 +314,7 @@ void AliTOFSDigitizer::InitParameters()
 }
 
 //__________________________________________________________________
-Double_t TimeWithTail(Double_t* x, Double_t* par)
+Double_t TimeWithTail(const Double_t * const x, const Double_t * const par)
 {
   // sigma - par[0], alpha - par[1], part - par[2]
   //  at x<part*sigma - gauss
@@ -362,14 +362,23 @@ void AliTOFSDigitizer::Exec(Option_t *verboseOption) {
   
   fTOFLoader->LoadHits("read");
   fTOFLoader->LoadSDigits("recreate");
+
+  Int_t vol[5]={-1,-1,-1,-1,-1}; // location for a digit
+  Int_t digit[2]={0,0};          // TOF digit variables
   
+  Int_t nselectedHitsinEv=0;
+  Int_t ntotalsdigitsinEv=0;
+  Int_t ntotalupdatesinEv=0;
+  Int_t nnoisesdigitsinEv=0;
+  Int_t nsignalsdigitsinEv=0;
+
   for (Int_t iEvent=fEvent1; iEvent<fEvent2; iEvent++) {
     //AliInfo(Form("------------------- %s -------------", GetName()));
     //AliInfo(Form("Sdigitizing event %i", iEvent));
 
     fRunLoader->GetEvent(iEvent);
 
-    TTree *hitTree = fTOFLoader->TreeH ();
+    TTree *hitTree = fTOFLoader->TreeH();
     if (!hitTree) return;
 
     if (fTOFLoader->TreeS () == 0) fTOFLoader->MakeTree ("S");
@@ -388,18 +397,18 @@ void AliTOFSDigitizer::Exec(Option_t *verboseOption) {
 
     Int_t version=tof->IsVersion();
 
-    Int_t nselectedHitsinEv=0;
-    Int_t ntotalsdigitsinEv=0;
-    Int_t ntotalupdatesinEv=0;
-    Int_t nnoisesdigitsinEv=0;
-    Int_t nsignalsdigitsinEv=0;
+    nselectedHitsinEv=0;
+    ntotalsdigitsinEv=0;
+    ntotalupdatesinEv=0;
+    nnoisesdigitsinEv=0;
+    nsignalsdigitsinEv=0;
 
     TParticle *particle;
     //AliTOFhit *tofHit;
     TClonesArray *tofHitArray = tof->Hits();
 
     // create hit map
-    //    AliTOFHitMap *hitMap = new AliTOFHitMap(tof->SDigits(), fTOFGeometry);
+    //AliTOFHitMap *hitMap = new AliTOFHitMap(tof->SDigits(), fTOFGeometry);
     AliTOFHitMap *hitMap = new AliTOFHitMap(tof->SDigits());
 
     TBranch * tofHitsBranch = hitTree->GetBranch("TOF");
@@ -412,7 +421,7 @@ void AliTOFSDigitizer::Exec(Option_t *verboseOption) {
 
       AliMC *mcApplication = (AliMC*)gAlice->GetMCApp();
 
-      particle = mcApplication->Particle(track);
+      particle = (TParticle*)mcApplication->Particle(track);
       Int_t nhits = tofHitArray->GetEntriesFast();
       // cleaning all hits of the same track in the same pad volume
       // it is a rare event, however it happens
@@ -425,9 +434,9 @@ void AliTOFSDigitizer::Exec(Option_t *verboseOption) {
       Int_t previousPadZ  =-1;
 
       for (Int_t hit = 0; hit < nhits; hit++) {
-       Int_t    vol[5];       // location for a digit
-       Int_t  digit[2];     // TOF digit variables
-       Int_t tracknum;
+       for (Int_t aa=0; aa<5;aa++) vol[aa]=-1;  // location for a digit
+       for (Int_t aa=0; aa<2;aa++) digit[aa]=0; // TOF digit variables
+       Int_t   tracknum;
        Float_t dxPad;
        Float_t dzPad;
        Float_t geantTime;
@@ -459,7 +468,13 @@ void AliTOFSDigitizer::Exec(Option_t *verboseOption) {
        }
        
        geantTime *= 1.e+09;  // conversion from [s] to [ns]
-       
+       // TOF matching window (~200ns) control
+       if (geantTime>=AliTOFGeometry::MatchingWindow()*1E-3) {
+         AliDebug(2,Form("Time measurement (%f) greater than the matching window (%f)",
+                         geantTime, AliTOFGeometry::MatchingWindow()*1E-3));
+         continue;
+       }
+
        // selection case for sdigitizing only hits in a given plate of a given sector
        if(thereIsNotASelection || (vol[0]==fSelectedSector && vol[1]==fSelectedPlate)){
          
@@ -497,10 +512,15 @@ void AliTOFSDigitizer::Exec(Option_t *verboseOption) {
              for(Int_t indexOfPad=0; indexOfPad<nActivatedPads; indexOfPad++) {
                if(isFired[indexOfPad]){ // the pad has fired
                  Float_t timediff=geantTime-tofAfterSimul[indexOfPad];
-                 
-                 if (tofAfterSimul[indexOfPad]>=AliTOFGeometry::MatchingWindow()*1E-3) continue;
 
-                 if(timediff>=0.2) nlargeTofDiff++;
+                 // TOF matching window (~200ns) control
+                 if (tofAfterSimul[indexOfPad]>=AliTOFGeometry::MatchingWindow()*1E-3) {
+                   AliDebug(2,Form("Time measurement (%f) greater than the matching window (%f)",
+                                   tofAfterSimul[indexOfPad], AliTOFGeometry::MatchingWindow()*1E-3));
+                   continue;
+                 }
+
+                 if(timediff>=0.2) nlargeTofDiff++; // greater than 200ps
                  
                  digit[0] = (Int_t) ((tofAfterSimul[indexOfPad]*1.e+03)/AliTOFGeometry::TdcBinWidth()); // TDC bin number (each bin -> 24.4 ps)
                  
@@ -552,15 +572,14 @@ void AliTOFSDigitizer::Exec(Option_t *verboseOption) {
     
     if (tof->SDigits()) tof->ResetSDigits();
     
-    if (strstr(verboseOption,"all")) {
-      AliInfo("----------------------------------------");
-      AliInfo("       <AliTOFSDigitizer>    ");
-      AliInfo(Form("After sdigitizing %d hits in event %d", nselectedHitsinEv, iEvent));
+    if (strstr(verboseOption,"all") || strstr(verboseOption,"partial")) {
+      AliDebug(2,"----------------------------------------");
+      AliDebug(2,Form("After sdigitizing %d hits in event %d", nselectedHitsinEv, iEvent));
       //" (" << nHitsFromPrim << " from primaries and " << nHitsFromSec << " from secondaries) TOF hits, " 
-      AliInfo(Form("%d digits have been created", ntotalsdigitsinEv));
-      AliInfo(Form("(%d due to signals and %d due to border effect)", nsignalsdigitsinEv, nnoisesdigitsinEv));
-      AliInfo(Form("%d total updates of the hit map have been performed in current event", ntotalupdatesinEv));
-      AliInfo("----------------------------------------");
+      AliDebug(1,Form("%d sdigits have been created", ntotalsdigitsinEv));
+      AliDebug(2,Form("(%d due to signals and %d due to border effect)", nsignalsdigitsinEv, nnoisesdigitsinEv));
+      AliDebug(2,Form("%d total updates of the hit map have been performed in current event", ntotalupdatesinEv));
+      AliDebug(2,"----------------------------------------");
     }
 
   } //event loop on events
@@ -577,19 +596,15 @@ void AliTOFSDigitizer::Exec(Option_t *verboseOption) {
   }
   
   nHitsFromSec=nselectedHits-nHitsFromPrim;
-  if(strstr(verboseOption,"all")){
-    AliInfo("----------------------------------------");
-    AliInfo("----------------------------------------");
-    AliInfo("-----------SDigitization Summary--------");
-    AliInfo("       <AliTOFSDigitizer>     ");
-    AliInfo(Form("After sdigitizing %d hits", nselectedHits));
-    AliInfo(Form("in %d events", fEvent2-fEvent1));
-//" (" << nHitsFromPrim << " from primaries and " << nHitsFromSec << " from secondaries) TOF hits, " 
-    AliInfo(Form("%d sdigits have been created", ntotalsdigits));
-    AliInfo(Form("(%d due to signals and " 
-                "%d due to border effect)", nsignalsdigits, nnoisesdigits));
-    AliInfo(Form("%d total updates of the hit map have been performed", ntotalupdates));
-    AliInfo(Form("in %d cases the time of flight difference is greater than 200 ps", nlargeTofDiff));
+  if (strstr(verboseOption,"all") || strstr(verboseOption,"partial")) {
+    AliDebug(2,"----------------------------------------");
+    AliDebug(2,Form("After sdigitizing %d hits in %d events ", nselectedHits, fEvent2-fEvent1));
+    //" (" << nHitsFromPrim << " from primaries and " << nHitsFromSec << " from secondaries) TOF hits, " 
+    AliDebug(2,Form("%d sdigits have been created", ntotalsdigits));
+    AliDebug(2,Form("(%d due to signals and %d due to border effect)", nsignalsdigits, nnoisesdigits));
+    AliDebug(2,Form("%d total updates of the hit map have been performed", ntotalupdates));
+    AliDebug(2,Form("in %d cases the time of flight difference is greater than 200 ps", nlargeTofDiff));
+    AliDebug(2,"----------------------------------------");
   }