Message: RE: Can I fill histograms with energy deposit per event using EndOfEvent() method of G4VSensitiveDetector? Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

None RE: Can I fill histograms with energy deposit per event using EndOfEvent() method of G4VSensitiveDetector? 

Forum: Hits, Digitization and Pileup
Re: Question Can I fill histograms with energy deposit per event using EndOfEvent() method of G4VSensitiveDetector? (Victor_Makarov)
Date: 07 Jun, 2007
From: Makoto Asai <Makoto Asai>

Please refer to examples/extended/analysis/A01.
Given you have nice print-out for each event, you 
do not need to modify your sensitive detector at 
all. Just modify your EndOfEventAction() to fill your
histograms, as demonstrated in A01 example.

Makoto 

> -----Original Message-----
> From: Victor [mailto:douglas@slac.stanford.edu] 
> Sent: Thursday, June 07, 2007 6:24 AM
> To: publichypernews
> Subject: Can I fill histograms with energy deposit per event 
> using EndOfEvent() method of G4VSensitiveDetector?
> 
> *** Discussion title: Hits, Digitization and Pileup
> Email replies to PublicHyperNews@slac.stanford.edu must include:
>   In-Reply-To: <"/hitsdigits/153"@geant4-hn.slac.stanford.edu>
>   Subject: ...change this to be about your reply.
> 
> I have a sensitive detector. It calculates energy deposition per event
> and prints it out by means of the current block of EndofEvent method:
> 
> G4double totE = 0;
>     G4int NbHits = trackerCollection->entries();
>         for(int i=0;i<NbHits;i++)
>     { totE += (*trackerCollection)[i]->GetEdep(); }
>     G4cout << "     Total energy deposition in NaI : "
>          << totE / MeV << " (MeV)" << G4endl;
> ....
> 
> It is printed out very well in my output. But I would also 
> like to fill
> a histogram with that info. I think I should use something like
> 
> #ifdef G4ANALYSIS_USE
>   Run->GetHisto(0)->fill(totE/MeV);
> #endif
> 
> after the previous block.
> 
> I've already created a blank histogram in RunAction and an empty aida
> file is outputted. It's ok!
> 
> In an example (extended-Em4) I saw how things are connected in
> EventAction when energy deposition of every event with no SD 
> is sent to
> histogram:
> 
> 1) EventAction::EventAction(RunAction* run)
> 
> :Run(run),drawFlag("none"),printModulo(10000),eventMessenger(NULL)
> 
> 2) Run->GetHisto(0)->fill(TotalEnergyDeposit/MeV);
> 
> In a similar way I think I should modify my sensitive detector
> constructor But I'm not very strong in C++ programming and don't know
> what to modify. My SD constructor is:
> 
> TrackerSD::TrackerSD(G4String name)
> :G4VSensitiveDetector(name)
> {
>   G4String HCname;
>   collectionName.insert(HCname="trackerCollection");
> }
> 
> Any idea how to modify it? Thanks.
> 

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

1 None: RE: Can I fill histograms with energy deposit per event using EndOfEvent() method of G4VSensitiveDetector?   (Victor - 08 Jun, 2007)
(_ None: RE: Can I fill histograms with energy deposit per event using EndOfEvent() method of G4VSensitiveDetector?   (Makoto Asai - 08 Jun, 2007)
(_ None: RE: Can I fill histograms with energy deposit per event using EndOfEvent() method of G4VSensitiveDetector?   (Victor - 09 Jun, 2007)
 Add Message Add Message
to: "RE: Can I fill histograms with energy deposit per event using EndOfEvent() method of G4VSensitiveDetector?"

 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 ]