Very small acceptance filter (setting variables for batch) including opening angle.



class PHadesAcc : public PBulkInterface {

private:
    Double_t *hadacc, *opang;

 public:
    
    PHadesAcc();

    Bool_t Modify(PParticle ** stack, int *decay_done, int *num, int stacksize);  //bulk interface

    ClassDef(PHadesAcc, 0) 
};

PHadesAcc::PHadesAcc() {
    hadacc = makeStaticData()->GetBatchValue("_hadacc");
    opang  = makeStaticData()->GetBatchValue("_opang");
};

bool PHadesAcc::Modify(PParticle **stack, int *decay_done, int *num, int stacksize) {

    *hadacc = 1.;

    for (int i=0; i<*num; i++) {
	PParticle *cur = stack[i];
//	cur->Print();

	if (cur->Is("pi+") || cur->Is("pi-")|| cur->Is("p") 
	    || cur->LeptonN()) {

#if 0
	    double momentum_resolution = 0.05;
	    double angular_resolution = 0.1*TMath::Pi()/180.;
//	    double angular_resolution = 0;

	    double mom = cur->P();

	    double theta = cur->Theta();
	    double phi   = cur->Phi();

	    double mom_measured   = PUtils::sampleGaus(mom, mom*momentum_resolution);
	    double theta_measured = PUtils::sampleGaus(theta, angular_resolution);
	    double phi_measured   = PUtils::sampleGaus(phi, angular_resolution);

	    cur->SetRho(mom_measured);
	    cur->SetTheta(theta_measured);
	    cur->SetPhi(phi_measured);

 	    cur->ResetE();
#endif
	    

	    if (cur->Theta() < ((18./180)*TMath::Pi())){
		*hadacc=0.;
		//cur->Print();
	    }
	    if (cur->Theta() > ((88./180)*TMath::Pi())){
		*hadacc=0.;
		
	    }
	    if (cur->P() < 0.1)  {
		*hadacc=0.;
		
	    }
	}
    }

    *opang = 1.;

    //the opang:
    for (int i=0; i<*num; i++) {
	PParticle *ep = stack[i];
	if (ep->Is("e+")) {
	    for (int i=0; i<*num; i++) {
		PParticle *em = stack[i];
		if (em->Is("e-")) {
		    Double_t oa = ep->Vect().Angle(em->Vect());
		    if (oa < ((4./180)*TMath::Pi())){
			*opang = 0.;
		    }
		}
	    }
	}
    }

    return kTRUE;
};

















 PHadesAcc.C:1
 PHadesAcc.C:2
 PHadesAcc.C:3
 PHadesAcc.C:4
 PHadesAcc.C:5
 PHadesAcc.C:6
 PHadesAcc.C:7
 PHadesAcc.C:8
 PHadesAcc.C:9
 PHadesAcc.C:10
 PHadesAcc.C:11
 PHadesAcc.C:12
 PHadesAcc.C:13
 PHadesAcc.C:14
 PHadesAcc.C:15
 PHadesAcc.C:16
 PHadesAcc.C:17
 PHadesAcc.C:18
 PHadesAcc.C:19
 PHadesAcc.C:20
 PHadesAcc.C:21
 PHadesAcc.C:22
 PHadesAcc.C:23
 PHadesAcc.C:24
 PHadesAcc.C:25
 PHadesAcc.C:26
 PHadesAcc.C:27
 PHadesAcc.C:28
 PHadesAcc.C:29
 PHadesAcc.C:30
 PHadesAcc.C:31
 PHadesAcc.C:32
 PHadesAcc.C:33
 PHadesAcc.C:34
 PHadesAcc.C:35
 PHadesAcc.C:36
 PHadesAcc.C:37
 PHadesAcc.C:38
 PHadesAcc.C:39
 PHadesAcc.C:40
 PHadesAcc.C:41
 PHadesAcc.C:42
 PHadesAcc.C:43
 PHadesAcc.C:44
 PHadesAcc.C:45
 PHadesAcc.C:46
 PHadesAcc.C:47
 PHadesAcc.C:48
 PHadesAcc.C:49
 PHadesAcc.C:50
 PHadesAcc.C:51
 PHadesAcc.C:52
 PHadesAcc.C:53
 PHadesAcc.C:54
 PHadesAcc.C:55
 PHadesAcc.C:56
 PHadesAcc.C:57
 PHadesAcc.C:58
 PHadesAcc.C:59
 PHadesAcc.C:60
 PHadesAcc.C:61
 PHadesAcc.C:62
 PHadesAcc.C:63
 PHadesAcc.C:64
 PHadesAcc.C:65
 PHadesAcc.C:66
 PHadesAcc.C:67
 PHadesAcc.C:68
 PHadesAcc.C:69
 PHadesAcc.C:70
 PHadesAcc.C:71
 PHadesAcc.C:72
 PHadesAcc.C:73
 PHadesAcc.C:74
 PHadesAcc.C:75
 PHadesAcc.C:76
 PHadesAcc.C:77
 PHadesAcc.C:78
 PHadesAcc.C:79
 PHadesAcc.C:80
 PHadesAcc.C:81
 PHadesAcc.C:82
 PHadesAcc.C:83
 PHadesAcc.C:84
 PHadesAcc.C:85
 PHadesAcc.C:86
 PHadesAcc.C:87
 PHadesAcc.C:88
 PHadesAcc.C:89
 PHadesAcc.C:90
 PHadesAcc.C:91
 PHadesAcc.C:92
 PHadesAcc.C:93
 PHadesAcc.C:94
 PHadesAcc.C:95
 PHadesAcc.C:96
 PHadesAcc.C:97
 PHadesAcc.C:98
 PHadesAcc.C:99
 PHadesAcc.C:100
 PHadesAcc.C:101
 PHadesAcc.C:102
 PHadesAcc.C:103
 PHadesAcc.C:104
 PHadesAcc.C:105
 PHadesAcc.C:106
 PHadesAcc.C:107