65 modOn( pSet.getUntrackedParameter<bool>(
"modOn",
true) ),
66 ladOn( pSet.getUntrackedParameter<bool>(
"ladOn",
false) ),
67 layOn( pSet.getUntrackedParameter<bool>(
"layOn",
false) ),
68 phiOn( pSet.getUntrackedParameter<bool>(
"phiOn",
false) ),
69 ringOn( pSet.getUntrackedParameter<bool>(
"ringOn",
false) ),
70 bladeOn( pSet.getUntrackedParameter<bool>(
"bladeOn",
false) ),
71 diskOn( pSet.getUntrackedParameter<bool>(
"diskOn",
false) )
84 LogInfo(
"PixelDQM") <<
"SiPixelHitEfficiencySource constructor" << endl;
93 LogInfo(
"PixelDQM") <<
"SiPixelHitEfficiencySource destructor" << endl;
95 std::map<uint32_t,SiPixelHitEfficiencyModule*>::iterator struct_iter;
97 delete struct_iter->second;
98 struct_iter->second = 0;
103 LogInfo(
"PixelDQM") <<
"SiPixelHitEfficiencySource beginJob()" << endl;
108 LogInfo(
"PixelDQM") <<
"SiPixelHitEfficiencySource beginRun()" << endl;
114 if (
debug_)
LogVerbatim(
"PixelDQM") <<
"TrackerGeometry "<< &(*TG) <<
" size is "<< TG->dets().size() << endl;
117 for (TrackerGeometry::DetContainer::const_iterator pxb = TG->detsPXB().begin();
118 pxb!=TG->detsPXB().end(); pxb++) {
119 if (dynamic_cast<PixelGeomDetUnit*>((*pxb))!=0) {
124 for (TrackerGeometry::DetContainer::const_iterator pxf = TG->detsPXF().begin();
125 pxf!=TG->detsPXF().end(); pxf++) {
126 if (dynamic_cast<PixelGeomDetUnit*>((*pxf))!=0) {
135 for (std::map<uint32_t, SiPixelHitEfficiencyModule*>::iterator pxd =
theSiPixelStructure.begin();
140 else throw cms::Exception(
"LogicError") <<
"SiPixelHitEfficiencySource Folder Creation Failed! ";
144 else throw cms::Exception(
"LogicError") <<
"SiPixelHitEfficiencySource ladder Folder Creation Failed! ";
148 else throw cms::Exception(
"LogicError") <<
"SiPixelHitEfficiencySource layer Folder Creation Failed! ";
152 else throw cms::Exception(
"LogicError") <<
"SiPixelHitEfficiencySource phi Folder Creation Failed! ";
156 else throw cms::Exception(
"LogicError") <<
"SiPixelHitEfficiencySource Blade Folder Creation Failed! ";
160 else throw cms::Exception(
"LogicError") <<
"SiPixelHitEfficiencySource Disk Folder Creation Failed! ";
164 else throw cms::Exception(
"LogicError") <<
"SiPixelHitEfficiencySource Ring Folder Creation Failed! ";
177 LogInfo(
"PixelDQM") <<
"SiPixelHitEfficiencySource endJob()";
183 LogInfo(
"PixelDQM") <<
" - saving histograms to "<< outputFile.data();
199 if(!vertexCollectionHandle.
isValid())
return;
204 reco::VertexCollection::const_iterator bestVtx=vertices.end();
205 for(reco::VertexCollection::const_iterator it=vertices.begin(); it!=vertices.end(); ++it){
206 if(!it->isValid())
continue;
209 (
vtxntrk_==
int(it->tracksSize()) && fabs(
vtxZ_)>fabs(it->z()))){
211 vtxD0_=it->position().rho();
219 if(fabs(it->z())<=20. && fabs(it->position().rho())<=2. && it->ndof()>4)
nvtx_++;
237 std::cout <<
"+++ NEW EVENT +++"<< std::endl;
238 std::cout <<
"Map entries \t : " << ttac.
size() << std::endl;
241 std::set<SiPixelCluster> clusterSet;
250 bool isBpixtrack =
false, isFpixtrack =
false;
251 int nStripHits=0;
int L1hits=0;
int L2hits=0;
int L3hits=0;
int D1hits=0;
int D2hits=0;
252 std::vector<TrajectoryMeasurement> tmeasColl =traj_iterator->measurements();
253 std::vector<TrajectoryMeasurement>::const_iterator tmeasIt;
255 for(tmeasIt = tmeasColl.begin();tmeasIt!=tmeasColl.end();tmeasIt++){
259 uint testSubDetID = (testhit->geographicalId().subdetId());
260 const DetId & hit_detId = testhit->geographicalId();
264 if(layer==1) L1hits++;
265 if(layer==2) L2hits++;
266 if(layer==3) L3hits++;
271 if(disk==1) D1hits++;
272 if(disk==2) D2hits++;
279 if(isBpixtrack || isFpixtrack){
280 if(trackref->pt()<0.6 ||
282 fabs(trackref->dxy(bestVtx->position()))>0.05 ||
283 fabs(trackref->dz(bestVtx->position()))>0.5)
continue;
286 std::cout <<
"isBpixtrack : " << isBpixtrack << std::endl;
287 std::cout <<
"isFpixtrack : " << isFpixtrack << std::endl;
290 for(std::vector<TrajectoryMeasurement>::const_iterator tmeasIt = tmeasColl.begin(); tmeasIt!=tmeasColl.end(); tmeasIt++){
300 const DetId & hit_detId = hit->geographicalId();
302 uint IntSubDetID = (hit_detId.
subdetId());
304 if(IntSubDetID == 0 ){
311 int disk=0;
int layer=0;
int panel=0;
int module=0;
bool isHalfModule=
false;
321 if(fabs(trackref->dxy(bestVtx->position()))>0.01 ||
322 fabs(trackref->dz(bestVtx->position()))>0.1)
continue;
323 if(!(L2hits>0&&L3hits>0) && !(L2hits>0&&D1hits>0) && !(D1hits>0&&D2hits>0))
continue;
325 if(fabs(trackref->dxy(bestVtx->position()))>0.02 ||
326 fabs(trackref->dz(bestVtx->position()))>0.1)
continue;
327 if(!(L1hits>0&&L3hits>0) && !(L1hits>0&&D1hits>0))
continue;
329 if(fabs(trackref->dxy(bestVtx->position()))>0.02 ||
330 fabs(trackref->dz(bestVtx->position()))>0.1)
continue;
331 if(!(L1hits>0&&L2hits>0))
continue;
333 if(fabs(trackref->dxy(bestVtx->position()))>0.05 ||
334 fabs(trackref->dz(bestVtx->position()))>0.5)
continue;
335 if(!(L1hits>0&&D2hits>0) && !(L2hits>0&&D2hits>0))
continue;
337 if(fabs(trackref->dxy(bestVtx->position()))>0.05 ||
338 fabs(trackref->dz(bestVtx->position()))>0.5)
continue;
339 if(!(L1hits>0&&D1hits>0))
continue;
362 if(theGeomDet == 0) {
369 std::map<uint32_t, SiPixelHitEfficiencyModule*>::iterator pxd =
theSiPixelStructure.find((*hit).geographicalId().rawId());
400 if(fabs(lx)>0.55 || fabs(ly)>3.0)
continue;
405 bool passedFiducial=
true;
410 ((module==1 && fabs(ly)<0.7) ||
411 ((module==2 && fabs(ly)<1.1) &&
412 !(disk==-1 && ly>0.8 && lx>0.2) &&
413 !(disk==1 && ly<-0.7 && lx>0.2) &&
414 !(disk==2 && ly<-0.8)) ||
415 ((module==3 && fabs(ly)<1.5) &&
416 !(disk==-2 && lx>0.1 && ly>1.0) &&
417 !(disk==2 && lx>0.1 && ly<-1.0)) ||
418 ((module==4 && fabs(ly)<1.9) &&
419 !(disk==-2 && ly>1.5) &&
420 !(disk==2 && ly<-1.5)))) ||
422 ((module==1 && fabs(ly)<0.7) ||
423 (module==2 && fabs(ly)<1.2 &&
424 !(disk>0 && ly>1.1) &&
425 !(disk<0 && ly<-1.1)) ||
426 (module==3 && fabs(ly)<1.6 &&
427 !(disk>0 && ly>1.5) &&
428 !(disk<0 && ly<-1.5)))))) passedFiducial=
false;
430 ((panel==1 && (module==1 || (module>=3 &&
abs(disk)==1))) ||
431 (panel==2 && ((module==1 &&
abs(disk)==2) ||
432 (module==3 &&
abs(disk)==1))))) passedFiducial=
false;
434 double ly_mod = fabs(ly);
436 float d_rocedge = fabs(fmod(ly_mod,0.81)-0.405);
437 if(d_rocedge<=0.0625) passedFiducial=
false;
439 ((!isHalfModule && fabs(lx)<0.6) ||
440 (isHalfModule && lx>-0.3 && lx<0.2))) ||
443 ((module==1 && fabs(lx)<0.2) ||
445 ((fabs(lx)<0.55 &&
abs(disk)==1) ||
446 (lx>-0.5 && lx<0.2 && disk==-2) ||
447 (lx>-0.5 && lx<0.0 && disk==2))) ||
448 (module==3 && lx>-0.6 && lx<0.5) ||
449 (module==4 && lx>-0.3 && lx<0.15))) ||
451 ((module==1 && fabs(lx)<0.6) ||
453 ((fabs(lx)<0.55 &&
abs(disk)==1) ||
454 (lx>-0.6 && lx<0.5 &&
abs(disk)==2))) ||
455 (module==3 && fabs(lx)<0.5))))))) passedFiducial=
false;
458 fabs(lx)<0.06) passedFiducial=
false;
462 float dx_cl[2];
float dy_cl[2]; dx_cl[0]=dx_cl[1]=dy_cl[0]=dy_cl[1]=-9999.;
474 if(clusterCollectionHandle.
isValid()){
477 float minD[2]; minD[0]=minD[1]=10000.;
478 for( ; itClusterSet!=clusterCollection.
end(); itClusterSet++){
479 DetId detId(itClusterSet->
id());
480 if(detId.rawId()!=hit->geographicalId().rawId())
continue;
484 for( ; itCluster!=itClusterSet->
end(); ++itCluster){
485 LocalPoint lp(itCluster->x(), itCluster->y(), 0.);
488 float D =
sqrt((lp.
x()-lx)*(lp.
x()-lx)+(lp.
y()-ly)*(lp.
y()-ly));
503 for(
size_t i=0;
i<2;
i++){
505 dx_cl[
i]=fabs(dx_cl[
i]-lx);
506 dy_cl[
i]=fabs(dy_cl[
i]-ly);
513 float d_cl[2]; d_cl[0]=d_cl[1]=-9999.;
514 if(dx_cl[0]!=-9999. && dy_cl[0]!=-9999.) d_cl[0]=
sqrt(dx_cl[0]*dx_cl[0]+dy_cl[0]*dy_cl[0]);
515 if(dx_cl[1]!=-9999. && dy_cl[1]!=-9999.) d_cl[1]=
sqrt(dx_cl[1]*dx_cl[1]+dy_cl[1]*dy_cl[1]);
516 if(isHitMissing && (d_cl[0]<0.05 || d_cl[1]<0.05)){ isHitMissing=0; isHitValid=1; }
520 std::cout <<
"Ready to add hit in histogram:\n";
522 std::cout <<
"isHitValid: "<<isHitValid<<std::endl;
523 std::cout <<
"isHitMissing: "<<isHitMissing<<std::endl;
int plaquetteName() const
plaquetteId (in pannel)
T getParameter(std::string const &) const
~SiPixelHitEfficiencySource()
T getUntrackedParameter(std::string const &, T const &) const
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
SiPixelHitEfficiencySource(const edm::ParameterSet &)
const LocalTrajectoryParameters & localParameters() const
friend struct const_iterator
const_iterator end() const
last iterator over the map (read only)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
#define DEFINE_FWK_MODULE(type)
LocalPoint localPosition() const
virtual void analyze(const edm::Event &, const edm::EventSetup &)
edm::EDGetTokenT< edmNew::DetSetVector< SiPixelCluster > > clusterCollectionToken_
std::map< uint32_t, SiPixelHitEfficiencyModule * > theSiPixelStructure
std::vector< Vertex > VertexCollection
collection of Vertex objects
data_type const * const_iterator
id_type id(size_t cell) const
std::pair< LocalPoint, LocalError > LocalValues
edm::EDGetTokenT< reco::VertexCollection > vertexCollectionToken_
virtual void endJob(void)
bool isHalfModule() const
full or half module
virtual void beginRun(const edm::Run &r, edm::EventSetup const &iSetup)
edm::EDGetTokenT< TrajTrackAssociationCollection > tracksrc_
Abs< T >::type abs(const T &t)
void save(const std::string &filename, const std::string &path="", const std::string &pattern="", const std::string &rewrite="", const uint32_t run=0, SaveReferenceTag ref=SaveWithReference, int minStatus=dqm::qstatus::STATUS_OK, const std::string &fileupdate="RECREATE")
int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
virtual const GeomDet * idToDet(DetId) const
size_type size() const
map size
key_type key() const
Accessor for product key.
int layerName() const
layer id
T const * product() const
T const * product() const
virtual const GeomDetUnit * idToDetUnit(DetId) const
Return the pointer to the GeomDetUnit corresponding to a given DetId.
const_iterator end(bool update=true) const
int pannelName() const
pannel id
int diskName() const
disk id
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
const_iterator begin() const
first iterator over the map (read only)
volatile std::atomic< bool > shutdown_flag false
const_iterator begin(bool update=true) const
DecomposeProduct< arg, typename Div::arg > D
virtual LocalValues localParameters(const T &, const GeomDetUnit &) const
bool setModuleFolder(const uint32_t &rawdetid=0, int type=0)
Set folder name for a module or plaquette.