| 
		
			| Event filter II [message #17484] | Mon, 10 November 2014 07:48  |  
			| 
				
				
					|  donghee Messages: 385
 Registered: January 2009
 Location: Germnay
 | first-grade participant | From: *dip0.t-ipconnect.de 
 |  |  
	| Hi Martin, 
 I am not trying to sort events for pi+pi- or pi+pi-pi0 at DPM
 
 I tried with below to get pi+pi-
 Quote:
 FairEvtFilterOnSingleParticleCounts* fil= new FairEvtFilterOnSingleParticleCounts("fil");
 fil->AndMinMaxPdgCodes(1,1,211,-211);
 primGen->AndFilter(fil);
 
 
 Bet in the MCinfo the inital particles are not only pi+pi- as I expected.
 pi+pi- plus some extras are in the entry. That means that the concept is wrong for pi+pi- selection.
 
 
 Therefore I tried to do with one more constrain.
 Quote:
 FairEvtFilterOnSingleParticleCounts* fil= new FairEvtFilterOnSingleParticleCounts("fil");
 fil->AndMinMaxPdgCodes(1,1,211,-211);
 fil->AndMaxAllParticles(2);
 primGen->AndFilter(fil);
 
 I used maximum allowed particles as 2, but unfortunately happens the crash with following message
 Quote:
 ===========================================================
 #5  0x00002b86e240184e in TDatabasePDG::GetParticle(int) const ()
 from /cvmfs/fairroot.gsi.de/fairsoft/apr13/lib/root/libEG.so
 #6  0x00002b86ea00a624 in FairEvtFilter::GetCharge (this=0x1af0780,
 inPdgCode=211, pdgCodeCharge=0x7fffa99d6870)
 at  /hera/panda/donghee/pandaroot/pandaroot_oct14/pgenerators/eventFilter/Fa irEvtFilter.cxx:64
 #7  0x00002b86ea00daf8 in FairEvtFilterOnSingleParticleCounts::CountCharge (
 this=0x1af0780, particle=0xce27f00)
 at  /hera/panda/donghee/pandaroot/pandaroot_oct14/pgenerators/eventFilter/Fa irEvtFilterOnSinglePa
 rticleCounts.cxx:524
 #8  0x00002b86ea00e002 in FairEvtFilterOnSingleParticleCounts::EventMatches (
 this=0x1af0780, evtNr=1)
 at  /hera/panda/donghee/pandaroot/pandaroot_oct14/pgenerators/eventFilter/Fa irEvtFilterOnSinglePa
 rticleCounts.cxx:612
 #9  0x00002b86ea00758c in FairFilteredPrimaryGenerator::GenerateEvent (
 this=0x1ae2d70, pStack=0x5804450)
 at  /hera/panda/donghee/pandaroot/pandaroot_oct14/pgenerators/eventFilter/Fa irFilteredPrimaryGene
 rator.cxx:187
 #10 0x00002b86e513d5a1 in FairMCApplication::GeneratePrimaries (this=0x1b3d010)
 at  /hera/panda/donghee/pandaroot/pandaroot_oct14/base/sim/FairMCApplication .cxx:792
 #11 0x00002b86ea7aabf3 in g3trig_ ()
 from /cvmfs/fairroot.gsi.de/fairsoft/apr13/lib/libgeant321.so
 #12 0x00002b86eaaf7e4c in TGeant3::ProcessRun(int) ()
 from /cvmfs/fairroot.gsi.de/fairsoft/apr13/lib/libgeant321.so
 #13 0x00002b86e513a8f0 in FairMCApplication::RunMC (this=0x1b3d010,
 nofEvents=1000)
 at  /hera/panda/donghee/pandaroot/pandaroot_oct14/base/sim/FairMCApplication .cxx:246
 #14 0x00002b86e512aed0 in FairRunSim::Run (this=0x17dbf10, NEvents=1000,
 NotUsed=0)
 at  /hera/panda/donghee/pandaroot/pandaroot_oct14/base/steer/FairRunSim.cxx: 372
 ===========================================================
 
 
 Do you have an idea or simple solution to aviod this problem?
 Best wishes,
 Donghee
 
 |  
	|  |  | 
	| 
		
			| Re: Event filter II [message #17486 is a reply to message #17484] | Mon, 10 November 2014 10:58   |  
			| 
				
				
					|  MartinJGaluska Messages: 203
 Registered: March 2010
 Location: Germany
 | first-grade participant | From: *pool.mediaWays.net 
 |  |  
	| Good morning Donghee, 
 thanks for reporting the crash. It occured in the code that finds the charge for a certain pdg code. I will have to look into the problem as this code was definitely working when I last tested the event filter code.
 
 The first issue you reported is a misconception of what the following code does.
 Quote:
 FairEvtFilterOnSingleParticleCounts* fil= new FairEvtFilterOnSingleParticleCounts("fil");
 fil->AndMinMaxPdgCodes(1,1,211,-211);
 primGen->AndFilter(fil);
 
 
 Please have a look at the tutorial (section "Pdg Codes") or the comments inside the source code.
 
 
 
//////////////////
71	        // User interfaces -- Pdg Code Min and Max
72	        //////////////////
73	        // Use this for grouping up to 8 pdgCodes into 1 groupId
74	        // all particles belonging to the groupId are regarded as being indistinguishable
75	        // min defines how many particles you want in your events AT LEAST
76	        // max defines how many particles you want in your events AT MOST
77	        // the min and max numbers are used for all particles with one of the above pdgCodes
78	        // returns kTRUE if the filter was added, otherwise returns kFALSE
79	        Bool_t AndMinMaxPdgCodes( Int_t min, Int_t max, Int_t pdgCode1, Int_t pdgCode2=kInvalidPdgCode, Int_t pdgCode3=kInvalidPdgCode, Int_t pdgCode4=kInvalidPdgCode, Int_t pdgCode5=kInvalidPdgCode, Int_t pdgCode6=kInvalidPdgCode, Int_t pdgCode7=kInvalidPdgCode, Int_t pdgCode8=kInvalidPdgCode );
80
 In short your code is asking that exactly one (pi- OR pi+) is present in the events. Nothing else.
 
 The second suggestion is a bit more correct as you also ask for exactly 2 particles to be present in the events, but it is still not what you want. Here is the code that should do what you ask for:
 
 
 FairEvtFilterOnSingleParticleCounts* fil= new FairEvtFilterOnSingleParticleCounts("fil");
fil->AndMinMaxPdgCodes(1,1,211); // exactly one pi+ in primary particles
fil->AndMinMaxPdgCodes(1,1,-211); // exactly one pi- in primary particles
fil->AndMinMaxAllParticles(2,2); // exactly 2 primary particles in event
primGen->AndFilter(fil);
 I assume that will also lead to a crash as long as I have not fixed the issue in FairEvtFilter::GetCharge.
 
 Kind regards,
 Martin
 [Updated on: Mon, 10 November 2014 11:01] Report message to a moderator |  
	|  |  | 
	|  | 
	|  | 
	|  | 
	|  | 
	|  | 
	| 
		
			| Re: Event filter II [message #17499 is a reply to message #17498] | Tue, 11 November 2014 09:27  |  
			| 
				
				
					|  Elisabetta Prencipe (2) Messages: 214
 Registered: February 2013
 | first-grade participant | From: *cern.ch 
 |  |  
	| Hi Martin, 
 it lookes that in the release oct13 I do not get any more troubles with the digi macro, now.
 
 Thank you for your help and suggestion,
 
 Elisabetta
 |  
	|  |  |