ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/yangyong/combineICEE/common_functions.cc
Revision: 1.2
Committed: Thu Aug 30 11:03:29 2012 UTC (12 years, 8 months ago) by yangyong
Content type: text/plain
Branch: MAIN
CVS Tags: V2012comb, HEAD
Changes since 1.1: +1 -160 lines
Log Message:
*** empty log message ***

File Contents

# Content
1
2
3 void get_xyzEBrechits(){
4 TChain *ch = new TChain("Analysis");
5 ch->Add("xyzECAL.root");
6
7 ch->SetBranchAddress("xEBAll",xEBAll);
8 ch->SetBranchAddress("yEBAll",yEBAll);
9 ch->SetBranchAddress("zEBAll",zEBAll);
10 ch->SetBranchAddress("etaEBAll",etaEBAll);
11 ch->SetBranchAddress("phiEBAll",phiEBAll);
12
13
14 ch->SetBranchAddress("dxEBAll",dxEBAll);
15 ch->SetBranchAddress("dyEBAll",dyEBAll);
16 ch->SetBranchAddress("dzEBAll",dzEBAll);
17
18
19 ch->SetBranchAddress("xEEAll",xEEAll);
20 ch->SetBranchAddress("yEEAll",yEEAll);
21 ch->SetBranchAddress("zEEAll",zEEAll);
22
23 ch->SetBranchAddress("dxEEAll",dxEEAll);
24 ch->SetBranchAddress("dyEEAll",dyEEAll);
25 ch->SetBranchAddress("dzEEAll",dzEEAll);
26
27
28
29 ch->SetBranchAddress("etaEEAll",etaEEAll);
30 ch->SetBranchAddress("phiEEAll",phiEEAll);
31
32
33
34
35
36 ch->GetEntry(0);
37
38 ch->Delete();
39
40 cout<<"got xyzEcal.."<<endl;
41
42
43
44 }
45
46
47 /////////////////////////////////////////////////////////////////////////////////////////////////
48
49 void convxtalid(Int_t &nphi,Int_t &neta)
50 {
51 // Changed to what Yong's convention; output will give just two indices
52 // phi is unchanged; only eta now runs from
53 //
54 // 03/01/2008 changed to the new definition in CMSSW. The output is still the same...
55 // Barrel only
56 // Output nphi 0...359; neta 0...84; nside=+1 (for eta>0), or 0 (for eta<0).
57 // neta will be [-85,-1] , or [0,84], the minus sign indicates the z<0 side.
58
59 if(neta > 0) neta -= 1;
60 if(nphi > 359) nphi=nphi-360;
61
62 // final check
63 if(nphi >359 || nphi <0 || neta< -85 || neta > 84)
64 {
65 cout <<" output not in range: "<< nphi << " " << neta << " " <<endl;
66 exit(1);
67 }
68 } //end of convxtalid
69
70
71 // Calculate the distance in xtals taking into account possibly different sides
72 // change to coincide with yongs definition
73 Int_t diff_neta(Int_t neta1, Int_t neta2){
74 Int_t mdiff;
75 mdiff=abs(neta1-neta2);
76 return mdiff;
77 }
78
79 // Calculate the absolute distance in xtals taking into account the periodicity of the Barrel
80 Int_t diff_nphi(Int_t nphi1,Int_t nphi2) {
81 Int_t mdiff;
82 mdiff=abs(nphi1-nphi2);
83 if (mdiff > (360-abs(nphi1-nphi2))) mdiff=(360-abs(nphi1-nphi2));
84 return mdiff;
85 }
86
87 // Calculate the distance in xtals taking into account possibly different sides
88 // Then the distance would be from the 1st to the 2nd argument
89 // _s means that it gives the sign; the only difference from the above !
90 // also changed to coincide with Yong's definition
91 Int_t diff_neta_s(Int_t neta1, Int_t neta2){
92 Int_t mdiff;
93 mdiff=(neta1-neta2);
94 return mdiff;
95 }
96
97 // Calculate the distance in xtals taking into account the periodicity of the Barrel
98 Int_t diff_nphi_s(Int_t nphi1,Int_t nphi2) {
99 Int_t mdiff;
100 if(abs(nphi1-nphi2) < (360-abs(nphi1-nphi2))) {
101 mdiff=nphi1-nphi2;
102 }
103 else {
104 mdiff=360-abs(nphi1-nphi2);
105 if(nphi1>nphi2) mdiff=-mdiff;
106 }
107 return mdiff;
108 }
109