Subversion Repositories f9daq

Compare Revisions

Ignore whitespace Rev 333 → Rev 344

/belle2/masterclass/src/Blab2.cc
40,7 → 40,7
UInt_t fNeve;
UInt_t fNfirst;
UInt_t fPrint;
int fData;
TString fData;
TH1F *fH[100];
UInt_t fHtype[100];
TClonesArray *fList[100];
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, std::vector<BParticle *> p);
int Fill(std::vector<int> hid, BParticle *p);
void plist(int i);
 
 
67,7 → 67,7
 
ClassImp(Blab2)
 
Blab2::Blab2():fNfirst(0), fNeve(0), fData(0), fPrint(0) {
Blab2::Blab2():fNfirst(0), fNeve(0), fData(), fPrint(0) {
 
Process();
};
84,7 → 84,7
"momentum (GeV/c)",
"momentum (GeV/c)",
"angle (deg.)",
"cos(theta)", "#Deltamass_{1}(GeV/c2)", "#Deltamass_{2}(GeV/c2)", "#Delta mass_{3}(GeV/c2)"};
"cos(theta)"};
fHtype[id] = 0;
if (svar.Contains("GetMass" )) fHtype[id]=0;
if (svar.Contains("GetMomentum")) fHtype[id]=1;
97,9 → 97,6
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) {
114,10 → 111,9
 
 
 
int Blab2::Fill(std::vector<int> id, std::vector<BParticle *> particle){
int Blab2::Fill(std::vector<int> id, BParticle *p){
for (int i=0; i< id.size(); i++){
int hid = id[i];
BParticle *p= particle[0];
int hid = id[i];
if (hid>=0 && fH[hid]) {
double val;
switch (fHtype[hid]){
132,12 → 128,6
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);
164,7 → 154,6
 
fList[_p2]->Clear();
std::vector<BParticle *> pall(3);
int nprt=0;
for(TIter next1(fList[_p0]);BParticle * p1 =(BParticle *) next1();) {
172,13 → 161,9
// 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
pall[0] = &p;
pall[1] = p1;
pall[2] = p2;
 
BParticle p = *p1 + *p2; // Combine two particles into a new particle
if (p.InMassRange(min, max)){
Fill(hid, pall);
Fill(hid, &p);
p.SetPid(pid); // set PID to particlename to fix the particle mass
p.SetEnergyFromPid();
TClonesArray& list = *fList[_p2];
201,8 → 186,6
 
fList[_p3]->Clear();
std::vector<BParticle *> pall(4);
 
int nprt=0;
for(TIter next1(fList[_p0]);BParticle * p1 =(BParticle *) next1();) {
212,15 → 195,9
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
pall[0] = &p;
pall[1] = p1;
pall[2] = p2;
pall[3] = p3;
 
BParticle p = *p1 + *p2 + *p3; // Combine two particles into a new particle
if (p.InMassRange(min, max)){
Fill(hid, pall);
Fill(hid, &p);
p.SetPid(pid); // set PID to particlename to fix the particle mass
p.SetEnergyFromPid();
TClonesArray& list = *fList[_p3];
244,7 → 221,6
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){
251,8 → 227,7
if ( p->pid()== type || type == ALL ) {
TClonesArray& list = *fList[pout];
new (list[nprt++]) BParticle ( *p );
pall[0] = p ;
Fill(hid, pall);
Fill(hid, p);
}
}
}
294,8 → 269,8
 
Init();
 
TFile * f = new TFile(TString::Format("../../data/hadron-%d.root",fData)); // Open a data file
if(f->IsZombie()) { send_message(0,TString::Format("File %d not found\n",fData), 0 ); return; }
TFile * f = new TFile(TString::Format("../../data/%s",fData.Data())); // Open a data file
if(f->IsZombie()) { send_message(0,TString::Format("File %s not found\n",fData.Data()), 0 ); return; }
TTree * t =(TTree *) f-> Get( "T"); // Obtain a pointer to a tree of "event" data in the file
BEvent * mevent = new BEvent(); // Create a "BEvent" object where data from the file will be loaded
TBranch * branch = t-> GetBranch( "BEvent"); // Obtain a branch for "BEvent" in the tree