New sdigitizer, not deriving from MUONDigitizer, and using
authorivana <ivana@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 31 Jan 2006 16:38:59 +0000 (16:38 +0000)
committerivana <ivana@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 31 Jan 2006 16:38:59 +0000 (16:38 +0000)
new Response:DisIntegrate method. Note also that this
one does *not* merge sdigits at all (this is deferred to the digitizer,
which
anyway has to do it), thus speeding a little bit this step.
(Laurent)

MUON/AliMUONSDigitizerV2.cxx [new file with mode: 0644]
MUON/AliMUONSDigitizerV2.h [new file with mode: 0644]

diff --git a/MUON/AliMUONSDigitizerV2.cxx b/MUON/AliMUONSDigitizerV2.cxx
new file mode 100644 (file)
index 0000000..f691eb5
--- /dev/null
@@ -0,0 +1,129 @@
+/**************************************************************************
+* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+*                                                                        *
+* Author: The ALICE Off-line Project.                                    *
+* Contributors are mentioned in the code where appropriate.              *
+*                                                                        *
+* Permission to use, copy, modify and distribute this software and its   *
+* documentation strictly for non-commercial purposes is hereby granted   *
+* without fee, provided that the above copyright notice appears in all   *
+* copies and that both the copyright notice and this permission notice   *
+* appear in the supporting documentation. The authors make no claims     *
+* about the suitability of this software for any purpose. It is          *
+* provided "as is" without express or implied warranty.                  *
+**************************************************************************/
+
+// $Id$
+
+#include "AliMUONSDigitizerV2.h"
+
+#include "AliLog.h"
+#include "AliMUON.h"
+#include "AliMUONChamber.h"
+#include "AliMUONData.h"
+#include "AliMUONDigit.h"
+#include "AliMUONHit.h"
+#include "AliLoader.h"
+#include "AliRun.h"
+#include "AliRunLoader.h"
+#include "TObjArray.h"
+
+ClassImp(AliMUONSDigitizerV2)
+
+//_____________________________________________________________________________
+AliMUONSDigitizerV2::AliMUONSDigitizerV2() 
+: TTask("AliMUONSDigitizerV2","From Hits to SDigits for MUON")
+{
+}
+
+//_____________________________________________________________________________
+AliMUONSDigitizerV2::~AliMUONSDigitizerV2()
+{
+}
+
+//_____________________________________________________________________________
+void
+AliMUONSDigitizerV2::Exec(Option_t*)
+{
+  //
+  // Go from hits to sdigits.
+  //
+  
+  AliDebug(1,"");
+  
+  AliRunLoader* runLoader = AliRunLoader::GetRunLoader();
+  AliLoader* fLoader = runLoader->GetLoader("MUONLoader");
+
+  fLoader->LoadHits("READ");
+  
+  AliMUONData muonData(fLoader,"MUON","MUON");
+
+  AliMUON* muon = static_cast<AliMUON*>(gAlice->GetModule("MUON"));
+    
+  const Int_t nofEvents(runLoader->GetNumberOfEvents());
+  for ( Int_t iEvent = 0; iEvent < nofEvents; ++iEvent ) 
+  {    
+    TObjArray tdlist;
+    tdlist.SetOwner(kTRUE);
+    
+    AliDebug(1,Form("iEvent=%d",iEvent));
+    runLoader->GetEvent(iEvent);
+    TTree* treeS = fLoader->TreeS();
+    AliDebug(1,Form("TreeS=%p",treeS));
+    if ( !treeS )
+    {
+      AliDebug(1,"MakeSDigitsContainer");
+      fLoader->MakeSDigitsContainer();
+      treeS = fLoader->TreeS();
+    }
+    AliDebug(1,Form("TreeS=%p",treeS));
+    muonData.MakeBranch("S");
+    muonData.SetTreeAddress("S");
+    
+    muonData.SetTreeAddress("H");
+    TTree* treeH = fLoader->TreeH();
+    AliDebug(1,Form("TreeH=%p",treeH));
+             
+    Long64_t nofTracks = treeH->GetEntries();
+    for ( Long64_t iTrack = 0; iTrack < nofTracks; ++iTrack )
+    {
+      treeH->GetEvent(iTrack);
+      TClonesArray* hits = muonData.Hits();
+      Int_t nofHits = hits->GetEntriesFast();
+      for ( Int_t ihit = 0; ihit < nofHits; ++ihit )
+      {
+        AliMUONHit* hit = static_cast<AliMUONHit*>(hits->At(ihit)); 
+        Int_t chamberId = hit->Chamber()-1;
+        AliMUONChamber& chamber = muon->Chamber(chamberId);
+        AliMUONResponse* response = chamber.ResponseModel();
+        TList digits;
+        response->DisIntegrate(*hit,digits);
+        TIter next(&digits);
+        AliMUONDigit* d;
+        while ( ( d = (AliMUONDigit*)next() ) )
+        {
+          d->SetHit(ihit);
+          tdlist.Add(d);
+        }
+      }
+      muonData.ResetHits();
+    } // loop on tracks within an event
+    tdlist.Sort(); // not really needed, except for comparing with old sdigitizer
+    for ( Int_t i = 0; i <= tdlist.GetLast(); ++i )
+    {
+      AliMUONDigit* d = (AliMUONDigit*)tdlist[i];
+      StdoutToAliDebug(1,d->Print(););
+      if ( d->Signal() > 0 ) // that check would be better in the disintegrate
+        // method, but to compare with old sdigitizer, it has to be there.
+      {
+        muonData.AddSDigit(d->DetElemId()/100-1,*d);
+      }
+    }
+    muonData.Fill("S");
+    fLoader->WriteSDigits("OVERWRITE");
+    muonData.ResetSDigits();
+    fLoader->UnloadSDigits();
+  } // loop on events
+  
+  fLoader->UnloadHits();  
+}
diff --git a/MUON/AliMUONSDigitizerV2.h b/MUON/AliMUONSDigitizerV2.h
new file mode 100644 (file)
index 0000000..921353b
--- /dev/null
@@ -0,0 +1,35 @@
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+* See cxx source for full Copyright notice                               */
+
+// $Id$
+
+/// \ingroup sim
+/// \class AliMUONSDigitizerV2
+/// \brief New sdigitizer, not deriving from MUONDigitizer, and using
+/// new Response:DisIntegrate method
+///
+/// Note also that this one does *not* merge sdigits at all 
+/// (this is deferred to the digitizer, which anyway has to do it), 
+/// thus speeding a little bit this step.
+///
+/// \author Laurent Aphecetche
+
+#ifndef ALIMUONSDIGITIZERV2_H
+#define ALIMUONSDIGITIZERV2_H
+
+#ifndef ROOT_TTask
+#  include "TTask.h"
+#endif
+
+class AliMUONSDigitizerV2 : public TTask
+{
+public:
+  AliMUONSDigitizerV2();
+  virtual ~AliMUONSDigitizerV2();
+  
+  virtual void Exec(Option_t* opt="");
+    
+  ClassDef(AliMUONSDigitizerV2,1) // 
+};
+
+#endif