]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Fix bug in energy deposition, and add some stuff for calibrations
authorcholm <cholm@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 6 Oct 2005 07:54:59 +0000 (07:54 +0000)
committercholm <cholm@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 6 Oct 2005 07:54:59 +0000 (07:54 +0000)
FMD/AliFMDBoolMap.h
FMD/AliFMDEdepMap.h
FMD/AliFMDMap.cxx
FMD/AliFMDMap.h
FMD/AliFMDSimulator.cxx
FMD/DrawFMD.C
FMD/Reconstruct.C
FMD/Simulate.C
FMD/scripts/DrawInner.C

index a86f6cc256b13349c35930417bd203951545fe5d..a81892b86b6e61389502c2de7ae7d7736dd3ea34 100644 (file)
@@ -20,9 +20,9 @@ class AliFMDBoolMap : public AliFMDMap
 public:
   AliFMDBoolMap(const AliFMDBoolMap& other);
   AliFMDBoolMap(size_t maxDet  = kMaxDetectors,
-                 size_t maxRing = kMaxRings,
-                 size_t maxSec  = kMaxSectors,
-                 size_t maxStr  = kMaxStrips);
+               size_t maxRing = kMaxRings,
+               size_t maxSec  = kMaxSectors,
+               size_t maxStr  = kMaxStrips);
   virtual ~AliFMDBoolMap() { delete [] fData; }
   AliFMDBoolMap& operator=(const AliFMDBoolMap& other);
   virtual void Reset(const Bool_t& v=Bool_t());
index 048694fba7be1e31de2701e431703cb8a1ccea8a..608b75f2cbac0fc35e0cd683e67d6f4118116323 100644 (file)
@@ -16,7 +16,7 @@
 //____________________________________________________________________
 class AliFMDEdepHitPair 
 {
- public:
+public:
   Float_t  fEdep;
   UShort_t fN;
   AliFMDEdepHitPair() : fEdep(0), fN(0) {}
index 39737c316776540df42889b03a5577a0a099bea8..9b9149b4741f7e9f08169947240d85fd5ef351bc 100644 (file)
@@ -46,7 +46,21 @@ AliFMDMap::AliFMDMap(size_t maxDet,
   //     maxStr       Maximum # of strips
 }
 
+//____________________________________________________________________
+Int_t 
+AliFMDMap::CheckIndex(size_t det, Char_t ring, size_t sec, size_t str) const
+{
+  // Check that the index supplied is OK.   Returns true index, or -1
+  // on error. 
+  size_t ringi = (ring == 'I' ||  ring == 'i' ? 0 : 1);
+  size_t idx = 
+    (det + fMaxDetectors * (ringi + fMaxRings * (sec + fMaxSectors * str)));
+  if (idx >= fMaxDetectors * fMaxRings * fMaxSectors * fMaxStrips) 
+    return -1;
+  return idx;
+}
 
+    
 //____________________________________________________________________
 size_t 
 AliFMDMap::CalcIndex(size_t det, Char_t ring, size_t sec, size_t str) const
@@ -61,19 +75,18 @@ AliFMDMap::CalcIndex(size_t det, Char_t ring, size_t sec, size_t str) const
   //
   // Returns appropriate index into storage 
   //
-  size_t ringi = (ring == 'I' ||  ring == 'i' ? 0 : 1);
-  size_t idx = 
-    (det + fMaxDetectors * (ringi + fMaxRings * (sec + fMaxSectors * str)));
-  if (idx >= fMaxDetectors * fMaxRings * fMaxSectors * fMaxStrips) {
+  Int_t idx = CheckIndex(det, ring, sec, str);
+  if (idx < 0) {
+    size_t ringi = (ring == 'I' ||  ring == 'i' ? 0 : 1);
     Fatal("CalcIndex", "Index (%d,'%c',%d,%d) out of bounds, "
-         "in particular the %s index", 
+         "in particular the %s index ", 
          det, ring, sec, str, 
          (det >= fMaxDetectors ? "Detector" : 
           (ringi >= fMaxRings ? "Ring" : 
            (sec >= fMaxSectors ? "Sector" : "Strip"))));
     return 0;
   }
-  return idx;
+  return size_t(idx);
 }
 
 
index 042c897d7b076b4d325b0b28e387843ead5aee9f..4777ff908c64128c8414ca76b34f5be63a4a55b9 100644 (file)
@@ -27,6 +27,7 @@ public:
            size_t maxSec = kMaxSectors, 
            size_t maxStr = kMaxStrips);
   virtual ~AliFMDMap() {}
+  Int_t CheckIndex(size_t det, Char_t ring, size_t sec, size_t str) const;
 protected:
   size_t CalcIndex(size_t det, Char_t ring, size_t sec, size_t str) const;
   size_t fMaxDetectors;             // Maximum # of detectors
index bdba7b8342654fd68a0cb55027ea9fd42a665744..9f17dad3baf678b52cfed44c1b2b5331e2cea2f7 100644 (file)
@@ -367,6 +367,7 @@ AliFMDSimulator::Exec(Option_t* /* option */)
   //   - ENDIF
   //     
   TVirtualMC* mc = TVirtualMC::GetMC();
+  static int nCall = 0;
   
   if (!mc->IsTrackAlive()) return;
   if (TMath::Abs(mc->TrackCharge()) <= 0) return;
@@ -374,11 +375,12 @@ AliFMDSimulator::Exec(Option_t* /* option */)
   Int_t copy;
   Int_t vol = mc->CurrentVolID(copy);
   if (vol != fInnerId && vol != fOuterId) {
-    AliDebug(15, Form("Not an FMD volume %d '%s' (%d or %d)", 
+    AliDebug(25, Form("Not an FMD volume %d '%s' (%d or %d)", 
                      vol, mc->CurrentVolName(), fInnerId, fOuterId));
     return;
   }
 
+  nCall++;
   // Check that the track is actually within the active area 
   Bool_t entering = mc->IsTrackEntering();
   Bool_t inside   = mc->IsTrackInside();
@@ -388,7 +390,10 @@ AliFMDSimulator::Exec(Option_t* /* option */)
   // Reset the energy deposition for this track, and update some of
   // our parameters.
   if (entering) {
-    AliDebug(15, "Entering active FMD volume");
+    AliDebug(15, Form("Track # %8d entering active FMD volume %s: "
+                     "Edep=%f (call # %d)", 
+                     gAlice->GetMCApp()->GetCurrentTrackNumber(),
+                     mc->CurrentVolPath(), 1000 * mc->Edep(), nCall));
     fCurrentDeltaE = 0;
 
     // Get production vertex and momentum of the track 
@@ -398,15 +403,19 @@ AliFMDSimulator::Exec(Option_t* /* option */)
   }
   
   // If the track is inside, then update the energy deposition
-  if (inside && fCurrentDeltaE >= 0) 
-    AliDebug(15, "Inside active FMD volume");
+  if (inside && fCurrentDeltaE >= 0) {
     fCurrentDeltaE += 1000 * mc->Edep();
-
+    AliDebug(15, Form("Track # %8d inside active FMD volume %s: Edep=%f, "
+                     "Accumulated Edep=%f (call # %d)", 
+                     gAlice->GetMCApp()->GetCurrentTrackNumber(),
+                     mc->CurrentVolPath(), 1000 * mc->Edep(), 
+                     fCurrentDeltaE, nCall));
+  }
+  
   // The track exits the volume, or it disappeared in the volume, or
   // the track is stopped because it no longer fulfills the cuts
   // defined, then we create a hit. 
   if (out && fCurrentDeltaE >= 0) {
-    AliDebug(15, Form("Leaving active FMD volume %s", mc->CurrentVolPath()));
 
     Int_t strip = copy - 1;
     Int_t sectordiv;
@@ -436,6 +445,11 @@ AliFMDSimulator::Exec(Option_t* /* option */)
     }
     sector--;
     fCurrentDeltaE += 1000 * mc->Edep();
+    AliDebug(15, Form("Track # %8d leaving active FMD volume %s: Edep=%f, "
+                     "Accumulated Edep=%f (call # %d nCall)", 
+                     gAlice->GetMCApp()->GetCurrentTrackNumber(),
+                     mc->CurrentVolPath(), 
+                     1000 * mc->Edep(), fCurrentDeltaE, nCall));
 
     AliDebug(20, Form("Processing hit in FMD%d%c[%2d,%3d]: %f", 
                      detector, ring, sector, strip, fCurrentDeltaE));
index 49808a71463b57b7b411a7b3c55c2606f16e5168..3e7d2a4ab3c30c98ab84a530534198ae5eb4f77e 100644 (file)
@@ -1,9 +1,15 @@
 void DrawFMD()
 {
+  gSystem->Load("/usr/lib/libshift");
+  gSystem->Load("/usr/lib/libgfortran");
+  gSystem->Load("libgeant321");
+  gMC = new TGeant3TGeo;
    gMC->Gsatt("*", "seen", -1);
    gMC->Gsatt("alic", "seen", 0);
    gROOT->LoadMacro("FMD/ViewFMD.C");
    gInterpreter->ProcessLine("ViewFMD()");
+   gROOT->LoadMacro("ITS/ViewITS.C");
+   gInterpreter->ProcessLine("ViewITS()");
    gMC->Gdopt("hide", "on");
    gMC->Gdopt("shad", "on");
    gMC->Gsatt("*", "fill", 7);
index 41c41544634b4ce3cbd30ef7cf7f240ad12848a3..20da3c4accaa68eb0e577ef3cd4d7838dbb27d9b 100644 (file)
@@ -24,7 +24,7 @@ Reconstruct()
   rec.SetRunLocalReconstruction("FMD");
   rec.SetRunVertexFinder(kFALSE);
   // rec.SetRunTracking(kFALSE); 
-  rec.SetFillESD(""); 
+  rec.SetFillESD("FMD"); 
   rec.SetInput("./");
   rec.Run(); 
 }
index 0cfd70614f447f405f8e2b8fdb7204ad6f163ab9..54c59f460edd1eaac502475613076e255fb1b58f 100644 (file)
@@ -25,7 +25,7 @@ Simulate()
  // sim.SetMakeDigits("FMD");
  sim.SetWriteRawData("FMD");
  // sim.SetMakeDigitsFromHits("FMD");
- sim.Run(2); 
+ sim.Run(1); 
 }
 
 //
index bc5a88375920ad2a2103be674560bfc94d7a694d..23b6ac4feb40034daf3519f52d984fc1076c5fdc 100644 (file)
@@ -8,32 +8,32 @@ void DrawInner()
   gMC->Gsatt("alic", "seen", 0);
   gROOT->LoadMacro("FMD/ViewFMD.C");
   gInterpreter->ProcessLine("ViewFMD()");
-  gROOT->LoadMacro("VZERO/ViewVZERO.C");
-  gInterpreter->ProcessLine("ViewVZERO()");
-  gROOT->LoadMacro("START/ViewSTART.C");
-  gInterpreter->ProcessLine("ViewSTART()");
+  // gROOT->LoadMacro("VZERO/ViewVZERO.C");
+  // gInterpreter->ProcessLine("ViewVZERO()");
+  // gROOT->LoadMacro("START/ViewSTART.C");
+  // gInterpreter->ProcessLine("ViewSTART()");
   gROOT->LoadMacro("macros/ViewITS.C");
   gInterpreter->ProcessLine("ViewITS()");
   // gROOT->LoadMacro("FMD/scripts/ViewPIPE.C");
   // gInterpreter->ProcessLine("ViewPIPE()");
   // gMC->Gsatt("ITSV", "seen", 1);
-  gMC->Gsatt("0STR", "seen", 1);
-  gMC->Gsatt("0STL", "seen", 1);
-  gMC->Gsatt("0SUP", "seen", 1);
+  // gMC->Gsatt("0STR", "seen", 1);
+  // gMC->Gsatt("0STL", "seen", 1);
+  // gMC->Gsatt("0SUP", "seen", 1);
   // gMC->Gsatt("FMD1", "seen", 1);
   // gMC->Gsatt("FMD2", "seen", 1);
-  gMC->Gsatt("FMD3", "seen", 0);
-  gMC->Gdopt("hide", "on");
-  gMC->Gdopt("shad", "on");
-  gMC->Gsatt("*", "fill", 7);
-  gMC->SetClipBox(".");
-  gMC->SetClipBox("*", 0, 1000, -1000, 1000, -1000, 1000);
-  gMC->DefaultRange();
-  gMC->Gdraw("alic", 60, 0, 0, 10, 10, .10, .10);
+  // gMC->Gsatt("FMD3", "seen", 0);
+  //gMC->Gdopt("hide", "on");
+  //gMC->Gdopt("shad", "on");
+  // gMC->Gsatt("*", "fill", 7);
+  // gMC->SetClipBox(".");
+  // gMC->SetClipBox("*", 0, 1000, -1000, 1000, -1000, 1000);
+  // gMC->DefaultRange();
+  // gMC->Gdraw("alic", 60, 0, 0, 10, 10, .10, .10);
   // gMC->Gdhead(1111, "FMD3 detail");
   // gMC->Gdman(16, 10, "MAN");
-  
+  gGeoManager->GetTopVolume()->Draw();
   gPad->Modified();
   gPad->cd();
-  gPad->Print("Inner.png");
+  // gPad->Print("Inner.png");
 }