7 #include <EVENT/LCCollection.h>
8 #include <UTIL/LCTOOLS.h>
9 #include <UTIL/Operators.h>
11 #define _USE_MATH_DEFINES
14 #include "marlin/VerbosityLevels.h"
21 #include "TMVA/Reader.h"
23 #include <TLorentzVector.h>
24 #include <CLHEP/Vector/LorentzVector.h>
29 #include "UTIL/LCRelationNavigator.h"
30 #include "EVENT/LCIO.h"
31 #include "marlin/Exceptions.h"
33 #include <EVENT/MCParticle.h>
34 #include <EVENT/SimTrackerHit.h>
35 #include <EVENT/ReconstructedParticle.h>
36 #include "IMPL/ReconstructedParticleImpl.h"
37 #include "IMPL/LCCollectionVec.h"
39 #include "IMPL/LCCollectionVec.h"
42 using namespace lcio ;
43 using namespace marlin ;
44 using namespace CLHEP ;
55 registerInputCollection( LCIO::RECONSTRUCTEDPARTICLE,
56 "InputJetCollection" ,
57 "Input collection of jets",
59 std::string(
"NewJets"));
62 registerInputCollection( LCIO::MCPARTICLE,
63 "InputMCPCollection" ,
64 "Input collection of MCParticles",
66 std::string(
"MCParticlesSkimmed"));
73 streamlog_out(DEBUG) <<
" " << std::endl ;
101 static int counter_events=0;
102 static int counter_alpha = 0;
103 static int counter_energy = 0;
104 static int counter_theta = 0;
115 float quark_theta[4];
132 for(
int i=0; i<4; i++){
158 int nJETS = jetcol->getNumberOfElements() ;
160 if (nJETS != 4)
return;
162 for(
int i=0; i<
nJETS ; i++){
165 ReconstructedParticle* j =
dynamic_cast<ReconstructedParticle*
>( jetcol->getElementAt( i ) ) ;
169 jet_px[i]=j->getMomentum()[0];
170 jet_py[i]=j->getMomentum()[1];
171 jet_pz[i]=j->getMomentum()[2];
172 jet_ene[i]=j->getEnergy();
175 jet_ptot[i]=sqrt(pow(jet_px[i], 2)+pow(jet_py[i], 2)+pow(jet_pz[i], 2));
184 for(
int e=6;
e<10 ;
e++){
186 MCParticle* q =
dynamic_cast<MCParticle*
>( mcpcol->getElementAt(
e ) ) ;
190 quark_px[
e-6]=q->getMomentum()[0];
191 quark_py[
e-6]=q->getMomentum()[1];
192 quark_pz[
e-6]=q->getMomentum()[2];
193 quark_ene[
e-6]=q->getEnergy();
195 quark_ptot[
e-6]=sqrt(pow(quark_px[
e-6], 2)+pow(quark_py[
e-6], 2)+pow(quark_pz[
e-6], 2));
204 int counter_jets = 0;
209 Float_t alpha_min = 9999;
214 for(
int i=0; i<4; i++){
215 energy+=quark_ene[i];
221 for (
int index1=0; index1<4; index1++) {
222 for (
int index2=0; index2<4; index2++) {
223 if (index2 != index1) {
224 for (
int index3=0; index3<4; index3++) {
225 if ((index3 != index2) && (index3 != index1)) {
226 for (
int index4=0; index4<4; index4++) {
227 if ((index4 != index3) && (index4 != index2) && (index4 != index1)) {
228 quark[0][
iperm]=index1;
229 quark[1][
iperm]=index2;
230 quark[2][
iperm]=index3;
231 quark[3][
iperm]=index4;
245 for(
int n = 0; n <
iperm; n++){
247 for (
int ijet=0; ijet<4; ijet++) {
248 alpha[n]+= acos(((jet_px[jet[ijet][n]]*quark_px[quark[ijet][n]])+(jet_py[jet[ijet][n]]*quark_py[quark[ijet][n]])+(jet_pz[jet[ijet][n]]*quark_pz[quark[ijet][n]]))/(jet_ptot[jet[ijet][n]]*quark_ptot[quark[ijet][n]]));
250 if(alpha[n] < alpha_min){
251 alpha_min = alpha[n];
262 for(
int ijet = 0; ijet<4; ijet++){
267 quark_theta[ijet] = atan((sqrt((pow(quark_px[quark[ijet][iperm_min]],2))+(pow(quark_py[quark[ijet][iperm_min]],2))))/quark_pz[quark[ijet][iperm_min]]);
268 jet_theta[ijet] = atan((sqrt((pow(jet_px[jet[ijet][iperm_min]],2))+(pow(jet_py[jet[ijet][iperm_min]],2))))/jet_pz[jet[ijet][iperm_min]]);
269 if(quark_theta[ijet] < 0){
270 quark_theta[ijet] = M_PI+quark_theta[ijet];
272 if(jet_theta[ijet] < 0){
273 jet_theta[ijet] = M_PI+jet_theta[ijet];
276 if(((quark_theta[ijet] > 0.14) && (quark_theta[ijet]<3)) &&((jet_theta[ijet] > 0.14) && (jet_theta[ijet]<3)) ){
281 throw marlin::SkipEventException(
this);
287 throw marlin::SkipEventException(
this);
291 throw marlin::SkipEventException(
this);
294 if(counter_jets == 4){
299 streamlog_out(DEBUG) <<
"Counter_events: " << counter_events << std::endl ;
300 streamlog_out(DEBUG) <<
"Counter_energy: " << counter_energy << std::endl ;
301 streamlog_out(DEBUG) <<
"Counter_alpha: " << counter_alpha << std::endl ;
302 streamlog_out(DEBUG) <<
"Counter_theta: " << counter_theta << std::endl ;
305 streamlog_out(DEBUG) <<
"Event: " << evt->getEventNumber() << std::endl ;
322 std::cout <<
"Finish run" <<std::endl;
QuarkJetPairing aQuarkJetPairing
virtual void check(LCEvent *evt)
virtual void processRunHeader(LCRunHeader *run)
Processor for marlin to find the smallest deviation between reconstructed jets and jet initialized qu...
std::string _inputJetCollection
virtual void processEvent(LCEvent *evt)
std::string _inputMCPCollection