source: MEMPHYS/HEAD/run/MEMPHYS_digit.C @ 148

Last change on this file since 148 was 148, checked in by campagne, 18 years ago

dump the geometry JEC

File size: 1.8 KB
Line 
1void MEMPHYS_digit() {
2
3  TCanvas* c1 = new TCanvas("c1","MEMPHYS Digit",100,100,600,600);
4  c1->SetGridx();
5  c1->SetGridy();
6 
7  TH1F* htime = new TH1F("htile","Time distribution",100,900.,1100.);
8
9
10
11  TFile* f = new TFile("MEMPHYS.root");
12  TTree* tEvent = (TTree*)f->Get("Event");
13
14  //declare Non subTuple part
15  Int_t eventId,inputEvtId, interMode, vtxVol;
16  tEvent->SetBranchAddress("eventId",&eventId);
17  tEvent->SetBranchAddress("inputEvtId",&inputEvtId);
18
19  Int_t nDigits;
20  Double_t sumPE;
21  tEvent->SetBranchAddress("nDigits",&nDigits);
22  tEvent->SetBranchAddress("sumPE",&sumPE);
23
24
25  //The Digit Event:subTuple   
26  TTree* Event_digit = new TTree();
27  tEvent->SetBranchAddress("digit",&Event_digit);
28  Int_t tubeId;
29  Double_t digit_pe, digit_time;
30
31  Int_t nEvent = tEvent->GetEntries();
32
33  for (Int_t i=0; i<nEvent; ++i){
34    tEvent->GetEntry(i);
35//     std::cout << ">>>>>>>>>>>>> Event{" << i << "}: "
36//            << " evt Id " << eventId
37//            <<" #digits: " << nDigits
38//            << std::endl;
39
40    Int_t nTubeDigits = Event_digit->GetEntries();
41//     std::cout << " nTube Digits = " << nTubeDigits
42//            << std::endl;
43
44   
45    // Have a brand new overwritten digit TTree ; we have
46    // to rebind its user variables :
47    Event_digit->SetBranchAddress("tubeId",&tubeId);
48    Event_digit->SetBranchAddress("pe",&digit_pe);
49    Event_digit->SetBranchAddress("time",&digit_time);
50
51
52    //--------
53    // The Digits
54    //--------
55    for (Int_t l=0; l<nTubeDigits; ++l) {
56      Event_digit->GetEntry(l);
57     
58       std::cout << "----> Digit{"<<l<<"}: " 
59                << "tube[" << tubeId << "] = " 
60                << " pe: " << digit_pe
61                << " time: " << digit_time
62                << std::endl;
63      htime->Fill(digit_time);
64     
65    }//Loop on Digits
66  }//loop on event
67
68  htime->Draw();
69
70}//read_event
Note: See TracBrowser for help on using the repository browser.