source: MEMPHYS/HEAD/run/MEMPHYS_hit.C @ 269

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

dump the geometry JEC

File size: 1.9 KB
Line 
1void MEMPHYS_hit() {
2
3  TFile* f = new TFile("MEMPHYS.root");
4  TTree* tEvent = (TTree*)f->Get("Event");
5
6  //declare Non subTuple part
7  Int_t eventId,inputEvtId, interMode, vtxVol;
8  tEvent->SetBranchAddress("eventId",&eventId);
9  tEvent->SetBranchAddress("inputEvtId",&inputEvtId);
10
11  Int_t nHits; 
12  tEvent->SetBranchAddress("nHits",&nHits);
13
14
15  //The Hit Event:subTuple
16  TTree* Event_hit = new TTree();
17  tEvent->SetBranchAddress("hit",&Event_hit);
18  Int_t tubeId_hit; //JEC 16/1/06
19  Int_t totalPE;
20 
21  //The Pe Hit::subTuple
22  TTree* Hit_pe = new TTree();
23  Float_t hit_time;
24
25
26  Int_t nEvent = tEvent->GetEntries();
27
28 
29  //  TList* aListOfH = new TList();
30  TNtuple* newTuple = new TNtuple("ntuple","MEMPHYS hit","i:tubeId:totalPE:time");
31
32  for (Int_t i=0; i<nEvent; ++i){
33    tEvent->GetEntry(i);
34
35    std::cout << ">>>>>>>>>>>>> Event{" << i << "}: "
36              << " evt Id " << eventId
37              << " evt Input Id " << inputEvtId
38              <<" #hits: " << nHits
39              << std::endl;
40
41    Int_t nTubeHits = Event_hit->GetEntries();
42    std::cout << " Hits = " << nTubeHits
43              << std::endl;
44
45
46    // Have a brand new overwritten hit TTree ; we have
47    // to rebind its user variables :
48    Event_hit->SetBranchAddress("tubeId",&tubeId_hit); //JEC 16/1/06   
49    Event_hit->SetBranchAddress("totalPE",&totalPE);
50    Event_hit->SetBranchAddress("pe",&Hit_pe);
51   
52
53    //--------
54    // The Hits
55    //--------
56
57    for (Int_t k=0; k<nTubeHits; ++k) {
58     
59      Event_hit->GetEntry(k);
60
61      Hit_pe->SetBranchAddress("time",&hit_time);
62      //JEC 16/1/06 add the tubeId_hit info
63      //std::cout << "----> Hit{"<<k<<"}: tube[" << tubeId_hit << "] total #PE " << totalPE << std::endl;
64      for (Int_t ki=0; ki<Hit_pe->GetEntries(); ++ki) {
65        Hit_pe->GetEntry(ki);
66        //std::cout << "<" << hit_time << ">";
67
68        ntuple->Fill(i,tubeId_hit,totalPE,hit_time);
69      }
70      //      std::cout << std::endl;
71    }//Loop on Hits
72
73  }//loop on event
74
75
76}//MEMPHYS_hit
Note: See TracBrowser for help on using the repository browser.