@@ -919,7 +919,7 @@ struct AnalysisPrefilterSelection {
919919 Configurable<std::string> fConfigPrefilterPairCut {" cfgPrefilterPairCut" , " " , " Prefilter pair cut" };
920920 Configurable<std::string> fConfigTrackCuts {" cfgTrackCuts" , " " , " Track cuts for which to run the prefilter" };
921921 // Track related options
922- Configurable<bool > fPropTrack {" cfgPropTrack" , true , " Propgate tracks to associated collision to recalculate DCA and momentum vector" };
922+ Configurable<bool > fPropTrack {" cfgPropTrack" , false , " Propgate tracks to associated collision to recalculate DCA and momentum vector" };
923923
924924 std::map<uint32_t , uint32_t > fPrefilterMap ;
925925 AnalysisCompositeCut* fPairCut ;
@@ -934,23 +934,39 @@ struct AnalysisPrefilterSelection {
934934 return ;
935935 }
936936
937+ bool runPrefilter = true ;
937938 // get the list of track cuts to be prefiltered
938939 TString trackCutsStr = fConfigTrackCuts .value ;
939940 TObjArray* objArrayTrackCuts = nullptr ;
940941 if (!trackCutsStr.IsNull ()) {
941942 objArrayTrackCuts = trackCutsStr.Tokenize (" ," );
943+ if (objArrayTrackCuts == nullptr ) {
944+ runPrefilter = false ;
945+ }
946+ } else {
947+ LOG (warn) << " No track cuts to prefilter! Prefilter will not be run" ;
948+ runPrefilter = false ;
949+ }
950+ // get the cut to be used as loose selection
951+ TString prefilterTrackCutStr = fConfigPrefilterTrackCut .value ;
952+ if (prefilterTrackCutStr.IsNull ()) {
953+ LOG (warn) << " No prefilter loose selection specified! Prefilter will not be run" ;
954+ runPrefilter = false ;
942955 }
943956
944- // get the list of cuts that were computed in the barrel track-selection task and create a bit mask
945- // to mark just the ones we want to apply a prefilter on
946957 fPrefilterMask = 0 ;
947958 fPrefilterCutBit = -1 ;
948- string trackCuts;
949- getTaskOptionValue<string>(context, " analysis-track-selection" , " cfgTrackCuts" , trackCuts, false );
950- TString allTrackCutsStr = trackCuts;
951- TString prefilterTrackCutStr = fConfigPrefilterTrackCut .value ;
952- if (!trackCutsStr.IsNull ()) {
959+ if (runPrefilter) {
960+ // get the list of cuts that were computed in the barrel track-selection task and create a bit mask
961+ // to mark just the ones we want to apply a prefilter on
962+ string trackCuts;
963+ getTaskOptionValue<string>(context, " analysis-track-selection" , " cfgTrackCuts" , trackCuts, false );
964+ TString allTrackCutsStr = trackCuts;
965+
953966 std::unique_ptr<TObjArray> objArray (allTrackCutsStr.Tokenize (" ," ));
967+ if (objArray == nullptr ) {
968+ LOG (fatal) << " Not getting any track cuts from the barrel-track-selection " ;
969+ }
954970 if (objArray->FindObject (prefilterTrackCutStr.Data ()) == nullptr ) {
955971 LOG (fatal) << " Prefilter track cut not among the cuts calculated by the track-selection task! " ;
956972 }
@@ -963,18 +979,15 @@ struct AnalysisPrefilterSelection {
963979 fPrefilterCutBit = icut;
964980 }
965981 }
982+ // setup the prefilter pair cut
983+ fPairCut = new AnalysisCompositeCut (true );
984+ TString pairCutStr = fConfigPrefilterPairCut .value ;
985+ if (!pairCutStr.IsNull ()) {
986+ fPairCut = dqcuts::GetCompositeCut (pairCutStr.Data ());
987+ }
966988 }
967- // NOTE: If no prefilter loose cut is specified to be "prefiltered" or no track cuts are asked to be prefiltered,
968- // then make a warning. In the processing, the produced table will just lead to a neutral behaviour (no prefilter applied)
969989 if (fPrefilterMask == static_cast <uint32_t >(0 ) || fPrefilterCutBit < 0 ) {
970- LOG (warn) << " No loose cut or track cuts for prefiltering are specified. This task will do nothing." ;
971- }
972-
973- // setup the prefilter pair cut
974- fPairCut = new AnalysisCompositeCut (true );
975- TString pairCutStr = fConfigPrefilterPairCut .value ;
976- if (!pairCutStr.IsNull ()) {
977- fPairCut = dqcuts::GetCompositeCut (pairCutStr.Data ());
990+ LOG (warn) << " No specified loose cut or track cuts for prefiltering. This task will do nothing." ;
978991 }
979992
980993 VarManager::SetUseVars (AnalysisCut::fgUsedVars); // provide the list of required variables so that VarManager knows what to fill
@@ -1039,18 +1052,26 @@ struct AnalysisPrefilterSelection {
10391052 runPrefilter<gkTrackFillMap>(event, groupedAssocs, tracks);
10401053 }
10411054 }
1055+
10421056 uint32_t mymap = -1 ;
1043- for (auto & assoc : assocs) {
1044- auto track = assoc.template reducedtrack_as <MyBarrelTracks>();
1045- mymap = -1 ;
1046- // If cuts were not configured, then produce a map with all 1's
1047- if (fPrefilterCutBit < 0 || fPrefilterMask == 0 ) {
1048- prefilter (mymap);
1049- } else if (fPrefilterMap .find (track.globalIndex ()) != fPrefilterMap .end ()) {
1050- // NOTE: publish the bitwise negated bits (~), so there will be zeroes for cuts that failed the prefiltering and 1 everywhere else
1051- mymap = ~fPrefilterMap [track.globalIndex ()];
1057+ // If cuts were not configured, then produce a map with all 1's and publish it for all associations
1058+ if (fPrefilterCutBit < 0 || fPrefilterMask == 0 ) {
1059+ for (int i = 0 ; i < assocs.size (); ++i) {
10521060 prefilter (mymap);
10531061 }
1062+ } else {
1063+ for (auto & assoc : assocs) {
1064+ // TODO: just use the index from the assoc (no need to cast the whole track)
1065+ auto track = assoc.template reducedtrack_as <MyBarrelTracks>();
1066+ mymap = -1 ;
1067+ if (fPrefilterMap .find (track.globalIndex ()) != fPrefilterMap .end ()) {
1068+ // NOTE: publish the bitwise negated bits (~), so there will be zeroes for cuts that failed the prefiltering and 1 everywhere else
1069+ mymap = ~fPrefilterMap [track.globalIndex ()];
1070+ prefilter (mymap);
1071+ } else {
1072+ prefilter (mymap); // track did not pass the prefilter selections, so publish just 1's
1073+ }
1074+ }
10541075 }
10551076 }
10561077
0 commit comments