Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions WCSim.cc
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
#include "G4ios.hh"
#include "G4RunManager.hh"
#include "G4UImanager.hh"
#include "G4UIterminal.hh"
#include "G4UItcsh.hh"
#include "WCSimDetectorConstruction.hh"
#include "WCSimPhysicsListFactory.hh"
#include "WCSimPhysicsListFactoryMessenger.hh"
Expand All @@ -17,6 +12,13 @@
#include "WCSimVisManager.hh"
#include "WCSimRandomParameters.hh"

#include "G4ios.hh"
#include "G4RunManager.hh"
#include "G4UImanager.hh"
#include "G4UIterminal.hh"
#include "G4UItcsh.hh"
#include "G4VisManager.hh"


#ifdef G4UI_USE
#include "G4UIExecutive.hh"
Expand Down Expand Up @@ -95,8 +97,10 @@ int main(int argc,char** argv)
runManager->SetUserInitialization(physFactory);

// Visualization
#ifdef G4VIS_USE
G4VisManager* visManager = new WCSimVisManager;
visManager->Initialize();
#endif

// Set user action classes
WCSimPrimaryGeneratorAction* myGeneratorAction = new
Expand Down Expand Up @@ -162,7 +166,9 @@ int main(int argc,char** argv)

}

#ifdef G4VIS_USE
delete visManager;
#endif

delete runManager;
return 0;
Expand Down
25 changes: 13 additions & 12 deletions include/WCSimWCDigi.hh
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,6 @@
//for less_equal, bind2nd,...
#include <functional>

// compose2 is not part of the C++ standard
#include <ext/functional>
using __gnu_cxx::compose2;



class WCSimWCDigi : public G4VDigi
{
Expand Down Expand Up @@ -229,13 +224,19 @@ public:
std::vector<G4double>::iterator tfirst = time_double.begin();
std::vector<G4double>::iterator tlast = time_double.end();

std::vector<G4double>::iterator found =
std::find_if(tfirst,tlast,
compose2(std::logical_and<bool>(),
std::bind2nd(std::greater_equal<G4double>(),low),
std::bind2nd(std::less_equal<G4double>(),upevent)
)
);
// std::vector<G4double>::iterator found =
// std::find_if(tfirst,tlast,
// compose2(std::logical_and<bool>(),
// std::bind2nd(std::greater_equal<G4double>(),low),
// std::bind2nd(std::less_equal<G4double>(),upevent)
// )
// );

std::vector<G4double>::iterator found =
std::find_if(tfirst,tlast, [&](G4double& element_){
return element_ >= low and element_ <= upevent;
});

if ( found != tlast ) {
firsttime = *found; // first hit time
}
Expand Down
37 changes: 2 additions & 35 deletions include/WCSimWCHit.hh
Original file line number Diff line number Diff line change
Expand Up @@ -12,29 +12,6 @@
//for less_equal, bind2nd,...
#include <functional>

// compose2 is not part of the C++ standard
// use this kludgy technique to use it
#include <ext/functional>
using __gnu_cxx::identity_element;
using __gnu_cxx::unary_compose;
using __gnu_cxx::binary_compose;
using __gnu_cxx::compose1;
using __gnu_cxx::compose2;
using __gnu_cxx::identity;
using __gnu_cxx::select1st;
using __gnu_cxx::select2nd;
using __gnu_cxx::project1st;
using __gnu_cxx::project2nd;
using __gnu_cxx::constant_void_fun;
using __gnu_cxx::constant_unary_fun;
using __gnu_cxx::constant_binary_fun;
using __gnu_cxx::constant0;
using __gnu_cxx::constant1;
using __gnu_cxx::constant2;
using __gnu_cxx::subtractive_rng;
using __gnu_cxx::mem_fun1;
using __gnu_cxx::mem_fun1_ref;



class WCSimWCHit : public G4VHit
Expand Down Expand Up @@ -112,12 +89,7 @@ class WCSimWCHit : public G4VHit
std::vector<G4double>::iterator tlast = time.end();

std::vector<G4double>::iterator found =
std::find_if(tfirst,tlast,
compose2(std::logical_and<bool>(),
std::bind2nd(std::greater_equal<G4double>(),low),
std::bind2nd(std::less_equal<G4double>(),upevent)
)
);
std::find_if(tfirst,tlast,[&](G4double& t_){ return t_ >= low and t_ <= upevent; });
if ( found != tlast ) {
firsttime = *found; // first hit time
}
Expand All @@ -141,12 +113,7 @@ class WCSimWCHit : public G4VHit

// return number of hits in the time window...

G4int number = std::count_if(tfirst,tlast,
compose2(std::logical_and<bool>(),
std::bind2nd(std::greater_equal<G4double>(),low),
std::bind2nd(std::less_equal<G4double>(),mintime)
)
);
G4int number = std::count_if(tfirst,tlast, [&](G4double& t_){ return (t_ >= low and t_ <= mintime); });

totalPeInGate = number;
// G4cout << "numer = " << number <<"\n";
Expand Down
Loading