14 #include "CLHEP/Random/RandGaussQ.h"
15 #include "CLHEP/Random/RandFlat.h"
24 produces<ME0DigiPreRecoCollection>();
27 if (!rng.isAvailable()){
29 <<
"ME0ReDigiProducer::ME0PreRecoDigiProducer() - RandomNumberGeneratorService is not present in configuration file.\n"
30 <<
"Add the service in the configuration file or remove the modules that require it.";
67 <<
"Extracting central TOFs:" << std::endl;
71 if (detId.chamber() != 1
or detId.region() != 1)
continue;
73 const GlobalPoint centralGP(roll->toGlobal(centralLP));
74 const float centralTOF(centralGP.mag() / 29.98);
77 <<
"ME0DetId " << detId <<
" central TOF " << centralTOF << std::endl;
103 CLHEP::HepRandomEngine* engine)
124 auto digis = input_digis.get(detId);
125 for (
auto d = digis.first;
d != digis.second; ++
d) {
128 <<
"Check detId " << detId <<
" digi " << me0Digi << std::endl;
136 if (CLHEP::RandFlat::shoot(engine) >
instLumi_*1.0/5)
continue;
139 <<
"\tPassed selection" << std::endl;
142 float newTof(me0Digi.
tof());
148 if(detId.roll() == 0) index =
nPartitions_ * (detId.layer() -1) + detId.roll();
150 <<
"size "<<
centralTOF_.size()<<
" nPartitions "<<
nPartitions_<<
" layer "<<detId.layer()<<
" roll "<<detId.roll()<<
" index "<<index<<std::endl;
153 const float correctedNewTof(newTof - t0);
156 <<
" t0 "<< t0 <<
" originalTOF " << me0Digi.
tof() <<
"\tnew TOF " << newTof <<
" corrected new TOF " << correctedNewTof << std::endl;
159 float newTime = correctedNewTof;
162 if (-12.5 + iBunch*25 < newTime and newTime <= 12.5 + iBunch*25){
163 newTime = iBunch * 25;
170 <<
"\tBX " << newTime << std::endl;
176 const std::vector<float>
parameters(roll->specs()->parameters());
180 const float oldR(oldGP.perp());
188 LocalPoint radialSmearedLP = roll->toLocal(radialSmearedGP);
192 float newLPy = radialSmearedLP.
y();
194 newLPy = CLHEP::RandGaussQ::shoot(engine, radialSmearedLP.
y(), targetYResolution);
197 LocalPoint newLP(radialSmearedLP.
x(), newLPy, radialSmearedLP.
z());
201 int newRoll = detId.roll();
202 if (newLP.y() > height) --newRoll;
203 if (newLP.y() < -height) ++newRoll;
205 if (newRoll != detId.roll()){
208 newRoll = detId.roll();
216 if (!newPart
or newRoll == detId.roll()){
219 if (newLP.y() > height) newLP =
LocalPoint(newLP.x(), height, newLP.z());
220 if (newLP.y() < -height) newLP =
LocalPoint(newLP.x(), -height, newLP.z());
223 newLP = newPart->
toLocal(newGP);
232 float newLPx = newLP.x();
234 newLPx = CLHEP::RandGaussQ::shoot(engine, newLP.x(), targetXResolution);
237 newLP =
LocalPoint(newLPx, newLP.y(), newLP.z());
239 float newY(newLP.y());
243 <<
"\tnew Y " << newY << std::endl;
245 float newX(newLP.x());
247 <<
"\tnew X " << newX << std::endl;
250 int strip(newPart->
strip(newLP));
251 float stripF(
float(strip) - 0.5);
255 <<
"\t\tdiscretized X " << newX << std::endl;
261 output_digis.insertDigi(newPart->
id(), out_digi);
270 double rollRadius = top_->radius();
271 double Rmax = rollRadius+height;
272 double Rx = rollRadius+
y;
const ME0EtaPartitionSpecs * specs() const
T getParameter(std::string const &) const
bool reDigitizeNeutronBkg_
void buildDigis(const ME0DigiPreRecoCollection &, ME0DigiPreRecoCollection &, CLHEP::HepRandomEngine *engine)
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
double correctSigmaU(const ME0EtaPartition *roll, double y)
static const int maxRollId
edm::Service< edm::RandomNumberGenerator > rng
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventIDconst &, edm::Timestampconst & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
bool getByToken(EDGetToken token, Handle< PROD > &result) const
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
const ME0Specs & parameters() const
virtual ~ME0ReDigiProducer()
LocalPoint toLocal(const GlobalPoint &gp) const
Conversion to the R.F. of the GeomDet.
LocalPoint centreOfStrip(int strip) const
float strip(const LocalPoint &lp) const
const ME0EtaPartition * etaPartition(ME0DetId id) const
Return a etaPartition given its id.
virtual CLHEP::HepRandomEngine & getEngine(StreamID const &)=0
Use this engine in event methods.
const ME0Geometry * geometry_
edm::EDGetTokenT< ME0DigiPreRecoCollection > token_
MuonDigiCollection< ME0DetId, ME0DigiPreReco > ME0DigiPreRecoCollection
Abs< T >::type abs(const T &t)
bool reDigitizeOnlyMuons_
const std::vector< ME0EtaPartition const * > & etaPartitions() const
Return a vector of all ME0 eta partitions.
T const * product() const
std::vector< double > centralTOF_
const Topology & topology() const
ME0ReDigiProducer(const edm::ParameterSet &ps)
StreamID streamID() const
const double Rmax[kNumberCalorimeter]
virtual void produce(edm::Event &, const edm::EventSetup &) override
virtual void beginRun(const edm::Run &, const edm::EventSetup &) override