//root script //reads a file with a charge distribution. Steered by a given _Rate this //charge is normalized to one drift step, then displaced and copied. //For monitoring purposes the first 120 drift-steps are written to files //in steps of 10. //Author: Felix { #include #include #include #include std::string _Output = "Drifted_chargeDens6.dat"; std::string _MonitorOut = "ChargeDens6_"; std::string _SingleBinOut = "singleBin6.dat"; std::ofstream singleoutfile(_SingleBinOut.c_str(), std::fstream::out); int _EventsSimInInput = 10000; std::string _Input = "chargeDens6.dat"; int _EventsToSim = 4e6; double _Rate = 2e-2; double _IonDriftVel = 1.766e-6; int drift_control = 0; //keep track of the number of drift-steps double minR; double segR; int nSegR; double minZ; double segZ; int nSegZ; std::ifstream infile(_Input.c_str(), std::fstream::in); if (!infile.good()) { std::cerr<<"Not Existing"<>minR>>segR>>nSegR>>minZ>>segZ>>nSegZ; //# of events needed to drift through one segment double evtsSeg = segZ/_IonDriftVel*_Rate; //read charge density double chargeDensOld[nSegR][nSegZ]; for (int nr=0; nr>chargeDensOld[nr][nz]; //normalize the charge to the amount expected for the number of //events needed for one drift-step chargeDensOld[nr][nz] = chargeDensOld[nr][nz]/_EventsSimInInput*evtsSeg; } infile.close(); double chargeDens[nSegR][nSegZ]; for (int nr=0; nr0; nz--) chargeDens[nr][nz] = chargeDens[nr][nz-1]; //the segments in front of the gems are emptied for (int nr=0; nr