Message: Digitization Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

None Digitization 

Keywords: Hits Digits totalenergydeposit
Forum: Hits, Digitization and Pileup
Date: 16 Sep, 2003
From: COURTINE <courtine@clermont.in2p3.fr>

i want to collect information about the total energy deposit in one event which + is the sum of all the hit of this event. So i use the method digitize() of the + class G4VDigitizerModule. Here found what i made: + PuitsDigitizer::PuitsDigitizer(const G4String& name) + :G4VDigitizerModule(name) + { + G4cout << "essai1" << G4endl; + } + + PuitsDigitizer::~PuitsDigitizer() + { + G4cout << "essai2" << G4endl; + } + + void PuitsDigitizer::Digitize() + { + G4cout << "essai3" << G4endl; + G4DigiManager* fDM = G4DigiManager::GetDMpionter(); + G4int myHitsCollID = fDM->GetHitsCollectionID("hits_collection_name"); + PuitsGeHitsCollection* HC = fDM->GetHitsCollection(myHitsCollID); + G4int n_hit = 0; + G4double totE=9, totL=0; + PuitsGeDigiCollection* digiCollection = 0; + n_hit = HC->entries(); + for (G4int i=0;i<n_hit;i++) + { + totE += (*HC) [i]->GetEdep(); + totL += (*HC) [i]->GetTrackL(); + G4cout << "essai5" << G4endl; + } + PuitsGeDigi* newDigi = new PuitsGeDigi(); + digiCollection->insert(newDigi); + newDigi->Print(); + G4cout << "essai6 << G4endl; + if (digiCollection) StoreDigiCollection(digiCollection); + if (verboseLevel==0){ + G4cout + << " Germanium total energy deposit " << G4BestUnit(totE,"Energy"); + << G4endl; + G4int NbDigi = digiCollection->entries(); + for (G4int i=0,i<NbDigi,i++) (*digiCollection) [i] ->Print(); + } + } + I can compile and run the program but when i have access to the digicollection + it return no digits. Moreover when i run i should view all the message essai1, + essai2... and i see none. + So I suupose that the class I derived don't work anymore but idon't know why + (this class is included in PuitsEventAction.cc where I took the value of digits) Here is the code for PuitsEventAction: #include "PuitsEventAction.hh"

#include "PuitsGeHit.hh"
#include "PuitsGeDigi.hh"
#include "PuitsDigitizer.hh"

#include "G4Event.hh"
#include "G4EventManager.hh"
#include "G4HCofThisEvent.hh"
#include "G4DCofThisEvent.hh"
#include "G4VDigiCollection.hh"
#include "G4TDigiCollection.hh"
#include "G4THitsCollection.hh"
#include "G4VHitsCollection.hh"
#include "G4TrajectoryContainer.hh"
#include "G4Trajectory.hh"
#include "G4VVisManager.hh"
#include "G4SDManager.hh"
#include "G4UImanager.hh"
#include "G4ios.hh"
#include "G4UnitsTable.hh"
#include "G4DigiManager.hh"

PuitsEventAction::PuitsEventAction()
:PuitsgeID(-1),printModulo(1)
{}

PuitsEventAction::~PuitsEventAction() {}

void PuitsEventAction::BeginOfEventAction(const G4Event* evt) {

 G4int evtNb = evt->GetEventID();
 if (evtNb%printModulo == 0)
   {
    G4cout << "\n---> Begin of event: " << evtNb << G4endl;
   }

 if (PuitsgeID==-1)
   {
    G4SDManager * SDman = G4SDManager::GetSDMpointer();
    PuitsgeID = SDman->GetCollectionID("geCollection");
}
}

void PuitsEventAction::EndOfEventAction(const G4Event* evt)
{
  G4int evtNb = evt->GetEventID();

  // extracted from hits, compute the total energy deposit (and total 
  // track length) in all the germanium volume

  G4HCofThisEvent* HCE = evt->GetHCofThisEvent();
  PuitsGeHitsCollection* CHC = 0;
  G4int n_hit = 0;
  G4double totEGe =0, totLGe=0;
  if (HCE) CHC = (PuitsGeHitsCollection*)(HCE->GetHC(PuitsgeID));

  if (CHC)
    {
     n_hit = CHC->entries();
     for (G4int i=0;i<n_hit;i++)
	{
	  totEGe += (*CHC)[i]->GetEdep(); 
	  totLGe += (*CHC)[i]->GetTrackL();
	}
     }

   // print this information event by event (modulo n)

  if (evtNb%printModulo == 0) {
    G4cout << "---> End of event: " << evtNb << G4endl;

    G4cout
       << "   Germanium : total energy: " << std::setw(7)
                                        << G4BestUnit(totEGe,"Energy")
       << "       total track length: " << std::setw(7)
                                        << G4BestUnit(totLGe,"Length")
       << G4endl;

    G4cout << "\n     " << n_hit
	   << " hits are stored in PuitsGeHitsCollection." << G4endl;
  }

  // extract the trajectories and draw them

  if (G4VVisManager::GetConcreteInstance())
    {
     G4TrajectoryContainer* trajectoryContainer = evt->GetTrajectoryContainer();
     G4int n_trajectories = 0;
     if (trajectoryContainer) n_trajectories = trajectoryContainer->entries();

     for (G4int i=0; i<n_trajectories; i++)
        { G4Trajectory* trj = (G4Trajectory*)
	                                ((*(evt->GetTrajectoryContainer()))[i]);
                                  trj->DrawTrajectory(50);
        }
  }

G4DigiManager* fDM = G4DigiManager::GetDMpointer(); G4int myDigiCollID = fDM->GetDigiCollectionID("digi_collection_name"); G4DCofThisEvent* DCE = evt->GetDCofThisEvent(); //PuitsGeDigiCollection* CDC = 0; PuitsGeDigiCollection* CDC = new PuitsGeDigiCollection(); G4double totE = 0; G4double totL = 0; G4int n_digi = 0; G4cout << "test1" << G4endl; if (DCE) CDC = (PuitsGeDigiCollection*)(DCE->GetDC(myDigiCollID));

  {
G4cout << "test2" << G4endl;
n_digi = CDC->entries();
G4cout << "\n     " << n_digi
	   << " digits are stored in PuitsGeDigiCollection." << G4endl;

  for (G4int i=0;i<n_digi;i++)
  {
 G4cout << "test3" << G4endl;
 (*digiCollection) [i]->Print();
    }
    }
    G4cout << "---> End of event: " << evtNb << G4endl;	

    G4cout
       << "   Germanium : total energy: " << std::setw(7)
                                        << G4BestUnit(totE,"Energy")
       << "       total track length: " << std::setw(7)

                        << G4BestUnit(totL,"Length")
       << G4endl;

    G4cout << "\n     " << n_digi
	   << " digits are stored in PuitsGeDigiCollection." << G4endl;

}

+ Thank you for your help. + Best regards, + Fabien

Inline Depth:
 1 1
 All All
Outline Depth:
 1 1
 2 2
 All All
Add message: (add)

 Add Message Add Message
to: "Digitization"

 Subscribe Subscribe

This site runs SLAC HyperNews version 1.11-slac-98, derived from the original HyperNews


[ Geant 4 Home | Geant 4 HyperNews | Search | Request New Forum | Feedback ]