Rev 333 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 333 | Rev 344 | ||
|---|---|---|---|
| Line 38... | Line 38... | ||
| 38 | const char *names[12]={"photon", "electron", "pion", "muon", "kaon", "proton", "J/Psi", "D", "D*", "B", "Phi","Lambda0"}; |
38 | const char *names[12]={"photon", "electron", "pion", "muon", "kaon", "proton", "J/Psi", "D", "D*", "B", "Phi","Lambda0"}; |
| 39 | 39 | ||
| 40 | UInt_t fNeve; |
40 | UInt_t fNeve; |
| 41 | UInt_t fNfirst; |
41 | UInt_t fNfirst; |
| 42 | UInt_t fPrint; |
42 | UInt_t fPrint; |
| 43 |
|
43 | TString fData; |
| 44 | TH1F *fH[100]; |
44 | TH1F *fH[100]; |
| 45 | UInt_t fHtype[100]; |
45 | UInt_t fHtype[100]; |
| 46 | TClonesArray *fList[100]; |
46 | TClonesArray *fList[100]; |
| 47 | 47 | ||
| 48 | Blab2(); |
48 | Blab2(); |
| Line 56... | Line 56... | ||
| 56 | int combiner(int id0 ,int id1 , int same, SIMPLEPID particlename, double min, double max, int hid, int id ); |
56 | int combiner(int id0 ,int id1 , int same, SIMPLEPID particlename, double min, double max, int hid, int id ); |
| 57 | int combiner(int id0 ,int id1 , int same, SIMPLEPID particlename, double min, double max, std::vector<int>hid, int id ); |
57 | int combiner(int id0 ,int id1 , int same, SIMPLEPID particlename, double min, double max, std::vector<int>hid, int id ); |
| 58 | int combiner3(int id0 ,int id1 , int id2, int same, SIMPLEPID particlename, double min, double max, int hid, int id ); |
58 | int combiner3(int id0 ,int id1 , int id2, int same, SIMPLEPID particlename, double min, double max, int hid, int id ); |
| 59 | int combiner3(int id0 ,int id1 , int id2, int same, SIMPLEPID particlename, double min, double max, std::vector<int>hid, int id ); |
59 | int combiner3(int id0 ,int id1 , int id2, int same, SIMPLEPID particlename, double min, double max, std::vector<int>hid, int id ); |
| 60 | int fix_mass(int id); |
60 | int fix_mass(int id); |
| 61 | int Fill(std::vector<int> hid, |
61 | int Fill(std::vector<int> hid, BParticle *p); |
| 62 | void plist(int i); |
62 | void plist(int i); |
| 63 | 63 | ||
| 64 | 64 | ||
| 65 | ClassDef ( Blab2, 1 ) |
65 | ClassDef ( Blab2, 1 ) |
| 66 | }; |
66 | }; |
| 67 | 67 | ||
| 68 | ClassImp(Blab2) |
68 | ClassImp(Blab2) |
| 69 | 69 | ||
| 70 | Blab2::Blab2():fNfirst(0), fNeve(0), fData( |
70 | Blab2::Blab2():fNfirst(0), fNeve(0), fData(), fPrint(0) { |
| 71 | 71 | ||
| 72 | Process(); |
72 | Process(); |
| 73 | }; |
73 | }; |
| 74 | 74 | ||
| 75 | 75 | ||
| Line 82... | Line 82... | ||
| 82 | "momentum (GeV/c)", |
82 | "momentum (GeV/c)", |
| 83 | "momentum (GeV/c)", |
83 | "momentum (GeV/c)", |
| 84 | "momentum (GeV/c)", |
84 | "momentum (GeV/c)", |
| 85 | "momentum (GeV/c)", |
85 | "momentum (GeV/c)", |
| 86 | "angle (deg.)", |
86 | "angle (deg.)", |
| 87 | "cos(theta |
87 | "cos(theta)"}; |
| 88 | fHtype[id] = 0; |
88 | fHtype[id] = 0; |
| 89 | if (svar.Contains("GetMass" )) fHtype[id]=0; |
89 | if (svar.Contains("GetMass" )) fHtype[id]=0; |
| 90 | if (svar.Contains("GetMomentum")) fHtype[id]=1; |
90 | if (svar.Contains("GetMomentum")) fHtype[id]=1; |
| 91 | if (svar.Contains("GetEnergy" )) fHtype[id]=2; |
91 | if (svar.Contains("GetEnergy" )) fHtype[id]=2; |
| 92 | if (svar.Contains("GetCharge" )) fHtype[id]=3; |
92 | if (svar.Contains("GetCharge" )) fHtype[id]=3; |
| Line 95... | Line 95... | ||
| 95 | if (svar.Contains("GetYMomentum")) fHtype[id]=6; |
95 | if (svar.Contains("GetYMomentum")) fHtype[id]=6; |
| 96 | if (svar.Contains("GetZMomentum")) fHtype[id]=7; |
96 | if (svar.Contains("GetZMomentum")) fHtype[id]=7; |
| 97 | if (svar.Contains("GetTransverseMomentum")) fHtype[id]=8; |
97 | if (svar.Contains("GetTransverseMomentum")) fHtype[id]=8; |
| 98 | if (svar.Contains("GetTheta")) fHtype[id]=9; |
98 | if (svar.Contains("GetTheta")) fHtype[id]=9; |
| 99 | if (svar.Contains("GetCosTheta")) fHtype[id]=10; |
99 | if (svar.Contains("GetCosTheta")) fHtype[id]=10; |
| 100 | if (svar.Contains("GetDeltaMass1" )) fHtype[id]=11; |
- | |
| 101 | if (svar.Contains("GetDeltaMass2" )) fHtype[id]=12; |
- | |
| 102 | if (svar.Contains("GetDeltaMass3" )) fHtype[id]=13; |
- | |
| 103 | 100 | ||
| 104 | //fH[id]= new TH1F(TString::Format("h%d",id), TString::Format("%s;%s;N",name,axis[fHtype[id]].Data()), nbins, min, max); |
101 | //fH[id]= new TH1F(TString::Format("h%d",id), TString::Format("%s;%s;N",name,axis[fHtype[id]].Data()), nbins, min, max); |
| 105 | if (fHtype[id]==4) { |
102 | if (fHtype[id]==4) { |
| 106 | fH[id]= new TH1F(TString::Format("h%d",id), TString::Format("%s;%s;N",name,axis[fHtype[id]].Data()), 11, 0, 11); |
103 | fH[id]= new TH1F(TString::Format("h%d",id), TString::Format("%s;%s;N",name,axis[fHtype[id]].Data()), 11, 0, 11); |
| 107 | for (int i=0;i<11;i++) fH[id]->GetXaxis()->SetBinLabel(i+1,names[i]); |
104 | for (int i=0;i<11;i++) fH[id]->GetXaxis()->SetBinLabel(i+1,names[i]); |
| Line 112... | Line 109... | ||
| 112 | 109 | ||
| 113 | } |
110 | } |
| 114 | 111 | ||
| 115 | 112 | ||
| 116 | 113 | ||
| 117 | int Blab2::Fill(std::vector<int> id, |
114 | int Blab2::Fill(std::vector<int> id, BParticle *p){ |
| 118 | for (int i=0; i< id.size(); i++){ |
115 | for (int i=0; i< id.size(); i++){ |
| 119 |
|
116 | int hid = id[i]; |
| 120 | BParticle *p= particle[0]; |
- | |
| 121 | if (hid>=0 && fH[hid]) { |
117 | if (hid>=0 && fH[hid]) { |
| 122 | double val; |
118 | double val; |
| 123 | switch (fHtype[hid]){ |
119 | switch (fHtype[hid]){ |
| 124 | case 0 : val = p->GetMass(); break; |
120 | case 0 : val = p->GetMass(); break; |
| 125 | case 1 : val = p->GetMomentum(); break; |
121 | case 1 : val = p->GetMomentum(); break; |
| Line 130... | Line 126... | ||
| 130 | case 6 : val = p->py(); break; |
126 | case 6 : val = p->py(); break; |
| 131 | case 7 : val = p->pz(); break; |
127 | case 7 : val = p->pz(); break; |
| 132 | case 8 : val = p->GetTransverseMomentum(); break; |
128 | case 8 : val = p->GetTransverseMomentum(); break; |
| 133 | case 9 : val = (p->GetMomentum()!=0) ? p->pz()/p->GetMomentum() : 0; val = 180.0*TMath::ACos(val)/TMath::Pi(); break; |
129 | case 9 : val = (p->GetMomentum()!=0) ? p->pz()/p->GetMomentum() : 0; val = 180.0*TMath::ACos(val)/TMath::Pi(); break; |
| 134 | case 10: val = (p->GetMomentum()!=0) ? p->pz()/p->GetMomentum() : 0; break; |
130 | case 10: val = (p->GetMomentum()!=0) ? p->pz()/p->GetMomentum() : 0; break; |
| 135 | case 11 : |
- | |
| 136 | case 12 : |
- | |
| 137 | case 13 : { |
- | |
| 138 | int idx = fHtype[hid]-10; |
- | |
| 139 | val = (particle.size()>idx) ? p->GetMass() - particle[idx]->GetMass() : 0; break; |
- | |
| 140 | } |
- | |
| 141 | default: val = 0 ; break; |
131 | default: val = 0 ; break; |
| 142 | } |
132 | } |
| 143 | fH[hid]->Fill(val); |
133 | fH[hid]->Fill(val); |
| 144 | } |
134 | } |
| 145 | 135 | ||
| Line 162... | Line 152... | ||
| 162 | if (_p0 < 0 ) _p0 =0; |
152 | if (_p0 < 0 ) _p0 =0; |
| 163 | if (_p1 < 0 ) _p1 =0; |
153 | if (_p1 < 0 ) _p1 =0; |
| 164 | 154 | ||
| 165 | 155 | ||
| 166 | fList[_p2]->Clear(); |
156 | fList[_p2]->Clear(); |
| 167 | std::vector<BParticle *> pall(3); |
- | |
| 168 | int nprt=0; |
157 | int nprt=0; |
| 169 | 158 | ||
| 170 | for(TIter next1(fList[_p0]);BParticle * p1 =(BParticle *) next1();) { |
159 | for(TIter next1(fList[_p0]);BParticle * p1 =(BParticle *) next1();) { |
| 171 | // the second loop |
160 | // the second loop |
| 172 | // in the case the second parti |
161 | // in the case the second parti |
| 173 | for(TIter next2 = (_p0!=_p1 && same==0) ? TIter(fList[_p1]): TIter(next1) ; BParticle * p2 =(BParticle *) next2();) { |
162 | for(TIter next2 = (_p0!=_p1 && same==0) ? TIter(fList[_p1]): TIter(next1) ; BParticle * p2 =(BParticle *) next2();) { |
| 174 | if (p1==p2) continue; // do not use the same particle in the combinations |
163 | if (p1==p2) continue; // do not use the same particle in the combinations |
| 175 | BParticle p = *p1 + *p2; // Combine two particles into a new particle |
164 | BParticle p = *p1 + *p2; // Combine two particles into a new particle |
| 176 | pall[0] = &p; |
- | |
| 177 | pall[1] = p1; |
- | |
| 178 | pall[2] = p2; |
- | |
| 179 | - | ||
| 180 | if (p.InMassRange(min, max)){ |
165 | if (p.InMassRange(min, max)){ |
| 181 | Fill(hid, |
166 | Fill(hid, &p); |
| 182 | p.SetPid(pid); // set PID to particlename to fix the particle mass |
167 | p.SetPid(pid); // set PID to particlename to fix the particle mass |
| 183 | p.SetEnergyFromPid(); |
168 | p.SetEnergyFromPid(); |
| 184 | TClonesArray& list = *fList[_p2]; |
169 | TClonesArray& list = *fList[_p2]; |
| 185 | new (list[nprt++]) BParticle ( p ); // create a new entry in kslist list of particles |
170 | new (list[nprt++]) BParticle ( p ); // create a new entry in kslist list of particles |
| 186 | 171 | ||
| Line 199... | Line 184... | ||
| 199 | if (_p1 < 0 ) _p1 =0; |
184 | if (_p1 < 0 ) _p1 =0; |
| 200 | if (_p2 < 0 ) _p2 =0; |
185 | if (_p2 < 0 ) _p2 =0; |
| 201 | 186 | ||
| 202 | 187 | ||
| 203 | fList[_p3]->Clear(); |
188 | fList[_p3]->Clear(); |
| 204 | std::vector<BParticle *> pall(4); |
- | |
| 205 | - | ||
| 206 | int nprt=0; |
189 | int nprt=0; |
| 207 | 190 | ||
| 208 | for(TIter next1(fList[_p0]);BParticle * p1 =(BParticle *) next1();) { |
191 | for(TIter next1(fList[_p0]);BParticle * p1 =(BParticle *) next1();) { |
| 209 | // the second loop |
192 | // the second loop |
| 210 | // in the case the second parti |
193 | // in the case the second parti |
| 211 | for(TIter next2 = (_p0!=_p1 && same==0) ? TIter(fList[_p1]): TIter(next1) ; BParticle * p2 =(BParticle *) next2();) { |
194 | for(TIter next2 = (_p0!=_p1 && same==0) ? TIter(fList[_p1]): TIter(next1) ; BParticle * p2 =(BParticle *) next2();) { |
| 212 | if (p1==p2) continue; // do not use the same particle in the combinations |
195 | if (p1==p2) continue; // do not use the same particle in the combinations |
| 213 | for(TIter next3 = (_p1!=_p2 && same==0) ? TIter(fList[_p2]): TIter(next2) ; BParticle * p3 =(BParticle *) next3();) { |
196 | for(TIter next3 = (_p1!=_p2 && same==0) ? TIter(fList[_p2]): TIter(next2) ; BParticle * p3 =(BParticle *) next3();) { |
| 214 | if (p2==p3) continue; // do not use the same particle in the combinations |
197 | if (p2==p3) continue; // do not use the same particle in the combinations |
| 215 | BParticle p = |
198 | BParticle p = *p1 + *p2 + *p3; // Combine two particles into a new particle |
| 216 | pall[0] = &p; |
- | |
| 217 | pall[1] = p1; |
- | |
| 218 | pall[2] = p2; |
- | |
| 219 | pall[3] = p3; |
- | |
| 220 | - | ||
| 221 | - | ||
| 222 | if (p.InMassRange(min, max)){ |
199 | if (p.InMassRange(min, max)){ |
| 223 | Fill(hid, |
200 | Fill(hid, &p); |
| 224 | p.SetPid(pid); // set PID to particlename to fix the particle mass |
201 | p.SetPid(pid); // set PID to particlename to fix the particle mass |
| 225 | p.SetEnergyFromPid(); |
202 | p.SetEnergyFromPid(); |
| 226 | TClonesArray& list = *fList[_p3]; |
203 | TClonesArray& list = *fList[_p3]; |
| 227 | new (list[nprt++]) BParticle ( p ); // create a new entry in kslist list of particles |
204 | new (list[nprt++]) BParticle ( p ); // create a new entry in kslist list of particles |
| 228 | } |
205 | } |
| Line 242... | Line 219... | ||
| 242 | int Blab2::selector(int pin, int charge, SIMPLEPID type , std::vector<int> hid, int pout ){ |
219 | int Blab2::selector(int pin, int charge, SIMPLEPID type , std::vector<int> hid, int pout ){ |
| 243 | if (pin < 0 ) pin =0; |
220 | if (pin < 0 ) pin =0; |
| 244 | 221 | ||
| 245 | fList[pout]->Clear(); |
222 | fList[pout]->Clear(); |
| 246 | int nprt=0; |
223 | int nprt=0; |
| 247 | std::vector<BParticle *> pall(1); |
- | |
| 248 | 224 | ||
| 249 | for(TIter next(fList[pin]); BParticle * p =(BParticle *) next();) { |
225 | for(TIter next(fList[pin]); BParticle * p =(BParticle *) next();) { |
| 250 | if (p->charge()== charge || charge > 1){ |
226 | if (p->charge()== charge || charge > 1){ |
| 251 | if ( p->pid()== type || type == ALL ) { |
227 | if ( p->pid()== type || type == ALL ) { |
| 252 | TClonesArray& list = *fList[pout]; |
228 | TClonesArray& list = *fList[pout]; |
| 253 | new (list[nprt++]) BParticle ( *p ); |
229 | new (list[nprt++]) BParticle ( *p ); |
| 254 | pall[0] = p ; |
- | |
| 255 | Fill(hid, |
230 | Fill(hid, p); |
| 256 | } |
231 | } |
| 257 | } |
232 | } |
| 258 | } |
233 | } |
| 259 | return pout; |
234 | return pout; |
| 260 | } |
235 | } |
| Line 292... | Line 267... | ||
| 292 | for (int i=0;i<100;i++) fHtype[i]=0; |
267 | for (int i=0;i<100;i++) fHtype[i]=0; |
| 293 | for (int i=0;i<100;i++) fList[i]=NULL; |
268 | for (int i=0;i<100;i++) fList[i]=NULL; |
| 294 | 269 | ||
| 295 | Init(); |
270 | Init(); |
| 296 | 271 | ||
| 297 | TFile * f = new TFile(TString::Format("../../data/ |
272 | TFile * f = new TFile(TString::Format("../../data/%s",fData.Data())); // Open a data file |
| 298 | if(f->IsZombie()) { send_message(0,TString::Format("File |
273 | if(f->IsZombie()) { send_message(0,TString::Format("File %s not found\n",fData.Data()), 0 ); return; } |
| 299 | TTree * t =(TTree *) f-> Get( "T"); // Obtain a pointer to a tree of "event" data in the file |
274 | TTree * t =(TTree *) f-> Get( "T"); // Obtain a pointer to a tree of "event" data in the file |
| 300 | BEvent * mevent = new BEvent(); // Create a "BEvent" object where data from the file will be loaded |
275 | BEvent * mevent = new BEvent(); // Create a "BEvent" object where data from the file will be loaded |
| 301 | TBranch * branch = t-> GetBranch( "BEvent"); // Obtain a branch for "BEvent" in the tree |
276 | TBranch * branch = t-> GetBranch( "BEvent"); // Obtain a branch for "BEvent" in the tree |
| 302 | branch-> SetAddress(&mevent); // Register created "BEvent" object to the branch |
277 | branch-> SetAddress(&mevent); // Register created "BEvent" object to the branch |
| 303 | TH1F *fHnprt= new TH1F("h100", "Number of particles in the event;N particles;N events", 50, -0.5, 49.5); |
278 | TH1F *fHnprt= new TH1F("h100", "Number of particles in the event;N particles;N events", 50, -0.5, 49.5); |