Subversion Repositories f9daq

Compare Revisions

Ignore whitespace Rev 332 → Rev 333

/belle2/masterclass/js/belle2_def.js
133,7 → 133,7
.appendField(new Blockly.FieldNumber(0, -Infinity, Infinity, 0.0001), "max");
this.appendDummyInput()
.appendField("Variable")
.appendField(new Blockly.FieldDropdown([["mass", "GetMass"], ["momentum", "GetMomentum"], ["energy", "GetEnergy"],["charge", "GetCharge"], ["identity", "GetPid"],["polar angle", "GetTheta"],["cos(polar ang.)", "GetCosTheta"],["px", "GetXMomentum"],["py", "GetYMomentum"],["pz", "GetZMomentum"],["pT", "GetTransverseMomentum"]]), "varname");
.appendField(new Blockly.FieldDropdown([["mass", "GetMass"], ["momentum", "GetMomentum"], ["energy", "GetEnergy"],["charge", "GetCharge"], ["identity", "GetPid"],["polar angle", "GetTheta"],["cos(polar ang.)", "GetCosTheta"],["px", "GetXMomentum"],["py", "GetYMomentum"],["pz", "GetZMomentum"],["pT", "GetTransverseMomentum"],["m-m1","GetDeltaMass1"],["m-m2","GetDeltaMass2"],["m-m3","GetDeltaMass3"]]), "varname");
this.setInputsInline(true);
this.setPreviousStatement(true);
this.setNextStatement(true);
/belle2/masterclass/src/Blab2.cc
58,7 → 58,7
int combiner3(int id0 ,int id1 , int id2, int same, SIMPLEPID particlename, double min, double max, int hid, int id );
int combiner3(int id0 ,int id1 , int id2, int same, SIMPLEPID particlename, double min, double max, std::vector<int>hid, int id );
int fix_mass(int id);
int Fill(std::vector<int> hid, BParticle *p);
int Fill(std::vector<int> hid, std::vector<BParticle *> p);
void plist(int i);
 
 
84,7 → 84,7
"momentum (GeV/c)",
"momentum (GeV/c)",
"angle (deg.)",
"cos(theta)"};
"cos(theta)", "#Deltamass_{1}(GeV/c2)", "#Deltamass_{2}(GeV/c2)", "#Delta mass_{3}(GeV/c2)"};
fHtype[id] = 0;
if (svar.Contains("GetMass" )) fHtype[id]=0;
if (svar.Contains("GetMomentum")) fHtype[id]=1;
97,6 → 97,9
if (svar.Contains("GetTransverseMomentum")) fHtype[id]=8;
if (svar.Contains("GetTheta")) fHtype[id]=9;
if (svar.Contains("GetCosTheta")) fHtype[id]=10;
if (svar.Contains("GetDeltaMass1" )) fHtype[id]=11;
if (svar.Contains("GetDeltaMass2" )) fHtype[id]=12;
if (svar.Contains("GetDeltaMass3" )) fHtype[id]=13;
 
//fH[id]= new TH1F(TString::Format("h%d",id), TString::Format("%s;%s;N",name,axis[fHtype[id]].Data()), nbins, min, max);
if (fHtype[id]==4) {
111,9 → 114,10
 
 
 
int Blab2::Fill(std::vector<int> id, BParticle *p){
int Blab2::Fill(std::vector<int> id, std::vector<BParticle *> particle){
for (int i=0; i< id.size(); i++){
int hid = id[i];
int hid = id[i];
BParticle *p= particle[0];
if (hid>=0 && fH[hid]) {
double val;
switch (fHtype[hid]){
128,6 → 132,12
case 8 : val = p->GetTransverseMomentum(); break;
case 9 : val = (p->GetMomentum()!=0) ? p->pz()/p->GetMomentum() : 0; val = 180.0*TMath::ACos(val)/TMath::Pi(); break;
case 10: val = (p->GetMomentum()!=0) ? p->pz()/p->GetMomentum() : 0; break;
case 11 :
case 12 :
case 13 : {
int idx = fHtype[hid]-10;
val = (particle.size()>idx) ? p->GetMass() - particle[idx]->GetMass() : 0; break;
}
default: val = 0 ; break;
}
fH[hid]->Fill(val);
154,6 → 164,7
 
fList[_p2]->Clear();
std::vector<BParticle *> pall(3);
int nprt=0;
for(TIter next1(fList[_p0]);BParticle * p1 =(BParticle *) next1();) {
161,9 → 172,13
// in the case the second parti
for(TIter next2 = (_p0!=_p1 && same==0) ? TIter(fList[_p1]): TIter(next1) ; BParticle * p2 =(BParticle *) next2();) {
if (p1==p2) continue; // do not use the same particle in the combinations
BParticle p = *p1 + *p2; // Combine two particles into a new particle
BParticle p = *p1 + *p2; // Combine two particles into a new particle
pall[0] = &p;
pall[1] = p1;
pall[2] = p2;
 
if (p.InMassRange(min, max)){
Fill(hid, &p);
Fill(hid, pall);
p.SetPid(pid); // set PID to particlename to fix the particle mass
p.SetEnergyFromPid();
TClonesArray& list = *fList[_p2];
186,6 → 201,8
 
fList[_p3]->Clear();
std::vector<BParticle *> pall(4);
 
int nprt=0;
for(TIter next1(fList[_p0]);BParticle * p1 =(BParticle *) next1();) {
195,9 → 212,15
if (p1==p2) continue; // do not use the same particle in the combinations
for(TIter next3 = (_p1!=_p2 && same==0) ? TIter(fList[_p2]): TIter(next2) ; BParticle * p3 =(BParticle *) next3();) {
if (p2==p3) continue; // do not use the same particle in the combinations
BParticle p = *p1 + *p2 + *p3; // Combine two particles into a new particle
BParticle p = *p1 + *p2 + *p3 ; // Combine two particles into a new particle
pall[0] = &p;
pall[1] = p1;
pall[2] = p2;
pall[3] = p3;
 
if (p.InMassRange(min, max)){
Fill(hid, &p);
Fill(hid, pall);
p.SetPid(pid); // set PID to particlename to fix the particle mass
p.SetEnergyFromPid();
TClonesArray& list = *fList[_p3];
221,6 → 244,7
fList[pout]->Clear();
int nprt=0;
std::vector<BParticle *> pall(1);
for(TIter next(fList[pin]); BParticle * p =(BParticle *) next();) {
if (p->charge()== charge || charge > 1){
227,7 → 251,8
if ( p->pid()== type || type == ALL ) {
TClonesArray& list = *fList[pout];
new (list[nprt++]) BParticle ( *p );
Fill(hid, p);
pall[0] = p ;
Fill(hid, pall);
}
}
}